mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 295072153d | |||
| e90aebd107 | |||
| b7c6c13bde | |||
| 01d666d92a | |||
| b3973b52d1 | |||
| 694876c31f | |||
| 499782bbec | |||
| f3eca3dd89 | |||
| 9c4c472a40 | |||
| a67afdc0ff | |||
| b30cdaba84 | |||
| 9ac0ca45be | |||
| 3fe98b24a4 | |||
| 7e7e43ee9c | |||
| 39892a0938 | |||
| 0ffe81d1cf | |||
| 5fd6e6a528 | |||
| 09ede52ecf | |||
| e5d6f3f581 | |||
| aa65b333c8 | |||
| 656c50e047 | |||
| 275157b243 | |||
| 0c9ffd2bf7 | |||
| d4dcae155d | |||
| bad8cadb3a | |||
| 3af32cc6e7 | |||
| 34bab6a45c | |||
| dd1eae1ea2 | |||
| b46bfb38bf | |||
| 19c4ee4fda | |||
| 13f13c7a0e | |||
| ffa63f611b | |||
| 82675ab80c | |||
| aac04c4135 | |||
| 56dca799f8 | |||
| 42d8f811c6 | |||
| 030136fd03 | |||
| c8b6e271e3 | |||
| f93997b858 | |||
| 6fbc23d7c4 | |||
| e0a264d58f | |||
| fec20b0947 | |||
| 0bf61d93c5 | |||
| bea24fb48e | |||
| 17a4522f50 | |||
| dfedb99c13 | |||
| 669cac9bd4 | |||
| d7625aece7 | |||
| a36c5c3063 |
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class MarkingIn implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->whereHas('companyModules', function ($module) use ($value) {
|
||||
$module->whereHas('connections', function ($connection) use ($value) {
|
||||
$connection->whereIn('invitee_reference', $value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class FetchOrdersFromYDPortalJob implements ShouldQueue
|
||||
{
|
||||
@@ -29,12 +30,17 @@ class FetchOrdersFromYDPortalJob implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('FetchOrdersFromYDPortalJob starts');
|
||||
Log::info('FetchPackingListsFromYdPortalProcessor starts');
|
||||
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute();
|
||||
Log::info('FetchContainersFromYdPortalProcessor starts');
|
||||
(App()->make(FetchContainersFromYdPortalProcessor::class))->execute();
|
||||
Log::info('FetchContainersUpdatesFromYdPortalProcessor starts');
|
||||
(App()->make(FetchContainersUpdatesFromYdPortalProcessor::class))->execute();
|
||||
Log::info('FetchDeliveryUpdatesFromYdPortalProcessor starts');
|
||||
(App()->make(FetchDeliveryUpdatesFromYdPortalProcessor::class))->execute();
|
||||
|
||||
// (App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
|
||||
Log::info('FetchOrdersFromYDPortalJob ends');
|
||||
// (App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateCustomerLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -167,6 +169,19 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
||||
}
|
||||
|
||||
if(app()->environment(['production'])){
|
||||
// call wac webhook
|
||||
$url = config('wagWebhookUrl.account_registration_url');
|
||||
$payload = [
|
||||
'name' => $request->input('name'),
|
||||
'email' => $request->input('email'),
|
||||
'phone' => $request->input('phone'),
|
||||
'portal' => 'izyim'
|
||||
];
|
||||
$response = Http::post($url, $payload);
|
||||
Log::channel('wac_webhook')->info('Register Account: ' . json_encode($response));
|
||||
}
|
||||
|
||||
// $this->generateEmailVerificationAttemptProcessor->execute($user);
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request));
|
||||
|
||||
@@ -15,7 +15,6 @@ use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use ErrorException;
|
||||
@@ -101,16 +100,6 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||
}
|
||||
|
||||
$addressExtraFields = [
|
||||
'property_type' => $request->input('property_type'),
|
||||
'tools_required_unload' => $request->input('tools_required_unload'),
|
||||
'pickup_time_from' => $request->input('pickup_time_from'),
|
||||
'pickup_time_to' => $request->input('pickup_time_to'),
|
||||
];
|
||||
|
||||
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -103,16 +102,6 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||
}
|
||||
|
||||
$addressExtraFields = [
|
||||
'property_type' => $request->input('property_type'),
|
||||
'tools_required_unload' => $request->input('tools_required_unload'),
|
||||
'pickup_time_from' => $request->input('pickup_time_from'),
|
||||
'pickup_time_to' => $request->input('pickup_time_to'),
|
||||
];
|
||||
|
||||
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
||||
|
||||
return $this->resourceResponse(new AddressResource($address));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Billplzs\Processors;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Wallet;
|
||||
use App\Models\Group;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Processors\ReleaseGoodsToCustomerProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
//Date: 20240817
|
||||
//This Processor is used for one time data patching with OneTimeTransactionFixBillplzFailedCallback.php
|
||||
class CallbackBillplzDataPatchProcessor
|
||||
{
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor;
|
||||
|
||||
/** @var UpdatesWalletBalance */
|
||||
private $updatesWalletBalance;
|
||||
|
||||
/** @var CreatePaymentTransactionProcessor */
|
||||
private $createPaymentTransactionProcessor;
|
||||
|
||||
/** @var ReleaseGoodsToCustomerProcessor */
|
||||
private $releaseGoodsToCustomerProcessor;
|
||||
|
||||
/**
|
||||
* CallbackBillplzDataPatchProcessor constructor.
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
|
||||
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
|
||||
* @param ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor
|
||||
*/
|
||||
public function __construct(UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor, ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor)
|
||||
{
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
|
||||
$this->releaseGoodsToCustomerProcessor = $releaseGoodsToCustomerProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute($transaction, $status)
|
||||
{
|
||||
$invoice = $transaction->owner;
|
||||
$packingList = $invoice->owner;
|
||||
|
||||
$proceed = $this->checkForGroupPayment($transaction);
|
||||
if(!$proceed) return false;
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
Log::info('CallbackBillplzDataPatchProcessor 1');
|
||||
|
||||
// check if is wallet top up
|
||||
if ($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED) {
|
||||
|
||||
Log::info('CallbackBillplzDataPatchProcessor 2');
|
||||
|
||||
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
|
||||
|
||||
$group = Group::where('reference', $transaction->payment_reference)->first();
|
||||
|
||||
// check if is group payment
|
||||
if ($group) {
|
||||
foreach ($group->groupTransactions as $groupTransaction) {
|
||||
$invoice = $groupTransaction->transaction;
|
||||
Log::info('CallbackBillplzDataPatchProcessor 3: '.json_encode($invoice));
|
||||
|
||||
//if($invoice->status !== ApprovalStatus::COMPLETED){
|
||||
// $paymentTransaction = $this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null, false);
|
||||
|
||||
// if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
|
||||
$pL = $invoice->owner;
|
||||
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice, true);
|
||||
//}
|
||||
//}
|
||||
}
|
||||
|
||||
$group->status = $status;
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$transaction->owner instanceof Wallet) {
|
||||
Log::info('CallbackBillplzDataPatchProcessor 3');
|
||||
$this->releaseGoodsToCustomerProcessor->execute($packingList, $invoice);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function checkForGroupPayment($transaction){
|
||||
//This check is targetting group payment that expired and soft deleted
|
||||
//command:check-storage-invoices must already run for this part of the code to work properly
|
||||
$group = Group::withTrashed()->where('reference', $transaction->payment_reference)->first();
|
||||
if ($group) {
|
||||
$totalAmountToBePaid = 0;
|
||||
$actualAmountPaid = $transaction->amount;
|
||||
|
||||
foreach ($group->groupTransactions as $groupTransaction) {
|
||||
$invoice = $groupTransaction->transaction;
|
||||
if($invoice->status !== ApprovalStatus::COMPLETED){
|
||||
$totalAmountToBePaid += $invoice->amount;
|
||||
}
|
||||
}
|
||||
|
||||
if(($totalAmountToBePaid - $actualAmountPaid) < 0.01){
|
||||
|
||||
}
|
||||
else{
|
||||
Log::channel('storage_invoices')->info('Total amount from current transaction: '.$totalAmountToBePaid); //cief todo: to be removed
|
||||
Log::channel('storage_invoices')->info('Total amount from paid transaction: '.$transaction->amount); //cief todo: to be removed
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ class CallbackBillplzProcessor
|
||||
private $releaseGoodsToCustomerProcessor;
|
||||
|
||||
/**
|
||||
* CreateUserProcessor constructor.
|
||||
* CallbackBillplzProcessor constructor.
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
|
||||
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
|
||||
|
||||
@@ -24,8 +24,8 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
|
||||
{
|
||||
$this->filters = [
|
||||
"has_invoice_status_in" => [2],
|
||||
"packing_list_ordered_by_invoice_date" => true,
|
||||
"with_aging_column" => true
|
||||
// "packing_list_ordered_by_invoice_date" => true,
|
||||
// "with_aging_column" => true
|
||||
];
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
|
||||
'Invoice Date',
|
||||
'Days',
|
||||
'Amount',
|
||||
'Credit Term Customer',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -55,9 +56,16 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
|
||||
$invDate = 'n/a';
|
||||
$invNo = 'n/a';
|
||||
$days = 'n/a';
|
||||
$isCreditTermCustomer = false;
|
||||
|
||||
if ($list->owner instanceof Order) {
|
||||
$inviterPivotInviteeReference = $list->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
|
||||
$companyModule = $list->owner->companyModule;
|
||||
|
||||
$segment = $companyModule->connections()->first()->segments()->where('name', 'Credit Term Customer')->first();
|
||||
if ($segment) {
|
||||
$isCreditTermCustomer = true;
|
||||
}
|
||||
|
||||
if ($inviterPivotInviteeReference) {
|
||||
$marking = $inviterPivotInviteeReference->pivot->invitee_reference;
|
||||
@@ -87,6 +95,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
|
||||
$invDate,
|
||||
$days,
|
||||
$amt,
|
||||
$isCreditTermCustomer ? 'TRUE' : 'FALSE',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Group;
|
||||
use App\Models\Transaction;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsGroupTransactions implements
|
||||
FromQuery,
|
||||
WithHeadings,
|
||||
WithHeadingRow,
|
||||
WithMapping,
|
||||
ShouldAutoSize
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'DocNo',
|
||||
'DocDate',
|
||||
'PaymentDate',
|
||||
'DebtorCode',
|
||||
'Ref',
|
||||
'ShipInfo',
|
||||
'AccNo',
|
||||
'DetailDescription',
|
||||
'FurtherDescription',
|
||||
'ProjNo',
|
||||
'DeptNo',
|
||||
'Qty',
|
||||
'UnitPrice',
|
||||
'TaxType',
|
||||
'TaxableAmt',
|
||||
'TaxRate'
|
||||
];
|
||||
}
|
||||
|
||||
public function query()
|
||||
{
|
||||
$start_date = $this->parseDate($this->request->input('startDate'));
|
||||
$end_date = $this->parseDate($this->request->input('endDate'));
|
||||
|
||||
return Group::when($start_date && $end_date, function ($query) use ($start_date, $end_date) {
|
||||
$query->whereBetween('created_at', [
|
||||
$start_date->startOfDay(),
|
||||
$end_date->endOfDay()
|
||||
]);
|
||||
})
|
||||
->when($start_date && !$end_date, function ($query) use ($start_date) {
|
||||
$query->where('created_at', '>=', $start_date->startOfDay());
|
||||
})
|
||||
->when(!$start_date && $end_date, function ($query) use ($end_date) {
|
||||
$query->where('created_at', '<=', $end_date->endOfDay());
|
||||
});
|
||||
}
|
||||
|
||||
private function parseDate($date)
|
||||
{
|
||||
return $date ? Carbon::parse($date)->startOfDay() : null;
|
||||
}
|
||||
|
||||
public function map($transaction): array
|
||||
{
|
||||
$company = $transaction->receiverCompany;
|
||||
return [
|
||||
'<<New>>', //'DocNo',
|
||||
'', //'DocDate',
|
||||
$transaction->created_at->format('m/d/Y H:m'), //'PaymentDate',
|
||||
$company->debtor, //'DebtorCode',
|
||||
$company->referece, //'Ref',
|
||||
$company->referece, //'ShipInfo',
|
||||
'500-0000', //'AccNo',
|
||||
'X1 Freight Service Charge', //'DetailDescription',
|
||||
'FurtherDescription', //'FurtherDescription',
|
||||
'M3', //'ProjNo',
|
||||
'CIEF', //'DeptNo',
|
||||
'', //'Qty',
|
||||
'', //'UnitPrice',
|
||||
'', //'TaxType',
|
||||
floatval($transaction->tax) > 0 ? number_format($transaction->tax, 2) : '0.00', //'TaxableAmt',
|
||||
'', //'TaxRate'
|
||||
];
|
||||
}
|
||||
|
||||
private function getTaxType($tax_percentage)
|
||||
{
|
||||
return floatval($tax_percentage) > 0 ? 'SV-6' : '';
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
return [
|
||||
'DocNo',
|
||||
'DocDate',
|
||||
'PaymentDate',
|
||||
'DebtorCode',
|
||||
'Ref',
|
||||
'ShipInfo',
|
||||
@@ -59,12 +60,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
{
|
||||
$start_date = $this->request->input('startDate', null);
|
||||
if ($start_date) {
|
||||
$start_date = Carbon::parse($this->request->input('startDate'))->format('Y-m-d');
|
||||
$start_date = Carbon::parse($start_date)->startOfDay();
|
||||
}
|
||||
|
||||
$end_date = $this->request->input('endDate', null);
|
||||
if ($end_date) {
|
||||
$end_date = Carbon::parse($this->request->input('endDate'))->format('Y-m-d');
|
||||
$end_date = Carbon::parse($end_date)->endOfDay();
|
||||
}
|
||||
|
||||
$query = Transaction::query();
|
||||
@@ -77,30 +78,31 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
$approvalStatus = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
// $query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [$approvalStatus]);
|
||||
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->whereIn('status', [$approvalStatus]);
|
||||
// Adjusted the query to include both types and status
|
||||
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])
|
||||
->where('status', $approvalStatus);
|
||||
|
||||
if($start_date && $end_date) {
|
||||
$query->whereBetween('updated_at', [
|
||||
Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
|
||||
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
|
||||
]);
|
||||
}
|
||||
elseif($start_date && !$end_date) {
|
||||
$query->whereHas('transactions', function($transaction) use ($start_date) {
|
||||
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
|
||||
if ($start_date && $end_date) {
|
||||
$query->whereHas('transactions', function($transaction) use ($start_date, $end_date) {
|
||||
$transaction->where('type', TransactionType::PAYMENT)
|
||||
->whereBetween('updated_at', [$start_date, $end_date]);
|
||||
});
|
||||
|
||||
}
|
||||
elseif(!$start_date && $end_date) {
|
||||
} elseif ($start_date) {
|
||||
$query->whereHas('transactions', function($transaction) use ($start_date) {
|
||||
$transaction->where('type', TransactionType::PAYMENT)
|
||||
->where('updated_at', '>=', $start_date);
|
||||
});
|
||||
} elseif ($end_date) {
|
||||
$query->whereHas('transactions', function($transaction) use ($end_date) {
|
||||
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($end_date)->format('Y-m-d 0:00:00'));
|
||||
$transaction->where('type', TransactionType::PAYMENT)
|
||||
->where('updated_at', '<=', $end_date);
|
||||
});
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function map($transaction): array
|
||||
{
|
||||
$container = $transaction->owner->containers()->first();
|
||||
@@ -142,6 +144,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
$rows[] = [
|
||||
$firstItem ? '<<New>>' : '',
|
||||
$transaction->created_at->format('m/d/Y H:m'),
|
||||
$transaction->transactions()->where('type', TransactionType::PAYMENT)->first()->updated_at->format('m/d/Y H:m'),
|
||||
$company->debtor,
|
||||
$order->reference,
|
||||
$order->reference,
|
||||
@@ -153,7 +156,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
$detail->quantity,
|
||||
$detail->price,
|
||||
floatval($detail->tax_percentage) > 0 ? 'SV-6' : '',
|
||||
floatval($detail->tax_percentage) > 0 ? $detail->amount : '0',
|
||||
floatval($detail->tax_percentage) > 0 ? number_format($detail->amount, 2) : '0.00',
|
||||
$detail->tax_percentage,
|
||||
];
|
||||
|
||||
@@ -166,7 +169,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
|
||||
return [
|
||||
'<<New>>',
|
||||
$transaction->created_at->format('m/d/Y H:m'),
|
||||
$transaction->transactions()->where('type', TransactionType::PAYMENT)->first()->updated_at->format('m/d/Y H:m'),
|
||||
$company->debtor,
|
||||
$order->reference,
|
||||
$order->reference,
|
||||
|
||||
+2
-1
@@ -76,6 +76,7 @@ class FetchDeliveryUpdatesFromYdPortalProcessor
|
||||
try {
|
||||
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
|
||||
|
||||
Log::info('Delivery tracking sTrackingNo: '. $packingList->reference);
|
||||
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$packingList->reference.'&sOrgId=sti', ['timeout' => 3]);
|
||||
$deliveryTracking = json_decode($request->getBody()->getContents());
|
||||
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
|
||||
@@ -119,7 +120,7 @@ class FetchDeliveryUpdatesFromYdPortalProcessor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Log::info('FetchDeliveryUpdatesFromYdPortalProcessor ends');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -138,7 +138,13 @@ class FetchPackingListsFromYdPortalProcessor
|
||||
|
||||
$receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8));
|
||||
|
||||
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
|
||||
$customerno = $row->customerno;
|
||||
// Check if $customerno contains '正确唛头YD' and extract the part after it
|
||||
if (strpos($customerno, '正确唛头YD') !== false) {
|
||||
$customerno = explode('正确唛头YD', $customerno)[1];
|
||||
}
|
||||
|
||||
$customerno = preg_split('/[-()\/]/', $customerno);
|
||||
|
||||
$orderNumber = $customerno[array_key_last($customerno)];
|
||||
$allow_contract = true;
|
||||
|
||||
@@ -13,14 +13,10 @@ class RemarkObject implements DataTransferObject
|
||||
/** @var string*/
|
||||
private $content;
|
||||
|
||||
/** @var int|null */
|
||||
private $type;
|
||||
|
||||
public function __construct(string $content, int $commenterID, int $type = null)
|
||||
public function __construct(string $content, int $commenterID)
|
||||
{
|
||||
$this->commenterID = $commenterID;
|
||||
$this->content = $content;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,12 +35,4 @@ class RemarkObject implements DataTransferObject
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getType(): ?int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ class CreatesRemark extends AbstractUpdateRelationshipRecord
|
||||
|
||||
$model->commenter_id = $object->getCommenterId();
|
||||
$model->content = $object->getContent();
|
||||
$model->type = $object->getType();
|
||||
|
||||
return $this->handler($remarkable->remarks(), $model);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class CreateInvoiceTransactionProcessor
|
||||
{
|
||||
@@ -74,6 +75,18 @@ class CreateInvoiceTransactionProcessor
|
||||
*/
|
||||
public function execute(PackingList $packingList)
|
||||
{
|
||||
$ori_packing_list = $packingList;
|
||||
// call wac webhook
|
||||
$hasInvoiceCreated = Transaction::withTrashed()
|
||||
->where('type', TransactionType::SHIPPING_INVOICE)
|
||||
->where('owner_type', PackingList::class)
|
||||
->where('owner_id', $ori_packing_list->id)
|
||||
->exists();
|
||||
|
||||
if ($hasInvoiceCreated) {
|
||||
Log::channel('wac_webhook')->info('Regenerating Invoice for PackingList: ' . $ori_packing_list->id . '. No call wac api.');
|
||||
}
|
||||
|
||||
$packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
|
||||
|
||||
$billable_packing_list = $packing_list->packingLists()->first();
|
||||
@@ -238,6 +251,32 @@ class CreateInvoiceTransactionProcessor
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
}
|
||||
|
||||
if (app()->environment('production') && !$hasInvoiceCreated) {
|
||||
$order = $ori_packing_list->owner;
|
||||
$companyModule = $order->companyModule;
|
||||
$company = $companyModule->company;
|
||||
$companyContact = $company->contacts()->first();
|
||||
$employee = $companyModule->employees()->first();
|
||||
|
||||
$invoiceCount = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
|
||||
->where('receiver', $companyModule->id)
|
||||
->where('status', ApprovalStatus::APPROVED)
|
||||
->count();
|
||||
|
||||
$payload = [
|
||||
'name' => $employee->name,
|
||||
'email' => $employee->email,
|
||||
'phone' => $companyContact->phone,
|
||||
'order_reference' => $order->reference,
|
||||
'portal' => 'izyim',
|
||||
'invoice_count' => $invoiceCount,
|
||||
];
|
||||
|
||||
Log::channel('wac_webhook')->info('Attempt to send wac_webhook - Invoice Created: ' . json_encode($payload));
|
||||
$response = Http::post(config('wagWebhookUrl.invoice_created_url'), $payload);
|
||||
Log::channel('wac_webhook')->info('Invoice Created: ' . json_encode($response));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class CreatePaymentTransactionProcessor
|
||||
/** @var Wallet $wallet */
|
||||
$wallet = $company_module->wallets()->first();
|
||||
|
||||
if((float) number_format(($wallet->amount - $amount),2) < 0){
|
||||
if((float) number_format(($wallet->amount - $amount),2) < -0.01){
|
||||
throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.');
|
||||
}
|
||||
|
||||
|
||||
@@ -44,24 +44,33 @@ class ReleaseGoodsToCustomerProcessor
|
||||
/**
|
||||
* @param $packingList
|
||||
* @param $invoice
|
||||
* @param $processCompletedInvoices
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute($packingList, $invoice = null)
|
||||
public function execute($packingList, $invoice = null, $processCompletedInvoices = false)
|
||||
{
|
||||
$result = false;
|
||||
$totalInvoicesAmountPaid = 0.00;
|
||||
$totalInvoicesAmount = 0.00;
|
||||
$invoiceTransactions = $packingList->transactions()->where('status', [ApprovalStatus::APPROVED])->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get();
|
||||
if($processCompletedInvoices){
|
||||
//processCompletedInvoices, for manual processing of invoices, e.g. incomplete payment gateway finish with storage invoice
|
||||
$invoiceTransactions = $packingList->transactions()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get();
|
||||
}
|
||||
else{
|
||||
$invoiceTransactions = $packingList->transactions()->where('status', ApprovalStatus::APPROVED)->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get();
|
||||
}
|
||||
|
||||
//Part 1: Process each single invoice type and get the total of all invoices
|
||||
//Part 1: Process each single invoice type and get the total of all invoices (STORAGE + SHIPPING)
|
||||
foreach($invoiceTransactions as $invoiceTransaction){
|
||||
|
||||
$totalInvoiceAmountPaid = $invoiceTransaction->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
if ($invoice && $invoice->type == $invoiceTransaction->type) {
|
||||
if(($invoice->amount - $totalInvoiceAmountPaid) < 0.01){
|
||||
Log::channel('storage_invoices')->info('ReleaseGoodsToCustomerProcessor updatesTransactionStatus');
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
if($invoice->type == TransactionType::STORAGE_INVOICE){
|
||||
//cief todo: remove the following if block
|
||||
if($invoice->type === TransactionType::STORAGE_INVOICE){
|
||||
Log::channel('storage_invoices')->info('ReleaseGoodsToCustomerProcessor createStorageInvoiceDocTransactionProcessor');
|
||||
$this->createStorageInvoiceDocTransactionProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Wac\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestion;
|
||||
use App\Classes\Modules\HelpMenu\Processors\FetchFirstQuestionQAProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\HelpMenuQuestionResource;
|
||||
use App\Models\User;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUser;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
|
||||
class RegisterExchangeEmailLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Register Exchange Email',
|
||||
'message' => 'You have successfully registered an exchange email address'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/** @var CreatesUser */
|
||||
private $createsUser;
|
||||
|
||||
/**
|
||||
* RegisterEmailLogic constructor.
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
*/
|
||||
public function __construct(AssignEmployeeProcessor $assignEmployeeProcessor, CreatesUser $createsUser)
|
||||
{
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
$this->createsUser = $createsUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
// Validate the request inputs
|
||||
$validator = Validator::make(
|
||||
$request->all(),
|
||||
[
|
||||
'izyim_email' => 'email|required',
|
||||
'exchange_email' => 'email|required',
|
||||
]
|
||||
);
|
||||
|
||||
if ($validator->fails()) {
|
||||
throw new RequestValidationException($validator->messages()->first());
|
||||
}
|
||||
|
||||
// Retrieve the validated emails from the request
|
||||
$izyimEmail = $request->input('izyim_email');
|
||||
$exchangeEmail = $request->input('exchange_email');
|
||||
|
||||
// Check if both emails are the same
|
||||
if ($izyimEmail === $exchangeEmail) {
|
||||
return response()->json([
|
||||
'message' => 'Both emails are the same.',
|
||||
'status' => 'ok',
|
||||
], 200);
|
||||
}
|
||||
|
||||
// Check if the exchange email already exists in the system
|
||||
$existingUser = User::where('email', $exchangeEmail)->first();
|
||||
if ($existingUser) {
|
||||
return response()->json([
|
||||
'message' => 'The Exchange email already exists in the system.',
|
||||
'status' => 'error',
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Retrieve the izyim user
|
||||
$izyimUser = User::where('email', $izyimEmail)->first();
|
||||
if (!$izyimUser) {
|
||||
return response()->json([
|
||||
'message' => 'The Izyim email not found in system.',
|
||||
'status' => 'error',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$newUser = new User();
|
||||
$newUser->name = $izyimUser->name;
|
||||
$newUser->email = $exchangeEmail;
|
||||
$newUser->password = $izyimUser->password;
|
||||
$newUser->type = RoleTypes::USER;
|
||||
$newUser->status = ApprovalStatus::APPROVED;
|
||||
$newUser->save();
|
||||
|
||||
Log::channel('wac_webhook')->info('Wac created user: ' . $exchangeEmail);
|
||||
|
||||
$companyModule = $izyimUser->companyModule->first();
|
||||
$Object = new EmploymentObject($companyModule, $newUser);
|
||||
|
||||
$this->assignEmployeeProcessor->execute($Object);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Exchange email registered successfully.',
|
||||
'status' => 'success',
|
||||
], 201);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,4 @@ final class RemarkTypes
|
||||
|
||||
public const EXTERNAL = 1;
|
||||
|
||||
public const ADDRESS_EXTRA_COLUMNS = 2;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Group;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class FixApprovedPaymentFailedGroup extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fix-approved-payment-failed-group';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fix all payment is approved or completed but group failed to be updated';
|
||||
|
||||
protected $output = null;
|
||||
|
||||
protected $outputArray = [];
|
||||
|
||||
/** @var CallbackBillplzProcessor */
|
||||
private $callbackBillplzProcessor;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
$groups = Group::whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereHas('payment', function ($query) {
|
||||
$query->whereIn('status', [2, 3]);
|
||||
})->get();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$transaction = $group->payment;
|
||||
|
||||
$response = Http::withBasicAuth(config('billplz.api_key') . ':', '')->get(config('billplz.base_url') . '/api/v3/bills/' . $transaction->payment_reference);
|
||||
|
||||
dump($transaction->payment_reference);
|
||||
|
||||
if ($response->successful()) {
|
||||
$data = $response->json();
|
||||
if ($data['paid']) {
|
||||
$status = ApprovalStatus::PENDING_VERIFICATION;
|
||||
|
||||
if ($data['state'] === 'paid') {
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
$this->info(Carbon::now() . ' : Fixing ' . $transaction->payment_reference);
|
||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
}
|
||||
} else {
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
if ($groups) {
|
||||
$this->info(Carbon::now() . ' : Done . ElapsedTime: ' . $elapsedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchPackingListsFromYdPortalProcessor;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FixMissingPackingList extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fix-missing-packinglist';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fix Missing Packinglist';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$start_date = '2024-05-05';
|
||||
$end_date = '2024-05-05';
|
||||
|
||||
$start = $start_date ? Carbon::parse($start_date) : null;
|
||||
$end = $end_date ? Carbon::parse($end_date) : null;
|
||||
|
||||
if (!$start || !$end) {
|
||||
return;
|
||||
}
|
||||
|
||||
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute($start, $end);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzDataPatchProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
@@ -32,15 +33,19 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
|
||||
/** @var CallbackBillplzProcessor */
|
||||
private $callbackBillplzProcessor;
|
||||
|
||||
/** @var CallbackBillplzDataPatchProcessor */
|
||||
private $callbackBillplzDataPatchProcessor;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor)
|
||||
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor, CallbackBillplzDataPatchProcessor $callbackBillplzDataPatchProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
||||
$this->callbackBillplzDataPatchProcessor = $callbackBillplzDataPatchProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,20 +60,22 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
//Transaction fix with this one time fix command: 15205, 16803
|
||||
//Transaction fix with this one time fix command: 15205, 16803, 17310
|
||||
//This transaction, 16803 has approve payment but not its owner, shipping invoice
|
||||
$transaction = Transaction::whereIn('id', [16803])->first();
|
||||
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 16803 cron started.');
|
||||
$transaction = Transaction::whereIn('id', [17310])->first();
|
||||
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 17310 cron started.');
|
||||
|
||||
if($transaction && $transaction->id == 16803){
|
||||
if($transaction && $transaction->id == 17310){
|
||||
|
||||
$this->info(Carbon::now() . ' : 17310.');
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
// $this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
$this->callbackBillplzDataPatchProcessor->execute($transaction, $status);
|
||||
}
|
||||
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 16803 cron ended. ElapsedTime: ' . $elapsedTime);
|
||||
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 17310 cron ended. ElapsedTime: ' . $elapsedTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class SendPermitsReminderEmails extends Command
|
||||
protected function getEmailList(): array
|
||||
{
|
||||
return [
|
||||
'edmond.wuiming2021@gmail.com',
|
||||
// 'edmond.wuiming2021@gmail.com',
|
||||
'anithagurl96@gmail.com'
|
||||
];
|
||||
}
|
||||
|
||||
+36
-36
@@ -28,50 +28,50 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
|
||||
$schedule->command('command:curlVTCommand')
|
||||
->cron('0 8 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/curlvt.log');
|
||||
|
||||
$schedule->command('command:curlYdOrderListCommand')
|
||||
->cron('0 9-18/3 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/curlyd.log');
|
||||
|
||||
$schedule->command('fix-packinglist')
|
||||
->cron('30 9-18/3 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/fix_packinglist.log');
|
||||
// $schedule->command('command:curlVTCommand')
|
||||
// ->cron('0 8 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/curlvt.log');
|
||||
|
||||
// $schedule->command('command:curlYdOrderListCommand')
|
||||
// ->cron('0 9 * * *')
|
||||
// ->cron('0 9-18/3 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/departure_email.log');
|
||||
// ->appendOutputTo (storage_path().'/logs/curlyd.log');
|
||||
|
||||
$schedule->command('fix-duplicate-container-reference')
|
||||
->cron('0 1 * * *')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/fix_duplicate_container_reference.log');
|
||||
// $schedule->command('fix-packinglist')
|
||||
// ->cron('30 9-18/3 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/fix_packinglist.log');
|
||||
|
||||
$schedule->command('invoice:generate')
|
||||
->hourly()
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
|
||||
// // $schedule->command('command:curlYdOrderListCommand')
|
||||
// // ->cron('0 9 * * *')
|
||||
// // ->withoutOverlapping()
|
||||
// // ->appendOutputTo (storage_path().'/logs/departure_email.log');
|
||||
|
||||
$schedule->command('billplz-failed-callback:fix')
|
||||
->hourly()
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log');
|
||||
// $schedule->command('fix-duplicate-container-reference')
|
||||
// ->cron('0 1 * * *')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/fix_duplicate_container_reference.log');
|
||||
|
||||
$schedule->command('check-storage-invoices-group-transactions')
|
||||
->dailyAt('0:01')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo(storage_path().'/logs/check_storage_invoices.log');
|
||||
// $schedule->command('invoice:generate')
|
||||
// ->hourly()
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
|
||||
|
||||
$schedule->command('permitsReminder:send')
|
||||
->dailyAt('09:30')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo(storage_path().'/logs/permits-reminder-send.log');
|
||||
// $schedule->command('billplz-failed-callback:fix')
|
||||
// ->hourly()
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log');
|
||||
|
||||
// $schedule->command('check-storage-invoices-group-transactions')
|
||||
// ->dailyAt('0:01')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo(storage_path().'/logs/check_storage_invoices.log');
|
||||
|
||||
// $schedule->command('permitsReminder:send')
|
||||
// ->dailyAt('09:30')
|
||||
// ->withoutOverlapping()
|
||||
// ->appendOutputTo(storage_path().'/logs/permits-reminder-send.log');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomersOrderLatestDate;
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomerTotalOrderByYear;
|
||||
use App\Classes\Modules\Exports\Services\ExportsGroupTransactions;
|
||||
use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -33,6 +34,13 @@ class ExportCustomersToExcelController
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function groupTransaction(Request $request){
|
||||
$exportsTransactions = new ExportsGroupTransactions($request);
|
||||
$response = $exportsTransactions->download('group-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function totalOrders(Request $request){
|
||||
$exportsTotalOrders = new ExportsCustomerTotalOrderByYear($request);
|
||||
$response = $exportsTotalOrders->download('total-orders-' . $request->route('year') . '.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
|
||||
@@ -40,25 +40,41 @@ class ImportPermitsReminderController
|
||||
$row['reminder_date'] = $this->changeExcelDate($row['reminder_date']);
|
||||
|
||||
$validator = Validator::make($row, [
|
||||
'model' => 'required|unique:permits_reminders,model',
|
||||
'expiry_date' => 'required|date|after_or_equal:today',
|
||||
'reminder_date' => 'required|date|after_or_equal:today',
|
||||
'model' => 'required',
|
||||
// 'expiry_date' => 'required|date|after_or_equal:today',
|
||||
'expiry_date' => 'required|date',
|
||||
// 'reminder_date' => 'required|date|after_or_equal:today',
|
||||
'reminder_date' => 'required|date',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$row['status'] = 'failed';
|
||||
$row['message'] = $validator->errors()->all();
|
||||
|
||||
$returnArray[] = $row;
|
||||
} else {
|
||||
$row['created_at'] = Carbon::now();
|
||||
$row['updated_at'] = Carbon::now();
|
||||
$successRows[] = $row;
|
||||
$existingRecord = PermitsReminder::where('model', $row['model'])->first();
|
||||
|
||||
if ($existingRecord) {
|
||||
$existingRecord->update([
|
||||
'expiry_date' => $row['expiry_date'],
|
||||
'reminder_date' => $row['reminder_date'],
|
||||
]);
|
||||
|
||||
$row['status'] = 'Updated';
|
||||
$row['message'] = 'Record has been updated';
|
||||
$returnArray[] = $row;
|
||||
} else {
|
||||
// Add to successful rows for batch insertion
|
||||
$row['created_at'] = Carbon::now();
|
||||
$row['updated_at'] = Carbon::now();
|
||||
$successRows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert only if there are new successful rows
|
||||
if (!empty($successRows)) {
|
||||
PermitsReminder::insert($successRows); // Insert only if there are successful rows
|
||||
PermitsReminder::insert($successRows);
|
||||
}
|
||||
|
||||
$successCount = count($successRows);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wac;
|
||||
|
||||
use App\Classes\Modules\Wac\ControllersLogic\RegisterExchangeEmailLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RegisterExchangeEmailController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchQuestionQALogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function register(Request $request, RegisterExchangeEmailLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,9 +27,6 @@ class AddressResource extends JsonResource
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
||||
|
||||
$extrafields = json_decode($this->addressExtraFields->first());
|
||||
$extrafields = $extrafields ? (isset($extrafields->content) ? json_decode($extrafields->content) : null) : null;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
@@ -46,11 +43,6 @@ class AddressResource extends JsonResource
|
||||
'contact' => new ContactResource($this->contacts->first()),
|
||||
'remark' => new RemarkResource($this->remarks->first()),
|
||||
'type' => $this->type,
|
||||
'extrafields' => $extrafields,
|
||||
'property_type' => $extrafields ? $extrafields->property_type : null,
|
||||
'tools_required_unload' => $extrafields ? $extrafields->tools_required_unload : null,
|
||||
'pickup_time_from' => $extrafields ? $extrafields->pickup_time_from : null,
|
||||
'pickup_time_to' => $extrafields ? $extrafields->pickup_time_to : null,
|
||||
$this->mergeWhen($this->relationLoaded('owner'), [
|
||||
'owner' => $this->when($this->owner instanceof Order, [
|
||||
'reference' => $this->owner->reference,
|
||||
|
||||
@@ -147,7 +147,7 @@ class TransactionWithStorageResource extends JsonResource
|
||||
}
|
||||
|
||||
private function getReferenceForGroupPayment($groups){
|
||||
if(count($groups)){
|
||||
if (is_array($groups) && count($groups) > 0) {
|
||||
$firstGroup = $groups[0];
|
||||
return $firstGroup['reference'];
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
@@ -90,12 +89,4 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addressExtraFields(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner')->where('type', RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,4 +84,12 @@ class Group extends Model implements Documentable, Transactionable
|
||||
{
|
||||
return $this->BelongsTo(Currency::class, 'original_currency_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return hasOne
|
||||
*/
|
||||
public function payment()
|
||||
{
|
||||
return $this->hasOne(Transaction::class, 'payment_reference', 'reference');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,11 @@ return [
|
||||
'path' => storage_path('logs/laravel_perfex_crm.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
'wac_webhook' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/wac_webhook.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'account_registration_url' => 'https://wacontact.readyspace.com/rest/trigger/9fe03daf-2ace-4095-b064-601ef6d9bfe7',
|
||||
'invoice_created_url' => 'https://wacontact.readyspace.com/rest/trigger/c0d38aa7-91ac-458b-8014-cf3287a636e4',
|
||||
];
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeToRemarksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('remarks', function (Blueprint $table) {
|
||||
$table->string('type')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('remarks', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<label class="text-primary">卸货工具 Tools required to unload goods</label>
|
||||
<vue-multi-select
|
||||
ref="multiSelect"
|
||||
:options="options"
|
||||
:btnLabel="btnLabel"
|
||||
@open="open"
|
||||
@close="close"
|
||||
:selectOptions="data">
|
||||
<template v-slot:option="{ option }">
|
||||
<input type="checkbox" :checked="option.selected"/>
|
||||
<span>{{ option.name }}</span>
|
||||
</template>
|
||||
</vue-multi-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vueMultiSelect from 'vue-multi-select';
|
||||
import 'vue-multi-select/dist/lib/vue-multi-select.css';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
values: [],
|
||||
data: [{
|
||||
list: [
|
||||
{ name: 'Manpower' },
|
||||
{ name: 'Forklift' },
|
||||
{ name: 'None of the above' }
|
||||
],
|
||||
}],
|
||||
options: {
|
||||
multi: true,
|
||||
groups: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
console.log('open');
|
||||
},
|
||||
close() {
|
||||
console.log('close');
|
||||
},
|
||||
btnLabel(values) {
|
||||
if (values.length === 0) {
|
||||
return 'Select Tools required';
|
||||
}
|
||||
return values.map(v => v.name).join(', ');
|
||||
},
|
||||
},
|
||||
components: {
|
||||
vueMultiSelect,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -3,6 +3,14 @@
|
||||
<div class="col">
|
||||
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Address Reference/Label</label>
|
||||
<input class="form-control" name="reference" v-model="parameters.reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||
@@ -33,14 +41,6 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Address Name / Label</label>
|
||||
<input class="form-control" name="reference" v-model="parameters.reference" placeholder="E.g. Home Address">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
@@ -59,6 +59,14 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Delivery Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -117,48 +125,14 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Delivery Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.pickup_time_from">
|
||||
<label>收货时间从 Available Hours From</label>
|
||||
<input type="time" class="form-control" name="pickup_time" v-model="parameters.pickup_time_from">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.pickup_time_to">
|
||||
<label>最晚收货时间 Available Hours To</label>
|
||||
<input type="time" class="form-control" name="latest_pickup_time" v-model="parameters.pickup_time_to">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.property_type">
|
||||
<label>房型 Receiver's property type</label>
|
||||
<select-component :options="['住家Landed house', '公寓Condominium (Drop on lobby only)', '工厂Factory', '店面Shop', '商场Shopping Mall (Drop on loading bay only)', 'Others']" v-model="parameters.property_type"></select-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1 pb-3 pb-md-0">
|
||||
<!-- <validation-wrapper-component selectable :validator="$v.parameters.tools_required_unload">
|
||||
<label>卸货工具 Tools require to unload goods</label>
|
||||
<select-component :options="['Manpower', 'Forklift', 'None of above']" v-model="parameters.tools_required_unload"></select-component>
|
||||
</validation-wrapper-component> -->
|
||||
<address-extra-details-component v-model="parameters.tools_required_unload"></address-extra-details-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center allign-items-center">
|
||||
<div class="col-12 col-sm-7">
|
||||
<h6 class="text-center fs-12 text-danger">**kindly reply within 2 hours while warehouse contact to arrange for delivery, otherwise, reschedule of delivery date will apply</h6>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -180,7 +154,7 @@
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
// required: true
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
@@ -200,10 +174,6 @@
|
||||
remark: '',
|
||||
phone: '',
|
||||
person_in_charge: '',
|
||||
property_type: '',
|
||||
tools_required_unload: '',
|
||||
pickup_time_from: '',
|
||||
pickup_time_to: '',
|
||||
}
|
||||
|
||||
}
|
||||
@@ -219,16 +189,12 @@
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
||||
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
||||
this.parameters.property_type = this.data.property_type ? this.data.property_type : '';
|
||||
this.parameters.tools_required_unload = this.data.tools_required_unload ? this.data.tools_required_unload : '';
|
||||
this.parameters.pickup_time_from = this.data.pickup_time_from ? this.data.pickup_time_from : '';
|
||||
this.parameters.pickup_time_to = this.data.pickup_time_to ? this.data.pickup_time_to : '';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'id': function () {
|
||||
this.parameters.company_module_id = this.id;
|
||||
},
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
|
||||
@@ -92,6 +92,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-white padding-5" v-if="$store.getters.isSuperAdmin">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-8 muted all-caps">Payment Method</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{ convertPaymentMethodToText(item.payment_method) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-8 muted all-caps">Created At</div>
|
||||
<div class="font-heading fs-10">{{ item.created_at }}</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-8 muted all-caps">Updated At</div>
|
||||
<div class="font-heading fs-10">{{ item.updated_at }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t b-grey" v-if="expandPaymentDetails">
|
||||
<div class="col bg-white padding-15">
|
||||
<!-- <div class="row align-items-end m-b-10 text-success bold">
|
||||
@@ -198,6 +214,17 @@
|
||||
this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
}
|
||||
},
|
||||
convertPaymentMethodToText(number) {
|
||||
var paymentMethods = {
|
||||
1: "CASH",
|
||||
2: "CHEQUE",
|
||||
3: "BA",
|
||||
4: "WALLET",
|
||||
5: "PAYMENT_GATEWAY"
|
||||
};
|
||||
|
||||
return paymentMethods[number] || "Unknown Payment Method";
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,11 +26,11 @@
|
||||
</div>
|
||||
<div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)">
|
||||
<p class="no-margin fs-10 all-caps">Payment Date</p>
|
||||
<div>{{ item.payment_history[item.payment_history.length-1].created_at }}</div>
|
||||
<div>{{ item.payment_history && item.payment_history.length > 0 ? item.payment_history[item.payment_history.length - 1].created_at : '-' }}</div>
|
||||
</div>
|
||||
<div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)">
|
||||
<p class="no-margin fs-10 all-caps">Bill Number</p>
|
||||
<div>{{ item.payment_history[item.payment_history.length-1].payment_reference }}</div>
|
||||
<div>{{ item.payment_history && item.payment_history.length > 0 ? item.payment_history[item.payment_history.length - 1].payment_reference : '-' }}</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div v-if="item.documents.length">
|
||||
|
||||
+3
@@ -69,6 +69,9 @@ export default {
|
||||
case 'walletsReportSection':
|
||||
apiRoute = route('walletTransactions.export');
|
||||
break;
|
||||
case 'groupTransactionSection':
|
||||
apiRoute = route('groupTransaction.export');
|
||||
break;
|
||||
}
|
||||
window.open(apiRoute + '?startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank');
|
||||
},
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
export default {
|
||||
props: {
|
||||
sumAmount: {
|
||||
type: String,
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
section:{
|
||||
|
||||
@@ -1,119 +1,94 @@
|
||||
<template>
|
||||
<div class="w-100">
|
||||
<validation-wrapper-component
|
||||
selectable
|
||||
:validator="$v.parameters.id"
|
||||
>
|
||||
<label>Segment</label>
|
||||
<selectable-component
|
||||
:endpoint="
|
||||
route('api.segment.list')
|
||||
"
|
||||
:section="section"
|
||||
:value="3"
|
||||
valueColumn="id"
|
||||
:labelColumn="['name']"
|
||||
v-model="parameters.id"
|
||||
@input="onSelect"
|
||||
|
||||
></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
<list-component
|
||||
v-if="parameters.id"
|
||||
class="mt-4"
|
||||
:key="parameters.id"
|
||||
:section="`segments_${parameters.id}`"
|
||||
:endpoint="route('api.company.list')"
|
||||
:options="{
|
||||
company_segments_in: [parameters.id],
|
||||
// with_total_payments: true,
|
||||
// recency: '2022-02-15',
|
||||
// frequency: 15,
|
||||
// business_type: 2,
|
||||
// with_bookings: true,
|
||||
// order_by: { column: 'total_payments', DESC: true },
|
||||
}"
|
||||
>
|
||||
<template slot="list" slot-scope="{ data }">
|
||||
<company-component :data="data"></company-component>
|
||||
</template>
|
||||
</list-component>
|
||||
<div v-else>
|
||||
<div
|
||||
class="row align-items-center justify-content-center p-t-50 p-b-50"
|
||||
style=""
|
||||
>
|
||||
<div class="col-10">
|
||||
<div
|
||||
class="row align-items-center justify-content-center hint-text"
|
||||
>
|
||||
<div class="col-4 hint-text">
|
||||
<img
|
||||
src="/images/2829248.png"
|
||||
class="w-100 hint-text"
|
||||
/>
|
||||
</div>
|
||||
<div class="row m-b-20" @keyup.enter="downloadReport()">
|
||||
<div class="col">
|
||||
<div class="row m-l-0 m-r-0">
|
||||
<div class="col p-l-0 p-r-0">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.id">
|
||||
<label>Segment</label>
|
||||
<selectable-component :endpoint="route('api.segment.list')" :section="section" :value="3"
|
||||
valueColumn="id" :labelColumn="['name']" v-model="parameters.id"
|
||||
@input="onSelect"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<p
|
||||
class="all-caps no-margin fs-11"
|
||||
style="letter-spacing: 2px"
|
||||
>
|
||||
Please Select a Segment
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-l-0 p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.company_marking">
|
||||
<label class="text-primary">Company Marking</label>
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.company_marking">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0">
|
||||
<div class="btn btn-lg btn-primary fs-11 w-100 h-100 d-flex justify-content-center align-items-center"
|
||||
@click="downloadReport()">
|
||||
<span>
|
||||
Search
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<list-component class="mt-4" :key="parameters.vueKey" section="listSegmentSection"
|
||||
:endpoint="route('api.company.list')" :options="options">
|
||||
<template #list="{ data }">
|
||||
<company-component :data="data"></company-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
default: null,
|
||||
}
|
||||
section: String,
|
||||
type: Number,
|
||||
id: { type: Number, default: null },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
id: null,
|
||||
},
|
||||
company_marking: null,
|
||||
vueKey: 1,
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
id: {},
|
||||
company_marking: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
const options = {
|
||||
company_segments_in: [this.parameters.id]
|
||||
};
|
||||
|
||||
if (this.parameters.company_marking) {
|
||||
options.marking_in = [this.parameters.company_marking];
|
||||
}
|
||||
|
||||
return options;
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
onSelect(val) {
|
||||
this.parameters.id = val
|
||||
this.parameters.id = val;
|
||||
},
|
||||
},
|
||||
created(){
|
||||
const id = new URL(location.href).searchParams.get('id')
|
||||
if(id){
|
||||
this.parameters.id = id
|
||||
}
|
||||
downloadReport() {
|
||||
this.parameters.vueKey++;
|
||||
console.log(this.parameters.vueKey);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
const id = new URL(location.href).searchParams.get('id');
|
||||
if (id) this.parameters.id = id;
|
||||
},
|
||||
mixins: [componentHandler],
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
+3
-8
@@ -10,20 +10,15 @@ export default {
|
||||
},
|
||||
street_one: { required },
|
||||
street_two: {
|
||||
required
|
||||
// required: requiredIf(function(){
|
||||
// return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
// })
|
||||
required: requiredIf(function(){
|
||||
return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
})
|
||||
},
|
||||
district_id: { required },
|
||||
post_code: { required },
|
||||
remark: {},
|
||||
phone: {required, numeric},
|
||||
person_in_charge: { required },
|
||||
property_type: { required },
|
||||
tools_required_unload: { required },
|
||||
pickup_time_from: { required },
|
||||
pickup_time_to: { required },
|
||||
}
|
||||
},
|
||||
mixins: [addressFormHandler]
|
||||
|
||||
@@ -131,6 +131,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15 m-b-15">
|
||||
<div class="col-8 p-l-0">
|
||||
<small class="all-caps muted">Export Group Transactions CSV</small>
|
||||
<download-billing-with-dates-component section="groupTransactionSection"></download-billing-with-dates-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<admin-payments-billing-section-component></admin-payments-billing-section-component>
|
||||
|
||||
@@ -34,8 +34,6 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import')->name('debtor.import');
|
||||
|
||||
Route::post('/import/upload-permits-reminder', 'Imports\ImportPermitsReminderController@import')->name('permits_reminder.upload');
|
||||
|
||||
require __DIR__ . '/company.php';
|
||||
|
||||
require __DIR__ . '/document.php';
|
||||
|
||||
@@ -12,5 +12,9 @@ Route::group(['middleware' => 'apipub', 'prefix' => 'v1', 'as' => 'apipub.'], fu
|
||||
Route::group(['prefix' => 'feedback', 'as' => 'feedback.', 'namespace' => 'HelpMenu'], function () {
|
||||
Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate');
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'wac', 'as' => 'wac.', 'namespace' => 'Wac'], function () {
|
||||
Route::post('/register-email', 'RegisterExchangeEmailController@register')->name('register_email');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,3 +9,5 @@ Route::group(['prefix' => 'permits-reminder', 'as' => 'permits_reminder.', 'name
|
||||
Route::post('/{id}/update', 'UpdatePermitsReminderController@update')->name('update');
|
||||
});
|
||||
|
||||
Route::post('/import/upload-permits-reminder', 'Imports\ImportPermitsReminderController@import')->name('permits_reminder.upload');
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use App\Models\Container;
|
||||
use App\Models\Group;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -578,6 +579,7 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){
|
||||
|
||||
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export');
|
||||
Route::get('/export/payment-transactions/{section}/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export');
|
||||
Route::get('/export/group-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@groupTransaction')->name('groupTransaction.export');
|
||||
|
||||
Route::get('/delayed_container/customers', function(){
|
||||
$containers = Container::whereHas('transports', function($query){
|
||||
@@ -1271,6 +1273,8 @@ Route::get('/payment-and-billing-2', function () {
|
||||
|
||||
Route::get('/show-all-extra-payments', function () {
|
||||
ini_set('memory_limit', '-1');
|
||||
ini_set('max_execution_time', 0);
|
||||
$transactionCounter = 0;
|
||||
|
||||
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
|
||||
->where('status', ApprovalStatus::COMPLETED)
|
||||
@@ -1300,6 +1304,7 @@ Route::get('/show-all-extra-payments', function () {
|
||||
if (($paidAmount <= $invoice->amount) || ($paidAmount - $invoice->amount < 0.01)) {
|
||||
continue;
|
||||
}
|
||||
$transactionCounter += 1;
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>' . $invoice->type . '</td>';
|
||||
@@ -1310,8 +1315,35 @@ Route::get('/show-all-extra-payments', function () {
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
echo'<br> Total: ' . $transactionCounter;
|
||||
});
|
||||
|
||||
Route::get('/segments', function (Request $request) {
|
||||
return view('pages.segments.index');
|
||||
})->name('segments');
|
||||
|
||||
Route::get('/group-transaction-with-completed-payments', function () {
|
||||
$groups = Group::whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereHas('payment', function ($query) {
|
||||
$query->whereIn('status', [2, 3]);
|
||||
})->get();
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$groupPayment = $group->payment;
|
||||
$order = $group->groupTransactions->first()->transaction->owner->owner;
|
||||
$companyModule = $order->companyModule;
|
||||
|
||||
$connection = $companyModule->connections()->first();
|
||||
$companyMarking = $connection ? $connection->invitee_reference : '';
|
||||
|
||||
dump([
|
||||
'reference' => $group->reference,
|
||||
'groupPayment_id' => $groupPayment->id,
|
||||
'groupPayment_status' => $groupPayment->status,
|
||||
'order' => $order->reference,
|
||||
'companyMarking' => $companyMarking,
|
||||
]);
|
||||
echo '<tr><td><a target="_blank" href="' . route('customer.payment-and-billing', $companyMarking) . '">' . $companyMarking . '</a><br></td></tr>';
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user