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.

319 lines
8.6 KiB
JavaScript

import { _Report } from '{js}lap-page-module.js?v={time}';
_fullScreen();
let pheader = [
[
{
text: 'Tanggal',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'No Posting',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Faktur',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Juru Bayar',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Kode Anggota',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
width: '60px',
textAlign: 'center',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Nama Anggota',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
width: '60px',
textAlign: 'center',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Pokok',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
,{
text: 'Bunga',
rowspan:1,
css: {
border: '1px solid #ddd',
fontSize: '12px',
padding: '2px 8px',
whiteSpace: 'normal',
textAlign: 'center'
}
}
]
];
window.BukuBesar = _Report
.qr(`
SELECT b.nama, a.* FROM mgagalbayar a
LEFT JOIN anggota b ON a.kode = b.kode
{tgl} ORDER BY a.tgl ASC
`)
.debug(true)
.conf({
tgl: function (obj, e) {
return `WHERE a.tgl BETWEEN '${e.getVal('startdate')}' AND '${e.getVal('enddate')}'`
}
})
.filterConf([
{
title: 'Pilih Range',
type: 'select',
name: 'range',
row: 4,
data: [
{ id: '1', text: 'Harian' }
, { id: '2', text: 'Bulanan' }
, { id: '3', text: 'Custome' }
],
info: "Range tanggal data di load",
readonly: false,
action: function () {
},
},
{
title: 'Tanggal Mulai',
type: 'date',
name: 'startdate',
nomax: true,
row: 4,
readonly: true,
info: "terbuka jika range custome",
action: function () {
},
}
, {
title: 'Tanggal Akhir',
type: 'date',
name: 'enddate',
row: 4,
nomax: true,
info: "terbuka jika range custome",
readonly: true,
action: function () {
},
}
])
.filterOnLoad(function (e, status) {
/*event action*/
e.change('app', function () {
var acc = _master('acc', 'acc').like('text', 'Kas');
let val = this.value;
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;
}
if (acc.length > 0) {
e.setOption('akun', acc);
e.setVal('akun', acc[0].id);
return false;
}
if (acc.length > 0) {
e.setOption('akun', acc);
e.setVal('akun', acc[0].id);
return false;
}
return false;
});
e.change('range', function () {
var val = this.value;
if (val == 1) {
_id('startdate').setAttribute('readonly', 'true');
_id('enddate').setAttribute('readonly', 'true');
e.setVal('startdate', tanggal().normal);
e.setVal('enddate', tanggal().normal);
}
if (val == 2) {
_id('startdate').setAttribute('readonly', 'true');
_id('enddate').setAttribute('readonly', 'true');
e.setVal('startdate', tanggal().normal2);
e.setVal('enddate', tanggal().normal3);
}
if (val == 3) {
_id('startdate').removeAttribute('readonly');
_id('enddate').removeAttribute('readonly');
}
return false;
});
if (status != false) {
e.setVal('range', 1);
e.setVal('app', 'usp');
}
})
.head(pheader)
.name([
{
name: 'tgl',
css: {
border: '1px solid #ddd',
textAlign: 'center',
width: '90px',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'kodetagihan',
css: {
border: '1px solid #ddd',
textWrap: 'nowrap',
width: '130px',
maxWidth: '130px',
minWidth: '130px',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'faktur',
css: {
border: '1px solid #ddd',
textWrap: 'nowrap',
minWidth: '150px',
maxWidth: '150px',
width: '150px',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'golkar',
css: {
border: '1px solid #ddd',
width: '120px',
minWidth: '120px',
maxWidth: '120px',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'kode',
css: {
border: '1px solid #ddd',
width: '60px',
textAlign: 'center',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'nama',
css: {
border: '1px solid #ddd',
width: '160px',
minWidth: '160px',
maxWidth: '160px',
textAlign: 'left',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return a;
}
}
,{
name: 'pokok',
css: {
border: '1px solid #ddd',
width: '120px',
textAlign: 'right',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
let aa = Number(b.pokok);
let bb = Number(b.jumlah);
let xx = 0;
if(aa != 0){
xx = aa;
}else{
xx = bb;
}
return 'Rp. '+Number(xx).currency(0);
}
}
,{
name: 'bunga',
css: {
border: '1px solid #ddd',
width: '120px',
textAlign: 'right',
padding: '2px 5px'
}
, custome: function (a, b, obj) {
return 'Rp. '+Number(a).currency(0);
}
}
])
.call()