mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0
This commit is contained in:
+40
-23
@@ -34,7 +34,8 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function notification():array {
|
protected function notification(): array
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'Create Supplier White Form Order',
|
'title' => 'Create Supplier White Form Order',
|
||||||
'message' => 'You have successfully created currency supplier white form order'
|
'message' => 'You have successfully created currency supplier white form order'
|
||||||
@@ -84,7 +85,7 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
|||||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logic(Request $request) : JsonResponse
|
public function logic(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
||||||
$supplier = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
$supplier = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||||
@@ -118,23 +119,23 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
|||||||
|
|
||||||
$service_charges = 0;
|
$service_charges = 0;
|
||||||
|
|
||||||
if ($supplier->id === 4548 || $supplier->id === 2729) {
|
// if ($supplier->id === 4548 || $supplier->id === 2729) {
|
||||||
$amount = round(floatval(str_replace(',', '', $request->input('payment_total'))), 2);
|
// $amount = round(floatval(str_replace(',', '', $request->input('payment_total'))), 2);
|
||||||
} else {
|
// } else {
|
||||||
$service_charges = round(floatval(str_replace(',', '', $request->input('service_charges'))), 2);
|
$service_charges = round(floatval(str_replace(',', '', $request->input('service_charges'))), 2);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$rate = $original_amount / $amount;
|
$rate = $original_amount / $amount;
|
||||||
|
|
||||||
if ($supplier->id === 4548 || $supplier->id === 2729) {
|
// if ($supplier->id === 4548 || $supplier->id === 2729) {
|
||||||
$request['rate'] = $rate;
|
// $request['rate'] = $rate;
|
||||||
$request['supplier_id'] = $supplier->id;
|
// $request['supplier_id'] = $supplier->id;
|
||||||
foreach ($payments as $payment) {
|
// foreach ($payments as $payment) {
|
||||||
$request->route()->setParameter('id', $payment['id']);
|
// $request->route()->setParameter('id', $payment['id']);
|
||||||
$this->updateGroupLogic->execute($request);
|
// $this->updateGroupLogic->execute($request);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$billGroup = new BillGroup();
|
$billGroup = new BillGroup();
|
||||||
$billGroup->issuer = $supplier->id;
|
$billGroup->issuer = $supplier->id;
|
||||||
$billGroup->receiver = 1;
|
$billGroup->receiver = 1;
|
||||||
@@ -153,7 +154,7 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
|||||||
$billGroup->groups()->sync($payment['id'], false);
|
$billGroup->groups()->sync($payment['id'], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//create bill refund
|
//create bill refund
|
||||||
$amount += $service_charges;
|
$amount += $service_charges;
|
||||||
|
|
||||||
foreach ($supplierRefunds as $supplierRefund) {
|
foreach ($supplierRefunds as $supplierRefund) {
|
||||||
@@ -179,17 +180,33 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
|||||||
|
|
||||||
$billNumber = $this->generatesTransactionBillNumber->execute('BRFD-');
|
$billNumber = $this->generatesTransactionBillNumber->execute('BRFD-');
|
||||||
|
|
||||||
$object = new TransactionObject($billNumber, TransactionType::BILL_REFUND, $supplier->id, 1,
|
$object = new TransactionObject(
|
||||||
1, PaymentMethodType::CASH,
|
$billNumber,
|
||||||
$deductedRefundAmount, $deductedRefundOriginalAmount, $refund->currency_id,
|
TransactionType::BILL_REFUND,
|
||||||
$refund->original_currency_id, $deductedRefundOriginalAmount / $deductedRefundAmount,
|
$supplier->id,
|
||||||
0, 0, null, ApprovalStatus::APPROVED, []);
|
1,
|
||||||
|
1,
|
||||||
|
PaymentMethodType::CASH,
|
||||||
|
$deductedRefundAmount,
|
||||||
|
$deductedRefundOriginalAmount,
|
||||||
|
$refund->currency_id,
|
||||||
|
$refund->original_currency_id,
|
||||||
|
$deductedRefundOriginalAmount / $deductedRefundAmount,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
ApprovalStatus::APPROVED,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
$transaction = $this->createsTransaction->execute($refund, $object);
|
$transaction = $this->createsTransaction->execute($refund, $object);
|
||||||
|
|
||||||
$billGroup->billRefunds()->sync($transaction->id, false);
|
$billGroup->billRefunds()->sync($transaction->id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$billGroup->amount = $amount;
|
||||||
|
$billGroup->save();
|
||||||
|
|
||||||
return $this->response([]);
|
return $this->response([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class CalculatesBillGroupPaymentAmount
|
|||||||
$bill_refund_amount = round(floatval($billGroup->billRefunds->sum('amount')), 7);
|
$bill_refund_amount = round(floatval($billGroup->billRefunds->sum('amount')), 7);
|
||||||
$floating_amount = round(floatval($billGroup->transactions()->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount')), 7);
|
$floating_amount = round(floatval($billGroup->transactions()->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount')), 7);
|
||||||
$paid_amount = round(floatval($billGroup->transactions()->where('status', ApprovalStatus::APPROVED)->sum('amount')), 7);
|
$paid_amount = round(floatval($billGroup->transactions()->where('status', ApprovalStatus::APPROVED)->sum('amount')), 7);
|
||||||
$outstanding_amount = $billGroup->amount - $bill_refund_amount - $paid_amount - $floating_amount;
|
$outstanding_amount = $billGroup->amount - $paid_amount - $floating_amount;
|
||||||
$outstanding_amount = round($outstanding_amount, 7);
|
$outstanding_amount = round($outstanding_amount, 7);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class BillGroupResource extends JsonResource
|
|||||||
'original_currency' => new CurrencyResource($this->original_currency),
|
'original_currency' => new CurrencyResource($this->original_currency),
|
||||||
'issuer_name' => $this->issuerCompany->name,
|
'issuer_name' => $this->issuerCompany->name,
|
||||||
'issuer_id' => $this->issuerCompany->id,
|
'issuer_id' => $this->issuerCompany->id,
|
||||||
|
'invoice_amount' => (float) $this->amount + $bill_refund_amount - $this->service_charge,
|
||||||
'amount' => (float) $this->amount,
|
'amount' => (float) $this->amount,
|
||||||
'service_charge' => (float) $this->service_charge,
|
'service_charge' => (float) $this->service_charge,
|
||||||
'currency' => new CurrencyResource($this->currency),
|
'currency' => new CurrencyResource($this->currency),
|
||||||
@@ -48,12 +49,12 @@ class BillGroupResource extends JsonResource
|
|||||||
'type' => (int) $transaction->type,
|
'type' => (int) $transaction->type,
|
||||||
'bill_no' => $transaction->bill_no,
|
'bill_no' => $transaction->bill_no,
|
||||||
'payment_method' => (float) $transaction->payment_method,
|
'payment_method' => (float) $transaction->payment_method,
|
||||||
'amount' => (double) $transaction->amount,
|
'amount' => (float) $transaction->amount,
|
||||||
'original_amount' => (double) $transaction->original_amount,
|
'original_amount' => (float) $transaction->original_amount,
|
||||||
'currency' => new CurrencyResource($transaction->currency),
|
'currency' => new CurrencyResource($transaction->currency),
|
||||||
'original_currency' => new CurrencyResource($transaction->original_currency),
|
'original_currency' => new CurrencyResource($transaction->original_currency),
|
||||||
'service_charge' => (double) $transaction->service_charge,
|
'service_charge' => (float) $transaction->service_charge,
|
||||||
'tax' => (double) $transaction->tax,
|
'tax' => (float) $transaction->tax,
|
||||||
'status' => (int) $transaction->status,
|
'status' => (int) $transaction->status,
|
||||||
'statusText' => ApprovalStatus::APPROVAL_STATUS_ID[(int) $transaction->status],
|
'statusText' => ApprovalStatus::APPROVAL_STATUS_ID[(int) $transaction->status],
|
||||||
'documents' => $transaction->documents()->first() ? new DocumentResource($transaction->documents()->first()) : null,
|
'documents' => $transaction->documents()->first() ? new DocumentResource($transaction->documents()->first()) : null,
|
||||||
@@ -66,12 +67,12 @@ class BillGroupResource extends JsonResource
|
|||||||
'type' => (int) $transaction->type,
|
'type' => (int) $transaction->type,
|
||||||
'bill_no' => $transaction->bill_no,
|
'bill_no' => $transaction->bill_no,
|
||||||
'payment_method' => (float) $transaction->payment_method,
|
'payment_method' => (float) $transaction->payment_method,
|
||||||
'amount' => (double) $transaction->amount,
|
'amount' => (float) $transaction->amount,
|
||||||
'original_amount' => (double) $transaction->original_amount,
|
'original_amount' => (float) $transaction->original_amount,
|
||||||
'currency' => new CurrencyResource($transaction->currency),
|
'currency' => new CurrencyResource($transaction->currency),
|
||||||
'original_currency' => new CurrencyResource($transaction->original_currency),
|
'original_currency' => new CurrencyResource($transaction->original_currency),
|
||||||
'service_charge' => (double) $transaction->service_charge,
|
'service_charge' => (float) $transaction->service_charge,
|
||||||
'tax' => (double) $transaction->tax,
|
'tax' => (float) $transaction->tax,
|
||||||
'status' => (int) $transaction->status,
|
'status' => (int) $transaction->status,
|
||||||
'statusText' => ApprovalStatus::APPROVAL_STATUS_ID[(int) $transaction->status],
|
'statusText' => ApprovalStatus::APPROVAL_STATUS_ID[(int) $transaction->status],
|
||||||
'updated_at' => Carbon::parse($transaction->updated_at)->format('d-m-Y h:i:s A'),
|
'updated_at' => Carbon::parse($transaction->updated_at)->format('d-m-Y h:i:s A'),
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
<div class="font-heading all-caps fs-12"></div>
|
<div class="font-heading all-caps fs-12"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto text-right" v-if="selectedBillGroup.id">
|
<div class="col-auto text-right" v-if="selectedBillGroup.id">
|
||||||
<div class="font-heading fs-12">{{selectedBillGroup.currency.short_code}} {{formatAmount(selectedBillGroup.amount - selectedBillGroup.service_charge)}}</div>
|
<div class="font-heading fs-12">{{selectedBillGroup.currency.short_code}} {{formatAmount((selectedBillGroup.invoice_amount))}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto text-right" v-else>
|
<div class="col-auto text-right" v-else>
|
||||||
<div class="font-heading fs-12">MYR 0.00</div>
|
<div class="font-heading fs-12">MYR 0.00</div>
|
||||||
|
|||||||
+3
-2
@@ -108,7 +108,7 @@
|
|||||||
<div class="m-b-20">
|
<div class="m-b-20">
|
||||||
<small class="all-caps muted fs-15">Supplier Refund</small>
|
<small class="all-caps muted fs-15">Supplier Refund</small>
|
||||||
</div>
|
</div>
|
||||||
<list-component :key="supplierRefundListKey" section="supplierRefundListSection" :options="{'per_page': 20, 'type': 15, 'currency_rate_is_not_equal': 1, 'status': 2, 'receiver_in': [this.supplier.id]}" :endpoint="route('api.transaction.list')">
|
<list-component :key="supplierRefundListKey" section="supplierRefundListSection" :options="{'per_page': 20, 'type': 15, 'currency_rate_is_not_equal': 1, ...(this.supplier.id == 4548 && { 'created_after_or_equal': '01-08-2024' }), 'status': 2, 'receiver_in': [this.supplier.id]}" :endpoint="route('api.transaction.list')">
|
||||||
<template slot="list" slot-scope="{data}">
|
<template slot="list" slot-scope="{data}">
|
||||||
<supplier-refund-component section="supplierRefundListSection" :data="data" :is1688Supplier="is1688Supplier" :payments="payments" :supplierRefunds="supplierRefunds" :refundTotal="refundTotal" :paymentTotal="paymentTotal" :inputPaymentTotal="inputPaymentTotal" v-on:input="refundOrder($event)"></supplier-refund-component>
|
<supplier-refund-component section="supplierRefundListSection" :data="data" :is1688Supplier="is1688Supplier" :payments="payments" :supplierRefunds="supplierRefunds" :refundTotal="refundTotal" :paymentTotal="paymentTotal" :inputPaymentTotal="inputPaymentTotal" v-on:input="refundOrder($event)"></supplier-refund-component>
|
||||||
</template>
|
</template>
|
||||||
@@ -207,7 +207,8 @@
|
|||||||
return this.originalTotal && paymentTotal > 0 ? (this.originalTotal / paymentTotal).toFixed(5) : 1;
|
return this.originalTotal && paymentTotal > 0 ? (this.originalTotal / paymentTotal).toFixed(5) : 1;
|
||||||
},
|
},
|
||||||
is1688Supplier(){
|
is1688Supplier(){
|
||||||
return (this.supplier.id === 4548 || this.supplier.id === 2729)
|
// return (this.supplier.id === 4548 || this.supplier.id === 2729)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row" v-if="this.selectedSupplier.id !== ''">
|
<div class="row" v-if="this.selectedSupplier.id !== ''">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<list-component :key="currencyOrderKey" section="transactionGroupsListPaymentSection" :options="{'per_page': 20, 'without_bill_group': true, 'issuer_in': [this.selectedSupplier.id]}" :endpoint="route('api.transaction.group.list')">
|
<list-component :key="currencyOrderKey" section="transactionGroupsListPaymentSection" :options="{'per_page': 20, 'without_bill_group': true, ...(this.selectedSupplier.id == 4548 && { 'created_after_or_equal': '01-08-2024' }), 'issuer_in': [this.selectedSupplier.id]}" :endpoint="route('api.transaction.group.list')">
|
||||||
<template slot="list" slot-scope="{data}">
|
<template slot="list" slot-scope="{data}">
|
||||||
<transaction-group-payment-component section="transactionGroupsListPaymentSection" :data="data" :payments="payments" v-on:input="updateOrder($event)" :emptyPaymentList="emptyPaymentList"></transaction-group-payment-component>
|
<transaction-group-payment-component section="transactionGroupsListPaymentSection" :data="data" :payments="payments" v-on:input="updateOrder($event)" :emptyPaymentList="emptyPaymentList"></transaction-group-payment-component>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user