27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"accountancy_last_manual_entries";
36 public $boximg =
"object_invoice";
37 public $boxlabel =
"BoxLastManualEntries";
38 public $depends = array(
"accounting");
47 public $info_box_head = array();
48 public $info_box_contents = array();
63 $this->hidden = !($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)
84 $sql =
"SELECT DISTINCT b.piece_num";
85 $sql .=
", b.doc_date as date_movement";
86 $sql .=
", b.label_operation";
87 $sql .=
", b.montant as amount";
88 $sql .=
", b.code_journal";
89 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_bookkeeping as b";
90 $sql .=
" WHERE b.fk_doc = 0";
91 $sql .=
" AND b.entity = ".$conf->entity;
92 $sql .=
" ORDER BY b.piece_num DESC ";
93 $sql .= $this->
db->plimit($max, 0);
95 $result = $this->
db->query($sql);
97 $num = $this->
db->num_rows($result);
101 while ($line < $num) {
102 $objp = $this->
db->fetch_object($result);
103 $date = $this->
db->jdate($objp->date_movement);
104 $journal = $objp->code_journal;
105 $label = $objp->label_operation;
106 $amount = $objp->amount;
108 $bookkeepingstatic->id = $objp->id;
109 $bookkeepingstatic->piece_num = $objp->piece_num;
111 $this->info_box_contents[$line][] = array(
113 'text' => $bookkeepingstatic->getNomUrl(1),
117 $this->info_box_contents[$line][] = array(
118 'td' =>
'class="right"',
123 $this->info_box_contents[$line][] = array(
124 'td' =>
'class="center"',
129 $this->info_box_contents[$line][] = array(
130 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
135 $this->info_box_contents[$line][] = array(
136 'td' =>
'class="nowraponall right"',
137 'text' =>
price($amount, 0, $langs, 0, -1, -1, $conf->currency),
143 if ($num == 0) $this->info_box_contents[$line][0] = array(
144 'td' =>
'class="center"',
145 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedManualEntries").
'</span>'
148 $this->
db->free($result);
150 $this->info_box_contents[0][0] = array(
153 'text' => ($this->
db->error().
' sql='.$sql),
157 $this->info_box_contents[0][0] = array(
158 'td' =>
'class="nohover left"',
159 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'
172 public function showBox($head = null, $contents = null, $nooutput = 0)
174 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.
__construct($db, $param)
Constructor.
$conf db
API class for accounts.
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).