first commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Member/BaruController
|
||||
Description : Pembuatan Member Baru
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 8th, 2012.
|
||||
Last Modified : September 27th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var MemberBaruJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(){
|
||||
$('#butTambah').click(() => this.proses_add());
|
||||
$('#butSimpan').click(() => this.proses_save());
|
||||
this.data_query('view');
|
||||
},
|
||||
|
||||
proses_add: function(){
|
||||
this.data_query('add');
|
||||
},
|
||||
|
||||
proses_save: function(){
|
||||
new Request({
|
||||
url: this.PHP + '/proses_simpan',
|
||||
sendParam: ['MemberID','Grup_MemberID','Kode_Member','Nama_Member','Alamat_Member','Kota_Member','Telp_Member','KTP_Member','Tgl_Lahir','Tgl_Daftar'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status == true) {
|
||||
this.data_query('view');
|
||||
FoniaJS.showInfo('Sukses simpan Member Baru!');
|
||||
} else {
|
||||
FoniaJS.showInfo('Ada masalah dalam proses simpan data!');
|
||||
}
|
||||
}
|
||||
}).send()
|
||||
},
|
||||
|
||||
data_query: function(mode){
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: ['mode='+mode],
|
||||
onSuccess: (ajson) => {
|
||||
$('#divMaster').html(ajson.html);
|
||||
if ($.inArray($('#mode').val(), ['add']) !== -1) {
|
||||
$("#butTambah").prop('disabled', true);
|
||||
$("#butSimpan").prop('disabled', false);
|
||||
FoniaJS.setFocus('#Kode_Member');
|
||||
} else {
|
||||
$("#butTambah").prop('disabled', false);
|
||||
$("#butSimpan").prop('disabled', true);
|
||||
}
|
||||
}
|
||||
}).send()
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Member/PointController
|
||||
Description : Informasi Point Member
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 22nd, 2014.
|
||||
Last Modified : September 29th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var MemberPointJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
html5QrcodeScanner: null,
|
||||
|
||||
index: function(){
|
||||
$('#butBrow').click(() => this.member_brow());
|
||||
if (FoniaJS.WEB_MOBILE){
|
||||
html5QrcodeScanner = new Html5Qrcode('qr-reader');
|
||||
html5QrcodeScanner.start({ facingMode: 'environment' }, { fps: 10, qrbox: 250 }, MemberPointJS.ScanSukses);
|
||||
} else {
|
||||
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', [], {'selectFunc': this.Member_Comp});
|
||||
FoniaJS.setFocus('#Nama_Member');
|
||||
}
|
||||
this.data_query('table-point');
|
||||
},
|
||||
|
||||
ScanSukses: function(decodedText, decodedResult){
|
||||
new Request({
|
||||
url: MemberPointJS.PHP + '/scan_member',
|
||||
sendParam: ['Cari_Member='+decodedText],
|
||||
onSuccess: (ajson) => {
|
||||
$('#MemberID').val(ajson.MemberID);
|
||||
$('#Kode_Member').val(ajson.Kode_Member);
|
||||
$('#Nama_Lengkap').val(ajson.Nama_Lengkap);
|
||||
$('#Nama_Grup').val(ajson.Nama_Grup);
|
||||
MemberPointJS.data_query('table-point');
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
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]);
|
||||
$('#Kode_Member').val(acell[1]);
|
||||
$('#Nama_Lengkap').val(acell[2]);
|
||||
$('#Nama_Grup').val(acell[5]);
|
||||
this.data_query('table-point');
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="table-point"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_point',
|
||||
sendParam: ['MemberID']
|
||||
}).send();
|
||||
} else if (tipe=="brow-member"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_member',
|
||||
sendParam: ['Cari_Member'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Member')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Kode_Member').val(adata[0]);
|
||||
$('#Nama_Lengkap').val(item.text);
|
||||
$('#Nama_Grup').val(adata[1]);
|
||||
$('#Nama_Member').val('').focus();
|
||||
MemberPointJS.data_query('table-point');
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,286 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Member/TukarController
|
||||
Description : Transaksi Penukaran Point Member
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 10th, 2017.
|
||||
Last Modified : September 29th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var MemberTukarJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(q){
|
||||
$('#butTambah').click(() => this.tx_tambah());
|
||||
$('#butUbah').click(() => this.tx_ubah());
|
||||
$('#butHapus').click(() => this.tx_hapus());
|
||||
$('#butSimpan').click(() => this.tx_simpan());
|
||||
$('#butBatal').click(() => this.tx_batal());
|
||||
$('#butPrint').click(() => this.tx_print());
|
||||
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
|
||||
},
|
||||
|
||||
tx_brow: function(){
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_TX" 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="divBrowTX"> </div>');
|
||||
this.winBTX = FoniaJS.showWindow('BTX', 'Daftar Transaksi', _isi, 'xl', '', () => {
|
||||
$('#winBTX')
|
||||
.find('#Cari_TX').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key==13 && e.target.value!='') this.data_query('brow-tx');
|
||||
}).end()
|
||||
.find('#butSearch').click(() => this.data_query('brow-tx')).end()
|
||||
.find('#butAll').click(() => {
|
||||
$('#winBTX').find('#Cari_TX').val('');
|
||||
this.data_query('brow-tx');
|
||||
});
|
||||
this.data_query('brow-tx');
|
||||
});
|
||||
},
|
||||
|
||||
tx_select: function(acell){
|
||||
FoniaJS.closeWindow(this.winBTX);
|
||||
$('#No_TX').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_TX').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_TX').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_TX').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_TX').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_TX'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_TX').val('');
|
||||
this.data_query('master', 'view');
|
||||
FoniaJS.showInfo('Proses hapus data sukses!');
|
||||
} else {
|
||||
FoniaJS.showInfo('Ada masalah dalam proses hapus data!');
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}, this, 'DELETE '+$('#No_TX').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
}
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Member !");
|
||||
return;
|
||||
}
|
||||
if ($('#InvPID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Barang !");
|
||||
return;
|
||||
}
|
||||
if (FoniaJS.StrToFloat($('#Qty').val())==0){
|
||||
FoniaJS.showError("Silakan masukkan Nilai Qty !");
|
||||
return;
|
||||
}
|
||||
var spoint = parseInt($('#Sisa_Point').val());
|
||||
var tpoint = parseInt($('#Nilai_Point').val());
|
||||
if (spoint < tpoint) {
|
||||
FoniaJS.showInfo("Sisa Point Member tidak mencukupi !");
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_TX').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(){
|
||||
if ($('#No_TX').val()) {
|
||||
var cetak = new PrinterPos('report/nota/tukarpoint_pos');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_TX').val());
|
||||
cetak.exec();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
member_brow: function(){
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
}
|
||||
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[3]);
|
||||
$('#Sisa_Point').val(acell[6]);
|
||||
},
|
||||
|
||||
barang_brow: function(){
|
||||
if ($('#Point_TipeID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Tipe Point !");
|
||||
return;
|
||||
}
|
||||
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Barang" 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="divBrowBarang"> </div>');
|
||||
this.winBBarang = FoniaJS.showWindow('BBarang', 'Daftar Barang', _isi, 'xl', '', () => {
|
||||
$('#winBBarang')
|
||||
.find('#Cari_Barang').keydown((e) => {
|
||||
var key = e.keyCode || e.which || 0;
|
||||
if (key == 13 && e.target.value != '') this.data_query('brow-barang');
|
||||
}).end()
|
||||
.find('#butSearch').click(() => this.data_query('brow-barang')).end()
|
||||
.find('#butAll').click(() => {
|
||||
$('#winBBarang').find('#Cari_Barang').val('');
|
||||
this.data_query('brow-barang');
|
||||
});
|
||||
this.data_query('brow-barang');
|
||||
});
|
||||
},
|
||||
|
||||
barang_select: function(acell){
|
||||
FoniaJS.closeWindow(this.winBBarang);
|
||||
$('#InvPID').val(acell[0]);
|
||||
$('#Nama_Barang').val(acell[2]);
|
||||
$('#Nilai_Barang').val(acell[3]);
|
||||
$('#Point').val(acell[4]);
|
||||
FoniaJS.setFocus('#Qty');
|
||||
this.Hitung_Point();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_TX'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'No_TX','Tgl_TX','Point_TipeID','InvPID','MemberID','Nilai_Barang','Qty','Point'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', ['Point_TipeID'], {'selectFunc':this.Member_Comp});
|
||||
FoniaJS.AutoComplete('#Nama_Barang', this.PHP + '/auto_barang', ['Point_TipeID'], {'selectFunc':this.Barang_Comp});
|
||||
$('#No_TX').keyup((e) =>{
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_TX")) && ($("#No_TX").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
$('#butBrowMember').click(() => this.member_brow());
|
||||
$('#butBrowBarang').click(() => this.barang_brow());
|
||||
$('#Qty').keyup(() => this.Hitung_Point());
|
||||
if ($.inArray($("#mode").val(),['add','edit']) !== -1) {
|
||||
$('#butBrow').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#butBrowMember').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butBrowBarang').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butTambah').addClass('d-none');
|
||||
$('#butUbah').addClass('d-none');
|
||||
$('#butHapus').addClass('d-none');
|
||||
$('#butPrint').addClass('d-none');
|
||||
$('#butSimpan').removeClass('d-none');
|
||||
$('#butBatal').removeClass('d-none');
|
||||
FoniaJS.setFocus('#Nama_Member');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butBrowMember').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#butBrowBarang').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#butTambah').removeClass('d-none');
|
||||
$('#butUbah').removeClass('d-none');
|
||||
$('#butHapus').removeClass('d-none');
|
||||
$('#butPrint').removeClass('d-none');
|
||||
$('#butSimpan').addClass('d-none');
|
||||
$('#butBatal').addClass('d-none');
|
||||
this.Hitung_Point();
|
||||
FoniaJS.setFocus('#No_TX');
|
||||
}
|
||||
if (FoniaJS.User.Level > 1) {
|
||||
$('#butUbah').prop('disabled', true);
|
||||
$('#butHapus').prop('disabled', true);
|
||||
}
|
||||
if (ajson.error) FoniaJS.showError(ajson.error);
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="brow-tx"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_tx',
|
||||
sendParam: ['Cari_TX'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_TX')
|
||||
}).send();
|
||||
} else if (tipe=="brow-member"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_member',
|
||||
sendParam: ['Cari_Member','Point_TipeID']
|
||||
}).send();
|
||||
} else if (tipe=="brow-barang"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_barang',
|
||||
sendParam: ['Cari_Barang','Point_TipeID'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Barang')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Sisa_Point').val(item.data);
|
||||
$('#Nama_Barang').focus();
|
||||
},
|
||||
|
||||
Barang_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#InvPID').val(item.value);
|
||||
$('#Nilai_Barang').val(adata[1]);
|
||||
$('#Qty').val(1);
|
||||
$('#Point').val(adata[2]);
|
||||
FoniaJS.setFocus('#Qty');
|
||||
this.Hitung_Point();
|
||||
},
|
||||
|
||||
oc_Tipe: function(){
|
||||
//
|
||||
},
|
||||
|
||||
Hitung_Point: function(){
|
||||
var qty = FoniaJS.StrToFloat($('#Qty').val());
|
||||
var point = FoniaJS.StrToFloat($('#Point').val());
|
||||
$('#Nilai_Point').val(FoniaJS.FloatToStr(qty * point,0));
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user