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

Diff of /phpcompta/include/user_form_ven.php

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

revision 1.3 by sparkyx, Thu Oct 27 13:09:42 2005 UTC revision 1.4 by sparkyx, Fri Oct 28 12:53:55 2005 UTC
# Line 1  Line 1 
1  <?  w<?
2  /*  /*
3   *   This file is part of PhpCompta.   *   This file is part of PhpCompta.
4   *   *
# Line 68  function FormVenInput($p_cn,$p_jrn,$p_pe Line 68  function FormVenInput($p_cn,$p_jrn,$p_pe
68    $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'";
69    $list=GetArray($p_cn,$sql);    $list=GetArray($p_cn,$sql);
70    $r.='<TABLE>';    $r.='<TABLE>';
71    //  $r.='<TR>'.InputType("Date ","Text","e_date",$op_date,$pview_only).'</TR>';    //  Date
72      //--
73    $Date=new widget("text");    $Date=new widget("text");
74    $Date->SetReadOnly($pview_only);    $Date->SetReadOnly($pview_only);
75    $Date->table=1;    $Date->table=1;
76    $r.="<tr>";    $r.="<tr>";
77    $r.=$Date->IOValue("e_date",$op_date,"Date");    $r.=$Date->IOValue("e_date",$op_date,"Date");
78    $r.="</tr>";    $r.="</tr>";
79      // Payment limit
80      //--
81    $Echeance=new widget("text");    $Echeance=new widget("text");
82    $Echeance->SetReadOnly($pview_only);    $Echeance->SetReadOnly($pview_only);
83    $Echeance->table=1;    $Echeance->table=1;
84    $r.="<tr>";    $r.="<tr>";
85    $r.=$Echeance->IOValue("e_ech",$e_ech,"Echeance");    $r.=$Echeance->IOValue("e_ech",$e_ech,"Echeance");
86    $r.="</tr>";    $r.="</tr>";
87      // Comment
88      //--
89    $Commentaire=new widget("text");    $Commentaire=new widget("text");
90    $Commentaire->table=1;    $Commentaire->table=1;
91    $Commentaire->SetReadOnly($pview_only);    $Commentaire->SetReadOnly($pview_only);
# Line 91  function FormVenInput($p_cn,$p_jrn,$p_pe Line 95  function FormVenInput($p_cn,$p_jrn,$p_pe
95    $r.="</tr>";    $r.="</tr>";
96    include_once("fiche_inc.php");    include_once("fiche_inc.php");
97    // Display the customer    // Display the customer
98      //--
99    $fiche='deb';    $fiche='deb';
100    echo_debug(__FILE__,__LINE__,"Client Nombre d'enregistrement ".sizeof($fiche));    echo_debug(__FILE__,__LINE__,"Client Nombre d'enregistrement ".sizeof($fiche));
101    // Save old value and set a new one    // Save old value and set a new one
102      //--
103    $e_client=( isset ($e_client) )?$e_client:"";    $e_client=( isset ($e_client) )?$e_client:"";
   
104    $e_client_label="";      $e_client_label="";  
105    
106    // retrieve e_client_label    // retrieve e_client_label
107      //--
108    if ( isNumber($e_client) == 1 ) {    if ( isNumber($e_client) == 1 ) {
109      if ( isFicheOfJrn($p_cn,$p_jrn,$e_client,'deb') == 0 ) {      if ( isFicheOfJrn($p_cn,$p_jrn,$e_client,'deb') == 0 ) {
110        $msg="Fiche inexistante !!! ";        $msg="Fiche inexistante !!! ";
# Line 141  function FormVenInput($p_cn,$p_jrn,$p_pe Line 147  function FormVenInput($p_cn,$p_jrn,$p_pe
147    $r.="<th>tva</th>";    $r.="<th>tva</th>";
148    $r.="<th>quantité</th>";    $r.="<th>quantité</th>";
149    $r.='</TR>';    $r.='</TR>';
150    //  $fiche=GetFicheJrn($p_cn,$p_jrn,'cred');    // For each article
151    //  echo_debug(__FILE__,__LINE__,"Cred Nombre d'enregistrement ".sizeof($fiche));    //--
152    for ($i=0;$i< $p_article;$i++) {    for ($i=0;$i< $p_article;$i++) {
153      // Code id      // Code id, price & vat code
154        //--
155      $march=(isset(${"e_march$i"}))?${"e_march$i"}:"";      $march=(isset(${"e_march$i"}))?${"e_march$i"}:"";
156      $march_sell=(isset(${"e_march".$i."_sell"}))?${"e_march".$i."_sell"}:"";      $march_sell=(isset(${"e_march".$i."_sell"}))?${"e_march".$i."_sell"}:"";
157      $march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";      $march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
# Line 153  function FormVenInput($p_cn,$p_jrn,$p_pe Line 160  function FormVenInput($p_cn,$p_jrn,$p_pe
160      $march_label="";      $march_label="";
161    
162      // If $march has a value      // If $march has a value
163        //--
164      if ( isNumber($march) == 1 ) {      if ( isNumber($march) == 1 ) {
165        if ( isFicheOfJrn($p_cn,$p_jrn,$march,'cred') == 0 ) {        if ( isFicheOfJrn($p_cn,$p_jrn,$march,'cred') == 0 ) {
166          $msg="Fiche inexistante !!! ";          $msg="Fiche inexistante !!! ";
# Line 161  function FormVenInput($p_cn,$p_jrn,$p_pe Line 169  function FormVenInput($p_cn,$p_jrn,$p_pe
169          $march="";          $march="";
170        } else {        } else {
171          // retrieve the tva label and name          // retrieve the tva label and name
172            //--
173          $a_fiche=GetFicheAttribut($p_cn, $march);          $a_fiche=GetFicheAttribut($p_cn, $march);
174          if ( $a_fiche != null ) {          if ( $a_fiche != null ) {
175            if ( $march_tva_id == "" ) {            if ( $march_tva_id == "" ) {
# Line 172  function FormVenInput($p_cn,$p_jrn,$p_pe Line 181  function FormVenInput($p_cn,$p_jrn,$p_pe
181        }        }
182      }      }
183      // Show input      // Show input
184      //    $r.='<TR>'.InputType("","js_search","e_march".$i,$march,$pview_only,'cred');      //--
185      $W1=new widget("js_search");      $W1=new widget("js_search");
186      $W1->label="";      $W1->label="";
187      $W1->name="e_march".$i;      $W1->name="e_march".$i;
# Line 183  function FormVenInput($p_cn,$p_jrn,$p_pe Line 192  function FormVenInput($p_cn,$p_jrn,$p_pe
192      $r.="<TR>".$W1->IOValue()."</TD>";      $r.="<TR>".$W1->IOValue()."</TD>";
193      $Span=new widget ("span");      $Span=new widget ("span");
194      $Span->SetReadOnly($pview_only);      $Span->SetReadOnly($pview_only);
195      // card's name      // card's name, price
196      //$r.=InputType("","span", "e_march".$i."_label", $march_label,$pview_only);      //--
197      $r.="<TD>".$Span->IOValue("e_march".$i."_label",$march_label)."</TD>";      $r.="<TD>".$Span->IOValue("e_march".$i."_label",$march_label)."</TD>";
198     // price     // price
199      $Price=new widget("text");      $Price=new widget("text");
200      $Price->SetReadOnly($pview_only);      $Price->SetReadOnly($pview_only);
201      $Price->table=1;      $Price->table=1;
     //$r.=InputType("","text","e_march".$i."_sell",$march_sell,$pview_only);  
202      $r.=$Price->IOValue("e_march".$i."_sell",$march_sell);      $r.=$Price->IOValue("e_march".$i."_sell",$march_sell);
203      // vat label      // vat label
204        //--
205      $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      $Tva=new widget("select");      $Tva=new widget("select");
207      $Tva->table=1;      $Tva->table=1;
# Line 200  function FormVenInput($p_cn,$p_jrn,$p_pe Line 209  function FormVenInput($p_cn,$p_jrn,$p_pe
209      $r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);      $r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);
210    
211      // quantity      // quantity
212        //--
213      $quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"0";      $quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"0";
214      $Quantity=new widget("text");      $Quantity=new widget("text");
215      $Quantity->SetReadOnly($pview_only);      $Quantity->SetReadOnly($pview_only);
# Line 562  function RecordInvoice($p_cn,$p_array,$p Line 572  function RecordInvoice($p_cn,$p_array,$p
572    $periode=$p_user->GetPeriode();    $periode=$p_user->GetPeriode();
573    $amount=0.0;    $amount=0.0;
574    // Computing total customer    // Computing total customer
575      //--
576    for ($i=0;$i<$nb_item;$i++) {    for ($i=0;$i<$nb_item;$i++) {
577      // store quantity & goods in array      // store quantity & goods in array
578      $a_good[$i]=${"e_march$i"};      $a_good[$i]=${"e_march$i"};
579      $a_quant[$i]=${"e_quant$i"};      $a_quant[$i]=${"e_quant$i"};
580      $a_price[$i]=0;      $a_price[$i]=0;
581      $a_vat[$i]=${"e_march$i"."_tva_id"};      $a_vat[$i]=${"e_march$i"."_tva_id"};
582      // check wether the price is set or no      // check whether the price is set or no
583      if ( isNumber(${"e_march$i"."_sell"}) == 0 ) {      if ( isNumber(${"e_march$i"."_sell"}) == 0 ) {
584        if ( isNumber($a_good[$i]) == 1 ) {        if ( isNumber($a_good[$i]) == 1 ) {
585               // If the price is not set we have to find it from the database               // If the price is not set we have to find it from the database
# Line 579  function RecordInvoice($p_cn,$p_array,$p Line 590  function RecordInvoice($p_cn,$p_array,$p
590        $a_price[$i]=${"e_march$i"."_sell"};        $a_price[$i]=${"e_march$i"."_sell"};
591      }      }
592      $amount+=$a_price[$i]*$a_quant[$i];      $amount+=$a_price[$i]*$a_quant[$i];
593    }    }// for
594    
595    $comm=FormatString($e_comm);    $comm=FormatString($e_comm);
596      // Compute VAT
597      //--
598    $a_vat=ComputeVat($p_cn,$a_good,$a_quant,$a_price,$a_vat);    $a_vat=ComputeVat($p_cn,$a_good,$a_quant,$a_price,$a_vat);
   
599    $sum_vat=0.0;    $sum_vat=0.0;
600    if ( $a_vat != null ){    if ( $a_vat != null ){
601      foreach ( $a_vat as $element => $t) {      foreach ( $a_vat as $element => $t) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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