NEW: Thirdparty module : box on customer/supplier tab for outsantding amount late
This commit is contained in:
parent
c271761212
commit
0cb04d14d7
@ -639,10 +639,11 @@ if ($object->id > 0)
|
|||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
// Box factures
|
// Box factures
|
||||||
$tmp = $object->getOutstandingBills();
|
$tmp = $object->getOutstandingBills('customer',0);
|
||||||
$outstandingOpened = $tmp['opened'];
|
$outstandingOpened = $tmp['opened'];
|
||||||
$outstandingTotal = $tmp['total_ht'];
|
$outstandingTotal = $tmp['total_ht'];
|
||||||
$outstandingTotalIncTax = $tmp['total_ttc'];
|
$outstandingTotalIncTax = $tmp['total_ttc'];
|
||||||
|
|
||||||
$text = $langs->trans("OverAllInvoices");
|
$text = $langs->trans("OverAllInvoices");
|
||||||
$link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
|
$link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
|
||||||
$icon = 'bill';
|
$icon = 'bill';
|
||||||
@ -668,6 +669,25 @@ if ($object->id > 0)
|
|||||||
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||||
$boxstat .= '</div>';
|
$boxstat .= '</div>';
|
||||||
if ($link) $boxstat .= '</a>';
|
if ($link) $boxstat .= '</a>';
|
||||||
|
|
||||||
|
$tmp = $object->getOutstandingBills('customer',1);
|
||||||
|
$outstandingOpenedLate = $tmp['opened'];
|
||||||
|
if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
|
||||||
|
$warn = '';
|
||||||
|
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpenedLate) {
|
||||||
|
$warn = ' ' . img_warning($langs->trans("OutstandingBillReached"));
|
||||||
|
}
|
||||||
|
$text = $langs->trans("CurrentOutstandingBillLate");
|
||||||
|
$link = DOL_URL_ROOT . '/compta/recap-compta.php?socid=' . $object->id;
|
||||||
|
$icon = 'bill';
|
||||||
|
if ($link) $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
|
$boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
|
||||||
|
$boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' <span>' . $text . '</span></span><br>';
|
||||||
|
$boxstat .= '<span class="boxstatsindicator' . ($outstandingOpenedLate > 0 ? ' amountremaintopay' : '') . '">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
|
||||||
|
$boxstat .= '</div>';
|
||||||
|
if ($link) $boxstat .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
|
|||||||
@ -417,6 +417,21 @@ if ($object->id > 0)
|
|||||||
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||||
$boxstat .= '</div>';
|
$boxstat .= '</div>';
|
||||||
if ($link) $boxstat .= '</a>';
|
if ($link) $boxstat .= '</a>';
|
||||||
|
|
||||||
|
$tmp = $object->getOutstandingBills('supplier',1);
|
||||||
|
$outstandingOpenedLate = $tmp['opened'];
|
||||||
|
if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
|
||||||
|
$text = $langs->trans("CurrentOutstandingBillLate");
|
||||||
|
$link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id;
|
||||||
|
$icon = 'bill';
|
||||||
|
if ($link) $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
|
$boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
|
||||||
|
$boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' <span>' . $text . '</span></span><br>';
|
||||||
|
$boxstat .= '<span class="boxstatsindicator' . ($outstandingOpenedLate > 0 ? ' amountremaintopay' : '') . '">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
|
||||||
|
$boxstat .= '</div>';
|
||||||
|
if ($link) $boxstat .= '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$boxstat .= '</td></tr>';
|
$boxstat .= '</td></tr>';
|
||||||
|
|||||||
@ -459,4 +459,5 @@ MulticurrencyUsed=Use Multicurrency
|
|||||||
MulticurrencyCurrency=Currency
|
MulticurrencyCurrency=Currency
|
||||||
InEEC=Europe (EEC)
|
InEEC=Europe (EEC)
|
||||||
RestOfEurope=Rest of Europe (EEC)
|
RestOfEurope=Rest of Europe (EEC)
|
||||||
OutOfEurope=Out of Europe (EEC)
|
OutOfEurope=Out of Europe (EEC)
|
||||||
|
CurrentOutstandingBillLate=Current outstanding bill late
|
||||||
|
|||||||
@ -4092,9 +4092,10 @@ class Societe extends CommonObject
|
|||||||
* Return amount of bill not paid and total
|
* Return amount of bill not paid and total
|
||||||
*
|
*
|
||||||
* @param string $mode 'customer' or 'supplier'
|
* @param string $mode 'customer' or 'supplier'
|
||||||
|
* @param int $late 0 => all invoice, 1=> only late
|
||||||
* @return array array('opened'=>Amount, 'total'=>Total amount)
|
* @return array array('opened'=>Amount, 'total'=>Total amount)
|
||||||
*/
|
*/
|
||||||
public function getOutstandingBills($mode = 'customer')
|
public function getOutstandingBills($mode = 'customer', $late = 0)
|
||||||
{
|
{
|
||||||
$table = 'facture';
|
$table = 'facture';
|
||||||
if ($mode == 'supplier') $table = 'facture_fourn';
|
if ($mode == 'supplier') $table = 'facture_fourn';
|
||||||
@ -4109,6 +4110,9 @@ class Societe extends CommonObject
|
|||||||
if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
||||||
else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut as status, close_code FROM ".MAIN_DB_PREFIX.$table." as f";
|
||||||
$sql .= " WHERE fk_soc = ".$this->id;
|
$sql .= " WHERE fk_soc = ".$this->id;
|
||||||
|
if (!empty($late)) {
|
||||||
|
$sql .= " AND date_lim_reglement < '".$this->db->idate(dol_now())."'";
|
||||||
|
}
|
||||||
if ($mode == 'supplier') {
|
if ($mode == 'supplier') {
|
||||||
$sql .= " AND entity IN (".getEntity('facture_fourn').")";
|
$sql .= " AND entity IN (".getEntity('facture_fourn').")";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user