mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 06:24:03 +00:00
Merge branch 'development' into 'update-service-content'
# Conflicts: # routes/web.php
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\CreatePurchaseOrderTransactionLogic;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePurchaseOrderTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesPurchaseOrderProducts;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AutoPurchaseOrderFillLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* AutoPurchaseOrderFillLogic constructor.
|
||||
* @param GeneratesPurchaseOrderProducts $generatesPurchaseOrderProducts
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor
|
||||
*/
|
||||
public function __construct(GeneratesPurchaseOrderProducts $generatesPurchaseOrderProducts, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor)
|
||||
{
|
||||
$this->generatesPurchaseOrderProducts = $generatesPurchaseOrderProducts;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createPurchaseOrderTransactionProcessor = $createPurchaseOrderTransactionProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Purchase Order Approval',
|
||||
'message' => 'You have successfully updated the Purchase order status'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var GeneratesPurchaseOrderProducts */
|
||||
private $generatesPurchaseOrderProducts;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var CreatePurchaseOrderTransactionProcessor */
|
||||
private $createPurchaseOrderTransactionProcessor;
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$bookings = Booking::whereMonth('created_at', 7)
|
||||
->whereYear('created_at', 2021)
|
||||
->whereDoesntHave('transactions', function($q){
|
||||
$q->where('type', TransactionType::PURCHASE_ORDER);
|
||||
$q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]);
|
||||
})->get();
|
||||
foreach ($bookings as $booking) {
|
||||
$po = Transaction::where('type', TransactionType::PURCHASE_ORDER)
|
||||
->where('status', ApprovalStatus::APPROVED)->where('issuer', $booking->company_id)
|
||||
->select('*', DB::raw('abs(amount - ' . $booking->fix_amount . ') as nearest_price'))->orderBy('nearest_price')->first();
|
||||
|
||||
|
||||
if (!$po) {
|
||||
$po = Transaction::where('type', TransactionType::PURCHASE_ORDER)
|
||||
->where('status', ApprovalStatus::APPROVED)->select('*', DB::raw('abs(amount - ' . $booking->fix_amount . ') as nearest_price'))->orderBy('nearest_price')->first();
|
||||
}
|
||||
|
||||
$products = $this->generatesPurchaseOrderProducts->execute($po, $booking->fix_amount);
|
||||
|
||||
$deference = $booking->fix_amount - $products->sum('total');
|
||||
|
||||
if($deference > -150 && $deference < 150 && $deference != 0) {
|
||||
|
||||
$products->push([
|
||||
'description' => $deference < 0 ? 'Discount':'Shipping Fee',
|
||||
'quantity' => 1,
|
||||
'stockCode' => '',
|
||||
'total' => $deference,
|
||||
'unit_price' => $deference
|
||||
]);
|
||||
}
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('XPO-');
|
||||
|
||||
$total = $products->sum('total');
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::PURCHASE_ORDER, $booking->company->id, 1,
|
||||
1, PaymentMethodType::CASH,
|
||||
$total, $total, $booking->fix_currency_id, $booking->fix_currency_id,
|
||||
1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, $products->toArray());
|
||||
|
||||
$this->createPurchaseOrderTransactionProcessor->execute($booking, $object);
|
||||
}
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Models\Company;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
|
||||
class ExportsProducts implements FromQuery, WithHeadingRow, WithMapping
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'HS Code',
|
||||
'Name',
|
||||
'price'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return \App\Models\TransactionDetail::inRandomOrder()->whereHas('transaction', function($query){
|
||||
return $query->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->where('status', ApprovalStatus::APPROVED);
|
||||
})->limit(50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $product
|
||||
* @return array
|
||||
*/
|
||||
public function map($product): array
|
||||
{
|
||||
|
||||
return [
|
||||
$product->product_code,
|
||||
$product->product_name,
|
||||
$product->price,
|
||||
];
|
||||
}
|
||||
}
|
||||
+20
-48
@@ -7,6 +7,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePurchaseOrderTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransactionDetails;
|
||||
@@ -25,26 +26,6 @@ use Illuminate\Http\Request;
|
||||
|
||||
class CreatePurchaseOrderTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* CreatePurchaseOrderTransactionLogic constructor.
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param CreatesTransactionDetail $createsTransactionDetail
|
||||
* @param UpdatesTransaction $updatesTransaction
|
||||
* @param DeletesTransactionDetails $deletesTransactionDetails
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
*/
|
||||
public function __construct(FetchesBooking $fetchesBooking, UpdatesTransactionStatus $updatesTransactionStatus, CreatesTransaction $createsTransaction, CreatesTransactionDetail $createsTransactionDetail, UpdatesTransaction $updatesTransaction, DeletesTransactionDetails $deletesTransactionDetails, GeneratesTransactionBillNumber $generatesTransactionBillNumber)
|
||||
{
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->createsTransactionDetail = $createsTransactionDetail;
|
||||
$this->updatesTransaction = $updatesTransaction;
|
||||
$this->deletesTransactionDetails = $deletesTransactionDetails;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
@@ -59,37 +40,35 @@ class CreatePurchaseOrderTransactionLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var CreatesTransactionDetail */
|
||||
private $createsTransactionDetail;
|
||||
|
||||
/** @var UpdatesTransaction */
|
||||
private $updatesTransaction;
|
||||
|
||||
/** @var DeletesTransactionDetails */
|
||||
private $deletesTransactionDetails;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var CreatePurchaseOrderTransactionProcessor */
|
||||
private $createPurchaseOrderTransactionProcessor;
|
||||
|
||||
/**
|
||||
* CreatePurchaseOrderTransactionLogic constructor.
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesBooking $fetchesBooking, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor)
|
||||
{
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createPurchaseOrderTransactionProcessor = $createPurchaseOrderTransactionProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param string $id
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
public function logic(Request $request, $id = '') : JsonResponse
|
||||
{
|
||||
/** @var Booking $booking */
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id') ?? $id]);
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PO-');
|
||||
|
||||
@@ -102,15 +81,8 @@ class CreatePurchaseOrderTransactionLogic extends AbstractControllerLogic
|
||||
$total, $total, $booking->fix_currency_id, $booking->fix_currency_id,
|
||||
1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, $request->input('products'));
|
||||
|
||||
!$transaction ? $transaction = $this->createsTransaction->execute($booking, $object) : $transaction = $this->updatesTransaction->execute($transaction, $object);
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, (float) number_format($total, 2, '.', '') === (float) number_format((float)$booking->fix_amount, 2, '.', '') ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
$this->deletesTransactionDetails->execute($transaction);
|
||||
|
||||
foreach ($object->getDetails() as $product){
|
||||
$this->createsTransactionDetail->execute($transaction, $product);
|
||||
}
|
||||
$transaction = $this->createPurchaseOrderTransactionProcessor->execute($booking, $object);
|
||||
|
||||
return $this->resourceResponse(new TransactionResource($transaction));
|
||||
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use App\Models\Company;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
|
||||
|
||||
class UpdatePaymentTransactionStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Transaction',
|
||||
'message' => 'You have successfully updated a transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var DeletesDocument */
|
||||
private $deletesDocument;
|
||||
|
||||
/**
|
||||
* CreatePaymentVerificationDocumentLogic constructor.
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param DeletesDocument $deletesDocument
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->deletesDocument = $deletesDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
|
||||
$status = $request->route('status');
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status === 'pending' ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::COMPLETED);
|
||||
|
||||
if ($status == 'pending') {
|
||||
$document = $transaction->documents()->first();
|
||||
if ($document) {
|
||||
$this->deletesDocument->execute($document);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransactionDetails;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
|
||||
class CreatePurchaseOrderTransactionProcessor
|
||||
{
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var CreatesTransactionDetail */
|
||||
private $createsTransactionDetail;
|
||||
|
||||
/** @var UpdatesTransaction */
|
||||
private $updatesTransaction;
|
||||
|
||||
/** @var DeletesTransactionDetails */
|
||||
private $deletesTransactionDetails;
|
||||
|
||||
/**
|
||||
* CreatePurchaseOrderTransactionProcessor constructor.
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param CreatesTransactionDetail $createsTransactionDetail
|
||||
* @param UpdatesTransaction $updatesTransaction
|
||||
* @param DeletesTransactionDetails $deletesTransactionDetails
|
||||
*/
|
||||
public function __construct(UpdatesTransactionStatus $updatesTransactionStatus, CreatesTransaction $createsTransaction, CreatesTransactionDetail $createsTransactionDetail, UpdatesTransaction $updatesTransaction, DeletesTransactionDetails $deletesTransactionDetails)
|
||||
{
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->createsTransactionDetail = $createsTransactionDetail;
|
||||
$this->updatesTransaction = $updatesTransaction;
|
||||
$this->deletesTransactionDetails = $deletesTransactionDetails;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @param TransactionObject $object
|
||||
* @return Transaction|\Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $booking, TransactionObject $object){
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
|
||||
!$transaction ? $transaction = $this->createsTransaction->execute($booking, $object) : $transaction = $this->updatesTransaction->execute($transaction, $object);
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, (float) number_format($object->getAmount(), 2, '.', '') === (float) number_format((float)$booking->fix_amount, 2, '.', '') ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
$this->deletesTransactionDetails->execute($transaction);
|
||||
|
||||
foreach ($object->getDetails() as $product){
|
||||
$this->createsTransactionDetail->execute($transaction, $product);
|
||||
}
|
||||
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class GeneratesPurchaseOrderProducts
|
||||
{
|
||||
|
||||
/** @var Collection */
|
||||
private $products;
|
||||
|
||||
/**
|
||||
* GeneratesPurchaseOrderProducts constructor.
|
||||
* @param Collection $products
|
||||
*/
|
||||
public function __construct(Collection $products)
|
||||
{
|
||||
$this->products = $products;
|
||||
}
|
||||
|
||||
|
||||
public function execute(Transaction $transaction, float $amount){
|
||||
|
||||
$products = collect();
|
||||
|
||||
$amountDifference = $amount - $transaction->amount;
|
||||
$transactionDetails = $transaction->transactionDetails()->select('*', DB::raw('abs(price - '.abs($amountDifference).') as nearest_price'))->orderBy('nearest_price')->get();
|
||||
foreach ($transactionDetails as $product) {
|
||||
$units = floor(abs($amountDifference) / $product->price);
|
||||
$quantity = $product->quantity;
|
||||
|
||||
if($product->price <= 0){
|
||||
$amountDifference = $amountDifference + ($product->price * $product->quantity);
|
||||
continue;
|
||||
}
|
||||
|
||||
if($amountDifference > 0){
|
||||
$quantity = $product->quantity + $units;
|
||||
$amountDifference = $amountDifference - ($product->price * $units);
|
||||
}
|
||||
|
||||
if($amountDifference < 0) {
|
||||
$units = ceil(abs($amountDifference) / $product->price);
|
||||
$quantity = $product->quantity - $units;
|
||||
|
||||
if($quantity <= 0){
|
||||
$amountDifference = $amountDifference + ($product->price * $product->quantity);
|
||||
continue;
|
||||
}
|
||||
|
||||
$amountDifference = $amountDifference + ($product->price * $quantity);
|
||||
}
|
||||
|
||||
$products->push([
|
||||
'description' => $product->product_name,
|
||||
'quantity' => (int) $quantity,
|
||||
'stockCode' => $product->product_code,
|
||||
'total' => $product->price * $quantity,
|
||||
'unit_price' => (float) $product->price,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
return $products;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\AutoPurchaseOrderFillLogic;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AutoPurchaseOrderFillController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param AutoPurchaseOrderFillLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function auto(Request $request, AutoPurchaseOrderFillLogic $logic): JsonResponse {
|
||||
Auth()->login(User::find(1));
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\UpdatePaymentTransactionStatusLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdatePaymentTransactionStatusController
|
||||
{
|
||||
public function update(Request $request, UpdatePaymentTransactionStatusLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -41,6 +41,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<bank-in-component :data="item"></bank-in-component>
|
||||
<div class="row" v-if="item.status === 2">
|
||||
<div class="col">
|
||||
<span class="text-complete fs-10 pointer requestModal" data-type="topUpModal">Cancel this order?</span>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="topUpModal">
|
||||
<delete-transaction-form-component :data="item" section="section" class="text-center"></delete-transaction-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,6 +69,20 @@
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="item.status === 2">
|
||||
<button class="btn btn-xs btn-default bg-success b-rad-none no-border requestModal" data-type="approvePaymentTransaction">
|
||||
<i class="fa fa-check text-white fa-fw"></i>
|
||||
</button>
|
||||
<modal-component type="approvePaymentTransaction">
|
||||
<approve-payment-transaction-form-component :data="item" section="section" class="text-center"></approve-payment-transaction-form-component>
|
||||
</modal-component>
|
||||
<button class="btn btn-xs btn-default bg-danger b-rad-none no-border requestModal" data-type="deletePaymentTransaction">
|
||||
<i class="fa fa-times text-white fa-fw"></i>
|
||||
</button>
|
||||
<modal-component type="deletePaymentTransaction">
|
||||
<reject-payment-transaction-form-component :data="item" section="section" class="text-center"></reject-payment-transaction-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to approve this transaction?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submit(route('api.transaction.bill.status', item.id, 'complete'), 'put', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to delete this transaction? You will not be able to recover your booking after confirming your action.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submit(route('api.transaction.bill.delete', item.id), 'delete', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to reject this transaction?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submit(route('api.transaction.bill.status', item.id, 'pending'), 'put', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -139,6 +139,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row">
|
||||
<div class="col-10 m-b-15">
|
||||
<wallet-balance-component></wallet-balance-component>
|
||||
</div>
|
||||
</div>
|
||||
<booking-form-component :data="company" section="customerProfileSection"></booking-form-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
+36
-2
@@ -3,6 +3,40 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-10 ">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row" style="background-image: url('/images/—Pngtree—2019 chinese new year lantern_951828.jpg'); background-size: cover;">
|
||||
<div class="col no-padding">
|
||||
<div class="text-white text-center p-t-25 p-l-25 p-r-25" style="background-color: rgba(0,0,0,0.4);">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<p class="m-b-0">新年快乐!</p>
|
||||
<p class="m-b-15">CIEF祝您春节快乐,万事如意,财运亨通,虎虎生威!<br>在此想通知您公司复工日期如下 :-</p>
|
||||
<p class="m-b-15 bold">客服团队 : 2022年2月7日</p>
|
||||
<p class="bold">* 假期期间 Exchange 照常可以下单,人民币复工之后就可以安排汇款</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<p class="m-b-0">Happy Chinese New Year!</p>
|
||||
<p class="m-b-15">CIEF wishes you a successful & prosperous Chinese New Year.. may your business prosper with every opportunity that comes your way. <br>We would like to also update you about our company's operation resume dates as below :-</p>
|
||||
<p class="m-b-15 bold">Customer Service : 07 February 2022</p>
|
||||
<p class="bold">* EXCHANGE bookings can be placed as usual during the holidays , RMB transfers will be arranged after operation resume.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<list-component style="min-height: auto;" section="customerAnnouncements" :emptyListSection=false :endpoint="route('api.announcement.list')" :options="{has_segments:true,is_published:true}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<view-announcement-form-component :data="data" section="customerAnnouncements"></view-announcement-form-component>
|
||||
@@ -536,8 +570,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 p-l-0 p-r-0 order-last">
|
||||
<verification-warning-component v-if="!isLoading && company.bookings.length"
|
||||
:data="company"></verification-warning-component>
|
||||
<verification-warning-component v-if="!isLoading && company.bookings.length" :data="company"></verification-warning-component>
|
||||
<wallet-balance-component></wallet-balance-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
@include('pages.wallet.transactions')
|
||||
@endsection
|
||||
@@ -0,0 +1,121 @@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="row p-b-5 b-b b-grey m-b-10 m-l-0 m-r-0">
|
||||
<div class="col no-padding">
|
||||
<h6>Transaction History</h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row padding-10">
|
||||
<div class="col-2 fs-10">Date</div>
|
||||
<div class="col fs-10">Description</div>
|
||||
<div class="col-2 fs-10">Incoming</div>
|
||||
<div class="col-2 fs-10">Outgoing</div>
|
||||
<div class="col-2 fs-10">Balance</div>
|
||||
</div>
|
||||
|
||||
<div class="row bg-white padding-10 m-b-10 rounded">
|
||||
<div class="col-2">25/11/2015</div>
|
||||
<div class="col">Payment to bill #121221121</div>
|
||||
<div class="col-2"></div>
|
||||
<div class="col-2 text-danger">2,123</div>
|
||||
<div class="col-2">12,123</div>
|
||||
</div>
|
||||
|
||||
<div class="row bg-white padding-10 m-b-10 rounded">
|
||||
<div class="col-2">115/11/2015</div>
|
||||
<div class="col">Top Up</div>
|
||||
<div class="col-2 text-success">1,234</div>
|
||||
<div class="col-2"></div>
|
||||
<div class="col-2">14,246</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 m-l-15">
|
||||
<wallet-balance-component></wallet-balance-component>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-head fs-10 all-caps">Top Up Records</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- start top up records -->
|
||||
<div class="row m-b-10">
|
||||
<div class="col bg-white m-l-15 m-r-15 padding-15 rounded">
|
||||
<div class="row m-l-5">
|
||||
<div class="col-auto btn-rounded bg-master-light d-flex justify-content-center align-content-center">
|
||||
<div class="padding-5 text-white"><i class="fa fa-check fs-15 lh-40"></i></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-master fs-11">Payment Method <span class="b-success b-a text-success fs-10 rounded p-l-5 p-r-5 m-l-5 bg-white">Success</span></div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p>$123,123</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="fs-10">12-03-2021</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-10">
|
||||
<div class="col bg-white m-l-15 m-r-15 padding-15 rounded">
|
||||
<div class="row m-l-5">
|
||||
<div class="col-auto btn-rounded bg-master-light d-flex justify-content-center align-content-center">
|
||||
<div class="padding-5 text-white"><i class="fa fa-times fs-15 lh-40"></i></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-master fs-11">Payment Method <span class="b-danger b-a text-danger fs-10 rounded p-l-5 p-r-5 m-l-5 bg-white">Failed</span></div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p>$123,123</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="fs-10">12-03-2021</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-10">
|
||||
<div class="col bg-white m-l-15 m-r-15 padding-15 rounded">
|
||||
<div class="row m-l-5">
|
||||
<div class="col-auto btn-rounded bg-master-light d-flex justify-content-center align-content-center">
|
||||
<div class="padding-5 text-white"><i class="fa fa-exclamation fs-15 lh-40"></i></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-master fs-11">Payment Method <span class="b-info b-a text-info fs-10 rounded p-l-5 p-r-5 m-l-5 bg-white">Processing</span></div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p>$123,123</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="fs-10">12-03-2021</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Vendored
+1
-1
@@ -7,6 +7,6 @@
|
||||
]) !!};
|
||||
</script>
|
||||
<script src="{{ asset('js/vendor.js') }}" type="text/javascript"></script>
|
||||
<script src="{{asset('vue/app.js')}}"></script>
|
||||
<script src="{{mix('vue/app.js')}}"></script>
|
||||
<script src="{{ asset('js/site.js') }}" type="text/javascript"></script>
|
||||
{{--END VENDOR JS--}}
|
||||
@@ -31,4 +31,5 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
|
||||
Route::post('/merge', 'MergeBookingController@merge')->name('merge');
|
||||
|
||||
Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create');
|
||||
|
||||
});
|
||||
@@ -10,6 +10,8 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
route::post('/supplier/{id}/bill/create', 'CreateSupplierTransactionController@create')->name('supplier.create');
|
||||
route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification');
|
||||
route::post('{id}/bill/pay', 'CreatePaymentProofDocumentController@pay')->name('bill.pay');
|
||||
Route::put('/{id}/bill/{status}', 'UpdatePaymentTransactionStatusController@update')->where('status', 'pending|complete')->name('bill.status');
|
||||
|
||||
route::delete('{id}/bill/delete', 'DeletePaymentProofDocumentController@delete')->name('bill.delete');
|
||||
|
||||
Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create');
|
||||
|
||||
+42
-23
@@ -4,6 +4,7 @@ use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -75,31 +76,49 @@ Route::get('/transfer/merge/{marking}', function ($marking) {
|
||||
})->name('booking.merge');
|
||||
|
||||
Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callback')->name('online_payment.redirect');
|
||||
Route::get('/wallet-transactions', function () {
|
||||
return view('pages.wallet.index');
|
||||
})->name('wallet.transactions');
|
||||
|
||||
Route::get('/test', function(){
|
||||
|
||||
// Auth::login(User::findOrFail(1));
|
||||
// try {
|
||||
// $zip_file = 'cief_jun_to_september_delivery_orders.zip'; // Name of our archive to download
|
||||
// $zip = new ZipArchive();
|
||||
// if ($zip->open(storage_path().'/'.$zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE) {
|
||||
//
|
||||
// //whereMonth('created_at', 5)->whereYear('created_at', 2021)->
|
||||
// $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->get();
|
||||
//
|
||||
// foreach ($bookings as $booking) {
|
||||
// $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
|
||||
// if (! $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), Carbon::now()->format('d_m_Y').'_'.$booking->marking.'.pdf')) {
|
||||
// echo 'Could not add file to ZIP: ' . $file;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Close ZipArchive
|
||||
// $zip->close();
|
||||
// } else {
|
||||
// echo 'Could not open ZIP file.';
|
||||
// }
|
||||
// } catch (Exception $exception) {
|
||||
// dd($exception);
|
||||
// }
|
||||
|
||||
|
||||
});
|
||||
Route::get('/bookings/billplz', function () {
|
||||
return view('pages.billplz_redirect');
|
||||
})->name('bookings.billplz');
|
||||
|
||||
|
||||
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
|
||||
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');
|
||||
|
||||
Route::get('/x2/data', function (Request $request) {
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
dd(\App\Models\Booking::whereDoesntHave('transactions', function($query){
|
||||
$query->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::PENDING_VERIFICATION, \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED]);
|
||||
})->groupBy('company_id')->get());
|
||||
})->name('x2.data');
|
||||
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
|
||||
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
})->name('products.random');
|
||||
|
||||
|
||||
Route::get('/1688', function (Request $request) {
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
$bookings = \App\Models\Booking::whereHas('bank', function ($query){
|
||||
return $query->where('bank_name', 'like', '%浙江网商银行%');
|
||||
})->get();
|
||||
|
||||
$sum = 0;
|
||||
foreach ($bookings as $booking){
|
||||
$sum += $booking->transactions()->whereMonth('created_at', 12)->where('type', 1)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED, \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED])->sum('amount');
|
||||
}
|
||||
|
||||
dd($sum);
|
||||
|
||||
})->name('x2.data');
|
||||
Route::get('/auto-purchase-order-fill', 'Bookings\AutoPurchaseOrderFillController@auto')->name('assign');
|
||||
Vendored
+1
-1
@@ -11,4 +11,4 @@ const mix = require('laravel-mix');
|
||||
|
|
||||
*/
|
||||
|
||||
mix.js('./resources/assets/vue/app.js', 'public/vue');
|
||||
mix.js('./resources/assets/vue/app.js', 'public/vue').version();
|
||||
|
||||
Reference in New Issue
Block a user