139 lines
5.5 KiB
JavaScript
139 lines
5.5 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Report/Jual/RekapController
|
|
Description : Laporan Rekap Penjualan
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : July 16th, 2011.
|
|
Last Modified : October 4th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var RepoJualRekapJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(){
|
|
$('#butCetak').click(() => this.proses_print(true));
|
|
$('#butPreview').click(() => this.proses_print());
|
|
$('#butExcel').click(() => this.proses_dload());
|
|
$('#butBrowProduk').click(() => this.produk_brow());
|
|
$('#butBrowMember').click(() => this.member_brow());
|
|
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', [], {'selectFunc':this.Produk_Comp});
|
|
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', [], {'selectFunc':this.Member_Comp});
|
|
FoniaJS.setFocus('#Nama_Produk');
|
|
},
|
|
|
|
proses_print: function(prt){
|
|
if ($('#InvID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Barang !");
|
|
$('#Nama_Produk').focus();
|
|
return;
|
|
}
|
|
if ($('#MemberID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Member !");
|
|
$('#Nama_Member').focus();
|
|
return;
|
|
}
|
|
var cetak = new Printer(this.PHP + '/print');
|
|
cetak.add_param("CabID");
|
|
cetak.add_param("InvID");
|
|
cetak.add_param("MemberID");
|
|
cetak.add_param("Tgl_From");
|
|
cetak.add_param("Tgl_To");
|
|
if (prt) cetak.doPrint(); else cetak.doPreview();
|
|
},
|
|
|
|
proses_dload: function(){
|
|
if ($('#InvID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Barang !");
|
|
$('#Nama_Produk').focus();
|
|
return;
|
|
}
|
|
if ($('#MemberID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Member !");
|
|
$('#Nama_Member').focus();
|
|
return;
|
|
}
|
|
var dload = new Download(this.PHP + '/excel');
|
|
dload.add_param("CabID");
|
|
dload.add_param("InvID");
|
|
dload.add_param("MemberID");
|
|
dload.add_param("Tgl_From");
|
|
dload.add_param("Tgl_To");
|
|
dload.download();
|
|
},
|
|
|
|
member_brow: function(){
|
|
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Member" 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="divBrowMember"> </div>');
|
|
this.winBMember = FoniaJS.showWindow('BMember', 'Daftar Member', _isi, 'xl', '', () => {
|
|
$('#winBMember')
|
|
.find('#Cari_Member').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key == 13 && e.target.value != '') this.data_query('brow-member');
|
|
}).end()
|
|
.find('#butSearch').click(() => this.data_query('brow-member')).end()
|
|
.find('#butAll').click(() => {
|
|
$('#winBMember').find('#Cari_Member').val('');
|
|
this.data_query('brow-member');
|
|
});
|
|
this.data_query('brow-member');
|
|
});
|
|
},
|
|
|
|
member_select: function(acell){
|
|
FoniaJS.closeWindow(this.winBMember);
|
|
$('#MemberID').val(acell[0]);
|
|
$('#Nama_Member').val(acell[1]);
|
|
},
|
|
|
|
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', '', () => {
|
|
$('#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: function(acell){
|
|
FoniaJS.closeWindow(this.winBProduk);
|
|
$('#InvID').val(acell[0]);
|
|
$('#Nama_Produk').val(acell[5]);
|
|
},
|
|
|
|
data_query: function(tipe){
|
|
if (tipe=="brow-member"){
|
|
new Request.JSONF({
|
|
url: this.PHP + '/brow_member',
|
|
sendParam: ['Cari_Member'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Member')
|
|
}).send();
|
|
} else if (tipe=="brow-produk"){
|
|
new Request.JSONF({
|
|
url: this.PHP + '/brow_produk',
|
|
sendParam: ['Cari_Produk'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
Member_Comp: function(item){
|
|
$('#MemberID').val(item.value);
|
|
},
|
|
|
|
Produk_Comp: function(item){
|
|
$('#InvID').val(item.value);
|
|
}
|
|
|
|
};
|