Merge branch 'adminapi' into 'master'
Adminapi See merge request online-sistem1/api_arrahn!135
This commit is contained in:
@@ -233,7 +233,7 @@ class AdminPageController extends Controller
|
|||||||
->groupBy(DB::connection($cawangan['mysql'])
|
->groupBy(DB::connection($cawangan['mysql'])
|
||||||
->raw("DATE_FORMAT(t_jual,'%Y%m')"))
|
->raw("DATE_FORMAT(t_jual,'%Y%m')"))
|
||||||
->whereYear('t_jual',$current->year)
|
->whereYear('t_jual',$current->year)
|
||||||
->where([['t_jual','<=',$current->toDateString()],['t_jual','>=',$monthly_date]])
|
// ->where([['t_jual','<=',$current->toDateString()],['t_jual','>=',$monthly_date]])
|
||||||
->orderBy('t_jual','asc')
|
->orderBy('t_jual','asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -245,14 +245,21 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$tebus = Tebus::on($cawangan['mysql'])
|
$tebus = Tebus::on($cawangan['mysql'])
|
||||||
->selectRaw('SUM(bakiupah) AS totalupahsimpan')
|
->selectRaw('SUM(bakiupah) AS totalupahsimpan')
|
||||||
->addSelect(DB::connection($cawangan['mysql'])
|
->addSelect(DB::connection($cawangan['mysql'])
|
||||||
->raw('DATE_FORMAT(t_tebus, "%Y-%m") as t_tebus'))
|
->raw('DATE_FORMAT(t_tebus, "%Y-%m") as t_tebus'))
|
||||||
->groupBy(DB::connection($cawangan['mysql'])
|
->groupBy(DB::connection($cawangan['mysql'])
|
||||||
->raw("DATE_FORMAT(t_tebus,'%Y%m')"))
|
->raw("DATE_FORMAT(t_tebus,'%Y%m')"))
|
||||||
->whereYear('t_tebus',$current->year)
|
->where(function($query) use ($current){
|
||||||
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()],['t_tebus','>=',$monthly_date]])
|
$query
|
||||||
->orWhere([['jenistebus','=','A'],['t_tebus','<=',$current->toDateString()],['t_tebus','>=',$monthly_date]])
|
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()]])
|
||||||
|
->whereYear('t_tebus',$current->year);
|
||||||
|
})
|
||||||
|
->orWhere(function($query) use ($current){
|
||||||
|
$query
|
||||||
|
->where([['jenistebus','=','T'],['t_tebus','<=',$current->toDateString()]])
|
||||||
|
->whereYear('t_tebus',$current->year);
|
||||||
|
})
|
||||||
->orderBy('t_tebus','asc')
|
->orderBy('t_tebus','asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -265,8 +272,6 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
$total = $totaltebus + $totallelong;
|
$total = $totaltebus + $totallelong;
|
||||||
|
|
||||||
// $total = $lelongupahsimpan + $tebus;
|
|
||||||
|
|
||||||
array_push($arrayKeuntungan,['bajet' => $bajetgroup,'total' => $total]);
|
array_push($arrayKeuntungan,['bajet' => $bajetgroup,'total' => $total]);
|
||||||
|
|
||||||
return response()->json($arrayKeuntungan);
|
return response()->json($arrayKeuntungan);
|
||||||
@@ -1137,7 +1142,7 @@ class AdminPageController extends Controller
|
|||||||
|
|
||||||
$upahToday = $upahToday + $upah_tebus_today + $upah_today;
|
$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;
|
$upahToday = $upahToday + $ansuran_today;
|
||||||
|
|
||||||
@@ -1221,7 +1226,7 @@ class AdminPageController extends Controller
|
|||||||
public function AdminsearchSagOnline(Request $request)
|
public function AdminsearchSagOnline(Request $request)
|
||||||
{
|
{
|
||||||
$customer = TransactionOnline::on('mysql7')
|
$customer = TransactionOnline::on('mysql7')
|
||||||
->where('norujukan','=', $request->norujukan)
|
->where('billplz_id','=', $request->billplzid)
|
||||||
->orderBy('status', 'asc')
|
->orderBy('status', 'asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|||||||
@@ -695,4 +695,45 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
return response()->json($dataCustomer);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ use App\Audit;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use DB;
|
||||||
|
|
||||||
class LaporanController extends Controller
|
class LaporanController extends Controller
|
||||||
{
|
{
|
||||||
@@ -137,20 +138,32 @@ class LaporanController extends Controller
|
|||||||
->where('trans.trans_type','!=','A')
|
->where('trans.trans_type','!=','A')
|
||||||
->where('trans.teller','<>','Online')
|
->where('trans.teller','<>','Online')
|
||||||
->whereDate('trans.created_at','=',$request->tarikh)
|
->whereDate('trans.created_at','=',$request->tarikh)
|
||||||
->where('trans.kodcaw','=',$request->kodcaw)
|
->where('trans.kodcaw','=',$request->kodcaw);
|
||||||
// ->whereNotNull('db2.hargajualan')
|
// ->whereNotNull('db2.hargajualan')
|
||||||
// ->sum('keuntungan_rebet');
|
// ->sum('keuntungan_rebet');
|
||||||
// ->get();
|
// ->get();
|
||||||
->pluck('transaksi_keuntungan.norujukan');
|
// ->pluck('transaksi_keuntungan.norujukan');
|
||||||
|
|
||||||
$gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganbukanansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
// dd($total_keuntunganbukanansuran_data_kaunter);
|
||||||
|
|
||||||
$keuntunganbukanansuran_kaunter_query = TransaksiKeuntungan::on('mysql7')
|
// $gadaiDataKaunter = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$total_keuntunganbukanansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan');
|
||||||
->whereIn('norujukan',$gadaiDataKaunter)
|
|
||||||
->whereDate('tarikh_bayaran','=',$request->tarikh);
|
|
||||||
|
// $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');
|
||||||
|
|
||||||
|
|
||||||
|
$total_keuntunganbukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('keuntungan_rebet');
|
||||||
|
|
||||||
|
$bil_keuntunganbukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->count();
|
||||||
|
|
||||||
$total_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->sum('keuntungan_rebet');
|
|
||||||
$bil_keuntunganbukanansuran_kaunter = $keuntunganbukanansuran_kaunter_query->count();
|
|
||||||
|
|
||||||
// $total_keuntunganbukanansuran = 0;
|
// $total_keuntunganbukanansuran = 0;
|
||||||
|
|
||||||
@@ -245,6 +258,8 @@ class LaporanController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$upahsimpankaunter = $keuntungan_kaunter + $upahtebus + $upahlelong + $upahansurKaunter + $total_keuntunganbukanansuran_kaunter;
|
$upahsimpankaunter = $keuntungan_kaunter + $upahtebus + $upahlelong + $upahansurKaunter + $total_keuntunganbukanansuran_kaunter;
|
||||||
|
|
||||||
|
// dd($keuntungan_kaunter,$upahtebus,$upahlelong,$upahansurKaunter,$total_keuntunganbukanansuran_kaunter,$upahsimpankaunter);
|
||||||
$keuntungansebenarkaunter = $total_keuntunganansuran_kaunter;
|
$keuntungansebenarkaunter = $total_keuntunganansuran_kaunter;
|
||||||
|
|
||||||
$upahsimpanonline = $upahansurOnline;
|
$upahsimpanonline = $upahansurOnline;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Polis;
|
use App\Polis;
|
||||||
use App\Cawangan;
|
use App\Cawangan;
|
||||||
|
use App\LookupAlasan;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -77,4 +78,29 @@ class PolisController extends Controller
|
|||||||
return response()->json($polis);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -660,17 +660,22 @@ class TebusController extends Controller
|
|||||||
->whereNotNull('hargajualan');
|
->whereNotNull('hargajualan');
|
||||||
|
|
||||||
$tebustawarruqansuran = Tebus::on($cawangan['mysql'])
|
$tebustawarruqansuran = Tebus::on($cawangan['mysql'])
|
||||||
|
->select('tebus.bakiupah','tebus.norujukan')
|
||||||
->join('gadai as gad','gad.norujukan','=','tebus.norujukan')
|
->join('gadai as gad','gad.norujukan','=','tebus.norujukan')
|
||||||
->where('t_tebus','=',$request->tarikh)
|
->where('t_tebus','=',$request->tarikh)
|
||||||
->whereNotNull('hargajualan')
|
->whereNotNull('hargajualan')
|
||||||
->where('hargajualan','<>','bakihargajualan');
|
->where('hargajualan','<>','bakihargajualan');
|
||||||
|
|
||||||
|
// dd($tebustawarruqansuran);
|
||||||
|
|
||||||
// $totalpenebusantawarruq = ($tebustawarruq->sum('tebus.pinjaman') - $tebustawarruqansuran->sum('gad.pinjaman')) + $tebustawarruqansuran->sum('gad.bakipjm');
|
// $totalpenebusantawarruq = ($tebustawarruq->sum('tebus.pinjaman') - $tebustawarruqansuran->sum('gad.pinjaman')) + $tebustawarruqansuran->sum('gad.bakipjm');
|
||||||
$totalpenebusantawarruq = $tebustawarruq->sum('tebus.pinjaman');
|
$totalpenebusantawarruq = $tebustawarruq->sum('tebus.pinjaman');
|
||||||
$bilpenebusantawarruq = $tebustawarruq->count();
|
$bilpenebusantawarruq = $tebustawarruq->count();
|
||||||
$totalrebatetawarruq = $tebustawarruq->sum('tebus.rebate');
|
$totalrebatetawarruq = $tebustawarruq->sum('tebus.rebate');
|
||||||
$totalkeuntungantawarruq = $tebustawarruq->sum('tebus.bakiupah');
|
$totalkeuntungantawarruq = $tebustawarruq->sum('tebus.bakiupah');
|
||||||
|
|
||||||
|
// dd($totalkeuntunganarrahn,$totalkeuntungantawarruq);
|
||||||
|
|
||||||
$array_penebusan = ['bilarrahn' => $bilpenebusanarrahn, 'totalarrahn' => $totalpenebusanarrahn, 'keuntunganarrahn' => $totalkeuntunganarrahn, 'biltawarruq' => $bilpenebusantawarruq, 'totaltawarruq' => $totalpenebusantawarruq,'totalrebate' => $totalrebatetawarruq,'keuntungantawarruq' => $totalkeuntungantawarruq];
|
$array_penebusan = ['bilarrahn' => $bilpenebusanarrahn, 'totalarrahn' => $totalpenebusanarrahn, 'keuntunganarrahn' => $totalkeuntunganarrahn, 'biltawarruq' => $bilpenebusantawarruq, 'totaltawarruq' => $totalpenebusantawarruq,'totalrebate' => $totalrebatetawarruq,'keuntungantawarruq' => $totalkeuntungantawarruq];
|
||||||
|
|
||||||
return response()->json($array_penebusan);
|
return response()->json($array_penebusan);
|
||||||
|
|||||||
@@ -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 = [];
|
||||||
|
}
|
||||||
@@ -361,6 +361,11 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
|||||||
$router->get('getwakil/{kodcaw}/status/{status}',['uses' => 'TebusController@getWakilbyStatus']);
|
$router->get('getwakil/{kodcaw}/status/{status}',['uses' => 'TebusController@getWakilbyStatus']);
|
||||||
$router->get('lookupwakil',['uses' => 'TebusController@LookupWakil']);
|
$router->get('lookupwakil',['uses' => 'TebusController@LookupWakil']);
|
||||||
|
|
||||||
|
//API ALASAN
|
||||||
|
$router->get('lookupalasan',['uses' => 'PolisController@LookupAlasan']);
|
||||||
|
$router->get('polis/laporan',['uses' => 'PolisController@LaporanPolis']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//update tagterima Tebus
|
//update tagterima Tebus
|
||||||
|
|||||||
Reference in New Issue
Block a user