Merge branch 'master' of https://gitlab.com/online-sistem1/api_arrahn
This commit is contained in:
@@ -428,6 +428,88 @@ class CustomerController extends Controller
|
||||
return response()->json($customer_update, 200);
|
||||
}
|
||||
|
||||
public function customerUpdateAdmin(Request $request){
|
||||
$poskod = Poskod::on('mysql7')->where('poskod','=',$request->poskod)->first();
|
||||
|
||||
if($request->ic_asal != $request->icno){
|
||||
|
||||
$existing_customer = Customer::on('mysql7')
|
||||
->where('kplama','=',$request->icno)
|
||||
->orWhere('kpbaru','=',$request->icno)
|
||||
->get();
|
||||
|
||||
if($existing_customer->isEmpty()){
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
foreach($cawangan_all as $index=> $cawangan){
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('nokp',$request->ic_asal)->update([
|
||||
'nokp'=>$request->icno
|
||||
]);
|
||||
}
|
||||
|
||||
$data_asal = $customer_update = Customer::on('mysql7')
|
||||
->where('kplama','=',$request->ic_asal)
|
||||
->orWhere('kpbaru','=',$request->ic_asal)
|
||||
->first();
|
||||
|
||||
if($data_asal['kpbaru'] != null){
|
||||
$customer_update = Customer::on('mysql7')
|
||||
->where('kplama','=',$request->ic_asal)
|
||||
->orWhere('kpbaru','=',$request->ic_asal)
|
||||
->update(array(
|
||||
'kpbaru' => $request->icno,
|
||||
'telefon' => $request->telefon1,
|
||||
'telefon2' => $request->telefon2,
|
||||
'kodbank' => $request->kodbank,
|
||||
'noakaun' => $request->noakaun,
|
||||
'nota' => $request->nota,
|
||||
'nama' => $request->nama,
|
||||
'alamat1' => $request->alamat,
|
||||
'poskod' => $request->poskod,
|
||||
'koddaerah' => $poskod['koddaerah'],
|
||||
'kodnegeri' => $poskod['kodnegeri']
|
||||
));
|
||||
}else{
|
||||
$customer_update = Customer::on('mysql7')
|
||||
->where('kplama','=',$request->ic_asal)
|
||||
->orWhere('kpbaru','=',$request->ic_asal)
|
||||
->update(array(
|
||||
'kplama' => $request->icno,
|
||||
'telefon' => $request->telefon1,
|
||||
'telefon2' => $request->telefon2,
|
||||
'kodbank' => $request->kodbank,
|
||||
'noakaun' => $request->noakaun,
|
||||
'nota' => $request->nota,
|
||||
'nama' => $request->nama,
|
||||
'alamat1' => $request->alamat,
|
||||
'poskod' => $request->poskod,
|
||||
'koddaerah' => $poskod['koddaerah'],
|
||||
'kodnegeri' => $poskod['kodnegeri']
|
||||
));
|
||||
}
|
||||
}else{
|
||||
return response()->json('existing');
|
||||
}
|
||||
}else if($request->ic_asal == $request->icno){
|
||||
$customer_update = Customer::on('mysql7')
|
||||
->where('kplama','=',$request->icno)
|
||||
->orWhere('kpbaru','=',$request->icno)
|
||||
->update(array(
|
||||
'telefon' => $request->telefon1,
|
||||
'telefon2' => $request->telefon2,
|
||||
'kodbank' => $request->kodbank,
|
||||
'noakaun' => $request->noakaun,
|
||||
'nota' => $request->nota,
|
||||
'nama' => $request->nama,
|
||||
'alamat1' => $request->alamat,
|
||||
'poskod' => $request->poskod,
|
||||
'koddaerah' => $poskod['koddaerah'],
|
||||
'kodnegeri' => $poskod['kodnegeri']
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json($customer_update, 200);
|
||||
}
|
||||
|
||||
public function listNorujukanMobile($nokp){
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$array_norujukan = [];
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Marhun;
|
||||
use App\Cawangan;
|
||||
use App\Transaction;
|
||||
use App\TransaksiKeuntungan;
|
||||
use App\TransactionOnline;
|
||||
use App\batalGadai;
|
||||
use App\TuntutBaki;
|
||||
use App\AnsRugi;
|
||||
@@ -55,6 +56,16 @@ class GadaiController extends Controller
|
||||
return response()->json($gadai_all);
|
||||
}
|
||||
|
||||
public function searchGadaiOnline(Request $request){
|
||||
|
||||
$transaction_online = TransactionOnline::on('mysql7')->where([['norujukan',$request->norujukan],['status','PAID'],['update_status',0]])->first();
|
||||
if($transaction_online){
|
||||
return response()->json(true);
|
||||
}else{
|
||||
return response()->json(false);
|
||||
}
|
||||
}
|
||||
|
||||
public function showOneGadaiMobile($noic){
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$gadai_all = [];
|
||||
@@ -518,11 +529,17 @@ class GadaiController extends Controller
|
||||
public function barcodeScan($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array(
|
||||
'semakbarcode'=>'Lulus'
|
||||
));
|
||||
$dahscan = Gadai::on($cawangan['mysql'])->where([['norujukan','=',$norujukan],['semakbarcode','Lulus']])->first();
|
||||
|
||||
return response()->json($gadai,200);
|
||||
if($dahscan){
|
||||
return response()->json('scanned');
|
||||
}else{
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update([
|
||||
'semakbarcode'=>'Lulus'
|
||||
]);
|
||||
|
||||
return response()->json('success');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkSerahGadaian(Request $request){
|
||||
|
||||
@@ -58,7 +58,7 @@ class LaporanController extends Controller
|
||||
|
||||
|
||||
//b
|
||||
$bilangan_gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$request->tarikh)->count();
|
||||
$bilangan_gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$request->tarikh)->where('pinjaman','>',0)->count();
|
||||
$bilangan_tebus = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$request->tarikh)->count();
|
||||
$bilangan_ansuran = Transaction::on('mysql7')->whereRaw('DATE(created_at) = ?',[$request->tarikh])->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]])->count();
|
||||
$bilangan_customer_baru = Customer::on('mysql7')->where([['tarikhdaftar','=',$request->tarikh],['kodcaw',$request->kodcaw]])->count();
|
||||
@@ -256,7 +256,7 @@ class LaporanController extends Controller
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||
$laporan_terkumpul = [];
|
||||
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where([['t_gadai','>=',$request->mula],['t_gadai','<=',$request->akhir]]);
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where([['t_gadai','>=',$request->mula],['t_gadai','<=',$request->akhir]])->where('pinjaman','>',0);
|
||||
|
||||
$tebus = Tebus::on($cawangan['mysql'])->where([['t_tebus','>=',$request->mula],['t_tebus','<=',$request->akhir]]);
|
||||
$ansuran = Transaction::on('mysql7')->whereDate('created_at','>=',$request->mula)->whereDate('created_at','<=',$request->akhir)->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]]);
|
||||
|
||||
@@ -249,12 +249,12 @@ class LelongController extends Controller
|
||||
}
|
||||
}else{
|
||||
$bakilelong = Lelong::on($cawangan['mysql'])
|
||||
->where('t_jual','>=',$request->mula)
|
||||
->where('t_jual','<=',$request->hingga)
|
||||
->where(function($query) use ($tarikhbaru){
|
||||
$query->whereNull('trkhtuntut')
|
||||
->orWhere('trkhtuntut','>',$tarikhbaru);
|
||||
})
|
||||
->where('trkhtuntut','>=',$request->mula)
|
||||
->where('trkhtuntut','<=',$request->hingga)
|
||||
// ->where(function($query) use ($tarikhbaru){
|
||||
// $query->whereNull('trkhtuntut')
|
||||
// ->orWhere('trkhtuntut','>',$tarikhbaru);
|
||||
// })
|
||||
->where('baki','>=',0)
|
||||
->sum('baki');
|
||||
}
|
||||
@@ -263,13 +263,13 @@ class LelongController extends Controller
|
||||
->sum('bayaran');
|
||||
|
||||
$rugilelong = Lelong::on($cawangan['mysql'])
|
||||
->where('t_jual','>=',$request->mula)
|
||||
->where('t_jual','<=',$request->hingga)
|
||||
->where(function($query) use ($tarikhbaru)
|
||||
{
|
||||
$query->whereNull('trkhtuntut')
|
||||
->orWhere('trkhtuntut','>',$tarikhbaru);
|
||||
})
|
||||
->where('trkhtuntut','>=',$request->mula)
|
||||
->where('trkhtuntut','<=',$request->hingga)
|
||||
//->where(function($query) use ($tarikhbaru)
|
||||
//{
|
||||
// $query->whereNull('t_jual')
|
||||
// ->orWhere('t_jual','>',$tarikhbaru);
|
||||
//})
|
||||
->where('baki','<',0)
|
||||
->sum('baki');
|
||||
|
||||
|
||||
@@ -195,13 +195,6 @@ class PanjarController extends Controller
|
||||
->sum('bayaran');
|
||||
|
||||
|
||||
|
||||
if($kodcaw == 'APM')
|
||||
{
|
||||
$perubatan = $perubatan - 10;
|
||||
$baikidanselenggara = $baikidanselenggara - 10;
|
||||
}
|
||||
|
||||
$arraycalculation = ['bds' => $baikidanselenggara, 'perubatan' => $perubatan, 'keraian' => $keraian];
|
||||
|
||||
return response()->json($arraycalculation);
|
||||
|
||||
@@ -580,10 +580,17 @@ class TebusController extends Controller
|
||||
|
||||
public function tagterimaupdate($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
$dahscan = Tebus::on($cawangan['mysql'])->where([['norujukan','=',$norujukan],['tagterima',1]])->first();
|
||||
|
||||
$update_inoutmar = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array(
|
||||
'tagterima' => 1
|
||||
));
|
||||
if($dahscan){
|
||||
return response()->json('scanned');
|
||||
}else{
|
||||
$update_inoutmar = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array(
|
||||
'tagterima' => 1
|
||||
));
|
||||
|
||||
return response()->json('success');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkSerahTebus(Request $request){
|
||||
|
||||
@@ -75,7 +75,7 @@ class TransactionOnlineController extends Controller
|
||||
|
||||
GlDetail::on($cawangan['mysql'])->create([
|
||||
'kodcaw' => $transaction['kodcaw'],
|
||||
'tarikh' => $current->toDateString(),
|
||||
'tarikh' => Carbon::parse($transaction['paid_at'])->format('Y-m-d'),
|
||||
'dtacct' => '1000/010',
|
||||
'ktacct' => '1000/020',
|
||||
'descpt' => 'SERAHAN BAYAR ONLINE - ' . $transaction['norujukan'],
|
||||
|
||||
Reference in New Issue
Block a user