first commit

This commit is contained in:
2026-10-29 13:34:31 +07:00
commit 45e4595c57
255 changed files with 35457 additions and 0 deletions
+170
View File
@@ -0,0 +1,170 @@
/*******************************************************************
PHP Class : /Controller/Promo/BarangController
Description : Konfigurasi Promo Penjualan Barang
Created By : Siau Pheng ([email protected]).
Created Date : September 28th, 2014.
Last Modified : September 2nd, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PromoBarangJS = {
PHP: '',
KODE: '',
index: function(){
this.data_query('detail');
$('#Cari_Promo').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('detail');
});
$('#butSearch').click(() => this.data_query('detail'));
$('#butAll').click(() => {
$('#Cari_Promo').val('');
this.data_query('detail');
});
FoniaJS.setFocus('#Cari_Promo');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP + '/form_promo',
sendParam: ['mode_detail='+mode,'PromoID='+ID],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Promo', ajson.html, 'xl', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail')
.find('#butWSimpan').click(() => this.detail_save()).end()
.find('#butBrow1').click(() => this.produk_brow(1)).end()
.find('#butBrow2').click(() => this.produk_brow(2));
if ($.inArray($("#mode_detail").val(),['insert','update']) !== -1) {
this.update_Items($('#InvID').val(), $('#SatuanID').val(), 1);
this.update_Items($('#Promo_InvID').val(), $('#Promo_SatuanID').val(), 2);
this.oc_PilihQ();
this.oc_PilihP();
}
});
}
}).send();
},
detail_tambah: function(){
this.detail_show('insert', 0);
},
detail_ubah: function(acell){
this.detail_show('update', acell[0]);
},
detail_hapus: function(acell){
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['mode_detail=delete','PromoID='+acell[0],'Cari_Promo'],
onSuccess: () => FoniaJS.showInfo('Proses hapus data sukses!')
}).send();
}, 'danger');
},
detail_save: function(){
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['mode_detail','PromoID','InvID','SatuanID','CabID','Grup_MemberID','Pilih_Qty','Qty_Min','Qty_Kali','Tipe_Promo','Promo_Disc','Promo_InvID','Promo_SatuanID','Promo_Qty','Jumlah_Promo','Tgl_Mulai','Tgl_Akhir','Aktif','Cari_Promo'],
onSuccess: () => {
FoniaJS.showInfo('Proses simpan data sukses!');
FoniaJS.closeWindow(this.winDetail);
}
}).send();
},
produk_brow: function(tipe){
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="Tipe_Brow" value="'+tipe+'" /></div></div></div><div id="divBrowProduk">&nbsp;</div>');
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'lg', '', () => {
$('#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');
FoniaJS.setFocus('#Cari_Produk');
});
},
produk_select: function(acell){
FoniaJS.closeWindow(this.winBProduk);
var itipe = parseInt($('#Tipe_Brow').val());
if (itipe == 1){
$('#InvID').val(acell[0]);
$('#Nama_Produk').val(acell[1]);
this.update_Items(acell[0], 0, 1);
} else {
$('#Promo_InvID').val(acell[0]);
$('#Promo_Produk').val(acell[1]);
this.update_Items(acell[0], 0, 2);
}
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['Cari_Promo']
}).send();
} else if (tipe=="brow-produk"){
new Request.JSONF({
url: this.PHP + '/brow_produk',
sendParam: ['Cari_Produk'],
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
}).send();
}
},
update_Items: function(InvID, SatuanID, Tipe){
const elSatuan = (Tipe==1) ? $('#SatuanID') : $('#Promo_SatuanID');
elSatuan.empty();
if (InvID==0) return false;
new Request({
url: this.PHP + '/item_detail',
sendParam: ['InvID='+InvID],
onSuccess: (adata) => {
adata.map((val) => {
elSatuan.append(new Option(val['label'],val['value'],false,(val['value']==SatuanID?true:false)))
});
elSatuan.trigger('change');
}
}).send();
},
oc_PilihQ: function(){
var i = parseInt($('#Pilih_Qty').val());
if (i == 1){
$('#Qty_Min').prop('disabled', false);
$('#Qty_Kali').prop('disabled', true).val(0);
} else {
$('#Qty_Min').prop('disabled', true).val(0);
$('#Qty_Kali').prop('disabled', false);
}
},
oc_PilihP: function(){
var i = parseInt($('#Tipe_Promo').val());
if (i == 1){
$('.promo1').removeClass('d-none');
$('.promo2').addClass('d-none');
$('#Promo_SatuanID').val(0);
$('#Promo_Qty').val(0);
$('#Promo_InvID').val(0);
} else {
$('.promo1').addClass('d-none');
$('.promo2').removeClass('d-none');
$('#Promo_Disc').val(0);
}
}
};
+238
View File
@@ -0,0 +1,238 @@
/*******************************************************************
PHP Class : /Controller/Promo/BelidiscController
Description : Promo Beli & Diskon
Created By : Siau Pheng ([email protected]).
Created Date : September 28th, 2014.
Last Modified : October 29th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PromoBeliDiscJS = {
PHP: '',
KODE: '',
index: function(q){
$('#butTambah').click(() => this.promo_tambah());
$('#butUbah').click(() => this.promo_ubah());
$('#butHapus').click(() => this.promo_hapus());
$('#butSimpan').click(() => this.promo_simpan());
$('#butBatal').click(() => this.promo_batal());
this.data_query('master', 'view', ((typeof(q)!=='undefined') ? q : ''));
},
promo_brow: function(){
var _isi = new String('<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Promo" 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="divBrowPromo">&nbsp;</div>');
this.winBPromo = FoniaJS.showWindow('BPromo', 'Daftar Promo', _isi, 'xl', '', () => {
$('#winBPromo')
.find('#Cari_Promo').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('brow-promo');
}).end()
.find('#butSearch').click(() => this.data_query('brow-promo')).end()
.find('#butAll').click(() => {
$('#winBPromo').find('#Cari_Promo').val('');
this.data_query('brow-promo');
});
this.data_query('brow-promo');
});
},
promo_select: function(acell){
FoniaJS.closeWindow(this.winBPromo);
$('#Grup_PromoID').val(acell[0]);
this.data_query('master', 'view');
},
promo_tambah: function(){
this.data_query('master', 'add');
},
promo_ubah: function(){
if ($('#Grup_PromoID').val() == 0){
FoniaJS.showError("Silakan pilih Nama Promo !");
return;
}
this.data_query('master', 'edit');
},
promo_hapus: function(){
if ($('#Grup_PromoID').val() == 0){
FoniaJS.showError("Silakan pilih Nama Promo !");
return;
}
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <strong>'+$('#Promo_Nama').val()+'</strong> ?', () => {
new Request({
url: this.PHP + '/proses_delete',
sendParam: ['Grup_PromoID'],
onSuccess: (ajson) => {
if (ajson.status === true){
$('#Grup_PromoID').val(0);
this.data_query('master', 'view');
FoniaJS.showInfo('Proses hapus data sukses!');
} else {
FoniaJS.showInfo('Ada masalah dalam proses hapus data!');
}
}
}).send();
}, 'danger');
},
promo_simpan: function(mode){
this.data_query('master', 'save');
},
promo_batal: function(){
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan membatalkan ?', () => {
this.data_query('master', 'cancel');
$('#Grup_PromoID').val(0);
}, 'danger');
},
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">&nbsp;</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], '0');
},
detail_produk: function(mode, PromoID, InvID, SatuanID, Kode_Varian){
new Request({
url: this.PHP + '/form_produk',
sendParam: ['mode','mode_detail='+mode,'Grup_PromoID','PromoID='+PromoID,'InvID='+InvID,'SatuanID='+SatuanID,'Kode_Varian='+Kode_Varian],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Barang Promo', ajson.html, 'lg', [{},{i:'butBatal'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail')
//select_all, clear_all
.find('#butWSimpan').click(() => this.detail_simpan());
FoniaJS.AutoComplete('#Nama_Produk', this.PHP + '/auto_produk', ['Grup_PromoID'], {'selectFunc':this.Produk_Comp});
$('#Nama_Produk').click(() => $('#Nama_Produk').select());
this.update_items(InvID, SatuanID);
FoniaJS.setFocus('#Nama_Produk');
});
}
}).send();
},
detail_tambah: function() {
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','Grup_PromoID','PromoID='+acell[0]],
}).send();
}, 'danger');
},
detail_simpan: function(){
if ($('#InvID').val() == 0) {
FoniaJS.showError('Silakan masukkan Nama Barang Promo !');
return;
}
new Request.JSONF({
url: this.PHP + '/table_detail',
sendParam: ['mode','mode_detail','Grup_PromoID','PromoID','InvID','SatuanID','Kode_Varian'],
onSuccess: () => FoniaJS.closeWindow(this.winDetail)
}).send();
},
varian_show: function(){
new Request.JSONF({
url: this.PHP + '/form_varian',
sendParam: ['InvID','SatuanID','Kode_Varian']
}).send();
},
data_query: function(tipe, mode, kd_tx){
if (tipe=="master"){
mode = (mode) ? mode : '';
var sparam = ['mode='+mode,'Grup_PromoID'+((typeof(kd_tx)!=='undefined')?'='+kd_tx:'')];
if (-1 !== mode.search(/save/i)) sparam = ['mode='+mode,'Grup_PromoID','CabID','Grup_MemberID','Qty_Kali','Tipe_Promo','Promo_Nama','Promo_Minggu','Promo_Disc','Tgl_Mulai','Tgl_Akhir','Aktif'];
new Request({
url: this.PHP + '/form_master',
sendParam: sparam,
onSuccess: (ajson) => {
$('#divTXMaster').html(ajson.html);
$('#butBrow').click(() => this.promo_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');
$('#butSimpan').removeClass('d-none');
$('#butBatal').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');
$('#butSimpan').addClass('d-none');
$('#butBatal').addClass('d-none');
}
if ($('#Grup_PromoID').val() == 0) {
$('#butUbah').prop('disabled', true);
$('#butHapus').prop('disabled', true);
}
}
}).send();
} else if (tipe=="tabel-detail"){
new Request.JSONF({
url: this.PHP + '/table_detail',
sendParam: ['mode','Grup_PromoID']
}).send();
} else if (tipe=="brow-promo"){
new Request.JSONF({
url: this.PHP + '/brow_promo',
sendParam: ['Cari_Promo'],
onSuccess: () => FoniaJS.setFocus('#Cari_Promo')
}).send();
} else if (tipe=="brow-produk"){
new Request.JSONF({
url: this.PHP + '/brow_produk',
sendParam: ['Cari_Produk','Grup_PromoID'],
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
}).send();
}
},
Produk_Comp: function(item){
$('#InvID').val(item.value);
$('#Nama_Produk').val(item.text);
PromoBeliDiscJS.update_items(item.value, item.data);
},
update_items: function(InvID, SatuanID){
new Request.JSONF({
url: this.PHP + '/option_satuan',
sendParam: ['InvID='+InvID,'SatuanID='+SatuanID],
onSuccess: () => this.varian_show()
}).send();
}
};
+182
View File
@@ -0,0 +1,182 @@
/*******************************************************************
PHP Class : /Controller/Promo/TotalController
Description : Promo Penjualan Total Penjualan
Created By : Siau Pheng ([email protected]).
Created Date : September 28th, 2014.
Last Modified : September 2nd, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
var PromoTotalJS = {
PHP: '',
KODE: '',
index: function(){
this.data_query('detail');
$('#Cari_Promo').keydown((e) => {
var key = e.keyCode || e.which || 0;
if (key==13 && e.target.value!='') this.data_query('detail');
});
$('#butSearch').click(() => this.data_query('detail'));
$('#butAll').click(() => {
$('#Cari_Promo').val('');
this.data_query('detail');
});
FoniaJS.setFocus('#Cari_Promo');
},
detail_show: function(mode, ID){
new Request({
url: this.PHP + '/form_promo',
sendParam: ['mode_detail='+mode,'PromoID='+ID],
onSuccess: (ajson) => {
this.winDetail = FoniaJS.showWindow('Detail', 'Detail Promo', ajson.html, 'xl', [{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winDetail')
.find('#butWSimpan').click(() => this.detail_save()).end()
.find('#butBrow1').click(() => this.grup_show()).end()
.find('#butBrow2').click(() => this.produk_brow());
if ($.inArray($("#mode_detail").val(),['insert','update']) !== -1) {
this.update_Items($('#Promo_InvID').val(), $('#Promo_SatuanID').val());
this.oc_PilihP();
}
});
}
}).send();
},
detail_tambah: function(){
this.detail_show('insert', 0);
},
detail_ubah: function(acell){
this.detail_show('update', acell[0]);
},
detail_hapus: function(acell){
FoniaJS.showConfirm('Konfirmasi', 'Yakin akan hapus <b>"'+acell[2]+'"</b> ?', () => {
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['mode_detail=delete','PromoID='+acell[0],'Cari_Promo'],
onSuccess: () => FoniaJS.showInfo('Proses hapus data sukses!')
}).send();
}, 'danger');
},
detail_save: function(){
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['mode_detail','PromoID','Nama_Promo','Jual_Min','Jual_Grup','CabID','Grup_MemberID','Tipe_Promo','Promo_Jual','Promo_InvID','Promo_SatuanID','Promo_Qty','Jumlah_Promo','Tgl_Mulai','Tgl_Akhir','Aktif','Cari_Promo'],
onSuccess: () => {
FoniaJS.showInfo('Proses simpan data sukses!');
FoniaJS.closeWindow(this.winDetail);
}
}).send();
},
grup_show: function(){
new Request({
url: this.PHP + '/form_grup',
sendParam: ['Jual_Grup'],
onSuccess: (ajson) => {
this.winGrup = FoniaJS.showWindow('Grup', 'Daftar Grup Barang', ajson.html, 'lg', [{i:'butWSAll',v:'Cek Semua',c:'info'},{i:'butWCAll',v:'Hapus Semua',c:'info'},{},{i:'butTutup'},{i:'butWSimpan',v:'Simpan',c:'success'}], () => {
$('#winGrup')
.find('#butWSAll').click(() => this.grup_semua()).end()
.find('#butWCAll').click(() => this.grup_clear()).end()
.find('#butWSimpan').click(() => this.grup_save());
});
}
}).send();
},
grup_semua: function(){
$('#tabGrupList input.form-check-input[type=checkbox]').prop('checked', true);
},
grup_clear: function(){
$('#tabGrupList input.form-check-input[type=checkbox]').prop('checked', false);
},
grup_save: function(){
var alist = [];
$('#tabGrupList tbody input.form-check-input[type=checkbox]:checked').map((i, b) => {
alist.push($(b).val());
});
$('#Jual_Grup').val(alist.join());
FoniaJS.closeWindow(this.winGrup);
},
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">&nbsp;</div>');
this.winBProduk = FoniaJS.showWindow('BProduk', 'Daftar Barang', _isi, 'lg', '', () => {
$('#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');
FoniaJS.setFocus('#Cari_Produk');
});
},
produk_select: function(acell){
FoniaJS.closeWindow(this.winBProduk);
$('#Promo_InvID').val(acell[0]);
$('#Promo_Produk').val(acell[1]);
this.update_Items(acell[0], 0);
},
data_query: function(tipe, mode){
if (tipe=="detail"){
new Request.JSONF({
url: this.PHP + '/table_promo',
sendParam: ['Cari_Promo']
}).send();
} else if (tipe=="brow-produk"){
new Request.JSONF({
url: this.PHP + '/brow_produk',
sendParam: ['Cari_Produk'],
onSuccess: () => FoniaJS.setFocus('#Cari_Produk')
}).send();
}
},
update_Items: function(InvID, SatuanID){
$('#Promo_SatuanID').empty();
if (InvID==0) return false;
new Request({
url: this.PHP + '/item_detail',
sendParam: ['InvID='+InvID],
onSuccess: (adata) => {
adata.map((val) => {
$('#Promo_SatuanID').append(new Option(val['label'],val['value'],false,(val['value']==SatuanID?true:false)))
});
$('#Promo_SatuanID').trigger('change');
}
}).send();
},
oc_PilihP: function(){
var i = parseInt($('#Tipe_Promo').val());
if (i == 4){
$('.promo1').removeClass('d-none');
$('.promo2').addClass('d-none');
$('#Promo_SatuanID').val(0);
$('#Promo_Qty').val(0);
$('#Promo_InvID').val(0);
$('#Jumlah_Promo').val(0);
} else {
$('.promo1').addClass('d-none');
$('.promo2').removeClass('d-none');
$('#Promo_Jual').val(0);
}
}
};