dolibarr  16.0.5
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 <https://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->socid) {
36  $socid = $user->socid;
37 }
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"), '', $checkdepositstatic->picto);
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 centpercent">';
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  if ($row = $db->fetch_row($resql)) {
73  $num = $row[0];
74  }
75  print '<tr class="oddeven">';
76  print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
77  print '<td class="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 } else {
82  dol_print_error($db);
83 }
84 
85 
86 print '</div><div class="fichetwothirdright">';
87 
88 $max = 10;
89 
90 $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
91 $sql .= " bc.statut, bc.nbcheque,";
92 $sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
93 $sql .= " aj.code";
94 $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
95 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
96 $sql .= " WHERE ba.rowid = bc.fk_bank_account";
97 $sql .= " AND bc.entity = ".$conf->entity;
98 $sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
99 $sql .= $db->plimit($max);
100 
101 $resql = $db->query($sql);
102 if ($resql) {
103  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
104  print '<table class="noborder centpercent">';
105  print '<tr class="liste_titre">';
106  print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
107  print '<th>'.$langs->trans("Date")."</th>";
108  print '<th>'.$langs->trans("Account").'</th>';
109  print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
110  print '<th class="right">'.$langs->trans("Amount").'</th>';
111  print '<th class="right">'.$langs->trans("Status").'</th>';
112  print "</tr>\n";
113 
114  while ($objp = $db->fetch_object($resql)) {
115  $checkdepositstatic->id = $objp->rowid;
116  $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
117  $checkdepositstatic->statut = $objp->statut;
118 
119  $accountstatic->id = $objp->bid;
120  $accountstatic->ref = $objp->bref;
121  $accountstatic->label = $objp->label;
122  $accountstatic->number = $objp->number;
123  $accountstatic->currency_code = $objp->currency_code;
124  $accountstatic->account_number = $objp->account_number;
125  $accountstatic->accountancy_journal = $objp->code;
126  $accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
127 
128  print '<tr class="oddeven">'."\n";
129 
130  print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
131  print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
132  print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
133  print '<td class="right">'.$objp->nbcheque.'</td>';
134  print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
135  print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
136 
137  print '</tr>';
138  }
139  print "</table>";
140  print '</div>';
141 
142  $db->free($resql);
143 } else {
144  dol_print_error($db);
145 }
146 
147 
148 print '</div></div>';
149 
150 // End of page
151 llxFooter();
152 $db->close();
restrictedArea
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:234
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
llxFooter
llxFooter()
Footer empty.
Definition: index.php:71
llxHeader
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
Definition: index.php:63
RemiseCheque
Class to manage cheque delivery receipts.
Definition: remisecheque.class.php:34
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
Account
Class to manage bank accounts.
Definition: account.class.php:38