Various updates for split transactions.

This commit is contained in:
James Cole
2016-05-12 22:44:31 +02:00
parent cfcc4ce88a
commit d7ab482ae1
9 changed files with 285 additions and 223 deletions

View File

@@ -15,11 +15,11 @@ use FireflyIII\Crud\Split\JournalInterface;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\SplitJournalFormRequest; use FireflyIII\Http\Requests\SplitJournalFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Log; use Log;
use Session; use Session;
@@ -42,7 +42,13 @@ class SplitController extends Controller
View::share('title', trans('firefly.split-transactions')); View::share('title', trans('firefly.split-transactions'));
} }
public function edit(TransactionJournal $journal) /**
* @param Request $request
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function edit(Request $request, TransactionJournal $journal)
{ {
$count = $journal->transactions()->count(); $count = $journal->transactions()->count();
if ($count === 2) { if ($count === 2) {
@@ -57,25 +63,16 @@ class SplitController extends Controller
/** @var BudgetRepositoryInterface $budgetRepository */ /** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class); $budgetRepository = app(BudgetRepositoryInterface::class);
/** @var PiggyBankRepositoryInterface $piggyBankRepository */
$piggyBankRepository = app(PiggyBankRepositoryInterface::class);
$what = strtolower(TransactionJournal::transactionTypeStr($journal));
$currencies = ExpandedForm::makeSelectList($currencyRepository->get()); $currencies = ExpandedForm::makeSelectList($currencyRepository->get());
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account'])); $assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets()); $budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyBankRepository->getPiggyBanks()); $preFilled = $this->arrayFromJournal($request, $journal);
$amount = TransactionJournal::amountPositive($journal);
// get source account:
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$destinationAccounts = TransactionJournal::destinationAccountList($journal);
// get the transactions: // get the transactions:
return view( return view(
'split.journals.edit', 'split.journals.edit',
compact('currencies', 'amount', 'piggyBanks', 'sourceAccounts', 'destinationAccounts', 'assetAccounts', 'budgets', 'what', 'journal') compact('currencies', 'preFilled', 'amount', 'sourceAccounts', 'destinationAccounts', 'assetAccounts', 'budgets', 'what', 'journal')
); );
} }
@@ -104,19 +101,12 @@ class SplitController extends Controller
/** @var BudgetRepositoryInterface $budgetRepository */ /** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class); $budgetRepository = app(BudgetRepositoryInterface::class);
/** @var PiggyBankRepositoryInterface $piggyBankRepository */
$piggyBankRepository = app(PiggyBankRepositoryInterface::class);
$currencies = ExpandedForm::makeSelectList($currencyRepository->get()); $currencies = ExpandedForm::makeSelectList($currencyRepository->get());
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account'])); $assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets()); $budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyBankRepository->getPiggyBanks());
//Session::flash('warning', 'This feature is very experimental. Beware.');
return view('split.journals.from-store', compact('currencies', 'piggyBanks', 'assetAccounts', 'budgets'))->with('data', $preFilled); return view('split.journals.from-store', compact('currencies', 'assetAccounts', 'budgets', 'preFilled'));
} }
@@ -154,6 +144,73 @@ class SplitController extends Controller
return redirect(session('transactions.create.url')); return redirect(session('transactions.create.url'));
} }
/**
* @param SplitJournalFormRequest $request
* @param JournalInterface $repository
*/
public function update(SplitJournalFormRequest $request, JournalInterface $repository)
{
echo 'ok';
}
/**
* @param Request $request
* @param TransactionJournal $journal
*
* @return array
*/
private function arrayFromJournal(Request $request, TransactionJournal $journal): array
{
if (Session::has('_old_input')) {
Log::debug('Old input: ', session('_old_input'));
}
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$firstSourceId = $sourceAccounts->first()->id;
$array = [
'journal_description' => $request->old('journal_description', $journal->description),
'journal_amount' => TransactionJournal::amountPositive($journal),
'sourceAccounts' => $sourceAccounts,
'transaction_currency_id' => $request->old('transaction_currency_id', $journal->transaction_currency_id),
'destinationAccounts' => TransactionJournal::destinationAccountList($journal),
'what' => strtolower(TransactionJournal::transactionTypeStr($journal)),
'date' => $request->old('date', $journal->date),
'interest_date' => $request->old('interest_date', $journal->interest_date),
'book_date' => $request->old('book_date', $journal->book_date),
'process_date' => $request->old('process_date', $journal->process_date),
'description' => [],
'destination_account_id' => [],
'destination_account_name' => [],
'amount' => [],
'budget_id' => [],
'category' => [],
];
$index = 0;
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
//if ($journal->isWithdrawal() && $transaction->account_id !== $firstSourceId) {
$array['description'][] = $transaction->description;
$array['destination_account_id'][] = $transaction->account_id;
$array['destination_account_name'][] = $transaction->account->name;
$array['amount'][] = $transaction->amount;
//}
$budget = $transaction->budgets()->first();
$budgetId = 0;
if (!is_null($budget)) {
$budgetId = $budget->id;
}
$category = $transaction->categories()->first();
$categoryName = '';
if (!is_null($category)) {
$categoryName = $category->name;
}
$array['budget_id'][] = $budgetId;
$array['category'][] = $categoryName;
}
return $array;
}
/** /**
* @param array $old * @param array $old
* *
@@ -203,7 +260,6 @@ class SplitController extends Controller
'amount' => [], 'amount' => [],
'budget_id' => [], 'budget_id' => [],
'category' => [], 'category' => [],
'piggy_bank_id' => [],
]; ];
// create the first transaction: // create the first transaction:
@@ -213,7 +269,6 @@ class SplitController extends Controller
$preFilled['amount'][] = $data['amount']; $preFilled['amount'][] = $data['amount'];
$preFilled['budget_id'][] = $data['budget_id']; $preFilled['budget_id'][] = $data['budget_id'];
$preFilled['category'][] = $data['category']; $preFilled['category'][] = $data['category'];
$preFilled['piggy_bank_id'][] = $data['piggy_bank_id'];
// echo '<pre>'; // echo '<pre>';
// var_dump($data); // var_dump($data);

View File

@@ -77,6 +77,7 @@ class SplitJournalFormRequest extends Request
return [ return [
'what' => 'required|in:withdrawal,deposit,transfer', 'what' => 'required|in:withdrawal,deposit,transfer',
'journal_description' => 'required|between:1,255', 'journal_description' => 'required|between:1,255',
'id' => 'numeric|belongsToUser:transaction_journals,id',
'journal_source_account_id' => 'numeric|belongsToUser:accounts,id', 'journal_source_account_id' => 'numeric|belongsToUser:accounts,id',
'journal_source_account_name.*' => 'between:1,255', 'journal_source_account_name.*' => 'between:1,255',
'journal_currency_id' => 'required|exists:transaction_currencies,id', 'journal_currency_id' => 'required|exists:transaction_currencies,id',

View File

@@ -225,6 +225,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $source->id, 'account_id' => $source->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index] * -1, 'amount' => $amounts[$index] * -1,
'description' => 'Split Even Expense #' . $index,
] ]
); );
@@ -234,6 +235,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $destination->id, 'account_id' => $destination->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index], 'amount' => $amounts[$index],
'description' => 'Split Even Expense #' . $index,
] ]
); );
@@ -279,6 +281,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $source->id, 'account_id' => $source->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index] * -1, 'amount' => $amounts[$index] * -1,
'description' => 'Split Uneven Expense #' . $index,
] ]
); );
@@ -288,7 +291,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $destination->id, 'account_id' => $destination->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index], 'amount' => $amounts[$index],
'description' => 'Split Uneven Expense #' . $index,
] ]
); );

View File

@@ -48,6 +48,13 @@ $(document).ready(function () {
$('input[name="source_account_name[]"]').typeahead({source: data}); $('input[name="source_account_name[]"]').typeahead({source: data});
}); });
} }
// and for split:
if ($('input[name="journal_source_account_name"]').length > 0) {
$.getJSON('json/revenue-accounts').done(function (data) {
$('input[name="journal_source_account_name"]').typeahead({source: data});
});
}
if ($('input[name="description"]').length > 0 && what !== undefined) { if ($('input[name="description"]').length > 0 && what !== undefined) {
$.getJSON('json/transaction-journals/' + what).done(function (data) { $.getJSON('json/transaction-journals/' + what).done(function (data) {

View File

@@ -811,6 +811,7 @@ return [
'split_intro_three_withdrawal' => 'For example: you could split your :total groceries so you pay :split_one from your "daily groceries" budget and :split_two from your "cigarettes" budget.', 'split_intro_three_withdrawal' => 'For example: you could split your :total groceries so you pay :split_one from your "daily groceries" budget and :split_two from your "cigarettes" budget.',
'split_table_intro_withdrawal' => 'Split your withdrawal in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.', 'split_table_intro_withdrawal' => 'Split your withdrawal in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
'store_splitted_withdrawal' => 'Store splitted withdrawal', 'store_splitted_withdrawal' => 'Store splitted withdrawal',
'update_splitted_withdrawal' => 'Update splitted withdrawal',
'split_title_deposit' => 'Split your new deposit', 'split_title_deposit' => 'Split your new deposit',
'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.', 'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',

View File

@@ -10,125 +10,128 @@
return [ return [
// new user: // new user:
'bank_name' => 'Bank name', 'bank_name' => 'Bank name',
'bank_balance' => 'Balance', 'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance', 'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit', 'credit_card_limit' => 'Credit card limit',
'automatch' => 'Match automatically', 'automatch' => 'Match automatically',
'skip' => 'Skip', 'skip' => 'Skip',
'name' => 'Name', 'name' => 'Name',
'active' => 'Active', 'active' => 'Active',
'amount_min' => 'Minimum amount', 'amount_min' => 'Minimum amount',
'amount_max' => 'Maximum amount', 'amount_max' => 'Maximum amount',
'match' => 'Matches on', 'match' => 'Matches on',
'repeat_freq' => 'Repeats', 'repeat_freq' => 'Repeats',
'account_from_id' => 'From account', 'journal_currency_id' => 'Currency',
'account_to_id' => 'To account', 'journal_amount' => 'Amount',
'asset_destination_account' => 'Asset account (destination)', 'journal_asset_source_account' => 'Asset account (source)',
'asset_source_account' => 'Asset account (source)', 'account_from_id' => 'From account',
'journal_description' => 'Description', 'account_to_id' => 'To account',
'split_journal' => 'Split this transaction', 'asset_destination_account' => 'Asset account (destination)',
'split_journal_explanation' => 'Split this transaction in multiple parts', 'asset_source_account' => 'Asset account (source)',
'currency' => 'Currency', 'journal_description' => 'Description',
'account_id' => 'Asset account', 'split_journal' => 'Split this transaction',
'budget_id' => 'Budget', 'split_journal_explanation' => 'Split this transaction in multiple parts',
'openingBalance' => 'Opening balance', 'currency' => 'Currency',
'tagMode' => 'Tag mode', 'account_id' => 'Asset account',
'tagPosition' => 'Tag location', 'budget_id' => 'Budget',
'virtualBalance' => 'Virtual balance', 'openingBalance' => 'Opening balance',
'longitude_latitude' => 'Location', 'tagMode' => 'Tag mode',
'targetamount' => 'Target amount', 'tagPosition' => 'Tag location',
'accountRole' => 'Account role', 'virtualBalance' => 'Virtual balance',
'openingBalanceDate' => 'Opening balance date', 'longitude_latitude' => 'Location',
'ccType' => 'Credit card payment plan', 'targetamount' => 'Target amount',
'ccMonthlyPaymentDate' => 'Credit card monthly payment date', 'accountRole' => 'Account role',
'piggy_bank_id' => 'Piggy bank', 'openingBalanceDate' => 'Opening balance date',
'returnHere' => 'Return here', 'ccType' => 'Credit card payment plan',
'returnHereExplanation' => 'After storing, return here to create another one.', 'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
'returnHereUpdateExplanation' => 'After updating, return here.', 'piggy_bank_id' => 'Piggy bank',
'description' => 'Description', 'returnHere' => 'Return here',
'expense_account' => 'Expense account', 'returnHereExplanation' => 'After storing, return here to create another one.',
'revenue_account' => 'Revenue account', 'returnHereUpdateExplanation' => 'After updating, return here.',
'amount' => 'Amount', 'description' => 'Description',
'date' => 'Date', 'expense_account' => 'Expense account',
'interest_date' => 'Interest date', 'revenue_account' => 'Revenue account',
'book_date' => 'Book date', 'amount' => 'Amount',
'process_date' => 'Processing date', 'date' => 'Date',
'category' => 'Category', 'interest_date' => 'Interest date',
'tags' => 'Tags', 'book_date' => 'Book date',
'deletePermanently' => 'Delete permanently', 'process_date' => 'Processing date',
'cancel' => 'Cancel', 'category' => 'Category',
'targetdate' => 'Target date', 'tags' => 'Tags',
'tag' => 'Tag', 'deletePermanently' => 'Delete permanently',
'under' => 'Under', 'cancel' => 'Cancel',
'symbol' => 'Symbol', 'targetdate' => 'Target date',
'code' => 'Code', 'tag' => 'Tag',
'iban' => 'IBAN', 'under' => 'Under',
'accountNumber' => 'Account number', 'symbol' => 'Symbol',
'csv' => 'CSV file', 'code' => 'Code',
'has_headers' => 'Headers', 'iban' => 'IBAN',
'date_format' => 'Date format', 'accountNumber' => 'Account number',
'csv_config' => 'CSV import configuration', 'csv' => 'CSV file',
'specifix' => 'Bank- or file specific fixes', 'has_headers' => 'Headers',
'csv_import_account' => 'Default import account', 'date_format' => 'Date format',
'csv_delimiter' => 'CSV field delimiter', 'csv_config' => 'CSV import configuration',
'attachments[]' => 'Attachments', 'specifix' => 'Bank- or file specific fixes',
'store_new_withdrawal' => 'Store new withdrawal', 'csv_import_account' => 'Default import account',
'store_new_deposit' => 'Store new deposit', 'csv_delimiter' => 'CSV field delimiter',
'store_new_transfer' => 'Store new transfer', 'attachments[]' => 'Attachments',
'add_new_withdrawal' => 'Add a new withdrawal', 'store_new_withdrawal' => 'Store new withdrawal',
'add_new_deposit' => 'Add a new deposit', 'store_new_deposit' => 'Store new deposit',
'add_new_transfer' => 'Add a new transfer', 'store_new_transfer' => 'Store new transfer',
'noPiggybank' => '(no piggy bank)', 'add_new_withdrawal' => 'Add a new withdrawal',
'title' => 'Title', 'add_new_deposit' => 'Add a new deposit',
'notes' => 'Notes', 'add_new_transfer' => 'Add a new transfer',
'filename' => 'File name', 'noPiggybank' => '(no piggy bank)',
'mime' => 'Mime type', 'title' => 'Title',
'size' => 'Size', 'notes' => 'Notes',
'trigger' => 'Trigger', 'filename' => 'File name',
'stop_processing' => 'Stop processing', 'mime' => 'Mime type',
'start_date' => 'Start of range', 'size' => 'Size',
'end_date' => 'End of range', 'trigger' => 'Trigger',
'export_start_range' => 'Start of export range', 'stop_processing' => 'Stop processing',
'export_end_range' => 'End of export range', 'start_date' => 'Start of range',
'export_format' => 'File format', 'end_date' => 'End of range',
'include_attachments' => 'Include uploaded attachments', 'export_start_range' => 'Start of export range',
'include_config' => 'Include configuration file', 'export_end_range' => 'End of export range',
'include_old_uploads' => 'Include imported data', 'export_format' => 'File format',
'accounts' => 'Export transactions from these accounts', 'include_attachments' => 'Include uploaded attachments',
'csv_comma' => 'A comma (,)', 'include_config' => 'Include configuration file',
'csv_semicolon' => 'A semicolon (;)', 'include_old_uploads' => 'Include imported data',
'csv_tab' => 'A tab (invisible)', 'accounts' => 'Export transactions from these accounts',
'delete_account' => 'Delete account ":name"', 'csv_comma' => 'A comma (,)',
'delete_bill' => 'Delete bill ":name"', 'csv_semicolon' => 'A semicolon (;)',
'delete_budget' => 'Delete budget ":name"', 'csv_tab' => 'A tab (invisible)',
'delete_category' => 'Delete category ":name"', 'delete_account' => 'Delete account ":name"',
'delete_currency' => 'Delete currency ":name"', 'delete_bill' => 'Delete bill ":name"',
'delete_journal' => 'Delete transaction with description ":description"', 'delete_budget' => 'Delete budget ":name"',
'delete_attachment' => 'Delete attachment ":name"', 'delete_category' => 'Delete category ":name"',
'delete_rule' => 'Delete rule ":title"', 'delete_currency' => 'Delete currency ":name"',
'delete_rule_group' => 'Delete rule group ":title"', 'delete_journal' => 'Delete transaction with description ":description"',
'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?', 'delete_attachment' => 'Delete attachment ":name"',
'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?', 'delete_rule' => 'Delete rule ":title"',
'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?', 'delete_rule_group' => 'Delete rule group ":title"',
'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?', 'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?', 'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?', 'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?', 'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?',
'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?', 'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?',
'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?', 'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?', 'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?', 'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?', 'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.', 'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.', 'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?',
'delete_all_permanently' => 'Delete selected permanently', 'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
'update_all_journals' => 'Update these transactions', 'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.', 'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.',
'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.', 'delete_all_permanently' => 'Delete selected permanently',
'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.', 'update_all_journals' => 'Update these transactions',
'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.', 'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.',
'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.', 'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.',
'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.', 'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.',
'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.', 'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.',
'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.',
'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.',
'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.',
]; ];

View File

@@ -22,6 +22,9 @@ return [
'balanceDiff' => 'Balance difference between :start and :end', 'balanceDiff' => 'Balance difference between :start and :end',
'matchedOn' => 'Matched on', 'matchedOn' => 'Matched on',
'matchesOn' => 'Matched on', 'matchesOn' => 'Matched on',
'account_type' => 'Account type',
'new_balance' => 'New balance',
'account' => 'Account',
'matchingAmount' => 'Amount', 'matchingAmount' => 'Amount',
'lastMatch' => 'Last match', 'lastMatch' => 'Last match',
'split_number' => 'Split #', 'split_number' => 'Split #',

View File

@@ -8,7 +8,7 @@
<input name="_token" type="hidden" value="{{ csrf_token() }}"> <input name="_token" type="hidden" value="{{ csrf_token() }}">
<input type="hidden" name="id" value="{{ journal.id }}"/> <input type="hidden" name="id" value="{{ journal.id }}"/>
<input type="hidden" name="what" value="{{ what }}"/> <input type="hidden" name="what" value="{{ preFilled.what }}"/>
{% if errors.all()|length > 0 %} {% if errors.all()|length > 0 %}
<div class="row"> <div class="row">
@@ -42,24 +42,23 @@
</div> </div>
</div> </div>
<div class="box-body"> <div class="box-body">
{{ ExpandedForm.text('journal_description') }} {{ ExpandedForm.text('journal_description', journal.description) }}
{{ ExpandedForm.select('journal_currency_id', currencies, journal.transaction_currency_id) }} {{ ExpandedForm.select('journal_currency_id', currencies, preFilled.transaction_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', amount|formatAmount ) }} {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}
<input type="hidden" name="journal_amount" value="{{ amount }}"/> <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
<!-- show static source if withdrawal or transfer --> <!-- show static source if withdrawal or transfer -->
{% if what == 'withdrawal' or what == 'transfer' %} {% if what == 'withdrawal' or what == 'transfer' %}
{{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[sourceAccounts.first.id]) }} {{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.sourceAccounts.first.id) }}
<input type="hidden" name="journal_source_account_id" value="{{ sourceAccounts.first.id }}"/>
{% endif %} {% endif %}
<!-- show static source if deposit: --> <!-- show static source if deposit: -->
{% if what == 'deposit' %} {% if what == 'deposit' %}
{{ ExpandedForm.staticText('revenue_account', sourceAccounts.first.name) }} {{ ExpandedForm.staticText('revenue_account', sourceAccounts.first.name) }}
<input type="hidden" name="journal_source_account_name" value="{{ sourceAccounts.first.name }}"/> <input type="hidden" name="journal_source_account_name" value="{{ preFilled.sourceAccounts.first.name }}"/>
{% endif %} {% endif %}
<!-- show static destination if transfer --> <!-- show static destination if transfer -->
{% if what == 'transfer' %} {% if what == 'transfer' %}
{{ ExpandedForm.staticText('asset_destination_account', assetAccounts[sourceAccounts.first.id]) }} {{ ExpandedForm.staticText('asset_destination_account', assetAccounts[preFilled.destinationAccounts.first.id]) }}
<input type="hidden" name="journal_destination_account_id" value="{{ sourceAccounts.first.id }}"/> <input type="hidden" name="journal_destination_account_id" value="{{ preFilled.destinationAccounts.first.id }}"/>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@@ -103,27 +102,27 @@
<th>{{ trans('list.description') }}</th> <th>{{ trans('list.description') }}</th>
<!-- split the source of a deposit --> <!-- split the source of a deposit -->
<!-- <!--
{% if data.what == 'deposit' %} {% if preFilled.what == 'deposit' %}
<th>{{ trans('list.source') }}</th> <th>{{ trans('list.source') }}</th>
{% endif %} {% endif %}
--> -->
<!-- split where a withdrawal is going --> <!-- split where a withdrawal is going -->
<!-- split where a deposit is going --> <!-- split where a deposit is going -->
{% if data.what == 'withdrawal' or data.what == 'deposit' %} {% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
<th>{{ trans('list.destination') }}</th> <th>{{ trans('list.destination') }}</th>
{% endif %} {% endif %}
<th>{{ trans('list.amount') }}</th> <th>{{ trans('list.amount') }}</th>
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<th>{{ trans('list.budget') }}</th> <th>{{ trans('list.budget') }}</th>
{% endif %} {% endif %}
<th>{{ trans('list.category') }}</th> <th>{{ trans('list.category') }}</th>
{% if data.what == 'transfer' %} {% if preFilled.what == 'transfer' %}
<th>{{ trans('list.piggy_bank') }}</th> <th>{{ trans('list.piggy_bank') }}</th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for index, descr in data.description %} {% for index, descr in preFilled.description %}
<tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}"> <tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}">
<td class="count">#{{ loop.index }}</td> <td class="count">#{{ loop.index }}</td>
<td> <td>
@@ -131,36 +130,36 @@
</td> </td>
<!-- withdrawal has several destination names. --> <!-- withdrawal has several destination names. -->
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<td> <td>
<input type="text" name="destination_account_name[]" value="{{ data.destination_account_name[index] }}" <input type="text" name="destination_account_name[]" value="{{ preFilled.destination_account_name[index] }}"
class="form-control"/> class="form-control"/>
</td> </td>
{% endif %} {% endif %}
<!-- deposit has several destination id's --> <!-- deposit has several destination id's -->
{% if data.what == 'deposit' %} {% if preFilled.what == 'deposit' %}
<td> <td>
{{ Form.select('destination_account_id[]', assetAccounts, data.destination_account_id[index], {class: 'form-control'}) }} {{ Form.select('destination_account_id[]', assetAccounts, preFilled.destination_account_id[index], {class: 'form-control'}) }}
</td> </td>
{% endif %} {% endif %}
<td style="width:10%;"> <td style="width:10%;">
<input type="number" name="amount[]" value="{{ data.amount[index] }}" <input type="number" name="amount[]" value="{{ preFilled.amount[index] }}"
class="form-control" autocomplete="off" step="any" min="0.01"> class="form-control" autocomplete="off" step="any" min="0.01">
</td> </td>
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<td> <td>
{{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }} {{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
</td> </td>
{% endif %} {% endif %}
<td> <td>
<input type="text" name="category[]" value="{{ data.category[index] }}" class="form-control"/> <input type="text" name="category[]" value="{{ preFilled.category[index] }}" class="form-control"/>
</td> </td>
{% if data.what == 'transfer' %} {% if preFilled.what == 'transfer' %}
<td> <td>
{{ Form.select('piggy_bank_id[]', piggyBanks, data.piggy_bank_id[index], {class: 'form-control'}) }} {{ Form.select('piggy_bank_id[]', piggyBanks, preFilled.piggy_bank_id[index], {class: 'form-control'}) }}
</td> </td>
{% endif %} {% endif %}
</tr> </tr>
@@ -173,7 +172,7 @@
</p> </p>
<p class="pull-right"> <p class="pull-right">
<button type="submit" id="transaction-btn" class="btn btn-success pull-right"> <button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ ('store_splitted_'~data.what)|_ }} {{ ('update_splitted_'~preFilled.what)|_ }}
</button> </button>
</p> </p>
</div> </div>
@@ -185,8 +184,8 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript"> <script type="text/javascript">
var originalSum = {{ data.journal_amount }}; var originalSum = {{ preFilled.journal_amount }};
var what = "{{ data.what }}"; var what = "{{ preFilled.what }}";
</script> </script>
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script> <script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/ff/transactions/create-edit.js"></script> <script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>

View File

@@ -5,12 +5,12 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('split.journal.from-store.post')}) }} {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('split.journal.from-store.post')}) }}
<input type="hidden" name="what" value="{{ data.what }}"/> <input type="hidden" name="what" value="{{ preFilled.what }}"/>
<div class="row"> <div class="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ ('split_title_'~data.what)|_ }}</h3> <h3 class="box-title">{{ ('split_title_'~preFilled.what)|_ }}</h3>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
@@ -18,16 +18,16 @@
</div> </div>
<div class="box-body"> <div class="box-body">
<p> <p>
{{ ('split_intro_one_'~data.what)|_ }} {{ ('split_intro_one_'~preFilled.what)|_ }}
</p> </p>
<p> <p>
{{ ('split_intro_two_'~data.what)|_ }} {{ ('split_intro_two_'~preFilled.what)|_ }}
</p> </p>
<p> <p>
{% if data.what =='deposit' %} {% if preFilled.what =='deposit' %}
{{ trans(('firefly.split_intro_three_'~data.what), {total: 500|formatAmount, split_one: 425|formatAmount, split_two: 75|formatAmount})|raw }} {{ trans(('firefly.split_intro_three_'~preFilled.what), {total: 500|formatAmount, split_one: 425|formatAmount, split_two: 75|formatAmount})|raw }}
{% else %} {% else %}
{{ trans(('firefly.split_intro_three_'~data.what), {total: 20|formatAmount, split_one: 15|formatAmount, split_two: 5|formatAmount})|raw }} {{ trans(('firefly.split_intro_three_'~preFilled.what), {total: 20|formatAmount, split_one: 15|formatAmount, split_two: 5|formatAmount})|raw }}
{% endif %} {% endif %}
</p> </p>
<p class="text-danger">This feature is experimental.</p> <p class="text-danger">This feature is experimental.</p>
@@ -68,23 +68,21 @@
</div> </div>
<div class="box-body"> <div class="box-body">
{{ ExpandedForm.text('journal_description') }} {{ ExpandedForm.text('journal_description') }}
{{ ExpandedForm.select('journal_currency_id', currencies, data.journal_currency_id) }} {{ ExpandedForm.select('journal_currency_id', currencies, preFilled.journal_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', data.journal_amount|formatAmount) }} {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount) }}
<input type="hidden" name="journal_amount" value="{{ data.journal_amount }}"/> <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
<!-- show static source if withdrawal or transfer -->
{% if data.what == 'withdrawal' or data.what == 'transfer' %} <!-- show source drop down box if withdrawal or transfer -->
{{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[data.journal_source_account_id]) }} {% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
<input type="hidden" name="journal_source_account_id" value="{{ data.journal_source_account_id }}"/> {{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.journal_source_account_id) }}
{% endif %} {% endif %}
<!-- show static source if deposit: --> <!-- show source text input if deposit: -->
{% if data.what == 'deposit' %} {% if preFilled.what == 'deposit' %}
{{ ExpandedForm.staticText('revenue_account', data.journal_source_account_name) }} {{ ExpandedForm.text('journal_source_account_name', preFilled.journal_source_account_name) }}
<input type="hidden" name="journal_source_account_name" value="{{ data.journal_source_account_name }}"/>
{% endif %} {% endif %}
<!-- show static destination if transfer --> <!-- show destination drop down if transfer -->
{% if data.what == 'transfer' %} {% if preFilled.what == 'transfer' %}
{{ ExpandedForm.staticText('asset_destination_account', assetAccounts[data.journal_destination_account_id]) }} {{ ExpandedForm.select('journal_destination_account_id', assetAccounts, preFilled.journal_destination_account_id) }}
<input type="hidden" name="journal_destination_account_id" value="{{ data.journal_destination_account_id }}"/>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@@ -99,13 +97,13 @@
</div> </div>
</div> </div>
<div class="box-body"> <div class="box-body">
{{ ExpandedForm.date('date', data.date) }} {{ ExpandedForm.date('date', preFilled.date) }}
{{ ExpandedForm.date('interest_date', data.interest_date) }} {{ ExpandedForm.date('interest_date', preFilled.interest_date) }}
{{ ExpandedForm.date('book_date', data.book_date) }} {{ ExpandedForm.date('book_date', preFilled.book_date) }}
{{ ExpandedForm.date('process_date', data.process_date) }} {{ ExpandedForm.date('process_date', preFilled.process_date) }}
</div> </div>
</div> </div>
</div> </div>
@@ -122,7 +120,7 @@
</div> </div>
<div class="box-body"> <div class="box-body">
<p> <p>
{{ ('split_table_intro_'~data.what)|_ }} {{ ('split_table_intro_'~preFilled.what)|_ }}
</p> </p>
<table class="table table-bordered table-condensed table-striped split-table"> <table class="table table-bordered table-condensed table-striped split-table">
<thead> <thead>
@@ -131,27 +129,24 @@
<th>{{ trans('list.description') }}</th> <th>{{ trans('list.description') }}</th>
<!-- split the source of a deposit --> <!-- split the source of a deposit -->
<!-- <!--
{% if data.what == 'deposit' %} {% if preFilled.what == 'deposit' %}
<th>{{ trans('list.source') }}</th> <th>{{ trans('list.source') }}</th>
{% endif %} {% endif %}
--> -->
<!-- split where a withdrawal is going --> <!-- split where a withdrawal is going -->
<!-- split where a deposit is going --> <!-- split where a deposit is going -->
{% if data.what == 'withdrawal' or data.what == 'deposit' %} {% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
<th>{{ trans('list.destination') }}</th> <th>{{ trans('list.destination') }}</th>
{% endif %} {% endif %}
<th>{{ trans('list.amount') }}</th> <th>{{ trans('list.amount') }}</th>
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<th>{{ trans('list.budget') }}</th> <th>{{ trans('list.budget') }}</th>
{% endif %} {% endif %}
<th>{{ trans('list.category') }}</th> <th>{{ trans('list.category') }}</th>
{% if data.what == 'transfer' %}
<th>{{ trans('list.piggy_bank') }}</th>
{% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for index, descr in data.description %} {% for index, descr in preFilled.description %}
<tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}"> <tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}">
<td class="count">#{{ loop.index }}</td> <td class="count">#{{ loop.index }}</td>
<td> <td>
@@ -159,38 +154,33 @@
</td> </td>
<!-- withdrawal has several destination names. --> <!-- withdrawal has several destination names. -->
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<td> <td>
<input type="text" name="destination_account_name[]" value="{{ data.destination_account_name[index] }}" <input type="text" name="destination_account_name[]" value="{{ preFilled.destination_account_name[index] }}"
class="form-control"/> class="form-control"/>
</td> </td>
{% endif %} {% endif %}
<!-- deposit has several destination id's --> <!-- deposit has several destination id's -->
{% if data.what == 'deposit' %} {% if preFilled.what == 'deposit' %}
<td> <td>
{{ Form.select('destination_account_id[]', assetAccounts, data.destination_account_id[index], {class: 'form-control'}) }} {{ Form.select('destination_account_id[]', assetAccounts, preFilled.destination_account_id[index], {class: 'form-control'}) }}
</td> </td>
{% endif %} {% endif %}
<td style="width:10%;"> <td style="width:10%;">
<input type="number" name="amount[]" value="{{ data.amount[index] }}" <input type="number" name="amount[]" value="{{ preFilled.amount[index] }}"
class="form-control" autocomplete="off" step="any" min="0.01"> class="form-control" autocomplete="off" step="any" min="0.01">
</td> </td>
{% if data.what == 'withdrawal' %} {% if preFilled.what == 'withdrawal' %}
<td> <td>
{{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }} {{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
</td> </td>
{% endif %} {% endif %}
<td> <td>
<input type="text" name="category[]" value="{{ data.category[index] }}" class="form-control"/> <input type="text" name="category[]" value="{{ preFilled.category[index] }}" class="form-control"/>
</td> </td>
{% if data.what == 'transfer' %}
<td>
{{ Form.select('piggy_bank_id[]', piggyBanks, data.piggy_bank_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -201,7 +191,7 @@
</p> </p>
<p class="pull-right"> <p class="pull-right">
<button type="submit" id="transaction-btn" class="btn btn-success pull-right"> <button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ ('store_splitted_'~data.what)|_ }} {{ ('store_splitted_'~preFilled.what)|_ }}
</button> </button>
</p> </p>
</div> </div>
@@ -213,8 +203,8 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript"> <script type="text/javascript">
var originalSum = {{ data.journal_amount }}; var originalSum = {{ preFilled.journal_amount }};
var what = "{{ data.what }}"; var what = "{{ preFilled.what }}";
</script> </script>
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script> <script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/ff/transactions/create-edit.js"></script> <script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>