New: Possibilit de saisir plusieurs avoir. Ajout d'un motif sur la saisie d'un avoir.
This commit is contained in:
parent
5b1d667040
commit
5e1166d81c
@ -367,17 +367,10 @@ if ($socidp > 0)
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$sql = "SELECT rc.amount_ht,".$db->pdate("rc.datec")." as dc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.fk_soc =". $objsoc->id;
|
||||
$sql .= " AND rc.fk_user = ".$user->id." AND fk_facture IS NULL";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->amount_ht) print $obj->amount_ht.' '.$langs->trans("Currency".$conf->monnaie);
|
||||
$amount_discount=$objsoc->getcurrentDiscount();
|
||||
if ($amount_discount < 0) dolibarr_print_error($db,$societe->error);
|
||||
if ($amount_discount > 0) print $amount_discount.' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -230,8 +230,8 @@ if ($_socid > 0)
|
||||
print_titre($langs->trans("Ristournes restant dues"));
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre"><td width="80">'.$langs->trans("Date").'</td>';
|
||||
print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td width="120" align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center" width="100">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -245,8 +245,8 @@ if ($_socid > 0)
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.dolibarr_print_date($obj->dc).'</td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td>'.$obj->description.'</td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'</td>';
|
||||
if ($obj->user_id == $user->id) print '<td><a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&action=remove&remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</td>';
|
||||
else print '<td> </td>';
|
||||
@ -283,8 +283,8 @@ if ($_socid > 0)
|
||||
print_titre($langs->trans("Ristournes appliquées"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="80">'.$langs->trans("Date").'</td>';
|
||||
print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td>'.$langs->trans("ReasonDiscount").'</td>';
|
||||
print '<td width="120" align="right">'.$langs->trans("Amount").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Bill").'</td>';
|
||||
print '<td align="center" width="100">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="20"> </td>';
|
||||
@ -299,8 +299,8 @@ if ($_socid > 0)
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.dolibarr_print_date($obj->dc).'</td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td>'.$obj->description.'</td>';
|
||||
print '<td align="right">'.price($obj->amount_ht).'</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->fk_facture.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
|
||||
print '<td align="center">'.$obj->code.'</td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -285,17 +285,10 @@ if ($socid > 0)
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$sql = "SELECT rc.amount_ht,".$db->pdate("rc.datec")." as dc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.fk_soc =". $societe->id;
|
||||
$sql .= " AND rc.fk_user = ".$user->id." AND fk_facture IS NULL";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->amount_ht) print $obj->amount_ht.' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
$amount_discount=$societe->getcurrentDiscount();
|
||||
if ($amount_discount < 0) dolibarr_print_error($db,$societe->error);
|
||||
if ($amount_discount > 0) print $amount_discount.' '.$langs->trans("Currency".$conf->monnaie);
|
||||
else print $langs->trans("None");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -897,8 +897,30 @@ class Societe
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie montant des avoirs en cours
|
||||
* \param user Filtre sur un user auteur des l'avoir
|
||||
* \return int <0 si ko, montant avoir sinon
|
||||
*/
|
||||
function getCurrentDiscount($user='')
|
||||
{
|
||||
$sql = "SELECT SUM(rc.amount_ht) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql.= " WHERE rc.fk_soc =". $this->id;
|
||||
if (is_object($user)) $sql.= " AND rc.fk_user = ".$user->id.
|
||||
$sql.= " AND rc.fk_facture IS NULL";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
return $obj->amount;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
function set_price_level($price_level, $user)
|
||||
{
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user