/******************************************************************* PHP Class : /Controller/Promo/BarangController Description : Konfigurasi Promo Penjualan Barang Created By : Siau Pheng (siaupheng@3fonia.com). 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 "'+acell[2]+'" ?', () => { new Request_JSF({ 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_JSF({ 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('