mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0 into development
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Models\Transaction;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
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;
|
||||
|
||||
class ExportsAnalyticBillingTransactions implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->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
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
+21
-5
@@ -20,11 +20,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 muted all-caps">timer</div>
|
||||
<div class="font-heading fs-12 bold" :class="[{'text-success': item.interval.value === '+'}, {'text-danger': item.interval.value === '-'}]">
|
||||
{{item.interval.value}}
|
||||
{{item.interval.duration}}
|
||||
days
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">timer</div>
|
||||
<div class="font-heading fs-12 bold" :class="[{'text-success': item.interval.value === '+'}, {'text-danger': item.interval.value === '-'}]">
|
||||
{{item.interval.value}}
|
||||
{{item.interval.duration}}
|
||||
days
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="item.booking.bank.bank_name.includes('浙江网商银行')">
|
||||
<div class="col">
|
||||
<span class="rounded badge-danger" style="padding: 5px">1688</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,6 +99,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<p>{{item.recipient_bank_account.holder_name}}</p>
|
||||
<p>{{item.recipient_bank_account.bank_name}}<span class="m-l-5">({{item.recipient_bank_account.bank_branch}})</span></p>
|
||||
<p><span class="text-primary">{{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()}}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user