From e4cc3e1b2c6528ab66aff4871bdb41e91d236cb3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 7 Jul 2020 07:05:18 +0200 Subject: [PATCH 1/5] NEW: Add column quantity in product margin page --- htdocs/margin/productMargins.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index cb67cb0d58f..25176220d49 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2020 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -180,6 +181,7 @@ if ($id > 0) $sql .= " d.fk_product,"; if ($id > 0) $sql .= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql .= " SUM(d.total_ht) as selling_price,"; // Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) +$sql .= " SUM(d.qty) as product_qty,"; $sql .= " SUM(".$db->ifsql('d.total_ht < 0', 'd.qty * d.buy_price_ht * -1 * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; $sql .= " SUM(".$db->ifsql('d.total_ht < 0', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -235,27 +237,30 @@ if ($result) print ''; if ($id > 0) { print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); } else { print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder); } - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder,'center '); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); if (!empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); if (!empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); print "\n"; $cumul_achat = 0; $cumul_vente = 0; + $cumul_qty = 0; if ($num > 0) { while ($i < $num /*&& $i < $conf->liste_limit*/) { $objp = $db->fetch_object($result); + $qty = $objp->product_qty; $pa = $objp->buying_price; $pv = $objp->selling_price; $marge = $objp->marge; @@ -295,9 +300,10 @@ if ($result) print "\n"; //print "".$product_static->getNomUrl(1)."\n"; } - print "".price(price2num($pv, 'MT'))."\n"; - print "".price(price2num($pa, 'MT'))."\n"; - print "".price(price2num($marge, 'MT'))."\n"; + print "".$qty."\n"; + print "".price(price2num($pv, 'MT'))."\n"; + print "".price(price2num($pa, 'MT'))."\n"; + print "".price(price2num($marge, 'MT'))."\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) print "".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) @@ -307,6 +313,7 @@ if ($result) $i++; $cumul_achat += $objp->buying_price; $cumul_vente += $objp->selling_price; + $cumul_qty += $objp->product_qty; } } @@ -322,9 +329,10 @@ if ($result) print ''; else print ''; print $langs->trans('TotalMargin').""; - print "".price(price2num($cumul_vente, 'MT'))."\n"; - print "".price(price2num($cumul_achat, 'MT'))."\n"; - print "".price(price2num($totalMargin, 'MT'))."\n"; + print "".$cumul_qty.""; + print "".price(price2num($cumul_vente, 'MT'))."\n"; + print "".price(price2num($cumul_achat, 'MT'))."\n"; + print "".price(price2num($totalMargin, 'MT'))."\n"; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) print "".(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%")."\n"; if (!empty($conf->global->DISPLAY_MARK_RATES)) From e032c2f7b961667fbd5be579f43eea9351a6d6a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 7 Jul 2020 05:09:28 +0000 Subject: [PATCH 2/5] Fixing style errors. --- htdocs/margin/productMargins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 25176220d49..71b8b41ef8d 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -241,7 +241,7 @@ if ($result) } else { print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder); } - print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder,'center '); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); From 71a5cc752253c43591e3d1e3500081e560f53584 Mon Sep 17 00:00:00 2001 From: atm-josselin Date: Thu, 9 Jul 2020 17:13:53 +0200 Subject: [PATCH 3/5] Show label on batch card --- htdocs/product/stock/productlot_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 33281ccf278..bb19726b247 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -332,7 +332,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Product").''; $producttmp = new Product($db); $producttmp->fetch($object->fk_product); - print $producttmp->getNomUrl(1, 'stock'); + print $producttmp->getNomUrl(1, 'stock'). " - " . $producttmp->label; print ''; // Eat by From dc8bce2f430f32d48dfea7d68b9e38b2e62a14e0 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Fri, 10 Jul 2020 11:42:59 +0200 Subject: [PATCH 4/5] Update list.php --- htdocs/societe/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 9b01893e479..4de868a1b27 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -139,6 +139,8 @@ $fieldstosearchall = array( 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"CustomerAccountancyCodeShort", 's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort", + 's.zip'=>"Zip", + 's.town'=>"Town", 's.email'=>"EMail", 's.url'=>"URL", 's.tva_intra'=>"VATIntra", From a2cf47389108148597e82ea3ecb5f5b3dce45a8b Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 13 Jul 2020 14:24:07 +0200 Subject: [PATCH 5/5] add class for ticket edition (pdf or odt) --- htdocs/core/modules/ticket/modules_ticket.php | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php index ad8394fa91e..6aa027f16fc 100644 --- a/htdocs/core/modules/ticket/modules_ticket.php +++ b/htdocs/core/modules/ticket/modules_ticket.php @@ -1,6 +1,7 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2014 Marcos García + * Copyright (C) 2020 Charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,38 @@ * and parent class for projects numbering models */ +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class for documents models + */ +abstract class ModelePDFTicket extends CommonDocGenerator +{ + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + public static function liste_modeles($db, $maxfilenamelength = 0) + { + // phpcs:enable + global $conf; + + $type = 'ticket'; + $list = array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $list = getListOfModels($db, $type, $maxfilenamelength); + + return $list; + } +} + + /** * Classe mere des modeles de numerotation des references de projets */