mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into promo-code
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\General;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -24,4 +25,21 @@ class Helper
|
||||
return array_slice(get_class_methods($className), 1);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @param $log
|
||||
* @return array
|
||||
*/
|
||||
static function debugLoggerForPerfexCRM($log){
|
||||
if($log){
|
||||
$message = $log['message'];
|
||||
$substring = 'No data were found';
|
||||
if (isset($message)) {
|
||||
if (strpos($message, $substring) !== false) {
|
||||
// Log::info('Message exist');
|
||||
} else {
|
||||
Log::info($log['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
{
|
||||
@@ -60,7 +61,12 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
|
||||
if(is_null($invoice)){
|
||||
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction, null, null, $this->updatePerfexCRMInvoiceObject->getIsPaid());
|
||||
$invoiceId = $result->payload['id'];
|
||||
if ($result) {
|
||||
$invoiceId = $result->payload['id'];
|
||||
} else {
|
||||
// Log::error(json_encode('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed'));
|
||||
Helper::debugLoggerForPerfexCRM('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$invoiceId = $invoice->id;
|
||||
|
||||
@@ -11,7 +11,7 @@ use App\Classes\Modules\Announcements\Services\CreatesAnnouncement;
|
||||
use App\Classes\Modules\Announcements\Processors\AssignAnnouncementToSegmentProcessor;
|
||||
|
||||
use App\Http\Resources\AnnouncementResource;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -67,8 +67,8 @@ class CreateAnnouncementLogic extends AbstractControllerLogic
|
||||
$annoucement_object = new AnnouncementObject(
|
||||
$request->input('title'),
|
||||
$request->input('description'),
|
||||
$request->input('starting_on'),
|
||||
$request->input('ending_on')
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('starting_on'))->format('Y-m-d H:i:s'),
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('ending_on'))->format('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
$this->canCreateAnnouncement->passes($annoucement_object);
|
||||
|
||||
@@ -10,7 +10,7 @@ use App\Classes\Modules\Announcements\Services\FetchesAnnouncement;
|
||||
use App\Classes\Modules\Announcements\Services\UpdatesAnnouncement;
|
||||
|
||||
use App\Http\Resources\AnnouncementResource;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -66,8 +66,8 @@ class UpdateAnnouncementLogic extends AbstractControllerLogic
|
||||
$annoucement_object = new AnnouncementObject(
|
||||
$request->input('title'),
|
||||
$request->input('description'),
|
||||
$request->input('starting_on'),
|
||||
$request->input('ending_on')
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('starting_on'))->format('Y-m-d H:i:s'),
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('ending_on'))->format('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
$this->canUpdateAnnouncement->passes($annoucement_object);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class FetchesPerfexCRMTask
|
||||
{
|
||||
@@ -38,7 +39,8 @@ class FetchesPerfexCRMTask
|
||||
|
||||
return (object) $data;
|
||||
}else{
|
||||
Log::error($response);
|
||||
// Log::error($response);
|
||||
Helper::debugLoggerForPerfexCRM($response);
|
||||
return null;
|
||||
}
|
||||
}catch(\Exception $exception){
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class UpdatesPerfexCRMCustomer
|
||||
{
|
||||
@@ -37,7 +38,8 @@ class UpdatesPerfexCRMCustomer
|
||||
$data = $response->json();
|
||||
return (object) $data;
|
||||
}else{
|
||||
Log::error($response);
|
||||
// Log::error($response);
|
||||
Helper::debugLoggerForPerfexCRM($response);
|
||||
return null;
|
||||
}
|
||||
}catch(\Exception $exception){
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\DeleteBookingLogic;
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\DeleteBookingLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ class AnnouncementResource extends JsonResource
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'segments' => $this->segments,
|
||||
'starting_on' => Carbon::parse($this->starting_on)->format('Y-m-d'),
|
||||
'ending_on' => Carbon::parse($this->ending_on)->format('Y-m-d'),
|
||||
'starting_on' => Carbon::parse($this->starting_on)->format('d-m-Y'),
|
||||
'ending_on' => Carbon::parse($this->ending_on)->format('d-m-Y'),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y'),
|
||||
];
|
||||
}
|
||||
|
||||
+5
-1
@@ -123,7 +123,11 @@ button:focus{
|
||||
|
||||
button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.not-allowed {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
/*
|
||||
Alternate buttons
|
||||
--------------------------------------------------
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
</div>
|
||||
<div class="row p-t-5">
|
||||
<div class="col">
|
||||
<currency-converter-component :data="serviceType" :section="section" :id="data.id" v-on:newCalculation="updateCalculation($event)"></currency-converter-component>
|
||||
<currency-converter-component :companySegment="data.segments" :data="serviceType" :section="section" :id="data.id" v-on:newCalculation="updateCalculation($event)"></currency-converter-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-b-15" v-if="(summary.calculation.total > 0 && (data.status === 1 || data.status === 2)) || ($store.getters.isAdmin && summary.calculation.total > 0)">
|
||||
|
||||
@@ -110,8 +110,8 @@
|
||||
<div class="row m-l-0 m-r-0">
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default m-b-0">
|
||||
<label>You'r Sending</label>
|
||||
<input id="cc_sending" name="cc_sending" type="text" placeholder="0.00" value="0.00" v-model="senderInput" class="form-control" @keyup="updateAmount($event, 0)" v-money="money">
|
||||
<label>You're Sending</label>
|
||||
<input id="cc_sending" name="cc_sending" type="text" placeholder="0.00" value="0.00" v-model="senderInput" class="form-control" :class="[{'not-allowed': disabledMyr}]" @keyup="updateAmount($event, 0)" v-money="money" :disabled="disabledMyr">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto bg-primary text-white">
|
||||
@@ -178,6 +178,10 @@
|
||||
required: true,
|
||||
type: Object
|
||||
},
|
||||
companySegment: {
|
||||
required: true,
|
||||
type: Array
|
||||
},
|
||||
id: {
|
||||
required: true,
|
||||
type: Number
|
||||
@@ -211,6 +215,20 @@
|
||||
created(){
|
||||
this.serviceType = this.data;
|
||||
},
|
||||
computed: {
|
||||
currentSegmentNames(){
|
||||
return this.companySegment.map(function (value){
|
||||
return value.name;
|
||||
})
|
||||
},
|
||||
disabledMyr(){
|
||||
if (!this.currentSegmentNames.includes('enable enter MYR rate')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
data: {
|
||||
handler: function (val) {
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
</div>
|
||||
|
||||
<div class="row m-b-20">
|
||||
<div class="col-6">
|
||||
<div class="col-6 p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.starting_on">
|
||||
<label>Start Date</label>
|
||||
<input type="date" v-model="parameters.starting_on">
|
||||
<date-picker-component v-model="parameters.starting_on"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-6 p-l-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.ending_on">
|
||||
<label>End Date</label>
|
||||
<input type="date" v-model="parameters.ending_on">
|
||||
<date-picker-component v-model="parameters.ending_on"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+42
-2
@@ -19,6 +19,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Bookings\Processors\CreatePurchaseOrderFor1688OrderProcessor;
|
||||
@@ -404,11 +405,13 @@ Route::get('/wallet/audit', function (Request $request) {
|
||||
if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount;
|
||||
if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount;
|
||||
}
|
||||
if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > -0.01) continue;
|
||||
$auditBalance = ($topups + $credit) - ($payments + $debit);
|
||||
$diffenrence = round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2);
|
||||
if((($diffenrence == 0) || ($diffenrence == -0)) AND $wallet->amount > -0.01) continue;
|
||||
|
||||
$i++;
|
||||
|
||||
echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")<br>Current Balance: ". $wallet->amount ."<br>Audit Balance: ". (($topups + $credit) - ($payments + $debit)) ."<br>Difference: ". round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) ."<br><br><br>";
|
||||
echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")<br>Current Balance: ". $wallet->amount ."<br>Audit Balance: ". ($auditBalance) ."<br>Difference: ". $diffenrence ."<br><br><br>";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -556,5 +559,42 @@ Route::get('/currency-rate-history', function () {
|
||||
|
||||
Route::get('/bank-record', 'Imports\ImportBankRecordController@import');
|
||||
|
||||
Route::get('/po/outsource/check', function(){
|
||||
$bookings = Booking::whereIn('marking', [34735, 43980, 35339, 28104, 40185, 46648, 34192, 21512, 84607, 31319, 23566, 48372, 59239, 72665, 81127, 46881, 41055, 67368, 41817, 60443, 28958, 46782, 98512, 43356, 78469, 88173, 52592, 77036, 76750, 77732, 31980, 57146, 38544, 78567, 98297, 90128, 43680, 86478, 80340, 41961, 26857, 33992, 79929, 53226, 88107, 31187, 68015, 43762, 34928, 55525, 44528, 57146, 31980, 27399, 63141, 74987, 85935, 37032, 95911, 59511, 47395, 97293, 43906, 74944, 53418, 61988, 81406, 83889, 83359, 66896, 21425, 61124, 23536, 56129, 21116, 64213, 72950, 20502, 20067, 64213, 59854, 44783, 35681, 74828, 28179, 32961, 46412, 99908, 49008, 77655, 45250, 65047, 37167, 90598, 26275, 58013, 38994, 63187, 33219, 52669, 79885, 74828, 91775, 29282, 46781, 96415, 36318, 84491, 32659, 23846, 38994, 65329, 25936, 68209, 72866, 63231, 32216, 82977, 24819, 32600, 38019, 80872, 65505, 37236, 82262, 30815, 59033, 46776, 87317, 89548, 36548, 54468, 35340, 98242, 29234, 47129, 67047, 64210, 36698, 39353, 86435, 65240, 37116, 71007, 40148, 88187, 76368, 91155, 57040, 95456, 29961, 66447, 43023, 29396, 30637, 60789, 84221, 35805, 44552, 35524, 43457, 22810, 83545, 92252, 83603, 59797, 40526, 32520, 71011, 95151, 90464, 78629, 61225, 74864, 73518, 53793, 26478, 57640, 43674, 23476, 76683, 23920, 22810, 44603, 56291, 23580, 94241, 51565, 83769, 63123, 58369, 99399, 41098, 60942, 69442, 80963, 48392, 73169, 59764, 66099, 21107, 33029, 38288, 32223, 55931, 43685, 24267, 83865, 52066, 61501, 83210, 20731, 55951, 82502, 66618, 62216, 22020, 42402, 99644, 35305, 49263, 37387, 73928, 92279, 26445, 83497, 96740, 38374, 29273, 94073, 99785, 21502, 51269, 31609, 97369, 73078, 28982, 64902, 41380, 87008, 59377, 39441, 81341, 62750, 29410, 85975, 37215, 43386, 80627, 79967, 81729, 81738, 58658, 40579, 56179, 37548, 72436, 77165, 32069, 97447, 84575, 49167, 45507, 96371, 90835, 27942, 87691, 30431, 47815, 82960, 43228, 87534, 93737, 98938, 69548, 82923, 48463, 24385, 96569, 53812, 32926, 54418, 34399, 53189, 49377, 27036, 68832, 72799, 76120, 78203, 87009, 86992, 97722, 96262, 95551, 77632, 54408, 33931, 62397, 58343, 52347, 59419, 50339, 54941, 31199, 92385, 90028, 90379, 43070, 25357, 24591, 60276, 91851, 96371, 81886, 24377, 21236, 66737, 93637, 85844, 23130, 75659, 27318, 43587, 46555, 28903, 44930, 52377, 20387, 40705, 79255, 29196, 30968, 76319, 54600, 29881, 37920, 43319, 35893, 65863, 33102, 71589, 45905, 49031, 97435, 70157, 78795, 47570, 71881, 92076, 45847, 35957, 58785, 84896, 65918, 25550, 49031, 50624, 83286, 63111, 21402, 56300, 77238, 21271, 21984, 30500, 76170, 95325, 22888, 84895, 26100, 84952, 49302, 41944, 43703, 84028, 53672, 49162, 28342, 47182, 70484, 59467, 85415, 20202, 97967, 58011, 85807, 79868, 81192, 86985, 43867, 47473, 28063, 68849, 61628, 96641, 37285, 58384, 86505, 51720, 63951, 91958, 28082, 46229, 57439, 55178, 96813, 34444, 28100, 75967, 33204, 75922, 68707, 71960, 34769, 29161, 49088, 79773, 91131, 53033, 77611, 81034, 72625, 36273, 78240, 34647, 21838, 73195, 83282, 60911, 29019, 98859, 44064, 82113, 51118, 54681, 59751, 64347, 21623, 47023, 62168, 23466, 62137, 85432, 85043, 41984, 30417, 40616, 97170, 69106, 81484, 68902, 78149, 62438, 67710, 57370, 99207, 64271, 33959, 60821, 51292, 44130, 28469, 77069, 91088, 47702, 89046, 84958, 41601, 99752, 72976, 26393, 85548, 32920, 86353, 97430, 71507, 36667, 57059, 71148, 44588, 35807, 80213, 89884, 76616, 35999, 79860, 37284, 72249, 32885, 70622, 47036, 97366, 60483, 89171, 37048, 34227, 76290, 46761, 31389, 73977, 54421, 87527, 75925, 68236, 31131, 43871, 54753, 90896, 41653, 82304, 87123, 80391, 42368, 35553, 60587, 30941, 31843, 25076])
|
||||
->get();
|
||||
|
||||
$averageItems = 5;
|
||||
$totalItems = 0;
|
||||
$pay = 0;
|
||||
|
||||
foreach ($bookings as $booking){
|
||||
$po = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION])->first();
|
||||
|
||||
if(!$po){
|
||||
echo '<span style="color: red">'.$booking->marking.' Purchase order not found!</span><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// $items = $po->transactionDetails()->get();
|
||||
//
|
||||
// foreach ($items as $item){
|
||||
// $activity = Activity::where('causer_id', 4332)->where('subject_id', $item->id)->where('subject_type', \App\Models\TransactionDetail::class)->get();
|
||||
// if($activity) {
|
||||
// $totalItems++;
|
||||
// }
|
||||
// }
|
||||
// // check activities by user
|
||||
$itemsCount = $po->transactionDetails()->count();
|
||||
$totalItems += $itemsCount;
|
||||
|
||||
$sum = $itemsCount / $averageItems;
|
||||
|
||||
$pay += $sum < 1 ? 1 : round($sum);
|
||||
|
||||
}
|
||||
|
||||
echo '<h3>Total Items: '.$totalItems.'</h3>';
|
||||
echo '<h3>Total Pay: '.$pay.'</h3>';
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user