29 |
* or update one |
* or update one |
30 |
* |
* |
31 |
* parm : |
* parm : |
32 |
* - p_array which can be empty |
* - $p_array which can be empty (normally = $_POST) |
33 |
* - the "journal" |
* - $p_jrn the ledger |
34 |
* - $p_periode = periode |
* - $p_periode = periode |
35 |
* - view_only if we cannot change it (no right or centralized op) |
* - $pview_only if we cannot change it (no right or centralized op) |
36 |
* - $p_article number of article |
* - $p_article number of article |
37 |
* gen : |
* gen : |
38 |
* - |
* - |
39 |
* return: string with the form |
* return: string with the form |
|
* TODO Add in parameters the infos about the company for making the invoice |
|
40 |
*/ |
*/ |
41 |
function FormAchInput($p_cn,$p_jrn,$p_periode,$p_array=null,$p_submit="",$pview_only=true,$p_article=1) |
function FormAchInput($p_cn,$p_jrn,$p_periode,$p_array=null,$p_submit="",$pview_only=true,$p_article=1) |
42 |
{ |
{ |
50 |
$op_date=( ! isset($e_date) ) ?substr($l_date_start,2,8):$e_date; |
$op_date=( ! isset($e_date) ) ?substr($l_date_start,2,8):$e_date; |
51 |
$e_ech=(isset($e_ech))?$e_ech:""; |
$e_ech=(isset($e_ech))?$e_ech:""; |
52 |
$e_comm=(isset($e_comm))?$e_comm:""; |
$e_comm=(isset($e_comm))?$e_comm:""; |
53 |
// $e_jrn=(isset($e_jrn))?$e_jrn:""; |
|
54 |
// Save old value and set a new one |
// Save old value and set a new one |
55 |
echo_debug(__FILE__,__LINE__,"form_input.php.FormSell_op_date is $op_date"); |
echo_debug(__FILE__,__LINE__,"form_input.php.FormSell_op_date is $op_date"); |
56 |
$r=""; |
$r=""; |
64 |
$sql="select jrn_def_id as value,jrn_def_name as label from jrn_def where jrn_def_type='VEN'"; |
$sql="select jrn_def_id as value,jrn_def_name as label from jrn_def where jrn_def_type='VEN'"; |
65 |
$list=GetArray($p_cn,$sql); |
$list=GetArray($p_cn,$sql); |
66 |
$r.='<TABLE>'; |
$r.='<TABLE>'; |
67 |
// $r.='<TR>'.InputType("Date ","Text","e_date",$op_date,$pview_only).'</TR>'; |
// Date widget |
68 |
|
//-- |
69 |
$Date=new widget("text"); |
$Date=new widget("text"); |
70 |
$Date->SetReadOnly($pview_only); |
$Date->SetReadOnly($pview_only); |
71 |
$Date->table=1; |
$Date->table=1; |
72 |
$r.="<tr>"; |
$r.="<tr>"; |
73 |
$r.=$Date->IOValue("e_date",$op_date,"Date"); |
$r.=$Date->IOValue("e_date",$op_date,"Date"); |
74 |
$r.="</tr>"; |
$r.="</tr>"; |
75 |
|
// Payment limit widget |
76 |
|
//-- |
77 |
$Echeance=new widget("text"); |
$Echeance=new widget("text"); |
78 |
$Echeance->SetReadOnly($pview_only); |
$Echeance->SetReadOnly($pview_only); |
79 |
$Echeance->table=1; |
$Echeance->table=1; |
80 |
$r.="<tr>"; |
$r.="<tr>"; |
81 |
$r.=$Echeance->IOValue("e_ech",$e_ech,"Echeance"); |
$r.=$Echeance->IOValue("e_ech",$e_ech,"Echeance"); |
82 |
$r.="</tr>"; |
$r.="</tr>"; |
83 |
|
// Comment |
84 |
|
//-- |
85 |
$Commentaire=new widget("text"); |
$Commentaire=new widget("text"); |
86 |
$Commentaire->table=1; |
$Commentaire->table=1; |
87 |
$Commentaire->SetReadOnly($pview_only); |
$Commentaire->SetReadOnly($pview_only); |
90 |
$r.=$Commentaire->IOValue("e_comm",$e_comm,"Description"); |
$r.=$Commentaire->IOValue("e_comm",$e_comm,"Description"); |
91 |
$r.="</tr>"; |
$r.="</tr>"; |
92 |
include_once("fiche_inc.php"); |
include_once("fiche_inc.php"); |
93 |
// Display the customer |
// Display the supplier |
94 |
|
//-- |
95 |
$fiche='cred'; |
$fiche='cred'; |
96 |
echo_debug(__FILE__,__LINE__,"Client Nombre d'enregistrement ".sizeof($fiche)); |
echo_debug(__FILE__,__LINE__,"Fournisseurs Nombre d'enregistrement ".sizeof($fiche)); |
97 |
// Save old value and set a new one |
// Save old value and set a new one |
98 |
$e_client=( isset ($e_client) )?$e_client:""; |
$e_client=( isset ($e_client) )?$e_client:""; |
99 |
|
|
112 |
$e_client_label=$a_client['vw_name']." adresse ".$a_client['vw_addr']." ".$a_client['vw_cp']; |
$e_client_label=$a_client['vw_name']." adresse ".$a_client['vw_addr']." ".$a_client['vw_cp']; |
113 |
} |
} |
114 |
} |
} |
115 |
|
// widget search |
116 |
$W1=new widget("js_search"); |
$W1=new widget("js_search"); |
117 |
$W1->label="Fournisseur"; |
$W1->label="Fournisseur"; |
118 |
$W1->name="e_client"; |
$W1->name="e_client"; |
142 |
$r.="<th>tva</th>"; |
$r.="<th>tva</th>"; |
143 |
$r.="<th>quantité</th>"; |
$r.="<th>quantité</th>"; |
144 |
$r.='</TR>'; |
$r.='</TR>'; |
145 |
// $fiche=GetFicheJrn($p_cn,$p_jrn,'cred'); |
// For each article |
146 |
// echo_debug(__FILE__,__LINE__,"Cred Nombre d'enregistrement ".sizeof($fiche)); |
// compute amount |
147 |
|
// verify if card exists |
148 |
|
// retrieve vat label |
149 |
|
//-- |
150 |
for ($i=0;$i< $p_article;$i++) { |
for ($i=0;$i< $p_article;$i++) { |
151 |
// Code id |
// Code id |
152 |
$march=(isset(${"e_march$i"}))?${"e_march$i"}:""; |
$march=(isset(${"e_march$i"}))?${"e_march$i"}:""; |
176 |
} |
} |
177 |
} |
} |
178 |
// Show input |
// Show input |
179 |
// $r.='<TR>'.InputType("","js_search","e_march".$i,$march,$pview_only,'cred'); |
|
180 |
$W1=new widget("js_search"); |
$W1=new widget("js_search"); |
181 |
$W1->label=""; |
$W1->label=""; |
182 |
$W1->name="e_march".$i; |
$W1->name="e_march".$i; |
188 |
$Span=new widget ("span"); |
$Span=new widget ("span"); |
189 |
$Span->SetReadOnly($pview_only); |
$Span->SetReadOnly($pview_only); |
190 |
// card's name |
// card's name |
|
//$r.=InputType("","span", "e_march".$i."_label", $march_label,$pview_only); |
|
191 |
$r.="<TD>".$Span->IOValue("e_march".$i."_label",$march_label)."</TD>"; |
$r.="<TD>".$Span->IOValue("e_march".$i."_label",$march_label)."</TD>"; |
192 |
// price |
// price |
193 |
$Price=new widget("text"); |
$Price=new widget("text"); |
194 |
$Price->SetReadOnly($pview_only); |
$Price->SetReadOnly($pview_only); |
195 |
$Price->table=1; |
$Price->table=1; |
|
//$r.=InputType("","text","e_march".$i."_sell",$march_sell,$pview_only); |
|
196 |
$r.=$Price->IOValue("e_march".$i."_sell",$march_sell); |
$r.=$Price->IOValue("e_march".$i."_sell",$march_sell); |
197 |
// vat label |
// vat label |
198 |
$select_tva=make_array($p_cn,"select tva_id,tva_label from tva_rate order by tva_id",1); |
$select_tva=make_array($p_cn,"select tva_id,tva_label from tva_rate order by tva_id",1); |
206 |
$Quantity=new widget("text"); |
$Quantity=new widget("text"); |
207 |
$Quantity->SetReadOnly($pview_only); |
$Quantity->SetReadOnly($pview_only); |
208 |
$Quantity->table=1; |
$Quantity->table=1; |
|
//$r.=InputType("","TEXT","e_quant".$i,$quant,$pview_only); |
|
209 |
$r.=$Quantity->IOValue("e_quant".$i,$quant); |
$r.=$Quantity->IOValue("e_quant".$i,$quant); |
210 |
$r.='</TR>'; |
$r.='</TR>'; |
211 |
} |
} |