added function to update all ig
This commit is contained in:
@@ -3834,18 +3834,20 @@ class AdminPageController extends Controller
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->simplePaginate(5);
|
||||
$check = app(AccountService::class);
|
||||
|
||||
$array_all = [];
|
||||
$array_all = ['current_page' => $cawangan->currentPage()];
|
||||
foreach($cawangan as $caw){
|
||||
try{
|
||||
$test =$check->checkAccount($caw['kodcaw'],'8');
|
||||
$array_all[$caw['kodcaw']] = $test;
|
||||
$test =$check->checkAccount($caw['kodcaw'],$request->month);
|
||||
$array_all['data'][$caw['details_caw']] = $test;
|
||||
}catch(\Exception $e){
|
||||
Log::error($caw['kodcaw']);
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json($array_all);
|
||||
$response = $array_all;
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\imbangdugabackup;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\Reports\ImbangDugaService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BalanceSheetsController extends Controller
|
||||
{
|
||||
@@ -24,10 +25,27 @@ class BalanceSheetsController extends Controller
|
||||
|
||||
public function insertBalanceSheets(Request $request){
|
||||
$igService = new ImbangDugaService($request->kodcaw,$request->tarikh);
|
||||
|
||||
$insert_imbangduga = $igService->setImbangDugaBackup();
|
||||
|
||||
return $insert_imbangduga;
|
||||
}
|
||||
|
||||
public function updateIGBalanceSheets(Request $request){
|
||||
$cawangan = Cawangan::on('mysql7')->get();
|
||||
$date = Carbon::now()->month($request->month);
|
||||
$lastDay = (clone $date)->endOfMonth();
|
||||
|
||||
try{
|
||||
foreach($cawangan as $caw){
|
||||
$igService = new ImbangDugaService($caw['kodcaw'],$lastDay->toDateString());
|
||||
$insert_imbangduga = $igService->setImbangDugaBackup();
|
||||
}
|
||||
}catch(\Exception $e){
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
return response('success');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user