noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ledger_detail_ven.php
Go to the documentation of this file.
1<?php
2//This file is part of NOALYSS and is under GPL
3//see licence.txt
4
5//* @var $div (string) current DIV
7//@var $dossier_id (int) folder id
8$dossier_id=Dossier::id();
9
10//@var $jr_id (int) jrn.jr_id
11//@var $obj (Acc_Operation) current operation detail
12
13?>
14
15<?php require_once NOALYSS_TEMPLATE . '/ledger_detail_top.php'; ?>
16<?php
17$tab_account = $div . "account";
18$tab_rapprochement = $div . "rapproch";
19$tab_receipt = $div . "receipt";
20$tab_document = $div . "document";
22?>
23<div class="content">
24 <?php
26 ?>
27
28 <?php if ($access == 'W') :
29 echo '<form class="print" onsubmit="return op_save(this);">';
31
32 <?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
33 <table style="width:100%">
34 <tr>
35 <td>
36 <table>
37 <tr>
38
39 <td></td>
40 <?php
41 $date = new IDate('p_date');
42 if ( $g_parameter->MY_STRICT=='Y' || $g_user->check_action(UPDDATE)==0) {
43 $date->setReadOnly(true);
44 }
45 $date->value = format_date($obj->det->jr_date);
46 echo td(_('Date')) . td($date->input());
47 ?>
48 </tr>
49 <tr>
50 <td></td>
51 <?php
52 $date_ech = new IDate('p_ech');
53 $date_ech->value = format_date($obj->det->jr_ech);
54 echo td(_('Echeance')) . td($date_ech->input());
55 ?>
56 <tr>
57 <td></td>
58 <td>
59 <?php echo _("Date paiement") ?>
60 </td>
61 <td>
62 <?php
63 $date_paid = new IDate('p_date_paid');
64 $date_paid->value = format_date($obj->det->jr_date_paid);
65 echo $date_paid->input();
66 ?>
67 </td>
68 </tr>
69 <tr>
70 <td>
71 <?php
72 $bk = new Fiche($cn, $obj->det->array[0]['qs_client']);
73 echo td(_('Client'));
74
75 $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
77 ?>
78 </td>
79 </tr>
80 <tr>
81 <td>
82 <?php
83 $itext = new IText('npj');
84 $itext->value = strip_tags($obj->det->jr_pj_number);
85 if ($owner->MY_PJ_SUGGEST=='A' || $g_user->check_action(UPDRECEIPT)==0)
86 $itext->setReadOnly(true);
87 echo td(_('Pièce')) . td($itext->input());
88 ?>
89 </td>
90 <tr>
91 <td>
92 <?php
93 $itext = new IText('lib');
94 $itext->value = strip_tags($obj->det->jr_comment??"");
95 $itext->size = 40;
96 echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
97 ?>
98 </td>
99 </tr>
100 <tr>
101 <td></td>
102 <td><?php echo _("Payé") ?></td>
103 <td>
104 <?php
105 $ipaid = new ICheckBox("ipaid", 'paid');
106 $ipaid->selected = ($obj->det->jr_rapt == 'paid');
107 echo $ipaid->input();
108
109 ?>
110 </td>
111 </tr>
112
113 </table>
114 </td>
115 <td style="width:50%;height:100%;vertical-align:top;text-align: center">
116 <table style="width:99%;height:8rem;vertical-align:top;">
117 <tr style="height: 5rem">
118 <td style="text-align:center;vertical-align: top">
119 <?php
120 $inote = new ITextarea('jrn_note');
121 $inote->set_enrichText("minimal");
122 $inote->id="jrn_note{$div}";
123 $inote->style=' class="itextarea" style="width:90%;height:100%;"';
124 $inote->value = $obj->det->note_html;
125 $inote->heigh=200;
126 echo $inote->input();
127
128 ?>
129
130 </td>
131
132 </tr>
133 <tr>
134 <td>
135 <div id="operation_tag_td<?=$div?>">
136 <?php
137 /******************************************************************************************************************
138 * Tags on operation
139 *****************************************************************************************************************/
141 $tag_operation->set_jrn_id($obj->det->jr_id);
142 $tag_operation->tag_cell($div);
143 ?>
144
145 </div>
146 <?php
147 // Button add tags
148 if ( $access=='W') { echo Tag_Operation::button_search($obj->det->jr_id,$div);}
149 ?>
150 </td>
151 </tr>
152 </table>
153 </td>
154
155 </tr>
156 </table>
157 <table class="result" style="margin-left:4px">
158 <?php
159 bcscale(2);
163 echo th(_('Quick Code'));
164 echo th(_('Description'));
165 echo th(_('Prix/Un'), 'style="text-align:right"');
166 echo th(_('Quantité'), 'style="text-align:right"');
167 if ($owner->MY_TVA_USE == 'Y')
168 echo th(_('Taux TVA'), 'style="text-align:right"');
169 else
170 echo th('');
171 if ($owner->MY_TVA_USE == 'Y') {
172 echo th(_('HTVA'), 'style="text-align:right"');
173 echo th(_('TVA'), 'style="text-align:right"');
174 echo th(_('TVAC'), 'style="text-align:right"');
175 } else
176 echo th(_('Total'), 'style="text-align:right"');
177 /*
178 * If not in EUR
179 */
180 if ($obj->det->currency_id != 0) {
181 $currency = $obj->db->get_value("select cr_code_iso from currency where id=$1",
182 [$obj->det->currency_id]);
183 echo th($currency, 'style="text-align:right"');
184 }
185 if ($owner->MY_ANALYTIC != 'nu' /*&& $div == 'popup'*/) {
186 $anc = new Anc_Plan($cn);
187 $a_anc = $anc->get_list(" order by pa_id ");
188 $x = count($a_anc);
189 /* set the width of the col */
190 /* add hidden variables pa[] to hold the value of pa_id */
191 $str_anc .= '<tr>' .
192 '<th>' .
193 _('Code') .
194 '</th>' .
195 '<th>' .
196 _('Poste') .
197 '</th>' .
198 '<th>' .
199 _('Montant') .
200 '</th>' .
201 '<th colspan="' . $x . '">'
202 . _('Compt. Analytique') . Anc_Plan::hidden($a_anc) .
203 '</th>' .
204 '</tr>';
205
206 }
207
208 echo '</tr>';
209 for ($e = 0; $e < count($obj->det->array); $e++) {
210 $row = '';
211 $q = $obj->det->array[$e];
212 $fiche = new Fiche($cn, $q['qs_fiche']);
213 $qcode = $fiche->get_attribute(ATTR_DEF_QUICKCODE);
214 $view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" ');
216 if ($owner->MY_UPDLAB == 'Y') {
217 $l_lib = ($q['j_text'] == '') ? $fiche->get_attribute(ATTR_DEF_NAME) : $q['j_text'];
218 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
219 $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
220 $input->css_size = "100%";
221 } else {
222 $input = new ISpan("e_march" . $q['j_id'] . "_label");
223 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
224 $input->value = $fiche->get_attribute(ATTR_DEF_NAME);
225 }
226
227 $row .= td($input->input() . $hidden);
228 $sym_tva = '';
229 $pu = $q['qs_unit'];
230 $row .= td(nbm($pu, 4), 'class="num"');
231 $row .= td(nbm($q['qs_quantite'], 4), 'class="num"');
232 $sym_tva = '';
233 if ($owner->MY_TVA_USE == 'Y' && $q['qs_vat_code'] != '') {
234 /* retrieve TVA symbol */
235 $tva = Acc_Tva::build($cn, $q['qs_vat_code']);
236 $tva->load();
237 $sym_tva = (h($tva->get_parameter('label')));
238 $x=($g_user->get_vat_code_preference()==1)?$tva->get_parameter('tva_code'):$tva->get_parameter('id');
239 $sym_tva .= sprintf('[%s]',$x);
240 }
241
242 $row .= td($sym_tva, 'style="text-align:center"');
243
244 $htva = $q['qs_price'];
245
246 $row .= td(nbm($htva), 'class="num"');
247 $tva_rounded = round($q['qs_vat'], 2);
248 $tvac = bcadd($htva, $tva_rounded);
249 if ($owner->MY_TVA_USE == 'Y') {
250 $class = "";
251 if ($q['qs_vat_sided'] != 0) {
252 $class = ' style="text-decoration:line-through"';
253 $tvac = bcsub($tvac, $tva_rounded);
254 }
255 $row .= td(nbm($tva_rounded), 'class="num"' . $class);
256 $row .= td(nbm($tvac), 'class="num"');
257 }
258 $total_tvac = bcadd($total_tvac, $tvac);
259 $total_htva = bcadd($total_htva, $htva);
260 /* Analytic accountancy */
261 if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */) {
262 $poste = $fiche->get_attribute(ATTR_DEF_ACCOUNT);
263 if ($g_parameter->match_analytic($poste)) {
264 $anc_op = new Anc_Operation($cn);
265 $anc_op->in_div = $div;
266 $anc_op->j_id = $q['j_id'];
267 $side = ($q['j_debit'] == 'f') ? 'C' : 'D';
268 echo HtmlInput::hidden('opanc[]', $anc_op->j_id);
269 /* compute total price */
270 bcscale(2);
271 $str_anc .= '<tr>';
272 $str_anc .= td($qcode);
273 $str_anc .= td($poste);
274 $str_anc .= td(nbm($htva) . " {$side}");
275 $str_anc .= $anc_op->display_table(1, $htva, $div) . '</tr>';
276 // $row.=($div == 'popup') ? $anc_op->display_table(1, $htva, $div):"";
277 } else {
278 $row .= td('');
279 }
280 }
281 $class = ($e % 2 == 0) ? ' class="even"' : 'class="odd"';
282 /*
283 * Display Currency in a column, if invoice not recorded in EUR
284 */
285 if ($obj->det->currency_id != 0) {
286 $value = $obj->db->get_value("select oc_amount+oc_vat_amount from operation_currency where j_id=$1", [$q['j_id']]);
288 $row .= td(nbm(round($value, 4), 4), ' class="num"');
289
290 }
291 echo tr($row, $class);
292 }
293 if ($owner->MY_TVA_USE == 'Y')
294 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
295 else
296 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
297 /**
298 * display additional tax if any + currency
299 */
303
305
307 if ($owner->MY_TVA_USE == 'N') {
309 }
310 $row .= td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
311 if ($owner->MY_TVA_USE == 'Y') {
312 $row .= td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
313
314 }
315
316 //Display total in currency
317 if ($obj->det->currency_id != "" && $obj->det->currency_id > 0) {
318 $row .= td(nbm($sum_prod_currency, 2), ' class="num" style="font-style:italic;font-weight: bolder;"');
319 }
320 echo tr($row);
321 ?>
322 </table>
323 </td>
324 </tr>
325 </table>
326 </td>
327 </tr>
328 </table>
329 <?php
330 /*
331 * Info about currency if not in euro
332 */
333 // Add a row with currency and amount
334 if ($obj->det->currency_id != "" && $obj->det->currency_id > 0) {
335 $currency = new Acc_Currency($obj->db, $obj->det->currency_id);
336 $four_space = "&nbsp;" . "&nbsp;" . "&nbsp;" . "&nbsp;";
337
338 echo $currency->get_code(), $four_space;
339 echo _("Taux utilisé"), "&nbsp;", nbm($obj->det->currency_rate, 4), $four_space;
340 echo _("Taux Réf"), "&nbsp;", nbm($obj->det->currency_rate_ref, 4) . $four_space;
341 echo _("Montant en devise"), "&nbsp;", nbm($sum_prod_currency, 4) . $four_space;
342 }
343
344 ?>
345
346 <?php
347 require_once NOALYSS_TEMPLATE . '/ledger_detail_bottom.php';
348 ?>
349</div>
format_date($p_date, $p_from_format='YYYY-MM-DD', $p_to_format='DD.MM.YYYY')
format the date, when taken from the database the format is MM-DD-YYYY
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
tr($p_string, $p_extra='')
Definition ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
global $g_parameter
global $g_user
if no group available , then stop
$dossier_id
catch(Exception $e) $obj
h( $row[ 'oa_description'])
if($ledger=="") $access
$jr_id
$opd_description style
_("actif, passif,charge,...")
$class
Display the Plugin and for each profile were it is installed or not.
display currency , convert to euro , and save them if used.
static build($db, $p_code)
retrieve TVA rate thanks the code that could be the tva_id or tva_code.
static display_row($p_jrn_id, &$sum_euro, &$sum_currency, $decalage=0)
display the additional_tax in the ledger_detail for Sales and Purchase
this class is used to show the form for entering an operation only FOR analytic operation to save it,...
Concerns the Analytic plan (table plan_analytique)
static hidden($p_array)
return an HTML string containing hidden input type to hold the differant PA_ID
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
static card_detail($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
show the detail of a card
static hidden($p_name, $p_value, $p_id="")
Html Input.
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Html Input.
Html Input Text member :
Manage the TEXTAREA html element.
Class to manage the company parameter (address, name...)
concerns the tags linked to an accountancy writing
static button_search($p_jr, $p_div)
Show a button to select tag for Search.
$all table
const ATTR_DEF_NAME
Definition constant.php:223
const ATTR_DEF_QUICKCODE
Definition constant.php:244
const ATTR_DEF_ACCOUNT
Definition constant.php:222
const UPDDATE
const UPDRECEIPT
$sum_add_tax
display additional tax if any + currency
$tag_operation
Tags on operation.
$view_card_detail
$tab_rapprochement
$side