diff --git a/503.html b/503.html new file mode 100644 index 00000000..d8fbc8c3 --- /dev/null +++ b/503.html @@ -0,0 +1,30 @@ + + + + + + Site Under Maintenance + + + +
+

We'll be back soon!

+

Sorry for the inconvenience but we're performing some maintenance at the moment. We'll be back online shortly!

+

— CIEF EXCHANGE

+
+ + diff --git a/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php b/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php index c1e2af71..a4252e9b 100644 --- a/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsAnalyticBookingTransactions.php @@ -51,8 +51,8 @@ class ExportsAnalyticBookingTransactions implements FromQuery, WithHeadings, Wit * @return \Illuminate\Support\Collection|mixed */ public function query() - { - return Booking::query(); + { + return Booking::query()->whereBetween('created_at', [Carbon::now()->subMonth(1), Carbon::now()]); //Limit, 'expensive' query; } /** @@ -66,12 +66,12 @@ class ExportsAnalyticBookingTransactions implements FromQuery, WithHeadings, Wit $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 == '' ) { + if ( $paymentMethod == '' ) { $paymentMethod = $payment->payment_method; } else if ( $payment->payment_method != $paymentMethod ) { $paymentMethod = 0; // set it to Hybrid @@ -104,4 +104,4 @@ class ExportsAnalyticBookingTransactions implements FromQuery, WithHeadings, Wit '', ]; } -} \ No newline at end of file +} diff --git a/app/Classes/Modules/Exports/Services/ExportsCustomers.php b/app/Classes/Modules/Exports/Services/ExportsCustomers.php index 9f314030..18498b4c 100644 --- a/app/Classes/Modules/Exports/Services/ExportsCustomers.php +++ b/app/Classes/Modules/Exports/Services/ExportsCustomers.php @@ -5,6 +5,7 @@ namespace App\Classes\Modules\Exports\Services; use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\CompanyType; use App\Models\Company; +use Carbon\Carbon; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromQuery; use Maatwebsite\Excel\Concerns\ShouldAutoSize; @@ -38,7 +39,8 @@ class ExportsCustomers implements FromQuery, WithHeadings, WithHeadingRow, WithM */ public function query() { - return Company::where('business_type', '=', 2); + return Company::where('business_type', '=', 2) + ->whereBetween('created_at', [Carbon::now()->subMonths(12), Carbon::now()]); //Limit, 'expensive' query; } /** @@ -66,4 +68,4 @@ class ExportsCustomers implements FromQuery, WithHeadings, WithHeadingRow, WithM count($company->segments()->where('segment_id', '=', 5)->get()) ? 'Exchange 1.0' : 'Exchange 2.0' ]; } -} \ 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 6d6751bf..b66cf878 100644 --- a/app/Classes/Modules/Exports/Services/ExportsTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsTransactions.php @@ -9,6 +9,7 @@ use App\Models\Booking; use App\Models\Company; use App\Models\Transaction; use App\Models\Wallet; +use Carbon\Carbon; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromQuery; use Maatwebsite\Excel\Concerns\WithHeadingRow; @@ -26,7 +27,9 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, Sho */ public function query() { - return Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::BILL])->where('owner_type', '!=',Wallet::class); + return Transaction::whereBetween('created_at', [Carbon::now()->subMonths(1), Carbon::now()]) //Limit, 'expensive' query; + ->whereIn('type', [TransactionType::PAYMENT, TransactionType::BILL]) + ->where('owner_type', '!=',Wallet::class); } /** @@ -87,7 +90,7 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, Sho $transaction->currency_rate, $transaction->tax, $transaction->service_charge, - $transactionStatus[$transaction->status], + isset($transactionStatus[$transaction->status]) ? $transactionStatus[$transaction->status] : 'Unknown Status', \PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->created_at), \PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->updated_at), // $marking diff --git a/database/migrations/2024_10_15_044532_add_index_to_transactions.php b/database/migrations/2024_10_15_044532_add_index_to_transactions.php new file mode 100644 index 00000000..4123fe3a --- /dev/null +++ b/database/migrations/2024_10_15_044532_add_index_to_transactions.php @@ -0,0 +1,32 @@ +index(['owner_id', 'owner_type', 'created_at', 'status'], 'idx_transactions_owner_date_status'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('transactions', function (Blueprint $table) { + $table->dropIndex('idx_transactions_owner_date_status'); + }); + } +} diff --git a/resources/assets/vue/components/bookings/elements/UploadDebtorExcelComponent.vue b/resources/assets/vue/components/bookings/elements/UploadDebtorExcelComponent.vue index 0e48240e..85db0263 100644 --- a/resources/assets/vue/components/bookings/elements/UploadDebtorExcelComponent.vue +++ b/resources/assets/vue/components/bookings/elements/UploadDebtorExcelComponent.vue @@ -72,9 +72,9 @@ this.submit(this.route('api.debtor.import'), 'post', this.section, true, false) }, downloadReport(){ - let route = route('newDebtor.export'); + let url = route('newDebtor.export'); if(window.LARAVEL_VAPOR_ENABLED){ - this.$store.dispatch('crudRequest', {endpoint: route, method: 'get'}) + this.$store.dispatch('crudRequest', {endpoint: url, method: 'get'}) .then(response => { let success = response.ok; @@ -88,7 +88,7 @@ ); } else{ - window.open(route, '_blank'); + window.open(url, '_blank'); } }, }, diff --git a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue index f171ec83..2adb9a43 100644 --- a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue @@ -124,7 +124,6 @@
- - + + Export Leads Data
diff --git a/resources/views/pages/downloads/index.blade.php b/resources/views/pages/downloads/index.blade.php index 6c75f192..1cf3a36b 100644 --- a/resources/views/pages/downloads/index.blade.php +++ b/resources/views/pages/downloads/index.blade.php @@ -9,15 +9,57 @@
- customers.csv - +
+ customers.csv +

(last 12 months)

+
+ + Download + +
+
+
+ +
+
+
+
+ transactions.csv +

(last 1 month)

+
+ Download
+
+
+
+
+
+ bookingData.csv +

(last 1 month)

+
+ + Download + +
+
+
+
+
+
+ billingData.csv + + Download + +
+
+
+
diff --git a/routes/web.php b/routes/web.php index 7cd12903..6a6a6d67 100644 --- a/routes/web.php +++ b/routes/web.php @@ -289,8 +289,8 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){ })->name('billplz.bill'); -Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export')->name('customer.export'); -Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions'); +Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export')->name('customers.export'); +Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions')->name('transactions.export'); Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export'); Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export'); Route::get('/export/white-form-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@whiteFormTransactions')->name('whiteFormTransactions.export'); @@ -300,8 +300,8 @@ Route::get('/export/invoice-transactions/f614e339d7058904a831aad742e24d55', 'Exp Route::get('/export/receipt-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@receiptTransactions')->name('receiptTransactions.export'); Route::get('/export/imported-invoice-mapped', 'Exports\ExportCustomersToExcelController@importedInvoiceMapped')->name('importedInvoiceMapped.export'); Route::get('/export/imported-receipt-mapped', 'Exports\ExportCustomersToExcelController@importedReceiptMapped')->name('importedReceiptMapped.export'); -Route::get('/export/analytic/booking', 'Exports\ExportAnalyticToExcelController@bookingData'); -Route::get('/export/analytic/bills', 'Exports\ExportAnalyticToExcelController@billingData'); +Route::get('/export/analytic/booking', 'Exports\ExportAnalyticToExcelController@bookingData')->name('bookingData.export');; +Route::get('/export/analytic/bills', 'Exports\ExportAnalyticToExcelController@billingData')->name('billingData.export');; Route::get('/export/customers/leads', 'Exports\ExportCustomersToExcelController@leadsData')->name('leads.export'); route::get('/export/excel/{id}', 'Exports\ExportCustomersToExcelController@exportCurrencyVendorOrder')->name('group.excel'); diff --git a/vapor.yml b/vapor.yml index b1e6fd94..c70edd09 100644 --- a/vapor.yml +++ b/vapor.yml @@ -11,8 +11,6 @@ environments: - exchange-high_priority-production database: cief-amazon-rds-mysql storage: exchange-2.0-production - # gateway-version: 2 - # cache: vapor-laravel-poc-cache runtime: 'docker' timeout: 180 build: @@ -20,13 +18,6 @@ environments: - 'npm install' - 'npm run prod' - 'gulp build' - # - 'rm -rf node_modules' - # - 'php artisan optimize' - # # - 'php artisan config:clear' - # - 'php artisan key:generate' - # - 'php artisan config:cache' - # - 'php artisan route:cache' - # - 'php artisan view:cache' deploy: - 'php artisan migrate --force' staging: