diff --git a/app/Classes/General/Eloquent/Filters/PendingPurchaseOrder.php b/app/Classes/General/Eloquent/Filters/PendingPurchaseOrder.php index 4097cbe0..d3fa28f9 100644 --- a/app/Classes/General/Eloquent/Filters/PendingPurchaseOrder.php +++ b/app/Classes/General/Eloquent/Filters/PendingPurchaseOrder.php @@ -23,8 +23,6 @@ class PendingPurchaseOrder implements Filter }); })->whereDoesntHave('transactions', function($transaction){ return $transaction->where('type', TransactionType::PURCHASE_ORDER)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]); - })->whereHas('transactions', function($transaction){ - return $transaction->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]); }); } diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 9068862b..73751cfb 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -65,15 +65,12 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { $bookings = Booking::where(function($query){ - return $query->whereMonth('created_at', 10)->orWhere(function ($query){ - return $query->whereMonth('created_at', 10); - }); - }) - ->whereYear('created_at', 2021) - ->whereDoesntHave('transactions', function($q){ + return $query->whereMonth('created_at', 11)->orWhereMonth('created_at', 12); + })->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); })->get(); + foreach ($bookings as $booking) { $po = Transaction::where('type', TransactionType::PURCHASE_ORDER) ->where('status', ApprovalStatus::APPROVED)->where('issuer', $booking->company_id) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php index 514c32cd..d8fdb0df 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php @@ -3,6 +3,7 @@ namespace App\Classes\Modules\Bookings\ControllersLogic; +use App\Classes\ValueObjects\Constants\TransactionType; use Illuminate\Support\Facades\File; use ZipArchive; use Carbon\Carbon; @@ -35,7 +36,11 @@ class DownloadBookingDocumentLogic $bookings = Booking::where('status', ApprovalStatus::COMPLETED) ->whereDate('created_at', '>=', Carbon::parse($request->input('startDate'))) - ->whereDate('created_at', '<=', Carbon::parse($request->input('endDate')))->get(); + ->whereDate('created_at', '<=', Carbon::parse($request->input('endDate')))->whereHas('transactions', function ($query) use ($request){ + return $query->where('type', TransactionType::PAYMENT)->whereHas('transactions', function ($query) use ($request){ + return $query->where('type', TransactionType::BILL)->where('issuer', $request->input('supplier')); + }); + })->get(); if (!count($bookings)) throw new MalformedRequestException('No available file to download'); diff --git a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php index 103797ed..be216473 100644 --- a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php +++ b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php @@ -24,34 +24,28 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit { return [ 'Code', + 'DebtorControlAcc', + 'ControlAccount', + 'AccNo', 'CompanyName', 'Desc2', - 'AreaCode', - 'SalesAgent', 'DebtorType', 'DisplayTerm', - 'AgingOn', - 'StatementType', 'CurrencyCode', 'RegisterNo', 'Address1', 'Address2', 'Address3', - 'Address4', 'PostCode', 'DeliverAddr1', 'DeliverAddr2', 'DeliverAddr3', - 'DeliverAddr4', 'DeliverPostCode', + 'EmailAddress', 'Attention', 'Phone1', 'Phone2', - 'Fax1', - 'Fax2', - 'ExemptNo', - 'ExpiryDate', - 'PriceCategory', + 'Fax1' ]; } @@ -62,7 +56,7 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit { return Company::where(function($query){ $query->whereNull('debtor')->orWhere('debtor', ''); - })->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){ + })->whereNotIn('id', [2207, 2248, 2029])->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->whereHas('transactions', function($query){ return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::PENDING_VERIFICATION]); }); } @@ -75,35 +69,29 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit public function map($company): array { return [ - '<>', //Code - $company->name.' (PURCHASE)', //CompanyName - $company->reference, //Desc2 - '', //AreaCode - '', //SalesAgent - '', //DebtorType - '', //DisplayTerm - '', //AgingOn - '', //StatementType - 'MYR', //CurrencyCode - '', //RegisterNo - '', //Address1 - '', //Address2 - '', //Address3 - '', //Address4 - '', //PostCode - '', //DeliverAddr1 - '', //DeliverAddr2 - '', //DeliverAddr3 - '', //DeliverAddr4 - '', //DeliverPostCode - '', //Attention - '', //Phone1 - '', //Phone2 - '', //Fax1 - '', //Fax2 - '', //ExemptNo - '', //ExpiryDate - '', //PriceCategory + '<>', + '300-0000', + '300-0000', + '300-0000', + $company->name.' (PURCHASE)', + $company->reference, + '', + 'PIA', + 'MYR', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '',//EmailAddress + '', + '', + '', + '' ]; } } \ No newline at end of file diff --git a/app/Classes/Modules/Exports/Services/ExportsTransactions.php b/app/Classes/Modules/Exports/Services/ExportsTransactions.php index a49d1f85..f9bbecaf 100644 --- a/app/Classes/Modules/Exports/Services/ExportsTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsTransactions.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Exports\Services; use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\CompanyType; +use App\Classes\ValueObjects\Constants\TransactionType; use App\Models\Company; use App\Models\Transaction; use Maatwebsite\Excel\Concerns\Exportable; @@ -41,6 +42,10 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping 6 => 'REFUND', 7 => 'PURCHASE_ORDER', 8 => 'SUPPLIER_DELIVER', + 9 => 'CREDIT_NOTE', + 10 => 'WITHDRAW', + 11 => 'DEBIT_NOTE', + 12 => 'TRANSFER_FEE' ]; $transactionStatus = [ @@ -55,9 +60,11 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping return [ $transaction->bill_no, - $transaction->booking->marking, - $transaction->booking->company->reference, + $transaction->owner_id, + $transaction->owner_type, $transactionTypes[$transaction->type], + $transaction->issuer, + $transaction->reciver, $transaction->currency_id === 1 ? 'MYR' : 'RMB', $transaction->amount, $transaction->original_currency_id === 1 ? 'MYR' : 'RMB', diff --git a/app/Classes/Modules/Imports/Services/ImportsDebtor.php b/app/Classes/Modules/Imports/Services/ImportsDebtor.php index b97aa263..5e0bdadc 100644 --- a/app/Classes/Modules/Imports/Services/ImportsDebtor.php +++ b/app/Classes/Modules/Imports/Services/ImportsDebtor.php @@ -18,7 +18,7 @@ class ImportsDebtor implements ToModel, WithHeadingRow, WithBatchInserts, WithVa public function model($row = []) { try { - preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['2nd_description'], $matches); + preg_match_all('/([0-9]{3,4}[a-zA-Z]{3,4})/', $row['desc2'], $matches); foreach ($matches[0] as $match){ $reference = $match; @@ -32,7 +32,9 @@ class ImportsDebtor implements ToModel, WithHeadingRow, WithBatchInserts, WithVa } - } catch (\Exception $exception){} + } catch (\Exception $exception){ + dd($exception); + } } public function batchSize(): int diff --git a/app/Classes/ValueObjects/Constants/FileType.php b/app/Classes/ValueObjects/Constants/FileType.php index 3ff989ca..d5404e7a 100644 --- a/app/Classes/ValueObjects/Constants/FileType.php +++ b/app/Classes/ValueObjects/Constants/FileType.php @@ -22,6 +22,7 @@ class FileType 'image/jpeg' => 'jpeg', 'application/pdf' => 'pdf', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'excel', + 'application/vnd.ms-excel' => 'excel', ]; } \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/TransactionType.php b/app/Classes/ValueObjects/Constants/TransactionType.php index 5221e8a2..29f5e946 100644 --- a/app/Classes/ValueObjects/Constants/TransactionType.php +++ b/app/Classes/ValueObjects/Constants/TransactionType.php @@ -24,11 +24,11 @@ final class TransactionType { public const CREDIT_NOTE = 9; - public const DEBIT_NOTE = 11; - public const WITHDRAW = 10; - public const TRANSFER_FEE = 11; + public const DEBIT_NOTE = 11; - public const CASH_BACK = 12; + public const TRANSFER_FEE = 12; + + public const CASH_BACK = 13; } diff --git a/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php b/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php index 95427363..d2a7d85c 100644 --- a/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php +++ b/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php @@ -15,7 +15,7 @@ class DownloadBookingDocumentController * @throws \App\Classes\Exceptions\MalformedRequestException */ public function download(Request $request, DownloadBookingDocumentLogic $logic) { - return $logic->execute($request); + $logic->execute($request); } } \ No newline at end of file diff --git a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php index f1e14fde..39ea3dc5 100644 --- a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php +++ b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php @@ -43,14 +43,14 @@ class ExportCustomersToExcelController public function paymentTransactions(Request $request){ $exportsTransactions = new ExportsPaymentTransactions($request); - $response = $exportsTransactions->download('payment-transactions.xls', Excel::XLSX, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); + $response = $exportsTransactions->download('payment-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } public function walletTransactions(Request $request){ $exportsTransactions = new ExportsWalletTransactions($request); - $response = $exportsTransactions->download('wallet-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.ms-excel']); + $response = $exportsTransactions->download('wallet-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); ob_end_clean(); return $response; } diff --git a/resources/assets/vue/components/address/forms/AddressFormComponent.vue b/resources/assets/vue/components/address/forms/AddressFormComponent.vue index 94cd9c9a..2a6de3d1 100644 --- a/resources/assets/vue/components/address/forms/AddressFormComponent.vue +++ b/resources/assets/vue/components/address/forms/AddressFormComponent.vue @@ -23,7 +23,7 @@
- + diff --git a/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue b/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue index cc79b885..e03fb36c 100644 --- a/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue +++ b/resources/assets/vue/components/announcements/forms/AssignAnnouncementToSegmentFormComponent.vue @@ -17,7 +17,7 @@
- + diff --git a/resources/assets/vue/components/banks/forms/BankAccountFormComponent.vue b/resources/assets/vue/components/banks/forms/BankAccountFormComponent.vue index fe611b69..3bf7fa65 100644 --- a/resources/assets/vue/components/banks/forms/BankAccountFormComponent.vue +++ b/resources/assets/vue/components/banks/forms/BankAccountFormComponent.vue @@ -74,7 +74,7 @@
- + diff --git a/resources/assets/vue/components/bookings/elements/BillingComponent.vue b/resources/assets/vue/components/bookings/elements/BillingComponent.vue index 83a2cb78..70f511ed 100644 --- a/resources/assets/vue/components/bookings/elements/BillingComponent.vue +++ b/resources/assets/vue/components/bookings/elements/BillingComponent.vue @@ -42,6 +42,12 @@
+
+ + + + +
@@ -76,6 +82,7 @@ export default { startDate: '', endDate: '', type: 'INVOICE', + supplier: null }, documents: ['INVOICE', 'PURCHASE_ORDER', 'DELIVER_ORDER', 'SUPPLIER_DELIVER_ORDER'], selectedDocumentStatus: false @@ -92,12 +99,13 @@ export default { type: { required }, + supplier: {}, } }, methods: { submitSearch(){ if(!this.validate()){ return; } - window.open(route('documents.download')+'?type='+this.parameters.type+'&startDate='+this.parameters.startDate+'&endDate='+this.parameters.endDate, '_blank'); + window.open(route('documents.download')+'?type='+this.parameters.type+'&startDate='+this.parameters.startDate+'&endDate='+this.parameters.endDate+'&supplier='+this.parameters.supplier, '_blank'); }, updateDocumentType(documentType) { this.parameters.type = documentType; diff --git a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue index c723631d..667bc76f 100644 --- a/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue +++ b/resources/assets/vue/components/companies/forms/AssignSegmentFormComponent.vue @@ -17,7 +17,7 @@
- + diff --git a/resources/assets/vue/components/general/forms/ValidationWrapperComponent.vue b/resources/assets/vue/components/general/forms/ValidationWrapperComponent.vue index d30fdbaf..285c19ff 100644 --- a/resources/assets/vue/components/general/forms/ValidationWrapperComponent.vue +++ b/resources/assets/vue/components/general/forms/ValidationWrapperComponent.vue @@ -2,7 +2,7 @@
-
+
@@ -21,7 +21,7 @@ validator: { required: true }, - selecatable: { + selectable: { type: Boolean, default: false } diff --git a/resources/assets/vue/components/settings/forms/AddCurrencyFormComponent.vue b/resources/assets/vue/components/settings/forms/AddCurrencyFormComponent.vue index 58ce0e64..380f96f9 100644 --- a/resources/assets/vue/components/settings/forms/AddCurrencyFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/AddCurrencyFormComponent.vue @@ -17,7 +17,7 @@
- + diff --git a/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue b/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue index 5405ae6e..a3ece6fa 100644 --- a/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue @@ -43,7 +43,7 @@
- + @@ -115,7 +115,7 @@
- +
diff --git a/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue b/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue index 002488cc..d92a8c84 100644 --- a/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue @@ -97,7 +97,7 @@
- + diff --git a/resources/views/pages/dashboards/account_admin.blade.php b/resources/views/pages/dashboards/account_admin.blade.php index c6c76a86..d22d3637 100644 --- a/resources/views/pages/dashboards/account_admin.blade.php +++ b/resources/views/pages/dashboards/account_admin.blade.php @@ -2,14 +2,14 @@
- +
- + diff --git a/resources/views/pages/pdfs/deliver_order.blade.php b/resources/views/pages/pdfs/deliver_order.blade.php index 20afd278..8ad9004a 100644 --- a/resources/views/pages/pdfs/deliver_order.blade.php +++ b/resources/views/pages/pdfs/deliver_order.blade.php @@ -20,7 +20,7 @@ (1134596-M)
Malaysian Global Innovation & Creativity Center
Level 1 CWS, Block 3730, Persiaran APEC,
- 63000 Cyberjaya, Malaysian.
+ 63000 Cyberjaya, Malaysia.
Tel: 018-2909252 diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 56d56afd..5d2cb5d1 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -19,7 +19,7 @@ (1134596-M)
Malaysian Global Innovation & Creativity Center
Level 1 CWS, Block 3730, Persiaran APEC,
- 63000 Cyberjaya, Malaysian.
+ 63000 Cyberjaya, Malaysia.
Tel: 018-2909252 diff --git a/routes/web.php b/routes/web.php index b6032a66..46595b97 100644 --- a/routes/web.php +++ b/routes/web.php @@ -6,6 +6,7 @@ use App\Classes\Modules\Documents\Services\CreatesFiles; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\DocumentType; use App\Classes\ValueObjects\Constants\TransactionType; +use App\Models\Booking; use App\Models\Company; use App\Models\Transaction; use App\Models\User; @@ -148,6 +149,13 @@ Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exp Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions')->name('walletTransactions.export'); Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) { + $bookings = Booking::where(function($query){ + return $query->whereMonth('created_at', 7)->orWhereMonth('created_at', 8)->orWhereMonth('created_at', 9)->orWhereMonth('created_at', 10)->orWhereMonth('created_at', 11)->orWhereMonth('created_at', 12); + })->whereDoesntHave('transactions', function($q){ + $q->where('type', TransactionType::PURCHASE_ORDER); + $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); + })->get(); + dd($bookings->count()); return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']); })->name('products.random');