From 5c2e62633887d513a042fd6c97727b4c61eae312 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Aug 2013 12:06:18 +0200 Subject: [PATCH 01/22] More css3 --- htdocs/theme/eldy/style.css.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ddafc390fde..472b34bdb0b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1879,6 +1879,12 @@ div.tabBar .noborder { border: 1px solid #AAA; text-align: center; border-radius: 5px; + background-image: linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); + background-image: -o-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); + background-image: -moz-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); + background-image: -ms-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); + background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(164,164,164,.3)) ); } .boxtable { From 29d329a1d2bcbe8f8ad5e8545a7c18b3f45cad9e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 12 Aug 2013 15:34:09 +0200 Subject: [PATCH 02/22] ability to define margin rate on quotes, orders, invoices more to come : same on edit, user permissions --- htdocs/comm/propal.php | 13 +- htdocs/commande/fiche.php | 13 +- htdocs/compta/facture.php | 13 +- .../core/tpl/freeproductline_create.tpl.php | 118 ++++++++++++++++-- .../tpl/predefinedproductline_create.tpl.php | 113 +++++++++++++++-- 5 files changed, 246 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 235e6e7ef9b..e2504eca6af 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -724,9 +724,16 @@ else if ($action == "addline" && $user->rights->propal->creer) $price_base_type = $prod->price_base_type; } + // if price ht is forced (ie: calculated by margin rate and cost price) + if (!empty($price_ht)) + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) + elseif ($tva_tx != $prod->tva_tx) { if ($price_base_type != 'HT') { @@ -861,6 +868,8 @@ else if ($action == "addline" && $user->rights->propal->creer) unset($_POST['product_desc']); unset($_POST['fournprice']); unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); // old method unset($_POST['np_desc']); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f710dadca4..05f60f9d8eb 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -6,7 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Philippe Grand -* Copyright (C) 2012 Christophe Battarel +* Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry * @@ -666,9 +666,16 @@ else if ($action == 'addline' && $user->rights->commande->creer) $price_base_type = $prod->price_base_type; } + // if price ht is forced (ie: calculated by margin rate and cost price) + if (!empty($price_ht)) + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) + elseif ($tva_tx != $prod->tva_tx) { if ($price_base_type != 'HT') { @@ -806,6 +813,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) unset($_POST['product_desc']); unset($_POST['fournprice']); unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); // old method unset($_POST['np_desc']); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2cca7fa9a3e..b61d22a948a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013 Florian Henry * @@ -1227,9 +1227,16 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_base_type = $prod->price_base_type; } + // if price ht is forced (ie: calculated by margin rate and cost price) + if (!empty($price_ht)) + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) + elseif ($tva_tx != $prod->tva_tx) { if ($price_base_type != 'HT') { @@ -1367,6 +1374,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- unset($_POST['product_desc']); unset($_POST['fournprice']); unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); // old method unset($_POST['np_desc']); diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 2c5a90f6d4e..85d310c39c7 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2010-2013 Laurent Destailleur - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -61,8 +61,14 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob ?> global->DISPLAY_MARGIN_RATES)) $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; + if(! empty($conf->global->DISPLAY_MARGIN_RATES)) + { + echo ''.$langs->trans('MarginRate').''; + } + if(! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo ''.$langs->trans('MarkRate').''; + } } ?>   @@ -109,7 +115,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob "> "> - % + remise_client); ?>" name="remise_percent">% margin->enabled) && ! empty($object->element) && in_array($ob global->DISPLAY_MARGIN_RATES)) { - $colspan++; - $coldisplay++; + echo '%'; } - if (! empty($conf->global->DISPLAY_MARK_RATES)) { - $colspan++; - $coldisplay++; + elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { + echo '%'; } } ?> @@ -185,4 +189,100 @@ if (! empty($conf->service->enabled) && $dateSelector) ?> + +margin->enabled) { ?> + + diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 214a03fd6e7..a3fd98b6322 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2010-2012 Laurent Destailleur - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -63,8 +63,14 @@ jQuery(document).ready(function() { $colspan = 4; if (! empty($usemargins)) { - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; + if(! empty($conf->global->DISPLAY_MARGIN_RATES)) + { + echo ''.$langs->trans('MarginRate').''; + } + if(! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo ''.$langs->trans('MarkRate').''; + } ?> Create(); ?> - + % global->DISPLAY_MARGIN_RATES)) { - $colspan++; - $coldisplay++; + echo '%'; } - if (! empty($conf->global->DISPLAY_MARK_RATES)) { - $colspan++; - $coldisplay++; + elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { + echo '%'; } ?> @@ -200,6 +204,97 @@ if (! empty($usemargins)) { ?>