change pg_exec by pg_query

This commit is contained in:
sparkyx 2005-03-06 16:00:28 +00:00
parent 85566efb42
commit a452cf8287
4 changed files with 9 additions and 42 deletions

View file

@ -397,6 +397,13 @@ function FormVente($p_cn,$p_jrn,$p_user,$p_array=null,$view_only=true,$p_article
$r.="</TABLE>";
$r.="<hr>";
$r.="<table>";
$file=new widget("file");
$file->table=1;
$r.="<TR>".$file->IOValue("pj",null,"Pièce justificative")."</TR>";
$r.="</table>";
$r.="<hr>";
if ($view_only == false ) {
$r.='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">';
$r.='<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
@ -404,45 +411,6 @@ function FormVente($p_cn,$p_jrn,$p_user,$p_array=null,$view_only=true,$p_article
$r.="</FORM>";
$r.=JS_CALC_LINE;
} else {
// // show summary
// $total=0;
// $r.='<h2 class="info">Total</h2>';
// $r.="<table>";
// $r.="<th> Description</th>";
// $r.="<th> Base TVA </th>";
// $r.="<th> Tva </th>";
// $r.="<th> Total </th>";
// for ( $i = 0; $i < $p_article;$i++) {
// if ( $view_only == true and ! isset (${"e_march$i"}) ) continue;
// $march=${"e_march$i"};
// if ( isNumber($march) ==1 and
// isFicheOfJrn($p_cn,$p_jrn,$march,'cred')){
// $a_fiche=GetFicheAttribut($p_cn, $march);
// // compute some data
// // $tva=(isNumber($a_fiche['tva_rate']) == 0 )?0:$a_fiche['tva_rate'];
// if ( isNumber(${"e_march$i"."_tva_id"}) ==1 ) {
// $a_tva=GetTvaRate($p_cn,${"e_march$i"."_tva_id"});
// $tva=$a_tva['tva_rate'];
// } else {
// $tva=(isNumber($a_fiche['tva_rate'])==1)?$a_fiche['tva_rate']:0;
// }
// $vat_row=${"e_march$i"."_sell"}*${"e_quant$i"}*$tva;
// $total_row_no_vat=${"e_march$i"."_sell"}*${"e_quant$i"};
// $total_row=${"e_march$i"."_sell"}*${"e_quant$i"}+$vat_row;
// $r.="<TR>";
// $r.="<TD>".$a_fiche['vw_name']."</td>";
// // $r.="<TD>".$a_fiche['tva_label']."</td>";
// $r.="<TD> ".round($total_row_no_vat,2)."</TD>";
// $r.="<TD> ".$vat_row."</TD>";
// $r.="<TD> ".round($total_row,2)."</TD>";
// $r.="</TR>";
// $total+=$total_row;
// }
// }// for ($i=0
// $r.="</table>";
// $r.=sprintf(" Total = %8.2f",$total);
$r.="</div>";
}

View file

@ -99,7 +99,7 @@ function DbConnect($p_db=-1,$p_type='dossier') {
function ExecSql($p_connection, $p_string) {
echo_debug(__FILE__,__LINE__,"SQL = $p_string");
$ret=pg_exec($p_connection,$p_string);
$ret=pg_query($p_connection,$p_string);
if ( $ret == false ) {
echo_error ("SQL ERROR ::: $p_string");
exit(" Operation cancelled due to error : $p_string");

View file

@ -24,7 +24,6 @@ include_once("class_widget.php");
$cn=DbConnect($_SESSION['g_dossier']);
// default action is insert_vente
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
// echo u_ShowMenuJrn($cn,$jrn_type);
exit;
} else {
$action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];

View file

@ -37,7 +37,7 @@ include_once("postgres.php");
function GetTvaRate($p_cn,$p_tva_id) {
if (strlen(trim($p_tva_id))==0) return 0;
$Res=pg_exec($p_cn,"select tva_id,tva_rate,tva_label from tva_rate where tva_id=".$p_tva_id);
$Res=ExecSql($p_cn,"select tva_id,tva_rate,tva_label from tva_rate where tva_id=".$p_tva_id);
if (pg_NumRows($Res) == 0 ) return null;
$r=pg_fetch_array($Res,0);