Merge remote-tracking branch 'origin/development' into development

# Conflicts:
#	app/Classes/Modules/Transactions/ControllersLogic/CreateBulkPurchaseOrderDocumentLogic.php
This commit is contained in:
omair saleh
2022-07-11 23:56:40 +08:00
21 changed files with 618 additions and 83 deletions
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class DateEnd implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDate('created_at', '<=', $value);
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class DateStart implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDate('created_at', '>=', $value);
}
}
@@ -65,7 +65,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic
public function logic(Request $request) : JsonResponse
{
$bookings = Booking::where(function($query){
return $query->whereMonth('created_at', 01)->orWhereMonth('created_at', 02);
return $query->whereMonth('created_at', 03)->orWhereMonth('created_at', 04);
})->whereDoesntHave('transactions', function($q){
$q->where('type', TransactionType::PURCHASE_ORDER);
$q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]);
@@ -7,21 +7,26 @@ use App\Classes\ValueObjects\Constants\CompanyType;
use App\Models\Company;
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;
class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
class ExportsCustomers implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
public function headings(): array
{
return [
'Marking',
'Name',
'Company Name',
'Email',
'Account Name',
'Phone Number',
'Business type',
'Number of bookings',
'Last booking Date',
'Bookings total',
'Registration Date',
'System Registration'
@@ -44,13 +49,18 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
public function map($company): array
{
$employee = $company->employees()->first();
$lastBooking = $company->bookings()->orderByDesc('id')->first();
return [
$company->reference,
$company->name,
$company->employees()->first() ? $company->employees()->first()->name : '',
$employee ? $employee->email : '',
$employee ? $employee->name : '',
$company->contacts()->first() ? $company->contacts()->first()->phone : '',
$company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual',
count($company->bookings),
$lastBooking ? $lastBooking->created_at : '',
$company->bookings()->sum('fix_amount'),
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($company->created_at),
count($company->segments()->where('segment_id', '=', 5)->get()) ? 'Exchange 1.0' : 'Exchange 2.0'
@@ -3,7 +3,6 @@
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Models\Document;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
@@ -0,0 +1,98 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Models\Booking;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Resources\TransactionResource;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Transactions\Services\ListsGroups;
use App\Classes\Modules\Transactions\Services\FetchesGroup;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceDocumentProcessor;
class CreateBulkPurchaseOrderTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Generate Bulk Purchase Order',
'message' => 'You have successfully generated bulk purchase order'
];
}
/** @var ListsGroups */
private $listsGroups;
/** @var FetchesCompany */
private $fetchesCompany;
/** @var CreateInvoiceDocumentProcessor */
private $invoiceDocumentProcessor;
/**
* CreateBulkPurchaseOrderTransactionLogic constructor.
* @param ListsGroups $listsGroups
* @param FetchesCompany $fetchesCompany
* @param CreateInvoiceDocumentProcessor $invoiceDocumentProcessor
*/
public function __construct(ListsGroups $listsGroups, FetchesCompany $fetchesCompany, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor)
{
$this->listsGroups = $listsGroups;
$this->fetchesCompany = $fetchesCompany;
$this->invoiceDocumentProcessor = $invoiceDocumentProcessor;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
$groups = $this->listsGroups->execute(['issuer_id' => [$request->issuer_id], 'date_start' => $request->start_date, 'date_end' => $request->end_date]);
foreach($groups as $group){
foreach($group->transactions as $transaction){
if($transaction->owner()->owner()->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('status', '!=', ApprovalStatus::APPROVED)->exists()){
throw new MalformedRequestException('You can\'t generate bulk purchased order if there in uncomplete transactions');
}
}
}
foreach($groups as $group){
foreach($group->transactions as $transaction){
$completed_transactions = $transaction->owner()->owner()->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('status', '=', ApprovalStatus::APPROVED)->get();
$purchaseOrder = $transaction->owner()->transactions()
->where('type', TransactionType::PURCHASE_ORDER)
->complete()
->first();
foreach($completed_transactions as $transaction){
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
// purchase order
$this->invoiceDocumentProcessor->execute($transaction, $purchaseOrder, $supplier, DocumentType::PURCHASE_ORDER);
}
}
}
return $this->response([]);
}
}
@@ -97,7 +97,7 @@ class CreateSupplierTransactionProcessor
$this->pushBill($billTransaction);
$transferFeeNumber = $this->generatesTransactionBillNumber->execute('TRFR-');
$transferFee = $this->calculatesTransactionTransferFee->execute($billTransaction->amount, $constant);
$transferFee = $this->calculatesTransactionTransferFee->execute($billTransaction->original_amount, $constant);
$object = new TransactionObject($transferFeeNumber, TransactionType::TRANSFER_FEE, 1, $supplier->id,
$supplier->banks()->where('default', true)->first()->id, PaymentMethodType::CASH,
$payment->original_amount, $payment->original_amount, $payment->original_currency_id, $payment->original_currency_id,
@@ -22,4 +22,5 @@ final class DocumentType {
public const DELIVER_ORDER = 'DELIVER_ORDER';
public const INVOICE = 'INVOICE';
public const SUPPLIER_DELIVER_ORDER = 'SUPPLIER_DELIVER_ORDER';
public const BULK_PURCHASE_ORDER = 'BULK_PURCHASE_ORDER';
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Transactions;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Transactions\ControllersLogic\CreateBulkPurchaseOrderDocumentLogic;
class CreateBulkPurchaseOrderDocumentController
{
/**
* @param Request $request
* @param CreateBulkPurchaseOrderDocumentLogic $logic
* @return JsonResponse
*/
public function create(Request $request, CreateBulkPurchaseOrderDocumentLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Transactions;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Transactions\ControllersLogic\CreateBulkPurchaseOrderTransactionLogic;
class CreateBulkPurchaseOrderTransactionController
{
/**
* @param Request $request
* @param CreateBulkPurchaseOrderTransactionLogic $logic
* @return JsonResponse
*/
public function create(Request $request, CreateBulkPurchaseOrderTransactionLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
+16 -3
View File
@@ -2,7 +2,10 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Resources\Json\JsonResource;
class GroupResource extends JsonResource
@@ -15,15 +18,25 @@ class GroupResource extends JsonResource
*/
public function toArray($request)
{
$transactions = $this->transactions()->get();
$complete_transactions = new Collection([]);
foreach($transactions as $transaction){
$booking = $transaction->owner()->first()->owner()->first();
$purchaseOrders = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->where('status', '=', ApprovalStatus::APPROVED)->get();
$complete_transactions = $complete_transactions->merge($purchaseOrders);
}
return [
'id' => $this->id,
'original_amount' => (double) $this->original_amount,
'original_amount' => (float) $this->original_amount,
'original_currency' => new CurrencyResource($this->original_currency),
'amount' => (double) $this->amount,
'amount' => (float) $this->amount,
'currency' => new CurrencyResource($this->currency),
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'),
'currency_rate' => (float) $this->currency_rate,
'transactions' => TransactionResource::collection($this->transactions()->get()),
'transactions' => TransactionResource::collection($transactions),
'complete_transactions' => TransactionResource::collection($complete_transactions),
];
}
}
+14 -1
View File
@@ -3,15 +3,28 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Classes\General\Interfaces\Documentable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
class Group extends Model
class Group extends Model implements Documentable
{
use HasRelationships;
public function transactions()
{
return $this->belongsToMany(Transaction::class, GroupTransaction::class);
}
/**
* @return MorphMany
*/
public function documents(): morphMany
{
return $this->morphMany(Document::class, 'owner');
}
/**
* @return BelongsTo
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@@ -14,18 +14,10 @@
<small class="bold fs-10 text-danger">{{error}}</small>
</div>
</div>
<div class="row m-b-10" v-if="type === 2">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.reference">
<label>Reference</label>
<input type="text" class="form-control" v-model="parameters.reference" :disabled="disabled">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.account_no">
<label>{{ serviceType.id === 4 ? 'Alipay recipient Email / Phone' : 'Account No.' }}</label>
<label>{{ serviceType.id === 4 ? '1688 Login Id/Email/Phone' : 'Account No.' }}</label>
<input type="text" class="form-control" v-model="parameters.account_no" :disabled="disabled">
</validation-wrapper-component>
</div>
@@ -33,20 +25,17 @@
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.holder_name">
<label>Account Holder Name</label>
<label>1688 Login Password</label>
<input type="text" class="form-control" v-model="parameters.holder_name" @keyup="onlyChinese($event)" :disabled="disabled">
</validation-wrapper-component>
</div>
</div>
<div class="row" v-show="englishTextWarning === true">
<div class="row m-b-10">
<div class="col">
<div class="fs-11 text-danger m-b-10" v-if="!confirmProceedEnglishText">Warning: We do not encourage to transfer to non-chinese recipient Alipay account ! <span class="text-danger bold pointer text-underline" @click="confirmProceedEnglishText = !confirmProceedEnglishText">Proceed Anyway.</span></div>
<div class="row" v-if="confirmProceedEnglishText">
<div class="col text-danger bold">
<p>Foreign name alipay may exceed Monthly / Yearly Limit , and may be unable to withdraw your funds out.</p>
</div>
</div>
<div class="text-danger m-b-10" v-if="confirmProceedEnglishText">The risk is too high. <span class="text-danger bold pointer text-underline" @click="confirmProceedEnglishText = !confirmProceedEnglishText">I changed my mind.</span></div>
<validation-wrapper-component :validator="$v.parameters.bank_branch">
<label>AliPay 6-digit Payment Pin</label>
<input type="text" class="form-control" v-model="parameters.bank_branch" :disabled="disabled">
</validation-wrapper-component>
</div>
</div>
<div class="row">
@@ -54,7 +43,7 @@
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" :data-dismiss="closable ? 'modal' : ''" @click="$emit('close')">{{disabled ? 'Change Recipient Account' : 'Cancel'}}</div>
</div>
<div class="col p-l-5" v-if="!disabled">
<button class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()" :disabled="!confirmProceedEnglishText && englishTextWarning">Add Account</button>
<button class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Add Account</button>
</div>
</div>
</div>
@@ -102,7 +91,7 @@
bank_name: '-',
holder_name: '',
account_no: '',
bank_branch: '-',
bank_branch: '',
country_id: this.country_id,
},
englishTextWarning: false,
@@ -117,15 +106,15 @@
account_no: {
required
},
reference: {
required: requiredIf(function () { return this.parameters.type === 2 })
bank_branch: {
required
}
}
},
methods: {
submitForm(){
this.parameters.account_type = 3,
this.parameters.bank_name = '-',
this.parameters.account_type = 3;
this.parameters.bank_name = '-';
this.submit(route('api.bank.create'), 'post', this.section, true, false);
},
successHandler(response){
@@ -73,7 +73,7 @@
<!--</div>-->
<div class="row parentContainer">
<div class="col">
<div class="row text-center m-b-15" v-if="data.serviceType.id === 4">
<div class="row text-center m-b-15 hide" v-if="data.serviceType.id === 4">
<div class="col-auto p-r-0">
<div class="b-a b-grey bg-white padding-15 pointer b-primary text-primary">
<div class="m-b-5">
@@ -103,7 +103,7 @@
<div class="row" id="select-list" name="select-list">
<div class="col">
<div class="form-group no-margin form-group-default">
<label>{{ data.serviceType.id === 4 ? 'Alipay recipient Email / Phone' : 'Account No.' }}</label>
<label>{{ data.serviceType.id === 4 ? '1688 Login Id/Email/Phone' : 'Account No.' }}</label>
<input type="text" class="form-control" v-model="account_no" @keyup="parameters.bankAccount = {}" @focus="dropdownStatus = true">
</div>
</div>
@@ -1,6 +1,7 @@
<template>
<div class="row parentContainer">
<div class="col">
<new-service-announcement-component :data="data"></new-service-announcement-component>
<div class="row">
<div class="col">
<div class="row m-l-0 m-r-0 m-b-20" v-if="!data.services.length">
@@ -0,0 +1,194 @@
<template>
<div class="row m-b-15 align-items-end parentContainer">
<div class="col">
<div class="row m-l-0 m-r-0 m-b-15 animate__animated animate__tada animate__repeat-2 animate__delay-3s" v-if="!data.segments.some(item => item.id === 13 || item.id === 16)">
<div class="col bg-white padding-15">
<div class="row">
<div class="col-4">
<img class="m-b-10 w-100" src="/images/1688_approved.png" />
</div>
<div class="col"></div>
<div class="col-4">
<img class="m-b-10 w-100" src="/images/best-rate-300x127.png" />
</div>
</div>
<div class="row">
<div class="col">
<div class="row ">
<div class="col">
<h5 class="m-b-0">Hi, {{$store.getters.getUserName}}</h5>
<h4 class="m-t-0">A new <span class="bold">1688 payment</span> solution for you</h4>
<p>Our team will access your 1688 account and pay on your behalf.</p>
<p>To activate the service, <span class="bold text-underline text-complete pointer requestModal" data-type="requirements" @click="ServiceWaitingList">check requirements</span>.</p>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<div class="checkbox check-primary m-t-0">
<input type="checkbox" v-model="acknowledge" id="acknowledge">
<label for="acknowledge" style="white-space: pre-wrap;">I hereby acknowledge that I have read the requirements and my 1688 account is eligible for this service.</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col text-center">
<div class="btn btn-lg block btn m-b-5 no-border text-white" :class="[{'bg-primary': acknowledge}, {'bg-primary-lighter': !acknowledge}]" :style="{ cursor: acknowledge ? 'pointer' : 'no-drop' }" @click="activateService">Activate Service</div>
<!--<p class="text-danger fs-12 bold pointer">Didn't meet the requirements?</p>-->
</div>
</div>
</div>
</div>
<div class="row" :class="[{'overflow-hidden': !expanded}]">
<div class="col">
<div class="row">
<div class="col">
<!--<p>Our team will access your 1688 account and pay on your behalf.</p>-->
<div class="row">
<div class="col m-t-10" v-if="expanded">
<p>1. Officially <span class="bold text-success all-caps">Authorized</span> by Alibaba 1688.</p>
<p>2. <span class="bold text-success all-caps">No restrictions</span> on the amount you want to transfer.</p>
<p>3. You can be sure your account will <span class="bold text-success all-caps">never freeze</span>, 100% guarantee.</p>
<p class="m-b-20">4. You're handed a <span class="bold text-success all-caps">local invoice</span>, complete with tax information and line items for your records.</p>
<p class="no-margin text-center hint-text pointer text-underline" @click="ServiceNotInterested">No thank you, I am not interested.</p>
</div>
</div>
</div>
</div>
<div class="row" v-if="!expanded">
<div class="col">
<div class="m-b-0 m-t-5 d-flex justify-content-center text-complete text-underline cursor" @click="expanded = !expanded">Learn more</div>
</div>
</div>
</div>
</div>
</div>
</div>
<modal-component small type="requirements">
<div class="row" v-if="!failed">
<div class="col text-center">
<div class="row">
<div class="col text-center">
<div class="row m-b-20">
<div class="col">
<h3 class="all-caps">Service Requirements</h3>
</div>
</div>
<div class="row">
<div class="col">
<iframe width="100%" height="auto" src="https://www.youtube.com/embed/6OQG50XnAOg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</div>
<div class="row m-b-15 text-left">
<div class="col">
<h4>To active this the service, please ensure that:</h4>
<p class="bold">1. Your 1688 account is linked with your Alipay account.</p>
<p class="bold">2. Your Alipay account has real-name authorized. [text]</p>
</div>
</div>
<div class="row text-left m-b-10">
<div class="col">
<p>If you fulfill the two requirements above, please click "activate" button to activate the service immediately</p>
</div>
</div>
<div class="row">
<div class="col">
<div class="btn btn-lg btn m-b-5 btn-primary p-l-50 p-r-50" @click="activateService">Activate</div>
<p class="no-margin text-center text-danger pointer text-underline" @click="failedRequierments">don't meet the requirements?</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" v-if="failed">
<div class="col">
<div class="row m-b-20">
<div class="col">
<h3 class="all-caps">How to fulfill the requirements for 1688 Payment</h3>
</div>
</div>
<div class="row m-b-15 text-left">
<div class="col">
<h4>You need to ensure your Alipay is verified & bound to your 1688 account.</h4>
<p class="bold">1. Download and sign up on Alipay app.</p>
<p class="bold">2. Complete registration and receive verification code.</p>
<p class="bold">3. Click on "Me" shortcut at the bottom of Alipay homepage.</p>
<p class="bold">4. Click on 'Settings'at top right.</p>
<p class="bold">5. Select "Account & Security", click on "Real Name Verification".</p>
<p class="bold">6. Click on "Verify now" , and submit the info requested.</p>
<p class="bold">7. You may use any verification method using passport.</p>
<p class="bold">8. Upload your passport photo and complete personal information</p>
<p class="bold">9. If Alipay shows "Verified", then it is successful.</p>
</div>
</div>
<div class="row text-left m-b-10">
<div class="col">
<p>For further enquiries, contact us via the chatbox.</p>
</div>
</div>
</div>
</div>
</modal-component>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
data(){
return {
acknowledge: false,
parameters: {
segment_id: ''
},
expanded: false,
failed: false
}
},
methods: {
activateService(){
this.parameters = {
segment_id: 13
};
if(this.acknowledge){
this.submit(this.route('api.company.segment.assign', this.data.id), 'post', 'activateService', true, false);
}
location.reload();
},
ServiceWaitingList(){
this.acknowledge = true;
this.parameters = {
segment_id: 14
};
this.submit(this.route('api.company.segment.assign', this.data.id), 'post', 'activateService', false, false)
},
failedRequierments(){
this.failed = true;
this.acknowledge = true;
this.parameters = {
segment_id: 17
};
this.submit(this.route('api.company.segment.assign', this.data.id), 'post', 'activateService', false, false)
},
ServiceNotInterested(){
this.parameters = {
segment_id: 16
};
this.submit(this.route('api.company.segment.assign', this.data.id), 'post', 'activateService', true, false);
location.reload();
}
},
mixins: [componentHandler]
}
</script>
@@ -1,5 +1,5 @@
<template>
<div class="row">
<div class="row parentContainer">
<div class="col">
<div class="row m-b-20 parentContainer" v-if="data.id === 9">
<div class="col-auto">
@@ -22,50 +22,6 @@
</div>
</modal-component>
</div>
<div class="row m-l-0 m-r-0 m-b-15">
<div class="col bg-white padding-15">
<div class="row">
<div class="col">
<div class="bold d-flex align-items-center m-b-10">
<span class="rounded badge-success m-r-10 padding-5 p-l-15 p-r-15">New</span> March 1, 2020
</div>
<h5 class="bold fs-18">Try out our wallet to get a better rate now.</h5>
</div>
</div>
<div class="row">
<div class="col">
<img class="m-b-10 w-100" src="/images/10107.jpg" />
</div>
</div>
<div class="row" :class="[{'h-25': !expanded}, {'overflow-hidden': !expanded}]">
<div class="col position-relative">
<div class="row">
<div class="col">
<p>Transferring your payments by using the wallet just got a lot easier.</p>
<div class="row">
<div class="col" v-if="expanded">
<p class="no-margin">This release you can:</p>
<p class="no-margin">1. Top up once, pay for multiple transfers</p>
<p class="no-margin">2. Get your refund back to your wallet</p>
<p class="no-margin">3. Get a better exchange rate.</p>
</div>
</div>
</div>
</div>
<div class="row position-absolute top-0 w-100 gradient-white p-t-15 p-b-15" v-if="!expanded">
<div class="col">
<div class="m-b-0 m-t-5 d-flex justify-content-center cursor" @click="expanded = !expanded">Show more <i class="fa fa-angle-down fs-20 bold m-l-10"></i></div>
</div>
</div>
<div class="row" v-if="expanded">
<div class="col">
<div class="m-b-0 m-t-5 d-flex justify-content-center cursor" @click="expanded = !expanded">Show less <i class="fa fa-angle-up fs-20 bold m-l-10"></i></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" v-if="!reload">
<div class="col">
<div class="bg-complete" :class="[{'padding-25': !mini}, {'padding-15': mini}]">
@@ -121,7 +77,6 @@
data(){
return {
reload: false,
expanded: false
}
},
mixins: [componentHandler],
@@ -0,0 +1,181 @@
@extends('layouts.base_pdf')
@section('inner_content')
<br>
<htmlpageheader name="page-header">
<br><br>
<div class="separator"><strong><i>{{ $group->transactions[0]->bill_no }}</i></strong></div>
</htmlpageheader>
<br>
<table>
<tr>
<td class="title">
<strong>Purchase Order</strong>
</td>
<td class="document-detail">
PO#: {{ $group->transactions[0]->bill_no }} <br>
Ref#: {{ $group->transactions[0]->owner()->first()->owner()->first()->marking }} <br>
Date: {{ $group->transactions[0]->owner()->first()->owner()->first()->created_at }}
</td>
</tr>
</table>
<br>
<table class="buyer-seller">
<tr>
<td width="50%" class="top">
<span class="buyer-seller-title">
Buyer
</span>
<br>
<div class="buyer-company">
Marking#: {{ $group->transactions[0]->owner()->first()->owner()->first()->marking }}
</div>
<span class="buyer-company">
{{ $supplier->name }}
</span>
<span class="reg">
{{-- {{ $supplier }} --}}
</span>
<br>
<span class="address">
@php
$addresses = $supplier->addresses()->where('billing', '=', true)->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</span>
<br>
<span class="contact-no">
Phone: {{ $supplier->contacts()->first()->phone }}
</span>
</td>
<td width="50%" class="top">
<span class="buyer-seller-title">
Seller
</span>
<br>
<span class="buyer-company">
CIEF Worldwide Sdn Bhd (1134596-M)
</span>
<div class="address">
Malaysia Global Innovation & CreativityCentre, Level 1 CWS, Block 3730, PersiaranAPEC 63000 Cyberjaya
</div>
<div class="contact-no">
Phone: 0182909252
</div>
</td>
</tr>
</table>
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
@php
$subtotal = 0;
@endphp
@foreach($group->transactions as $po_order_transaction)
@foreach ($po_order_transaction->owner()->first()->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@if($po_order_transaction->owner()->first()->booking()->first()->fix_currency_id !== 1)
{{ number_format( (1/$group->currency_rate) * $transaction_detail->price, 2) }}
@else
{{ number_format($transaction_detail->price, 2) }}
@endif
</td>
<td width="20%" class="right top">
@if($po_order_transaction->owner()->first()->booking()->first()->fix_currency_id !== 1)
{{ number_format((float)number_format( (1/$group->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
@php
$subtotal += number_format((float)number_format( (1/$group->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
@endphp
@else
{{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
@php
$subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
@endphp
@endif
</td>
</tr>
@endforeach
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($subtotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($group->service_charge, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@if($group->transactions[0]->owner()->first()->owner()->first()->fix_currency_id !== 1)
{{ number_format((float)number_format( (1/$group->currency_rate) * $group->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
@else
{{ number_format((float)number_format($group->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
@endif
</td>
</tr>
@if($group->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($group->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@if($group->transactions[0]->owner()->first()->owner()->first()->fix_currency_id !== 1)
{{ number_format( ((1/$group->currency_rate) * $group->amount) + $group->service_charge + $group->tax, 2) }}
@else
{{ number_format($group->amount + $group->service_charge + $group->tax, 2) }}
@endif
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">
<table width="100%">
<tr>
<td style="text-align: right; ">This is generated by computer. No signature required.</td>
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
</tr>
</table>
</htmlpagefooter>
@endsection
+3
View File
@@ -16,6 +16,8 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
route::delete('{id}/bill/delete', 'DeletePaymentProofDocumentController@delete')->name('bill.delete');
Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create');
Route::get('bulk/po/{issuer_id}/{start_date}/{end_date}', 'CreateBulkPurchaseOrderTransactionController@create')->name('po.bulk.create');
Route::get('wallet/list', 'ListWalletTransactionsController@list')->name('wallet.list');
@@ -27,5 +29,6 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
Route::get('/list', 'ListGroupsController@list')->name('list');
Route::delete('/{id}/delete', 'DeleteGroupController@delete')->name('delete');
Route::put('/{id}/update', 'UpdateGroupController@update')->name('update');
Route::get('/{id}/bulk/po', 'CreateBulkPurchaseOrderDocumentController@create')->name('bulk.po');
});
});