From fe5756efc29d3fca09e71f392945045ff09c8b48 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 14 May 2022 15:02:17 +0800 Subject: [PATCH 1/9] export billing analaytic data --- .../ExportsAnalyticBillingTransactions.php | 87 +++++++++++++++++++ .../ValueObjects/Constants/CompanyType.php | 5 ++ .../ExportAnalyticToExcelController.php | 7 ++ routes/web.php | 1 + 4 files changed, 100 insertions(+) create mode 100644 app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php diff --git a/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php new file mode 100644 index 00000000..11fafa15 --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php @@ -0,0 +1,87 @@ +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 Sevice Charge', + 'Supplier Payment Date' + ]; + } + + /** + * @return \Illuminate\Support\Collection|mixed + */ + public function query() + { + return Transaction::where('type', 3); + } + + /** + * @param $transaction + * @return array + */ + public function map($transaction): array + { + dd($transaction->owner->owner->company); + + $paymentmethondArray = PaymentMethodType::PAYMENT_METHODS_ID; + $paymentMethod = $paymentmethondArray[$transaction->payment_method]; + + $companyTypeArray = CompanyType::COMPANY_TYPE_ID; + $companyType = $companyTypeArray[$transaction->owner->owner->company->business_type]; + + return [ + $transaction->id, + $transaction->booking->service->name, + $paymentMethod, + $transaction->owner->owner->company->id, + $transaction->owner->owner->company->segments->first()->name, + $transaction->owner->owner->company->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/routes/web.php b/routes/web.php index 5628c585..50a64e90 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']); From 29ab59bbf77eb9cfc95588b36ac85704798c42c1 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 14 May 2022 20:17:28 +0800 Subject: [PATCH 2/9] update export bill data --- .../ExportsAnalyticBillingTransactions.php | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php index 11fafa15..1798af4f 100644 --- a/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsAnalyticBillingTransactions.php @@ -2,23 +2,17 @@ namespace App\Classes\Modules\Exports\Services; -use App\Classes\General\Eloquent\Filters\ServiceType; -use App\Classes\ValueObjects\Constants\CompanyType; use App\Classes\ValueObjects\Constants\PaymentMethodType; -use App\Models\Booking; -use App\Models\Company; use App\Models\Transaction; use Maatwebsite\Excel\Concerns\Exportable; -use Maatwebsite\Excel\Concerns\FromQuery; +use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadingRow; use Maatwebsite\Excel\Concerns\WithMapping; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\ShouldAutoSize; use Illuminate\Http\Request; -use Illuminate\Support\Facades\DB; -use Carbon\Carbon; -class ExportsAnalyticBillingTransactions implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize +class ExportsAnalyticBillingTransactions implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize { use Exportable; @@ -47,7 +41,7 @@ class ExportsAnalyticBillingTransactions implements FromQuery, WithHeadings, Wit 'Original Amount', 'Supplier Payment', 'Supplier Rate', - 'Supplier Sevice Charge', + 'Supplier Service Charge', 'Supplier Payment Date' ]; } @@ -55,9 +49,9 @@ class ExportsAnalyticBillingTransactions implements FromQuery, WithHeadings, Wit /** * @return \Illuminate\Support\Collection|mixed */ - public function query() - { - return Transaction::where('type', 3); + public function collection() + { + return Transaction::where('type', 3)->get(); } /** @@ -66,22 +60,30 @@ class ExportsAnalyticBillingTransactions implements FromQuery, WithHeadings, Wit */ public function map($transaction): array { - dd($transaction->owner->owner->company); - - $paymentmethondArray = PaymentMethodType::PAYMENT_METHODS_ID; - $paymentMethod = $paymentmethondArray[$transaction->payment_method]; - $companyTypeArray = CompanyType::COMPANY_TYPE_ID; - $companyType = $companyTypeArray[$transaction->owner->owner->company->business_type]; + $bill = $transaction; + $payment = $transaction->owner; + $booking = $payment->owner; + $company = $booking->company; return [ - $transaction->id, - $transaction->booking->service->name, - $paymentMethod, - $transaction->owner->owner->company->id, - $transaction->owner->owner->company->segments->first()->name, - $transaction->owner->owner->company->created_at, - + $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 From f39601c5ef286e393d1fc5ca24e5e35fa012779d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 17 May 2022 14:46:00 +0800 Subject: [PATCH 3/9] hide create order for lingesh --- .../bookings/forms/SupplierPlaceOrderFormComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue index 4ec71edd..c3b1a6de 100644 --- a/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue @@ -47,7 +47,7 @@
- +
From 94cc136462f8e110947fc44f24c114fa6d2961dc Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 21 May 2022 13:48:06 +0800 Subject: [PATCH 4/9] add chromatic --- package.json | 1 + 1 file changed, 1 insertion(+) 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", From 3921919d865f5dc588a3b7a5866ec1450073c8b4 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 1 Jun 2022 10:13:36 +0800 Subject: [PATCH 5/9] update pending supplier list --- .../SupplierPendingOrderComponent.vue | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue index 80eb3932..441c2df3 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()}}

+
+
From 2cae88e7fed0b219623e1372d90eff50a44b566e Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 1 Jun 2022 10:15:32 +0800 Subject: [PATCH 6/9] update pending supplier list --- .../bookings/elements/SupplierPendingOrderComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue index 441c2df3..e4877e96 100644 --- a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue +++ b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue @@ -99,7 +99,7 @@ -
+

{{item.recipient_bank_account.holder_name}}

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

From d2a8fb9fc840170fa66e59176d4ee88414872a51 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 8 Jun 2022 10:49:03 +0800 Subject: [PATCH 7/9] unhide create supplier order for lingesh --- .../bookings/forms/SupplierPlaceOrderFormComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue index c3b1a6de..4ec71edd 100644 --- a/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/SupplierPlaceOrderFormComponent.vue @@ -47,7 +47,7 @@
- +
From ace3b433922c7f27346fc73be86faae10f6febf1 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 8 Jun 2022 15:31:55 +0800 Subject: [PATCH 8/9] show all service for currency suppliers --- app/Models/Company.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Company.php b/app/Models/Company.php index def72720..11560c79 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Classes\General\Interfaces\Documentable; use App\Classes\Modules\ServiceTypes\DataTransferObjects\ServiceConfigurationsObject; use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\SegmentConstants; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -135,7 +136,7 @@ class Company extends AbstractModel implements Documentable return $this->services()->get()->map(function($service) { return new ServiceConfigurationsObject($service, $service->constants->where('reference', SegmentConstants::SERVICE_TYPE)->first(), - $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id'))); + $this->type === BusinessType::CURRENCY_VENDOR ? $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE) : $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id'))); }); } From 297f1c5c7155f9ff000fb10ff9d4a428e1299c8a Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 8 Jun 2022 15:35:26 +0800 Subject: [PATCH 9/9] show all service for currency suppliers --- app/Models/Company.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Models/Company.php b/app/Models/Company.php index 11560c79..def72720 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -4,7 +4,6 @@ namespace App\Models; use App\Classes\General\Interfaces\Documentable; use App\Classes\Modules\ServiceTypes\DataTransferObjects\ServiceConfigurationsObject; use App\Classes\ValueObjects\Constants\ApprovalStatus; -use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\SegmentConstants; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -136,7 +135,7 @@ class Company extends AbstractModel implements Documentable return $this->services()->get()->map(function($service) { return new ServiceConfigurationsObject($service, $service->constants->where('reference', SegmentConstants::SERVICE_TYPE)->first(), - $this->type === BusinessType::CURRENCY_VENDOR ? $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE) : $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id'))); + $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id'))); }); }