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');
38 $socid = $user->socid;
43 $hookmanager->initHooks(array(
'supplierbalencelist',
'globalcard'));
49 $form =
new Form($db);
50 $userstatic =
new User($db);
57 $societe->fetch($socid);
65 dol_banner_tab($societe,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
68 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire)
73 print '<table class="noborder tagtable liste centpercent">';
75 $sql =
"SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
76 $sql .=
" f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
77 $sql .=
" u.login, u.rowid as userid";
78 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s,".MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"user as u";
79 $sql .=
" WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
80 $sql .=
" AND f.entity IN (".getEntity(
"facture_fourn").
")";
81 $sql .=
" AND f.fk_user_valid = u.rowid";
82 $sql .=
" ORDER BY f.datef DESC";
87 $num = $db->num_rows(
$resql);
89 print
'<tr class="liste_titre">';
90 print
'<td width="100" class="center">'.$langs->trans(
"Date").
'</td>';
91 print
'<td> </td>';
92 print
'<td>'.$langs->trans(
"Status").
'</td>';
93 print
'<td class="right">'.$langs->trans(
"Debit").
'</td>';
94 print
'<td class="right">'.$langs->trans(
"Credit").
'</td>';
95 print
'<td class="right">'.$langs->trans(
"Balance").
'</td>';
96 print
'<td> </td>';
101 print
'<tr><td colspan="7">'.$langs->trans(
"NoInvoice").
'</td></tr>';
107 for ($i = 0; $i < $num; $i++)
109 $objf = $db->fetch_object(
$resql);
112 $ret = $fac->fetch($objf->facid);
115 print $fac->error.
"<br>";
118 $totalpaye = $fac->getSommePaiement();
120 print
'<tr class="oddeven">';
122 print
"<td class=\"center\">".dol_print_date($fac->date).
"</td>\n";
123 print
"<td><a href=\"facture/card.php?facid=$fac->id\">".img_object($langs->trans(
"ShowBill"),
"bill").
" ".$fac->ref.
"</a></td>\n";
125 print
'<td class="left">'.$fac->getLibStatut(2, $totalpaye).
'</td>';
126 print
'<td class="right">'.price($fac->total_ttc).
"</td>\n";
127 $solde = $solde + $fac->total_ttc;
129 print
'<td class="right"> </td>';
130 print
'<td class="right">'.price($solde).
"</td>\n";
133 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>';
138 $sql =
"SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
139 $sql .=
" p.fk_user_author, u.login, u.rowid as userid";
140 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf,";
141 $sql .=
" ".MAIN_DB_PREFIX.
"paiementfourn as p";
142 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON p.fk_user_author = u.rowid";
143 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid";
144 $sql .=
" AND pf.fk_facturefourn = ".$fac->id;
146 $resqlp = $db->query($sql);
149 $nump = $db->num_rows($resqlp);
154 $objp = $db->fetch_object($resqlp);
156 print
'<tr class="oddeven">';
157 print
'<td class="center">'.dol_print_date($db->jdate($objp->dp)).
"</td>\n";
159 print
' ';
160 print
'<a href="paiement/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"ShowPayment"),
"payment").
' '.$langs->trans(
"Payment").
' '.$objp->rowid.
'</td>';
161 print
"<td> </td>\n";
162 print
"<td> </td>\n";
163 print
'<td class="right">'.price($objp->amount).
'</td>';
164 $solde = $solde - $objp->amount;
165 print
'<td class="right">'.price($solde).
"</td>\n";
168 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>';
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 Dolibarr users.
Class to manage suppliers invoices.
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.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.