Merge branch 'faiqahzaman' of https://gitlab.com/azfararsyad/lelong into faiqahzaman

This commit is contained in:
faiqahzaman
2022-02-10 16:55:30 +08:00
11 changed files with 682 additions and 9 deletions
+13
View File
@@ -27,6 +27,7 @@ use App\Models\LelongBidder;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use Carbon\Carbon;
use Carbon\Carbon;
@@ -324,6 +325,18 @@ class LelongController extends Controller
->with('success','Create Lelong Berjaya');
}
public function exportnotis($id)
{
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
$lelong = Lelong::where('id','=',$id)->first();
$lelongbid = LelongBid::where('lelong_id','=',$lelong->id)->get();
// return view('pdf.notislelong',compact('currentdate','lelongbid')); //page for editing
$pdf = PDF::loadView('pdf.notislelong',compact('currentdate','lelongbid'));
return $pdf->download('Notis Lelong.pdf');
}
public function delete($id)
{
+23 -1
View File
@@ -102,7 +102,29 @@ class MarhunController extends Controller
$emasall = JenisEmas::all();
return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall'));
}
}
public function exportmarhundetails(Request $request)
{
$lelongbid = LelongBid::where('id','=',$request->lelongbid)->first();
$marhun = LelongBidMarhun::where('lelongbid_id','=',$request->lelongbid)->get();
$karatall = JenisKarat::all();
$emasall = JenisEmas::all();
$pdf = PDF::loadView('pdf.marhundetails',compact('marhun',
'lelongbid',
'karatall',
'emasall'))->setPaper('a4', 'landscape');
return $pdf->download('Senarai Lelong Details.pdf');
}
}
+181
View File
@@ -27,6 +27,11 @@ use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
class SimulasiController extends Controller
{
/**
@@ -462,6 +467,182 @@ class SimulasiController extends Controller
{
}
// PDF SIMULASI KESELURUHAN SEMUA CAWANGAN
public function export(Request $request)
{
$simulasi_id = $request->simulasiid;
$simulasi = Simulasi::where('id','=',$request->simulasiid)->first();
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$request->simulasiid)->get();
$simkarat = SimKarat::where('simulasi_id','=',$request->simulasiid)->get();
$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;
foreach($cawangansim as $cawsim)
{
$cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
$databid = SimulasiBid::where('simulasi_id','=',$simulasi_id)->get();
$packet = 0;
$berat = 0;
$nilai_marhun = 0;
$pinjaman =0;
$upah = 0;
$hargaasas = 0;
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
foreach($databid as $bid)
{
$marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)->get();
$berat = $berat + $bid->berat;
$nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
$pinjaman =$pinjaman + $bid->pinjaman;
$upah = $upah + $bid->upah;
$hargaasas = $hargaasas + $bid->hargaasas;
$cajlelong = $cajlelong + $bid->cajlelong;
if($bid->baki > 0)
{
$bakilelong = $bakilelong + $bid->baki;
}
else
{
$rugilelong = $rugilelong - $bid->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,[
'cawangan'=>$cawangan->caw_name,
't_lelong'=>$simulasi->tarikh_lelong,
'bil_marhun'=>sizeof($databid),
'berat'=>$berat,
'n_marhun'=>$nilai_marhun,
'pinjaman'=>$pinjaman,
'upah'=>0,
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
'bakilelong'=>$bakilelong,
]);
$total_marhun = $total_marhun + sizeof($databid);
$total_berat = $total_berat + $berat;
$total_nmarhun = $total_nmarhun + $nilai_marhun;
$total_pinjaman = $total_pinjaman + $pinjaman;
$total_upah = $total_upah + 0;
$total_hargaasas = $total_hargaasas + $hargaasas;
$total_cazlelong = $total_cazlelong + $cajlelong;
$total_rugilelong = $total_rugilelong + $rugilelong;
$total_bakilelong = $total_bakilelong + $bakilelong;
}
$pdf = PDF::loadView('pdf.simrpt2',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',
'databid'))->setPaper('a4', 'landscape');
return $pdf->download('Simulasi Keseluruhan.pdf');
}
}
+8 -3
View File
@@ -52,9 +52,14 @@
</li> --}}
@endhasrole
@hasrole('pengurus-cawangan')
{{-- <li class="{{ (request()->is('home')) ? 'active' : '' }}">
<a href="/home">Home</a>
</li> --}}
<li class="{{ (request()->is('')) ? 'active' : '' }}">
<a href="#analisaSubmenu" data-toggle="collapse" aria-expanded="false" style="">Notis Lelong</a>
<ul class="list-unstyled collapse {{ (request()->is('analisa/*')) ? 'show' : '' }}" id="analisaSubmenu" >
<li class="{{ (request()->is('') || request()->is('') ) ? 'active' : '' }}">
<a href="{{url('#')}}">Jana Notis Lelong</a>
</li>
</ul>
</li>
@endhasrole
@hasrole('jurulelong')
<li class="{{ (request()->is('lelong/*')) ? 'active' : '' }}">
@@ -48,7 +48,7 @@
@endif
<a href="{{ route('lelong.show',$lel->id) }}"><i class="far fa-edit"></i></a>
@endhasrole
<a href="{{ route('lelong.exportnotis',$lel->id) }}"><i class="fas fa-download"></i></a>
+4 -2
View File
@@ -10,8 +10,10 @@
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="" method="POST">
<form id="exportform" action="{{route('marhun.exportmarhundetails')}}" method="POST">
@csrf
<input type="hidden" name="type" value="User">
<input type="hidden" name="lelongbid" value="{{ $lelongbid->id }}">
<table class="table table-striped table-xl" id="marhun" style="width:100%">
<thead class="bg-primary text-white">
<tr>
@@ -162,7 +164,7 @@
},
{
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
titleAttr: 'Export to CSV',
titleAttr: 'Export Marhun Details to PDF',
text: '<i class="fas fa-download"></i>',
action: function ( e, dt, node, config ) {
$("#exportform").submit();
+138
View File
@@ -0,0 +1,138 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
#sim {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:10px;
border-collapse: collapse;
width: 100%;
}
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
border: 0px solid;
padding: 1px;
text-align: center;
}
#sim tr:nth-child(even){}
#sim tr:hover {}
#sim th {
text-align: center;
border: 1px solid;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.row {
margin-left:-5px;
margin-right:-5px;
}
.column {
float: left;
width: 100%;
padding: 5px;
}
/* Clearfix (clear floats) */
.row::after {
content: "";
clear: both;
display: table;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 200%;
border: 0px solid #ddd;
}
th, td {
text-align: left;
padding: 16px;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
<body>
<table width="100%" border="0" id="sim">
<tr>
<td width="50%"><h3>PERMODALAN KELANTAN BERHAD</h3></td>
</tr>
<tr>
<td colspan="2"><u><b>SENARAI BARANG LELONG (DETAILS)</b></u></td>
</tr>
</table>
<br>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="1" width="100%" height="80" align="center" id="sim">
<thead>
<tr>
<th width="2%" align="center">No</th>
<th width="9%" align="center">No Rujukan </th>
<th width="6%" align="center">Jenis Marhun</th>
<th width="5%" align="center">Karat</th>
<th width="5%" align="center">Berat(gm)</th>
<th width="9%" align="center">Harga(RM)</th>
<th width="9%" align="center">Nilai Marhun(RM)</th>
<th width="9%" align="center">Harga Asas(RM)</th>
<th width="12%" align="center">Nota</th>
</tr>
</thead>
<tbody>
@foreach ($marhun as $index=>$item)
<tr>
<td>{{$index+1}}</td>
<td>{{ $lelongbid->norujukan }}</td>
<td>{{ $item->marhun }}</td>
<td>{{ $item->karat }}</td>
<td>{{ $item->berat }}</td>
<td>{{ $item->harga }}</td>
<td>{{ $item->n_marhun }}</td>
<td>{{ $item->hargaasas }}</td>
<td>{{ $item->nota }}</td>
</tr>
@endforeach
</tbody>
<@php
@endphp
{{--
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td></td>
<td>{{$total_berat}}</td>
<td>{{$total_harga}}</td>
<td>{{$total_nilaimarhun}}</td>
<td>{{$total_hargaasas}}</td>
<td></td>
</tr> --}}
</table>
</tbody>
+106
View File
@@ -0,0 +1,106 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
.letter{
font-family:'Times New Roman', Times, serif;
}
.row::after {
content: "";
clear: both;
display: table;
}
.first-prgph{
float: left;
width: 10%;
padding: 2px;
}
.first-prgph1{
float: left;
width: 30%;
padding-left: 50px;
}
/* .page-break {
page-break-before: always; */
}
.name{
padding-top: 40px;
}
</style>
<body>
{{-- @foreach($lelongbid as $surat) --}}
<div class = "letter">
<div class="row">
<div class="first-prgph">
<img src="http://lelongrpt.test/img/icon_pkb.png" alt="PKB LOGO" width="100" height="100">
</div>
<div class="first-prgph1">
<p> AR- RAHN (NAMA CAWANGAN) <br>
Lot (alamat caw)<br>
No Tel: xxxx<br>
No Faks: xxx
<p>
</div>
</div>
<p> Tarikh Cetak: {{$currentdate}}<br>
{{-- No Rujukan: {{$surat['norujukan']}}<br> --}}
No Rujukan: <br>
Kepada: <br>
No Telefon: <br>
No K/P:
</p>
<p class="name"> Tuan/Puan, <br>
<b><h3>LELONGAN BARANGAN GADAIAN SECARA TENDER PADA (TARIKH)</h3></b>
<p>Dengan hormatnya kami ingin memaklumkan bahawa barang-barang cagaran tuan/puan yang digadai di cawangan seperti di atas akan dilelong.</p>
<p>Butiran lelongan adalah seperti berikut :-</p>
<p>Tarikh: <br>
Cawangan: <br>
Waktu:
</p>
<p>Tuan/Puan adalah dikehendaki untuk membuat urusan berikut <b>pada atau sebelum (tarikh):-</b></p>
<p>1. Tebus sepenuhnya <br>
2. Tebus gadai semula
<p>Pelanggan hanya perlu menjelaskan upah simpan sehingga sembilan (9) bulan sahaja.<br>
<i>*Permohonan tangguh lelong adalah tidak dibenarkan.</i></p>
<p>Notis:<br>
<i>Sila bawa bersama Surat Akuan Gadai(SAG) untuk sebarang urusan.</i><br>
<i>Sila abaikan notis ini sekiranya penebusan telah dibuat.</i><br></p>
<p>Surat ini adalah cetakan komputer dan tiada tandatangan diperlukan</p>
</div>
{{-- <div class="page-break"></div> --}}
{{-- @endforeach --}}
</body>
+199
View File
@@ -0,0 +1,199 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
#sim {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:10px;
border-collapse: collapse;
width: 100%;
}
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
border: 0px solid;
padding: 1px;
text-align: center;
}
#sim tr:nth-child(even){}
#sim tr:hover {}
#sim th {
text-align: center;
border: 1px solid;
table-layout:auto;
color: black;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.row {
margin-left:-5px;
margin-right:-5px;
}
.column {
float: left;
width: 100%;
padding: 5px;
}
/* Clearfix (clear floats) */
.row::after {
content: "";
clear: both;
display: table;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 200%;
border: 0px solid #ddd;
}
th, td {
text-align: left;
padding: 16px;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
<body>
<table width="100%" border="0" id="sim">
<tr>
<td width="50%"><h3>PERMODALAN KELANTAN BERHAD</h3></td>
</tr>
<tr>
<td colspan="2"><u><b>LAPORAN SIMULASI SEMUA CAWANGAN</b></u></td>
</tr>
</table>
<br><br>
<table cellspacing="" cellpadding="5" text-align="left" border="1" height="25" align="left" id="sim">
<thead>
<br>
<tr>
<td>Bilangan Lelong: {{$total_marhun}}</td>
<td>Nilai Marhun Keseluruhan: RM{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} </td>
<td>Keuntungan Keseluruhan:RM{{ number_format($total_upah, 2, '.', ',') }}</td>
</thead>
</table>
<table cellspacing="" cellpadding="5" text-align="left" border="1" height="25" align="left" id="sim">
<thead>
<tr>
<td>Rugi Lelong Keseluruhan: RM{{ number_format($total_rugilelong, 2, '.', ',') }}</td>
<td>Baki Lelong Keseluruhan: RM{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>Caj Lelong Keseluruhan: RM{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
</tr>
</thead>
</table>
<br>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="1" width="100%" height="80" align="center" id="sim">
<thead>
<tr>
<th width="2%" align="center">No</th>
<th width="9%" align="center">Cawangan</th>
<th width="6%" align="center">Tarikh Lelong</th>
<th width="5%" align="center">Bil Marhun (Paket)</th>
<th width="5%" align="center">Berat(gm)</th>
<th width="9%" align="center">Nilai Marhun(RM)</th>
<th width="9%" align="center">Pembiayaan(RM)</th>
<th width="9%" align="center">Keuntungan(RM)</th>
<th width="9%" align="center">Harga Asas(RM)</th>
<th width="9%" align="center">Caj Lelong(RM)</th>
<th width="9%" align="center">Baki Lelong(RM)</th>
<th width="9%" align="center">Rugi Lelong(RM)</th>
</tr>
</thead>
@foreach ($arraycaw as $index=>$caw)
<tr>
<td>{{$index+1}}</td>
<td>{{ $caw['cawangan'] }}</td>
<td>{{ $caw['t_lelong'] }}</td>
<td>{{ $caw['bil_marhun'] }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['n_marhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upah'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['cajlelong'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['bakilelong'], 2, '.', ',') }}</td>
<td>({{ number_format($caw['rugilelong'], 2, '.', ',') }})</td>
</tr>
@endforeach
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td>{{ $total_marhun }}</td>
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td>
</tr>
</table>
<br><br><br><br><br><br>
<table cellspacing="0" cellpadding="2" style="float:right;" border="1" width="100%" height="80" align="right" id="sim">
<thead>
<tr>
<th style="text-align:center;" colspan="10"><h3><b>JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN)</b></h3></th>
</tr>
</thead>
<tr>
<td colspan="1" align="left"><strong>MUTU &nbsp;</strong></td>
<td colspan="1" align="center">24Kgb &nbsp;</td>
<td colspan="1" align="center">24K&nbsp;</td>
<td colspan="1" align="center">23K&nbsp;</td>
<td colspan="1" align="center">22K&nbsp;</td>
<td colspan="1" align="center">21K&nbsp;</td>
<td colspan="1" align="center">20K&nbsp;</td>
<td colspan="1" align="center">18K&nbsp;</td>
<td colspan="1" align="center">14K&nbsp;</td>
<td colspan="1" align="center">9K&nbsp;</td>
</tr>
<tr>
<td colspan="1" align="left"><strong>BERAT(gm)</strong></td>
<td colspan="1" align="center">{{$total24Kgb}}</td>
<td colspan="1" align="center">{{$total24K}}</td>
<td colspan="1" align="center">{{$total23k}}</td>
<td colspan="1" align="center">{{$total22K}}</td>
<td colspan="1" align="center">{{$total21K}}</td>
<td colspan="1" align="center">{{$total20K}}</td>
<td colspan="1" align="center">{{$total18Kp}}</td>
<td colspan="1" align="center">{{$total14K}}</td>
<td colspan="1" align="center">{{$total9K}}</td>
</tr>
</table>
</tbody>
@@ -13,8 +13,10 @@
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-simulasi" role="tabpanel" aria-labelledby="nav-simulasi-tab">
<br>
<form id="exportform" action="" method="POST">
<form id="exportform" action="{{route('analisa.export')}}" method="POST">
@csrf
<input type="hidden" name="type" value="User">
<input type="hidden" name="simulasiid" value="{{ $simulasi_id }}">
<div class="row">
<div class="col-md-5">
<table class="table table-striped table-xl" id="conclusion" style="width:100%">
@@ -253,7 +255,7 @@
},
{
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
titleAttr: 'Export to CSV',
titleAttr: 'Download to PDF',
text: '<i class="fas fa-download"></i>',
action: function ( e, dt, node, config ) {
$("#exportform").submit();
+5
View File
@@ -60,6 +60,7 @@ Route::group(['middleware' => ['permission:analisa'],'prefix'=>'analisa'], funct
Route::get('/deletesimulasi/{id}',['as'=>'analisa.delete','uses'=>'SimulasiController@delete']);
Route::post('/filter',['as'=>'analisa.filter','uses'=>'SimulasiController@filter']);
Route::post('/export',['as'=>'analisa.export','uses'=>'SimulasiController@export']);
});
Route::group(['middleware' => ['permission:sistem'],'prefix'=>'sistem'], function () {
@@ -78,6 +79,8 @@ Route::group(['prefix'=>'lelong'], function () {
Route::get('/senarailelong',['as'=>'lelong.senarailelong','uses'=>'LelongController@index']);
Route::get('/showlelong/{id}',['as'=>'lelong.show','uses'=>'LelongController@show']);
Route::get('/deletelelong/{id}',['as'=>'lelong.delete','uses'=>'LelongController@delete']);
Route::get('/export/{id}',['as'=>'lelong.exportnotis','uses'=>'LelongController@exportnotis']);
Route::get('/janapemenang', ['as'=>'lelong.janapemenang','uses'=>'LelongController@janapemenang']);
});
@@ -110,6 +113,8 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
Route::post('/kemaskini',['as'=>'marhun.kemaskini','uses'=>'MarhunController@kemaskini']);
Route::get('/semakan',['as'=>'marhun.semakan','uses'=>'MarhunController@semakan']);
Route::post('/exportmarhun',['as'=>'marhun.exportmarhundetails','uses'=>'MarhunController@exportmarhundetails']);
});