497 lines
22 KiB
JavaScript
497 lines
22 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Inv/PosController
|
|
Description : Transaksi Penjualan POS
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : August 5th, 2012.
|
|
Last Modified : September 27th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var POSJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
POLE_DISP: null,
|
|
POLE_CONF: {},
|
|
Simpan: false,
|
|
|
|
index: function(){
|
|
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Jual','Grup_MemberID'], {'selectFunc': this.Produk_Comp, 'keyFunc': this.Produk_Key});
|
|
$('#Nama_Produk').click(() => $('#Nama_Produk').select());
|
|
$('#POS_Qty').on({
|
|
keyup: (e) => {
|
|
(13 == e.which) && $('#Nama_Produk').focus();
|
|
},
|
|
blur: (e) => {
|
|
if (parseInt(e.target.value) == 0) e.target.value = '1.00';
|
|
},
|
|
click: () => $('#POS_Qty').select()
|
|
});
|
|
this.data_query('master');
|
|
//POLE DISPLAY
|
|
this.data_query('config-pole');
|
|
},
|
|
|
|
proses_oc: function(){
|
|
var cetak = new PrinterPos('report/nota/open_cash');
|
|
cetak.exec();
|
|
$('#Nama_Produk').focus();
|
|
},
|
|
|
|
proses_print: function(oc){
|
|
var cetak = new PrinterPos('report/nota/pos');
|
|
cetak.add_param("Nomor_Cetak", $('#No_Cetak').val());
|
|
cetak.add_param("Open_Cash", oc);
|
|
cetak.exec();
|
|
},
|
|
|
|
proses_cancel: function(){
|
|
if ($('#Total_Item').val()==0) {
|
|
FoniaJS.showInfo('Tidak ada item barang !');
|
|
return;
|
|
}
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin membatalkan ?<br>Semua item nota ini akan dihapus !', () => this.data_query('master','cancel'), 'danger');
|
|
},
|
|
|
|
nota_brow: function(){
|
|
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Nota" 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="divBrowNota"> </div>');
|
|
this.winBNota = FoniaJS.showWindow('BNota', 'Daftar Transaksi', _isi, 'xl', '', () => {
|
|
$('#winBNota')
|
|
.find('#Cari_Nota').keydown((e) => {
|
|
var key = e.keyCode || e.which || 0;
|
|
if (key==13 && e.target.value!='') this.data_query('brow-nota');
|
|
}).end()
|
|
.find('#butSearch').click((e) => this.data_query('brow-nota')).end()
|
|
.find('#butAll').click(() => {
|
|
$('#winBNota').find('#Cari_Nota').val('');
|
|
this.data_query('brow-nota');
|
|
});
|
|
this.data_query('brow-nota');
|
|
});
|
|
},
|
|
|
|
nota_print: function(acell){
|
|
FoniaJS.closeWindow(this.winBNota);
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin cetak ulang Nota "'+acell[0]+'" ?', () => {
|
|
$('#No_Cetak').val(acell[0]);
|
|
this.proses_print(0);
|
|
}, 'info');
|
|
},
|
|
|
|
nota_select: function(acell){
|
|
FoniaJS.closeWindow(this.winBNota);
|
|
FoniaJS.showAuth(() => {
|
|
$('#No_Jual').val(acell[0]);
|
|
this.data_query('master', 'edit');
|
|
}, this, 'EDIT POS : '+acell[0]);
|
|
},
|
|
|
|
nota_delete: function(acell){
|
|
FoniaJS.closeWindow(this.winBNota);
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Nota "'+acell[0]+'" ?', () => {
|
|
FoniaJS.showAuth(() => {
|
|
$('#No_Jual').val(acell[0]);
|
|
this.data_query('master', 'delete');
|
|
}, this, 'DELETE '+acell[0]);
|
|
}, 'danger');
|
|
},
|
|
|
|
pending_brow: function(){
|
|
this.winBPend = FoniaJS.showWindow('BPend', 'Daftar Pending POS', '<div id="divBrowPending"> </div>', 'xl', '', () => this.data_query('brow-pending'));
|
|
},
|
|
|
|
pending_select: function(acell){
|
|
FoniaJS.closeWindow(this.winBPend);
|
|
$('#No_Jual').val(acell[0]);
|
|
this.data_query('master', 'pending-edit');
|
|
},
|
|
|
|
pending_delete: function(acell){
|
|
FoniaJS.closeWindow(this.winBPend);
|
|
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Transaksi Pending "'+acell[0]+'" ?', () => {
|
|
$('#No_Jual').val(acell[0]);
|
|
this.data_query('master', 'pending-delete');
|
|
}, 'danger');
|
|
},
|
|
|
|
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]);
|
|
$('#Grup_MemberID').val(acell[1]);
|
|
$('#Nama_Member').val(acell[3]);
|
|
$('#Info_Member').html(acell[6] || '-');
|
|
$('#Nama_Produk').focus();
|
|
},
|
|
|
|
produk_brow: function(){
|
|
if ($('#MemberID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Member !");
|
|
FoniaJS.setFocus('Nama_Member');
|
|
return;
|
|
}
|
|
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);
|
|
this.detail_produk('insert', 0, acell[0], acell[1], acell[2]);
|
|
},
|
|
|
|
detail_produk: function(mode, ID, InvID, SatuanID, VarianID){
|
|
if ($('#MemberID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Member !");
|
|
FoniaJS.setFocus('Nama_Member');
|
|
return;
|
|
}
|
|
new Request({
|
|
url: this.PHP + '/form_produk',
|
|
sendParam: ['mode_detail='+mode,'No_Jual','ID='+ID,'InvID='+InvID,'SatuanID='+SatuanID,'VarianID='+VarianID,'Grup_MemberID'],
|
|
onSuccess: (ajson) => {
|
|
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butBatal'},{i:'butSimpan',v:'Simpan',c:'success'}], () => {
|
|
$('#winDetail')
|
|
.find('#butSimpan').click(() => this.detail_simpan()).end()
|
|
.find('#butBatal').click(() => $('#Nama_Produk').focus()).end()
|
|
.find('#Qty').keyup((e) => {
|
|
this.Hitung_Detail(1);
|
|
if (-1!==$.inArray(e.which, [13,9]) && parseInt(e.target.value)>0) FoniaJS.setFocus('#Disk_Rupiah');
|
|
}).end()
|
|
.find('#Disk_Rupiah').keyup((e) => {
|
|
this.Hitung_Detail(1);
|
|
if (13==e.which && FoniaJS.StrToFloat($('#Qty').val())>0) this.detail_simpan();
|
|
}).end()
|
|
.find('#Disk_Persen').keyup((e) => {
|
|
this.Hitung_Detail(2);
|
|
if (13==e.which && FoniaJS.StrToFloat($('#Qty').val())>0) this.detail_simpan();
|
|
});
|
|
this.Hitung_Detail(1);
|
|
FoniaJS.setFocus('#Qty');
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_ubah: function(acell){
|
|
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
|
},
|
|
|
|
detail_hapus: function(acell){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=delete','No_Jual','ID='+acell[0]],
|
|
onSuccess: () => {
|
|
$('#Nama_Produk').focus();
|
|
//POLE DISPLAY
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP.Send([{'t':'..','a':'L'},{'t':'Total '+$('#Total_Disp').html(),'a':'R'}]);
|
|
}
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
detail_simpan: function(){
|
|
if (FoniaJS.StrToFloat($('#Disk_Persen').val()) >= 100) {
|
|
FoniaJS.showInfo('Nilai Diskon diluar batas !');
|
|
return false;
|
|
}
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['mode_detail','No_Jual','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli','Harga_Jual','Disk_Rupiah','Disk_Persen'],
|
|
onSuccess: () => {
|
|
//POLE DISPLAY
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP.Send([{'t':$('#Nama_Lengkap').val(),'a':'L'},{'t':'Total '+$('#Total_Disp').html(),'a':'R'}]);
|
|
}
|
|
FoniaJS.closeWindow(this.winDetail);
|
|
$('#Nama_Produk').val('').focus();
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
kasir_show: function(){
|
|
if ($('#MemberID').val()==0){
|
|
FoniaJS.showError("Silakan masukkan Nama Member !");
|
|
FoniaJS.setFocus('Nama_Member');
|
|
return;
|
|
}
|
|
if ($('#Total_Item').val()==0) {
|
|
FoniaJS.showInfo('Belum ada transaksi !');
|
|
return;
|
|
}
|
|
//POLE DISPLAY
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP.Send([{'t':'Total '+$('#Total_Disp').html(),'a':'C'},{'t':'Tunai / Non Tunai ?','a':'C'}]);
|
|
}
|
|
new Request({
|
|
url: this.PHP + '/form_kasir',
|
|
sendParam: ['No_Jual','Total_Nota','Grup_MemberID'],
|
|
onSuccess: (ajson) => {
|
|
this.winKasir = FoniaJS.showWindow('Kasir', 'Informasi Pembayaran', ajson.html, 'md', '', () => {
|
|
$('#butKPend').click(() => this.kasir_pending());
|
|
$('#butKBayar').click(() => this.kasir_simpan());
|
|
$('#butKBatal').click(() => $('#Nama_Produk').focus());
|
|
$('#popTotal_Tunai').keyup((e) => {
|
|
if (13 == e.which && parseFloat(e.target.value) == 0){
|
|
e.target.value = FoniaJS.FloatToStr($('#Total_Nota').val());
|
|
}
|
|
if (27 == e.which) {
|
|
FoniaJS.closeWindow(this.winKasir);
|
|
$('#Nama_Produk').focus();
|
|
}
|
|
this.kasir_hitung();
|
|
if (parseFloat(e.target.value) == 0) return false;
|
|
if (13 == e.which) $('#butKBayar').focus();
|
|
});
|
|
$('#popTotal_Kartu').keyup((e) => {
|
|
if (13 == e.which && $('#popKartuID').val() > 0 && parseFloat(e.target.value) == 0){
|
|
e.target.value = FoniaJS.FloatToStr($('#Total_Nota').val()-FoniaJS.StrToFloat($('#popTotal_Tunai').val()));
|
|
}
|
|
if (27 == e.which) {
|
|
FoniaJS.closeWindow(this.winKasir);
|
|
$('#Nama_Produk').focus();
|
|
}
|
|
this.kasir_hitung();
|
|
if (parseFloat(e.target.value) == 0) return false;
|
|
if (13 == e.which) $('#butKBayar').focus();
|
|
});
|
|
$('#popKartuID').change(() => {
|
|
if ($('#popKartuID').val() > 0){
|
|
if (parseFloat($('#popTotal_Kartu').val()) == 0) $('#popTotal_Kartu').val(FoniaJS.FloatToStr($('#Total_Nota').val()-FoniaJS.StrToFloat($('#popTotal_Tunai').val())));
|
|
$('.ckartu').removeClass('d-none');
|
|
} else {
|
|
$('#popTotal_Kartu').val('0.00');
|
|
$('.ckartu').addClass('d-none');
|
|
}
|
|
this.kasir_hitung();
|
|
FoniaJS.setFocus('#popTotal_Kartu');
|
|
});
|
|
$('#popTotal_Tunai').val(FoniaJS.FloatToStr($('#Total_Tunai').val()));
|
|
$('#popTotal_Kartu').val(FoniaJS.FloatToStr($('#Total_Kartu').val()));
|
|
$('#popTotal_Bayar').val($('#Total_Bayar').val());
|
|
$('#popKartuID').val($('#KartuID').val()).trigger('change');
|
|
$('#popNo_Kartu').val($('#No_Kartu').val());
|
|
$('#popNama_Kartu').val($('#Nama_Kartu').val());
|
|
$('#Total_Disp').html(ajson.Total_Disp);
|
|
FoniaJS.setFocus('#popTotal_Tunai');
|
|
});
|
|
this.Simpan = false;
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
kasir_hitung: function(){
|
|
const totBayar = FoniaJS.StrToFloat($('#popTotal_Tunai').val()) + FoniaJS.StrToFloat($('#popTotal_Kartu').val());
|
|
const totSisa = totBayar - FoniaJS.StrToFloat($('#popTotal_Jual').val());
|
|
$('#popTotal_Bayar').val(totBayar);
|
|
$('#popTotal_Sisa').val(FoniaJS.FloatToStr(totSisa, 2)).removeClass('border-danger border-success').addClass((totSisa < 0) ? 'border-danger' : 'border-success');
|
|
},
|
|
|
|
kasir_simpan: function(){
|
|
const totTunai = FoniaJS.StrToFloat($('#popTotal_Tunai').val());
|
|
const totKartu = FoniaJS.StrToFloat($('#popTotal_Kartu').val());
|
|
const jenKartu = $('#popKartuID').val();
|
|
if (jenKartu == 0 && totKartu > 0) {
|
|
FoniaJS.showInfo('Silakan pilih Jenis Pembayaran Non Tunai!');
|
|
FoniaJS.setFocus('#popKartuID');
|
|
return false;
|
|
} else if (jenKartu > 0 && totKartu == 0) {
|
|
FoniaJS.showInfo('Silakan masukkan Jumlah Pembayaran Non Tunai!');
|
|
FoniaJS.setFocus('#popKartuID');
|
|
return false;
|
|
}
|
|
if (FoniaJS.StrToFloat($('#popTotal_Sisa').val())<0) {
|
|
FoniaJS.showInfo('Pembayaran Transaksi tidak mencukupi!');
|
|
FoniaJS.setFocus('#popTotal_Bayar');
|
|
return false;
|
|
}
|
|
if (this.Simpan==true) {
|
|
FoniaJS.showError('Proses pembayaran sedang dilakukan!');
|
|
return;
|
|
}
|
|
this.Simpan = true;
|
|
$('#Total_Tunai').val(totTunai);
|
|
$('#Total_Kartu').val(totKartu);
|
|
$('#Total_Bayar').val($('#popTotal_Bayar').val());
|
|
$('#KartuID').val($('#popKartuID').val());
|
|
$('#No_Kartu').val($('#popNo_Kartu').val());
|
|
$('#Nama_Kartu').val($('#popNama_Kartu').val());
|
|
FoniaJS.closeWindow(this.winKasir);
|
|
this.data_query('master', 'save');
|
|
},
|
|
|
|
kasir_pending: function(){
|
|
FoniaJS.closeWindow(this.winKasir);
|
|
this.data_query('master', 'pending-save');
|
|
},
|
|
|
|
data_query: function(tipe, mode){
|
|
if (tipe=='master'){
|
|
mode = (mode) ? mode : '';
|
|
var sparam = ['mode='+mode,'No_Jual','No_Cetak'];
|
|
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'No_Jual','Tgl_Jual','MemberID','Grup_MemberID','Total_Tunai','Total_Kartu','Total_Bayar','KartuID','No_Kartu','Nama_Kartu'];
|
|
new Request({
|
|
url: this.PHP + '/form_master',
|
|
sendParam: sparam,
|
|
onSuccess: (ajson) => {
|
|
$('#divPOS2').html(ajson.html);
|
|
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', [], {'selectFunc': this.Member_Comp});
|
|
$('#posPEND').click(() =>this.pending_brow());
|
|
$('#posMEMBER').click(() =>this.member_brow());
|
|
$('#posBARANG').click(() => this.produk_brow());
|
|
$('#posNOTA').click(() => this.nota_brow());
|
|
$('#posSIMPAN').click(() => this.kasir_show());
|
|
$('#posBATAL').click(() => this.proses_cancel());
|
|
FoniaJS.User.Level>1 && $('#posBATAL').hide();
|
|
$('#Nama_Member').click(() => $('#Nama_Member').select());
|
|
this.data_query('detail');
|
|
$('#Nama_Produk').focus();
|
|
if (-1!==$.inArray($('#mode').val(), ['print','opencd','saveonly'])){
|
|
if ($('#mode').val()=='print') this.proses_print(1);
|
|
if ($('#mode').val()=='opencd') this.proses_oc();
|
|
//POLE DISPLAY
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP.Send([{'t':this.POLE_CONF.END1,'a':'C'},{'t':this.POLE_CONF.END2,'a':'C'}]);
|
|
}
|
|
} else {
|
|
//POLE DISPLAY
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP.Send([{'t':this.POLE_CONF.START1,'a':'C'},{'t':this.POLE_CONF.START2,'a':'C'}]);
|
|
}
|
|
}
|
|
}
|
|
}).send();
|
|
} else if (tipe=='detail'){
|
|
new Request_JSF({
|
|
url: this.PHP + '/table_detail',
|
|
sendParam: ['No_Jual']
|
|
}).send();
|
|
} else if (tipe=='brow-nota'){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_nota',
|
|
sendParam: ['Cari_Nota'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Nota')
|
|
}).send();
|
|
} else if (tipe=='brow-pending'){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_pending',
|
|
}).send();
|
|
} else if (tipe=="brow-member"){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_member',
|
|
sendParam: ['Cari_Member'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Member')
|
|
}).send();
|
|
} else if (tipe=='brow-produk'){
|
|
new Request_JSF({
|
|
url: this.PHP + '/brow_produk',
|
|
sendParam: ['Cari_Produk','Grup_MemberID'],
|
|
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
|
}).send();
|
|
} else if (tipe=='config-pole'){
|
|
new Request({
|
|
url: this.PHP + '/config_pole',
|
|
onSuccess: (acfg) => {
|
|
if (typeof acfg.pole == 'object'){
|
|
this.POLE_CONF = acfg.pole;
|
|
if (this.POLE_CONF.ENABLE){
|
|
this.POLE_DISP = new PoleDisplay(this.POLE_CONF.PORT);
|
|
this.POLE_DISP.Open();
|
|
}
|
|
}
|
|
}
|
|
}).send();
|
|
}
|
|
},
|
|
|
|
Member_Comp: function(item){
|
|
var adata = item.data.split(':');
|
|
$('#MemberID').val(item.value);
|
|
$('#Grup_MemberID').val(adata[0]);
|
|
$('#Info_Member').html(adata[1] || '-');
|
|
$('#Nama_Produk').focus();
|
|
},
|
|
|
|
Produk_Comp: function(item){
|
|
var _qty = FoniaJS.StrToFloat($('#POS_Qty').val());
|
|
var adata = item.data.split(':');
|
|
// M : Grup_Member : Info_Member
|
|
if (adata[0] === 'M') {
|
|
$('#MemberID').val(item.value);
|
|
$('#Nama_Member').val(item.text);
|
|
$('#Grup_MemberID').val(adata[1]);
|
|
$('#Info_Member').html(adata[2] || '-');
|
|
} else {
|
|
// P : Satuan : Varian : Harga_Pokok : Harga_Jual : Stok
|
|
//todo: jika stok kosong tidak simpan !!
|
|
//if (parseInt(adata[5])>0 || _qty<0){
|
|
new Request_JSF({
|
|
url: POSJS.PHP + '/table_detail',
|
|
sendParam: ['mode_detail=insert','No_Jual','InvID='+item.value,'SatuanID='+adata[1],'VarianID='+adata[2],'Qty='+_qty,'Harga_Beli='+adata[3],'Harga_Jual='+adata[4]],
|
|
onSuccess: () => {
|
|
$('#POS_Qty').val('1.00');
|
|
//POLE DISPLAY
|
|
if (POSJS.POLE_CONF.ENABLE){
|
|
POSJS.POLE_DISP.Send([{'t':item.text,'a':'L'},{'t':'Total '+$('#Total_Disp').html(),'a':'R'}]);
|
|
}
|
|
}
|
|
}).send();
|
|
/*} else {
|
|
this.winPesan = FoniaJS.showWindow('Pesan', 'Informasi Barang', '<div class="fs-3 text-center text-danger">Barang tidak tersedia atau habis !</div>', 300, [{},{i:'butTutup'}], () => {
|
|
$('#winPesan').find('#butTutup').click(() => $('#Nama_Produk').focus()).focus();
|
|
});
|
|
}*/
|
|
}
|
|
$('#Nama_Produk').val('').focus();
|
|
},
|
|
|
|
Produk_Key: function(key, val){
|
|
if (key == 13) {
|
|
POSJS.kasir_show();
|
|
} else if (key == 117) {//f6
|
|
POSJS.proses_oc();
|
|
} else if (key == 119) {//f8
|
|
POSJS.produk_add();
|
|
} else if (key == 120) {//f9
|
|
POSJS.produk_brow();
|
|
}
|
|
},
|
|
|
|
Hitung_Detail: function(tipe){
|
|
if (tipe==1) $('#Disk_Persen').val(FoniaJS.FloatToStr((FoniaJS.StrToFloat($('#Disk_Rupiah').val())*100) / FoniaJS.StrToFloat($('#Harga_Jual').val()), 2));
|
|
if (tipe==2) $('#Disk_Rupiah').val(FoniaJS.FloatToStr(FoniaJS.StrToFloat($('#Harga_Jual').val()) * FoniaJS.StrToFloat($('#Disk_Persen').val()) * 0.01, 2));
|
|
$('#Jumlah').val(FoniaJS.FloatToStr(FoniaJS.StrToFloat($('#Qty').val()) * (FoniaJS.StrToFloat($('#Harga_Jual').val()) - FoniaJS.StrToFloat($('#Disk_Rupiah').val())), 2));
|
|
}
|
|
|
|
};
|