| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/application/controllers/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Invoice extends ClientsController
{
public function index($id = '', $hash = '')
{
check_invoice_restrictions($id, $hash);
$invoice = $this->invoices_model->get($id);
$invoice = hooks()->apply_filters('before_client_view_invoice', $invoice);
if (!is_client_logged_in()) {
load_client_language($invoice->clientid);
}
// Handle Invoice PDF generator
if ($this->input->post('invoicepdf')) {
try {
$pdf = invoice_pdf($invoice);
} catch (Exception $e) {
echo $e->getMessage();
die;
}
$invoice_number = format_invoice_number($invoice->id);
$companyname = get_option('invoice_company_name');
if ($companyname != '') {
$invoice_number .= '-' . mb_strtoupper(slug_it($companyname), 'UTF-8');
}
$pdf->Output(mb_strtoupper(slug_it($invoice_number), 'UTF-8') . '.pdf', 'D');
die();
}
// Handle $_POST payment
if ($this->input->post('make_payment')) {
$this->load->model('payments_model');
if (!$this->input->post('paymentmode')) {
set_alert('warning', _l('invoice_html_payment_modes_not_selected'));
redirect(site_url('invoice/' . $id . '/' . $hash));
} elseif ((!$this->input->post('amount') || $this->input->post('amount') == 0) && get_option('allow_payment_amount_to_be_modified') == 1) {
set_alert('warning', _l('invoice_html_amount_blank'));
redirect(site_url('invoice/' . $id . '/' . $hash));
}
$this->payments_model->process_payment($this->input->post(), $id);
}
if ($this->input->post('paymentpdf')) {
$payment = $this->payments_model->get($this->input->post('paymentpdf'));
// Confirm that the payment is related to the invoice.
if ($payment->invoiceid == $id) {
$payment->invoice_data = $this->invoices_model->get($payment->invoiceid);
$paymentpdf = payment_pdf($payment);
$paymentpdf->Output(mb_strtoupper(slug_it(_l('payment') . '-' . $payment->paymentid), 'UTF-8') . '.pdf', 'D');
die;
}
}
$this->app_scripts->theme('sticky-js', 'assets/plugins/sticky/sticky.js');
$this->load->library('app_number_to_word', [
'clientid' => $invoice->clientid,
], 'numberword');
$this->load->model('payment_modes_model');
$this->load->model('payments_model');
$data['payments'] = $this->payments_model->get_invoice_payments($id);
$data['payment_modes'] = $this->payment_modes_model->get();
$data['title'] = format_invoice_number($invoice->id);
$this->disableNavigation();
$this->disableSubMenu();
$data['hash'] = $hash;
$data['invoice'] = hooks()->apply_filters('invoice_html_pdf_data', $invoice);
$data['bodyclass'] = 'viewinvoice';
$this->data($data);
$this->view('invoicehtml');
add_views_tracking('invoice', $id);
hooks()->do_action('invoice_html_viewed', $id);
no_index_customers_area();
$this->layout();
}
}