fix skit2

This commit is contained in:
hafifierahman
2022-01-08 11:02:16 +08:00
parent b776924e71
commit d8c0615073
7 changed files with 140 additions and 5 deletions
+1 -1
View File
@@ -1137,7 +1137,7 @@ class AdminPageController extends Controller
$upahToday = $upahToday + $upah_tebus_today + $upah_today;
$ansuran_today = TransaksiKeuntungan::on('mysql7')->where([['tarikh_bayaran','>=',$harini . ' 00:00:00'],['tarikh_bayaran','<=',$harini . ' 23:59:59']])->sum('bayaran_keuntungan');
$ansuran_today = TransaksiKeuntungan::on('mysql7')->where([['tarikh_bayaran','>=',$harini . ' 00:00:00'],['tarikh_bayaran','<=',$harini . ' 23:59:59']])->where('kodcaw','=',$request->kodcaw)->sum('bayaran_keuntungan');
$upahToday = $upahToday + $ansuran_today;
@@ -695,4 +695,45 @@ class CustomerController extends Controller
return response()->json($dataCustomer);
}
public function AdminsearchCustomerByName(Request $request)
{
$nama = strtoupper($request->nama);
if(empty($nama))
{
$customer = [];
}else{
$customer = Customer::on('mysql7')
->where('nama','like',$nama.'%')
->orWhere('nama','like','%'.$nama)
->orWhere('nama','like','%'.$nama.'%')
->take(3)
->get();
}
return response()->json($customer);
}
public function AdminsearchCustomerByIC(Request $request)
{
if(isset($request->kodcaw))
{
$customer = Customer::on('mysql7')
->where([['kplama','like',$request->ic.'%'],['kodcaw','=',$request->kodcaw]])
->orWhere([['kpbaru','like',$request->ic.'%'],['kodcaw','=',$request->kodcaw]])
->take(3)
->get();
}else{
$customer = Customer::on('mysql7')
->where('kplama','like',$request->ic.'%')
->orWhere('kpbaru','like',$request->ic.'%')
->take(3)
->get();
}
return response()->json($customer);
}
}
+34 -5
View File
@@ -23,6 +23,7 @@ use App\Audit;
use Carbon\Carbon;
use DateTime;
use DB;
class LaporanController extends Controller
{
@@ -145,12 +146,38 @@ class LaporanController extends Controller
$gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganbukanansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
$keuntunganbukanansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
->whereIn('norujukan',$gadaiDataKaunter)
->whereDate('tarikh_bayaran','=',$request->tarikh);
$total_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->sum('keuntungan_rebet');
$bil_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->count();
$keuntunganbukanansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
->selectRaw('sum(keuntungan_rebet) as sum')
->whereIn('norujukan',$gadaiDataKaunter)
->whereDate('tarikh_bayaran','=',$request->tarikh)
->where('kodcaw','=',$request->kodcaw)
->where('bayaran_pembiayaan','>', 0)
->groupby('norujukan')
->pluck('sum');
// ->sum('sum');
$sum = 0;
$countsum = 0;
foreach($keuntunganbukanansuran_kaunter_query as $quer)
{
$sum += $quer;
$countsum++;
}
// $total_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->sum('keuntungan_rebet');
// $bil_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->count();
$total_keuntunganbukanansuran_kaunter = $sum;
$bil_keuntunganbukanansuran_kaunter = $countsum;
// dd($total_keuntunganbukanansuran_kaunter);
// $total_keuntunganbukanansuran = 0;
@@ -245,6 +272,8 @@ class LaporanController extends Controller
$upahsimpankaunter = $keuntungan_kaunter + $upahtebus + $upahlelong + $upahansurKaunter + $total_keuntunganbukanansuran_kaunter;
// dd($keuntungan_kaunter,$upahtebus,$upahlelong,$upahansurKaunter,$total_keuntunganbukanansuran_kaunter,$upahsimpankaunter);
$keuntungansebenarkaunter = $total_keuntunganansuran_kaunter;
$upahsimpanonline = $upahansurOnline;
+26
View File
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Polis;
use App\Cawangan;
use App\LookupAlasan;
use Illuminate\Http\Request;
use Carbon\Carbon;
@@ -77,4 +78,29 @@ class PolisController extends Controller
return response()->json($polis);
}
public function LookupAlasan(Request $request)
{
$harini = Carbon::now();
$harini = new Carbon;
$alasan = LookupAlasan::on('mysql7')
->get();
return response()->json($alasan);
}
public function LaporanPolis(Request $request){
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
$polis = Polis::on($cawangan['mysql'])
->where('komen1','=',$request->alasan)
->where('tarikh','=',$request->tarikh)
->get();
return response()->json($polis);
}
}
+7 -1
View File
@@ -660,10 +660,14 @@ class TebusController extends Controller
->whereNotNull('hargajualan');
$tebustawarruqansuran = Tebus::on($cawangan['mysql'])
->select('tebus.bakiupah','tebus.norujukan')
->join('gadai as gad','gad.norujukan','=','tebus.norujukan')
->where('t_tebus','=',$request->tarikh)
->whereNotNull('hargajualan')
->where('hargajualan','<>','bakihargajualan');
->where('hargajualan','<>','bakihargajualan')
->get()->toArray();
// dd($tebustawarruqansuran);
// $totalpenebusantawarruq = ($tebustawarruq->sum('tebus.pinjaman') - $tebustawarruqansuran->sum('gad.pinjaman')) + $tebustawarruqansuran->sum('gad.bakipjm');
$totalpenebusantawarruq = $tebustawarruq->sum('tebus.pinjaman');
@@ -671,6 +675,8 @@ class TebusController extends Controller
$totalrebatetawarruq = $tebustawarruq->sum('tebus.rebate');
$totalkeuntungantawarruq = $tebustawarruq->sum('tebus.bakiupah');
// dd($totalkeuntunganarrahn,$totalkeuntungantawarruq);
$array_penebusan = ['bilarrahn' => $bilpenebusanarrahn, 'totalarrahn' => $totalpenebusanarrahn, 'keuntunganarrahn' => $totalkeuntunganarrahn, 'biltawarruq' => $bilpenebusantawarruq, 'totaltawarruq' => $totalpenebusantawarruq,'totalrebate' => $totalrebatetawarruq,'keuntungantawarruq' => $totalkeuntungantawarruq];
return response()->json($array_penebusan);
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class LookupAlasan extends Model
{
protected $table = 'lookup_alasan';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'recno',
'alasan'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+5
View File
@@ -361,6 +361,11 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('getwakil/{kodcaw}/status/{status}',['uses' => 'TebusController@getWakilbyStatus']);
$router->get('lookupwakil',['uses' => 'TebusController@LookupWakil']);
//API ALASAN
$router->get('lookupalasan',['uses' => 'PolisController@LookupAlasan']);
$router->get('polis/laporan',['uses' => 'PolisController@LaporanPolis']);
//update tagterima Tebus