mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Group;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ExportCurrencyVendorOrder implements FromView, ShouldAutoSize
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$id = $this->request->route('id');
|
||||
|
||||
$group = Group::findOrFail($id);
|
||||
|
||||
$supplier = $group->issuerCompany;
|
||||
|
||||
$transferFeeTransactions = $group->transactions()->with([
|
||||
'transactions' => function ($transaction) {
|
||||
return $transaction->where('type', TransactionType::TRANSFER_FEE);
|
||||
}
|
||||
])->get()->pluck('transactions')->flatten();
|
||||
|
||||
return view('pages.pdfs.currency_vendor_order_inner', [
|
||||
'transactions' => $group->transactions,
|
||||
'transferFeeTransactions' => $transferFeeTransactions,
|
||||
'supplier' => $supplier
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,23 @@ final class TransactionType {
|
||||
|
||||
public const BILL_REFUND = 16;
|
||||
|
||||
}
|
||||
public const ID_TO_NAME = [
|
||||
self::PAYMENT_ATTEMPT => "PAYMENT_ATTEMPT",
|
||||
self::PAYMENT => "PAYMENT",
|
||||
self::INVOICE => "INVOICE",
|
||||
self::BILL => "BILL",
|
||||
self::PROFORMA => "PROFORMA",
|
||||
self::TOP_UP => "TOP_UP",
|
||||
self::REFUND => "REFUND",
|
||||
self::PURCHASE_ORDER => "PURCHASE_ORDER",
|
||||
self::SUPPLIER_DELIVER => "SUPPLIER_DELIVER",
|
||||
self::CREDIT_NOTE => "CREDIT_NOTE",
|
||||
self::DEBIT_NOTE => "DEBIT_NOTE",
|
||||
self::WITHDRAW => "WITHDRAW",
|
||||
self::TRANSFER_FEE => "TRANSFER_FEE",
|
||||
self::CASH_BACK => "CASH_BACK",
|
||||
self::SUPPLIER_PAYMENT => "SUPPLIER_PAYMENT",
|
||||
self::SUPPLIER_REFUND => "SUPPLIER_REFUND",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Exports;
|
||||
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportCurrencyVendorOrder;
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomers;
|
||||
use App\Classes\Modules\Exports\Services\ExportsTransactions;
|
||||
use App\Classes\Modules\Exports\Services\ExportsBookingTransactions;
|
||||
@@ -37,6 +38,12 @@ class ExportCustomersToExcelController
|
||||
public function export(ExportsCustomers $exportsCustomers, Request $request){
|
||||
return $exportsCustomers->download('customers.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
public function exportCurrencyVendorOrder(ExportCurrencyVendorOrder $exportCurrencyVendorOrder, Request $request){
|
||||
$exportCurrencyVendorOrder = new ExportCurrencyVendorOrder($request);
|
||||
$response = $exportCurrencyVendorOrder->download('CurrencyVendorOrder.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function transactions(ExportsTransactions $exportsTransactions, Request $request){
|
||||
return $exportsTransactions->download('transactions.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
|
||||
@@ -56,7 +56,8 @@ class BookingResource extends JsonResource
|
||||
->whereDate('expires_on', '>=', Carbon::now())
|
||||
->get()
|
||||
),
|
||||
'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()),
|
||||
// 'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()),
|
||||
'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::EXPIRED)->get()),
|
||||
'payment_history' => TransactionResource::collection($this->transactions()->where(function($query){
|
||||
$query->where(function($query){
|
||||
$query->payments()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED, ApprovalStatus::REFUNDED]);
|
||||
|
||||
Vendored
+7
@@ -34,6 +34,13 @@ Vue.use(VueTheMask);
|
||||
Vue.use(filters);
|
||||
|
||||
Vue.directive('closable', closable);
|
||||
Vue.directive('tooltip', function(el, binding){
|
||||
$(el).tooltip({
|
||||
title: binding.value,
|
||||
placement: binding.arg,
|
||||
trigger: 'hover'
|
||||
})
|
||||
})
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
route: route
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<download-supplier-white-form-component section="paymentsReportSection" ></download-supplier-white-form-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row m-b-20">
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="row">
|
||||
<div class="col p-l-0">
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10" v-show="!hasRefundInProgress && [2, 3].includes(item.status) && (totalRequestedRefund + totalRefunds) < data.original_amount">
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && (totalRequestedRefund + totalRefunds) < data.original_amount">
|
||||
<div class="col" v-if="$store.getters.isAdmin">
|
||||
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal" data-type="transferSummary">Request Refund</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="transferSummary" size="large">
|
||||
@@ -319,7 +319,7 @@
|
||||
<div class="row" v-if="data.transaction_refunds.length > 0 && expandRefundTransactions">
|
||||
<div class="col bg-white padding-15">
|
||||
<div class="b-b b-grey m-b-5" v-for="(refund, index) in data.transaction_refunds">
|
||||
<div class="row m-b-10">
|
||||
<div class="row m-b-10 parentContainer">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Created At</div>
|
||||
<div class="font-heading fs-10">
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<div class="row m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Paid Amount: {{ paidAmount }}</div>
|
||||
<div class="font-heading all-caps fs-10 m-b-5" v-if="this.data.refunded_amount > 0">Paid Amount: {{ (Math.round((this.data.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2) }}</div>
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Refund Amount: {{ refundAmount }}</div>
|
||||
<div class="font-heading all-caps fs-10 m-b-5" v-if="this.data.refunded_amount > 0">Refunded Amount: {{ (Math.round((this.data.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2) }}</div>
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Refund Amount Requested: {{ refundAmount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -67,7 +67,7 @@
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { maxValue } from "vuelidate/lib/validators";
|
||||
import { maxValue, required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -92,7 +92,9 @@ export default {
|
||||
refundAmount: {
|
||||
maxValue: maxValue(this.refundMaxValue)
|
||||
},
|
||||
refundRemark: {}
|
||||
refundRemark: {
|
||||
required
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
<a :href="route('customer.profile', data.booking.company.reference)">{{data.booking.company.reference}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="$store.getters.isAdmin">
|
||||
<span class="btn requestModal no-border" size="large" data-type="chatmodal">
|
||||
<i class="fa fa-comment-o"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="chatmodal">
|
||||
<remark-component :section="section" :data="data" module_type="Transaction"></remark-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 muted all-caps">Amount</div>
|
||||
<div class="font-heading fs-14 text-success bold">
|
||||
|
||||
@@ -17,6 +17,28 @@
|
||||
{{item.issuer_name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps text-right">Export</div>
|
||||
<div class="row parentcontainer">
|
||||
<div class="col d-flex justify-content-end">
|
||||
<a :href="route('group.text', item.id)" target="_blank" v-tooltip:top="'Export in Text'" class="m-l-5">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-font"></i>
|
||||
</button>
|
||||
</a>
|
||||
<a :href="route('group.excel', item.id)" target="_blank" v-tooltip:top="'Export in Excel'" class="m-l-5">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-file-excel-o"></i>
|
||||
</button>
|
||||
</a>
|
||||
<a :href="route('group.invoice', item.id)" target="_blank" v-tooltip:top="'Export Invoice PDF'" class="m-l-5">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-list-alt"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
@@ -79,11 +101,6 @@
|
||||
<div class="col-auto">
|
||||
<div class="row parentContainer">
|
||||
<div class="col p-l-0">
|
||||
<a :href="route('group.text', item.id)" target="_blank">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-align-left"></i>
|
||||
</button>
|
||||
</a>
|
||||
<button class="btn btn-xs btn-complete b-rad-none">
|
||||
<i class="fa fa-refresh" @click="updateDo()"></i>
|
||||
</button>
|
||||
|
||||
@@ -74,9 +74,6 @@
|
||||
data(){
|
||||
return {
|
||||
filters: this.options,
|
||||
pollingInterval: null,
|
||||
isPolling: false,
|
||||
isFetchingResult: false,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
@@ -87,13 +84,26 @@
|
||||
computed: {
|
||||
pendingList () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
}
|
||||
},
|
||||
getJob() {
|
||||
return this.$store.getters.getJob(this.section);
|
||||
},
|
||||
getJobAttemptCount() {
|
||||
return this.$store.getters.getJobAttemptCount(this.section);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
pendingList(inComplete){
|
||||
if(inComplete){
|
||||
this.fetchList();
|
||||
}
|
||||
},
|
||||
getJobAttemptCount(newValue, oldValue) {
|
||||
// console.log('Old value:', JSON.stringify(oldValue));
|
||||
// console.log('New value:', JSON.stringify(newValue));
|
||||
if(this.getJob){
|
||||
this.fetchJobResult(this.getJob.isLastAttempt);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -101,7 +111,7 @@
|
||||
let listDecorators = this.$store.getters.getListDetails(this.section);
|
||||
let url = this.endpoint + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters);
|
||||
this.isLoading = true;
|
||||
this.submitJob(url);
|
||||
this.$store.dispatch('submitJobRequest', {'url': url, 'name': this.section});
|
||||
},
|
||||
//cief todo: remove?
|
||||
// updateFilters(filters){
|
||||
@@ -125,82 +135,21 @@
|
||||
to: result.meta.to,
|
||||
total: result.meta.total
|
||||
};
|
||||
|
||||
this.stopPolling();
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': result.data});
|
||||
this.$store.dispatch('stopPollingJobResultByJobId', {'jobId': this.getJob.jobId});
|
||||
this.$refs.pagination.makePagination(result.meta, result.links);
|
||||
this.isLoading = false;
|
||||
},
|
||||
errorHandler(error){
|
||||
this.isFetchingResult = false;
|
||||
this.isPolling = false;
|
||||
},
|
||||
startPolling(jobId, maxAttempts = 8) {
|
||||
let attempts = 0;
|
||||
let interval = 10000; // Initial interval
|
||||
|
||||
const resetPollingInterval = (customInterval) => {
|
||||
this.pollingInterval = setInterval(pollJobResult, customInterval);
|
||||
};
|
||||
|
||||
const pollJobResult = () => {
|
||||
if (this.isPolling || this.isFetchingResult) {
|
||||
return;
|
||||
}
|
||||
this.isPolling = true;
|
||||
|
||||
attempts++;
|
||||
if(attempts === 1){
|
||||
this.stopPolling();
|
||||
resetPollingInterval(5000);
|
||||
}
|
||||
|
||||
if (attempts > maxAttempts) {
|
||||
this.stopPolling();
|
||||
this.isLoading = false;
|
||||
console.log(`Reached maximum attempts (${maxAttempts}). Polling stopped.`);
|
||||
return;
|
||||
}
|
||||
|
||||
if(attempts === maxAttempts){
|
||||
this.fetchJobResult(jobId, true);
|
||||
}
|
||||
else{
|
||||
this.fetchJobResult(jobId);
|
||||
}
|
||||
};
|
||||
|
||||
// pollJobResult(); // Initial call
|
||||
this.pollingInterval = setInterval(pollJobResult, interval);
|
||||
},
|
||||
stopPolling() {
|
||||
clearInterval(this.pollingInterval);
|
||||
this.pollingInterval = null;
|
||||
this.isPolling = false;
|
||||
this.isFetchingResult = false;
|
||||
},
|
||||
submitJob(url){
|
||||
try {
|
||||
this.$store.dispatch('crudRequest', {endpoint: url, method: 'get'}).then(response => {
|
||||
let success = response.ok;
|
||||
response.json().then(response => {
|
||||
if(!success){return;}
|
||||
let jobId = response.payload.data.job_id;
|
||||
if(jobId){
|
||||
this.startPolling(jobId);
|
||||
}
|
||||
});
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error submitJob', error);
|
||||
}
|
||||
// console.log("Error: " + JSON.stringify(error));
|
||||
this.$store.dispatch('updatePollingJobResultByJobId', {'jobId': this.getJob.jobId, 'isPolling': false, 'isFetchingResult': false });
|
||||
},
|
||||
fetchJobResult(jobId, isLastAttempt = false) {
|
||||
this.isFetchingResult = true;
|
||||
this.$store.dispatch('updatePollingJobResultByJobId', {'jobId': this.getJob.jobId, 'isFetchingResult': true });
|
||||
try {
|
||||
let anotherEndpoint = route('api.job.fetch', jobId);
|
||||
let anotherEndpoint = route('api.job.fetch', this.getJob.jobId);
|
||||
if(isLastAttempt){
|
||||
anotherEndpoint = route('api.job.fetch.last.attempt', jobId, isLastAttempt);
|
||||
anotherEndpoint = route('api.job.fetch.last.attempt', this.getJob.jobId, isLastAttempt);
|
||||
}
|
||||
this.poll(anotherEndpoint, 'get', this.section, false, false); //cief todo: Uncaught (in promise) null
|
||||
} catch (error) {
|
||||
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
|
||||
const state = {
|
||||
pollingJobResults: []
|
||||
};
|
||||
|
||||
export default {
|
||||
state,
|
||||
getters: {
|
||||
getJob: (state) => (name) => {
|
||||
return state.pollingJobResults.find(item => item.name === name);;
|
||||
},
|
||||
getJobAttemptCount: (state) => (name) => {
|
||||
let job = state.pollingJobResults.find(item => item.name === name);
|
||||
return job ? job.pollingAttemptsCount : 0;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
ADD_POLLING_JOB_RESULT(state, {jobId, name, pollingAttemptsCount, isPolling, isFetchingResult, maxAttempts, pollJobResult, interval}) {
|
||||
let intervalId = setInterval(() => {
|
||||
if (pollJobResult) {
|
||||
pollJobResult(state);
|
||||
}
|
||||
}, interval);
|
||||
state.pollingJobResults.push({ jobId, name, pollingAttemptsCount, isPolling, isFetchingResult, maxAttempts, intervalId});
|
||||
},
|
||||
UPDATE_POLLING_JOB_RESULT(state, { jobId, pollingAttemptsCount, isPolling, isFetchingResult, isLastAttempt}) {
|
||||
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
|
||||
if (index !== -1) {
|
||||
const updatedPollingJobResults = [...state.pollingJobResults];
|
||||
updatedPollingJobResults[index] = { ...updatedPollingJobResults[index],
|
||||
jobId,
|
||||
pollingAttemptsCount: pollingAttemptsCount !== undefined ? pollingAttemptsCount : updatedPollingJobResults[index].pollingAttemptsCount,
|
||||
isPolling: isPolling !== undefined ? isPolling : updatedPollingJobResults[index].isPolling,
|
||||
isFetchingResult: isFetchingResult !== undefined ? isFetchingResult : updatedPollingJobResults[index].isFetchingResult,
|
||||
isLastAttempt: isLastAttempt !== undefined ? isLastAttempt : updatedPollingJobResults[index].isLastAttempt,
|
||||
};
|
||||
state.pollingJobResults = updatedPollingJobResults;
|
||||
}
|
||||
},
|
||||
REMOVE_POLLING_JOB_RESULT_BY_JOBID(state, jobId) {
|
||||
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
|
||||
if (index !== -1) {
|
||||
clearInterval(state.pollingJobResults[index].intervalId);
|
||||
state.pollingJobResults.splice(index, 1);
|
||||
}
|
||||
},
|
||||
// REMOVE_POLLING_JOB_RESULT_BY_JOBID_2(state, jobId) {
|
||||
// const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
|
||||
// if (index !== -1) {
|
||||
// clearInterval(state.pollingJobResults[index].intervalId);
|
||||
// //state.pollingJobResults.splice(index, 1);
|
||||
// }
|
||||
// },
|
||||
REMOVE_POLLING_JOB_RESULT_BY_NAME(state, name) {
|
||||
const index = state.pollingJobResults.findIndex(s => s.name === name);
|
||||
if (index !== -1) {
|
||||
clearInterval(state.pollingJobResults[index].intervalId);
|
||||
state.pollingJobResults.splice(index, 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
submitJobRequest({ dispatch }, { url, name }){
|
||||
dispatch('crudRequestV2', {
|
||||
endpoint: url,
|
||||
method: 'get',
|
||||
|
||||
}).then(response => {
|
||||
let success = response.ok;
|
||||
response.json().then(response => {
|
||||
if(!success){return;}
|
||||
let jobId = response.payload.data.job_id;
|
||||
if(jobId){
|
||||
let pollingAttemptsCount = 0;
|
||||
dispatch('startPolling', { jobId, name, pollingAttemptsCount });
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
stopPollingJobResultByJobId({ commit }, { jobId }){
|
||||
commit('REMOVE_POLLING_JOB_RESULT_BY_JOBID', jobId);
|
||||
},
|
||||
|
||||
stopPollingJobResultByName({ commit }, { name }){
|
||||
commit('REMOVE_POLLING_JOB_RESULT_BY_NAME', name);
|
||||
},
|
||||
|
||||
startPolling({ state, commit, dispatch }, { jobId, name, pollingAttemptsCount, maxAttempts = 8}) {
|
||||
let interval = 10000;
|
||||
|
||||
// console.log(`startPolling jobId: ${jobId}, pollingAttemptsCount: ${pollingAttemptsCount}, name: ${name}`);
|
||||
|
||||
const pollJobResult = (state) => {
|
||||
//console.log(`MONITOR state ${JSON.stringify(state)}`);
|
||||
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
|
||||
if (index !== -1) {
|
||||
pollingAttemptsCount = state.pollingJobResults[index].pollingAttemptsCount;
|
||||
if (state.pollingJobResults[index].isPolling || state.pollingJobResults[index].isFetchingResult) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
|
||||
pollingAttemptsCount++;
|
||||
if(pollingAttemptsCount === 1){
|
||||
commit("REMOVE_POLLING_JOB_RESULT_BY_JOBID", jobId );
|
||||
commit("ADD_POLLING_JOB_RESULT", { jobId, name, pollingAttemptsCount, isPolling: false, isFetchingResult: false, maxAttempts, pollJobResult, interval: 5000});
|
||||
}
|
||||
|
||||
if (pollingAttemptsCount > maxAttempts) {
|
||||
//console.log(`Reached maximum attempts (${maxAttempts}). Polling stopped.`);
|
||||
commit("REMOVE_POLLING_JOB_RESULT_BY_JOBID", jobId );
|
||||
return;
|
||||
}
|
||||
|
||||
if(pollingAttemptsCount === maxAttempts){
|
||||
commit('UPDATE_POLLING_JOB_RESULT', { jobId, pollingAttemptsCount, isPolling: true, isFetchingResult: false, isLastAttempt: true });
|
||||
}
|
||||
else{
|
||||
commit('UPDATE_POLLING_JOB_RESULT', { jobId, pollingAttemptsCount, isPolling: true, isFetchingResult: false, isLastAttempt: false});
|
||||
}
|
||||
}
|
||||
commit("ADD_POLLING_JOB_RESULT", { jobId, name, pollingAttemptsCount, isPolling: false, isFetchingResult: false, maxAttempts, pollJobResult, interval});
|
||||
|
||||
},
|
||||
|
||||
updatePollingJobResultByJobId({ commit }, { jobId, isPolling, isFetchingResult }){
|
||||
commit('UPDATE_POLLING_JOB_RESULT', { jobId, isPolling, isFetchingResult });
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+3
-1
@@ -7,6 +7,7 @@ import crudRequest from './modules/crudRequest'
|
||||
import crudRequestV2 from './modules/crudRequestV2'
|
||||
import authentication from './modules/authentication'
|
||||
import loadRequestQueue from './modules/loadRequestQueue'
|
||||
import jobPolling from './modules/jobPolling'
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -18,6 +19,7 @@ export default new Vuex.Store({
|
||||
createNotification,
|
||||
crudRequest,
|
||||
crudRequestV2,
|
||||
authentication
|
||||
authentication,
|
||||
jobPolling
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{$supplier->name}}</td>
|
||||
<td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Marking</td>
|
||||
<td>Rate</td>
|
||||
<td>Amount</td>
|
||||
<td>Bank in Details</td>
|
||||
</tr>
|
||||
@foreach($transactions as $transaction)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->owner->owner->marking}}</td>
|
||||
<td>{{$transaction->owner->owner->company->reference}}</td>
|
||||
<td>{{$transaction->currency_rate}}</td>
|
||||
<td>{{$transaction->currency->short_code}} {{number_format((float)$transaction->amount, 2, '.', '')}}</td>
|
||||
<td>Account Holder Name: {{$transaction->owner->owner->bank->holder_name}}<br>{{$transaction->owner->owner->bank->bank_name}}: {{$transaction->owner->owner->bank->account_no}}
|
||||
<br>Branch: {{$transaction->owner->owner->bank->bank_branch}}@if($transaction->original_currency->short_code === 'USD')<br>Swift Code: {{$transaction->owner->owner->bank->swift}}@endif<br>Bank in Amount: {{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Sub total booking amount: </td>
|
||||
@php
|
||||
$sub_total_booking_amount = number_format((float)$transactions->sum('original_amount'), 2, '.', '');
|
||||
@endphp
|
||||
<td>{{$transaction->original_currency->short_code}} {{$sub_total_booking_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Transfer fee: </td>
|
||||
@php
|
||||
$transfer_fee = number_format((float)$transferFeeTransactions->sum('service_charge'), 2, '.', '');
|
||||
@endphp
|
||||
<td>{{$transaction->original_currency->short_code}} {{$transfer_fee}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Total booking amount: </td>
|
||||
@php
|
||||
$total_booking_amount = number_format((float) ($transactions->sum('original_amount') + $transfer_fee), 2, '.', '');
|
||||
@endphp
|
||||
<td>{{$transaction->original_currency->short_code}} {{$total_booking_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Sub total amount: </td>
|
||||
@php
|
||||
$sub_total_amount = number_format((float)$transactions->sum('amount') + ($transfer_fee * 1/$transactions[0]->currency_rate), 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$sub_total_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Service charge: </td>
|
||||
@php
|
||||
$service_charge = number_format((float)$transactions->sum('service_charge'), 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$service_charge}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;" colspan="4">Total amount: </td>
|
||||
@php
|
||||
$total_amount = number_format((float)$sub_total_amount + $service_charge, 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$total_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,85 @@
|
||||
@extends('layouts.base_pdf')
|
||||
<htmlpageheader name="page-header">
|
||||
<br>
|
||||
<table width="100%" style="border-bottom: 1px solid black;">
|
||||
<tr>
|
||||
<td style="text-align: center; color: red; text-transform: uppercase; font-weight: bold; font-size: 18px; padding-bottom: 5px;">
|
||||
{{ $supplier->name }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpageheader>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<strong>Invoice</strong>
|
||||
</td>
|
||||
<td class="document-detail">
|
||||
PO#: {{$group->reference}} <br>
|
||||
Ref#: {{$supplier->reference}} <br>
|
||||
Date: {{$group->created_at}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table class="buyer-seller">
|
||||
<tr>
|
||||
<td width="50%" class="top">
|
||||
<span class="buyer-seller-title">
|
||||
Buyer
|
||||
</span>
|
||||
<br>
|
||||
<span class="buyer-company">
|
||||
CIEF Worldwide Sdn Bhd (1134596-M)
|
||||
</span>
|
||||
<div class="address">
|
||||
No. 72-3, Jalan Jalil 1,<br>
|
||||
The Earth Bukit Jalil,<br>
|
||||
57000 Kuala Lumpur
|
||||
</div>
|
||||
<div class="contact-no">
|
||||
Tel: 03-8082 1252
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table class="line-table" style="overflow: wrap" autosize="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">No</th>
|
||||
<th class="marking" width="10%">Marking</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Currency Rate</th>
|
||||
<th width="15%">Unit Price (RM)</th>
|
||||
<th width="10%">Total Amount<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@foreach($transactions as $key => $transaction)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td width="5%" class="center top">{{ $key + 1 }}</td>
|
||||
<td class="marking top" width="10%">{{$transaction->owner->owner->marking}}</td>
|
||||
<td class="description">Please refer to the appedix reference no: {{$transaction->owner->owner->marking}}</td>
|
||||
<td width="10%" class="center top">{{$transaction->currency_rate}}</td>
|
||||
<td>{{$transaction->currency->short_code}} {{number_format((float)$transaction->amount, 2, '.', '')}}</td>
|
||||
@php
|
||||
$sub_total_booking_amount = number_format((float)$transactions->sum('original_amount'), 2, '.', '');
|
||||
$transfer_fee = number_format((float)$transferFeeTransactions->sum('service_charge'), 2, '.', '');
|
||||
$total_booking_amount = number_format((float) ($transactions->sum('original_amount') + $transfer_fee), 2, '.', '');
|
||||
$sub_total_amount = number_format((float)$transactions->sum('amount') + ($transfer_fee * 1/$transactions[0]->currency_rate), 2, '.', '');
|
||||
$service_charge = number_format((float)$transactions->sum('service_charge'), 2, '.', '');
|
||||
$total_amount = number_format((float)$sub_total_amount + $service_charge, 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$total_amount}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
+124
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DownloadMockUpWhiteFormPdfLogic;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
use App\Http\Controllers\Accounting\BankStatementController;
|
||||
use App\Models\Group;
|
||||
use App\Models\Remark;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
@@ -9,6 +11,7 @@ use App\Models\Wallet;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Company;
|
||||
use App\Models\Transaction;
|
||||
use Dompdf\Dompdf;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
@@ -30,6 +33,7 @@ use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionWithInvoiceNoProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
@@ -291,6 +295,7 @@ Route::get('/export/imported-receipt-mapped', 'Exports\ExportCustomersToExcelCon
|
||||
Route::get('/export/analytic/booking', 'Exports\ExportAnalyticToExcelController@bookingData');
|
||||
Route::get('/export/analytic/bills', 'Exports\ExportAnalyticToExcelController@billingData');
|
||||
Route::get('/export/customers/leads', 'Exports\ExportCustomersToExcelController@leadsData')->name('leads.export');
|
||||
route::get('/export/excel/{id}', 'Exports\ExportCustomersToExcelController@exportCurrencyVendorOrder')->name('group.excel');
|
||||
|
||||
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
|
||||
$bookings = Booking::where(function($query){
|
||||
@@ -471,6 +476,7 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
echo '<td>Last Updated At</td>';
|
||||
echo '<td>Bank Type</td>';
|
||||
echo '<td>Bank Holder Name</td>';
|
||||
echo '<td>Note Remark</td>';
|
||||
echo '</tr>';
|
||||
foreach ($payments->orderBy('updated_at', 'DESC')->get() as $index => $payment){
|
||||
$booking = $payment->owner;
|
||||
@@ -495,6 +501,14 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
$remark = 'Pre ' . $remark;
|
||||
}
|
||||
|
||||
$refundTransactions = $payment->transactions()->refunds()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
|
||||
$noteRemark = '';
|
||||
|
||||
foreach ($refundTransactions as $refund) {
|
||||
$noteRemark .= implode(', ', $refund->remarks->pluck('content')->toArray()) . ' ';
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>'.($index + 1).'.</td>';
|
||||
echo '<td>'.$payment->updated_at->format('d-M-y').'</td>';
|
||||
@@ -512,6 +526,7 @@ Route::get('/approve_refunds', function(Request $request){
|
||||
echo '<td>'.$payment->updated_at->diffForHumans().'</td>';
|
||||
echo '<td>'.$bankType.'</td>';
|
||||
echo '<td>'.$booking->bank->holder_name.'</td>';
|
||||
echo '<td>'.$noteRemark.'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
@@ -537,6 +552,35 @@ Route::get('/group/text/{id}', function($id){
|
||||
}
|
||||
})->name('group.text');
|
||||
|
||||
Route::get('/group/invoice/{id}', function ($id) {
|
||||
|
||||
$group = Group::findOrFail($id);
|
||||
|
||||
$supplier = $group->issuerCompany;
|
||||
|
||||
$transferFeeTransactions = $group->transactions()
|
||||
->with(['transactions' => function ($transaction) {
|
||||
return $transaction->where('type', TransactionType::TRANSFER_FEE);
|
||||
}])
|
||||
->get()
|
||||
->pluck('transactions')
|
||||
->flatten();
|
||||
|
||||
$html = view('pages.pdfs.supplier_deliver_order_group_invoice', [
|
||||
'group'=> $group,
|
||||
'transactions' => $group->transactions,
|
||||
'transferFeeTransactions' => $transferFeeTransactions,
|
||||
'supplier' => $supplier
|
||||
])->render();
|
||||
|
||||
$dompdf = new Dompdf();
|
||||
$dompdf->loadHtml($html);
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
|
||||
return $dompdf->stream("invoice_pdf_{$supplier->name}.pdf");
|
||||
})->name('group.invoice');
|
||||
|
||||
Route::get('/wallet/audit', function (Request $request) {
|
||||
$wallets = \App\Models\Wallet::all();
|
||||
|
||||
@@ -1066,3 +1110,83 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
Route::get('check-duplicate-refunds', function () {
|
||||
$results = Transaction::select('payment_reference', 'owner_id', 'owner_type', 'type', 'status', 'amount', DB::raw('COUNT(*) as count'))
|
||||
->whereNotNull('payment_reference')
|
||||
->where('payment_reference', '<>', '')
|
||||
->where('payment_reference', '<>', 'Withdraw')
|
||||
->where('payment_reference', '<>', 'Refund for Ref. 77315')
|
||||
->whereNull('deleted_at')
|
||||
->groupBy('payment_reference', 'owner_id', 'owner_type', 'type', 'status', 'amount')
|
||||
->having(DB::raw('COUNT(*)'), '>', 1)
|
||||
->get();
|
||||
|
||||
$transactionType = TransactionType::ID_TO_NAME;
|
||||
$approvalStatus = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
echo '<table style="border-collapse: collapse; width: 100%;">';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th style="border: 1px solid black;">Owner Type</th>';
|
||||
echo '<th style="border: 1px solid black;">Owner ID</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment Reference</th>';
|
||||
echo '<th style="border: 1px solid black;">Type</th>';
|
||||
echo '<th style="border: 1px solid black;">Status</th>';
|
||||
echo '<th style="border: 1px solid black;">Count</th>';
|
||||
echo '<th style="border: 1px solid black;">Amount</th>';
|
||||
echo '<th style="border: 1px solid black;">Wallet Details</th>';
|
||||
echo '<th style="border: 1px solid black;">Booking Ref</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment ID</th>';
|
||||
echo '<th style="border: 1px solid black;">Payment Status</th>';
|
||||
echo '<th style="border: 1px solid black;">Refund ID</th>';
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
|
||||
foreach ($results as $result) {
|
||||
$booking_ref_arr = explode(' ', $result->payment_reference);
|
||||
$booking_ref = end($booking_ref_arr);
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td style='border: 1px solid black;'>$result->owner_type</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->owner_id</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->payment_reference</td>";
|
||||
$status = $transactionType[$result->type];
|
||||
echo "<td style='border: 1px solid black;'>$status</td>";
|
||||
$approvalsName = $approvalStatus[$result->status];
|
||||
echo "<td style='border: 1px solid black;'>$approvalsName</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->count</td>";
|
||||
echo "<td style='border: 1px solid black;'>$result->amount</td>";
|
||||
|
||||
$click = null;
|
||||
if ($result->owner_type == 'App\Models\Wallet') {
|
||||
$click = '<a href="'.route('wallet.details', $result->owner->owner->reference).'" target="_blank">'.$result->owner->owner->reference.'</a>';
|
||||
}
|
||||
echo "<td style='border: 1px solid black;'>". $click ."</td>";
|
||||
|
||||
$booking_ref_click = null;
|
||||
$payment = null;
|
||||
$refund = null;
|
||||
if ($booking_ref) {
|
||||
$booking_ref_click = '<a href="'.route('booking.details', $booking_ref).'" target="_blank">'.$booking_ref.'</a>';
|
||||
|
||||
$booking = Booking::where('marking', $booking_ref)->first();
|
||||
if ($booking) {
|
||||
$payment = $booking->transactions()->where('type', TransactionType::PAYMENT)->first();
|
||||
$refund = $payment->transactions()->where('type', TransactionType::REFUND)->get()->pluck('id')->toArray();
|
||||
$refund = implode(',', $refund);
|
||||
}
|
||||
}
|
||||
echo "<td style='border: 1px solid black;'>$booking_ref_click</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($payment ? $payment->id : '') . "</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($payment ? $approvalStatus[$payment->status] : '') . "</td>";
|
||||
echo "<td style='border: 1px solid black;'>" . ($refund ? $refund : '') . "</td>";
|
||||
echo '</tr>';
|
||||
|
||||
|
||||
}
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user