mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'dillon/90-e-invoice-e' into vapor/development
This commit is contained in:
@@ -68,7 +68,8 @@ class ExportsSalesInvoiceReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
return Booking::with([
|
||||
'company',
|
||||
'transactions.transactionDetails',
|
||||
'transactions.voucherRedemption'
|
||||
'transactions.voucherRedemption',
|
||||
'transactions.voucherRedemption.voucher.campaign'
|
||||
])
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->whereHas('transactions', function ($query) use ($startDate, $endDate) {
|
||||
@@ -138,10 +139,12 @@ class ExportsSalesInvoiceReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->count();
|
||||
|
||||
$refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1);
|
||||
$refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1);
|
||||
// $refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1);
|
||||
// $refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1);
|
||||
|
||||
$totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge;
|
||||
// $totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge;
|
||||
|
||||
$totalPayment = $paymentSum;
|
||||
}
|
||||
|
||||
$formattedDocumentDate = Carbon::parse($documentDate)->format('m/d/Y');
|
||||
@@ -194,6 +197,30 @@ class ExportsSalesInvoiceReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
}
|
||||
}
|
||||
|
||||
// Voucherify - Starts
|
||||
$voucherRedemption = $lastPaymentTransaction->voucherRedemption;
|
||||
if($voucherRedemption){
|
||||
$voucherDiscount = $voucherRedemption ? bcmul((string)$voucherRedemption->value, "-1", 2) : "0";
|
||||
$voucher = $voucherRedemption->voucher;
|
||||
$category = $voucher->campaign ? $voucher->campaign->category : null;
|
||||
$records[] = [
|
||||
'',
|
||||
$formattedDocumentDate,
|
||||
$company->debtor,
|
||||
$invoiceTransaction ? $invoiceTransaction->bill_no : '',
|
||||
$booking->marking,
|
||||
$category === 'Compensation Voucher' ? '1000-000' : '949-2000',
|
||||
'PRODUCT NAME :',
|
||||
$voucher->code,
|
||||
'022',
|
||||
'C',
|
||||
'1',
|
||||
$voucherDiscount ? number_format($voucherDiscount, 2): '0',
|
||||
'',
|
||||
''
|
||||
];
|
||||
}
|
||||
// Voucherify - Ends
|
||||
|
||||
// Service Charge - Starts
|
||||
$serviceCharge = 0;
|
||||
@@ -229,7 +256,7 @@ class ExportsSalesInvoiceReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
|
||||
// Adjustment - Starts
|
||||
$adjustment = 0;
|
||||
$voucherRedemption = $invoiceTransaction->voucherRedemption;
|
||||
$voucherRedemption = $lastPaymentTransaction->voucherRedemption;
|
||||
$voucherDiscount = $voucherRedemption ? bcmul((string)$voucherRedemption->value, "-1", 2) : "0";
|
||||
|
||||
$displayedSubtotal = is_numeric($displayedSubtotal) ? sprintf('%F', $displayedSubtotal) : '0';
|
||||
|
||||
@@ -146,10 +146,11 @@ class ExportsSalesInvoiceWithRefundReport implements FromQuery, WithHeadings, Wi
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
->count();
|
||||
|
||||
$refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1);
|
||||
$refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1);
|
||||
// $refundedAmount = (App()->make(CalculatesBookingRefundAmount::class))->execute($booking, 1);
|
||||
// $refundedServiceCharge = (App()->make(CalculatesBookingRefundServiceCharge::class))->execute($booking, 1);
|
||||
// $totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge;
|
||||
|
||||
$totalPayment = $paymentSum - $refundedAmount - $refundedServiceCharge;
|
||||
$totalPayment = $paymentSum;
|
||||
}
|
||||
|
||||
$formattedDocumentDate = Carbon::parse($documentDate)->format('m/d/Y');
|
||||
@@ -203,6 +204,31 @@ class ExportsSalesInvoiceWithRefundReport implements FromQuery, WithHeadings, Wi
|
||||
}
|
||||
}
|
||||
|
||||
// Voucherify - Starts
|
||||
$voucherRedemption = $lastPaymentTransaction->voucherRedemption;
|
||||
if($voucherRedemption){
|
||||
$voucherDiscount = $voucherRedemption ? bcmul((string)$voucherRedemption->value, "-1", 2) : "0";
|
||||
$voucher = $voucherRedemption->voucher;
|
||||
$category = $voucher->campaign ? $voucher->campaign->category : null;
|
||||
$records[] = [
|
||||
'',
|
||||
$formattedDocumentDate,
|
||||
$company->debtor,
|
||||
$invoiceTransaction ? $invoiceTransaction->bill_no : '',
|
||||
$booking->marking,
|
||||
$category === 'Compensation Voucher' ? '1000-000' : '949-2000',
|
||||
'PRODUCT NAME :',
|
||||
$voucher->code,
|
||||
'022',
|
||||
'C',
|
||||
'1',
|
||||
$voucherDiscount ? number_format($voucherDiscount, 2): '0',
|
||||
'',
|
||||
''
|
||||
];
|
||||
}
|
||||
// Voucherify - Ends
|
||||
|
||||
// Service Charge - Starts
|
||||
$serviceCharge = 0;
|
||||
if (!$totalPayment && $invoiceTransaction) {
|
||||
@@ -239,7 +265,7 @@ class ExportsSalesInvoiceWithRefundReport implements FromQuery, WithHeadings, Wi
|
||||
// Adjustment - Starts
|
||||
if($invoiceTransaction){
|
||||
$adjustment = 0;
|
||||
$voucherRedemption = $invoiceTransaction->voucherRedemption;
|
||||
$voucherRedemption = $lastPaymentTransaction->voucherRedemption;
|
||||
$voucherDiscount = $voucherRedemption ? bcmul((string)$voucherRedemption->value, "-1", 2) : "0";
|
||||
|
||||
$displayedSubtotal = is_numeric($displayedSubtotal) ? sprintf('%F', $displayedSubtotal) : '0';
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCategoryToVoucherCampaignsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('voucher_campaigns', function (Blueprint $table) {
|
||||
$table->string('category')->nullable()->after('description');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('voucher_campaigns', function (Blueprint $table) {
|
||||
$table->dropColumn('category');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user