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.
200 lines
4.5 KiB
JavaScript
200 lines
4.5 KiB
JavaScript
import { ff, ffSelect, ffNum } from '{js}bb-ff.js?v={time}';
|
|
|
|
export const insertNode = function (a = 'keterangan') {
|
|
var par = globalThis[a].parent.parentNode;
|
|
var t = div()
|
|
.css('border', '1px dotted #aaa')
|
|
.css('padding', '10px');
|
|
par.parentNode.insertBefore(t.get(), par);
|
|
return t;
|
|
};
|
|
|
|
export const counter = {
|
|
val : 1,
|
|
add: function(a){
|
|
if(typeof a === 'number'){
|
|
this.val += a;
|
|
}else{
|
|
this.val += 1;
|
|
}
|
|
return this;
|
|
},
|
|
remove : function(){
|
|
this.val = 1;
|
|
return this;
|
|
}
|
|
};
|
|
|
|
export function addButton(jpk = null) {
|
|
var hd = el(globalThis['headadd'].parent);
|
|
var ct = el(globalThis['contentprop'].parent);
|
|
|
|
hd.css({
|
|
display: 'grid',
|
|
maxHeight: '200px',
|
|
overflow: 'auto',
|
|
borderBottom: '1px solid #ddd',
|
|
gridGap: '4px',
|
|
gridTemplateColumns: '50px auto 150px auto 150px',
|
|
});
|
|
|
|
var hm = ['Urut', 'Rek', 'Debit', 'Rek', 'Kredit'];
|
|
|
|
hd.get().innerHTML = '';
|
|
hm.forEach(function (c) {
|
|
hd.get().appendChild(
|
|
div().css({ padding: '5px' }).text(c).get()
|
|
);
|
|
});
|
|
|
|
ct.css({
|
|
display: 'grid',
|
|
maxHeight: '200px',
|
|
overflow: 'auto',
|
|
gridGap: '4px',
|
|
paddingTop: '8px',
|
|
gridTemplateColumns: '40px auto 150px auto 150px',
|
|
});
|
|
if (jpk != null) {
|
|
ct.get().appendChild(ff({
|
|
title: '',
|
|
type: 'number',
|
|
name: 'tr',
|
|
row: 6,
|
|
readonly: true,
|
|
val: jpk.tr.number(2).currency(),
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
counter.add(jpk.tr.number(2) + 1);
|
|
|
|
ct.get().appendChild(ffSelect({
|
|
title: '',
|
|
type: 'select',
|
|
name: 'rekdebit',
|
|
row: 12,
|
|
readonly: false,
|
|
data: acc,
|
|
val: jpk.rekdebit,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffNum({
|
|
title: '',
|
|
type: 'number',
|
|
name: 'debit',
|
|
row: 6,
|
|
readonly: false,
|
|
val: jpk.debit.number(2),
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffSelect({
|
|
title: '',
|
|
type: 'select',
|
|
name: 'rekkredit',
|
|
row: 12,
|
|
readonly: false,
|
|
val: jpk.rekkredit,
|
|
data: acc,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffNum({
|
|
title: 'Debit',
|
|
type: 'number',
|
|
name: 'kredit',
|
|
row: 6,
|
|
readonly: false,
|
|
val: jpk.kredit.number(2),
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
} else {
|
|
ct.get().appendChild(ff({
|
|
title: '',
|
|
type: 'number',
|
|
name: 'tr',
|
|
row: 6,
|
|
readonly: true,
|
|
val: counter.val,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
counter.add();
|
|
|
|
ct.get().appendChild(ffSelect({
|
|
title: '',
|
|
type: 'select',
|
|
name: 'rekdebit',
|
|
row: 12,
|
|
readonly: false,
|
|
data: acc,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffNum({
|
|
title: '',
|
|
type: 'number',
|
|
name: 'debit',
|
|
row: 6,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffSelect({
|
|
title: '',
|
|
type: 'select',
|
|
name: 'rekkredit',
|
|
row: 12,
|
|
readonly: false,
|
|
data: acc,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
|
|
ct.get().appendChild(ffNum({
|
|
title: 'Debit',
|
|
type: 'number',
|
|
name: 'kredit',
|
|
row: 6,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}));
|
|
};
|
|
|
|
var v = _getval('app');
|
|
var m = _json('acc').map(function(a){
|
|
return {
|
|
id:a.kode,
|
|
text:a.nama,
|
|
app:a.app,
|
|
}
|
|
}).sortArrayObjectAsc('id');
|
|
if (v.indexOf('acc') == -1 || v.indexOf('usp') == -1) {
|
|
m = m.like('app', v);
|
|
}
|
|
if (_id('propertiadd') != undefined) {
|
|
_setoptionmulti('propertiadd', 'rekdebit', m);
|
|
_setoptionmulti('propertiadd', 'rekkredit', m);
|
|
}
|
|
|
|
}; |