mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge branch 'dillon/58-shipping-portal-sst' into 'master'
Dillon/58 shipping portal sst See merge request CIEFWorldwideSdnBhd/shipping-portal!213
This commit is contained in:
@@ -59,3 +59,7 @@ YD_API_CODE=''
|
||||
PERFEXCRM_BASE_URL=""
|
||||
PERFEXCRM_API_KEY=""
|
||||
PERFEXCRM_IS_ENABLED="false"
|
||||
|
||||
|
||||
STORAGE_FEE_LAUNCH_DATE="2023-12-11 00:00:00"
|
||||
SST_START_DATE="2024-04-01 00:00:00"
|
||||
|
||||
+15
-7
@@ -15,6 +15,7 @@ use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class RegenerateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -51,11 +52,18 @@ class RegenerateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
foreach ($orders as $order){
|
||||
$invoices = $order->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get();
|
||||
foreach ($invoices as $invoice){
|
||||
|
||||
|
||||
$invoice->documents()->delete();
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice]);
|
||||
|
||||
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
|
||||
@@ -63,11 +71,11 @@ class RegenerateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
|
||||
$document =$this->createsDocument->execute($invoice, $document_object);
|
||||
|
||||
|
||||
$this->createsFiles->execute($document, $document_object);
|
||||
|
||||
|
||||
// dump($document);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -16,6 +16,7 @@ use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class RegenerateSingleShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -54,7 +55,14 @@ class RegenerateSingleShippingInvoiceTransactionLogic extends AbstractController
|
||||
|
||||
$invoice->documents()->delete();
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice]);
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
|
||||
+28
-12
@@ -25,6 +25,8 @@ use App\Classes\Modules\Transactions\Services\DeletesTransactionDetails;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\ValueObjects\Constants\TaxPercentage;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -60,9 +62,9 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
|
||||
/** @var DeletesTransactionDetails */
|
||||
private $deletesTransactionDetails;
|
||||
|
||||
|
||||
public function __construct(
|
||||
FetchesPackingList $fetchesPackingList,
|
||||
FetchesPackingList $fetchesPackingList,
|
||||
FetchesTransaction $fetchesTransaction,
|
||||
UpdatesTransaction $updatesTransaction,
|
||||
FetchesTransactionDetail $fetchesTransactionDetail,
|
||||
@@ -105,11 +107,25 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
$transaction_detail = (object) $transaction_detail;
|
||||
|
||||
if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES', 'MIN_CBM_CHARGES'])){
|
||||
$reference = 'CUSTOM_CHARGES';
|
||||
$taxPercentage = TaxPercentage::DEFAULT;
|
||||
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice_transaction->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) {
|
||||
$taxPercentage = TaxPercentage::SIX_PERCENT;
|
||||
}
|
||||
|
||||
if($transaction_detail->reference === "PAY_ON_BEHALF"){
|
||||
$reference = "PAY_ON_BEHALF";
|
||||
$taxPercentage = TaxPercentage::NO_TAX;
|
||||
}
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'CUSTOM_CHARGES',
|
||||
$reference,
|
||||
isset($transaction_detail->name) ? $transaction_detail->name : TransactionDetailType::CUSTOM_CHARGES,
|
||||
$transaction_detail->quantity,
|
||||
$transaction_detail->price
|
||||
$transaction_detail->price,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
if(isset($transaction_detail->id)){
|
||||
@@ -121,20 +137,20 @@ class UpdateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
$object = new TransactionObject(
|
||||
$invoice_transaction->bill_no,
|
||||
TransactionType::SHIPPING_INVOICE,
|
||||
1,
|
||||
$invoice_transaction->bill_no,
|
||||
TransactionType::SHIPPING_INVOICE,
|
||||
1,
|
||||
$invoice_transaction->issuer,
|
||||
1,
|
||||
1,
|
||||
PaymentMethodType::CASH,
|
||||
$invoice_transaction->transactionDetails()->sum('amount'),
|
||||
$invoice_transaction->transactionDetails()->sum('amount'),
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
null,
|
||||
$invoice_transaction->transactionDetails()->sum('tax_amount'),
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::PENDING_VERIFICATION
|
||||
);
|
||||
|
||||
|
||||
@@ -18,19 +18,25 @@ class TransactionDetailObject implements DataTransferObject
|
||||
/** @var float|null */
|
||||
private $price;
|
||||
|
||||
/** @var float|null */
|
||||
private $taxPercentage;
|
||||
|
||||
|
||||
/**
|
||||
* TransactionDetailObject constructor.
|
||||
* @param string $reference
|
||||
* @param string $name
|
||||
* @param float $quantity
|
||||
* @param float $price
|
||||
* @param float $taxPercentage
|
||||
*/
|
||||
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price)
|
||||
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price, ?float $taxPercentage)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->name = $name;
|
||||
$this->quantity = $quantity;
|
||||
$this->price = $price;
|
||||
$this->taxPercentage = $taxPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,9 +71,28 @@ class TransactionDetailObject implements DataTransferObject
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getAmount(): float
|
||||
{
|
||||
return $this->getQuantity() * $this->getPrice();
|
||||
return ($this->getQuantity() * $this->getPrice()) + $this->getTaxAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getTaxPercentage(): ?float
|
||||
{
|
||||
return $this->taxPercentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getTaxAmount(): float
|
||||
{
|
||||
return ($this->getQuantity() * $this->getPrice()) * $this->getTaxPercentage() / 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,21 +80,21 @@ class TransactionObject implements DataTransferObject
|
||||
* @param array|null $details
|
||||
*/
|
||||
public function __construct(
|
||||
string $billNo,
|
||||
string $transactionType,
|
||||
int $issuer,
|
||||
int $receiver,
|
||||
int $recipientBankAccountId,
|
||||
int $paymentMethod,
|
||||
float $amount,
|
||||
float $originalAmount,
|
||||
string $billNo,
|
||||
string $transactionType,
|
||||
int $issuer,
|
||||
int $receiver,
|
||||
int $recipientBankAccountId,
|
||||
int $paymentMethod,
|
||||
float $amount,
|
||||
float $originalAmount,
|
||||
int $currencyId,
|
||||
int $originalCurrencyId,
|
||||
int $originalCurrencyId,
|
||||
float $currencyRate,
|
||||
float $tax,
|
||||
float $serviceCharge,
|
||||
?Carbon $expiresOn,
|
||||
?int $status = ApprovalStatus::PENDING_SUBMISSION,
|
||||
float $tax,
|
||||
float $serviceCharge,
|
||||
?Carbon $expiresOn,
|
||||
?int $status = ApprovalStatus::PENDING_SUBMISSION,
|
||||
?array $details = [],
|
||||
?string $paymentReference = null
|
||||
)
|
||||
@@ -241,10 +241,10 @@ class TransactionObject implements DataTransferObject
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDetails(): array
|
||||
public function getDetails(): array //cief todo: not in used as of 20240407
|
||||
{
|
||||
return array_map(function($product){
|
||||
return new TransactionDetailObject($product['stockCode'] ?? '', $product['description'] ?? '', $product['quantity'] ?? '', floatval(str_replace(',', '', $product['unit_price'])));
|
||||
return new TransactionDetailObject($product['stockCode'] ?? '', $product['description'] ?? '', $product['quantity'] ?? '', floatval(str_replace(',', '', $product['unit_price'])), 0.0 );
|
||||
}, $this->details);
|
||||
}
|
||||
|
||||
@@ -255,4 +255,4 @@ class TransactionObject implements DataTransferObject
|
||||
{
|
||||
return $this->paymentReference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -19,6 +19,7 @@ use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Jobs\CreatePerfexCRMInvoice;
|
||||
use App\Classes\Modules\Transactions\Processors\CheckStorageInvoiceTransactionProcessor;
|
||||
use App\Models\Order;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ApproveShippingInvoiceTransactionProcessor
|
||||
{
|
||||
@@ -59,9 +60,16 @@ class ApproveShippingInvoiceTransactionProcessor
|
||||
/** @var Transaction $invoice_transaction */
|
||||
$invoice_transaction = $packingList->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::PENDING_SUBMISSION])->first();
|
||||
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice_transaction->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice_transaction->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice_transaction]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
|
||||
+34
-12
@@ -23,6 +23,7 @@ use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TaxPercentage;
|
||||
use App\Classes\ValueObjects\Constants\TransactionDetailType;
|
||||
use App\Http\Resources\TransactionWithStorageResource;
|
||||
use App\Models\Order;
|
||||
@@ -195,14 +196,26 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
$cbm = $cbm + $quantity;
|
||||
}
|
||||
|
||||
$total_tax = 0;
|
||||
$taxPercentage = TaxPercentage::DEFAULT;
|
||||
$price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded;
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::now();
|
||||
|
||||
Log::channel('storage_invoices')->info('storageInvoice: '.json_encode($storageInvoice).', $transaction->status: '.$transaction->status);
|
||||
if(!$storageInvoice && $resultNumberOfDaysExceeded > 0 && $transaction->status != ApprovalStatus::COMPLETED){
|
||||
Log::channel('storage_invoices')->info('Created $transaction->id: '.$transaction->id);
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('STOR-');
|
||||
$storageInvoice = $this->createStorageInvoiceTransaction($destinationWarehousePackage, $billNumber, $company_module_id, $price_cbm);
|
||||
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) {
|
||||
$taxPercentage = TaxPercentage::SIX_PERCENT;
|
||||
$total_tax = $price_cbm * $taxPercentage / 100;
|
||||
$price_cbm = $price_cbm + $total_tax;
|
||||
}
|
||||
|
||||
$storageInvoice = $this->createStorageInvoiceTransaction($destinationWarehousePackage, $billNumber, $company_module_id, $price_cbm, $total_tax);
|
||||
$storageInvoiceId = $storageInvoice->id;
|
||||
$this->createStorageInvoiceTransactionDetails($storageInvoice, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded);
|
||||
$this->createStorageInvoiceTransactionDetails($storageInvoice, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded, $taxPercentage);
|
||||
}
|
||||
else if($storageInvoice){
|
||||
//Additional handling for giving selected storage invoice a waiver
|
||||
@@ -221,6 +234,12 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
$price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded;
|
||||
}
|
||||
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) {
|
||||
$taxPercentage = TaxPercentage::SIX_PERCENT;
|
||||
$total_tax = $price_cbm * $taxPercentage / 100;
|
||||
$price_cbm = $price_cbm + $total_tax;
|
||||
}
|
||||
|
||||
$amount = $storageInvoice->amount;
|
||||
$epsilon = 0.0001; // Tolerance for the comparison
|
||||
Log::channel('storage_invoices')->info('Update $transaction->id: '.$transaction->id);
|
||||
@@ -246,9 +265,10 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
|
||||
if($proceedToUpdate || ($pricePerCBM == 0 && $amount != 0)){
|
||||
Log::channel('storage_invoices')->info('proceedToUpdate');
|
||||
$storageInvoice = $this->updateStorageInvoiceTransaction($storageInvoice, $price_cbm);
|
||||
|
||||
$storageInvoice = $this->updateStorageInvoiceTransaction($storageInvoice, $price_cbm, $total_tax);
|
||||
$invoiceTransactionDetails = $storageInvoice->transactionDetails()->first();
|
||||
$this->updateStorageInvoiceTransactionDetails($invoiceTransactionDetails, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded);
|
||||
$this->updateStorageInvoiceTransactionDetails($invoiceTransactionDetails, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded, $taxPercentage);
|
||||
}
|
||||
|
||||
$storageInvoiceId = $storageInvoice->id;
|
||||
@@ -356,7 +376,7 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
}
|
||||
}
|
||||
|
||||
private function updateStorageInvoiceTransaction(Transaction $transaction, float $totalAmount){
|
||||
private function updateStorageInvoiceTransaction(Transaction $transaction, float $totalAmount, float $totalTax){
|
||||
|
||||
$object = new TransactionObject(
|
||||
$transaction->bill_no,
|
||||
@@ -370,7 +390,7 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
$totalTax,
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
@@ -382,18 +402,19 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
return $invoice_transaction;
|
||||
}
|
||||
|
||||
private function updateStorageInvoiceTransactionDetails($invoice_transaction_details, PackingList $packing_list, $cbm, $pricePerCBM, $numberOfDays){
|
||||
private function updateStorageInvoiceTransactionDetails($invoice_transaction_details, PackingList $packing_list, $cbm, $pricePerCBM, $numberOfDays, $taxPercentage){
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'STORAGE_FEE',
|
||||
TransactionDetailType::STORAGE_FEE.' for '.$numberOfDays. ' days * RM'.$pricePerCBM.'<br>'.round($packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum('quantity'), 3).' CTNS - '.round($cbm, 3).' CBM',
|
||||
$cbm,
|
||||
$pricePerCBM * $numberOfDays
|
||||
$pricePerCBM * $numberOfDays,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
$this->updatesTransactionDetail->execute($invoice_transaction_details, $object_detail);
|
||||
}
|
||||
|
||||
private function createStorageInvoiceTransaction(PackingList $packing_list, string $billNumber, int $companyModuleId, float $totalAmount){
|
||||
private function createStorageInvoiceTransaction(PackingList $packing_list, string $billNumber, int $companyModuleId, float $totalAmount, float $totalTax){
|
||||
|
||||
$object = new TransactionObject(
|
||||
$billNumber,
|
||||
@@ -407,7 +428,7 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
$totalTax,
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
@@ -419,12 +440,13 @@ class CheckStorageInvoiceTransactionProcessor
|
||||
return $invoice_transaction;
|
||||
}
|
||||
|
||||
private function createStorageInvoiceTransactionDetails($invoice_transaction, PackingList $packing_list, $cbm, $pricePerCBM, $numberOfDays){
|
||||
private function createStorageInvoiceTransactionDetails($invoice_transaction, PackingList $packing_list, $cbm, $pricePerCBM, $numberOfDays, $taxPercentage){
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'STORAGE_FEE',
|
||||
TransactionDetailType::STORAGE_FEE.' for '.$numberOfDays. ' days * RM'.$pricePerCBM.'<br>'.round($packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum('quantity'), 3).' CTNS - '.round($cbm, 3).' CBM',
|
||||
$cbm,
|
||||
$pricePerCBM * $numberOfDays
|
||||
$pricePerCBM * $numberOfDays,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
@@ -22,14 +22,17 @@ use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TaxPercentage;
|
||||
use App\Classes\ValueObjects\Constants\TransactionDetailType;
|
||||
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\Document;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||
|
||||
class CreateInvoiceTransactionProcessor
|
||||
@@ -171,6 +174,16 @@ class CreateInvoiceTransactionProcessor
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
|
||||
|
||||
$total_tax = 0;
|
||||
$taxPercentage = TaxPercentage::DEFAULT;
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::now();
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) {
|
||||
$taxPercentage = TaxPercentage::SIX_PERCENT;
|
||||
$total_tax = $total_cbm * $taxPercentage / 100;
|
||||
$total_cbm = $total_cbm + $total_tax;
|
||||
}
|
||||
|
||||
$object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::SHIPPING_INVOICE,
|
||||
@@ -183,7 +196,7 @@ class CreateInvoiceTransactionProcessor
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
$total_tax,
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
@@ -196,7 +209,8 @@ class CreateInvoiceTransactionProcessor
|
||||
'SHIPPING_FEE',
|
||||
TransactionDetailType::SHIPPING_FEE.'<br>'.round($packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum('quantity'), 3).' CTNS - '.round($cbm, 3).' CBM',
|
||||
$cbm,
|
||||
$price_cbm
|
||||
$price_cbm,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
@@ -206,7 +220,8 @@ class CreateInvoiceTransactionProcessor
|
||||
'OVER_WEIGHT_CHARGES',
|
||||
TransactionDetailType::OVER_WEIGHT_CHARGES,
|
||||
$over_weight_cbm,
|
||||
$price_cbm
|
||||
$price_cbm,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
@@ -217,7 +232,8 @@ class CreateInvoiceTransactionProcessor
|
||||
'MIN_CBM_CHARGES',
|
||||
TransactionDetailType::MIN_CBM_CHARGES,
|
||||
$minimum_charge,
|
||||
$price_cbm
|
||||
$price_cbm,
|
||||
$taxPercentage
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
+3
-1
@@ -9,6 +9,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TaxPercentage;
|
||||
use App\Models\Order;
|
||||
|
||||
class CreateShippingCostTransactionProcessor
|
||||
@@ -57,7 +58,8 @@ class CreateShippingCostTransactionProcessor
|
||||
TransactionType::SHIPPING_COST,
|
||||
'Shipping Cost',
|
||||
$quantity,
|
||||
$totalShippingCost/$totalCBM
|
||||
$totalShippingCost/$totalCBM,
|
||||
TaxPercentage::SIX_PERCENT
|
||||
);
|
||||
|
||||
$shippingCostTransaction = $this->createsShippingCostTransaction->execute($order, $transactionObject, $transactionDetailObject);
|
||||
|
||||
+12
-2
@@ -16,6 +16,8 @@ use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateStorageInvoiceDocTransactionFixProcessor
|
||||
{
|
||||
@@ -51,9 +53,17 @@ class CreateStorageInvoiceDocTransactionFixProcessor
|
||||
/** @var Transaction $invoice_transaction */
|
||||
$invoice_transaction = $packingList->transactions()->where('transactions.type', TransactionType::STORAGE_INVOICE)->whereIn('status', [ApprovalStatus::COMPLETED])->first();
|
||||
|
||||
// $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
|
||||
// $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
Log::info('$dateToCompare 2: '.$dateToCompare);
|
||||
$storageInvoiceTransactionCreatedDate = Carbon::parse($invoice_transaction->created_at);
|
||||
Log::info('$storageInvoiceTransactionCreatedDate 2: '.$storageInvoiceTransactionCreatedDate);
|
||||
if ($storageInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice_transaction->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice_transaction]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::STORAGE_INVOICE,
|
||||
|
||||
+12
-1
@@ -16,6 +16,8 @@ use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateStorageInvoiceDocTransactionProcessor
|
||||
{
|
||||
@@ -53,7 +55,16 @@ class CreateStorageInvoiceDocTransactionProcessor
|
||||
|
||||
// $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED);
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
Log::info('$dateToCompare: '.$dateToCompare);
|
||||
$storageInvoiceTransactionCreatedDate = Carbon::parse($invoice_transaction->created_at);
|
||||
Log::info('$storageInvoiceTransactionCreatedDate: '.$storageInvoiceTransactionCreatedDate);
|
||||
if ($storageInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice_transaction->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice_transaction]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::STORAGE_INVOICE,
|
||||
|
||||
@@ -44,6 +44,8 @@ class CreatesShippingCostTransaction extends AbstractUpdateRelationshipRecord
|
||||
$model->quantity = $transactionDetailObject->getQuantity();
|
||||
$model->price = $transactionDetailObject->getPrice();
|
||||
$model->amount = $transactionDetailObject->getAmount();
|
||||
$model->tax_amount = $transactionDetailObject->getTaxAmount();
|
||||
$model->tax_percentage = $transactionDetailObject->getTaxPercentage();
|
||||
|
||||
return $this->handler($transaction->transactionDetails(), $model);
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ class CreatesTransactionDetail extends AbstractUpdateRelationshipRecord
|
||||
$model->quantity = $object->getQuantity();
|
||||
$model->price = $object->getPrice();
|
||||
$model->amount = $object->getAmount();
|
||||
$model->tax_amount = $object->getTaxAmount();
|
||||
$model->tax_percentage = $object->getTaxPercentage();
|
||||
|
||||
return $this->handler($transaction->transactionDetails(), $model);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,10 @@ class UpdatesTransactionDetail extends AbstractUpdateRecord
|
||||
$transactionDetail->quantity = $object->getQuantity();
|
||||
$transactionDetail->price = $object->getPrice();
|
||||
$transactionDetail->amount = $object->getAmount();
|
||||
$transactionDetail->tax_amount = $object->getTaxAmount();
|
||||
$transactionDetail->tax_percentage = $object->getTaxPercentage();
|
||||
|
||||
return $this->handler($transactionDetail);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class TaxPercentage {
|
||||
|
||||
public const DEFAULT = 0;
|
||||
|
||||
public const NO_TAX = 0;
|
||||
|
||||
public const SIX_PERCENT = 6;
|
||||
}
|
||||
@@ -13,4 +13,6 @@ final class TransactionDetailType {
|
||||
public const CUSTOM_CHARGES = 'Custom charges';
|
||||
|
||||
public const STORAGE_FEE = 'Malaysia Warehouse Storage Fee';
|
||||
|
||||
public const PAY_ON_BEHALF = 'Pay on behalf';
|
||||
}
|
||||
|
||||
@@ -58,13 +58,20 @@ class FixInvoice extends Command
|
||||
foreach ($orders as $order){
|
||||
$invoices = $order->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get();
|
||||
foreach ($invoices as $invoice){
|
||||
|
||||
|
||||
dump($invoice->id);
|
||||
|
||||
|
||||
$invoice->documents()->delete();
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice]);
|
||||
|
||||
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
|
||||
@@ -72,10 +79,10 @@ class FixInvoice extends Command
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
|
||||
/** @var Document $document */
|
||||
$document = (App()->make(CreatesDocument::class))->execute($invoice, $document_object);
|
||||
|
||||
|
||||
(App()->make(CreatesFiles::class))->execute($document, $document_object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class GroupForOrderV2Resource extends JsonResource
|
||||
'original_currency' => new CurrencyResource($this->original_currency),
|
||||
'issuer_name' => $this->issuerCompany->name,
|
||||
'issuer_id' => $this->issuerCompany->id,
|
||||
'amount' => (float) $this->amount,
|
||||
'amount' => (float) $this->amount, //cief todo: 58
|
||||
'service_charge' => (float) $this->amount,
|
||||
'currency' => new CurrencyResource($this->currency),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'),
|
||||
|
||||
@@ -52,7 +52,7 @@ class TransactionResource extends JsonResource
|
||||
'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents),
|
||||
'type' => (int) $this->type,
|
||||
'bill_no' => $this->bill_no,
|
||||
'amount' => (double) $this->amount,
|
||||
'amount' => (double) $this->amount, //cief todo: 58
|
||||
'payment_method' => (int) $this->payment_method,
|
||||
'payment_reference' => $this->payment_reference,
|
||||
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')),
|
||||
|
||||
@@ -59,7 +59,7 @@ class TransactionWithStorageResource extends JsonResource
|
||||
if ($ts) {
|
||||
$paymentTransaction = Transaction::where('payment_reference', $ts->reference)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION])->first();
|
||||
if($paymentTransaction){
|
||||
$groupTotalAmount = (double) $this->amount;
|
||||
$groupTotalAmount = (double) $this->amount; //cief todo: 58
|
||||
|
||||
foreach ($group_payment_history as $key => $value) {
|
||||
if ($value->id === $ts->id && $value->reference === $ts->reference) {
|
||||
@@ -88,10 +88,10 @@ class TransactionWithStorageResource extends JsonResource
|
||||
'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents),
|
||||
'type' => (int) $this->type,
|
||||
'bill_no' => $this->bill_no,
|
||||
'amount' => (double) $this->amount,
|
||||
'amount' => (double) $this->amount, //cief todo: 58
|
||||
'payment_method' => (int) $this->payment_method,
|
||||
'payment_reference' => $this->payment_reference,
|
||||
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')),
|
||||
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')), //cief todo: 58
|
||||
'floating' => $group_payment_attempts ? $groupTotalAmount : (double) $this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount'),
|
||||
'service_charge' => (double) $this->service_charge,
|
||||
'tax' => (double) $this->tax,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToTransactionDetailsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('transaction_details', function (Blueprint $table) {
|
||||
$table->decimal('tax_amount', 14, 5)->after('amount')->default(0.00);
|
||||
$table->decimal('tax_percentage', 6, 2)->after('tax_amount')->default(0.00);
|
||||
$table->decimal('discount', 14, 5)->after('tax_percentage')->default(0.00);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('transaction_details', function (Blueprint $table) {
|
||||
$table->dropColumn('tax_amount');
|
||||
$table->dropColumn('tax_percentage');
|
||||
$table->dropColumn('discount');
|
||||
});
|
||||
}
|
||||
}
|
||||
-322
@@ -1,322 +0,0 @@
|
||||
<template>
|
||||
<div class="row m-b-15 m-l-5 m-r-10 parentContainer">
|
||||
<div class="col bg-white rounded">
|
||||
<div class="row">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Marking</p>
|
||||
<div class="no-margin">
|
||||
<div v-if="item.order">
|
||||
<a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a>/<a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a>
|
||||
<p>{{item.loading_days_ago}}</p>
|
||||
</div>
|
||||
<div v-else class="text-danger">Unclaimed Packing List</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Container</p>
|
||||
<div v-if="item.packages[0].container"> {{item.packages[0].container.container_reference}}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Invoice Date</p>
|
||||
<div v-if="!item.shipping_transaction">n/a</div>
|
||||
<div v-if="item.shipping_transaction"> {{ item.shipping_transaction.updated_at }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div v-if="item.order">
|
||||
<p class="no-margin fs-10 all-caps">Address</p>
|
||||
<div>{{ item.order.address.post_code_area}}</div>
|
||||
<div>{{ item.order.address.district.name +' '+item.order.address.postcode+' '+item.order.address.state.name }}</div>
|
||||
</div>
|
||||
<div v-else class="text-danger">Unclaimed</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Status</p>
|
||||
<div class="all-caps">{{ invoice_status }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Amount</p>
|
||||
<div v-if="!item.shipping_transaction">n/a</div>
|
||||
<div v-if="item.shipping_transaction">MYR {{ item.shipping_transaction.amount.toFixed(2) }}</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0" v-if="['Pending Payment', 'Paid Invoice', 'Suspended Invoice'].includes(invoice_status)">
|
||||
<div v-if="item.shipping_transaction">
|
||||
<div v-if="item.shipping_transaction.documents.length">
|
||||
<div v-for="file in item.shipping_transaction.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
|
||||
<document-file-viewer-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="btn bg-grey no-border muted">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="btn bg-grey no-border muted invisible">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row text-center parentContainer m-b-10" v-if="['Pending Invoice'].includes(invoice_status) && !item.receive_packing_list" >
|
||||
<div class="col">
|
||||
<div class="requestModal pointer btn btn-primary btn-xs" data-type="addWarehouseTransport">
|
||||
Add Warehouse Transport
|
||||
</div>
|
||||
<modal-component class="animate_animated animatefast animate_fadeIn" styleType="fill-in" type="addWarehouseTransport">
|
||||
<create-warehouse-transport-form-component :packinglistId="item.id" :section="section"></create-warehouse-transport-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval', 'Pending Payment'].includes(invoice_status)">
|
||||
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
|
||||
</div>
|
||||
<div v-if="!item.shipping_transaction">
|
||||
<div v-if="item.order">
|
||||
<div v-if="!item.order.company_module.billingAddress">
|
||||
<div class="btn btn-primary btn-xs pointer requestModal btn-block" data-type="billingAddressComponent">Add Billing Address</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="billingAddressComponent">
|
||||
<address-form-component :id="item.order.company_module.id" :section="section" :type=1></address-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="row" v-if="item.order.company_module.billingAddress">
|
||||
<div class="col">
|
||||
<div class="col-auto requestModal pointer" data-type="editBillingAddress">
|
||||
<i class="fa fa-edit pointer fa-fw m-l-5"></i> Edit billing Address
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="editBillingAddress">
|
||||
<div class="row">
|
||||
<div class="col bg-white">
|
||||
<address-form-component :id="item.order.company_module.id" :data="item.order.company_module.billingAddress" section="editBillingAddress"></address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!item.order.address.post_code_area">
|
||||
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal btn-block" data-type="defineLocation">Define Location</div>
|
||||
<modal-component class="animate_animated animatefast animate_fadeIn" styleType="fill-in" type="defineLocation">
|
||||
<declare-postcode-area-form-component :data="item.order.address" :section="section"></declare-postcode-area-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div v-if="item.order.company_module.billingAddress && item.order.address.post_code_area" class="btn btn-outline-primary btn-lg pointer" @click="generateInvoice()">Generate Invoice</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="btn btn-outline-primary btn-lg pointer invisible">Generate Invoice</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn bg-grey no-border muted requestModal" v-if="item.shipping_transaction && invoice_status == 'Pending Approval'" data-type="confirmInvoice">
|
||||
<i class="fa fa-check fs-12"></i>
|
||||
</div>
|
||||
<div class="btn bg-grey no-border muted requestModal" v-if="item.shipping_transaction && invoice_status == 'Pending Approval'" data-type="deleteInoive">
|
||||
<i class="fa fa-close fs-12"></i>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="confirmInvoice">
|
||||
<approve-shipping-invoice-form-component :section="section" :data="data"></approve-shipping-invoice-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInoive">
|
||||
<delete-shipping-invoice-form-component :section="section" :data="data"></delete-shipping-invoice-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="item.shipping_transaction && ['Pending Approval', 'Suspended Invoice'].includes(invoice_status)">
|
||||
<div class="col p-b-10">
|
||||
<div class="row">
|
||||
<div class="col p-l-20 p-r-20 p-t-10 p-b-10">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Container Reference</p>
|
||||
<div v-if="item.packages.length">{{ item.packages[0].container ? item.packages[0].container.container_reference : 'n/a' }}</div>
|
||||
<div v-else>n/a</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Due Date</p>
|
||||
<div v-if="item.packages.length">
|
||||
<div v-if="item.packages[0].container">
|
||||
<div v-if="item.packages[0].container.transport">{{ item.packages[0].container.transport.drop_date == null ? item.packages[0].container.transport.current_schedule.etd : item.packages[0].container.transport.drop_date }}</div>
|
||||
<div v-else>n/a</div>
|
||||
</div>
|
||||
<div v-else>n/a</div>
|
||||
</div>
|
||||
<div v-else>n/a</div>
|
||||
</div>
|
||||
<!-- <div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Paid Date</p>
|
||||
<div>n/a</div>
|
||||
</div> -->
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Total CBM</p>
|
||||
<div>{{ (parseFloat(cbm) + parseFloat(overweight)).toFixed(3) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 class="text-underline text-center">Invoice Details</h5>
|
||||
<invoice-items-form-component :data="item.shipping_transaction" :section="section"></invoice-items-form-component>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Subtotal</p>
|
||||
<div>{{ item.shipping_transaction.amount - item.shipping_transaction.service_charge - item.shipping_transaction.tax }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Service Charges</p>
|
||||
<div>{{ item.shipping_transaction.service_charge }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Tax</p>
|
||||
<div>{{ item.shipping_transaction.tax }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Total</p>
|
||||
<div>{{ item.shipping_transaction.amount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="item.shipping_transaction && invoice_status == 'Pending Payment'">
|
||||
<div class="col-12 col-md-7 padding-20">
|
||||
<div class="row bg-master-lightest h-100">
|
||||
<div class="col">
|
||||
<div class="row bg-master-lightest" v-if="item.shipping_transaction.payment_attempts.length">
|
||||
<div class="col">
|
||||
<div class="row m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-head fs-10 all-caps">Payment Attempt</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<shipping-transaction-component v-for="item in item.shipping_transaction.payment_attempts" v-bind:key="item.id" :data="item" ></shipping-transaction-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-master-lightest" v-if="item.shipping_transaction.payment_history.length">
|
||||
<div class="col">
|
||||
<div class="row m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-head fs-10 all-caps">Payment History</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<payment-history-component v-for="item in item.shipping_transaction.payment_history" v-bind:key="item.id" :data="item" ></payment-history-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-5 padding-20 parentContainer">
|
||||
<div class="row bg-master-lightest h-100">
|
||||
<div class="col">
|
||||
<div class="row padding-10">
|
||||
<div class="col">
|
||||
<div class="row align-items-end m-b-10 text-complete">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-12">Total Amount:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end m-b-10 text-success hide">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-12">Paid Total:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<!-- <div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.paid_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div> -->
|
||||
<div class="font-heading fs-12">Paid Total</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end m-b-10 hide">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-12">Floating Amount:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<!-- <div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.floating_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div> -->
|
||||
<div class="font-heading fs-12">Floating Amount</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end bold text-danger">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-12">OutStanding Total:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="item.shipping_transaction.outstanding > 0">
|
||||
<div class="col">
|
||||
<div class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="makePayment">Make Payment</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment">
|
||||
<payment-form-component :data="item.shipping_transaction" :section="section"></payment-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
props: {
|
||||
invoice_status: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
packing_list_id: null,
|
||||
transaction_details: [],
|
||||
},
|
||||
expanded: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cbm () {
|
||||
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? 0 : obj.cbm) + total, 0)) * 1000) / 1000).toFixed(3)
|
||||
},
|
||||
overweight(){
|
||||
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? obj.cbm : 0) + total, 0)) * 1000) / 1000).toFixed(3)
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.parameters.packing_list_id = this.data.id;
|
||||
},
|
||||
methods: {
|
||||
generateInvoice() {
|
||||
this.submit(this.route('api.transaction.invoice.create'), 'post', this.section, true, true);
|
||||
},
|
||||
successHandler(response){
|
||||
this.item = response.payload.data;
|
||||
this.updateList();
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
+1
@@ -38,6 +38,7 @@
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<single-parent-admin-payments-billing-component :data="data" :invoice_status="invoice_status" :section="section" ></single-parent-admin-payments-billing-component>
|
||||
<!-- <admin-payments-billing-component :data="data" :invoice_status="invoice_status" :section="section" ></admin-payments-billing-component> -->
|
||||
<!-- AdminPaymentsBillingComponent.vue deleted to avoid confusion -->
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,11 @@
|
||||
<div class="row" v-if="isEdit">
|
||||
<div class="col padding-25 bg-master-lightest">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="col" v-if="name">
|
||||
<p class="m-b-0 small muted">Name</p>
|
||||
<p class="m-b-0 bold">{{product.name}}</p>
|
||||
</div>
|
||||
<div class="col" v-else>
|
||||
<validation-wrapper-component :validator="$v.product.name">
|
||||
<label>Name</label>
|
||||
<input class="form-control" v-model="product.name">
|
||||
@@ -93,6 +97,10 @@
|
||||
// required: true
|
||||
default: 0
|
||||
},
|
||||
name:{
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -102,6 +110,7 @@
|
||||
quantity: 0,
|
||||
price: 0,
|
||||
amount: 0,
|
||||
reference: 'CUSTOM_CHARGES',
|
||||
},
|
||||
products: []
|
||||
}
|
||||
@@ -113,6 +122,12 @@
|
||||
price: { required },
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if(this.name){
|
||||
this.product.name = this.name;
|
||||
this.product.reference = 'PAY_ON_BEHALF';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.data) {
|
||||
this.product = this.data;
|
||||
@@ -136,7 +151,7 @@
|
||||
this.$emit('add', {
|
||||
name: this.product.name,
|
||||
quantity: this.product.quantity,
|
||||
reference: 'CUSTOM_CHARGES',
|
||||
reference: this.product.reference,
|
||||
price: parseFloat((this.product.price).toString().replace(',', '')),
|
||||
amount: this.productTotal
|
||||
});
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
|
||||
<div class="row" v-if="addCharges">
|
||||
<div class="col">
|
||||
<invoice-item-form-component currency="MYR" :editable="!submitted" :section="section" @change="addCharges = !addCharges" @add="addProduct($event)" v-on:remove="removeProduct(index)"></invoice-item-form-component>
|
||||
<invoice-item-form-component currency="MYR" :editable="!submitted" :section="section" :name="addChargesName" @change="addCharges = !addCharges" @add="addProduct($event)" v-on:remove="removeProduct(index)"></invoice-item-form-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row d-flex justify-content-center allign-items-between align-items-center m-b-15">
|
||||
<div class="col-auto">
|
||||
<div class="btn btn-outline-primary btn-md" @click="addCharges = !addCharges">{{ addCharges? 'Cancel' : 'Add Charges' }}</div>
|
||||
<div class="btn btn-outline-primary btn-md" @click="addCharges = !addCharges; addChargesName = 'Pay On Behalf'">{{ addCharges? 'Cancel' : 'Add \'Pay On Behalf \' Charges' }}</div>
|
||||
<div class="btn btn-outline-primary btn-md" @click="addCharges = !addCharges; addChargesName = ''">{{ addCharges? 'Cancel' : 'Add Charges' }}</div>
|
||||
<div class="btn btn-outline-primary btn-md" @click="submitForm()">Save Change</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,6 +45,7 @@
|
||||
parameters: {
|
||||
transaction_details: []
|
||||
},
|
||||
addChargesName: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
@include('pages.pdfs.shipping_invoice_sst_inner', ['invoice_transaction' => $invoice_transaction])
|
||||
|
||||
<pagebreak />
|
||||
@include('pages.pdfs.packing_list_measurement', ['invoice_transaction' => $invoice_transaction])
|
||||
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="text-align: right; ">SST This is generated by computer. No signature required.</td>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpagefooter>
|
||||
@endsection
|
||||
@@ -0,0 +1,143 @@
|
||||
<style>
|
||||
body {
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="header-logo">
|
||||
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
|
||||
</td>
|
||||
<td class="header-cief-address">
|
||||
<span class="company-name">
|
||||
<strong>
|
||||
CIEF WORLDWIDE SDN BHD
|
||||
</strong>
|
||||
</span>
|
||||
<span class="company-reg">(1134596-M)</span><br>
|
||||
No. 72-3, Jalan Jalil 1,<br>
|
||||
The Earth Bukit Jalil,<br>
|
||||
57000 Kuala Lumpur<br>
|
||||
Tel: 03-8082 1252<br>
|
||||
SST No: W10-2403-32000643
|
||||
</td>
|
||||
<td class="header-details">
|
||||
<div class="title" style="font-size: 20px; text-transform: uppercase;">
|
||||
<strong>
|
||||
Invoice
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div class="number">Invoice No: {{ $invoice_transaction->bill_no }}</div>
|
||||
|
||||
@php
|
||||
$companyModule = $invoice_transaction->owner->owner->companyModule;
|
||||
@endphp
|
||||
|
||||
<div class="date">Date: {{ $invoice_transaction->created_at }}</div>
|
||||
<div class="ref">Order No: {{ $invoice_transaction->owner->owner->reference }}</div>
|
||||
<div class="ref">Container Ref: {{ $invoice_transaction->owner->containers()->first()->reference }}</div>
|
||||
{{--<div class="d-none">{{ $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference }}</div>--}}
|
||||
<div> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="bill-to">
|
||||
<span class="sub-title">
|
||||
Bill To
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="address">
|
||||
<div class="label">
|
||||
{{ $companyModule->name }}
|
||||
</div>
|
||||
<div class="address">
|
||||
@php
|
||||
$addresses = $companyModule->addresses()->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
|
||||
@endphp
|
||||
@if($addresses)
|
||||
{{ $addresses->street_one }}
|
||||
{{ $addresses->street_two }} ,
|
||||
{{ $addresses->district()->first()->name }},
|
||||
{{ $addresses->postcode }}
|
||||
{{ $addresses->state()->first()->name }},
|
||||
{{ $addresses->country()->first()->name }}
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
@php
|
||||
$contact = $companyModule->contacts()->first();
|
||||
@endphp
|
||||
Phone: {{ $contact ? $contact->phone : '' }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<table class="line-table" style="overflow: wrap" autosize="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">No</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Qty</th>
|
||||
<th width="10%">Unit Price <br>(RM)</th>
|
||||
<th width="10%">Tax (%)</th>
|
||||
<th width="20%">Tax Amount <br>(RM)</th>
|
||||
<th width="15%">Sub Total<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($invoice_transaction->transactionDetails as $key => $transaction_detail)
|
||||
<tr>
|
||||
<td width="5%" class="center top">{{ $key + 1 }}</td>
|
||||
<td class="description">{!! $transaction_detail->name !!}</td>
|
||||
<td width="10%" class="center top" style="text-align: center">{{ round($transaction_detail->quantity, 3) }}</td>
|
||||
<td width="10%" class="center top" style="text-align: center">
|
||||
{{ round($transaction_detail->price, 2) }}
|
||||
</td>
|
||||
<td width="10%" class="center top" style="text-align: center">
|
||||
{{ round($transaction_detail->tax_percentage, 2) }}
|
||||
</td>
|
||||
<td width="20%" class="center top" style="text-align: center">
|
||||
{{ number_format(round($transaction_detail->tax_amount, 2), 2) }}
|
||||
</td>
|
||||
<td width="15%" class="right top">
|
||||
{{ number_format(round($transaction_detail->amount, 2), 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="subtotal">
|
||||
<td colspan="5"></td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">
|
||||
{{ number_format(round($invoice_transaction->amount - $invoice_transaction->tax, 2), 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="5"></td>
|
||||
<td class="right">Service Charges</td>
|
||||
<td class="right">
|
||||
{{ number_format(round($invoice_transaction->service_charge, 2), 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="5"></td>
|
||||
<td class="right">Total SST (6%) RM</td>
|
||||
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5"></td>
|
||||
<td class="right middle">Total Amount RM</td>
|
||||
<td class="total right middle">
|
||||
{{ number_format(round($invoice_transaction->amount, 2), 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@@ -0,0 +1,163 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
@php
|
||||
$grandTotal = 0;
|
||||
$grandTotalTax = 0;
|
||||
$grandSubTotal = 0;
|
||||
@endphp
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="header-logo">
|
||||
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
|
||||
</td>
|
||||
<td class="header-cief-address">
|
||||
<span class="company-name">
|
||||
<strong>
|
||||
CIEF WORLDWIDE SDN BHD
|
||||
</strong>
|
||||
</span>
|
||||
<span class="company-reg">(1134596-M)</span><br>
|
||||
No. 72-3, Jalan Jalil 1,<br>
|
||||
The Earth Bukit Jalil,<br>
|
||||
57000 Kuala Lumpur<br>
|
||||
Tel: 03-8082 1252<br>
|
||||
SST No: W10-2403-32000643
|
||||
</td>
|
||||
<td class="header-details">
|
||||
<div class="title" style="font-size: 20px; text-transform: uppercase;">
|
||||
<strong>
|
||||
Summary
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$companyModule = $invoice_transactions[0]->owner->owner->companyModule;
|
||||
@endphp
|
||||
|
||||
{{-- <div class="date">Date: {{ $invoice_transactions[0]->created_at }}</div> --}}
|
||||
<div class="date">Date: {{ \Carbon\Carbon::now() }}</div>
|
||||
<div> </div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="bill-to">
|
||||
<span class="sub-title">
|
||||
Bill To
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="address">
|
||||
<div class="label">
|
||||
{{ $companyModule->name }}
|
||||
</div>
|
||||
<div class="address">
|
||||
@php
|
||||
$addresses = $companyModule->addresses()->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
|
||||
@endphp
|
||||
{{ $addresses->street_one }}
|
||||
{{ $addresses->street_two }} ,
|
||||
{{ $addresses->district()->first()->name }},
|
||||
{{ $addresses->postcode }}
|
||||
{{ $addresses->state()->first()->name }},
|
||||
{{ $addresses->country()->first()->name }}
|
||||
</div>
|
||||
<div>
|
||||
@php
|
||||
$contact = $companyModule->contacts()->first();
|
||||
@endphp
|
||||
Phone: {{ $contact ? $contact->phone : '' }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<table class="line-table" style="overflow: wrap" autosize="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">No</th>
|
||||
<th class="description">Invoice No</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Qty</th>
|
||||
<th width="10%">Unit Price <br>(RM)</th>
|
||||
<th width="10%">Tax (%)</th>
|
||||
<th width="20%">Tax Amount <br>(RM)</th>
|
||||
<th width="15%">Sub Total<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($invoice_transactions as $key => $invoice_transaction)
|
||||
@foreach ($invoice_transaction->transactionDetails as $transaction_detail)
|
||||
<tr>
|
||||
<td width="5%" class="center top">{{ $key + 1 }}</td>
|
||||
<td width="15%" class="center top">{{ $invoice_transaction->bill_no }}</td>
|
||||
<td class="description">{!! $transaction_detail->name !!}</td>
|
||||
<td width="10%" class="center top" style="text-align: center">{{ round($transaction_detail->quantity, 3) }}</td>
|
||||
<td width="10%" class="center top" style="text-align: center">
|
||||
{{ round($transaction_detail->price, 2) }}
|
||||
</td>
|
||||
<td width="10%" class="center top" style="text-align: center">
|
||||
{{ round($transaction_detail->tax_percentage, 2) }}
|
||||
</td>
|
||||
<td width="20%" class="center top" style="text-align: center">
|
||||
{{ number_format(round($transaction_detail->tax_amount, 2), 2) }}
|
||||
</td>
|
||||
<td width="15%" class="right top">
|
||||
{{ round($transaction_detail->amount, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@php
|
||||
$grandSubTotal = $grandSubTotal + round($invoice_transaction->amount - $invoice_transaction->tax, 2);
|
||||
$grandTotalTax = $grandTotalTax + round($invoice_transaction->tax, 2);
|
||||
$grandTotal = $grandTotal + round($invoice_transaction->amount, 2);
|
||||
@endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="subtotal">
|
||||
<td colspan="6"></td>
|
||||
<td class="right middle">Total Taxable Amount</td>
|
||||
<td class="right middle">
|
||||
{{ round($grandSubTotal, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="6"></td>
|
||||
<td class="right middle">Total SST (6%) RM</td>
|
||||
<td class="right middle">
|
||||
{{ round($grandTotalTax, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td class="right middle">Total Amount RM</td>
|
||||
<td class="total right middle">
|
||||
{{ round($grandTotal, 2) }}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@foreach ($invoice_transactions as $transaction)
|
||||
<pagebreak />
|
||||
@include('pages.pdfs.shipping_invoice_sst_inner', ['invoice_transaction' => $transaction])
|
||||
<pagebreak />
|
||||
@include('pages.pdfs.packing_list_measurement', ['invoice_transaction' => $transaction])
|
||||
@endforeach
|
||||
|
||||
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpagefooter>
|
||||
@endsection
|
||||
+18
-3
@@ -802,7 +802,14 @@ Route::get('/invoices/fix/{company_module_id}', function($company_module_id) {
|
||||
|
||||
$invoice->documents()->delete();
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice]);
|
||||
$view = 'pages.pdfs.shipping_invoice';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoice_sst';
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
@@ -828,8 +835,16 @@ Route::get('/invoices/combine/{ids}', function($ids){
|
||||
$ids = json_decode($ids);
|
||||
|
||||
$transactions = Transaction::whereIn('id', $ids)->get();
|
||||
$invoice = $transactions[0]; //NOTE: invoices that need to be combined need to be seperated before and after SST implementation
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoices_combined', ['invoice_transactions' => $transactions]);
|
||||
$view = 'pages.pdfs.shipping_invoices_combined';
|
||||
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
|
||||
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
|
||||
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
|
||||
$view = 'pages.pdfs.shipping_invoices_sst_combined';
|
||||
}
|
||||
|
||||
$pdf = LaravelMpdf::loadView($view, ['invoice_transactions' => $transactions]);
|
||||
return $pdf->download('combined_invoice_.pdf');
|
||||
})->name('invoice.combined_summary');
|
||||
|
||||
@@ -1255,7 +1270,7 @@ Route::get('/payment-and-billing-2', function () {
|
||||
})->name('admin.payment-and-billing-2');
|
||||
|
||||
Route::get('/show-all-extra-payments', function () {
|
||||
ini_set('memory_limit', '-1');
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
|
||||
Reference in New Issue
Block a user