From f688ba972fc2dea5f97e92addf1260ba5450ccbd Mon Sep 17 00:00:00 2001 From: Steve Ng Date: Mon, 9 Oct 2023 14:14:57 +0800 Subject: [PATCH] this task for have a checkbox to selected which records want export invoices to autocount --- .../Services/ExportsInvoiceTransactions.php | 4 +++- .../elements/StatementTransactionComponent.vue | 9 +++++++++ .../sections/TransactionsMappingComponent.vue | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php index 90780750..87cf35a2 100644 --- a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php @@ -56,9 +56,11 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading */ public function query() { - return StatementTransactionOwner::whereNull('invoice_reference') + $data = StatementTransactionOwner::whereNull('invoice_reference') ->whereIn('type', [StatementTransactionOwnerType::SALES, StatementTransactionOwnerType::WALLET_TOP_UP]) ->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED]); + if ($this->request->has('bankStatementOwnerId')) $data = $data->whereIn('id',json_decode($this->request->input('bankStatementOwnerId'))); + return $data; } /** diff --git a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue index d36c149f..6014bb5d 100644 --- a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue +++ b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue @@ -113,6 +113,12 @@
{{ item.amount }}
{{ [6, 7, 8, 9, 10, 11, 12, 13, 14].includes(item.owners.approved[0].type) ? 'Miscellaneous' : 'Approved' }}
+ + +
+ +
+
Pending...
Amount
+
+
Select +
+ @@ -191,6 +195,8 @@ export default { files: [], parameters: {}, section: 'bankTransactionSection', + mappedTrue: false, + selectAll: false, } }, validations: { @@ -212,7 +218,13 @@ export default { this.submit(this.route('api.import_receipts.upload'), 'post', this.section, true, false); }, exportInvoiceToAutoCount(){ - window.open(this.route('invoiceTransactions.export'), '_blank'); + let bankStatementOwnerId = []; + $('.request_export_item:checked').each(function() { + bankStatementOwnerId.push($(this).val()); + }); + + bankStatementOwnerId = JSON.stringify(bankStatementOwnerId); + window.open(this.route('invoiceTransactions.export')+'?bankStatementOwnerId='+bankStatementOwnerId, '_blank'); }, successHandler(){ this.step += 1;