?
Current Path : /home1/savoy/public_html/oscarerp.com/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/oscarerp.com/application/controllers/accounting.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class accounting extends MY_Controller { public function __construct() { parent::__construct(); $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 viewinaccountingsearch($modelfunction, $page, $pagenum) { $output = $this->accountingmodel->$modelfunction($pagenum); $data['viewinfo'] = $output['results']; $this->load->view('accounting/' . $page . '', $data); } function addformdisplay($page, $directory, $return_page = '') { $data = array(); $data['return_page'] = $return_page; $perm = $this->accountingmodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1); if (!$perm) { $data['msg'] = "Permission Denied"; $this->load->view('message', $data); } else { $this->load->view('' . $directory . '/' . $page . '', $data); } } function addinaccounting($modelfunction, $page) { $data=array(); $postdata = $this->get_post_values(); $data = $this->accountingmodel->$modelfunction($postdata); $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'], 3); if (!$perm) $data['msg'] = "Permission Denied"; else $data = $this->mastermodel->deletedata($table, $id, $field); $arr = array('msg' => $data['msg'], 'res' => $data['res']); echo json_encode($arr); } function edit_page($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 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 edit_payment_voucher($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); $data['journal'] = $this->mastermodel->get_data_dual('finance_journal', $id, 'journal_id', '0', 'credit', 'journal_id'); $data['id'] = $id; $this->load->view('accounting/' . $page, $data); } } function edit_cost_center($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); $data['journal'] = $this->mastermodel->get_data_dual('finance_journal', $id, 'journal_id', '0', 'credit', 'journal_id'); $data['id'] = $id; $this->load->view('accounting/' . $page, $data); } } function edit_post_dated_cheque($id, $table, $field, $page) { if ($_SESSION['current_mode'] != "") { $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); if($data['journal_refs']-> transaction_id==2) $data['journal'] = $this->mastermodel->get_data_dual('finance_journal', $id, 'journal_id', '0', 'debit', 'journal_id'); if($data['journal_refs']-> transaction_id==1) $data['journal'] = $this->mastermodel->get_data_dual('finance_journal', $id, 'journal_id', '0', 'credit', 'journal_id'); $data['cheque_info'] = $this->mastermodel->get_data_srow('finance_cheque_info', $id, 'journal_id'); $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'], 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['journal_refs'] = $this->mastermodel->get_data_srow('finance_journal_refs', $id, 'journal_id'); $data['journal'] = $this->mastermodel->get_data_dual('finance_journal', $id, 'journal_id', '0', 'debit', 'journal_id'); $data['id'] = $id; $this->load->view('accounting/' . $page, $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'], 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); $from_account = $this->mastermodel->get_data_dual_srow('finance_journal', $id, 'journal_id', 0, 'debit', 'journal_id'); $to_account = $this->mastermodel->get_data_dual_srow('finance_journal', $id, 'journal_id', 0, 'credit', 'journal_id'); $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'], 2); } else { $perm = 1; } if (!$perm) { $data['msg'] = "Permission Denied"; $this->load->view('message', $data); } else { $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['id'] = $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'], 2); } 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 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 set_fiscal_year_current($fiscal_year_id) { $result = $this->accountingmodel->set_fiscal_year_current($fiscal_year_id); } function checkaccountisset_fiscalyear() { $res = $this->accountingmodel->checkaccountisset(); echo $res; } function show_payment_type($type,$transaction_type='') { $data['type'] = $type; $data['transaction_type']=$transaction_type; $this->load->view('accounting/list_payment', $data); } function viewsingle_page($journal_id, $model_function, $return_page) { $data = array(); $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', 'journal_id'); $data['payment'] = $this->get_payment_details($journal_id, $data['journal_refs']->payment_type_id); $data['model_function'] = $model_function; $data['return_page'] = $return_page; $this->load->view('accounting/single_transaction_page', $data); } function view_single_page($journal_id, $model_function, $return_page) { $data = array(); $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', 'journal_id'); $data['payment'] = $this->get_payment_details($journal_id, $data['journal_refs']->payment_type_id); $data['model_function'] = $model_function; $data['return_page'] = $return_page; $this->load->view('accounting/single_fee_page', $data); } function viewsingle_page_cost_center($journal_id, $model_function, $return_page) { $data = array(); $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', 'journal_id'); $data['payment'] = $this->get_payment_details($journal_id, $data['journal_refs']->payment_type_id); $data['model_function'] = $model_function; $data['return_page'] = $return_page; $this->load->view('accounting/single_transaction_page_cost_center', $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->convertdatenormalformat($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_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 viewsingle_transaction($journal_id) { $data = array(); $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', 'journal_id'); $data['payment'] = $this->get_payment_details($journal_id, $data['journal_refs']->payment_type_id); $this->load->view('accounting/single_reverse_transaction', $data); } function check_unique_cheque_no($cheque_no,$cheque_no_prev){ $count_cheque_no=$this->accountingmodel->get_count_cheque_no($cheque_no,$cheque_no_prev); echo $count_cheque_no; } function generate_report($model_function,$page) { $postdata = $_POST; $data['postdata']=$postdata; $output=$this->accountingmodel->$model_function($postdata); $data['view_info']=$output['result']; $data['cheque_info'] = $output['cheque_info']; $this->load->view('accounting/'.$page,$data); } function searchreconcile($page, $account, $statement,$cheque) { $data = array(); $output = $this->accountingmodel->search_reconcile($account, $statement,$cheque); $data['totrecord'] = $output['count']; $data['journal'] = $output['result']; $data['cheque_info'] = $output['cheque_info']; $this->load->view('accounting/' . $page, $data); } function set_reconcile($model_function) { $postdata = $_POST; $data = $this->accountingmodel->$model_function($postdata); echo $data['res']; } function getAccountingReports($modelfunction,$page){ $data=array(); $page = 'xls' . $page; $postdata = $this->get_post_values(); // echo $page;die(); $data=$this->accountingmodel->$modelfunction($postdata); $data['company'] = $this->mastermodel->getdatas('nursery'); $data['reportin']=$postdata['reportin']; $data['file_name']=$postdata['file_name']; $data['heading'] = $postdata['file_name']; $data['sub'] = 'true'; $output=$data['result']; // if (!empty($output)) { // $data['report'] = $output; // $this->load->view('accounting/' . $page . '', $data); // } else { // redirect('master/index/' . $_SESSION['current_mode'] . '/8'); // // } $this->load->view('accounting/' . $page . '', $data); } }