Fix total with tax does not include local taxes. To solve, i show both
totals.
This commit is contained in:
parent
8abec461a6
commit
4c0fcb2b9a
@ -1606,9 +1606,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update_customer_price_confirm">';
|
||||
print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans('ThirdParty') . '</td>';
|
||||
print '<td class="titlefield">' . $langs->trans('ThirdParty') . '</td>';
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch($prodcustprice->fk_soc);
|
||||
print "<td colspan='2'>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
@ -1620,7 +1623,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '</td></tr>';
|
||||
|
||||
// Price base
|
||||
print '<tr><td width="15%">';
|
||||
print '<tr><td>';
|
||||
print $langs->trans('PriceBase');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -1629,7 +1632,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '</tr>';
|
||||
|
||||
// Price
|
||||
print '<tr><td width="20%">';
|
||||
print '<tr><td>';
|
||||
$text = $langs->trans('SellingPrice');
|
||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||
print '</td><td>';
|
||||
@ -1658,7 +1661,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '</tr>';
|
||||
|
||||
// Update all child soc
|
||||
print '<tr><td width="15%">';
|
||||
print '<tr><td>';
|
||||
print $langs->trans('ForceUpdateChildPriceSoc');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -1668,7 +1671,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
@ -1678,7 +1683,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
}
|
||||
elseif ($action == 'showlog_customer_price')
|
||||
{
|
||||
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
||||
// List of all log of prices by customers
|
||||
print '<!-- list of all lof of prices per customer -->'."\n";
|
||||
|
||||
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int'));
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -1705,7 +1713,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
{
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
@ -1718,6 +1725,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("TTC") . '</td>';
|
||||
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . $langs->trans("INCT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("ChangedBy") . '</td>';
|
||||
@ -1726,21 +1734,44 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
|
||||
foreach ($prodcustprice->lines as $line)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
// Date
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch($line->fk_soc);
|
||||
|
||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
// Date
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch($line->fk_soc);
|
||||
|
||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
// Line for default price
|
||||
if ($line->price_base_type=='HT')
|
||||
{
|
||||
$pu=$line->price;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu=$line->price_ttc;
|
||||
}
|
||||
|
||||
// Local tax is not saved into table of product. We use value linked to VAT code.
|
||||
$localtaxarray=getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), 0, $staticsoc, $mysoc);
|
||||
// Define part of HT, VAT, TTC
|
||||
$resultarray=calcul_price_total(1, $pu, 0, $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||
// Calcul du total ht sans remise
|
||||
$total_ht = $resultarray[0];
|
||||
$total_vat = $resultarray[1];
|
||||
$total_localtax1 = $resultarray[9];
|
||||
$total_localtax2 = $resultarray[10];
|
||||
$total_ttc = $resultarray[2];
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
print '<td align="right">' . price($line->price_ttc) . "</td>";
|
||||
|
||||
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '<td align="right">' . price($resultarray[2]) . '</td>';
|
||||
|
||||
print '<td align="right">' . price($line->price_min) . '</td>';
|
||||
print '<td align="right">' . price($line->price_min_ttc) . '</td>';
|
||||
|
||||
@ -1760,7 +1791,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
else if ($action != 'showlog_default_price' && $action != 'edit_price')
|
||||
{
|
||||
// List of all prices by customers
|
||||
print '<!-- list of prices per customer -->'."\n";
|
||||
print '<!-- list of all prices per customer -->'."\n";
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -1872,8 +1903,6 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
foreach ($prodcustprice->lines as $line)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch($line->fk_soc);
|
||||
@ -1881,7 +1910,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||
|
||||
// Line for default price
|
||||
if ($object->price_base_type=='HT')
|
||||
if ($line->price_base_type=='HT')
|
||||
{
|
||||
$pu=$line->price;
|
||||
}
|
||||
@ -1891,9 +1920,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
}
|
||||
|
||||
// Local tax is not saved into table of product. We use value linked to VAT code.
|
||||
$localtaxarray=getLocalTaxesFromRate($object->tva_tx.($object->default_vat_code?' ('.$object->default_vat_code.')':''), 0, $mysoc, $mysoc);
|
||||
$localtaxarray=getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), 0, $staticsoc, $mysoc);
|
||||
// Define part of HT, VAT, TTC
|
||||
$resultarray=calcul_price_total(1, $pu, 0, $object->tva_tx, 1, 1, 0, $object->price_base_type, $object->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||
$resultarray=calcul_price_total(1, $pu, 0, $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly, $object->type, $mysoc, $localtaxarray);
|
||||
// Calcul du total ht sans remise
|
||||
$total_ht = $resultarray[0];
|
||||
$total_vat = $resultarray[1];
|
||||
@ -1901,6 +1930,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
$total_localtax2 = $resultarray[10];
|
||||
$total_ttc = $resultarray[2];
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user