Fight against key tva_taux. Removed completely.

This commit is contained in:
Laurent Destailleur 2015-05-14 15:59:09 +02:00
parent 33b9d492e2
commit 74607218ea
6 changed files with 18 additions and 30 deletions

View File

@ -56,9 +56,6 @@ class Form
var $cache_types_fees=array();
var $cache_vatrates=array();
var $tva_taux_value;
var $tva_taux_libelle;
/**
* Constructor
@ -3969,10 +3966,6 @@ class Form
$return.= '>'.vatrate($rate['libtva']);
$return.= $rate['nprtva'] ? ' *': '';
$return.= '</option>';
$this->tva_taux_value[] = $rate['txtva'];
$this->tva_taux_libelle[] = $rate['libtva'];
$this->tva_taux_npr[] = $rate['nprtva'];
}
if (! $options_only) $return.= '</select>';

View File

@ -342,7 +342,7 @@ class pdf_standard extends ModeleExpenseReport
// VAT Rate
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->tva_taux,true), 0, 'R');
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->vatrate,true), 0, 'R');
// UP
$pdf->SetFont('','', $default_font_size - 1);

View File

@ -879,7 +879,7 @@ if ($action == "addline")
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type);
$object_ligne->total_ttc = $tmp[2];
$object_ligne->tva_taux = GETPOST('vatrate');
$object_ligne->vatrate = GETPOST('vatrate');
$object_ligne->total_ht = $tmp[0];
$object_ligne->total_tva = $tmp[1];
@ -1649,17 +1649,17 @@ else
print '<textarea class="flat_ndf" name="comments" class="centpercent">'.$objp->comments.'</textarea>';
print '</td>';
// Sélection TVA
// VAT
print '<td style="text-align:right;">';
print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->tva_taux), $mysoc, '');
print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->vatrate), $mysoc, '');
print '</td>';
// Prix unitaire
// Unit price
print '<td style="text-align:right;">';
print '<input type="text" size="6" name="value_unit" value="'.$objp->value_unit.'" />';
print '</td>';
// Quantité
// Qty
print '<td style="text-align:right;">';
print '<input type="text" size="4" name="qty" value="'.$objp->qty.'" />';
print '</td>';

View File

@ -540,7 +540,7 @@ class ExpenseReport extends CommonObject
$line->total_ttc=120;
$line->qty=1;
$line->fk_c_tva=20;
$line->tva_taux=20;
$line->vatrate=20;
$line->value_unit=120;
$line->fk_expensereport=0;
$line->type_fees_code='TRA';
@ -724,7 +724,7 @@ class ExpenseReport extends CommonObject
$this->lines=array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva, de.tva_tx as vatrate,';
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql.= ' p.ref as ref_projet, p.title as title_projet';
@ -761,7 +761,7 @@ class ExpenseReport extends CommonObject
$deplig->type_fees_code = $objp->code_type_fees;
$deplig->type_fees_libelle = $objp->libelle_type_fees;
$deplig->tva_taux = $objp->taux_tva;
$deplig->vatrate = $objp->vatrate;
$deplig->projet_ref = $objp->ref_projet;
$deplig->projet_title = $objp->title_projet;
@ -1239,7 +1239,7 @@ class ExpenseReport extends CommonObject
$ligne->total_ht = $total_ht;
$ligne->total_tva = $total_tva;
$ligne->total_ttc = $total_ttc;
$ligne->tva_taux = $objp_tva->taux_tva;
$ligne->vatrate = $objp_tva->vatrate;
$ligne->rowid = $rowid;
// Select des infos sur le type fees
@ -1487,8 +1487,7 @@ class ExpenseReportLine
var $projet_ref;
var $projet_title;
var $tva_taux;
var $vatrate;
var $total_ht;
var $total_tva;
var $total_ttc;
@ -1512,7 +1511,7 @@ class ExpenseReportLine
function fetch($rowid)
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
$sql.= ' fde.fk_c_tva as tva_taux, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@ -1539,7 +1538,7 @@ class ExpenseReportLine
$this->type_fees_libelle = $objp->type_fees_libelle;
$this->projet_ref = $objp->projet_ref;
$this->projet_title = $objp->projet_title;
$this->tva_taux = $objp->tva_taux;
$this->vatrate = $objp->vatrate;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;

View File

@ -28,7 +28,7 @@ CREATE TABLE llx_expensereport_det
qty real NOT NULL,
value_unit real NOT NULL,
remise_percent real,
tva_tx double(6,3), -- Vat rat
tva_tx double(6,3), -- Vat rate
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
localtax1_type varchar(10) NULL, -- localtax1 type
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate

View File

@ -22,9 +22,8 @@
/**
* \class FormProduct
* \brief Class with static methods for building HTML components related to products
* \remarks Only common components must be here.
* Class with static methods for building HTML components related to products
* Only components common to products and services must be here.
*/
class FormProduct
{
@ -34,9 +33,6 @@ class FormProduct
// Cache arrays
var $cache_warehouses=array();
var $tva_taux_value;
var $tva_taux_libelle;
/**
* Constructor
@ -109,7 +105,7 @@ class FormProduct
* @param int $empty 1=Can be empty, 0 if not
* @param int $disabled 1=Select is disabled
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
* @param string $empty_label Empty label if needed (only if $empty=1)
* @param string $empty_label Empty label if needed (only if $empty=1)
* @return string HTML select
*/
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='')
@ -120,7 +116,7 @@ class FormProduct
$this->loadWarehouses($fk_product);
$nbofwarehouses=count($this->cache_warehouses);
$out='<select class="flat"'.($disabled?' disabled':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">';
if ($empty) $out.='<option value="-1">'.($empty_label?$empty_label:'&nbsp;').'</option>';
foreach($this->cache_warehouses as $id => $arraytypes)