fix skit2

This commit is contained in:
hafifierahman
2022-07-17 09:10:26 +08:00
parent ee282b65ea
commit ea8aadb0be
9 changed files with 523 additions and 92 deletions
+16 -2
View File
@@ -9,6 +9,9 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Http;
use Carbon\Carbon;
use PDF;
use Maatwebsite\Excel\Excel;
class WTDController extends Controller
{
// public function __construct()
@@ -34,10 +37,21 @@ class WTDController extends Controller
$current = Carbon::now();
$tarikh_cetak = $current->toDateString();
$api_url = config('api.url');
$mula = $request->mula;
$hingga = $request->hingga;
// $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
// $tarikhcetakan = $myDateTime->format('d-m-Y');
return view('wtd.cetakan', compact('tuntutbaki','cawangan_detail','tarikh_cetak'));
if(isset($request->jenis))
{
if($request->jenis == 'pdf')
{
$pdf = PDF::loadView('wtd.cetakan', compact('tuntutbaki','cawangan_detail','tarikh_cetak','api_url','mula','hingga'))->setPaper('a4', 'potrait');
return $pdf->download('wtd_' . $request->cawangan .'_'. $tarikh_cetak . '.pdf');
}else{
return view('wtd.cetakanexcel', compact('tuntutbaki','cawangan_detail','tarikh_cetak','api_url','mula','hingga'));
}
}
}
}
+3
View File
@@ -39,10 +39,13 @@
"jw-vue-pagination": "^1.0.3",
"laravel-echo": "^1.11.4",
"pusher-js": "^7.0.6",
"table2excel": "^1.0.4",
"vue-apexcharts": "^1.6.2",
"vue-axios": "^3.4.1",
"vue-class-component": "^7.2.6",
"vue-content-placeholders": "^0.2.1",
"vue-excel-xlsx": "^1.2.2",
"vue-flatpickr-component": "^8.1.7",
"vue-moment": "^4.1.0",
"vue-property-decorator": "^9.1.2",
"vue-pusher": "^1.1.0",
+2
View File
File diff suppressed because one or more lines are too long
+83 -58
View File
@@ -613,66 +613,91 @@ export default {
if (response.data === 1) {
if (this.userroles === "operasi") {
this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaoperasi: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else if (this.userroles === 'akaun') {
this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaakaun: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else {
let config = {
header: {
'Content-Type': 'multipart/form-data'
}
}
this.$swal({
title: 'Muat Naik Fail Permohonan',
showCancelButton: true,
confirmButtonText: 'Muat Naik',
input: 'file',
allowOutsideClick: false,
willOpen: () => {
$(".swal2-file").change(function () {
var reader = new FileReader();
reader.readAsDataURL(this.files[0]);
});
}
}).then((file) => {
if (file.value) {
var formData = new FormData();
var file = $('.swal2-file')[0].files[0];
formData.append("mohonid", mohonid);
formData.append("image", file);
formData.append("kelulusan", 'Lulus');
if (this.userroles === "operasi") {
formData.append("namaoperasi", this.username);
this.axios.put(this.$hostname + '/admin/permohonan/updateoperasi', formData, config).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
} else if (this.userroles === 'akaun') {
formData.append("namaakaun", this.username);
this.axios.put(this.$hostname + '/admin/permohonan/updateakaun', {
kelulusan: 'Lulus',
mohonid: mohonid,
namaakaun: this.username
}).then(response => {
if (response.data === 1) {
this.$swal({
icon: 'success',
title: 'Berjaya',
text: 'Berjaya mengemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
} else {
this.$swal({
icon: 'warning',
title: 'Tidak Berjaya',
text: 'tidak berjaya dikemaskini',
allowOutsideClick: false
}).then(function () {
refer.getSenaraiMohon(refer.currentPage);
});
}
});
}
}
});
} else {
this.$swal({
icon: 'warning',
+137 -16
View File
@@ -16,6 +16,20 @@
</div>
</div>
<div class="flex justify-between">
<div class="pr-4">
<button @click.prevent="cetakpdf" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">PDF</button>
<button @click.prevent="cetaksenarai" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">Excel</button>
<!-- <vue-excel-xlsx :disabled="this.selectedNorujukan.length == 0" :data="arraybakilelong" :columns="columns" :file-name="'exceltest'" :file-type="'xlsx'" :sheet-name="'exceltestsheet'" class="border border-yellow-600 text-white bg-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">
Excel
</vue-excel-xlsx> -->
</div>
<div class="p-4">
{{ extensionbulan(this.$props.bulanmula) }} Hingga {{ extensionbulan(this.$props.bulanhingga) }}
</div>
</div>
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 rounded-lg border w-full sm:h-96 p-6 overflow-x-auto overflow-y-scroll scrollbar">
<thead class="text-xs text-gray-700 uppercase bg-yellow-200 dark:bg-gray-700 dark:text-gray-400">
<tr>
@@ -82,10 +96,27 @@ export default {
boolblocksag: false,
cawangan: 'KB2',
batchno: 0,
blockseterusnya:false,
blockseterusnya: false,
columns: [{
label: "Norujukan",
field: "norujukan",
},
{
label: "Tarikh",
field: "t_lelong",
},
{
label: "Pembiayaan",
field: "pinjaman",
},
{
label: "Baki",
field: "baki",
},
],
}
},
props: ['bakilelong'],
props: ['bakilelong', 'bulanmula', 'bulanhingga'],
methods: {
async associate() {
this.arraybakilelong = this.$props.bakilelong;
@@ -176,6 +207,7 @@ export default {
icon: 'info',
title: '<strong>Cetak WTD</strong>',
html: "Sila tekan <b>Cetak</b> untuk mencetak senarai SAG yang ingin dituntut,Sila tekan <b>Ya</b> untuk block SAG!",
// html:"<button onclick='console.log(`haha`);cetaksenarai();' class='px-4 py-2 bg-yellow-500 text-white rounded-xl'>PDF</button><button class='ml-2 px-4 py-2 bg-yellow-500 text-white rounded-xl'>Excel</button>",
showCloseButton: true,
showCancelButton: true,
showDenyButton: true,
@@ -183,28 +215,51 @@ export default {
confirmButtonText: 'Ya',
cancelButtonText: 'Tidak',
denyButtonText: `Cetak`,
confirmButtonColor: '#2ecc71',
confirmButtonColor: '#f39c12',
denyButtonColor: '#f39c12',
cancelButtonColor: '#e74c3c',
cancelButtonColor: '#f39c12',
allowOutsideClick: false,
}).then((result) => {
if (result.isConfirmed) {
this.blockwtd();
} else if (result.isDenied) {
// Swal.fire('Changes are not saved', '', 'info')
this.cetaksenarai();
this.$swal({
icon: 'info',
title: '<strong>Pilihan Cetakan</strong>',
html: "Sila tekan <b>PDF</b> untuk pilihan dalam bentuk PDF,Sila tekan <b>Excel</b> untuk pilihan dalam bentuk Excel!",
showCloseButton: true,
showCancelButton: false,
showDenyButton: true,
confirmButtonText: 'Excel',
denyButtonText: 'PDF',
confirmButtonColor: '#f39c12',
denyButtonColor: '#f39c12',
allowOutsideClick: false,
}).then((result) => {
if (result.isConfirmed) {
this.cetaksenarai();
event.preventDefault();
return false;
} else if (result.isDenied) {
this.cetakpdf();
event.preventDefault();
return false;
}
});
}
})
}else{
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
@@ -227,9 +282,75 @@ export default {
});
},
cetaksenarai: function () {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj, '_blank');
if (this.selectedNorujukan.length > 0) {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj + '&&jenis=excel' + '&&mula=' + this.extensionbulan(this.$props.bulanmula) + '&&hingga=' + this.extensionbulan(this.$props.bulanhingga), '_blank');
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
cetakpdf: function () {
if (this.selectedNorujukan.length > 0) {
let urldirect = window.route('wtd.cetak');
let noruj = JSON.stringify(this.selectedNorujukan);
window.open(urldirect + '?cawangan=' + this.cawangan + '&&norujukan=' + noruj + '&&jenis=pdf' + '&&mula=' + this.extensionbulan(this.$props.bulanmula) + '&&hingga=' + this.extensionbulan(this.$props.bulanhingga), '_blank');
} else {
this.$swal(
'Amaran!',
'Sila pilih norujukan terlebih dahulu!',
'warning'
)
}
},
extensionbulan: function (bulan) {
var stringexplode = bulan.split("-");
switch (stringexplode[0]) {
case '01':
bulan = "Januari";
break;
case '02':
bulan = "Februari";
break;
case '03':
bulan = "Mac";
break;
case '04':
bulan = "April";
break;
case '05':
bulan = "Mei";
break;
case '06':
bulan = "Jun";
break;
case '07':
bulan = "Julai";
break;
case '08':
bulan = "Ogos";
break;
case '09':
bulan = "September";
break;
case '10':
bulan = "Oktober";
break;
case '11':
bulan = "November";
break;
case '12':
bulan = "Disember";
break;
}
return bulan + '-' + stringexplode[1];
}
}
}
+2 -2
View File
@@ -29,7 +29,7 @@
<senarai-baki :bakilelong="bakilelong" ref="senaraibaki" @updateLoad="updateLoad"></senarai-baki>
<senarai-baki :bakilelong="bakilelong" :bulanmula="mula" :bulanhingga="hingga" ref="senaraibaki" @updateLoad="updateLoad"></senarai-baki>
</div>
</template>
@@ -86,7 +86,7 @@ export default {
)
}
});
await this.$refs.senaraibaki.associate();
}
+3
View File
@@ -29,6 +29,8 @@ import VueHtml5Editor from 'vue-html5-editor'
import VueFlatPickr from 'vue-flatpickr-component';
import 'flatpickr/dist/flatpickr.css';
import VueExcelXlsx from "vue-excel-xlsx";
let ops = {
// global component name
name: "vue-html5-editor",
@@ -110,6 +112,7 @@ Vue.use(VueContentPlaceholders)
Vue.use(VueSweetalert2);
Vue.use(VueFriendlyIframe)
Vue.use(VueFlatPickr)
Vue.use(VueExcelXlsx)
Vue.use(require('vue-moment'));
+17 -14
View File
@@ -168,8 +168,8 @@
<table id="scan">
<tr>
<th colspan ="5"><b>Senarai SAG</b></th>
<th> </th>
<th> </th>
<th></th>
<th></th>
<th><b> Tarikh Cetak:</b>
@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
@@ -179,32 +179,35 @@
</th>
<th></th>
</tr>
<tr>
<th colspan ="5"><b>Mula : {{ $mula }} - Hingga : {{ $hingga }}</b></th>
<th></th>
<th></th>
<th></th>
</tr>
</table>
<br>
<table id="details">
<thead>
<th>Bil</th>
<th>Norujukan</th>
<th>Tarikh Lelong</th>
<th>Pembiayaan</th>
<th>Nama</th>
<th>No. IC</th>
<th>Baki</th>
</thead>
<tr></tr>
@php $counter = 1;$totalpinjaman = 0;$totalbaki = 0; @endphp
@foreach($tuntutbaki as $index=>$item)
@php $totalpinjaman += $item['pinjaman'];$totalbaki += $item['baki']; @endphp
@php $totalbaki += $item['baki']; @endphp
<tr>
<td>{{ $counter }}</td>
<td>{{$item['norujukan']}}</td>
<td>@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $item['t_lelong']);
$lelongdate = $myDateTime->format('d-m-Y');
echo($lelongdate);
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/customers/'. $item['nokp'])->json();
echo ($customer_info['nama']);
@endphp</td>
<td>{{ number_format($item['pinjaman'],2) }}</td>
<td>{{ $item['nokp'] }}</td>
<td>{{ number_format($item['baki'],2) }}</td>
</tr>
@php $counter++; @endphp
@@ -212,7 +215,7 @@
<tr>
<th colspan='2'>Jumlah</th>
<th></th>
<th>{{ number_format($totalpinjaman,2) }}</th>
<th></th>
<th>{{ number_format($totalbaki,2) }}</th>
</tr>
</table>
+260
View File
@@ -0,0 +1,260 @@
<script src="{{ asset('js/table2excel.js') }}"></script>
<style>
#header {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#header td, #customers th {
padding:4px;
font-size:10px;
}
#header tr:nth-child(even){background-color: #ffffff;}
#header tr:hover {background-color: #ddd;}
#header th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#scan {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scan td, #scan th {
padding: 8px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
#scan tr:hover {background-color: #ddd;}
#scan th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#scan {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scan td, #scan th {
border-collapse: collapse;
padding: 8px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
#scan tr:hover {background-color: #ddd;}
#scan th {
border-collapse: collapse;
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#details {
font-family: Arial, Helvetica, sans-serif;
/* border-collapse: collapse; */
/* border: 1px solid black; */
width: 100%;
}
#details td, #details th {
padding: 8px;
font-size:11px;
}
#details tr:nth-child(even){background-color: #ffffff;}
#details tr:hover {background-color: #ddd;}
#details th {
padding-top: 12px;
font-style:bold;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#sign {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#sign td, #sign th {
padding: 8px;
font-size:11px;
text-align: center;
}
#sign tr:nth-child(even){background-color: #ffffff;}
#sign tr:hover {background-color: #ddd;}
#sign th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<table id="header">
<tr>
<th rowspan="4" style="width:50px"><br><img src="{{ asset('img/ARRAHN1.png') }}" style="width:70px"></img></th>
<th colspan="1">KOPERASI PERMODALAN KELANTAN BERHAD</th>
</tr>
<tr>
<td>{{ $cawangan_detail['namacaw'] }}</td>
<td></td>
</tr>
<tr>
<td>{{ $cawangan_detail['alamat1'] }}</td>
<td></td>
</tr>
<tr>
<td>{{ $cawangan_detail['alamat2'].' No Tel : '. $cawangan_detail['notel'].' No Faks : '. $cawangan_detail['nofaks'] }}</td>
<td></td>
</tr>
</table>
<br>
<table id="scan">
<tr>
<th colspan ="5"><b>Senarai SAG</b></th>
<th></th>
<th></th>
<th><b> Tarikh Cetak:</b>
@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
$formattedweddingdate = $myDateTime->format('d-m-Y');
echo($formattedweddingdate)
@endphp
</th>
<th></th>
</tr>
<tr>
<th colspan ="5"><b>Mula : {{ $mula }} - Hingga : {{ $hingga }}</b></th>
<th></th>
<th></th>
<th></th>
</tr>
</table>
<br>
<table id="details">
<thead>
<th>Bil</th>
<th>Norujukan</th>
<th>Nama</th>
<th>No. IC</th>
<th>Baki</th>
</thead>
@php $counter = 1;$totalpinjaman = 0;$totalbaki = 0; @endphp
@foreach($tuntutbaki as $index=>$item)
@php $totalbaki += $item['baki']; @endphp
<tr>
<td>{{ $counter }}</td>
<td>{{$item['norujukan']}}</td>
<td>@php
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/customers/'. $item['nokp'])->json();
echo ($customer_info['nama']);
@endphp</td>
<td>{{ $item['nokp'] }}</td>
<td>{{ number_format($item['baki'],2) }}</td>
</tr>
@php $counter++; @endphp
@endforeach
<tr>
<th colspan='2'>Jumlah</th>
<th></th>
<th></th>
<th>{{ number_format($totalbaki,2) }}</th>
</tr>
</table>
<br>
<br>
<table id="sign">
<tr>
<td></td>
<td colspan="2"> .................................................................. </td>
<td> </td>
<td colspan="2">.................................................................. </td>
<td> </td>
</tr>
<tr>
<td></td>
<td colspan="2"><B> DI SEMAK</B> </td>
<td> </td>
<td colspan="2"><B>DI SAHKAN </B></td>
<td> </td>
</tr>
</table>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
// window.print();
// window.onfocus=function(){ window.close();}
let tarikhmula = "{{ $mula }}";
let tarikhhingga = "{{ $hingga }}";
let namacawangan = "{{ $cawangan_detail['namacaw'] }}";
var table2excel = new Table2Excel();
table2excel.export(document.querySelectorAll("#details"),'laporan_wtd_' + tarikhmula + '_' + tarikhhingga + '_' + namacawangan);
setTimeout(function(){ window.close() }, 1000);
});
</script>