27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"accountancy_last_manual_entries";
36 public $boximg =
"accounting";
37 public $boxlabel =
"BoxLastManualEntries";
38 public $depends = array(
"accounting");
47 public $info_box_head = array();
48 public $info_box_contents = array();
63 $this->hidden = empty($user->rights->accounting->mouvements->lire);
74 global $user, $langs, $conf;
76 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
80 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastManualEntries", $max));
82 if ($user->rights->accounting->mouvements->lire) {
83 $sql =
"SELECT DISTINCT b.piece_num";
84 $sql .=
", b.doc_date as date_movement";
85 $sql .=
", b.label_operation";
86 $sql .=
", b.montant as amount";
87 $sql .=
", b.code_journal";
88 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as b";
89 $sql .=
" WHERE b.fk_doc = 0";
90 $sql .=
" AND b.entity = ".$conf->entity;
91 $sql .=
" ORDER BY b.piece_num DESC ";
92 $sql .= $this->
db->plimit($max, 0);
94 $result = $this->
db->query($sql);
96 $num = $this->
db->num_rows($result);
100 while ($line < $num) {
101 $objp = $this->
db->fetch_object($result);
102 $date = $this->
db->jdate($objp->date_movement);
103 $journal = $objp->code_journal;
104 $label = $objp->label_operation;
105 $amount = $objp->amount;
110 $bookkeepingstatic->piece_num = $objp->piece_num;
112 $this->info_box_contents[$line][] = array(
114 'text' => $bookkeepingstatic->getNomUrl(1),
118 $this->info_box_contents[$line][] = array(
119 'td' =>
'class="center nowraponall"',
124 $this->info_box_contents[$line][] = array(
125 'td' =>
'class="center"',
130 $this->info_box_contents[$line][] = array(
131 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
136 $this->info_box_contents[$line][] = array(
137 'td' =>
'class="nowraponall right amount"',
138 'text' =>
price($amount, 0, $langs, 0, -1, -1, $conf->currency),
145 $this->info_box_contents[$line][0] = array(
146 'td' =>
'class="center"',
147 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedManualEntries").
'</span>'
151 $this->
db->free($result);
153 $this->info_box_contents[0][0] = array(
156 'text' => ($this->
db->error().
' sql='.$sql),
160 $this->info_box_contents[0][0] = array(
161 'td' =>
'class="nohover left"',
162 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'
175 public function showBox($head = null, $contents = null, $nooutput = 0)
177 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
loadBox($max=5)
Load data for box to show them later.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
$conf db
API class for accounts.
__construct($db, $param)
Constructor.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Class to manage Ledger (General Ledger and Subledger)
Class to manage the box to show last manual entries.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).