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->cond_reglement_code = 'RECEP';
|
||||||
$this->mode_reglement_code = 'CHQ';
|
$this->mode_reglement_code = 'CHQ';
|
||||||
$this->note_public='SPECIMEN';
|
$this->note_public='SPECIMEN';
|
||||||
$nbp = rand(1, 9);
|
$nbp = rand(3, 5);
|
||||||
$xnbp = 0;
|
$xnbp = 0;
|
||||||
while ($xnbp < $nbp)
|
while ($xnbp < $nbp)
|
||||||
{
|
{
|
||||||
@ -1441,6 +1441,7 @@ class CommandeFournisseur extends Commande
|
|||||||
$ligne->qty=1;
|
$ligne->qty=1;
|
||||||
$ligne->subprice=100;
|
$ligne->subprice=100;
|
||||||
$ligne->tva_tx=19.6;
|
$ligne->tva_tx=19.6;
|
||||||
|
$ligne->ref_fourn='SUPPLIER_REF_'.$xnbp;
|
||||||
$prodid = rand(1, $num_prods);
|
$prodid = rand(1, $num_prods);
|
||||||
$ligne->produit_id=$prodids[$prodid];
|
$ligne->produit_id=$prodids[$prodid];
|
||||||
$this->lignes[$xnbp]=$ligne;
|
$this->lignes[$xnbp]=$ligne;
|
||||||
|
|||||||
@ -242,7 +242,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
// 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
|
$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->SetXY ($this->posxtva, $curY);
|
||||||
$pdf->MultiCell(10, 3, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
|
$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->SetXY ($this->posxup, $curY);
|
||||||
$pdf->MultiCell(18, 3, price($com->lignes[$i]->subprice), 0, 'R', 0);
|
$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->SetXY ($this->posxqty, $curY);
|
||||||
$pdf->MultiCell(10, 3, $com->lignes[$i]->qty, 0, 'R');
|
$pdf->MultiCell(10, 3, $com->lignes[$i]->qty, 0, 'R');
|
||||||
|
|
||||||
// Remise sur ligne
|
// Discount on line
|
||||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||||
if ($com->lignes[$i]->remise_percent)
|
if ($com->lignes[$i]->remise_percent)
|
||||||
{
|
{
|
||||||
$pdf->MultiCell(14, 3, $com->lignes[$i]->remise_percent."%", 0, 'R');
|
$pdf->MultiCell(14, 3, $com->lignes[$i]->remise_percent."%", 0, 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total HT ligne
|
// Total HT line
|
||||||
$pdf->SetXY ($this->postotalht, $curY);
|
$pdf->SetXY ($this->postotalht, $curY);
|
||||||
$total = price($com->lignes[$i]->total_ht);
|
$total = price($com->lignes[$i]->total_ht);
|
||||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
$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->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||||
}
|
}
|
||||||
$pdf->SetXY ($this->postotalht-1, $tab_top+2);
|
$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->SetTextColor(0,0,0);
|
||||||
$pdf->SetFont('Arial','',8);
|
$pdf->SetFont('Arial','',8);
|
||||||
$pdf->SetXY(100,$posy-5);
|
$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 = new Societe($this->db);
|
||||||
$client->fetch($object->socid);
|
$client->fetch($object->socid);
|
||||||
|
|||||||
@ -214,21 +214,21 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
* \param line Line to format
|
* \param line Line to format
|
||||||
* \param outputlang Object lang for output
|
* \param outputlang Object lang for output
|
||||||
* \param showref Show reference
|
* \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;
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
$label=$line->label;
|
$idprod=$line->fk_product; if (empty($idprod)) $idprod=$line->produit_id;
|
||||||
$desc=$line->desc;
|
$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;
|
$note=$line->note;
|
||||||
$idprod=$line->fk_product;
|
|
||||||
|
|
||||||
if (empty($label)) $label=$line->libelle;
|
if ($issupplierline) $prodser = new ProductFournisseur($db);
|
||||||
if (empty($desc)) $desc=$line->description;
|
else $prodser = new Product($db);
|
||||||
if (empty($idprod)) $idprod=$line->produit_id;
|
|
||||||
|
|
||||||
$prodser = new Product($db);
|
|
||||||
if ($idprod)
|
if ($idprod)
|
||||||
{
|
{
|
||||||
$prodser->fetch($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)
|
if ($idprod)
|
||||||
{
|
{
|
||||||
// On ajoute la ref
|
// 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;
|
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 ('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);
|
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,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_commande integer NOT NULL,
|
fk_commande integer NOT NULL,
|
||||||
fk_product integer,
|
fk_product integer,
|
||||||
ref varchar(50),
|
ref varchar(50), -- supplier product ref
|
||||||
label varchar(255),
|
label varchar(255), -- product label
|
||||||
description text,
|
description text,
|
||||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||||
qty real, -- quantité
|
qty real, -- quantity
|
||||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||||
remise real DEFAULT 0, -- montant de la remise
|
remise real DEFAULT 0, -- montant de la remise
|
||||||
subprice double(24,8) DEFAULT 0, -- prix unitaire
|
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_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é 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é 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,
|
product_type integer DEFAULT 0,
|
||||||
date_start datetime DEFAULT NULL, -- date debut si service
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
date_end datetime DEFAULT NULL, -- date fin 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,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_facture_fourn integer NOT NULL,
|
fk_facture_fourn integer NOT NULL,
|
||||||
fk_product integer NULL,
|
fk_product integer NULL,
|
||||||
|
ref varchar(50), -- supplier product ref
|
||||||
|
label varchar(255), -- product label
|
||||||
description text,
|
description text,
|
||||||
pu_ht double(24,8),
|
pu_ht double(24,8),
|
||||||
pu_ttc double(24,8),
|
pu_ttc double(24,8),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user