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/Accounts/ControllersLogic/CreateCustomerLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php index 3fe7b382..2c732126 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php @@ -14,6 +14,7 @@ use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject; use App\Classes\Modules\Contacts\Processors\CreateContactProcessor; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\BusinessType; +use App\Classes\ValueObjects\Constants\CompanyType; use App\Classes\ValueObjects\Constants\RoleTypes; use App\Models\Company; use App\Models\User; @@ -91,7 +92,7 @@ class CreateCustomerLogic extends AbstractControllerLogic $user = $this->createUserProcessor->execute($request, RoleTypes::USER, App::environment(['local']) ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION); /** @var Company $company */ - $company = $this->createCompanyProcessor->execute($request, BusinessType::IMPORTER, $request->input('type'), ApprovalStatus::PENDING_SUBMISSION); + $company = $this->createCompanyProcessor->execute($request, BusinessType::IMPORTER, $request->input('type') === CompanyType::COMPANY_BUSINESS ? CompanyType::COMPANY_BUSINESS : CompanyType::PERSONAL_BUSINESS, ApprovalStatus::PENDING_SUBMISSION); $this->createContactProcessor->execute($request, $company); diff --git a/app/Classes/Modules/Accounts/Services/GeneratesAuthenticationToken.php b/app/Classes/Modules/Accounts/Services/GeneratesAuthenticationToken.php index 72296b97..2116895c 100644 --- a/app/Classes/Modules/Accounts/Services/GeneratesAuthenticationToken.php +++ b/app/Classes/Modules/Accounts/Services/GeneratesAuthenticationToken.php @@ -65,8 +65,12 @@ class GeneratesAuthenticationToken { ]; if($user->type === RoleTypes::USER) { + + /** @var Company $companyModule */ $claims = array_merge($claims, [ - 'company_id' => $company->id + 'company_id' => $company->id, + 'company_name' => $company->name, + 'company_marking' => $company->reference, ]); } diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php index 5b331fca..1bed083c 100644 --- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Billplzs\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use Illuminate\Support\Facades\Log; class CreatesBillplzBill { @@ -43,6 +44,7 @@ class CreatesBillplzBill return (object) $data; }else{ + Log::error($response); return null; } }catch(\Exception $exception){ diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 9068862b..5e65c6a4 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', 01)->orWhereMonth('created_at', 02); + })->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/CreateBookingPaymentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php index fdd786e6..2fc1d1f0 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php @@ -121,7 +121,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic $amount = $configurations->getTotal(); if(PaymentMethodType::PAYMENT_METHODS[$request->input('payment_method')] == PaymentMethodType::PAYMENT_GATEWAY){ - $billPlzBill = $this->createsBillplzBill->execute($request->user()->name, $request->user()->email, 'This payment is made for transfer ref. '.$booking->marking, $configurations->getTotal(), $billNumber, $request->input('bank_code')); + $billPlzBill = $this->createsBillplzBill->execute($booking->company->name, $request->user()->email, 'This payment is made for transfer ref. '.$booking->marking, $configurations->getTotal(), $billNumber, $request->input('bank_code')); $paymentReference = $billPlzBill->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/ExportsAnalyticBookingTransactions.php b/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php new file mode 100644 index 00000000..791c0de3 --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php @@ -0,0 +1,104 @@ +request = $request; + } + + public function headings(): array + { + return [ + 'TransID', + 'Company ID', + 'Type Of User', + 'Group Control / Experiment', + 'Payment Date', + 'Completed Purchase OrderDate', + 'DayTo Closed', + 'IsCompleted Purchase Order (1 or 0)', + 'Final Payment', + 'Discount Amount', + 'PaymentType', + 'RowUpdateDate' + ]; + } + + /** + * @return \Illuminate\Support\Collection|mixed + */ + public function query() + { + return Booking::query(); + } + + /** + * @param $booking + * @return array + */ + public function map($booking): array + { + $companyType = []; + $companyType[companyType::COMPANY_BUSINESS] = 'COMPANY_BUSINESS'; + $companyType[companyType::PERSONAL_BUSINESS] = 'PERSONAL_BUSINESS'; + + $payments = $booking->transactions()->where('type', 1)->whereIn('status', [2, 3]); + + $paymentmethondArray = PaymentMethodType::PAYMENT_METHODS_ID; + $paymentmethondArray[0] = 'Hybrid'; + $paymentMethod = ''; + foreach ($payments->get() as $payment) { + if ( $paymentMethod == '' ) { + $paymentMethod = $payment->payment_method; + } else if ( $payment->payment_method != $paymentMethod ) { + $paymentMethod = 0; // set it to Hybrid + } + } + $paymentMethod === '' ? '' : $paymentMethod = $paymentmethondArray[$paymentMethod]; + + $firstPayment = $payments->first(); + + $CompletedPurchaseOrders = $booking->transactions()->where('type', 7)->whereIn('status', [1, 2]); + + $FirstCompletedPurchaseOrder = $CompletedPurchaseOrders->first(); + + $lastPayment = $booking->transactions()->where('type', 1)->whereIn('status', [2, 3])->orderBy('id', 'desc')->first(); + + return [ + $booking->id, + $booking->company_id, + $companyType[$booking->company->type], + '', + $firstPayment == null ? '' : $firstPayment->created_at, + $FirstCompletedPurchaseOrder == null ? '' : $FirstCompletedPurchaseOrder->created_at, + '', + $CompletedPurchaseOrders->count() > 0 ? '1' : '0', + $lastPayment == null ? '' : $lastPayment->amount, + '', + $paymentMethod, + '', + ]; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php index 103797ed..53a71772 100644 --- a/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php +++ b/app/Classes/Modules/Exports/Services/ExportsNullDebtors.php @@ -24,34 +24,27 @@ class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, Wit { return [ 'Code', + 'DebtorControlAcc', + 'ControlAccount', '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,8 +55,12 @@ 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){ - return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::PENDING_VERIFICATION]); + })->whereNotIn('id', [2207, 2248, 2029])->where('business_type', BusinessType::IMPORTER)->where('status', ApprovalStatus::APPROVED)->where(function($query){ + $query->whereHas('transactions', function($query){ + return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::PENDING_VERIFICATION]); + })->orWhereHas('wallets', function($query){ + return $query->whereHas('transactions'); + }); }); } @@ -75,35 +72,28 @@ 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', + $company->name.' (PURCHASE)', + $company->reference, + '', + 'PIA', + 'MYR', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '',//EmailAddress + '', + '', + '', + '' ]; } } \ No newline at end of file diff --git a/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php b/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php index 0ca1d730..57dba200 100644 --- a/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsPaymentTransactions.php @@ -39,7 +39,8 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading 'DetailDescription', 'Qty', 'UnitPrice', - 'AccNo' + 'AccNo', + 'DeptNo' ]; } @@ -100,7 +101,8 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading 'PLEASE REFER TO THE ATTACHED APPENDIX REF ' . $booking->marking, 1, $transaction->amount, - '500-0000' + '500-0000', + 'CIEF' ]; } } \ 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..910fb79b 100644 --- a/app/Classes/Modules/Exports/Services/ExportsTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsTransactions.php @@ -4,8 +4,11 @@ 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\Booking; use App\Models\Company; use App\Models\Transaction; +use App\Models\Wallet; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromQuery; use Maatwebsite\Excel\Concerns\WithHeadingRow; @@ -22,7 +25,7 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping */ public function query() { - return Transaction::query(); + return Transaction::where('type', TransactionType::BILL); } /** @@ -41,6 +44,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 = [ @@ -53,11 +60,16 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping 6 => 'EXPIRED' ]; + $booking = $transaction->owner->owner; return [ + $booking ? $booking->company->reference : '', + $booking ? $booking->marking : '', $transaction->bill_no, - $transaction->booking->marking, - $transaction->booking->company->reference, + $transaction->owner_id, + $transaction->owner_type, $transactionTypes[$transaction->type], + $transaction->issuerCompany->name, + $transaction->reciver, $transaction->currency_id === 1 ? 'MYR' : 'RMB', $transaction->amount, $transaction->original_currency_id === 1 ? 'MYR' : 'RMB', diff --git a/app/Classes/Modules/Exports/Services/ExportsWalletTransactions.php b/app/Classes/Modules/Exports/Services/ExportsWalletTransactions.php index af4d2d07..29c1728c 100644 --- a/app/Classes/Modules/Exports/Services/ExportsWalletTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsWalletTransactions.php @@ -39,7 +39,8 @@ class ExportsWalletTransactions implements FromQuery, WithHeadings, WithHeadingR 'DetailDescription', 'Qty', 'UnitPrice', - 'AccNo' + 'AccNo', + 'DeptNo' ]; } @@ -80,7 +81,7 @@ class ExportsWalletTransactions implements FromQuery, WithHeadings, WithHeadingR } /** - * @param Company $transaction + * @param Transaction $transaction * * @return array */ @@ -99,7 +100,8 @@ class ExportsWalletTransactions implements FromQuery, WithHeadings, WithHeadingR 'CREDIT SALES', 1, $transaction->amount, - '500-0000' + '500-0000', + 'WALLET' ]; } } \ No newline at end of file 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/Modules/Transactions/Processors/CreateSupplierTransactionProcessor.php b/app/Classes/Modules/Transactions/Processors/CreateSupplierTransactionProcessor.php index 75516fdf..db443184 100644 --- a/app/Classes/Modules/Transactions/Processors/CreateSupplierTransactionProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CreateSupplierTransactionProcessor.php @@ -97,7 +97,7 @@ class CreateSupplierTransactionProcessor $this->pushBill($billTransaction); $transferFeeNumber = $this->generatesTransactionBillNumber->execute('TRFR-'); - $transferFee = $this->calculatesTransactionTransferFee->execute($payment->original_amount, $constant); + $transferFee = $this->calculatesTransactionTransferFee->execute($billTransaction->amount, $constant); $object = new TransactionObject($transferFeeNumber, TransactionType::TRANSFER_FEE, 1, $supplier->id, $supplier->banks()->where('default', true)->first()->id, PaymentMethodType::CASH, $payment->original_amount, $payment->original_amount, $payment->original_currency_id, $payment->original_currency_id, diff --git a/app/Classes/Modules/Transactions/Services/CalculatesTransactionServiceCharge.php b/app/Classes/Modules/Transactions/Services/CalculatesTransactionServiceCharge.php index e04edee2..29751d80 100644 --- a/app/Classes/Modules/Transactions/Services/CalculatesTransactionServiceCharge.php +++ b/app/Classes/Modules/Transactions/Services/CalculatesTransactionServiceCharge.php @@ -31,7 +31,7 @@ class CalculatesTransactionServiceCharge return 0; } - $transfer_fee = $this->calculatesTransactionTransferFee->execute($amount, $service_charge); + $transfer_fee = $this->calculatesTransactionTransferFee->execute(($amount * (1 / $rate)), $service_charge); return $service_charge->detail->amount->type === 'percentage' ? (($amount + $transfer_fee) * ( (float) $service_charge->detail->amount->value /100) * (1/$rate)) : (float) $service_charge->detail->amount->value; } diff --git a/app/Classes/Modules/Wallets/ControllersLogic/TopUpWalletLogic.php b/app/Classes/Modules/Wallets/ControllersLogic/TopUpWalletLogic.php index 9bbe6073..c60cbf54 100644 --- a/app/Classes/Modules/Wallets/ControllersLogic/TopUpWalletLogic.php +++ b/app/Classes/Modules/Wallets/ControllersLogic/TopUpWalletLogic.php @@ -102,7 +102,7 @@ class TopUpWalletLogic extends AbstractControllerLogic throw new MalformedRequestException('Top up credit value must be greater than zero.'); } - $billPlzBill = $this->createsBillplzBill->execute($user->name, $user->email, 'This payment is credit topup for company ref. ' . $company->reference, $amount, $billNumber, $request->input('bank_code'), true); + $billPlzBill = $this->createsBillplzBill->execute($company->name, $user->email, 'This payment is credit topup for company ref. ' . $company->reference, $amount, $billNumber, $request->input('bank_code'), true); $transaction_object = new TransactionObject($billNumber, TransactionType::TOP_UP, 1, $company->id, 1, PaymentMethodType::PAYMENT_GATEWAY, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, [], $billPlzBill->id); 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..026f25ba 100644 --- a/app/Classes/ValueObjects/Constants/TransactionType.php +++ b/app/Classes/ValueObjects/Constants/TransactionType.php @@ -28,7 +28,7 @@ final class TransactionType { public const WITHDRAW = 10; - public const TRANSFER_FEE = 11; + public const TRANSFER_FEE = 12; - public const CASH_BACK = 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/ExportAnalyticToExcelController.php b/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php new file mode 100644 index 00000000..135e570d --- /dev/null +++ b/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php @@ -0,0 +1,30 @@ +headers->set('Authorization', 'Bearer '.$token); + } + + public function bookingData(ExportsAnalyticBookingTransactions $exportsAnalyticBookingTransactions, Request $request){ + $response = $exportsAnalyticBookingTransactions->download('bookingData.csv', Excel::CSV, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); + ob_end_clean(); + return $response; + } +} \ 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/app/Models/Booking.php b/app/Models/Booking.php index 69b8a745..2dfd945a 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -38,7 +38,7 @@ class Booking extends AbstractModel implements Documentable, Transactionable */ public function company(): BelongsTo { - return $this->BelongsTo(Company::class, 'company_id'); + return $this->BelongsTo(Company::class, 'company_id')->withTrashed(); } /** diff --git a/resources/assets/vue/app.js b/resources/assets/vue/app.js index 1d98d12d..d9e2e465 100644 --- a/resources/assets/vue/app.js +++ b/resources/assets/vue/app.js @@ -50,6 +50,19 @@ const app = new Vue({ store, created(){ this.routesGuard(); + if (!this.$store.getters.isAdmin && !('company_marking' in this.$store.getters.getDecodedAccessToken.user) && this.isProtectedRoute() && !this.isWithTokenRoute()) { + this.$store.dispatch('crudRequest', {endpoint: this.route('api.account.authentication.refresh'), method: 'get'}).then(response => { + let success = response.ok; + response.json().then(response => { + + if(!success){return;} + + this.$store.dispatch('userAuthentication', {access_token: response.payload.refresh_token, redirect_url: window.location.href}); + + }); + }) + + } }, methods: { route: route diff --git a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue index e436960a..429d0b9a 100644 --- a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue @@ -121,16 +121,18 @@
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/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index 5af5548c..ff8452a5 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -1,5 +1,5 @@