From 8d1c8e2da730ece975a3cabfa1dec843ac0adc57 Mon Sep 17 00:00:00 2001 From: AlainRnet Date: Sat, 8 Jul 2017 08:09:02 +0200 Subject: [PATCH 1/2] Update main.lang StatusInterInvoiced missing and I don't know its wording. --- htdocs/langs/en_US/main.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8b1c0df7f40..383cc807afe 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -439,6 +439,7 @@ Reporting=Reporting Reportings=Reporting Draft=Draft Drafts=Drafts +StatusInterInvoiced= Validated=Validated Opened=Open New=New @@ -835,4 +836,4 @@ SearchIntoInterventions=Interventions SearchIntoContracts=Contracts SearchIntoCustomerShipments=Customer shipments SearchIntoExpenseReports=Expense reports -SearchIntoLeaves=Leaves \ No newline at end of file +SearchIntoLeaves=Leaves From 06fe172669500d3e5b8d5fd0163695da58c35205 Mon Sep 17 00:00:00 2001 From: Philippe Date: Thu, 27 Sep 2018 20:06:00 +0200 Subject: [PATCH 2/2] FIX Product marge tabs on product card Credit note are not negative so the grand total are false --- htdocs/margin/tabs/productMargins.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 9175736d5db..f899d112a2d 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -138,9 +138,9 @@ if ($id > 0 || ! empty($ref)) $sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,"; $sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive - $sql.= " sum(d.qty) as qty,"; - $sql.= " sum(d.qty * d.buy_price_ht) as buying_price,"; // always positive - $sql.= " sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // always positive + $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty) as qty,"; // not always positive in case of Credit note + $sql.= " IF(f.type = 2, -1, 1) * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note + $sql.= " IF(f.type = 2, -1, 1) * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";