';
print '| ';
print $langs->trans('PaymentConditionsShort');
@@ -3184,21 +3185,24 @@ else if ($id > 0 || ! empty($ref))
print ' | ';
// Multicurrency rate
- print '';
- print '| ';
- print '';
- print ' | ';
- if ($action == 'editmulticurrencyrate') {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- }
- print ' | ';
+ //if ($object->multicurrency_code != $conf->currency)
+ //{
+ print '';
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editmulticurrencyrate') {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ }
+ print ' | ';
+ //}
}
// Bank Account
@@ -3307,9 +3311,29 @@ else if ($id > 0 || ! empty($ref))
print '';
+ if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
+ {
+ // Multicurrency Amount HT
+ print '| ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' | ';
+ print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' ';
+
+ // Multicurrency Amount VAT
+ print '| ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' | ';
+ print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' ';
+
+ // Multicurrency Amount TTC
+ print '| ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' | ';
+ print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
+ print ' ';
+ }
+
// Amount
- print '| ' . $langs->trans('AmountHT') . ' | ';
+ print ' | ' . $langs->trans('AmountHT') . ' | ';
print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
+
+ // Vat
print '| ' . $langs->trans('AmountVAT') . ' | ' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
print '';
@@ -3355,24 +3379,6 @@ else if ($id > 0 || ! empty($ref))
// Total with tax
print '| ' . $langs->trans('AmountTTC') . ' | ' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
- if (!empty($conf->multicurrency->enabled))
- {
- // Multicurrency Amount HT
- print '| ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' | ';
- print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
- print ' ';
-
- // Multicurrency Amount VAT
- print '| ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' | ';
- print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
- print ' ';
-
- // Multicurrency Amount TTC
- print '| ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' | ';
- print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
- print ' ';
- }
-
print ' ';
// List of payments
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index fafb4ce51fe..1e3d59b7e65 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2311,7 +2311,7 @@ class Facture extends CommonInvoice
* @param string $desc Description of line
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
- * @param double $txtva Force vat rate, -1 for auto
+ * @param double $txtva Force Vat rate, -1 for auto
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
* @param int $fk_product Id of predefined product/service
@@ -2363,6 +2363,16 @@ class Facture extends CommonInvoice
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
+ $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
+
+ // Clean vat code
+ $vat_src_code='';
+ if (preg_match('/\((.*)\)/', $txtva, $reg))
+ {
+ $vat_src_code = $reg[1];
+ $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
+ }
+
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
@@ -2408,9 +2418,6 @@ class Facture extends CommonInvoice
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
- $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
- $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
-
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx);
$total_ht = $tabprice[0];
@@ -2445,6 +2452,7 @@ class Facture extends CommonInvoice
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
+ $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
@@ -4315,7 +4323,7 @@ class FactureLigne extends CommonInvoiceLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty,';
- $sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
+ $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql.= ' date_start, date_end, fk_code_ventilation, ';
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
@@ -4329,6 +4337,7 @@ class FactureLigne extends CommonInvoiceLine
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " '".$this->db->escape($this->desc)."',";
$sql.= " ".price2num($this->qty).",";
+ $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).",";
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 97630ca4252..a1f50959aa4 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -461,7 +461,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '';
// Third party
- print '| '.$langs->trans('Company').' | '.$facture->thirdparty->getNomUrl(4)." | \n";
+ print '| '.$langs->trans('Company').' | '.$facture->thirdparty->getNomUrl(4)." | \n";
// Date payment
print '| '.$langs->trans('Date').' | ';
@@ -513,7 +513,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Comments
print ' | | '.$langs->trans('Comments').' | ';
print '';
- print ' | ';
+ print '';
print ' ';
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index c9634a1d687..9bb8af69a35 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -1241,7 +1241,7 @@ class FactureFournisseur extends CommonInvoice
*
* @param string $desc Description de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
- * @param double $txtva Taux de tva force, sinon -1
+ * @param double $txtva Force Vat rate to use, -1 for auto.
* @param double $txlocaltax1 LocalTax1 Rate
* @param double $txlocaltax2 LocalTax2 Rate
* @param double $qty Quantite
@@ -1277,13 +1277,17 @@ class FactureFournisseur extends CommonInvoice
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
+
+ $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
+
// Clean vat code
+ $vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
- $txtva = preg_replace('/\((.*)\)/', '', $txtva);
+ $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
-
+
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu=price2num($pu);
@@ -1291,8 +1295,6 @@ class FactureFournisseur extends CommonInvoice
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
- $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty);
-
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@@ -1317,8 +1319,9 @@ class FactureFournisseur extends CommonInvoice
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
- $this->line->tva_tx=$txtva;
+
$this->line->vat_src_code=$vat_src_code;
+ $this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
$this->line->fk_product=$fk_product;
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 454e6e62347..e176ebcaaee 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -624,8 +624,9 @@ div.myavailability {
.maxwidth500 { max-width: 500px; }
.minheight20 { min-height: 20px; }
.minheight40 { min-height: 40px; }
-.titlefield { width: 25%; }
.titlefieldcreate { width: 20%; }
+.titlefield { width: 25%; }
+.titlefieldmiddle { width: 50%; }
/* Force values for small screen */
@media only screen and (max-width: 1400px)
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 05ba40e86d2..ef751d882f7 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -618,8 +618,9 @@ div.myavailability {
.maxwidth500 { max-width: 500px; }
.minheight20 { min-height: 20px; }
.minheight40 { min-height: 40px; }
-.titlefield { width: 25%; }
.titlefieldcreate { width: 20%; }
+.titlefield { width: 25%; }
+.titlefieldmiddle { width: 50%; }
/* Force values for small screen */
@media only screen and (max-width: 1400px)
|