mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
E-Invoice - Update the conditions for generating Sales Invoice Report with business logic update on generating invoice
This commit is contained in:
@@ -72,7 +72,8 @@ class ExportsSalesInvoiceReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
'transactions.voucherRedemption',
|
||||
'transactions.voucherRedemption.voucher.campaign'
|
||||
])
|
||||
->whereIn('status', [ApprovalStatus::COMPLETED])
|
||||
// ->whereIn('status', [ApprovalStatus::COMPLETED])
|
||||
->where('is_invoice_generated', 1)
|
||||
->whereHas('transactions', function ($query) use ($startDate, $endDate) {
|
||||
$query->payments()
|
||||
->complete()
|
||||
|
||||
@@ -223,6 +223,10 @@ class CreateInvoiceTransactionV2Processor
|
||||
);
|
||||
$invoice_transaction = $this->createsTransaction->execute($purchaseOrder->booking ?? $booking, $transaction_object);
|
||||
|
||||
//Update booking table, used on Export Sales Invoice Report
|
||||
$booking->is_invoice_generated = true;
|
||||
$booking->save();
|
||||
|
||||
if ($kvpCopies) {
|
||||
foreach ($kvpCopies as $kvp) {
|
||||
$invoice_transaction->attributesKVP()->save($kvp);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIsInvoiceGeneratedToBookingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->boolean('is_invoice_generated')
|
||||
->default(false)
|
||||
->after('status');
|
||||
|
||||
$table->index('is_invoice_generated', 'bookings_is_invoice_generated_index');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->dropIndex('bookings_is_invoice_generated_index');
|
||||
$table->dropColumn('is_invoice_generated');
|
||||
});
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIsInvoiceGeneratedToBookingLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('booking_logs', function (Blueprint $table) {
|
||||
$table->boolean('is_invoice_generated')
|
||||
->default(false)
|
||||
->after('status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('booking_logs', function (Blueprint $table) {
|
||||
$table->dropColumn('is_invoice_generated');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user