Go to the documentation of this file.
26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
31 $langs->loadLangs(array(
'bills',
'companies'));
34 $socid =
GETPOST(
"socid",
'int');
35 if ($user->socid > 0) {
37 $socid = $user->socid;
42 $hookmanager->initHooks(array(
'supplierbalencelist',
'globalcard'));
49 $userstatic =
new User($db);
55 $societe->fetch($socid);
62 print
dol_get_fiche_head($head,
'supplier', $langs->trans(
"ThirdParty"), 0,
'company');
63 dol_banner_tab($societe,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
66 if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
70 print
'<table class="noborder tagtable liste centpercent">';
72 $sql =
"SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
73 $sql .=
" f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
74 $sql .=
" u.login, u.rowid as userid";
75 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"user as u";
76 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $societe->id);
77 $sql .=
" AND f.entity IN (".getEntity(
"facture_fourn").
")";
78 $sql .=
" AND f.fk_user_valid = u.rowid";
79 $sql .=
" ORDER BY f.datef DESC";
83 $num = $db->num_rows(
$resql);
85 print
'<tr class="liste_titre">';
86 print
'<td width="100" class="center">'.$langs->trans(
"Date").
'</td>';
87 print
'<td> </td>';
88 print
'<td>'.$langs->trans(
"Status").
'</td>';
89 print
'<td class="right">'.$langs->trans(
"Debit").
'</td>';
90 print
'<td class="right">'.$langs->trans(
"Credit").
'</td>';
91 print
'<td class="right">'.$langs->trans(
"Balance").
'</td>';
92 print
'<td> </td>';
96 print
'<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
102 for ($i = 0; $i < $num; $i++) {
103 $objf = $db->fetch_object(
$resql);
106 $ret = $fac->fetch($objf->facid);
108 print $fac->error.
"<br>";
111 $totalpaid = $fac->getSommePaiement();
113 print
'<tr class="oddeven">';
115 print
'<td class="center">'.dol_print_date($fac->date).
"</td>\n";
116 print
"<td><a href=\"facture/card.php?facid=$fac->id\">".img_object($langs->trans(
"ShowBill"),
"bill").
" ".$fac->ref.
"</a></td>\n";
118 print
'<td class="left">'.$fac->getLibStatut(2, $totalpaid).
'</td>';
119 print
'<td class="right">'.price($fac->total_ttc).
"</td>\n";
120 $solde = $solde + $fac->total_ttc;
122 print
'<td class="right"> </td>';
123 print
'<td class="right">'.price($solde).
"</td>\n";
126 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>';
131 $sql =
"SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
132 $sql .=
" p.fk_user_author, u.login, u.rowid as userid";
133 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf,";
134 $sql .=
" ".MAIN_DB_PREFIX.
"paiementfourn as p";
135 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON p.fk_user_author = u.rowid";
136 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid";
137 $sql .=
" AND pf.fk_facturefourn = ".((int) $fac->id);
139 $resqlp = $db->query($sql);
141 $nump = $db->num_rows($resqlp);
145 $objp = $db->fetch_object($resqlp);
147 print
'<tr class="oddeven">';
148 print
'<td class="center">'.dol_print_date($db->jdate($objp->dp)).
"</td>\n";
150 print
' ';
151 print
'<a href="paiement/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowPayment"),
"payment").
' '.$langs->trans(
"Payment").
' '.$objp->rowid.
'</td>';
152 print
"<td> </td>\n";
153 print
"<td> </td>\n";
154 print
'<td class="right">'.price($objp->amount).
'</td>';
155 $solde = $solde - $objp->amount;
156 print
'<td class="right">'.price($solde).
"</td>\n";
159 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>';
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage suppliers invoices.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage Dolibarr users.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.