19 |
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr |
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr |
20 |
/* $Revision$ */ |
/* $Revision$ */ |
21 |
echo_debug(__FILE__,__LINE__,"include user_action_ach.php"); |
echo_debug(__FILE__,__LINE__,"include user_action_ach.php"); |
22 |
include_once("form_input.php"); |
require_once("user_form_ach.php"); |
23 |
include_once ("preference.php"); |
require_once ("preference.php"); |
24 |
include_once ("user_common.php"); |
require_once ("user_common.php"); |
25 |
include_once("class_widget.php"); |
require_once("class_widget.php"); |
26 |
$cn=DbConnect($_SESSION['g_dossier']); |
$cn=DbConnect($_SESSION['g_dossier']); |
27 |
|
|
28 |
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { |
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { |
44 |
// Submit button in the form |
// Submit button in the form |
45 |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
46 |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
47 |
// add a one-line calculator |
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$submit,false); |
|
|
|
|
|
|
|
$r=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,null,false); |
|
48 |
echo '<div class="u_redcontent">'; |
echo '<div class="u_redcontent">'; |
49 |
echo $r; |
echo $r; |
50 |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
63 |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
64 |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
65 |
|
|
66 |
$r=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); |
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$submit,false, $nb_number); |
67 |
echo '<div class="u_redcontent">'; |
echo '<div class="u_redcontent">'; |
68 |
echo $r; |
echo $r; |
69 |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
78 |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
79 |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
80 |
|
|
81 |
$r=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); |
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$submit,false, $nb_number); |
82 |
echo '<div class="u_redcontent">'; |
echo '<div class="u_redcontent">'; |
83 |
echo $r; |
echo $r; |
84 |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>"; |
85 |
echo "</div>"; |
echo "</div>"; |
86 |
|
return; |
87 |
} |
} |
88 |
|
|
89 |
|
|
90 |
// View the charge and show a submit button to save it |
// View the charge and show a submit button to save it |
91 |
if ( isset ($_POST['view_invoice']) ) { |
if ( isset ($_POST['view_invoice']) and |
92 |
|
! isset ($_POST['save'])) { |
93 |
$nb_number=$_POST["nb_item"]; |
$nb_number=$_POST["nb_item"]; |
94 |
$submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer">'; |
$submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer">'; |
95 |
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">'; |
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">'; |
96 |
|
if ( form_verify_input ($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$nb_number) == true ) { |
97 |
// Should use a read only view instead of FormAch |
// Should use a read only view instead of FormAch |
98 |
// where we can check |
// where we can check |
99 |
$r=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true,$nb_number); |
$r=FormAchView($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$submit,$nb_number); |
100 |
|
} else { |
101 |
// if something goes wrong, correct it |
// if something goes wrong, correct it |
|
if ( $r == null ) { |
|
102 |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article"> |
103 |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">'; |
104 |
$r=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); |
$r=FormAchInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS, $nb_number); |
105 |
} |
} |
106 |
echo '<div class="u_redcontent">'; |
echo '<div class="u_redcontent">'; |
107 |
echo $r; |
echo $r; |
110 |
} |
} |
111 |
// Save the charge into database |
// Save the charge into database |
112 |
if ( isset($_POST['save'] )) { |
if ( isset($_POST['save'] )) { |
|
$r=RecordAchat($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_GET['p_jrn']); |
|
113 |
// Get number of lines |
// Get number of lines |
114 |
$nb_number=$_POST["nb_item"]; |
$nb_number=$_POST["nb_item"]; |
115 |
|
|
116 |
// submit button in the form |
// submit button in the form |
117 |
$submit='<h2 class="info">Recorded</h2>'; |
$submit='<h2 class="info">Recorded</h2>'; |
118 |
|
$r=RecordSell($cn,$HTTP_POST_VARS,$User,$_GET['p_jrn']); |
119 |
$r.=FormAch($cn,$_GET['p_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true, $nb_number,true); |
$r=FormAchView($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,"",$nb_number,false); |
120 |
echo '<div class="u_redcontent">'; |
echo '<div class="u_redcontent">'; |
121 |
|
echo $submit; |
122 |
echo $r; |
echo $r; |
123 |
echo "</div>"; |
echo "</div>"; |
124 |
|
|