Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0 into development

This commit is contained in:
Dillon Ngo
2024-08-12 22:06:39 +08:00
5 changed files with 17 additions and 21 deletions
@@ -108,7 +108,12 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
// $transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
// $transactionRefundCalculationObject->init();
$refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7);
if ((float)$request->input('amount') === (float)$transaction->original_amount) {
$refundAmount = $transaction->original_amount / $transaction->currency_rate;
$service_charges_to_refund = $transaction->service_charge;
} else {
$refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7);
}
$bookingAmountBeforeCurrentRefund = $booking->fix_amount - $refundInPending;
@@ -18,6 +18,7 @@ class ListTransactionJobResource extends JsonResource
{
$booking = null; //cief todo: 66
$bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -26,6 +27,7 @@ class ListTransactionJobResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [
@@ -24,6 +24,7 @@ class PaymentTransactionResource extends JsonResource
$booking = null; //cief todo: 66
$bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -32,6 +33,7 @@ class PaymentTransactionResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$booking_marking = '';
@@ -21,6 +21,7 @@ class TransactionResource extends JsonResource
{
$booking = null; //cief todo: 66
$bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND, TransactionType::SUPPLIER_REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -29,6 +30,7 @@ class TransactionResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [
+5 -20
View File
@@ -408,24 +408,7 @@ Route::get('/pending_orders', function(){
->orderBy('updated_at', 'desc')
->get();
echo '<table border="1">';
// echo '<thead>';
// echo '<tr>';
// echo '<th>Client Booking Date</th>';
// echo '<th>Payment Type</th>';
// echo '<th>Marking</th>';
// echo '<th>Customer Payment Currency</th>';
// echo '<th>Customer Payment Amount</th>';
// echo '<th>Reference No.</th>';
// echo '<th>Booking Amount Currency</th>';
// echo '<th>CNY</th>';
// echo '<th>Service</th>';
// echo '<th>Days</th>';
// echo '<th>Cust Supplier Acc Type</th>';
// echo '<th>Cust Supplier Acc Name</th>';
// echo '</tr>';
// echo '</thead>';
// echo '<tbody>';
echo '<table>';
$i = 0;
foreach ($payments as $payment){
$booking = $payment->owner;
@@ -445,17 +428,19 @@ Route::get('/pending_orders', function(){
echo '<tr>';
echo '<td>'.$payment->updated_at->format('d-M-y').'</td>';
echo '<td>'.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].'</td>';
echo '<td>'.$booking->marking.'</td>';
echo '<td>'.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].'</td>';
echo '<td>'.$payment->currency->short_code.'</td>';
echo '<td>'.number_format(bcsub($payment->amount, $refunds, 7), 5, '.', '').'</td>';
echo '<td>'.$booking->company->reference.'</td>';
echo '<td></td>';
echo '<td>'.$payment->original_currency->short_code.'</td>';
echo '<td>'.number_format(bcsub($payment->original_amount, $original_refunds, 7), 5, '.', '').'</td>';
echo '<td></td>';
echo '<td>'.$booking->service->name.'</td>';
echo '<td>'.$payment->updated_at->diffForHumans().'</td>';
echo '<td>'.$bankType.'</td>';
echo '<td>'.$bank->holder_name.'</td>';
echo '<td>'.$booking->bank->holder_name.'</td>';
echo '</tr>';
}
echo '</table>';