Merged in izzati-hotfix-gadai-tebus-keseluruhan (pull request #297)
edit sort cawangan
This commit is contained in:
@@ -26,13 +26,24 @@ class GadaianController extends Controller
|
||||
$startDate = $request->startDate;
|
||||
$endDate = $request->endDate;
|
||||
|
||||
// Get active branch DBs from helper
|
||||
$active_cawangan_db_connection = Helper::getActiveCawanganDbConnection();
|
||||
|
||||
$active_cawangan_db_name = array_map(function ($db_connection) {
|
||||
return config('database.connections' . '.' . $db_connection . '.' . 'database');
|
||||
}, $active_cawangan_db_connection);
|
||||
|
||||
$active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray();
|
||||
|
||||
// Fetch branch details with mysql info
|
||||
$cawangan_available = Cawangan::select('kodcaw', 'details_caw', 'mysql')
|
||||
->whereIn('mysql', $active_cawangan_db_connection)
|
||||
->get();
|
||||
|
||||
// Get db connections
|
||||
$active_cawangan_db_connection = array_column($cawangan_available->toArray(), 'mysql');
|
||||
|
||||
// Map branch info for response
|
||||
$active_cawangan_detail = $cawangan_available->map(function ($c) {
|
||||
return [
|
||||
'kodcaw' => $c->kodcaw,
|
||||
'details_caw' => $c->details_caw,
|
||||
];
|
||||
})->values()->toArray();
|
||||
|
||||
$summary_gadaian_data = array_map(function ($db_connection) use ($request) {
|
||||
$query = Gadai::on($db_connection);
|
||||
|
||||
@@ -21,16 +21,24 @@ class PenebusanController extends Controller
|
||||
|
||||
public function getSummaryLaporanTebus(Request $request)
|
||||
{
|
||||
// Get active branch DBs from helper
|
||||
$active_cawangan_db_connection = Helper::getActiveCawanganDbConnection();
|
||||
$arrahn_master_db_connection = Cawangan::all()->pluck('mysql')->toArray();
|
||||
|
||||
$active_cawangan_db_connection = array_intersect($active_cawangan_db_connection, $arrahn_master_db_connection);
|
||||
|
||||
$active_cawangan_db_name = array_map(function ($db_connection) {
|
||||
return config('database.connections' . '.' . $db_connection . '.' . 'database');
|
||||
}, $active_cawangan_db_connection);
|
||||
|
||||
$active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray();
|
||||
|
||||
// Fetch branch details with mysql info
|
||||
$cawangan_available = Cawangan::select('kodcaw', 'details_caw', 'mysql')
|
||||
->whereIn('mysql', $active_cawangan_db_connection)
|
||||
->get();
|
||||
|
||||
// Get db connections
|
||||
$active_cawangan_db_connection = array_column($cawangan_available->toArray(), 'mysql');
|
||||
|
||||
// Map branch info for response
|
||||
$active_cawangan_detail = $cawangan_available->map(function ($c) {
|
||||
return [
|
||||
'kodcaw' => $c->kodcaw,
|
||||
'details_caw' => $c->details_caw,
|
||||
];
|
||||
})->values()->toArray();
|
||||
|
||||
$summary_penebusan_data = array_map(function ($db_connection) use ($request) {
|
||||
$penebusan = Tebus::on($db_connection)
|
||||
|
||||
Reference in New Issue
Block a user