dolibarr  9.0.0
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
27 require '../../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array('banks', 'categories', 'compta', 'bills'));
33 
34 // Security check
35 if ($user->societe_id) $socid=$user->societe_id;
36 $result = restrictedArea($user, 'banque', '','');
37 
38 
39 $checkdepositstatic=new RemiseCheque($db);
40 $accountstatic=new Account($db);
41 
42 
43 /*
44  * View
45  */
46 
47 llxHeader('',$langs->trans("ChequesArea"));
48 
49 print load_fiche_titre($langs->trans("ChequesArea"));
50 
51 print '<div class="fichecenter"><div class="fichethirdleft">';
52 
53 $sql = "SELECT count(b.rowid)";
54 $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
55 $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
56 $sql.= " WHERE ba.rowid = b.fk_account";
57 $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
58 $sql.= " AND b.fk_type = 'CHQ'";
59 $sql.= " AND b.fk_bordereau = 0";
60 $sql.= " AND b.amount > 0";
61 
62 $resql = $db->query($sql);
63 
64 print '<table class="noborder" width="100%">';
65 print '<tr class="liste_titre">';
66 print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
67 print "</tr>\n";
68 
69 if ($resql)
70 {
71  if ($row = $db->fetch_row($resql) )
72  {
73  $num = $row[0];
74  }
75  print '<tr class="oddeven">';
76  print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
77  print '<td align="right">';
78  print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
79  print '</td></tr>';
80  print "</table>\n";
81 }
82 else
83 {
84  dol_print_error($db);
85 }
86 
87 
88 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
89 
90 $max=10;
91 
92 $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
93 $sql.= " bc.statut, bc.nbcheque,";
94 $sql.= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
95 $sql.= " aj.code";
96 $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
97 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
98 $sql.= " WHERE ba.rowid = bc.fk_bank_account";
99 $sql.= " AND bc.entity = ".$conf->entity;
100 $sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
101 $sql.= $db->plimit($max);
102 
103 $resql = $db->query($sql);
104 if ($resql)
105 {
106  print '<table class="noborder" width="100%">';
107  print '<tr class="liste_titre">';
108  print '<th>'.$langs->trans("LastCheckReceiptShort",$max).'</th>';
109  print '<th>'.$langs->trans("Date")."</th>";
110  print '<th>'.$langs->trans("Account").'</th>';
111  print '<th align="right">'.$langs->trans("NbOfCheques").'</th>';
112  print '<th align="right">'.$langs->trans("Amount").'</th>';
113  print '<th align="right">'.$langs->trans("Status").'</th>';
114  print "</tr>\n";
115 
116  while ( $objp = $db->fetch_object($resql) )
117  {
118  $checkdepositstatic->id=$objp->rowid;
119  $checkdepositstatic->ref=($objp->ref?$objp->ref:$objp->rowid);
120  $checkdepositstatic->statut=$objp->statut;
121 
122  $accountstatic->id=$objp->bid;
123  $accountstatic->ref=$objp->bref;
124  $accountstatic->label=$objp->label;
125  $accountstatic->number=$objp->number;
126  $accountstatic->currency_code=$objp->currency_code;
127  $accountstatic->account_number=$objp->account_number;
128  $accountstatic->accountancy_journal=$objp->code;
129  $accountstatic->fk_accountancy_journal=$objp->fk_accountancy_journal;
130 
131  print '<tr class="oddeven">'."\n";
132 
133  print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
134  print '<td>'.dol_print_date($db->jdate($objp->db),'day').'</td>';
135  print '<td>'.$accountstatic->getNomUrl(1).'</td>';
136  print '<td align="right">'.$objp->nbcheque.'</td>';
137  print '<td align="right">'.price($objp->amount).'</td>';
138  print '<td align="right">'.$checkdepositstatic->LibStatut($objp->statut,3).'</td>';
139 
140  print '</tr>';
141  }
142  print "</table>";
143 
144  $db->free($resql);
145 }
146 else
147 {
148  dol_print_error($db);
149 }
150 
151 
152 print '</div></div></div>';
153 
154 // End of page
155 llxFooter();
156 $db->close();
llxFooter()
Footer empty.
Definition: index.php:44
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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:1053
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage bank accounts.
llxHeader()
Header empty.
Definition: index.php:36
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage cheque delivery receipts.