given by the

"; $i=1; // include javascript for popup echo JS_SEARCH_CARD; while($val = pg_fetch_array($Res)){ $w=new widget('js_search_only'); $w->name='poste'.$i; $w->extra='cred'; $w->extra2=$val['jrn']; $w->label=''; $w->table=0; $s=new widget('span'); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; //echo ''; echo ''; echo ""; echo ''; echo '
'.$val['code'].''.$val['date_exec'].''.$val['montant'].' EUR
'.$val['detail'].'
Poste Comptable :
'.$w->IOValue().' '.$s->IOValue('poste'.$i.'_label').'n° compte : ".$val['num_compte']."
'; echo '
'; $i++; } } /*!\brief Transfert data into the ledger * \param $p_cn connx * \param $periode periode */ function TransferCSV($p_cn, $periode){ //on obtient la période courante $User=new cl_user($p_cn); $periode = $User->GetPeriode(); // on trouve les dates frontières de cette période $sql = "select to_char(p_start,'DD-MM-YYYY') as p_start,to_char(p_end,'DD-MM-YYYY') as p_end". " from parm_periode where p_id = '".$periode."'"; $Res=ExecSql($p_cn,$sql); $val = pg_fetch_array($Res); if ( $val == false ) { echo ""; exit(); } $start ="to_date('".$val['p_start']."','DD-MM-YYYY')"; $end = "to_date('".$val['p_end']."','DD-MM-YYYY')"; // var_dump($val); $sql = "select code,to_char(date_exec,'DD.MM.YYYY') as date_exec, ". " montant,num_compte,poste_comptable,bq_account,jrn,detail ". " from import_tmp where poste_comptable is not null and poste_comptable <> '' and ok <> TRUE AND date_exec BETWEEN ".$start." and ".$end; $Res=ExecSql($p_cn,$sql); //echo "boucle: ".sizeof($Res)."
"; //while($val = pg_fetch_array($Res)){ $Max=pg_NumRows($Res); echo $Max." opérations à transférer.
"; for ($i = 0;$i < $Max;$i++) { $val=pg_fetch_array($Res,$i); $code=$val['code']; $date_exec=$val['date_exec']; $montant=$val['montant']; $num_compte=$val['num_compte']; $poste_comptable=$val['poste_comptable'];$bq_account=$val['bq_account']; $jrn=$val['jrn']; // Retrieve the account thx the quick code $f=new fiche($p_cn); $f->GetByQCode($poste_comptable,false); $poste_comptable=$f->strAttribut(ATTR_DEF_ACCOUNT); StartSql($p_cn); // Vérification que le poste comptable trouvé existe if ( $poste_comptable == '- ERROR -') $test=0; else { $sqltest = "select * from tmp_pcmn WHERE pcm_val='".$poste_comptable."'"; $Restest=ExecSql($p_cn,$sqltest); $test=pg_NumRows($Restest); } // Test it if($test == 0) { $sqlupdate = "update import_tmp set poste_comptable='' WHERE code='".$code."' AND num_compte='".$num_compte."'"; $Resupdate=ExecSql($p_cn,$sqlupdate); echo "Poste comptable erronné pour l'opération ".$num_compte."-".$code.", réinitialisation du poste comptable
"; continue; } // Finances $seq=NextSequence($p_cn,'s_grpt'); $p_user = $_SESSION['g_user']; $r=InsertJrnx($p_cn,"d",$p_user,$jrn,$bq_account,$date_exec,$montant,$seq,$periode); if ( $r == false) { $Rollback($p_cn);exit("error 'import_inc.php' __LINE__");} $r=InsertJrnx($p_cn,"c",$p_user,$jrn,$poste_comptable,$date_exec,$montant,$seq,$periode); if ( $r == false) { $Rollback($p_cn);exit("error 'import_inc.php' __LINE__");} //remove annoying double-quote $num_compte=str_replace('"','',$num_compte); $code=str_replace('\"','',$code); if ( strlen(trim($num_compte)) == 0 ) $num_compte=$val['detail']; $r=InsertJrn($p_cn,$date_exec,NULL,$jrn,$num_compte." ".$code,$montant,$seq,$periode); if ( $r == false ) { Rollback($p_cn); exit(" Error 'import_inc.php' __LINE__");} SetInternalCode($p_cn,$seq,$jrn); echo "Tranfer de l'opération ".$code." effectué
"; $sql2 = "update import_tmp set ok=TRUE where code='".$code."'"; $Res2=ExecSql($p_cn,$sql2); } Commit($p_cn); } /*! ************************************************** * \brief ShowForm for getting data about * the bank transfert in cvs * * \param : database connection * - * \return none */ function ShowFormTransfert($p_cn){ $w=new widget("select"); echo '
'; echo '
'; // ask for the journal target $jrn=make_array ($p_cn,"select jrn_def_id,jrn_def_name from jrn_def where jrn_def_type='FIN';"); $w->label='Journal'; echo $w->label." :".$w->IOValue('import_jrn',$jrn)."
"; // choose the bank account $bq=make_array($p_cn,"select pcm_val,pcm_lib from tmp_pcmn where pcm_val like '550%'"); $w->label='Banque'; echo "Compte en banque :".$w->IOValue('import_bq',$bq)."
"; $format_csv=make_array($p_cn,"select include_file,name from format_csv_banque;"); $w->label="Format import"; echo $w->label.$w->IOValue('format_csv',$format_csv).'
'; echo ''; echo '
'; } ?>