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.
974 lines
39 KiB
JavaScript
974 lines
39 KiB
JavaScript
import { _bbData, _perbandingan, _triwulan } from "{{PATH}}/assets-js/module-lap-bb.js?v={time}";
|
|
import { temp } from "{{PATH}}/assets-js/module-lap-filterneraca.js?v={time}";
|
|
import { xlsx } from "{{PATH}}/assets-js/module-export-xlsx.js?v={time}";
|
|
|
|
globalThis.acc = JSON.parse(_id('acc').innerHTML);
|
|
|
|
let d = _id('report').querySelector('tbody');
|
|
let main = [];
|
|
|
|
let hideShowEq = {};
|
|
|
|
_fullScreen();
|
|
|
|
temp();
|
|
|
|
_id('bulan').value = tanggal().normal.split('-')[1];
|
|
|
|
const headerTemp = function () {
|
|
let year = _id('tahun').value.number(2);
|
|
let mnt = ['03', '06', '09', '12'];
|
|
let jn = _id('jenislap').value;
|
|
if (jn == 2) {
|
|
_id('report').querySelector('thead').innerHTML = `
|
|
<tr>
|
|
<th style="font-size:14px;" colspan="8" class="text-center">Neraca</th>
|
|
</tr>
|
|
<tr style="border-bottom: 1px solid #777;">
|
|
<th style="font-size:14px;" colspan="8" class="text-center">Tahun ${year}</th>
|
|
</tr>
|
|
<tr style="border-bottom: 4px double #333;">
|
|
<th style="padding:2px 3px;font-size:14px; min-width:60px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Aktiva</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;max-width:140px;min-width:140px;">${_id('tahun').value.number(2)}</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;max-width:140px;min-width:140px;">${_id('tahun').value.number(2) - 1}</th>
|
|
<th style="border-left: 1px solid #777; padding:2px 3px;font-size:14px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Pasiva</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;max-width:140px;min-width:140px;">${_id('tahun').value.number(2)}</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;max-width:140px;min-width:140px;">${_id('tahun').value.number(2) - 1}</th>
|
|
</tr>
|
|
`
|
|
} else if (jn == 1) {
|
|
_id('report').querySelector('thead').innerHTML = `
|
|
<tr>
|
|
<th style="font-size:14px;" colspan="8" class="text-center">Neraca</th>
|
|
</tr>
|
|
<tr style="border-bottom: 1px solid #777;">
|
|
<th style="font-size:14px;" colspan="8" class="text-center">Tahun ${year}</th>
|
|
</tr>
|
|
<tr style="border-bottom: 4px double #333;">
|
|
<th style="padding:2px 3px;font-size:14px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Aktiva</th>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;">${h + '-' + _id('tahun').value.number(2)}</th>
|
|
`
|
|
}).join('')}
|
|
<th style="border-left: 1px solid #777; padding:2px 3px;font-size:14px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Pasiva</th>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;">${h + '-' + _id('tahun').value.number(2)}</th>
|
|
`
|
|
}).join('')}
|
|
</tr>
|
|
`
|
|
} else {
|
|
_id('report').querySelector('thead').innerHTML = `
|
|
<tr>
|
|
<th style="font-size:14px;" colspan="6" class="text-center">KPRI WARPEKA GRESIK</th>
|
|
</tr>
|
|
<tr>
|
|
<th style="font-size:14px;" colspan="6" class="text-center">Neraca</th>
|
|
</tr>
|
|
<tr style="border-bottom: 1px solid #777;">
|
|
<th style="font-size:14px;" colspan="6" class="text-center">Per <span id="tgl2"></span></th>
|
|
</tr>
|
|
<tr style="border-bottom: 4px double #333;">
|
|
<th style="padding:2px 3px;font-size:14px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Aktiva</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;">Nominal</th>
|
|
<th style="border-left: 1px solid #777; padding:2px 3px;font-size:14px;">Kode</th>
|
|
<th style="padding:2px 3px;font-size:14px;">Pasiva</th>
|
|
<th style="text-align:right;padding:2px 3px;font-size:14px;">Nominal</th>
|
|
</tr>
|
|
`
|
|
}
|
|
}
|
|
|
|
const subTitle = function(s){
|
|
let type = _val('laporantype');
|
|
let [dataR] = main.cond( (type=== 'u'?s.kode: s.main) , 'kode');
|
|
s.mainkel = dataR.mainkel;
|
|
s.subkel = dataR.subkel;
|
|
return `
|
|
<tr>
|
|
<td colspan=3 style="padding:2px 3px;font-size:14px;white-space:nowrap;border-right: 1px solid #777;">${s.mainkel}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" data-name="akun"></td>
|
|
<td class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<tr>
|
|
`;
|
|
}
|
|
|
|
const tempContent = function (s, i, status = 0) {
|
|
let year = _id('tahun').value.number(2);
|
|
let mnt = ['03', '06', '09', '12'];
|
|
let jn = _id('jenislap').value;
|
|
if (status == 0) {
|
|
if (jn == 2) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
<td class="nmap" data-kode="${s.kode}" year="${year}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td class="nmap" data-kode="${s.kode}" year="${year - 1}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
<td posisi="${i}" data-name="nom" year="${year}" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td posisi="${i}" data-name="nom" year="${year - 1}" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
</tr>
|
|
`
|
|
} else if (jn == 1) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<td class="nmap" data-kode="${s.kode}" year="${h}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
`;
|
|
}).join('')}
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<td posisi="${i}" data-name="nom" year="${h}" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
`;
|
|
}).join('')}
|
|
</tr>
|
|
`
|
|
|
|
} else {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
<td class="nmap" data-kode="${s.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
<td posisi="${i}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
</tr>
|
|
`
|
|
}
|
|
} else {
|
|
if (jn == 2) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
<td posisi="${i}" year="${year}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;white-space:nowrap;text-align:right; ">Rp. 0</td>
|
|
<td posisi="${i}" year="${year - 1}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;white-space:nowrap;text-align:right; ">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
<td class="nmap" year="${year}" data-kode="${s.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
<td class="nmap" year="${year - 1}" data-kode="${s.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
</tr>
|
|
`
|
|
} else if (jn == 1) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<td posisi="${i}" year="${h}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;white-space:nowrap;text-align:right; ">Rp. 0</td>
|
|
`;
|
|
}).join('')}
|
|
<td posisi="${i}" year="${year - 1}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;white-space:nowrap;text-align:right; ">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
${mnt.map(function (h) {
|
|
return `
|
|
<td class="nmap" year="${h}" data-kode="${s.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
`;
|
|
}).join('')}
|
|
</tr>
|
|
`
|
|
} else {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="kode"></td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" posisi="${i}" data-name="akun"></td>
|
|
<td posisi="${i}" data-name="nom" class="nmap" data-kode="-" style="padding:2px 3px;font-size:14px;white-space:nowrap;text-align:right; ">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;">${s.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${s.nama}</td>
|
|
<td class="nmap" data-kode="${s.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;">Rp. 0</td>
|
|
</tr>
|
|
`
|
|
}
|
|
}
|
|
}
|
|
|
|
const footerTTD = `
|
|
<tr>
|
|
<td colspan="3" class="dated"></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3">Pengurus :</td>
|
|
</tr>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>${dataProfile ? dataProfile.get('ketua1') :''}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2</td>
|
|
<td>Drs. H. Nadlif, M.Si</td>
|
|
</tr>
|
|
<tr>
|
|
<td>3</td>
|
|
<td>Drs. H. Sami'an, M.Pd</td>
|
|
</tr>
|
|
<tr>
|
|
<td>4</td>
|
|
<td>Drs. Siswandi Wibowo K, M.Si</td>
|
|
</tr>
|
|
<tr>
|
|
<td>5</td>
|
|
<td>${dataProfile ? dataProfile.get('bendahara') : ''}</td>
|
|
</tr>
|
|
`
|
|
|
|
const tempContentFooter = function () {
|
|
let year = _id('tahun').value.number(2);
|
|
let mnt = ['03', '06', '09', '12'];
|
|
let jn = _id('jenislap').value;
|
|
if (jn == 2) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Aktiva</td>
|
|
<td year="${year}" style="width:180px;padding:2px year 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totald">Rp. 0</td>
|
|
<td year="${year - 1}" style="width:180px;padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totald">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Pasiva</td>
|
|
<td year="${year}" style="width:180px; padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totalk">Rp. 0</td>
|
|
<td year="${year - 1}" style="width:180px; padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totalk">Rp. 0</td>
|
|
</tr>
|
|
${footerTTD}
|
|
`
|
|
} else if (jn == 1) {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Aktiva</td>
|
|
${mnt.map(function (s) {
|
|
return `
|
|
<td year="${s}" style="padding:2px year 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totald">Rp. 0</td>
|
|
`;
|
|
}).join("")}
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Pasiva</td>
|
|
${mnt.map(function (s) {
|
|
return `
|
|
<td year="${s}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;" class="totalk">Rp. 0</td>
|
|
`;
|
|
}).join("")}
|
|
</tr>
|
|
${footerTTD}
|
|
`
|
|
} else {
|
|
return `
|
|
<tr style="border-bottom: 1px solid #333;">
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Aktiva</td>
|
|
<td style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;font-weight:bold;" class="totald">Rp. 0</td>
|
|
<td style="border-left: 1px solid #777;padding:2px 3px;font-size:14px;white-space:nowrap;" colspan="2">Grand Total Pasiva</td>
|
|
<td style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;" class="totalk">Rp. 0</td>
|
|
</tr>
|
|
${footerTTD}
|
|
`
|
|
}
|
|
}
|
|
|
|
function spaceString(n){
|
|
let r = '';
|
|
for (let q = 0; q < n; q++) {
|
|
r+= ' '
|
|
}
|
|
return r;
|
|
}
|
|
|
|
let showDataTable = function(x){
|
|
let type = _val('laporantype')
|
|
let app = _val('app');
|
|
let pmain = _json('pmainacc');
|
|
let nr = acc.removeDuplicate(['main', 'nr', 'app']);
|
|
let data = (type == 'u'? main.map(function(p){
|
|
let [n] = nr.cond(p.kode, 'main');
|
|
p.nr = n.nr;
|
|
p.app = n.app;
|
|
return p;
|
|
}): acc.map(function(e){
|
|
let [q] = main.cond(e.main, 'kode');
|
|
e.mainkel = q.mainkel;
|
|
e.subkel = q.subkel;
|
|
return e;
|
|
}));
|
|
data = data.map(function(q){
|
|
let [s] = pmain.cond(q.mainkel, 'main');
|
|
q.posisi = s.posisi;
|
|
return q;
|
|
});
|
|
let allData = data.cond((x == 'D'?1:2),'posisi');
|
|
|
|
let dataCek = (
|
|
app.indexOf(',') != -1? allData
|
|
: data.cond(app, 'app')
|
|
).cond('N','nr');
|
|
|
|
let dataRender = (
|
|
app.indexOf(',') != -1? allData
|
|
: data.cond(app, 'app')
|
|
)
|
|
.cond((x == 'D'?1:2),'posisi').cond('N','nr').map(function(w){
|
|
return type == 'u'? {
|
|
subkel : w.subkel,
|
|
mainkel : w.mainkel,
|
|
kode : w.kode,
|
|
nama : w.nama,
|
|
}:{
|
|
subkel : w.subkel,
|
|
mainkel : w.mainkel,
|
|
kode : w.kode,
|
|
nama : w.nama,
|
|
}
|
|
}).sortArrayObjectAsc('kode');
|
|
|
|
let tree = {}
|
|
|
|
dataRender.removeDuplicate(['mainkel'])
|
|
.forEach(function(o){
|
|
tree[o.mainkel] = {};
|
|
});
|
|
|
|
dataRender.removeDuplicate(['mainkel','subkel'])
|
|
.forEach(function(i){
|
|
if(!tree[i.mainkel][i.subkel]){
|
|
tree[i.mainkel][i.subkel] = [];
|
|
}
|
|
});
|
|
dataRender.removeDuplicate(['mainkel','subkel','kode', 'nama'])
|
|
.forEach(function(i){
|
|
if(tree[i.mainkel][i.subkel]){
|
|
tree[i.mainkel][i.subkel].push(i);
|
|
}
|
|
});
|
|
|
|
let newData = [];
|
|
|
|
function subSum(d){
|
|
let n = 0;
|
|
}
|
|
|
|
let xd = x;
|
|
|
|
|
|
(function gt(tr, n=0){
|
|
if(!Array.isArray(tr)){
|
|
Object.keys(tr).forEach(function(x){
|
|
newData.push({
|
|
urut: n,
|
|
kode: '',
|
|
nama: x,
|
|
});
|
|
gt(tr[x], n+1);
|
|
if(n>0)
|
|
{
|
|
if(x == 'EKUITAS'){
|
|
newData.push({
|
|
urut: n,
|
|
kode: 'SHU',
|
|
name: 'nom',
|
|
nama: app == 'usp' ? 'USP' : app == 'acc' ? 'INDUK':'',
|
|
});
|
|
}
|
|
newData.push({
|
|
urut: n,
|
|
total: 'total',
|
|
kode: x,
|
|
hide: true,
|
|
nama: 'TOTAL '+x,
|
|
});
|
|
}else{
|
|
newData.push({
|
|
urut: n,
|
|
total: 'total',
|
|
kode: x,
|
|
hide: true,
|
|
nama: 'TOTAL '+x,
|
|
});
|
|
}
|
|
});
|
|
}else{
|
|
tr.forEach(function(c, o){
|
|
newData.push({
|
|
urut: n+'-'+o,
|
|
kode: c.kode,
|
|
nama: c.nama,
|
|
})
|
|
});
|
|
}
|
|
})(tree);
|
|
|
|
|
|
|
|
let kiri = dataCek.cond(1,'posisi').length;
|
|
let kanan = dataCek.cond(2,'posisi').length + 1;
|
|
|
|
if(kiri > kanan){
|
|
if(x == 'K'){
|
|
let sisa = kiri - kanan;
|
|
for (let j = 0; j < sisa; j++) {
|
|
newData.push({
|
|
urut: 4,
|
|
kode: '',
|
|
nama: '',
|
|
})
|
|
}
|
|
}
|
|
}else{
|
|
if(x == 'D'){
|
|
let sisa = kanan - kiri;
|
|
for (let j = 0; j < sisa; j++) {
|
|
newData.push({
|
|
urut: 4,
|
|
kode: '',
|
|
nama: '',
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
let toHtml = newData.map(function(x){
|
|
let jlp = _val('jenislap');
|
|
return jlp == 2?
|
|
`
|
|
<tr style="border-bottom: 1px solid #ddd;">
|
|
${
|
|
x.kode == ''?
|
|
`
|
|
<td colspan=2 style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;">${spaceString(x.urut+1)} ${x.nama}</td>
|
|
`
|
|
:
|
|
`
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;text-align:right;">${x.hide?``:x.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${x.urut == 0 && x.total ? ' ' + x.nama : x.nama}</td>
|
|
`
|
|
}
|
|
<td class="nmap ${x.total?`total`:``}" year="${_val('tahun')}" ${x.name?`data-name="${x.name}"`:``} data-kode="${x.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;min-width:140px;"></td>
|
|
<td class="nmap ${x.total?`total`:``}" year="${Number(_val('tahun'))-1}" ${x.name?`data-name="${x.name}"`:``} data-kode="${x.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;min-width:140px;"></td>
|
|
</tr>
|
|
`
|
|
:
|
|
jlp == 1?
|
|
(function(){
|
|
let mnt = ['03', '06', '09', '12'];
|
|
return `
|
|
<tr style="border-bottom: 1px solid #ddd;">
|
|
${
|
|
x.kode == ''?
|
|
`
|
|
<td colspan=2 style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;">${spaceString(x.urut+1)} ${x.nama}</td>
|
|
`
|
|
:
|
|
`
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;text-align:right;">${x.hide?``:x.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${x.urut == 0 && x.total ? ' ' + x.nama : x.nama}</td>
|
|
`
|
|
}
|
|
`+mnt.map(function(q){
|
|
return `
|
|
<td class="nmap ${x.total?`total`:``}" year="${q}" ${x.name?`data-name="${x.name}"`:``} data-kode="${x.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;min-width:140px;"></td>
|
|
`
|
|
}).join('')+
|
|
`
|
|
</tr>
|
|
`
|
|
})()
|
|
:
|
|
`
|
|
<tr style="border-bottom: 1px solid #ddd;">
|
|
${
|
|
x.kode == ''?
|
|
`
|
|
<td colspan=2 style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;">${spaceString(x.urut+1)} ${x.nama}</td>
|
|
`
|
|
:
|
|
`
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;min-width:60px;text-align:right;">${x.hide?``:x.kode}</td>
|
|
<td style="padding:2px 3px;font-size:14px;white-space:nowrap;">${x.urut == 0 && x.total ? ' '+x.nama: x.nama}</td>
|
|
`
|
|
}
|
|
<td class="nmap ${x.total?`total`:``}" ${x.name?`data-name="${x.name}"`:``} data-kode="${x.kode}" style="padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;"></td>
|
|
</tr>
|
|
`
|
|
}).join('');
|
|
return `
|
|
<table style="width:100%;">
|
|
${toHtml}
|
|
</table>
|
|
`;
|
|
}
|
|
|
|
|
|
let bodyContaner = function(){
|
|
let body = _id('report').querySelector('tbody');
|
|
let jlp = _val('jenislap');
|
|
let columsn = jlp == 2? 4 : jlp == 1? 6 : 3;
|
|
body.innerHTML = '';
|
|
body.appendChild(
|
|
el('tr')
|
|
.child(
|
|
el('td')
|
|
.attr('colspan',columsn)
|
|
.html(showDataTable('D'))
|
|
)
|
|
.child(
|
|
el('td')
|
|
.css({
|
|
borderLeft:'1px solid #ddd'
|
|
})
|
|
.html(showDataTable('K'))
|
|
.attr('colspan',columsn)
|
|
)
|
|
.get()
|
|
);
|
|
|
|
let total = el('tr')
|
|
.css('border-top', '1px solid #ddd')
|
|
.css('border-bottom', '1px solid #333')
|
|
total.child(
|
|
el('td')
|
|
.css({
|
|
fontWeight:'bold'
|
|
})
|
|
.attr('colspan','2').html('TOTAL ASET')
|
|
);
|
|
|
|
jlp == 2?
|
|
(function(){
|
|
total.child(
|
|
el('td')
|
|
.attr('year',_val('tahun'))
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totald')
|
|
);
|
|
total.child(
|
|
el('td')
|
|
.attr('year',Number(_val('tahun'))-1)
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totald')
|
|
);
|
|
})()
|
|
:
|
|
jlp == 1?
|
|
(function(){
|
|
let mnt = ['03', '06', '09', '12'];
|
|
mnt.forEach(q => {
|
|
total.child(
|
|
el('td')
|
|
.attr('year',q)
|
|
.css('font-weight', 'bold')
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totald')
|
|
);
|
|
});
|
|
})()
|
|
:
|
|
total.child(
|
|
el('td')
|
|
.css('font-weight', 'bold')
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;`)
|
|
.class('totald')
|
|
);
|
|
;
|
|
|
|
total.child(
|
|
el('td')
|
|
.css({
|
|
borderLeft:'1px solid #ddd'
|
|
,fontWeight:'bold'
|
|
})
|
|
.attr('colspan','2').html('TOTAL KEWAJIBAN DAN EKUITAS')
|
|
);
|
|
jlp == 2?
|
|
(function(){
|
|
total.child(
|
|
el('td')
|
|
.attr('year',_val('tahun'))
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totalk')
|
|
);
|
|
total.child(
|
|
el('td')
|
|
.attr('year',Number(_val('tahun'))-1)
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totalk')
|
|
);
|
|
})()
|
|
:
|
|
jlp == 1?
|
|
(function(){
|
|
let mnt = ['03', '06', '09', '12'];
|
|
mnt.forEach(q => {
|
|
total.child(
|
|
el('td')
|
|
.attr('year',q)
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;width:140px;max-width:140px;min-width:140px;`)
|
|
.class('totalk')
|
|
);
|
|
});
|
|
|
|
})()
|
|
:
|
|
total.child(
|
|
el('td')
|
|
.attr('style', `padding:2px 3px;font-size:14px;text-align:right; white-space:nowrap;`)
|
|
.class('totalk')
|
|
);
|
|
;
|
|
|
|
body.appendChild(
|
|
total.get()
|
|
);
|
|
|
|
body.appendChild(
|
|
el('tr')
|
|
.child(
|
|
el('td')
|
|
.attr('colspan',(columsn*2))
|
|
.html(`
|
|
<table>
|
|
${footerTTD}
|
|
</table>
|
|
`)
|
|
)
|
|
.get()
|
|
);
|
|
|
|
}
|
|
|
|
let loader = function (callback) {
|
|
let year = _id('tahun').value.number(2);
|
|
let mnt = ['03', '06', '09', '12'];
|
|
let jn = _id('jenislap').value;
|
|
headerTemp();
|
|
bodyContaner();
|
|
setTimeout(function () {
|
|
|
|
(function(){
|
|
let getD = Array.from(document.querySelectorAll('tr td'));
|
|
let duplicates = {};
|
|
|
|
for (let it of getD) {
|
|
it.style.height = '23px';
|
|
let text = it.innerText.replace(/\u00A0/g, '').replace(/Rp/g, '').trim();
|
|
if (text) {
|
|
if (!duplicates[text]) {
|
|
duplicates[text] = [];
|
|
}
|
|
duplicates[text].push({
|
|
text: text,
|
|
element: it
|
|
});
|
|
}
|
|
}
|
|
|
|
// Filter only duplicates
|
|
Object.keys(duplicates).forEach(key => {
|
|
if (duplicates[key].length <= 1) {
|
|
delete duplicates[key];
|
|
}
|
|
});
|
|
|
|
if (duplicates['EKUITAS'] || duplicates['TOTAL EKUITAS'] || duplicates['TOTAL ASET']) {
|
|
if (duplicates['TOTAL ASET']){
|
|
let totalAssetTidakLancar = duplicates['TOTAL ASET'].shift()
|
|
totalAssetTidakLancar.element.innerHTML = 'TOTAL ASET TIDAK LANCAR';
|
|
}
|
|
hideShowEq.m = [];
|
|
let eq = duplicates['EKUITAS'];
|
|
let h = eq.shift();
|
|
eq.forEach(item => {
|
|
item.element.style.height = '23px';
|
|
item.element.innerText = ''
|
|
});
|
|
let eqa = duplicates['TOTAL EKUITAS'];
|
|
eqa.shift();
|
|
eqa.forEach(item => {
|
|
let mn = Array.from(item.element.parentNode.querySelectorAll('.total'));
|
|
for(let m of mn){
|
|
m.dataset.kode = '-'
|
|
m.className='map';
|
|
m.innerText = '';
|
|
hideShowEq.m.push(m);
|
|
}
|
|
item.element.style.height = '23px';
|
|
item.element.innerText = ''
|
|
});
|
|
|
|
}
|
|
})();
|
|
|
|
callback();
|
|
})
|
|
|
|
}
|
|
AuditDevQuery(`SELECT * FROM mainacc`, function(a){
|
|
main = a;
|
|
loader(function () {
|
|
setTimeout(function () {
|
|
loadData();
|
|
}, 100)
|
|
})
|
|
});
|
|
|
|
_id('play').addEventListener('click', function () {
|
|
loader(function () {
|
|
setTimeout(function () {
|
|
loadData();
|
|
}, 100)
|
|
})
|
|
});
|
|
|
|
|
|
function LoadDataPartial(d, lb, c = '') {
|
|
d = d.filter(function (c) {
|
|
if (c.main != null) {
|
|
return c;
|
|
}
|
|
});
|
|
let akunP = Array.from(document.querySelectorAll('td[data-kode]' + c))
|
|
let totd = document.querySelector('td.totald' + c)
|
|
let totk = document.querySelector('td.totalk' + c)
|
|
totd.style.fontWeight = 'bold';
|
|
totk.style.fontWeight = 'bold';
|
|
totd.style.fontSize = '14px';
|
|
totk.style.fontSize = '14px';
|
|
let totDeb = 0;
|
|
let totKre = 0;
|
|
let laporantype = _id('laporantype').value;
|
|
let kodeGet = 'rek';
|
|
if (laporantype === 'u') {
|
|
kodeGet = 'main';
|
|
}
|
|
let dataKel = {};
|
|
akunP.forEach(function (k) {
|
|
let g = d.cond(k.dataset.kode, kodeGet);
|
|
if (g.length > 0) {
|
|
let g = d.cond(k.dataset.kode, kodeGet);
|
|
if (g.length > 0) {
|
|
let [read] = g;
|
|
let [kel]=main.cond(read.main,'kode');
|
|
|
|
let total = g.sum('total');
|
|
if (g.singleItem('dk') == 'D') {
|
|
totDeb += total
|
|
} else {
|
|
totKre += total
|
|
}
|
|
k.innerHTML = (Math.round(total) == 0? 0 : total).rp(0);
|
|
kel?(function(kel, total){
|
|
if(!dataKel[kel.subkel]){
|
|
dataKel[kel.subkel] = []
|
|
}
|
|
dataKel[kel.subkel].push(total)
|
|
})(kel, total):null;
|
|
}
|
|
}
|
|
});
|
|
let gt = {}
|
|
mainacc.removeDuplicate(['mainkel', 'subkel']).forEach(function(c){
|
|
if(!gt[c.mainkel]){
|
|
gt[c.mainkel] = [];
|
|
}
|
|
gt[c.mainkel].push(dataKel[c.subkel] ? dataKel[c.subkel].sum() : 0 );
|
|
});
|
|
|
|
Array.from(document.querySelectorAll(`td.total` + c)).forEach((s)=>{
|
|
let kode = s.dataset.kode;
|
|
if(gt[kode]){
|
|
if(kode.indexOf('EKUITAS') != -1){
|
|
s.innerHTML = (gt[kode]).sum().rp(0);
|
|
}else if(kode.indexOf('ASET') != -1){
|
|
let op = gt[kode];
|
|
op.shift()
|
|
s.innerHTML = ((op).sum()).rp(0);
|
|
}else{
|
|
s.innerHTML = (gt[kode]).sum().rp(0);
|
|
}
|
|
}
|
|
})
|
|
|
|
Object.keys(dataKel).forEach(function(s){
|
|
let l = Array.from(document.querySelectorAll(`td.total`+c));
|
|
l.forEach(function(o){
|
|
let kode = o.dataset.kode;
|
|
let numberDatas = dataKel[kode];
|
|
if(kode == 'EKUITAS'){
|
|
numberDatas = [(lb*-1),...dataKel[kode]];
|
|
}
|
|
if(dataKel[kode]){
|
|
o.innerHTML = (numberDatas.sum()).rp(0);
|
|
}
|
|
})
|
|
});
|
|
totd.innerHTML = totDeb.rp(0).replace(/IDR/g, "Rp")
|
|
totk.innerHTML = totKre.rp(0).replace(/IDR/g, "Rp")
|
|
if (lb != undefined) {
|
|
let t = document.querySelector('td[data-kode="SHU"]' + c);
|
|
if (t != undefined) {
|
|
t.innerHTML = (lb * -1).rp().replace(/IDR/g, "Rp");
|
|
totk.innerHTML = (totKre + (lb * -1)).rp(0).replace(/IDR/g, "Rp")
|
|
}
|
|
}
|
|
Array.from(document.querySelectorAll("[data-kode]")).forEach(function(a){
|
|
if(a.dataset.kode != '' && a.innerHTML == ''){
|
|
a.innerHTML = (0).rp(2);
|
|
}
|
|
})
|
|
if(hideShowEq.m){
|
|
hideShowEq.m.forEach(function(z){
|
|
z.innerHTML = '';
|
|
})
|
|
}
|
|
}
|
|
|
|
async function loadData() {
|
|
|
|
let ip = await getIP();
|
|
console.log(ip);
|
|
|
|
let year = _id('tahun').value.number(2);
|
|
let jn = _id('jenislap').value;
|
|
let mnt = ['03', '06', '09', '12'];
|
|
|
|
if (jn == 2) {
|
|
_perbandingan(function (d, lb, dd, lbd) {
|
|
LoadDataPartial(d, lb, `[year="${year}"]`);
|
|
LoadDataPartial(dd, lbd, `[year="${year - 1}"]`);
|
|
}
|
|
, function () {
|
|
(function(){
|
|
let day = tanggal(_val('tahun') + '-' + _val('bulan')).normal3;
|
|
let daySecond = day.split('-');
|
|
Array.from(document.querySelectorAll('.dated'))
|
|
.forEach(function(w){
|
|
w.innerHTML = `Gresik, `+tanggal(tanggal(day).normal3).sekarang2;
|
|
});
|
|
})();
|
|
let day = tanggal(_id('tahun').value + '-12').normal3
|
|
if (_id('app').value == 'usp') {
|
|
return ` WHERE lap_bb.tgl LIKE "${_val('tahun')}%" AND lap_bb.tgl <= "${day}" AND acc.app = 'usp'`;
|
|
} else if (_id('app').value == 'acc') {
|
|
return ` WHERE lap_bb.tgl LIKE "${_val('tahun')}%" AND lap_bb.tgl <= "${day}" AND acc.app = 'acc'`;
|
|
} else {
|
|
return ` WHERE lap_bb.tgl LIKE "${_val('tahun')}%" AND lap_bb.tgl <= "${day}"`;
|
|
}
|
|
}
|
|
, function () {
|
|
let day = tanggal((_id('tahun').value.number(2) - 1) + '-12').normal3
|
|
if (_id('app').value == 'usp') {
|
|
return ` WHERE lap_bb.tgl like '${(_id('tahun').value.number(2) - 1)}%' AND lap_bb.tgl <= "${day}" AND acc.app = 'usp'`;
|
|
} else if (_id('app').value == 'acc') {
|
|
return ` WHERE lap_bb.tgl like '${(_id('tahun').value.number(2) - 1)}%' AND lap_bb.tgl <= "${day}" AND acc.app = 'acc'`;
|
|
} else {
|
|
return ` WHERE lap_bb.tgl like '${(_id('tahun').value.number(2) - 1)}%' AND lap_bb.tgl <= "${day}"`;
|
|
}
|
|
}
|
|
)
|
|
} else if (jn == 1) {
|
|
_triwulan(function (a) {
|
|
let day = tanggal(_val('tahun') + '-' + _val('bulan')).normal3;
|
|
let daySecond = day.split('-');
|
|
Array.from(document.querySelectorAll('.dated'))
|
|
.forEach(function(w){
|
|
w.innerHTML = `Gresik, `+tanggal(tanggal(day).normal3).sekarang2;
|
|
});
|
|
mnt.forEach(function (h, z) {
|
|
let q = (z * 2);
|
|
let w = (z * 2) + 1;0
|
|
LoadDataPartial(a[q], a[w][0].total, `[year="${h}"]`);
|
|
})
|
|
|
|
}, year, function () {
|
|
if (_id('app').value == 'usp') {
|
|
return ` AND acc.app = 'usp'`;
|
|
}
|
|
else if (_id('app').value == 'acc') {
|
|
return ` AND acc.app = 'acc'`;
|
|
}
|
|
else if (_id('app').value == 'acc,usp') {
|
|
return ` AND acc.app = 'acc' OR acc.app = 'usp'`;
|
|
}
|
|
else {
|
|
return ``;
|
|
}
|
|
})
|
|
} else {
|
|
console.log("single")
|
|
_bbData(function (d, lb) {
|
|
LoadDataPartial(d,lb)
|
|
}, function () {
|
|
let day = tanggal(_val('tahun') + '-' + _val('bulan')).normal3;
|
|
let daySecond = day.split('-');
|
|
_id('tgl2').innerHTML = tanggal(tanggal(day).normal3).sekarang2;
|
|
Array.from(document.querySelectorAll('.dated'))
|
|
.forEach(function(w){
|
|
w.innerHTML = `Gresik, `+tanggal(tanggal(day).normal3).sekarang2;
|
|
})
|
|
if (_id('app').value == 'usp') {
|
|
return ` WHERE lap_bb.tgl LIKE "${daySecond[0]}%" AND lap_bb.tgl <= "${day}" AND acc.app = 'usp'`;
|
|
}
|
|
else if (_id('app').value == 'acc') {
|
|
return ` WHERE lap_bb.tgl LIKE "${daySecond[0]}%" AND lap_bb.tgl <= "${day}" AND acc.app = 'acc'`;
|
|
}
|
|
else if (_id('app').value == 'acc,usp') {
|
|
return ` WHERE lap_bb.tgl LIKE "${daySecond[0]}%" AND lap_bb.tgl <= "${day}" AND (acc.app = 'acc' OR acc.app = 'usp')`;
|
|
}
|
|
else {
|
|
return ` WHERE lap_bb.tgl LIKE "${daySecond[0]}%" AND lap_bb.tgl <= "${day}"`;
|
|
}
|
|
}, function(){
|
|
if(Number(_val('tahun')) > thprogram ){
|
|
let cek = _val('app').indexOf(',') != -1?null:_val('app');
|
|
let g = _json('dataprofile').like('kode', 'shubl').map(function(j){
|
|
j.kode = j.kode.indexOf('induk') != -1?'acc':'usp';
|
|
return {
|
|
kode: j.kode,
|
|
rek: j.data
|
|
}
|
|
});
|
|
let cekGol = [(cek?g.cond(cek,'kode'):g).shift()].map(function(w){
|
|
return `
|
|
SELECT main, nama_main, dk, kode rek, nama, total FROM bbtahunan WHERE tahun = '${Number(_val('tahun')) - 1}' ${_val('app') =='acc,usp' ? ``: ` AND app = '${_val('app')}' `} AND nr = 'N'
|
|
`;
|
|
}).join('[;]');
|
|
return ip == '-' ? `${cekGol} [;] SELECT 0 total ` : `
|
|
${cekGol}
|
|
UNION ALL
|
|
`
|
|
}else{
|
|
return ``;
|
|
}
|
|
}, ip == '-' ? 0:1)
|
|
}
|
|
};
|
|
|
|
|
|
_id('print').addEventListener('click', function () {
|
|
let layout = {
|
|
"p": "a4portrait.css",
|
|
"l": "a4landscape.css"
|
|
}
|
|
|
|
$('#report').printThis({
|
|
// base: 'https://jasonday.github.io/printThis',
|
|
header: null, // prefix to html
|
|
footer: null,
|
|
importCSS: true,
|
|
loadCSS: ["{{PATH}}/" + layout['l'], '{{PATH}}/assets/css/bootstrap.min.css'],
|
|
header: false,
|
|
});
|
|
}, false)
|
|
|
|
_id('exportExcel').addEventListener('click', function () {
|
|
xlsx("#report");
|
|
}, false);
|