fix skit2
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BatchLel extends Model
|
||||
{
|
||||
protected $table = 'batchlel';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $fillable = [
|
||||
|
||||
// ];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -258,6 +258,11 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
$router->get('gadai/aging/lebih12bulan/{kodcaw}/{tarikh}', ['uses'=>'GadaiController@carian_agingLebih12_Bulan']);
|
||||
$router->get('gadai/JumlahagingBulanan/test/{kodcaw}/{tarikh}',['uses'=>'GadaiController@carian_Seluruh_AgingBulanan']);
|
||||
|
||||
//LELONG API
|
||||
$router->get('senaraibatch/aktif/{kodcaw}',['uses'=>'LelongController@getSenaraiLelongAktif']);
|
||||
$router->get('senaraibatch/laporan/{kodcaw}',['uses'=>'LelongController@getSenaraiBatchNoAktif']);
|
||||
|
||||
|
||||
//API BARU
|
||||
$router->get('Dashboard_all/{kodcaw}',['uses'=>'GadaiController@dashboardall']);
|
||||
$router->get('VaultController/{kodcaw}',['uses'=>'VaultController@list']);
|
||||
|
||||
Reference in New Issue
Block a user