Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/ecampus.ncriptech.com/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * */ class Billing extends BaseAdminController { function __construct() { parent::__construct(); } function index(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Software Billing'; $userdata=$this->data['userdata']; //print_obj($userdata);die; $institute_id=$userdata->user_id; if($userdata->user_type=='institute'){ $institute_data=$this->um->get_user(array('user_pk_id'=>$institute_id),'institute'); $institute_name=$institute_data->user_profile_name; $intitute_address=$institute_data->user_address_1; $institute_contact_no=$institute_data->user_contact_no; }else if($userdata->user_type=='institute_branch'){ $institute_data=$this->um->get_user(array('branch_user_id'=>$institute_id),'institute_branch'); $institute_name=$institute_data->branch_name; $intitute_address=$institute_data->branch_address; $institute_contact_no=$institute_data->branch_contact_no; } // $billing_pacakge_subtotal=$this->pacm->get_system_package_total_payments(array('package_institute_id'=>$userdata->user_id,'package_inst_type'=>$userdata->user_type,'package_renewed'=>'no'),'pacakge_subtotal'); // $billing_pacakge_tax=$this->pacm->get_system_package_total_payments(array('package_institute_id'=>$userdata->user_id,'package_inst_type'=>$userdata->user_type,'package_renewed'=>'no'),'pacakge_tax_amount'); // $billing_pacakge_total=$this->pacm->get_system_package_total_payments(array('package_institute_id'=>$userdata->user_id,'package_inst_type'=>$userdata->user_type,'package_renewed'=>'no'),'package_total_payment'); $billing_data=$this->pacm->get_system_package_payments(array('package_institute_id'=>$userdata->user_id,'package_inst_type'=>$userdata->user_type,'package_renewed'=>'no')); //print_obj($billing_data);die; if(!empty($billing_data)){ $bill_details=array( 'name'=>$institute_name, 'address'=>$intitute_address, 'contact_no'=>$institute_contact_no, 'email'=>$intitute_email, 'gst_no'=>$institute_gst_no, 'payment_id'=>$billing_data->package_payment_id, 'cgst_percent'=>CGST, 'sgst_percent'=>SGST, 'sub_total_amount'=>number_format($billing_data->pacakge_subtotal,2), 'cgst_percent_amount'=>number_format($billing_data->package_cgst_tax_amount,2), 'sgst_percent_amount'=>number_format($billing_data->package_sgst_tax_amount,2), 'total_amount'=>number_format($billing_data->package_total_payment,2), 'package_renewed'=>$billing_data->package_renewed, 'bill_status'=>$billing_data->package_payment_status ); }else{ $bill_details=array(); } //print_obj($bill_details);die; $this->data['billing_data']=$bill_details; $this->theme->title($this->data['page_title'])->add_partial('partial_software_payment_model')->load('sass/vw_sass_billing', $this->data); }else{ redirect($this->data['base_url']); } } function indexPaymentHistory(){ if(session_userdata('isAdminLoggedin')){ $this->data['page_title']='Software Payment History'; $this->theme->title($this->data['page_title'])->load('sass/vw_sass_billing_payment_history', $this->data); }else{ redirect($this->data['base_url']); } } function onSearchBillingPaymentHistory(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $institute_data=check_institute($this->data['userdata']); $param['inst_id']=$institute_data['institute_id']; $param['inst_type']=$institute_data['inst_type']; $param['column_order'] = array( null, 'pacakge_invoice_no' ); $param['column_search'] = array('pacakge_invoice_no'); $param['order'] = array('package_payment_id' => 'DESC'); $posts=$this->input->post(); $param['payment_from']=$posts['payment_from']; $param['payment_to']=$posts['payment_to']; //print_obj($param);die; $list = $this->pacm->_get_system_package_payments($posts,$param,FALSE,FALSE); $data = array(); $no = isset($posts['start'])?$posts['start']:0; $action=''; foreach ($list as $payment){ $no++; $row = array(); if($payment->package_payment_status=='not paid'){ $status='<span class="badge badge-sm badge-danger">Not Paid</span>'; }else if($payment->package_payment_status=='paid'){ $status='<span class="badge badge-sm badge-success">Paid</span>'; } $row[] = $no; $row[] = $payment->pacakge_invoice_no; $row[] = $status; $row[] = date('d-m-Y',strtotime($payment->package_created_date)); $row[] = ($payment->package_payment_date!=null)?date('d-m-Y',strtotime($payment->package_payment_date)):''; $row[] = '₹ '.number_format($payment->package_total_payment,2); $data[] = $row; } $output = array( "draw" => isset($posts['draw'])?$posts['draw']:'', "recordsTotal" => $this->pacm->_get_system_package_payments($posts,$param,TRUE), "recordsFiltered" => $this->pacm->_get_system_package_payments($posts,$param,TRUE), "data" => $data, ); echo json_encode($output); }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function onInitializePayment(){ if(session_userdata('isAdminLoggedin')==TRUE && session_userdata('admin_id')){ if($this->input->is_ajax_request() && $this->input->server('REQUEST_METHOD')=='POST'){ $userdata = $this->data['userdata']; if($userdata->user_type=='insttitute'){ $parent_inst_id=$userdata->user_id; $user_email=$userdata->user_email; $user_phone_no=$userdata->user_contact_no; $user_address=$userdata->user_address_1; }else if($userdata->user_type=='institute_branch'){ $parent_inst_id=$userdata->branch_parent_inst_id; $user_email=$userdata->branch_email; $user_phone_no=$userdata->branch_contact_no; $user_address=$userdata->branch_address; } $payment_id=post_data('payment_id'); $billing_data=$this->pacm->get_system_package_payments(array('package_payment_id'=>$payment_id)); if(!empty($billing_data)){ $payment_amount=$billing_data->package_total_payment; $payment_order_id=$billing_data->pacakge_invoice_no; $rz_mid=NCRIPTECH_PAYMENT_MERCHANT_MID; $rz_key=(NCRIPTECH_RAZORPAY_PAYMENT_MODE=='TEST')?NCRIPTECH_PAYMENT_TEST_MERCHANT_KEY:NCRIPTECH_PAYMENT_PROD_MERCHANT_KEY; $rz_key_secret=(NCRIPTECH_RAZORPAY_PAYMENT_MODE=='TEST')?NCRIPTECH_PAYMENT_TEST_MERCHANT_SECRET_KEY:NCRIPTECH_PAYMENT_PROD_MERCHANT_SECRET_KEY; $reciept_no=ge_rand_code('RCPT'); $param=array( 'key'=>$rz_key, 'key_secret'=>$rz_key_secret, 'order_amount'=>$payment_amount, 'reciept_no'=>$reciept_no, 'order_name'=>'NCRIPTECH CMS RENEWAL', 'order_description'=>'Ncriptech CMS software renewal', 'order_cust_email'=>$user_email, 'order_cust_ph'=>$user_phone_no, 'order_address'=>$user_address, 'order_id'=>$payment_order_id, 'order_screen_color'=>'#212529', 'order_logo'=>NCRIPTECH_LOGO, 'order_action_url'=>$this->data['base_url'].'/billing_payment_response' ); $razorpayRedirect=$this->razorpay->rzRedirect($param); //print_obj($razorpayRedirect);die; //echo get_cookie('payment_gateway');die; echo $razorpayRedirect; }else{ $return['error']='Billing data not found in the system'; json_headers($return); } }else{ redirect($this->data['base_url']); } }else{ redirect($this->data['base_url']); } } public function indexPaymentResponse(){ // header("Pragma: no-cache"); // header("Cache-Control: no-cache"); // header("Expires: 0"); //print_obj($_POST);die; $payment_id=$_POST['razorpay_payment_id']; $signature=$_POST['razorpay_signature']; $order_id=$_POST['razorpay_order_id']; $order_code=$_POST['razorpay_order_code']; //echo $order_code; $gateway_key=(NCRIPTECH_RAZORPAY_PAYMENT_MODE=='TEST')?NCRIPTECH_PAYMENT_TEST_MERCHANT_KEY:NCRIPTECH_PAYMENT_PROD_MERCHANT_KEY; $gateway_key_secret=(NCRIPTECH_RAZORPAY_PAYMENT_MODE=='TEST')?NCRIPTECH_PAYMENT_TEST_MERCHANT_SECRET_KEY:NCRIPTECH_PAYMENT_PROD_MERCHANT_SECRET_KEY; $param=array( 'key'=>$gateway_key, 'key_secret'=>$gateway_key_secret, 'order_id'=>$order_id, 'order_payment_id'=>$payment_id, 'order_signature'=>$signature ); //print_obj($param); $payment_response=$this->razorpay->rzResponse($param); //print_obj($payment_response);die; $response=json_decode($payment_response); if(!empty($response) && isset($response->payment_response)){ $bill_data=$this->pacm->get_system_package_payments(array('pacakge_invoice_no'=>$order_code)); if(!empty($bill_data)){ $txn_id='TXN'.date('YmdHis').$bill_data->package_payment_id; $bill_data_to_update=array( 'package_txn_id'=>$txn_id, 'package_order_id'=>$order_id, 'package_payment_signature'=>$signature, 'package_payment_payment_id'=>$payment_id, 'package_payment_gate_way'=>'RAZORPAY', 'package_payment_gate_way_status'=>$response->payment_response->status, 'package_payee_email'=>$response->payment_response->customer_email, 'package_payee_phno'=>$response->payment_response->customer_ph, 'package_renewed'=>'yes', 'package_payment_status'=>'paid', 'package_payment_date'=>date('Y-m-d') ); $updated=$this->pacm->update_system_package_payments($bill_data_to_update,array('pacakge_invoice_no'=>$order_code)); if($updated){ $institute_data=$this->um->get_user(array('user_id'=>$bill_data->package_institute_id),$bill_data->package_inst_type); if(NCRIPTECH_SOFTWARE_RENEWAL_SCHEDULE=='monthly'){ $expiry_date=date('Y-m-d', strtotime('+1 month', strtotime($institute_data->user_expire_at))); }else if(NCRIPTECH_SOFTWARE_RENEWAL_SCHEDULE=='yearly'){ $expiry_date=date('Y-m-d', strtotime('+1 year', strtotime($institute_data->user_expire_at))); } if($bill_data->package_inst_type=='institute'){ $this->um->update_institute(array('user_expire_at'=>$expiry_date),array('user_pk_id'=>$bill_data->package_institute_id)); }else if($bill_data->package_inst_type=='institute_branch'){ $this->um->update_institute_branch(array('branch_expire_at'=>$expiry_date),array('branch_user_id'=>$bill_data->package_institute_id)); } redirect($this->data['base_url'].'/billing/payment-history'); }else{ } }else{ } } } }