143 lines
6.1 KiB
JavaScript
143 lines
6.1 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Report/Inv/LabelController
|
|
Description : Cetak Label Harga
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : September 13th, 2014.
|
|
Last Modified : October 16th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var RepoInvLabelJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(q){
|
|
$('#butHapus').click(() => this.proses_empty());
|
|
$('#butPrint').click(() => this.proses_print(true));
|
|
$('#butPreview').click(() => this.proses_print());
|
|
this.data_query('tabel-detail', 'empty', ((typeof(q)!=='undefined') ? q : ''));
|
|
},
|
|
|
|
proses_empty: function(){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=empty']
|
|
}).send();
|
|
},
|
|
|
|
proses_print: function(prt){
|
|
var cetak = new Printer(this.PHP + '/print');
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
},
|
|
|
|
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', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winBProduk')
|
|
.find('#butWSimpan').click(() => this.produk_simpan()).end()
|
|
.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_simpan: function(){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=simpan-produk'],
|
|
onSuccess: () => FoniaJS.closeWindow(this.winBProduk)
|
|
}).send();
|
|
},
|
|
|
|
grup_brow: function(){
|
|
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, 'xl', '', () => {
|
|
$('#winBGrup')
|
|
.find('#Cari_Grup').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('brow-grup');
|
|
}).end()
|
|
.find('#butSearch').click(() => this.data_query('brow-grup')).end()
|
|
.find('#butAll').click(() => {
|
|
$('#winBGrup').find('#Cari_Grup').val('');
|
|
this.data_query('brow-grup');
|
|
});
|
|
this.data_query('brow-grup');
|
|
});
|
|
},
|
|
|
|
grup_select: function(acell){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=simpan-grup','Grup_InvID='+acell[0]],
|
|
onSuccess: () => FoniaJS.closeWindow(this.winBGrup)
|
|
}).send();
|
|
},
|
|
|
|
detail_ubah: function(acell){
|
|
new Request({
|
|
url: this.PHP + '/form_detail',
|
|
sendParam: ['mode_detail=update','ID='+acell[0]],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winDetail')
|
|
.find('#butWSimpan').click(() => this.detail_simpan())
|
|
.find('#Nama_Produk').keyup((e) => {
|
|
if (-1!==$.inArray(e.which, [13,9])) this.detail_simpan();
|
|
});
|
|
FoniaJS.setFocus('#Nama_Produk');
|
|
}, false);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_hapus: function(acell){
|
|
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[1]+'"</strong> ?', () => {
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=delete','ID='+acell[0]]
|
|
}).send();
|
|
}, 'danger');
|
|
},
|
|
|
|
detail_simpan: function(){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=update','ID='+$('#ID').val(),'Nama_Produk='+encodeURIComponent($('#Nama_Produk').val())],
|
|
onSuccess: () => FoniaJS.closeWindow(this.winDetail)
|
|
}).send();
|
|
},
|
|
|
|
data_query: function(tipe, mode, kd_tx){
|
|
if (tipe=="tabel-detail"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail='+mode,'No_Label'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')]
|
|
}).send();
|
|
} else if (tipe=="brow-produk"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_produk',
|
|
sendParam: ['Cari_Produk'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
|
}).send();
|
|
} else if (tipe=="brow-grup"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_grup',
|
|
sendParam: ['Cari_Grup'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Grup')
|
|
}).send();
|
|
}
|
|
}
|
|
|
|
};
|