Created supplier invoice line

This commit is contained in:
Marcos García de La Fuente 2015-03-04 10:23:18 +01:00
parent b84cf4afac
commit 47a151f157

View File

@ -457,7 +457,7 @@ class FactureFournisseur extends CommonInvoice
*/
function fetch_lines()
{
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
@ -488,6 +488,7 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline
$this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order)
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->subprice = $obj->pu_ht;
$this->lines[$i]->pu_ht = $obj->pu_ht;
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
$this->lines[$i]->tva_tx = $obj->tva_tx;
@ -495,7 +496,7 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
$this->lines[$i]->qty = $obj->qty;
$this->lines[$i]->remise_percent = $obj->remise_percent;
$this->lines[$i]->tva = $obj->tva;
$this->lines[$i]->tva = $obj->total_tva;
$this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_localtax1 = $obj->total_localtax1;
@ -1819,6 +1820,18 @@ class FactureFournisseur extends CommonInvoice
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
* Returns the rights used for this class
* @return stdClass
*/
public function getRights()
{
global $user;
return $user->rights->fournisseur->facture;
}
}
@ -1828,18 +1841,68 @@ class FactureFournisseur extends CommonInvoice
*/
class SupplierInvoiceLine extends CommonInvoice
{
var $db;
var $error;
var $pu_ht;
var $pu_ttc;
public $element='facture_fourn_det';
public $element='fournisseur->facture';
public $table_element='facture_fourn_det';
var $oldline;
var $oldline;
/**
public $ref;
public $product_ref;
public $ref_supplier;
public $libelle;
public $product_desc;
/**
* Unit price before taxes
* @var float
* @deprecated Use $subprice
*/
public $pu_ht;
/**
* Unit price included taxes
* @var float
*/
public $pu_ttc;
/**
* Total VAT amount
* @var float
* @deprecated Use $total_tva instead
*/
public $tva;
/**
* Id of the corresponding supplier invoice
* @var int
*/
var $fk_facture_fourn;
/**
* Product label
* @var string
*/
var $label; // deprecated
/**
* Description of the line
* @var string
*/
var $description;
var $skip_update_total; // Skip update price total for special lines
/**
* @var int Situation advance percentage
*/
public $situation_percent;
/**
* @var int Previous situation line id reference
*/
public $fk_prev_id;
/**
* Constructor
*
* @param DoliDB $db Database handler