Refactor function declarations in pos.js to use concise method syntax for improved readability
This commit is contained in:
@@ -373,7 +373,7 @@ class JualController {
|
||||
$ttglnota = $form->datebox("_", "Tgl_Jual", $atabel['Tgl_Jual'], $enable, true);
|
||||
$ttgllunas = $form->datebox("_", "Tgl_Lunas", $atabel['Tgl_Lunas'], false, false);
|
||||
$tcab = $form->option_db("_", "CabID", $atabel['CabID'], $enable, false, "para_cabang", ["CabID","Nama_Cab"], "Aktif=1 ORDER BY Nama_Cab", [0," "]);
|
||||
$tmember = $form->textauto("_", "Nama_Member", ['value'=>$atabel['MemberID'],'text'=>$atabel['Nama_Member']], true, true, "nama member");
|
||||
$tmember = $form->textauto("_", "Nama_Member", ['value'=>$atabel['MemberID'],'text'=>$atabel['Nama_Member']], $enable, true, "nama member");
|
||||
$tpiutang = $form->textbox("_", "Total_Piutang", 0, false, false, "double");
|
||||
$ajson['html'] = '
|
||||
<div class="row">
|
||||
|
||||
+32
-32
@@ -17,7 +17,7 @@ var POSJS = {
|
||||
POLE_CONF: {},
|
||||
Simpan: false,
|
||||
|
||||
index: function(){
|
||||
index() {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Jual','Grup_MemberID'], {'selectFunc': this.Produk_Comp, 'keyFunc': this.Produk_Key, 'breakFocus': true});
|
||||
$('#Nama_Produk').click(() => $('#Nama_Produk').select());
|
||||
$('#POS_Qty').on({
|
||||
@@ -34,20 +34,20 @@ var POSJS = {
|
||||
this.data_query('config-pole');
|
||||
},
|
||||
|
||||
proses_oc: function(){
|
||||
proses_oc() {
|
||||
var cetak = new PrinterPos('report/nota/open_cash');
|
||||
cetak.exec();
|
||||
$('#Nama_Produk').focus();
|
||||
},
|
||||
|
||||
proses_print: function(oc){
|
||||
proses_print(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(){
|
||||
proses_cancel() {
|
||||
if ($('#Total_Item').val()==0) {
|
||||
FoniaJS.showInfo('Tidak ada item barang !');
|
||||
return;
|
||||
@@ -55,7 +55,7 @@ var POSJS = {
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin membatalkan ?<br>Semua item nota ini akan dihapus !', () => this.data_query('master','cancel'), 'danger');
|
||||
},
|
||||
|
||||
nota_brow: function(){
|
||||
nota_brow() {
|
||||
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')
|
||||
@@ -72,7 +72,7 @@ var POSJS = {
|
||||
});
|
||||
},
|
||||
|
||||
nota_print: function(acell){
|
||||
nota_print(acell) {
|
||||
FoniaJS.closeWindow(this.winBNota);
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin cetak ulang Nota "'+acell[0]+'" ?', () => {
|
||||
$('#No_Cetak').val(acell[0]);
|
||||
@@ -80,7 +80,7 @@ var POSJS = {
|
||||
}, 'info');
|
||||
},
|
||||
|
||||
nota_select: function(acell){
|
||||
nota_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBNota);
|
||||
FoniaJS.showAuth(() => {
|
||||
$('#No_Jual').val(acell[0]);
|
||||
@@ -88,7 +88,7 @@ var POSJS = {
|
||||
}, this, 'EDIT POS : '+acell[0]);
|
||||
},
|
||||
|
||||
nota_delete: function(acell){
|
||||
nota_delete(acell) {
|
||||
FoniaJS.closeWindow(this.winBNota);
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Nota "'+acell[0]+'" ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
@@ -98,17 +98,17 @@ var POSJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
pending_brow: function(){
|
||||
pending_brow() {
|
||||
this.winBPend = FoniaJS.showWindow('BPend', 'Daftar Pending POS', '<div id="divBrowPending"> </div>', 'xl', '', () => this.data_query('brow-pending'));
|
||||
},
|
||||
|
||||
pending_select: function(acell){
|
||||
pending_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBPend);
|
||||
$('#No_Jual').val(acell[0]);
|
||||
this.data_query('master', 'pending-edit');
|
||||
},
|
||||
|
||||
pending_delete: function(acell){
|
||||
pending_delete(acell) {
|
||||
FoniaJS.closeWindow(this.winBPend);
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Transaksi Pending "'+acell[0]+'" ?', () => {
|
||||
$('#No_Jual').val(acell[0]);
|
||||
@@ -116,7 +116,7 @@ var POSJS = {
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
member_brow: function(){
|
||||
member_brow() {
|
||||
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')
|
||||
@@ -133,7 +133,7 @@ var POSJS = {
|
||||
});
|
||||
},
|
||||
|
||||
member_select: function(acell){
|
||||
member_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBMember);
|
||||
$('#MemberID').val(acell[0]);
|
||||
$('#Grup_MemberID').val(acell[1]);
|
||||
@@ -142,7 +142,7 @@ var POSJS = {
|
||||
$('#Nama_Produk').focus();
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
produk_brow() {
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Member !");
|
||||
FoniaJS.setFocus('Nama_Member');
|
||||
@@ -164,12 +164,12 @@ var POSJS = {
|
||||
});
|
||||
},
|
||||
|
||||
produk_select: function(acell){
|
||||
produk_select(acell) {
|
||||
FoniaJS.closeWindow(this.winBProduk);
|
||||
this.detail_produk('insert', 0, acell[0], acell[1], acell[2]);
|
||||
},
|
||||
|
||||
detail_produk: function(mode, ID, InvID, SatuanID, VarianID){
|
||||
detail_produk(mode, ID, InvID, SatuanID, VarianID) {
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Member !");
|
||||
FoniaJS.setFocus('Nama_Member');
|
||||
@@ -202,11 +202,11 @@ var POSJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
detail_ubah(acell) {
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
detail_hapus(acell) {
|
||||
new Request_JSF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode_detail=delete','No_Jual','ID='+acell[0]],
|
||||
@@ -220,7 +220,7 @@ var POSJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
detail_simpan() {
|
||||
if (FoniaJS.StrToFloat($('#Disk_Persen').val()) >= 100) {
|
||||
FoniaJS.showInfo('Nilai Diskon diluar batas !');
|
||||
return false;
|
||||
@@ -239,7 +239,7 @@ var POSJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
kasir_show: function(){
|
||||
kasir_show() {
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Member !");
|
||||
FoniaJS.setFocus('Nama_Member');
|
||||
@@ -263,26 +263,26 @@ var POSJS = {
|
||||
$('#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());
|
||||
e.target.value = $('#Total_Nota').val()-FoniaJS.StrToFloat($('#popTotal_Kartu').val());
|
||||
}
|
||||
if (27 == e.which) {
|
||||
FoniaJS.closeWindow(this.winKasir);
|
||||
$('#Nama_Produk').focus();
|
||||
}
|
||||
this.kasir_hitung();
|
||||
if (parseFloat(e.target.value) == 0) return false;
|
||||
//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()));
|
||||
e.target.value = $('#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 (parseFloat(e.target.value) == 0) return false;
|
||||
if (13 == e.which) $('#butKBayar').focus();
|
||||
});
|
||||
$('#popKartuID').change(() => {
|
||||
@@ -310,14 +310,14 @@ var POSJS = {
|
||||
}).send();
|
||||
},
|
||||
|
||||
kasir_hitung: function(){
|
||||
kasir_hitung() {
|
||||
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(){
|
||||
kasir_simpan() {
|
||||
const totTunai = FoniaJS.StrToFloat($('#popTotal_Tunai').val());
|
||||
const totKartu = FoniaJS.StrToFloat($('#popTotal_Kartu').val());
|
||||
const jenKartu = $('#popKartuID').val();
|
||||
@@ -350,12 +350,12 @@ var POSJS = {
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
kasir_pending: function(){
|
||||
kasir_pending() {
|
||||
FoniaJS.closeWindow(this.winKasir);
|
||||
this.data_query('master', 'pending-save');
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
data_query(tipe, mode) {
|
||||
if (tipe=='master'){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_Jual','No_Cetak'];
|
||||
@@ -434,7 +434,7 @@ var POSJS = {
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
Member_Comp(item) {
|
||||
var adata = item.data.split(':');
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Grup_MemberID').val(adata[0]);
|
||||
@@ -442,7 +442,7 @@ var POSJS = {
|
||||
$('#Nama_Produk').focus();
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
Produk_Comp(item) {
|
||||
var _qty = FoniaJS.StrToFloat($('#POS_Qty').val());
|
||||
var adata = item.data.split(':');
|
||||
// M : Grup_Member : Info_Member
|
||||
@@ -475,7 +475,7 @@ var POSJS = {
|
||||
$('#Nama_Produk').val('').focus();
|
||||
},
|
||||
|
||||
Produk_Key: function(key, val){
|
||||
Produk_Key(key, val) {
|
||||
if (key == 13) {
|
||||
POSJS.kasir_show();
|
||||
} else if (key == 117) {//f6
|
||||
@@ -487,7 +487,7 @@ var POSJS = {
|
||||
}
|
||||
},
|
||||
|
||||
Hitung_Detail: function(tipe){
|
||||
Hitung_Detail(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));
|
||||
|
||||
Reference in New Issue
Block a user