Fix last bugs

This commit is contained in:
sparkyx 2008-01-22 16:12:24 +00:00
parent 3bb1fad3fe
commit b87e928a2e
24 changed files with 147 additions and 79 deletions

View file

@ -46,14 +46,15 @@ if ( $do == 'po') {
}
/* 2nd Synthese */
if ( $do == 'ga') {
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="bud_groupe.csv"',FALSE);
require_once ('class_bud_synthese_hypo.php');
$obj=new Bud_Synthese_Hypo($cn);
$obj->from_array($_GET);
$res=$obj->load();
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="bud_groupe.csv"',FALSE);
echo $obj->display_csv($res);
}

View file

@ -57,9 +57,9 @@ if ( isset($_GET['search']) ) {
if ( isset($p_comment) && strlen(trim($p_comment)) != 0 ) {
$condition=" where (upper(pcm_lib) like upper('%$p_comment%') or ".
" pcm_val::text like '$p_comment%') ".
" and (pcm_val::text like '7%' or pcm_val::text like '6%' or pcm_val::text like '5%') ";
" and (pcm_val::text like '7%' or pcm_val::text like '6%') ";
} else {
$condition="where pcm_val::text like '7%' or pcm_val::text like '6%' or pcm_val::text like '5%' ";
$condition="where pcm_val::text like '7%' or pcm_val::text like '6%' ";
}
}

View file

@ -52,6 +52,18 @@ function SearchJrn(p_sessid,p_dossier,p_ctl,p_montant,p_paid)
}
}
}
if ( p_montant == 0 && document.forms[1]) {
for ( i=0; i < document.forms[1].length; i++)
{
var e=document.forms[1].elements[i];
if ( e.name == ctl_montant_name ) {
p_montant=e.value;
break;
}
}
}
}

View file

@ -38,11 +38,11 @@ $User=new User($cn);
$User->Check();
if ( isset ( $_POST['poste_fille']) )
{ //choisit de voir tous les postes
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val like '".$_POST["poste_id"]."%'");
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val like '".$_POST["poste_id"]."%'");
}
else
{
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val = '".$_POST['poste_id']."'");
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val = '".$_POST['poste_id']."'");
}
if ( count($a_poste) == 0 )
exit;

View file

@ -38,9 +38,9 @@ foreach ($_POST as $key=>$element) {
${"$key"}=$element;
}
if ( isset ( $poste_fille) ){ //choisit de voir tous les postes
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val like '$poste_id%'");
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val like '$poste_id%'");
} else
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val = '$poste_id'");
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val = '$poste_id'");
$ret="";

View file

@ -35,43 +35,6 @@ $User->can_request($cn,BALANCE);
echo '<div class="u_content">';
//-----------------------------------------------------
// Form
//-----------------------------------------------------
// Show the export button
if ( isset ($_POST['view'] ) ) {
$submit=new widget();
$hid=new widget("hidden");
echo "<table>";
echo '<TR>';
echo '<TD><form method="POST" ACTION="print_balance.php">'.
dossier::hidden().
widget::submit('bt_pdf',"Export PDF").
$hid->IOValue("p_action","impress").
$hid->IOValue("from_periode",$_POST['from_periode']).
$hid->IOValue("to_periode",$_POST['to_periode']).
$hid->IOValue("p_jrn",$_POST['p_jrn']).
$hid->IOValue("from_poste",$_POST['from_poste']).
$hid->IOValue("to_poste",$_POST['to_poste']);
echo "</form></TD>";
echo '<TD><form method="POST" ACTION="bal_csv.php">'.
widget::submit('bt_csv',"Export CSV").
dossier::hidden().
$hid->IOValue("p_action","impress").
$hid->IOValue("from_periode",$_POST['from_periode']).
$hid->IOValue("to_periode",$_POST['to_periode']).
$hid->IOValue("p_jrn",$_POST['p_jrn']).
$hid->IOValue("from_poste",$_POST['from_poste']).
$hid->IOValue("to_poste",$_POST['to_poste']);
echo "</form></TD>";
echo "</TR>";
echo "</table>";
}
// Show the form for period
echo '<FORM action="?p_action=impress&type=bal" method="post">';
echo dossier::hidden();
@ -123,7 +86,45 @@ echo "</div>";
//$a=FormPeriodeMult($cn);
//echo $a;
echo '<input type="submit" name="view" value="ok">';
echo '<input type="submit" name="view" value="Impression">';
echo '</form>';
//-----------------------------------------------------
// Form
//-----------------------------------------------------
// Show the export button
if ( isset ($_POST['view'] ) ) {
$submit=new widget();
$hid=new widget("hidden");
echo "<table>";
echo '<TR>';
echo '<TD><form method="POST" ACTION="print_balance.php">'.
dossier::hidden().
widget::submit('bt_pdf',"Export PDF").
$hid->IOValue("p_action","impress").
$hid->IOValue("from_periode",$_POST['from_periode']).
$hid->IOValue("to_periode",$_POST['to_periode']).
$hid->IOValue("p_jrn",$_POST['p_jrn']).
$hid->IOValue("from_poste",$_POST['from_poste']).
$hid->IOValue("to_poste",$_POST['to_poste']);
echo "</form></TD>";
echo '<TD><form method="POST" ACTION="bal_csv.php">'.
widget::submit('bt_csv',"Export CSV").
dossier::hidden().
$hid->IOValue("p_action","impress").
$hid->IOValue("from_periode",$_POST['from_periode']).
$hid->IOValue("to_periode",$_POST['to_periode']).
$hid->IOValue("p_jrn",$_POST['p_jrn']).
$hid->IOValue("from_poste",$_POST['from_poste']).
$hid->IOValue("to_poste",$_POST['to_poste']);
echo "</form></TD>";
echo "</TR>";
echo "</table>";
}
//-----------------------------------------------------

