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

91 lines
3.3 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Report/Jual/AnalisaController
Description : Laporan Analisa Penjualan
Created By : Siau Pheng ([email protected]).
Created Date : May 9th, 2013.
Last Modified : October 5th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var RepoJualAnalisaJS = {
PHP: '',
KODE: '',
index() {
$('#butCetak').click(() => this.proses_print(true));
$('#butPreview').click(() => this.proses_print());
$('#butExcel').click(() => this.proses_dload());
$('#butBrowMember').click(() => this.member_brow());
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', [], {'selectFunc':this.Member_Comp});
},
proses_print(prt) {
let cetak = new Printer(this.PHP + '/print')
.addParam("Tipe")
.addParam("CabID")
.addParam("Grup_InvID")
.addParam("Grup_MemberID")
.addParam("MemberID")
.addParam("SupID")
.addParam("Urut")
.addParam("Tgl_From")
.addParam("Tgl_To");
if (prt) cetak.doPrint(); else cetak.doPreview();
},
proses_dload() {
var dload = new Download(this.PHP + '/excel');
dload.addParam("Tipe");
dload.addParam("CabID");
dload.addParam("Grup_InvID");
dload.addParam("Grup_MemberID");
dload.addParam("MemberID");
dload.addParam("SupID");
dload.addParam("Urut");
dload.addParam("Tgl_From");
dload.addParam("Tgl_To");
dload.download();
},
member_brow() {
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Member" 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="divBrowMember">&nbsp;</div>');
this.winBMember = FoniaJS.showWindow('BMember', 'Daftar Member', _isi, 'xl', '', () => {
$('#winBMember')
.find('#Cari_Member').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key == 13 && e.target.value != '') this.data_query('brow-member');
}).end()
.find('#butSearch').click(() => this.data_query('brow-member')).end()
.find('#butAll').click(() => {
$('#winBMember').find('#Cari_Member').val('');
this.data_query('brow-member');
});
this.data_query('brow-member');
});
},
member_select(acell) {
FoniaJS.closeWindow(this.winBMember);
$('#MemberID').val(acell[0]);
$('#Nama_Member').val(acell[1]);
},
data_query(tipe) {
if (tipe=="brow-member"){
new Request_JSF({
url: this.PHP + '/brow_member',
sendParam: ['Cari_Member'],
onSuccess: () => FoniaJS.setFocus('#Cari_Member')
}).send();
}
},
Member_Comp(item) {
$('#MemberID').val(item.value);
}
};