diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a35342f2af9..8b1c0df7f40 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -358,6 +358,7 @@ TotalLT1ES=Total RE TotalLT2ES=Total IRPF HT=Net of tax TTC=Inc. tax +INCT=Inc. all taxes VAT=Sales tax VATs=Sales taxes LT1ES=RE diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8c86f544dba..a701a637aa8 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -33,6 +33,7 @@ */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_expression.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; @@ -759,12 +760,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print ''.$langs->trans("MinPrice").''; print ''; - $var=True; - for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { - $var = ! $var; - print ''; // Label of price @@ -1244,11 +1241,8 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; - $var = false; for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { - $var = !$var; - print ''; print ''; print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); @@ -1389,13 +1383,12 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ $notfirstlineforlevel=array(); - $var = True; $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); - $var = ! $var; - print ''; + + print ''; // Date print "" . dol_print_date($db->jdate($objp->dp), "dayhour") . ""; @@ -1440,7 +1433,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ print ''; } } + print '' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . ''; + print '' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . ''; // User @@ -1729,11 +1724,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ' '; print ''; - $var = True; - foreach ($prodcustprice->lines as $line) { - $var = ! $var; print ''; // Date $staticsoc = new Societe($db); @@ -1748,6 +1740,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '' . vatrate($tva_tx, true, $line->recuperableonly) . ""; print '' . price($line->price) . ""; print '' . price($line->price_ttc) . ""; + print '' . price($line->price_min) . ''; print '' . price($line->price_min_ttc) . ''; @@ -1757,6 +1750,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print $userstatic->getLoginUrl(1); print ''; + print ''; } print ""; } else { @@ -1788,24 +1782,14 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($prodcustprice->lines) > 0 || $search_soc) { + $colspan=8; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++; + print ''; print ''; - print ''; + print ''; // Print the search button print ''; } - $var = False; - + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print ''; + print ''; + print ''; + print ''; + print ''; + print ''; // Line for default price + if ($object->price_base_type=='HT') + { + $pu=$object->price; + } + else + { + $pu=$object->price_ttc; + } + + // 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); + // 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); + // 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 ''; print ""; print ""; @@ -1827,8 +1842,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print vatrate($object->tva_tx, true, $object->recuperableonly); print $object->default_vat_code?' ('.$object->default_vat_code.')':''; print ""; + print '"; print '"; + + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print ''; + print ''; print ''; print ''; // Date @@ -1864,6 +1880,27 @@ 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') + { + $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($object->tva_tx.($object->default_vat_code?' ('.$object->default_vat_code.')':''), 0, $mysoc, $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); + // 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 ""; print ""; @@ -1871,6 +1908,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '"; print '"; print '"; + + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print ''; + print ''; print '';
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VATRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
  '; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -1814,10 +1798,41 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VATRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("INCT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
" . $langs->trans("Default") . "" . "' . price($object->price) . "' . price($object->price_ttc) . "' . price($resultarray[2]) . '' . price($object->price_min) . '' . price($object->price_min_ttc) . ''; @@ -1851,11 +1870,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) if (count($prodcustprice->lines) > 0) { - $var = false; foreach ($prodcustprice->lines as $line) { - $var = ! $var; - print '
" . $staticsoc->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . vatrate($tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($resultarray[2]) . '' . price($line->price_min) . '' . price($line->price_min_ttc) . '