944 lines
34 KiB
PHP
944 lines
34 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Utilisateur
|
|
* Date: 2019-04-23
|
|
* Time: 10:21
|
|
*/
|
|
class Lots_pdf_model extends CI_Model
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
function mod_pdf_reservation($data,$mem_lang='fr'){
|
|
// require_once FCPATH.'fpdf/fpdf.php';
|
|
|
|
|
|
if ($mem_lang!='fr')
|
|
$this->lang->load("pdf_lang","english");
|
|
else
|
|
$this->lang->load("pdf_lang","french");
|
|
|
|
$this->load->library('PDF');
|
|
$pdf = new PDF();
|
|
$pdf->AddPage();
|
|
|
|
|
|
foreach ($data as $key => $value ) {
|
|
|
|
// valide si fiche transporteur
|
|
|
|
|
|
switch ($value['des_ref_type']) {
|
|
// transport
|
|
case 1:
|
|
$pdf->SetLineWidth(.5);
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B',17);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('reservation'));
|
|
$pdf->Cell(150);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(5,5,$this->langx('projet').$this->u($value['proj_numero']));
|
|
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->u($value['com_compagnie_fou']));
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('contact'));
|
|
$pdf->SetFont('Arial','',12);
|
|
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$this->u($value['fou_contact_prenom'].' '.$value['fou_contact_nom']));
|
|
$pdf->Cell(55);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('email'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['fou_contact_courriel']);
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(30,5,$this->langx('client').$this->u($value['com_compagnie']));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(80);
|
|
|
|
$pdf->Cell(5,5,$this->langx('responsable'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(22);
|
|
$pdf->Cell(5,5,$this->u($value['cli_contact_prenom'].' '.$value['cli_contact_nom']));
|
|
|
|
$pdf->Ln(7);
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->u($value['des_nom_'.$mem_lang]));
|
|
$pdf->Cell(80);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(5,5,$this->langx('qte'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['det_qte']);
|
|
$pdf->Cell(20);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(5,5,$this->langx('coutant'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['det_coutant'].' $');
|
|
|
|
|
|
$pdf->Ln(12);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',11);
|
|
$pdf->Cell(5,5,$this->langx('embarquement'));
|
|
$pdf->Ln(5);
|
|
|
|
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','',10);
|
|
|
|
$pdf->Cell(5,5,$this->u($value['det_adress']));
|
|
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(5,5,$this->langx('datedepart'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(80);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_depart'])));
|
|
|
|
$pdf->Ln(15);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(5,5,$this->langx('destination'));
|
|
$pdf->Ln(5);
|
|
|
|
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','',10);
|
|
|
|
$pdf->Cell(5,5,$this->u($value['det_destination']));
|
|
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',11);
|
|
$pdf->Cell(5,5,$this->langx('datedestination'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(80);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_retour'])));
|
|
|
|
$pdf->Ln(10);
|
|
//$pdf->Rect(10,$pdf->GetY() ,190,10) ;
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(1);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
$pdf->MultiCell(190,5,$this->langx('notes').$this->u($value['det_notes']),1);
|
|
$pdf->Ln(5);
|
|
$pdf->SetLineWidth(1);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$pdf->SetLineWidth(.5);
|
|
|
|
|
|
break;
|
|
// hebergement
|
|
case 2:
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B',17);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('reservation'));
|
|
$pdf->Cell(150);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(5,5,$this->langx('projet').$value['proj_numero']);
|
|
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->u($value['com_compagnie_fou']));
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('contact'));
|
|
$pdf->SetFont('Arial','',12);
|
|
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$this->u($value['fou_contact_prenom'].' '.$value['fou_contact_nom']));
|
|
$pdf->Cell(55);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('email'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['fou_contact_courriel']);
|
|
|
|
$pdf->Ln(15);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->u($value['des_nom_'.$mem_lang]));
|
|
$pdf->Cell(70);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('qte'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['det_qte']);
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(25,5,$this->u($value['com_compagnie']));
|
|
$pdf->Cell(80);
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->Cell(5,5,$this->langx('responsable'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(22);
|
|
$pdf->Cell(5,5,$this->u($value['cli_contact_prenom'].' '.$value['cli_contact_nom']));
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('datearrive'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(70);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_depart'])));
|
|
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('datedepart'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(70);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_retour'])));
|
|
$pdf->Ln(10);
|
|
//$pdf->Rect(10,$pdf->GetY() ,190,10) ;
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(1);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
$pdf->MultiCell(190,5,$this->langx('notes').$this->u($value['det_notes'],1));
|
|
$pdf->Ln(5);
|
|
$pdf->SetLineWidth(1);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$pdf->SetLineWidth(.5);
|
|
break;
|
|
default:
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B',17);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('reservation'));
|
|
$pdf->Cell(150);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(5,5,$this->langx('projet').$value['proj_numero']);
|
|
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->u($value['com_compagnie_fou']));
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('contact'));
|
|
$pdf->SetFont('Arial','',12);
|
|
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$this->u($value['fou_contact_prenom'].' '.$value['fou_contact_nom']));
|
|
$pdf->Cell(55);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('email'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$this->u($value['fou_contact_courriel']));
|
|
|
|
$pdf->Ln(15);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->u($value['des_nom_'.$mem_lang]));
|
|
$pdf->Cell(70);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('qte'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['det_qte']);
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(25,5,$this->u($value['com_compagnie']));
|
|
$pdf->Cell(80);
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->Cell(5,5,$this->langx('responsable'));
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(22);
|
|
$pdf->Cell(5,5,$this->u($value['cli_contact_prenom']).' '.$this->u($value['cli_contact_nom']));
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('datevisite'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(70);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_depart'])));
|
|
$pdf->Ln(10);
|
|
//$pdf->Rect(10,$pdf->GetY() ,190,10) ;
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(1);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
$pdf->MultiCell(190,5,$this->langx('notes').$this->u($value['det_notes']) ,1 );
|
|
$pdf->Ln(5);
|
|
$pdf->SetLineWidth(1);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$pdf->SetLineWidth(.5);
|
|
|
|
|
|
}
|
|
$this->Lots_model->mod_modiflot_send_reservation($value['detail_id'],1);
|
|
|
|
}
|
|
|
|
// $pdf->Output();
|
|
|
|
$pdfdoc = $pdf->Output("", "S");
|
|
return $pdfdoc;
|
|
|
|
|
|
}
|
|
function mod_pdf_confirmation($data,$nom_fichier,$mem_lot,$mem_lang){
|
|
// require_once FCPATH.'fpdf/fpdf.php';
|
|
|
|
if ($mem_lang!='fr')
|
|
$this->lang->load("pdf_lang","english");
|
|
else
|
|
$this->lang->load("pdf_lang","french");
|
|
|
|
|
|
|
|
|
|
$this->load->library('PDF');
|
|
$pdf = new PDF();
|
|
$pdf->AddPage();
|
|
$pdf->Ln(1);
|
|
|
|
$mem_entete=1;
|
|
$mem_des_ref_type=0;
|
|
$numItems = count($data);
|
|
$i = 0;
|
|
$counter=0;
|
|
foreach ($data as $key => $value ) {
|
|
// valide si fiche transporteur
|
|
|
|
$mem_des_ref_type=$value['des_ref_type'];
|
|
switch ($value['des_ref_type']) {
|
|
// transport
|
|
case 1:
|
|
if ($mem_entete==1){
|
|
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
// print("<pre>".print_r($value,true)."</pre>");
|
|
// exit;
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(20,0,$this->langx('confirmation'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(120);
|
|
$pdf->Cell(40,0,$this->langx('ent_numeroprojet_confirmation').$value['proj_numero'],0,0,'R');
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Ln(8);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(100,0,$this->u($value['com_compagnie']));
|
|
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(0,0,$this->langx('ent_date_confirmation').date("Y-m-d"));
|
|
|
|
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(100,0,$this->u($value['com_compagnie_fou']));
|
|
$pdf->SetFont('Arial','',9);
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1,5,$this->langx('ent_produit_tr_description',0,0,'L'));
|
|
$pdf->Cell(100);
|
|
$pdf->Cell(1,5,$this->langx('ent_produit_tr_qte',0,0,'L'));
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(15,5,$this->langx('ent_produit_tr_depart'),0,0,'L');
|
|
|
|
$pdf->Cell(30);
|
|
$pdf->Cell(15,5,$this->langx('ent_produit_tr_fin'),0,0,'L');
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->SetLineWidth(0.5);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$num=1;
|
|
$mem_entete=0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B',10);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(15,5,$this->u($value['des_nom_'.$mem_lang]));
|
|
$pdf->Cell(85);
|
|
$pdf->Cell(5,5,$value['det_qte']);
|
|
$pdf->Cell(10);
|
|
$pdf->Cell(15,5,date("Y-m-d H:i",strtotime($value['det_depart'])),0,0,'L');
|
|
|
|
$pdf->Cell(30);
|
|
$pdf->Cell(15,5,date("Y-m-d H:i",strtotime($value['det_retour'])),0,0,'L');
|
|
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(1,5,$this->langx('ent_produit_tr_emb').$this->u($value['det_adress']),0,0,'L');
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(1,5,$this->langx('ent_produit_tr_des').$this->u($value['det_destination']),0,0,'L');
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(1,5,$this->langx('ent_produit_tr_res').$this->u($value['det_responsable']),0,0,'L');
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
|
|
$pdf->MultiCell(190,5,$this->langx('notes').$this->u($value['det_notes'],1));
|
|
|
|
$pdf->Ln(4);
|
|
$pdf->SetLineWidth(1);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$pdf->SetLineWidth(.5);
|
|
|
|
|
|
break;
|
|
// pas bon
|
|
case 99999:
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','B',17);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('confirmation'));
|
|
$pdf->Cell(150);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(5,5,$this->langx('projet').$value['proj_numero']);
|
|
|
|
$pdf->Ln(10);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->u($value['com_compagnie_fou']));
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$this->langx('contact'));
|
|
$pdf->SetFont('Arial','',12);
|
|
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['fou_contact_prenom'].' '.$value['fou_contact_nom']);
|
|
$pdf->Cell(55);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('email'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['fou_contact_courriel']);
|
|
|
|
$pdf->Ln(15);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$value['des_nom_'.$mem_lang]);
|
|
$pdf->Cell(70);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('qte'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(5,5,$value['det_qte']);
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(5,5,$value['com_compagnie']);
|
|
$pdf->Cell(70);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('responsable'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(30);
|
|
$pdf->Cell(5,5,$value['cli_contact_prenom'].' '.$value['cli_contact_nom']);
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('datearrive'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(70);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_depart'])));
|
|
|
|
$pdf->Ln(7);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Cell(5,5,$this->langx('datedepart'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(70);
|
|
$pdf->Cell(5,5,date("Y-m-d H:i",strtotime($value['det_retour'])));
|
|
$pdf->Ln(10);
|
|
//$pdf->Rect(10,$pdf->GetY() ,190,10) ;
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(1);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
$pdf->MultiCell(190,5,$this->langx('notes').$this->u($value['det_notes'],1));
|
|
$pdf->Ln(10);
|
|
break;
|
|
default:
|
|
if ($mem_entete==1){
|
|
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
// print("<pre>".print_r($value,true)."</pre>");
|
|
// exit;
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(20,0,$this->langx('confirmation'));
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Cell(120);
|
|
$pdf->Cell(40,0,$this->langx('ent_numeroprojet_confirmation').$value['proj_numero'],0,0,'R');
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Ln(8);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(100,0,$this->u($value['com_compagnie']));
|
|
|
|
$pdf->SetFont('Arial','',12);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(0,0,$this->langx('ent_date_confirmation').date("Y-m-d"));
|
|
|
|
|
|
$pdf->SetFont('Arial','B',12);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(100,0,$this->u($value['com_compagnie_fou']));
|
|
$pdf->SetFont('Arial','',9);
|
|
$pdf->Ln(10);
|
|
|
|
$pdf->Cell(1);
|
|
$pdf->Cell(20,0,$this->langx('ent_num_confirmation'),0,0,'L');
|
|
|
|
$pdf->Cell(60,0,$this->langx('ent_produit_confirmation'),0,0,'L');
|
|
$pdf->Cell(20);
|
|
$pdf->Cell(40,0,$this->langx('ent_datedebut_confirmation'),0,0,'L');
|
|
$pdf->Cell(25);
|
|
$pdf->Cell(40,0,$this->langx('ent_qte_confirmation'),0,0,'L');
|
|
|
|
$num=1;
|
|
$mem_entete=0;
|
|
|
|
|
|
}
|
|
$pdf->Ln(5);
|
|
$pdf->SetFont('Arial','',10);
|
|
|
|
|
|
|
|
$pdf->Cell(20,5, $num);
|
|
$num= $num+1;
|
|
// $pdf->Cell(25);
|
|
$pdf->Cell(60,5,$this->u($value['des_nom_'.$mem_lang]));
|
|
// $pdf->Cell(70);
|
|
$pdf->Cell(25);
|
|
|
|
|
|
$pdf->Cell(60,5,date("Y-m-d H:i" ,strtotime($value['det_depart'])));
|
|
|
|
$pdf->Cell(15);
|
|
$pdf->Cell(40,5,$value['det_qte']);
|
|
|
|
|
|
// $pdf->Ln(3);
|
|
// $pdf->Cell(1);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
// $pdf->MultiCell(190,10,$this->langx('notes').$this->u($value['det_notes']),1);
|
|
// $pdf->Ln(10);
|
|
}
|
|
|
|
$this->Lots_model->mod_modiflot_pdf_confirmation($value['detail_id'],$nom_fichier,$mem_lot,$value['proj_ent_id']);
|
|
|
|
if ($value['des_ref_type']<> $mem_des_ref_type || ++$i === $numItems){
|
|
if ($value['des_ref_type']<>1){
|
|
|
|
$pdf->Ln(60);
|
|
$pdf->Cell(1);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(100,20,$this->langx('ent_fot_notea_confirmation'));
|
|
|
|
$pdf->Image(FCPATH.'img/pdf/confirmationtable_'.$mem_lang.'.PNG',10,150,190);
|
|
$pdf->SetY(-55);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(50,20,$this->langx('ent_fot_noteb_confirmation'));
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(50,20,$this->langx('ent_fot_notebb_confirmation'));
|
|
}
|
|
}
|
|
|
|
// changement page
|
|
if ($pdf->GetY()>170 && $counter != count( $data ) - 1){
|
|
$pdf->AddPage();
|
|
$pdf->Ln(1);
|
|
$mem_entete=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// a faire
|
|
// changer pour confirmation
|
|
|
|
|
|
$counter = $counter + 1;
|
|
}
|
|
|
|
// $pdf->Output();
|
|
|
|
$pdfdoc = $pdf->Output("", "S");
|
|
return $pdfdoc;
|
|
|
|
|
|
}
|
|
function mod_pdf_facturation_ajoutenumero($mem_pdf,$numero)
|
|
{
|
|
// require_once FCPATH.'fpdf/fpdf.php';
|
|
|
|
$mem_lang = 'fr';
|
|
|
|
//$this->load->library('PDF');
|
|
require_once( FCPATH.'fpdf/fpdf.php');
|
|
|
|
require_once( FCPATH.'fpdf/src/autoload.php');
|
|
|
|
$pdf = new \setasign\Fpdi\Fpdi();
|
|
// $pdf->AddPage();
|
|
$mem_pdf_path=FCPATH.'pdf/pdf2019/facturation/'.$mem_pdf;
|
|
|
|
//Set the source PDF file
|
|
$pagecount = $pdf->setSourceFile($mem_pdf_path);
|
|
|
|
//Import the first page of the file
|
|
// $tppl = $pdf->importPage(1);
|
|
|
|
//Use this page as template
|
|
// use the imported page and place it at point 20,30 with a width of 170 mm
|
|
// $pdf->useTemplate($tppl);
|
|
|
|
for ($pageNo = 1; $pageNo <= $pagecount; $pageNo++) {
|
|
$tplIdx = $pdf->importPage($pageNo);
|
|
|
|
// add a page
|
|
$pdf->AddPage();
|
|
$pdf->SetFont('Arial','B',12);
|
|
if($pageNo == 1)
|
|
$pdf->Ln(26);
|
|
else
|
|
$pdf->Ln(0);
|
|
$pdf->Cell(155);
|
|
$pdf->Write(0,$this->langx('ent_facture').$numero);
|
|
$pdf->useTemplate($tplIdx);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$pdf->Output($mem_pdf_path, "F");
|
|
|
|
|
|
}
|
|
function mod_pdf_facturation($data,$nom_fichier,$mem_lot,$client,$mem_lang){
|
|
// require_once FCPATH.'fpdf/fpdf.php';
|
|
if ($mem_lang!='fr')
|
|
$this->lang->load("pdf_lang","english");
|
|
else
|
|
$this->lang->load("pdf_lang","french");
|
|
|
|
|
|
// print_r($data[0]);
|
|
// exit;
|
|
$this->load->library('PDF');
|
|
$pdf = new PDF();
|
|
$pdf->SetMargins(6, 6, 3);
|
|
$pdf->AliasNbPages();
|
|
$pdf->AddPage();
|
|
// entete
|
|
// print_r($client);
|
|
//exit;
|
|
|
|
$pdf->Rect(10,$pdf->GetY() ,190,27) ;
|
|
$pdf->SetFont('Arial','B',13);
|
|
$pdf->Ln(6);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(150,0,$this->u($client->com_compagnie));
|
|
$pdf->Cell(50);
|
|
// $pdf->Cell(0,0,$mem_lot);
|
|
|
|
$pdf->SetFont('Arial','',13);
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(100,0,$this->u($data[0]['con_prenom'].' '.$data[0]['con_nom']));
|
|
|
|
$pdf->Cell(50);
|
|
$pdf->Cell(0,0,'Projet '.$this->u($data[0]['proj_numero']));
|
|
$pdf->SetFont('Arial','',13);
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(100,0,$this->u($client->com_adresse));
|
|
$pdf->Cell(50);
|
|
$pdf->Cell(0,0,$this->u($client->com_telephone));
|
|
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(100,0,$this->u($client->com_ville.','.$client->StateOrProvince.' '.$client->com_codepostal));
|
|
$pdf->SetFont('Arial','',9);
|
|
$pdf->Cell(25);
|
|
$pdf->Cell(0,0,$this->langx('ent_date_facturation').date("Y-m-d"));
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(130);
|
|
$pdf->Cell(0,0,$this->langx('ent_rep').$this->u($data[0]['usa_prenom'].' '.$data[0]['usa_nom']));
|
|
$pdf->SetFont('Arial','B',13);
|
|
$pdf->Ln(13);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(150,0,$this->u($data[0]['proj_nom']));
|
|
$pdf->SetFont('Arial','',9);
|
|
$pdf->Ln(5);
|
|
|
|
$pdf->Cell(120);
|
|
$pdf->Cell(20,0,$this->langx('ent_qte_facturation'),0,0,'R');
|
|
$pdf->Cell(25,0,$this->langx('ent_prix_facturation'),0,0,'R');
|
|
$pdf->Cell(25,0,$this->langx('ent_total_facturation'),0,0,'R');
|
|
|
|
$mem_total=0;
|
|
$mem_sous_total=0;
|
|
$mem_total_tps=0;
|
|
$mem_total_tvq=0;
|
|
$mem_total_tvh=0;
|
|
$mem_total_opc=0;
|
|
$mem_tot=0;
|
|
$mem_depot=0;
|
|
$mem_max=count($data);
|
|
$max=1;
|
|
$mem_page=1;
|
|
foreach ($data as $key => $value ) {
|
|
|
|
// valide si fiche transporteur
|
|
// echo('-----<br>');
|
|
// print_r($data);
|
|
switch ($value['des_ref_type']) {
|
|
// transport
|
|
|
|
default:
|
|
// si taxe
|
|
$mem_tx=' ';
|
|
if ($value['des_tps']==1 || $value['des_tvq'] || $value['des_tvh'])
|
|
$mem_tx='Tx';
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->SetFont('Arial','B',10);
|
|
|
|
$mem_titre=$this->u($value['des_nom_'.$mem_lang]);
|
|
if ($this->u($value['com_compagnie_fou'])!="")
|
|
{
|
|
$mem_titre=$this->u($value['des_nom_'.$mem_lang])."-".$this->u($value['com_compagnie_fou']);
|
|
|
|
}
|
|
$pdf->Cell(80,0, $mem_titre);
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(35);
|
|
$pdf->Cell(20,0,$value['det_qte'],0,0,'R');
|
|
$pdf->Cell(30,0,number_format($value['det_vendant'], 2, '.', ' ').' $ '.$mem_tx,0,0,'R');
|
|
$tot_ligne=$value['det_qte']*$value['det_vendant'];
|
|
$pdf->Cell(25,0,number_format($tot_ligne, 2, '.', ' ').' $',0,0,'R');
|
|
// $pdf->Ln(5);
|
|
// $pdf->Cell(6);
|
|
// $pdf->Cell(50,0,$this->u($value['des_nom_'.$mem_lang]));
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(50,0,date("Y-m-d",strtotime($value['det_depart'])));
|
|
|
|
//$pdf->Rect(10,$pdf->GetY() ,190,10) ;
|
|
$pdf->Ln(3);
|
|
$pdf->Cell(5);
|
|
//$pdf->Cell(5,5,$this->langx('notes').$value['det_notes']);
|
|
$pdf->MultiCell(125,5,$this->langx('notes').$this->u($value['det_notes']),0);
|
|
|
|
// total et taxe
|
|
|
|
$mem_sous_total= $mem_sous_total+$tot_ligne;
|
|
if ($value['des_tps']==1)
|
|
$mem_total_tps=$mem_total_tps+$tot_ligne;
|
|
if ($value['des_tvq']==1)
|
|
$mem_total_tvq=$mem_total_tvq+$tot_ligne;
|
|
if ($value['des_tvh']==1)
|
|
$mem_total_tvh=$mem_total_tvh+$tot_ligne;
|
|
if ($value['des_opc']==1)
|
|
$mem_total_opc=$mem_total_opc+$tot_ligne;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->Lots_model->mod_modiflot_pdf_facturation($value['detail_id'],$nom_fichier,$mem_lot,0);
|
|
|
|
|
|
if ($mem_max<>$max){
|
|
$pdf->Ln(2);
|
|
$pdf->Cell(5);
|
|
$pdf->SetLineWidth(0.5);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
|
|
}
|
|
|
|
if ($pdf->GetY()>180){
|
|
//if (2==3){
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->SetY(-25);
|
|
$pdf->Cell(0,0,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
|
|
$mem_page=$mem_page+1;
|
|
$pdf->AddPage();
|
|
$pdf->SetFont('Arial','',10);
|
|
$pdf->Cell(120);
|
|
$pdf->Cell(20,0,$this->langx('ent_qte_facturation'),0,0,'R');
|
|
$pdf->Cell(25,0,$this->langx('ent_prix_facturation'),0,0,'R');
|
|
$pdf->Cell(25,0,$this->langx('ent_total_facturation'),0,0,'R');
|
|
}
|
|
|
|
$max=$max+1;
|
|
|
|
|
|
// changer pour confirmation
|
|
}
|
|
|
|
$mem_tax=$this->Config_model->conf_tax_desc('fr');
|
|
|
|
// tot
|
|
$mem_opc=$mem_total_opc*$mem_tax['OPC']['taux'];
|
|
|
|
// imprime opc
|
|
$pdf->Cell(5);
|
|
$pdf->Ln(5);
|
|
$pdf->SetLineWidth(1);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
$pdf->SetLineWidth(.5);
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(130,0,$this->langx('ent_opc_facturation').' ('.number_format($mem_tax['OPC']['taux']*100, 1, '.', ' ').'%)');
|
|
|
|
|
|
|
|
$pdf->Cell(60,0,number_format($mem_opc, 2, '.', ' ').' $',0,0,'R');
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(130,0,$this->langx('ent_remiseopc_facturation'));
|
|
|
|
$pdf->Cell(60,0,number_format($mem_opc*-1, 2, '.', ' ').' $',0,0,'R');
|
|
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->line(12,$pdf->GetY(),200,$pdf->GetY()) ;
|
|
// sous total
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_soustotal_facturation'),0,0,'L');
|
|
$pdf->Cell(54,0,number_format($mem_sous_total , 2, '.', ' ').' $',0,0,'R');
|
|
// tps
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_tps_facturation').' ('.number_format($mem_tax['TPS']['taux'], 3, '.', ' ').'%) :' ,0,0,'L');
|
|
$mem_tps=$mem_total_tps*($mem_tax['TPS']['taux']/100);
|
|
$pdf->Cell(54,0,number_format($mem_tps , 2, '.', ' ').' $',0,0,'R');
|
|
// tvq
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_tvq_facturation').' ('.number_format($mem_tax['TVQ']['taux'], 3, '.', ' ').'%) :' ,0,0,'L');
|
|
$mem_tvq=($mem_total_tvq)*($mem_tax['TVQ']['taux']/100);
|
|
$pdf->Cell(54,0,number_format( $mem_tvq, 2, '.', ' ').' $',0,0,'R');
|
|
// tvh
|
|
if ($mem_total_tvh<>0){
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_tvh_facturation').' ('.number_format($mem_tax['TVH']['taux'], 3, '.', ' ').'%) :' ,0,0,'L');
|
|
$mem_tvh=($mem_total_tvh)*($mem_tax['TVH']['taux']/100);
|
|
$pdf->Cell(54,0,number_format( $mem_tvh, 2, '.', ' ').' $',0,0,'R');
|
|
}
|
|
|
|
|
|
|
|
// total
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_total_facturation'),0,0,'L');
|
|
$mem_total=$mem_sous_total+$mem_tvq+$mem_tps ;
|
|
$pdf->Cell(54,0,number_format($mem_total, 2, '.', ' ').' $',0,0,'R');
|
|
// depot
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_depot_facturation'),0,0,'L');
|
|
|
|
$pdf->Cell(54,0,number_format($mem_depot, 2, '.', ' ').' $',0,0,'R');
|
|
// solde
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(131);
|
|
$pdf->Cell(10,0,$this->langx('ent_solde_facturation'),0,0,'L');
|
|
$mem_solde=$mem_total-$mem_depot;
|
|
$pdf->Cell(54,0,number_format($mem_solde, 2, '.', ' ').' $',0,0,'R');
|
|
// no taxe
|
|
$pdf->SetY(-65);
|
|
// tps
|
|
$pdf->SetFont('Arial','',7);
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(10,0,$mem_tax['TPSNO']['note'] ,0,0,'L');
|
|
|
|
// tvq
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(10,0,$mem_tax['TVQNO']['note'] ,0,0,'L');
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(1);
|
|
// $pdf->Output();
|
|
$pdf->Rect(10,$pdf->GetY() ,190,20) ;
|
|
$pdf->Ln(5);
|
|
$pdf->Cell(5);
|
|
$pdf->Cell(0,0,$this->langx('ent_note1_facturation') ,0,0,'L');
|
|
$pdf->Ln(4);
|
|
$pdf->Cell(5);
|
|
$pdf->MultiCell(180,3,$this->langx('ent_note2_facturation') ,0,'L');
|
|
$pdf->SetFont('Arial','',10);
|
|
|
|
$pdf->SetY(-25);
|
|
$pdf->Cell(0,0,'Page '.$pdf->PageNo().'/{nb}',0,0,'C');
|
|
$pdfdoc = $pdf->Output("", "S");
|
|
|
|
$mem_montant['det_fac_montant']=$mem_solde;
|
|
$mem_montant['det_fac_tvq']=$mem_tvq;
|
|
$mem_montant['det_fac_tps']=$mem_tps;
|
|
$mem_montant['det_fac_tvh']=$mem_tvh;
|
|
$mem_montant['det_fac_depot']=$mem_depot;
|
|
$mem_montant['det_fac_avanttx']=$mem_sous_total;
|
|
//$mem_montant['det_fac_opc']=$mem_opc;
|
|
$mem_montant['det_fac_opc']=0;
|
|
|
|
$mem_montant['det_fac_opc_avant']=$mem_opc;
|
|
$this->Lots_model->mod_modiflot_pdf_facturation_montant($mem_lot, $mem_montant);
|
|
|
|
|
|
return $pdfdoc;
|
|
|
|
|
|
}
|
|
function langx($key){
|
|
return utf8_decode($this->lang->line($key));
|
|
|
|
}
|
|
function u($key){
|
|
return utf8_decode(($key));
|
|
|
|
}
|
|
} |