111 lines
4.0 KiB
JavaScript
111 lines
4.0 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Report/Stok/MutasiController
|
|
Description : Laporan Mutasi Stok Barang
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : July 16th, 2011.
|
|
Last Modified : November 4th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var RepoStokMutasiJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
html5QrcodeScanner: null,
|
|
|
|
index() {
|
|
$('#butCetak').click(() => this.proses_print(true));
|
|
$('#butPreview').click(() => this.proses_print());
|
|
$('#butExcel').click(() => this.proses_dload());
|
|
$('#butBrowProduk').click(() => this.produk_brow());
|
|
if (FoniaJS.WEB_MOBILE){
|
|
html5QrcodeScanner = new Html5Qrcode('qr-reader');
|
|
html5QrcodeScanner.start({ facingMode: 'environment' }, { fps: 10, qrbox: 250 }, RepoStokMutasiJS.ScanSukses);
|
|
} else {
|
|
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', [], {'selectFunc': this.Produk_Comp});
|
|
FoniaJS.setFocus('#Nama_Produk');
|
|
}
|
|
},
|
|
|
|
proses_print(prt) {
|
|
if ($('#InvID').val()==0) {
|
|
FoniaJS.showError('Silakan masukkan Nama Barang !');
|
|
$('#Nama_Produk').focus();
|
|
return;
|
|
}
|
|
let cetak = new Printer(this.PHP + '/print')
|
|
.addParam("CabID")
|
|
.addParam("InvID")
|
|
.addParam("Tgl_From")
|
|
.addParam("Tgl_To");
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
},
|
|
|
|
proses_dload() {
|
|
if ($('#InvID').val()==0) {
|
|
FoniaJS.showError('Silakan masukkan Nama Barang !');
|
|
$('#Nama_Produk').focus();
|
|
return;
|
|
}
|
|
var dload = new Download(this.PHP + '/excel');
|
|
dload.addParam("CabID");
|
|
dload.addParam("InvID");
|
|
dload.addParam("Tgl_From");
|
|
dload.addParam("Tgl_To");
|
|
dload.download();
|
|
},
|
|
|
|
ScanSukses(decodedText, decodedResult) {
|
|
new Request({
|
|
url: RepoStokMutasiJS.PHP + '/scan_produk',
|
|
sendParam: ['Cari_Produk='+decodedText],
|
|
onSuccess: (ajson) => {
|
|
$('#InvID').val(ajson.InvID);
|
|
$('#Nama_Produk').val(ajson.Nama_Produk);
|
|
$('#Tgl_From').focus();
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
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"> </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]);
|
|
$('#Nama_Produk').val(acell[5]);
|
|
},
|
|
|
|
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) {
|
|
$('#InvID').val(item.value);
|
|
$('#Tgl_From').focus();
|
|
}
|
|
|
|
};
|