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.

129 lines
5.5 KiB
JavaScript

import { pos80 } from '{js}module-lap-pos80.js?v={time}';
export const show = function (data, filter) {
let dataBaru = data.cond(filter, 'kode');
if (dataBaru.length > 0) {
return dataBaru[0].data;
}
return '-';
};
export const print = function (a, x) {
let _ld = cssLoader();
let typeData = {
usp: ['reg', 'sm', 'tk', 'swp'],
induk: ['sp', 'sw', 'bw', 'pt', 'usp1', 'usp2', 'usp3']
};
typeData = typeData[x];
let dw = '';
if (x === 'induk') {
dw = `
+ (
SELECT ifnull( (
SELECT sum(tunai) FROM totptg WHERE posting = '${a}'
), 0) total
)
`;
}
AuditDevQuery(`
SELECT
a.kodesp
, b.jurubayar
, ifnull(sum(a.jumlah),0) ${dw} stotal
, (SELECT tgl FROM lap_bb WHERE posting = a.posting LIMIT 1) stgl
, a.username
, a.userlog
, a.posting kodetagihan
, ifnull((
SELECT j.nama FROM msimpan m
LEFT JOIN jpinjam j ON m.kodesp = j.kode
WHERE m.posting = '${a}' LIMIT 1
),'-') jpj
FROM (
SELECT kodesp, jumlah , posting, userlog, username FROM msimpan WHERE posting = '${a}'
UNION ALL
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(fkt,"/",2),"/",-1) kodesp, pokok + bunga jumlah, posting, \`user\` username, userlog FROM mags
WHERE posting = '${a}'
) a
LEFT JOIN (
SELECT * FROM mpenarikan WHERE kodetagihan = '${a}' LIMIT 1
) b ON a.posting = b.kodetagihan WHERE
1=1
[;]
SELECT * FROM profile
`, function (s) {
let [a, profile] = s;
if (a.length > 0) {
let f = a[0];
_ld.remove();
let pb = f.stotal.number(2).pembilang()
pos80().content([
{ type: 'text', css: { paddingBottom: '3px', fontWeight: 'bold', fontSize: '16px', margin: 0, textAlign: 'center' }, text: 'KPRI WARPEKA' }
, { type: 'text', css: { paddingBottom: '3px', fontWeight: 'bold', fontSize: '16px', margin: 0, textAlign: 'center' }, text: 'JL. AR. HAKIM' }
, { type: 'text', css: { paddingBottom: '3px', fontWeight: 'bold', fontSize: '16px', margin: 0, textAlign: 'center' }, text: 'GRESIK' }
, { type: 'text', css: { paddingBottom: '3px', fontWeight: 'bold', fontSize: '16px', margin: 0, textAlign: 'center' }, text: 'KWITANSI PENARIKAN ' + f.jpj.toUpperCase() }
, { type: 'text', css: { paddingBottom: '3px', fontWeight: 'bold', fontSize: '16px', margin: 0, textAlign: 'center' }, text: 'No. ' + f.kodetagihan }
, { type: 'text', css: { borderBottom: '1.5px dashed #333' }, text: '' }
, {
type: 'table', css: { width: '100%' }, data: [
[
{ text: 'Tgl', css: { maxWidth: '95px', width: '95px' } }
, { text: ':', css: { maxWidth: '5px', width: '5px' } }
, { text: tanggal(f.stgl).sekarang }
]
, [
{ text: 'Sudah terima dari', css: { maxWidth: '95px', width: '95px' } }
, { text: ':', css: { maxWidth: '5px', width: '5px' } }
, {
text: 'KPRI Warpeka Gresik' }
]
, [
{ text: 'Jumlah (Rp)', css: { maxWidth: '95px', width: '95px' } }
, { text: ':', css: { maxWidth: '5px', width: '5px' } }
, { text: f.stotal.number(2).currency(0) }
]
, [
{ text: 'Terbilang', css: { maxWidth: '95px', width: '95px' } }
, { text: ':', css: { maxWidth: '5px', width: '5px' } }
, { text: pb + ' Rupiah' }
]
, [
{ text: 'Keterangan.', css: { maxWidth: '95px', width: '95px' } }
, { text: ':', css: { maxWidth: '5px', width: '5px' } }
, { text: 'Penarikan ' + f.jpj + ' juru bayar '+ f.jurubayar +' bulan ' + f.stgl.split('-')[1] + ' ' + f.stgl.split('-')[0] }
]
, [
{ text: 'Piket, ' + tanggal(f.userlog).sekarang, colspan: 3, css: {} }
]
, [
{ text: '', colspan: 3, css: { height: '40px' } }
]
, [
{ text: '(TTD)', colspan: 3, css: {} }
]
, [
{ text: 'Kasir : ' + f.username, colspan: 3, css: {} }
]
, [
{ text: 'Yang Menerima', colspan: 3, css: {} }
]
, [
{ text: '', colspan: 3, css: { height: '40px' } }
]
, [
{ text: '', colspan: 3, css: { borderBottom: '1.5px dashed #333' } }
]
]
}
]).print();
} else {
_ld.remove();
Swal('Info', 'Faktur tidak tersedia', 'info');
}
})
}