tambah function call center
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CawanganNotis extends Model
|
||||
{
|
||||
protected $table = 'cawangan_notis';
|
||||
public $timestamps = false;
|
||||
protected $primaryKey = 'id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'id','notis_id','kodcaw','peringatan','daritempoh','hinggatempoh','status'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Gadai;
|
||||
use App\Marhun;
|
||||
use App\Cawangan;
|
||||
use App\Transaction;
|
||||
use App\TransaksiKeuntungan;
|
||||
use App\TransactionOnline;
|
||||
use App\batalGadai;
|
||||
use App\TuntutBaki;
|
||||
use App\AnsRugi;
|
||||
use App\Lelong;
|
||||
use App\WTD;
|
||||
use App\HapusKira;
|
||||
use App\Tebus;
|
||||
use App\Vault;
|
||||
use App\Tunai;
|
||||
use App\Komuditi;
|
||||
use App\KawalanStokLama;
|
||||
use App\KawalanStok;
|
||||
use App\KadarUpah;
|
||||
use App\Moratorium;
|
||||
use App\Audit;
|
||||
use App\Customer;
|
||||
use App\KomuditiPurchase;
|
||||
use App\KomuditiTransaksi;
|
||||
use App\Advansur;
|
||||
use App\BlastWasap;
|
||||
use App\Notis;
|
||||
use App\CawanganNotis;
|
||||
use App\NotisPeringatan;
|
||||
use App\Jobs\WhatsappPelangganSAGLAMA;
|
||||
use App\Jobs\SMSPelangganSAGLAMA;
|
||||
use Illuminate\Http\Request;
|
||||
use App\CawanganDetail;
|
||||
use App\BlastSMS;
|
||||
use App\Jobs\WhatsappPelangganSAGLAMAbysag;
|
||||
use App\Jobs\SMSPelangganSAGLAMAbysag;
|
||||
|
||||
use App\Services\OnePercentServices;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CallCenterController extends Controller
|
||||
{
|
||||
public function showAllCawangans()
|
||||
{
|
||||
return response()->json(Cawangan::on('mysql7')->orderBy('details_caw','ASC')->get());
|
||||
}
|
||||
public function datagadai($kodcaw,Request $request)
|
||||
{
|
||||
// dd($request->all(), $kodcaw);
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
$datagadai = Gadai::on($cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC');
|
||||
// ->get();
|
||||
// dd($datagadai);
|
||||
$arraynorujukan = $datagadai->pluck('norujukan')->toArray();
|
||||
$rekodgadai = $datagadai->get();
|
||||
|
||||
$totalrekod = $datagadai->count('norujukan');
|
||||
$totalberat = $datagadai->sum('berat');
|
||||
$totalnilaimarhun = $datagadai->sum('nilaimarhun');
|
||||
$totalpinjaman = $datagadai->sum('pinjaman');
|
||||
$totalbakipjm = $datagadai->sum('bakipjm');
|
||||
$totaltunggakan = $datagadai->sum('tunggakan');
|
||||
|
||||
$arrayrekod = ['rekod' => $rekodgadai, 'totalsag' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpembiayaan'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan];
|
||||
// dd($arrayrekod);
|
||||
return response()->json($arrayrekod,200);
|
||||
}
|
||||
|
||||
public function insertdatagadai($kodcaw,Request $request)
|
||||
{
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
$notisid = $request->notisid;
|
||||
$currentDate = Carbon::now();
|
||||
// $currentDate = $currentDate->toDateString();
|
||||
$tarikh_notis = $currentDate->toDateString();
|
||||
$sag_cawangans = [];
|
||||
$bil_surat = 0;
|
||||
// dd($kodcaw);
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
// $notis = Notis::create([
|
||||
// 'tarikh_notis' => $tarikh_notis,
|
||||
// 'daritempoh' => $daritempoh,
|
||||
// 'hinggatempoh' => $hinggatempoh,
|
||||
// 'sts_notis' => 1,
|
||||
// 'peringatan' => 1
|
||||
// ]);
|
||||
|
||||
$datagadai = Gadai::on($cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC');
|
||||
// ->get();
|
||||
|
||||
|
||||
array_push($sag_cawangans,['data'=>$datagadai->get()]);
|
||||
// dd($sag_cawangans);
|
||||
|
||||
foreach($sag_cawangans as $index=>$cawnotis){
|
||||
|
||||
$caw_notis = new CawanganNotis;
|
||||
$caw_notis->notis_id = $notisid;
|
||||
$caw_notis->kodcaw = $kodcaw;
|
||||
$caw_notis->peringatan = 1;
|
||||
$caw_notis->daritempoh = $daritempoh;
|
||||
$caw_notis->hinggatempoh = $hinggatempoh;
|
||||
$caw_notis->status = 1;
|
||||
$caw_notis->save();
|
||||
|
||||
|
||||
$suratcaw = $cawnotis['data'];
|
||||
|
||||
$notis_peringatan_arr = [];
|
||||
$now = Carbon::now();
|
||||
foreach($suratcaw as $surat)
|
||||
{
|
||||
$notis_to_be_inserted = new NotisPeringatan();
|
||||
$notis_to_be_inserted->notis_id = $notisid;
|
||||
$notis_to_be_inserted->tarikh_notis = $tarikh_notis;
|
||||
$notis_to_be_inserted->kodcaw = $kodcaw;
|
||||
$notis_to_be_inserted->norujukan = $surat->norujukan;
|
||||
$notis_to_be_inserted->nokp = $surat->nokp;
|
||||
$notis_to_be_inserted->jbg = $surat->tempoh;
|
||||
$notis_to_be_inserted->kadarupah = $surat->kadarupah;
|
||||
$notis_to_be_inserted->nilaimarhun = $surat->nilaimarhun;
|
||||
$notis_to_be_inserted->pinjaman = $surat->bakipjm;
|
||||
$notis_to_be_inserted->bakiupah = $surat->bakiupah;
|
||||
$notis_to_be_inserted->berat = $surat->berat;
|
||||
$notis_to_be_inserted->marhun = $surat->marhun;
|
||||
$notis_to_be_inserted->percent = $surat->percentpinj;
|
||||
$notis_to_be_inserted->peringatan = '1';
|
||||
$notis_peringatan_arr[] = $notis_to_be_inserted->attributesToArray();
|
||||
}
|
||||
|
||||
$notis_peringatan_collection = collect($notis_peringatan_arr);
|
||||
|
||||
NotisPeringatan::insert($notis_peringatan_arr);
|
||||
}
|
||||
return response()->json("success");
|
||||
}
|
||||
|
||||
public function getbatchnotis(Request $request)
|
||||
{
|
||||
|
||||
$currentDate = Carbon::now();
|
||||
$tarikh_notis = $currentDate->toDateString();
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
|
||||
$notis = Notis::create([
|
||||
'tarikh_notis' => $tarikh_notis,
|
||||
'daritempoh' => $daritempoh,
|
||||
'hinggatempoh' => $hinggatempoh,
|
||||
'sts_notis' => 1,
|
||||
'peringatan' => 1
|
||||
]);
|
||||
|
||||
$batchnotis = Notis::on('mysql7')->orderBy('id','desc')->first()->id;
|
||||
|
||||
return response()->json($batchnotis);
|
||||
|
||||
}
|
||||
|
||||
public function senarainotisperingatan()
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$arraybatch = [];
|
||||
$batchnotis = Notis::on('mysql7')->get();
|
||||
// $cawangan_all = Cawangan::on('mysql7')->get();
|
||||
// $cawnotis_all = [];
|
||||
// foreach ($batchnotis as $index => $cawangan){
|
||||
// $notis = CawanganNotis::on('mysql7')->get();
|
||||
// if(sizeof($notis) != 0){
|
||||
// array_push($cawnotis_all,$notis);
|
||||
// }
|
||||
// }
|
||||
return response()->json($batchnotis);
|
||||
}
|
||||
|
||||
public function getcawnotis($notisid)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$arraybatch = [];
|
||||
$batchnotis = Notis::on('mysql7')->where('id',$notisid)->get();
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$cawnotis_all = [];
|
||||
foreach ($batchnotis as $index => $cawangan){
|
||||
$notis = CawanganNotis::on('mysql7')
|
||||
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw')
|
||||
->where('notis_id',$notisid)->get();
|
||||
if(sizeof($notis) != 0){
|
||||
array_push($cawnotis_all,$notis);
|
||||
}
|
||||
}
|
||||
return response()->json($cawnotis_all);
|
||||
}
|
||||
|
||||
public function getcawnotisbycaw(Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$kodcaw = $request->kodcaw;
|
||||
$notisid = $request->notisid;
|
||||
|
||||
$arraybatch = [];
|
||||
$batchnotis = CawanganNotis::on('mysql7')->where('id',$notisid)->where('kodcaw',$kodcaw)->get();
|
||||
$cawnotis_all = [];
|
||||
foreach ($batchnotis as $index => $cawangan){
|
||||
$notis = NotisPeringatan::on('mysql7')
|
||||
->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'notisperingatan.kodcaw')
|
||||
->join('cawangan_notis', 'cawangan_notis.kodcaw', '=', 'notisperingatan.kodcaw')
|
||||
->where('cawangan_notis.notis_id',$notisid)->where('cawangan_notis.kodcaw',$kodcaw)->get();
|
||||
|
||||
$totalsag = $notis->count('norujukan');
|
||||
// dd($totalsag);
|
||||
if(sizeof($notis) != 0){
|
||||
array_push($cawnotis_all,$notis);
|
||||
}
|
||||
}
|
||||
// dd($cawnotis_all);
|
||||
|
||||
$arrayrekod = ['rekod' => $cawnotis_all,'totalsag' =>$totalsag];
|
||||
return response()->json($arrayrekod);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notis extends Model
|
||||
{
|
||||
protected $table = 'notis';
|
||||
public $timestamps = false;
|
||||
protected $primaryKey = 'id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'id','tarikh_notis','daritempoh','hinggatempoh','sts_notis','peringatan'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NotisPeringatan extends Model
|
||||
{
|
||||
protected $table = 'notisperingatan';
|
||||
public $timestamps = false;
|
||||
protected $primaryKey = 'id';
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'notis_id',
|
||||
'kodcaw',
|
||||
'norujukan',
|
||||
'nokp',
|
||||
'jbg',
|
||||
'kadarupah',
|
||||
'nilaimarhun',
|
||||
'pinjaman',
|
||||
'bakiupah',
|
||||
'berat',
|
||||
'marhun',
|
||||
'percent',
|
||||
'peringatan',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNotisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notis', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('tarikh_notis')->nullable();
|
||||
$table->string('daritempoh')->nullable();
|
||||
$table->string('hinggatempoh')->nullable();
|
||||
$table->integer('sts_notis')->nullable();
|
||||
$table->integer('peringatan')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('notisperingatan', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('notis_id')->unsigned();
|
||||
$table->string('tarikh_notis');
|
||||
$table->string('kodcaw');
|
||||
$table->string('norujukan');
|
||||
$table->string('nokp');
|
||||
$table->decimal('jbg', $precision = 7, $scale = 2);
|
||||
$table->decimal('kadarupah', $precision = 5, $scale = 2)->nullable();
|
||||
$table->decimal('nilaimarhun', $precision = 9, $scale = 2);
|
||||
$table->decimal('pinjaman', $precision = 9, $scale = 2)->nullable();
|
||||
$table->decimal('bakiupah', $precision = 7, $scale = 2);
|
||||
$table->decimal('berat', $precision = 7, $scale = 2);
|
||||
$table->string('marhun');
|
||||
$table->decimal('percent', $precision = 7, $scale = 2);
|
||||
$table->integer('peringatan')->default(0);
|
||||
$table->date('tarikhnotis1')->nullable();
|
||||
$table->date('tarikhnotis2')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
});
|
||||
|
||||
|
||||
Schema::create('cawangan_notis', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('notis_id')->unsigned();
|
||||
$table->unsignedBigInteger('kodcaw')->unsigned();
|
||||
$table->integer('peringatan')->default(0);
|
||||
$table->string('daritempoh')->nullable();
|
||||
$table->string('hinggatempoh')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notis');
|
||||
Schema::dropIfExists('notisperingatan');
|
||||
Schema::dropIfExists('cawangan_notis');
|
||||
}
|
||||
}
|
||||
@@ -828,3 +828,15 @@ $router->group(['prefix'=>'kelantanpay'], function () use ($router){
|
||||
$router->get('gadai/customer',['uses'=>'KelantanPayController@index']);
|
||||
$router->post('payment/gadai',['uses'=>'KelantanPayController@postPayment']);
|
||||
});
|
||||
|
||||
$router->group(['prefix'=>'arcc'], function () use ($router){
|
||||
//ARCC API
|
||||
$router->get('datagadai/aktif/{kodcaw}',['uses'=>'CallCenterController@datagadai']);
|
||||
$router->get('cawangan',['uses'=>'CallCenterController@showAllCawangans']);
|
||||
$router->post('insertdatagadai/aktif/{kodcaw}',['uses'=>'CallCenterController@insertdatagadai']);
|
||||
$router->get('getbatchnotis',['uses'=>'CallCenterController@getbatchnotis']);
|
||||
$router->get('senarainotisperingatan',['uses'=>'CallCenterController@senarainotisperingatan']);
|
||||
$router->get('getcawnotis/{notisid}',['uses'=>'CallCenterController@getcawnotis']);
|
||||
$router->get('getcawnotisbycaw',['uses'=>'CallCenterController@getcawnotisbycaw']);
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user