161 lines
6.9 KiB
JavaScript
161 lines
6.9 KiB
JavaScript
/*******************************************************************
|
|
|
|
App. Name : INVENTORY AND SALES SYSTEMS
|
|
Module : /apps/js/repo/label.js
|
|
Desc. : JS - Cetak Label Harga Barang
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : September 13th, 2014.
|
|
Last Modified : October 5th, 2025.
|
|
|
|
(c) 2014 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var RepoLabelJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
loading: function(q){//oke
|
|
$('#butHapus').click(function(){this.proses_empty();}.bind(this));
|
|
$('#butPrint').click(function(){this.proses_print(true);}.bind(this));
|
|
$('#butPreview').click(function(){this.proses_print();}.bind(this));
|
|
this.data_query('tabel-detail', 'empty', ((typeof(q)!=='undefined') ? q : ''));
|
|
},
|
|
|
|
proses_empty: function(){//oke
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail=empty']
|
|
}).send();
|
|
},
|
|
|
|
proses_print: function(prt){//oke
|
|
var cetak = new cPRINTER(this.PHP);
|
|
cetak.add_param("data", "print");
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
},
|
|
|
|
produk_brow: function(){//oke
|
|
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, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
|
|
$('#winBProduk')
|
|
.find('#butWSimpan').click(function(){this.produk_simpan();}.bind(this)).end()
|
|
.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');
|
|
FoniaJS.setFocus('#Cari_Produk');
|
|
}.bind(this));
|
|
},
|
|
|
|
produk_simpan: function(){//oke
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail=simpan-produk'],
|
|
onSuccess: function(){
|
|
FoniaJS.closeWindow(this.winBProduk);
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
grup_brow: function(){//oke
|
|
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Grup" 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="divBrowGrup"> </div>');
|
|
this.winBGrup = FoniaJS.showWindow('BGrup', 'Daftar Grup Barang', _isi, 900, null, function(){
|
|
$('#winBGrup')
|
|
.find('#Cari_Grup').keydown(function(e){
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('brow-grup');
|
|
}.bind(this)).end()
|
|
.find('#butSearch').click(function(e){
|
|
this.data_query('brow-grup');
|
|
}.bind(this)).end()
|
|
.find('#butAll').click(function(){
|
|
$('#winBGrup').find('#Cari_Grup').val('');
|
|
this.data_query('brow-grup');
|
|
}.bind(this));
|
|
this.data_query('brow-grup');
|
|
FoniaJS.setFocus('#Cari_Grup');
|
|
}.bind(this));
|
|
},
|
|
|
|
grup_select: function(acell){//oke
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail=simpan-grup','Grup_InvID='+acell[0]],
|
|
onSuccess: function(){
|
|
FoniaJS.closeWindow(this.winBGrup);
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
detail_ubah: function(acell){//oke
|
|
new Request.JSON({
|
|
url: this.PHP,
|
|
sendParam: ['data=detail-tx','mode_detail=update','ID='+acell[0]],
|
|
onSuccess: function(a){
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', a.html, 600, [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], function(){
|
|
$('#winDetail')
|
|
.find('#butWSimpan').click(function(){this.detail_simpan();}.bind(this)).end()
|
|
.find('#Nama_Produk').keyup(function(e){
|
|
if (-1!==$.inArray(e.which, [13,9])) this.detail_simpan();
|
|
}.bind(this));
|
|
FoniaJS.setFocus('#Nama_Produk');
|
|
}.bind(this), false);
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
detail_hapus: function(acell){//oke
|
|
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[1]+'"</strong> ?', function(){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail=delete','ID='+acell[0]]
|
|
}).send();
|
|
}.bind(this), 'danger');
|
|
},
|
|
|
|
detail_simpan: function(){//oke
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail','ID','Nama_Produk='+encodeURIComponent($('#Nama_Produk').val())],
|
|
onSuccess: function(){
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
}.bind(this)
|
|
}).send();
|
|
},
|
|
|
|
data_query: function(tipe, mode, kd_tx){//oke
|
|
if (tipe=="tabel-detail"){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=tabel-detail','mode_detail='+mode,'No_Label'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')]
|
|
}).send();
|
|
} else if (tipe=="brow-produk"){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=brow-produk','Cari_Produk'],
|
|
onSuccess: function(){
|
|
FoniaJS.setFocus('#Cari_Produk');
|
|
}
|
|
}).send();
|
|
} else if (tipe=="brow-grup"){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=brow-grup','Cari_Grup'],
|
|
onSuccess: function(){
|
|
FoniaJS.setFocus('#Cari_Grup');
|
|
}
|
|
}).send();
|
|
}
|
|
}
|
|
|
|
};
|