mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
Merge branch 'dillon/34.4-jenkins-vapor' into vapor/development
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LogHelper
|
||||
{
|
||||
private String $channelName;
|
||||
|
||||
public static function channel($channelName): self
|
||||
{
|
||||
$logHelper = new self;
|
||||
$logHelper->channelName = $channelName;
|
||||
return $logHelper;
|
||||
}
|
||||
|
||||
public function info($message)
|
||||
{
|
||||
$envVar = env('LARAVEL_VAPOR_ENABLED');
|
||||
Log::info("LogHelper.info: {$message}, channelName: {$this->channelName}, envVar {$envVar}");
|
||||
if ($envVar) {
|
||||
Log::channel($this->channelName.'_vapor')->info($message);
|
||||
}
|
||||
else{
|
||||
Log::channel($this->channelName)->info($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function warning($message)
|
||||
{
|
||||
$envVar = env('LARAVEL_VAPOR_ENABLED');
|
||||
Log::info("LogHelper.warning: {$message}, channelName: {$this->channelName}, envVar {$envVar}");
|
||||
if ($envVar) {
|
||||
Log::channel($this->channelName . '_vapor')->warning($message);
|
||||
} else {
|
||||
Log::channel($this->channelName)->warning($message);
|
||||
}
|
||||
}
|
||||
|
||||
public function error($message)
|
||||
{
|
||||
$envVar = env('LARAVEL_VAPOR_ENABLED');
|
||||
Log::info("LogHelper.error: {$message}, channelName: {$this->channelName}, envVar {$envVar}");
|
||||
if ($envVar) {
|
||||
Log::channel($this->channelName . '_vapor')->error($message);
|
||||
} else {
|
||||
Log::channel($this->channelName)->error($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,11 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class DeleteOrderV2CommandJob implements ShouldQueue
|
||||
{
|
||||
@@ -72,10 +74,15 @@ class DeleteOrderV2CommandJob implements ShouldQueue
|
||||
$text = implode(', ', $text);
|
||||
}
|
||||
|
||||
Log::info(Carbon::now() . ' : ' . $text);
|
||||
Log::info(Carbon::now() . ' [DeleteOrderV2] : ' . $text);
|
||||
$filesystemDriver = Storage::getDefaultDriver();
|
||||
if($filesystemDriver === 's3'){
|
||||
|
||||
$filePath = storage_path('logs/delete-orders.log'); //cief todo: should map to the equivalent in AWS S3 bucket
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
}
|
||||
else{
|
||||
$filePath = storage_path('logs/delete-orders.log');
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\Booking;
|
||||
|
||||
class DeleteOrderCommand extends Command
|
||||
@@ -77,10 +78,15 @@ class DeleteOrderCommand extends Command
|
||||
$text = implode(', ', $text);
|
||||
}
|
||||
|
||||
$this->info(Carbon::now() . ' : ' . $text);
|
||||
$this->info(Carbon::now() . ' [DeleteOrderV1]: ' . $text);
|
||||
$filesystemDriver = Storage::getDefaultDriver();
|
||||
if($filesystemDriver === 's3'){
|
||||
|
||||
$filePath = storage_path('logs/delete-orders.log');
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
}
|
||||
else{
|
||||
$filePath = storage_path('logs/delete-orders.log');
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"laravel/vapor-cli": "^1.55",
|
||||
"laravel/vapor-core": "^2.33",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"maxbanton/cwh": "^2.0",
|
||||
"mpdf/mpdf": "^8.1",
|
||||
"rinvex/countries": "^6.1",
|
||||
"rspective/voucherify": " v2.0.*",
|
||||
|
||||
Vendored
+7
@@ -38,6 +38,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>
|
||||
|
||||
@@ -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>
|
||||
+123
@@ -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;
|
||||
|
||||
|
||||
@@ -296,6 +300,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){
|
||||
@@ -476,6 +481,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;
|
||||
@@ -500,6 +506,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>';
|
||||
@@ -517,6 +531,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>';
|
||||
@@ -542,6 +557,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();
|
||||
|
||||
@@ -1074,6 +1118,85 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
|
||||
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>';
|
||||
});
|
||||
|
||||
//Laravel Vapor - Starts
|
||||
Route::get('/aws-image-upload', 'AWS\AWSImageUploadController@imageUpload')->name('aws.image.upload');
|
||||
Route::post('/aws-image-upload', 'AWS\AWSImageUploadController@imageUploadPost')->name('aws.image.upload.post');
|
||||
|
||||
Reference in New Issue
Block a user