106 lines
3.8 KiB
JavaScript
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: function(q){
|
|
$('#butPinjam').click(() => this.tx_pinjam());
|
|
$('#butBayar').click(() => this.tx_bayar());
|
|
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
|
|
},
|
|
|
|
tx_pinjam: function(){
|
|
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: function(){
|
|
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: function(){
|
|
if (FoniaJS.StrToFloat($('#Total_Pinjam').val()) == 0){
|
|
FoniaJS.showError("Silahkan masukkan jumlah pinjaman !");
|
|
return;
|
|
}
|
|
new Request.JSONF({
|
|
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: function(){
|
|
if (FoniaJS.StrToFloat($('#Total_Bayar').val()) == 0){
|
|
FoniaJS.showError("Silahkan masukkan jumlah pembayaran !");
|
|
return;
|
|
}
|
|
new Request.JSONF({
|
|
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: function(acell){
|
|
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[0]+'"</strong> ?', () => {
|
|
new Request.JSONF({
|
|
url: this.PHP + '/table_karya',
|
|
sendParam: ['mode_detail=delete','KaryaID','No_Trans='+acell[0]]
|
|
}).send();
|
|
}, 'danger');
|
|
},
|
|
|
|
data_query: function(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.JSONF({
|
|
url: this.PHP + '/table_karya',
|
|
sendParam: ['KaryaID']
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
ocKarya: function() {
|
|
this.data_query('master');
|
|
}
|
|
|
|
};
|