Fix multicurrency and vat_src_code not propaged on invoice from
shipment.
This commit is contained in:
parent
ecae2fc6b6
commit
45004493e0
@ -3891,7 +3891,7 @@ function getTaxesFromId($vatrowid)
|
|||||||
* @param Societe $buyer Company object
|
* @param Societe $buyer Company object
|
||||||
* @param Societe $seller Company object
|
* @param Societe $seller Company object
|
||||||
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
||||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
|
||||||
*/
|
*/
|
||||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
||||||
{
|
{
|
||||||
@ -3927,22 +3927,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
{
|
{
|
||||||
if (! isOnlyOneLocalTax(1))
|
if (! isOnlyOneLocalTax(1))
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($local == 2)
|
elseif ($local == 2)
|
||||||
{
|
{
|
||||||
if (! isOnlyOneLocalTax(2))
|
if (! isOnlyOneLocalTax(2))
|
||||||
{
|
{
|
||||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3951,22 +3951,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
{
|
{
|
||||||
if(! isOnlyOneLocalTax(2))
|
if(! isOnlyOneLocalTax(2))
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(! isOnlyOneLocalTax(2))
|
if(! isOnlyOneLocalTax(2))
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1316,7 +1316,8 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
||||||
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||||
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
$sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||||
|
$sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc";
|
||||||
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||||
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||||
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
||||||
@ -1389,8 +1390,10 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
$line->pa_ht = $obj->pa_ht;
|
$line->pa_ht = $obj->pa_ht;
|
||||||
|
|
||||||
|
$localtax_array=array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx);
|
||||||
|
|
||||||
// For invoicing
|
// For invoicing
|
||||||
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
|
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc, $localtax_array); // We force type to 0
|
||||||
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
|
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
|
||||||
$line->qty = $line->qty_shipped;
|
$line->qty = $line->qty_shipped;
|
||||||
$line->total_ht = $tabprice[0];
|
$line->total_ht = $tabprice[0];
|
||||||
@ -1398,6 +1401,7 @@ class Expedition extends CommonObject
|
|||||||
$line->total_localtax2 = $tabprice[10];
|
$line->total_localtax2 = $tabprice[10];
|
||||||
$line->total_ttc = $tabprice[2];
|
$line->total_ttc = $tabprice[2];
|
||||||
$line->total_tva = $tabprice[1];
|
$line->total_tva = $tabprice[1];
|
||||||
|
$line->vat_src_code = $obj->vat_src_code;
|
||||||
$line->tva_tx = $obj->tva_tx;
|
$line->tva_tx = $obj->tva_tx;
|
||||||
$line->localtax1_tx = $obj->localtax1_tx;
|
$line->localtax1_tx = $obj->localtax1_tx;
|
||||||
$line->localtax2_tx = $obj->localtax2_tx;
|
$line->localtax2_tx = $obj->localtax2_tx;
|
||||||
@ -1411,6 +1415,14 @@ class Expedition extends CommonObject
|
|||||||
$this->total_localtax1+= $tabprice[9];
|
$this->total_localtax1+= $tabprice[9];
|
||||||
$this->total_localtax2+= $tabprice[10];
|
$this->total_localtax2+= $tabprice[10];
|
||||||
|
|
||||||
|
// Multicurrency
|
||||||
|
$this->fk_multicurrency = $obj->fk_multicurrency;
|
||||||
|
$this->multicurrency_code = $obj->multicurrency_code;
|
||||||
|
$this->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||||
|
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||||
|
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||||
|
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||||
|
|
||||||
if ($originline != $obj->fk_origin_line)
|
if ($originline != $obj->fk_origin_line)
|
||||||
{
|
{
|
||||||
$line->detail_batch = array();
|
$line->detail_batch = array();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user