?
Current Path : /home1/savoy/www/savoyglobal.net/oscardraft/application/views/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/www/savoyglobal.net/oscardraft/application/views/commonfunctions.php |
<script type="text/javascript"> function post(id, model_function, page) { $.ajax({ type: "GET", dataType: "json", url: "<?= site_url('accounting/post_data/') ?>/" + id, success: function(msg) { alert('Posted Successfully'); $.fn.colorbox.close(); viewdata('accounting', 'viewinaccountingsearch', model_function, page, '1'); } }); } function view_alert() { var divid="inner_content"; $("#"+divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#"+divid).load("<?= site_url() ?>/"+'settings'+'/'+'show_alert'+'/'+'display_alert'); } function checkamount(id) { var val= $('#' + id).val(); if (val <= 0) { alert('Amount should be greater than zero.'); $('#' + id).val(""); } } function searchformdisplay() { $("#top-panel-search").fadeIn(1000,0); } function viewdata(controller,controllerfunction,modelfunction,page,pagenum) { if(arguments[5]) { var divid=arguments[5]; } else { var divid="inner_content"; } $("#"+divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#"+divid).load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum); } function addformdisplay(page,directory) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url('master/addformdisplay/') ?>/" +page+'/'+directory); } function view_page(directory,page,div) { $("#"+div).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#"+div).load("<?= site_url('master/view/') ?>/" +directory+'/'+page); } function view_fee_alert(class_name_id) { $("#dashboard_alert_div").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#dashboard_alert_div").load("<?= site_url('master/view_fee_alert/') ?>/" +class_name_id); } function student_class_details(controller,controllerfunction,id,field,page){ $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+field+'/'+page); } function editformdata(controller,controllerfunction,id,table,field,page) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function displayformdata(controller,controllerfunction,id,table,field,page) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function viewincolorbox(controller,controllerfunction,id,table,field,page) { $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#empdiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"}); } function closesearchformdisplay() { $("#top-panel-search").fadeOut(1000,0); } function displayformdata1(controller,controllerfunction,id,table,field,page,returnpage) { $("#uploaddiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#uploaddiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); $(".inliexample2").colorbox({width:"90%",height:"90%", inline:true, href:"#uploaddiv"}); } function smalldisplayformdata(controller,controllerfunction,id,table,field,page,returnpage) { $("#uploaddiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#uploaddiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); $(".inliexample2").colorbox({width:"60%",height:"55%", inline:true, href:"#uploaddiv"}); } function display_alert(controller,controllerfunction,id,table,field,page) { $("#alert_show").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#alert_show").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function viewformdata(controller,controllerfunction,id) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/" +controller+'/'+controllerfunction+'/'+id); } function uploadformdata(controller,controllerfunction,master_id,return_function,return_page) { $("#inner_content").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#inner_content").load("<?= site_url() ?>/master/upload_form/"+controller+'/'+controllerfunction+'/'+master_id+"/"+return_function+"/"+return_page); } function deletedata(deltable,id,delfield,controller,controllerfunction,modelfunction,page,table,field,value) { var clicked = function(){ $.fallr('hide'); if(value) { var val=value; } else { var val= id; } if(table != "" && field != "") { $.ajax({ type: "POST", dataType:"json", url: "<?= site_url('master/checkexistencearray/') ?>/" +table+'/'+field+'/'+val, success: function(msg){ if(msg!=0) { alert("Record cannot be deleted due to associated data"); } else { $.ajax({ type: "POST", dataType:"json", url: "<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield, success: function(msg) { viewdata(controller,controllerfunction,modelfunction,page,'1'); } }); } } }); } else { $.ajax({ type: "GET", dataType:"json", url: "<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield, success: function(msg){ viewdata(controller,controllerfunction,modelfunction,page,'1'); } }); } }; $.fallr('show', { buttons : { button1 : {text: 'Yes', danger: true, onclick: clicked}, button2 : {text: 'Cancel', onclick: function(){$.fallr('hide')}} }, content : '<p>Are you sure you want to delete ?</p>', icon : 'error' }); } function confirmDelete() { if (confirm("Are you sure you want to delete")) return 1; else return 0; } function addformdata1(formid){ if(callvalidate(formid)) { return true; } else { return false; } } function addformdata(formid) { if(arguments[1]) { var divid=arguments[1]; } else { var divid="inner_content"; } if(callvalidate(formid)) { $('.customForm,.validate').ajaxForm({ beforeSubmit:function(){ // $('button[type="submit"]').attr('disabled', 'disabled'); return true; }, success:function(data) { $("#"+divid).html(data); $('html, body, #'+divid).animate({scrollTop:0}, 'slow'); $('#table-example').dataTable(); }, error:function(data){ // alert(); } }); // alert('after'); return true; } else { return false; } } function callvalidate(formid) { $("#"+formid).validate(); return $("#"+formid).valid(); } function datecheck() { if(callvalidate('validateform')) { var startDate = document.getElementById("date1").value; var endDate = document.getElementById("date").value; var date1=startDate.split('-'); var date2=endDate.split('-'); var sdate=new Date( date1[1]+"-"+date1[0]+"-"+date1[2]); var edate= new Date(date2[1]+"-"+date2[0]+"-"+date2[2]); if (sdate <= edate) { $.ajax({ type: "POST", url: "<?= site_url('master/addinmaster/insert_assessment_master/view_assessment_master/1') ?>", data : $('.validate').serialize(), success: function(data){ $("#inner_content").html(data); $('html, body, #inner_content').animate({scrollTop:0}, 'slow'); $('#table-example').dataTable(); } }); return false; } else { alert("End date should be greater than Start date"); document.getElementById("date").value = ""; return false; } } return false; } function suggestemployee(divid) { $("#"+divid).autocomplete("<?= site_url() ?>/master/autosuggestemployee/", { width: 250, selectFirst: false }); } function suggestStudent(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggeststudent/", { width: 250, selectFirst: false }); } function suggestStudentDetails(div){ $('#stud_details').css('display','none'); $(div).autocomplete("<?= site_url() ?>/master/autosuggeststudent/", { width: 250, selectFirst: false, onCallBack: function(id,index) { if(id!="") { $.ajax({ type: "POST", dataType:"json", url: "<?= site_url('master/getStudentDetails/') ?>/"+id, success: function(data) { $('#stud_details').css('display','block'); $('#stud_gender').val(data.gender); $('#stud_reg').val(data.reg_no); } }); } else { $('#stud_details').css('display','none'); $('#stud_gender,#stud_reg').val(''); } } }); } function set_fiscal_year_current(fiscal_year_id) { $.ajax({ type: "POST", dataType: "json", url: "<?= site_url('master/checkexistencearray/') ?>/finance_fiscal_year/fiscal_year_id" + '/' + fiscal_year_id, success: function(msg) { $.ajax({ type: "POST", dataType: "json", url: "<?= site_url('accounting/set_fiscal_year_current/') ?>/" + fiscal_year_id, success: function() { viewdata('accounting', 'viewinaccountingsearch', 'search_fiscal_year', 'view_fiscal_year', '1'); } }); } }); } function checkexistence(table,field,value) { $("#success-panel").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/checkexistence/') ?>/" +table+'/'+field+'/'+value,function(data){ if(data==1) { $("input#"+field).val(""); $("select#"+field).val(""); $("#"+field).css('border','solid 1px red'); $("#"+field).focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("Duplicate Entry Recorded"); $("#success-panel").fadeOut(2000,0); } else { $("#"+field).css('border','solid 1px gray'); } }); } function checkdata(id, className, comment) { var numItems = $('.' + className).length var i = 1; var flag = 1; for (i = 1; i <= numItems; i++) { if ($('input#' + id + '_id' + i).val() == "") { flag = 0; $('input#' + id + i).val(""); } } if (flag == 0) { alert(comment) return false; } else return true } function checkdatavalidity(jid, field, comment) { if (jid == "") { alert(comment) $('input#' + field).val(""); return false; } else { return true; } } function empty_text(tag) { $('#'+tag).val(""); } // function empty_text1(tag) // { // $('#'+tag).val(""); // } function remove_alert(id) { var clicked = function(){ $.fallr('hide'); $.ajax({ type: "GET", dataType:"json", url: "<?= site_url('settings/remove_alert/') ?>/"+'alert'+"/"+id+"/alert_id", success: function(msg){ viewdata('settings','viewinsettingssearch','search_alert','view_alert','1'); } }); }; $.fallr('show', { buttons : { button1 : {text: 'Yes', danger: true, onclick: clicked}, button2 : {text: 'Cancel', onclick: function(){$.fallr('hide')}} }, content : '<p>Are you sure you want to remove ?</p>', icon : 'error' }); } function calculteallowancetotal(val,mode,count) { var basicsalary=$("input#basic_salary").val(); if(!basicsalary) { alert("Please set basic salary") $('input#amount_'+count).val(''); } else { if(mode==0) { val=parseFloat(basicsalary)*parseFloat(val)*0.01; } $('input#alltotal_'+count).val(val); var allowcount=$("input#allowcount").val(); var deduction=$("input#deduction").val(); var sumallow=0; for(var i=1;i<allowcount;i++) { var allowamount=$("input#alltotal_"+i).val(); if(allowamount) sumallow+=parseFloat(allowamount); } $('input#allowance').val(sumallow); var commission=$("input#commission").val(); var grosssalary=parseFloat(sumallow)+parseFloat(basicsalary); var netsalary=parseFloat(grosssalary)-parseFloat(deduction); var payamount=parseFloat(netsalary)+parseFloat(commission); $('input#grosssalary').val(grosssalary); $('input#netsalary').val(netsalary); $('input#payamount').val(payamount); } } function calcultedeductiontotal(val,mode,count) { var basicsalary=$("input#basic_salary").val(); if(!basicsalary) { alert("Please set basic salary"); $("input#amount_"+count).val(''); } else { if(mode==0) { val=parseFloat(basicsalary)*parseFloat(val)*0.01; } $("input#dedtotal_"+count).val(val); var dedcount=$("input#dedcount").val(); var allowance=$("input#allowance").val(); var sumded=0; for(var i=1;i<dedcount;i++) { var dedamount=$("input#dedtotal_"+i).val(); if(dedamount) sumded+=parseFloat(dedamount); } $('input#deduction').val(sumded); var commission=$("input#commission").val(); var grosssalary=parseFloat(allowance)+parseFloat(basicsalary); var netsalary=parseFloat(grosssalary)-parseFloat(sumded); var payamount=parseFloat(netsalary)+parseFloat(commission); $('input#grosssalary').val(grosssalary); $('input#netsalary').val(netsalary); $('input#payamount').val(payamount); } } function changebasicsalary(val) { var allowance=$("input#allowance").val(); var deduction=$("input#deduction").val(); var grosssalary=parseFloat(allowance)+parseFloat(val); var netsalary=parseFloat(grosssalary)-parseFloat(deduction); $('input#grosssalary').val(grosssalary); $('input#netsalary').val(netsalary); } function calculatepayamount(commission_amount) { var netsalary=$("input#netsalary").val(); var payamount=parseFloat(netsalary)+parseFloat(commission_amount); $('input#payamount').val(payamount); } function empty(divid) { $(divid).html(""); } function empty_div(divid) { $('#' + divid).val(""); } function change_leave_status(status,id) { $.ajax({ type: "GET", dataType:"json", url: "<?= site_url('hr/leave_approval/') ?>/"+id+"/"+status, success: function(msg){ viewdata('hr','viewinhrsearch','search_leave_application','view_leave_application','1'); } }); } function leave_approval(id) { $.fallr('show', { buttons : { button1 : {text: 'Approve', danger: false, onclick: function() { $.fallr('hide'); change_leave_status('Approved',id); }}, button2 : {text: 'Reject', danger: true, onclick: function(){ $.fallr('hide'); change_leave_status('Reject',id); }}, button3 : {text: 'Cancel', onclick: function(){$.fallr('hide')}} }, content : '<p>Are you sure you want to Approve ?</p>', icon : 'Confirm-like' }); } function showPreloader(divid) { $("#"+divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); } function hidePreloader(divid) { $("#"+divid).empty().html(''); } function get_building_info(id) { $("#building_details").load("<?= site_url() ?>"+'/master/get_building_info/' +id); } function get_student_name(id) { alert(id) } function suggestmainaccount(divattr) { $(divattr).autocomplete("<?= site_url() ?>/master/autosuggestmainaccount/", { width: 250, selectFirst: false }); } function suggestmainaccount_c(divid) { $("#"+divid).autocomplete("<?= site_url() ?>/master/autosuggestmainaccount_c/", { width: 250, selectFirst: false }); } function checkfiscalyear() { $.ajax({ type: "POST", url: "<?= site_url('accounting/checkaccountisset_fiscalyear/') ?>", success: function(msg) { if (msg == 0) { $("#viewmsg").fadeIn(900, 0); $("#viewmsg").html("<div style=\"padding-top: 3px;border:1px solid red;text-align:center; width:400px;height:20px;margin-left:30%\" ><font color=\"red\" >Set the fiscal year to process payment OR Fiscal Year is Closed</font></div>"); $('button[type=submit]#button1').attr('disabled', 'disabled'); } else if (msg == -1) { $("#viewmsg").fadeIn(900, 0); $("#viewmsg").html("<div style=\"padding-top: 3px;border:1px solid red;text-align:center; width:400px;height:20px;margin-left:30%\" ><font color=\"red\" >Set the currency to process payment</font></div>"); $('button[type=submit]#button1').attr('disabled', 'disabled'); } else { $("#viewmsg").css('display', 'none'); } } }); } function suggestaccount(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggestaccount/", { width: 250, selectFirst: false }); } function suggestchartaccount(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggestchartaccount/", { width: 250, selectFirst: false }); } function suggest_bank_account(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggestbankaccount/", { width: 250, selectFirst: false }); } function select_payment_mode(val, divid,transaction_type) { $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#" + divid).load("<?= site_url() ?>/" + 'accounting' + '/' + 'show_payment_type' + '/' + val+"/"+transaction_type); } function view_fee(id,model_function,view_page) { $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#empdiv").load("<?= site_url('accounting/view_single_page/') ?>/" + id +"/"+ model_function +"/" + view_page); $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"}); } function viewthis_unpost(id,model_function,view_page) { $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#empdiv").load("<?= site_url('accounting/viewsingle_page/') ?>/" + id +"/"+ model_function +"/" + view_page); $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"}); } function viewthis_unpost_cost_center(id,model_function,view_page) { $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#empdiv").load("<?= site_url('accounting/viewsingle_page_cost_center/') ?>/" + id +"/"+ model_function +"/" + view_page); $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"}); } function viewthis_rev_transaction(id) { $("#empdiv").empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#empdiv").load("<?= site_url('accounting/viewsingle_transaction/') ?>/" + id ); $(".clickimage1").colorbox({width: "75%", height: "70%", inline: true, href: "#empdiv"}); } function validateRow() { var flag = 0; var rowTotal = $('table tr.addAccount ').length; var i = 1; for (i = 1; i <= rowTotal; i++) { var debit = $('#debit' + i).val(); var credit = $('#credit' + i).val(); debit = (debit < 1) ? '0' : debit; credit = (credit < 1) ? '0' : credit; if ((debit >= 1 && credit >= 1) || (debit == credit)) { flag = 1; alert('Enter any one (credit or debit) at a time'); return false; } if ($('#account_id' + i).val() == "") { $('#account' + i).val(""); alert('Enter valid Account'); flag = 1; return false; } } if (flag == 0) { return true } } function validateAmount(obj) { var RowIndex = $(obj).parents('table tr.addAccount ').index() + 1; var debit = $('#debit' + RowIndex).val(); var credit = $('#credit' + RowIndex).val(); debit = (debit < 1) ? '0' : debit; credit = (credit < 1) ? '0' : credit; obj.value=(obj.id == 'debit' + RowIndex) ? parseFloat(debit).toFixed(2):parseFloat(credit).toFixed(2); if ((debit >= 1 && credit >= 1) || (debit == credit)) { if ($('#debit' + RowIndex).val() != '' && $('#credit' + RowIndex).val() != '') alert('enter any one(credit or debit) at a time'); obj.value = '0'.toFixed(2); } getSum(); } function getSum() { var rowTotal = $('table tr.addAccount ').length; var sumDebit = 0; var sumCredit = 0; var i = 1; for (i = 1; i <= rowTotal; i++) { var debit = $('#debit' + i).val(); var credit = $('#credit' + i).val(); debit = (debit < 1) ? '0' : debit; credit = (credit < 1) ? '0' : credit; sumDebit += parseFloat(debit); sumCredit += parseFloat(credit); } $('#sumdebit').val(sumDebit.toFixed(2)); $('#sumcredit').val(sumCredit.toFixed(2)); } function insertpayment() { var debit = document.getElementById('sumdebit').value; var credit = document.getElementById('sumcredit').value; var flag=1; if ( debit != credit ) { alert('Total credit and Debit Does not match'); flag=0; return false; } else if (credit <= 0 || debit <= 0) { alert('Add atleast one debit and credit account'); flag=0; return false; } if(!validateRow()) { flag=0; return false; } if(flag==1){ addformdata('validateform') } return flag; } function check_unique_cheque(transaction_type,cheque_no_prev){ if(transaction_type=="PV"){ var cheque_no=$('#cheque_no').val(); if(cheque_no!=""){ $.ajax({ type: "POST", dataType:"json", url: "<?= site_url() ?>/accounting/check_unique_cheque_no/"+cheque_no+"/"+cheque_no_prev, success: function(msg){ if(msg>0){ $('#cheque_no').val(''); $("#cheque_no_info").fadeIn(900,0); $("#cheque_no_info").html('Cheque already issued'); $("#cheque_no_info").fadeOut(2000,0); } } }); } } } function set_academic_year_default(id) { $.ajax({ type: "POST", dataType: "json", url: "<?= site_url('master/checkexistencearray/') ?>/academic_year/academic_year_id" + '/' + id, success: function(msg) { $.ajax({ type: "POST", url: "<?= site_url('master/set_academic_year_default') ?>/" + id, success: function() { viewdata('master','viewinmastersearch','search_academic_year','view_academic_year','1'); } }); } }); } function get_payment_mode(val, divid,transaction_type) { $("#" + divid).empty().html('<CENTER><img src="<?= base_url() ?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#" + divid).load("<?= site_url() ?>/" + 'student' + '/' + 'show_payment_type' + '/' + val+"/"+transaction_type); } </script>