?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/application/views/accounting/ |
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/sec/application/views/accounting/accountingfunctions.php |
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ ?> <script type="text/javascript"> 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 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/img/loading.gif" class="loading"/></CENTER>'); $("#" + divid).load("<?= site_url() ?>/" + 'accounting' + '/' + 'show_payment_type' + '/' + val + "/" + transaction_type, function (data) { if (val > 1) $('#div_payment_details').show('slow'); else $('#div_payment_details').hide('slow'); }); } 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 suggestaccount(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggestaccount/", { width: 250, selectFirst: false }); } function checkamount(id) { var val= $('#' + id).val(); if (val <= 0) { alert('Amount should be greater than zero.'); $('#' + id).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 suggestmainaccount(divattr) { $(divattr).autocomplete("<?= site_url() ?>/master/autosuggestmainaccount/", { width: 250, selectFirst: false }); } function suggestaccount(divid) { $(divid).autocomplete("<?= site_url() ?>/master/autosuggestaccount/", { width: 250, selectFirst: false }); } 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 tbody 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); } } }); } } } </script>