View file

@ -104,7 +104,7 @@ if ( $po_id !== -1 ) {
echo "Poste Analytique ".$wPo_id->IOValue();
}
echo $button_other;
//echo http://localhost/phpcompta-dev/phpcompta/html/budget.php?gDossier=21&bh_id=3&recherche=recherche&p_action=detail//
if ( isset ($_GET['po_id'] ) )
$str_po_id="&po_id=".$_REQUEST['po_id'];
else

View file

@ -44,6 +44,8 @@ if ( isset($_GET['display'])) {
$obj->from_array($_GET);
$res=$obj->load();
echo $obj->display_html($res);
echo '<h2 class="info">Resume</h2>';
echo $obj->summary_html($res);
echo '<form method="GET" action="bud_csv.php">';
echo $obj->hidden();
echo widget::hidden('do','ga');

View file

@ -38,8 +38,9 @@ $menu=array(array("?p_action=ca_imp&sub=listing&$str_dossier","Listing","Listing
array("?p_action=ca_imp&sub=bc2&$str_dossier","Balance crois&eacute;","Balance crois&eacute; de 2 plans analytiques","bc2")
);
$sub=(isset($_GET['sub']))?$_GET['sub']:'no';
echo '<div class="u_content">';
echo ShowItem($menu,"H","mtitle","mtitle",$sub);
echo '</div>';
$hidden=new widget("hidden");
$str_hidden=$hidden->IOValue("p_action","ca_imp");
$str_hidden.=$hidden->IOValue("sub",$sub);

View file

@ -36,15 +36,14 @@ require_once ("class_anc_group_operation.php");
$pa=new Anc_Plan($cn);
$m=$pa->get_list();
if ( ! $m ) { echo '<h2 class="info"> Aucun plan analytique d&eacute;fini</h2>';exit();}
echo '<div class="u_subt2menu">';
echo '<table>';
echo '<tr>';
echo '</div>';
//----------------------------------------------------------------------
// show the left menu
//----------------------------------------------------------------------
echo '
<div class="u_content">
<div class="lmenu">
<table>
<tr>
@ -56,7 +55,10 @@ echo '
</td>
</tr>
</table>
</div>';
</div>
</div>
';
//----------------------------------------------------------------------
// the pa_id is set
//
@ -93,8 +95,9 @@ echo '
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1);
$User=new User($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->get_periode();
$w->value=$periode_start;
$w->selected=$current;
echo $w->IOValue();
echo 'P&eacute;riode '.widget::submit('gl_submit','Valider').'</form>';
echo '<div class="u_redcontent">';

View file

@ -207,7 +207,8 @@ class Acc_Ledger {
c_grp as grp,
c_comment||' ('||c_internal||' '||jr_opid||')' as comment,
c_rapt as oc,
c_periode as periode
j_qcode,
c_periode as periode
from centralized left join jrn on ".
"jr_grpt_id=c_grp left join tmp_pcmn ".
" on (pcm_val=c_poste) ".
@ -488,7 +489,7 @@ class Acc_Ledger {
echo_debug('class_acc_ledger',__LINE__,$code['j_qcode'].'est F ou C');
$p_array['TVAC']=$code['j_montant'];
$p_array['client']=($trunc==0)?$fiche->get_name():substr($fiche->get_name(),0,20);
$p_array['client']=($trunc==0)?$fiche->getName():substr($fiche->getName(),0,20);
$p_array['reversed']=false;
if ( $fiche_def_id == FICHE_TYPE_CLIENT && $code['j_debit']=='f')
{
@ -511,7 +512,7 @@ class Acc_Ledger {
echo_debug('class_acc_ledger',__LINE__,$code['j_qcode']."n 'est PAS F ou C");
$p_array['TVAC']=$code['j_montant'];
$p_array['client']= ($trunc==0)?$fiche->get_name():substr($fiche->get_name(),0,20);
$p_array['client']= ($trunc==0)?$fiche->getName():substr($fiche->getName(),0,20);
$p_array['reversed']=false;
if ($p_jrn_type == 'ACH' && $code['j_debit']=='t')
{

View file

@ -171,7 +171,7 @@ class Anc_Group_Operation
{
$idx=$d['id'];
$p=new Anc_Operation($this->db);
$p->oa_amount=$_array["pamount$i"];
$p->oa_amount=$p_array["pamount$i"];
$p->oa_description=$p_array["pdesc"];
$p->oa_date=$_POST['pdate'];

View file

@ -98,7 +98,7 @@ class Bud_Card {
);
try {
ExecSqlParam($this->db,$sql,$array);
print_r(DEBUG);
}catch (Exception $e) {
if ( DEBUG == 'true' ) print_r($e);
return '<span class="notice">Impossible de sauver</span>';

View file

@ -134,6 +134,7 @@ class Bud_Data {
$p_id=$r['p_id'];
$ret->amount[$p_id]=0;
}
return $ret;
}
/*!\brief convert the array loaded from the database into data member
@ -277,7 +278,7 @@ class Bud_Data {
if ( ! isset ($this->header ) ){
$r='<table style="border: 2px outset blue; width: 100%;">';
$r.="<tr>";
$periode=get_array($this->cn,"select to_char(p_start,'MM/YY')as d from parm_periode ");
$periode=get_array($this->cn,"select to_char(p_start,'MM/YY')as d from parm_periode order by p_start,p_end ");
foreach ($periode as $row)
$r.='<th >'.$row['d'].'</th>';

View file

@ -157,6 +157,7 @@ class Bud_Synthese_Anc extends Bud_Synthese {
" join parm_periode using (p_id) ".
" where bc_id=$1 and $per and pcm_val=$2 group by p_id,p_start order by p_start");
if ( empty( $aBudCard) ) return array();
// foreach card get the detail per pcm_val and periode
foreach ($aBudCard as $rBudCard) {
$line=array();

View file

@ -195,10 +195,10 @@ Array
$group_id=$rGroup['ga_id'];
$sub[$group_id]=(isset($sub[$group_id]))?$sub[$group_id]:0;
$sub[$group_id]+=$row[$group_id];
print_r("$key pcm_val :".$pcm_val."gr.".$group_id." ".$row[$group_id]."sub ".$sub[$group_id]);
// print_r("$key pcm_val :".$pcm_val."gr.".$group_id." ".$row[$group_id]."sub ".$sub[$group_id]);
$sub['total']=(isset($sub['total']))?$sub['total']:0;
$sub['total']+=$row[$group_id];
print_r('sub_total = '.$sub['total'].'<br>');
//print_r('sub_total = '.$sub['total'].'<br>');
}
if (isset( $array[$pcm_val])) {
$new_array=array();
@ -329,7 +329,48 @@ Array
$r.=widget::hidden($e,$this->$e);
return $r;
}
/*!\brief the same as summary but show it in html */
function summary_html($p_array) {
if ( empty ($p_array))return '';
$summary_array=$this->summary($p_array);
arsort($summary_array);
$aGroup=get_array($this->cn,"select distinct ga_id from bud_detail join poste_analytique ".
" using (po_id) where bh_id=".$this->bh_id." order by ga_id ");
$per_acc=sql_filter_per($this->cn,$this->from,$this->to,'p_id','j_tech_per');
$heading='<tr>';
$heading.='<th>CE </th>';
foreach ($aGroup as $rGroup )
$heading.='<th>'.$rGroup['ga_id'].'</td>';
$heading.='<th>Total Ligne</th><th>Result. CE</th>';
$heading.='</tr>';
$r='<table>';
$r.=$heading;
foreach ($summary_array as $key=>$aRow) {
$amount_row=0;
$r.="<tr><td>";
$acc_account=new Acc_Account_Ledger($this->cn,$key);
$acc_account->load();
$r.=$key." - ".$acc_account->label.'</td>';
foreach ($aGroup as $gr) {
$idx=$gr['ga_id'];
$r.='<td>'.$aRow[$idx].'</td>';
$amount_row+=$aRow[$idx];
}
$r.="<td>".$amount_row.'</td>';
$acc_account->id=$acc_account->id."%";
$r.="<td>".$acc_account->get_solde($per_acc).'</td>';
$r.="</tr>";
}
$r.="</table>";
return $r;
}
static function test_me() {
$cn=DbConnect(dossier::id());
$obj=new Bud_Synthese_Hypo($cn);

View file

@ -626,7 +626,7 @@ class fiche {
if ( $exercice == 0 ) throw Exception ('Annee invalide erreur');
$str_stock=sprintf('insert into stock_goods(f_id,sg_comment,sg_code,sg_type,sg_exercice) '.
' values (%d,upper(\'%s\'),\'d\',\'%s\')',
' values (%d,upper(\'%s\'),upper(\'%s\'),\'d\',%s)',
$this->id,
'initial',
FormatString($value),
@ -729,7 +729,7 @@ class fiche {
// if the card is used do not removed it
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
if ( CountSql($this->cn,"select * from jrnx where j_qcode='$qcode'") != 0)
if ( CountSql($this->cn,"select * from jrnx where j_qcode='".pg_escape_string($qcode)."'") != 0)
{
echo "<SCRIPT> alert('Impossible cette fiche est utilisée dans un journal'); </SCRIPT>";
return;

View file

@ -32,7 +32,7 @@ define ("phpcompta_psql_port","5432");
define ("phpcompta_user","phpcompta");
//
// the domain can't start by a number !!!
define ("domaine","");
define ("domaine","beta31");
define ("MAX_COMPTE",4);
define ('MAX_BUD_DETAIL',20);

View file

@ -43,6 +43,7 @@ $span=new widget("span");
$w=new widget("js_search_poste");
$w->table=1;
$w->value=(isset($_REQUEST['poste_id']))?$_REQUEST['poste_id']:"";
$w->label="Choississez le poste";
print $w->IOValue("poste_id");
echo $span->IOValue('poste_id_label');
@ -50,6 +51,7 @@ $w_poste=new widget("js_search_only");
$w_poste->table=1;
$w_poste->label="Ou Choississez la fiche";
$w_poste->extra='all';
$w_poste->value=(isset($_REQUEST['f_id']))?$_REQUEST['f_id']:"";
print $w_poste->IOValue("f_id");
echo $span->IOValue('f_id_label');
print '</TR>';
@ -60,9 +62,11 @@ $select->table=1;
$filter_year=" where p_exercice='".$User->get_exercice()."'";
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$select->label="Depuis";
$select->selected=(isset($_REQUEST['from_periode']))?$_REQUEST['from_periode']:"";
print $select->IOValue('from_periode',$periode_start);
$select->label=" jusqu'à ";
$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$select->selected=(isset($_REQUEST['to_periode']))?$_REQUEST['to_periode']:"";
print $select->IOValue('to_periode',$periode_end);
print "</TR>";
print "<TR><TD>";
@ -90,7 +94,7 @@ if ( isset( $_POST['bt_html'] ) ) {
if ( isset ($_POST['poste_fille']) )
{
$parent=$_POST['poste_id'];
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val like '$parent%'");
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val like '$parent%' order by pcm_val::text");
$go=3;
}
// Check if the post is numeric and exists

View file

@ -166,7 +166,7 @@ function ExecSqlParam($p_connection, $p_string,$p_array) {
$r=$p_string."array ".var_export($p_array,TRUE);
throw new Exception (" SQL ERROR $r",1);
}
ob_flush();
ob_end_clean();
return $ret;
}

View file

@ -76,7 +76,7 @@ if ( $sub_action == "" )
if ( $sub_action=="blank")
{
$retour=sprintf('<A class="mtitle" HREF="%s"><input type="button" value="Retour"></A>',
"commercial.php?p_action=fournisseur");
"commercial.php?p_action=fournisseur&".dossier::get());
echo '<div class="u_content">';
echo $retour;

View file

@ -69,7 +69,7 @@ if ( $action=="use_opd" ) {
echo $hid->IOValue("jrn_type","ACH");
if ($op->count() != 0 )
echo widget::submit('use_opd','Utilisez une op.prédéfinie');
echo widget::submit('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
@ -118,7 +118,7 @@ if ( $action == 'new' ) {
echo $hid->IOValue("jrn_type","ACH");
if ($op->count() != 0 )
echo widget::submit('use_opd','Utilisez une op.prédéfinie');
echo widget::submit('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '</form>';
@ -202,7 +202,7 @@ if ( $action == 'new' ) {
list($internal,$comment)=RecordSell($cn,$_POST,$User,$_GET['p_jrn']);
// submit button in the form
$submit='<h2 class="info">Opération '.$internal.' </h2>';
$submit='<h2 class="info">Opération '.$internal.' </h2>';
$r=FormAchView($cn,$_GET['p_jrn'],$User->get_periode(),$_POST,"",$nb_number,false);
echo '<div class="u_redcontent">';
echo $submit;
@ -319,7 +319,7 @@ echo 'P&eacute;riode '.$w->IOValue("p_periode",$periode_start).widget::submit('
echo "$bar <hr>";
$hid=new widget();
if ( $max_ligne != 0 )
echo widget::submit('paid','Mise à jour paiement');
echo widget::submit('paid','Mise à jour paiement');
echo '</form>';
echo '</div>';
}
@ -374,20 +374,20 @@ if ( $action == 'voir_jrn_non_paye' ) {
$bar2=jrn_navigation_bar($offset,$m,$step,$page);
echo '<div class="u_redcontent">';
echo '<h2 class="info"> Echeance dépassée </h2>';
echo '<h2 class="info"> Echeance dépassée </h2>';
echo '<FORM METHOD="POST">';
echo dossier::hidden();
echo $bar2;
echo $list;
echo '<h2 class="info"> Non Payée </h2>';
echo '<h2 class="info"> Non Payée </h2>';
echo $list2;
echo $bar2;
$hid=new widget();
echo '<hr>';
if ( $m != 0 )
echo widget::submit('paid','Mise à jour paiement');
echo widget::submit('paid','Mise à jour paiement');
echo '</form>';
echo '</div>';

View file

@ -303,7 +303,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number)
{
echo_error("Invalid date $e_date");
echo_debug('user_form_ach.php',__LINE__,"Invalid date $e_date");
echo "<SCRIPT> alert('INVALID DATE $e_date !!!!');</SCRIPT>";
echo "<SCRIPT> alert(' DATE INVALIDE $e_date !!!!');</SCRIPT>";
return null;
}
$tot=0;
@ -314,7 +314,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number)
{
echo_debug('user_form_ach.php',__LINE__,"invalid quantity ".${"e_quant$o"});
echo_error("invalid quantity ".${"e_quant$o"});
echo "<SCRIPT> alert('INVALID QUANTITY !!!');</SCRIPT>";
echo "<SCRIPT> alert('Quantite invalide !!!');</SCRIPT>";
return null;
}
// check if vat is correct

View file

@ -311,7 +311,7 @@ $r.="</TABLE>";
$r.="</table>";
$r.="<hr>";
$chk=new widget('checkbox');
$chk->selected=true;
$chk->selected=false;
$r.="Sauvez l'op&eacute;ration ?";
$r.=$chk->IOValue('opd_save');