diff --git a/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php new file mode 100644 index 00000000..1798af4f --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php @@ -0,0 +1,89 @@ +request = $request; + } + + public function headings(): array + { + return [ + 'Booking Id', + 'Service Type', + 'Payment Method', + 'Company Id', + 'Customer Segment', + 'Company Create Date', + 'Company Type', + 'Supplier Id', + 'Customer Payment', + 'Customer Rate', + 'Customer Service Charge', + 'Customer Payment Date', + 'Original Amount', + 'Supplier Payment', + 'Supplier Rate', + 'Supplier Service Charge', + 'Supplier Payment Date' + ]; + } + + /** + * @return \Illuminate\Support\Collection|mixed + */ + public function collection() + { + return Transaction::where('type', 3)->get(); + } + + /** + * @param $transaction + * @return array + */ + public function map($transaction): array + { + + $bill = $transaction; + $payment = $transaction->owner; + $booking = $payment->owner; + $company = $booking->company; + + return [ + $booking->id, + $booking->service->name, + PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method], + $company->id, + $company->segments->implode('name', ', '), + $company->created_at, + $company->type === 0 ? 'Personal' : 'Company', + $bill->issuerCompany->name, + $payment->amount, + $payment->currency_rate, + $payment->service_charge, + $payment->created_at, + $payment->original_amount, + $bill->amount, + $bill->currency_rate, + $bill->service_charge, + $bill->created_at + ]; + } +} \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/CompanyType.php b/app/Classes/ValueObjects/Constants/CompanyType.php index 61918925..135aa700 100644 --- a/app/Classes/ValueObjects/Constants/CompanyType.php +++ b/app/Classes/ValueObjects/Constants/CompanyType.php @@ -8,4 +8,9 @@ final class CompanyType { public const COMPANY_BUSINESS = 1; + public const COMPANY_TYPE_ID = [ + self::PERSONAL_BUSINESS => 'PERSONAL_BUSINESS', + self::COMPANY_BUSINESS => 'COMPANY_BUSINESS', + ]; + } diff --git a/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php b/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php index 135e570d..2a93a991 100644 --- a/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php +++ b/app/Http/Controllers/Exports/ExportAnalyticToExcelController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Exports; use App\Classes\Modules\Exports\Services\ExportsAnalyticBookingTransactions; +use App\Classes\Modules\Exports\Services\ExportsAnalyticBillingTransactions; use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -27,4 +28,10 @@ class ExportAnalyticToExcelController ob_end_clean(); return $response; } + + public function billingData(ExportsAnalyticBillingTransactions $exportsAnalyticBillingTransactions, Request $request){ + $response = $exportsAnalyticBillingTransactions->download('billingData.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/package.json b/package.json index ced333fa..5d4b92bf 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ }, "devDependencies": { "axios": "^0.21.0", + "chromatic": "^6.5.4", "cross-env": "^7.0.2", "del": "^6.0.0", "fancy-log": "^1.3.0", diff --git a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue index 80eb3932..e4877e96 100644 --- a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue +++ b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue @@ -20,11 +20,20 @@
-
timer
-
- {{item.interval.value}} - {{item.interval.duration}} - days +
+
+
timer
+
+ {{item.interval.value}} + {{item.interval.duration}} + days +
+
+
+
+
+ 1688 +
@@ -90,6 +99,13 @@ +
+
+

{{item.recipient_bank_account.holder_name}}

+

{{item.recipient_bank_account.bank_name}}({{item.recipient_bank_account.bank_branch}})

+

{{item.recipient_bank_account.type === 3 ? item.recipient_bank_account.account_no : item.recipient_bank_account.account_no.replace(/[^\dA-Z]/g, '').replace(/(.{4})/g, '$1 ').trim()}}

+
+
diff --git a/routes/web.php b/routes/web.php index db739cc4..740737ff 100644 --- a/routes/web.php +++ b/routes/web.php @@ -97,6 +97,7 @@ Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callba Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export'); Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions'); Route::get('/export/analytic/booking', 'Exports\ExportAnalyticToExcelController@bookingData'); +Route::get('/export/analytic/bills', 'Exports\ExportAnalyticToExcelController@billingData'); Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) { return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);