/[phpcompta]/phpcompta/include/user_action_ven.php
ViewVC logotype

Diff of /phpcompta/include/user_action_ven.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by sparkyx, Sat Aug 27 20:42:49 2005 UTC revision 1.23 by sparkyx, Sun Oct 23 18:55:33 2005 UTC
# Line 19  Line 19 
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_ven.php");  echo_debug(__FILE__,__LINE__,"include user_action_ven.php");
22  include_once("form_input.php");  require_once("user_form_ven.php");
23  include_once("class_widget.php");  include_once("class_widget.php");
24  $cn=DbConnect($_SESSION['g_dossier']);  $cn=DbConnect($_SESSION['g_dossier']);
25  // default action is insert_vente  // default action is insert_vente
# Line 34  if ( $action == 'insert_vente' ) { Line 34  if ( $action == 'insert_vente' ) {
34        
35      // Add item      // Add item
36          if (isset($_POST["add_item"]) ) {          if (isset($_POST["add_item"]) ) {
37        echo_debug(__FILE__,__LINE__,"Add an item");            echo_debug(__FILE__,__LINE__,"Add an item");
38        $nb_number=$_POST["nb_item"];            $nb_number=$_POST["nb_item"];
39        $nb_number++;            $nb_number++;
40              
41              $form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,false,$nb_number);
42              echo '<div class="u_redcontent">';
43              echo   $form;
44              echo '</div>';
45    
46        $form=FormVente($cn,$_GET['p_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb_number);          } // add an item
       echo '<div class="u_redcontent">';  
       echo     "here".    $form;  
       echo '</div>';  
         
     }  
47    
48      // We want to see the encoded invoice      // We want to see the encoded invoice
49      if ( isset ($_POST["view_invoice"])) {      if ( isset ($_POST["view_invoice"])) {
50        $nb_number=$_POST["nb_item"];        $nb_number=$_POST["nb_item"];
51        $form=FormVenteView($cn,$_GET['p_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,$nb_number);        if ( form_verify_input($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$nb_number) == true)
52            {
53              $form=FormVenteView($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,$nb_number);
54            // Check failed : invalid date or quantity            // Check failed : invalid date or quantity
55            if ( $form== null) {          } else {
56                    echo_error("Cannot validate ");              echo_error("Cannot validate ");
57                    $form=FormVente($cn,$_GET['p_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb_number);              $form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,false,$nb_number);
58           }            }
59        echo '<div class="u_redcontent">';        echo '<div class="u_redcontent">';
60        echo         $form;        echo         $form;
61        echo '</div>';        echo '</div>';
# Line 65  if ( $action == 'insert_vente' ) { Line 67  if ( $action == 'insert_vente' ) {
67        {        {
68        echo_debug(__FILE__,__LINE__,"Blank form");        echo_debug(__FILE__,__LINE__,"Blank form");
69        // Show an empty form of invoice        // Show an empty form of invoice
70        $form=FormVente($cn,$_GET['p_jrn'],$_SESSION['g_user'],null,false);        $form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),null,false);
71        echo '<div class="u_redcontent">';        echo '<div class="u_redcontent">';
72        echo $form;        echo $form;
73        echo '</div>';        echo '</div>';
# Line 77  if ( $action == 'insert_vente' ) { Line 79  if ( $action == 'insert_vente' ) {
79      // Save the invoice      // Save the invoice
80  if ( isset($_POST["record_invoice"])) {  if ( isset($_POST["record_invoice"])) {
81    // Check privilege    // Check privilege
82    if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn']) != 2 )    {    if ( CheckJrn($_SESSION['g_dossier'],$User,$_GET['p_jrn']) != 2 )    {
83      NoAccess();      NoAccess();
84      exit -1;      exit -1;
85    }    }
86    
87    // echo "RECORD INVOICE";    // echo "RECORD INVOICE";
88     RecordInvoice($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_GET['p_jrn']);     RecordInvoice($cn,$HTTP_POST_VARS,$User,$_GET['p_jrn']);
89  }  }
90  if (isset ($_POST['correct_new_invoice'])) {  if (isset ($_POST['correct_new_invoice'])) {
91    // Check privilege    // Check privilege
# Line 93  if (isset ($_POST['correct_new_invoice'] Line 95  if (isset ($_POST['correct_new_invoice']
95    }    }
96        
97    $nb=$_POST['nb_item'];    $nb=$_POST['nb_item'];
98    $form=FormVente($cn,$_GET['p_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb);    $form=FormVenInput($cn,$_GET['p_jrn'],$User->GetPeriode(),$HTTP_POST_VARS,false,$nb);
99    echo '<div class="u_redcontent">';    echo '<div class="u_redcontent">';
100    echo $form;    echo $form;
101    echo '</div>';    echo '</div>';
# Line 108  if ( isset($_POST["record_and_print_invo Line 110  if ( isset($_POST["record_and_print_invo
110        
111    //  echo "RECORD AND PRINT INVOICE";    //  echo "RECORD AND PRINT INVOICE";
112    
113    $comment=RecordInvoice($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_GET['p_jrn']);    $comment=RecordInvoice($cn,$HTTP_POST_VARS,$User,$_GET['p_jrn']);
114    
115    $nb_number=$_POST["nb_item"];    $nb_number=$_POST["nb_item"];
116    $form=FormVenteView($cn,$p_jrn,$g_user,$HTTP_POST_VARS,$nb_number,'noform',$comment);    if ( form_verify_input($cn,$p_jrn,$User->GetPeriode(),$HTTP_POST_VARS,$nb_number)== true) {
117        $form=FormVenteView($cn,$p_jrn,$User->GetPeriode(),$HTTP_POST_VARS,$nb_number,'noform',$comment);
118      } else {
119                echo_error("Cannot validate ");
120                $form=FormVenInput($cn,$_GET['p_jrn'],$User,$HTTP_POST_VARS,false,$nb_number);
121      }
122        
123    echo '<div class="u_redcontent">';    echo '<div class="u_redcontent">';
124    echo $form;    echo $form;
# Line 125  if ( isset($_POST["record_and_print_invo Line 132  if ( isset($_POST["record_and_print_invo
132       NoAccess();       NoAccess();
133       exit -1;       exit -1;
134     }     }
135       // Extract the page number we want
136       $debut=(isset($_REQUEST['p_page']))?$_REQUEST['p_page']:0;
137    
138    
139  ?>  ?>
140  <div class="u_redcontent">  <div class="u_redcontent">
141  <?  <?
# Line 133  echo "<form method=\"POST\" action=\"use Line 144  echo "<form method=\"POST\" action=\"use
144  $w=new widget("select");  $w=new widget("select");
145    
146  $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");  $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
147  $User=new cl_user($cn);  // User is already set User=new cl_user($cn);
148  $current=(isset($_POST['p_periode']))?$_POST['p_periode']:$User->GetPeriode();  $current=(isset($_POST['p_periode']))?$_POST['p_periode']:$User->GetPeriode();
149  $w->selected=$current;  $w->selected=$current;
150    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26