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

Diff of /phpcompta/include/form_input.php

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

revision 1.62 by sparkyx, Sun Oct 16 16:12:24 2005 UTC revision 1.63 by sparkyx, Sat Oct 22 10:59:48 2005 UTC
# Line 274  function FormVente($p_cn,$p_jrn,$p_user, Line 274  function FormVente($p_cn,$p_jrn,$p_user,
274    $r.='<TR>';    $r.='<TR>';
275    $r.="<th></th>";    $r.="<th></th>";
276    $r.="<th>Code</th>";    $r.="<th>Code</th>";
277    $r.="<th>D�omination</th>";    $r.="<th>Dénomination</th>";
278    $r.="<th>prix</th>";    $r.="<th>prix</th>";
279    $r.="<th colspan=\"2\">tva</th>";    $r.="<th colspan=\"2\">tva</th>";
280    $r.="<th>quantit�/th>";    $r.="<th>quantité</th>";
281    $r.='</TR>';    $r.='</TR>';
282    //  $fiche=GetFicheJrn($p_cn,$p_jrn,'cred');    //  $fiche=GetFicheJrn($p_cn,$p_jrn,'cred');
283    //  echo_debug(__FILE__,__LINE__,"Cred Nombre d'enregistrement ".sizeof($fiche));    //  echo_debug(__FILE__,__LINE__,"Cred Nombre d'enregistrement ".sizeof($fiche));
# Line 523  for ($o = 0;$o < $p_number; $o++) { Line 523  for ($o = 0;$o < $p_number; $o++) {
523    // show all article, price vat and sum    // show all article, price vat and sum
524      $r.="<TR>";      $r.="<TR>";
525      $r.="<TH>Article</TH>";      $r.="<TH>Article</TH>";
526      $r.="<TH>quantit�/TH>";      $r.="<TH>quantité</TH>";
527      $r.="<TH>prix unit.</TH>";      $r.="<TH>prix unit.</TH>";
528      $r.="<TH>taux tva</TH>";      $r.="<TH>taux tva</TH>";
529      $r.="<TH>Montant HTVA</TH>";      $r.="<TH>Montant HTVA</TH>";
# Line 607  for ($o = 0;$o < $p_number; $o++) { Line 607  for ($o = 0;$o < $p_number; $o++) {
607            $file->table=1;            $file->table=1;
608            $r.="<hr>";            $r.="<hr>";
609            $r.= "<table>";            $r.= "<table>";
610            $r.="<TR>".$file->IOValue("pj","","Pi�e justificative")."</TR>";            $r.="<TR>".$file->IOValue("pj","","Pièce justificative")."</TR>";
611            $r.="</table>";            $r.="</table>";
612            $r.="<hr>";            $r.="<hr>";
613    
# Line 701  function RecordInvoice($p_cn,$p_array,$p Line 701  function RecordInvoice($p_cn,$p_array,$p
701    // Debit = client    // Debit = client
702    $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT);    $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT);
703    StartSql($p_cn);          StartSql($p_cn);      
704    $r=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$amount+$sum_vat,$seq,$periode);    $r=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,round($amount,2)+round($sum_vat,2),$seq,$periode);
705    if ( $r == false) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}    if ( $r == false) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}
706    // Credit = goods    // Credit = goods
707    for ( $i = 0; $i < $nb_item;$i++) {    for ( $i = 0; $i < $nb_item;$i++) {
# Line 712  function RecordInvoice($p_cn,$p_array,$p Line 712  function RecordInvoice($p_cn,$p_array,$p
712      if ( $a_price[$i]*$a_quant[$i] == 0 ) continue;      if ( $a_price[$i]*$a_quant[$i] == 0 ) continue;
713                        
714      // record into jrnx      // record into jrnx
715      $j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$a_price[$i]*$a_quant[$i],$seq,$periode);      $j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,round($a_price[$i]*$a_quant[$i],2),$seq,$periode);
716      if ( $j_id == false) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}      if ( $j_id == false) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}
717      // always save quantity but in withStock we can find what card need a stock management      // always save quantity but in withStock we can find what card need a stock management
718      if (  InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c') == false ) {      if (  InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c') == false ) {
# Line 727  function RecordInvoice($p_cn,$p_array,$p Line 727  function RecordInvoice($p_cn,$p_array,$p
727        foreach ($a_vat as $tva_id => $tva_amount ) {        foreach ($a_vat as $tva_id => $tva_amount ) {
728          $poste=GetTvaPoste($p_cn,$tva_id,'c');          $poste=GetTvaPoste($p_cn,$tva_id,'c');
729          if ($tva_amount == 0 ) continue;          if ($tva_amount == 0 ) continue;
730          $r=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$tva_amount,$seq,$periode);          $r=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,round($tva_amount,2),$seq,$periode);
731          if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");}          if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");}
732                
733        }        }
734      }      }
735    echo_debug(__FILE__,__LINE__,"echeance = $e_ech");    echo_debug(__FILE__,__LINE__,"echeance = $e_ech");
736    $r=InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",$amount+$sum_vat,$seq,$periode);    $r=InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",round($amount,2)+round($sum_vat,2),$seq,$periode);
737    if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");}    if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");}
738    // Set Internal code and Comment    // Set Internal code and Comment
739    $internal=SetInternalCode($p_cn,$seq,$p_jrn);    $internal=SetInternalCode($p_cn,$seq,$p_jrn);
# Line 746  function RecordInvoice($p_cn,$p_array,$p Line 746  function RecordInvoice($p_cn,$p_array,$p
746    if ( isset ($_FILES))    if ( isset ($_FILES))
747      save_upload_document($p_cn,$seq);      save_upload_document($p_cn,$seq);
748    
749    
750    Commit($p_cn);    Commit($p_cn);
751    
752    return $comment;    return $comment;
# Line 972  function FormAch($p_cn,$p_jrn,$p_user,$p Line 973  function FormAch($p_cn,$p_jrn,$p_user,$p
973      $file->table=1;      $file->table=1;
974      $r.="<hr>";      $r.="<hr>";
975      $r.= "<table>";      $r.= "<table>";
976      $r.="<TR>".$file->IOValue("pj","","Pi�e justificative")."</TR>";      $r.="<TR>".$file->IOValue("pj","","Pièce justificative")."</TR>";
977      $r.="</table>";      $r.="</table>";
978      $r.="<hr>";      $r.="<hr>";
979    }    }
# Line 1108  function RecordAchat($p_cn,$p_array,$p_u Line 1109  function RecordAchat($p_cn,$p_array,$p_u
1109    // Debit = client    // Debit = client
1110    $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT);    $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT);
1111    StartSql($p_cn);    StartSql($p_cn);
1112    InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$amount+$sum_vat,$seq,$periode);    InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,round($amount,2)+round($sum_vat,2),$seq,$periode);
1113        
1114    // Credit = goods    // Credit = goods
1115    for ( $i = 0; $i < $nb_item;$i++) {    for ( $i = 0; $i < $nb_item;$i++) {
1116      if ( ! isset ( $a_good[$i]) ) continue;      if ( ! isset ( $a_good[$i]) ) continue;
1117      $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT);      $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT);
1118      if ( $a_price[$i] * $a_quant[$i] == 0 ) continue;          if ( $a_price[$i] * $a_quant[$i] == 0 ) continue;    
1119      $j_id=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$a_price[$i]*$a_quant[$i],$seq,$periode);      $j_id=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,round($a_price[$i]*$a_quant[$i],2),$seq,$periode);
1120      if ( $j_id == false ) {$Rollback($p_cn);exit("error __FILE__ __LINE__");}      if ( $j_id == false ) {$Rollback($p_cn);exit("error __FILE__ __LINE__");}
1121      //    if ( withStock($p_cn,$a_good[$i]) == true )        //    if ( withStock($p_cn,$a_good[$i]) == true )  
1122      // always save quantity but in withStock we can find what card need a stock management      // always save quantity but in withStock we can find what card need a stock management
# Line 1126  function RecordAchat($p_cn,$p_array,$p_u Line 1127  function RecordAchat($p_cn,$p_array,$p_u
1127      {      {
1128        foreach ($a_vat as $tva_id => $tva_amount ) {        foreach ($a_vat as $tva_id => $tva_amount ) {
1129          $poste=GetTvaPoste($p_cn,$tva_id,'d');          $poste=GetTvaPoste($p_cn,$tva_id,'d');
1130          if ( InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$tva_amount,$seq,$periode) == false ) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}          if ( InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,round($tva_amount,2),$seq,$periode) == false ) { $Rollback($p_cn);exit("error __FILE__ __LINE__");}
1131        }        }
1132      }      }
1133    $e_comment=FormatString($e_comment);    $e_comment=FormatString($e_comment);
1134    echo_debug(__FILE__,__LINE__,"echeance = $e_ech");    echo_debug(__FILE__,__LINE__,"echeance = $e_ech");
1135    echo_debug(__FILE__,__LINE__,"comment = $e_comment");    echo_debug(__FILE__,__LINE__,"comment = $e_comment");
1136    if ( ($amount+$sum_vat) != 0 ){    if ( ($amount+$sum_vat) != 0 ){
1137      if ( InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,$e_comment,round($amount+$sum_vat,2),$seq,$periode) == false ) {      if ( InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,$e_comment,round($amount,2)+round($sum_vat,2),$seq,$periode) == false ) {
1138        $Rollback($p_cn);exit("error __FILE__ __LINE__");        $Rollback($p_cn);exit("error __FILE__ __LINE__");
1139      }      }
1140      // Set Internal code and Comment      // Set Internal code and Comment
1141      $comment=SetInternalCode($p_cn,$seq,$p_jrn)."  client : ".GetFicheName($p_cn,$e_client);      $internal_code=SetInternalCode($p_cn,$seq,$p_jrn);
1142        $comment=$internal_code."  client : ".GetFicheName($p_cn,$e_client);
1143      if ( $e_comment=="" ) {      if ( $e_comment=="" ) {
1144        // Update comment if comment is blank        // Update comment if comment is blank
1145        $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);        $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);
1146      }      }
1147      if ( isset ($_FILES))      if ( isset ($_FILES))
1148        save_upload_document($p_cn,$seq);        save_upload_document($p_cn,$seq);
   
