DONE: whatsapp api integration, fix linter using laravel pint, fix issue on invoice not found
This commit is contained in:
+38
-17
@@ -1,10 +1,10 @@
|
||||
APP_NAME=Laravel
|
||||
APP_NAME="Lelong - Admin"
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:ezY+zzzO7+TOh5WtUG544ffDFNCqNQr4c9/uxFCVywo=
|
||||
APP_KEY=base64:qelauhvfTopsnZJAxIfOc5CewbCN9zi4pjBfvsmqWdA=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost:8082
|
||||
APP_PEMBIDA=http://localhost:8083/
|
||||
API_URL=http://host.docker.internal:8080/
|
||||
API_URL=http://host.docker.internal:8080/lelong/
|
||||
API_UJRAH_URL=http://host.docker.internal:8080/lelong/
|
||||
API_URL_KAUNTER=http://host.docker.internal:8081/
|
||||
API_VERIFY=false
|
||||
@@ -13,7 +13,6 @@ LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
# Uses existing api_arrahn-mysql (hostname "mysql" on api_arrahn_default network)
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mysql
|
||||
DB_PORT=3306
|
||||
@@ -24,10 +23,38 @@ DB_PASSWORD=root
|
||||
DB_CONNECTION_MAIN=mysql
|
||||
DB_HOST_MAIN=mysql
|
||||
DB_PORT_MAIN=3306
|
||||
DB_DATABASE_MAIN=erahn_xtra
|
||||
DB_DATABASE_MAIN=master_erahn
|
||||
DB_USERNAME_MAIN=root
|
||||
DB_PASSWORD_MAIN=root
|
||||
|
||||
DB_CONNECTION_X0101=mysql
|
||||
DB_HOST_X0101=mysql
|
||||
DB_PORT_X0101=3306
|
||||
DB_DATABASE_X0101=arrahn_ld
|
||||
DB_USERNAME_X0101=root
|
||||
DB_PASSWORD_X0101=root
|
||||
|
||||
DB_CONNECTION_X0201=mysql
|
||||
DB_HOST_X0201=mysql
|
||||
DB_PORT_X0201=3306
|
||||
DB_DATABASE_X0201=erahn_baling
|
||||
DB_USERNAME_X0201=root
|
||||
DB_PASSWORD_X0201=root
|
||||
|
||||
DB_CONNECTION_X0301=mysql
|
||||
DB_HOST_X0301=mysql
|
||||
DB_PORT_X0301=3306
|
||||
DB_DATABASE_X0301=erahn_xtra
|
||||
DB_USERNAME_X0301=root
|
||||
DB_PASSWORD_X0301=root
|
||||
|
||||
DB_CONNECTION_X0401=mysql
|
||||
DB_HOST_X0401=mysql
|
||||
DB_PORT_X0401=3306
|
||||
DB_DATABASE_X0401=erahn_segamat
|
||||
DB_USERNAME_X0401=root
|
||||
DB_PASSWORD_X0401=root
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
@@ -69,15 +96,6 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
MARHUN_CAMERAS="Doccamera"
|
||||
|
||||
WABOT_API=https://md.wabot.my/api/send.php
|
||||
WABOT_INSTANCES_ID=63C26B7AAD21A
|
||||
WABOT_TOKEN_KEYS=cbee7e95cf3ffbfa0531d5fddfd44f87
|
||||
|
||||
# wabot use for blast message to pembida
|
||||
WABOT_API_SECOND=https://md.wabot.my/api/send.php
|
||||
WABOT_INSTANCES_ID_SECOND=64892FD7440A6
|
||||
WABOT_TOKEN_KEYS_SECOND=cbee7e95cf3ffbfa0531d5fddfd44f87
|
||||
|
||||
# for config STORAGE_DIRECTORY, set value without slash at the end
|
||||
# STORAGE_DIRECTORY=/Users/UTM/Sites/lelong/storage
|
||||
|
||||
@@ -95,13 +113,16 @@ WHATSAPP_TEMPLATE=hello_world
|
||||
WHATSAPP_TEMPLATE_LANG=en_US
|
||||
WHATSAPP_JANA_NOTIS_TEMPLATE=hello_world
|
||||
WHATSAPP_JANA_NOTIS_TEMPLATE_LANG=en_US
|
||||
WHATSAPP_PEMENANG_TEMPLATE=hello_world
|
||||
WHATSAPP_PEMENANG_TEMPLATE_LANG=en_US
|
||||
WHATSAPP_VERIFY_TOKEN=
|
||||
WHATSAPP_APP_SECRET=
|
||||
|
||||
ONE_WAY_SMS_USERNAME=apiusername
|
||||
ONE_WAY_SMS_PASSWORD=apipassword
|
||||
|
||||
# required at boot (BillplzService is constructed during package discovery)
|
||||
BILLPLZ_API_KEY=local-placeholder
|
||||
BILLPLZ_API_KEY=f0697647-bfc0-41da-8486-5df0d4c8d741
|
||||
BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE=33de621397c59551cca9b9a007c7b5913b95d57c06a3422b1e0dceae2e79c4360e20c8a1f5680fdb8880137a1b379db1824e167ae9a80952ddfedb508d8eaac8
|
||||
BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID=vbkc2urs
|
||||
BILLPLZ_API_URL=https://www.billplz-sandbox.com/api
|
||||
BILLPLZ_SANDBOX=true
|
||||
BILLPLZ_SANDBOX=true
|
||||
@@ -1,4 +1,10 @@
|
||||
## Jana Notis Send Email to Admin
|
||||
|
||||
## Process Flow
|
||||
Operasi buat simulasi -> PC Jana Notis -> Khazanah scan marhun keluar -> Penilai upload gambar -> Operasi start lelong balik
|
||||
Operasi buat simulasi -> PC Jana Notis -> Khazanah scan marhun keluar -> Penilai upload gambar -> Operasi start lelong balik
|
||||
|
||||
## Tag Means
|
||||
### cawangan_lelong.tagujrah
|
||||
0 = Normal lelong (bukan ujrah)
|
||||
1 = Lelong ujrah
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Resit;
|
||||
use App\Http\Controllers\ApiController;
|
||||
use App\Services\BillplzService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Payment;
|
||||
use App\Http\Controllers\ApiController;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CheckBillplzPayments extends Command
|
||||
{
|
||||
protected $signature = 'billplz:semak
|
||||
{--date= : Date in YYYY-MM-DD format}
|
||||
{--preview : Preview pending resits only}';
|
||||
|
||||
protected $description = 'Check Billplz payment status and update database';
|
||||
|
||||
protected $billplzService;
|
||||
@@ -28,85 +27,86 @@ class CheckBillplzPayments extends Command
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$date = $this->option('date') ?? now()->toDateString();
|
||||
$preview = $this->option('preview');
|
||||
{
|
||||
$date = $this->option('date') ?? now()->toDateString();
|
||||
$preview = $this->option('preview');
|
||||
|
||||
// Validate date
|
||||
try {
|
||||
$dateObj = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (\Exception $e) {
|
||||
$this->error("Invalid date format. Use YYYY-MM-DD.");
|
||||
return 1;
|
||||
}
|
||||
// Validate date
|
||||
try {
|
||||
$dateObj = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('Invalid date format. Use YYYY-MM-DD.');
|
||||
|
||||
$this->info("Retrying Billplz check for date: {$dateObj->toDateString()}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
$date = $dateObj->toDateString();
|
||||
$this->info("Retrying Billplz check for date: {$dateObj->toDateString()}");
|
||||
|
||||
$pendingResits = DB::table('resit as r')
|
||||
->join('payment as p', 'p.resit_id', '=', 'r.id')
|
||||
->join(DB::raw('(
|
||||
$date = $dateObj->toDateString();
|
||||
|
||||
$pendingResits = DB::table('resit as r')
|
||||
->join('payment as p', 'p.resit_id', '=', 'r.id')
|
||||
->join(DB::raw('(
|
||||
SELECT user_id, total_payment, MIN(id) AS min_id
|
||||
FROM payment
|
||||
GROUP BY user_id, total_payment
|
||||
) as unique_payment'), 'p.id', '=', 'unique_payment.min_id')
|
||||
->whereNull('r.status')
|
||||
->where('p.status', 0)
|
||||
->whereNotNull('r.billplz_id')
|
||||
->whereDate('r.created_at', $date)
|
||||
->where('r.billplz_id', 'NOT LIKE', '%CDM%')
|
||||
->select('r.*', 'p.id as payment_id', 'p.total_payment')
|
||||
->distinct()
|
||||
->get();
|
||||
->whereNull('r.status')
|
||||
->where('p.status', 0)
|
||||
->whereNotNull('r.billplz_id')
|
||||
->whereDate('r.created_at', $date)
|
||||
->where('r.billplz_id', 'NOT LIKE', '%CDM%')
|
||||
->select('r.*', 'p.id as payment_id', 'p.total_payment')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
if ($pendingResits->isEmpty()) {
|
||||
$this->info('Tiada Resit belum dibayar ditemui.');
|
||||
return 0;
|
||||
}
|
||||
if ($pendingResits->isEmpty()) {
|
||||
$this->info('Tiada Resit belum dibayar ditemui.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($preview) {
|
||||
$this->info('Preview mode aktif. Senarai Resit:');
|
||||
foreach ($pendingResits as $resit) {
|
||||
$this->line("Resit ID: {$resit->id} | Billplz ID: {$resit->billplz_id} | Jumlah: RM{$resit->total_payment}");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($preview) {
|
||||
$this->info("Preview mode aktif. Senarai Resit:");
|
||||
foreach ($pendingResits as $resit) {
|
||||
$this->line("Resit ID: {$resit->id} | Billplz ID: {$resit->billplz_id} | Jumlah: RM{$resit->total_payment}");
|
||||
$this->info("Semak Resit ID: {$resit->id}");
|
||||
|
||||
$billData = $this->billplzService->testGetBill($resit->billplz_id);
|
||||
|
||||
if (isset($billData['error'])) {
|
||||
$this->error("❌ Gagal semak Billplz untuk Resit {$resit->id}: {$billData['details']}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($billData['paid']) && $billData['paid'] === true) {
|
||||
// Simulate Request object
|
||||
$data = [
|
||||
'billplz' => [
|
||||
'id' => $resit->billplz_id,
|
||||
'paid' => 'true',
|
||||
'paid_at' => $billData['paid_at'] ?? now()->toDateTimeString(),
|
||||
],
|
||||
];
|
||||
// dd($data);
|
||||
|
||||
$apiController = App::make(ApiController::class);
|
||||
$apiController->processPaidResit($data);
|
||||
// dd($fakeRequest);
|
||||
|
||||
$this->info("✅ Resit ID {$resit->id} handled via processPaidResit.");
|
||||
} else {
|
||||
$this->info("ℹ️ Resit ID {$resit->id} masih belum dibayar.");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
$this->info('Semakan semula Billplz selesai.');
|
||||
}
|
||||
|
||||
foreach ($pendingResits as $resit) {
|
||||
$this->info("Semak Resit ID: {$resit->id}");
|
||||
|
||||
$billData = $this->billplzService->testGetBill($resit->billplz_id);
|
||||
|
||||
if (isset($billData['error'])) {
|
||||
$this->error("❌ Gagal semak Billplz untuk Resit {$resit->id}: {$billData['details']}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($billData['paid']) && $billData['paid'] === true) {
|
||||
// Simulate Request object
|
||||
$data = [
|
||||
'billplz' => [
|
||||
'id' => $resit->billplz_id,
|
||||
'paid' => 'true',
|
||||
'paid_at' => $billData['paid_at'] ?? now()->toDateTimeString(),
|
||||
]
|
||||
];
|
||||
// dd($data);
|
||||
|
||||
$apiController = App::make(ApiController::class);
|
||||
$apiController->processPaidResit($data);
|
||||
// dd($fakeRequest);
|
||||
|
||||
|
||||
$this->info("✅ Resit ID {$resit->id} handled via processPaidResit.");
|
||||
}else {
|
||||
$this->info("ℹ️ Resit ID {$resit->id} masih belum dibayar.");
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Semakan semula Billplz selesai.');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -40,32 +40,32 @@ class WebpMakeExecutables extends Command
|
||||
$DS = DIRECTORY_SEPARATOR;
|
||||
|
||||
$cwebp_compilers = [
|
||||
'Windows' => 'binaries' . $DS . 'libwebp-1.2.4-windows-x64' . $DS . 'bin' . $DS . 'cwebp',
|
||||
'Linux' => 'binaries' . $DS . 'libwebp-1.2.4-linux-x86-64' . $DS . 'bin' . $DS .'cwebp',
|
||||
'Windows' => 'binaries'.$DS.'libwebp-1.2.4-windows-x64'.$DS.'bin'.$DS.'cwebp',
|
||||
'Linux' => 'binaries'.$DS.'libwebp-1.2.4-linux-x86-64'.$DS.'bin'.$DS.'cwebp',
|
||||
'Darwin' => [
|
||||
'X86-64' => 'binaries' . $DS . 'libwebp-1.2.4-mac-X86-64' . $DS . 'bin' . $DS . 'cwebp',
|
||||
'arm64' => 'binaries' . $DS . 'libwebp-1.2.4-mac-arm64' . $DS . 'bin' . $DS .'cwebp',
|
||||
'X86-64' => 'binaries'.$DS.'libwebp-1.2.4-mac-X86-64'.$DS.'bin'.$DS.'cwebp',
|
||||
'arm64' => 'binaries'.$DS.'libwebp-1.2.4-mac-arm64'.$DS.'bin'.$DS.'cwebp',
|
||||
],
|
||||
];
|
||||
|
||||
$server_operating_system = explode(' ', trim(php_uname()))[0];
|
||||
$server_processor_architecture = trim(php_uname('m'));
|
||||
|
||||
if ($server_operating_system === 'Windows') {
|
||||
$this->error('Windows OS are not permitted');
|
||||
|
||||
if($server_operating_system === 'Windows'){
|
||||
$this->error('Windows OS are not permitted');
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($server_operating_system === 'Darwin') {
|
||||
$webp_binary_path = resource_path($cwebp_compilers['Darwin'][$server_processor_architecture]);
|
||||
$webp_binary_path = resource_path($cwebp_compilers['Darwin'][$server_processor_architecture]);
|
||||
}
|
||||
|
||||
if ($server_operating_system === 'Linux') {
|
||||
$webp_binary_path = resource_path($cwebp_compilers[$server_operating_system]);
|
||||
}
|
||||
|
||||
exec('chmod +x ' . $webp_binary_path, $output, $result);
|
||||
exec('chmod +x '.$webp_binary_path, $output, $result);
|
||||
|
||||
$this->info('Webp binaries are now executables');
|
||||
}
|
||||
|
||||
@@ -42,13 +42,10 @@ class kemaskiniCawanganLelong extends Command
|
||||
{
|
||||
|
||||
$lelong = Lelong::with('cawangan')->select('id')->get();
|
||||
foreach($lelong as $lel)
|
||||
{
|
||||
foreach($lel->cawangan as $caw)
|
||||
{
|
||||
foreach ($lelong as $lel) {
|
||||
foreach ($lel->cawangan as $caw) {
|
||||
$lelong_bid = LelongBid::where('kodcaw', $caw->caw_code)->where('lelong_id', $lel->id)->first();
|
||||
if($lelong_bid == null)
|
||||
{
|
||||
if ($lelong_bid == null) {
|
||||
CawanganLelong::where('caw_id', $caw->id)->where('lelong_id', $lel->id)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\Gadai;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongTebus;
|
||||
use App\Models\LogUser;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class kemaskiniLelong extends Command
|
||||
@@ -49,71 +49,70 @@ class kemaskiniLelong extends Command
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$data = [];
|
||||
|
||||
$lelongbids = LelongBid::where('status_jual',0)->get();
|
||||
$lelongbids = LelongBid::where('status_jual', 0)->get();
|
||||
|
||||
foreach($lelongbids as $index=>$lelongbid){
|
||||
$gadai = Gadai::on($lelongbid->kodcaw)->where('norujukan',$lelongbid->norujukan)->first();
|
||||
foreach ($lelongbids as $index => $lelongbid) {
|
||||
$gadai = Gadai::on($lelongbid->kodcaw)->where('norujukan', $lelongbid->norujukan)->first();
|
||||
$keluar_lelong = false;
|
||||
$sebab_keluar = '';
|
||||
if($lelongbid->fasa == '1'){
|
||||
if($gadai->sttebus == 'T'){
|
||||
if ($lelongbid->fasa == '1') {
|
||||
if ($gadai->sttebus == 'T') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
} elseif ($gadai->sttebus == 'L') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$telahbayar = $gadai->hargajualan - $gadai->bakihargajualan;
|
||||
$upah6bln_raw = $gadai->bakiupah - 0.5;
|
||||
if(bcdiv($telahbayar,1,1) >= bcdiv($upah6bln_raw,1,1)){
|
||||
if (bcdiv($telahbayar, 1, 1) >= bcdiv($upah6bln_raw, 1, 1)) {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'A';
|
||||
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->post(config('app.api_url').'taglel/revert',[
|
||||
'kodcaw'=>$lelongbid->kodcaw,
|
||||
'norujukan'=>$lelongbid->norujukan
|
||||
])
|
||||
->json();
|
||||
}else{
|
||||
if($gadai->tagbaru == '0'){
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
->post(config('app.api_url').'taglel/revert', [
|
||||
'kodcaw' => $lelongbid->kodcaw,
|
||||
'norujukan' => $lelongbid->norujukan,
|
||||
])
|
||||
->json();
|
||||
} else {
|
||||
if ($gadai->tagbaru == '0') {
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
if($gadai->tempohbayar == $gadai->tempoh ){
|
||||
if ($gadai->tempohbayar == $gadai->tempoh) {
|
||||
$keuntungan = 0.00;
|
||||
}else{
|
||||
} else {
|
||||
$jbg = $gadai->tempoh - $gadai->tempohbayar;
|
||||
$jbg2 = 12 - $gadai->tempohbayar;
|
||||
if($gadai->tempoh <= '12.00'){
|
||||
$keuntungan = bcdiv(($jbg)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan;
|
||||
}else{
|
||||
$keuntungan = bcdiv(($jbg2)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan;
|
||||
if ($gadai->tempoh <= '12.00') {
|
||||
$keuntungan = bcdiv(($jbg) * $gadai->kadarupah / 100 * $gadai->bakipjm, 1, 1) - $beza_keuntungan;
|
||||
} else {
|
||||
$keuntungan = bcdiv(($jbg2) * $gadai->kadarupah / 100 * $gadai->bakipjm, 1, 1) - $beza_keuntungan;
|
||||
}
|
||||
|
||||
}
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}else if($gadai->tagbaru == '1'){
|
||||
//kiraan keuntungan ujrah
|
||||
} elseif ($gadai->tagbaru == '1') {
|
||||
// kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan.'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url').'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
||||
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
||||
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
||||
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
@@ -125,56 +124,53 @@ class kemaskiniLelong extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($gadai->sttebus == 'T'){
|
||||
} else {
|
||||
if ($gadai->sttebus == 'T') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
} elseif ($gadai->sttebus == 'L') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}else{
|
||||
if($gadai->tagbaru == '0'){
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
} else {
|
||||
if ($gadai->tagbaru == '0') {
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
if($gadai->tempohbayar == 12){
|
||||
if ($gadai->tempohbayar == 12) {
|
||||
$keuntungan = 0.00;
|
||||
}
|
||||
elseif($gadai->tempohbayar == $gadai->tempoh ){
|
||||
} elseif ($gadai->tempohbayar == $gadai->tempoh) {
|
||||
$keuntungan = 0.00;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$jbg = $gadai->tempoh - $gadai->tempohbayar;
|
||||
$jbg2 = 12 - $gadai->tempohbayar;
|
||||
if($gadai->tempoh <= '12.00'){
|
||||
$keuntungan = bcdiv(($jbg)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan;
|
||||
}else{
|
||||
$keuntungan = bcdiv(($jbg2)*$gadai->kadarupah/100*$gadai->bakipjm,1,1)-$beza_keuntungan;
|
||||
if ($gadai->tempoh <= '12.00') {
|
||||
$keuntungan = bcdiv(($jbg) * $gadai->kadarupah / 100 * $gadai->bakipjm, 1, 1) - $beza_keuntungan;
|
||||
} else {
|
||||
$keuntungan = bcdiv(($jbg2) * $gadai->kadarupah / 100 * $gadai->bakipjm, 1, 1) - $beza_keuntungan;
|
||||
}
|
||||
}
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}elseif($gadai->tagbaru == '1'){
|
||||
//kiraan keuntungan ujrah
|
||||
} elseif ($gadai->tagbaru == '1') {
|
||||
// kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan.'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url').'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
||||
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
||||
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
||||
|
||||
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
@@ -186,7 +182,7 @@ class kemaskiniLelong extends Command
|
||||
}
|
||||
}
|
||||
|
||||
if($keluar_lelong == true){
|
||||
if ($keluar_lelong == true) {
|
||||
$lelongtebus = new LelongTebus;
|
||||
$lelongtebus->tarikh = $currentdate;
|
||||
$lelongtebus->kodcaw = $lelongbid->kodcaw;
|
||||
@@ -201,27 +197,26 @@ class kemaskiniLelong extends Command
|
||||
$lelongtebus->save();
|
||||
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->user_id = User::where('name', 'System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $gadai->norujukan;
|
||||
$loguser->nota = $sebab_keluar == 'A' ? ' KELUAR LELONG '.$lelongbid->lelong_id : ' TEBUS LELONG '.$lelongbid->lelong_id ;
|
||||
$loguser->nota = $sebab_keluar == 'A' ? ' KELUAR LELONG '.$lelongbid->lelong_id : ' TEBUS LELONG '.$lelongbid->lelong_id;
|
||||
$loguser->save();
|
||||
|
||||
$lelongbid->delete();
|
||||
}else{
|
||||
} else {
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->user_id = User::where('name', 'System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $gadai->norujukan;
|
||||
if($gadai->tagbaru == '0'){
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan SAG LAMA' ;
|
||||
}
|
||||
elseif($gadai->tagbaru == '1'){
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan UJRAH '.$keuntungan ;
|
||||
if ($gadai->tagbaru == '0') {
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan SAG LAMA';
|
||||
} elseif ($gadai->tagbaru == '1') {
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan UJRAH '.$keuntungan;
|
||||
}
|
||||
$loguser->save();
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\Gadai;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongTebus;
|
||||
use App\Models\LogUser;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class kemaskiniLelongUjrah extends Command
|
||||
@@ -49,46 +49,45 @@ class kemaskiniLelongUjrah extends Command
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$data = [];
|
||||
|
||||
$lelongbids = LelongBid::where('status_jual',0)->where('tagujrah','1')->get();
|
||||
$lelongbids = LelongBid::where('status_jual', 0)->where('tagujrah', '1')->get();
|
||||
// dd($lelongbids);
|
||||
|
||||
foreach($lelongbids as $index=>$lelongbid){
|
||||
$gadai = Gadai::on($lelongbid->kodcaw)->where('norujukan',$lelongbid->norujukan)->first();
|
||||
foreach ($lelongbids as $index => $lelongbid) {
|
||||
$gadai = Gadai::on($lelongbid->kodcaw)->where('norujukan', $lelongbid->norujukan)->first();
|
||||
$keluar_lelong = false;
|
||||
$sebab_keluar = '';
|
||||
if($lelongbid->fasa == '1'){
|
||||
if($gadai->sttebus == 'T'){
|
||||
if ($lelongbid->fasa == '1') {
|
||||
if ($gadai->sttebus == 'T') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
} elseif ($gadai->sttebus == 'L') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$telahbayar = $gadai->hargajualan - $gadai->bakihargajualan;
|
||||
$upah6bln_raw = $gadai->bakiupah - 0.5;
|
||||
if(bcdiv($telahbayar,1,1) >= bcdiv($upah6bln_raw,1,1)){
|
||||
if (bcdiv($telahbayar, 1, 1) >= bcdiv($upah6bln_raw, 1, 1)) {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'A';
|
||||
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->post(config('app.api_url').'taglel/revert',[
|
||||
'kodcaw'=>$lelongbid->kodcaw,
|
||||
'norujukan'=>$lelongbid->norujukan
|
||||
])
|
||||
->json();
|
||||
}else{
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
->post(config('app.api_url').'taglel/revert', [
|
||||
'kodcaw' => $lelongbid->kodcaw,
|
||||
'norujukan' => $lelongbid->norujukan,
|
||||
])
|
||||
->json();
|
||||
} else {
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
if($gadai->tempohbayar == $gadai->tempoh ){
|
||||
if ($gadai->tempohbayar == $gadai->tempoh) {
|
||||
$keuntungan = 0.00;
|
||||
$rounded_ujrah = 0.00;
|
||||
$rounded_onepercent = 0.00;
|
||||
}else{
|
||||
//kiraan keuntungan ujrah
|
||||
} else {
|
||||
// kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan.'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url').'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
||||
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
||||
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
||||
@@ -97,62 +96,60 @@ class kemaskiniLelongUjrah extends Command
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->ujrah = $rounded_ujrah;
|
||||
$lelongbid->onepercent = $rounded_onepercent;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->ujrah = $rounded_ujrah;
|
||||
$lelongbid->onepercent = $rounded_onepercent;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($gadai->sttebus == 'T'){
|
||||
} else {
|
||||
if ($gadai->sttebus == 'T') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'T';
|
||||
}elseif($gadai->sttebus == 'L'){
|
||||
} elseif ($gadai->sttebus == 'L') {
|
||||
$keluar_lelong = true;
|
||||
$sebab_keluar = 'L';
|
||||
}else{
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan',$lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
} else {
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan', $lelongbid->norujukan)->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
if($gadai->tempohbayar == 12){
|
||||
if ($gadai->tempohbayar == 12) {
|
||||
$keuntungan = 0.00;
|
||||
$rounded_ujrah = 0.00;
|
||||
$rounded_onepercent = 0.00;
|
||||
}
|
||||
elseif($gadai->tempohbayar == $gadai->tempoh ){
|
||||
} elseif ($gadai->tempohbayar == $gadai->tempoh) {
|
||||
$keuntungan = 0.00;
|
||||
$rounded_ujrah = 0.00;
|
||||
$rounded_onepercent = 0.00;
|
||||
}
|
||||
else{
|
||||
//kiraan keuntungan ujrah
|
||||
} else {
|
||||
// kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan.'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url').'kiraupahUjrahOnePercentRebate/'.$lelongbid->kodcaw.'/'.$lelongbid->norujukan)->json();
|
||||
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
||||
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
||||
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
||||
|
||||
|
||||
}
|
||||
$checkdataxlaku = LelongBid::where('norujukan', $lelongbid->norujukan)
|
||||
->where('xlaku', 1)
|
||||
->first();
|
||||
if (!$checkdataxlaku) {
|
||||
if (! $checkdataxlaku) {
|
||||
$lelongbid->jbg = $gadai->tempoh;
|
||||
$lelongbid->pinjaman = $gadai->bakipjm;
|
||||
$lelongbid->bakiupah = $keuntungan;
|
||||
$lelongbid->ujrah = $rounded_ujrah;
|
||||
$lelongbid->onepercent = $rounded_onepercent;
|
||||
$lelongbid->ujrah = $rounded_ujrah;
|
||||
$lelongbid->onepercent = $rounded_onepercent;
|
||||
$lelongbid->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($keluar_lelong == true){
|
||||
if ($keluar_lelong == true) {
|
||||
$lelongtebus = new LelongTebus;
|
||||
$lelongtebus->tarikh = $currentdate;
|
||||
$lelongtebus->kodcaw = $lelongbid->kodcaw;
|
||||
@@ -167,23 +164,23 @@ class kemaskiniLelongUjrah extends Command
|
||||
$lelongtebus->save();
|
||||
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->user_id = User::where('name', 'System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $gadai->norujukan;
|
||||
$loguser->nota = $sebab_keluar == 'A' ? ' KELUAR LELONG UJRAH '.$lelongbid->lelong_id : ' TEBUS LELONG UJRAH '.$lelongbid->lelong_id ;
|
||||
$loguser->nota = $sebab_keluar == 'A' ? ' KELUAR LELONG UJRAH '.$lelongbid->lelong_id : ' TEBUS LELONG UJRAH '.$lelongbid->lelong_id;
|
||||
$loguser->save();
|
||||
|
||||
$lelongbid->delete();
|
||||
}else{
|
||||
} else {
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->user_id = User::where('name', 'System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $gadai->norujukan;
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan Ujrah' ;
|
||||
$loguser->nota = $lelongbid->lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan Ujrah';
|
||||
$loguser->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
|
||||
+17
-17
@@ -2,29 +2,29 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class LelongNotify implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $status;
|
||||
public $status;
|
||||
|
||||
public function __construct($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
public function __construct($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['lelong-notify'];
|
||||
}
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['lelong-notify'];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'trigger-lelong';
|
||||
}
|
||||
}
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'trigger-lelong';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,33 +2,35 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PaymentNotify implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $response;
|
||||
public $userid;
|
||||
public $paymentid;
|
||||
public $response;
|
||||
|
||||
public function __construct($response,$userid,$paymentid)
|
||||
{
|
||||
$this->response = $response;
|
||||
$this->userid = $userid;
|
||||
$this->paymentid = $paymentid;
|
||||
}
|
||||
public $userid;
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['payment-notify'];
|
||||
}
|
||||
public $paymentid;
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'trigger-payment';
|
||||
}
|
||||
}
|
||||
public function __construct($response, $userid, $paymentid)
|
||||
{
|
||||
$this->response = $response;
|
||||
$this->userid = $userid;
|
||||
$this->paymentid = $paymentid;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['payment-notify'];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'trigger-payment';
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,44 +3,22 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\PaymentNotify;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\User;
|
||||
use PDF;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\JenisEmas;
|
||||
use App\Models\JenisKarat;
|
||||
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\SimKarat_temp;
|
||||
use App\Models\CawanganSimulasi;
|
||||
|
||||
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\LelongBidder;
|
||||
use App\Models\Resit;
|
||||
use App\Models\Payment;
|
||||
|
||||
use Session;
|
||||
use Carbon\Carbon;
|
||||
use Money\Money;
|
||||
use Billplz\Client;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use App\Models\LogUser;
|
||||
use App\Jobs\WhatsappPembidaFPXPaid;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Resit;
|
||||
use App\Models\User;
|
||||
use Billplz\Client;
|
||||
use Carbon\Carbon;
|
||||
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Money\Money;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
@@ -55,49 +33,46 @@ class ApiController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function __construct(){
|
||||
// parent::__construct();
|
||||
if(config('app.env') != 'production'){
|
||||
$this->api_key = 'abecfd0c-98d8-4635-abc2-2fcba8c60c11';
|
||||
$this->XSignature_Key = 'S-GWr7z03XjAhqPsFfu_H5nQ';
|
||||
$this->collection_id = 'bwdtejv0';
|
||||
}else{
|
||||
$this->api_key = 'f3e82fe1-a422-4660-97f0-65cc59ff6c47';
|
||||
$this->XSignature_Key = 'S-alZUbzmD2_TF3vmrRqgehQ';
|
||||
public function __construct()
|
||||
{
|
||||
// parent::__construct();
|
||||
if (config('app.env') != 'production') {
|
||||
$this->api_key = 'abecfd0c-98d8-4635-abc2-2fcba8c60c11';
|
||||
$this->XSignature_Key = 'S-GWr7z03XjAhqPsFfu_H5nQ';
|
||||
$this->collection_id = 'bwdtejv0';
|
||||
} else {
|
||||
$this->api_key = 'f3e82fe1-a422-4660-97f0-65cc59ff6c47';
|
||||
$this->XSignature_Key = 'S-alZUbzmD2_TF3vmrRqgehQ';
|
||||
$this->collection_id = 'lx_bplsb';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function biditem()
|
||||
}
|
||||
|
||||
public function biditem()
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateString();
|
||||
// dd($currentdate->toDateString());
|
||||
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
|
||||
$lelong = Lelong::where('tarikh_lelong', '=', $currentdate)->get();
|
||||
|
||||
$arrayID = [];
|
||||
foreach($lelong as $data)
|
||||
{
|
||||
array_push($arrayID,$data->id);
|
||||
foreach ($lelong as $data) {
|
||||
array_push($arrayID, $data->id);
|
||||
}
|
||||
$lelongbid = LelongBid::whereIn('lelong_id',$arrayID)
|
||||
->join('lelongbidmarhun','lelongbid.id','=','lelongbidmarhun.lelongbid_id')
|
||||
->get();
|
||||
$lelongbid = LelongBid::whereIn('lelong_id', $arrayID)
|
||||
->join('lelongbidmarhun', 'lelongbid.id', '=', 'lelongbidmarhun.lelongbid_id')
|
||||
->get();
|
||||
|
||||
$surat = LelongBid::whereIn('lelong_id',$arrayID)->get();
|
||||
$surat = LelongBid::whereIn('lelong_id', $arrayID)->get();
|
||||
|
||||
if(sizeof($lelongbid)!=0)
|
||||
{
|
||||
if (count($lelongbid) != 0) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'lelong' => $lelong,
|
||||
'surat' => $surat,
|
||||
'item' => $lelongbid
|
||||
'item' => $lelongbid,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'No Data',
|
||||
@@ -105,23 +80,19 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function karat()
|
||||
public function karat()
|
||||
{
|
||||
|
||||
|
||||
$jenisemas = JenisEmas::all();
|
||||
$jeniskarat = JenisKarat::all();
|
||||
|
||||
|
||||
if(sizeof($jenisemas)!=0 && sizeof($jeniskarat)!=0 )
|
||||
{
|
||||
if (count($jenisemas) != 0 && count($jeniskarat) != 0) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'karat' => $jeniskarat,
|
||||
'emas' => $jenisemas
|
||||
'emas' => $jenisemas,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'No Data',
|
||||
@@ -133,59 +104,60 @@ class ApiController extends Controller
|
||||
{
|
||||
return view('pembayaran.testbillplz');
|
||||
}
|
||||
|
||||
public function feepayment(Request $request)
|
||||
{
|
||||
|
||||
$arraycollection_id = array();
|
||||
$arraycollection_id = [];
|
||||
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$billplz->useVersion('v4');
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if (config('app.env') != 'production') {
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
|
||||
$bill = $billplz->bill();
|
||||
$billplz->useVersion('v4');
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$bill = $billplz->bill();
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon;
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
$year = $current->format('y');
|
||||
|
||||
$total_bayaran = 1100;
|
||||
|
||||
|
||||
$collection_id = $this->collection_id;
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
$request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.callback'),
|
||||
'Bayaran Borang',
|
||||
['redirect_url' => route('pay.paymentStatus')]
|
||||
// ['redirect_url' => url('http://localhost:8080/test')]
|
||||
);
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
$request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.callback'),
|
||||
'Bayaran Borang',
|
||||
['redirect_url' => route('pay.paymentStatus')]
|
||||
// ['redirect_url' => url('http://localhost:8080/test')]
|
||||
);
|
||||
// dd($response);
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
if($previous_siri){
|
||||
$previous_siri = Resit::orderBy('id', 'desc')->first();
|
||||
if ($previous_siri) {
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
} else {
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$billcode = $response->toArray();
|
||||
|
||||
$billcode = $response->toArray();
|
||||
// dd($billcode);
|
||||
// $billcode['redirect_url'] = 'http://192.168.0.10:8003/api/pembayaran/response';
|
||||
// dd($billcode);
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
$reference_no = 'LPKB'.$day.$month.$year.sprintf('%08d', $nosiri);
|
||||
// $response2 = $bill->get($billcode['id']);
|
||||
// dd($response2->toArray());
|
||||
$resit = new Resit;
|
||||
@@ -197,8 +169,7 @@ class ApiController extends Controller
|
||||
$resit->total_payment = 10;
|
||||
$resit->save();
|
||||
|
||||
|
||||
// return redirect($billcode['url'] . '?auto_submit=true');
|
||||
// return redirect($billcode['url'] . '?auto_submit=true');
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => $billcode['url'],
|
||||
@@ -206,41 +177,42 @@ class ApiController extends Controller
|
||||
|
||||
// return view('pembayaran.result.berjaya',compact('arraybayaran'));
|
||||
}
|
||||
|
||||
public function callback(Request $request){
|
||||
|
||||
public function callback(Request $request)
|
||||
{
|
||||
// dd('hye callback');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$bill = $billplz->bill();
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if (config('app.env') != 'production') {
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
|
||||
$data = $bill->webhook($request->toArray());
|
||||
|
||||
if($data['billplz']['paid'] == 'true'){
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
$bill = $billplz->bill();
|
||||
|
||||
$data = $bill->webhook($request->toArray());
|
||||
|
||||
if ($data['billplz']['paid'] == 'true') {
|
||||
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['billplz']['paid_at'];
|
||||
$resit->save();
|
||||
|
||||
|
||||
$payment = new Payment;
|
||||
$payment->user_id = $resit->user_id;
|
||||
$payment->lelong_id = $resit->lelong_id;
|
||||
$payment->total_payment = $resit->total_payment;
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->status_payment_opt = 2; //bayar secara online 2
|
||||
$payment->status = 1; //fee rm10 - 1
|
||||
$payment->status_payment_opt = 2; // bayar secara online 2
|
||||
$payment->status = 1; // fee rm10 - 1
|
||||
$payment->remark = 'BAYARAN ONLINE';
|
||||
$payment->save();
|
||||
|
||||
event(new PaymentNotify('PAID',$resit->user_id,$payment->id));
|
||||
event(new PaymentNotify('PAID', $resit->user_id, $payment->id));
|
||||
|
||||
$success = true;
|
||||
|
||||
@@ -251,47 +223,49 @@ class ApiController extends Controller
|
||||
// 'resit' => $resit
|
||||
// ]);
|
||||
|
||||
return view('pembida.feePaymentResult',compact('data', 'result', 'success'));
|
||||
|
||||
}else{
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
return view('pembida.feePaymentResult', compact('data', 'result', 'success'));
|
||||
|
||||
} else {
|
||||
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
|
||||
|
||||
$result = $resit->toArray();
|
||||
|
||||
$success = false;
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL',$resit->user_id,''));
|
||||
// return response()->json([
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL', $resit->user_id, ''));
|
||||
|
||||
// return response()->json([
|
||||
// 'success' => false,
|
||||
// 'resit' => $resit
|
||||
// ]);
|
||||
return view('pembida.feePaymentResult',compact('data', 'result', 'success'));
|
||||
}
|
||||
}
|
||||
return view('pembida.feePaymentResult', compact('data', 'result', 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
public function response(Request $request){
|
||||
public function response(Request $request)
|
||||
{
|
||||
// dd('hye response');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$bill = $billplz->bill();
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if (config('app.env') != 'production') {
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
|
||||
$bill = $billplz->bill();
|
||||
$req = $request->toArray();
|
||||
$response = $bill->get($req['billplz']['id']);
|
||||
$data = $response->toArray();
|
||||
$data = $response->toArray();
|
||||
// dd($data);
|
||||
if($data['paid'] == 'true'){
|
||||
$resit = Resit::where('billplz_id','=',$data['id'])->first();
|
||||
if ($data['paid'] == 'true') {
|
||||
$resit = Resit::where('billplz_id', '=', $data['id'])->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['paid_at'];
|
||||
$resit->save();
|
||||
@@ -301,12 +275,12 @@ class ApiController extends Controller
|
||||
$payment->lelong_id = $resit->lelong_id;
|
||||
$payment->total_payment = $resit->total_payment;
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->status_payment_opt = 2; //bayar secara online 2
|
||||
$payment->status = 1; //fee rm10 - 1
|
||||
$payment->status_payment_opt = 2; // bayar secara online 2
|
||||
$payment->status = 1; // fee rm10 - 1
|
||||
$payment->remark = 'BAYARAN ONLINE';
|
||||
$payment->save();
|
||||
|
||||
event(new PaymentNotify('PAID',$resit->user_id,$payment->id));
|
||||
event(new PaymentNotify('PAID', $resit->user_id, $payment->id));
|
||||
|
||||
$success = true;
|
||||
|
||||
@@ -317,91 +291,92 @@ class ApiController extends Controller
|
||||
// 'resit' => $resit
|
||||
// ]);
|
||||
|
||||
return view('pembida.feePaymentResult',compact('data', 'result', 'success'));
|
||||
return view('pembida.feePaymentResult', compact('data', 'result', 'success'));
|
||||
|
||||
// return redirect()->to('http://localhost:8080/test')->with(['resit'=>$resit]);
|
||||
|
||||
}else{
|
||||
$resit = Resit::where('billplz_id','=',$data['id'])->first();
|
||||
|
||||
} else {
|
||||
$resit = Resit::where('billplz_id', '=', $data['id'])->first();
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
|
||||
|
||||
$result = $resit->toArray();
|
||||
|
||||
$success = false;
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL',$resit->user_id,''));
|
||||
// return response()->json([
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL', $resit->user_id, ''));
|
||||
|
||||
// return response()->json([
|
||||
// 'success' => false,
|
||||
// 'resit' => $resit
|
||||
// ]);
|
||||
return view('pembida.feePaymentResult',compact('data', 'result', 'success'));
|
||||
}
|
||||
}
|
||||
return view('pembida.feePaymentResult', compact('data', 'result', 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
public function bidpayment(Request $request)
|
||||
{
|
||||
$arraycollection_id = array();
|
||||
$arraycollection_id = [];
|
||||
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$billplz->useVersion('v4');
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if (config('app.env') != 'production') {
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
|
||||
$bill = $billplz->bill();
|
||||
$billplz->useVersion('v4');
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$bill = $billplz->bill();
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon;
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
$year = $current->format('y');
|
||||
|
||||
$total_bayaran = ($request->total)*100+100;
|
||||
$total_bayaran = ($request->total) * 100 + 100;
|
||||
// dump($request->total);
|
||||
// dd($total_bayaran);
|
||||
|
||||
|
||||
$collection_id = $this->collection_id;
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
$request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.bidcallback'),
|
||||
'Bayaran Bidaan',
|
||||
['redirect_url' => route('pay.bidpaymentStatus')]
|
||||
);
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
$request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.bidcallback'),
|
||||
'Bayaran Bidaan',
|
||||
['redirect_url' => route('pay.bidpaymentStatus')]
|
||||
);
|
||||
// dd($response->toArray());
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
if($previous_siri){
|
||||
$previous_siri = Resit::orderBy('id', 'desc')->first();
|
||||
if ($previous_siri) {
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
} else {
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$billcode = $response->toArray();
|
||||
|
||||
$billcode = $response->toArray();
|
||||
// dd($billcode);
|
||||
// $billcode['redirect_url'] = 'http://192.168.0.10:8003/api/pembayaran/response';
|
||||
// dd($billcode);
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
$reference_no = 'LPKB'.$day.$month.$year.sprintf('%08d', $nosiri);
|
||||
// $response2 = $bill->get($billcode['id']);
|
||||
// dd($response2->toArray());
|
||||
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelong_id = $request->lelong_id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = $billcode['id'];
|
||||
$resit->resit_type = 2; //billplz resit for bid payment
|
||||
$resit->resit_type = 2; // billplz resit for bid payment
|
||||
$resit->total_payment = $request->total;
|
||||
$resit->invoice_id = $request->invoice_id;
|
||||
$resit->invoice_no = $request->invoice_no;
|
||||
@@ -419,15 +394,14 @@ class ApiController extends Controller
|
||||
$payment->lelongbid_id = $index['lelongbid_id'];
|
||||
$payment->norujukan = $index['norujukan'];
|
||||
$payment->total_payment = $index['total_payment'];
|
||||
$payment->status_payment_opt = 2; //bayar secara online 2
|
||||
$payment->status = 0; //0-unpaid //1-fee //2-bid
|
||||
$payment->status_payment_opt = 2; // bayar secara online 2
|
||||
$payment->status = 0; // 0-unpaid //1-fee //2-bid
|
||||
$payment->remark = '';
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->save();
|
||||
}
|
||||
|
||||
|
||||
// return redirect($billcode['url'] . '?auto_submit=true');
|
||||
// return redirect($billcode['url'] . '?auto_submit=true');
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => $billcode['url'],
|
||||
@@ -439,8 +413,8 @@ class ApiController extends Controller
|
||||
{
|
||||
// dd('hye callback');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
@@ -482,8 +456,8 @@ class ApiController extends Controller
|
||||
->where('resit_id', $resit->id)
|
||||
->get();
|
||||
foreach ($payment as $index) {
|
||||
$index->status = 2; //0-unpaid //1-fee //2-bid
|
||||
$index->remark = "BERJAYA BAYARAN ONLINE";
|
||||
$index->status = 2; // 0-unpaid //1-fee //2-bid
|
||||
$index->remark = 'BERJAYA BAYARAN ONLINE';
|
||||
$index->update();
|
||||
|
||||
// $updateTag = LelongBid::where('lelongbid.norujukan', $index->norujukan)->first();
|
||||
@@ -500,7 +474,7 @@ class ApiController extends Controller
|
||||
$updateTagBid->save();
|
||||
|
||||
$updateTagBidder = LelongBidder::where('lelongbid_id', $updateTagBid->id)
|
||||
->where('user_id', $resit->user_id)->first();
|
||||
->where('user_id', $resit->user_id)->first();
|
||||
$updateTagBidder->status_payment = 2;
|
||||
$updateTagBidder->payment_id = $index->id;
|
||||
$updateTagBidder->save();
|
||||
@@ -543,8 +517,8 @@ class ApiController extends Controller
|
||||
{
|
||||
// dd($request->all());
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
new GuzzleHttpClient,
|
||||
new GuzzleMessageFactory
|
||||
);
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
@@ -587,8 +561,8 @@ class ApiController extends Controller
|
||||
->get();
|
||||
|
||||
foreach ($payment as $index) {
|
||||
$index->status = 2; //0-unpaid //1-fee //2-bid
|
||||
$index->remark = "BERJAYA BAYARAN ONLINE";
|
||||
$index->status = 2; // 0-unpaid //1-fee //2-bid
|
||||
$index->remark = 'BERJAYA BAYARAN ONLINE';
|
||||
$index->update();
|
||||
|
||||
// $updateTag = LelongBid::where('lelongbid.norujukan', $index->norujukan)->first();
|
||||
@@ -605,7 +579,7 @@ class ApiController extends Controller
|
||||
$updateTagBid->save();
|
||||
|
||||
$updateTagBidder = LelongBidder::where('lelongbid_id', $updateTagBid->id)
|
||||
->where('user_id', $resit->user_id)->first();
|
||||
->where('user_id', $resit->user_id)->first();
|
||||
$updateTagBidder->status_payment = 2;
|
||||
$updateTagBidder->payment_id = $index->id;
|
||||
$updateTagBidder->save();
|
||||
@@ -647,24 +621,23 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// BillplzService.php atau ApiController.php
|
||||
public function processPaidResit(array $data)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->user_id = User::where('name', 'System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $data['billplz']['id'];
|
||||
$loguser->nota = 'Callback Resit Billplz Telah Bayar : Billplz_id -'.$data['billplz']['id'];
|
||||
$loguser->save();
|
||||
|
||||
|
||||
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
|
||||
|
||||
if (!$resit) {
|
||||
if (! $resit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -684,7 +657,7 @@ class ApiController extends Controller
|
||||
|
||||
foreach ($payment as $index) {
|
||||
$index->status = 2;
|
||||
$index->remark = "BERJAYA BAYARAN ONLINE";
|
||||
$index->remark = 'BERJAYA BAYARAN ONLINE';
|
||||
$index->update();
|
||||
|
||||
$updateTagBid = LelongBid::where('norujukan', $index->norujukan)->first();
|
||||
@@ -703,13 +676,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
event(new PaymentNotify('PAID', $resit->user_id, $payment));
|
||||
//notifikasi wasap kepada pembida//
|
||||
WhatsappPembidaFPXPaid::dispatch($resit->user_id,
|
||||
$resit->id,
|
||||
$resit->total_payment);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
@@ -44,7 +44,6 @@ class RegisterController extends Controller
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
@@ -59,7 +58,6 @@ class RegisterController extends Controller
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use App\Models\User;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
|
||||
@@ -2,26 +2,25 @@
|
||||
|
||||
namespace App\Http\Controllers\AuthMobile;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Staff;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\ResetPassword;
|
||||
use App\Mail\VerifyEmail;
|
||||
use App\Models\Staff;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function register(Request $request)
|
||||
{
|
||||
// dd($request->all);
|
||||
$validator = Validator::make($request->all(), [
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string',
|
||||
'username' => 'required|string|unique:users',
|
||||
'nokp' => 'required|string|unique:users',
|
||||
@@ -29,14 +28,15 @@ class AuthController extends Controller
|
||||
'email' => 'required|string|unique:users|email',
|
||||
'notelbimbit' => 'required|string|unique:users',
|
||||
'register_agree' => 'required|integer',
|
||||
'alamat' => 'required'
|
||||
'alamat' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$errors = [
|
||||
'success' => false,
|
||||
'message' => $validator->errors()
|
||||
'message' => $validator->errors(),
|
||||
];
|
||||
|
||||
return response($errors, 201);
|
||||
}
|
||||
// Retrieve the validated input...
|
||||
@@ -44,22 +44,22 @@ class AuthController extends Controller
|
||||
|
||||
$convert_ic_to_hyphen = (substr_replace(substr_replace($fields['nokp'], '-', 6, 0), '-', 9, 0));
|
||||
$check_staff = Staff::where('nokp', '=', $convert_ic_to_hyphen)
|
||||
->orWhere('nokp', '=', $fields['nokp'])
|
||||
->first();
|
||||
if($check_staff)
|
||||
{
|
||||
->orWhere('nokp', '=', $fields['nokp'])
|
||||
->first();
|
||||
if ($check_staff) {
|
||||
$errors = [
|
||||
'success' => "Staff",
|
||||
'message' => "Staff tidak dibenarkan mendaftar."
|
||||
'success' => 'Staff',
|
||||
'message' => 'Staff tidak dibenarkan mendaftar.',
|
||||
];
|
||||
|
||||
return response($errors, 201);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$verificationToken = Str::random(60);
|
||||
|
||||
|
||||
$user = new User;
|
||||
$user->name = $fields['name'];
|
||||
$user->username = $fields['username'];
|
||||
@@ -70,14 +70,14 @@ class AuthController extends Controller
|
||||
$user->register_agree = $fields['register_agree'];
|
||||
$user->t_daftar = $currentdate;
|
||||
$user->status = 'active';
|
||||
$user->user_type = 2; //type 2 = pembida
|
||||
$user->user_type = 2; // type 2 = pembida
|
||||
$user->alamat = $fields['alamat'];
|
||||
$user->token = $verificationToken;
|
||||
$user->is_verified = 0;
|
||||
$user->email_verified_at = null;
|
||||
$user->save();
|
||||
|
||||
$verifyUrl = url('/api/verifyEmail') . '?' . http_build_query([
|
||||
$verifyUrl = url('/api/verifyEmail').'?'.http_build_query([
|
||||
'email' => $user->email,
|
||||
'token' => $verificationToken,
|
||||
]);
|
||||
@@ -89,7 +89,7 @@ class AuthController extends Controller
|
||||
'message' => 'Pendaftaran berjaya. Sila semak emel anda untuk pautan pengesahan.',
|
||||
'user' => $user,
|
||||
];
|
||||
|
||||
|
||||
return response($response, 201);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class AuthController extends Controller
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->away($redirectBase . '?email_verified=0&message=' . urlencode('Pautan pengesahan tidak sah.'));
|
||||
return redirect()->away($redirectBase.'?email_verified=0&message='.urlencode('Pautan pengesahan tidak sah.'));
|
||||
}
|
||||
|
||||
$user = User::where('email', $request->email)
|
||||
@@ -111,8 +111,8 @@ class AuthController extends Controller
|
||||
->where('is_verified', 0)
|
||||
->first();
|
||||
|
||||
if (!$user) {
|
||||
return redirect()->away($redirectBase . '?email_verified=0&message=' . urlencode('Pautan pengesahan tidak sah atau emel telah disahkan.'));
|
||||
if (! $user) {
|
||||
return redirect()->away($redirectBase.'?email_verified=0&message='.urlencode('Pautan pengesahan tidak sah atau emel telah disahkan.'));
|
||||
}
|
||||
|
||||
$user->is_verified = 1;
|
||||
@@ -120,14 +120,14 @@ class AuthController extends Controller
|
||||
$user->token = null;
|
||||
$user->save();
|
||||
|
||||
return redirect()->away($redirectBase . '?email_verified=1&message=' . urlencode('Emel berjaya disahkan.'));
|
||||
return redirect()->away($redirectBase.'?email_verified=1&message='.urlencode('Emel berjaya disahkan.'));
|
||||
}
|
||||
|
||||
public function loginUser(Request $request)
|
||||
{
|
||||
$fields = $request->validate([
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string'
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = User::where('username', $fields['username'])->orWhere('email', $fields['username'])->first();
|
||||
@@ -142,8 +142,8 @@ class AuthController extends Controller
|
||||
if ($user->user_type != '2') {
|
||||
return response([
|
||||
'statusAkaun' => 6,
|
||||
'message1' => "Akaun ini didaftar menggunakan id staff.",
|
||||
'message2' => "Sila login menggunakan url " . env('APP_URL'),
|
||||
'message1' => 'Akaun ini didaftar menggunakan id staff.',
|
||||
'message2' => 'Sila login menggunakan url '.env('APP_URL'),
|
||||
]);
|
||||
} else {
|
||||
if (is_null($user->email_verified_at)) {
|
||||
@@ -151,41 +151,42 @@ class AuthController extends Controller
|
||||
'statusAkaun' => 7,
|
||||
'message' => 'Sila sahkan emel anda sebelum log masuk. Semak peti masuk anda untuk pautan pengesahan.',
|
||||
]);
|
||||
} else if ($user->status == 'active') {
|
||||
} elseif ($user->status == 'active') {
|
||||
$user->tokens()->delete();
|
||||
$token = $user->createToken('myapptoken')->plainTextToken;
|
||||
|
||||
return response([
|
||||
'statusAkaun' => 1,
|
||||
'user' => $user,
|
||||
'token' => $token
|
||||
'token' => $token,
|
||||
]);
|
||||
} else if ($user->status == 'banned') {
|
||||
} elseif ($user->status == 'banned') {
|
||||
return response()->json([
|
||||
'statusAkaun' => 2,
|
||||
'message' => "User banned."
|
||||
'message' => 'User banned.',
|
||||
]);
|
||||
} else if ($user->status == 'rejected') {
|
||||
} elseif ($user->status == 'rejected') {
|
||||
return response([
|
||||
'statusAkaun' => 3,
|
||||
'message' => "Rejected."
|
||||
'message' => 'Rejected.',
|
||||
]);
|
||||
} else {
|
||||
return response([
|
||||
'statusAkaun' => 4,
|
||||
'message' => 'Registration in progress,status wait for approval.'
|
||||
'message' => 'Registration in progress,status wait for approval.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return response()->json([
|
||||
'statusAkaun' => 5,
|
||||
'message' => "Kata Laluan Salah."
|
||||
'message' => 'Kata Laluan Salah.',
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return response()->json([
|
||||
'statusAkaun' => 0,
|
||||
'message' => "Akaun tiada."
|
||||
'message' => 'Akaun tiada.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -203,11 +204,11 @@ class AuthController extends Controller
|
||||
public function forgotPassword(Request $request)
|
||||
{
|
||||
$user = User::where('email', $request->email)->first();
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'status' => 0,
|
||||
'message' => "Emel tidak dijumpai. Sila daftar sekarang."
|
||||
'message' => 'Emel tidak dijumpai. Sila daftar sekarang.',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -217,20 +218,21 @@ class AuthController extends Controller
|
||||
$user['is_verified'] = 0;
|
||||
$user->save();
|
||||
|
||||
$resetUrl = rtrim(config('app.app_pembida'), '/') . '/reset-password/' . $token;
|
||||
$resetUrl = rtrim(config('app.app_pembida'), '/').'/reset-password/'.$token;
|
||||
|
||||
Mail::to($request->email)->send(new ResetPassword($user->name, $resetUrl));
|
||||
|
||||
if (Mail::failures() != 0) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => "Berjaya DiHantar! Pautan Lupa Katalaluan Telah Dihantarkan Kepada Alamat Emel Anda."
|
||||
'message' => 'Berjaya DiHantar! Pautan Lupa Katalaluan Telah Dihantarkan Kepada Alamat Emel Anda.',
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'status' => 500,
|
||||
'message' => "Failed! there is some issue with email provider"
|
||||
'message' => 'Failed! there is some issue with email provider',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -238,7 +240,7 @@ class AuthController extends Controller
|
||||
{
|
||||
$user = User::where('token', $token)->where('is_verified', 0)->first();
|
||||
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pautan tetapan semula kata laluan tidak sah atau telah tamat tempoh.',
|
||||
@@ -269,7 +271,7 @@ class AuthController extends Controller
|
||||
|
||||
$user = User::where('token', $request->token)->where('is_verified', 0)->first();
|
||||
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pautan tetapan semula kata laluan tidak sah atau telah tamat tempoh.',
|
||||
@@ -290,9 +292,10 @@ class AuthController extends Controller
|
||||
public function getProfile()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return response()->json([
|
||||
"message" => true,
|
||||
"user_detail" => $user
|
||||
'message' => true,
|
||||
'user_detail' => $user,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
@@ -29,4 +28,4 @@ class ResetPasswordController extends Controller
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\AuthMobile;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
|
||||
@@ -38,4 +38,4 @@ class VerificationController extends Controller
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,12 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\User;
|
||||
use PDF;
|
||||
use App\Models\Cart;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\JenisEmas;
|
||||
use App\Models\JenisKarat;
|
||||
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\FileMarhun;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\Cart;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\FileMarhun;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CartController extends Controller
|
||||
{
|
||||
@@ -35,32 +22,30 @@ class CartController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
|
||||
public function getCart($userid)
|
||||
public function getCart($userid)
|
||||
{
|
||||
$carts = Cart::where('user_id','=', $userid)->get()->toArray();
|
||||
|
||||
foreach($carts as $index => $cart)
|
||||
{
|
||||
$lelongbid = LelongBid::where('id',$cart['lelongbid_id'])->first()->toArray();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$lelongbid['id'])->get()->toArray();
|
||||
$cawangan = Cawangan::where('id','=',$lelongbid['caw_id'])->first()->toArray();
|
||||
$carts = Cart::where('user_id', '=', $userid)->get()->toArray();
|
||||
|
||||
foreach ($carts as $index => $cart) {
|
||||
$lelongbid = LelongBid::where('id', $cart['lelongbid_id'])->first()->toArray();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id', '=', $lelongbid['id'])->get()->toArray();
|
||||
$cawangan = Cawangan::where('id', '=', $lelongbid['caw_id'])->first()->toArray();
|
||||
|
||||
$carts[$index]['datalelongbid'] = $lelongbid;
|
||||
$carts[$index]['datalelongbid']['lelongbidmarhun'] = $marhun;
|
||||
$carts[$index]['datalelongbid']['cawangan'] = $cawangan;
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
"carts" => $carts
|
||||
'carts' => $carts,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getCartByCawangan($userId)
|
||||
{
|
||||
$groupCawangan = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->where('user_id', '=', $userId)
|
||||
->join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
||||
->where('user_id', '=', $userId)
|
||||
->select('caw_id', 'caw_name')
|
||||
->groupBy('caw_id')
|
||||
->get()->toArray();
|
||||
@@ -71,7 +56,7 @@ class CartController extends Controller
|
||||
foreach ($groupCawangan as $index => $cawangan) {
|
||||
|
||||
$cart = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id', $userId)
|
||||
->where('user_id', $userId)
|
||||
->where('caw_id', $cawangan)
|
||||
->get()->toArray();
|
||||
|
||||
@@ -92,11 +77,11 @@ class CartController extends Controller
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id', '=', $data['id'])->get()->toArray();
|
||||
|
||||
$cart[$index1]['lelongbidmarhun'] = $marhun;
|
||||
$cart[$index1]['tambahanbidaan'] = number_format((float)$tambahan_bidaan, 2, '.', '');
|
||||
$cart[$index1]['tambahanbidaan'] = number_format((float) $tambahan_bidaan, 2, '.', '');
|
||||
}
|
||||
$groupCawangan[$index]['total_surat'] = $total_surat;
|
||||
$groupCawangan[$index]['total_berat'] = number_format((float)$total_berat, 2, '.', '');
|
||||
$groupCawangan[$index]['total_bidaan'] = number_format((float)$total_hargabida, 2, '.', '');
|
||||
$groupCawangan[$index]['total_berat'] = number_format((float) $total_berat, 2, '.', '');
|
||||
$groupCawangan[$index]['total_bidaan'] = number_format((float) $total_hargabida, 2, '.', '');
|
||||
|
||||
$groupCawangan[$index]['lelongbid'] = $cart;
|
||||
|
||||
@@ -104,18 +89,17 @@ class CartController extends Controller
|
||||
$master_total_bidaan += $total_hargabida;
|
||||
}
|
||||
|
||||
|
||||
if ($groupCawangan) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'cart' => $groupCawangan,
|
||||
'master_total_surat' => $master_total_surat,
|
||||
'master_total_bidaan' => number_format((float)$master_total_bidaan, 2, '.', ''),
|
||||
'master_total_bidaan' => number_format((float) $master_total_bidaan, 2, '.', ''),
|
||||
], 201);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Empty Data'
|
||||
'message' => 'Empty Data',
|
||||
], 201);
|
||||
}
|
||||
}
|
||||
@@ -126,20 +110,20 @@ class CartController extends Controller
|
||||
|
||||
$beza_harga = $request->hargabida - $lelong_bid->hargaasas;
|
||||
|
||||
if($beza_harga < 1) {
|
||||
if ($beza_harga < 1) {
|
||||
return response()->json([
|
||||
'success' => 'gagal',
|
||||
'status' => 9,
|
||||
'message' => 'Harga bida kurang daripada harga asas.'
|
||||
'message' => 'Harga bida kurang daripada harga asas.',
|
||||
]);
|
||||
}
|
||||
|
||||
$check_exist = Cart::where('lelongbid_id', $request->lelongbid_id)->where('user_id', $request->user_id)->exists();
|
||||
if($check_exist == true) {
|
||||
if ($check_exist == true) {
|
||||
return response()->json([
|
||||
'success' => 'gagal_tambah_ke_troli',
|
||||
'status' => 8,
|
||||
'message' => 'SAG telah berada di dalam troli!'
|
||||
'message' => 'SAG telah berada di dalam troli!',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -148,15 +132,12 @@ class CartController extends Controller
|
||||
$item->lelongbid_id = $request->lelongbid_id;
|
||||
$item->hargabida = $request->hargabida;
|
||||
|
||||
if($item->save())
|
||||
{
|
||||
if ($item->save()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'carts' => $item
|
||||
'carts' => $item,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Error! Cannot save.',
|
||||
@@ -166,16 +147,13 @@ class CartController extends Controller
|
||||
|
||||
public function removeFromCart(Request $request)
|
||||
{
|
||||
$item = Cart::where('id',$request->cart_id)->first();
|
||||
if($item->delete())
|
||||
{
|
||||
$item = Cart::where('id', $request->cart_id)->first();
|
||||
if ($item->delete()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'carts' => $item
|
||||
'carts' => $item,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Error! Cannot save.',
|
||||
@@ -193,11 +171,11 @@ class CartController extends Controller
|
||||
|
||||
$beza_harga = $request->hargabida - $lelong_bid->hargaasas;
|
||||
|
||||
if($beza_harga < 1) {
|
||||
if ($beza_harga < 1) {
|
||||
return response()->json([
|
||||
'success' => 'gagal',
|
||||
'status' => 9,
|
||||
'message' => 'Harga bida kurang daripada harga asas.'
|
||||
'message' => 'Harga bida kurang daripada harga asas.',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -205,7 +183,7 @@ class CartController extends Controller
|
||||
if ($cart->save()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'cart' => $cart
|
||||
'cart' => $cart,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
@@ -217,32 +195,11 @@ class CartController extends Controller
|
||||
|
||||
public function deleteCart($id)
|
||||
{
|
||||
$cart = Cart::where('id','=',$id)->first();
|
||||
if($cart->delete())
|
||||
{
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Delete Success'
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Error! Cannot save.',
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteItem(Request $request)
|
||||
{
|
||||
$cart = Cart::where('user_id', $request->userId)
|
||||
->where('lelongbid_id', $request->lelongBidId)
|
||||
->first();
|
||||
$cart = Cart::where('id', '=', $id)->first();
|
||||
if ($cart->delete()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Delete Success'
|
||||
'message' => 'Delete Success',
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
@@ -252,6 +209,21 @@ class CartController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deleteItem(Request $request)
|
||||
{
|
||||
$cart = Cart::where('user_id', $request->userId)
|
||||
->where('lelongbid_id', $request->lelongBidId)
|
||||
->first();
|
||||
if ($cart->delete()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Delete Success',
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Error! Cannot save.',
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Exception;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class DatabaseController extends Controller
|
||||
{
|
||||
@@ -44,14 +42,14 @@ class DatabaseController extends Controller
|
||||
|
||||
// dd($gadai, $transaksi_keuntungan, $roles_harian_penilai, $customer_details);
|
||||
|
||||
return view('pengurusandatabase.senaraidb',compact('caw'));
|
||||
return view('pengurusandatabase.senaraidb', compact('caw'));
|
||||
}
|
||||
|
||||
public function showConn($id)
|
||||
{
|
||||
$caw = Cawangan::where('id','=',$id)->first();
|
||||
|
||||
return view('pengurusandatabase.show',compact('caw'));
|
||||
$caw = Cawangan::where('id', '=', $id)->first();
|
||||
|
||||
return view('pengurusandatabase.show', compact('caw'));
|
||||
}
|
||||
|
||||
public function newConn(Request $request)
|
||||
@@ -74,14 +72,15 @@ class DatabaseController extends Controller
|
||||
'lokasi' => $request->lokasi,
|
||||
'pkb_jmc' => $request->pkb_jmc,
|
||||
]);
|
||||
|
||||
return redirect()->route('sistem.database')
|
||||
->with('success','Data berjaya disimpan');
|
||||
->with('success', 'Data berjaya disimpan');
|
||||
}
|
||||
|
||||
public function storeConn(Request $request)
|
||||
{
|
||||
$caw = Cawangan::where('id','=',$request->caw_id)->first();
|
||||
|
||||
$caw = Cawangan::where('id', '=', $request->caw_id)->first();
|
||||
|
||||
$caw->caw_dbname = $request->caw_dbname;
|
||||
$caw->caw_dbuser = $request->caw_dbuser;
|
||||
$caw->caw_dbpass = $request->caw_dbpass;
|
||||
@@ -98,27 +97,24 @@ class DatabaseController extends Controller
|
||||
$caw->lokasi = $request->lokasi;
|
||||
$caw->pkb_jmc = $request->pkb_jmc;
|
||||
$caw->save();
|
||||
|
||||
|
||||
return redirect()->route('sistem.database')
|
||||
->with('success','Data berjaya disimpan');
|
||||
->with('success', 'Data berjaya disimpan');
|
||||
}
|
||||
|
||||
public function deleteConn($id)
|
||||
{
|
||||
$caw = Cawangan::where('id','=',$id)->first();
|
||||
$caw = Cawangan::where('id', '=', $id)->first();
|
||||
$caw->delete();
|
||||
|
||||
return redirect()->route('sistem.database')
|
||||
->with('success','Data berjaya dipadam');
|
||||
->with('success', 'Data berjaya dipadam');
|
||||
}
|
||||
|
||||
public function export()
|
||||
public function export() {}
|
||||
|
||||
public function yuranBidaan()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function yuranBidaan() {
|
||||
// dd("hye");
|
||||
return view('pengurusandatabase.yuranbidaan');
|
||||
|
||||
@@ -137,9 +133,9 @@ class DatabaseController extends Controller
|
||||
$extension = $request->file_upload->getClientOriginalExtension();
|
||||
Storage::putFileAs('test', $file, "test-upload.$extension");
|
||||
|
||||
return redirect()->route('pengurusanuploaddownload.testupload')->with('success', 'Upload successful with size ' . $file_size);
|
||||
return redirect()->route('pengurusanuploaddownload.testupload')->with('success', 'Upload successful with size '.$file_size);
|
||||
} catch (Exception $exception) {
|
||||
return redirect()->route('pengurusanuploaddownload.testupload')->with('failed', 'Upload failed with size ' . $file_size);
|
||||
return redirect()->route('pengurusanuploaddownload.testupload')->with('failed', 'Upload failed with size '.$file_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,168 +2,158 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\GadaiMarhun;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidMarhun;
|
||||
|
||||
use DateTime;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
|
||||
|
||||
|
||||
class ImportDataController extends Controller
|
||||
{
|
||||
//PC
|
||||
public function importdata(Request $request)
|
||||
// PC
|
||||
public function importdata(Request $request)
|
||||
{
|
||||
//return view('importdata.importdatacawangan');
|
||||
// return view('importdata.importdatacawangan');
|
||||
$caw = Cawangan::all();
|
||||
return view('importdata.listcawangan',compact('caw'));
|
||||
|
||||
|
||||
return view('importdata.listcawangan', compact('caw'));
|
||||
|
||||
}
|
||||
|
||||
public function listcawangan()
|
||||
{
|
||||
$caw = Cawangan::all();
|
||||
return view('importdata.listcawangan',compact('caw'));
|
||||
|
||||
return view('importdata.listcawangan', compact('caw'));
|
||||
}
|
||||
|
||||
public function showsenarai($kodcaw)
|
||||
{
|
||||
$caw = Cawangan::where('caw_code','=',$kodcaw)->first();
|
||||
|
||||
return view('importdata.showsenarai',compact('caw'));
|
||||
$caw = Cawangan::where('caw_code', '=', $kodcaw)->first();
|
||||
|
||||
return view('importdata.showsenarai', compact('caw'));
|
||||
}
|
||||
|
||||
public function importdatagadai($kodcaw)
|
||||
{
|
||||
// dd($kodcaw);
|
||||
$caw = Cawangan::all();
|
||||
if (Gadai::where('kodcaw', '=', $kodcaw)->count() == null)
|
||||
{
|
||||
$results = DB::select("SELECT * FROM cawangan where caw_code = '$kodcaw' ");
|
||||
//dd($results);
|
||||
foreach($results as $row)
|
||||
{
|
||||
$caw_ip = $row->caw_ip;
|
||||
$caw_dbuser = $row->caw_dbuser;
|
||||
$caw_dbpass = $row->caw_dbpass;
|
||||
$caw_dbname = $row->caw_dbname;
|
||||
$caw_name = $row->caw_name;
|
||||
$caw_id = $row->id;
|
||||
if (Gadai::where('kodcaw', '=', $kodcaw)->count() == null) {
|
||||
$results = DB::select("SELECT * FROM cawangan where caw_code = '$kodcaw' ");
|
||||
// dd($results);
|
||||
foreach ($results as $row) {
|
||||
$caw_ip = $row->caw_ip;
|
||||
$caw_dbuser = $row->caw_dbuser;
|
||||
$caw_dbpass = $row->caw_dbpass;
|
||||
$caw_dbname = $row->caw_dbname;
|
||||
$caw_name = $row->caw_name;
|
||||
$caw_id = $row->id;
|
||||
|
||||
// dd($caw_ip);
|
||||
|
||||
$db = mysqli_connect($caw_ip,$caw_dbuser, $caw_dbpass);
|
||||
if (!$db)
|
||||
{
|
||||
|
||||
$db = mysqli_connect($caw_ip, $caw_dbuser, $caw_dbpass);
|
||||
if (! $db) {
|
||||
echo "<p style='color:#F00'>Server Down: $caw_name</p>";
|
||||
|
||||
continue;
|
||||
die('Could not connect: ' . mysqli_error());
|
||||
}
|
||||
mysqli_select_db($db,$caw_dbname);
|
||||
|
||||
$count = 0;
|
||||
$result=mysqli_query($db,"SELECT kodcaw,norujukan,nopelanggan,nokp,t_gadai,masa,sirig,nilaimarhun,berat,pinjaman,sttebus,tagcetak,kadarupah,tempoh,t_matang,t_matang1,teller,bakipjm,bakiupah,marhun,taglel,ansakhir,t_update,tagtbaki,penilai,percentpinj,tagpalsu,semakbarcode,historygadaian,upah12,hargajualan,bakihargajualan,tempohbayar,lelong_tawarruq FROM gadai where taglel = '0' and sttebus = '' and upah12 is NOT NULL");
|
||||
while($row_gadai = mysqli_fetch_array($result))
|
||||
{
|
||||
|
||||
$count++;
|
||||
$kodcaw = $row_gadai['kodcaw'];
|
||||
$norujukan = $row_gadai['norujukan'];
|
||||
$nopelanggan = $row_gadai['nopelanggan'];
|
||||
$nokp = $row_gadai['nokp'];
|
||||
$t_gadai = $row_gadai['t_gadai'];
|
||||
$masa = $row_gadai['masa'];
|
||||
$sirig = $row_gadai['sirig'];
|
||||
$nilaimarhun = $row_gadai['nilaimarhun'];
|
||||
$berat = $row_gadai['berat'];
|
||||
$pinjaman = $row_gadai['pinjaman'];
|
||||
$kadarupah = $row_gadai['kadarupah'];
|
||||
$tempoh = $row_gadai['tempoh'];
|
||||
$t_matang = $row_gadai['t_matang'];
|
||||
$t_matang1 = $row_gadai['t_matang1'];
|
||||
$teller = $row_gadai['teller'];
|
||||
$bakipjm = $row_gadai['bakipjm'];
|
||||
$bakiupah = $row_gadai['bakiupah'];
|
||||
$marhun = $row_gadai['marhun'];
|
||||
$taglel = $row_gadai['taglel'];
|
||||
$ansakhir = $row_gadai['ansakhir'];
|
||||
$t_update = $row_gadai['t_update'];
|
||||
$tagtbaki = $row_gadai['tagtbaki'];
|
||||
$penilai = $row_gadai['penilai'];
|
||||
$percentpinj = $row_gadai['percentpinj'];
|
||||
$tagpalsu = $row_gadai['tagpalsu'];
|
||||
$semakbarcode = $row_gadai['semakbarcode'];
|
||||
$historygadaian = $row_gadai['historygadaian'];
|
||||
$upah12 = $row_gadai['upah12'];
|
||||
$hargajualan = $row_gadai['hargajualan'];
|
||||
$bakihargajualan = $row_gadai['bakihargajualan'];
|
||||
$tempohbayar = $row_gadai['tempohbayar'];
|
||||
$lelong_tawarruq = $row_gadai['lelong_tawarruq'];
|
||||
|
||||
DB::insert("INSERT INTO lelong.gadai (kodcaw,norujukan,nopelanggan,nokp,t_gadai,masa,sirig,nilaimarhun,berat,pinjaman,sttebus,tagcetak,kadarupah,tempoh,t_matang,t_matang1,teller,bakipjm,bakiupah,marhun,taglel,ansakhir,t_update,tagtbaki,penilai,percentpinj,tagpalsu,semakbarcode,historygadaian,upah12,hargajualan,bakihargajualan,tempohbayar,lelong_tawarruq)
|
||||
VALUES ('$kodcaw','$norujukan','$nopelanggan','$nokp','$t_gadai','$masa','$sirig','$nilaimarhun','$berat','$pinjaman', '','','$kadarupah','$tempoh','$t_matang','$t_matang1','$teller','$bakipjm','$bakiupah','$marhun','$taglel','$ansakhir','$t_update','0','$penilai','$percentpinj','$tagpalsu','$semakbarcode','$historygadaian','$upah12','$hargajualan','$bakihargajualan','$tempohbayar','$lelong_tawarruq')");
|
||||
|
||||
//untuk gadaimarhun
|
||||
$result1=mysqli_query($db,"SELECT * FROM marhun where norujukan = '$norujukan'");
|
||||
while($row_tender1 = mysqli_fetch_array($result1))
|
||||
{
|
||||
|
||||
$kodcaw1 = $row_tender1['kodcaw'];
|
||||
$norujukan1 = $row_tender1['norujukan'];
|
||||
$bil1 = $row_tender1['bil'];
|
||||
$t_gadai1 = $row_tender1['t_gadai'];
|
||||
$marhun1 = $row_tender1['marhun'];
|
||||
$nota1 = $row_tender1['nota'];
|
||||
$karat1 = $row_tender1['karat'];
|
||||
$berat1 = $row_tender1['berat'];
|
||||
$harga1 = $row_tender1['harga'];
|
||||
$n_marhun1 = $row_tender1['n_marhun'];
|
||||
$nota2 = $db -> real_escape_string($nota1);
|
||||
|
||||
DB::insert("INSERT INTO lelong.gadaimarhun (kodcaw,norujukan,t_gadai,bil,marhun,nota,karat,berat,harga,n_marhun)
|
||||
VALUES ('$kodcaw1','$norujukan1','$t_gadai1','$bil1','$marhun1','$nota2','$karat1','$berat1','$harga1','$n_marhun1')");
|
||||
|
||||
}
|
||||
|
||||
exit('Could not connect: '.mysqli_error());
|
||||
}
|
||||
mysqli_select_db($db, $caw_dbname);
|
||||
|
||||
$count = 0;
|
||||
$result = mysqli_query($db, "SELECT kodcaw,norujukan,nopelanggan,nokp,t_gadai,masa,sirig,nilaimarhun,berat,pinjaman,sttebus,tagcetak,kadarupah,tempoh,t_matang,t_matang1,teller,bakipjm,bakiupah,marhun,taglel,ansakhir,t_update,tagtbaki,penilai,percentpinj,tagpalsu,semakbarcode,historygadaian,upah12,hargajualan,bakihargajualan,tempohbayar,lelong_tawarruq FROM gadai where taglel = '0' and sttebus = '' and upah12 is NOT NULL");
|
||||
while ($row_gadai = mysqli_fetch_array($result)) {
|
||||
|
||||
$count++;
|
||||
$kodcaw = $row_gadai['kodcaw'];
|
||||
$norujukan = $row_gadai['norujukan'];
|
||||
$nopelanggan = $row_gadai['nopelanggan'];
|
||||
$nokp = $row_gadai['nokp'];
|
||||
$t_gadai = $row_gadai['t_gadai'];
|
||||
$masa = $row_gadai['masa'];
|
||||
$sirig = $row_gadai['sirig'];
|
||||
$nilaimarhun = $row_gadai['nilaimarhun'];
|
||||
$berat = $row_gadai['berat'];
|
||||
$pinjaman = $row_gadai['pinjaman'];
|
||||
$kadarupah = $row_gadai['kadarupah'];
|
||||
$tempoh = $row_gadai['tempoh'];
|
||||
$t_matang = $row_gadai['t_matang'];
|
||||
$t_matang1 = $row_gadai['t_matang1'];
|
||||
$teller = $row_gadai['teller'];
|
||||
$bakipjm = $row_gadai['bakipjm'];
|
||||
$bakiupah = $row_gadai['bakiupah'];
|
||||
$marhun = $row_gadai['marhun'];
|
||||
$taglel = $row_gadai['taglel'];
|
||||
$ansakhir = $row_gadai['ansakhir'];
|
||||
$t_update = $row_gadai['t_update'];
|
||||
$tagtbaki = $row_gadai['tagtbaki'];
|
||||
$penilai = $row_gadai['penilai'];
|
||||
$percentpinj = $row_gadai['percentpinj'];
|
||||
$tagpalsu = $row_gadai['tagpalsu'];
|
||||
$semakbarcode = $row_gadai['semakbarcode'];
|
||||
$historygadaian = $row_gadai['historygadaian'];
|
||||
$upah12 = $row_gadai['upah12'];
|
||||
$hargajualan = $row_gadai['hargajualan'];
|
||||
$bakihargajualan = $row_gadai['bakihargajualan'];
|
||||
$tempohbayar = $row_gadai['tempohbayar'];
|
||||
$lelong_tawarruq = $row_gadai['lelong_tawarruq'];
|
||||
|
||||
DB::insert("INSERT INTO lelong.gadai (kodcaw,norujukan,nopelanggan,nokp,t_gadai,masa,sirig,nilaimarhun,berat,pinjaman,sttebus,tagcetak,kadarupah,tempoh,t_matang,t_matang1,teller,bakipjm,bakiupah,marhun,taglel,ansakhir,t_update,tagtbaki,penilai,percentpinj,tagpalsu,semakbarcode,historygadaian,upah12,hargajualan,bakihargajualan,tempohbayar,lelong_tawarruq)
|
||||
VALUES ('$kodcaw','$norujukan','$nopelanggan','$nokp','$t_gadai','$masa','$sirig','$nilaimarhun','$berat','$pinjaman', '','','$kadarupah','$tempoh','$t_matang','$t_matang1','$teller','$bakipjm','$bakiupah','$marhun','$taglel','$ansakhir','$t_update','0','$penilai','$percentpinj','$tagpalsu','$semakbarcode','$historygadaian','$upah12','$hargajualan','$bakihargajualan','$tempohbayar','$lelong_tawarruq')");
|
||||
|
||||
// untuk gadaimarhun
|
||||
$result1 = mysqli_query($db, "SELECT * FROM marhun where norujukan = '$norujukan'");
|
||||
while ($row_tender1 = mysqli_fetch_array($result1)) {
|
||||
|
||||
$kodcaw1 = $row_tender1['kodcaw'];
|
||||
$norujukan1 = $row_tender1['norujukan'];
|
||||
$bil1 = $row_tender1['bil'];
|
||||
$t_gadai1 = $row_tender1['t_gadai'];
|
||||
$marhun1 = $row_tender1['marhun'];
|
||||
$nota1 = $row_tender1['nota'];
|
||||
$karat1 = $row_tender1['karat'];
|
||||
$berat1 = $row_tender1['berat'];
|
||||
$harga1 = $row_tender1['harga'];
|
||||
$n_marhun1 = $row_tender1['n_marhun'];
|
||||
$nota2 = $db->real_escape_string($nota1);
|
||||
|
||||
DB::insert("INSERT INTO lelong.gadaimarhun (kodcaw,norujukan,t_gadai,bil,marhun,nota,karat,berat,harga,n_marhun)
|
||||
VALUES ('$kodcaw1','$norujukan1','$t_gadai1','$bil1','$marhun1','$nota2','$karat1','$berat1','$harga1','$n_marhun1')");
|
||||
|
||||
}
|
||||
return redirect()->route('importdata.listcawangan')
|
||||
->with('success','Data '.$caw_name.' berjaya import');
|
||||
|
||||
}
|
||||
}else{
|
||||
|
||||
return redirect()->route('importdata.listcawangan')
|
||||
->with('success','Data '.$kodcaw.' Ini Telah Wujud Sila Hapus Data Dahulu');
|
||||
->with('success', 'Data '.$caw_name.' berjaya import');
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
return redirect()->route('importdata.listcawangan')
|
||||
->with('success', 'Data '.$kodcaw.' Ini Telah Wujud Sila Hapus Data Dahulu');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapusdatacawangan($kodcaw)
|
||||
{
|
||||
$caw = Gadai::where('kodcaw','=',$kodcaw);
|
||||
$caw = Gadai::where('kodcaw', '=', $kodcaw);
|
||||
$caw->delete();
|
||||
|
||||
$cawmarhun = GadaiMarhun::where('kodcaw','=',$kodcaw);
|
||||
$cawmarhun = GadaiMarhun::where('kodcaw', '=', $kodcaw);
|
||||
$cawmarhun->delete();
|
||||
// dd($cawmarhun);
|
||||
|
||||
// dd($cawmarhun);
|
||||
return redirect()->route('importdata.listcawangan')
|
||||
->with('success','Data '.$kodcaw.' Berjaya Dihapuskan');
|
||||
->with('success', 'Data '.$kodcaw.' Berjaya Dihapuskan');
|
||||
}
|
||||
|
||||
public function exportdatacawangan($kodcaw,$lelong_id)
|
||||
public function exportdatacawangan($kodcaw, $lelong_id)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
// $currenttime = $currentdate->toTimeString();
|
||||
@@ -172,148 +162,128 @@ class ImportDataController extends Controller
|
||||
$cawid = $getcawid['id'];
|
||||
$caw = Cawangan::all();
|
||||
$carian = CawanganLelong::where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', '=', $lelong_id)
|
||||
->select('export_data_sts')
|
||||
->first();
|
||||
->where('lelong_id', '=', $lelong_id)
|
||||
->select('export_data_sts')
|
||||
->first();
|
||||
// dd($carian->export_data_sts);
|
||||
if ($carian->export_data_sts == NULL )
|
||||
{
|
||||
//untuk dapatkan tarikhlelong sebenar
|
||||
$datacawlel = Lelong::where('id', '=', $lelong_id)->first();
|
||||
if ($carian->export_data_sts == null) {
|
||||
// untuk dapatkan tarikhlelong sebenar
|
||||
$datacawlel = Lelong::where('id', '=', $lelong_id)->first();
|
||||
|
||||
$tarikh_lelong = $datacawlel->tarikh_lelong;
|
||||
$masamula_lelong = $datacawlel->masamula_lelong;
|
||||
$masatamat_lelong = $datacawlel->masatamat_lelong;
|
||||
$cajlelong = $datacawlel->cajlelong;
|
||||
|
||||
$results = DB::select("SELECT * FROM cawangan where caw_code = '$kodcaw' ");
|
||||
foreach($results as $row)
|
||||
{
|
||||
$caw_ip = $row->caw_ip;
|
||||
$caw_dbuser = $row->caw_dbuser;
|
||||
$caw_dbpass = $row->caw_dbpass;
|
||||
$caw_dbname = $row->caw_dbname;
|
||||
$caw_name = $row->caw_name;
|
||||
$caw_id = $row->id;
|
||||
$tarikh_lelong = $datacawlel->tarikh_lelong;
|
||||
$masamula_lelong = $datacawlel->masamula_lelong;
|
||||
$masatamat_lelong = $datacawlel->masatamat_lelong;
|
||||
$cajlelong = $datacawlel->cajlelong;
|
||||
|
||||
// dd($results);
|
||||
|
||||
$db = mysqli_connect($caw_ip,$caw_dbuser, $caw_dbpass);
|
||||
if (!$db)
|
||||
{
|
||||
echo "<p style='color:#F00'>Server Down: $caw_name</p>";
|
||||
continue;
|
||||
die('Could not connect: ' . mysqli_error());
|
||||
}
|
||||
|
||||
mysqli_select_db($db,$caw_dbname);
|
||||
$results = DB::select("SELECT * FROM cawangan where caw_code = '$kodcaw' ");
|
||||
foreach ($results as $row) {
|
||||
$caw_ip = $row->caw_ip;
|
||||
$caw_dbuser = $row->caw_dbuser;
|
||||
$caw_dbpass = $row->caw_dbpass;
|
||||
$caw_dbname = $row->caw_dbname;
|
||||
$caw_name = $row->caw_name;
|
||||
$caw_id = $row->id;
|
||||
|
||||
$result_batchlel=mysqli_query($db,"SELECT MAX(batchno) AS bil FROM batchlel");
|
||||
$row_batchlel = mysqli_fetch_array($result_batchlel);
|
||||
$newbatchlel = $row_batchlel['bil']+1;
|
||||
$insert1 =mysqli_query($db,"INSERT INTO batchlel (kodcaw,batchno,tarikh,tarikh2,masadari,masahingga,pilihankos,pcntkos) VALUES ('$kodcaw','$newbatchlel','$tarikh_lelong','$tarikh_lelong','$masamula_lelong','$masatamat_lelong','P','$cajlelong') ");
|
||||
$datalelbid = LelongBid::join('users','users.id','=','lelongbid.nopembeli')
|
||||
->where('caw_id','=',$cawid)
|
||||
->where('lelong_id',$lelong_id)
|
||||
->where('status_payment','1')
|
||||
->get();
|
||||
// dd($datalelbid);
|
||||
$suratcaw = $datalelbid->all();
|
||||
$sirilel = 0;
|
||||
foreach(array_chunk($suratcaw,100) as $data_chunk)
|
||||
{
|
||||
foreach($data_chunk as $data)
|
||||
{
|
||||
$sirilel++;
|
||||
|
||||
$insert2 =mysqli_query($db,"INSERT INTO audtrail (tarikh,teller,act,transaksi,kodcaw,norujukan) VALUES ('$currentdate','LELONG','JUAL','LELONG','$kodcaw','$data->norujukan') ");
|
||||
//getglcode
|
||||
$result_parameter=mysqli_query($db,"SELECT * from product");
|
||||
$row_parameter = mysqli_fetch_array($result_parameter);
|
||||
$glcode = $row_parameter['glcode'];
|
||||
$kodgl = $row_parameter['kodgl'];
|
||||
$prkod = $row_parameter['prkod'];
|
||||
// dd($results);
|
||||
|
||||
$insert3 = mysqli_query($db,"insert into lelong(sirilel, kodcaw, norujukan, batchno,t_lelong, nilaimarhun, pinjaman, kadarupah, berat, marhun,bakiupah, jbg, glcode, kodgl, teller, prkod,beratasal,hargaasas,hargajual,t_jual,baki,cajlelong,status_bida_online,fasa)
|
||||
$db = mysqli_connect($caw_ip, $caw_dbuser, $caw_dbpass);
|
||||
if (! $db) {
|
||||
echo "<p style='color:#F00'>Server Down: $caw_name</p>";
|
||||
|
||||
continue;
|
||||
exit('Could not connect: '.mysqli_error());
|
||||
}
|
||||
|
||||
mysqli_select_db($db, $caw_dbname);
|
||||
|
||||
$result_batchlel = mysqli_query($db, 'SELECT MAX(batchno) AS bil FROM batchlel');
|
||||
$row_batchlel = mysqli_fetch_array($result_batchlel);
|
||||
$newbatchlel = $row_batchlel['bil'] + 1;
|
||||
$insert1 = mysqli_query($db, "INSERT INTO batchlel (kodcaw,batchno,tarikh,tarikh2,masadari,masahingga,pilihankos,pcntkos) VALUES ('$kodcaw','$newbatchlel','$tarikh_lelong','$tarikh_lelong','$masamula_lelong','$masatamat_lelong','P','$cajlelong') ");
|
||||
$datalelbid = LelongBid::join('users', 'users.id', '=', 'lelongbid.nopembeli')
|
||||
->where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', $lelong_id)
|
||||
->where('status_payment', '1')
|
||||
->get();
|
||||
// dd($datalelbid);
|
||||
$suratcaw = $datalelbid->all();
|
||||
$sirilel = 0;
|
||||
foreach (array_chunk($suratcaw, 100) as $data_chunk) {
|
||||
foreach ($data_chunk as $data) {
|
||||
$sirilel++;
|
||||
|
||||
$insert2 = mysqli_query($db, "INSERT INTO audtrail (tarikh,teller,act,transaksi,kodcaw,norujukan) VALUES ('$currentdate','LELONG','JUAL','LELONG','$kodcaw','$data->norujukan') ");
|
||||
// getglcode
|
||||
$result_parameter = mysqli_query($db, 'SELECT * from product');
|
||||
$row_parameter = mysqli_fetch_array($result_parameter);
|
||||
$glcode = $row_parameter['glcode'];
|
||||
$kodgl = $row_parameter['kodgl'];
|
||||
$prkod = $row_parameter['prkod'];
|
||||
|
||||
$insert3 = mysqli_query($db, "insert into lelong(sirilel, kodcaw, norujukan, batchno,t_lelong, nilaimarhun, pinjaman, kadarupah, berat, marhun,bakiupah, jbg, glcode, kodgl, teller, prkod,beratasal,hargaasas,hargajual,t_jual,baki,cajlelong,status_bida_online,fasa)
|
||||
values('$sirilel', '$kodcaw', '$data->norujukan', '$newbatchlel', '$data->t_lelong', '$data->nilaimarhun', '$data->pinjaman', '$data->kadarupah', '$data->berat', '$data->marhun', '$data->bakiupah', '$data->jbg', '$glcode', '$kodgl', 'LELONG', '$prkod', '$data->berat','$data->hargaasas','$data->hargajual','$data->t_jual','$data->baki','$data->cajlelong','1','$data->fasa')");
|
||||
// dd($insert3);
|
||||
// dd($insert3);
|
||||
|
||||
$resultss=mysqli_query($db,"SELECT * FROM pembeli WHERE nokp = '$data->nokp'");
|
||||
$row_tender = mysqli_fetch_array($resultss);
|
||||
if($row_tender == null)
|
||||
|
||||
{
|
||||
$result_pembeli=mysqli_query($db,"SELECT MAX(nopembeli) AS bil FROM pembeli");
|
||||
$row_pembeli = mysqli_fetch_array($result_pembeli);
|
||||
$nopembelibaru = $row_pembeli['bil']+1;
|
||||
|
||||
$insert4 =mysqli_query($db,"INSERT INTO pembeli (nopembeli,nokp,nama,alamat1,telefon) VALUES ('$nopembelibaru','$data->nokp','$data->name','$data->alamat','$data->notelbimbit') ");
|
||||
$update1 = mysqli_query($db,"UPDATE lelong SET nopembeli = '$nopembelibaru' where norujukan = '$data->norujukan' and batchno = '$newbatchlel'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$nopembeli = $row_tender['nopembeli'];
|
||||
$update2 = mysqli_query($db,"UPDATE lelong SET nopembeli = '$nopembeli' where norujukan = '$data->norujukan' and batchno = '$newbatchlel'");
|
||||
|
||||
}
|
||||
$resultss = mysqli_query($db, "SELECT * FROM pembeli WHERE nokp = '$data->nokp'");
|
||||
$row_tender = mysqli_fetch_array($resultss);
|
||||
if ($row_tender == null) {
|
||||
$result_pembeli = mysqli_query($db, 'SELECT MAX(nopembeli) AS bil FROM pembeli');
|
||||
$row_pembeli = mysqli_fetch_array($result_pembeli);
|
||||
$nopembelibaru = $row_pembeli['bil'] + 1;
|
||||
|
||||
}
|
||||
}
|
||||
$datalelbidmarhun = LelongBidMarhun::join('lelongbid','lelongbid.id','=','lelongbidmarhun.lelongbid_id')
|
||||
->where('lelongbid.caw_id','=',$cawid)
|
||||
->where('lelongbid.lelong_id',$lelong_id)
|
||||
->where('lelongbid.status_payment','1')
|
||||
->select('lelongbid.t_jual','lelongbid.norujukan',
|
||||
'lelongbidmarhun.hargaasas','lelongbidmarhun.bil','lelongbidmarhun.marhun','lelongbidmarhun.nota','lelongbidmarhun.berat',
|
||||
'lelongbidmarhun.n_marhun','lelongbidmarhun.harga','lelongbidmarhun.karat','lelongbid.kodcaw')
|
||||
->get();
|
||||
// dd($datalelbidmarhun);
|
||||
$suratcawmarhun = $datalelbidmarhun->all();
|
||||
foreach(array_chunk($suratcawmarhun,100) as $data_chunkmarhun)
|
||||
{
|
||||
foreach($data_chunkmarhun as $datamarhun)
|
||||
{
|
||||
// $sirilel++;
|
||||
// $batchno = $q1['batch_no'];
|
||||
$kodcaw = $datamarhun->kodcaw;
|
||||
$norujukan = $datamarhun->norujukan;
|
||||
$hargaasas = $datamarhun->hargaasas;
|
||||
$harga = $datamarhun->harga;
|
||||
$n_marhun = $datamarhun->n_marhun;
|
||||
$insert4 = mysqli_query($db, "INSERT INTO pembeli (nopembeli,nokp,nama,alamat1,telefon) VALUES ('$nopembelibaru','$data->nokp','$data->name','$data->alamat','$data->notelbimbit') ");
|
||||
$update1 = mysqli_query($db, "UPDATE lelong SET nopembeli = '$nopembelibaru' where norujukan = '$data->norujukan' and batchno = '$newbatchlel'");
|
||||
} else {
|
||||
$nopembeli = $row_tender['nopembeli'];
|
||||
$update2 = mysqli_query($db, "UPDATE lelong SET nopembeli = '$nopembeli' where norujukan = '$data->norujukan' and batchno = '$newbatchlel'");
|
||||
|
||||
$insert5 = mysqli_query($db,"insert into lelmarhun(kodcaw, norujukan, bil, marhun, nota, berat, n_marhun, batch_no, harga, karat,hargaasas,beratasal)
|
||||
values('$kodcaw', '$datamarhun->norujukan', '$datamarhun->bil', '$datamarhun->marhun', '$datamarhun->nota', '$datamarhun->berat', '$n_marhun', '$newbatchlel', '$harga', '$datamarhun->karat','$hargaasas','$datamarhun->berat')");
|
||||
|
||||
$update3 = mysqli_query($db,"UPDATE gadai SET sttebus = 'L', taglel = '1', tagtbaki = '1', t_update = '$datamarhun->t_jual' where norujukan = '$datamarhun->norujukan'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$updatecawlel = CawanganLelong::where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', '=', $lelong_id)
|
||||
// ->select('export_data_sts')
|
||||
->first();
|
||||
$updatecawlel->export_data_sts = 1;
|
||||
$updatecawlel->export_data_stsdate = $currentdate;
|
||||
$updatecawlel->update();
|
||||
|
||||
|
||||
|
||||
return redirect()->route('pembida.senlelpembayaranbidaan')
|
||||
->with('success','Data '.$caw_name.' berjaya export');
|
||||
|
||||
}else
|
||||
{
|
||||
return redirect()->route('pembida.senlelpembayaranbidaan')
|
||||
->with('success','Data Tidak berjaya export');
|
||||
}
|
||||
|
||||
|
||||
$datalelbidmarhun = LelongBidMarhun::join('lelongbid', 'lelongbid.id', '=', 'lelongbidmarhun.lelongbid_id')
|
||||
->where('lelongbid.caw_id', '=', $cawid)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.status_payment', '1')
|
||||
->select('lelongbid.t_jual', 'lelongbid.norujukan',
|
||||
'lelongbidmarhun.hargaasas', 'lelongbidmarhun.bil', 'lelongbidmarhun.marhun', 'lelongbidmarhun.nota', 'lelongbidmarhun.berat',
|
||||
'lelongbidmarhun.n_marhun', 'lelongbidmarhun.harga', 'lelongbidmarhun.karat', 'lelongbid.kodcaw')
|
||||
->get();
|
||||
// dd($datalelbidmarhun);
|
||||
$suratcawmarhun = $datalelbidmarhun->all();
|
||||
foreach (array_chunk($suratcawmarhun, 100) as $data_chunkmarhun) {
|
||||
foreach ($data_chunkmarhun as $datamarhun) {
|
||||
// $sirilel++;
|
||||
// $batchno = $q1['batch_no'];
|
||||
$kodcaw = $datamarhun->kodcaw;
|
||||
$norujukan = $datamarhun->norujukan;
|
||||
$hargaasas = $datamarhun->hargaasas;
|
||||
$harga = $datamarhun->harga;
|
||||
$n_marhun = $datamarhun->n_marhun;
|
||||
|
||||
$insert5 = mysqli_query($db, "insert into lelmarhun(kodcaw, norujukan, bil, marhun, nota, berat, n_marhun, batch_no, harga, karat,hargaasas,beratasal)
|
||||
values('$kodcaw', '$datamarhun->norujukan', '$datamarhun->bil', '$datamarhun->marhun', '$datamarhun->nota', '$datamarhun->berat', '$n_marhun', '$newbatchlel', '$harga', '$datamarhun->karat','$hargaasas','$datamarhun->berat')");
|
||||
|
||||
$update3 = mysqli_query($db, "UPDATE gadai SET sttebus = 'L', taglel = '1', tagtbaki = '1', t_update = '$datamarhun->t_jual' where norujukan = '$datamarhun->norujukan'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$updatecawlel = CawanganLelong::where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', '=', $lelong_id)
|
||||
// ->select('export_data_sts')
|
||||
->first();
|
||||
$updatecawlel->export_data_sts = 1;
|
||||
$updatecawlel->export_data_stsdate = $currentdate;
|
||||
$updatecawlel->update();
|
||||
|
||||
return redirect()->route('pembida.senlelpembayaranbidaan')
|
||||
->with('success', 'Data '.$caw_name.' berjaya export');
|
||||
|
||||
} else {
|
||||
return redirect()->route('pembida.senlelpembayaranbidaan')
|
||||
->with('success', 'Data Tidak berjaya export');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+3223
-3542
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,23 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LogUser;
|
||||
use DateTime;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LelongUjrahController extends Controller
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
@@ -35,21 +33,18 @@ class LelongUjrahController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
public function index() {}
|
||||
|
||||
public function create($id)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$simulasi = Simulasi::where('id','=',$id)->first();
|
||||
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$id)->get();
|
||||
$simkarat = SimKarat::where('simulasi_id','=',$id)->get();
|
||||
$simulasi = Simulasi::where('id', '=', $id)->first();
|
||||
$cawangansim = CawanganSimulasi::where('simulasi_id', '=', $id)->get();
|
||||
$simkarat = SimKarat::where('simulasi_id', '=', $id)->get();
|
||||
|
||||
|
||||
$lelong = new Lelong();
|
||||
$lelong = new Lelong;
|
||||
$lelong->tarikh_lelong = $simulasi->tarikh_lelong;
|
||||
$lelong->harga_emas_asas = $simulasi->harga_emas_asas;
|
||||
$lelong->jbg = $simulasi->jbg;
|
||||
@@ -59,9 +54,7 @@ class LelongUjrahController extends Controller
|
||||
$lelong->tagujrah = 1;
|
||||
$lelong->save();
|
||||
|
||||
|
||||
foreach($simkarat as $simulasikarat)
|
||||
{
|
||||
foreach ($simkarat as $simulasikarat) {
|
||||
$lelkarat = new LelKarat;
|
||||
$lelkarat->lelong_id = $lelong->id;
|
||||
$lelkarat->karat = $simulasikarat->karat;
|
||||
@@ -71,15 +64,11 @@ class LelongUjrahController extends Controller
|
||||
$lelkarat->save();
|
||||
}
|
||||
|
||||
foreach($cawangansim as $caw)
|
||||
{
|
||||
$cawanganlel = CawanganLelong::where('caw_id','=',$caw->caw_id)->orderBy('id','desc')->first();
|
||||
if($cawanganlel)
|
||||
{
|
||||
$batchno = $cawanganlel->batchlel+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($cawangansim as $caw) {
|
||||
$cawanganlel = CawanganLelong::where('caw_id', '=', $caw->caw_id)->orderBy('id', 'desc')->first();
|
||||
if ($cawanganlel) {
|
||||
$batchno = $cawanganlel->batchlel + 1;
|
||||
} else {
|
||||
$batchno = 1;
|
||||
}
|
||||
$caw_lelong = new CawanganLelong;
|
||||
@@ -93,102 +82,93 @@ class LelongUjrahController extends Controller
|
||||
$caw_lelong->tagujrah = 1;
|
||||
$caw_lelong->save();
|
||||
|
||||
$datasimbid = SimulasiBid::where('caw_id','=',$caw->caw_id)->where('simulasi_id',$id)->get();
|
||||
$datasimbid = SimulasiBid::where('caw_id', '=', $caw->caw_id)->where('simulasi_id', $id)->get();
|
||||
$suratcaw = $datasimbid->all();
|
||||
foreach(array_chunk($suratcaw,100) as $data_chunk)
|
||||
{
|
||||
//dd($data);
|
||||
foreach($data_chunk as $data)
|
||||
{
|
||||
//dd($simulasi->id);
|
||||
$lelongbid = LelongBid::create([
|
||||
"lelong_id" => $lelong->id,
|
||||
"caw_id" => $data->caw_id,
|
||||
"kodcaw" => $data->kodcaw,
|
||||
"norujukan" => $data->norujukan,
|
||||
"t_lelong" => $data->t_lelong,
|
||||
"hargaasas" => $data->hargaasas,
|
||||
"hargajual" => 0.00,
|
||||
"jbg" => $data->jbg,
|
||||
"kadarupah" => $data->kadarupah,
|
||||
"ansuran" => $data->ansuran,
|
||||
"nilaimarhun" => $data->nilaimarhun,
|
||||
"pinjaman" => $data->pinjaman,
|
||||
"bakiupah" => $data->bakiupah,
|
||||
"upahsimpan" => $data->bakiupah,
|
||||
"cajlain" => $data->cajlain,
|
||||
"cajlelong" => 0.00,
|
||||
"baki" => 0.00,
|
||||
"berat" => $data->berat,
|
||||
"marhun" => $data->marhun,
|
||||
"percent" => $data->percent,
|
||||
"status_jual" => 0,
|
||||
"status_payment" => 0,
|
||||
"mora_upah" => 0,
|
||||
"fasa" => $data->fasa,
|
||||
"tagujrah" => 1,
|
||||
"onepercent" => $data->onepercent,
|
||||
"ujrah" => $data->ujrah
|
||||
]);
|
||||
|
||||
|
||||
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id','=',$data->id)->get();
|
||||
foreach($simulasibidmarhun as $simbidmarhun)
|
||||
{
|
||||
$lelongbidmarhun = new LelongBidMarhun;
|
||||
$lelongbidmarhun->lelongbid_id = $lelongbid->id;
|
||||
$lelongbidmarhun->bil = $simbidmarhun->bil;
|
||||
$lelongbidmarhun->marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->nota = $simbidmarhun->nota;
|
||||
$lelongbidmarhun->old_marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->old_karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->old_berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->old_harga = $simbidmarhun->old_harga;
|
||||
$lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->harga = $simbidmarhun->harga;
|
||||
$lelongbidmarhun->n_marhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->save();
|
||||
|
||||
}
|
||||
|
||||
if($lelongbidmarhun->save())
|
||||
{
|
||||
// $updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
// $updategadai->taglel = 1;
|
||||
// $updategadai->save();
|
||||
|
||||
$hapussimulasi = SimulasiBid::where('norujukan','=',$data->norujukan)->first();
|
||||
$hapussimulasi->delete();
|
||||
|
||||
//insert loguser
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $data->norujukan;
|
||||
$loguser->nota = 'Daftar Batch Lelong Ujrah'.$lelong->id;
|
||||
$loguser->save();
|
||||
}
|
||||
foreach (array_chunk($suratcaw, 100) as $data_chunk) {
|
||||
// dd($data);
|
||||
foreach ($data_chunk as $data) {
|
||||
// dd($simulasi->id);
|
||||
$lelongbid = LelongBid::create([
|
||||
'lelong_id' => $lelong->id,
|
||||
'caw_id' => $data->caw_id,
|
||||
'kodcaw' => $data->kodcaw,
|
||||
'norujukan' => $data->norujukan,
|
||||
't_lelong' => $data->t_lelong,
|
||||
'hargaasas' => $data->hargaasas,
|
||||
'hargajual' => 0.00,
|
||||
'jbg' => $data->jbg,
|
||||
'kadarupah' => $data->kadarupah,
|
||||
'ansuran' => $data->ansuran,
|
||||
'nilaimarhun' => $data->nilaimarhun,
|
||||
'pinjaman' => $data->pinjaman,
|
||||
'bakiupah' => $data->bakiupah,
|
||||
'upahsimpan' => $data->bakiupah,
|
||||
'cajlain' => $data->cajlain,
|
||||
'cajlelong' => 0.00,
|
||||
'baki' => 0.00,
|
||||
'berat' => $data->berat,
|
||||
'marhun' => $data->marhun,
|
||||
'percent' => $data->percent,
|
||||
'status_jual' => 0,
|
||||
'status_payment' => 0,
|
||||
'mora_upah' => 0,
|
||||
'fasa' => $data->fasa,
|
||||
'tagujrah' => 1,
|
||||
'onepercent' => $data->onepercent,
|
||||
'ujrah' => $data->ujrah,
|
||||
]);
|
||||
|
||||
$simulasibidmarhun = SimulasiBidMarhun::where('simulasibid_id', '=', $data->id)->get();
|
||||
foreach ($simulasibidmarhun as $simbidmarhun) {
|
||||
$lelongbidmarhun = new LelongBidMarhun;
|
||||
$lelongbidmarhun->lelongbid_id = $lelongbid->id;
|
||||
$lelongbidmarhun->bil = $simbidmarhun->bil;
|
||||
$lelongbidmarhun->marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->nota = $simbidmarhun->nota;
|
||||
$lelongbidmarhun->old_marhun = $simbidmarhun->marhun;
|
||||
$lelongbidmarhun->old_karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->old_berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->old_harga = $simbidmarhun->old_harga;
|
||||
$lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->karat = $simbidmarhun->karat;
|
||||
$lelongbidmarhun->berat = $simbidmarhun->berat;
|
||||
$lelongbidmarhun->harga = $simbidmarhun->harga;
|
||||
$lelongbidmarhun->n_marhun = $simbidmarhun->n_marhun;
|
||||
$lelongbidmarhun->hargaasas = $simbidmarhun->hargaasas;
|
||||
$lelongbidmarhun->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($lelongbidmarhun->save()) {
|
||||
// $updategadai = Gadai::where('norujukan','=', $data->norujukan)->first();
|
||||
// $updategadai->taglel = 1;
|
||||
// $updategadai->save();
|
||||
|
||||
$hapussimulasi = SimulasiBid::where('norujukan', '=', $data->norujukan)->first();
|
||||
$hapussimulasi->delete();
|
||||
|
||||
// insert loguser
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $data->norujukan;
|
||||
$loguser->nota = 'Daftar Batch Lelong Ujrah'.$lelong->id;
|
||||
$loguser->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$simulasi = Simulasi::where('id','=',$id)->where('tagujrah', 1)->first();
|
||||
$simulasi = Simulasi::where('id', '=', $id)->where('tagujrah', 1)->first();
|
||||
// dd($role);
|
||||
$simulasi->delete();
|
||||
|
||||
return redirect()->route('lelong.senarailelong')
|
||||
->with('success','Pendaftaran Lelong Berjaya');
|
||||
->with('success', 'Pendaftaran Lelong Berjaya');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,18 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Pengesahan;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\LelongBid;
|
||||
use Hash;
|
||||
// use Auth;
|
||||
|
||||
class LogoutController extends Controller
|
||||
@@ -34,8 +24,10 @@ class LogoutController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function logout(Request $request) {
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
|
||||
return redirect()->route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\notislelong;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use App\Models\User;
|
||||
|
||||
class MailController extends Controller {
|
||||
|
||||
public function sendEmail() {
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\notislelong;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class MailController extends Controller
|
||||
{
|
||||
public function sendEmail()
|
||||
{
|
||||
|
||||
$users = User::where('user_type', 2)
|
||||
->get();
|
||||
->get();
|
||||
|
||||
foreach($users as $user)
|
||||
{
|
||||
foreach ($users as $user) {
|
||||
$email = $user->email;
|
||||
|
||||
|
||||
$mailData = [
|
||||
'title' => 'Notis Lelongan Gadaian',
|
||||
'url' => 'https://www.positronx.io' // show unpaid gadaian
|
||||
'url' => 'https://www.positronx.io', // show unpaid gadaian
|
||||
];
|
||||
|
||||
|
||||
Mail::to($email)->send(new notislelong($mailData));
|
||||
}
|
||||
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Email has been sent.'
|
||||
'message' => 'Email has been sent.',
|
||||
], Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,19 +2,18 @@
|
||||
|
||||
namespace App\Http\Controllers\Mobile;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmailVerificationController extends Controller
|
||||
{
|
||||
|
||||
public function sendVerificationEmail(Request $request)
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return [
|
||||
'message' => 'Already Verified'
|
||||
'message' => 'Already Verified',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ class EmailVerificationController extends Controller
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return [
|
||||
'message' => 'Email already verified'
|
||||
'message' => 'Email already verified',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -36,7 +35,7 @@ class EmailVerificationController extends Controller
|
||||
}
|
||||
|
||||
return [
|
||||
'message'=>'Email has been verified'
|
||||
'message' => 'Email has been verified',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,15 @@ class ForgotPasswordController extends Controller
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
|
||||
protected function sendResetLinkResponse(Request $request, $response)
|
||||
{
|
||||
return response(['message'=> $response]);
|
||||
return response(['message' => $response]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function sendResetLinkFailedResponse(Request $request, $response)
|
||||
{
|
||||
return response(['error'=> $response], 422);
|
||||
return response(['error' => $response], 422);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,14 +23,12 @@ class ResetPasswordController extends Controller
|
||||
|
||||
protected function sendResetResponse(Request $request, $response)
|
||||
{
|
||||
return response(['message'=> trans($response)]);
|
||||
return response(['message' => trans($response)]);
|
||||
|
||||
}
|
||||
|
||||
protected function sendResetFailedResponse(Request $request, $response)
|
||||
{
|
||||
return response(['error'=> trans($response)], 422);
|
||||
return response(['error' => trans($response)], 422);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,37 +4,38 @@ namespace App\Http\Controllers\Mobile;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\TacCode;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function getProfileUser(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => [$user]
|
||||
'message' => [$user],
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized'
|
||||
'message' => 'Unauthorized',
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
public function updateProfileUser(Request $request){
|
||||
|
||||
public function updateProfileUser(Request $request)
|
||||
{
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nokp' => 'required'
|
||||
'nokp' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
@@ -43,16 +44,16 @@ class UserController extends Controller
|
||||
|
||||
$currentdate = Carbon::now()->toDateTimeString();
|
||||
|
||||
$user_update = User::where('nokp','=',$request->nokp)
|
||||
->update([
|
||||
'bank_acc_pembeli' => $request->bank_acc_pembeli,
|
||||
'bank_acc_no_pembeli' => $request->bank_acc_no_pembeli,
|
||||
'alamat' => $request->alamat,
|
||||
'notelbimbit' => $request->notelbimbit,
|
||||
'notelpejabat' => $request->notelpejabat,
|
||||
'email' => $request->email,
|
||||
'updated_at' => $currentdate
|
||||
]);
|
||||
$user_update = User::where('nokp', '=', $request->nokp)
|
||||
->update([
|
||||
'bank_acc_pembeli' => $request->bank_acc_pembeli,
|
||||
'bank_acc_no_pembeli' => $request->bank_acc_no_pembeli,
|
||||
'alamat' => $request->alamat,
|
||||
'notelbimbit' => $request->notelbimbit,
|
||||
'notelpejabat' => $request->notelpejabat,
|
||||
'email' => $request->email,
|
||||
'updated_at' => $currentdate,
|
||||
]);
|
||||
|
||||
return response()->json($user_update);
|
||||
}
|
||||
@@ -70,36 +71,37 @@ class UserController extends Controller
|
||||
'string' => [
|
||||
'status' => 3,
|
||||
'message' => 'Kata laluan baharu mestilah melebihi 8 karakter.',
|
||||
]
|
||||
],
|
||||
],
|
||||
'confirm_new_password.required' => ['status' => '4', 'message' => 'Sila isi pengesahan kata laluan baharu.'],
|
||||
'confirm_new_password.min' => [
|
||||
'string' => [
|
||||
'status' => 5,
|
||||
'message' => 'Pengesahan kata laluan baharu mestilah melebihi 8 karakter.',
|
||||
]
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$all_errors = [
|
||||
'success' => false,
|
||||
'message' => $validator->errors()
|
||||
'message' => $validator->errors(),
|
||||
];
|
||||
|
||||
return response($all_errors, 201);
|
||||
}
|
||||
|
||||
if (!(Hash::check($request->get('current_password'), Auth::user()->password))) {
|
||||
if (! (Hash::check($request->get('current_password'), Auth::user()->password))) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => [
|
||||
'current_password' => [
|
||||
0 => [
|
||||
'status' => 9,
|
||||
'message' => 'Kata laluan asal salah.'
|
||||
]
|
||||
]
|
||||
]
|
||||
'message' => 'Kata laluan asal salah.',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -110,10 +112,10 @@ class UserController extends Controller
|
||||
'current_password' => [
|
||||
0 => [
|
||||
'status' => 8,
|
||||
'message' => 'Kata laluan baharu tidak boleh sama dengan kata laluan asal.'
|
||||
]
|
||||
]
|
||||
]
|
||||
'message' => 'Kata laluan baharu tidak boleh sama dengan kata laluan asal.',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -124,10 +126,10 @@ class UserController extends Controller
|
||||
'current_password' => [
|
||||
0 => [
|
||||
'status' => 12,
|
||||
'message' => 'Kata laluan baharu tidak sama dengan pengesahan kata laluan baharu.'
|
||||
]
|
||||
]
|
||||
]
|
||||
'message' => 'Kata laluan baharu tidak sama dengan pengesahan kata laluan baharu.',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ class UserController extends Controller
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'status' => 55,
|
||||
'message' => 'Kata laluan berjaya diubah'
|
||||
'message' => 'Kata laluan berjaya diubah',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -152,7 +154,7 @@ class UserController extends Controller
|
||||
$date = $current->toDateTimeString();
|
||||
$current_date = strtotime($date);
|
||||
$future_date = $current_date + (60 * 2);
|
||||
$expired_date_formated = date("Y-m-d H:i:s", $future_date);
|
||||
$expired_date_formated = date('Y-m-d H:i:s', $future_date);
|
||||
|
||||
$tac_code = rand(100000, 999999);
|
||||
|
||||
@@ -164,7 +166,7 @@ class UserController extends Controller
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'The phone number already request for tac code. Please wait 2 minute from request time for the session to end.',
|
||||
'response' => $check_status_phone_number
|
||||
'response' => $check_status_phone_number,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -173,11 +175,11 @@ class UserController extends Controller
|
||||
'apipassword' => config('app.one_way_sms_password'),
|
||||
'senderid' => 'INFO',
|
||||
'mobileno' => $request->phone_number,
|
||||
'message' => '[ArrahnBid]: '. $tac_code .' is your TAC code. The code is valid for 2 minutes.',
|
||||
'languagetype' => 1
|
||||
'message' => '[ArrahnBid]: '.$tac_code.' is your TAC code. The code is valid for 2 minutes.',
|
||||
'languagetype' => 1,
|
||||
]);
|
||||
|
||||
$tac_code_model = new TacCode();
|
||||
$tac_code_model = new TacCode;
|
||||
$tac_code_model->tac_code = Hash::make($tac_code);
|
||||
$tac_code_model->phone_number = $request->phone_number;
|
||||
$tac_code_model->case_code = 1;
|
||||
@@ -214,7 +216,7 @@ class UserController extends Controller
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Update successful!',
|
||||
'user' => $user
|
||||
'user' => $user,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\Mobile;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
@@ -45,14 +45,13 @@ class VerificationController extends Controller
|
||||
/**
|
||||
* Resend the email verification notification.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function resend(Request $request)
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
|
||||
return response(['message'=>'Already verified']);
|
||||
return response(['message' => 'Already verified']);
|
||||
}
|
||||
|
||||
$request->user()->sendEmailVerificationNotification();
|
||||
@@ -64,12 +63,11 @@ class VerificationController extends Controller
|
||||
return back()->with('resent', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark the authenticated user's email address as verified.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function verify(Request $request)
|
||||
@@ -82,7 +80,7 @@ class VerificationController extends Controller
|
||||
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
|
||||
return response(['message'=>'Already verified']);
|
||||
return response(['message' => 'Already verified']);
|
||||
|
||||
// return redirect($this->redirectPath());
|
||||
}
|
||||
@@ -91,9 +89,7 @@ class VerificationController extends Controller
|
||||
event(new Verified($request->user()));
|
||||
}
|
||||
|
||||
return response(['message'=>'Successfully verified']);
|
||||
return response(['message' => 'Successfully verified']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1037
-1119
File diff suppressed because it is too large
Load Diff
@@ -2,26 +2,25 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Resit;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\FileResit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidder;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\Payment;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use App\Models\FileResit;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PayDenoKaunter;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Resit;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
public function SenaraiLelongBayar(Request $request){
|
||||
public function SenaraiLelongBayar(Request $request)
|
||||
{
|
||||
|
||||
$arrayinfo = [];
|
||||
$arraysms = [];
|
||||
@@ -30,93 +29,91 @@ class PaymentController extends Controller
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$lelong = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->join('cawangan','cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->select('lelong.fasa','lelong_id','tarikh_lelong','lelong.masatamat_lelong','harga_emas_asas','jbg','cajlelong','sts_lelong')
|
||||
->where('lelong.sts_lelong', 3)
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->groupBy('lelong_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
|
||||
foreach($lelong as $info)
|
||||
{
|
||||
$detailsinfo = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$info['lelong_id'])
|
||||
->where('cawangan.caw_code',$user->kodcaw)
|
||||
$lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id')
|
||||
->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->select('lelong.fasa', 'lelong_id', 'tarikh_lelong', 'lelong.masatamat_lelong', 'harga_emas_asas', 'jbg', 'cajlelong', 'sts_lelong')
|
||||
->where('lelong.sts_lelong', 3)
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->groupBy('lelong_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
if($info['tarikh_lelong'] == $tarikh_semasa)
|
||||
{
|
||||
array_push($arraysms,['info'=>$info, 'detailsinfo'=>$detailsinfo]);
|
||||
foreach ($lelong as $info) {
|
||||
$detailsinfo = CawanganLelong::join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong_id', $info['lelong_id'])
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
if ($info['tarikh_lelong'] == $tarikh_semasa) {
|
||||
array_push($arraysms, ['info' => $info, 'detailsinfo' => $detailsinfo]);
|
||||
} else {
|
||||
array_push($arraysls,['info'=>$info, 'detailsinfo'=>$detailsinfo]);
|
||||
array_push($arraysls, ['info' => $info, 'detailsinfo' => $detailsinfo]);
|
||||
}
|
||||
// array_push($arrayinfo,['info'=>$info, 'detailsinfo'=>$detailsinfo]);
|
||||
// dd($detailsinfo);
|
||||
}
|
||||
$datacaw = Cawangan::where('caw_code','=', $user->kodcaw)
|
||||
->get();
|
||||
$datacaw = Cawangan::where('caw_code', '=', $user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('pembayaran.senarailelongbayaran',compact('arraysms','arraysls','datacaw','lelong', 'arrayinfo'));
|
||||
return view('pembayaran.senarailelongbayaran', compact('arraysms', 'arraysls', 'datacaw', 'lelong', 'arrayinfo'));
|
||||
|
||||
}
|
||||
|
||||
public function SenaraiPemenang($lelong_id){
|
||||
public function SenaraiPemenang($lelong_id)
|
||||
{
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$listwinner = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.user_id')
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.user_id')
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
|
||||
foreach($listwinner as $index1=>$winner){
|
||||
foreach ($listwinner as $index1 => $winner) {
|
||||
|
||||
$userdetails = User::where('id', $winner['user_id'])->first();
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($userdetails);
|
||||
|
||||
$sts_payment = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.status_payment')
|
||||
->get();
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.status_payment')
|
||||
->get();
|
||||
// dd($sts_payment[0]['status_payment']);
|
||||
|
||||
$payment_id = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('payment_id')->groupBy('payment_id')->get();
|
||||
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('payment_id')->groupBy('payment_id')->get();
|
||||
|
||||
$total_payment = 0;
|
||||
foreach($payment_id as $id){
|
||||
foreach ($payment_id as $id) {
|
||||
$payment = Payment::where('id', $id->payment_id)
|
||||
->first();
|
||||
->first();
|
||||
// dd($payment);
|
||||
|
||||
if($payment){
|
||||
if ($payment) {
|
||||
$total_payment = $total_payment + $payment->total_payment;
|
||||
}
|
||||
}
|
||||
// dd($total_payment);
|
||||
|
||||
$listwinner[$index1]['details'] = $userdetails;
|
||||
$listwinner[$index1]['total_surat'] = sizeof($SAGWin);
|
||||
$listwinner[$index1]['total_surat'] = count($SAGWin);
|
||||
$listwinner[$index1]['totalBid'] = $SAGWin->sum('hargabida');
|
||||
$listwinner[$index1]['totalPay'] = $total_payment;
|
||||
$listwinner[$index1]['sts_payment'] = $sts_payment[0]['status_payment'];
|
||||
@@ -124,12 +121,12 @@ class PaymentController extends Controller
|
||||
|
||||
}
|
||||
$sum = 0;
|
||||
$kaedah = Payment::where('kodcaw',$user->kodcaw)
|
||||
->where('status', '=', 2)
|
||||
->where('lelong_id', $lelong_id)
|
||||
->select('payment.status_payment_opt', 'payment.total_payment')
|
||||
$kaedah = Payment::where('kodcaw', $user->kodcaw)
|
||||
->where('status', '=', 2)
|
||||
->where('lelong_id', $lelong_id)
|
||||
->select('payment.status_payment_opt', 'payment.total_payment')
|
||||
// ->groupBy('payment.status_payment_opt')
|
||||
->get();
|
||||
->get();
|
||||
$kaedah_cdm = $kaedah->where('status_payment_opt', 3)->sum('total_payment');
|
||||
$kaedah_fpx = $kaedah->where('status_payment_opt', 2)->sum('total_payment');
|
||||
$kaedah_tunai = $kaedah->where('status_payment_opt', 1)->sum('total_payment');
|
||||
@@ -138,125 +135,123 @@ class PaymentController extends Controller
|
||||
$bilfpx = $kaedah->where('status_payment_opt', 2)->count('norujukan');
|
||||
$biltunai = $kaedah->where('status_payment_opt', 1)->count('norujukan');
|
||||
|
||||
$datacaw = Cawangan::where('caw_code','=', $user->kodcaw)
|
||||
->get();
|
||||
$datacaw = Cawangan::where('caw_code', '=', $user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('pembayaran.kaunterpembayaran',compact('bilcdm','bilfpx','biltunai','datacaw','listwinner','lelong_id','kaedah_cdm','kaedah_fpx','kaedah_tunai'));
|
||||
return view('pembayaran.kaunterpembayaran', compact('bilcdm', 'bilfpx', 'biltunai', 'datacaw', 'listwinner', 'lelong_id', 'kaedah_cdm', 'kaedah_fpx', 'kaedah_tunai'));
|
||||
|
||||
}
|
||||
|
||||
public function SAGBidItem($user_id, $lelong_id){
|
||||
public function SAGBidItem($user_id, $lelong_id)
|
||||
{
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$SAGBidItem = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select(
|
||||
'users.id',
|
||||
'users.name',
|
||||
'users.nokp',
|
||||
'users.alamat',
|
||||
'users.notelbimbit'
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select(
|
||||
'users.id',
|
||||
'users.name',
|
||||
'users.nokp',
|
||||
'users.alamat',
|
||||
'users.notelbimbit'
|
||||
)
|
||||
->first();
|
||||
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
->first();
|
||||
|
||||
foreach($eachbid as $bid)
|
||||
{
|
||||
// dd($bid);
|
||||
$paymentstatus = Payment::where('lelong_id', $lelong_id)
|
||||
->where('user_id', $bid['user_id'])
|
||||
->where('status', 2)
|
||||
->where('status_payment_opt', 2)
|
||||
->orWhere('status_payment_opt', 3)
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
|
||||
if($paymentstatus)
|
||||
{
|
||||
foreach ($eachbid as $bid) {
|
||||
// dd($bid);
|
||||
$paymentstatus = Payment::where('lelong_id', $lelong_id)
|
||||
->where('user_id', $bid['user_id'])
|
||||
->where('status', 2)
|
||||
->where('status_payment_opt', 2)
|
||||
->orWhere('status_payment_opt', 3)
|
||||
->get();
|
||||
|
||||
if ($paymentstatus) {
|
||||
$total_payment = 0;
|
||||
foreach($paymentstatus as $index1=>$payemnt)
|
||||
{
|
||||
foreach ($paymentstatus as $index1 => $payemnt) {
|
||||
$payment = Payment::where('id', $payemnt->payment_id)
|
||||
->first();
|
||||
|
||||
if($payment){
|
||||
->first();
|
||||
|
||||
if ($payment) {
|
||||
$total_payment = $total_payment + $payment->total_payment;
|
||||
}
|
||||
$listwinner[$index1]['totalPay'] = $total_payment;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// dd();
|
||||
}
|
||||
$statuspayment = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment',
|
||||
'lelongbid.opencash'
|
||||
)
|
||||
->first();
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment',
|
||||
'lelongbid.opencash'
|
||||
)
|
||||
->first();
|
||||
$getresit = FileResit::join('payment', 'fileresit.payment_id', '=', 'payment.id')
|
||||
->where('payment.lelong_id', $lelong_id)
|
||||
->where('payment.user_id', $user_id)
|
||||
->get()->toArray();
|
||||
->where('payment.lelong_id', $lelong_id)
|
||||
->where('payment.user_id', $user_id)
|
||||
->get()->toArray();
|
||||
// dd($getresit);
|
||||
|
||||
$getinvoice = Invoice::where('lelong_id',$lelong_id)
|
||||
->where('user_id','=',$user_id)
|
||||
->first();
|
||||
$getinvoice = Invoice::where('lelong_id', $lelong_id)
|
||||
->where('user_id', '=', $user_id)
|
||||
->first();
|
||||
|
||||
$totalbidaan = $eachbid->SUM('hargabida');
|
||||
|
||||
$array_resit = [];
|
||||
foreach($getresit as $index1=>$resit)
|
||||
{
|
||||
$getresit[$index1]['resit64'] = 'data:image/' . $resit['file_type'] . ';base64' . base64_encode($resit['filename']);
|
||||
foreach ($getresit as $index1 => $resit) {
|
||||
$getresit[$index1]['resit64'] = 'data:image/'.$resit['file_type'].';base64'.base64_encode($resit['filename']);
|
||||
}
|
||||
$datacaw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->get();
|
||||
$datacaw = Cawangan::where('caw_code', '=', $user->kodcaw)
|
||||
->get();
|
||||
|
||||
return view('pembayaran.SAGBidItem',compact('statuspayment','datacaw','SAGBidItem', 'eachbid', 'lelong_id','user_id', 'getresit','getinvoice','totalbidaan'));
|
||||
return view('pembayaran.SAGBidItem', compact('statuspayment', 'datacaw', 'SAGBidItem', 'eachbid', 'lelong_id', 'user_id', 'getresit', 'getinvoice', 'totalbidaan'));
|
||||
}
|
||||
|
||||
public function paymentdenokaunter(Request $request){
|
||||
|
||||
public function paymentdenokaunter(Request $request)
|
||||
{
|
||||
|
||||
// dd($request->all());
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$current = new Carbon;
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
$year = $current->format('y');
|
||||
|
||||
$user = Auth::user();
|
||||
$total_hargabida = 0;
|
||||
@@ -268,35 +263,34 @@ class PaymentController extends Controller
|
||||
// $norujukanid = implode(",", $request->norujukan);
|
||||
// $norujukan_id = explode(",", $norujukanid);
|
||||
|
||||
|
||||
// dd($eachbid);
|
||||
|
||||
$getinvoice = Invoice::where('lelong_id',$request->lelong_id)
|
||||
->where('user_id','=',$request->user_id)
|
||||
->first();
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
$getinvoice = Invoice::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id', '=', $request->user_id)
|
||||
->first();
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelong_id = $request->lelong_id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->invoice_id = $getinvoice->id;
|
||||
$resit->invoice_no = $getinvoice->invoice_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = $request->amaunkiraan;
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit->save();
|
||||
|
||||
//adddenokaunter
|
||||
$previous_siri = Resit::orderBy('id', 'desc')->first();
|
||||
|
||||
if ($previous_siri) {
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
} else {
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$reference_no = 'LPKB'.$day.$month.$year.sprintf('%08d', $nosiri);
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelong_id = $request->lelong_id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->invoice_id = $getinvoice->id;
|
||||
$resit->invoice_no = $getinvoice->invoice_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = $request->amaunkiraan;
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit->save();
|
||||
|
||||
// adddenokaunter
|
||||
$paymentdeno = PayDenoKaunter::create([
|
||||
'user_id' => $request->user_id,
|
||||
'lelong_id' => $request->lelong_id,
|
||||
@@ -319,50 +313,47 @@ class PaymentController extends Controller
|
||||
'rm50' => $request->ambilanring50,
|
||||
'rm100' => $request->ambilanring100,
|
||||
'disahkan_oleh' => $user->id,
|
||||
'disahkan_pada' => $currentdate
|
||||
'disahkan_pada' => $currentdate,
|
||||
]);
|
||||
|
||||
|
||||
$sagmenang = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbid.status_jual', 1)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
|
||||
// dd($sagmenang);
|
||||
|
||||
|
||||
foreach($sagmenang as $index1=>$bid)
|
||||
{
|
||||
// dd($bid->lelongbid_id);
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid->lelongbid_id)
|
||||
->where('lelongbid.status_jual', 1)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.kodcaw',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
'lelongbidder.user_id',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
|
||||
// dd($sagmenang);
|
||||
|
||||
foreach ($sagmenang as $index1 => $bid) {
|
||||
// dd($bid->lelongbid_id);
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid->lelongbid_id)
|
||||
->where('lelongbid.status_jual', 1)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.kodcaw',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
// dd($eachbid);
|
||||
|
||||
|
||||
$total_hargabida = $total_hargabida + $eachbid->hargabida;
|
||||
|
||||
$payment = Payment::create([
|
||||
@@ -378,20 +369,17 @@ class PaymentController extends Controller
|
||||
'resit_id' => $resit->id,
|
||||
'total_payment' => $eachbid->hargabida,
|
||||
'disahkan_oleh' => $user->id,
|
||||
'disahkan_pada' => $currentdate
|
||||
'disahkan_pada' => $currentdate,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->first();
|
||||
->where('user_id', $request->user_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 1;
|
||||
$updatelelbidbidder->payment_id = $payment->id;
|
||||
$updatelelbidbidder->save();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id',$bid->lelongbid_id)->first();
|
||||
$eachbidupdate = LelongBid::where('id', $bid->lelongbid_id)->first();
|
||||
$eachbidupdate->status_jual = 1;
|
||||
$eachbidupdate->status_payment = '1';
|
||||
// $eachbidupdate->t_jual = $currentdate;
|
||||
@@ -399,18 +387,16 @@ class PaymentController extends Controller
|
||||
$eachbidupdate->save();
|
||||
|
||||
}
|
||||
|
||||
$senaraisagallpayment = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->get();
|
||||
|
||||
if(floatval($request->amaunkiraan) == $total_hargabida)
|
||||
{
|
||||
$senaraisagallpayment = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->get();
|
||||
|
||||
if (floatval($request->amaunkiraan) == $total_hargabida) {
|
||||
$resit->total_payment = $request->amaunkiraan;
|
||||
if($resit->total_payment >= $senaraisagallpayment->sum('hargabida'))
|
||||
{
|
||||
if ($resit->total_payment >= $senaraisagallpayment->sum('hargabida')) {
|
||||
$resit->status = 'PAID'; // $resit->status = 'PAID'; when hargabida >= total_payment di resit
|
||||
$resit->paid_at = $currentdate;
|
||||
}
|
||||
@@ -419,54 +405,54 @@ class PaymentController extends Controller
|
||||
|
||||
// return redirect()->route('pembayaran.SenaraiLelongBayar')->with('success','Pembayaran Berjaya');
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $request->lelong_id)
|
||||
->with('success','Pembayaran Berjaya');
|
||||
->with('success', 'Pembayaran Berjaya');
|
||||
|
||||
}
|
||||
|
||||
public function pengesahanPembayaran(Request $request){
|
||||
public function pengesahanPembayaran(Request $request)
|
||||
{
|
||||
|
||||
// dd($request->all());
|
||||
|
||||
$pengesahanPembayaran = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->get();
|
||||
|
||||
return view('pembayaran.pengesahanPembayaran',compact('pengesahanPembayaran'));
|
||||
$pengesahanPembayaran = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->get();
|
||||
|
||||
return view('pembayaran.pengesahanPembayaran', compact('pengesahanPembayaran'));
|
||||
}
|
||||
|
||||
public function banktransfer(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
//eachbid = lelongbid_id
|
||||
// eachbid = lelongbid_id
|
||||
// $bid_id = implode(",", $request->eachbid);
|
||||
// dd($bid_id);
|
||||
|
||||
$paymentexist = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->first();
|
||||
|
||||
if($paymentexist)
|
||||
{
|
||||
$getpayment = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->select('payment.id as payment_id',
|
||||
'payment.lelong_id',
|
||||
'payment.user_id',
|
||||
'fileresit.id as fileresit_id',
|
||||
'fileresit.file_type',
|
||||
'fileresit.filename'
|
||||
)
|
||||
->first();
|
||||
|
||||
if ($paymentexist) {
|
||||
$getpayment = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->select('payment.id as payment_id',
|
||||
'payment.lelong_id',
|
||||
'payment.user_id',
|
||||
'fileresit.id as fileresit_id',
|
||||
'fileresit.file_type',
|
||||
'fileresit.filename'
|
||||
)
|
||||
->first();
|
||||
|
||||
$data = base64_encode($request->resit->get());
|
||||
$file_type = $request->resit->extension();
|
||||
|
||||
|
||||
$updatepayment = FileResit::where('payment_id', $getpayment['payment_id'])
|
||||
->where('id', $getpayment['fileresit_id'])
|
||||
->first();
|
||||
->where('id', $getpayment['fileresit_id'])
|
||||
->first();
|
||||
$updatepayment->user_id = $request->user_id;
|
||||
$updatepayment->payment_id = $updatepayment->payment_id;
|
||||
$updatepayment->file_type = $file_type;
|
||||
@@ -474,27 +460,25 @@ class PaymentController extends Controller
|
||||
$updatepayment->update();
|
||||
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $request->lelong_id)
|
||||
->with('success','Ubah Resit Berjaya, Tunggu Pengesahan Akaun');
|
||||
}
|
||||
else
|
||||
{
|
||||
->with('success', 'Ubah Resit Berjaya, Tunggu Pengesahan Akaun');
|
||||
} else {
|
||||
// $bid_id = $request->eachbid;
|
||||
$bidid = implode(",", $request->eachbid);
|
||||
$bid_id = explode(",", $bidid);
|
||||
$bidid = implode(',', $request->eachbid);
|
||||
$bid_id = explode(',', $bidid);
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
|
||||
// $imageName = time().'.'.$request->resit->extension();
|
||||
$data = base64_encode($request->resit->get());
|
||||
$file_type = $request->resit->extension();
|
||||
|
||||
|
||||
$resit = Resit::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->where('resit_type', 2)
|
||||
->first();
|
||||
|
||||
->where('user_id', $request->user_id)
|
||||
->where('resit_type', 2)
|
||||
->first();
|
||||
|
||||
$payment = new Payment;
|
||||
$payment->user_id = $request->user_id;
|
||||
$payment->lelong_id = $request->lelong_id;
|
||||
@@ -507,44 +491,42 @@ class PaymentController extends Controller
|
||||
$payment->diminta_pada = $currentdate;
|
||||
$payment->diminta_oleh = $user->id;
|
||||
$payment->save();
|
||||
|
||||
|
||||
$addfile = new FileResit;
|
||||
$addfile->user_id = $request->user_id;
|
||||
$addfile->payment_id = $payment->id;
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
$addfile->save();
|
||||
|
||||
foreach($bid_id as $bid)
|
||||
{
|
||||
|
||||
foreach ($bid_id as $bid) {
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->first();
|
||||
->where('user_id', $request->user_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 2;
|
||||
$updatelelbidbidder->payment_id = $payment->id;
|
||||
$updatelelbidbidder->save();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id',$bid)->first();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id', $bid)->first();
|
||||
$eachbidupdate->hargajual = $eachbid->hargabida;
|
||||
$eachbidupdate->save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $request->lelong_id)
|
||||
->with('success','Menunggu Pengesahan Akaun');
|
||||
->with('success', 'Menunggu Pengesahan Akaun');
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,16 +2,15 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PDF;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class PenggunaController extends Controller
|
||||
{
|
||||
@@ -33,108 +32,105 @@ class PenggunaController extends Controller
|
||||
public function index()
|
||||
{
|
||||
// $alluser = User::all();
|
||||
$alluser = User::with('roles','cawangan')->whereHas("roles", function($q) {
|
||||
$q->where("id",'!=', 8);})
|
||||
->orderBy('name','ASC')
|
||||
$alluser = User::with('roles', 'cawangan')->whereHas('roles', function ($q) {
|
||||
$q->where('id', '!=', 8);
|
||||
})
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// dd($alluser);
|
||||
$allroles = Role::all();
|
||||
$allRolesPluck= $allroles->pluck('name');
|
||||
$allRolesPluck = $allroles->pluck('name');
|
||||
$caw = Cawangan::all();
|
||||
|
||||
// $user = User::with('roles')->first();
|
||||
// // dd($user);
|
||||
// $userroles = $user->getRoleNames()->toArray();
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return view('pengurusanpengguna.index',compact('alluser','allroles','caw', 'allRolesPluck'));
|
||||
return view('pengurusanpengguna.index', compact('alluser', 'allroles', 'caw', 'allRolesPluck'));
|
||||
}
|
||||
|
||||
|
||||
public function show(Request $request, $userid)
|
||||
{
|
||||
// dd($userid);
|
||||
$user = User::where('id','=',$userid)->with('roles','cawangan')->first();
|
||||
$user = User::where('id', '=', $userid)->with('roles', 'cawangan')->first();
|
||||
$userroles = $user->getRoleNames()->toArray();
|
||||
$caw = Cawangan::all();
|
||||
$allroles = Role::all()->pluck('name');
|
||||
|
||||
|
||||
// $active = User::where('id','=',$userid)->update('status', 1);
|
||||
|
||||
return view('pengurusanpengguna.show',compact('user','allroles','userroles','caw'));
|
||||
return view('pengurusanpengguna.show', compact('user', 'allroles', 'userroles', 'caw'));
|
||||
}
|
||||
|
||||
public function storepengguna(Request $request)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
//dd($request->all());
|
||||
// dd($request->all());
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|string|unique:users|email',
|
||||
'username' => 'required|string|unique:users'
|
||||
'username' => 'required|string|unique:users',
|
||||
]);
|
||||
|
||||
|
||||
// if ($validator->fails()) {
|
||||
// $errors = [
|
||||
// 'success' => "error",
|
||||
// 'message' => $validator->errors()
|
||||
|
||||
|
||||
// ];
|
||||
|
||||
// return redirect()->route('pengguna.index')
|
||||
// ->with('message', 'Sila Masukkan Email Yang Sah'); }
|
||||
|
||||
//check if user already existed
|
||||
$check = User::where('username',$request->username)
|
||||
->orWhere('email',$request->email)
|
||||
// check if user already existed
|
||||
$check = User::where('username', $request->username)
|
||||
->orWhere('email', $request->email)
|
||||
->first();
|
||||
|
||||
if($check)
|
||||
{
|
||||
return redirect()->route('pengguna.index')->with('failed','Maaf, Nama Pengguna / Emel Berikut Telah Wujud !');
|
||||
} else {
|
||||
if ($check) {
|
||||
return redirect()->route('pengguna.index')->with('failed', 'Maaf, Nama Pengguna / Emel Berikut Telah Wujud !');
|
||||
} else {
|
||||
|
||||
$allroles = Role::all()->pluck('name');
|
||||
$arraytaraf = [];
|
||||
$counttaraf = 0;
|
||||
foreach($allroles as $index=>$taraf) {
|
||||
$req = 'taraf'.$taraf;
|
||||
if($request->$req)
|
||||
{
|
||||
$counttaraf++;
|
||||
array_push($arraytaraf,$taraf);
|
||||
}
|
||||
$allroles = Role::all()->pluck('name');
|
||||
$arraytaraf = [];
|
||||
$counttaraf = 0;
|
||||
foreach ($allroles as $index => $taraf) {
|
||||
$req = 'taraf'.$taraf;
|
||||
if ($request->$req) {
|
||||
$counttaraf++;
|
||||
array_push($arraytaraf, $taraf);
|
||||
}
|
||||
if($counttaraf < 1){
|
||||
return redirect()->route('pengguna.index')->with('failed','Maaf, Taraf Tidak Dipilih');
|
||||
}
|
||||
|
||||
$user = new User;
|
||||
$user->name = $request->name;
|
||||
$user->username = $request->username;
|
||||
$user->kodcaw = $request->caw;
|
||||
$user->notelbimbit = $request->notelbimbit;
|
||||
$user->status = 'active';
|
||||
$user->t_daftar = $currentdate;
|
||||
$user->email = $request->email;
|
||||
$user->email_verified_at = $currentdate;
|
||||
$user->password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; //password
|
||||
if($arraytaraf[0] == 'ajk'){
|
||||
$user->user_type = 3;
|
||||
}
|
||||
else{
|
||||
$user->user_type = 1;
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
$user->syncRoles($arraytaraf);
|
||||
return redirect()->route('pengguna.index')
|
||||
->with('success', 'Pengguna Berjaya Disimpan');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($counttaraf < 1) {
|
||||
return redirect()->route('pengguna.index')->with('failed', 'Maaf, Taraf Tidak Dipilih');
|
||||
}
|
||||
|
||||
$user = new User;
|
||||
$user->name = $request->name;
|
||||
$user->username = $request->username;
|
||||
$user->kodcaw = $request->caw;
|
||||
$user->notelbimbit = $request->notelbimbit;
|
||||
$user->status = 'active';
|
||||
$user->t_daftar = $currentdate;
|
||||
$user->email = $request->email;
|
||||
$user->email_verified_at = $currentdate;
|
||||
$user->password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; // password
|
||||
if ($arraytaraf[0] == 'ajk') {
|
||||
$user->user_type = 3;
|
||||
} else {
|
||||
$user->user_type = 1;
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
$user->syncRoles($arraytaraf);
|
||||
|
||||
return redirect()->route('pengguna.index')
|
||||
->with('success', 'Pengguna Berjaya Disimpan');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
@@ -142,39 +138,34 @@ class PenggunaController extends Controller
|
||||
// dd($request->all());
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$user = User::where('id','=',$request->userid)->first();
|
||||
|
||||
$user = User::where('id', '=', $request->userid)->first();
|
||||
$allroles = Role::all()->pluck('name');
|
||||
// dd($user);
|
||||
$arraytaraf = [];
|
||||
foreach($allroles as $index=>$taraf) {
|
||||
foreach ($allroles as $index => $taraf) {
|
||||
$req = 'taraf'.$taraf;
|
||||
// dd($req);
|
||||
if($request->$req)
|
||||
{
|
||||
array_push($arraytaraf,$taraf);
|
||||
if ($request->$req) {
|
||||
array_push($arraytaraf, $taraf);
|
||||
}
|
||||
}
|
||||
// dd($arraytaraf);
|
||||
$user->syncRoles($arraytaraf);
|
||||
|
||||
if($request->status == true)
|
||||
{
|
||||
if ($request->status == true) {
|
||||
$status = 'active';
|
||||
}
|
||||
else if($request->statusban == true)
|
||||
{
|
||||
} elseif ($request->statusban == true) {
|
||||
$status = 'banned';
|
||||
}
|
||||
// else if(!($request->has('status'))){
|
||||
// $status = 'active';
|
||||
// }
|
||||
else
|
||||
{
|
||||
else {
|
||||
$status = 'inactive';
|
||||
}
|
||||
|
||||
$user = User::where('id','=',$request->userid)->first();
|
||||
$user = User::where('id', '=', $request->userid)->first();
|
||||
// dd($request->caw);
|
||||
$user->name = $request->name;
|
||||
$user->email = $request->emel;
|
||||
@@ -184,84 +175,86 @@ class PenggunaController extends Controller
|
||||
// $user->nokp = $request->nokp;
|
||||
$user->updated_at = $currentdate;
|
||||
$user->status = $status;
|
||||
|
||||
|
||||
$user->save();
|
||||
|
||||
return redirect()->route('pengguna.index')
|
||||
->with('success','Kemaskini Berjaya');
|
||||
->with('success', 'Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function delete($userid)
|
||||
{
|
||||
$user = User::where('id','=',$userid)->first();
|
||||
$user = User::where('id', '=', $userid)->first();
|
||||
$allrolesuser = $user->getRoleNames();
|
||||
foreach($allrolesuser as $index=>$role)
|
||||
{
|
||||
foreach ($allrolesuser as $index => $role) {
|
||||
$user->removeRole($role);
|
||||
}
|
||||
$user->delete();
|
||||
|
||||
return redirect()->route('pengguna.index')
|
||||
->with('success','Padam Pengguna Berjaya');
|
||||
->with('success', 'Padam Pengguna Berjaya');
|
||||
}
|
||||
|
||||
public function taraf() //taraf = roles in db
|
||||
public function taraf() // taraf = roles in db
|
||||
{
|
||||
$arrayrole = [];
|
||||
$arraypermision = [];
|
||||
$roles = Role::all();
|
||||
$permission = Permission::all();
|
||||
|
||||
return view('pengurusanpengguna.taraf',compact('roles','permission'));
|
||||
|
||||
return view('pengurusanpengguna.taraf', compact('roles', 'permission'));
|
||||
}
|
||||
|
||||
public function showtaraf($tarafid)
|
||||
{
|
||||
// dd($tarafname->permissions);
|
||||
$roles = Role::where('id','=',$tarafid)->first();
|
||||
$roles = Role::where('id', '=', $tarafid)->first();
|
||||
$selectedroles = $roles->name;
|
||||
$allpermission = Permission::all()->pluck('name');
|
||||
$userpermission = $roles->permissions->pluck('name')->toArray();
|
||||
|
||||
// dd($roles->permissions->pluck('name'));
|
||||
return view('pengurusanpengguna.showtaraf',compact('selectedroles','allpermission','userpermission'));
|
||||
return view('pengurusanpengguna.showtaraf', compact('selectedroles', 'allpermission', 'userpermission'));
|
||||
}
|
||||
|
||||
public function storetaraf(Request $request) //taraf = roles in db
|
||||
public function storetaraf(Request $request) // taraf = roles in db
|
||||
{
|
||||
$role = Role::where('name','=',$request->namataraf)->first();
|
||||
$role = Role::where('name', '=', $request->namataraf)->first();
|
||||
$allpermission = Permission::all()->pluck('name');
|
||||
|
||||
$arraypermission = [];
|
||||
foreach($allpermission as $index=>$roles) {
|
||||
foreach ($allpermission as $index => $roles) {
|
||||
$req = 'role'.$roles;
|
||||
// dd($req);
|
||||
if($request->$req)
|
||||
{
|
||||
array_push($arraypermission,$roles);
|
||||
if ($request->$req) {
|
||||
array_push($arraypermission, $roles);
|
||||
}
|
||||
}
|
||||
// dd($arraypermission);
|
||||
$role->syncPermissions($arraypermission);
|
||||
|
||||
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return redirect()->route('pengguna.taraf')
|
||||
->with('success','Kemaskini Berjaya');
|
||||
->with('success', 'Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function deletetaraf($tarafid)
|
||||
{
|
||||
$taraf = Role::where('id','=',$tarafid)->first();
|
||||
$taraf = Role::where('id', '=', $tarafid)->first();
|
||||
$taraf->delete();
|
||||
|
||||
return redirect()->route('pengguna.taraf')
|
||||
->with('success','Padam Taraf Berjaya');
|
||||
->with('success', 'Padam Taraf Berjaya');
|
||||
}
|
||||
|
||||
public function roles() //roles = permissions in db
|
||||
public function roles() // roles = permissions in db
|
||||
{
|
||||
$allpermission = Permission::all();
|
||||
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return view('pengurusanpengguna.roles',compact('allpermission'));
|
||||
return view('pengurusanpengguna.roles', compact('allpermission'));
|
||||
}
|
||||
|
||||
public function newrole(Request $request)
|
||||
@@ -269,98 +262,92 @@ class PenggunaController extends Controller
|
||||
// dd($request->all());
|
||||
Permission::create([
|
||||
'name' => $request->name,
|
||||
'description' => $request->keterangan
|
||||
'description' => $request->keterangan,
|
||||
]);
|
||||
|
||||
return redirect()->route('pengguna.roles')
|
||||
->with('success','Role berjaya disimpan');
|
||||
->with('success', 'Role berjaya disimpan');
|
||||
}
|
||||
|
||||
public function showrole($roleid) //roles = permissions in db
|
||||
public function showrole($roleid) // roles = permissions in db
|
||||
{
|
||||
$permission = Permission::where('id','=',$roleid)->first();
|
||||
$permission = Permission::where('id', '=', $roleid)->first();
|
||||
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return view('pengurusanpengguna.showrole',compact('permission'));
|
||||
return view('pengurusanpengguna.showrole', compact('permission'));
|
||||
}
|
||||
|
||||
public function storerole(Request $request)
|
||||
{
|
||||
$role = Permission::where('id','=',$request->idrole)->first();
|
||||
$role = Permission::where('id', '=', $request->idrole)->first();
|
||||
|
||||
return redirect()->route('pengguna.roles')
|
||||
->with('success','Kemaskini Berjaya');
|
||||
->with('success', 'Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function updateroles(Request $request)
|
||||
{
|
||||
$user = User::where('id','=',$request->id);
|
||||
$user = User::where('id', '=', $request->id);
|
||||
$user->syncPermissions($request->arrayroles);
|
||||
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
return redirect()->route('pengguna.roles')
|
||||
->with('success','Tukar Roles Berjaya');
|
||||
->with('success', 'Tukar Roles Berjaya');
|
||||
}
|
||||
|
||||
public function deleterole($roleid)
|
||||
{
|
||||
$role = Permission::where('id','=',$roleid)->first();
|
||||
$role = Permission::where('id', '=', $roleid)->first();
|
||||
$role->delete();
|
||||
|
||||
return redirect()->route('pengguna.roles')
|
||||
->with('success','Padam Roles Berjaya');
|
||||
->with('success', 'Padam Roles Berjaya');
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
if($request->type =='Role' || $request->type =='Permission')
|
||||
{
|
||||
if ($request->type == 'Role' || $request->type == 'Permission') {
|
||||
$model_name = '\\Spatie\\Permission\\Models\\'.$request->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$model_name = '\\App\\Models\\'.$request->type;
|
||||
}
|
||||
|
||||
|
||||
// dd($request->checkboxdata);
|
||||
if($request->checkboxdata)
|
||||
{
|
||||
if($request->type == 'User')
|
||||
{
|
||||
$data = $model_name::whereIn('id',$request->checkboxdata)->with('roles')->get();
|
||||
|
||||
if ($request->checkboxdata) {
|
||||
if ($request->type == 'User') {
|
||||
$data = $model_name::whereIn('id', $request->checkboxdata)->with('roles')->get();
|
||||
|
||||
} else {
|
||||
$data = $model_name::whereIn('id', $request->checkboxdata)->get();
|
||||
}
|
||||
else{
|
||||
$data = $model_name::whereIn('id',$request->checkboxdata)->get();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($request->type == 'User')
|
||||
{
|
||||
} else {
|
||||
if ($request->type == 'User') {
|
||||
// $data = $model_name::with('roles')->get();
|
||||
$data = User::with('roles','cawangan')->whereHas("roles", function($q) {
|
||||
$q->where("id",'!=', 8);})
|
||||
$data = User::with('roles', 'cawangan')->whereHas('roles', function ($q) {
|
||||
$q->where('id', '!=', 8);
|
||||
})
|
||||
->get();
|
||||
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$data = $model_name::all();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// return view('pdf.edit',compact('data')); //page for editing
|
||||
// dd($data);
|
||||
if($request->type =='Role')
|
||||
{
|
||||
$pdf = PDF::loadView('pdf.tarafpdf',compact('data'));
|
||||
// dd($data);
|
||||
if ($request->type == 'Role') {
|
||||
$pdf = PDF::loadView('pdf.tarafpdf', compact('data'));
|
||||
|
||||
return $pdf->download('Taraf.pdf');
|
||||
}
|
||||
elseif($request->type =='User')
|
||||
{
|
||||
} elseif ($request->type == 'User') {
|
||||
// return view('pdf.edit',compact('data')); //page for editing
|
||||
$pdf = PDF::loadView('pdf.penggunapdf',compact('data'));
|
||||
$pdf = PDF::loadView('pdf.penggunapdf', compact('data'));
|
||||
|
||||
return $pdf->download('Pengguna.pdf');
|
||||
}
|
||||
elseif($request->type =='Permission')
|
||||
{
|
||||
return view('pdf.edit',compact('data')); //page for editing
|
||||
} elseif ($request->type == 'Permission') {
|
||||
return view('pdf.edit', compact('data')); // page for editing
|
||||
// $pdf = PDF::loadView('pdf.rolespdf',compact('data'));
|
||||
// return $pdf->download('Roles.pdf');
|
||||
}
|
||||
@@ -368,15 +355,15 @@ class PenggunaController extends Controller
|
||||
|
||||
public function listajk()
|
||||
{
|
||||
$alluser = User::with('roles','cawangan')->whereHas("roles", function($q) {
|
||||
$q->where("name",'=', 'ajk');})
|
||||
->orderBy('name','ASC')
|
||||
$alluser = User::with('roles', 'cawangan')->whereHas('roles', function ($q) {
|
||||
$q->where('name', '=', 'ajk');
|
||||
})
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
$allroles = Role::all();
|
||||
$allRolesPluck= $allroles->pluck('name');
|
||||
$allRolesPluck = $allroles->pluck('name');
|
||||
$caw = Cawangan::all();
|
||||
return view('parameter.listajk',compact('alluser','allroles','caw', 'allRolesPluck'));
|
||||
|
||||
return view('parameter.listajk', compact('alluser', 'allroles', 'caw', 'allRolesPluck'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,31 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use PDF;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\LelongBidder;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidder;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Resit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\FileResit;
|
||||
use App\Models\LelongBidMarhun;
|
||||
|
||||
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use PDF;
|
||||
|
||||
class SerahanController extends Controller
|
||||
{
|
||||
@@ -44,382 +33,358 @@ class SerahanController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
|
||||
public function laporanserahan()
|
||||
{
|
||||
// $user = Auth::user();
|
||||
|
||||
|
||||
|
||||
|
||||
// $lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
||||
// ->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
// ->where('cawangan.caw_code','=',$user->kodcaw)
|
||||
// ->get();
|
||||
|
||||
|
||||
|
||||
// return view('serahan.laporanserahan',compact('lelongid'));
|
||||
$arrayinfo = [];
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$lelong = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->join('cawangan','cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->select('lelong.fasa','lelong_id','tarikh_lelong','lelong.masatamat_lelong','harga_emas_asas','jbg','cajlelong','sts_lelong')
|
||||
->where('lelong.sts_lelong', 3)
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->groupBy('lelong_id')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
|
||||
foreach($lelong as $info)
|
||||
{
|
||||
$detailsinfo = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$info['lelong_id'])
|
||||
->where('cawangan.caw_code',$user->kodcaw)
|
||||
$lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id')
|
||||
->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->select('lelong.fasa', 'lelong_id', 'tarikh_lelong', 'lelong.masatamat_lelong', 'harga_emas_asas', 'jbg', 'cajlelong', 'sts_lelong')
|
||||
->where('lelong.sts_lelong', 3)
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->groupBy('lelong_id')
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo,['info'=>$info, 'detailsinfo'=>$detailsinfo]);
|
||||
|
||||
foreach ($lelong as $info) {
|
||||
$detailsinfo = CawanganLelong::join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong_id', $info['lelong_id'])
|
||||
->where('cawangan.caw_code', $user->kodcaw)
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo, ['info' => $info, 'detailsinfo' => $detailsinfo]);
|
||||
// dd($detailsinfo);
|
||||
}
|
||||
|
||||
return view('serahan.laporanserahan',compact('lelong', 'arrayinfo'));
|
||||
|
||||
return view('serahan.laporanserahan', compact('lelong', 'arrayinfo'));
|
||||
|
||||
}
|
||||
|
||||
public function pembayaran($lelong_id){
|
||||
|
||||
public function pembayaran($lelong_id)
|
||||
{
|
||||
|
||||
$lelong_id = $lelong_id;
|
||||
$user = Auth::user();
|
||||
|
||||
$payment = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.user_id')
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.user_id')
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
|
||||
foreach($payment as $index1=>$winner){
|
||||
foreach ($payment as $index1 => $winner) {
|
||||
|
||||
$userdetails = User::where('id', $winner['user_id'])->first();
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('payment','lelongbidder.payment_id','=','payment.id')
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('lelongbidder.user_id', $winner['user_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
->join('payment', 'lelongbidder.payment_id', '=', 'payment.id')
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.user_id', $winner['user_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
$payment[$index1]['details'] = $userdetails;
|
||||
$payment[$index1]['resit'] = $SAGWin[$index1]['resit_id'];
|
||||
$payment[$index1]['total_surat'] = sizeof($SAGWin);
|
||||
$payment[$index1]['total_surat'] = count($SAGWin);
|
||||
$payment[$index1]['totalBid'] = $SAGWin->sum('hargabida');
|
||||
|
||||
|
||||
}
|
||||
// dd($SAGWin);
|
||||
|
||||
return view('serahan.pembayaran',compact('payment','lelong_id'));
|
||||
return view('serahan.pembayaran', compact('payment', 'lelong_id'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function penyatabayaran($user_id, $lelong_id)
|
||||
|
||||
{
|
||||
{
|
||||
$total_berat = 0;
|
||||
$user = Auth::user();
|
||||
$user = Auth::user();
|
||||
// dd($user_id);
|
||||
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id','=',$user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id',$lelong_id)
|
||||
->first();
|
||||
|
||||
$invois = Invoice::where('lelong_id',$lelong_id)
|
||||
->where('user_id','=',$user_id)
|
||||
->first();
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id', '=', $user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$invois = Invoice::where('lelong_id', $lelong_id)
|
||||
->where('user_id', '=', $user_id)
|
||||
->first();
|
||||
// dd($invois);
|
||||
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw','=',$user->kodcaw)
|
||||
->select('lelongbid.norujukan','lelongbid.id','lelongbid.hargajual')
|
||||
->get();
|
||||
->where('user_id', $user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', '=', $user->kodcaw)
|
||||
->select('lelongbid.norujukan', 'lelongbid.id', 'lelongbid.hargajual')
|
||||
->get();
|
||||
|
||||
foreach($SAGWin as $index1=>$lelong2){
|
||||
foreach ($SAGWin as $index1 => $lelong2) {
|
||||
|
||||
// dd($SAGWin);
|
||||
$marhun= LelongBidMarhun::join('jenisemas','jenisemas.marhun','=','lelongbidmarhun.marhun')
|
||||
->where('lelongbid_id','=',$lelong2['id'])
|
||||
$marhun = LelongBidMarhun::join('jenisemas', 'jenisemas.marhun', '=', 'lelongbidmarhun.marhun')
|
||||
->where('lelongbid_id', '=', $lelong2['id'])
|
||||
// ->where('kodcaw','=',$user['kodcaw'])
|
||||
->get();
|
||||
|
||||
->get();
|
||||
|
||||
$total_berat = $total_berat + ($marhun->sum('berat'));
|
||||
|
||||
$SAGWin[$index1]['detailmarhun']=$marhun;
|
||||
|
||||
|
||||
$SAGWin[$index1]['detailmarhun'] = $marhun;
|
||||
|
||||
}
|
||||
|
||||
$senaraisag = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
// ->where('lelongbid.kodcaw',$caw['caw_code']) buang jap nti check balik
|
||||
->where('lelongbid.kodcaw','=',$user->kodcaw)
|
||||
->where('user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
->where('lelongbid.kodcaw', '=', $user->kodcaw)
|
||||
->where('user_id', $user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($senaraisag);
|
||||
|
||||
$caw['total_berat'] = $senaraisag->sum('berat');
|
||||
$caw['total_bidaan'] = $senaraisag->sum('hargabida');
|
||||
|
||||
$pdf = PDF::loadView('pdf.penyatabayaran',compact('userdetails','SAGWin','caw','user','lelong','invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
$pdf = PDF::loadView('pdf.penyatabayaran', compact('userdetails', 'SAGWin', 'caw', 'user', 'lelong', 'invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Penyata Bayaran.pdf');
|
||||
}
|
||||
|
||||
|
||||
public function resit($user_id, $lelong_id){
|
||||
public function resit($user_id, $lelong_id)
|
||||
{
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$SAGBidItem = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select(
|
||||
'users.id',
|
||||
'users.name',
|
||||
'users.nokp',
|
||||
'users.alamat'
|
||||
)
|
||||
->first();
|
||||
|
||||
|
||||
$arraydetails = [];
|
||||
|
||||
$brgdetails= LelongBidder::join('payment','lelongbidder.payment_id','=','payment.id')
|
||||
->join('lelongbid','lelongbidder.lelongbid_id','=','lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->select('resit_id','payment.lelong_id','payment.user_id','payment.status','status_payment_opt','lelongbidder.status_payment')
|
||||
->where('payment.status', 2)
|
||||
->where('payment.user_id',$user_id)
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('status_payment_opt', 2)
|
||||
->orWhere('status_payment_opt', 3)
|
||||
->distinct()
|
||||
->orderBy('resit_id')
|
||||
->get()
|
||||
->toArray();
|
||||
// dd($brgdetails);
|
||||
|
||||
// dd($user->kodcaw);
|
||||
foreach($brgdetails as $brg)
|
||||
{
|
||||
$details = Payment::join('lelongbid','payment.norujukan','=','lelongbid.norujukan')
|
||||
->join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->join('resit','payment.resit_id','=','resit.id')
|
||||
->where('resit_id', $brg['resit_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
// ->where('payment.kodcaw', $user->kodcaw)
|
||||
->where('payment.status',2)
|
||||
->select(
|
||||
'users.id',
|
||||
'users.name',
|
||||
'users.nokp',
|
||||
'users.alamat'
|
||||
)
|
||||
->first();
|
||||
|
||||
$arraydetails = [];
|
||||
|
||||
$brgdetails = LelongBidder::join('payment', 'lelongbidder.payment_id', '=', 'payment.id')
|
||||
->join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->select('resit_id', 'payment.lelong_id', 'payment.user_id', 'payment.status', 'status_payment_opt', 'lelongbidder.status_payment')
|
||||
->where('payment.status', 2)
|
||||
->where('payment.user_id', $user_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('status_payment_opt', 2)
|
||||
->orWhere('status_payment_opt', 3)
|
||||
->distinct()
|
||||
->orderBy('resit_id')
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arraydetails,['brg' => $brg, 'detailsbrg' => $details ]);
|
||||
|
||||
|
||||
// dd($brgdetails);
|
||||
|
||||
// dd($user->kodcaw);
|
||||
foreach ($brgdetails as $brg) {
|
||||
$details = Payment::join('lelongbid', 'payment.norujukan', '=', 'lelongbid.norujukan')
|
||||
->join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->join('resit', 'payment.resit_id', '=', 'resit.id')
|
||||
->where('resit_id', $brg['resit_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('users.id', $user_id)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
// ->where('payment.kodcaw', $user->kodcaw)
|
||||
->where('payment.status', 2)
|
||||
->distinct()
|
||||
->orderBy('resit_id')
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arraydetails, ['brg' => $brg, 'detailsbrg' => $details]);
|
||||
|
||||
}
|
||||
// dd($arraydetails);
|
||||
|
||||
|
||||
|
||||
|
||||
return view('serahan.resit',compact('SAGBidItem', 'arraydetails', 'lelong_id','user_id','brgdetails'));
|
||||
return view('serahan.resit', compact('SAGBidItem', 'arraydetails', 'lelong_id', 'user_id', 'brgdetails'));
|
||||
}
|
||||
|
||||
public function resitpembayaran($user_id, $resit_id, $lelong_id)
|
||||
{
|
||||
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id','=',$user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id',$lelong_id)
|
||||
->first();
|
||||
{
|
||||
|
||||
$invois = Resit::where('id',$resit_id)
|
||||
$user = Auth::user();
|
||||
|
||||
->get();
|
||||
// dd($invois);
|
||||
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id', '=', $user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$invois = Resit::where('id', $resit_id)
|
||||
->get();
|
||||
// dd($invois);
|
||||
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('payment','lelongbid.norujukan','=','payment.norujukan')
|
||||
->join('resit','payment.resit_id','=','resit.id')
|
||||
->where('lelongbidder.user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('payment.resit_id',$resit_id)
|
||||
->get();
|
||||
->join('payment', 'lelongbid.norujukan', '=', 'payment.norujukan')
|
||||
->join('resit', 'payment.resit_id', '=', 'resit.id')
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('payment.resit_id', $resit_id)
|
||||
->get();
|
||||
// dd($SAGWin);
|
||||
|
||||
$senaraisag = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
// ->where('lelongbid.kodcaw',$caw['caw_code']) buang jap nti check balik
|
||||
->join('payment','lelongbid.norujukan','=','payment.norujukan')
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('lelongbidder.user_id',$user_id)
|
||||
->where('payment.resit_id',$resit_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
->join('payment', 'lelongbid.norujukan', '=', 'payment.norujukan')
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('payment.resit_id', $resit_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($senaraisag);
|
||||
|
||||
$caw['total_berat'] = $senaraisag->sum('berat');
|
||||
$caw['total_bidaan'] = $senaraisag->sum('hargabida');
|
||||
|
||||
$pdf = PDF::loadView('pdf.resitpembayaran', compact('userdetails', 'SAGWin', 'caw', 'user', 'lelong', 'invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
$pdf = PDF::loadView('pdf.resitpembayaran',compact('userdetails','SAGWin','caw','user','lelong','invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Resit Bayaran.pdf');
|
||||
}
|
||||
|
||||
public function slipserahan($user_id, $lelong_id)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
$total_berat = 0;
|
||||
$berat = 0;
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id','=',$user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id',$lelong_id)
|
||||
->first();
|
||||
$user = Auth::user();
|
||||
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id', '=', $user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id', $lelong_id)
|
||||
->first();
|
||||
// dd($lelong);
|
||||
|
||||
$invois = Invoice::where('user_id',$user_id)
|
||||
->where('lelong_id',$lelong_id)
|
||||
->get();
|
||||
// dd($invois);
|
||||
$invois = Invoice::where('user_id', $user_id)
|
||||
->where('lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($invois);
|
||||
|
||||
$khazanah = Http::get(config('app.api_url_kaunter').'api/roles_harian/' . $user->kodcaw ,[
|
||||
'role_harian' => 'khazanah'
|
||||
$khazanah = Http::get(config('app.api_url_kaunter').'api/roles_harian/'.$user->kodcaw, [
|
||||
'role_harian' => 'khazanah',
|
||||
])->json();
|
||||
// dd($roles_harian_khazanah);
|
||||
|
||||
|
||||
$SAGWin = LelongBid::join('scan_semak','lelongbid.norujukan','=','scan_semak.norujukan')
|
||||
->where('lelongbid.nopembeli',$user_id)
|
||||
->where('lelongbid.status_payment', 1)
|
||||
->where('scan_semak.serahkpdpembida', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->select('lelongbid.id','lelongbid.norujukan','lelongbid.hargajual')
|
||||
->orderBy('lelongbid.id')
|
||||
$SAGWin = LelongBid::join('scan_semak', 'lelongbid.norujukan', '=', 'scan_semak.norujukan')
|
||||
->where('lelongbid.nopembeli', $user_id)
|
||||
->where('lelongbid.status_payment', 1)
|
||||
->where('scan_semak.serahkpdpembida', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->select('lelongbid.id', 'lelongbid.norujukan', 'lelongbid.hargajual')
|
||||
->orderBy('lelongbid.id')
|
||||
// ->where('payment.resit_id',$resit_id)
|
||||
->get();
|
||||
->get();
|
||||
// dd($SAGWin);
|
||||
if($SAGWin->isNotEmpty()){
|
||||
foreach($SAGWin as $index1=>$lelong2){
|
||||
if ($SAGWin->isNotEmpty()) {
|
||||
foreach ($SAGWin as $index1 => $lelong2) {
|
||||
|
||||
// dd($SAGWin);
|
||||
$marhun= LelongBidMarhun::join('jenisemas','jenisemas.marhun','=','lelongbidmarhun.marhun')
|
||||
->where('lelongbid_id','=',$lelong2['id'])
|
||||
$marhun = LelongBidMarhun::join('jenisemas', 'jenisemas.marhun', '=', 'lelongbidmarhun.marhun')
|
||||
->where('lelongbid_id', '=', $lelong2['id'])
|
||||
// ->where('kodcaw','=',$user['kodcaw'])
|
||||
->get();
|
||||
|
||||
->get();
|
||||
|
||||
$total_berat = $total_berat + ($marhun->sum('berat'));
|
||||
// $total_harga = $total_harga + ($marhun->sum('harga'));
|
||||
// $total_nmarhun = $total_nmarhun + ($marhun->sum('n_marhun'));
|
||||
// $total_hargaasas = $total_hargaasas + ($marhun->sum('hargaasas'));
|
||||
|
||||
$SAGWin[$index1]['detailmarhun']=$marhun;
|
||||
|
||||
|
||||
$SAGWin[$index1]['detailmarhun'] = $marhun;
|
||||
|
||||
}
|
||||
|
||||
$senaraisag = LelongBid::where('lelongbid.kodcaw',$user->kodcaw)
|
||||
->where('lelongbid.nopembeli',$user_id)
|
||||
->where('lelongbid.status_payment', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($senaraisag);
|
||||
$caw['total_berat'] = $senaraisag->sum('berat');
|
||||
$caw['total_bidaan'] = $senaraisag->sum('hargajual');
|
||||
$senaraisag = LelongBid::where('lelongbid.kodcaw', $user->kodcaw)
|
||||
->where('lelongbid.nopembeli', $user_id)
|
||||
->where('lelongbid.status_payment', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
// dd($senaraisag);
|
||||
$caw['total_berat'] = $senaraisag->sum('berat');
|
||||
$caw['total_bidaan'] = $senaraisag->sum('hargajual');
|
||||
|
||||
$pdf = PDF::loadView('pdf.slipserahan', compact('userdetails', 'SAGWin', 'caw', 'user', 'lelong', 'invois', 'total_berat', 'khazanah'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
$pdf = PDF::loadView('pdf.slipserahan',compact('userdetails','SAGWin','caw','user','lelong','invois','total_berat','khazanah'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Slip Serahan.pdf');
|
||||
}
|
||||
elseif($SAGWin->isEmpty()){
|
||||
return redirect()->route('pembayaran.kaunterpembayaran',$lelong_id)
|
||||
->with('failed','Maaf, Tidak Boleh Dijana kerana SAG Belum Di Scan Keluar/Belum Bayar Penuh');
|
||||
return $pdf->download('Slip Serahan.pdf');
|
||||
} elseif ($SAGWin->isEmpty()) {
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $lelong_id)
|
||||
->with('failed', 'Maaf, Tidak Boleh Dijana kerana SAG Belum Di Scan Keluar/Belum Bayar Penuh');
|
||||
}
|
||||
}
|
||||
|
||||
public function senaraibid($user_id, $lelong_id)
|
||||
{
|
||||
{
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id','=',$user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id',$lelong_id)
|
||||
->first();
|
||||
$user = Auth::user();
|
||||
|
||||
$invois = Payment::join('resit','payment.resit_id','=','resit.id')
|
||||
->where('payment.id',$lelong_id)
|
||||
->first();
|
||||
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first()->toArray();
|
||||
|
||||
$userdetails = User::where('id', '=', $user_id)
|
||||
->first();
|
||||
|
||||
$lelong = Lelong::where('id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$invois = Payment::join('resit', 'payment.resit_id', '=', 'resit.id')
|
||||
->where('payment.id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
->where('user_id', $user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
$senaraisag = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid.kodcaw',$caw['caw_code'])
|
||||
->where('user_id',$user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
->where('lelongbid.kodcaw', $caw['caw_code'])
|
||||
->where('user_id', $user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
$caw['total_hargaasas'] = $senaraisag->sum('hargaasas');
|
||||
$caw['total_bidaan'] = $senaraisag->sum('hargabida');
|
||||
|
||||
$pdf = PDF::loadView('pdf.senaraibid',compact('userdetails','SAGWin','caw','user','lelong','invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
$pdf = PDF::loadView('pdf.senaraibid', compact('userdetails', 'SAGWin', 'caw', 'user', 'lelong', 'invois'))
|
||||
->setPaper('a4', 'potrait');
|
||||
|
||||
return $pdf->download('Senarai Bidaan.pdf');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1088
-1249
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,47 +2,31 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Excel;
|
||||
|
||||
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\GadaiMarhun;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use PDF;
|
||||
use App\Models\JenisKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\Simulasi;
|
||||
use App\Models\SimulasiBid;
|
||||
use App\Models\SimulasiBidMarhun;
|
||||
use App\Models\SimKarat;
|
||||
use App\Models\SimKarat_temp;
|
||||
use App\Models\CawanganSimulasi;
|
||||
use App\Models\JenisEmas;
|
||||
use App\Models\JenisKarat;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\Customer;
|
||||
|
||||
|
||||
use DateTime;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use Carbon\Carbon;
|
||||
use Excel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use PDF;
|
||||
|
||||
class TamatKontController extends Controller
|
||||
{
|
||||
//PC
|
||||
public function notistamatkontrak(Request $request)
|
||||
// PC
|
||||
public function notistamatkontrak(Request $request)
|
||||
{
|
||||
return view('jananotis.notistamatkontrak');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function gadaibycaw(Request $request)
|
||||
@@ -55,67 +39,62 @@ class TamatKontController extends Controller
|
||||
// ->get();
|
||||
// dd($cawangan);
|
||||
|
||||
|
||||
$getsurat = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
|
||||
// dd($getsurat);
|
||||
|
||||
if (count($getsurat) != 0) {
|
||||
|
||||
if(sizeof($getsurat) != 0)
|
||||
{
|
||||
|
||||
$t_gadais = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
$cawangan_all = Cawangan::where('caw_code', $user->kodcaw)->get();
|
||||
|
||||
foreach($cawangan_all as $cawangan){
|
||||
foreach ($cawangan_all as $cawangan) {
|
||||
|
||||
$bil_lelongcaw = Gadai::on($cawangan->caw_code)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
$bil_lelongcaw = Gadai::on($cawangan->caw_code)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
}
|
||||
// dd($bil_lelongcaw);
|
||||
|
||||
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
$t_anggaran = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
|
||||
foreach($getsurat as $index1=>$surats)
|
||||
{
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
|
||||
foreach ($getsurat as $index1 => $surats) {
|
||||
$senarai = Gadai::on($user->kodcaw)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
|
||||
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
$ktlhbyr = $surats['hargajualan'] - $surats['bakihargajualan'];
|
||||
|
||||
|
||||
$getsurat[$index1]['list_norujukan'] = $senarai;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
|
||||
@@ -125,24 +104,20 @@ class TamatKontController extends Controller
|
||||
// $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2')
|
||||
// ->sum('bayaran_keuntungan');
|
||||
|
||||
return view('jananotis.gadaibycaw', compact( 'getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'
|
||||
));
|
||||
}
|
||||
else if(sizeof($getsurat) == 0)
|
||||
{
|
||||
return view('jananotis.gadaibycaw', compact('getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'
|
||||
));
|
||||
} elseif (count($getsurat) == 0) {
|
||||
return redirect()->route('jananotis.notistamatkontrak')
|
||||
->with('failed','Tiada surat untuk di lelong');
|
||||
}
|
||||
else
|
||||
{
|
||||
->with('failed', 'Tiada surat untuk di lelong');
|
||||
} else {
|
||||
return redirect()->route('jananotis.notistamatkontrak')
|
||||
->with('failed','Sila Masukkan Tarikh Lelongan');
|
||||
->with('failed', 'Sila Masukkan Tarikh Lelongan');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -152,181 +127,169 @@ class TamatKontController extends Controller
|
||||
// $t_lelong = $request->tarikh_lelong;
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
|
||||
$getsurat = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
|
||||
// dd($getsurat);
|
||||
|
||||
|
||||
$t_gadais = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
$cawangan_all = Cawangan::where('caw_code', $user->kodcaw)->get();
|
||||
$t_gadais = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
foreach($cawangan_all as $cawangan){
|
||||
$cawangan_all = Cawangan::where('caw_code', $user->kodcaw)->get();
|
||||
|
||||
foreach ($cawangan_all as $cawangan) {
|
||||
|
||||
$bil_lelongcaw = Gadai::on($cawangan->caw_code)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
}
|
||||
// dd($bil_lelongcaw);
|
||||
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
$t_anggaran = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
}
|
||||
// dd($bil_lelongcaw);
|
||||
|
||||
foreach($getsurat as $index1=>$surats)
|
||||
{
|
||||
$senarai = Gadai::on($user->kodcaw)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
$t_anggaran = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
|
||||
foreach ($getsurat as $index1 => $surats) {
|
||||
$senarai = Gadai::on($user->kodcaw)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
->get();
|
||||
|
||||
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
$ktlhbyr = $surats['hargajualan'] - $surats['bakihargajualan'];
|
||||
|
||||
|
||||
$getsurat[$index1]['list_norujukan'] = $senarai;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
$getsurat[$index1]['list_norujukan'] = $senarai;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
|
||||
}
|
||||
$pdf = PDF::loadView('pdf.gadaibycawpdf',compact( 'getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'))
|
||||
|
||||
}
|
||||
$pdf = PDF::loadView('pdf.gadaibycawpdf', compact('getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'))
|
||||
->setPaper('a4', 'potrait');
|
||||
return $pdf->download('Notis Sebelum Tamat Kontrak.pdf');
|
||||
|
||||
|
||||
|
||||
return $pdf->download('Notis Sebelum Tamat Kontrak.pdf');
|
||||
|
||||
}
|
||||
|
||||
public function gadaibycawexcel (Request $request, $t_lelong)
|
||||
public function gadaibycawexcel(Request $request, $t_lelong)
|
||||
{
|
||||
// $t_lelong = $request->tarikh_lelong;
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
|
||||
$getsurat = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
|
||||
// dd($getsurat);
|
||||
|
||||
|
||||
$t_gadais = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
$cawangan_all = Cawangan::where('caw_code', $user->kodcaw)->get();
|
||||
$t_gadais = Gadai::on($user->kodcaw)
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
foreach($cawangan_all as $cawangan){
|
||||
$cawangan_all = Cawangan::where('caw_code', $user->kodcaw)->get();
|
||||
|
||||
foreach ($cawangan_all as $cawangan) {
|
||||
|
||||
$bil_lelongcaw = Gadai::on($cawangan->caw_code)
|
||||
// join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
}
|
||||
// dd($bil_lelongcaw);
|
||||
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
$t_anggaran = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $user->kodcaw)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->selectRaw('count(*) as bil_lelong')
|
||||
->get()->toArray();
|
||||
}
|
||||
// dd($bil_lelongcaw);
|
||||
|
||||
foreach($getsurat as $index1=>$surats)
|
||||
{
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
$t_anggaran = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
$customer = Customer::where('kpbaru','=',$surats['nokp'])
|
||||
->orWhere('kplama','=',$surats['nokp'])
|
||||
// $t_anggaran = date('d-m-Y', strtotime('-1 months', strtotime($tarikh_lelong)));
|
||||
|
||||
foreach ($getsurat as $index1 => $surats) {
|
||||
|
||||
$customer = Customer::where('kpbaru', '=', $surats['nokp'])
|
||||
->orWhere('kplama', '=', $surats['nokp'])
|
||||
->get();
|
||||
|
||||
$listsag = Gadai::on($user->kodcaw)
|
||||
$listsag = Gadai::on($user->kodcaw)
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
->get();
|
||||
|
||||
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
$ktlhbyr = $surats['hargajualan'] - $surats['bakihargajualan'];
|
||||
|
||||
// foreach($listsag as $index=>$listing){
|
||||
|
||||
// foreach($listsag as $index=>$listing){
|
||||
// $bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
|
||||
|
||||
// $bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// $ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
// $ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
||||
|
||||
|
||||
$getsurat[$index1]['nama'] = $customer;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
$getsurat[$index1]['nama'] = $customer;
|
||||
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// return Excel::download(new DisneyplusExport, 'disney.xlsx');
|
||||
// return Excel::download(new DisneyplusExport, 'disney.xlsx');
|
||||
|
||||
return view('excel.gadaibycawexcel',compact('getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'
|
||||
));
|
||||
|
||||
|
||||
|
||||
return view('excel.gadaibycawexcel', compact('getsurat',
|
||||
't_lelong',
|
||||
'user',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'bil_lelongcaw',
|
||||
'ktlhbyr'
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
//Operasi
|
||||
|
||||
// Operasi
|
||||
public function sebelumtamatkont(Request $request)
|
||||
{
|
||||
return view('jananotis.sebelumtamatkont');
|
||||
@@ -340,72 +303,66 @@ class TamatKontController extends Controller
|
||||
$t_anggaran = ($tarikh_lelong->subDays(20))->format('d/m/Y');
|
||||
$t_daftarlelong = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
|
||||
|
||||
if($t_lelong != null)
|
||||
{
|
||||
if ($t_lelong != null) {
|
||||
$getsurat = Gadai::where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
// dd($getsurat);
|
||||
if(sizeof($getsurat) == 0)
|
||||
{
|
||||
return redirect()->route('notistamatkontrak.sebelumtamatkont')
|
||||
->with('failed','Tiada surat untuk di lelong');
|
||||
if (count($getsurat) == 0) {
|
||||
return redirect()->route('notistamatkontrak.sebelumtamatkont')
|
||||
->with('failed', 'Tiada surat untuk di lelong');
|
||||
}
|
||||
|
||||
|
||||
$t_gadais = Gadai::where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai', 'norujukan')
|
||||
->first();
|
||||
//dd($t_gadais);
|
||||
// $t_gadais = $request->t_gadai;
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->where('t_matang1', '<', $t_lelong)
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai', 'norujukan')
|
||||
->first();
|
||||
// dd($t_gadais);
|
||||
// $t_gadais = $request->t_gadai;
|
||||
// $t_gadaisehingga = Carbon::parse($t_gadais);
|
||||
// $t_gadaisdisplay = $t_gadaisehingga->format('d/m/Y');
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
$senarai = Gadai::join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->groupBy('gadai.kodcaw','cawangan.caw_name')
|
||||
->selectRaw('count(*) as bil_lelong,
|
||||
->where('gadai.t_matang1', '<', $t_lelong)
|
||||
->where('gadai.sttebus', '=', '')
|
||||
->where('gadai.taglel', '=', 0)
|
||||
->where('gadai.tagpalsu', '=', 0)
|
||||
->where('gadai.tagpalsu2', '=', 0)
|
||||
->whereNotNull('gadai.upah12')
|
||||
->groupBy('gadai.kodcaw', 'cawangan.caw_name')
|
||||
->selectRaw('count(*) as bil_lelong,
|
||||
sum(berat) as total_berat,
|
||||
sum(nilaimarhun) as total_nilaimarhun,
|
||||
sum(pinjaman) as total_pembiayaan,
|
||||
sum(bakipjm) as total_bakipjm,
|
||||
gadai.kodcaw,
|
||||
cawangan.caw_name as caw_name')
|
||||
->get();
|
||||
|
||||
$bil_lelong = sizeof($getsurat);
|
||||
->get();
|
||||
|
||||
return view('jananotis.senaraitemp', compact( 't_lelong',
|
||||
'getsurat',
|
||||
'senarai',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
't_daftarlelong',
|
||||
't_lelongdisplay'
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$bil_lelong = count($getsurat);
|
||||
|
||||
return view('jananotis.senaraitemp', compact('t_lelong',
|
||||
'getsurat',
|
||||
'senarai',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
't_daftarlelong',
|
||||
't_lelongdisplay'
|
||||
));
|
||||
} else {
|
||||
return redirect()->route('notistamatkontrak.sebelumtamatkont')
|
||||
->with('failed','Sila Masukkan Tarikh Lelongan');
|
||||
->with('failed', 'Sila Masukkan Tarikh Lelongan');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -413,23 +370,23 @@ class TamatKontController extends Controller
|
||||
public function tempbycaw($details, $t_lelong)
|
||||
{
|
||||
$getsurat = Gadai::where('t_matang1', '<', $t_lelong)
|
||||
->where('kodcaw', $details)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
->where('kodcaw', $details)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->get();
|
||||
|
||||
$t_gadais = Gadai::where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
->where('sttebus', '=', '')
|
||||
->where('taglel', '=', 0)
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->whereNotNull('upah12')
|
||||
->orderBy('t_gadai')
|
||||
->select('t_gadai')
|
||||
->first();
|
||||
|
||||
$tarikh_lelong = Carbon::parse($t_lelong);
|
||||
// $t_anggaran = ($tarikh_lelong->subMonths(1))->toDateString();
|
||||
@@ -437,180 +394,168 @@ class TamatKontController extends Controller
|
||||
$t_anggaran = ($tarikh_lelong->subDays(20))->format('d/m/Y');
|
||||
$t_daftarlelong = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
||||
|
||||
|
||||
foreach($getsurat as $index1=>$surats)
|
||||
{
|
||||
foreach ($getsurat as $index1 => $surats) {
|
||||
$senarai = Gadai::join('cawangan', 'gadai.kodcaw', '=', 'cawangan.caw_code')
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
//dd($senarai);
|
||||
->where('norujukan', $surats['norujukan'])
|
||||
->get();
|
||||
// dd($senarai);
|
||||
$getsurat[$index1]['list_norujukan'] = $senarai;
|
||||
}
|
||||
|
||||
// $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2')
|
||||
// ->sum('bayaran_keuntungan');
|
||||
|
||||
return view('jananotis.tempbycaw', compact( 'getsurat',
|
||||
'details',
|
||||
'senarai',
|
||||
't_lelong',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'tarikh_lelong',
|
||||
't_daftarlelong',
|
||||
't_lelongdisplay'
|
||||
));
|
||||
return view('jananotis.tempbycaw', compact('getsurat',
|
||||
'details',
|
||||
'senarai',
|
||||
't_lelong',
|
||||
't_gadais',
|
||||
't_anggaran',
|
||||
'tarikh_lelong',
|
||||
't_daftarlelong',
|
||||
't_lelongdisplay'
|
||||
));
|
||||
}
|
||||
|
||||
public function janadatatamatkontrak(Request $request)
|
||||
{
|
||||
//dd($request->all());
|
||||
// dd($request->all());
|
||||
$t_lelong = Carbon::parse($request->trkh_lelong);
|
||||
$bulan = (int)round('12.00');
|
||||
$bulan = (int) round('12.00');
|
||||
$fasa = '2';
|
||||
$jbg = '12';
|
||||
$cajlelong = '3';
|
||||
//dd($t_lelong);
|
||||
// dd($t_lelong);
|
||||
$t_gadai = $request->t_gadai;
|
||||
//dd($t_gadai);
|
||||
if($fasa == '2'){
|
||||
$surat = Gadai::where('t_matang1','<',$t_lelong)
|
||||
->where('sttebus','=','')
|
||||
->where('tagpalsu','=',0)
|
||||
->where('tagpalsu2','=',0)
|
||||
->where('taglel','=',0)
|
||||
->get();
|
||||
|
||||
}
|
||||
//dd($surat);
|
||||
// dd($jbg);
|
||||
if(sizeof($surat) == 0)
|
||||
{
|
||||
// dd($t_gadai);
|
||||
if ($fasa == '2') {
|
||||
$surat = Gadai::where('t_matang1', '<', $t_lelong)
|
||||
->where('sttebus', '=', '')
|
||||
->where('tagpalsu', '=', 0)
|
||||
->where('tagpalsu2', '=', 0)
|
||||
->where('taglel', '=', 0)
|
||||
->get();
|
||||
|
||||
}
|
||||
// dd($surat);
|
||||
// dd($jbg);
|
||||
if (count($surat) == 0) {
|
||||
return redirect()->route('analisa.janasimulasi')
|
||||
->with('failed','Tiada surat untuk di lelong');
|
||||
}
|
||||
->with('failed', 'Tiada surat untuk di lelong');
|
||||
}
|
||||
$cawangan = Cawangan::all();
|
||||
//create simulasi
|
||||
// create simulasi
|
||||
$simulasi = new Simulasi;
|
||||
$simulasi->tarikh_lelong = $request->trkh_lelong;
|
||||
$simulasi->harga_emas_asas = "0.00";
|
||||
$simulasi->harga_emas_asas = '0.00';
|
||||
$simulasi->jbg = $jbg;
|
||||
$simulasi->cajlelong = $cajlelong;
|
||||
$simulasi->fasa = $fasa;
|
||||
$simulasi->save();
|
||||
|
||||
//create harga asas berdasarkan input harga asas
|
||||
// create harga asas berdasarkan input harga asas
|
||||
$karat = JenisKarat::all();
|
||||
$hargaasas = $request->hargaasas; //rial
|
||||
foreach($karat as $item)
|
||||
{
|
||||
$hargaasas = $request->hargaasas; // rial
|
||||
foreach ($karat as $item) {
|
||||
$simkarat = new SimKarat;
|
||||
$simkarat->simulasi_id = $simulasi->id;
|
||||
$simkarat->karat = $item->karat;
|
||||
$simkarat->keterangan = $item->keterangan;
|
||||
$simkarat->harga = ($hargaasas + ($item->dariharga916)); //gram
|
||||
$simkarat->harga2 = $hargaasas + ($item->dariharga916); //rial
|
||||
$simkarat->harga = ($hargaasas + ($item->dariharga916)); // gram
|
||||
$simkarat->harga2 = $hargaasas + ($item->dariharga916); // rial
|
||||
$simkarat->save();
|
||||
}
|
||||
|
||||
//$fasa = $request->fasa;
|
||||
// $fasa = $request->fasa;
|
||||
// join cawangan yang terlibat dengan simulasi
|
||||
if($request->caw && $request->caw != 'all')
|
||||
{
|
||||
// dd($request->kodcaw);
|
||||
$caw = Cawangan::whereIn('caw_code',$request->caw)->get();
|
||||
if ($request->caw && $request->caw != 'all') {
|
||||
// dd($request->kodcaw);
|
||||
$caw = Cawangan::whereIn('caw_code', $request->caw)->get();
|
||||
// dd($caw);
|
||||
foreach($caw as $index=>$cawsimulasi){
|
||||
foreach ($caw as $index => $cawsimulasi) {
|
||||
// dd($cawsimulasi->id);
|
||||
$caw_simulasi = new CawanganSimulasi;
|
||||
$caw_simulasi->simulasi_id = $simulasi->id;
|
||||
$caw_simulasi->caw_id = $cawsimulasi->id;
|
||||
$caw_simulasi->online = 'Online';
|
||||
$caw_simulasi->lokasi = $cawsimulasi->lokasi;
|
||||
$caw_simulasi->fasa = $request->fasa;
|
||||
$caw_simulasi->save();
|
||||
// dd($caw_simulasi);
|
||||
|
||||
$suratcaw = $surat->where('kodcaw','=',$cawsimulasi->caw_code)->all();
|
||||
$caw_simulasi = new CawanganSimulasi;
|
||||
$caw_simulasi->simulasi_id = $simulasi->id;
|
||||
$caw_simulasi->caw_id = $cawsimulasi->id;
|
||||
$caw_simulasi->online = 'Online';
|
||||
$caw_simulasi->lokasi = $cawsimulasi->lokasi;
|
||||
$caw_simulasi->fasa = $request->fasa;
|
||||
$caw_simulasi->save();
|
||||
// dd($caw_simulasi);
|
||||
|
||||
// $simulasibid = SimulasiBid::where('caw_id','=',$caw->id)->get();
|
||||
foreach($suratcaw as $data)
|
||||
{
|
||||
$simulasibid = new SimulasiBid;
|
||||
$simulasibid->simulasi_id = $simulasi->id;
|
||||
$simulasibid->caw_id = $cawsimulasi->id;
|
||||
$simulasibid->kodcaw = $data->kodcaw;
|
||||
$simulasibid->norujukan = $data->norujukan;
|
||||
$simulasibid->t_lelong = $request->trkh_lelong;
|
||||
$simulasibid->hargaasas = 0.00;
|
||||
$simulasibid->hargajual = 0.00;
|
||||
$simulasibid->jbg = $data->jbg;
|
||||
$simulasibid->kadarupah = $data->kadarupah;
|
||||
$simulasibid->upahsimpan = $data->upahSim;
|
||||
$simulasibid->ansuran = $data->ansuran;
|
||||
$simulasibid->nilaimarhun = $data->nilaimarhun;
|
||||
$simulasibid->pinjaman = $data->pinjaman;
|
||||
$simulasibid->bakiupah = $data->bakiupah;
|
||||
$simulasibid->cajlain = $data->cajlain;
|
||||
$simulasibid->cajlelong = 0.00;
|
||||
$simulasibid->baki = 0.00;
|
||||
$simulasibid->berat = $data->berat;
|
||||
$simulasibid->marhun = $data->marhun;
|
||||
$simulasibid->percent = $data->percentpinj;
|
||||
$simulasibid->status_jual = 0;
|
||||
$simulasibid->status_payment = 0;
|
||||
$simulasibid->mora_upah = 0;
|
||||
$simulasibid->save();
|
||||
$suratcaw = $surat->where('kodcaw', '=', $cawsimulasi->caw_code)->all();
|
||||
|
||||
$sumhargaasas = 0;
|
||||
$berat = 0;
|
||||
$gadaimarhun = GadaiMarhun::where('norujukan','=',$data->norujukan)->get();
|
||||
foreach($gadaimarhun as $marhun)
|
||||
{
|
||||
$simkarat = SimKarat::where('simulasi_id','=',$simulasi->id)->get();
|
||||
// dd($simkarat);
|
||||
foreach($simkarat as $karat)
|
||||
{
|
||||
|
||||
if($karat->karat == $marhun->karat)
|
||||
{
|
||||
$val = round($marhun->berat * $karat->harga);
|
||||
$sumhargaasas = $sumhargaasas + $val;
|
||||
$berat = $berat + $marhun->berat;
|
||||
// $simulasibid = SimulasiBid::where('caw_id','=',$caw->id)->get();
|
||||
foreach ($suratcaw as $data) {
|
||||
$simulasibid = new SimulasiBid;
|
||||
$simulasibid->simulasi_id = $simulasi->id;
|
||||
$simulasibid->caw_id = $cawsimulasi->id;
|
||||
$simulasibid->kodcaw = $data->kodcaw;
|
||||
$simulasibid->norujukan = $data->norujukan;
|
||||
$simulasibid->t_lelong = $request->trkh_lelong;
|
||||
$simulasibid->hargaasas = 0.00;
|
||||
$simulasibid->hargajual = 0.00;
|
||||
$simulasibid->jbg = $data->jbg;
|
||||
$simulasibid->kadarupah = $data->kadarupah;
|
||||
$simulasibid->upahsimpan = $data->upahSim;
|
||||
$simulasibid->ansuran = $data->ansuran;
|
||||
$simulasibid->nilaimarhun = $data->nilaimarhun;
|
||||
$simulasibid->pinjaman = $data->pinjaman;
|
||||
$simulasibid->bakiupah = $data->bakiupah;
|
||||
$simulasibid->cajlain = $data->cajlain;
|
||||
$simulasibid->cajlelong = 0.00;
|
||||
$simulasibid->baki = 0.00;
|
||||
$simulasibid->berat = $data->berat;
|
||||
$simulasibid->marhun = $data->marhun;
|
||||
$simulasibid->percent = $data->percentpinj;
|
||||
$simulasibid->status_jual = 0;
|
||||
$simulasibid->status_payment = 0;
|
||||
$simulasibid->mora_upah = 0;
|
||||
$simulasibid->save();
|
||||
|
||||
$simmarhun = new SimulasiBidMarhun;
|
||||
$simmarhun->simulasibid_id = $simulasibid->id;
|
||||
$simmarhun->bil = $marhun->bil;
|
||||
$simmarhun->marhun = $marhun->marhun;
|
||||
$simmarhun->nota = $marhun->nota;
|
||||
$simmarhun->karat = $marhun->karat;
|
||||
$simmarhun->berat = $marhun->berat;
|
||||
$simmarhun->harga = $karat->harga;
|
||||
$simmarhun->n_marhun = $marhun->berat * $karat->harga;
|
||||
$simmarhun->hargaasas = $val;
|
||||
$simmarhun->save();
|
||||
$sumhargaasas = 0;
|
||||
$berat = 0;
|
||||
$gadaimarhun = GadaiMarhun::where('norujukan', '=', $data->norujukan)->get();
|
||||
foreach ($gadaimarhun as $marhun) {
|
||||
$simkarat = SimKarat::where('simulasi_id', '=', $simulasi->id)->get();
|
||||
// dd($simkarat);
|
||||
foreach ($simkarat as $karat) {
|
||||
|
||||
if ($karat->karat == $marhun->karat) {
|
||||
$val = round($marhun->berat * $karat->harga);
|
||||
$sumhargaasas = $sumhargaasas + $val;
|
||||
$berat = $berat + $marhun->berat;
|
||||
|
||||
$simmarhun = new SimulasiBidMarhun;
|
||||
$simmarhun->simulasibid_id = $simulasibid->id;
|
||||
$simmarhun->bil = $marhun->bil;
|
||||
$simmarhun->marhun = $marhun->marhun;
|
||||
$simmarhun->nota = $marhun->nota;
|
||||
$simmarhun->karat = $marhun->karat;
|
||||
$simmarhun->berat = $marhun->berat;
|
||||
$simmarhun->harga = $karat->harga;
|
||||
$simmarhun->n_marhun = $marhun->berat * $karat->harga;
|
||||
$simmarhun->hargaasas = $val;
|
||||
$simmarhun->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$calcaj = ($request->cajlelong / 100) * $sumhargaasas;
|
||||
$updatesimbid = SimulasiBid::where('id', '=', $simulasibid->id)->first();
|
||||
$updatesimbid->hargaasas = $sumhargaasas;
|
||||
$updatesimbid->cajlelong = $calcaj;
|
||||
$updatesimbid->baki = $sumhargaasas - $data->pinjaman - $data->bakiupah - $calcaj;
|
||||
$updatesimbid->berat = $berat;
|
||||
$updatesimbid->save();
|
||||
}
|
||||
|
||||
|
||||
$calcaj = ($request->cajlelong/100)*$sumhargaasas;
|
||||
$updatesimbid = SimulasiBid::where('id','=',$simulasibid->id)->first();
|
||||
$updatesimbid->hargaasas = $sumhargaasas;
|
||||
$updatesimbid->cajlelong = $calcaj;
|
||||
$updatesimbid->baki = $sumhargaasas-$data->pinjaman - $data->bakiupah - $calcaj;
|
||||
$updatesimbid->berat = $berat;
|
||||
$updatesimbid->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dd('error');
|
||||
}
|
||||
|
||||
return redirect()->route('analisa.show',$simulasi->id);
|
||||
return redirect()->route('analisa.show', $simulasi->id);
|
||||
}
|
||||
|
||||
// public function janasimulasi($t_lelong, )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,35 +2,20 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\GadaiMarhun;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use App\Models\Tetapan;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TetapanController extends Controller
|
||||
{
|
||||
//PC
|
||||
// PC
|
||||
public function parameter(Request $request)
|
||||
{
|
||||
$caw = Cawangan::all();
|
||||
$tetapan = Tetapan::first();
|
||||
|
||||
return view('tetapan.parameter',compact('caw','tetapan'));
|
||||
return view('tetapan.parameter', compact('caw', 'tetapan'));
|
||||
|
||||
}
|
||||
|
||||
@@ -38,25 +23,22 @@ class TetapanController extends Controller
|
||||
{
|
||||
$t_lelong = Carbon::parse($request->tarikh_lelong);
|
||||
$kali = $request->kali;
|
||||
//create tetapan
|
||||
$tetapan = Tetapan::first();
|
||||
if($tetapan){
|
||||
// create tetapan
|
||||
$tetapan = Tetapan::first();
|
||||
if ($tetapan) {
|
||||
$tetapan->tetap_tarikh_lelong = $request->tarikh_lelong;
|
||||
$tetapan->kali = $request->kali;
|
||||
$tetapan->cajlelong = $request->cajlelong;
|
||||
$tetapan->update();
|
||||
}else{
|
||||
} else {
|
||||
$newtetapan = new Tetapan;
|
||||
$newtetapan->tetap_tarikh_lelong = $request->tarikh_lelong;
|
||||
$newtetapan->kali = $request->kali;
|
||||
$newtetapan->cajlelong = $request->cajlelong;
|
||||
$newtetapan->save();
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('tetapan.parameter')
|
||||
->with('success','Tetapan Berjaya');
|
||||
return redirect()->route('tetapan.parameter')
|
||||
->with('success', 'Tetapan Berjaya');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Register user
|
||||
*
|
||||
* @param request
|
||||
* @return response
|
||||
*/
|
||||
@@ -22,18 +23,19 @@ class UserController extends Controller
|
||||
$this->validate($request, [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|min:6'
|
||||
'password' => 'required|min:6',
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password)
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Login page
|
||||
*
|
||||
* @param NA
|
||||
* @return view
|
||||
*/
|
||||
@@ -44,6 +46,7 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* User Login
|
||||
*
|
||||
* @param request
|
||||
* @return response
|
||||
*/
|
||||
@@ -51,7 +54,7 @@ class UserController extends Controller
|
||||
{
|
||||
$this->validate($request, [
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|min:6'
|
||||
'password' => 'required|min:6',
|
||||
]);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
@@ -59,13 +62,16 @@ class UserController extends Controller
|
||||
if (Hash::check($request->password, $user->password)) {
|
||||
return back()->with('success', 'Success! You are logged in');
|
||||
}
|
||||
|
||||
return back()->with('failed', 'Failed! Invalid password');
|
||||
}
|
||||
|
||||
return back()->with('failed', 'Failed! Invalid email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgot password
|
||||
*
|
||||
* @param NA
|
||||
* @return view
|
||||
*/
|
||||
@@ -76,6 +82,7 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* Validate token for forgot password
|
||||
*
|
||||
* @param token
|
||||
* @return view
|
||||
*/
|
||||
@@ -85,13 +92,16 @@ class UserController extends Controller
|
||||
// dd($user);
|
||||
if ($user) {
|
||||
$email = $user->email;
|
||||
|
||||
return view('auth.change-password', compact('email'));
|
||||
}
|
||||
|
||||
return redirect()->route('forgot-password')->with('failed', 'Password reset link is expired');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset password
|
||||
*
|
||||
* @param request
|
||||
* @return response
|
||||
*/
|
||||
@@ -103,7 +113,7 @@ class UserController extends Controller
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
// dd($user);
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
return back()->with('failed', 'Gagal! Alamat Ini Belum Didaftarkan.');
|
||||
}
|
||||
|
||||
@@ -113,26 +123,29 @@ class UserController extends Controller
|
||||
$user['is_verified'] = 0;
|
||||
$user->save();
|
||||
|
||||
$resetUrl = url('/forgot-password/' . $token);
|
||||
$resetUrl = url('/forgot-password/'.$token);
|
||||
|
||||
Mail::to($request->email)->send(new ResetPassword($user->name, $resetUrl));
|
||||
|
||||
if(Mail::failures() != 0) {
|
||||
if (Mail::failures() != 0) {
|
||||
return back()->with('success', 'Berjaya DiHantar! Pautan Lupa Katalaluan Telah Dihantarkan Kepada Alamat Emel Anda.');
|
||||
}
|
||||
|
||||
return back()->with('failed', 'Failed! there is some issue with email provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change password
|
||||
*
|
||||
* @param request
|
||||
* @return response
|
||||
*/
|
||||
public function updatePassword(Request $request) {
|
||||
public function updatePassword(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'email' => 'required',
|
||||
'password' => 'required|min:6',
|
||||
'confirm_password' => 'required|same:password'
|
||||
'confirm_password' => 'required|same:password',
|
||||
]);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
@@ -142,12 +155,13 @@ class UserController extends Controller
|
||||
$user['password'] = Hash::make($request->password);
|
||||
$user->save();
|
||||
// dd($user->user_type);
|
||||
if($user->user_type == 2){
|
||||
if ($user->user_type == 2) {
|
||||
return redirect()->to(config('app.app_pembida'));
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('login')->with('success', 'Berjaya! Katalaluan Anda Telah Didaftarkan.');
|
||||
}
|
||||
|
||||
return redirect()->route('forgot-password')->with('failed', 'Gadal! Sila Cuba Lagi...');
|
||||
}
|
||||
|
||||
@@ -155,4 +169,4 @@ class UserController extends Controller
|
||||
{
|
||||
return view('auth.termasyarat');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class Kernel extends HttpKernel
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
|
||||
@@ -12,8 +12,6 @@ class RedirectIfAuthenticated
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@@ -2,23 +2,20 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Events\LelongNotify;
|
||||
use App\Models\Cart;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LogUser;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Lelong;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Events\LelongNotify;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Models\LogUser;
|
||||
use App\Models\User;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\Cart;
|
||||
|
||||
|
||||
|
||||
class AutoTamatLelong implements ShouldQueue
|
||||
{
|
||||
@@ -43,57 +40,55 @@ class AutoTamatLelong implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$dt = Carbon::now();
|
||||
$timeloni = $dt->toTimeString();
|
||||
$tarikhlelong = $dt->toDateString();
|
||||
|
||||
event(new LelongNotify('stop'));
|
||||
$updatestatus = Lelong::where('sts_lelong',1)
|
||||
->where('tarikh_lelong',$tarikhlelong)
|
||||
->update(['sts_lelong' => 2]);
|
||||
$dt = Carbon::now();
|
||||
$timeloni = $dt->toTimeString();
|
||||
$tarikhlelong = $dt->toDateString();
|
||||
|
||||
$cawlelong = CawanganLelong::where('lelong_id','=',$this->id)->get();
|
||||
foreach($cawlelong as $cawlel) //save old harga asas
|
||||
{
|
||||
// $cawlel->masatamat_lelong = $currenttime;
|
||||
$cawlel->status_online = 0; //start lelong
|
||||
$cawlel->save();
|
||||
}
|
||||
event(new LelongNotify('stop'));
|
||||
$updatestatus = Lelong::where('sts_lelong', 1)
|
||||
->where('tarikh_lelong', $tarikhlelong)
|
||||
->update(['sts_lelong' => 2]);
|
||||
|
||||
$hapuscart = Cart::truncate();
|
||||
$cawlelong = CawanganLelong::where('lelong_id', '=', $this->id)->get();
|
||||
foreach ($cawlelong as $cawlel) { // save old harga asas
|
||||
// $cawlel->masatamat_lelong = $currenttime;
|
||||
$cawlel->status_online = 0; // start lelong
|
||||
$cawlel->save();
|
||||
}
|
||||
|
||||
|
||||
$hapuscart = Cart::truncate();
|
||||
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach($getnoajk as $notifikasi){
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
$response = null;
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach ($getnoajk as $notifikasi) {
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => 'Lelongan Telah Tamat, Sila Jana Pemenang',
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
}
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => 'Lelongan Telah Tamat, Sila Jana Pemenang',
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys'),
|
||||
]);
|
||||
}
|
||||
|
||||
//insert loguser
|
||||
$loguser = new LogUser;
|
||||
// $loguser->user_id = $user->id;
|
||||
$loguser->date = $dt;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
// $loguser->norujukan = $data['norujukan'];
|
||||
$loguser->nota = 'Lelongan Tamat';
|
||||
$loguser->save();
|
||||
|
||||
Log::info("Lelongan Telah Tamat" . $response);
|
||||
// }
|
||||
|
||||
// event(new LelongNotify('stop'));
|
||||
// insert loguser
|
||||
$loguser = new LogUser;
|
||||
// $loguser->user_id = $user->id;
|
||||
$loguser->date = $dt;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
// $loguser->norujukan = $data['norujukan'];
|
||||
$loguser->nota = 'Lelongan Tamat';
|
||||
$loguser->save();
|
||||
|
||||
Log::info('Lelongan Telah Tamat', ['response' => $response]);
|
||||
// }
|
||||
|
||||
// event(new LelongNotify('stop'));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,29 +19,31 @@ trait ResolvesJanaNotisJumlah
|
||||
->where('norujukan', $suratnotis->norujukan)
|
||||
->first();
|
||||
|
||||
if (!$lelongBid) {
|
||||
if (! $lelongBid) {
|
||||
Log::warning('Jana notis jumlah: lelong bid not found', [
|
||||
'lelong_id' => $lelongId,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$tagbaru = (string) $suratnotis->tagbaru;
|
||||
$jeniskeuntungan = $tagbaru === '1' ? 'onepercent' : 'asal';
|
||||
|
||||
$api = Http::get(config('app.api_ujrah_url') . 'get/upahtawarruqbytarikh', [
|
||||
$api = Http::get(config('app.api_ujrah_url').'get/upahtawarruqbytarikh', [
|
||||
'kodcaw' => $kodcaw,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
'tarikh' => $lelongBid->t_lelong,
|
||||
'jeniskeuntungan' => $jeniskeuntungan,
|
||||
])->json();
|
||||
|
||||
if (!is_array($api)) {
|
||||
if (! is_array($api)) {
|
||||
Log::warning('Jana notis jumlah: API returned null', [
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
'jeniskeuntungan' => $jeniskeuntungan,
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Jobs\WhatsappNotisLelongFasa1;
|
||||
use App\Jobs\WhatsappNotisLelongFasa2;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Gadai;
|
||||
@@ -44,7 +42,7 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
ini_set('memory_limit', '2048M');
|
||||
|
||||
$export = JanaNotisExport::find($this->exportId);
|
||||
if (!$export) {
|
||||
if (! $export) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +56,7 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
$lelong_id = $export->lelong_id;
|
||||
$fasa = (int) $export->fasa;
|
||||
|
||||
Log::info("Jana notis fasa {$fasa} (queued): {$export->kodcaw}, " . ($user->name ?? 'unknown'));
|
||||
Log::info("Jana notis fasa {$fasa} (queued): {$export->kodcaw}, ".($user->name ?? 'unknown'));
|
||||
|
||||
$tarikh_cetak = Carbon::now()->toDateString();
|
||||
$lelongid = Lelong::find($lelong_id);
|
||||
@@ -100,7 +98,7 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
|
||||
$tagbaru = $marhun->tagbaru;
|
||||
if ($tagbaru == '0') {
|
||||
$getkeuntunganhinggatarikhlelong = Http::get(config('app.api_ujrah_url') . 'get/upahtawarruqbytarikh', [
|
||||
$getkeuntunganhinggatarikhlelong = Http::get(config('app.api_ujrah_url').'get/upahtawarruqbytarikh', [
|
||||
'kodcaw' => $export->kodcaw,
|
||||
'norujukan' => $marhun->norujukan,
|
||||
'tarikh' => $getdatalelongbid['t_lelong'],
|
||||
@@ -117,7 +115,7 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
$marhuns[$index]['nilaikeuntungan'] = $nilaikeuntungan;
|
||||
$marhuns[$index]['jumlah'] = $jumlah;
|
||||
} elseif ($tagbaru == '1') {
|
||||
$getkeuntunganhinggatarikhlelong = Http::get(config('app.api_ujrah_url') . 'get/upahtawarruqbytarikh', [
|
||||
$getkeuntunganhinggatarikhlelong = Http::get(config('app.api_ujrah_url').'get/upahtawarruqbytarikh', [
|
||||
'kodcaw' => $export->kodcaw,
|
||||
'norujukan' => $marhun->norujukan,
|
||||
'tarikh' => $getdatalelongbid['t_lelong'],
|
||||
@@ -140,8 +138,8 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
}
|
||||
|
||||
$view = $fasa === 2 ? 'pdf.jananotisfasa2_new' : 'pdf.jananotis_new';
|
||||
$fileName = 'Penjanaan Notis Fasa ' . $fasa . ':Batch Lelong ' . $lelong_id . '.pdf';
|
||||
$relativePath = 'jana_notis/' . $export->kodcaw . '/' . $lelong_id . '_fasa' . $fasa . '_' . $export->id . '.pdf';
|
||||
$fileName = 'Penjanaan Notis Fasa '.$fasa.':Batch Lelong '.$lelong_id.'.pdf';
|
||||
$relativePath = 'jana_notis/'.$export->kodcaw.'/'.$lelong_id.'_fasa'.$fasa.'_'.$export->id.'.pdf';
|
||||
|
||||
$pdf = PDF::loadView($view, compact('marhuns', 'lelongid', 'caw', 'tarikh_cetak'))
|
||||
->setPaper('a4', 'potrait');
|
||||
@@ -174,7 +172,7 @@ class GenerateJanaNotisPdf implements ShouldQueue
|
||||
]);
|
||||
}
|
||||
|
||||
Log::error('GenerateJanaNotisPdf failed: ' . $exception->getMessage(), [
|
||||
Log::error('GenerateJanaNotisPdf failed: '.$exception->getMessage(), [
|
||||
'export_id' => $this->exportId,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Mail\Pemenang;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Pemenang;
|
||||
|
||||
class HantarMail implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_email;
|
||||
|
||||
public $user_name;
|
||||
|
||||
protected $total_bid_win_converted;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Mail\NotifyAdmin;
|
||||
use App\Mail\NotifyJanaNotis as MailNotifyJanaNotis;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class NotifyJanaNotis implements ShouldQueue
|
||||
@@ -18,9 +15,13 @@ class NotifyJanaNotis implements ShouldQueue
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public $user_kodcaw;
|
||||
|
||||
private $user_name;
|
||||
|
||||
private $description;
|
||||
|
||||
private $date_time;
|
||||
|
||||
/**
|
||||
@@ -53,7 +54,7 @@ class NotifyJanaNotis implements ShouldQueue
|
||||
|
||||
$admin_emails = explode(',', config('app.admin_email'));
|
||||
|
||||
foreach($admin_emails as $email) {
|
||||
foreach ($admin_emails as $email) {
|
||||
Mail::to($email)->send(new NotifyAdmin($content_collection));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ class WhatsappNotisLelongFasa1 implements ShouldQueue
|
||||
public $tries = 1;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public $user_kodcaw;
|
||||
|
||||
protected $lelong_id;
|
||||
|
||||
public function __construct($user_id, $user_kodcaw, $lelong_id)
|
||||
@@ -39,20 +41,23 @@ class WhatsappNotisLelongFasa1 implements ShouldQueue
|
||||
|
||||
public function handle(WhatsAppCloudService $whatsapp)
|
||||
{
|
||||
if (!$whatsapp->isEnabled()) {
|
||||
if (! $whatsapp->isEnabled()) {
|
||||
Log::warning('WhatsappNotisLelongFasa1 skipped: WhatsApp Cloud API not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$caw = Cawangan::where('caw_code', $this->user_kodcaw)->first();
|
||||
if (!$caw) {
|
||||
if (! $caw) {
|
||||
Log::error('WhatsappNotisLelongFasa1: cawangan not found', ['kodcaw' => $this->user_kodcaw]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$lel = Lelong::find($this->lelong_id);
|
||||
if (!$lel) {
|
||||
if (! $lel) {
|
||||
Log::error('WhatsappNotisLelongFasa1: lelong not found', ['lelong_id' => $this->lelong_id]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,17 +91,18 @@ class WhatsappNotisLelongFasa1 implements ShouldQueue
|
||||
$lang = config('whatsapp.jana_notis_template_lang');
|
||||
|
||||
foreach ($gadaiAll as $suratnotis) {
|
||||
if (!isset($customersByKp[$suratnotis->nokp])) {
|
||||
if (! isset($customersByKp[$suratnotis->nokp])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customer = $customersByKp[$suratnotis->nokp];
|
||||
$recipient = $whatsapp->resolveRecipient($customer->telefon);
|
||||
if (!$recipient) {
|
||||
if (! $recipient) {
|
||||
Log::warning('WhatsappNotisLelongFasa1: invalid phone', [
|
||||
'nokp' => $suratnotis->nokp,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -105,18 +111,29 @@ class WhatsappNotisLelongFasa1 implements ShouldQueue
|
||||
Log::warning('WhatsappNotisLelongFasa1: skip send, jumlah unavailable', [
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Simplified notice letter as template body params.
|
||||
if (empty($caw->notel)) {
|
||||
Log::warning('WhatsappNotisLelongFasa1: skip send, cawangan phone missing', [
|
||||
'kodcaw' => $caw->caw_code,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// {{1}} nama, {{2}} norujukan, {{3}} jumlah, {{4}} tarikh lelong,
|
||||
// {{5}} tarikh akhir bayaran, {{6}} telefon cawangan, {{7}} cawangan
|
||||
$bodyParams = [
|
||||
$customer->nama,
|
||||
$suratnotis->nokp,
|
||||
$suratnotis->norujukan,
|
||||
$caw->caw_name,
|
||||
$jumlah,
|
||||
$tarikhLelong,
|
||||
$tarikhSebelum,
|
||||
$jumlah,
|
||||
$caw->notel,
|
||||
$caw->caw_name,
|
||||
];
|
||||
|
||||
$whatsapp->sendTemplate($recipient, $template, $bodyParams, $lang);
|
||||
|
||||
@@ -26,7 +26,9 @@ class WhatsappNotisLelongFasa2 implements ShouldQueue
|
||||
public $tries = 1;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public $user_kodcaw;
|
||||
|
||||
protected $lelong_id;
|
||||
|
||||
public function __construct($user_id, $user_kodcaw, $lelong_id)
|
||||
@@ -39,20 +41,23 @@ class WhatsappNotisLelongFasa2 implements ShouldQueue
|
||||
|
||||
public function handle(WhatsAppCloudService $whatsapp)
|
||||
{
|
||||
if (!$whatsapp->isEnabled()) {
|
||||
if (! $whatsapp->isEnabled()) {
|
||||
Log::warning('WhatsappNotisLelongFasa2 skipped: WhatsApp Cloud API not enabled.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$caw = Cawangan::where('caw_code', $this->user_kodcaw)->first();
|
||||
if (!$caw) {
|
||||
if (! $caw) {
|
||||
Log::error('WhatsappNotisLelongFasa2: cawangan not found', ['kodcaw' => $this->user_kodcaw]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$lel = Lelong::find($this->lelong_id);
|
||||
if (!$lel) {
|
||||
if (! $lel) {
|
||||
Log::error('WhatsappNotisLelongFasa2: lelong not found', ['lelong_id' => $this->lelong_id]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,17 +91,18 @@ class WhatsappNotisLelongFasa2 implements ShouldQueue
|
||||
$lang = config('whatsapp.jana_notis_template_lang');
|
||||
|
||||
foreach ($gadaiAll as $suratnotis) {
|
||||
if (!isset($customersByKp[$suratnotis->nokp])) {
|
||||
if (! isset($customersByKp[$suratnotis->nokp])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customer = $customersByKp[$suratnotis->nokp];
|
||||
$recipient = $whatsapp->resolveRecipient($customer->telefon);
|
||||
if (!$recipient) {
|
||||
if (! $recipient) {
|
||||
Log::warning('WhatsappNotisLelongFasa2: invalid phone', [
|
||||
'nokp' => $suratnotis->nokp,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -105,17 +111,29 @@ class WhatsappNotisLelongFasa2 implements ShouldQueue
|
||||
Log::warning('WhatsappNotisLelongFasa2: skip send, jumlah unavailable', [
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty($caw->notel)) {
|
||||
Log::warning('WhatsappNotisLelongFasa2: skip send, cawangan phone missing', [
|
||||
'kodcaw' => $caw->caw_code,
|
||||
'norujukan' => $suratnotis->norujukan,
|
||||
]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// {{1}} nama, {{2}} norujukan, {{3}} jumlah, {{4}} tarikh lelong,
|
||||
// {{5}} tarikh akhir bayaran, {{6}} telefon cawangan, {{7}} cawangan
|
||||
$bodyParams = [
|
||||
$customer->nama,
|
||||
$suratnotis->nokp,
|
||||
$suratnotis->norujukan,
|
||||
$caw->caw_name,
|
||||
$jumlah,
|
||||
$tarikhLelong,
|
||||
$tarikhSebelum,
|
||||
$jumlah,
|
||||
$caw->notel,
|
||||
$caw->caw_name,
|
||||
];
|
||||
|
||||
$whatsapp->sendTemplate($recipient, $template, $bodyParams, $lang);
|
||||
|
||||
@@ -2,39 +2,38 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\Notis;
|
||||
use App\Models\NotisBid;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Notis;
|
||||
use App\Models\NotisBid;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\Customer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\CawanganNotis;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class WhatsappNotisPeringatanKedua implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public $user_kodcaw;
|
||||
|
||||
protected $notisid;
|
||||
|
||||
protected $cawid;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_id, $user_kodcaw, $notisid,$cawid)
|
||||
public function __construct($user_id, $user_kodcaw, $notisid, $cawid)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->user_kodcaw = $user_kodcaw;
|
||||
@@ -57,66 +56,64 @@ class WhatsappNotisPeringatanKedua implements ShouldQueue
|
||||
|
||||
$notis = Notis::find($this->notisid);
|
||||
// dd($notis->tarikh_notis);
|
||||
$notis_bid_all = NotisBid::select('id','nokp','norujukan','jbg','pinjaman','fasa')->where('notis_id', $this->notisid)->where('kodcaw', $caw->caw_code)->get();
|
||||
$notis_bid_all = NotisBid::select('id', 'nokp', 'norujukan', 'jbg', 'pinjaman', 'fasa')->where('notis_id', $this->notisid)->where('kodcaw', $caw->caw_code)->get();
|
||||
$arraynorujukan_notis_bid_all = NotisBid::where('notis_id', $this->notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
|
||||
|
||||
|
||||
$arraynorujukan = NotisBid::where('notis_id', $this->notisid)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
|
||||
$gadai_all = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan','bakipjm','t_matang','t_matang1','tempoh')->orderBy('nokp', 'asc')->get();
|
||||
|
||||
$gadai_all = Gadai::on($caw->caw_code)->whereIn('norujukan', $arraynorujukan)->select('nokp', 'norujukan', 'bakipjm', 't_matang', 't_matang1', 'tempoh')->orderBy('nokp', 'asc')->get();
|
||||
|
||||
$customers_list = $gadai_all->pluck('nokp')->unique();
|
||||
$customers = Customer::whereIn('kpbaru', $customers_list)
|
||||
->orWhereIn('kplama', $customers_list)
|
||||
->select('id','kpbaru','kplama' ,'nama', 'telefon')
|
||||
->get()->keyBy('id');
|
||||
|
||||
->orWhereIn('kplama', $customers_list)
|
||||
->select('id', 'kpbaru', 'kplama', 'nama', 'telefon')
|
||||
->get()->keyBy('id');
|
||||
|
||||
$customers_keyBy_noKp = $customers->keyBy(function ($item) {
|
||||
if ($item->kpbaru != '') {
|
||||
return $item->kpbaru;
|
||||
} else if ($item->kplama != '') {
|
||||
} elseif ($item->kplama != '') {
|
||||
return $item->kplama;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$customers_pluck_notel = $customers_keyBy_noKp->pluck('telefon');
|
||||
// dd($customers_pluck_notel);
|
||||
foreach($customers_pluck_notel as $index1 =>$custphone) {
|
||||
foreach ($customers_pluck_notel as $index1 => $custphone) {
|
||||
// dd($custphone);
|
||||
$special = preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $custphone);
|
||||
// dump($special);
|
||||
if($special == 0){
|
||||
if($custphone == ''){
|
||||
$newtel = '';
|
||||
}elseif($custphone <> ''){
|
||||
$newtel = '6'.$custphone;
|
||||
}
|
||||
// dump($special);
|
||||
if ($special == 0) {
|
||||
if ($custphone == '') {
|
||||
$newtel = '';
|
||||
} elseif ($custphone != '') {
|
||||
$newtel = '6'.$custphone;
|
||||
}
|
||||
elseif($special == 1){
|
||||
if($custphone == ''){
|
||||
$newtel = '';
|
||||
}elseif($custphone <> ''){
|
||||
$newtel = '6'.str_replace( array( '-' ), '', $custphone);
|
||||
}
|
||||
} elseif ($special == 1) {
|
||||
if ($custphone == '') {
|
||||
$newtel = '';
|
||||
} elseif ($custphone != '') {
|
||||
$newtel = '6'.str_replace(['-'], '', $custphone);
|
||||
}
|
||||
// dump($newtel);
|
||||
|
||||
}
|
||||
// dump($newtel);
|
||||
|
||||
}
|
||||
$notis_bid_all_groupby_norujukan = $notis_bid_all->groupBy('norujukan');
|
||||
$notis_all_keyBy_norujukan = $gadai_all->keyBy('norujukan');
|
||||
foreach($notis_bid_all_groupby_norujukan as $index7=>$notisbid){
|
||||
foreach ($notis_bid_all_groupby_norujukan as $index7 => $notisbid) {
|
||||
// dd($notis_all_keyBy_norujukan);
|
||||
if($notis_all_keyBy_norujukan[$index7]){
|
||||
|
||||
if ($notis_all_keyBy_norujukan[$index7]) {
|
||||
|
||||
$gadai_true = $notis_all_keyBy_norujukan[$index7];
|
||||
$gadai_true['data_notisbid'] = $notisbid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// dd($gadai_all);
|
||||
foreach ($gadai_all as $index => $suratnotis) {
|
||||
$datanotisbid = $suratnotis['data_notisbid'][0]->fasa;
|
||||
// dd($suratnotis);
|
||||
if($customers_keyBy_noKp[$suratnotis->nokp])
|
||||
{
|
||||
if ($customers_keyBy_noKp[$suratnotis->nokp]) {
|
||||
$mobile_no = '60178916936';
|
||||
// $mobile_no = $newtel;
|
||||
$user_true = $customers_keyBy_noKp[$suratnotis->nokp];
|
||||
@@ -128,7 +125,7 @@ class WhatsappNotisPeringatanKedua implements ShouldQueue
|
||||
$t_matangf2 = $t_matang1->format('d-m-Y');
|
||||
$cawname = $caw->caw_name;
|
||||
// dd($t_matang1);
|
||||
if( $datanotisbid == '1'){
|
||||
if ($datanotisbid == '1') {
|
||||
$message = '*NOTIS PEMBERITAHUAN*
|
||||
|
||||
Nama: *'.$nama.'*
|
||||
@@ -140,8 +137,7 @@ Tempoh: *'.$suratnotis->tempoh.' bulan*
|
||||
|
||||
Tuan/puan atau wakil adalah dikehendaki menebus/membayar *KOS KEUNTUNGAN* tersebut secepat mungkin. Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di dalam *Surat Akaun Gadaian* ATAU datang sendiri ke *'.$cawname.'* dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan.
|
||||
Sekian, terima kasih.';
|
||||
}
|
||||
else if( $datanotisbid == '2'){
|
||||
} elseif ($datanotisbid == '2') {
|
||||
$message = '*NOTIS PEMBERITAHUAN*
|
||||
|
||||
Nama: *'.$nama.'*
|
||||
@@ -154,20 +150,19 @@ Tempoh: *'.$suratnotis->tempoh.' bulan*.
|
||||
Tuan/puan atau wakil adalah dikehendaki menebus/tukar surat di premis kami dengan kadar yang segera. Jika pihak tuan/puan menghadapi sebarang masalah, sila hubungi kami sebagaimana alamat di dalam *Surat Akaun Gadaian* ATAU datang sendiri ke *'.$cawname.'* dengan membawa bersama salinan asal Surat Akaun Gadaian tuan/puan.
|
||||
Sekian, terima kasih.';
|
||||
|
||||
|
||||
}
|
||||
if(config('app.env') != 'production'){
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
'access_token' => config('app.wabot_token_keys'),
|
||||
]);
|
||||
|
||||
Log::info("WABOT - notis peringatan kedua " . $response);
|
||||
Log::info('WABOT - notis peringatan kedua '.$response);
|
||||
}
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@@ -2,40 +2,37 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongCawangan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Lelong;
|
||||
use App\Models\LelongCawangan;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\Customer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\CawanganLelong;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class WhatsappNotisTuntutBaki implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public $user_kodcaw;
|
||||
|
||||
protected $lelong_id;
|
||||
|
||||
protected $caw_id;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_id, $user_kodcaw, $lelong_id,$caw_id)
|
||||
public function __construct($user_id, $user_kodcaw, $lelong_id, $caw_id)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->user_kodcaw = $user_kodcaw;
|
||||
@@ -56,77 +53,75 @@ class WhatsappNotisTuntutBaki implements ShouldQueue
|
||||
$currentdate = Carbon::now();
|
||||
|
||||
$lel = Lelong::with('cawangan')->find($this->lelong_id);
|
||||
|
||||
|
||||
$cawanganDetail = $lel->cawangan->find($this->caw_id);
|
||||
$lelong_id = $this->lelong_id;
|
||||
$cawangan = Cawangan::with(["lelongBid" => function($q) use ($lelong_id){
|
||||
$q->where('lelong_id', '=', $lelong_id)->select('id','caw_id','kodcaw','norujukan','pinjaman','bakiupah','hargaasas','nilaimarhun','cajlelong','baki');
|
||||
$cawangan = Cawangan::with(['lelongBid' => function ($q) use ($lelong_id) {
|
||||
$q->where('lelong_id', '=', $lelong_id)->select('id', 'caw_id', 'kodcaw', 'norujukan', 'pinjaman', 'bakiupah', 'hargaasas', 'nilaimarhun', 'cajlelong', 'baki');
|
||||
}])
|
||||
->where('caw_code','=',$cawanganDetail->caw_code)->first();
|
||||
->where('caw_code', '=', $cawanganDetail->caw_code)->first();
|
||||
$lelongbid_data_pluck_norujukan = $cawangan->lelongBid->pluck('norujukan')->toArray();
|
||||
$gadai_all = LelongCawangan::on($cawanganDetail->caw_code)->whereIn('lelong.norujukan', $lelongbid_data_pluck_norujukan)
|
||||
->join('gadai','gadai.norujukan','=','lelong.norujukan')
|
||||
->where('trkhtuntut','=',null)
|
||||
->where('baki','>', '0.00')
|
||||
->select('nokp', 'lelong.norujukan','lelong.t_lelong AS tarikhlelong','lelong.hargajual','lelong.gst_hj','gadai.bakipjm','lelong.bakiupah','lelong.cajlelong','lelong.gst_cl','lelong.cajlain','lelong.baki')
|
||||
->orderBy('nokp', 'asc')
|
||||
->orderBy('lelong.norujukan','ASC')
|
||||
->get();
|
||||
->join('gadai', 'gadai.norujukan', '=', 'lelong.norujukan')
|
||||
->where('trkhtuntut', '=', null)
|
||||
->where('baki', '>', '0.00')
|
||||
->select('nokp', 'lelong.norujukan', 'lelong.t_lelong AS tarikhlelong', 'lelong.hargajual', 'lelong.gst_hj', 'gadai.bakipjm', 'lelong.bakiupah', 'lelong.cajlelong', 'lelong.gst_cl', 'lelong.cajlain', 'lelong.baki')
|
||||
->orderBy('nokp', 'asc')
|
||||
->orderBy('lelong.norujukan', 'ASC')
|
||||
->get();
|
||||
|
||||
$customers_list = $gadai_all->pluck('nokp')->unique();
|
||||
$customers = Customer::whereIn('kpbaru', $customers_list)
|
||||
->orWhereIn('kplama', $customers_list)
|
||||
->select('id','kpbaru','kplama' ,'nama', 'telefon')
|
||||
->get()->keyBy('id');
|
||||
|
||||
->orWhereIn('kplama', $customers_list)
|
||||
->select('id', 'kpbaru', 'kplama', 'nama', 'telefon')
|
||||
->get()->keyBy('id');
|
||||
|
||||
$customers_keyBy_noKp = $customers->keyBy(function ($item) {
|
||||
if ($item->kpbaru != '') {
|
||||
return $item->kpbaru;
|
||||
} else if ($item->kplama != '') {
|
||||
} elseif ($item->kplama != '') {
|
||||
return $item->kplama;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$customers_pluck_notel = $customers_keyBy_noKp->pluck('telefon');
|
||||
// dd($customers_pluck_notel);
|
||||
foreach($customers_pluck_notel as $index1 =>$custphone) {
|
||||
foreach ($customers_pluck_notel as $index1 => $custphone) {
|
||||
// dd($custphone);
|
||||
$special = preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $custphone);
|
||||
// dump($special);
|
||||
if($special == 0){
|
||||
if($custphone == ''){
|
||||
$newtel = '';
|
||||
}elseif($custphone <> ''){
|
||||
$newtel = '6'.$custphone;
|
||||
}
|
||||
// dump($special);
|
||||
if ($special == 0) {
|
||||
if ($custphone == '') {
|
||||
$newtel = '';
|
||||
} elseif ($custphone != '') {
|
||||
$newtel = '6'.$custphone;
|
||||
}
|
||||
elseif($special == 1){
|
||||
if($custphone == ''){
|
||||
$newtel = '';
|
||||
}elseif($custphone <> ''){
|
||||
$newtel = '6'.str_replace( array( '-' ), '', $custphone);
|
||||
}
|
||||
} elseif ($special == 1) {
|
||||
if ($custphone == '') {
|
||||
$newtel = '';
|
||||
} elseif ($custphone != '') {
|
||||
$newtel = '6'.str_replace(['-'], '', $custphone);
|
||||
}
|
||||
// dump($newtel);
|
||||
|
||||
}
|
||||
// dump($newtel);
|
||||
|
||||
}
|
||||
$lelong_bid_all_groupby_norujukan = $gadai_all->groupBy('norujukan');
|
||||
$lelong_all_keyBy_norujukan = $gadai_all->keyBy('norujukan');
|
||||
foreach($lelong_bid_all_groupby_norujukan as $index7=>$lelongbid){
|
||||
foreach ($lelong_bid_all_groupby_norujukan as $index7 => $lelongbid) {
|
||||
// dd($notis_all_keyBy_norujukan);
|
||||
if($lelong_all_keyBy_norujukan[$index7]){
|
||||
|
||||
if ($lelong_all_keyBy_norujukan[$index7]) {
|
||||
|
||||
$gadai_true = $lelong_all_keyBy_norujukan[$index7];
|
||||
$gadai_true['data_lelongbid'] = $lelongbid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// dd($gadai_all);
|
||||
foreach ($gadai_all as $index => $suratnotis) {
|
||||
$datanotisbid = $suratnotis['data_lelongbid'][0]->fasa;
|
||||
// dd($suratnotis);
|
||||
if($customers_keyBy_noKp[$suratnotis->nokp])
|
||||
{
|
||||
if ($customers_keyBy_noKp[$suratnotis->nokp]) {
|
||||
$mobile_no = '60178916936';
|
||||
// $mobile_no = $newtel;
|
||||
$user_true = $customers_keyBy_noKp[$suratnotis->nokp];
|
||||
@@ -137,7 +132,7 @@ class WhatsappNotisTuntutBaki implements ShouldQueue
|
||||
$cawname = $caw->caw_name;
|
||||
$parabaki2 = $caw->parabaki2;
|
||||
// dd($t_matang1);
|
||||
$message = '*NOTIS MAKLUMAN LEBIHAN WANG LELONGAN BARANGAN*
|
||||
$message = '*NOTIS MAKLUMAN LEBIHAN WANG LELONGAN BARANGAN*
|
||||
|
||||
Nama: *'.$nama.'*
|
||||
No.KP: *'.$suratnotis->nokp.'*'.'
|
||||
@@ -145,22 +140,22 @@ No.Rujukan: *'.$suratnotis->norujukan.'*
|
||||
Tarikh Lelong: *'.$t_jualf1.'*
|
||||
Wang Lebihan: *RM'.$baki.'*'.'
|
||||
|
||||
'.$parabaki2. ' *'.$cawname.'*.
|
||||
'.$parabaki2.' *'.$cawname.'*.
|
||||
|
||||
Terima Kasih';
|
||||
|
||||
if(config('app.env') != 'production'){
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
'access_token' => config('app.wabot_token_keys'),
|
||||
]);
|
||||
|
||||
Log::info("WABOT - Notis Tuntutan Baki Lelong" . $response);
|
||||
Log::info('WABOT - Notis Tuntutan Baki Lelong'.$response);
|
||||
}
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\LogUser;
|
||||
|
||||
class WhatsappPembidaFPXPaid implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $userId, $resitId, $amount;
|
||||
|
||||
public function __construct($userId, $resitId, $amount)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->resitId = $resitId;
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$dt = Carbon::now();
|
||||
$user = User::find($this->userId);
|
||||
if (!$user || !$user->notelbimbit) return;
|
||||
|
||||
$message = "Assalamualaikum {$user->name}, bayaran FPX anda sebanyak RM " . number_format($this->amount, 2) . " telah berjaya direkodkan. Resit ID: {$this->resitId}. Terima kasih.";
|
||||
|
||||
$mobile_no = '6' . $user->notelbimbit;
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
|
||||
$loguser = new LogUser;
|
||||
$loguser->date = $dt;
|
||||
$loguser->username = 'Operasi';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->nota = 'Notifikasi Pembayaran Billplz Berjaya';
|
||||
$loguser->save();
|
||||
|
||||
Log::info("Notifikasi Pembayaran Billplz Berjaya: " . $response);
|
||||
}
|
||||
}
|
||||
@@ -2,66 +2,52 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Services\WhatsAppCloudService;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Notis;
|
||||
use App\Models\NotisBid;
|
||||
use App\Models\Gadai;
|
||||
use App\Models\Customer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\CawanganNotis;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class WhatsappPemenang implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_notelbimbit;
|
||||
|
||||
public $total_bid_win_converted;
|
||||
// protected $notisid;
|
||||
// protected $cawid;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct($user_notelbimbit, $total_bid_win_converted)
|
||||
{
|
||||
$this->user_notelbimbit = $user_notelbimbit;
|
||||
$this->total_bid_win_converted = $total_bid_win_converted;
|
||||
// $this->notisid = $notisid;
|
||||
// $this->cawid = $cawid;
|
||||
$this->onQueue('default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(WhatsAppCloudService $whatsapp)
|
||||
{
|
||||
$mobile_no = ltrim($this->user_notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Tahniah Anda Menang Bidaan Sebanyak RM' . $this->total_bid_win_converted . '. Sila Semak Melalui Sistem ArrahnBid. Terima Kasih.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
if (! $whatsapp->isEnabled()) {
|
||||
Log::warning('WhatsappPemenang skipped: WhatsApp Cloud API not enabled.');
|
||||
|
||||
Log::info("WABOT - menang bidaan " . $response);
|
||||
return;
|
||||
}
|
||||
|
||||
$recipient = $whatsapp->resolveRecipient($this->user_notelbimbit);
|
||||
if (! $recipient) {
|
||||
Log::warning('WhatsappPemenang: invalid phone', [
|
||||
'notelbimbit' => $this->user_notelbimbit,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// {{1}} jumlah bidaan menang (formatted, without RM)
|
||||
$whatsapp->sendTemplate(
|
||||
$recipient,
|
||||
config('whatsapp.pemenang_template'),
|
||||
[$this->total_bid_win_converted],
|
||||
config('whatsapp.pemenang_template_lang')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\Cawangan;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class WhatsappPengesahanPembida implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_notelbimbit;
|
||||
public $user_namapembida;
|
||||
public $user_cawname;
|
||||
|
||||
// protected $notisid;
|
||||
// protected $cawid;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_notelbimbit,$user_namapembida,$user_cawname)
|
||||
{
|
||||
$this->user_notelbimbit = $user_notelbimbit;
|
||||
$this->user_namapembida = $user_namapembida;
|
||||
$this->user_cawname = $user_cawname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$mobile_no = ltrim($this->user_notelbimbit, '+');
|
||||
$message = 'AR-RAHN PKB: Terima Kasih '.$this->user_namapembida .', Pembayaran Bidaan Anda Untuk Cawangan *'.$this->user_cawname.'* Telah Disahkan, Sila Ke Cawangan Berkenaan Untuk Tuntutan Barang Bidaan Anda Hari Ini.';
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
|
||||
Log::info("WABOT - Akaun Telah Sahkan Pembayaran: ".$this->user_namapembida .'' . $response);
|
||||
}
|
||||
}
|
||||
@@ -2,19 +2,14 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
use App\Models\LogUser;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
|
||||
|
||||
class WhatsappTidakSahBayaran implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
@@ -38,21 +33,20 @@ class WhatsappTidakSahBayaran implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach($getnoajk as $notifikasi){
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
$getnoajk = User::where('user_type', 3)->get();
|
||||
foreach ($getnoajk as $notifikasi) {
|
||||
$mobile_no = '6'.$notifikasi->notelbimbit;
|
||||
|
||||
if(config('app.env') != 'production'){
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => 'Bayaran Pembida yang bernama *'.$this->user_namapembida.'* Adalah *Tidak Sah*, Mohon Pihak AJK Lelong Untuk Buat Semakan, Terima Kasih.' ,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
}
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => 'Bayaran Pembida yang bernama *'.$this->user_namapembida.'* Adalah *Tidak Sah*, Mohon Pihak AJK Lelong Untuk Buat Semakan, Terima Kasih.',
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@@ -30,8 +29,8 @@ class NotifyAdmin extends Mailable
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from("masterlelongpkb@gmail.com", "Admin ArrahnBid")
|
||||
->subject('ArrahnBid - ' . $this->content_collection['description'])
|
||||
return $this->from('masterlelongpkb@gmail.com', 'Admin ArrahnBid')
|
||||
->subject('ArrahnBid - '.$this->content_collection['description'])
|
||||
->view('template.notifyadmin', ['content_collection' => $this->content_collection]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\LelongBidder;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Pemenang extends Mailable
|
||||
{
|
||||
@@ -18,8 +17,8 @@ class Pemenang extends Mailable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public $name;
|
||||
|
||||
public $total_bid_win;
|
||||
// public $id;
|
||||
// public $lelong_id;
|
||||
@@ -62,11 +61,11 @@ class Pemenang extends Mailable
|
||||
// {
|
||||
// $bidders[$index]['hargabida'] = $bidder->sum('hargabida');
|
||||
// }
|
||||
|
||||
|
||||
// $infos[$index1]['info'] = $info;
|
||||
|
||||
return $this->from("masterlelongpkb@gmail.com", "Admin ArrahnBid")
|
||||
->subject('ArrahnBid -Tahniah,Anda Pemenang ArrahnBid')
|
||||
->view('template.pemenang', ['user' => $user]);
|
||||
return $this->from('masterlelongpkb@gmail.com', 'Admin ArrahnBid')
|
||||
->subject('ArrahnBid -Tahniah,Anda Pemenang ArrahnBid')
|
||||
->view('template.pemenang', ['user' => $user]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@@ -12,6 +11,7 @@ class ResetPassword extends Mailable
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $name;
|
||||
|
||||
public $resetUrl;
|
||||
|
||||
public function __construct($name, $resetUrl)
|
||||
|
||||
@@ -11,6 +11,7 @@ class VerifyEmail extends Mailable
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $name;
|
||||
|
||||
public $verifyUrl;
|
||||
|
||||
public function __construct($name, $verifyUrl)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@@ -12,6 +11,7 @@ class notislelong extends Mailable
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $mailData;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
@@ -30,6 +30,6 @@ class notislelong extends Mailable
|
||||
public function build()
|
||||
{
|
||||
return $this->markdown('Email.notispembida')
|
||||
->with('mailData', $this->mailData);
|
||||
->with('mailData', $this->mailData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Bulan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'bulan';
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ class Cart extends Model
|
||||
protected $table = 'carts';
|
||||
|
||||
protected $fillable = [
|
||||
'hargabida'
|
||||
'hargabida',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -29,15 +29,15 @@ class Cawangan extends Model
|
||||
'pkb_jmc',
|
||||
'para2',
|
||||
'para3',
|
||||
'tagujrah'
|
||||
'tagujrah',
|
||||
];
|
||||
|
||||
public function simulasi()
|
||||
public function simulasi()
|
||||
{
|
||||
return $this->belongsToMany(Simulasi::class, 'cawangan_simulasi', 'caw_id', 'simulasi_id');
|
||||
}
|
||||
|
||||
public function lelong()
|
||||
public function lelong()
|
||||
{
|
||||
return $this->belongsToMany(Lelong::class, 'cawangan_lelong', 'caw_id', 'lelong_id');
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class Cawangan extends Model
|
||||
{
|
||||
return $this->hasMany(SimulasiBid::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function lelongBid()
|
||||
{
|
||||
return $this->hasMany(LelongBid::class, 'caw_id', 'id');
|
||||
@@ -82,7 +82,7 @@ class Cawangan extends Model
|
||||
return $this->hasMany(CawanganKpi::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
public function datakpi()
|
||||
public function datakpi()
|
||||
{
|
||||
return $this->belongsToMany(DataKpi::class, 'cawangan_kpi', 'caw_id', 'id');
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class CawanganKpi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'cawangan_kpi';
|
||||
|
||||
protected $fillable = [
|
||||
@@ -20,6 +21,7 @@ class CawanganKpi extends Model
|
||||
{
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
public function dataKpi()
|
||||
{
|
||||
return $this->hasMany(DataKpi::class, 'namastaff', 'namastaff');
|
||||
@@ -33,5 +35,5 @@ class CawanganKpi extends Model
|
||||
// public function notis()
|
||||
// {
|
||||
// return $this->belongsTo(Notis::class, 'notis_id', 'id');
|
||||
//}
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class CawanganLelong extends Model
|
||||
'import_data_sts',
|
||||
'export_data_stsdate',
|
||||
'import_data_stsdate',
|
||||
'lokasi'
|
||||
'lokasi',
|
||||
];
|
||||
|
||||
public function lelongBid()
|
||||
|
||||
@@ -16,7 +16,7 @@ class CawanganNotis extends Model
|
||||
'notis_id',
|
||||
'caw_id',
|
||||
'fasa',
|
||||
'status'
|
||||
'status',
|
||||
];
|
||||
|
||||
// public function lelongBid()
|
||||
@@ -34,5 +34,3 @@ class CawanganNotis extends Model
|
||||
return $this->belongsTo(Notis::class, 'notis_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class CawanganSimulasi extends Model
|
||||
'import_data_sts',
|
||||
'export_data_stsdate',
|
||||
'import_data_stsdate',
|
||||
'lokasi'
|
||||
'lokasi',
|
||||
];
|
||||
|
||||
// function below to delete
|
||||
@@ -31,9 +31,8 @@ class CawanganSimulasi extends Model
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
public function simulasiBid_id()
|
||||
public function simulasiBid_id()
|
||||
{
|
||||
return SimulasiBid::where('simulasi_id',$this->simulasi_id)->where('caw_id',$this->caw_id)->get();
|
||||
return SimulasiBid::where('simulasi_id', $this->simulasi_id)->where('caw_id', $this->caw_id)->get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+46
-44
@@ -8,53 +8,55 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'main';
|
||||
|
||||
protected $table = 'customer';
|
||||
|
||||
protected $fillable = [
|
||||
'ahli',
|
||||
'kodcaw',
|
||||
'nosiri',
|
||||
'tarikhdaftar',
|
||||
'nopelanggan',
|
||||
'kplama',
|
||||
'kpbaru',
|
||||
'nama',
|
||||
't_lahir',
|
||||
'jantina',
|
||||
'alamat1',
|
||||
'alamat2',
|
||||
'alamat3',
|
||||
'alamat4',
|
||||
'poskod',
|
||||
'koddaerah',
|
||||
'kodnegeri',
|
||||
'telefon',
|
||||
'jumpinjaman',
|
||||
't_gadai',
|
||||
'pinjamhari',
|
||||
'bumiputra',
|
||||
'warganegara',
|
||||
'bangsa',
|
||||
'kodkerja',
|
||||
'kodugama',
|
||||
'kodstatus',
|
||||
'kodbank',
|
||||
'noakaun',
|
||||
'nota',
|
||||
'teller',
|
||||
'pelulus',
|
||||
't_ubah',
|
||||
'm_ubah',
|
||||
'aktif',
|
||||
'yuranahli',
|
||||
'nopelangganlama',
|
||||
'tujuangadai',
|
||||
'kodkerjabaru',
|
||||
'tagperingatan',
|
||||
'namateller',
|
||||
'kumpulan',
|
||||
'telefon2',
|
||||
'tagpelanggan'
|
||||
'ahli',
|
||||
'kodcaw',
|
||||
'nosiri',
|
||||
'tarikhdaftar',
|
||||
'nopelanggan',
|
||||
'kplama',
|
||||
'kpbaru',
|
||||
'nama',
|
||||
't_lahir',
|
||||
'jantina',
|
||||
'alamat1',
|
||||
'alamat2',
|
||||
'alamat3',
|
||||
'alamat4',
|
||||
'poskod',
|
||||
'koddaerah',
|
||||
'kodnegeri',
|
||||
'telefon',
|
||||
'jumpinjaman',
|
||||
't_gadai',
|
||||
'pinjamhari',
|
||||
'bumiputra',
|
||||
'warganegara',
|
||||
'bangsa',
|
||||
'kodkerja',
|
||||
'kodugama',
|
||||
'kodstatus',
|
||||
'kodbank',
|
||||
'noakaun',
|
||||
'nota',
|
||||
'teller',
|
||||
'pelulus',
|
||||
't_ubah',
|
||||
'm_ubah',
|
||||
'aktif',
|
||||
'yuranahli',
|
||||
'nopelangganlama',
|
||||
'tujuangadai',
|
||||
'kodkerjabaru',
|
||||
'tagperingatan',
|
||||
'namateller',
|
||||
'kumpulan',
|
||||
'telefon2',
|
||||
'tagpelanggan',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class DataKpi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'datakpi';
|
||||
|
||||
protected $fillable = [
|
||||
@@ -38,10 +39,11 @@ class DataKpi extends Model
|
||||
|
||||
public function cawangan()
|
||||
{
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id','id');
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
public function cawanganKpi(){
|
||||
return $this->hasOne(CawanganKpi::class, 'caw_id','caw_id');
|
||||
public function cawanganKpi()
|
||||
{
|
||||
return $this->hasOne(CawanganKpi::class, 'caw_id', 'caw_id');
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -12,9 +12,9 @@ class File extends Model
|
||||
protected $table = 'file';
|
||||
|
||||
protected $fillable = [
|
||||
'file_type',
|
||||
'filename',
|
||||
'deleted_at',
|
||||
'deleted_by'
|
||||
'file_type',
|
||||
'filename',
|
||||
'deleted_at',
|
||||
'deleted_by',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ class FileMarhun extends Model
|
||||
protected $table = 'filemarhun';
|
||||
|
||||
protected $fillable = [
|
||||
'lelongbid_id',
|
||||
'lelongbidmarhun_id',
|
||||
'photo_type', //1-overall_marhun, 2-each_marhun
|
||||
'file_type',
|
||||
'filename',
|
||||
'lelongbid_id',
|
||||
'lelongbidmarhun_id',
|
||||
'photo_type', // 1-overall_marhun, 2-each_marhun
|
||||
'file_type',
|
||||
'filename',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ class FileResit extends Model
|
||||
'user_id',
|
||||
'lelong_id',
|
||||
'payment_id',
|
||||
'file_type',
|
||||
'filename',
|
||||
'deleted_at',
|
||||
'deleted_by',
|
||||
'original_file_type',
|
||||
'original_size',
|
||||
'compress_size'
|
||||
'file_type',
|
||||
'filename',
|
||||
'deleted_at',
|
||||
'deleted_by',
|
||||
'original_file_type',
|
||||
'original_size',
|
||||
'compress_size',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class Gadai extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'main';
|
||||
|
||||
protected $table = 'gadai';
|
||||
|
||||
protected $fillable = [
|
||||
@@ -17,13 +18,13 @@ class Gadai extends Model
|
||||
'norujukan',
|
||||
'jbg',
|
||||
'kadarupah',
|
||||
'upahsimpan',
|
||||
'ansuran',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'upahsimpan',
|
||||
'ansuran',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'bakiupah',
|
||||
'cajlain',
|
||||
'baki',
|
||||
'baki',
|
||||
'berat',
|
||||
'marhun',
|
||||
'percent',
|
||||
@@ -34,7 +35,7 @@ class Gadai extends Model
|
||||
'tagpalsu',
|
||||
'tagpalsu2',
|
||||
'taglel',
|
||||
'lelong_tawarruq'
|
||||
'lelong_tawarruq',
|
||||
];
|
||||
|
||||
public function gadaiMarhun()
|
||||
|
||||
@@ -17,6 +17,6 @@ class GadaiMarhun extends Model
|
||||
'marhun',
|
||||
'nota',
|
||||
'karat',
|
||||
'berat'
|
||||
'berat',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,13 +16,12 @@ class GadaiTemp extends Model
|
||||
'norujukan',
|
||||
'tempoh',
|
||||
'kadarupah',
|
||||
'nilaimarhun',
|
||||
'bakipjm',
|
||||
'nilaimarhun',
|
||||
'bakipjm',
|
||||
'bakiupah',
|
||||
'cajlain',
|
||||
'berat',
|
||||
'marhun',
|
||||
'percentpinj',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ class Invoice extends Model
|
||||
'invoice_no',
|
||||
'total_invoice',
|
||||
'invoice_type', // 1 = fee , 2 = bid
|
||||
'status', //status => 1 = paid , 2 = pending
|
||||
'status', // status => 1 = paid , 2 = pending
|
||||
'opencash',
|
||||
'paid_at'
|
||||
'paid_at',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -23,13 +23,16 @@ class JanaNotisExport extends Model
|
||||
];
|
||||
|
||||
public const STATUS_PENDING = 'pending';
|
||||
|
||||
public const STATUS_PROCESSING = 'processing';
|
||||
|
||||
public const STATUS_COMPLETED = 'completed';
|
||||
|
||||
public const STATUS_FAILED = 'failed';
|
||||
|
||||
public function isReady()
|
||||
{
|
||||
return $this->status === self::STATUS_COMPLETED && !empty($this->file_path);
|
||||
return $this->status === self::STATUS_COMPLETED && ! empty($this->file_path);
|
||||
}
|
||||
|
||||
public function isInProgress()
|
||||
|
||||
@@ -8,11 +8,12 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Jawatan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'jawatan';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'idjawatan',
|
||||
'namajawatan'
|
||||
'namajawatan',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ class LelKarat extends Model
|
||||
'karat2',
|
||||
'keterangan',
|
||||
'harga',
|
||||
'harga2'
|
||||
'harga2',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -20,5 +20,4 @@ class LelKarat_temp extends Model
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
+10
-9
@@ -19,7 +19,7 @@ class Lelong extends Model
|
||||
'harga_emas_asas',
|
||||
'jbg',
|
||||
'cajlelong',
|
||||
'sts_lelong'
|
||||
'sts_lelong',
|
||||
];
|
||||
|
||||
public function cawangan()
|
||||
@@ -32,18 +32,18 @@ class Lelong extends Model
|
||||
return $this->hasMany(CawanganLelong::class, 'lelong_id');
|
||||
}
|
||||
|
||||
public function lelongBid()
|
||||
{
|
||||
public function lelongBid()
|
||||
{
|
||||
return $this->hasMany(LelongBid::class, 'lelong_id', 'id');
|
||||
}
|
||||
|
||||
public function lelongBidJual()
|
||||
{
|
||||
public function lelongBidJual()
|
||||
{
|
||||
return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_jual', 1);
|
||||
}
|
||||
|
||||
public function lelongBidBelumSemak()
|
||||
{
|
||||
public function lelongBidBelumSemak()
|
||||
{
|
||||
return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_semak', 0);
|
||||
}
|
||||
|
||||
@@ -61,8 +61,9 @@ class Lelong extends Model
|
||||
{
|
||||
return $this->hasMany(Pengesahan::class, 'lelong_id', 'id')->whereNotNull('disahkan_oleh');
|
||||
}
|
||||
public function scanjual()
|
||||
{
|
||||
|
||||
public function scanjual()
|
||||
{
|
||||
return $this->hasMany(ScanJual::class, 'lelong_id', 'id')->where('serahkpdpembida', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,20 +40,22 @@ class LelongBid extends Model
|
||||
'fasa',
|
||||
'tagujrah',
|
||||
'ujrah',
|
||||
'onepercent'
|
||||
'onepercent',
|
||||
];
|
||||
|
||||
public function cawangan()
|
||||
{
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id','id');
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
public function lelongbidder() {
|
||||
return $this->hasOne(LelongBidder::class,'lelongbid_id', 'id' );
|
||||
public function lelongbidder()
|
||||
{
|
||||
return $this->hasOne(LelongBidder::class, 'lelongbid_id', 'id');
|
||||
}
|
||||
|
||||
public function cawanganLelong(){
|
||||
return $this->hasOne(CawanganLelong::class, 'caw_id','caw_id');
|
||||
public function cawanganLelong()
|
||||
{
|
||||
return $this->hasOne(CawanganLelong::class, 'caw_id', 'caw_id');
|
||||
}
|
||||
|
||||
public function fileMarhunMain()
|
||||
@@ -100,6 +102,7 @@ class LelongBid extends Model
|
||||
{
|
||||
return $this->hasOne(LelongBidder::class, 'lelongbid_id', 'id')->where('status_bidder', 1);
|
||||
}
|
||||
|
||||
public function scanjual()
|
||||
{
|
||||
return $this->belongsTo(ScanJual::class, 'id', 'lelongbid_id');
|
||||
|
||||
@@ -12,23 +12,24 @@ class LelongBidMarhun extends Model
|
||||
protected $table = 'lelongbidmarhun';
|
||||
|
||||
protected $fillable = [
|
||||
'lelongbid_id',
|
||||
'bil',
|
||||
'marhun',
|
||||
'nota',
|
||||
'old_karat',
|
||||
'karat',
|
||||
'old_berat',
|
||||
'berat',
|
||||
'old_harga',
|
||||
'harga',
|
||||
'old_nmarhun',
|
||||
'n_marhun',
|
||||
'old_hargaasas',
|
||||
'hargaasas',
|
||||
'lelongbid_id',
|
||||
'bil',
|
||||
'marhun',
|
||||
'nota',
|
||||
'old_karat',
|
||||
'karat',
|
||||
'old_berat',
|
||||
'berat',
|
||||
'old_harga',
|
||||
'harga',
|
||||
'old_nmarhun',
|
||||
'n_marhun',
|
||||
'old_hargaasas',
|
||||
'hargaasas',
|
||||
];
|
||||
|
||||
public function pengesahan() {
|
||||
public function pengesahan()
|
||||
{
|
||||
return $this->hasOne(Pengesahan::class, 'lelongbidmarhun_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@ class LelongBidder extends Model
|
||||
'cajlelong',
|
||||
'status_bidder',
|
||||
'status_payment',
|
||||
'masa_bidaan'
|
||||
'masa_bidaan',
|
||||
];
|
||||
|
||||
public function lelongbid() {
|
||||
return $this->hasOne(LelongBid::class,'id', 'lelongbid_id');
|
||||
public function lelongbid()
|
||||
{
|
||||
return $this->hasOne(LelongBid::class, 'id', 'lelongbid_id');
|
||||
}
|
||||
|
||||
public function payment()
|
||||
@@ -33,8 +34,8 @@ class LelongBidder extends Model
|
||||
return $this->hasOne(Payment::class, 'lelongbid_id', 'lelongbid_id')->where('remark', '<>', '');
|
||||
}
|
||||
|
||||
public function scanjual() {
|
||||
public function scanjual()
|
||||
{
|
||||
return $this->hasOne(ScanJual::class, 'lelongbid_id', 'lelongbid_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,12 @@ class LelongBidderTemp extends Model
|
||||
'cajlelong',
|
||||
'status_bidder',
|
||||
'status_payment',
|
||||
'masa_bidaan'
|
||||
'masa_bidaan',
|
||||
];
|
||||
|
||||
public function lelongbid() {
|
||||
return $this->hasOne(LelongBid::class,'id', 'lelongbid_id');
|
||||
public function lelongbid()
|
||||
{
|
||||
return $this->hasOne(LelongBid::class, 'id', 'lelongbid_id');
|
||||
}
|
||||
|
||||
public function payment()
|
||||
@@ -33,8 +34,8 @@ class LelongBidderTemp extends Model
|
||||
return $this->hasOne(Payment::class, 'lelongbid_id', 'lelongbid_id')->where('remark', '<>', '');
|
||||
}
|
||||
|
||||
public function scanjual() {
|
||||
public function scanjual()
|
||||
{
|
||||
return $this->hasOne(ScanJual::class, 'lelongbid_id', 'lelongbid_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,20 +37,21 @@ class LelongBidxlaku extends Model
|
||||
'status_jual',
|
||||
'status_payment',
|
||||
'mora_upah',
|
||||
'fasa'
|
||||
'fasa',
|
||||
];
|
||||
|
||||
public function cawangan()
|
||||
{
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id','id');
|
||||
return $this->belongsTo(Cawangan::class, 'caw_id', 'id');
|
||||
}
|
||||
|
||||
// public function lelongbidder() {
|
||||
// return $this->hasOne(LelongBidder::class,'lelongbid_id', 'id' );
|
||||
// }
|
||||
|
||||
public function cawanganLelong(){
|
||||
return $this->hasOne(CawanganLelong::class, 'caw_id','caw_id');
|
||||
public function cawanganLelong()
|
||||
{
|
||||
return $this->hasOne(CawanganLelong::class, 'caw_id', 'caw_id');
|
||||
}
|
||||
|
||||
// public function fileMarhunMain()
|
||||
|
||||
@@ -10,97 +10,96 @@ class LelongCawangan extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'main';
|
||||
|
||||
protected $table = 'lelong';
|
||||
|
||||
protected $fillable = [
|
||||
'batchno',
|
||||
'sirilel',
|
||||
'kodcaw',
|
||||
'norujukan',
|
||||
't_lelong',
|
||||
'hargaasas',
|
||||
'sandaran',
|
||||
'hargajual',
|
||||
'glcode',
|
||||
't_jual',
|
||||
'nopembeli',
|
||||
'jbg',
|
||||
'kadarupah',
|
||||
'upahsimpan',
|
||||
'ansuran',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'bakipjmas',
|
||||
'bakipjm',
|
||||
'bakiupahas',
|
||||
'bakiupah',
|
||||
'cajlainas',
|
||||
'cajlain',
|
||||
'cajlelongas',
|
||||
'cajlelong',
|
||||
'baki',
|
||||
'terima',
|
||||
'cetak',
|
||||
'teller',
|
||||
'pelulus',
|
||||
'pelulust',
|
||||
'f_lulus',
|
||||
'type',
|
||||
'prkod',
|
||||
'tagsurat',
|
||||
'trkhtuntut',
|
||||
'tellertb',
|
||||
'pelulustb',
|
||||
'terimatb',
|
||||
't_hapuskira',
|
||||
'hapuskira',
|
||||
'hkpjm',
|
||||
'cancelid',
|
||||
'canceltime',
|
||||
'kodgl',
|
||||
't_update',
|
||||
'berat',
|
||||
'marhun',
|
||||
'recno',
|
||||
'lebihkurang',
|
||||
'nilaimarhuns',
|
||||
'tagaid',
|
||||
'gst_hj',
|
||||
'gst_cl',
|
||||
'hargajual_sim',
|
||||
'cajlelong_sim',
|
||||
'gst_hj_sim',
|
||||
'gst_cl_sim',
|
||||
'bakiupah_sim',
|
||||
'hargaasas_sim',
|
||||
'mutu_terendah',
|
||||
'harga_baru',
|
||||
'turun',
|
||||
'percent',
|
||||
'baki_sim',
|
||||
'hargalama',
|
||||
't_lelong_sim',
|
||||
'tag_gst',
|
||||
'makan_pinj',
|
||||
'baki_upah6',
|
||||
'baki6',
|
||||
'rugi_asal',
|
||||
'tagpelanggan',
|
||||
'fasa',
|
||||
'pmt',
|
||||
'tagpmt',
|
||||
'hargaasasasal',
|
||||
'beratasal',
|
||||
'loopsemak',
|
||||
'lel1stop',
|
||||
'jbg_lelong',
|
||||
'berat_plastik',
|
||||
'status_bida_online',
|
||||
'nopelanggan',
|
||||
'tag_tbaki',
|
||||
'pel_tbaki',
|
||||
'tagcall'
|
||||
'sirilel',
|
||||
'kodcaw',
|
||||
'norujukan',
|
||||
't_lelong',
|
||||
'hargaasas',
|
||||
'sandaran',
|
||||
'hargajual',
|
||||
'glcode',
|
||||
't_jual',
|
||||
'nopembeli',
|
||||
'jbg',
|
||||
'kadarupah',
|
||||
'upahsimpan',
|
||||
'ansuran',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'bakipjmas',
|
||||
'bakipjm',
|
||||
'bakiupahas',
|
||||
'bakiupah',
|
||||
'cajlainas',
|
||||
'cajlain',
|
||||
'cajlelongas',
|
||||
'cajlelong',
|
||||
'baki',
|
||||
'terima',
|
||||
'cetak',
|
||||
'teller',
|
||||
'pelulus',
|
||||
'pelulust',
|
||||
'f_lulus',
|
||||
'type',
|
||||
'prkod',
|
||||
'tagsurat',
|
||||
'trkhtuntut',
|
||||
'tellertb',
|
||||
'pelulustb',
|
||||
'terimatb',
|
||||
't_hapuskira',
|
||||
'hapuskira',
|
||||
'hkpjm',
|
||||
'cancelid',
|
||||
'canceltime',
|
||||
'kodgl',
|
||||
't_update',
|
||||
'berat',
|
||||
'marhun',
|
||||
'recno',
|
||||
'lebihkurang',
|
||||
'nilaimarhuns',
|
||||
'tagaid',
|
||||
'gst_hj',
|
||||
'gst_cl',
|
||||
'hargajual_sim',
|
||||
'cajlelong_sim',
|
||||
'gst_hj_sim',
|
||||
'gst_cl_sim',
|
||||
'bakiupah_sim',
|
||||
'hargaasas_sim',
|
||||
'mutu_terendah',
|
||||
'harga_baru',
|
||||
'turun',
|
||||
'percent',
|
||||
'baki_sim',
|
||||
'hargalama',
|
||||
't_lelong_sim',
|
||||
'tag_gst',
|
||||
'makan_pinj',
|
||||
'baki_upah6',
|
||||
'baki6',
|
||||
'rugi_asal',
|
||||
'tagpelanggan',
|
||||
'fasa',
|
||||
'pmt',
|
||||
'tagpmt',
|
||||
'hargaasasasal',
|
||||
'beratasal',
|
||||
'loopsemak',
|
||||
'lel1stop',
|
||||
'jbg_lelong',
|
||||
'berat_plastik',
|
||||
'status_bida_online',
|
||||
'nopelanggan',
|
||||
'tag_tbaki',
|
||||
'pel_tbaki',
|
||||
'tagcall',
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ class LelongTebus extends Model
|
||||
'pinjaman',
|
||||
'upah',
|
||||
'jbg',
|
||||
'jenis_tebus'
|
||||
'jenis_tebus',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ class LogUser extends Model
|
||||
'username',
|
||||
'nama_user',
|
||||
'norujukan',
|
||||
'nota'
|
||||
'nota',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -15,10 +15,9 @@ class MarhunTemp extends Model
|
||||
'norujukan',
|
||||
'karat',
|
||||
'berat',
|
||||
'bil',
|
||||
'marhun',
|
||||
'bil',
|
||||
'marhun',
|
||||
'nota',
|
||||
'n_marhun',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class Notis extends Model
|
||||
'daritempoh',
|
||||
'hinggatempoh',
|
||||
'sts_notis',
|
||||
'fasa'
|
||||
'fasa',
|
||||
];
|
||||
|
||||
public function cawangan()
|
||||
@@ -29,18 +29,18 @@ class Notis extends Model
|
||||
return $this->hasMany(CawanganNotis::class, 'notis_id');
|
||||
}
|
||||
|
||||
public function notisBid()
|
||||
{
|
||||
public function notisBid()
|
||||
{
|
||||
return $this->hasMany(NotisBid::class, 'notis_id', 'id');
|
||||
}
|
||||
|
||||
// public function lelongBidJual()
|
||||
// {
|
||||
// public function lelongBidJual()
|
||||
// {
|
||||
// return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_jual', 1);
|
||||
// }
|
||||
|
||||
// public function lelongBidBelumSemak()
|
||||
// {
|
||||
// public function lelongBidBelumSemak()
|
||||
// {
|
||||
// return $this->hasMany(LelongBid::class, 'lelong_id', 'id')->where('status_semak', 0);
|
||||
// }
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ class NotisBid extends Model
|
||||
return $this->belongsTo(Notis::class, 'notis_id', 'id');
|
||||
}
|
||||
|
||||
public function cawanganNotis(){
|
||||
return $this->hasOne(CawanganNotis::class, 'caw_id','caw_id');
|
||||
public function cawanganNotis()
|
||||
{
|
||||
return $this->hasOne(CawanganNotis::class, 'caw_id', 'caw_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user