dolibarr  7.0.0-beta
avalider.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
25 require '../../main.inc.php';
26 
27 $langs->load("bills");
28 
29 // Security check
30 if (! $user->rights->facture->lire)
32 
33 $socid=0;
34 if ($user->societe_id > 0)
35 {
36  $action = '';
37  $socid = $user->societe_id;
38 }
39 
40 
41 $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
42 $sortfield = GETPOST('sortfield','alpha');
43 $sortorder = GETPOST('sortorder','alpha');
44 $page = GETPOST('page','int');
45 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
46 $offset = $limit * $page;
47 $pageprev = $page - 1;
48 $pagenext = $page + 1;
49 if (! $sortorder) $sortorder="DESC";
50 if (! $sortfield) $sortfield="p.rowid";
51 
52 
53 /*
54  * Actions
55  */
56 
57 
58 
59 /*
60  * View
61  */
62 
63 llxHeader();
64 
65 $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut";
66 $sql.=", c.libelle as paiement_type, p.num_paiement";
67 $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
68 if ($socid)
69 {
70  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
71  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
72 }
73 $sql.= " WHERE p.entity IN (" . getEntity('facture') . ')';
74 if ($socid)
75 {
76  $sql.= " AND f.fk_soc = ".$socid;
77 }
78 $sql.= " AND p.statut = 0";
79 
80 $sql.= $db->order($sortfield,$sortorder);
81 
82 // Count total nb of records
83 $nbtotalofrecords = '';
84 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
85 {
86  $result = $db->query($sql);
87  $nbtotalofrecords = $db->num_rows($result);
88 }
89 
90 $sql.= $db->plimit($limit + 1,$offset);
91 
92 $resql = $db->query($sql);
93 if ($resql)
94 {
95  $num = $db->num_rows($resql);
96  $i = 0;
97  $var=True;
98 
99  print_barre_liste($langs->trans("ReceivedCustomersPaymentsToValid"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num);
100 
101  print '<table class="noborder" width="100%">';
102  print '<tr class="liste_titre">';
103  print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder);
104  print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder);
105  print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder);
106  print_liste_field_titre("AmountTTC",$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder);
108  print "</tr>\n";
109 
110  while ($i < min($num,$limit))
111  {
112  $objp = $db->fetch_object($resql);
113 
114  print '<tr class="oddeven">';
115  print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.'</a></td>';
116  print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
117  print "<td>$objp->paiement_type $objp->num_paiement</td>\n";
118  print '<td align="right">'.price($objp->amount).'</td>';
119  print '<td align="center">';
120 
121  if ($objp->statut == 0)
122  {
123  print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">'.$langs->trans("PaymentStatusToValidShort").'</a>';
124  }
125  else
126  {
127  print "-";
128  }
129 
130  print '</td>';
131  print "</tr>";
132  $i++;
133  }
134  print "</table>";
135 }
136 
137 llxFooter();
138 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
llxHeader()
Empty header.
Definition: wrapper.php:46
getEntity($element, $shared=1, $forceentity=null)
Get list of entity id to use.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
print
Draft customers invoices.
Definition: index.php:91
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->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)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.