1149      Commit($p_cn);      Commit($p_cn);
1150      return $comment;      return $comment;
1151    }    }
# Line 1266  function FormFin($p_cn,$p_jrn,$p_user,$p Line 1267  function FormFin($p_cn,$p_jrn,$p_user,$p
1267    $r.="<TR>";    $r.="<TR>";
1268    $r.="<th></TH>";    $r.="<th></TH>";
1269    $r.="<th>code</TH>";    $r.="<th>code</TH>";
1270    $r.="<th>D�omination</TH>";    $r.="<th>D&eacute;omination</TH>";
1271    $r.="<th>Description</TH>";    $r.="<th>Description</TH>";
1272    $r.="<th>Montant</TH>";    $r.="<th>Montant</TH>";
1273    $r.='<th colspan="2"> Op. Concern�</th>';    $r.='<th colspan="2"> Op. Concern&eacute;</th>';
1274    $r.="</TR>";    $r.="</TR>";
1275    // Parse each " tiers"    // Parse each " tiers"
1276      for ($i=0; $i < $p_item; $i++) {      for ($i=0; $i < $p_item; $i++) {
# Line 1336  $r.="</TABLE>"; Line 1337  $r.="</TABLE>";
1337     $file->table=1;     $file->table=1;
1338     $r.="<hr>";     $r.="<hr>";
1339     $r.= "<table>";     $r.= "<table>";
1340     $r.="<TR>".$file->IOValue("pj","","Pi�e justificative")."</TR>";     $r.="<TR>".$file->IOValue("pj","","Pi&eagrave;ce justificative")."</TR>";
1341     $r.="</table>";     $r.="</table>";
1342     $r.="<hr>";     $r.="<hr>";
1343   }   }
# Line 1418  function RecordFin($p_cn,$p_array,$p_use Line 1419  function RecordFin($p_cn,$p_array,$p_use
1419      // Compute the j_grpt      // Compute the j_grpt
1420      $seq=NextSequence($p_cn,'s_grpt');      $seq=NextSequence($p_cn,'s_grpt');
1421    
1422      if ( InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste_bq,$e_date,${"e_other$i"."_amount"},$seq,$periode) == false ) {      if ( InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste_bq,$e_date,round(${"e_other$i"."_amount"},2),$seq,$periode) == false ) {
1423        $Rollback($p_cn);exit("error __FILE__ __LINE__");        $Rollback($p_cn);exit("error __FILE__ __LINE__");
1424      }      }
1425    
1426    
1427      // Record a line for the other account      // Record a line for the other account
1428      //    $type=( ${"e_other$i"."_amount"} < 0 )?'c':'d';      //    $type=( ${"e_other$i"."_amount"} < 0 )?'c':'d';
1429      if ( ($j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,${"e_other$i"."_amount"},$seq,$periode)) == false )      if ( ($j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,round(${"e_other$i"."_amount"},2),$seq,$periode)) == false )
1430        { $Rollback($p_cn);exit("error __FILE__ __LINE__");}        { $Rollback($p_cn);exit("error __FILE__ __LINE__");}
1431    
1432      echo_debug(__FILE__,__LINE__,"   $j_id=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,".${"e_other$i"}."_amount".",$seq,$periode);");      echo_debug(__FILE__,__LINE__,"   $j_id=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,".${"e_other$i"}."_amount".",$seq,$periode);");
1433    
1434      if ( ($jr_id=InsertJrn($p_cn,$e_date,'',$p_jrn,FormatString(${"e_other$i"."_comment"}),      if ( ($jr_id=InsertJrn($p_cn,$e_date,'',$p_jrn,FormatString(${"e_other$i"."_comment"}),
1435                             ${"e_other$i"."_amount"},$seq,$periode))==false) {                             round(${"e_other$i"."_amount"},2),$seq,$periode))==false) {
1436        $Rollback($p_cn);exit("error __FILE__ __LINE__");}        $Rollback($p_cn);exit("error __FILE__ __LINE__");}
1437        
1438      if ( isNumber(${"e_concerned".$i}) == 1 ) {      if ( isNumber(${"e_concerned".$i}) == 1 ) {
# Line 1441  function RecordFin($p_cn,$p_array,$p_use Line 1442  function RecordFin($p_cn,$p_array,$p_use
1442    
1443    
1444    // Set Internal code and Comment    // Set Internal code and Comment
1445    $comment=SetInternalCode($p_cn,$seq,$p_jrn)."  client : ".GetFicheName($p_cn,$e_bank_account);      $internal_code=SetInternalCode($p_cn,$seq,$p_jrn);
1446    if ( FormatString(${"e_other$i"."_comment"}) == null ) {      $comment=$internal_code."  client : ".GetFicheName($p_cn,$e_bank_account);
1447      // Update comment if comment is blank      if ( FormatString(${"e_other$i"."_comment"}) == null ) {
1448      $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);        // Update comment if comment is blank
1449    }        $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);
1450        }
1451        
1452      } // for nbitem
1453    if ( isset ($_FILES))    if ( isset ($_FILES))
1454      save_upload_document($p_cn,$seq);      save_upload_document($p_cn,$seq);
1455    
   }  
