27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
32$langs->loadLangs(array(
'bills',
'companies'));
36if ($user->socid > 0) {
38 $socid = $user->socid;
43$hookmanager->initHooks(array(
'supplierbalencelist',
'globalcard'));
50$userstatic =
new User($db);
56 $societe->fetch($socid);
63 print
dol_get_fiche_head($head,
'supplier', $langs->trans(
"ThirdParty"), 0,
'company');
64 dol_banner_tab($societe,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
67 if ((isModEnabled(
"fournisseur") && $user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
"supplier_invoice",
"lire"))) {
71 print
'<table class="noborder tagtable liste centpercent">';
73 $sql =
"SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
74 $sql .=
" f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
75 $sql .=
" u.login, u.rowid as userid";
76 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"user as u";
77 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $societe->id);
78 $sql .=
" AND f.entity IN (".getEntity(
"facture_fourn").
")";
79 $sql .=
" AND f.fk_user_valid = u.rowid";
80 $sql .=
" ORDER BY f.datef DESC";
82 $resql = $db->query($sql);
84 $num = $db->num_rows($resql);
86 print
'<tr class="liste_titre">';
87 print
'<td width="100" class="center">'.$langs->trans(
"Date").
'</td>';
88 print
'<td> </td>';
89 print
'<td>'.$langs->trans(
"Status").
'</td>';
90 print
'<td class="right">'.$langs->trans(
"Debit").
'</td>';
91 print
'<td class="right">'.$langs->trans(
"Credit").
'</td>';
92 print
'<td class="right">'.$langs->trans(
"Balance").
'</td>';
93 print
'<td> </td>';
97 print
'<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
103 for ($i = 0; $i < $num; $i++) {
104 $objf = $db->fetch_object($resql);
107 $ret = $fac->fetch($objf->facid);
109 print $fac->error.
"<br>";
112 $totalpaid = $fac->getSommePaiement();
114 print
'<tr class="oddeven">';
116 print
'<td class="center">'.dol_print_date($fac->date).
"</td>\n";
117 print
"<td><a href=\"facture/card.php?facid=$fac->id\">".img_object($langs->trans(
"ShowBill"),
"bill").
" ".$fac->ref.
"</a></td>\n";
119 print
'<td class="left">'.$fac->getLibStatut(2, $totalpaid).
'</td>';
120 print
'<td class="right">'.price($fac->total_ttc).
"</td>\n";
121 $solde = $solde + $fac->total_ttc;
123 print
'<td class="right"> </td>';
124 print
'<td class="right">'.price($solde).
"</td>\n";
127 print
'<td class="nowrap" width="50"><a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$objf->userid.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$objf->login.
'</a></td>';
132 $sql =
"SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
133 $sql .=
" p.fk_user_author, u.login, u.rowid as userid";
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf,";
135 $sql .=
" ".MAIN_DB_PREFIX.
"paiementfourn as p";
136 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON p.fk_user_author = u.rowid";
137 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid";
138 $sql .=
" AND pf.fk_facturefourn = ".((int) $fac->id);
140 $resqlp = $db->query($sql);
142 $nump = $db->num_rows($resqlp);
146 $objp = $db->fetch_object($resqlp);
148 print
'<tr class="oddeven">';
149 print
'<td class="center">'.dol_print_date($db->jdate($objp->dp)).
"</td>\n";
151 print
' ';
152 print
'<a href="paiement/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowPayment"),
"payment").
' '.$langs->trans(
"Payment").
' '.$objp->rowid.
'</td>';
153 print
"<td> </td>\n";
154 print
"<td> </td>\n";
155 print
'<td class="right">'.price($objp->amount).
'</td>';
156 $solde = $solde - $objp->amount;
157 print
'<td class="right">'.price($solde).
"</td>\n";
160 print
'<td class="nowrap" width="50"><a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$objp->userid.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$objp->login.
'</a></td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage suppliers invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.