On fait march l'apercu du specimen des modeles expedition

This commit is contained in:
Laurent Destailleur 2006-08-26 14:13:37 +00:00
parent ffcfab529c
commit 74f6dcde9e
4 changed files with 52 additions and 49 deletions

View File

@ -578,46 +578,46 @@ class Expedition extends CommonObject
*/
function fetch_commande()
{
$this->commande =& new Commande($this->db);
$this->commande = & new Commande($this->db);
$this->commande->fetch($this->commande_id);
}
function fetch_lignes()
{
$this->lignes = array();
$sql = "SELECT c.description, c.qty as qtycom, e.qty as qtyexp";
$sql .= ", c.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as e";
$sql .= " , ".MAIN_DB_PREFIX."commandedet as c";
$sql .= " WHERE e.fk_expedition = ".$this->id;
$sql .= " AND e.fk_commande_ligne = c.rowid";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$ligne = new ExpeditionLigne($this->db);
$obj = $this->db->fetch_object($resql);
$ligne->fk_product = $obj->fk_product;
$ligne->qty_commande = $obj->qtycom;
$ligne->qty_expedition = $obj->qtyexp;
$ligne->description = $obj->description;
$this->lignes[$i] = $ligne;
$i++;
}
$this->db->free($resql);
}
return $this->lignes;
}
function fetch_lignes()
{
$this->lignes = array();
$sql = "SELECT c.description, c.qty as qtycom, e.qty as qtyexp";
$sql .= ", c.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as e";
$sql .= " , ".MAIN_DB_PREFIX."commandedet as c";
$sql .= " WHERE e.fk_expedition = ".$this->id;
$sql .= " AND e.fk_commande_ligne = c.rowid";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$ligne = new ExpeditionLigne($this->db);
$obj = $this->db->fetch_object($resql);
$ligne->fk_product = $obj->fk_product;
$ligne->qty_commande = $obj->qtycom;
$ligne->qty_expedition = $obj->qtyexp;
$ligne->description = $obj->description;
$this->lignes[$i] = $ligne;
$i++;
}
$this->db->free($resql);
}
return $this->lignes;
}
/**
* \brief Retourne le libellé du statut d'une expedition

View File

@ -142,7 +142,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
// Sauvegarde le dernier modèle choisi pour générer un document
$expedition = new Expedition($db, 0, $_REQUEST['id']);
$expedition->fetch($_REQUEST['id']);
$expedition->fetch_commande();
if ($_REQUEST['model'])
{
$expedition->set_pdf_model($user, $_REQUEST['model']);

View File

@ -122,7 +122,8 @@ function expedition_pdf_create($db, $id, $modele='', $outputlangs='')
$expedition = new Expedition($db);
$result=$expedition->fetch($id);
$result=$expedition->fetch_commande();
if ($obj->write_file($expedition, $langs) > 0)
{
// on supprime l'image correspondant au preview

View File

@ -199,10 +199,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('Arial','', 10);
$curY = $this->tableau_top + 5;
$pdf->Text(12, $curY+2, $outputlangs->trans("Description"));
$pdf->Text(166, $curY, $outputlangs->trans("Qty"));
$pdf->Text(166, $curY+4, "Commandée");
$pdf->Text(190, $curY, $outputlangs->trans("Qty"));
$pdf->Text(190, $curY+4, "Livrée");
$pdf->Text(160, $curY, $outputlangs->trans("Qty"));
$pdf->Text(160, $curY+4, "Commandée");
$pdf->Text(186, $curY, $outputlangs->trans("Qty"));
$pdf->Text(186, $curY+4, "Livrée");
$this->expe->fetch_lignes();
for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++)
@ -243,20 +243,22 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled)
{
$pdf->writeHTMLCell(108, 4, $this->posxdesc, $curY, $libelleproduitservice, 0, 1);
$pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $libelleproduitservice, 0, 1);
// $pdf->SetXY ($this->posxdesc, $curY);
// $pdf->MultiCell(150, 3, "zzzz g dg fdgdfgfgfgfdg dfg dfgdfgfdggggggggggggggggggg f g fd g fdgfdgggggggggggggggggggggggggggg fg df g ff hf hz", 0, 'J');
}
else
{
$pdf->SetXY ($this->posxdesc, $curY);
$pdf->MultiCell(108, 4, $libelleproduitservice, 0, 'J');
$pdf->MultiCell(150, 3, $libelleproduitservice, 0, 'J');
}
$pdf->Text(170, $curY, $this->expe->lignes[$i]->qty_commande);
$pdf->SetXY (160, $curY);
$pdf->MultiCell(30, 3, $this->expe->lignes[$i]->qty_commande);
$pdf->Text(194, $curY, $this->expe->lignes[$i]->qty_expedition);
$pdf->SetXY (186, $curY);
$pdf->MultiCell(30, 3, $this->expe->lignes[$i]->qty_expedition);
}
$pdf->AliasNbPages();