modif pour assujetis tva ou pas
This commit is contained in:
parent
477b9dec25
commit
ec87bfcb7e
@ -253,19 +253,24 @@ class Commande
|
|||||||
{
|
{
|
||||||
$prod = new Product($this->db, $this->products[$i]);
|
$prod = new Product($this->db, $this->products[$i]);
|
||||||
if ($prod->fetch($this->products[$i]))
|
if ($prod->fetch($this->products[$i]))
|
||||||
{
|
|
||||||
// multiprix
|
|
||||||
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
|
||||||
{
|
{
|
||||||
$this->soc_id;
|
$this->soc_id;
|
||||||
$client = new Societe($this->db);
|
$client = new Societe($this->db);
|
||||||
$client->fetch($this->soc_id);
|
$client->fetch($this->soc_id);
|
||||||
|
if($client->tva_assuj == "0")
|
||||||
|
$tva_tx ="0";
|
||||||
|
else
|
||||||
|
$tva_tx=$prod->tva_tx;
|
||||||
|
// multiprix
|
||||||
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
|
{
|
||||||
|
|
||||||
//$prod->multiprices[$client->price_level]
|
//$prod->multiprices[$client->price_level]
|
||||||
$this->insert_product_generic($prod->libelle,
|
$this->insert_product_generic($prod->libelle,
|
||||||
$prod->description,
|
$prod->description,
|
||||||
$prod->multiprices[$client->price_level],
|
$prod->multiprices[$client->price_level],
|
||||||
$this->products_qty[$i],
|
$this->products_qty[$i],
|
||||||
$prod->tva_tx,
|
$tva_tx,
|
||||||
$this->products[$i],
|
$this->products[$i],
|
||||||
$this->products_remise_percent[$i]);
|
$this->products_remise_percent[$i]);
|
||||||
}
|
}
|
||||||
@ -275,7 +280,7 @@ class Commande
|
|||||||
$prod->description,
|
$prod->description,
|
||||||
$prod->price,
|
$prod->price,
|
||||||
$this->products_qty[$i],
|
$this->products_qty[$i],
|
||||||
$prod->tva_tx,
|
$tva_tx,
|
||||||
$this->products[$i],
|
$this->products[$i],
|
||||||
$this->products_remise_percent[$i]);
|
$this->products_remise_percent[$i]);
|
||||||
}
|
}
|
||||||
@ -409,20 +414,22 @@ class Commande
|
|||||||
{
|
{
|
||||||
$desc = $desc?$desc:$prod->libelle;
|
$desc = $desc?$desc:$prod->libelle;
|
||||||
$product_desc = $prod->description;
|
$product_desc = $prod->description;
|
||||||
|
$client = new Societe($this->db);
|
||||||
|
$client->fetch($this->soc_id);
|
||||||
|
if($client->tva_assuj == "0")
|
||||||
|
$txtva ="0";
|
||||||
|
else
|
||||||
|
$txtva=$prod->tva_tx;
|
||||||
// multiprix
|
// multiprix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||||
{
|
{
|
||||||
$client = new Societe($this->db);
|
|
||||||
$client->fetch($this->soc_id);
|
|
||||||
$pu = $prod->multiprices[$client->price_level];
|
$pu = $prod->multiprices[$client->price_level];
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$pu = $prod->price;
|
$pu = $prod->price;
|
||||||
$txtva = $prod->tva_tx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
$price = round(ereg_replace(',','.',$pu), 2);
|
$price = round(ereg_replace(',','.',$pu), 2);
|
||||||
$subprice = $price;
|
$subprice = $price;
|
||||||
@ -489,8 +496,8 @@ class Commande
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
||||||
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;";
|
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "','$fk_product',".price2num($price).", '$qty', '$txtva', $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;";
|
||||||
|
print $sql;
|
||||||
if ( $this->db->query( $sql) )
|
if ( $this->db->query( $sql) )
|
||||||
{
|
{
|
||||||
$this->update_price();
|
$this->update_price();
|
||||||
|
|||||||
@ -807,6 +807,7 @@ else
|
|||||||
print '<td>'.stripslashes(nl2br($objp->description));
|
print '<td>'.stripslashes(nl2br($objp->description));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right">'.$objp->tva_tx.'%</td>';
|
print '<td align="right">'.$objp->tva_tx.'%</td>';
|
||||||
print '<td align="right">'.price($objp->subprice).'</td>';
|
print '<td align="right">'.price($objp->subprice).'</td>';
|
||||||
print '<td align="right">'.$objp->qty.'</td>';
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
@ -857,6 +858,9 @@ else
|
|||||||
}
|
}
|
||||||
print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>';
|
print '<textarea name="eldesc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
|
if($soc->tva_assuj == "0")
|
||||||
|
print '<input type="hidden" name="eltva_tx" value="0">0';
|
||||||
|
else
|
||||||
print $html->select_tva('eltva_tx',$objp->tva_tx,$mysoc,$soc);
|
print $html->select_tva('eltva_tx',$objp->tva_tx,$mysoc,$soc);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>';
|
print '<td align="right"><input size="5" type="text" class="flat" name="elprice" value="'.price($objp->subprice).'"></td>';
|
||||||
@ -903,6 +907,9 @@ else
|
|||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print ' <td><textarea cols="50" name="desc" rows="1"></textarea></td>';
|
print ' <td><textarea cols="50" name="desc" rows="1"></textarea></td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
|
if($soc->tva_assuj == "0")
|
||||||
|
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||||
|
else
|
||||||
print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right"><input type="text" name="pu" size="5"></td>';
|
print '<td align="right"><input type="text" name="pu" size="5"></td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user