diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php
index 423f0b6b..24fc9f7d 100644
--- a/app/Http/Controllers/LelongController.php
+++ b/app/Http/Controllers/LelongController.php
@@ -3979,12 +3979,14 @@ class LelongController extends Controller
$total_nilaimarhun = 0;
$nilai_marhun = 0;
$total_bakiupah = 0;
+ $total_onepercent= 0;
+ $total_ujrah = 0;
foreach($cawanganlel as $cawlel)
{
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
$databid = LelongBid::select('lelongbid.jbg','lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun',
- 'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah')
+ 'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah','lelongbid.onepercent','lelongbid.ujrah')
->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$lelong_id)->get();
// dd($databid->toArray());
@@ -3997,6 +3999,9 @@ class LelongController extends Controller
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
+ $onepercent = 0;
+ $ujrah = 0;
+
foreach($databid as $index1=>$bid)
{
@@ -4007,11 +4012,16 @@ class LelongController extends Controller
$bakiupah = $bakiupah + $bid['bakiupah'];
$hargaasas = $hargaasas + $bid['hargaasas'];
$cajlelong = $cajlelong + $bid['cajlelong'];
+ if($lelong->tagujrah == '1'){
+ $onepercent = $onepercent + $bid['onepercent'];
+ $ujrah = $ujrah + $bid['ujrah'];
+ }
$lelongsim = Lelong::where('id', $lelong_id )->get();
$sumcajlelong = $bid['hargaasas'] * ($lelongsim[0]['cajlelong']/100);
$cajlelong = $cajlelong + bcdiv($sumcajlelong,1,1);
$totalbaki = $bid['hargaasas'] - $bid['pinjaman'] - $bid['bakiupah'] - bcdiv($sumcajlelong,1,1);
+
if($totalbaki > 0)
{
@@ -4081,6 +4091,9 @@ class LelongController extends Controller
'pinjaman'=>$pinjaman,
'upahsimpan'=>$bakiupah,
'bakiupah'=>$bakiupah,
+ 'onepercent'=>$onepercent,
+ 'ujrah'=>$ujrah,
+ 'tagujrah'=>$lelong->tagujrah,
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
@@ -4096,12 +4109,17 @@ class LelongController extends Controller
$total_bakilelong = $total_bakilelong + $bakilelong;
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
$total_bakiupah = $total_bakiupah + $bakiupah;
+ if($lelong->tagujrah == '1'){
+ $total_onepercent = $total_onepercent + $onepercent;
+ $total_ujrah = $total_ujrah + $ujrah;
+ }
$data = Lelong::where('lelong.id','=',$lelong_id)
->first();
}
-
+
+ $tagujrah = $lelong->tagujrah;
$pdf = PDF::loadView('pdf.lelreport',compact('arraycaw',
'total_marhun',
'total_berat',
@@ -4128,7 +4146,10 @@ class LelongController extends Controller
'jeniskarat',
'data',
'total_bakiupah',
- 'total_nilaimarhun'
+ 'total_nilaimarhun',
+ 'total_onepercent',
+ 'total_ujrah',
+ 'tagujrah'
))->setPaper('a4', 'landscape');
return $pdf->download('Lelong Simulasi Keseluruhan.pdf');
diff --git a/app/Http/Controllers/SimulasiUjrahController.php b/app/Http/Controllers/SimulasiUjrahController.php
index 386429ed..f1d03924 100644
--- a/app/Http/Controllers/SimulasiUjrahController.php
+++ b/app/Http/Controllers/SimulasiUjrahController.php
@@ -23,6 +23,7 @@ use App\Models\SimKarat_temp;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
+use PDF;
class SimulasiUjrahController extends Controller
{
@@ -1254,8 +1255,8 @@ class SimulasiUjrahController extends Controller
//kiraan keuntungan ujrah
$jeniskeuntungan = 'onepercent';
- $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$cawanganDetail->caw_code.'/'.$datagadai->norujukan.'/'.$jeniskeuntungan)->json();
- $ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$cawanganDetail->caw_code.'/'.$datagadai->norujukan)->json();
+ $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$details.'/'.$surats['norujukan'].'/'.$jeniskeuntungan)->json();
+ $ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$details.'/'.$surats['norujukan'])->json();
$keuntungan = $keuntungan1['pendapatan'];
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
@@ -1278,10 +1279,236 @@ class SimulasiUjrahController extends Controller
'senarai',
'keuntungan',
't_gadais',
- 'ktlhbyr'
+ 'ktlhbyr','rounded_ujrah','rounded_onepercent'
));
}
+ public function export(Request $request)
+ {
+ $simulasi_id = $request->simulasiid;
+
+ $simulasi = Simulasi::where('id','=',$simulasi_id)->first();
+ $cawangansim = CawanganSimulasi::where('simulasi_id','=',$simulasi_id)->get();
+ $simkarat = SimKarat::where('simulasi_id','=',$simulasi_id)->get();
+ $jeniskarat = JenisKarat::all();
+
+ $arraydata = [];
+ $arraycaw = [];
+ $data = [];
+
+ $total_marhun = 0;
+ $total_berat = 0;
+ $total_nmarhun = 0;
+ $total_pinjaman = 0;
+ $total_upah = 0;
+ $total_hargaasas = 0;
+ $total_cazlelong = 0;
+ $total_rugilelong = 0;
+ $total_bakilelong = 0;
+
+ $total24Kgb = 0;
+ $total24K = 0;
+ $total23k = 0;
+ $total22K = 0;
+ $total21K = 0;
+ $total20K = 0;
+ $total18Kp = 0;
+ $total18K = 0;
+ $total14Kp = 0;
+ $total14K = 0;
+ $total9K = 0;
+ $total_bakiupah = 0;
+ $total_nilaimarhun = 0;
+ $total_onepercent = 0;
+ $total_ujrah = 0;
+
+ foreach($cawangansim as $cawsim)
+ {
+ $cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
+ // $databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
+ // ->select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
+ // 'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12',
+ // 'gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
+ // ->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
+ $databid = SimulasiBid::select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
+ 'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','simulasibid.bakiupah','simulasibid.onepercent','simulasibid.ujrah')
+ ->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
+ // ->toArray();
+
+ $packet = 0;
+ $berat = 0;
+ $nilai_marhun = 0;
+ $pinjaman =0;
+ $bakiupah = 0;
+ $onepercent = 0;
+ $ujrah = 0;
+ $hargaasas = 0;
+ $cajlelong = 0;
+ $rugilelong = 0;
+ $bakilelong = 0;
+
+ // $keuntungan = 0;
+ // $total_upahkeuntungan = 0;
+
+
+ foreach($databid as $index1=>$bid)
+ {
+ $marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])->get();
+ $berat = $berat + $bid['berat'];
+ // $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
+ $nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
+ $pinjaman =$pinjaman + $bid['pinjaman'];
+ $bakiupah = $bakiupah + $bid['bakiupah'];
+ $onepercent = $onepercent + $bid['onepercent'];
+ $ujrah = $ujrah + $bid['ujrah'];
+ $hargaasas = $hargaasas + $bid['hargaasas'];
+ // $cajlelong = $cajlelong + $bid['cajlelong'];
+
+
+ // $keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
+ // $databid[$index1]['keuntungan'] = $keuntungan;
+
+ // // $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
+ // $total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
+
+ $sumcajlelong = $bid['hargaasas'] * ($simulasi['cajlelong']/100);
+ $cajlelongnew = round($sumcajlelong, 1, 1);
+ $cajlelong = $cajlelong + $cajlelongnew;
+ $totalbaki = $bid['hargaasas'] - $bid['pinjaman'] - $bid['bakiupah'] - $cajlelongnew;
+ if(strpos($totalbaki, '-') !== false)
+ {
+ $rugi = -$totalbaki;
+ $rugilelong += $rugi;
+ }
+ else {
+ $baki = $totalbaki;
+ $bakilelong += $baki;
+ }
+
+ $total24Kgb += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','24.0Kgb')
+ ->sum('berat');
+
+ $total24K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','24.0K')
+ ->sum('berat');
+
+ $total23k += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','23.0K')
+ ->sum('berat');
+
+ $total22K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','22.0K')
+ ->sum('berat');
+
+ $total21K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','21.0K')
+ ->sum('berat');
+
+ $total20K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','20.0K')
+ ->sum('berat');
+
+ $total18Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','18.0Kp')
+ ->sum('berat');
+
+ $total18K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','18.0K')
+ ->sum('berat');
+
+ $total14Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','14.0Kp')
+ ->sum('berat');
+
+ $total14K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','14.0K')
+ ->sum('berat');
+
+ $total9K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
+ ->where('karat','=','9.0K')
+ ->sum('berat');
+
+
+
+ }
+
+ array_push($arraycaw,[
+ 'id_cawangan'=> $cawangan['id'],
+ 'cawangan'=>$cawangan['caw_name'],
+ 't_lelong'=>$simulasi['tarikh_lelong'],
+ 'bil_marhun'=>sizeof($databid),
+ 'berat'=>$berat,
+ 'n_marhun'=>$nilai_marhun,
+ 'pinjaman'=>$pinjaman,
+ 'upahsimpan'=>$bakiupah,
+ 'bakiupah'=>$bakiupah,
+ 'onepercent'=>$onepercent,
+ 'ujrah'=>$ujrah,
+ 'hargaasas'=>$hargaasas,
+ 'cajlelong'=>$cajlelong,
+ 'rugilelong'=>$rugilelong,
+ 'bakilelong'=>$bakilelong,
+ ]);
+
+
+ $total_marhun = $total_marhun + sizeof($databid);
+ $total_berat = $total_berat + $berat;
+ $total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
+ $total_pinjaman = $total_pinjaman + $pinjaman;
+ $total_hargaasas = $total_hargaasas + $hargaasas;
+ $total_cazlelong = $total_cazlelong + $cajlelong;
+ $total_rugilelong = $total_rugilelong + $rugilelong;
+ $total_bakilelong = $total_bakilelong + $bakilelong;
+ $total_bakiupah = $total_bakiupah + $bakiupah;
+ $total_onepercent = $total_onepercent + $onepercent;
+ $total_ujrah = $total_ujrah + $ujrah;
+
+
+ $data = Simulasi::where('simulasi.id','=',$simulasi_id)
+ ->first();
+
+
+ }
+
+
+
+
+ $pdf = PDF::loadView('pdf.simrpt2ujrah',compact('arraycaw',
+ 'total_marhun',
+ 'total_berat',
+ 'total_nmarhun',
+ 'total_pinjaman',
+ 'total_upah',
+ 'total_hargaasas',
+ 'total_cazlelong',
+ 'total_rugilelong',
+ 'total_bakilelong',
+ 'total24Kgb',
+ 'total24K',
+ 'total23k',
+ 'total22K',
+ 'total21K',
+ 'total20K',
+ 'total18Kp',
+ 'total18K',
+ 'total14Kp',
+ 'total14K',
+ 'total9K',
+ 'simkarat',
+ 'simulasi_id',
+ 'jeniskarat',
+ 'data',
+ 'total_bakiupah',
+ 'total_onepercent',
+ 'total_ujrah',
+ 'total_nilaimarhun'
+ ))->setPaper('a4', 'landscape');
+ return $pdf->download('Simulasi Keseluruhan.pdf');
+
+
+ }
+
}
diff --git a/database/migrations/2023_12_07_125717_add_onepercent_ujrah_to_lelongbid_table.php b/database/migrations/2023_12_07_125717_add_onepercent_ujrah_to_lelongbid_table.php
index 3ccca800..5d1d396b 100644
--- a/database/migrations/2023_12_07_125717_add_onepercent_ujrah_to_lelongbid_table.php
+++ b/database/migrations/2023_12_07_125717_add_onepercent_ujrah_to_lelongbid_table.php
@@ -14,8 +14,8 @@ class AddOnepercentUjrahToLelongbidTable extends Migration
public function up()
{
Schema::table('lelongbid', function (Blueprint $table) {
- $table->decimal('ujrah', 5, 2);
- $table->decimal('onepercent', 5, 2);
+ $table->decimal('ujrah', 9, 2);
+ $table->decimal('onepercent', 9, 2);
});
}
diff --git a/database/migrations/2023_12_10_094723_add_onepercernt_ujrah_to_simulasibid_table.php b/database/migrations/2023_12_10_094723_add_onepercernt_ujrah_to_simulasibid_table.php
index 917bb4b8..6b32f230 100644
--- a/database/migrations/2023_12_10_094723_add_onepercernt_ujrah_to_simulasibid_table.php
+++ b/database/migrations/2023_12_10_094723_add_onepercernt_ujrah_to_simulasibid_table.php
@@ -14,8 +14,8 @@ class AddOnepercerntUjrahToSimulasibidTable extends Migration
public function up()
{
Schema::table('simulasibid', function (Blueprint $table) {
- $table->decimal('ujrah', 5, 2);
- $table->decimal('onepercent', 5, 2);
+ $table->decimal('ujrah', 9, 2);
+ $table->decimal('onepercent', 9, 2);
});
}
diff --git a/resources/views/pdf/lelreport.blade.php b/resources/views/pdf/lelreport.blade.php
index b0ccd868..ceb28fe9 100644
--- a/resources/views/pdf/lelreport.blade.php
+++ b/resources/views/pdf/lelreport.blade.php
@@ -118,7 +118,6 @@
-
@@ -131,6 +130,11 @@
| Nilai Marhun (RM) |
Pinjaman (RM) |
Keuntungan (RM) |
+ @if($tagujrah == 1)
+ 1% (RM) |
+ Lain-Lain Caj (RM) |
+ @endif
+
Harga Asas (RM) |
Caj Lelong (RM) |
Baki Lelong (RM) |
@@ -148,6 +152,10 @@
{{ number_format($caw['n_marhun'], 2, '.', ',') }} |
{{ number_format($caw['pinjaman'], 2, '.', ',') }} |
{{ number_format($caw['upahsimpan'], 2, '.', ',') }} |
+ @if($tagujrah == 1)
+ {{ number_format($caw['onepercent'], 2, '.', ',') }} |
+ {{ number_format($caw['ujrah'], 2, '.', ',') }} |
+ @endif
{{ number_format($caw['hargaasas'], 2, '.', ',') }} |
{{ number_format($caw['cajlelong'], 2, '.', ',') }} |
{{ number_format($caw['bakilelong'], 2, '.', ',') }} |
@@ -163,6 +171,10 @@
{{ number_format($total_nilaimarhun, 2, '.', ',') }} |
{{ number_format($total_pinjaman, 2, '.', ',') }} |
{{ number_format($total_bakiupah, 2, '.', ',') }} |
+ @if($tagujrah == 1)
+ {{ number_format($total_onepercent, 2, '.', ',') }} |
+ {{ number_format($total_ujrah, 2, '.', ',') }} |
+ @endif
{{ number_format($total_hargaasas, 2, '.', ',') }} |
{{ number_format($total_cazlelong, 2, '.', ',') }} |
{{ number_format($total_bakilelong, 2, '.', ',') }} |
diff --git a/resources/views/pdf/simrpt2ujrah.blade.php b/resources/views/pdf/simrpt2ujrah.blade.php
new file mode 100644
index 00000000..0aaa7ad0
--- /dev/null
+++ b/resources/views/pdf/simrpt2ujrah.blade.php
@@ -0,0 +1,220 @@
+
+
+
+
+
+
+ LAPORAN SIMULASI CAWANGAN
+
+
+
+ {{--
+
+
+ | Bilangan Lelong: {{$total_marhun}} |
+ Nilai Marhun Keseluruhan: RM{{ number_format($total_nilaimarhun, 2, '.', ',') }} |
+ Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} |
+ Keuntungan Keseluruhan:RM{{ number_format($total_bakiupah, 2, '.', ',') }} |
+
+
--}}
+
+
+
+
+ {{-- | Harga Asas Keseluruhan: RM{{ number_format($total_hargaasas, 2, '.', ',') }} |
+ Caj Lelong Keseluruhan: RM{{ number_format($total_cazlelong, 2, '.', ',') }} |
+ Baki Lelong Keseluruhan: RM{{ number_format($total_bakilelong, 2, '.', ',') }} |
+ Rugi Lelong Keseluruhan: RM{{ number_format($total_rugilelong, 2, '.', ',') }} | --}}
+ Batch Lelong : {{$simulasi_id}}
+ Tarikh Lelong :@php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $data['tarikh_lelong'] );
+ $datez = $myDateTime->format('d-m-Y');
+ echo($datez);
+ @endphp
+
+
+ Harga Emas Lelong 916: RM {{ $data['harga_emas_asas']}}
+ Tempoh: {{ $data['jbg']}}
+
+
+
+
+
+
+
+
+
+ | No |
+ Cawangan |
+ Bil SAG |
+ Berat (gm) |
+ Nilai Marhun (RM) |
+ Pinjaman (RM) |
+ Keuntungan (RM) |
+ 1% (RM) |
+ Lain-Lain Caj (RM) |
+ Harga Asas (RM) |
+ Caj Lelong (RM) |
+ Baki Lelong (RM) |
+ Rugi Lelong (RM) |
+
+
+
+
+ @foreach ($arraycaw as $index=>$caw)
+
+ | {{$index+1}} |
+ {{ $caw['cawangan'] }} |
+ {{ $caw['bil_marhun'] }} |
+ {{ number_format($caw['berat'], 2, '.', ',') }} |
+ {{ number_format($caw['n_marhun'], 2, '.', ',') }} |
+ {{ number_format($caw['pinjaman'], 2, '.', ',') }} |
+ {{ number_format($caw['upahsimpan'], 2, '.', ',') }} |
+ {{ number_format($caw['onepercent'], 2, '.', ',') }} |
+ {{ number_format($caw['ujrah'], 2, '.', ',') }} |
+ {{ number_format($caw['hargaasas'], 2, '.', ',') }} |
+ {{ number_format($caw['cajlelong'], 2, '.', ',') }} |
+ {{ number_format($caw['bakilelong'], 2, '.', ',') }} |
+ ({{ number_format($caw['rugilelong'], 2, '.', ',') }}) |
+
+ @endforeach
+
+
+
+ | JUMLAH KESELURUHAN |
+ {{ $total_marhun }} |
+ {{ number_format($total_berat, 2, '.', ',') }} |
+ {{ number_format($total_nilaimarhun, 2, '.', ',') }} |
+ {{ number_format($total_pinjaman, 2, '.', ',') }} |
+ {{ number_format($total_bakiupah, 2, '.', ',') }} |
+ {{ number_format($total_onepercent, 2, '.', ',') }} |
+ {{ number_format($total_ujrah, 2, '.', ',') }} |
+ {{ number_format($total_hargaasas, 2, '.', ',') }} |
+ {{ number_format($total_cazlelong, 2, '.', ',') }} |
+ {{ number_format($total_bakilelong, 2, '.', ',') }} |
+ ({{ number_format($total_rugilelong, 2, '.', ',') }}) |
+
+
+
+
+
+
+
+
+
+
+
+ JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN) |
+
+
+ | MUTU |
+ 24Kgb |
+ 24K |
+ 23K |
+ 22K |
+ 21K |
+ 20K |
+ 18K |
+ 14K |
+ 9K |
+
+
+ | BERAT(gm) |
+ {{$total24Kgb}} |
+ {{$total24K}} |
+ {{$total23k}} |
+ {{$total22K}} |
+ {{$total21K}} |
+ {{$total20K}} |
+ {{$total18Kp}} |
+ {{$total14K}} |
+ {{$total9K}} |
+
+
+
+
+
+
+
+
+
diff --git a/resources/views/simulasiujrah/showsimulasi.blade.php b/resources/views/simulasiujrah/showsimulasi.blade.php
index 462ac36d..84787f6e 100644
--- a/resources/views/simulasiujrah/showsimulasi.blade.php
+++ b/resources/views/simulasiujrah/showsimulasi.blade.php
@@ -33,7 +33,7 @@