1456    Commit($p_cn);    Commit($p_cn);
1457  }  }
1458  /* function FormODS($p_cn,$p_jrn,$p_user,$p_array=null,$pview_only=true,$p_article=1)  /* function FormODS($p_cn,$p_jrn,$p_user,$p_array=null,$pview_only=true,$p_article=1)
# Line 1601  function FormODS($p_cn,$p_jrn,$p_user,$p Line 1604  function FormODS($p_cn,$p_jrn,$p_user,$p
1604     $file->table=1;     $file->table=1;
1605     $r.="<hr>";     $r.="<hr>";
1606     $r.= "<table>";     $r.= "<table>";
1607     $r.="<TR>".$file->IOValue("pj","","Pi�e justificative")."</TR>";     $r.="<TR>".$file->IOValue("pj","","Pièce justificative")."</TR>";
1608     $r.="</table>";     $r.="</table>";
1609     $r.="<hr>";     $r.="<hr>";
1610   }   }
# Line 1672  function RecordODS($p_cn,$p_array,$p_use Line 1675  function RecordODS($p_cn,$p_array,$p_use
1675    // store into the database    // store into the database
1676    for ( $i = 0; $i < $nb_item;$i++) {    for ( $i = 0; $i < $nb_item;$i++) {
1677      if ( isNumber(${"e_account$i"}) == 0 ) continue;      if ( isNumber(${"e_account$i"}) == 0 ) continue;
1678      $sum_deb+=(${"e_account$i"."_type"}=='d')?${"e_account$i"."_amount"}:0;      $sum_deb+=(${"e_account$i"."_type"}=='d')?round(${"e_account$i"."_amount"},2):0;
1679      $sum_cred+=(${"e_account$i"."_type"}=='c')?${"e_account$i"."_amount"}:0;      $sum_cred+=(${"e_account$i"."_type"}=='c')?round(${"e_account$i"."_amount"},2):0;
1680    
1681      if ( ${"e_account$i"."_amount"} == 0 ) continue;      if ( ${"e_account$i"."_amount"} == 0 ) continue;
1682      if ( ($j_id=InsertJrnx($p_cn,${"e_account$i"."_type"},$p_user,$p_jrn,${"e_account$i"},$e_date,${"e_account$i"."_amount"},$seq,$periode)) == false ) {      if ( ($j_id=InsertJrnx($p_cn,${"e_account$i"."_type"},$p_user,$p_jrn,${"e_account$i"},$e_date,${"e_account$i"."_amount"},$seq,$periode)) == false ) {
# Line 1684  function RecordODS($p_cn,$p_array,$p_use Line 1687  function RecordODS($p_cn,$p_array,$p_use
1687      $Rollback($p_cn);exit("error __FILE__ __LINE__");}      $Rollback($p_cn);exit("error __FILE__ __LINE__");}
1688    
1689    // Set Internal code and Comment    // Set Internal code and Comment
1690    $comment=SetInternalCode($p_cn,$seq,$p_jrn);    $internal_code=SetInternalCode($p_cn,$seq,$p_jrn);
1691    if ( $e_comment=="" ) {    if ( $e_comment=="" ) {
1692      // Update comment if comment is blank      // Update comment if comment is blank
1693      $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq);      $Res=ExecSql($p_cn,"update jrn set jr_comment='".$internal_code."' where jr_grpt_id=".$seq);
1694    }    }
1695    if ( isset ($_FILES))    if ( isset ($_FILES))
1696      save_upload_document($p_cn,$seq);      save_upload_document($p_cn,$seq);
1697    
1698    Commit($p_cn);    Commit($p_cn);
1699    return $comment;    return $internal_code;
1700  }  }
   

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

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