Files
cmasa/app/Scripts/report/inv/barcode.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

102 lines
3.7 KiB
JavaScript

/*******************************************************************
PHP Class : /Controller/Report/Inv/BarcodeController
Description : Laporan Barcode Barang
Created By : Siau Pheng ([email protected]).
Created Date : October 28th, 2013.
Last Modified : October 14th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var RepoInvBarcodeJS = {
PHP: '',
KODE: '',
index() {
$('#butCetak').click(() => this.proses_print());
$('#butLoadPrinter').click(() => this.load_printer());
$('#butBrowProduk').click(() => this.produk_brow());
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', [], {'selectFunc':this.Produk_Comp});
FoniaJS.setFocus('#Nama_Produk');
},
proses_print() {
if ($('#InvID').val() == 0){
FoniaJS.showError('Silakan masukkan Nama Barang !');
FoniaJS.setFocus('Nama_Produk');
return;
}
if ($('#Printer').val() == ''){
FoniaJS.showError('Silakan pilih Nama Printer Barcode !');
return;
}
var cetak = new PrinterPos(this.PHP + '/barcode');
cetak.setPrinter($('#Printer').val());
cetak.add_param("InvID");
cetak.add_param("SatuanID");
cetak.add_param("VarianID");
cetak.add_param("Qty");
cetak.add_param("Printer");
cetak.exec();
},
produk_brow() {
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Produk" 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="divBrowProduk">&nbsp;</div>');
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'xl', '', () => {
$('#winBProduk')
.find('#Cari_Produk').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key == 13 && e.target.value != '') this.data_query('brow-produk');
}).end()
.find('#butSearch').click(() => this.data_query('brow-produk')).end()
.find('#butAll').click(() => {
$('#winBProduk').find('#Cari_Produk').val('');
this.data_query('brow-produk');
});
this.data_query('brow-produk');
});
},
produk_select(acell) {
FoniaJS.closeWindow(this.winBProduk);
$('#InvID').val(acell[0]);
$('#SatuanID').val(acell[1]);
$('#VarianID').val(acell[2]);
$('#Kode_SKU').val(acell[3]);
$('#Nama_Produk').val(acell[5]);
FoniaJS.setFocus('#Qty');
},
data_query(tipe) {
if (tipe=="brow-produk"){
new Request_JSF({
url: this.PHP + '/brow_produk',
sendParam: ['Cari_Produk'],
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
}).send();
}
},
Produk_Comp(item) {
var adata = item.data.split(':');
$('#InvID').val(item.value);
$('#SatuanID').val(adata[0]);
$('#VarianID').val(adata[1]);
$('#Kode_SKU').val(adata[2]);
$('#Nama_Produk').val(item.text);
FoniaJS.setFocus('#Qty');
},
load_printer() {
qz.printers.find().then((data) => {
new Request_JSF({
url: this.PHP + '/load_printer',
sendParam: ['Printer='+JSON.stringify(data),'DefPrint='+$('#configPrinter').html()]
}).send();
});
}
};