update export pending order so that partial refund booking show correct amount

This commit is contained in:
JiaSheng
2024-03-11 01:14:40 +08:00
parent b0e3467fbe
commit 626bec90d2
+5 -2
View File
@@ -25,6 +25,7 @@ use Spatie\Activitylog\Models\Activity;
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Bookings\Processors\CreatePurchaseOrderFor1688OrderProcessor;
use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
use App\Classes\Modules\Documents\Services\DeletesDocument;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionWithInvoiceNoProcessor;
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
@@ -396,6 +397,8 @@ Route::get('/pending_orders', function(){
$i = 0;
foreach ($payments as $payment){
$booking = $payment->owner;
$original_refunds = floatval((App()->make(CalculatesBookingRefundAmount::class))->calculateRefundAmount($payment, $booking->fix_currency_id));
$refunds = $original_refunds / $payment->currency_rate;
if(!$booking instanceof Booking){
dd($payment);
}
@@ -411,11 +414,11 @@ Route::get('/pending_orders', function(){
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>'.$payment->amount.'</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>'.$payment->original_amount.'</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>';