Look: Amélioration look espace compta
This commit is contained in:
parent
6e9a97cbde
commit
0e7741286d
@ -1244,7 +1244,7 @@ else
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$commande->socidp.'">';
|
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$commande->socidp.'">';
|
||||||
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
|
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
if ($objp->description) print ': '.nl2br($objp->description);
|
if ($objp->description) print ' - '.nl2br($objp->description);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1728,7 +1728,7 @@ else
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$fac->socidp.'">';
|
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$fac->socidp.'">';
|
||||||
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
|
print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount");
|
||||||
print '</a>';
|
print '</a>';
|
||||||
if ($objp->description) print ': '.nl2br($objp->description);
|
if ($objp->description) print ' - '.nl2br($objp->description);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,6 +29,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
|
||||||
|
if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
|
||||||
|
if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.facture.class.php');
|
||||||
|
|
||||||
$user->getrights(); // On a besoin des permissions sur plusieurs modules
|
$user->getrights(); // On a besoin des permissions sur plusieurs modules
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
print '<tr '.$bc[$var].'><td nowrap><a href="facture.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,20).'</a></td>';
|
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,16).'</a></td>';
|
||||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$tot_ttc+=$obj->total_ttc;
|
$tot_ttc+=$obj->total_ttc;
|
||||||
@ -266,23 +269,25 @@ print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
|||||||
*/
|
*/
|
||||||
if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire)
|
if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire)
|
||||||
{
|
{
|
||||||
|
$commandestatic=new Commande($db);
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
|
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,";
|
||||||
$sql .= ", s.nom, s.idp, p.rowid, p.ref, p.total_ht, p.total_ttc";
|
$sql.= " s.nom, s.idp,";
|
||||||
|
$sql.= " p.rowid, p.ref, p.facture, p.fk_statut, p.total_ht, p.total_ttc";
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p";
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid";
|
||||||
$sql .= " WHERE p.fk_soc = s.idp";
|
$sql.= " WHERE p.fk_soc = s.idp";
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND p.fk_soc = $socidp";
|
$sql.= " AND p.fk_soc = $socidp";
|
||||||
}
|
}
|
||||||
$sql .= " AND p.fk_statut >=1 AND p.facture=0";
|
$sql.= " AND p.fk_statut = 3 AND p.facture=0";
|
||||||
$sql .= " GROUP BY p.rowid";
|
$sql.= " GROUP BY p.rowid";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
@ -294,40 +299,44 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print '<td colspan="2">'.$langs->trans("OrdersToBill").' ('.$num.')</td>';
|
print '<td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/commande/liste.php?status=3&afacturer=1">'.$langs->trans("OrdersToBill").' ('.$num.')</a></td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("ToBill").'</td>';
|
print '<td align="right">'.$langs->trans("ToBill").'</td>';
|
||||||
|
print '<td align="center" width="16"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var = True;
|
$var = True;
|
||||||
$tot_ht=$tot_ttc=$tot_tobill=0;
|
$tot_ht=$tot_ttc=$tot_tobill=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
// if ($obj->total_ttc-$obj->tot_fttc >0)
|
// if ($obj->total_ttc-$obj->tot_fttc >0)
|
||||||
// {
|
// {
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print "<td width=\"20%\"><a href=\"commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").'</a> ';
|
print "<td width=\"20%\"><a href=\"commande/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").'</a> ';
|
||||||
print "<a href=\"commande/fiche.php?id=$obj->rowid\">".$obj->ref.'</a></td>';
|
print "<a href=\"commande/fiche.php?id=$obj->rowid\">".$obj->ref.'</a></td>';
|
||||||
|
|
||||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").'</a> ';
|
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").'</a> ';
|
||||||
print '<a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,50).'</a></td>';
|
print '<a href="fiche.php?socid='.$obj->idp.'">'.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||||
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td></tr>';
|
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td>';
|
||||||
|
print '<td>'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,3).'</td>';
|
||||||
|
print '</tr>';
|
||||||
$tot_ht += $obj->total_ht;
|
$tot_ht += $obj->total_ht;
|
||||||
$tot_ttc += $obj->total_ttc;
|
$tot_ttc += $obj->total_ttc;
|
||||||
$tot_tobill += ($obj->total_ttc-$obj->tot_fttc);
|
$tot_tobill += ($obj->total_ttc-$obj->tot_fttc);
|
||||||
// }
|
// }
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||||
print '<td align="right">'.price($tot_ht).'</td>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($tot_ht).'</td>';
|
||||||
print '<td align="right">'.price($tot_ttc).'</td>';
|
print '<td align="right">'.price($tot_ttc).'</td>';
|
||||||
print '<td align="right">'.price($tot_tobill).'</td>';
|
print '<td align="right">'.price($tot_tobill).'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
@ -339,23 +348,24 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Factures impayées
|
||||||
|
*/
|
||||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
|
$facstatic=new Facture($db);
|
||||||
|
|
||||||
/*
|
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.total, f.total_ttc, ".$db->pdate("f.date_lim_reglement")." as datelimite,";
|
||||||
* Factures impayées
|
$sql.= " sum(pf.amount) as am,";
|
||||||
*
|
$sql.= " s.nom, s.idp";
|
||||||
*/
|
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc, ".$db->pdate("f.date_lim_reglement")." as datelimite, sum(pf.amount) as am";
|
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
$sql.= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socidp) $sql .= " AND f.fk_soc = $socidp";
|
if ($socidp) $sql .= " AND f.fk_soc = ".$socidp;
|
||||||
$sql.= " GROUP BY f.facnumber, f.rowid, s.nom, s.idp, f.total, f.total_ttc";
|
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.total, f.total_ttc, s.nom, s.idp";
|
||||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -368,7 +378,11 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
|||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php">'.$langs->trans("BillsCustomersUnpayed",min($conf->liste_limit,$num)).' ('.$num.')</a></td>';
|
print '<tr class="liste_titre"><td colspan="2"><a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php">'.$langs->trans("BillsCustomersUnpayed",min($conf->liste_limit,$num)).' ('.$num.')</a></td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountHT").'</td><td align="right">'.$langs->trans("AmountTTC").'</td><td align="right">'.$langs->trans("Received").'</td></tr>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Received").'</td>';
|
||||||
|
print '<td width="16"> </td>';
|
||||||
|
print '</tr>';
|
||||||
$var = True;
|
$var = True;
|
||||||
$total_ttc = $totalam = $total = 0;
|
$total_ttc = $totalam = $total = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -383,9 +397,11 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
|||||||
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||||
print '<td align="right">'.price($obj->total).'</td>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total).'</td>';
|
||||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||||
print '<td align="right">'.price($obj->am).'</td></tr>';
|
print '<td align="right">'.price($obj->am).'</td>';
|
||||||
|
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'</td>';
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$total_ttc += $obj->total_ttc;
|
$total_ttc += $obj->total_ttc;
|
||||||
$total += $obj->total;
|
$total += $obj->total;
|
||||||
@ -395,9 +411,10 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).')</font> </td>';
|
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||||
print '<td align="right">'.price($total).'</td>';
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($total).'</td>';
|
||||||
print '<td align="right">'.price($total_ttc).'</td>';
|
print '<td align="right">'.price($total_ttc).'</td>';
|
||||||
print '<td align="right">'.price($totalam).'</td>';
|
print '<td align="right">'.price($totalam).'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
@ -409,6 +426,79 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Factures a payer
|
||||||
|
*/
|
||||||
|
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||||
|
{
|
||||||
|
$facstatic=new FactureFournisseur($db);
|
||||||
|
|
||||||
|
if ($user->societe_id == 0)
|
||||||
|
{
|
||||||
|
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc,";
|
||||||
|
$sql.= " sum(pf.amount) as am,";
|
||||||
|
$sql.= " s.nom, s.idp";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE s.idp = ff.fk_soc";
|
||||||
|
$sql.= " AND ff.paye=0 AND ff.fk_statut = 1";
|
||||||
|
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.total, ff.total_ttc, s.nom, s.idp";
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpayed").' ('.$num.')</td>';
|
||||||
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Payed").'</td>';
|
||||||
|
print '<td width="16"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
$i = 0;
|
||||||
|
$var = True;
|
||||||
|
$total = $total_ttc = $totalam = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$var = !$var;
|
||||||
|
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
||||||
|
print '<td><a href="fiche.php?socidp='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||||
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||||
|
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||||
|
print '<td align="right">'.price($obj->am).'</td>';
|
||||||
|
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$total += $obj->total_ht;
|
||||||
|
$total_ttc += $obj->total_ttc;
|
||||||
|
$totalam += $obj->am;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||||
|
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($total).'</td>';
|
||||||
|
print '<td align="right">'.price($total_ttc).'</td>';
|
||||||
|
print '<td align="right">'.price($totalam).'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</table><br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// \todo Mettre ici recup des actions en rapport avec la compta
|
// \todo Mettre ici recup des actions en rapport avec la compta
|
||||||
$resql = 0;
|
$resql = 0;
|
||||||
@ -424,75 +514,14 @@ if ($resql)
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php\">$obj->libelle $obj->label</a></td></tr>";
|
print "<tr $bc[$var]><td>".dolibarr_print_date($obj->da,"%d %b %Y")."</td>";
|
||||||
|
print "<td><a href=\"action/fiche.php\">$obj->libelle $obj->label</a></td></tr>";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Factures a payer
|
|
||||||
*/
|
|
||||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
|
||||||
{
|
|
||||||
if ($user->societe_id == 0)
|
|
||||||
{
|
|
||||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.idp";
|
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user ";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
||||||
$sql .= " WHERE s.idp = ff.fk_soc";
|
|
||||||
$sql .= " AND ff.paye=0";
|
|
||||||
if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
||||||
|
|
||||||
$result=$db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows();
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpayed").' ('.$num.')</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td></tr>';
|
|
||||||
print "</tr>\n";
|
|
||||||
$i = 0;
|
|
||||||
$var = True;
|
|
||||||
$total = $total_ttc = $totalam = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$var = !$var;
|
|
||||||
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$obj->facnumber.'</a></td>';
|
|
||||||
print '<td><a href="fiche.php?socidp='.$obj->idp.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dolibarr_trunc($obj->nom,50).'</a></td>';
|
|
||||||
print '<td align="right">'.price($obj->total_ht).'</td>';
|
|
||||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
$total += $obj->total_ht;
|
|
||||||
$total_ttc += $obj->total_ttc;
|
|
||||||
$totalam += $obj->am;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
|
|
||||||
print '<td align="right">'.price($total).'</td>';
|
|
||||||
print '<td align="right">'.price($total_ttc).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table><br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user