enhance import invoice mapping conditions

This commit is contained in:
Steve Ng
2023-10-15 22:42:47 +08:00
parent 521260d69f
commit 829ea9ad17
3 changed files with 21 additions and 16 deletions
@@ -129,7 +129,7 @@ class BankStatementController extends Controller
->download($statement->date_from->format('Y-m-d') . '_' . $statement->date_to->format('Y-m-d') . '_statement.csv');
}
public function fetch(Request $request, ListBankStatementDetailsLogic $logic): JsonResponse
public function fetch(Request $request, ListBankStatementTransactionsLogic $logic): JsonResponse
{
return $logic->execute($request);
}
@@ -140,8 +140,14 @@ class ImportStatementInvoiceController
$transactions = Transaction::where('original_amount', $row['net_total'])->whereRaw("DATE(created_at) = '$date'")
->whereHas('receiverCompany', function($q) use($row) {
$q->where('debtor',$row['debtor_code']);
})
->get();
})->get();
if ($transactions && $transactions->count() == 0) {
$transactions = Transaction::where(DB::raw('FLOOR(original_amount)'), floor($row['net_total']))->whereRaw("DATE(created_at) = '$date'")
->whereHas('receiverCompany', function($q) use($row) {
$q->where('debtor',$row['debtor_code']);
})->get();
}
if ($transactions && $transactions->count() == 1) {
foreach ($transactions as $key => $transaction) {
@@ -65,10 +65,12 @@
<thead>
<tr>
<th>ID</th>
<th>Date</th>
<th>Posting Date</th>
<th>Description 1</th>
<th>Pay For</th>
<th>System References</th>
<th>Description 2</th>
<th>Description 3</th>
<th>Description 4</th>
<th>Description 5</th>
<th>Amount</th>
<th>Action</th>
</tr>
@@ -76,11 +78,12 @@
<tbody v-show="!isLoading">
<tr v-for="item in $store.getters.getListData(section)" :key="item.id">
<td>{{item.id}}</td>
<td>{{item.date}}</td>
<td v-if="item.transaction_description_1 != null">{{item.transaction_description_1 | truncate(30, '...')}}</td>
<td v-if="item.transaction_description_1 == null"></td>
<td>{{item.pay_for}}</td>
<td>{{item.system_references}}</td>
<td>{{item.posting_date}}</td>
<td>{{item.transaction_description_1}}</td>
<td>{{item.transaction_description_2}}</td>
<td>{{item.transaction_description_3}}</td>
<td>{{item.transaction_description_4}}</td>
<td>{{item.transaction_description_5}}</td>
<td>{{item.amount}}</td>
<td>
<a href="#">
@@ -184,11 +187,7 @@ export default {
},
created(){
this.setDecoratorDefault();
if (this.statement === 0) {
this.filters = { 'per_page': 10, order_by: {column: 'id', DESC: true} };
} else {
this.filters = { 'per_page': 10, order_by: {column: 'id', DESC: true}, 'has_account_statement_id': this.statement };
}
this.filters = { 'per_page': 10, order_by: {column: 'id', DESC: true} };
this.$store.dispatch('updateListQueue', {'name': this.section, 'page': 1, 'filters': this.filters});
},
methods: {