update seeder, notis lelong

This commit is contained in:
Amirah22
2022-07-26 10:58:33 +08:00
parent 504ceb7297
commit 4adcac3317
9 changed files with 248 additions and 206 deletions
+74 -35
View File
@@ -63,49 +63,49 @@ class NotisController extends Controller
$user = Auth::user();
$bayaran=0;
$arraydetails = [];
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
->first();
$lelong_id = $lelong_id;
$senarai = LelongBid::where('lelongbid.kodcaw','=',$user->kodcaw)
->where('lelongbid.lelong_id', $lelong_id);
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
->where('lelong_id','=',$lelong_id)
->where('lelongbid.kodcaw','=',$user->kodcaw);
$arraysenarai = $senarai->pluck('norujukan')->toArray();
$datasenarai = $senarai->get();
$gadaicaw = Gadai::on($datasenarai[0]['kodcaw'])->whereIn('norujukan',$arraysenarai)
->get()->toArray();
// $gadaicaw2 = Gadai::on($datasenarai[0]['kodcaw'])->whereIn('norujukan',$arraysenarai)
// ->where('gadai.kodcaw','=',$user->kodcaw);
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
$datalelong = $marhun->get();
$marhuns = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
->select('nokp')
->groupBy('nokp')
->get();
// dd($marhuns);
$arraysag = [];
// $arraycustomer = $gadaicaw2->pluck('nokp')->toArray();
// $datacustomer = $gadaicaw2->get();
// // dd($gadaicaw2);
// $customer = Customer::on($datacustomer[0]['kodcaw'])
// ->whereIn('kpbaru',$arraycustomer)
// ->orWhereIn('kplama',$arraycustomer)
// ->get()->toArray();
foreach($marhuns as $index1=>$cal){
$customer = Customer::where('kpbaru','=',$cal['nokp'])
->orWhere('kplama','=',$cal['nokp'])
->first();
$listsag = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
->where('nokp','=',$cal['nokp'])
->get();
// dd($listgadai);
foreach($listsag as $index=>$listing){
$bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
}
$marhuns[$index1]['nama'] = $customer;
$marhuns[$index1]['listsag'] = $listsag;
// $gadaicaw = Gadai::on($datasenarai[0]['kodcaw'])->whereIn('norujukan',$arraysenarai)
// ->select('nokp')
// ->groupBy('nokp')
// ->get()->toArray();
// dd($gadaicaw);
foreach($gadaicaw as $index1=>$notis)
{
$bayaran = $notis['hargajualan'] - $notis['bakihargajualan'];
}
// $gadaicaw[$index1]['payment'] = $payment;
// $gadaicaw[$index1]['bayaran_keuntungan'] = $bayaran_keuntungan;
return view('jananotis.senarainotis',compact('gadaicaw','lelong_id','bayaran'));
return view('jananotis.senarainotis',compact('marhuns','lelong_id','bayaran','listsag'));
}
@@ -122,12 +122,52 @@ class NotisController extends Controller
$current = new Carbon();
$tarikh_cetak = $current->toDateString();
$payment = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
->join('customer','gadai.nokp','=','customer.kpbaru')
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
->where('lelong_id','=',$lelong_id)
->where('lelongbid.kodcaw','=',$user->kodcaw);
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
$datalelong = $marhun->get();
$marhuns = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
->select('nokp','norujukan')
->get();
// dd($marhuns);
$arraysag = [];
foreach($marhuns as $index1=>$cal){
$customer = Customer::where('kpbaru','=',$cal['nokp'])
->orWhere('kplama','=',$cal['nokp'])
->join('daerah','customer.koddaerah','=','daerah.koddaerah')
->join('negeri','customer.kodnegeri','=','negeri.kodnegeri')
->where('lelongbid.lelong_id', $lelong_id)
->get()->toArray();
->join('poskod','customer.poskod','=','poskod.poskod')
->first();
$listsag = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
->where('nokp','=',$cal['nokp'])
->get();
// dd($listgadai);
foreach($listsag as $index=>$listing){
$bayaran = $listing['hargajualan'] - $listing['bakihargajualan'];
}
$marhuns[$index1]['nama'] = $customer;
$marhuns[$index1]['listsag'] = $listsag;
}
// $arraycustomer = $gadaicaw2->pluck('nokp')->toArray();
// $datacustomer = $gadaicaw2->get();
// $customer = Customer::query()
// ->whereIn('kpbaru',$arraycustomer)
// ->orWhereIn('kplama',$arraycustomer)
// ->join('daerah','customer.koddaerah','=','daerah.koddaerah')
// ->join('negeri','customer.kodnegeri','=','negeri.kodnegeri')
// ->join('poskod','customer.poskod','=','poskod.poskod')
// ->get()->toArray();
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
@@ -136,8 +176,7 @@ class NotisController extends Controller
->get();
$pdf = PDF::loadView('pdf.jananotis',compact('payment','lelong_id','lelongid','caw','tarikh_cetak'))
$pdf = PDF::loadView('pdf.jananotis',compact('marhuns','lelong_id','lelongid','caw','tarikh_cetak','customer','listsag'))
->setPaper('a4', 'potrait');
return $pdf->download('Penjanaan Notis.pdf');
@@ -61,7 +61,7 @@ class CreateSimulasisTable extends Migration
$table->date('t_jual')->nullable();
$table->integer('nopembeli')->nullable();
$table->decimal('jbg', $precision = 7, $scale = 2);
$table->decimal('kadarupah', $precision = 5, $scale = 2);
$table->decimal('kadarupah', $precision = 5, $scale = 2)->nullable();
$table->decimal('upahsimpan', $precision = 11, $scale = 2)->nullable();
$table->decimal('ansuran', $precision = 11, $scale = 2)->nullable();
$table->decimal('nilaimarhun', $precision = 9, $scale = 2);
@@ -68,7 +68,7 @@ class CreateLelongsTable extends Migration
$table->integer('nopembeli')->nullable();
$table->decimal('jbg', $precision = 7, $scale = 2);
$table->decimal('kadarupah', $precision = 5, $scale = 2);
$table->decimal('upahsimpan', $precision = 11, $scale = 2);
$table->decimal('upahsimpan', $precision = 11, $scale = 2)->nullable();
$table->decimal('ansuran', $precision = 11, $scale = 2)->nullable();
$table->decimal('nilaimarhun', $precision = 9, $scale = 2);
$table->decimal('pinjaman', $precision = 9, $scale = 2);
@@ -173,7 +173,7 @@ class CreateLelongsTable extends Migration
$table->string('kali')->nullable();
$table->integer('cajlelong')->nullable();
$table->timestamps();
$table->string('para2')->nullable();
$table->string('para2','9999')->nullable();
// $table->foreign('norujukan')
@@ -14,7 +14,7 @@ class AddPara2ToCawanganTable extends Migration
public function up()
{
Schema::table('cawangan', function (Blueprint $table) {
$table->string('para2')->nullable();
$table->string('para2','9999')->nullable();
});
}
+2
View File
@@ -16,5 +16,7 @@ class DatabaseSeeder extends Seeder
$this->call(RolesSeeder::class);
$this->call(JenisEmasSeeder::class);
$this->call(KaratSeeder::class);
$this->call(TetapanSeeder::class);
}
}
-5
View File
@@ -80,12 +80,7 @@ class KaratSeeder extends Seeder
'dariharga916' => -139.71
]);
Tetapan::create([
'tetap_tarikh_lelong' => '2022-07-31',
'kali' => '1',
'cajlelong' => '3'
]);
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Tetapan;
class TetapanSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Tetapan::create([
'tetap_tarikh_lelong' => '2022-07-26',
'kali' => '1',
'cajlelong' => '3'
]);
}
}
@@ -21,24 +21,26 @@
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>No KP</th>
<th>No Rujukan</th>
<th>Tempoh</th>
<th>No KP</th>
<th>Pembiayaan</th>
<th>Keuntungan 6 Bulan</th>
<th>Bayaran Telah Dibuat</th>
</tr>
</thead>
<tbody>
@foreach($gadaicaw as $index1=> $notis)
@foreach($marhuns as $index1=> $notis)
<tr>
<td>{{ $loop->iteration }} </td>
<td>{{ $notis['norujukan']}}</td>
<td>{{ $notis['tempoh']}}</td>
<td>{{ $notis['nokp']}}</td>
<td>{{ number_format($notis['pinjaman'], 2, '.', ',')}}</td>
<td>{{ number_format($notis['bakiupah'], 2, '.', ',')}}</td>
<td>{{ number_format($bayaran, 2, '.', ',')}}</td>
{{-- <td style='word-wrap'>{{ $notis['nama']['nama']}}</td> --}}
<td>@foreach($notis['listsag'] as $item){{ $item['norujukan']}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ $item['tempoh']}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ number_format($item['pinjaman'], 2, '.', ',')}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ number_format($item['bakiupah'], 2, '.', ',')}}<br>@endforeach</td>
<td>{{ number_format($bayaran, 2, '.', ',')}}<br></td>
@endforeach
</tbody>
+29 -54
View File
@@ -8,7 +8,7 @@
#header td, #customers th {
padding-left:4px;
font-size:13px;
font-size:12px;
}
#header tr:nth-child(even){background-color: #ffffff;}
@@ -37,7 +37,7 @@
#scan td, #scan th {
padding: 8px;
font-size:13px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
@@ -64,7 +64,7 @@
#scan td, #scan th {
border-collapse: collapse;
padding: 8px;
font-size:13px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
@@ -93,7 +93,7 @@
#details td, #details th {
padding: 8px;
font-size:13px;
font-size:11px;
}
#details tr:nth-child(even){background-color: #ffffff;}
@@ -113,7 +113,7 @@
padding: 20px 20px 20px 20px;
}
.tablestyle{
font-size:13px;
font-size:12px;
}
.tablestyle td, .tablestyle th{
/* padding-top: 12px; */
@@ -122,24 +122,26 @@
}
.page-break {
page-break-before: always;
}
}
</style>
@foreach($marhuns as $index1=> $notis)
@foreach ($gadaicaw as $notis)
<div class="container">
<table id="header">
<tr>
{{-- <th rowspan="4"style="width:100px"><br><img src="{{ asset('img/icon_pkb.png') }}" style="width:70px"></img></th> --}}
<th colspan="1">{{$caw['caw_name']}}</th>
<th colspan="1">{{ $caw['caw_name'] }}</th>
</tr>
<tr>
<td style="vertical-align:top;">{{$caw['alamat1']}}</td>
<td style="vertical-align:top;">{{ $caw['alamat1'] }}</td>
<td></td>
</tr>
<tr>
<td style="vertical-align:top;">{{$caw['alamat2']}}</td>
<td style="vertical-align:top;">{{ $caw['alamat2'] }}</td>
<td></td>
</tr>
<tr>
@@ -170,48 +172,27 @@
<tr>
<td>NO RUJUKAN</td>
<td>:</td>
<td>{{ $notis['norujukan'] }}</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>{{ $notis['norujukan']}}</td>
<td></td>
<td width="14%">NO TELEFON</td>
<td width="1%">:</td>
{{-- <td>{{$notis['telefon'] }}</td> --}}
<td>{{ $notis['nama']['telefon'] }}</td>
</tr>
<tr>
<td style="vertical-align:top;">KEPADA</td>
<td style="vertical-align:top;">:</td>
{{-- <td style="vertical-align:top;">{{ $notis['nama'] }}<br> {{ strtoupper($notis['alamat1']) }} {!! ($notis['alamat2'] === null || $notis['alamat2'] === '') ? '' : '<br>' . strtoupper($notis['alamat2']) !!} <br> {{ ' ' . $notis['poskod'] . ' ' . strtoupper($notis['namadaerah']) . ' ' . strtoupper($notis['negeri'])}}</td> --}}
<td style="vertical-align:top;">{{ $notis['nama']['nama']}}
<br> {{ strtoupper($notis['nama']['alamat1']) }}
{!! ($notis['nama']['alamat2'] === null || $notis['nama']['alamat2'] === '') ? '' : '<br>' . strtoupper($notis['nama']['alamat2']) !!} <br>
{{ ' ' . $notis['nama']['poskod'] . ' ' . strtoupper($notis['nama']['namadaerah']) . ' ' . strtoupper($notis['nama']['negeri'])}}</td>
<td></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td style="vertical-align:top;">NO K/P</td>
<td style="vertical-align:top;">:</td>
<td style="vertical-align:top;"> {{ $notis['nokp'] }}</td>
</tr>
</table>
@foreach ($lelongid as $bid)
<p>Tuan/Puan,</p>
@@ -239,12 +220,12 @@
<tr>
<td>Cawangan</td>
<td>:</td>
<td>{{$caw['caw_name']}}</td>
<td>{{ $caw['caw_name'] }}</td>
</tr>
<tr>
<td>Waktu</td>
<td>:</td>
<td>10.00 pagi</td>
<td>{{ date('H:i',strtotime($notis['masa'])). ' pagi' }}</td>
</tr>
</table>
@@ -256,23 +237,17 @@
echo($datez);
@endphp:-</b></p>
@endforeach
@php echo $caw['para2']; @endphp
{{-- syarat2 notis lelong( db cawangan - table para2) --}}
<p>Notis:</p>
<i>Sila bawa bersama Surat Akaun Gadai (SAG) untuk sebarang urusan.</i>
<br>
<i>Sila abaikan notis ini sekiranya penebusan telah dibuat.</i>
<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 class="page-break"></div>
@endforeach
</div>
</body>
</div>
@endforeach
@endforeach