mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 21:43:57 +00:00
Merge branch 'dillon/90-e-invoice-f-2' into vapor/staging
This commit is contained in:
@@ -87,7 +87,7 @@ class Helper
|
||||
return strtoupper('ringgit ' . $ringgitWords . ' and ' . $centsWords . ' cents only');
|
||||
}
|
||||
|
||||
public static function getStateCodeByName($name)
|
||||
public static function getLHDNStateCodeByName($name)
|
||||
{
|
||||
$path = resource_path('data/lhdn/StateCodes.json');
|
||||
|
||||
@@ -127,7 +127,7 @@ class Helper
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getMsicDescriptionByCode($code)
|
||||
public static function getLHDNMsicDescriptionByCode($code)
|
||||
{
|
||||
$path = resource_path('data/lhdn/MSICSubCategoryCodes.json');
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Exports\Services;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use App\Classes\ValueObjects\Constants\RemarkRefundReason;
|
||||
use App\Models\KeyValuePair;
|
||||
use App\Models\Transaction;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
@@ -39,11 +40,11 @@ class ExportsARCreditNoteReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
'Description',
|
||||
'Reason',
|
||||
'DeptNo',
|
||||
'Qty',
|
||||
'UnitPrice',
|
||||
'Amount',
|
||||
'AccNo',
|
||||
'submiteinvoice',
|
||||
'ConsolidatedEinvoice',
|
||||
'KnockOffDocType',
|
||||
'KnockOffDocNo',
|
||||
'KnockOffAmt',
|
||||
];
|
||||
@@ -74,8 +75,8 @@ class ExportsARCreditNoteReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
$booking = null;
|
||||
$autoCountSalesInvoiceId = null;
|
||||
$formattedDocumentDate = null;
|
||||
$refundRemark = null;
|
||||
|
||||
$refundRemarkGroup = null;
|
||||
$refundRemarkGroupAccNo = null;
|
||||
$company = $transaction->owner->owner;
|
||||
$kvps = KeyValuePair::where('value', $transaction->id)
|
||||
->where('key', 'App\Models\Transaction')
|
||||
@@ -86,6 +87,13 @@ class ExportsARCreditNoteReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
if ($kvp && $kvp->owner && $kvp->owner->owner && $kvp->owner->owner->type === 1) {
|
||||
$refundTransaction = $kvp->owner;
|
||||
$refundRemark = $refundTransaction->remarks && $refundTransaction->remarks->first() ? $refundTransaction->remarks->first()->content : null;
|
||||
if($refundRemark){
|
||||
$refundRemarkGroup = RemarkRefundReason::REFUND_REASONS[$refundRemark] ?? null;
|
||||
if($refundRemarkGroup){
|
||||
$refundRemarkGroupAccNo = RemarkRefundReason::REFUND_REASONS_GROUP[$refundRemarkGroup] ?? null;
|
||||
}
|
||||
$refundRemarkGroup = strtoupper($refundRemarkGroup);
|
||||
}
|
||||
$booking = $refundTransaction->owner->booking;
|
||||
if($booking){
|
||||
$metadata = $booking->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO)->first();
|
||||
@@ -112,14 +120,14 @@ class ExportsARCreditNoteReport implements FromQuery, WithHeadings, WithHeadingR
|
||||
$formattedDocumentDate, //DocDate
|
||||
$company->debtor, //DebtorCode
|
||||
$booking ? $booking->marking : '', //Ref
|
||||
$refundRemark ?? '', //Description
|
||||
$refundRemark ?? '', //Reason
|
||||
$refundRemarkGroup ?? '', //Description
|
||||
$refundRemarkGroup ?? '', //Reason
|
||||
'C', //DeptNo
|
||||
'1', //Qty
|
||||
number_format($transaction->amount, 2), //UnitPrice
|
||||
'511-0000', //AccNo
|
||||
'F', //submiteinvoice
|
||||
number_format($transaction->amount, 2), //Amount
|
||||
$refundRemarkGroupAccNo ?? '', //AccNo
|
||||
'T', //submiteinvoice
|
||||
$company->e_invoice ? 'F' : 'T', //ConsolidatedEinvoice
|
||||
'RI', //KnockOffDocType
|
||||
$autoCountSalesInvoiceId ?? '', //KnockOffDocNo
|
||||
number_format($transaction->amount, 2), //KnockOffAmt
|
||||
];
|
||||
|
||||
@@ -81,22 +81,22 @@ class ExportsCompanies implements FromQuery, WithHeadings, WithHeadingRow, WithM
|
||||
}
|
||||
|
||||
return [
|
||||
$company->tin, // 'TIN',
|
||||
$identityReference, // 'IdentityNo',
|
||||
$company->name, // 'Name',
|
||||
$identityType === DocumentType::IDENTITY_CARD ? 'MyKAD' : '', // 'IdentityType',
|
||||
$company->type !== null ? (string) $company->type : '0', // 'TaxClassification',
|
||||
$company->msic_code, // 'MSICCode',
|
||||
$company->msic_code ? Helper::getMsicDescriptionByCode($company->msic_code) : '', // 'BusinessActivityDesc',
|
||||
$company->debtor, // 'DebtorCode',
|
||||
$company->name, // 'TradeName',
|
||||
$address ? $address->street_one . ',' . $address->street_two : '',// 'Address',
|
||||
$address ? $address->postcode : '', // 'PostCode',
|
||||
$company->contacts()->first() ? $company->contacts()->first()->phone : '', // 'Phone',
|
||||
$employee ? $employee->email : '', // 'EmailAddress',
|
||||
$address ? $address->district()->first()->name : '', // 'City',
|
||||
'MYS', // 'CountryCode',
|
||||
$address ? Helper::getStateCodeByName($address->state()->first()->name) : '', // 'StateCode'
|
||||
$company->tin, // 'TIN',
|
||||
$identityReference, // 'IdentityNo',
|
||||
$company->name, // 'Name',
|
||||
$identityType === DocumentType::IDENTITY_CARD ? 'MyKAD' : '', // 'IdentityType',
|
||||
$company->type !== null ? (string) $company->type : '0', // 'TaxClassification',
|
||||
$company->msic_code, // 'MSICCode',
|
||||
$company->msic_code ? Helper::getLHDNMsicDescriptionByCode($company->msic_code) : '', // 'BusinessActivityDesc',
|
||||
$company->debtor, // 'DebtorCode',
|
||||
$company->name, // 'TradeName',
|
||||
$address ? $address->street_one . ',' . $address->street_two : '', // 'Address',
|
||||
$address ? $address->postcode : '', // 'PostCode',
|
||||
$company->contacts()->first() ? $company->contacts()->first()->phone : '', // 'Phone',
|
||||
$employee ? $employee->email : '', // 'EmailAddress',
|
||||
$address ? $address->district()->first()->name : '', // 'City',
|
||||
'MYS', // 'CountryCode',
|
||||
$address ? Helper::getLHDNStateCodeByName($address->state()->first()->name) : '', // 'StateCode'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,9 @@ class RemarkRefundReason
|
||||
'Cancel Full Order' => 'Return Inward',
|
||||
'Others' => '',
|
||||
];
|
||||
|
||||
public const REFUND_REASONS_GROUP = [
|
||||
'Return Inward' => '510-0000',
|
||||
'Discount Allowed' => '511-0000',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user