noalyss Version-9
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
6?><?php require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php'; ?>
7<div class="content" style="padding:0;">
8 <?php
10 ?>
11
12 <?php if ($access == 'W') : ?>
13 <form class="print" onsubmit="return op_save(this);">
14 <?php endif; ?>
15
16 <?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
17 <table style="width:100%">
18 <tr><td>
19 <table>
20 <td></td>
21 <?php
22 $date = new IDate('p_date');
23 $date->value = format_date($obj->det->jr_date);
24 if ( $g_parameter->MY_STRICT=='Y' && $g_user->check_action(UPDDATE)==0) {
25 $date->setReadOnly(true);
26 }
27 echo td(_('Date')) . td($date->input());
28 ?>
29 <tr>
30 <td></td>
31 <?php
32 $date_ech = new IDate('p_ech');
33 $date_ech->value = format_date($obj->det->jr_ech);
34 echo td(_('Echeance')) . td($date_ech->input());
35 ?>
36 </tr>
37 <tr>
38 <td></td>
39 <td>
40 <?php echo _("Date paiement")?>
41 </td>
42 <td>
43 <?php
44 $date_paid = new IDate('p_date_paid');
45 $date_paid->value = format_date($obj->det->jr_date_paid);
46 echo $date_paid->input();
47 ?>
48 </td>
49 </tr>
50
51 <tr><td>
52 <?php
53 $bk = new Fiche($cn, $obj->det->array[0]['qp_supplier']);
54 echo td(_('Fournisseur'));
55
56 $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
58 ?>
59 </td>
60 </tr>
61 <tr>
62 <td>
63 <?php
64 $itext = new IText('npj');
65 if ($owner->MY_PJ_SUGGEST=='A' || $g_user->check_action(UPDRECEIPT)==0)
66 $itext->setReadOnly(true);
67 $itext->value = strip_tags($obj->det->jr_pj_number);
68 echo td(_('Pièce')) . td($itext->input());
69 ?>
70 </td>
71 <tr>
72 <td>
73 <?php
74 $itext = new IText('lib');
75 $itext->value = strip_tags($obj->det->jr_comment??"");
76 $itext->size = 40;
77 echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
78 ?>
79 </td>
80 </tr>
81 <tr>
82 <td></td>
83 <td>Payé</td>
84 <td>
85 <?php
86 $ipaid = new ICheckBox("ipaid", 'paid');
87 $ipaid->selected = ($obj->det->jr_rapt == 'paid');
88 echo $ipaid->input();
89 ?>
90 </td>
91 </tr>
92
93 </table>
94 </td>
95 <td style="width:50%;height:100%;vertical-align:top;text-align: center">
96 <table style="width:99%;height:8rem;vertical-align:top;">
97 <tr style="height: 5%">
98 <td style="text-align:center;vertical-align: top">
99 Note
100 </td></tr>
101 <tr>
102 <td style="text-align:center;vertical-align: top">
103 <?php
104 $inote = new ITextarea('jrn_note');
105 $inote->style=' class="itextarea" style="width:90%;height:100%;"';
106 $inote->value = strip_tags($obj->det->note);
107 echo $inote->input();
108 ?>
109
110 </td>
111 </tr>
112 <tr>
113 <td>
114 <div id="operation_tag_td<?=$div?>">
115 <?php
116 /******************************************************************************************************************
117 * Tags on operation
118 *****************************************************************************************************************/
120 $tag_operation->set_jrn_id($obj->det->jr_id);
121 $tag_operation->tag_cell($div);
122 ?>
123
124
125 </div>
126 <?php
127 // Button add tags
128 if ( $access=='W') { echo Tag_Operation::button_search($obj->det->jr_id,$div);}
129 ?>
130 </td>
131 </tr>
132 </table>
133 </td>
134 </tr>
135
136 </table>
137 <table class="result" style="margin-left:4px">
138 <?php
139 bcscale(2);
142 echo th(_('Quick Code'));
143 echo th(_('Description'));
144
145 echo th(_('Prix/Un.'), 'style="text-align:right"');
146 echo th(_('Quantité'), 'style="text-align:right"');
147 if ($owner->MY_TVA_USE == 'Y')
148 {
149 echo th(_('Taux TVA'), 'style="text-align:right"');
150 } else
151 {
152 echo th('');
153 }
154 echo th(_('Non ded'), 'style="text-align:right"');
155
156 if ($owner->MY_TVA_USE == 'Y')
157 {
158 echo th(_('HTVA'), 'style="text-align:right"');
159 echo th(_('TVA ND'), 'style="text-align:right"');
160 echo th(_('TVA'), 'style="text-align:right"');
161 echo th(_('TVAC'), 'style="text-align:right"');
162 } else
163 echo th(_('Total'), 'style="text-align:right"');
164 if ( $obj->det->currency_id != 0 ) {
165 $currency=$obj->db->get_value("select cr_code_iso from currency where id=$1",
166 [$obj->det->currency_id]);
167 echo th($currency, 'style="text-align:right"');
168 }
169 if ($owner->MY_ANALYTIC != 'nu' )
170 {
171 $anc = new Anc_Plan($cn);
172 $a_anc = $anc->get_list(' order by pa_id ');
173 $x = count($a_anc);
174 /* set the width of the col */
175 /* add hidden variables pa[] to hold the value of pa_id */
176 $str_anc.='<tr>'.
177 '<th>'.
178 _('Code').
179 '</th>'.
180 '<th>'.
181 _('Poste').
182 '</th>'.
183 '<th>'.
184 _('Montant').
185 '</th>'.
186 '<th colspan="' . $x . '">'
187 . _('Compt. Analytique') .Anc_Plan::hidden($a_anc).
188 '</th>'.
189 '</tr>';
190
191 }
192 echo '</tr>';
194 for ($e = 0; $e < count($obj->det->array); $e++)
195 {
196 $row = '';
197 $q = $obj->det->array[$e];
198 $fiche = new Fiche($cn, $q['qp_fiche']);
199 $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
200 $view_card_detail = HtmlInput::card_detail($qcode, "", ' class="line" ');
202 $sym_tva = '';
203
204 if ($owner->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
205 {
206 /* retrieve TVA symbol */
207 $tva = new Acc_Tva($cn, $q['qp_vat_code']);
208 $tva->load();
209 $sym_tva = h($tva->get_parameter('label'));
210 }
211 if ($owner->MY_UPDLAB == 'Y')
212 {
213 $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
214 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
215 $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
216 $input->css_size = "100%";
217 } else
218 {
219 $input = new ISpan("e_march" . $q['j_id'] . "_label");
220 $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
221 $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
222 }
223 $row.=td($input->input() . $hidden);
224 $pu = $q['qp_unit'];
225 $row.=td(nbm($pu,4), 'class="num"');
226 $row.=td(nbm($q['qp_quantite'],4), 'class="num"');
227 $row.=td($sym_tva, 'style="text-align:center"');
228
229 $no_ded = bcadd($q['qp_dep_priv'], $q['qp_nd_amount']);
230 $row.=td(nbm($no_ded), ' style="text-align:right"');
231 $htva = $q['qp_price'];
232
233
234 $row.=td(nbm($htva), 'class="num"');
235 $tva_rounded=round($q['qp_vat'],2);
236 $tvac = bcadd($htva, $tva_rounded);
237 $tvac = bcadd($tvac, $q['qp_nd_tva']);
238 $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
239 $tvac = bcsub ($tvac,$q['qp_vat_sided']);
240 if ($owner->MY_TVA_USE == 'Y')
241 {
242 $tva_amount_nd = bcadd($q['qp_nd_tva_recup'], $q['qp_nd_tva']);
243 $class = "";
244 if ($q['qp_vat_sided'] <> 0)
245 {
246 $class = ' style="text-decoration:line-through"';
247 }
248 $row.=td(nbm($tva_amount_nd), 'class="num" ' . $class);
249 $row.=td(nbm($tva_rounded), 'class="num" ' . $class);
250 $row.=td(nbm($tvac), 'class="num"');
251 }
252 $total_tvac=bcadd($total_tvac,$tvac);
253 $total_htva=bcadd($htva,$total_htva);
254 /* Analytic accountancy */
255 if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/ )
256 {
257 $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
258 if ( $g_parameter->match_analytic($poste))
259 {
260 $anc_op = new Anc_Operation($cn);
261 $anc_op->j_id = $q['j_id'];
262 $anc_op->in_div=$div;
263 $side=($q['j_debit'] == 'f')?'C':'D';
264
265 echo HtmlInput::hidden('opanc[]', $anc_op->j_id);
266 /* compute total price */
267 bcscale(2);
268 $str_anc.='<tr>';
271 $str_anc.=td(nbm($htva)." {$side}");
272 $str_anc.=$anc_op->display_table(1, $htva, $div);
273 }
274 }
275 $class=($e%2==0)?' class="even"':'class="odd"';
276 /*
277 * Display Currency in a column, if invoice not recorded in EUR
278 */
279 if ( $obj->det->currency_id != 0 ) {
280 $value=$obj->db->get_value("select oc_amount+oc_vat_amount from operation_currency where j_id=$1",[$q['j_id']]);
281 $row.=td(nbm($value,4),' class="num"');
283
284 }
285 echo tr($row,$class);
286 }
287
288 if ($owner->MY_TVA_USE == 'Y')
289 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
290 else
291 $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
292 /**
293 * display additional tax if any + currency
294 */
298
300 if ($owner->MY_TVA_USE == 'N') {
302 }
303 $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
304 if ($owner->MY_TVA_USE == 'Y')
305 $row.=td("") . td("").td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
306 /**
307 * display additional tax if any + currency
308 */
309
310
311 //Display total in currency
312 if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
313 {
314 $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
315 $row.= td(nbm($sum_charge_euro,4),' class="num" style="font-style:italic;font-weight: bolder;"');
316 }
317 echo tr($row);
318
319 ?>
320 </table>
321<?php
322
323
324/*
325 * Info about currency if not in euro
326 */
327 // Add a row with currency and amount
328 if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0)
329 {
330 $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
331 $four_space="&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;";
332
333 echo $currency->get_code(),$four_space;
334 echo _("Taux utilisé"),"&nbsp;", nbm($obj->det->currency_rate,4),$four_space;
335 echo _("Taux Réf"), "&nbsp;",nbm($obj->det->currency_rate_ref,4).$four_space;
336 echo _("Montant en devise"), "&nbsp;",nbm($sum_charge_euro,4).$four_space;
337 }
338?>
339
340
341
342<?php
343require_once NOALYSS_TEMPLATE.'/ledger_detail_bottom.php';
344?>
345</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
Definition: ac_common.php:852
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.
Definition: ac_common.php:137
global $g_user
if no group available , then stop
h( $row[ 'oa_description'])
$input
$class
display currency , convert to euro , and save them if used.
Acc_Tva is used for to map the table tva_rate parameter are.
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...
Definition: fiche.class.php:38
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...
Definition: idate.class.php:34
Html Input.
Definition: ispan.class.php:32
Html Input.
Definition: itext.class.php:30
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: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
global $cn
$tag_operation
$view_card_detail
$sum_add_tax_cur
global $jr_id
$inote style
global $obj
global $access
global $div
global $g_parameter
$sum_charge_euro
else $row
$side