Fix: Show the supplier ref on supplier orders.
This commit is contained in:
parent
016805f867
commit
2998d68260
@ -1432,7 +1432,7 @@ class CommandeFournisseur extends Commande
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->note_public='SPECIMEN';
|
||||
$nbp = rand(1, 9);
|
||||
$nbp = rand(3, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
@ -1441,6 +1441,7 @@ class CommandeFournisseur extends Commande
|
||||
$ligne->qty=1;
|
||||
$ligne->subprice=100;
|
||||
$ligne->tva_tx=19.6;
|
||||
$ligne->ref_fourn='SUPPLIER_REF_'.$xnbp;
|
||||
$prodid = rand(1, $num_prods);
|
||||
$ligne->produit_id=$prodids[$prodid];
|
||||
$this->lignes[$xnbp]=$ligne;
|
||||
|
||||
@ -242,7 +242,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs);
|
||||
$libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs,1,1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
|
||||
@ -256,7 +256,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY ($this->posxtva, $curY);
|
||||
$pdf->MultiCell(10, 3, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
|
||||
|
||||
// Prix unitaire HT avant remise
|
||||
// Unit price before discount
|
||||
$pdf->SetXY ($this->posxup, $curY);
|
||||
$pdf->MultiCell(18, 3, price($com->lignes[$i]->subprice), 0, 'R', 0);
|
||||
|
||||
@ -264,14 +264,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY ($this->posxqty, $curY);
|
||||
$pdf->MultiCell(10, 3, $com->lignes[$i]->qty, 0, 'R');
|
||||
|
||||
// Remise sur ligne
|
||||
// Discount on line
|
||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||
if ($com->lignes[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell(14, 3, $com->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT ligne
|
||||
// Total HT line
|
||||
$pdf->SetXY ($this->postotalht, $curY);
|
||||
$total = price($com->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
||||
@ -563,7 +563,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||
}
|
||||
$pdf->SetXY ($this->postotalht-1, $tab_top+2);
|
||||
$pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHT"),'','C');
|
||||
$pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHTShort"),'','C');
|
||||
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY(100,$posy-5);
|
||||
$pdf->MultiCell(96, 4, $outputlangs->transnoentities("BillTo").":");
|
||||
$pdf->MultiCell(96, 4, $outputlangs->transnoentities("Supplier").":");
|
||||
//
|
||||
$client = new Societe($this->db);
|
||||
$client->fetch($object->socid);
|
||||
|
||||
@ -210,25 +210,25 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return line description translated in outputlangs and encoded in UTF8
|
||||
* \param line Line to format
|
||||
* \param outputlang Object lang for output
|
||||
* \param showref Show reference
|
||||
* \brief Return line description translated in outputlangs and encoded in UTF8
|
||||
* \param line Line to format
|
||||
* \param outputlang Object lang for output
|
||||
* \param showref Show reference
|
||||
* \param issupplierline Is it a line for a supplier object ?
|
||||
*/
|
||||
function pdf_getlinedesc($line,$outputlangs,$showref=1)
|
||||
function pdf_getlinedesc($line,$outputlangs,$showref=1,$issupplierline=0)
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
|
||||
$label=$line->label;
|
||||
$desc=$line->desc;
|
||||
$idprod=$line->fk_product; if (empty($idprod)) $idprod=$line->produit_id;
|
||||
$label=$line->label; if (empty($label)) $label=$line->libelle;
|
||||
$desc=$line->desc; if (empty($desc)) $desc=$line->description;
|
||||
$ref_supplier=$line->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$line->ref_fourn; // TODO Not yeld saved for supplier invoices, only supplier orders
|
||||
$note=$line->note;
|
||||
$idprod=$line->fk_product;
|
||||
|
||||
if (empty($label)) $label=$line->libelle;
|
||||
if (empty($desc)) $desc=$line->description;
|
||||
if (empty($idprod)) $idprod=$line->produit_id;
|
||||
if ($issupplierline) $prodser = new ProductFournisseur($db);
|
||||
else $prodser = new Product($db);
|
||||
|
||||
$prodser = new Product($db);
|
||||
if ($idprod)
|
||||
{
|
||||
$prodser->fetch($idprod);
|
||||
@ -269,7 +269,7 @@ function pdf_getlinedesc($line,$outputlangs,$showref=1)
|
||||
}
|
||||
}
|
||||
|
||||
// Si ligne associee a un code produit
|
||||
// If line linked to a product
|
||||
if ($idprod)
|
||||
{
|
||||
// On ajoute la ref
|
||||
@ -289,7 +289,13 @@ function pdf_getlinedesc($line,$outputlangs,$showref=1)
|
||||
}
|
||||
}
|
||||
|
||||
if ($showref) $ref_prodserv = $prodser->ref." - ";
|
||||
if ($showref)
|
||||
{
|
||||
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
||||
else $ref_prodserv = $prodser->ref; // Show local ref only
|
||||
|
||||
$ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
}
|
||||
|
||||
@ -1034,7 +1034,7 @@ class Product extends CommonObject
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.rowid = pd.fk_propal";
|
||||
$sql.= " AND p.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND pd.fk_product = ".$this->id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//$sql.= " AND pr.fk_statut != 0";
|
||||
|
||||
@ -229,3 +229,6 @@ insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
|
||||
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WI', 110, '', 0, 'WISCONSIN', 'Wisconsin', 1);
|
||||
insert into llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) values ('WY', 110, '', 0, 'WYOMONG', 'Wyoming', 1);
|
||||
|
||||
alter table llx_facture_fourn_det add column ref varchar(50) after fk_product;
|
||||
alter table llx_facture_fourn_det add column label varchar(255) after ref;
|
||||
|
||||
|
||||
@ -24,17 +24,17 @@ create table llx_commande_fournisseurdet
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_commande integer NOT NULL,
|
||||
fk_product integer,
|
||||
ref varchar(50),
|
||||
label varchar(255),
|
||||
ref varchar(50), -- supplier product ref
|
||||
label varchar(255), -- product label
|
||||
description text,
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
qty real, -- quantité
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
remise real DEFAULT 0, -- montant de la remise
|
||||
subprice double(24,8) DEFAULT 0, -- prix unitaire
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantit<EFBFBD> et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantit<EFBFBD> et incluant remise ligne et globale
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantit<EFBFBD> et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
|
||||
@ -24,6 +24,8 @@ create table llx_facture_fourn_det
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_facture_fourn integer NOT NULL,
|
||||
fk_product integer NULL,
|
||||
ref varchar(50), -- supplier product ref
|
||||
label varchar(255), -- product label
|
||||
description text,
|
||||
pu_ht double(24,8),
|
||||
pu_ttc double(24,8),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user