fix skit2

This commit is contained in:
hafifierahman
2022-03-21 10:48:23 +08:00
parent 28fd9a6a64
commit d58e7dcd09
6 changed files with 186 additions and 1 deletions
+47 -1
View File
@@ -22,7 +22,10 @@ use App\BajetTahunan;
use App\Blacklist;
use App\Pelelong;
use App\Mohon;
use App\Pengesahan;
use App\Permohonan;
use App\Status;
use App\LookupStatus;
use DB;
use Carbon\Carbon;
@@ -1802,4 +1805,47 @@ class AdminPageController extends Controller
return response()->json($data);
}
public function TambahPermohonan(Request $request,$kodcaw)
{
$timeloni = Carbon::now();
$current = new Carbon();
$curent_year = substr($current->year,2,2);
$curent_month = sprintf("%02d", $current->month);
$current_day = sprintf("%02d", $current->day);
try {
$permohonan = new Permohonan;
$pengesahan = new Pengesahan;
$status = new Status;
$nopermohonan = 'AR' . strtoupper($kodcaw) . $curent_year . $curent_month . $current_day . '-000' .rand(1,9);
$permohonan->kodcaw = $kodcaw;
$permohonan->jenismohon = $request->jenismohon;
$permohonan->baki_petibesi = $request->bakipetibesi;
$permohonan->amaun_mohon = $request->jumlahmohon;
$permohonan->nama_pemohon = $request->namapemohon;
$permohonan->tarikh_permohonan = $request->tarikhmohon;
$permohonan->outstandingsemasa = $request->outstanding;
$permohonan->nopermohonan = $nopermohonan;
$permohonan->save();
$pengesahan->mohonid = $permohonan->id;
$pengesahan->kodcaw = $kodcaw;
$pengesahan->save();
$status->mohonid = $permohonan->id;
$status->statusid = 1;
$status->tarikhmasa = $timeloni->toDateTimeString();
$status->save();
return response(1);
} catch (\Throwable $e) {
return response($e);
}
}
}