Files
siaupheng dcd13bb9df Refactor printing logic across multiple scripts to use method chaining for improved readability and consistency
- 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.
2026-11-02 14:03:32 +07:00

92 lines
3.3 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Report/Gel/HarianbesarController
Description : Laporan Buku Besar Harian
Created By : Siau Pheng ([email protected]).
Created Date : May 1st, 2009.
Last Modified : October 22nd, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var RepoGelHBesarJS = {
PHP: '',
KODE: '',
index() {
$('#butCetak').click(() => this.proses_print(true));
$('#butPreview').click(() => this.proses_print());
$('#butExcel').click(() => this.proses_dload());
$('#butBrowRek').click(() => this.rek_brow());
FoniaJS.AutoComplete('#Nama_Rek', this.PHP + '/auto_rek', [], {'selectFunc':this.Rek_Comp});
FoniaJS.setFocus('#Nama_Rek');
},
proses_print(prt) {
if (parseInt($('#Kode_Rek').val())==0) {
FoniaJS.showError('Silakan masukkan Nama Rekening !');
return;
}
let cetak = new Printer(this.PHP + '/print')
.addParam("Kode_Rek")
.addParam("Jenis")
.addParam("Tgl_From")
.addParam("Tgl_To");
if (prt) cetak.doPrint(); else cetak.doPreview();
},
proses_dload() {
if (parseInt($('#Kode_Rek').val())==0) {
FoniaJS.showError('Silakan masukkan Nama Rekening !');
return;
}
var dload = new Download(this.PHP + '/excel');
dload.addParam("Kode_Rek");
dload.addParam("Jenis");
dload.addParam("Tgl_From");
dload.addParam("Tgl_To");
dload.download();
},
rek_brow() {
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Rek" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divBrowRek">&nbsp;</div>');
this.winBRek = FoniaJS.showWindow('BRek', 'Daftar Rekening', _isi, 'lg', '', () => {
$('#winBRek')
.find('#Cari_Rek').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('brow-rek');
}).end()
.find('#butSearch').click(() => this.data_query('brow-rek')).end()
.find('#butAll').click(() => {
$('#winBRek').find('#Cari_Rek').val('');
this.data_query('brow-rek');
});
this.data_query('brow-rek');
});
},
rek_select(acell) {
FoniaJS.closeWindow(this.winBRek);
$('#Kode_Rek').val(acell[0]);
$('#Nama_Rek').val(acell[1]);
$('#Tgl_From').focus();
},
data_query(tipe, mode) {
if (tipe=="brow-rek"){
new Request_JSF({
url: this.PHP + '/brow_rek',
sendParam: ['Cari_Rek'],
onSuccess: () => FoniaJS.setFocus('#Cari_Rek')
}).send();
}
},
Rek_Comp(item) {
$('#Kode_Rek').val(item.value);
$('#Tgl_From').focus();
}
};