28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
33$langs->loadLangs(array(
'bills',
'companies'));
37if ($user->socid > 0) {
39 $socid = $user->socid;
44$hookmanager->initHooks(array(
'supplierbalencelist',
'globalcard'));
51$userstatic =
new User($db);
53llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-fourn page-recap-fourn');
57 $societe->fetch($socid);
64 print
dol_get_fiche_head($head,
'supplier', $langs->trans(
"ThirdParty"), 0,
'company');
65 dol_banner_tab($societe,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
68 if ((isModEnabled(
"fournisseur") && $user->hasRight(
"fournisseur",
"facture",
"lire") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
"supplier_invoice",
"lire"))) {
72 print
'<table class="noborder tagtable liste centpercent">';
74 $sql =
"SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
75 $sql .=
" f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
76 $sql .=
" u.login, u.rowid as userid";
77 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"user as u";
78 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $societe->id);
79 $sql .=
" AND f.entity IN (".getEntity(
"facture_fourn").
")";
80 $sql .=
" AND f.fk_user_valid = u.rowid";
81 $sql .=
" ORDER BY f.datef DESC";
83 $resql = $db->query($sql);
85 $num = $db->num_rows($resql);
87 print
'<tr class="liste_titre">';
88 print
'<td width="100" class="center">'.$langs->trans(
"Date").
'</td>';
89 print
'<td> </td>';
90 print
'<td>'.$langs->trans(
"Status").
'</td>';
91 print
'<td class="right">'.$langs->trans(
"Debit").
'</td>';
92 print
'<td class="right">'.$langs->trans(
"Credit").
'</td>';
93 print
'<td class="right">'.$langs->trans(
"Balance").
'</td>';
94 print
'<td> </td>';
98 print
'<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
104 for ($i = 0; $i < $num; $i++) {
105 $objf = $db->fetch_object($resql);
108 $ret = $fac->fetch($objf->facid);
110 print $fac->error.
"<br>";
113 $totalpaid = $fac->getSommePaiement();
115 print
'<tr class="oddeven">';
117 print
'<td class="center">'.dol_print_date($fac->date).
"</td>\n";
118 print
"<td><a href=\"facture/card.php?facid=$fac->id\">".img_object($langs->trans(
"ShowBill"),
"bill").
" ".$fac->ref.
"</a></td>\n";
120 print
'<td class="left">'.$fac->getLibStatut(2, $totalpaid).
'</td>';
121 print
'<td class="right">'.price($fac->total_ttc).
"</td>\n";
122 $solde += $fac->total_ttc;
124 print
'<td class="right"> </td>';
125 print
'<td class="right">'.price($solde).
"</td>\n";
128 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>';
133 $sql =
"SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
134 $sql .=
" p.fk_user_author, u.login, u.rowid as userid";
135 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf,";
136 $sql .=
" ".MAIN_DB_PREFIX.
"paiementfourn as p";
137 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON p.fk_user_author = u.rowid";
138 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid";
139 $sql .=
" AND pf.fk_facturefourn = ".((int) $fac->id);
141 $resqlp = $db->query($sql);
143 $nump = $db->num_rows($resqlp);
147 $objp = $db->fetch_object($resqlp);
149 print
'<tr class="oddeven">';
150 print
'<td class="center">'.dol_print_date($db->jdate($objp->dp)).
"</td>\n";
152 print
' ';
153 print
'<a href="paiement/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowPayment"),
"payment").
' '.$langs->trans(
"Payment").
' '.$objp->rowid.
'</td>';
154 print
"<td> </td>\n";
155 print
"<td> </td>\n";
156 print
'<td class="right">'.price($objp->amount).
'</td>';
157 $solde -= $objp->amount;
158 print
'<td class="right">'.price($solde).
"</td>\n";
161 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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 a Dolibarr global constant string value.