- Updated Printer and PrinterPos instantiation to use method chaining with addParam instead of add_param. - Refactored print functions in various modules including opname.js, pos.js, tukar.js, ppobtx.js, prabayar.js, and multiple report scripts. - Enhanced code clarity and maintainability by standardizing parameter addition for print jobs.
116 lines
4.0 KiB
JavaScript
116 lines
4.0 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Table/Ppob/ProdukController
|
|
Description : Master Produk PPOB
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : May 19th, 2010.
|
|
Last Modified : September 1st, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var PPOBProdukJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index() {
|
|
this.data_query('tabel-produk');
|
|
$('#butPrint').click(() => this.print_show());
|
|
$('#butUpdate').click(() => this.update_show());
|
|
$('#Cari_Produk').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('tabel-produk');
|
|
});
|
|
$('#butSearch').click((e) => this.data_query('tabel-produk'));
|
|
$('#butAll').click(() => {
|
|
$('#Cari_Produk').val('');
|
|
this.data_query('tabel-produk');
|
|
});
|
|
FoniaJS.setFocus('#Cari_Produk');
|
|
},
|
|
|
|
print_show() {
|
|
new Request({
|
|
url: this.PHP + '/detail_print',
|
|
onSuccess: (ajson) => {
|
|
this.winDPrint = FoniaJS.showWindow('DPrint', 'Cetak Daftar Produk PPOB', ajson.html, 'lg', [{},{"i":"butWCetak","v":"Cetak","c":"info"},{"i":"butWPreview","v":"Pratinjau","c":"secondary"}], () => {
|
|
$('#winDPrint')
|
|
.find('#butWCetak').click(() => this.print_produk(true)).end()
|
|
.find('#butWPreview').click(() => this.print_produk());
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
print_produk(prt) {
|
|
let cetak = new Printer(this.PHP + '/print_produk')
|
|
.addParam("KateID")
|
|
.addParam("OpeID")
|
|
.addParam("Tgl_Cetak");
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
FoniaJS.closeWindow(this.winDPrint);
|
|
},
|
|
|
|
update_show() {
|
|
new Request({
|
|
url: this.PHP + '/detail_update',
|
|
onSuccess: (ajson) => {
|
|
this.winDUpdate = FoniaJS.showWindow('DUpdate', 'Update Produk PPOB', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Proses',c:'success'}], () => {
|
|
$('#winDUpdate').find('#butWSimpan').click(() => this.update_proses());
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
update_proses() {
|
|
new Request_JSF({
|
|
url: this.PHP + '/proses_update',
|
|
sendParam: ['K_Kate','K_Ope'],
|
|
onSuccess: (ajson) => {
|
|
FoniaJS.closeWindow(this.winDUpdate);
|
|
this.data_query('tabel-produk');
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
produk_show(mode, ID) {
|
|
new Request({
|
|
url: this.PHP + '/form_produk',
|
|
sendParam: ['mode_detail='+mode,'ProdukID='+ID],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Produk PPOB', ajson.html, 'xl', [{},{i:'butBatal'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winDetail').find('#butWSimpan').click(() => this.produk_simpan());
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
produk_ubah(acell) {
|
|
this.produk_show('update', acell[0]);
|
|
},
|
|
|
|
produk_simpan() {
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_produk',
|
|
sendParam: ['mode_detail','ProdukID','OpeID','KateID','Nama_Produk='+encodeURIComponent($('#Nama_Produk').val()),'Kode','Harga_Pokok','Harga_Jual','Status','Cari_Produk'],
|
|
onSuccess: (adata) => {
|
|
if (adata.status){
|
|
FoniaJS.showInfo('Proses simpan data sukses!');
|
|
} else FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
data_query(tipe, mode) {
|
|
if (tipe=="tabel-produk"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_produk',
|
|
sendParam: ['Cari_Produk']
|
|
}).send();
|
|
}
|
|
}
|
|
|
|
};
|