31 |
|
|
32 |
$langs->load("bills"); |
$langs->load("bills"); |
33 |
|
|
34 |
|
$user->getrights("facture"); |
35 |
|
|
36 |
// Sécurité accés client |
// Sécurité accés client |
37 |
|
if (! $user->rights->facture->lire) |
38 |
|
accessforbidden(); |
39 |
|
|
40 |
|
$socidp=0; |
41 |
if ($user->societe_id > 0) |
if ($user->societe_id > 0) |
42 |
{ |
{ |
43 |
$action = ''; |
$action = ''; |
68 |
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c"; |
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c"; |
69 |
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; |
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; |
70 |
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; |
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; |
71 |
|
if ($socidp) |
72 |
|
{ |
73 |
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; |
74 |
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid"; |
75 |
|
} |
76 |
$sql.= " WHERE p.fk_paiement = c.id"; |
$sql.= " WHERE p.fk_paiement = c.id"; |
77 |
|
if ($socidp) |
78 |
|
{ |
79 |
|
$sql.= " AND f.fk_soc = ".$socidp; |
80 |
|
} |
81 |
if ($_GET["search_montant"]) |
if ($_GET["search_montant"]) |
82 |
{ |
{ |
83 |
$sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]); |
$sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]); |
103 |
|
|
104 |
if ($resql) |
if ($resql) |
105 |
{ |
{ |
106 |
$num = $db->num_rows($resql); |
$num = $db->num_rows($resql); |
107 |
$i = 0; |
$i = 0; |
108 |
$var=True; |
$var=True; |
109 |
|
|
110 |
$paramlist=($_GET["orphelins"]?"&orphelins=1":""); |
$paramlist=($_GET["orphelins"]?"&orphelins=1":""); |
111 |
print_barre_liste($langs->trans("ReceivedPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num); |
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num); |
112 |
|
|
113 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
114 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
115 |
print_liste_field_titre($langs->trans("Ref"),"liste.php","p.rowid","",$paramlist,"",$sortfield); |
print_liste_field_titre($langs->trans("Ref"),"liste.php","p.rowid","",$paramlist,"",$sortfield); |
116 |
print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield); |
print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield); |
117 |
print_liste_field_titre($langs->trans("Type"),"liste.php","c.libelle","",$paramlist,"",$sortfield); |
print_liste_field_titre($langs->trans("Type"),"liste.php","c.libelle","",$paramlist,"",$sortfield); |
118 |
print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$paramlist,"",$sortfield); |
print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$paramlist,"",$sortfield); |
119 |
print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield); |
print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield); |
120 |
print_liste_field_titre($langs->trans("Status"),"liste.php","p.statut","",$paramlist,'align="center"',$sortfield); |
print_liste_field_titre($langs->trans("Status"),"liste.php","p.statut","",$paramlist,'align="center"',$sortfield); |
121 |
print "</tr>\n"; |
print "</tr>\n"; |
122 |
|
|
123 |
|
|
124 |
// Lignes des champs de filtre |
// Lignes des champs de filtre |
125 |
print '<form method="get" action="liste.php">'; |
print '<form method="get" action="liste.php">'; |
126 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
127 |
print '<td colspan="4"> </td>'; |
print '<td colspan="4"> </td>'; |
128 |
|
|
129 |
print '<td align="right">'; |
print '<td align="right">'; |
130 |
print '<input class="fat" type="text" size="6" name="search_montant" value="'.$_GET["search_montant"].'">'; |
print '<input class="fat" type="text" size="6" name="search_montant" value="'.$_GET["search_montant"].'">'; |
131 |
|
|
132 |
print '</td><td align="center">'; |
print '</td><td align="right">'; |
133 |
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; |
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; |
134 |
print '</td>'; |
print '</td>'; |
135 |
print "</tr>\n"; |
print "</tr>\n"; |
136 |
print '</form>'; |
print '</form>'; |
137 |
|
|
138 |
|
|
139 |
while ($i < min($num,$limit)) |
while ($i < min($num,$limit)) |
140 |
{ |
{ |
141 |
$objp = $db->fetch_object($resql); |
$objp = $db->fetch_object($resql); |
142 |
$var=!$var; |
$var=!$var; |
143 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
144 |
print '<td width="40"><a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").'</a>'; |
print '<td width="40"><a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").'</a>'; |
145 |
|
|
146 |
print ' <a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.$objp->rowid.'</a></td>'; |
print ' <a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$objp->rowid.'">'.$objp->rowid.'</a></td>'; |
147 |
|
|
148 |
print '<td align="center">'.dolibarr_print_date($objp->dp).'</td>'; |
print '<td align="center">'.dolibarr_print_date($objp->dp).'</td>'; |
149 |
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement.'</td>'; |
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement.'</td>'; |
150 |
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.$objp->label.'</a></td>'; |
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.$objp->label.'</a></td>'; |
151 |
print '<td align="right">'.price($objp->amount).'</td>'; |
print '<td align="right">'.price($objp->amount).'</td>'; |
152 |
print '<td align="center">'; |
print '<td align="center">'; |
153 |
|
|
154 |
if ($objp->statut == 0) |
if ($objp->statut == 0) |
155 |
{ |
{ |
156 |
print '<a href="fiche.php?id='.$objp->rowid.'&action=valide">'.$langs->trans("ToValidate").'</a>'; |
print '<a href="fiche.php?id='.$objp->rowid.'&action=valide">'.$langs->trans("ToValidate").'</a>'; |
157 |
} |
} |
158 |
else |
else |
159 |
{ |
{ |
160 |
print img_tick(); |
print img_tick(); |
161 |
} |
} |
162 |
|
|
163 |
print '</td></tr>'; |
print '</td></tr>'; |
164 |
$i++; |
$i++; |
165 |
} |
} |
166 |
print "</table>"; |
print "</table>"; |
167 |
} |
} |
168 |
else |
else |
169 |
{ |
{ |