mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
bulk download white form and supplier filter
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
use ZipArchive;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Models\Company;
|
||||
use App\Models\Group;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class BulkDownloadSupplierWhiteFormsLogic
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return void
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(Request $request)
|
||||
{
|
||||
$startDate = Carbon::createFromFormat('d-m-Y', $request->input('startDate'))->startOfDay();
|
||||
$endDate = Carbon::createFromFormat('d-m-Y', $request->input('endDate'))->endOfDay();
|
||||
|
||||
$companyReference = Company::find($request->input('supplier'))->reference;
|
||||
$groups = Group::where('issuer', $request->input('supplier'))
|
||||
->whereDate('created_at', '>=', $startDate)
|
||||
->whereDate('created_at', '<=', $endDate)
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
if (count($groups) > 0) {
|
||||
$zip_file = "currency_vendor_orders_{$request->input('startDate')}_to_{$request->input('endDate')}_{$companyReference}.zip";
|
||||
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($zip_file, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
|
||||
foreach($groups as $group) {
|
||||
$document = $group->documents()->where('document_type', DocumentType::CURRENCY_VENDOR_ORDER)->whereNull('deleted_at')->first()->files()->first();
|
||||
$zip->addFile(Storage::disk('documents')->path($document->file->file_info->original->file), $group->reference . '.pdf');
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
while (ob_get_level()) {
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
return response()->download($zip_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\BulkDownloadSupplierWhiteFormsLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BulkDownloadSupplierWhiteFormsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param BulkDownloadSupplierWhiteFormsLogic $logic
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function download(Request $request, BulkDownloadSupplierWhiteFormsLogic $logic) {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row m-l-0 m-r-0">
|
||||
<div class="col-3 mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.supplier">
|
||||
<label>Supplier</label>
|
||||
<selectable-component :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="exportSupplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="parameters.supplier"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-3 mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.startDate">
|
||||
<label class="all-caps">Start Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.startDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-3 mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.endDate">
|
||||
<label class="all-caps">End Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.endDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto p-l-3 p-r-3 p-md-0">
|
||||
<div class="btn btn-lg btn-primary fs-11 w-100 h-100 d-flex justify-content-center align-items-center" @click="bulkDownloadWhiteForm()">
|
||||
<span>
|
||||
Export White Form
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
supplier: ''
|
||||
},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
supplier: {
|
||||
required
|
||||
},
|
||||
startDate: {
|
||||
required
|
||||
},
|
||||
endDate: {
|
||||
required
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
bulkDownloadWhiteForm(){
|
||||
window.open(route('suppliers.white_forms') + '?supplier=' + this.parameters.supplier + '&startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank');
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 p-l-0">
|
||||
<download-billing-with-dates-component section="paymentsReportSection" ></download-billing-with-dates-component>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<validation-wrapper-component selectable :validator="$v.filterSupplier">
|
||||
<label>Supplier</label>
|
||||
<selectable-component :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]})" section="supplierFilterSection" valueColumn="id" :labelColumn="['name']" v-model="filterSupplier"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button type="button" class="btn btn-lg btn-secondary fs-11 h-100 d-flex justify-content-center align-items-center" @click="reset()">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col bg-white p-t-15 p-b-15">
|
||||
<div class="row no-margin">
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Complete Payments</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list')" :options="{'type': 1, 'status': 3, 'payment_method_not_in': [4]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-verification-component section="paymentVerificationSection" :data="data" :no_action="true"></payment-verification-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Complete Currency Orders</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component :key="currencyOrderKey" section="completeTransactionGroupsListSection" :options="{'per_page': 20, 'status': 3, ...this.filterSupplier && {'issuer_in': [this.filterSupplier]}}" :endpoint="route('api.transaction.group.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<transaction-group-component section="transactionGroupsListSection" :data="data"></transaction-group-component>
|
||||
</template>
|
||||
</list-component>
|
||||
<!-- <list-component key="2" section="currencyOrdersListSection" :options="{'per_page': 20, 'document_type_in': ['CURRENCY_VENDOR_ORDER'], 'status': 2, 'with_company': true}" :endpoint="route('api.document.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<currency-order-component section="currencyOrdersListSection" :data="data"></currency-order-component>
|
||||
</template>
|
||||
</list-component> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Open Currency Orders</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component :key="currencyOrderKey" section="transactionGroupsListSection" :options="{'per_page': 20, 'status_in': [0, 1, 2], ...this.filterSupplier && {'issuer_in': [this.filterSupplier]}}" :endpoint="route('api.transaction.group.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<transaction-group-component section="transactionGroupsListSection" :data="data"></transaction-group-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-t-15">
|
||||
<div class="col-12 p-l-0">
|
||||
<download-supplier-white-form-component section="paymentsReportSection" ></download-supplier-white-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
filterSupplier: "",
|
||||
currencyOrderKey: 1,
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
filterSupplier: {}
|
||||
},
|
||||
watch: {
|
||||
filterSupplier() {
|
||||
this.currencyOrderKey += 1;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
this.filterSupplier = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,67 +1,4 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 no-padding">
|
||||
<download-billing-with-dates-component section="paymentsReportSection" ></download-billing-with-dates-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col bg-white p-t-15 p-b-15">
|
||||
<div class="row no-margin">
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Complete Payments</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list')" :options="{'type': 1, 'status': 3, 'payment_method_not_in': [4]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-verification-component section="paymentVerificationSection" :data="data" :no_action="true"></payment-verification-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Complete Currency Orders</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="completeTransactionGroupsListSection" :options="{'per_page': 20, 'status': 3}" :endpoint="route('api.transaction.group.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<transaction-group-component section="transactionGroupsListSection" :data="data"></transaction-group-component>
|
||||
</template>
|
||||
</list-component>
|
||||
{{--<list-component key="2" section="currencyOrdersListSection" :options="{'per_page': 20, 'document_type_in': ['CURRENCY_VENDOR_ORDER'], 'status': 2, 'with_company': true}" :endpoint="route('api.document.list')">--}}
|
||||
{{--<template slot="list" slot-scope="{data}">--}}
|
||||
{{--<currency-order-component section="currencyOrdersListSection" :data="data"></currency-order-component>--}}
|
||||
{{--</template>--}}
|
||||
{{--</list-component>--}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Open Currency Orders</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="transactionGroupsListSection" :options="{'per_page': 20, 'status_in': [0, 1, 2]}" :endpoint="route('api.transaction.group.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<transaction-group-component section="transactionGroupsListSection" :data="data"></transaction-group-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<payment-component></payment-component>
|
||||
@endsection
|
||||
@@ -261,6 +261,7 @@ Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exp
|
||||
Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions')->name('walletTransactions.export');
|
||||
Route::get('/export/booking-transactions', 'Exports\ExportCustomersToExcelController@bookingTransactions')->name('export.transactions.booking');
|
||||
Route::get('/export/invoice-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@invoiceTransactions')->name('invoiceTransactions.export');
|
||||
Route::get('/supplier/white-form/bulk-download', 'Companies\BulkDownloadSupplierWhiteFormsController@download')->name('suppliers.white_forms');
|
||||
|
||||
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
|
||||
$bookings = Booking::where(function($query){
|
||||
|
||||
Reference in New Issue
Block a user