108 lines
3.9 KiB
JavaScript
108 lines
3.9 KiB
JavaScript
/*******************************************************************
|
|
|
|
App. Name : Inventory Advanced Systems
|
|
Module : /apps/js/repo/jual.js
|
|
Desc. : JS - Laporan Penjualan
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : April 12th, 2011.
|
|
Last Modified : July 4th, 2023.
|
|
|
|
(c) 2011 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var RepoJualJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
loading: function(){
|
|
$('#butCetak').click(function(){this.proses_print('print');}.bind(this));
|
|
$('#butPreview').click(function(){this.proses_print('preview');}.bind(this));
|
|
$('#butExcel').click(function(){this.proses_dload();}.bind(this));
|
|
FoniaJS.AutoComplete('#Nama_Outlet', this.PHP, ['data=auto-outlet'], this.Outlet_Comp);
|
|
$('#Nama_Outlet').on('click', function(){
|
|
$('#Nama_Outlet').select();
|
|
});
|
|
this.oc_Tipe();
|
|
},
|
|
|
|
proses_print: function(prt){
|
|
var cetak = new cPRINTER(this.PHP);
|
|
cetak.set_zoom(90);
|
|
cetak.add_param("data", "print");
|
|
cetak.add_param("Tipe");
|
|
cetak.add_param("Rekap");
|
|
cetak.add_param("OutletID");
|
|
cetak.add_param("SalesID");
|
|
cetak.add_param("Grup_InvID");
|
|
cetak.add_param("CK");
|
|
cetak.add_param("Tgl_From");
|
|
cetak.add_param("Tgl_To");
|
|
if (prt=='print') { cetak.doPrint(); } else cetak.doPreview();
|
|
},
|
|
|
|
proses_dload: function(){
|
|
var dload = new cEXPORT(this.PHP);
|
|
dload.add_param('data', 'export');
|
|
dload.add_param("Tipe");
|
|
dload.add_param("Rekap");
|
|
dload.add_param("OutletID");
|
|
dload.add_param("SalesID");
|
|
dload.add_param("Grup_InvID");
|
|
dload.add_param("CK");
|
|
dload.add_param("Tgl_From");
|
|
dload.add_param("Tgl_To");
|
|
dload.download();
|
|
},
|
|
|
|
outlet_brow: function(){
|
|
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Outlet" 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="divBrowOutlet"> </div>');
|
|
this.winBOutlet = FoniaJS.showWindow('BOutlet', 'Daftar Outlet', _isi, 900, '', function(){
|
|
$('#winBOutlet').find('#Cari_Outlet').keydown(function(e){
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('brow-outlet');
|
|
}.bind(this));
|
|
$('#winBOutlet').find('#butSearch').click(function(e){
|
|
this.data_query('brow-outlet');
|
|
}.bind(this));
|
|
$('#winBOutlet').find('#butAll').click(function(){
|
|
$('#winBOutlet').find('#Cari_Outlet').val('');
|
|
this.data_query('brow-outlet');
|
|
}.bind(this));
|
|
this.data_query('brow-outlet');
|
|
FoniaJS.setFocus('#Cari_Outlet');
|
|
}.bind(this));
|
|
},
|
|
|
|
outlet_select: function(acell){
|
|
FoniaJS.closeWindow(this.winBOutlet);
|
|
$('#OutletID').val(acell[0]);
|
|
$('#Nama_Outlet').val(acell[2]);
|
|
},
|
|
|
|
data_query: function(tipe){
|
|
if (tipe=="brow-outlet"){
|
|
new Request.JSONF({
|
|
url: this.PHP,
|
|
sendParam: ['data=brow-outlet','Cari_Outlet'],
|
|
onSuccess: function(){
|
|
FoniaJS.setFocus('#Cari_Outlet');
|
|
}
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
Outlet_Comp: function(item){
|
|
$('#OutletID').val(item.value);
|
|
},
|
|
|
|
oc_Tipe: function(){
|
|
if ($('#Tipe').val()=='R') {
|
|
$('#Grup_InvID').val(0).trigger('change');
|
|
$('#Grup_InvID').prop('disabled', true);
|
|
} else
|
|
$('#Grup_InvID').prop('disabled', false);
|
|
}
|
|
|
|
};
|