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 */ diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index cb67cb0d58f..71b8b41ef8d 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)) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 0fd37e3f55b..9b6de313b65 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -323,7 +323,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 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",