first commit
This commit is contained in:
@@ -0,0 +1,444 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/BeliController
|
||||
Description : Transaksi Pembelian
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 22th, 2010.
|
||||
Last Modified : September 20th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var BeliJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(q){
|
||||
$('#butTambah').click(() => this.tx_tambah());
|
||||
$('#butUbah').click(() => this.tx_ubah());
|
||||
$('#butHapus').click(() => this.tx_hapus());
|
||||
$('#butPendingBrow').click(() => this.pending_brow());
|
||||
$('#butPendingSimpan').click(() => this.tx_simpan('pending'));
|
||||
$('#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_Beli').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_Beli').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
if (-1 !== $('#No_Beli').val().search(/BELI/i)){
|
||||
this.data_query('master', 'pending-edit')
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_Beli').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_Beli').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_Beli').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_Beli'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_Beli').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_Beli').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(mode){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
return;
|
||||
}
|
||||
if ($('#SupID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Supplier !");
|
||||
return;
|
||||
}
|
||||
if (mode == 'pending'){
|
||||
this.data_query('master', 'pending-save');
|
||||
return;
|
||||
}
|
||||
if (parseFloat($('#Real_Beli').val())==0){
|
||||
this.total_show();
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_Beli').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(prt){
|
||||
if ($('#No_Beli').val()) {
|
||||
var cetak = new Printer('report/nota/beli');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Beli').val());
|
||||
if (prt) cetak.doPrint(); else cetak.doPreview();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
pending_brow: function(){
|
||||
var _isi = new String('<div id="divBrowPending"> </div>');
|
||||
this.winBPending = FoniaJS.showWindow('BPending', 'Daftar Pending Pembelian', _isi, 'xl', '', () => this.data_query('brow-pending'));
|
||||
},
|
||||
|
||||
pending_select: function(acell){
|
||||
FoniaJS.closeWindow(this.winBPending);
|
||||
$('#No_Beli').val(acell[0]);
|
||||
this.data_query('master', 'pending-edit');
|
||||
},
|
||||
|
||||
pending_delete: function(acell){
|
||||
FoniaJS.closeWindow(this.winBPending);
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus Transaksi Pending "'+acell[0]+'" ?', () => {
|
||||
$('#No_Beli').val(acell[0]);
|
||||
this.data_query('master', 'pending-delete');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
if ($('#SupID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Supplier !");
|
||||
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><input type="hidden" id="Filter_Browse" value="all" /></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(() => {
|
||||
if ($('#Filter_Browse').val()=='filter') {
|
||||
$('#Filter_Browse').val('all');
|
||||
$('#butAll').html('Semua');
|
||||
} else {
|
||||
$('#Filter_Browse').val('filter');
|
||||
$('#butAll').html('Supplier');
|
||||
}
|
||||
$('#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){
|
||||
new Request({
|
||||
url: this.PHP + '/form_produk',
|
||||
sendParam: ['mode','mode_detail='+mode,'No_Beli','ID='+ID,'InvID='+InvID,'SatuanID='+SatuanID,'VarianID='+VarianID],
|
||||
onSuccess: (ajson) => {
|
||||
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Beli','CabID','SupID'], {'selectFunc':this.Produk_Comp});
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').click(() => this.detail_simpan()).end()
|
||||
.find('#Nama_Produk').click(() => $('#Nama_Produk').select()).end()
|
||||
.find('#Qty').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13 && parseInt(e.target.value)>0) FoniaJS.setFocus('#Harga_Beli');
|
||||
}).end()
|
||||
.find('#Harga_Beli').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Rupiah');
|
||||
}).end()
|
||||
.find('#Disk_Rupiah').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Persen1');
|
||||
}).end()
|
||||
.find('#Disk_Persen1').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Persen2');
|
||||
}).end()
|
||||
.find('#Disk_Persen2').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Persen3');
|
||||
}).end()
|
||||
.find('#Disk_Persen3').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Persen4');
|
||||
}).end()
|
||||
.find('#Disk_Persen4').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13) FoniaJS.setFocus('#Disk_Persen5');
|
||||
}).end()
|
||||
.find('#Disk_Persen5').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13 && FoniaJS.StrToFloat($('#Jumlah').val())>0) this.detail_simpan();
|
||||
});
|
||||
if ($('#mode_detail').val() == 'insert') {
|
||||
if ($('#InvID').val() == 0) {
|
||||
FoniaJS.setFocus('#Nama_Produk');
|
||||
} else {
|
||||
this.update_Items();
|
||||
}
|
||||
} else {
|
||||
this.Hitung_Detail();
|
||||
this.update_Varian();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function(){
|
||||
if ($('#SupID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Supplier !");
|
||||
return;
|
||||
}
|
||||
this.detail_produk('insert', 0, 0, 0, 0);
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[5]+'"</strong> ?', () => {
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=delete','No_Beli','ID='+acell[0]],
|
||||
onSuccess: () => {
|
||||
var _obtn = $('button:contains("Total")');
|
||||
if (_obtn) _obtn.removeClass('btn-info').addClass('btn-secondary').attr('id','tombolTotal').html('Hutang : '+FoniaJS.FloatToStr($('#Real_Beli').val(),2));
|
||||
}
|
||||
}).send();
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
if (parseInt($('#InvID').val())==0) {
|
||||
FoniaJS.showError('Silakan masukkan Nama Barang !');
|
||||
return;
|
||||
}
|
||||
var _mdetail = $('#mode_detail').val();
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail','No_Beli','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli','Disk_Rupiah','Disk_Persen1','Disk_Persen2','Disk_Persen3','Disk_Persen4','Disk_Persen5'],
|
||||
onSuccess: () => {
|
||||
var _obtn = $('button:contains("Total")');
|
||||
if (_obtn) _obtn.removeClass('btn-info').addClass('btn-secondary').attr('id','tombolTotal').html('Hutang : '+FoniaJS.FloatToStr($('#Real_Beli').val(),2));
|
||||
if (_mdetail=='insert') { this.detail_tambah(); } else FoniaJS.closeWindow(this.winDetail);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
total_show: function(){
|
||||
if (['add','edit'].indexOf($('#mode').val()) == -1) return false;
|
||||
new Request({
|
||||
url: this.PHP + '/form_total',
|
||||
onSuccess: (ajson) => {
|
||||
this.winTotal = FoniaJS.showWindow('Total', 'Informasi Transaksi', ajson.html, 'md', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
var dhutang = parseFloat($('#Real_Beli').val());
|
||||
if (dhutang == 0) dhutang = parseFloat($('#Total_Beli').val());
|
||||
$('#winTotal')
|
||||
.find('#butWSimpan').click(() => this.total_simpan()).end()
|
||||
.find('#popTotal_Diskon').keyup((e) => {
|
||||
if (e.which==13) FoniaJS.setFocus('#popTotal_Beli');
|
||||
}).end()
|
||||
.find('#popTotal_Beli').keyup((e) => {
|
||||
if (e.which==13) $('#butWSimpan').focus();
|
||||
}).end()
|
||||
.find('#popTotal_Diskon').val($('#Real_Diskon').val()).end()
|
||||
.find('#popTotal_Beli').val(dhutang);
|
||||
FoniaJS.setFocus('#popTotal_Diskon');
|
||||
}, false);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
total_simpan: function(){
|
||||
$('#Real_Diskon').val(FoniaJS.StrToFloat($('#popTotal_Diskon').val()));
|
||||
$('#Real_Beli').val(FoniaJS.StrToFloat($('#popTotal_Beli').val()));
|
||||
$('#tombolTotal').html('<i class="bi-wallet2 me-1"></i>Hutang : '+FoniaJS.FloatToStr($('#Real_Beli').val(),2));
|
||||
FoniaJS.closeWindow(this.winTotal);
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_Beli'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'No_Beli','Tgl_Beli','Tgl_Faktur','No_Faktur','CabID','SupID','Real_Diskon','Real_Beli','PPN'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
$('#No_Beli').keyup((e) =>{
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_Beli")) && ($("#No_Beli").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
$('#No_Faktur').addClass('w-auto');
|
||||
this.data_query('tabel-detail');
|
||||
if ($.inArray($("#mode").val(),['add','edit']) !== -1) {
|
||||
$('#butBrow').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#butTambah').addClass('d-none');
|
||||
$('#butUbah').addClass('d-none');
|
||||
$('#butHapus').addClass('d-none');
|
||||
$('#butPrint').addClass('d-none');
|
||||
$('#butSimpan').removeClass('d-none');
|
||||
$('#butBatal').removeClass('d-none');
|
||||
$('#butPendingBrow').addClass('d-none');
|
||||
$('#butPendingSimpan').addClass('d-none');
|
||||
if (-1 !== $('#No_Beli').val().search(/BELI/i)) $('#butPendingSimpan').removeClass('d-none');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butTambah').removeClass('d-none');
|
||||
$('#butUbah').removeClass('d-none');
|
||||
$('#butHapus').removeClass('d-none');
|
||||
$('#butPrint').removeClass('d-none');
|
||||
$('#butSimpan').addClass('d-none');
|
||||
$('#butBatal').addClass('d-none');
|
||||
$('#butPendingBrow').removeClass('d-none');
|
||||
$('#butPendingSimpan').addClass('d-none');
|
||||
}
|
||||
$('#butUbah').prop('disabled', ($('#Lunas').val()==1 ? true : false));
|
||||
$('#butHapus').prop('disabled', ($('#Lunas').val()==1 ? true : false));
|
||||
if (ajson.error) {
|
||||
FoniaJS.showError(ajson.error);
|
||||
FoniaJS.setFocus('#No_Beli');
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','No_Beli'],
|
||||
onSuccess: () => {
|
||||
var _obtn = $('button:contains("Total")');
|
||||
if (_obtn) _obtn.removeClass('btn-info').addClass('btn-secondary').attr('id','tombolTotal').html('<i class="bi-wallet2 me-1"></i>Hutang : '+FoniaJS.FloatToStr($('#Real_Beli').val(),2));
|
||||
}
|
||||
}).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-pending"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_pending',
|
||||
sendParam: ['Cari_Pending']
|
||||
}).send();
|
||||
} else if (tipe=="brow-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['Cari_Produk','Filter_Browse','SupID'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#InvID').val(item.value);
|
||||
$('#SatuanID').val(adata[0]);
|
||||
$('#Nama_Satuan').val(adata[2]);
|
||||
var _vari = $('#VarianID');
|
||||
_vari.append($('<option>', { value: adata[1], label: adata[1] }));
|
||||
_vari.val(adata[1]).trigger('change');
|
||||
BeliJS.update_Varian();
|
||||
BeliJS.update_Items();
|
||||
},
|
||||
|
||||
update_Items: function(){
|
||||
new Request({
|
||||
url: this.PHP + '/item_detail',
|
||||
sendParam: ['InvID','SatuanID','SupID'],
|
||||
onSuccess: (adata) => {
|
||||
if (adata.data) {
|
||||
var _data = adata.data;
|
||||
$('#Harga_Beli').val(FoniaJS.FloatToStr(_data.Harga_Beli));
|
||||
$('#Disk_Rupiah').val(_data.Disk_Rupiah);
|
||||
$('#Disk_Persen1').val(_data.Disk_Persen1);
|
||||
$('#Disk_Persen2').val(_data.Disk_Persen2);
|
||||
$('#Disk_Persen3').val(_data.Disk_Persen3);
|
||||
$('#Disk_Persen4').val(_data.Disk_Persen4);
|
||||
$('#Disk_Persen5').val(_data.Disk_Persen5);
|
||||
this.Hitung_Detail();
|
||||
}
|
||||
FoniaJS.setFocus('#Qty');
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
update_Varian: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/option_varian',
|
||||
sendParam: ['InvID','SatuanID','VarianID']
|
||||
}).send();
|
||||
},
|
||||
|
||||
Hitung_Detail: function(){
|
||||
var dqty = FoniaJS.StrToFloat($('#Qty').val());
|
||||
var dharga = FoniaJS.StrToFloat($('#Harga_Beli').val());
|
||||
var ddiskrp = FoniaJS.StrToFloat($('#Disk_Rupiah').val());
|
||||
var ddiskp1 = (100.0-FoniaJS.StrToFloat($('#Disk_Persen1').val())) / 100;
|
||||
var ddiskp2 = (100.0-FoniaJS.StrToFloat($('#Disk_Persen2').val())) / 100;
|
||||
var ddiskp3 = (100.0-FoniaJS.StrToFloat($('#Disk_Persen3').val())) / 100;
|
||||
var ddiskp4 = (100.0-FoniaJS.StrToFloat($('#Disk_Persen4').val())) / 100;
|
||||
var ddiskp5 = (100.0-FoniaJS.StrToFloat($('#Disk_Persen5').val())) / 100;
|
||||
var dtot = ((dharga - ddiskrp) * ddiskp1 * ddiskp2 * ddiskp3 * ddiskp4 * ddiskp5) * dqty;
|
||||
var ddis = (dharga * dqty) - dtot;
|
||||
$('#Total_Diskon').val(FoniaJS.FloatToStr(ddis,2));
|
||||
$('#Jumlah').val(FoniaJS.FloatToStr(dtot,2));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,287 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/BelireturController
|
||||
Description : Transaksi Retur Pembelian
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 22th, 2010.
|
||||
Last Modified : September 21st, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var BeliReturJS = {
|
||||
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_Beli').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_Beli').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_Beli').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_Beli').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_Beli').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_Beli'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_Beli').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_Beli').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
return;
|
||||
}
|
||||
if ($('#SupID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Supplier !");
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_Beli').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(prt){
|
||||
if ($('#No_Beli').val()) {
|
||||
var cetak = new Printer('report/nota/beli_retur');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Beli').val());
|
||||
if (prt) cetak.doPrint(); else cetak.doPreview();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
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){
|
||||
new Request({
|
||||
url: this.PHP + '/form_produk',
|
||||
sendParam: ['mode','mode_detail='+mode,'No_Beli','ID='+ID,'InvID='+InvID,'SatuanID='+SatuanID,'VarianID='+VarianID],
|
||||
onSuccess: (ajson) => {
|
||||
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Beli','CabID','SupID'], {'selectFunc': this.Produk_Comp});
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').click(() => this.detail_simpan()).end()
|
||||
.find('#Qty').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (parseFloat(e.target.value) == 0) return false;
|
||||
if (-1!==$.inArray(e.which, [13,9])) FoniaJS.setFocus('#Harga_Beli');
|
||||
}).end()
|
||||
.find('#Harga_Beli').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (e.which==13 && FoniaJS.StrToFloat($('#Jumlah').val())>0) this.detail_simpan();
|
||||
});
|
||||
if ($('#mode_detail').val() == 'insert' && $('#InvID').val() == 0) {
|
||||
FoniaJS.setFocus('#Nama_Produk');
|
||||
} else {
|
||||
this.Hitung_Detail();
|
||||
this.update_Varian();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function(){
|
||||
if ($('#SupID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Supplier !");
|
||||
return;
|
||||
}
|
||||
this.detail_produk('insert', 0, 0, 0, 0);
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[5]+'"</strong> ?', () => {
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=delete','No_Beli','ID='+acell[0]]
|
||||
}).send();
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
if (parseInt($('#InvID').val())==0) {
|
||||
FoniaJS.showError('Silakan masukkan Nama Barang !');
|
||||
return;
|
||||
}
|
||||
var _mdetail = $('#mode_detail').val();
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail','No_Beli','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli'],
|
||||
onSuccess: () => {
|
||||
if (_mdetail=='insert') { this.detail_tambah(); } else FoniaJS.closeWindow(this.winDetail);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
var sparam = ['mode='+mode,'No_Beli'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if ((mode ?? '')=='save') sparam = ['mode='+mode,'No_Beli','Tgl_Beli','No_Faktur','CabID','SupID'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
$('#No_Beli').keyup((e) => {
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_Beli")) && ($("#No_Beli").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
this.data_query('tabel-detail');
|
||||
if ($.inArray($("#mode").val(),['add','edit']) !== -1) {
|
||||
$('#butBrow').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#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('#No_Beli');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butTambah').removeClass('d-none');
|
||||
$('#butUbah').removeClass('d-none');
|
||||
$('#butHapus').removeClass('d-none');
|
||||
$('#butPrint').removeClass('d-none');
|
||||
$('#butSimpan').addClass('d-none');
|
||||
$('#butBatal').addClass('d-none');
|
||||
}
|
||||
if (ajson.error) FoniaJS.showError(ajson.error);
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','No_Beli']
|
||||
}).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-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['CabID','Cari_Produk'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#InvID').val(item.value);
|
||||
$('#SatuanID').val(adata[0]);
|
||||
$('#Nama_Satuan').val(adata[2]);
|
||||
var _vari = $('#VarianID');
|
||||
_vari.append($('<option>', { value: adata[1], label: adata[1] }));
|
||||
_vari.val(adata[1]).trigger('change');
|
||||
BeliReturJS.update_Varian();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
},
|
||||
|
||||
update_Varian: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/option_varian',
|
||||
sendParam: ['InvID','SatuanID','VarianID']
|
||||
}).send();
|
||||
},
|
||||
|
||||
Hitung_Detail: function(){
|
||||
$('#Jumlah').val(FoniaJS.FloatToStr(FoniaJS.StrToFloat($('#Qty').val()) * FoniaJS.StrToFloat($('#Harga_Beli').val()), 2));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,100 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/CekhargaController
|
||||
Description : Informasi Barang & Harga Jual
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 22nd, 2014.
|
||||
Last Modified : September 27th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var CekHargaJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
html5QrcodeScanner: null,
|
||||
|
||||
index: function(){
|
||||
$('#butBrow').click(() => this.produk_brow());
|
||||
if (FoniaJS.WEB_MOBILE){
|
||||
html5QrcodeScanner = new Html5Qrcode('qr-reader');
|
||||
html5QrcodeScanner.start({ facingMode: 'environment' }, { fps: 10, qrbox: 250 }, CekHargaJS.ScanSukses);
|
||||
} else {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', [], {'selectFunc': this.Produk_Comp});
|
||||
FoniaJS.setFocus('#Nama_Produk');
|
||||
}
|
||||
},
|
||||
|
||||
ScanSukses: function(decodedText, decodedResult){
|
||||
new Request({
|
||||
url: CekHargaJS.PHP + '/scan_produk',
|
||||
sendParam: ['Cari_Produk='+decodedText],
|
||||
onSuccess: (ajson) => {
|
||||
$('#InvID').val(ajson.InvID);
|
||||
$('#Kode_Barang').val(ajson.Kode_Barang);
|
||||
$('#Nama_Barang').val(ajson.Nama_Barang);
|
||||
$('#Nama_Satuan').val(ajson.Nama_Satuan);
|
||||
$('#Harga_Jual').val(ajson.Harga_Jual);
|
||||
$('#Nama_Supplier').val(ajson.Nama_Supplier);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
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]);
|
||||
$('#Kode_Barang').val(acell[1]+' / '+acell[2]);
|
||||
$('#Nama_Barang').val(acell[3]);
|
||||
$('#Harga_Jual').val(acell[4]);
|
||||
$('#Nama_Satuan').val(acell[5]);
|
||||
this.update_Sup();
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="brow-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['Cari_Produk'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
$('#InvID').val(item.value);
|
||||
$('#Nama_Barang').val(item.text);
|
||||
$('#Kode_Barang').val(adata[0]);
|
||||
$('#Nama_Satuan').val(adata[1]);
|
||||
$('#Harga_Jual').val(adata[2]);
|
||||
$('#Nama_Produk').val('').focus();
|
||||
CekHargaJS.update_Sup();
|
||||
},
|
||||
|
||||
update_Sup: function(){
|
||||
if (parseInt($('#InvID').val()) == 0) return false;
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/update_sup',
|
||||
sendParam: ['InvID']
|
||||
}).send();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,402 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/JualController
|
||||
Description : Transaksi Penjualan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 22th, 2010.
|
||||
Last Modified : September 27th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var JualJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
|
||||
index: function(q){
|
||||
$('#butTambah').click(() => this.tx_tambah());
|
||||
$('#butUbah').click(() => this.tx_ubah());
|
||||
$('#butHapus').click(() => this.tx_hapus());
|
||||
$('#butPendingBrow').click(() => this.pending_brow());
|
||||
$('#butPendingSimpan').click(() => this.tx_simpan('pending'));
|
||||
$('#butSimpan').click(() => this.tx_simpan());
|
||||
$('#butBatal').click(() => this.tx_batal());
|
||||
$('#printNota').click(() => this.tx_print());
|
||||
$('#printPOS').click(() => this.tx_print_pos());
|
||||
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_Jual').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_Jual').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
if (-1 !== $('#No_Jual').val().search(/JUAL/i)){
|
||||
this.data_query('master', 'pending-edit')
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_Jual').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_Jual').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_Jual').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_Jual','MemberID'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_Jual').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_Jual').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(mode){
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan Nama Member !");
|
||||
return;
|
||||
}
|
||||
if (mode == 'pending'){
|
||||
this.data_query('master', 'pending-save');
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_Jual').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(prt){
|
||||
if ($('#No_Jual').val()) {
|
||||
var cetak = new Printer('report/nota/jual');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Jual').val());
|
||||
if (prt) cetak.doPrint(); else cetak.doPreview();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
tx_print_pos: function(){
|
||||
if ($('#No_Jual').val()) {
|
||||
var cetak = new PrinterPos('report/nota/pos');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Jual').val());
|
||||
cetak.exec();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
pending_brow: function(){
|
||||
this.winBPending = FoniaJS.showWindow('BPending', 'Daftar Pending Penjualan', '<div id="divBrowPending"> </div>', 'xl', '', () => this.data_query('brow-pending'));
|
||||
},
|
||||
|
||||
pending_select: function(acell){
|
||||
FoniaJS.closeWindow(this.winBPending);
|
||||
$('#No_Jual').val(acell[0]);
|
||||
this.data_query('master', 'pending-edit');
|
||||
},
|
||||
|
||||
pending_delete: function(acell){
|
||||
FoniaJS.closeWindow(this.winBPending);
|
||||
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]);
|
||||
this.update_Piutang();
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
if ($('#MemberID').val()==0){
|
||||
FoniaJS.showError("Silakan masukkan 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','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:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').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 (e.which==13 && 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){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[5]+'"</strong> ?', () => {
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=delete','No_Jual','ID='+acell[0]],
|
||||
onSuccess: () => $('#Nama_Produk').focus()
|
||||
}).send();
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
if (FoniaJS.StrToFloat($('#Disk_Persen').val()) >= 100) {
|
||||
FoniaJS.showInfo('Nilai Diskon diluar batas !');
|
||||
return false;
|
||||
}
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail','No_Jual','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli','Harga_Jual','Disk_Rupiah','Disk_Persen'],
|
||||
onSuccess: () => {
|
||||
FoniaJS.closeWindow(this.winDetail);
|
||||
$('#Nama_Produk').val('').focus();
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
mode = (mode) ? mode : '';
|
||||
var sparam = ['mode='+mode,'No_Jual'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'No_Jual','Tgl_Jual','CabID','MemberID'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
FoniaJS.AutoComplete('#Nama_Member', this.PHP + '/auto_member', [], {'selectFunc':this.Member_Comp});
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Jual','CabID','Grup_MemberID'], {'selectFunc':this.Produk_Comp});
|
||||
$('#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()
|
||||
});
|
||||
$('#No_Jual').keyup((e) =>{
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_Jual")) && ($("#No_Jual").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
$('#butBrowMember').click(() => this.member_brow());
|
||||
$('#Nama_Member').click(() => $('#Nama_Member').select());
|
||||
this.data_query('tabel-detail');
|
||||
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');
|
||||
$('#butTambah').addClass('d-none');
|
||||
$('#butUbah').addClass('d-none');
|
||||
$('#butHapus').addClass('d-none');
|
||||
$('#butPrint').addClass('d-none');
|
||||
$('#butSimpan').removeClass('d-none');
|
||||
$('#butBatal').removeClass('d-none');
|
||||
$('#butPendingBrow').addClass('d-none');
|
||||
$('#butPendingSimpan').addClass('d-none');
|
||||
if (-1 !== $('#No_Jual').val().search(/JUAL/i)) $('#butPendingSimpan').removeClass('d-none');
|
||||
if ($('#Nama_Member').val() === '') { FoniaJS.setFocus('#Nama_Member'); }
|
||||
else FoniaJS.setFocus('#Nama_Produk');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butBrowMember').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');
|
||||
$('#butPendingBrow').removeClass('d-none');
|
||||
$('#butPendingSimpan').addClass('d-none');
|
||||
FoniaJS.setFocus('#No_Jual');
|
||||
}
|
||||
$('#butUbah').prop('disabled', ($('#Lunas').val()==1 ? true : false));
|
||||
$('#butHapus').prop('disabled', ($('#Lunas').val()==1 ? true : false));
|
||||
if (ajson.error) FoniaJS.showError(ajson.error);
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','No_Jual']
|
||||
}).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-pending"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_pending',
|
||||
}).send();
|
||||
} else 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','Grup_MemberID'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Member_Comp: function(item){
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Grup_MemberID').val(item.data);
|
||||
JualJS.update_Piutang();
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var _qty = FoniaJS.StrToFloat($('#POS_Qty').val());
|
||||
var adata = item.data.split(':');
|
||||
// M : Grup_Member
|
||||
if (adata[0] === 'M') {
|
||||
$('#MemberID').val(item.value);
|
||||
$('#Nama_Member').val(item.text);
|
||||
$('#Grup_MemberID').val(adata[1]);
|
||||
} else {
|
||||
// P : Satuan : Varian : Harga_Pokok : Harga_Jual : Stok
|
||||
//todo: jika stok kosong tidak simpan !!
|
||||
//if (parseInt(adata[5])>0 || _qty<0){
|
||||
new Request.JSONF({
|
||||
url: JualJS.PHP + '/table_detail',
|
||||
sendParam: ['mode','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')
|
||||
}).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();
|
||||
},
|
||||
|
||||
update_Piutang: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/update_piutang',
|
||||
sendParam: ['MemberID'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Nama_Produk')
|
||||
}).send();
|
||||
},
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,291 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/MutasiController
|
||||
Description : Transaksi Mutasi Stok Antar Cabang
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 28th, 2011.
|
||||
Last Modified : September 28th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var MutasiJS = {
|
||||
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());
|
||||
$('#printNota').click(() => this.tx_print());
|
||||
$('#printPOS').click(() => this.tx_print_pos());
|
||||
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_Mutasi').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_Mutasi').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(function(){this.data_query('master', 'edit')}.bind(this), this, 'EDIT '+$('#No_Mutasi').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_Mutasi').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_Mutasi').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_Mutasi'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_Mutasi').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_Mutasi').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
if ($('#Dari_CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Dari Cabang !");
|
||||
return;
|
||||
}
|
||||
if ($('#Ke_CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Ke Cabang !");
|
||||
return;
|
||||
}
|
||||
if ($('#Dari_CabID').val()==$('#Ke_CabID').val()){
|
||||
FoniaJS.showError("Dari Cabang dan Ke Cabang tidak boleh sama !");
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_Mutasi').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(prt){
|
||||
if ($('#No_Mutasi').val()) {
|
||||
var cetak = new Printer('report/nota/mutasi');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Mutasi').val());
|
||||
if (prt) cetak.doPrint(); else cetak.doPreview();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
tx_print_pos: function(){
|
||||
if ($('#No_Mutasi').val()) {
|
||||
var cetak = new PrinterPos('report/nota/mutasi_pos');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Mutasi').val());
|
||||
cetak.exec();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
if ($('#Dari_CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Dari Cabang !");
|
||||
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){
|
||||
new Request({
|
||||
url: this.PHP + '/form_produk',
|
||||
sendParam: ['mode','mode_detail='+mode,'No_Mutasi','ID='+ID,'InvID='+InvID,'SatuanID='+SatuanID,'VarianID='+VarianID],
|
||||
onSuccess: (ajson) => {
|
||||
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').click(() => this.detail_simpan()).end()
|
||||
.find('#butBatal').click(() => $('#Nama_Produk').focus()).end()
|
||||
.find('#Qty').keyup((e) => {
|
||||
this.Hitung_Detail();
|
||||
if (parseFloat(e.target.value) == 0) return false;
|
||||
if (-1!==$.inArray(e.which, [13,9])) this.detail_simpan();
|
||||
});
|
||||
this.Hitung_Detail();
|
||||
FoniaJS.setFocus('#Qty');
|
||||
});
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[5]+'"</strong> ?', () => {
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=delete','No_Mutasi','ID='+acell[0]],
|
||||
onSuccess: () => $('#Nama_Produk').focus()
|
||||
}).send();
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail','No_Mutasi','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli','Dari_CabID','Ke_CabID'],
|
||||
onSuccess: () => {
|
||||
FoniaJS.closeWindow(this.winDetail);
|
||||
$('#Nama_Produk').val('').focus();
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
var sparam = ['mode='+mode,'No_Mutasi'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if ((mode ?? '')=='save') sparam = ['mode='+mode,'No_Mutasi','Tgl_Mutasi','Dari_CabID','Ke_CabID','Catatan'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Mutasi','Dari_CabID'], {'selectFunc':this.Produk_Comp});
|
||||
$('#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()
|
||||
});
|
||||
$('#No_Mutasi').keyup((e) => {
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_Mutasi")) && ($("#No_Mutasi").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
this.data_query('tabel-detail');
|
||||
if ($.inArray($("#mode").val(),['add','edit']) !== -1) {
|
||||
$('#butBrow').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#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_Produk');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butTambah').removeClass('d-none');
|
||||
$('#butUbah').removeClass('d-none');
|
||||
$('#butHapus').removeClass('d-none');
|
||||
$('#butPrint').removeClass('d-none');
|
||||
$('#butSimpan').addClass('d-none');
|
||||
$('#butBatal').addClass('d-none');
|
||||
FoniaJS.setFocus('#No_Mutasi');
|
||||
}
|
||||
if (ajson.error) FoniaJS.showError(ajson.error);
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','No_Mutasi']
|
||||
}).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-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['Cari_Produk','Dari_CabID'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
if ($('#Dari_CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Dari Cabang !");
|
||||
return;
|
||||
}
|
||||
var _qty = FoniaJS.StrToFloat($('#POS_Qty').val());
|
||||
var adata = item.data.split(':');
|
||||
// Satuan : Varian : Harga_Pokok
|
||||
new Request.JSONF({
|
||||
url: MutasiJS.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=insert','No_Mutasi','InvID='+item.value,'SatuanID='+adata[0],'VarianID='+adata[1],'Qty='+_qty,'Harga_Beli='+adata[2]],
|
||||
onSuccess: () => $('#POS_Qty').val('1.00')
|
||||
}).send();
|
||||
$('#Nama_Produk').val('').focus();
|
||||
},
|
||||
|
||||
Hitung_Detail: function(){
|
||||
$('#Jumlah').val(FoniaJS.FloatToStr(FoniaJS.StrToFloat($('#Qty').val()) * FoniaJS.StrToFloat($('#Harga_Beli').val()), 2));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,266 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/OpnameController
|
||||
Description : Transaksi Opname Stok
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 24th, 2010.
|
||||
Last Modified : September 28th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var OpnameJS = {
|
||||
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_Opname').val(acell[0]);
|
||||
this.data_query('master', 'view');
|
||||
},
|
||||
|
||||
tx_tambah: function(){
|
||||
this.data_query('master', 'add');
|
||||
},
|
||||
|
||||
tx_ubah: function(){
|
||||
if (!$('#No_Opname').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showAuth(() => this.data_query('master', 'edit'), this, 'EDIT '+$('#No_Opname').val());
|
||||
},
|
||||
|
||||
tx_hapus: function(){
|
||||
if (!$('#No_Opname').val()){
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
return;
|
||||
}
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#No_Opname').val()+'</strong> ?', () => {
|
||||
FoniaJS.showAuth(() => {
|
||||
new Request({
|
||||
url: this.PHP + '/proses_delete',
|
||||
sendParam: ['No_Opname'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
$('#No_Opname').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_Opname').val());
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_simpan: function(){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
return;
|
||||
}
|
||||
this.data_query('master', 'save');
|
||||
},
|
||||
|
||||
tx_batal: function(){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
|
||||
this.data_query('master', 'cancel');
|
||||
$('#No_Opname').val('');
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
tx_print: function(prt){
|
||||
if ($('#No_Opname').val()) {
|
||||
var cetak = new Printer('report/nota/opname');
|
||||
cetak.add_param("Nomor_Cetak", $('#No_Opname').val());
|
||||
if (prt) cetak.doPrint(); else cetak.doPreview();
|
||||
return;
|
||||
}
|
||||
FoniaJS.showError("Silakan masukkan Nomor Transaksi !");
|
||||
},
|
||||
|
||||
produk_brow: function(){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
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){
|
||||
new Request({
|
||||
url: this.PHP + '/form_produk',
|
||||
sendParam: ['mode','mode_detail='+mode,'No_Opname','ID='+ID,'InvID='+InvID,'SatuanID='+SatuanID,'VarianIID='+VarianID],
|
||||
onSuccess: (ajson) => {
|
||||
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang', ajson.html, 'lg', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['No_Opname','CabID'], {'selectFunc': this.Produk_Comp});
|
||||
$('#winDetail')
|
||||
.find('#butWSimpan').click(() => this.detail_simpan()).end()
|
||||
.find('#Qty').keyup((e) => {
|
||||
if (parseFloat(e.target.value) == 0) return false;
|
||||
if (-1!==$.inArray(e.which, [13,9])) this.detail_simpan();
|
||||
});
|
||||
if ($('#mode_detail').val() == 'insert' && $('#InvID').val() == 0) {
|
||||
FoniaJS.setFocus('#Nama_Produk');
|
||||
} else {
|
||||
FoniaJS.setFocus('#Qty');
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
detail_tambah: function(){
|
||||
if ($('#CabID').val()==0){
|
||||
FoniaJS.showError("Silakan pilih Nama Cabang !");
|
||||
return;
|
||||
}
|
||||
this.detail_produk('insert', 0, 0, 0, 0);
|
||||
},
|
||||
|
||||
detail_ubah: function(acell){
|
||||
this.detail_produk('update', acell[0], acell[1], acell[2], acell[3]);
|
||||
},
|
||||
|
||||
detail_hapus: function(acell){
|
||||
FoniaJS.showConfirm('Konfirmasi', 'Hapus item <strong>"'+acell[2]+'"</strong> ?', () => {
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail=delete','No_Opname','ID='+acell[0]]
|
||||
}).send();
|
||||
}, 'danger');
|
||||
},
|
||||
|
||||
detail_simpan: function(){
|
||||
if (parseInt($('#InvID').val())==0) {
|
||||
FoniaJS.showError('Silakan masukkan Nama Barang !');
|
||||
return;
|
||||
}
|
||||
var _mdetail = $('#mode_detail').val();
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','mode_detail','No_Opname','CabID','ID','InvID','SatuanID','VarianID','Qty','Harga_Beli'],
|
||||
onSuccess: () => {
|
||||
if (_mdetail=='insert') { this.detail_tambah(); } else FoniaJS.closeWindow(this.winDetail);
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
data_query: function(tipe, mode, kd_tx){
|
||||
if (tipe=="master"){
|
||||
var sparam = ['mode='+mode,'No_Opname'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
|
||||
if ((mode ?? '')=='save') sparam = ['mode='+mode,'No_Opname','Tgl_Opname','CabID','Catatan'];
|
||||
new Request({
|
||||
url: this.PHP + '/form_master',
|
||||
sendParam: sparam,
|
||||
onSuccess: (ajson) => {
|
||||
$('#divTXMaster').html(ajson.html);
|
||||
$('#No_Opname').keyup((e) => {
|
||||
if ((e.which || e.keyCode) == 13) {
|
||||
if (($("#No_Opname")) && ($("#No_Opname").val() !== '')) this.data_query('master');
|
||||
}
|
||||
});
|
||||
$('#butBrow').click(() => this.tx_brow());
|
||||
this.data_query('tabel-detail');
|
||||
if ($.inArray($("#mode").val(),['add','edit']) !== -1) {
|
||||
$('#butBrow').prop('disabled', true).removeClass('btn-info').addClass('btn-secondary');
|
||||
$('#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('#No_Opname');
|
||||
} else {
|
||||
$('#butBrow').prop('disabled', false).removeClass('btn-secondary').addClass('btn-info');
|
||||
$('#butTambah').removeClass('d-none');
|
||||
$('#butUbah').removeClass('d-none');
|
||||
$('#butHapus').removeClass('d-none');
|
||||
$('#butPrint').removeClass('d-none');
|
||||
$('#butSimpan').addClass('d-none');
|
||||
$('#butBatal').addClass('d-none');
|
||||
}
|
||||
if (ajson.error) FoniaJS.showError(ajson.error);
|
||||
}
|
||||
}).send();
|
||||
} else if (tipe=="tabel-detail"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['mode','No_Opname']
|
||||
}).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-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['CabID','Cari_Produk'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
var adata = item.data.split(':');
|
||||
// Satuan : Varian : Harga_Pokok : Satuan : Stok
|
||||
$('#InvID').val(item.value);
|
||||
$('#SatuanID').val(adata[0]);
|
||||
$('#VarianID').val(adata[1]);
|
||||
$('#Harga_Beli').val(adata[2]);
|
||||
$('#Nama_Satuan1').val(adata[3]);
|
||||
$('#Nama_Satuan2').val(adata[3]);
|
||||
$('#Stok').val(adata[4]);
|
||||
FoniaJS.setFocus('#Qty');
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Inv/OpnamebarangController
|
||||
Description : Transaksi Penyesuaian Stok Per Barang
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : October 22nd, 2014.
|
||||
Last Modified : October 11th, 2026, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var OpnameBarangJS = {
|
||||
PHP: '',
|
||||
KODE: '',
|
||||
html5QrcodeScanner: null,
|
||||
|
||||
index: function(){
|
||||
$('#butSimpan').click(() => this.proses_save());
|
||||
$('#butBrow').click(() => this.produk_brow());
|
||||
if (FoniaJS.WEB_MOBILE){
|
||||
//html5QrcodeScanner = new Html5QrcodeScanner('qr-reader', { fps: 10, qrbox: 250, rememberLastUsedCamera: true, supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA] });
|
||||
html5QrcodeScanner = new Html5Qrcode('qr-reader');
|
||||
html5QrcodeScanner.start({ facingMode: 'environment' }, { fps: 10, qrbox: 250 }, OpnameBarangJS.ScanSukses);
|
||||
} else {
|
||||
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', [], {'selectFunc': this.Produk_Comp});
|
||||
FoniaJS.setFocus('#Nama_Produk');
|
||||
}
|
||||
},
|
||||
|
||||
proses_save: function(){
|
||||
if ($('#InvID').val()==0) {
|
||||
FoniaJS.showError('Silakan masukkan Nama Produk!');
|
||||
return;
|
||||
}
|
||||
new Request({
|
||||
url: this.PHP + '/proses_simpan',
|
||||
sendParam: ['InvID','SatuanID','VarianID','Stok_Fisik','Harga_Beli','PPN'],
|
||||
onSuccess: (ajson) => {
|
||||
if (ajson.status === true){
|
||||
FoniaJS.showInfo('Sukses simpan penyesuaian Stok !');
|
||||
$('#InvID, #SatuanID, #VarianID, #Harga_Beli #PPN').val(0);
|
||||
$('#Nama_Produk, #Kode_Barang, #Nama_Barang, #Nama_Satuan').val('');
|
||||
$('#Stok_Sistem, #Stok_Fisik').val('0.00');
|
||||
if (FoniaJS.WEB_MOBILE){
|
||||
this.html5QrcodeScanner.resume();
|
||||
} else FoniaJS.setFocus('Nama_Produk');
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
},
|
||||
|
||||
ScanSukses: function(decodedText, decodedResult){
|
||||
new Request({
|
||||
url: OpnameBarangJS.PHP + '/scan_produk',
|
||||
sendParam: ['Cari_Produk='+decodedText],
|
||||
onSuccess: (ajson) => {
|
||||
$('#InvID').val(ajson.InvID);
|
||||
$('#SatuanID').val(ajson.SatuanID);
|
||||
$('#VarianID').val(ajson.VarianID);
|
||||
$('#Harga_Beli').val(ajson.Harga_Beli);
|
||||
$('#Kode_Barang').val(ajson.Kode_Barang);
|
||||
$('#Nama_Barang').val(ajson.Nama_Barang);
|
||||
$('#Nama_Satuan').val(ajson.Nama_Satuan);
|
||||
$('#Stok_Sistem').val(ajson.Stok_Sistem);
|
||||
$('#PPN').val(ajson.PPN);
|
||||
FoniaJS.setFocus('#Stok_Fisik');
|
||||
}
|
||||
}).send();
|
||||
this.html5QrcodeScanner.pause();
|
||||
},
|
||||
|
||||
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]);
|
||||
$('#SatuanID').val(acell[1]);
|
||||
$('#VarianID').val(acell[2]);
|
||||
$('#Harga_Beli').val(acell[7]);
|
||||
$('#Kode_Barang').val(acell[3]+' / '+acell[4]);
|
||||
$('#Nama_Barang').val(acell[5]);
|
||||
$('#Nama_Satuan').val(acell[6]);
|
||||
$('#Stok_Sistem').val(acell[8]);
|
||||
$('#PPN').val(acell[9]);
|
||||
FoniaJS.setFocus('#Stok_Fisik');
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=="brow-produk"){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_produk',
|
||||
sendParam: ['Cari_Produk'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
|
||||
}).send();
|
||||
}
|
||||
},
|
||||
|
||||
Produk_Comp: function(item){
|
||||
// Cari by SKU + Barcode
|
||||
// Satuan : Varian : SKU + Barcode : Harga_Pokok : Satuan : PPN : Stok
|
||||
var adata = item.data.split(':');
|
||||
$('#InvID').val(item.value);
|
||||
$('#SatuanID').val(adata[0]);
|
||||
$('#VarianID').val(adata[1]);
|
||||
$('#Harga_Beli').val(adata[3]);
|
||||
$('#Kode_Barang').val(adata[2]);
|
||||
$('#Nama_Barang').val(item.text);
|
||||
$('#Nama_Satuan').val(adata[4]);
|
||||
$('#Stok_Sistem').val(adata[6]);
|
||||
$('#PPN').val(adata[5]);
|
||||
FoniaJS.setFocus('#Stok_Fisik');
|
||||
}
|
||||
|
||||
};
|
||||
@@ -0,0 +1,496 @@
|
||||
/*******************************************************************
|
||||
|
||||
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.JSONF({
|
||||
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.JSONF({
|
||||
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.JSONF({
|
||||
url: this.PHP + '/table_detail',
|
||||
sendParam: ['No_Jual']
|
||||
}).send();
|
||||
} else if (tipe=='brow-nota'){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_nota',
|
||||
sendParam: ['Cari_Nota'],
|
||||
onSuccess: () => FoniaJS.setFocus('#Cari_Nota')
|
||||
}).send();
|
||||
} else if (tipe=='brow-pending'){
|
||||
new Request.JSONF({
|
||||
url: this.PHP + '/brow_pending',
|
||||
}).send();
|
||||
} else 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','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.JSONF({
|
||||
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));
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user