1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
<?php
// -- Démarrage d'une session
session_start();
// -- Variables de SESSION
@$login = $_SESSION['login'];
@$pass = $_SESSION['pass'];
@$level = $_SESSION['level'];
@$affiliation = $_SESSION['affiliation'];
include ('fichiers/util.php');
$orders = $_GET['idorders'];
// -- ORDERS
$obj_orders = new Orders();
$tab_orders = $obj_orders->liste_orders($orders); // -- Création du tableau
$ligne_orders = $obj_orders->bd->objetSuivant($tab_orders); // -- Remplissage du tableau avec les enregistrements
$customers = $ligne_orders->fk_customers_orders;
$date = $ligne_orders->date_orders;
// -- Chargement des données du client
$obj_customers = new Customers();
$tab_customers = $obj_customers->liste_customers($customers); // -- Création du tableau
$ligne_customers = $obj_customers->bd->objetSuivant($tab_customers); // -- Remplissage du tableau avec les enregistrements
// -- Chargement des pricing
@$obj_pricelistcode = new Pricelistcode();
$tab_pricelistcode = $obj_pricelistcode->liste_pricelistcode($ligne_customers->fk_pricelistcode_customers); // -- Création du tableau
$ligne_pricelistcode = $obj_pricelistcode->bd->objetSuivant($tab_pricelistcode); // -- Remplissage du tableau avec les enregistrements
// -- Utilisé pour la liste des produits
$obj_products = new Products();
$tab_products2 = $obj_products->liste_orderonly($orders,$ligne_customers->fk_pricelistcode_customers); // -- Création du tableau
$ligne_products2 = $obj_products->bd->objetSuivant($tab_products2); // -- Remplissage du tableau avec les enregistrements
$PDF=new phpToPDF();
$PDF->AddPage();
$PDF->SetFont('Arial','',10);
$PDF->Image("images/ggw.jpg", 10, 10);
$PDF->Text(100,10,'NumCustomers: '.$ligne_customers->pk_customers.'');
$PDF->Text(100,17,'NameCustomers: '.$ligne_customers->name_customers.'');
$PDF->Text(100,24,'LocationCustomers: '.$ligne_customers->location_customers.'');
$PDF->Text(100,31,'Pricelistcode: '.$ligne_pricelistcode->description_pricelistcode.'');
$PDF->Text(10, 40,'Created by: '.$login.'');
$PDF->Text(10, 47, 'Date order: '.$ligne_orders->date_orders.'');
$PDF->Text(100, 47, 'State order: '.$ligne_orders->state_orders.'');
// Définition des propriétés du tableau.
$proprietesTableau = array(
'TB_ALIGN' => 'L',
'L_MARGIN' => 0,
'BRD_COLOR' => array(255,255,255),
'BRD_SIZE' => '0',
);
// Définition des propriétés du header du tableau.
$proprieteHeader = array(
'T_COLOR' => array(0,0,0),
'T_SIZE' => 10,
'T_FONT' => 'Arial',
'T_ALIGN' => 'C',
'V_ALIGN' => 'T',
'T_TYPE' => 'B',
'LN_SIZE' => 7,
'BG_COLOR_COL0' => array(255, 255, 255),
'BG_COLOR' => array(255, 255, 255),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0,
'BRD_TYPE' => '0',
'BRD_TYPE_NEW_PAGE' => '',
);
// Contenu du header du tableau. NULL --> pas de header
$contenuHeader = array(
30,30, 25, 75, 20, 20,25,
"","Family", "NumProducts", "Desc", "UnityPrice", "Qty","TotalPrice",
);
// Définition des propriétés du reste du contenu du tableau.
$proprieteContenu = array(
'T_COLOR' => array(0, 0, 0),
'T_SIZE' => 10,
'T_FONT' => 'Arial',
'T_ALIGN_COL0' => 'L',
'T_ALIGN' => 'R',
'V_ALIGN' => 'M',
'T_TYPE' => '',
'LN_SIZE' => 6,
'BG_COLOR_COL0' => array(255,255,255),
'BG_COLOR' => array(255,255,255),
'BRD_COLOR' => array(0,92,177),
'BRD_SIZE' => 0,
'BRD_TYPE' => '0',
'BRD_TYPE_NEW_PAGE' => '',
);
$PDF->SetY(60);
$contenuTableau = array();
do {
// -- Utilisé pour trouver la quantité
$tab_orders2 = $obj_orders->trouver_quantity($orders, $ligne_products2->pk_products); // -- Création du tableau
$ligne_orders2 = $obj_orders->bd->objetSuivant($tab_orders2); // -- Remplissage du tableau avec les enregistrements
$quantity = $ligne_orders2->quantity_lineorders;
$total_quantity = ($total_quantity+$ligne_orders2->quantity_lineorders);
$x = $PDF->GetX();
$y = $PDF->GetY();
//$PDF->Image('images/ggw.jpg', $x, $y);
$total = $ligne_orders2->quantity_lineorders*$ligne_products2->retail_pricing;
$afftotal = $total.' '.$ligne_customers->currency_customers;
$totalprice = ($totalprice+$total);
array_push($contenuTableau,$x.' '.$y,$ligne_products2->pk_products,$ligne_products2->description_products,$ligne_products2->name_family,$ligne_products2->retail_pricing,$quantity,$afftotal);
} while($ligne_products2 = $obj_products->bd->objetSuivant($tab_products2));
$afftotalprice = $totalprice.' '.$ligne_customers->currency_customers;
array_push($contenuTableau,'','','','TOTAL:',$total_quantity,$afftotalprice);
$PDF->drawTableau($PDF, $proprietesTableau, $proprieteHeader, $contenuHeader, $proprieteContenu, $contenuTableau);
$PDF->Output();
?> |
Partager