tambah function SMS
This commit is contained in:
committed by
Hafifie PKB
parent
3ab9baf7b5
commit
135b9c37bc
@@ -31,6 +31,7 @@ use App\BlastWasap;
|
||||
use App\HistoryEmasSandaran;
|
||||
use App\InOutMar;
|
||||
use App\Jobs\WhatsappPelangganSAGLAMA;
|
||||
use App\Jobs\SMSPelangganSAGLAMA;
|
||||
use Illuminate\Http\Request;
|
||||
use App\CawanganDetail;
|
||||
|
||||
@@ -50,7 +51,7 @@ class StokAuditController extends Controller
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||
|
||||
$audit = Gadai::on($cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC');
|
||||
// ->get();
|
||||
@@ -121,7 +122,7 @@ class StokAuditController extends Controller
|
||||
// dd($cawangan_detail->notel);
|
||||
|
||||
$audit = Gadai::on($cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC');
|
||||
// ->get();
|
||||
@@ -178,7 +179,7 @@ class StokAuditController extends Controller
|
||||
//log auditrail
|
||||
$audit = new Audit();
|
||||
$audit->users = $namapengguna;
|
||||
$audit->actions = 'Blast Whatsapp';
|
||||
$audit->actions = 'Blast Whatsapp & SMS';
|
||||
$audit->norujukan = $cal3->norujukan;
|
||||
$audit->new_data = $customer->telefon;
|
||||
$audit->old_data = $nokp;
|
||||
@@ -188,6 +189,7 @@ class StokAuditController extends Controller
|
||||
$audit->save();
|
||||
|
||||
dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw));
|
||||
dispatch(new SMSPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw));
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -234,15 +236,22 @@ class StokAuditController extends Controller
|
||||
$gadainokp[$index1]['listsag'] = $listsag;
|
||||
}
|
||||
|
||||
|
||||
if($listsag ?? ''){
|
||||
$totalrekod = $listsag->sum('pinjaman');
|
||||
$totalberat = $listsag->sum('berat');
|
||||
$totalnilaimarhun = $listsag->sum('nilaimarhun');
|
||||
$totalpinjaman = $listsag->sum('pinjaman');
|
||||
$totalbakipjm = $listsag->sum('bakipjm');
|
||||
$totaltunggakan = $listsag->sum('tunggakan');
|
||||
}
|
||||
|
||||
$arrayrekod = ['rekod' => $gadainokp, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan];
|
||||
$arrayrekod = ['rekod' => $gadainokp ?? null,
|
||||
'total' => $totalrekod ?? null,
|
||||
'totalberat' => $totalberat ?? null,
|
||||
'totalnilaimarhun' => $totalnilaimarhun ?? null,
|
||||
'totalpinjaman'=>$totalpinjaman ?? null,
|
||||
'totalbakipjm'=>$totalbakipjm ?? null,
|
||||
'totaltunggakan'=>$totaltunggakan ?? null];
|
||||
return response()->json($arrayrekod,200);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class SMSPelangganSAGLAMA extends Job
|
||||
{
|
||||
public $nokp;
|
||||
public $telefon;
|
||||
public $caw_name;
|
||||
public $nofoncaw;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($nokp, $telefon, $caw_name,$nofoncaw)
|
||||
{
|
||||
$this->nokp = $nokp;
|
||||
$this->telefon = $telefon;
|
||||
$this->caw_name = $caw_name;
|
||||
$this->nofoncaw = $nofoncaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// $mobile_no = ltrim($this->telefon, '+6');
|
||||
$mobile_no = '60178916936';
|
||||
$message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis sebelum 15/7/2024 bagi menukar SAG dengan cara:
|
||||
1. Tebus atau
|
||||
2. Tebus Gadai Semula
|
||||
Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.';
|
||||
if(env('APP_ENV') != 'production'){
|
||||
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
||||
}
|
||||
|
||||
Http::get(env('ONEWAYSMS_API'), [
|
||||
'apiusername' => env('ONEWAYSMS_AUTH_USER'),
|
||||
'apipassword' => env('ONEWAYSMS_AUTH_PASS'),
|
||||
'senderid' => 'INFO',
|
||||
'mobileno' => $mobile_no,
|
||||
'message' => $message,
|
||||
'languagetype' => 1
|
||||
]);
|
||||
|
||||
Log::info("SMS - Pelanggan ".$this->caw_name." SAG Tawarruq Lama -".$mobile_no);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class WhatsappPelangganSAGLAMA extends Job
|
||||
atau
|
||||
2. Tebus Gadai Semula
|
||||
|
||||
Hubungi '.$this->nofoncaw.'(Ar-Rahn '.$this->caw_name.') untuk maklumat lanjut.';
|
||||
Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.';
|
||||
if(env('APP_ENV') != 'production'){
|
||||
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user