You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
418 lines
15 KiB
JavaScript
418 lines
15 KiB
JavaScript
import { _Report } from '{js}lap-page-module.js?v={time}';
|
|
import { pquery } from '{js}lap-page-module-query.js?v={time}';
|
|
import { phead } from '{js}lap-page-module-head.js?v={time}';
|
|
import { pbody } from '{js}lap-page-module-body.js?v={time}';
|
|
import { pfooter } from '{js}lap-page-module-footer.js?v={time}';
|
|
|
|
$(document).ready(function () {
|
|
window.BukuBesar = _Report
|
|
.debug(true)
|
|
.qr(`
|
|
SELECT
|
|
'{year}' year
|
|
, bln.bulan
|
|
, bln.nama
|
|
, sum(if(bb.tr = 'D', bb.total, 0)) debit
|
|
, sum(if(bb.tr = 'K', bb.total, 0)) kredit
|
|
FROM (
|
|
SELECT '00' AS bulan, 'Saldo Awal' AS nama
|
|
UNION
|
|
SELECT '01' AS bulan, 'Januari' AS nama
|
|
UNION
|
|
SELECT '02' AS bulan, 'Februari' AS nama
|
|
UNION
|
|
SELECT '03' AS bulan, 'Maret' AS nama
|
|
UNION
|
|
SELECT '04' AS bulan, 'April' AS nama
|
|
UNION
|
|
SELECT '05' AS bulan, 'Mei' AS nama
|
|
UNION
|
|
SELECT '06' AS bulan, 'Juni' AS nama
|
|
UNION
|
|
SELECT '07' AS bulan, 'Juli' AS nama
|
|
UNION
|
|
SELECT '08' AS bulan, 'Agustus' AS nama
|
|
UNION
|
|
SELECT '09' AS bulan, 'September' AS nama
|
|
UNION
|
|
SELECT '10' AS bulan, 'Oktober' AS nama
|
|
UNION
|
|
SELECT '11' AS bulan, 'November' AS nama
|
|
UNION
|
|
SELECT '12' AS bulan, 'Desember' AS nama
|
|
) bln
|
|
LEFT JOIN (
|
|
SELECT a.tr, a.bulan, sum(total) total FROM (
|
|
{cek}
|
|
SELECT rekdebit rek, 'D' tr, lpad(month(tgl),2,0) bulan, debit total FROM lap_bb
|
|
LEFT JOIN acc ON acc.kode = lap_bb.rekdebit
|
|
WHERE
|
|
main = '{akun}'
|
|
AND debit <> 0
|
|
AND tgl LIKE '{year}%'
|
|
UNION ALL
|
|
SELECT rekkredit rek, 'K' tr, lpad(month(tgl),2,0) bulan, kredit total FROM lap_bb
|
|
LEFT JOIN acc ON acc.kode = lap_bb.rekkredit
|
|
WHERE
|
|
main = '{akun}'
|
|
AND tgl LIKE '{year}%'
|
|
AND kredit <> 0
|
|
) a GROUP BY a.tr, a.bulan
|
|
) bb ON bb.bulan = bln.bulan
|
|
GROUP BY bln.bulan
|
|
`)
|
|
.conf({
|
|
cek: function (obj, e) {
|
|
let [cek] = acc.cond(_val('akun'), 'main');
|
|
console.log(cek.nr)
|
|
if(cek.nr == 'N'){
|
|
return `
|
|
SELECT rek, tr, bulan, total FROM (
|
|
SELECT main rek, dk tr, '00' bulan, sum(total) total FROM bbtahunan WHERE
|
|
tahun = ('{year}'-1) AND main = '{akun}' ORDER BY tahun DESC
|
|
) a
|
|
UNION ALL
|
|
`;
|
|
}
|
|
return ``;
|
|
},
|
|
app: function (obj, e) {
|
|
return e.getVal('app');
|
|
}
|
|
, year: function (obj, e) {
|
|
return e.getVal('year');
|
|
}
|
|
, akun: function (obj, e) {
|
|
return e.getVal('akun');
|
|
}
|
|
})
|
|
.filterConf([
|
|
{
|
|
title: 'Year',
|
|
type: 'text',
|
|
name: 'year',
|
|
nomax: true,
|
|
row: 4,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'APP',
|
|
type: 'select',
|
|
name: 'app',
|
|
row: 4,
|
|
data: AppData2,
|
|
textonly: true,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Akun',
|
|
type: 'select',
|
|
name: 'akun',
|
|
row: 4,
|
|
data: [],
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
])
|
|
.filterOnLoad(function (e, status, obj) {
|
|
/*event action*/
|
|
e.change('app', function () {
|
|
let val = this.value;
|
|
let acc = acc2.sortArrayObjectAsc('id');
|
|
if (val == 'acc' || val == 'usp') {
|
|
acc = acc.like('app', val)
|
|
}
|
|
if (acc.length > 0) {
|
|
e.setOption('akun', acc);
|
|
e.setVal('akun', acc[0].id);
|
|
return false;
|
|
}
|
|
return false;
|
|
});
|
|
if (status != false) {
|
|
e.setVal('year', tanggal().normal.split('-')[0]);
|
|
e.setVal('app', 'usp');
|
|
}
|
|
})
|
|
.head([
|
|
[
|
|
{
|
|
text: function () {
|
|
return `
|
|
<div>
|
|
<img width="75px" src="{{ASSET}}/logo/koperasi.png" />
|
|
</div>
|
|
`;
|
|
},
|
|
rowspan: 4,
|
|
css: {
|
|
width: '95px',
|
|
border: 'none',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'center'
|
|
}
|
|
},
|
|
{
|
|
text: function (obj) {
|
|
return "<div style=\"margin-bottom:5px;font-size:14px;\">KOPERASI PEGAWAI REPUBLIK INDONESIA</div>"
|
|
},
|
|
colspan: 4,
|
|
css: {
|
|
textAlign: 'center',
|
|
border: 'none',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
],
|
|
[
|
|
{
|
|
text: function (obj) {
|
|
return "<div style=\"margin-bottom:5px;font-size:18px;\">KPRI WARPEKA GRESIK</div>"
|
|
},
|
|
colspan: 4,
|
|
css: {
|
|
textAlign: 'center',
|
|
border: 'none',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
],
|
|
[
|
|
{
|
|
text: function (obj) {
|
|
return "<div style=\"margin-bottom:5px;font-size:16px;\">KECAMATAN GRESIK KABUPATEN GRESIK</div>"
|
|
},
|
|
colspan: 4,
|
|
css: {
|
|
textAlign: 'center',
|
|
border: 'none',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
],
|
|
[
|
|
{
|
|
text: function (obj) {
|
|
return "<div style=\"margin-bottom:5px;font-size:14px;\">JL. AR. HAKIM GRESIK</div>"
|
|
},
|
|
colspan: 4,
|
|
css: {
|
|
textAlign: 'center',
|
|
border: 'none',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
],
|
|
[
|
|
{
|
|
text: function (obj) {
|
|
return `
|
|
<table width="100%;">
|
|
<tr style="border:none;text-align:left;">
|
|
<td style="border:none;text-align:left;width:200px; max-width:200px;" width="200px">BUKU BESAR</td>
|
|
<td style="border:none;text-align:left;width:5px; max-width:5px;" width="5px">:</td>
|
|
<td style="border:none;text-align:left;">${(function () {
|
|
let name = acc2.cond(obj.globalEvent.getVal('akun'), 'id');
|
|
if (name.length > 0) {
|
|
return name[0].text;
|
|
}
|
|
return '-'
|
|
})()}</td>
|
|
</tr>
|
|
<tr style="border:none;text-align:left;">
|
|
<td style="border:none;text-align:left;width:200px; max-width:200px;" width="200px">NOMOR KODE REKENING</td>
|
|
<td style="border:none;text-align:left;width:5px; max-width:5px;" width="5px">:</td>
|
|
<td style="border:none;text-align:left;" >${obj.globalEvent.getVal('akun')}</td>
|
|
</tr>
|
|
<tr style="border:none;text-align:left;">
|
|
<td style="border:none;text-align:left;width:200px; max-width:200px;" width="200px">TAHUN BUKU</td>
|
|
<td style="border:none;text-align:left;width:5px; max-width:5px;" width="5px">:</td>
|
|
<td style="border:none;text-align:left;" >${obj.globalEvent.getVal('year')}</td>
|
|
</tr>
|
|
</table>
|
|
`
|
|
},
|
|
colspan: 5,
|
|
css: {
|
|
textAlign: 'center',
|
|
border: 'none',
|
|
borderTop: '4px double #777',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
],
|
|
[
|
|
{
|
|
text: '',
|
|
colspan: 5,
|
|
css: {
|
|
color: '#ffffff',
|
|
height: '10px',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'center'
|
|
}
|
|
}
|
|
],
|
|
[
|
|
, {
|
|
text: 'Tanggal',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'center'
|
|
}
|
|
}
|
|
, {
|
|
text: 'Uraian',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
, {
|
|
text: 'Debit',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
}
|
|
, {
|
|
text: 'Kredit',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
}
|
|
, {
|
|
text: 'Sisa',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
}
|
|
]
|
|
])
|
|
.name([
|
|
{
|
|
name: 'tgl',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
, custome: function (a, b, obj) {
|
|
if (b.bulan == '00') {
|
|
return tanggal(
|
|
tanggal((b.year.number() - 1) + '-12').normal3
|
|
).sekarang;
|
|
}
|
|
return tanggal(
|
|
tanggal(b.year + '-' + b.bulan).normal3
|
|
).sekarang;
|
|
}
|
|
}
|
|
, {
|
|
name: 'nama',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
}
|
|
}
|
|
, {
|
|
name: 'debit',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
, custome: function (a, b, obj) {
|
|
if (obj.dataStore['debit'] == undefined) {
|
|
obj.dataStore['debit'] = [];
|
|
}
|
|
obj.dataStore['debit'].push(a.number(2))
|
|
return 'Rp. ' + a.number(2).currency(0)
|
|
}
|
|
}
|
|
, {
|
|
name: 'kredit',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
, custome: function (a, b, obj) {
|
|
if (obj.dataStore['kredit'] == undefined) {
|
|
obj.dataStore['kredit'] = [];
|
|
}
|
|
obj.dataStore['kredit'].push(a.number(2))
|
|
return 'Rp. ' + a.number(2).currency(0)
|
|
}
|
|
}
|
|
, {
|
|
name: 'saldo',
|
|
css: {
|
|
borderBottom: '1px solid #ddd',
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
, custome: function (a, b, obj) {
|
|
let d = obj.dataStore['debit'].sum();
|
|
let k = obj.dataStore['kredit'].sum();
|
|
let val = (d - k);
|
|
let [data] = acc2.cond(_id('akun').value, 'id');
|
|
if(data.dk == "K"){
|
|
val *= -1;
|
|
}
|
|
return 'Rp. ' + val.currency(0)
|
|
}
|
|
}
|
|
])
|
|
.footer([
|
|
[
|
|
{
|
|
text: 'Jumlah',
|
|
colspan: 2,
|
|
css: {
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'center'
|
|
}
|
|
}
|
|
, {
|
|
css: {
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
, text: function (obj) {
|
|
return 'Rp. ' + obj.dataStore.debit.sum().currency(0)
|
|
}
|
|
}
|
|
, {
|
|
css: {
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'right'
|
|
}
|
|
, text: function (obj) {
|
|
return 'Rp. ' + obj.dataStore.kredit.sum().currency(0)
|
|
}
|
|
}
|
|
, {
|
|
text: '',
|
|
css: {
|
|
whiteSpace: 'nowrap',
|
|
textAlign: 'center'
|
|
}
|
|
}
|
|
]
|
|
])
|
|
.call()
|
|
}) |