first commit
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Ppob/PpobtxController
|
||||
Description : Transaksi PPOB
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 6th, 2017.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var PPOBTXJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
this.data_query('tabel-detail');
|
||||
$('#Cari_TX').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.data_query('tabel-detail');
|
||||
});
|
||||
$('#butSearch').click(() => this.data_query('tabel-detail'));
|
||||
$('#butAll').click(() => {
|
||||
$('#Cari_TX').val('');
|
||||
this.data_query('tabel-detail');
|
||||
});
|
||||
FoniaJS.setFocus('#Cari_TX');
|
||||
},
|
||||
|
||||
proses_print: function(oc, no_cetak){
|
||||
var cetak = new PrinterPos('report/nota/ppob');
|
||||
cetak.add_param("Nomor_Cetak", no_cetak);
|
||||
cetak.add_param("Open_Cash", oc);
|
||||
cetak.exec();
|
||||
},
|
||||
|
||||
proses_delete: function(no_tx){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['mode_detail=delete','No_TX='+no_tx,'Tgl_From','Tgl_To','Cari_TX']
|
||||
}).send();
|
||||
},
|
||||
|
||||
proses_reproc: function(no_tx){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['mode_detail=reproc','No_TX='+no_tx,'Tgl_From','Tgl_To','Cari_TX']
|
||||
}).send();
|
||||
},
|
||||
|
||||
nota_print: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin cetak ulang Nota "'+acell[0]+'" ?', () => {
|
||||
this.proses_print(0, acell[0]);
|
||||
}, 'info');
|
||||
},
|
||||
|
||||
nota_delete: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Nota "'+acell[0]+'" ?', () => {
|
||||
FoniaJS.showAuth(() => this.proses_delete(acell[0]), this, 'DELETE '+acell[0]);
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
nota_reproc: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin proses ulang "'+acell[0]+'" ?', () => this.proses_reproc(acell[0]), 'warning');
|
||||
},
|
||||
|
||||
nota_detail: function(acell){
|
||||
new Request({
|
||||
url: this.PHP + '/form_tx',
|
||||
sendParam: ['No_TX='+acell[0]],
|
||||
onSuccess: (adata) => {
|
||||
this.winInfo = FoniaJS.showWindow('Info', 'Informasi Transaksi', adata.html, 'md');
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
saldo_ppob: function(){
|
||||
new Request({
|
||||
url: this.PHP + '/form_saldo',
|
||||
onSuccess: (adata) => {
|
||||
var _obtn = $('button:contains("Saldo")');
|
||||
if (_obtn) _obtn.html('<i class="bi-coin me-2"></i>Saldo Rp. '+adata.Saldo);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['Tgl_From','Tgl_To','Cari_TX']
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,306 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Ppob/PrabayarController
|
||||
Description : Transaksi Prabayar PPOB
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 15th, 2017.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var PrabayarJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
POLE_DISP: null,
|
||||
POLE_CONF: {},
|
||||
Simpan: false,
|
||||
KATE_PREFIX: [1,2,3,4],
|
||||
KATE_TOKEN: [5],
|
||||
|
||||
index: function(){
|
||||
$('#Cari_PPOB').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.data_query('tabel-tx');
|
||||
});
|
||||
$('#butSearch').click((e) => this.data_query('tabel-tx'));
|
||||
$('#butAll').click(() => {
|
||||
$('#Cari_PPOB').val('');
|
||||
this.data_query('tabel-tx');
|
||||
});
|
||||
this.data_query('master');
|
||||
//POLE DISPLAY
|
||||
this.data_query('pole-config');
|
||||
},
|
||||
|
||||
proses_print: function(oc, no_cetak){
|
||||
var cetak = new PrinterPos('apps/php/repo/nota.php');
|
||||
cetak.add_param("data", "ppob-pos");
|
||||
cetak.add_param("Nomor_Cetak", no_cetak);
|
||||
cetak.add_param("Open_Cash", oc);
|
||||
cetak.exec();
|
||||
},
|
||||
|
||||
proses_delete: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['mode_detail=delete','No_TX']
|
||||
}).send();
|
||||
},
|
||||
|
||||
proses_reproc: function(ft){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['mode_detail=reproc','No_TX','FT='+ft]
|
||||
}).send();
|
||||
},
|
||||
|
||||
proses_cancel: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Apakah Anda yakin ingin membatalkan ?', () => this.data_query('master','cancel'), 'danger');
|
||||
},
|
||||
|
||||
nota_print: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin ingin cetak ulang Nota "'+acell[0]+'" ?', () => {
|
||||
this.proses_print(0, acell[0]);
|
||||
}, 'info');
|
||||
},
|
||||
|
||||
nota_delete: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Nota "'+acell[0]+'" ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
$('#No_TX').val(acell[0]);
|
||||
this.proses_delete();
|
||||
}, this, 'DELETE '+acell[0]);
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
nota_reproc: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin proses ulang "'+acell[0]+'" ?', () => {
|
||||
$('#No_TX').val(acell[0]);
|
||||
this.proses_reproc();
|
||||
}, 'warning');
|
||||
},
|
||||
|
||||
nota_detail: function(acell){
|
||||
new Request({
|
||||
url: this.PHP + '/form_tx',
|
||||
sendParam: ['No_TX='+acell[0]],
|
||||
onSuccess: (adata) => {
|
||||
this.winInfo = FoniaJS.showWindow('Info', 'Informasi Transaksi', adata.html, 'lg');
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
kasir_show: function(){
|
||||
if ($('#Tujuan').val()=='') {
|
||||
FoniaJS.showInfo('Silahkan masukkan Nomor Tujuan !');
|
||||
FoniaJS.setFocus('#Tujuan');
|
||||
return;
|
||||
}
|
||||
if ($('#ProdukID').val()==0) {
|
||||
FoniaJS.showInfo('Silahkan pilih Jenis Produk !');
|
||||
$('#ProdukID').focus();
|
||||
return;
|
||||
}
|
||||
new Request({
|
||||
url: this.PHP + '/form_kasir',
|
||||
sendParam: ['No_TX','Harga_Jual'],
|
||||
onSuccess: (adata) => {
|
||||
this.winKasir = FoniaJS.showWindow('Kasir', 'Informasi Pembayaran', adata.html, 'lg', '', () => {
|
||||
//POLE DISPLAY
|
||||
if (this.POLE_CONF.ENABLE){
|
||||
this.POLE_DISP.Send([{'t':'Total '+adata.Total_Disp,'a':'C'},{'t':'Tunai / Non Tunai ?','a':'C'}]);
|
||||
}
|
||||
$('#butKBayar').click(() => this.kasir_simpan());
|
||||
$('#butKBatal').click(() => $('#Tujuan').focus());
|
||||
$('#popTotal_Tunai').keyup((e) => {
|
||||
if (13 == e.which && parseFloat(e.target.value) == 0){
|
||||
e.target.value = FoniaJS.FloatToStr($('#Harga_Jual').val());
|
||||
}
|
||||
if (27 == e.which) {
|
||||
FoniaJS.closeWindow(this.winKasir);
|
||||
$('#Tujuan').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($('#Harga_Jual').val()-FoniaJS.StrToFloat($('#popTotal_Tunai').val()));
|
||||
}
|
||||
if (27 == e.which) {
|
||||
FoniaJS.closeWindow(this.winKasir);
|
||||
$('#Tujuan').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($('#Harga_Jual').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(adata.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');
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode){
|
||||
if (tipe=='master'){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_TX'];
|
||||
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'Tujuan','No_HP','KateID','OpeID','ProdukID','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);
|
||||
$('#ppobSIMPAN').click(() => this.kasir_show());
|
||||
$('#ppobBATAL').click(() => this.proses_cancel());
|
||||
this.data_query('tabel-tx');
|
||||
this.oc_KateID();
|
||||
$('#Tujuan').on({
|
||||
keyup: (e) => {
|
||||
if (e.target.value.length == 4 || 13 == e.which) this.oc_Tujuan();
|
||||
},
|
||||
blur: () => this.oc_Tujuan(),
|
||||
click: () => $('#Tujuan').select()
|
||||
});
|
||||
$('#No_HP').click(() => $('#No_HP').select());
|
||||
$('#KateID').focus();
|
||||
if (-1!==$.inArray($('#mode').val(), ['reproc'])){
|
||||
this.proses_reproc(1);
|
||||
if ($.inArray(parseInt($('#KateID').val()), this.KATE_TOKEN) !== -1) {
|
||||
if (socket.active) socket.emit('ppob-check', { 'UserID': FoniaJS.User.UID, 'CabID': FoniaJS.User.CabID });
|
||||
} else {
|
||||
this.proses_print(1, $('#No_TX').val());
|
||||
}
|
||||
//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=='tabel-tx'){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_tx',
|
||||
sendParam: ['Cari_PPOB']
|
||||
}).send();
|
||||
} else if (tipe=='pole-config'){
|
||||
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();
|
||||
}
|
||||
},
|
||||
|
||||
oc_KateID: function(){
|
||||
if ($.inArray(parseInt($('#KateID').val()), this.KATE_TOKEN) !== -1) {
|
||||
$('.rowToken').removeClass('d-none');
|
||||
$('.rowPulsa').addClass('d-none');
|
||||
} else {
|
||||
$('.rowToken').addClass('d-none');
|
||||
$('.rowPulsa').removeClass('d-none');
|
||||
}
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/option_operator',
|
||||
sendParam: ['KateID'],
|
||||
}).send();
|
||||
},
|
||||
|
||||
oc_Tujuan: function(){
|
||||
if ($('#Tujuan').val()=='') return false;
|
||||
if ($.inArray(parseInt($('#KateID').val()), this.KATE_PREFIX) === -1) return false;
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/option_operator',
|
||||
sendParam: ['KateID','Tujuan'],
|
||||
}).send();
|
||||
},
|
||||
|
||||
oc_OpeID: function(){
|
||||
if ($('#OpeID').val()==0) return false;
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/option_produk',
|
||||
sendParam: ['KateID','OpeID'],
|
||||
}).send();
|
||||
},
|
||||
|
||||
oc_ProdukID: function(){
|
||||
const obj = $('#ProdukID');
|
||||
var harga = $(obj).find(":selected").attr('olabel');
|
||||
$('#Harga_Jual').val(harga);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Ppob/TopupController
|
||||
Description : Transaksi Topup Saldo PPOB
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 6th, 2017.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var TopupJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
this.data_query('tabel-detail');
|
||||
$('#butTambah').click(() => this.tx_tambah());
|
||||
$('#Cari_Topup').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.data_query('tabel-detail');
|
||||
});
|
||||
$('#butSearch').click(() => this.data_query('tabel-detail'));
|
||||
$('#butAll').click(() => {
|
||||
$('#Cari_Topup').val('');
|
||||
this.data_query('tabel-detail');
|
||||
});
|
||||
FoniaJS.setFocus('#Cari_Topup');
|
||||
},
|
||||
|
||||
tx_info: function(acell){
|
||||
this.winInfo = FoniaJS.showWindow('', 'Informasi Topup Saldo', '<div class="form-control fs-4">'+acell[6]+'</div>', 'md');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
new Request({
|
||||
url: this.PHP + '/form_topup',
|
||||
onSuccess: (a) => {
|
||||
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Topup Saldo', a.html, 'md', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').click(() => this.tx_simpan()).end()
|
||||
.find('#Jumlah').click(() => $('#Jumlah').select());
|
||||
});
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
if (parseInt($('#Jumlah').val())==0) {
|
||||
FoniaJS.showError('Silakan isi Jumlah lebih dari NOL !');
|
||||
$('#Jumlah').focus();
|
||||
return;
|
||||
}
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode_detail=insert','Tgl_Depo','Jumlah','Bank'],
|
||||
onSuccess: () => FoniaJS.closeWindow(this.winDetail)
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['Cari_Topup']
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user