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.
130 lines
4.0 KiB
JavaScript
130 lines
4.0 KiB
JavaScript
import { action } from "{js}ts-tagihan-action.js?v={time}";
|
|
import { idGenerator } from "{js}module-idgenerator.js?v={time}";
|
|
|
|
String.prototype.extractText = function () {
|
|
let text = this.match(/[a-zA-Z]+/g); // Menggunakan regular expression untuk mencocokkan teks
|
|
return text ? text.join(' ') : ''; // Menggabungkan teks yang cocok menjadi satu string
|
|
};
|
|
|
|
const idTagihan = function (nama = "nama") {
|
|
const date = new Date();
|
|
const year = date.getFullYear().toString().substr(-2);
|
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
const day = String(date.getDate()).padStart(2, '0');
|
|
const hours = String(date.getHours()).padStart(2, '0');
|
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
|
const formattedId = `${nama}-${year}${month}${day}${hours}${minutes}${seconds}`;
|
|
return formattedId;
|
|
};
|
|
|
|
|
|
var objectForm = {
|
|
debug:false,
|
|
title: function () {
|
|
return 'Tagihan'
|
|
},
|
|
table: "mtagihan",
|
|
idform: "containerforms",
|
|
newkode: ``,
|
|
kode: 'kodetagihan',
|
|
view: ['kodetagihan','jurubayar','kodesp', 'tgl', 'statusposting'],
|
|
dataSelect: ["*"],
|
|
queryTemp: "SELECT {select} FROM (SELECT {select} FROM mtagihan GROUP BY kodetagihan) a || ORDER BY kodetagihan DESC",
|
|
validasiForm: ['jurubayar'],
|
|
oncreate: function () {
|
|
_setval('tgl', tanggal().normal);
|
|
$('#jurubayar').val('').trigger('change');
|
|
},
|
|
disableEditor: function(a,b,c){
|
|
return _trashTable(a,b,c)+`
|
|
<button class="btn btn-clear btn-sm" onclick="location.href = '{{PATH}}/admin/api/export/excel/tagihan/${b.kodetagihan}';">cetak tagihan</button>
|
|
`;
|
|
},
|
|
onupdate: function (dt) {
|
|
globalThis['kode'].parent.setAttribute('readonly', true);
|
|
},
|
|
custcondition: function (a) {
|
|
return a+'';
|
|
}
|
|
, onviewonly: action,
|
|
custome: {
|
|
statusposting: function(a){
|
|
return replaceFromMaster(statusTagihan, 'id', a, 'text');
|
|
}
|
|
},
|
|
custOrder: ['kodetagihan'],
|
|
_condDeleteStop: [
|
|
{id:'statusposting', val:'1'}
|
|
]
|
|
,data: [
|
|
{
|
|
title: 'Kode Tagihan',
|
|
type: 'text',
|
|
name: 'kodetagihan',
|
|
row: 12,
|
|
info: 'kode akan di generate otomatis setelah juru bayar diisi',
|
|
readonly: true,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Tgl. Transaksi',
|
|
type: 'date',
|
|
name: 'tgl',
|
|
row: 12,
|
|
line: 120,
|
|
readonly: false,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Juru Bayar',
|
|
type: 'select',
|
|
name: 'jurubayar',
|
|
row: 12,
|
|
line: 120,
|
|
readonly: false,
|
|
data: JSON.parse(_id('munit').innerHTML),
|
|
action: function (a) {
|
|
if(typeof _Evchange != 'undefined'){
|
|
_Evchange(a ,function (){
|
|
let val = this.value
|
|
.toUpperCase()
|
|
.extractText()
|
|
.replace(/\ /g, '')
|
|
.substring(0,3);
|
|
if(val != ''){
|
|
_setVal('kodetagihan', idTagihan(val));
|
|
}
|
|
});
|
|
}else{
|
|
Swal('Info', '_Evchange tidak di load dengan benar', 'warning');
|
|
}
|
|
},
|
|
}
|
|
, {
|
|
title: 'Kasir',
|
|
type: 'text',
|
|
name: 'kasir',
|
|
row: 6,
|
|
readonly: true,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
, {
|
|
title: 'Jam',
|
|
type: 'text',
|
|
name: 'jam',
|
|
row: 6,
|
|
readonly: true,
|
|
action: function () {
|
|
|
|
},
|
|
}
|
|
]
|
|
}; |