mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-25 15:34:02 +00:00
transaction not tally
This commit is contained in:
+9
@@ -55,6 +55,15 @@ class FetchCompanyTransactionStatementLogic extends AbstractControllerLogic
|
||||
->where('owner_type', Wallet::class)
|
||||
->where('type', '!=', TransactionType::PAYMENT);
|
||||
})
|
||||
->orWhere(function ($query) use ($companyId) {
|
||||
$query
|
||||
->where('type', TransactionType::INVOICE)
|
||||
->where('owner_type', Booking::class)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereHas('booking', function ($query) use ($companyId) {
|
||||
$query->where('company_id', $companyId);
|
||||
});
|
||||
})
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
+7
-2
@@ -24,7 +24,8 @@
|
||||
<div class="col-2 fs-12">{{item.created_at}}</div>
|
||||
<div class="col-3 fs-12">{{ convertTransactionType(item.type) }} {{ item.payment_reference ? ' - ' + item.payment_reference : '' }} <a target=”_blank” v-if="[9,11].includes(item.type) " :href="route('transaction.credit_note.download', item.id)"><i class="fa fa-download fs-11 m-l-5 text-secondary hover-primary"></i></a></div>
|
||||
<div class="col fs-12"><a :href="route('booking.details', item.booking_marking)">{{item.booking_marking}}</a></div>
|
||||
<div class="col-2 text-success text-center">{{[5, 9].includes(parseFloat(item.type)) ? (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-success text-center" v-if="parseFloat(item.type) !== 2">{{[5, 9].includes(parseFloat(item.type)) ? (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-success text-center" v-if="parseFloat(item.type) === 2">{{(Math.round(((parseFloat(item.amount) / parseFloat(item.currency_rate) + parseFloat(item.service_charge)) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
<div class="col-2 text-danger text-center">{{[1, 11].includes(parseFloat(item.type)) ? '- ' + (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-right">{{remainingBalance(index)}}</div>
|
||||
</div>
|
||||
@@ -104,7 +105,11 @@ export default {
|
||||
if(this.transaction){
|
||||
let transactions = this.transaction.slice().reverse();
|
||||
transactions.slice(0, transactions.length - index).map(function(transaction) {
|
||||
[1, 11].includes(transaction.type) ? tempBalance -= (transaction.amount) : tempBalance += (transaction.amount);
|
||||
if (transaction.type === 2) {
|
||||
tempBalance += (transaction.amount / transaction.currency_rate + transaction.service_charge);
|
||||
} else {
|
||||
[1, 11].includes(transaction.type) ? tempBalance -= (transaction.amount) : tempBalance += (transaction.amount);
|
||||
}
|
||||
return tempBalance
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user