| Server IP : 188.114.96.4 / Your IP : 104.23.243.200 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 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 : ON | Sudo : ON | Pkexec : ON Directory : /home/git/sms.edl.codes.solutions/application/controllers/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class PdfGenerator extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('crud_model');
$this->load->model('profile_model');
$this->load->model('security_model');
$this->load->model('wallet_model');
$this->load->model('accounting_model');
}
public function index()
{
//echo "module loaded";
$address = $this->input->post('customer_add_l1').',<br>'.$this->input->post('customer_add_l2').',<br>'.$this->input->post('customer_add_code').' '.$this->input->post('customer_add_city');
$data = array(
'invoice_id' => '#9999',
'name' => $this->input->post('customer_name'),
'date' =>$this->input->post('invoice_date'),
'due' => $this->input->post('due_date'),
'address' => $address,
'comment' => 'preview',
'products' => $this->input->post('invoice_product'),
'amount' => $this->input->post('amount'),
'state' => '4',
'email' => $this->crud_model->get_user_email($this->input->post('id'))
);
switch ($this->input->post('society')) {
case '1':
$this->load->view('pdf/invoice/OrangeBlue/fr',$data);
break;
case '2':
$this->load->view('pdf/invoice/Propulse/fr',$data);
break;
case '3':
$this->load->view('pdf/invoice/Themavic/fr',$data);
break;
default:
// code...
break;
}
}
function invoice(){
$token = $this->input->post('token');//$this->security_model->generateToken('2');
$id = $this->input->post('id');//'2';//
if($this->security_model->generateToken($id) == $token){
$invoice = $this->wallet_model->get_invoice($id);
$address = $invoice['Add_L1']." , ". $invoice['Add_L2']."<br>". $invoice['Add_Location']." , ". $invoice['Add_Location'];
$data = array(
'invoice_id' => $invoice['ID'],
'name' =>$invoice['Customer_Name'],
'date' => $invoice['Invoice_Date'],
'due' => $invoice['Payment_Date'],
'address' => $address,
'comment' => $invoice['Comment'],
'products' => $invoice['Product'],
'amount' => $this->wallet_model->get_invoice_price($invoice['Wallet_ID']),
'state' => $invoice['Status'],
'email' => $this->crud_model->get_user_email($invoice['Customer_ID'])
);
$langInt = $this->crud_model->get_user_lang($invoice['Customer_ID']);
$lang = $this->profile_model->intToIso($langInt);
$society = $this->crud_model->get_society_name($invoice['Society_ID']);
//var_dump($id);
$this->load->library('pdf');
//$this->pdf->load_view('pdf/test');
if(!isset($lang)|| $lang == ""){
$lang = "en";
}
$this->pdf->load_view('pdf/invoice/'.$society.'/'.$lang,$data);
//$dompdf->set_paper(DEFAULT_PDF_PAPER_SIZE, 'portrait');
$this->pdf->render();
$this->pdf->stream("invoice.pdf");
}
else{
echo "error : token corrupt";
}
}
function credit_note(){
$token = $this->input->post('token');
$id = $this->input->post('id');
if($this->security_model->generateToken($id) == $token){
$invoice = $this->wallet_model->get_invoice($id);
$address = $invoice['Add_L1']." , ". $invoice['Add_L2']."<br>". $invoice['Add_Location']." , ". $invoice['Add_Location'];
$data = array(
'credit_note_id' => $invoice['Credit_Note_ID'],
'name' =>$invoice['Customer_Name'],
'date' => $invoice['Credit_Note_Date'],
'address' => $address,
'comment' => $invoice['Credit_Note_Comment'],
'products' => $invoice['Product'],
'amount' => $this->wallet_model->get_invoice_price($invoice['Wallet_ID']),
'email' => $this->crud_model->get_user_email($invoice['Customer_ID'])
);
$langInt = $this->crud_model->get_user_lang($invoice['Customer_ID']);
$lang = $this->profile_model->intToIso($langInt);
$society = $this->crud_model->get_society_name($invoice['Society_ID']);
//var_dump($id);
$this->load->library('pdf');
//$this->pdf->load_view('pdf/test');
if(!isset($lang)|| $lang == ""){
$lang = "en";
}
$this->pdf->load_view('pdf/credit_note/'.$society.'/'.$lang,$data);
$this->pdf->render();
$this->pdf->stream("credit_note.pdf");
}
else{
echo "error : token corrupt";
}
}
}