first commit
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : INVENTORY AND SALES SYSTEMS
|
||||
Module : /apps/js/repo/barcode.js
|
||||
Desc. : JS - Cetak Barcode Label
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 28th, 2013.
|
||||
Last Modified : October 2nd, 2025.
|
||||
|
||||
(c) 2013 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var RepoBarcodeJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
loading: function(){
|
||||
$('#butCetak').click(function(){this.proses_print();}.bind(this));
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP, ['data=auto-produk'], {'selectFunc': RepoBarcodeJS.Produk_Comp});
|
||||
$('#butBrow').click(function(){this.produk_brow();}.bind(this));
|
||||
$('#butPL').click(function(){this.load_printer();}.bind(this));
|
||||
$('#Nama_Produk').focus();
|
||||
},
|
||||
|
||||
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 cPRINTERPOS(this.PHP);
|
||||
cetak.setPrinter($('#Printer').val());
|
||||
cetak.add_param("data", "print-barcode");
|
||||
cetak.add_param("InvID");
|
||||
cetak.add_param("SatuanID");
|
||||
cetak.add_param("Qty");
|
||||
cetak.add_param("Kode_Sup");
|
||||
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, 900, '', function(){
|
||||
$('#winBProduk')
|
||||
.find('#Cari_Produk').keydown(function(e){
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.data_query('brow-produk');
|
||||
}.bind(this)).end()
|
||||
.find('#butSearch').click(function(e){
|
||||
this.data_query('brow-produk');
|
||||
}.bind(this)).end()
|
||||
.find('#butAll').click(function(){
|
||||
$('#winBProduk').find('#Cari_Produk').val('');
|
||||
this.data_query('brow-produk');
|
||||
}.bind(this));
|
||||
this.data_query('brow-produk');
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
$('#InvID').val(acell[0]);
|
||||
$('#SatuanID').val(acell[1]);
|
||||
$('#Kode_SKU').val(acell[2]);
|
||||
$('#Nama_Produk').val(acell[4]);
|
||||
this.update_Sup();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="brow-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=brow-produk','Cari_Produk'],
|
||||
onSuccess: function(){
|
||||
FoniaJS.setFocus('#Cari_Produk');
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#InvID').val(item.value);
|
||||
$('#SatuanID').val(adata[1]);
|
||||
$('#Kode_SKU').val(adata[0]);
|
||||
RepoBarcodeJS.update_Sup();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
},
|
||||
|
||||
update_Sup: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=opt-sup','InvID']
|
||||
}).send();
|
||||
},
|
||||
|
||||
load_printer: function(){
|
||||
var parent = this;
|
||||
qz.printers.find().then(function(data){
|
||||
var _dafprt = '';
|
||||
for(var i = 0; i < data.length; i++) {
|
||||
_dafprt += data[i] + '|';
|
||||
};
|
||||
new Request.JSONF({
|
||||
url: parent.PHP,
|
||||
sendParam: ['data=load-printer','Printer='+_dafprt,'DefPrint='+$('#configPrinter').html()]
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user