mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of 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
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, Sho
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return Transaction::where('type', TransactionType::BILL);
|
||||
return Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::BILL])->where('owner_type', '!=',Wallet::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +61,18 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, Sho
|
||||
6 => 'EXPIRED'
|
||||
];
|
||||
|
||||
$booking = $transaction->owner->owner;
|
||||
|
||||
$booking = $transaction->owner;
|
||||
if(!($booking instanceof Booking)){
|
||||
$booking = $booking->owner;
|
||||
}
|
||||
|
||||
$company = $booking->company;
|
||||
|
||||
if(!$company instanceof Company) dd($transaction);
|
||||
|
||||
return [
|
||||
$booking ? $booking->company->reference : '',
|
||||
$company->reference,
|
||||
$booking ? $booking->marking : '',
|
||||
$transaction->bill_no,
|
||||
$transaction->owner_id,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -7,7 +7,14 @@
|
||||
<div class="col-auto p-r-0"><div class="icon-thumbnail icon-35 mr-0 btn-rounded text-white light animate__animated animate__infinite" :class="[{'bg-danger': !submitted}, {'animate__pulse': !submitted}, {'bg-success': submitted}]"><span v-if="data.status !==3">2</span><i class='fa fa-check' v-if="data.status === 3"></i></div></div>
|
||||
<div class="col">
|
||||
<div class="fs-14 bold all-caps" :class="[{'text-success': submitted}]">Purchase Order</div>
|
||||
<p class="m-b-0 text-danger fs-12" v-if="!submitted">In order for us to process your order, you will need to provide us with your purchase order information.</p>
|
||||
<p class="m-b-0 fs-12" v-if="!submitted">In order for us to process your order, you will need to provide us with your purchase order information.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="!submitted">
|
||||
<div class="col-auto">
|
||||
<div class="bg-danger p-l-15 p-r-15 p-t-5 p-b-5">
|
||||
<p class="m-b-0 text-white fs-12" >Any Purchase Orders that aren't submitted within 60 days will be closed for editing.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
<div class="row" v-if="paymentTotal > 0">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs btn-success b-rad-none p-t-5 p-b-5 all-caps fs-10 btn-block" @click="submitForm()">Create Order</button>
|
||||
<button class="btn btn-xs btn-success b-rad-none p-t-5 p-b-5 all-caps fs-10 btn-block" @click="submitForm()" v-if="$store.getters.getUserId !== 2495">Create Order</button>
|
||||
<button class="btn btn-xs btn-complete b-rad-none p-t-5 p-b-5 all-caps fs-10 w-100" @click="generateMockWhiteForm()">Create Mock Up White Form</button>
|
||||
</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