?
Current Path : /home1/savoy/public_html/savoyglobal.net/sgms/draft/application/controllers/ |
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/controllers/accounting.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Accounting extends MY_Controller { function __construct() { parent::__construct(); $this->load->library('Fpaginate'); $this->load->model('mastermodel'); $this->load->model('accountingmodel'); $this->load->helper('to_pdf'); } function get_post_values() { $data = array(); foreach ($_POST as $key => $value) { if($key != "submit") { $data[$key] = $this->input->post($key); } } return $data; } function addformdisplay($page,$directory,$table="",$pagenum="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],1); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $this->load->view(''.$directory.'/'.$page.''); } } function deletedata($table,$id,$field) { $data=array(); $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],3); if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data=$this->mastermodel->deletedata($table,$id,$field); $data['msg']=$data['msg']; if($data['res']==1) { $this->load->view('message',$data); } else { $this->load->view('message',$data); } } } function checkexistence($table,$field,$value) { if($this->mastermodel->checkexistence($table,$field,$value)>0) { echo 1; } } function checkexistencearray($table,$field,$value) { if($this->mastermodel->checkexistencearray($table,$field,$value)>0) { echo 1; } } function addinaccounting($modelfunction,$page) { $postdata=$this->get_post_values(); $data=$this->accountingmodel->$modelfunction($postdata); $data['msg']=$data['msg']; if($data['res']=="password") { $this->load->view('message',$data); } else if($data['res']==1) { $this->viewinaccountingsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } else { $this->viewinaccountingsearch($data['resfunction'],$page,$_SESSION['pagenum']); $this->load->view('message',$data); } } function viewinaccountingsearch($modelfunction,$page,$pagenum) { /*<---------------- For pagination purpose------------>*/ $perpage= $this->config->item('perpage'); $_SESSION['pagenum']=$pagenum; $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } if(isset($_POST['tab_name'])) { $postdata =""; } else { $postdata=$this->get_post_values(); } if(!empty ($postdata)) $_SESSION['searchdata']=$postdata; else if(!isset($_SESSION['searchdata'])) $_SESSION['searchdata']=""; /*<---------------- For pagination purpose------------> */ $output=$this->accountingmodel->$modelfunction($pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['viewinfo']=$output['results']; $this->load->view('Accounting/'.$page.'',$data); } function edit_page($id,$table,$field,$page) { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],2); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $this->load->view('Accounting/'.$page,$data); } } function editform($controllerfunction,$id) { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],2); if(!$perm) { $data['res']=0; $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $this->$controllerfunction($id); } } function single_page($id,$table,$field,$page,$alert_id='') { if($_SESSION['current_mode']!="") { $perm=$this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['sgms_userid'],0); } else { $perm=1; } if(!$perm) { $data['msg']="Permission Denied"; $this->load->view('message',$data); } else { $data['viewinfo']=$this->mastermodel->get_data_srow($table,$id,$field); $data['id']=$id; $data['alert_id']=$alert_id; $this->load->view('Accounting/'.$page,$data); } } function set_default_currency($currency_id) { $this->accountingmodel->setdefaultcurrency($currency_id); echo 1; } function code_exist($table,$field,$data) { $res=$this->mastermodel->number_rows($table,$field,$data); echo $res; } function checkaccountsettings() { $res=$this->accountingmodel->checkaccountsettings(); echo $res; } function single_note($ref_id,$ref_code) { $ref_code=str_replace('~', '/', $ref_code); $data['refs']=$this->accountingmodel->get_transaction_details($ref_id); $data['reference_code']=$ref_code; $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/single_note',$data); } function single_payment($ref_id) { $data['refs']=$this->accountingmodel->get_payment_details($ref_id); $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/single_payment',$data); } function payment_voucher_pdf($ref_id) { $data['refs']=$this->accountingmodel->get_payment_details($ref_id); $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/payment_voucher_pdf',$data); } function receipt_voucher_pdf($ref_id,$payment_method) { $data['payment_method']=$payment_method; $data['refs']=$this->accountingmodel->get_payment_details($ref_id); $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/receipt_voucher_pdf',$data); } function checkaccountisset() { $res=$this->mastermodel->getsinglejoinedvalue('fiscal_year_start','fiscal_year','company','fiscal_year_id','fiscal_year_id','closed',0); if($res=='') echo 0; else echo $res; } function check_transaction_codeisset($transaction_type_id) { $num=$this->mastermodel->get_num_rows('transaction_code','trans',$transaction_type_id); if($num==0) echo $num; else { $code=$this->mastermodel->getSingleFieldValue('transaction_code', 'code', 'trans', $transaction_type_id); $num=$this->mastermodel->get_num_rows('refs','ref_transaction_type_id',$transaction_type_id); $num++; do { $transaction_code = $code.'/'.date("Y").'/'.$num; $num_rows=$this->mastermodel->mastermodel->get_num_rows('refs','ref_code',$transaction_code); $num++; }while($num_rows!=0); echo $transaction_code; } } function insert_payment_receipt_voucher_posted($ref_id) { $this->accountingmodel->insert_payment_receipt_voucher_posted($ref_id); } function insert_bank_journal_posted($ref_id) { $this->accountingmodel->insert_bank_journal_posted($ref_id); } function debit_note_pdf($ref_id) { $data['refs']=$this->accountingmodel->get_transaction_details($ref_id); $data['quotation_code']=$this->accountingmodel->get_quotation_code($ref_id); $data['project_title']=$this->accountingmodel->get_project_title($ref_id); $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/debit_note_pdf',$data); } function credit_note_pdf($ref_id) { $data['refs']=$this->accountingmodel->get_transaction_details($ref_id); $data['quotation_code']=$this->accountingmodel->get_quotation_code($ref_id); $data['project_title']=$this->accountingmodel->get_project_title($ref_id); $data['gl_details']=$this->mastermodel->get_data_joined('gl_trans','chart_master','account_code','chart_account_code',$ref_id,'ref_id','gl_trans_id'); $this->load->view('Accounting/credit_note_pdf',$data); } function insert_journal_voucher_posted($ref_id) { $this->accountingmodel->insert_journal_voucher_posted($ref_id); } function edit_payment_voucher_unposted($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getunpostedpayment(1,$id); $this->load->view('Accounting/edit_payment_voucher_unposted',$data); } function edit_receipt_voucher_unposted($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getunpostedpayment(2,$id); $this->load->view('Accounting/edit_receipt_voucher_unposted',$data); } function edit_customer_payment($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getunpostedpayment(2,$id); $this->load->view('Accounting/edit_customer_payment',$data); } function bank_bal($id) { $this->accountingmodel->bank_bal($id); } function edit_bank_journal($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getunpostedpayment(4,$id); $this->load->view('Accounting/edit_bank_journal',$data); } function edit_journal_voucher_unposted($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getunpostedjournal($id); $this->load->view('Accounting/edit_journal_voucher_unposted',$data); } function edit_fixed_autojournal($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getfixed_autojournal($id); $this->load->view('Accounting/edit_fixed_autojournal',$data); } function single_auto_journal($id) { $data['id']=$id; $data['viewinfo']= $this->accountingmodel->getfixed_autojournal($id); $this->load->view('Accounting/single_auto_journal',$data); } function search_transaction() { $data=array(); $postdata=$this->get_post_values(); $output=$this->accountingmodel->search_transaction($postdata); $data['viewinfo']=$output['results']; $this->load->view('Accounting/transaction_search_results',$data); } function reverse_transaction($ref_id) { echo $this->accountingmodel->reverse_transaction($ref_id); } function generate_trailbalance_pdf() { $data=array(); $postdata=$this->get_post_values(); $to1=explode('-',$_POST['report_date']); $days=$this->accountingmodel->monthdays($to1[1], $to1[2]); $to=$days.'-'.$to1[1].'-'.$to1[2]; $from='01-'.$to1[1].'-'.$to1[2]; $data['date1']=$from; $data['date2']=$to; $data['receipt']=$this->accountingmodel->get_main_trail_balance($from,$to); $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $data['sub']='false'; $data['heading']="Trial Balance"; $data['fname']="Trial Balance"; $data['rfrom']=""; $data['rto']=""; $this->load->view('Accounting/pdf_trail_balance',$data); } function generate_subacc_trailbalance_pdf() { $data=array(); $postdata=$this->get_post_values(); $to1=explode('-',$postdata['report_date']); $days=$this->accountingmodel->monthdays($to1[1], $to1[2]); $to=$days.'-'.$to1[1].'-'.$to1[2]; $from='01-'.$to1[1].'-'.$to1[2]; $data['date1']=$from; $data['date2']=$to; $data['receipt']=$this->accountingmodel->get_trail_balance($from,$to,$postdata['main_account_id'],$postdata['sub_account_from'],$postdata['sub_account_to']); $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $data['sub']='false'; $data['heading']="Sub A/c Trial Balance"; $data['rfrom']=$_POST['sub_account_from']; $data['fname']="Sub A/c Trial Balance"; $data['rto']=$_POST['sub_account_to']; $this->load->view('Accounting/pdf_trail_balance',$data); } function generate_subacc_ledger_pdf() { $data=array(); //$postdata=$this->get_post_values(); $to=$_POST['report_start_date']; $from=$_POST['report_start_date']; $data['date1']=$from; $data['date2']=$to; $output=$this->accountingmodel->get_sub_gl($from,$to,$_POST['main_account_id'],$_POST['sub_account_from'],$_POST['sub_account_to']); $data['receipt']=$output['transdet']; $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $data['sub']='true'; $data['acctitle']='Sub A/c Total'; $data['fname']="Sub Account Ledger"; $data['heading']="Sub A/c Ledger"; $data['rfrom']=$_POST['sub_account_from']; $data['rto']=$_POST['sub_account_to']; $this->load->view('Accounting/pdf_gl',$data); } function generate_ageingsummary_pdf() { $data=array(); ///$postdata=$this->get_post_values(); $output=$this->accountingmodel->get_ageingsummary_report($_POST['report_date'],$_POST['account_type']); $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $data['statement']=$output['transdet']; $data['date']=$_POST['report_date']; $this->load->view('Accounting/pdf_ageingsummary_report',$data); } function generate_ageing_pdf() { $data=array(); //$postdata=$this->get_post_values(); $output=$this->accountingmodel->get_ageing_report($_POST['report_date'],$_POST['account']); $data['balance']=$output['balance']; $data['current']=$output['current']; $data['lthirty']=$output['lthirty']; $data['lninty']=$output['lninty']; $data['loneeighty']=$output['loneeighty']; $data['ltseventy']=$output['ltseventy']; $data['ltsixty']=$output['ltsixty']; $data['statement']=$output['transdet']; $data['accdet']=$output['accdet']; $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $data['accountcode']=$_POST['account']; $data['date']=$_POST['report_date']; $this->load->view('Accounting/pdf_ageing_report',$data); } function generate_statement_account_pdf() { $data=array(); //$postdata=$this->get_post_values(); $data['from']=$_POST['report_start_date']; $data['to']=$_POST['report_end_date']; $output=$this->accountingmodel->get_statement_account($_POST['account'],$data['from'],$data['to']); $data['accdet']=$output['accdet']; $data['statement']=$output['transdet']; $data['company']=$this->mastermodel->get_data_srow('company','1','company_id'); $this->load->view('Accounting/pdf_statement_account',$data); } }