noalyss Version-9
follow_up_detail_display.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * PhpCompta 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 * PhpCompta 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 PhpCompta; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
20
21/**
22 * @file
23 * @brief Called from Follow_Up_Detail for displaying detail
24 * @see Follow_Up_Detail::display
25 */
26// Number of articles
27$article_count=(count($p_follow_up->aAction_detail)==0)?MAX_ARTICLE:count($p_follow_up->aAction_detail);
28// total item and vat
32$num=new INum();
34$readonly=($p_view == "READ")?true:false;
35// Check for the Price on ACH or VEN
37$document_type=$p_follow_up->db->get_value("select ag_type from action_gestion where ag_id = $1",[$p_follow_up->ag_id]);
39
40// default menu for invoice
42?>
43<div id="follow_up_detail">
44
45 <?php echo h2(_("Détail opération")) ?>
46 <?php echo HtmlInput::hidden("nb_item", $article_count); ?>
47
48 <table style="width:100%" id="sold_item">
49 <tr>
50 <th><?php echo _('Fiche') ?></th>
51 <th><?php echo _('Description') ?></th>
52 <th class="num"><?php echo _('prix unitaire') ?></th>
53 <th class="num"><?php echo _('quantité') ?></th>
54 <th class="num"><?php echo _('Code TVA') ?></th>
55 <th class="num"><?php echo _('Montant TVA') ?></th>
56 <th class="num"><?php echo _('Montant TVAC') ?></th>
57
58 </tr>
59 <?php
60 for ($i=0; $i<$article_count; $i++):
61 /* fid = Icard */
62 $icard=new ICard();
63 $icard->jrn=-10;
64 $icard->table=0;
65 $icard->noadd="no";
66 $icard->extra='all';
67 $icard->name="e_march".$i;
68 $tmp_ad=(isset($p_follow_up->aAction_detail[$i]))?$p_follow_up->aAction_detail[$i]:false;
69 $icard->readOnly=$readonly;
70 $icard->value='';
72 if ($tmp_ad)
73 {
74 $march=new Fiche($p_follow_up->db);
75 $f=$tmp_ad->get_parameter('qcode');
76 if ($f!=0)
77 {
78 $march->id=$f;
79 $icard->value=$march->get_quick_code();
80 $aCard[$i]=$f;
81 }
82 }
83 $icard->set_dblclick("fill_ipopcard(this);");
84 // name of the field to update with the name of the card
85 $icard->set_attribute('label', "e_march".$i."_label");
86 // name of the field to update with the name of the card
87 $icard->set_attribute('typecard', $icard->extra);
88 $icard->set_attribute('ipopup', 'ipopcard');
89 $icard->set_function('fill_data');
90 $icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name);
91 // name of the field to update with the name of the card
92 $icard->set_attribute('label', 'e_march' . $i . '_label');
93 // name of the field with the price autocomplete
94 if ( $option == 'ACH'){
95 $icard->set_attribute('purchase', 'e_march' . $i . '_price');
96 } else {
97 $icard->set_attribute('price','e_march'.$i.'_price');
98 }
99
100 // name of the field with the TVA_ID
101 $icard->set_attribute('tvaid', 'e_march' . $i . '_tva_id');
102 $icard->amount_from_type=$option_detail;
103
104 $aArticle[$i]['fid']=$icard->search().$icard->input();
105
106 $text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"';
107 $text->css_size="100%";
108 $text->name="e_march".$i."_label";
109 $text->id="e_march".$i."_label";
110 $text->size=40;
111 $text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):"";
112 $text->readOnly=$readonly;
113 $aArticle[$i]['desc']=$text->input();
114
115 $num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"';
116 $num->name="e_march".$i."_price";
117 $num->id="e_march".$i."_price";
118 $num->size=8;
119 $num->readOnly=$readonly;
120 $num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0;
121 $aArticle[$i]['pu']=$num->input();
122
123 $num->name="e_quant".$i;
124 $num->id="e_quant".$i;
125 $num->size=8;
126 $num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0;
127 $aArticle[$i]['quant']=$num->input();
128
129 $itva->name='e_march'.$i.'_tva_id';
130 $itva->id='e_march'.$i.'_tva_id';
131 $itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0;
132 $itva->readOnly=$readonly;
133 $itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"';
134 $itva->set_attribute('compute', $i);
135
136 $aArticle[$i]['tvaid']=$itva->input();
137
138 $num->name="e_march".$i."_tva_amount";
139 $num->id="e_march".$i."_tva_amount";
140 $num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0;
141 $num->javascript=" onchange=\"compute_ledger('".$i." ')\"";
142 $num->size=8;
143 $aArticle[$i]['tva']=$num->input();
144 $tot_vat=bcadd($tot_vat, $num->value);
145
146 $num->name="tvac_march".$i;
147 $num->id="tvac_march".$i;
148 $num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0;
149 $num->size=8;
150 $aArticle[$i]['tvac']=$num->input();
151 $tot_item=bcadd($tot_item, $num->value);
152
153 $aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0);
154 $aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0);
155 $aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i,
156 0);
157 ?>
158
159 <TR>
160 <TD><?php echo $aArticle[$i]['fid'] ?></TD>
161 <TD><?php echo $aArticle[$i]['desc'] ?></TD>
162 <TD class="num"><?php echo $aArticle[$i]['pu'] ?></TD>
163 <TD class="num"><?php echo $aArticle[$i]['quant'] ?></TD>
164 <TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
165 <TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
166 <TD class="num"><?php echo $aArticle[$i]['tvac'] ?>
167 <?php echo $aArticle[$i]['hidden_tva']; ?>
168 <?php echo $aArticle[$i]['hidden_htva']; ?>
169 <?php echo $aArticle[$i]['ad_id']; ?>
170 </TD>
171 </TR>
172 <?php
174 ?>
175 </table>
176 <div>
177
178 <div style=" float:right;margin-right: 2px" id="sum">
179 <br><span style="text-align: right;" class="highlight" id="htva"><?php echo bcsub($tot_item, $tot_vat) ?></span>
180 <br><span style="text-align: right" class="highlight" id="tva"><?php echo $tot_vat ?></span>
181 <br><span style="text-align: right" class="highlight" id="tvac"><?php echo $tot_item ?></span>
182 </div>
183
184 <div style="float:right;margin-right: 230px" >
185 <br>Total HTVA
186 <br>Total TVA
187 <br>Total TVAC
188 </div>
189
190 </div>
191 <div id="d_add_rows">
192 <?php if ( $p_view != 'READ' ) echo Html_Input_Noalyss::ledger_add_item("O"); ?>
193
194 <?php echo HtmlInput::button('actualiser', _('Recalculer'), ' onClick="compute_all_ledger();"'); ?>
195 </div>
196 <script>compute_all_ledger()</script>
197 <div class="row">
198
199 <?php
200 if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)):
201 ?>
202 <div id="follow_up_detail_invoice" class="col m-3" style="position:static">
203 <?php
204 $query=http_build_query(array('gDossier'=>Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 'ac'=>$menu->get('code_invoice')));
205 echo HtmlInput::button_anchor(_("Transformer en Facture de Vente"), "do.php?".$query, "create_invoice",
206 ' target="_blank" ', "button");
207 ?>
208 </div>
209 <?php
211 ?>
212
213 <?php
214 if (Document_Option::is_enable_make_feenote($p_follow_up->dt_id)):
215 ?>
216 <div id="follow_up_detail_feenote" class="col m-3" style="position:static">
217 <?php
218 $query=http_build_query(array('gDossier'=>Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_feenote'=>1, 'ac'=>$menu->get('code_feenote')));
219 echo HtmlInput::button_anchor(_("Transformer en Note de frais ou Facture Achat"), "do.php?".$query, "create_feenote",
220 ' target="_blank" ', "button");
221 ?>
222 </div>
223 <?php
224 endif;
225 ?>
226</div>
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
span($p_string, $p_extra='')
Definition: ac_common.php:43
tr($p_string, $p_extra='')
Definition: ac_common.php:88
if(!headers_sent())
– pour utiliser unoconv démarrer un server libreoffice commande libreoffice –headless –accept="socket...
$opd_description style
Description of class_default_menu.
static is_enable_make_feenote($p_document_type)
returns true if the operation_detail is enable, otherwise false
static is_enable_make_invoice($p_document_type)
returns true if the operation_detail is enable, otherwise false
static option_operation_detail($p_document_type)
returns option from the operation_detail
static id()
return the 'gDossier' value after a check
static connect()
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
static ledger_add_item($p_ledger)
Build a HTML string for adding multiple rows.
static button($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
static hidden($p_name, $p_value, $p_id="")
static button_anchor($p_label, $p_value, $p_name="", $p_javascript="", $p_class="smallbutton")
create a button with a ref
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: inum.class.php:42
Html Input.
Definition: itext.class.php:30
let you choose a TVA in a popup
const MAX_ARTICLE
Definition: constant.php:133
$icard table
$aArticle[$i]['fid']