mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Laravel Vapor - New UI for admin to download reports (sync code from Shipping Portal)
This commit is contained in:
@@ -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()->subMonths(3), 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
|
||||
'',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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::whereIn('type', [TransactionType::PAYMENT, TransactionType::BILL])
|
||||
->where('owner_type', '!=',Wallet::class)
|
||||
->whereBetween('created_at', [Carbon::now()->subMonths(3), Carbon::now()]); //Limit, 'expensive' query;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
<div class="col-md-6">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<span>customers.csv</span>
|
||||
<div>
|
||||
<span>customers.csv</span>
|
||||
<p class="text-muted mb-0">(last 12 months)</p>
|
||||
</div>
|
||||
<open-link-in-new-tab-component custom-class="btn btn-primary" :url="route('customers.export')">
|
||||
<i class="fa fa-download"></i> Download
|
||||
</open-link-in-new-tab-component>
|
||||
@@ -20,7 +23,10 @@
|
||||
<div class="col-md-6">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<span>transactions.csv</span>
|
||||
<div>
|
||||
<span>transactions.csv</span>
|
||||
<p class="text-muted mb-0">(last 3 months)</p>
|
||||
</div>
|
||||
<open-link-in-new-tab-component custom-class="btn btn-primary" :url="route('transactions.export')">
|
||||
<i class="fa fa-download"></i> Download
|
||||
</open-link-in-new-tab-component>
|
||||
@@ -32,7 +38,10 @@
|
||||
<div class="col-md-6">
|
||||
<div class="card mb-3">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<span>bookingData.csv</span>
|
||||
<div>
|
||||
<span>bookingData.csv</span>
|
||||
<p class="text-muted mb-0">(last 3 months)</p>
|
||||
</div>
|
||||
<open-link-in-new-tab-component custom-class="btn btn-primary" :url="route('bookingData.export')">
|
||||
<i class="fa fa-download"></i> Download
|
||||
</open-link-in-new-tab-component>
|
||||
|
||||
Reference in New Issue
Block a user