dolibarr  7.0.0-beta
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@capnetworks.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 $langs->load("banks");
32 $langs->load("categories");
33 $langs->load("compta");
34 $langs->load("bills");
35 
36 // Security check
37 if ($user->societe_id) $socid=$user->societe_id;
38 $result = restrictedArea($user, 'banque', '','');
39 
40 
41 $checkdepositstatic=new RemiseCheque($db);
42 $accountstatic=new Account($db);
43 
44 
45 /*
46  * View
47  */
48 
49 llxHeader('',$langs->trans("ChequesArea"));
50 
51 print load_fiche_titre($langs->trans("ChequesArea"));
52 
53 print '<div class="fichecenter"><div class="fichethirdleft">';
54 
55 $sql = "SELECT count(b.rowid)";
56 $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
57 $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
58 $sql.= " WHERE ba.rowid = b.fk_account";
59 $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
60 $sql.= " AND b.fk_type = 'CHQ'";
61 $sql.= " AND b.fk_bordereau = 0";
62 $sql.= " AND b.amount > 0";
63 
64 $resql = $db->query($sql);
65 
66 print '<table class="noborder" width="100%">';
67 print '<tr class="liste_titre">';
68 print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
69 print "</tr>\n";
70 
71 if ($resql)
72 {
73  $var=false;
74  if ($row = $db->fetch_row($resql) )
75  {
76  $num = $row[0];
77  }
78  print '<tr class="oddeven">';
79  print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
80  print '<td align="right">';
81  print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
82  print '</td></tr>';
83  print "</table>\n";
84 }
85 else
86 {
87  dol_print_error($db);
88 }
89 
90 
91 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
92 
93 $max=10;
94 
95 $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref";
96 $sql.= ", bc.statut, bc.nbcheque";
97 $sql.= ", ba.label, ba.rowid as bid";
98 $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
99 $sql.= " WHERE ba.rowid = bc.fk_bank_account";
100 $sql.= " AND bc.entity = ".$conf->entity;
101 $sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
102 $sql.= $db->plimit($max);
103 
104 $resql = $db->query($sql);
105 if ($resql)
106 {
107  print '<table class="noborder" width="100%">';
108  print '<tr class="liste_titre">';
109  print '<th>'.$langs->trans("LastCheckReceiptShort",$max).'</th>';
110  print '<th>'.$langs->trans("Date")."</th>";
111  print '<th>'.$langs->trans("Account").'</th>';
112  print '<th align="right">'.$langs->trans("NbOfCheques").'</th>';
113  print '<th align="right">'.$langs->trans("Amount").'</th>';
114  print '<th align="right">'.$langs->trans("Status").'</th>';
115  print "</tr>\n";
116 
117  $var=true;
118  while ( $objp = $db->fetch_object($resql) )
119  {
120  $checkdepositstatic->id=$objp->rowid;
121  $checkdepositstatic->ref=($objp->ref?$objp->ref:$objp->rowid);
122  $checkdepositstatic->statut=$objp->statut;
123 
124  $accountstatic->id=$objp->bid;
125  $accountstatic->label=$objp->label;
126 
127  print '<tr class="oddeven">'."\n";
128 
129  print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
130  print '<td>'.dol_print_date($db->jdate($objp->db),'day').'</td>';
131  print '<td>'.$accountstatic->getNomUrl(1).'</td>';
132  print '<td align="right">'.$objp->nbcheque.'</td>';
133  print '<td align="right">'.price($objp->amount).'</td>';
134  print '<td align="right">'.$checkdepositstatic->LibStatut($objp->statut,3).'</td>';
135 
136  print '</tr>';
137  }
138  print "</table>";
139 
140  $db->free($resql);
141 }
142 else
143 {
144  dol_print_error($db);
145 }
146 
147 
148 print '</div></div></div>';
149 
150 llxFooter();
151 
152 $db->close();
llxFooter()
Footer empty.
Definition: index.php:43
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:37
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $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:1013
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.
Class to manage cheque delivery receipts.