?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/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/public_html/savoyglobal.net/sgms/draft/application/views/commonfunctions.php |
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ ?> <script type="text/javascript"> /* Common function for viewing and adding data. Loaded via onclick function. */ function viewdata(controller,controllerfunction,modelfunction,page,pagenum) { if(arguments[5]) { var divid=arguments[5]; } else { var divid="entrydiv"; } //alert("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+modelfunction+'/'+page+'/'+pagenum); $("#"+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) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url('master/addformdisplay/') ?>/" +page+'/'+directory); } function addformdata(formid) { if(arguments[1]) { var divid=arguments[1]; } else { var divid="entrydiv"; } if(callvalidate(formid)) { $('.customForm').ajaxForm({ beforeSubmit: showPreloader(divid), success: function(data) { $("#"+divid).html(data); $('html, body, #'+divid).animate({scrollTop:0}, 'slow'); } }); } } function callvalidate(formid) { $("#"+formid).validate(); return $("#"+formid).valid(); } function addeditformdata(formid) { if($("#"+formid).validate()) { $('.customForm').ajaxForm(function(data) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").html(data); }); } } function editformdata(controller,controllerfunction,id,table,field,page) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function editforms(controller,controllerfunction,id) { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>/assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/" +controller+'/editform/'+controllerfunction+'/'+id); } function displayformdata(controller,controllerfunction,id,table,field,page) { //alert("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/"+controller+'/'+controllerfunction+'/'+id+'/'+table+'/'+field+'/'+page); } function viewformdata(controller,controllerfunction,id) { //alert("<?= site_url('master/viewform/') ?>/" +controller+'/'+controllerfunction+'/'+id); $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url()?>/" +controller+'/'+controllerfunction+'/'+id); } function deletedata(deltable,id,delfield,controller,controllerfunction,modelfunction,page,table,field,value) { if(confirmDelete()) { if(value) { var val=value; } else { var val= id; } if(table != "" && field != "") { $("#success-panel").load("<?= site_url('master/checkexistencearray/') ?>/" +table+'/'+field+'/'+val,function(data){ if(data==1) { $('html, body').animate({scrollTop:0}, 'slow'); // for scrolling to the top of the page $("#success-panel").fadeIn(900,0); $("#success-panel").html("Records with relation exist. Cannot be deleted."); $("#success-panel").fadeOut(2000,0); } else { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } }); } else { $("#success-panel").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#success-panel").load("<?= site_url('master/deletedata/') ?>/"+deltable+"/"+id+"/"+delfield,function(){ viewdata(controller,controllerfunction,modelfunction,page,'1'); }); } } else { viewdata(controller,controllerfunction,modelfunction,page,'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 checkchartmaster(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#account_code").val(""); $("#account_code").css('border','solid 1px red'); $("#account_code").focus(); $("#success-panel").fadeIn(900,0); $("#success-panel").html("Duplicate Entry Recorded"); $("#success-panel").fadeOut(2000,0); } }); } function confirmDelete() { if (confirm("Are you sure you want to delete")) return 1; else return 0; } function validateform(formid) { if($("#"+formid).validate()) { return true; } else { return false; } } 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 showDiv(divname) { var divstyle = new String(); divstyle = document.getElementById(divname).style.display; if(divstyle.toLowerCase()=="none" || divstyle == "") { document.getElementById(divname).style.display="block"; } else { document.getElementById(divname).style.display="none"; } } function suggestemployee(divid) { $("#"+divid).autocomplete("<?= site_url() ?>/master/autosuggestemployee/", { width: 250, selectFirst: false }); } function suggestemployeehierarchy(divid) { $("#"+divid).autocomplete("<?= site_url() ?>/master/autosuggestemployeehierarchy/", { width: 250, selectFirst: false }); } function suggestemployeeattendance() { $("#employee").autocomplete("<?= site_url() ?>/master/autosuggestemployeeattendance/", { width: 250, selectFirst: false }); } function suggesttraining() { $("#training").autocomplete("<?= site_url() ?>/master/autosuggesttraining/", { width: 250, selectFirst: false }); } function suggestemployeesalarypayment(date) { $("#employee").autocomplete("<?= site_url() ?>/hr/autosuggestemployeesalarypayment/"+date, { width: 250, selectFirst: false }); } function suggestcustomer() { $("#customer").autocomplete("<?= site_url() ?>/master/autosuggestcustomer/", { width: 250, selectFirst: false }); } function suggestcustomercode(field_id) { $("#"+field_id).autocomplete("<?= site_url() ?>/master/autosuggestcustomercode/", { width: 250, selectFirst: false }); } function suggestproposal() { $("#software_proposal").autocomplete("<?= site_url() ?>/master/autosuggestproposal/", { width: 250, selectFirst: false }); } function suggestconsultingproposal() { $("#consulting_proposal").autocomplete("<?= site_url() ?>/master/autosuggestconsultingproposal/", { width: 250, selectFirst: false }); } function suggesttrainingproposal() { $("#customer_training").autocomplete("<?= site_url() ?>/master/autosuggesttrainingproposal/", { width: 250, selectFirst: false }); } function suggesttrainingquotation() { $("#quotation").autocomplete("<?= site_url() ?>/master/autosuggesttrainingquotation/", { width: 250, selectFirst: false }); } function suggesttrainingregistration() { $("#registration").autocomplete("<?= site_url() ?>/master/autosuggesttrainingregistration/", { width: 250, selectFirst: false }); } function suggestmainaccounts() { $("#main_account").autocomplete("<?= site_url() ?>/master/autosuggestmainaccounts/", { width: 320, selectFirst: false }); } function suggestsubacfrom() { var main_account_id = $("#main_account_id").val(); $("#sub_account_from").autocomplete("<?= site_url() ?>/master/autosuggestsubacfrom/"+main_account_id, { width: 320, selectFirst: false }); } function suggestsubacto() { var main_account_id = $("#main_account_id").val(); $("#sub_account_to").autocomplete("<?= site_url() ?>/master/autosuggestsubacto/"+main_account_id, { width: 320, selectFirst: false }); } function suggestaccounts(id) { $("#"+id).autocomplete("<?= site_url() ?>/master/autosuggestaccounts/", { width: 320, selectFirst: false }); } function suggestallaccounts(id) { $("#"+id).autocomplete("<?= site_url() ?>/master/autosuggestallaccounts/", { width: 320, selectFirst: false }); } function suggest_cust_emp_accounts(id) { $("#"+id).autocomplete("<?= site_url() ?>/master/autosuggest_cust_emp_accounts/", { width: 320, selectFirst: false }); } function viewnote(id,ref_code) { ref_code=ref_code.replace(/\//gi,"~"); $("#note_div").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#note_div").load("<?= site_url('accounting/single_note')?>/"+id+"/"+ref_code); $(".inliexample").colorbox({width:"65%",height:"65%", inline:true, href:"#note_div"}); } function viewpayment(id) { $("#note_div").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#note_div").load("<?= site_url('accounting/single_payment')?>/"+id); $(".inliexample").colorbox({width:"65%",height:"65%", inline:true, href:"#note_div"}); } function check_fiscal_year() { $.ajax({ type: "POST", url: "<?= site_url('accounting/checkaccountisset/') ?>", success: function(msg){ if(msg==0) { $("#success-panel").fadeIn(900,0); $("#success-panel").html("<div style=\"border:1px solid red;text-align:center; width:500px;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]#submit').attr('disabled', 'disabled'); } } }); } function check_transaction_code_settings(val) { $.ajax({ type: "POST", url: "<?= site_url('accounting/check_transaction_codeisset/') ?>/"+val, success: function(msg){ if(msg==0) { $("#viewmsg").fadeIn(900,0); $("#viewmsg").html("<div style=\"border:2px solid red;padding-top:4px;text-align:center; width:500px;height:20px;margin-left:30%\" ><font color=\"red\" >Transaction Code not Set</font></div>"); $('input[type=text]#ref_code').attr('readonly', 'readonly'); $('button[type=submit]#submit').attr('disabled', 'disabled'); } else { $('input[type=text]#ref_code').val(msg); } } }); } Number.prototype.formatMoney = function(c, d, t){ var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); }; function checknumeric() { $('input.auto').autoNumeric(); } function makenull(obj) { if(obj.value=="") { var myid=$(obj).attr('id'); $("#"+myid+"_id").val(""); } } function checkrequiredfields() { if($(".required").val()=='') { alert("Please enter required values"); return false; } } function checkdatavalidity(jid,field,comment) { if(jid=="") { alert(comment) $('input#'+field).val(""); return false; } } function leave_approval_list() { $("#entrydiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#entrydiv").load("<?= site_url() ?>/hr/leave_approval_list"); } function showcommonuploaddiv(master_id,return_page) { $("#uploaddiv").empty().html('<CENTER><img src="<?=base_url()?>assets/images/loading.gif" class="loading"/></CENTER>'); $("#uploaddiv").load("<?= site_url() ?>/master/commonuploadform/"+master_id+"/"+return_page); $(".inliexample2").colorbox({width:"45%",height:"45%", inline:true, href:"#uploaddiv"}); } </script>