DONE: merged code annur with into one codebase

This commit is contained in:
ISMAIL MASSERAN
2026-09-17 08:01:49 +08:00
parent 363420d195
commit 0b0c6f9f17
9 changed files with 206 additions and 5 deletions
+50
View File
@@ -0,0 +1,50 @@
APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:FFRogE6mJj8FaDSSHl/KpXpzqi2M+P4plxVSRgVM8JI=
APP_DEBUG=false
APP_URL=https://annurv2.erahn.com.my
API_URL=https://apiannurv2.erahn.com.my
API_ARRAHNBID=http://lelong.test/api/
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=192.168.1.216
DB_PORT=3306
DB_DATABASE=kaunter_annur
DB_USERNAME=spider
DB_PASSWORD=arrahn@123
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
PUSHER_APP_ID=1132718
PUSHER_APP_KEY=26b0ec2f297f94b7aa9b
PUSHER_APP_SECRET=421b61fb5a8ecce477a6
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=8085
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
@@ -23,9 +23,10 @@ class AdminFeatureController extends Controller
$metaRes = $this->api()->get($api_url . '/api/features');
$meta = $metaRes->successful() ? $metaRes->json() : [];
$keys = is_array($meta) && !empty($meta['keys']) ? $meta['keys'] : ['pembiayaan_online'];
$keys = is_array($meta) && !empty($meta['keys']) ? $meta['keys'] : ['pembiayaan_online', 'rebet_annur'];
$labels = is_array($meta) && !empty($meta['labels']) ? $meta['labels'] : [
'pembiayaan_online' => 'Pembiayaan Online',
'rebet_annur' => 'Rebet / diskaun Annur',
];
$listRes = $this->api()->get($api_url . '/api/features/cawangan');
+22 -2
View File
@@ -32,14 +32,30 @@ class GadaianController extends Controller
$this->AliranTunaiController = new AliranTunaiController();
}
protected function isPembiayaanOnlineEnabled($kodcaw)
protected function isFeatureEnabled($kodcaw, $feature)
{
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/api/cawangan/' . $kodcaw)
->json();
$features = is_array($cawangan_info) ? ($cawangan_info['features'] ?? []) : [];
return !empty($features['pembiayaan_online']);
return !empty($features[$feature]);
}
protected function isPembiayaanOnlineEnabled($kodcaw)
{
return $this->isFeatureEnabled($kodcaw, 'pembiayaan_online');
}
protected function parseMoney($value)
{
if ($value === null || $value === '') {
return 0.0;
}
$cleaned = preg_replace('/[^0-9.\-]/', '', str_replace([',', '%', ' '], '', (string) $value));
return is_numeric($cleaned) ? (float) $cleaned : 0.0;
}
public function index(Request $request)
@@ -211,6 +227,8 @@ class GadaianController extends Controller
'onepercent' => $onepercent,
'margin_semasa' => $margin_pinjaman,
'nokp' => $request->nokp,
'kadar_rebate' => $this->parseMoney($request->kadar_rebate),
'rebate' => $this->parseMoney($request->rebate),
])->json();
@@ -423,6 +441,8 @@ class GadaianController extends Controller
'ujrah' => $ujrah,
'onepercent' => $onepercent,
'margin_semasa' => $margin_pinjaman,
'kadar_rebate' => $this->parseMoney($request->kadar_rebate),
'rebate' => $this->parseMoney($request->rebate),
])->json();
$update_komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/komuditi/update', [
'unit_komuditi' => round($request->pinjaman, 2),
+15 -2
View File
@@ -2473,6 +2473,14 @@ class KhazanahController extends Controller
$hapuskira = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/CalculationHapusKira/' . $auth_user['cawangan'],['tarikh' => $tarikh_imbangan2])->json();
$xtra = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/Xtra/' . $auth_user['cawangan'],['tarikh' => $tarikh_imbangan2])->json();
$rebetAnnur = !empty(($cawangan_info['features'] ?? [])['rebet_annur']);
$rebetpromo = 0;
$pelarasanrebate = 0;
if ($rebetAnnur) {
$rebetpromo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/RebetPromoCalculation/' . $auth_user['cawangan'],['tarikh' => $tarikh_imbangan2])->json();
$pelarasanrebate = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/PelarasanRebate/' . $auth_user['cawangan'],['tarikh' => $tarikh_imbangan2])->json();
}
//TunaiDitangan Sementara Upah
if($tarikh_imbangan2 >= '2021-04-22' && $tarikh_imbangan2 < '2021-05-05')
@@ -2523,6 +2531,7 @@ class KhazanahController extends Controller
if($imbangduga['pindahkekpkb'] > 0) array_push($hartasemasa,['glcode' => '1000/090','descpt' => 'Pindah Ke KPKB(IP)', 'amaun' => $imbangduga['pindahkekpkb']]);
if($peruntukanhapuskira > 0) array_push($hartasemasa,['glcode' => '1000/015','descpt' => 'Peruntukan Hapus Kira', 'amaun' => $peruntukanhapuskira]);
if($belian1stop > 0) array_push($hartasemasa,['glcode' => '8000/501','descpt' => 'Belian 1 Stop', 'amaun' => $belian1stop]);
if($rebetpromo > 0) array_push($hartasemasa,['glcode' => '5000/242','descpt' => 'Diskaun Promosi', 'amaun' => ($rebetpromo * -1)]);
$totalhartasemasa = 0;
foreach($hartasemasa as $index => $hs)
@@ -2554,6 +2563,8 @@ class KhazanahController extends Controller
if($utgterkumpulxtra > 0) array_push($tanggungansemasa,['glcode' => '7000/201','descpt' => 'Untung/Rugi Terkumpul Xtra','amaun' => $utgterkumpulxtra]);
if($jualan1stop > 0) array_push($tanggungansemasa,['glcode' => '9000/501','descpt' => 'Jualan 1 Stop','amaun' => $jualan1stop]);
if($hapuskira > 0) array_push($tanggungansemasa,['glcode' => '3000/011','descpt' => 'Hapus Kira','amaun' => -$hapuskira]);
if($rebetpromo > 0) array_push($tanggungansemasa,['glcode' => '5000/242','descpt' => 'Diskaun Promosi', 'amaun' => ($rebetpromo * -1)]);
if($pelarasanrebate > 0) array_push($tanggungansemasa,['glcode' => '5000/243','descpt' => 'Pelarasan Rebate', 'amaun' => ($pelarasanrebate * -1)]);
$totaltanggungansemasa = 0;
foreach($tanggungansemasa as $index => $ts)
@@ -4031,8 +4042,9 @@ class KhazanahController extends Controller
$cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
$cawangan_detail=$cawangan[0];
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])->json();
return view('print.laporan_gadaian_ujrah', compact('gadai','cawangan_detail','tarikh_cetak','mula_date','api_url','hingga_date','statistik','reportPembiayaan','reportLoanAmount','reportMarhunValue','reportMarhunMargin','reportCustomerJob','reportCustomerRace','reportCustomerRace'));
return view('print.laporan_gadaian_ujrah', compact('gadai','cawangan_detail','cawangan_info','tarikh_cetak','mula_date','api_url','hingga_date','statistik','reportPembiayaan','reportLoanAmount','reportMarhunValue','reportMarhunMargin','reportCustomerJob','reportCustomerRace','reportCustomerRace'));
}
@@ -4075,7 +4087,8 @@ class KhazanahController extends Controller
$cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
$cawangan_detail=$cawangan[0];
return view('print.laporan_tebus_ujrah', compact('tebus','cawangan_detail','tarikh_cetak','mula_date','hingga_date','tebuspengasingan','api_url','upahlama','ansuran','totalkeuntunganrebet'));
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('print.laporan_tebus_ujrah', compact('tebus','cawangan_detail','cawangan_info','tarikh_cetak','mula_date','hingga_date','tebuspengasingan','api_url','upahlama','ansuran','totalkeuntunganrebet'));
}
public function laporanAnsuranUjrah(){
@@ -29,6 +29,7 @@
<div class="form-group row col-12">
<input type="hidden" name="kodcaw" id="kodcaw" value="{{$cawangan_info['kodcaw']}}">
<input type="hidden" id="pembiayaan_online_enabled" value="{{ !empty(($cawangan_info['features'] ?? [])['pembiayaan_online']) ? '1' : '0' }}">
<input type="hidden" id="rebet_annur_enabled" value="{{ !empty(($cawangan_info['features'] ?? [])['rebet_annur']) ? '1' : '0' }}">
<input type="hidden" name="nokp" id="nokp" value="{{ $customer_info['kpbaru'] }}">
<input type="hidden" name="tag_anggota" id="tag_anggota" value="{{ $customer_info['tag_anggota'] ?? 0 }}">
@@ -186,6 +187,19 @@
</div>
</diV>
</div>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<div class="col-4">
<div class="form-group row">
<div class="col-md-6">
Kadar Rebet
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly name="rebate" id="rebate">
<input type="text" class="form-control" readonly name="kadar_rebate" id="kadar_rebate">
</div>
</div>
</div>
@endif
<div class="col-4">
<div class="form-group row">
<div class="col-md-6">
@@ -789,6 +803,26 @@
$('#ujrah').val(formatter.format(getRoundedMethod(array_keuntungan['ujrah']).toFixed(2)));
$('#onepercent').val(formatter.format(getRoundedMethod(array_keuntungan['onepercent']).toFixed(2)));
if ($('#rebet_annur_enabled').val() === '1') {
var rebate, kadar_rebate;
if (pinjaman < 20000) {
rebate = keuntungan_sebulan * 0.05;
kadar_rebate = 5;
} else if (pinjaman >= 20000 && pinjaman <= 50000) {
rebate = keuntungan_sebulan * 0.10;
kadar_rebate = 10;
} else if (pinjaman > 50000 && pinjaman <= 100000) {
rebate = keuntungan_sebulan * 0.15;
kadar_rebate = 15;
} else {
rebate = keuntungan_sebulan * 0.20;
kadar_rebate = 20;
}
rebate = getRoundedMethod(rebate);
$('#rebate').val(formatter.format(rebate.toFixed(2)));
$('#kadar_rebate').val(formatter.format(kadar_rebate.toFixed(2)) + ' %');
}
});
const formatter = new Intl.NumberFormat('en-US', {
@@ -326,6 +326,16 @@
<input type="text" id="jumlahtelahdibayar" class="form-control" readonly/>
</div>
</div>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<div class="form-group row">
<div class="col-4">
REBET DISKAUN (RM)
</div>
<div class="col-8">
<input type="text" id="jumlahDiskaun" value="{{ number_format($gadai['diskaun'] ?? 0, 2) }}" class="form-control" readonly/>
</div>
</div>
@endif
</div>
</div>
@@ -441,6 +451,16 @@
<input type="text" id="jumlahupah" class="form-control" readonly/>
</div>
</div>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<div class="form-group row">
<div class="col-4">
REBET DISKAUN (RM)
</div>
<div class="col-8">
<input type="text" id="jumlahDiskaun" value="{{ number_format($gadai['diskaun'] ?? 0, 2) }}" class="form-control" readonly/>
</div>
</div>
@endif
<div id="divbakipinjaman">
<div class="form-group row">
@@ -467,6 +487,17 @@
<input type="text" id="jumlahtelahdibayar" class="form-control" readonly/>
</div>
</div>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<div class="form-group row">
<div class="col-4">
REBET DISKAUN (RM)
</div>
<div class="col-8">
<input type="text" id="jumlahDiskaun" value="{{ number_format($gadai['diskaun'] ?? 0, 2) }}" class="form-control" readonly/>
</div>
</div>
@endif
<div class="form-group row" id="divbayaran">
@@ -1,3 +1,4 @@
@php $rebetAnnur = !empty(($cawangan_info['features'] ?? [])['rebet_annur']); @endphp
<style>
#header {
font-family: Arial, Helvetica, sans-serif;
@@ -230,6 +231,9 @@
<th>Lain-Lain Caj (RM)</th>
<th>Keuntungan 1% (RM)</th>
<th>Keuntungan</th>
@if($rebetAnnur)
<th>Diskaun Rebet</th>
@endif
<th>Peratus (%)</th>
</tr>
@php
@@ -241,6 +245,7 @@
$bil = 0;
$full_total_ujrah = 0;
$full_total_onepercent = 0;
$totaldiskaun = 0;
@endphp
@foreach($gadai as $index=>$item)
@@ -251,6 +256,7 @@
$totalupah += $item['upah12'];
$full_total_ujrah += $item['ujrah']*12;
$full_total_onepercent += $item['onepercent']*12;
$totaldiskaun += $item['diskaun'] ?? 0;
@endphp
@if($index > 0)
@@ -264,6 +270,7 @@
$totalberatteller = 0;
$totalujrah = 0;
$totalonepercent = 0;
$totaldiskaunteller = 0;
@endphp
@endif
@@ -278,6 +285,7 @@
$totalupah12 = 0;
$totalujrah = 0;
$totalonepercent= 0;
$totaldiskaunteller = 0;
@endphp
@endif
@@ -303,6 +311,9 @@
<td>{{ number_format($item['ujrah']*12,2) }}</td>
<td>{{ number_format($item['onepercent']*12,2) }}</td>
<td>{{ number_format($item['upah12'],2) }}</td>
@if($rebetAnnur)
<td>{{ number_format($item['diskaun'] ?? 0,2) }}</td>
@endif
<td>{{ $item['percentpinj'] }}</td>
</tr>
@php $counter++; @endphp
@@ -313,6 +324,7 @@
$totalupah12 += $item['upah12'];
$totalujrah += $item['ujrah']*12;
$totalonepercent += $item['onepercent']*12;
$totaldiskaunteller += $item['diskaun'] ?? 0;
@endphp
@@ -327,6 +339,9 @@
<td><b>{{ number_format($totalujrah,2) }}</b></td>
<td><b>{{ number_format($totalonepercent,2) }}</b></td>
<td><b>{{ number_format($totalupah12,2) }} </b></td>
@if($rebetAnnur)
<td><b>{{ number_format($totaldiskaunteller,2) }} </b></td>
@endif
</tr>
@@ -337,6 +352,7 @@
$totalnmteller = 0;
$totalujrah = 0;
$totalonepercent = 0;
$totaldiskaunteller = 0;
@endphp
@endif
@@ -350,6 +366,9 @@
<td><b>{{ number_format($totalujrah,2) }}</b></td>
<td><b>{{ number_format($totalonepercent,2) }}</b></td>
<td><b>{{ number_format($totalupah12,2) }} </b></td>
@if($rebetAnnur)
<td><b>{{ number_format($totaldiskaunteller,2) }} </b></td>
@endif
</tr>
@endif
@@ -1,3 +1,4 @@
@php $rebetAnnur = !empty(($cawangan_info['features'] ?? [])['rebet_annur']); @endphp
<style>
#header {
font-family: Arial, Helvetica, sans-serif;
@@ -241,6 +242,9 @@
<th>B.Pembiayaan(RM)</th>
<th>Lain-Lain Caj (RM)</th>
<th>Untung 1% (RM)</th>
@if($rebetAnnur)
<th>Diskaun Rebet (RM)</th>
@endif
<th>Pendapatan(RM)</th>
<th>Bayaran(RM)</th>
<th>Jumlah(RM)</th>
@@ -254,6 +258,7 @@
$totalupah = 0;
$totalujrah = 0;
$totalonepercent = 0;
$totaldiskaunrebate = 0;
@endphp
@foreach ($tebus as $index => $item)
@@ -266,6 +271,7 @@
$totalnm += $item['nilaimarhun'];
$totalujrah += $item['ujrah'];
$totalonepercent += $item['onepercent'];
$totaldiskaunrebate += $item['diskaun_rebate'] ?? 0;
@endphp
@@ -282,6 +288,7 @@
$totalbayaranteller = 0;
$totalujrahteller = 0;
$totalonepercentteller = 0;
$totaldiskaunrebateteller = 0;
@endphp
@endif
@else
@@ -297,6 +304,7 @@
$totaljumlahteller = 0;
$totalujrahteller = 0;
$totalonepercentteller = 0;
$totaldiskaunrebateteller = 0;
@endphp
@endif
@@ -336,6 +344,9 @@
</td>
<td>{{ number_format($item['ujrah'], 2) }}</td>
<td>{{ number_format($item['onepercent'], 2) }}</td>
@if($rebetAnnur)
<td>{{ number_format($item['diskaun_rebate'] ?? 0, 2) }}</td>
@endif
{{-- <td>{{ number_format($item['bakiupah'], 2) }}</td> --}}
<td>
@php
@@ -371,6 +382,7 @@
$totalbayaranteller += $item['bakipjm']; //
$totalujrahteller += $item['ujrah'];
$totalonepercentteller += $item['onepercent'];
$totaldiskaunrebateteller += $item['diskaun_rebate'] ?? 0;
@endphp
@php
@@ -388,6 +400,9 @@
<td><b>{{ number_format($totalpinjamanteller, 2) }} </b></td>
<td><b>{{ number_format($totalujrahteller, 2) }} </b></td>
<td><b>{{ number_format($totalonepercentteller, 2) }} </b></td>
@if($rebetAnnur)
<td><b>{{ number_format($totaldiskaunrebateteller ?? 0, 2) }} </b></td>
@endif
<td><b>{{ number_format($totalupahteller, 2) }} </b></td>
<td><b>{{ number_format($totalbayaranteller, 2) }} </b></td>
<td><b>{{ number_format($totaljumlahteller, 2) }} </b></td>
@@ -402,6 +417,7 @@
$totaljumlahteller = 0;
$totalujrahteller = 0;
$totalonepercentteller = 0;
$totaldiskaunrebateteller = 0;
@endphp
@endif
@else
@@ -412,6 +428,9 @@
<td><b>{{ number_format($totalpinjamanteller, 2) }} </b></td>
<td><b>{{ number_format($totalujrahteller, 2) }} </b></td>
<td><b>{{ number_format($totalonepercentteller, 2) }} </b></td>
@if($rebetAnnur)
<td><b>{{ number_format($totaldiskaunrebateteller ?? 0, 2) }} </b></td>
@endif
<td><b>{{ number_format($totalupahteller, 2) }} </b></td>
<td><b>{{ number_format($totalbayaranteller, 2) }} </b></td>
<td><b>{{ number_format($totaljumlahteller, 2) }} </b></td>
@@ -652,6 +652,13 @@
{{ number_format($penebusan['onepercent'] + $penebusan['ujrah'], 2) }}</strong>
</td>
</tr>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<tr>
<td style="width:10px">(-) Diskaun Promosi</td>
<td style="width:10px">: RM
{{ number_format($gadai['diskaun'] ?? 0, 2) }} </td>
</tr>
@endif
<tr>
<td></td>
</tr>
@@ -885,6 +892,13 @@
{{ number_format($penebusan['onepercent'] + $penebusan['ujrah'], 2) }}</strong>
</td>
</tr>
@if(!empty(($cawangan_info['features'] ?? [])['rebet_annur']))
<tr>
<td style="width:10px">(-) Diskaun Promosi</td>
<td style="width:10px">: RM
{{ number_format($gadai['diskaun'] ?? 0, 2) }} </td>
</tr>
@endif
<tr>
<td></td>
</tr>