?
Current Path : /home1/savoy/public_html/savoyglobal.net/rms/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/rms/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->model('mastermodel'); $this->load->model('accountingmodel'); $this->load->model('bmmodel'); $this->load->model('maintenancemodel'); $this->load->model('inventorymodel'); $this->load->model('projectmodel'); $this->load->helper('to_pdf'); } function viewinaccountingsearch($modelfunction = '', $page, $pagenum) { $output = $this->accountingmodel->$modelfunction($pagenum); $data['viewinfo'] = $output['results']; $this->load->view('accounting/' . $page . '', $data); } function addformdisplay($page, $directory, $table = "", $pagenum = "") { $data = array(); $data['return_page'] = $return_page; $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'], 1); if (!$perm) { $data['msg'] = "Permission Denied"; $this->load->view('message', $data); } else { $this->load->view('' . $directory . '/' . $page . ''); } } function addinaccounting($modelfunction, $page) { $postdata = $_POST; $data = $this->accountingmodel->$modelfunction($postdata); $data['msg'] = $data['msg']; 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 deletedata($table, $id, $field) { $data = array(); $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2); if (!$perm) $data['msg'] = "Permission Denied"; else $data = $this->accountingmodel->deletedata($table, $id, $field); $arr = array('msg' => $data['msg'], 'res' => $data['res']); echo json_encode($arr); } 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 edit_page($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } 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 edit_receipt_voucher($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); // $data['journal']=$this->mastermodel->get_data('finance_journal',$id,'journal_id'); $data['journal'] = $this->accountingmodel->search_journal_rv($id); $data['id'] = $id; $this->load->view('accounting/' . $page, $data); } } function edit_payment_voucher($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); // $data['journal']=$this->mastermodel->get_data('finance_journal',$id,'journal_id'); $data['journal'] = $this->accountingmodel->search_journal_pv($id); $data['id'] = $id; $this->load->view('accounting/' . $page, $data); } } function editform($controllerfunction, $id) { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['userid'], 1); 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) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 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; $this->load->view('accounting/' . $page, $data); } } function show_purchase_type($type, $select = "") { if ($type != "") { echo $type; $data = array(); $data['sel'] = $select; if ($type == "cost") { $page = 'list_cost_center'; $output = $this->accountingmodel->search_cost_center(""); $data['view_cost_center'] = $output['results']; } else if ($type == "invoice") { $page = 'list_invoice'; $output = $this->bmmodel->search_lease_agreement(""); $data['lease_agreement'] = $output['results']; $output = $this->maintenancemodel->search_maintenance_contract(""); $data['maintenance_contract'] = $output['results']; $output = $this->inventorymodel->search_vendor_purchase(""); $data['vender'] = $output['results']; $output = $this->projectmodel->search_project(""); $data['project'] = $output['results']; } $this->load->view('accounting/' . $page, $data); } } function show_payment_type($type) { $data['type'] = $type; $this->load->view('accounting/list_payment', $data); } function edit_bank_journal($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } 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); $from_account = $this->accountingmodel->get_bank_journal_data($data['viewinfo']->journal_id, '0', 'debit'); $to_account = $this->accountingmodel->get_bank_journal_data($data['viewinfo']->journal_id, '0', 'credit'); $data['from_acc'] = $this->mastermodel->get_data_srow('finance_bank_account', $from_account->chart_account_code , 'chart_account_code'); $data['to_acc'] = $this->mastermodel->get_data_srow('finance_bank_account', $to_account->chart_account_code , 'chart_account_code'); $data['amount'] = $from_account->credit; $data['id'] = $id; $this->load->view('accounting/' . $page, $data); } } function edit_journal_voucher($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Permission Denied"; $this->load->view('message', $data); } else { $data['journal_refs'] = $this->mastermodel->get_data_srow($table, $id, $field); $data['journal'] = $this->mastermodel->get_data('finance_journal', $id, 'journal_id'); $this->load->view('accounting/' . $page, $data); } } function edit_auto_journal($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Permission Denied"; $this->load->view('message', $data); } else { $data['journal_refs'] = $this->mastermodel->get_data_srow('finance_auto_journal_refs', $id, $field); $data['journal'] = $this->mastermodel->get_data('finance_auto_journal', $id, 'auto_journal_id'); $this->load->view('accounting/' . $page, $data); } } function set_currency_closed($currency_id) { $result = $this->accountingmodel->set_currency_closed($currency_id); } function set_fiscal_year_closed($fiscal_year_id) { $result = $this->accountingmodel->set_fiscal_year_closed($fiscal_year_id); } function checkaccountisset() { $res = $this->accountingmodel->checkaccountisset(); echo $res; } function viewsingle_page($journal_id) { $data['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $journal_id, 'journal_id'); $data['journal'] = $this->mastermodel->get_data('finance_journal', $journal_id, 'journal_id', 'id', '', 'desc'); $data['payment']=$this->get_payment_details($journal_id,$data['journal_refs']->payment_type_id); $this->load->view('accounting/single_transaction_page', $data); } function get_payment_details($journal_id,$payment_type_id) { $payment=array(); $method=$this->mastermodel->get_single_field_value('finance_payment_types', 'payment_type', 'payment_type_id',$payment_type_id); if($method!="") $payment['method']=$method; else return $payment; $payment['payment_details']=array(); if($payment_type_id==2) { $cheque=$this->mastermodel->get_data_srow('finance_cheque_info',$journal_id,'journal_id'); $payment['payment_details']=array('Cheque No'=>$cheque->cheque_no,'Cheque Date'=>$this->mastermodel->convertdateformat($cheque->cheque_date),'Cheque Info'=>$cheque->cheque_info); } else if($payment_type_id==3) { $wire_info=$this->mastermodel->get_data_srow('finance_wire_info',$journal_id,'journal_id'); $payment['payment_details']=array('Wire Info'=>$wire_info->wire_info); } return $payment; } function post_bank_journal($id) { $data['viewinfo'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); $from_acc = $this->accountingmodel->get_bank_journal_data($data['viewinfo']->journal_id, '0', 'debit'); $to_acc = $this->accountingmodel->get_bank_journal_data($data['viewinfo']->journal_id, '0', 'credit'); $data['from_acc'] = $this->mastermodel->get_single_field_value('finance_bank_account', 'bank_account_id', 'chart_account_code', $from_acc->chart_account_code); $data['to_acc'] = $this->mastermodel->get_single_field_value('finance_bank_account', 'bank_account_id', 'chart_account_code', $to_acc->chart_account_code); $data['amount'] = $from_acc->credit; $data['id'] = $id; $this->load->view('accounting/single_bank_journal', $data); } function post_data($id) { echo $this->accountingmodel->post_data($id); } function searchtransaction($page, $type, $from, $to, $ref = "") { $ref = str_replace("~", " ", $ref); $ref = str_replace("_", "/", $ref); $data['totrecord'] = $this->accountingmodel->search_trans('count', $ref, $type, $from, $to); $data['journal'] = $this->accountingmodel->search_trans('data', $ref, $type, $from, $to); $this->load->view('accounting/' . $page, $data); } function searchreconcile($page, $account, $statement) { $data['totrecord'] = $this->accountingmodel->search_reconcile('count', $account, $statement); $data['journal'] = $this->accountingmodel->search_reconcile('data', $account, $statement); $this->load->view('accounting/' . $page, $data); } function Addreverse_journal($model_function) { $postdata = $_POST; $data = $this->accountingmodel->$model_function($postdata); echo $data['res']; } function set_reconcile($model_function) { $postdata = $_POST; $data = $this->accountingmodel->$model_function($postdata); echo $data['res']; } function generate_report($model_function,$page) { $postdata = $_POST; $data['postdata']=$postdata; $output=$this->accountingmodel->$model_function($postdata); $data['view_info']=$output; $this->load->view('accounting/'.$page,$data); } function set_fiscal_year_current($fiscal_year_id) { $result=$this->accountingmodel->set_fiscal_year_current($fiscal_year_id); } } ?>