nisha-checking-wtd
This commit is contained in:
@@ -9,6 +9,8 @@ use App\Customer;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\Helper;
|
use App\Helper;
|
||||||
|
use App\SerahBaki;
|
||||||
|
use App\WTD;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
@@ -121,4 +123,69 @@ class WTDController extends Controller
|
|||||||
return response()->json($responses);
|
return response()->json($responses);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDebugWtd(Request $request){
|
||||||
|
|
||||||
|
$startDate = $request->startDate ?? now()->startOfMonth()->toDateString();
|
||||||
|
$endDate = $request->endDate ?? now()->endOfMonth()->toDateString();
|
||||||
|
|
||||||
|
$active_dbs = Helper::getActiveCawanganDbConnection();
|
||||||
|
|
||||||
|
$cawangan = Cawangan::select('kodcaw', 'details_caw', 'mysql')
|
||||||
|
->whereIn('mysql', $active_dbs)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$responses = [];
|
||||||
|
|
||||||
|
foreach ($cawangan as $caw) {
|
||||||
|
|
||||||
|
$db = $caw->mysql;
|
||||||
|
|
||||||
|
$serahbaki = SerahBaki::on($db)
|
||||||
|
->whereBetween('t_jual', [$startDate, $endDate])
|
||||||
|
->where('aktif', 1)
|
||||||
|
//->selectRaw("baki as serahb")
|
||||||
|
->sum('baki');;
|
||||||
|
//->get();
|
||||||
|
|
||||||
|
$tuntutbaki = TuntutBaki::on($db)
|
||||||
|
->whereBetween('tarikh', [$startDate, $endDate])
|
||||||
|
->where('teller', 'DM')
|
||||||
|
//->selectRaw("jumlah as tuntutb")
|
||||||
|
->sum('jumlah');
|
||||||
|
//->get();
|
||||||
|
|
||||||
|
$twtd = WTD::on($db)
|
||||||
|
->whereBetween('tarikh', [$startDate, $endDate])
|
||||||
|
//->selectRaw("wtd as twtd")
|
||||||
|
->sum('wtd');
|
||||||
|
//->get();
|
||||||
|
|
||||||
|
$wtd_det = [];
|
||||||
|
|
||||||
|
$wtd_det[] = [
|
||||||
|
"serahb" => $serahbaki,
|
||||||
|
"tuntutb" => $tuntutbaki,
|
||||||
|
"twtd" => $twtd,
|
||||||
|
];
|
||||||
|
|
||||||
|
$details = collect($wtd_det)
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
//dd($details);
|
||||||
|
|
||||||
|
$responses[] = [
|
||||||
|
'kodcaw' => $caw->kodcaw,
|
||||||
|
'details_caw' => $caw->details_caw,
|
||||||
|
//collect($details)->sum('jumlah'),
|
||||||
|
// WEB
|
||||||
|
'serahb' => collect($details)->sum('serahb'),
|
||||||
|
'tuntutb' => collect($details)->sum('tuntutb'),
|
||||||
|
'twtd' => collect($details)->sum('twtd'),
|
||||||
|
//'debugwtd' => $details,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return response()->json($responses);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -902,6 +902,9 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
|||||||
//laporan wtd
|
//laporan wtd
|
||||||
$router->get('wtd/summaryWtd', ['uses' => 'WTDController@getSummaryWtd']);
|
$router->get('wtd/summaryWtd', ['uses' => 'WTDController@getSummaryWtd']);
|
||||||
|
|
||||||
|
//debugwtd
|
||||||
|
$router->get('wtd/debugWtd', ['uses' => 'WTDController@getDebugWtd']);
|
||||||
|
|
||||||
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
||||||
$router->get('laporan/aging',['uses'=>'AdminPageController@LaporanAging']);
|
$router->get('laporan/aging',['uses'=>'AdminPageController@LaporanAging']);
|
||||||
$router->get('dashboard/aging',['uses'=>'AdminPageController@DashboardAging']);
|
$router->get('dashboard/aging',['uses'=>'AdminPageController@DashboardAging']);
|
||||||
|
|||||||
Reference in New Issue
Block a user