noalyss  Version-9
operation_detail_ach.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 /* $Revision$ */
20 
21 // Copyright Author Dany De Bontridder danydb@aevalys.eu
22 
23 /**
24  * @file
25  * @brief show detail of a operation of purchase
26  *
27  */
28 global $g_parameter;
29 ?>
30 <table class="result" >
31  <?php
32  bcscale(2);
35  echo th(_('Quick Code'));
36  echo th(_('Description'));
37  if ($g_parameter->MY_TVA_USE == 'Y')
38  {
39  echo th(_('Taux TVA'), 'style="text-align:right"');
40  }
41  else
42  {
43  echo th('');
44  }
45  echo th(_('Prix/Un.'), 'style="text-align:right"');
46  echo th(_('Quantité'), 'style="text-align:right"');
47  echo th(_('Personnel'), 'style="text-align:right"');
48  echo th(_('Non ded'), 'style="text-align:right"');
49 
50  if ($g_parameter->MY_TVA_USE == 'Y')
51  {
52  echo th(_('HTVA'), 'style="text-align:right"');
53  echo th(_('TVA NP'), 'style="text-align:right"');
54  echo th(_('TVA'), 'style="text-align:right"');
55  echo th(_('TVAC'), 'style="text-align:right"');
56  }else
57  echo th(_('Total'), 'style="text-align:right"');
58 
59  echo '</tr>';
60  for ($e = 0; $e < count($obj->det->array); $e++)
61  {
62  $row = '';
63  $q = $obj->det->array[$e];
64  $fiche = new Fiche($cn, $q['qp_fiche']);
65  $view_card_detail = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' class="line" ');
67  $sym_tva = '';
68 
69  if ($g_parameter->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
70  {
71  /* retrieve TVA symbol */
72  $tva = new Acc_Tva($cn, $q['qp_vat_code']);
73  $tva->load();
74  $sym_tva = h($tva->get_parameter('label'));
75  }
76  $input = new ISpan("e_march" . $q['j_id'] . "_label");
77  $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
78  $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
79  $row.=td($input->input() . $hidden);
80  $row.=td($sym_tva, 'style="text-align:center"');
81  $pu = 0;
82  if ($q['qp_quantite'] != 0)
83  $pu = bcdiv($q['qp_price'], $q['qp_quantite']);
84  $row.=td(nbm($pu), 'class="num"');
85  $row.=td(nbm($q['qp_quantite']), 'class="num"');
86 
87  $no_ded = $q['qp_nd_amount'];
88  $row.=td(nbm($q['qp_dep_priv']), 'style="text-align:right"');
89  $row.=td(nbm($no_ded), ' style="text-align:right"');
90  $htva = $q['qp_price'];
91 
92 
93  $row.=td(nbm($htva), 'class="num"');
94  $tvac = bcadd($htva, $q['qp_vat']);
95  $tvac = bcadd($tvac, $q['qp_nd_tva']);
96  $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
97 
98 
99  if ($g_parameter->MY_TVA_USE == 'Y')
100  {
101  $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']);
102  $tva_amount = bcadd($tva_amount, $q['qp_nd_tva_recup']);
103  $class = "";
104  if ($q['qp_vat_sided'] <> 0)
105  {
106  $class = ' style="text-decoration:line-through"';
107  $tvac = bcsub($tvac, $q['qp_vat_sided']);
108  }
109  $row.=td(nbm($q['qp_vat_sided']),'class="num"');
110  $row.=td(nbm($tva_amount), 'class="num" ' . $class);
111  $row.=td(nbm($tvac), 'class="num"');
112  }
113  $total_tvac+=$tvac;
114  $total_htva+=$htva;
115  echo tr($row);
116  }
117  if ($g_parameter->MY_TVA_USE == 'Y')
118  $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
119  else
120  $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
121  $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
122  if ($g_parameter->MY_TVA_USE == 'Y')
123  $row.=td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
124  echo tr($row);
125  ?>
126 </table>
nbm
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$class
$class
Definition: cfgplugin.inc.php:128
h
h( $row[ 'oa_description'])
Definition: ajax_anc_detail_operation.php:46
$e
$e
Definition: result_cat_card_summary.php:26
$q
$q
Definition: ajax_add_concerned_card.php:58
$row
else $row
Definition: operation_detail_ach.php:120
$total_htva
$total_htva
Definition: operation_detail_ach.php:33
$fiche
$fiche
Definition: ajax_add_concerned_card.php:98
tr
tr($p_string, $p_extra='')
Definition: ac_common.php:88
Acc_Tva
Acc_Tva is used for to map the table tva_rate parameter are.
Definition: acc_tva.class.php:36
ISpan
Html Input.
Definition: ispan.class.php:31
Fiche
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:37
$obj
$obj
Definition: ajax_accounting.php:43
$total_tvac
$total_tvac
Definition: operation_detail_ach.php:34
$view_card_detail
$view_card_detail
Definition: ledger_detail_ach.php:52
$cn
$cn
Definition: ajax_anc_accounting.php:30
$input
$input
Definition: ajax_anc_plan.php:32
table
$all table
Definition: company.inc.php:138
ATTR_DEF_QUICKCODE
const ATTR_DEF_QUICKCODE
Definition: constant.php:227
$hidden
$hidden
Definition: impress_rapport.inc.php:236
th
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
td
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$g_parameter
global $g_parameter
Definition: operation_detail_ach.php:28
ATTR_DEF_NAME
const ATTR_DEF_NAME
Definition: constant.php:206
HtmlInput\hidden
static hidden($p_name, $p_value, $p_id="")
Definition: html_input.class.php:218
HtmlInput\card_detail
static card_detail($p_qcode, $pname='', $p_style="", $p_nohistory=false)
show the detail of a card
Definition: html_input.class.php:565