fix skit2
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Customer;
|
||||
use App\BatchLel;
|
||||
use App\Daerah;
|
||||
use App\Poskod;
|
||||
use App\Negeri;
|
||||
use App\Lelong;
|
||||
use App\Transaction;
|
||||
use App\Cawangan;
|
||||
use App\Gadai;
|
||||
use App\TuntutBaki;
|
||||
@@ -17,7 +23,7 @@ use App\LelTebus;
|
||||
use App\LelMarhun;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LelongController extends Controller
|
||||
@@ -635,4 +641,71 @@ class LelongController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getSenaraiLelongAktif($kodcaw){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw',$kodcaw)->first();
|
||||
|
||||
$lelong = Lelong::on($cawangan['mysql'])
|
||||
->selectRaw('count(*) as total, batchno,t_lelong')
|
||||
->whereYear('t_lelong','>','2020')
|
||||
->whereNull('t_jual')
|
||||
->orderBy('t_lelong','desc')
|
||||
->groupBy('batchno')
|
||||
->get();
|
||||
|
||||
return response()->json($lelong);
|
||||
}
|
||||
|
||||
public function getSenaraiBatchNoAktif($kodcaw,Request $request){
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$arraylelong = [];
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
$lelong = Lelong::on($cawangan['mysql'])
|
||||
->select('lelong.t_lelong','lelong.norujukan','gadai.jbg','gadai.nokp','gadai.pinjaman','gadai.bakiupah')
|
||||
->leftJoin('gadai', 'gadai.norujukan', '=', 'Lelong.norujukan')
|
||||
// ->leftJoin('customer', 'customer.kpbaru', '=', 'gadai.nokp')
|
||||
->where('batchno','=',$request->batchno)
|
||||
->orderBy('gadai.t_gadai','asc')
|
||||
->where('gadai.taglel','=', 1);
|
||||
|
||||
$batchlel = BatchLel::on($cawangan['mysql'])
|
||||
->where('batchno','=',$request->batchno)
|
||||
->get()->toArray();
|
||||
|
||||
$lelonglist = $lelong->get();
|
||||
|
||||
foreach($lelonglist as $index=>$lel)
|
||||
{
|
||||
$ansuran = Transaction::on('mysql7')
|
||||
->where('norujukan','=', $lel['norujukan'])
|
||||
->where([['trans_type','=','A'],['kodcaw','=',$kodcaw]])
|
||||
->sum('duit_masuk');
|
||||
|
||||
$customer = Customer::on('mysql7')
|
||||
->select('nama','telefon','telefon2','alamat1','poskod','koddaerah')
|
||||
->where('kpbaru','=',$lel['nokp'])
|
||||
->orWhere('kplama','=',$lel['nokp'])
|
||||
->get()->toArray();
|
||||
|
||||
$poskod = Poskod::on('mysql7')
|
||||
->where('poskod','=',$customer[0]['poskod'])
|
||||
->first();
|
||||
|
||||
$daerah = Daerah::on('mysql7')
|
||||
->where('koddaerah','=',$poskod['koddaerah'])
|
||||
->first();
|
||||
|
||||
$negeri = Negeri::on('mysql7')
|
||||
->where('kodnegeri','=',$poskod['kodnegeri'])
|
||||
->first();
|
||||
|
||||
array_push($arraylelong,['poskod'=>$customer[0]['poskod'],'negeri' => $negeri['negeri'],'daerah' => $daerah['namadaerah'],'alamat' => $customer[0]['alamat1'],'masa' => $batchlel[0]['masadari'],'tarikhlelong' => $lel['t_lelong'],'nama' => $customer[0]['nama'], 'telefon1' => $customer[0]['telefon'], 'telefon2' => $customer[0]['telefon2'], 'norujukan' => $lel['norujukan'], 'JBG' => $lel['jbg'], 'IC' => $lel['nokp'], 'Pembiayaan' => $lel['pinjaman'], 'upah6' => $lel['bakiupah'], 'bayaran' => $ansuran]);
|
||||
}
|
||||
|
||||
return response()->json($arraylelong);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user