mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 09:24:07 +00:00
Merge branch 'supplier-bill-group-dashboard' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into development
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ class ApproveBillGroupPaymentVerificationLogic extends AbstractControllerLogic
|
||||
$billGroup->status = ApprovalStatus::PENDING_SUBMISSION;
|
||||
$billGroup->save();
|
||||
} else {
|
||||
if ($billGroupPayment['outstanding_amount'] <= 0) {
|
||||
if ($billGroupPayment['outstanding_amount'] <= 0 && $billGroupPayment['floating_amount'] <= 0) {
|
||||
$billGroup->status = ApprovalStatus::APPROVED;
|
||||
$billGroup->save();
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class CreateBillGroupPaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
$billGroup = $transaction->owner;
|
||||
$billGroupPayment = $this->calculatesBillGroupPaymentAmount->execute($billGroup);
|
||||
|
||||
if ($billGroupPayment['outstanding_amount'] <= 0) {
|
||||
if ($billGroupPayment['outstanding_amount'] <= 0 && $billGroup->transactions()->where('status', ApprovalStatus::PENDING_SUBMISSION)->count() === 0) {
|
||||
$billGroup->status = ApprovalStatus::PENDING_VERIFICATION;
|
||||
$billGroup->save();
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class CreateBillGroupPaymentTransactionLogic extends AbstractControllerLogic
|
||||
$billGroupPayment = $this->calculatesBillGroupPaymentAmount->execute($billGroup);
|
||||
$outstanding_amount = $billGroupPayment['outstanding_amount'];
|
||||
|
||||
if ($billGroupPayment['outstanding_amount'] == 0) {
|
||||
if ($billGroupPayment['outstanding_amount'] <= 0) {
|
||||
if ($billGroup->transactions()->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->count() !== 0) {
|
||||
throw new MalformedRequestException('Invalid bill group, payment transaction already exist.');
|
||||
}
|
||||
|
||||
@@ -159,11 +159,11 @@ class CreateSupplierBillGroupLogic extends AbstractControllerLogic
|
||||
foreach ($supplierRefunds as $supplierRefund) {
|
||||
$refund = Transaction::find($supplierRefund['id']);
|
||||
$deductedRefunds = $refund->transactions()->where('type', TransactionType::BILL_REFUND)->where('status', ApprovalStatus::APPROVED)->get();
|
||||
$refundDeductableAmount = $refund->amount - $deductedRefunds->sum('amount');
|
||||
$refundDeductableOriginalAmount = $refund->original_amount - $deductedRefunds->sum('original_amount');
|
||||
$refundDeductableAmount = round(($refund->amount - $deductedRefunds->sum('amount')), 2);
|
||||
$refundDeductableOriginalAmount = round(($refund->original_amount - $deductedRefunds->sum('original_amount')), 2);
|
||||
|
||||
$amount -= round($refundDeductableAmount, 2);
|
||||
$original_amount -= round($refundDeductableOriginalAmount, 2);
|
||||
$amount -= $refundDeductableAmount;
|
||||
$original_amount -= $refundDeductableOriginalAmount;
|
||||
|
||||
if ($amount > 0) {
|
||||
$deductedRefundAmount = $refundDeductableAmount;
|
||||
|
||||
Reference in New Issue
Block a user