dolibarr  13.0.2
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) $socid = $user->socid;
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"), '', 'bank_account');
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 centpercent">';
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  if ($row = $db->fetch_row($resql)) {
71  $num = $row[0];
72  }
73  print '<tr class="oddeven">';
74  print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
75  print '<td class="right">';
76  print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
77  print '</td></tr>';
78  print "</table>\n";
79 } else {
80  dol_print_error($db);
81 }
82 
83 
84 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
85 
86 $max = 10;
87 
88 $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
89 $sql .= " bc.statut, bc.nbcheque,";
90 $sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
91 $sql .= " aj.code";
92 $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
93 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
94 $sql .= " WHERE ba.rowid = bc.fk_bank_account";
95 $sql .= " AND bc.entity = ".$conf->entity;
96 $sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
97 $sql .= $db->plimit($max);
98 
99 $resql = $db->query($sql);
100 if ($resql)
101 {
102  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
103  print '<table class="noborder centpercent">';
104  print '<tr class="liste_titre">';
105  print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
106  print '<th>'.$langs->trans("Date")."</th>";
107  print '<th>'.$langs->trans("Account").'</th>';
108  print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
109  print '<th class="right">'.$langs->trans("Amount").'</th>';
110  print '<th class="right">'.$langs->trans("Status").'</th>';
111  print "</tr>\n";
112 
113  while ($objp = $db->fetch_object($resql))
114  {
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">'.price($objp->amount).'</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></div>';
149 
150 // End of page
151 llxFooter();
152 $db->close();
Class to manage bank accounts.
llxHeader()
Empty header.
Definition: wrapper.php:45
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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.
print
Draft customers invoices.
Definition: index.php:89
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
llxFooter()
Empty footer.
Definition: wrapper.php:59
Class to manage cheque delivery receipts.