Files
cmasa/app/Scripts/gel/karya.js
T
siaupheng aaaf0a9215 Refactor member and product scripts to use concise method definitions
- Updated all function declarations to use ES6 shorthand method syntax in member.js, member_grup.js, point_barang.js, point_skema.js, point_tipe.js, kategori.js, operator.js, produk.js, produk_grup.js, rekpos.js, satuan.js, supplier.js, and varian.js.
2026-11-01 14:57:54 +07:00

106 lines
3.8 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Gel/KaryaController
Description : Transaksi Pinjaman Karyawan
Created By : Siau Pheng ([email protected]).
Created Date : September 9th, 2014.
Last Modified : September 14th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var GELKaryaJS = {
PHP: '',
KODE: '',
index(q) {
$('#butPinjam').click(() => this.tx_pinjam());
$('#butBayar').click(() => this.tx_bayar());
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
},
tx_pinjam() {
new Request({
url: this.PHP + '/form_pinjam',
sendParam: ['KaryaID'],
onSuccess: (ajson) => {
this.winPinjam = FoniaJS.showWindow('Pinjam', 'Detail Peminjaman', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winPinjam').find('#butWSimpan').click(() => this.pinjam_simpan());
FoniaJS.setFocus('#Total_Pinjam');
}, false);
}
}).send();
},
tx_bayar() {
new Request({
url: this.PHP + '/form_bayar',
sendParam: ['KaryaID'],
onSuccess: (ajson) => {
this.winBayar = FoniaJS.showWindow('Bayar', 'Detail Pembayaran', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winBayar').find('#butWSimpan').click(() => this.bayar_simpan());
FoniaJS.setFocus('#Total_Bayar');
}, false);
}
}).send();
},
pinjam_simpan() {
if (FoniaJS.StrToFloat($('#Total_Pinjam').val()) == 0){
FoniaJS.showError("Silahkan masukkan jumlah pinjaman !");
return;
}
new Request_JSF({
url: this.PHP + '/table_karya',
sendParam: ['mode_detail=insert','Tgl_Trans','Kode_Rek','Total_Pinjam','KaryaID','Nama_Karya='+$('#KaryaID').find(':selected').text(),'Catatan','is_pinjam=1'],
onSuccess: () => FoniaJS.closeWindow(this.winPinjam)
}).send();
},
bayar_simpan() {
if (FoniaJS.StrToFloat($('#Total_Bayar').val()) == 0){
FoniaJS.showError("Silahkan masukkan jumlah pembayaran !");
return;
}
new Request_JSF({
url: this.PHP + '/table_karya',
sendParam: ['mode_detail=insert','Tgl_Trans','Kode_Rek','Total_Bayar','KaryaID','Nama_Karya='+$('#KaryaID').find(':selected').text(),'Catatan','is_pinjam=0'],
onSuccess: () => FoniaJS.closeWindow(this.winBayar)
}).send();
},
karya_hapus(acell) {
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[0]+'"</strong> ?', () => {
new Request_JSF({
url: this.PHP + '/table_karya',
sendParam: ['mode_detail=delete','KaryaID','No_Trans='+acell[0]]
}).send();
}, 'danger');
},
data_query(tipe, mode, kd_tx) {
if (tipe=="master"){
new Request({
url: this.PHP + '/form_master',
sendParam: ['KaryaID'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')],
onSuccess: (ajson) => {
$('#divTXMaster').html(ajson.html);
$('#KaryaID').focus();
this.data_query('tabel-karya');
}
}).send();
} else if (tipe=="tabel-karya"){
new Request_JSF({
url: this.PHP + '/table_karya',
sendParam: ['KaryaID']
}).send();
}
},
ocKarya() {
this.data_query('master');
}
};