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.
194 lines
5.4 KiB
JavaScript
194 lines
5.4 KiB
JavaScript
const getQuery2 = function (qr) {
|
|
return new Promise((resolve, reject) => {
|
|
try {
|
|
AuditDevQuery(qr, function (data) {
|
|
resolve(data)
|
|
})
|
|
} catch (e) {
|
|
reject(e)
|
|
}
|
|
})
|
|
}
|
|
var rekObj = {
|
|
title: function () {
|
|
return 'Rek. COA ';
|
|
},
|
|
table: "acc",
|
|
idform: "containerforms",
|
|
newkode: ``,
|
|
kode: 'kode',
|
|
view: ['main',"app", 'nama_main', 'kode', 'nama', 'dk'],
|
|
columnsExport: [1, 2, 3, 4, 5],
|
|
dataSelect: ["*"],
|
|
queryTemp: "SELECT {select} FROM acc || ORDER BY kode ASC",
|
|
validasiForm: ['kode', 'nama', 'dk', 'nr'],
|
|
custome: {
|
|
app: function(a){
|
|
var y = [{ id: 'acc', text: 'Induk' }, { id: 'usp', text: 'USP' }]
|
|
return a.replace(/\ /g,'').split(',').map(function(x){
|
|
let h = y.cond(x, 'id')[0].text
|
|
return h;
|
|
}).join(',')
|
|
}
|
|
},
|
|
beforeDelete: async function (data) {
|
|
let cek = await getQuery2(`
|
|
SELECT sum(1) total FROM (
|
|
SELECT DISTINCT rekdebit kode FROM lap_bb a
|
|
UNION
|
|
SELECT DISTINCT rekkredit kode FROM lap_bb a
|
|
) a
|
|
LEFT JOIN acc ON a.kode = acc.kode
|
|
WHERE acc.kode = '${data.kode}'
|
|
`);
|
|
if (cek.length > 0) {
|
|
swal('Peringatan', 'Data ini masih digunakan di data lain', 'warning');
|
|
throw 'stop action';
|
|
}
|
|
},
|
|
oncreate: function (a) {
|
|
$("#main").on('change', function () {
|
|
var val = this.value;
|
|
val = globalThis.ObjDataMain.cond(val, 'id');
|
|
if (val.length != 0) {
|
|
val = val[0];
|
|
}
|
|
globalThis['nama_main'].parent.value = val.text;
|
|
$('select#dk').val(val.dk).trigger('change');
|
|
})
|
|
$('select#dk').val('').trigger('change');
|
|
$('select#main').val('').trigger('change');
|
|
globalThis['username'].parent.value = username;
|
|
globalThis['userlog'].parent.value = timestamp();
|
|
},
|
|
onupdate: function (dt) {
|
|
$("#main").on('change', function () {
|
|
var val = this.value;
|
|
val = globalThis.ObjDataMain.cond(val, 'id');
|
|
if (val.length != 0) {
|
|
val = val[0];
|
|
}
|
|
globalThis['nama_main'].parent.value = val.text;
|
|
$('select#dk').val(val.dk).trigger('change');
|
|
})
|
|
globalThis['username'].parent.value = username;
|
|
globalThis['userlog'].parent.value = timestamp();
|
|
(async ()=>{
|
|
let cek = await getQuery2(`
|
|
SELECT sum(1) total FROM (
|
|
SELECT DISTINCT rekdebit kode FROM lap_bb a
|
|
UNION
|
|
SELECT DISTINCT rekkredit kode FROM lap_bb a
|
|
) a
|
|
LEFT JOIN acc ON a.kode = acc.kode
|
|
WHERE acc.kode = '${dt.kode}'
|
|
|
|
`);
|
|
if (cek.length > 0) {
|
|
document.querySelector('button.simpan').style.display = 'none';
|
|
throw 'stop action';
|
|
}
|
|
})();
|
|
},
|
|
data: [
|
|
{
|
|
title: 'Kode',
|
|
type: 'text',
|
|
name: 'kode',
|
|
row: 12,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
},
|
|
{
|
|
title: 'App',
|
|
type: 'select',
|
|
name: 'app',
|
|
row: 12,
|
|
multiple: true,
|
|
textonly: true,
|
|
data: [{ id: 'acc', text: 'Induk' }, { id: 'usp', text: 'USP' }],
|
|
readonly: false,
|
|
info: "Isi *Induk* jika hanya tampil di induk, *usp* jika hanya tampil di usp, *acc,induk* jika keduanya",
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Nama COA',
|
|
type: 'text',
|
|
name: 'nama',
|
|
row: 12,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Kode Main',
|
|
type: 'select',
|
|
name: 'main',
|
|
row: 12,
|
|
readonly: false,
|
|
data: globalThis.ObjDataMain,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Nama Main COA',
|
|
type: 'text',
|
|
name: 'nama_main',
|
|
row: 12,
|
|
readonly: true,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'N[eraca]/L[aba Rugi]',
|
|
type: 'select',
|
|
name: 'nr',
|
|
row: 12,
|
|
readonly: false,
|
|
data: [{ id: 'N', text: 'Neraca' }, { id: 'L', text: 'Laba Rugi' }],
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'D/K',
|
|
type: 'select',
|
|
name: 'dk',
|
|
row: 12,
|
|
readonly: false,
|
|
data: [{ id: 'D', text: 'Debit' }, { id: 'K', text: 'Kredit' }],
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'username',
|
|
type: 'text',
|
|
display: 'none',
|
|
name: 'username',
|
|
row: 12,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'userlog',
|
|
type: 'text',
|
|
display: 'none',
|
|
name: 'userlog',
|
|
row: 12,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
]
|
|
}; |