102 lines
3.8 KiB
JavaScript
102 lines
3.8 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: function(){
|
|
$('#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: function(){
|
|
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: function(){
|
|
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"> </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: function(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: function(tipe){
|
|
if (tipe=="brow-produk"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_produk',
|
|
sendParam: ['Cari_Produk'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
Produk_Comp: function(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: function(){
|
|
qz.printers.find().then((data) => {
|
|
new Request_JSF({
|
|
url: this.PHP + '/load_printer',
|
|
sendParam: ['Printer='+JSON.stringify(data),'DefPrint='+$('#configPrinter').html()]
|
|
}).send();
|
|
});
|
|
}
|
|
|
|
};
|