noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ledger_detail_ach.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/**
6 * @var $str_anc String HTML contains the detail of analytic
7 * @var $g_user Noalyss_User inherited , it is the connected user
8 */
11?><?php require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php'; ?>
12<div class="content" style="padding:0;">
13 <?php
15 ?>
16
17 <?php if ($access == 'W') : ?>
18 <form class="print" onsubmit="return op_save(this);">
19 <?php endif; ?>
20
21 <?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
22 <table style="width:100%">
23 <tr><td>
24 <table>
25 <td></td>
26 <?php
27 $date = new IDate('p_date');
28 $date->value = format_date($obj->det->jr_date);
29 if ( $g_parameter->MY_STRICT=='Y' && $g_user->check_action(UPDDATE)==0) {
30 $date->setReadOnly(true);
31 }
32 echo td(_('Date')) . td($date->input());
33 ?>
34 <tr>
35 <td></td>
36 <?php
37 $date_ech = new IDate('p_ech');
38 $date_ech->value = format_date($obj->det->jr_ech);
39 echo td(_('Echeance')) . td($date_ech->input());
40 ?>
41 </tr>
42 <tr>
43 <td></td>
44 <td>
45 <?php echo _("Date paiement")?>
46 </td>
47 <td>
48 <?php
49 $date_paid = new IDate('p_date_paid');
50 $date_paid->value = format_date($obj->det->jr_date_paid);
51 echo $date_paid->input();
52 ?>
53 </td>
54 </tr>
55
56 <tr><td>
57 <?php
58 $bk = new Fiche($cn, $obj->det->array[0]['qp_supplier']);
59 echo td(_('Fournisseur'));
60
61 $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
63 ?>
64 </td>
65 </tr>
66 <tr>
67 <td>
68 <?php
69 $itext = new IText('npj');
70 if ($owner->MY_PJ_SUGGEST=='A' || $g_user->check_action(UPDRECEIPT)==0)
71 $itext->setReadOnly(true);
72 $itext->value = strip_tags($obj->det->jr_pj_number);
73 echo td(_('Pièce')) . td($itext->input());
74 ?>
75 </td>
76 <tr>
77 <td>
78 <?php
79 $itext = new IText('lib');
80 $itext->value = strip_tags($obj->det->jr_comment??"");
81 $itext->size = 40;
82 echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
83 ?>
84 </td>
85 </tr>
86 <tr>
87 <td></td>
88 <td>Payé</td>
89 <td>
90 <?php
91 $ipaid = new ICheckBox("ipaid", 'paid');
92 $ipaid->selected = ($obj->det->jr_rapt == 'paid');
93 echo $ipaid->input();
94 ?>
95 </td>
96 </tr>
97
98 </table>
99 </td>
100 <td style="width:50%;height:100%;vertical-align:top;text-align: center">
101 <table style="width:99%;height:8rem;vertical-align:top;">
102 <tr style="height: 5%">
103 <td style="text-align:center;vertical-align: top">
104 Note
105 </td></tr>
106 <tr>
107 <td style="text-align:center;vertical-align: top">
108 <?php
109 $inote = new ITextarea('jrn_note');
110 $inote->style=' class="itextarea" style="width:90%;height:100%;"';
111 $inote->value = strip_tags($obj->det->note);
112 echo $inote->input();
113 ?>
114
115 </td>
116 </tr>
117 <tr>
118 <td>
119 <div id="operation_tag_td<?=$div?>">
120 <?php
121 /******************************************************************************************************************
122 * Tags on operation
123 *****************************************************************************************************************/
125 $tag_operation->set_jrn_id($obj->det->jr_id);
126 $tag_operation->tag_cell($div);
127 ?>
128
129
130 </div>
131 <?php
132 // Button add tags
133 if ( $access=='W') { echo Tag_Operation::button_search($obj->det->jr_id,$div);}
134 ?>
135 </td>
136 </tr>
137 </table>
138 </td>
139 </tr>
140
141 </table>
142 <table class="result" style="margin-left:4px">
143 <?php
144 bcscale(2);
147 echo th(_('Quick Code'));
148 echo th(_('Description'));
149
150 echo th(_('Prix/Un.'), 'style="text-align:right"');
151 echo th(_('Quantité'), 'style="text-align:right"');
152 if ($owner->MY_TVA_USE == 'Y')
153 {
154 echo th(_('Taux TVA'), 'style="text-align:right"');
155 } else
156 {
157 echo th('');
158 }
159 echo th(_('Non ded'), 'style="text-align:right"');
160
161 if ($owner->MY_TVA_USE == 'Y')
162 {
163 echo th(_('HTVA'), 'style="text-align:right"');
164 echo th(_('TVA ND'), 'style="text-align:right"');
165 echo th(_('TVA'), 'style="text-align:right"');
166 echo th(_('TVAC'), 'style="text-align:right"');
167 } else
168 echo th(_('Total'), 'style="text-align:right"');
169 if ( $obj->det->currency_id != 0 ) {
170 $currency=$obj->db->get_value("select cr_code_iso from currency where id=$1",
171 [$obj->det->currency_id]);
172 echo th($currency, 'style="text-align:right"');
173 }
174 if ($owner->MY_ANALYTIC != 'nu' )
175 {
176 $anc = new Anc_Plan($cn);
177 $a_anc = $anc->get_list(' order by pa_id ');
178 $x = count($a_anc);
179 /* set the width of the col */
180 /* add hidden variables pa[] to hold the value of pa_id */
181 $str_anc.='<tr>'.
182 '<th>'.
183 _('Code').
184 '</th>'.
185 '<th>'.
186 _('Poste').
187 '</th>'.
188 '<th>'.
189 _('Montant').
190 '</th>'.
191 '<th colspan="' . $x . '">'
192 . _('Compt. Analytique') .Anc_Plan::hidden($a_anc).
193 '</th>'.
194 '</tr>';
195
196 }
197 echo '</tr>';
199 for ($e = 0; $e < count($obj->det->array); $e++)
200 {
201 $row = '';
202 $q = $obj->det->array[$e];
203 $fiche = new Fiche($cn, $q['qp_fiche']);
204 $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
205 $view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" ');
207 $sym_tva = '';
208
209 if ($owner->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
210 {
211 /* retrieve TVA symbol */
212 $tva = Acc_Tva::build($cn, $q['qp_vat_code']);
213 $tva->load();
214 $sym_tva = h($tva->get_parameter('label'));
215 $x=($g_user->get_vat_code_preference()==1)?$tva->get_parameter('tva_code'):$tva->get_parameter('id');
216 $sym_tva .= sprintf('[%s]',$x);
217 }
218 if ($owner->MY_UPDLAB == 'Y')
219 {
220 $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
221 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
222 $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
223 $input->css_size = "100%";
224 } else
225 {
226 $input = new ISpan("e_march" . $q['j_id'] . "_label");
227 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
228 $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
229 }
230 $row.=td($input->input() . $hidden);
231 $pu = $q['qp_unit'];
232 $row.=td(nbm($pu,4), 'class="num"');
233 $row.=td(nbm($q['qp_quantite'],4), 'class="num"');
234 $row.=td($sym_tva, 'style="text-align:center"');
235
236 $no_ded = bcadd($q['qp_dep_priv'], $q['qp_nd_amount']);
237 $row.=td(nbm($no_ded), ' style="text-align:right"');
238 $htva = $q['qp_price'];
239
240
241 $row.=td(nbm($htva), 'class="num"');
242 $tva_rounded=round($q['qp_vat'],2);
243 $tvac = bcadd($htva, $tva_rounded);
244 $tvac = bcadd($tvac, $q['qp_nd_tva']);
245 $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
246 $tvac = bcsub ($tvac,$q['qp_vat_sided']);
247 if ($owner->MY_TVA_USE == 'Y')
248 {
249 $tva_amount_nd = bcadd($q['qp_nd_tva_recup'], $q['qp_nd_tva']);
250 $class = "";
251 if ($q['qp_vat_sided'] <> 0)
252 {
253 $class = ' style="text-decoration:line-through"';
254 }
255 $row.=td(nbm($tva_amount_nd), 'class="num" ' . $class);
256 $row.=td(nbm($tva_rounded), 'class="num" ' . $class);
257 $row.=td(nbm($tvac), 'class="num"');
258 }
259 $total_tvac=bcadd($total_tvac,$tvac);
260 $total_htva=bcadd($htva,$total_htva);
261 /* Analytic accountancy */
262 if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/ )
263 {
264 $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
265 if ( $g_parameter->match_analytic($poste))
266 {
267 $anc_op = new Anc_Operation($cn);
268 $anc_op->j_id = $q['j_id'];
269 $anc_op->in_div=$div;
270 $side=($q['j_debit'] == 'f')?'C':'D';
271
272 echo HtmlInput::hidden('opanc[]', $anc_op->j_id);
273 /* compute total price */
274 bcscale(2);
275 $str_anc.='<tr>';
278 $str_anc.=td(nbm($htva)." {$side}");
279 $str_anc.=$anc_op->display_table(1, $htva, $div);
280
281 $str_anc.='</tr>';
282 /* check there is no other row for this one like TVA_ND */
283 /**
284 * @var $anl_extra array of rows from operation_analytique concerning the current record
285 *
286 */
287 $anl_extra=$cn->get_array('select distinct j1.f_id,
288 o1.j_id j_id_anx,
289 j1.j_poste,
290 j1.j_debit,
291 j1.j_montant
292 from operation_analytique o1
293 join jrnx j1 on (o1.j_id=j1.j_id)
294 where oa_jrnx_id_source = $1',
295 [$q['j_id']]);
296 if (count($anl_extra) > 0)
297 {
298 foreach ($anl_extra as $item_anl_extra) {
299
300 $anc_op = new Anc_Operation($cn);
301 $anc_op->j_id =$item_anl_extra['j_id_anx'];
302 $anc_op->in_div=uniqid();
303 $side=($item_anl_extra['j_debit'] == 'f')?'C':'D';
304 $n="";
305 if ( $item_anl_extra['f_id'] != "") {
306 $n=$cn->get_value('select ad_value from fiche_detail
307 where
308 f_id =$1
309 and ad_id=$2'
310 ,[$item_anl_extra['f_id'],ATTR_DEF_QUICKCODE]);
311 }
312
313 /* compute total price */
314 bcscale(2);
315 $str_anc.='<tr>';
316 $str_anc.=td($n);
317 $str_anc.=td($item_anl_extra['j_poste']);
318
319 $str_anc.=td(nbm($item_anl_extra['j_montant'])." {$side}");
320 $str_anc.=$anc_op->display_table(0, $htva, $anc_op->in_div);
321
322 $str_anc.='</tr>';
323 }
324
325 }
326 }
327 }
328 $class=($e%2==0)?' class="even"':'class="odd"';
329 /*
330 * Display Currency in a column, if invoice not recorded in EUR
331 */
332 if ( $obj->det->currency_id != 0 ) {
333 $value=$obj->db->get_value("select oc_amount+oc_vat_amount from operation_currency where j_id=$1",[$q['j_id']]);
334 $row.=td(nbm($value,4),' class="num"');
336
337 }
338 echo tr($row,$class);
339 }
340
341 if ($owner->MY_TVA_USE == 'Y')
342 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
343 else
344 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
345 /**
346 * display additional tax if any + currency
347 */
351
353 if ($owner->MY_TVA_USE == 'N') {
355 }
356 $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
357 if ($owner->MY_TVA_USE == 'Y')
358 $row.=td("") . td("").td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
359 /**
360 * display additional tax if any + currency
361 */
362
363
364 //Display total in currency
365 if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
366 {
367 $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
368 $row.= td(nbm($sum_charge_euro,4),' class="num" style="font-style:italic;font-weight: bolder;"');
369 }
370 echo tr($row);
371
372 ?>
373 </table>
374<?php
375
376
377/*
378 * Info about currency if not in euro
379 */
380 // Add a row with currency and amount
381 if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
382 {
383 $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
384 $four_space="&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;";
385
386 echo $currency->get_code(),$four_space;
387 echo _("Taux utilisé"),"&nbsp;", nbm($obj->det->currency_rate,4),$four_space;
388 echo _("Taux Réf"), "&nbsp;",nbm($obj->det->currency_rate_ref,4).$four_space;
389 echo _("Montant en devise"), "&nbsp;",nbm($sum_charge_euro,4).$four_space;
390 }
391?>
392
393
394
395<?php
396require_once NOALYSS_TEMPLATE.'/ledger_detail_bottom.php';
397?>
398</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
h( $row[ 'oa_description'])
if($ledger=="") $access
$jr_id
$opd_description style
_("actif, passif,charge,...")
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)
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
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.
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
$n
Definition compute.php:54
const ATTR_DEF_NAME
Definition constant.php:216
const ATTR_DEF_QUICKCODE
Definition constant.php:237
const ATTR_DEF_ACCOUNT
Definition constant.php:215
const UPDDATE
const UPDRECEIPT
$sum_add_tax
display additional tax if any + currency
$view_card_detail
$side