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
31 $text=new IText();
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><?php echo _('prix unitaire') ?></th>
53  <th><?php echo _('quantité') ?></th>
54  <th><?php echo _('Code TVA') ?></th>
55  <th><?php echo _('Montant TVA') ?></th>
56  <th><?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='';
71  $aCard[$i]=0;
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
173  endfor;
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  <?php
198  if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)):
199  ?>
200  <p id="follow_up_detail_invoice">
201  <?php
202  $query=http_build_query(array('gDossier'=>Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 'ac'=>$menu->get('code_invoice')));
203  echo HtmlInput::button_anchor(_("Transformer en facture"), "do.php?".$query, "create_invoice",
204  ' target="_blank" ', "button");
205  ?>
206  </p>
207  <?php
208  endif;
209  ?>
$query
$query
Definition: ajax_add_concerned_card.php:91
style
$opd_description style
Definition: ajax_mod_predf_op.php:52
endif
endif
Definition: follow_up_detail_display.php:204
INum
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: inum.class.php:41
ITva_Popup
let you choose a TVA in a popup
Definition: itva_popup.class.php:43
table
$icard table
Definition: follow_up_detail_display.php:64
IText
Html Input.
Definition: itext.class.php:29
HtmlInput\button
static button($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Definition: html_input.class.php:206
endfor
endfor
Definition: follow_up_detail_display.php:167
$tmp_ad
$tmp_ad
Definition: follow_up_detail_display.php:68
p
p($p_string)
Definition: ac_common.php:39
tr
tr($p_string, $p_extra='')
Definition: ac_common.php:88
HtmlInput\button_anchor
static button_anchor($p_label, $p_value, $p_name="", $p_javascript="", $p_class="smallbutton")
create a button with a ref
Definition: html_input.class.php:238
Document_Option\is_enable_make_invoice
static is_enable_make_invoice($p_document_type)
returns true if the operation_detail is enable, otherwise false
Definition: document_option.class.php:109
$tot_item
$tot_item
Definition: follow_up_detail_display.php:29
$itva
$itva
Definition: follow_up_detail_display.php:33
Html_Input_Noalyss\ledger_add_item
static ledger_add_item($p_ledger)
Build a HTML string for adding multiple rows.
Definition: html_input_noalyss.class.php:42
$document_type
$document_type
Definition: follow_up_detail_display.php:37
$aArticle
$aArticle[$i]['fid']
Definition: follow_up_detail_display.php:104
$text
$text
Definition: follow_up_detail_display.php:31
Dossier\connect
static connect()
Definition: dossier.class.php:282
$num
$num
Definition: follow_up_detail_display.php:32
$readonly
$readonly
Definition: follow_up_detail_display.php:34
$tot_vat
$tot_vat
Definition: follow_up_detail_display.php:30
Document_Option\option_operation_detail
static option_operation_detail($p_document_type)
returns option from the operation_detail
Definition: document_option.class.php:76
$cn
$cn
Definition: follow_up_detail_display.php:36
$i
$i
Definition: action_document_type_mtable_input.php:83
h2
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
Default_Menu
Description of class_default_menu.
Definition: default_menu.class.php:28
$article_count
$article_count
Definition: follow_up_detail_display.php:27
$aCard
$aCard[$i]
Definition: follow_up_detail_display.php:71
Fiche
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:37
MAX_ARTICLE
const MAX_ARTICLE
Definition: constant.php:124
Dossier\id
static id()
return the $_REQUEST['gDossier'] after a check
Definition: dossier.class.php:55
$f
$f
Definition: category_card.inc.php:69
$menu
$menu
Definition: follow_up_detail_display.php:41
span
span($p_string, $p_extra='')
Definition: ac_common.php:43
$option_detail
$option_detail
Definition: follow_up_detail_display.php:38
ICard
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Definition: icard.class.php:120
th
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
HtmlInput\hidden
static hidden($p_name, $p_value, $p_id="")
Definition: html_input.class.php:218
if
if(! defined('ALLOWED')) if(! defined( 'ALLOWED_ADMIN'))
– pour utiliser unoconv démarrer un server libreoffice commande libreoffice –headless –accept="socket...
Definition: admin_repo.inc.php:25