From bed5084bcfd2e5deab487e2034cbf064c08a7729 Mon Sep 17 00:00:00 2001 From: atm-john Date: Tue, 23 Oct 2018 21:44:45 +0200 Subject: [PATCH 1/2] Add missing Max payment date col --- htdocs/compta/paiement.php | 23 +++++++++++++++++++++-- htdocs/fourn/facture/paiement.php | 25 ++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 764ca818f7f..94cd53b5424 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -526,7 +526,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie */ $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,'; - $sql.= ' f.datef as df, f.fk_soc as socid'; + $sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')'; $sql.= ' AND (f.fk_soc = '.$facture->socid; @@ -578,6 +578,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.$arraytitle.''; print ''.$langs->trans('Date').''; + print ''.$langs->trans('DateMaxPayment').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; if (!empty($conf->multicurrency->enabled)) print ''.$multicurrencyalreadypayedlabel.''; @@ -629,7 +630,25 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date print ''.dol_print_date($db->jdate($objp->df),'day')."\n"; - + + // Date Max Payment + if ($objp->dlr > 0 ) + { + print ''; + print dol_print_date($db->jdate($objp->dlr), 'day'); + + if ($invoice->hasDelay()) + { + print img_warning($langs->trans('Late')); + } + + print ''; + } + else + { + print '--'; + } + // Currency if (!empty($conf->multicurrency->enabled)) print ''.$objp->multicurrency_code."\n"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index fdd358933d9..20ef0d4b9aa 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -473,7 +473,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie * Autres factures impayees */ $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef as df,'; - $sql.= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am'; + $sql.= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am, f.date_lim_reglement as dlr'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $sql.= " WHERE f.entity = ".$conf->entity; @@ -511,6 +511,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('Invoice').''; print ''.$langs->trans('RefSupplier').''; print ''.$langs->trans('Date').''; + print ''.$langs->trans('DateMaxPayment').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').''; @@ -569,7 +570,25 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { print '!!!'; } - + + // Date Max Payment + if ($objp->dlr > 0 ) + { + print ''; + print dol_print_date($db->jdate($objp->dlr), 'day'); + + if ($invoice->hasDelay()) + { + print img_warning($langs->trans('Late')); + } + + print ''; + } + else + { + print '--'; + } + // Multicurrency if (!empty($conf->multicurrency->enabled)) { @@ -661,7 +680,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').':'; + print ''.$langs->trans('TotalTTC').':'; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; From a380d3e89b09d7bc29e3517b35a56f0953d4b58a Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Wed, 24 Oct 2018 09:19:57 +0200 Subject: [PATCH 2/2] Fix missing group by in query --- htdocs/fourn/facture/paiement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 20ef0d4b9aa..7946f98cb66 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -480,7 +480,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.paye = 0'; $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef'; + $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef, f.date_lim_reglement'; $resql = $db->query($sql); if ($resql) {