fix kerja

This commit is contained in:
Ain Izazi
2024-12-01 15:30:48 +08:00
parent 520ca5d92d
commit 36dad586c5
5 changed files with 112 additions and 51 deletions
+3 -1
View File
@@ -14,10 +14,12 @@ class AuditCustomer extends Model
'username',
'old_data',
'new_data',
'kodkerja',
'nota_pekerjaan',
'kodcaw',
'created_at',
'updated_at',
'customer_name',
'customer_nokp',
];
}
}
+1
View File
@@ -60,6 +60,7 @@ class Customer extends Model
'tagperingatan',
'kumpulan',
'telefon2',
'nota_pekerjaan',
'tagpelanggan'
];
+57 -49
View File
@@ -111,7 +111,7 @@ class CustomerController extends Controller
}
}
}
return response()->json($gadai_all);
}
@@ -142,7 +142,7 @@ class CustomerController extends Controller
}
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
if($status == 'belum_tebus'){
$gadai = Gadai::on($cawangan['mysql'])
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
@@ -165,7 +165,7 @@ class CustomerController extends Controller
$gadai[0]['datatuntut'] = $tuntutbaki;
}
}
}
}
return response()->json($gadai);
}
@@ -202,7 +202,7 @@ class CustomerController extends Controller
}
}
}
return response()->json($gadai_all);
}
@@ -227,7 +227,7 @@ class CustomerController extends Controller
));
}
}
return $barang;
}
@@ -259,10 +259,10 @@ class CustomerController extends Controller
'tarikhgadai' => $gd->t_gadai,
'hargajualan' => $gd->hargajualan,
'bakihargajualan' => $gd->bakihargajualan,
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
));
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
));
}
}
elseif($gd->sttebus == 'T')
{
array_push($sttebus_T, array(
@@ -270,22 +270,22 @@ class CustomerController extends Controller
'pembiayaan' => number_format($gd->pinjaman,2),
'tarikhgadai' => $gd->t_gadai,
'hargajualan' => $gd->hargajualan,
'bakihargajualan' => $gd->bakihargajualan,
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
'bakihargajualan' => $gd->bakihargajualan,
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
));
}
elseif($gd->sttebus == 'L')
{
{
array_push($sttebus_L, array(
'norujukan' => $gd->norujukan,
'pembiayaan' => number_format($gd->pinjaman,2),
'tarikhgadai' => $gd->t_gadai,
'hargajualan' => $gd->hargajualan,
'bakihargajualan' => $gd->bakihargajualan,
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
'bakihargajualan' => $gd->bakihargajualan,
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
));
}
}
}
}
else
@@ -308,7 +308,7 @@ class CustomerController extends Controller
->where([['tarikhdaftar','=',$tarikh],['kodcaw',$kodcaw]])
->orderBy('tarikhdaftar', 'desc')
->get();
return response()->json($gadai);
}
@@ -344,6 +344,7 @@ class CustomerController extends Controller
'nosiri'=>$request->nosiri,
'nota'=>$request->nota,
'kodkerja'=>$request->kodkerja,
'nota_pekerjaan'=>$request->nota_pekerjaan,
'tujuangadai'=>$request->tujuangadai
]);
@@ -361,10 +362,12 @@ class CustomerController extends Controller
'poskod' => $request->poskod,
'koddaerah' => $poskod['koddaerah'],
'kodnegeri' => $poskod['kodnegeri'],
'kodkerja'=>$request->kodkerja,
'nota_pekerjaan'=>$request->nota_pekerjaan,
'telefon' => $request->telefon1,
'telefon2' => $request->telefon2
));
return response()->json($customer_update, 200);
}
@@ -376,7 +379,7 @@ class CustomerController extends Controller
$poskod = Poskod::on('mysql7')->where('poskod','=',$request->poskod)->first();
$customer_info = DB::connection('mysql7')->table('customer')
->select('kodcaw','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2')
->select('kodcaw','kodkerja','nota_pekerjaan','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2')
->where('kplama','=',$nokp)
->orWhere('kpbaru','=',$nokp)
->get()->toArray();
@@ -391,6 +394,9 @@ class CustomerController extends Controller
'telefon' => $request->telefon1,
'telefon2' => $request->telefon2,
'kodbank' => $request->kodbank,
'kodkerja' => $request->kodkerja,
// 'nota_pekerjaan' => $request->nota_pekerjaan,
'nota_pekerjaan' => $request->kodkerja === '6' ? $request->nota_pekerjaan : null,
'noakaun' => $request->noakaun,
'nota' => $request->nota,
'alamat1' => $request->alamat,
@@ -402,13 +408,13 @@ class CustomerController extends Controller
if($customer_update)
{
$customer_info_new = DB::connection('mysql7')->table('customer')
->select('kodcaw','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2')
->select('kodcaw','kodkerja','nota_pekerjaan','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2')
->where('kplama','=',$nokp)
->orWhere('kpbaru','=',$nokp)
->get()->toArray();
$new_data = json_encode($customer_info_new);
$audit_customer = DB::connection('mysql7')
->table('audit_customer')
->insert([
@@ -431,11 +437,11 @@ class CustomerController extends Controller
DB::connection('mysql7')->rollback();
return response()->json($e->getMessage(),400);
}
}
}
public function customerUpdateKhazanah($nokp,Request $request){
DB::connection('mysql7')->beginTransaction();
try{
@@ -457,6 +463,8 @@ class CustomerController extends Controller
'telefon' => $request->telefon1,
'telefon2' => $request->telefon2,
'kodbank' => $request->kodbank,
'kodkerja' => $request->kodkerja,
'nota_pekerjaan' => $request->nota_pekerjaan,
'noakaun' => $request->noakaun,
'nota' => $request->nota,
'nama' => $request->nama,
@@ -476,7 +484,7 @@ class CustomerController extends Controller
->get()->toArray();
$new_data = json_encode($customer_info_new);
$audit_customer = DB::connection('mysql7')
->table('audit_customer')
->insert([
@@ -490,7 +498,7 @@ class CustomerController extends Controller
'customer_nokp' => $nokp,
]);
}
DB::connection('mysql7')->commit();
@@ -500,8 +508,8 @@ class CustomerController extends Controller
DB::connection('mysql7')->rollback();
return response()->json($e->getMessage(),400);
}
}
}
public function customerUpdateAdmin(Request $request){
@@ -521,12 +529,12 @@ class CustomerController extends Controller
'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)
@@ -601,7 +609,7 @@ class CustomerController extends Controller
return response()->json($array_norujukan);
}
public function countNorujukanMobile($nokp){
$cawangan_all = Cawangan::on('mysql7')->get();
$bilangan_sag = 0;
@@ -615,7 +623,7 @@ class CustomerController extends Controller
public function getGadaiDetailMobile(Request $request)
{
$array_norujukan = $request->norujukan;
$array_norujukan = $request->norujukan;
$array_kodcaw = $request->kodcaw;
$array_gadai = [];
$gadai_payment = [];
@@ -660,7 +668,7 @@ class CustomerController extends Controller
return response('Deleted Successfully', 200);
}
public function akaunBankMobile($nokp)
{
$customer_detail = [];
@@ -672,7 +680,7 @@ class CustomerController extends Controller
->where('kplama','=',$nokp)
->orWhere('kpbaru','=',$nokp)
->rightJoin('online_arrahn.bank', 'bank.id', '=', 'customer.kodbank')
->first();
->first();
if(!empty($customer))
{
@@ -680,14 +688,14 @@ class CustomerController extends Controller
$customer_detail['namabank'] = $customer['name'];
$customer_detail['kodbank'] = $customer['id'];
return response()->json($customer_detail);
}
}
else
{
return $customer_detail;
}
}
}
public function bankListMobile()
{
$bank_array = [];
@@ -702,32 +710,32 @@ class CustomerController extends Controller
{
array_push($bank_array, array(
'kodbank' => $banklist->id,
'namabank' => $banklist->name,
));
'namabank' => $banklist->name,
));
}
return response()->json($bank_array);
}
else
{
return response()->json('Data Not Found');
}
}
}
}
public function insertAkaunBankMobile(Request $request)
{
$customer = Customer::on('mysql7')
$customer = Customer::on('mysql7')
->where('kplama','=',$request->nokp)
->orWhere('kpbaru','=',$request->nokp)
->first();
if(!empty($customer))
{
{
$customer->kodbank = $request->kodbank;
$customer->noakaun = $request->noakaun;
$customer->save();
$customer->save();
}
return response()->json($customer, 200);
}
@@ -761,7 +769,7 @@ class CustomerController extends Controller
}
public function blacklistCustomer(Request $request){
$blacklist = Blacklist::where('nokp',$request->nokp)->first();
return response()->json($blacklist);
@@ -778,8 +786,8 @@ class CustomerController extends Controller
->select('kodcaw')
->where('nokp', '=', $ic)
->first();
if($customer)
if($customer)
array_push($custcawangan,['kodcaw' => $customer['kodcaw'], 'namacawangan' => $cawangan['details_caw']]);
}
@@ -805,9 +813,9 @@ class CustomerController extends Controller
return response()->json($dataCustomer);
}
public function AdminsearchCustomerByName(Request $request)
{
{
$nama = strtoupper($request->nama);
if(empty($nama))
@@ -821,12 +829,12 @@ class CustomerController extends Controller
->take(3)
->get();
}
return response()->json($customer);
}
public function AdminsearchCustomerByIC(Request $request)
{
{
if(isset($request->kodcaw))
{
$customer = Customer::on('mysql7')
@@ -841,7 +849,7 @@ class CustomerController extends Controller
->take(3)
->get();
}
return response()->json($customer);
}
+1 -1
View File
@@ -12,4 +12,4 @@ class PekerjaanController extends Controller
return response()->json($kerja);
}
}
}
@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddNotaPekerjaan extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function getActiveDB(){
$config_db = array_keys(config("database.connections"));
$db_connection = array_filter($config_db,function($connection){
try{
if($connection == 'mysql7')
return false;
$db = DB::connection($connection)->getPdo();
return true;
} catch(\Exception $e){
return false;
}
});
return $db_connection;
}
public function up()
{
Schema::connection('mysql7')->table('customer', function (Blueprint $table) {
$table->string('nota_pekerjaan')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('customer', function (Blueprint $table) {
$table->dropColumn('nota_pekerjaan');
});
}
}