rem: operation -> date ) > 0 )
add: operation -> date ) < 0 )
context: void affichage_etat ( struct struct_etat *etat, 		      struct struct_etat_affichage * affichage ){  GSList *liste_opes_selectionnees;  gint i;  gint no_exercice_recherche;  struct struct_devise *devise_montant;  struct struct_devise *devise_operation;  if ( !etat )    {      if ( etat_courant )	etat = etat_courant;      else	return;    }  if ( !affichage )    {      affichage = &gtktable_affichage;    }  /* si on utilise l'exercice courant ou prcdent, on cherche ici */  /* le numro de l'exercice correspondant */  no_exercice_recherche = 0;  if ( etat -> exo_date )    {      GSList *liste_tmp;      GDate *date_jour;      struct struct_exercice *exo;      struct struct_exercice *exo_courant;      struct struct_exercice *exo_precedent;      liste_tmp = liste_struct_exercices;      date_jour = g_date_new ();      g_date_set_time ( date_jour,			time ( NULL ));      exo_courant = NULL;      exo_precedent = NULL;      switch ( etat -> utilise_detail_exo )	{	case 1:	  /* on recherche l'exo courant */	  while ( liste_tmp )	    {	      exo = liste_tmp -> data;	      if ( g_date_compare ( date_jour,				    exo -> date_debut ) >= 0		   &&		   g_date_compare ( date_jour,				    exo -> date_fin ) <= 0 )		{		  no_exercice_recherche = exo -> no_exercice;		  liste_tmp = NULL;		}	      else		liste_tmp = liste_tmp -> next;	    }	  break;	case 2:	  /* on recherche l'exo prcdent */	  while ( liste_tmp )	    {	      struct struct_exercice *exo;	      exo = liste_tmp -> data;	      if ( exo_courant )		{		  /* exo_courant est forcemment aprs exo_precedent */		  /* si l'exo en court est aprs exo_courant, on met exo_courant */		  /* dans exo_precedent, et l'exo en court dans exo_courant */		  /*   sinon, on compare avec exo_precedent */		  if ( g_date_compare ( exo -> date_debut,					exo_courant -> date_fin ) >= 0 )		    {		      exo_precedent = exo_courant;		      exo_courant = exo;		    }		  else		    {		      /* l'exo en cours est avant exo_courant, on le compare  exo_precedent */		      if ( !exo_precedent			   ||			   g_date_compare ( exo -> date_debut,					    exo_precedent -> date_fin ) >= 0 )			exo_precedent = exo;		    }		}	      else		exo_courant = exo;	      liste_tmp = liste_tmp -> next;	    }	  if ( exo_precedent )	    no_exercice_recherche = exo_precedent -> no_exercice;	  break;	default:	}    }  /* on rcupre la devise des monants pour les tests de montants */  devise_montant = g_slist_find_custom ( liste_struct_devises,					GINT_TO_POINTER ( etat_courant -> choix_devise_montant ),					( GCompareFunc ) recherche_devise_par_no) -> data;  devise_operation = NULL;  /*   selection des oprations */  /* on va mettre l'adresse des ops slectionnes dans une liste */  liste_opes_selectionnees = NULL;  p_tab_nom_de_compte_variable = p_tab_nom_de_compte;  for ( i=0 ; i<nb_comptes ; i++ )    {      /* on commence par vrifier que le compte fait partie de l'tat */      if ( !etat -> utilise_detail_comptes	   ||	   g_slist_index ( etat -> no_comptes,			   GINT_TO_POINTER ( i )) != -1 )	{	  /* 	  le compte est bon, passe  la suite de la slection */	  /* on va faire le tour de toutes les ops du compte */	  GSList *pointeur_tmp;	  pointeur_tmp = LISTE_OPERATIONS;	  while ( pointeur_tmp )	    {	      struct structure_operation *operation;	      operation = pointeur_tmp -> data;	      /* si c'est une op ventile, dpend de la conf */	      if ( operation -> operation_ventilee		   &&		   !etat -> pas_detailler_ventilation )		goto operation_refusee;	      if ( operation -> no_operation_ventilee_associee		   &&		   etat -> pas_detailler_ventilation )		goto operation_refusee;	      /* on vrifie ensuite si un texte est recherch */	      if ( etat -> texte		   &&		   (		    !operation -> notes		    ||		    !g_strcasecmp ( operation -> notes,				    etat -> texte )))		goto operation_refusee;	      /* 	  on va vrifier les montant est demand */	      /* 	      si les montants nuls sont exclus, c'est ici */	      if ( etat -> choix_montant_nul == 1		   &&		   fabs (operation -> montant ) < 0.01 )		goto operation_refusee;	      /* vrifie le positif/ng */	      if ( etat -> utilise_montant_neg_pos		   &&		   ( (( etat -> type_neg_pos			 &&			 operation -> montant < 0 )		       ||		       ( etat -> type_neg_pos			 &&			 fabs (operation -> montant) < 0.01			 &&			 etat -> choix_montant_nul == 2 ))		     ||		     (( !etat -> type_neg_pos			&&			operation -> montant > 0 )		      ||		      ( !etat -> type_neg_pos			&&			fabs (operation -> montant) < 0.01			&&			etat -> choix_montant_nul == 3 ))))		goto operation_refusee;	      /* vrifie la valeur du montant */	      if ( etat -> utilise_valeur )		{		  switch ( etat -> type_operateur_valeur )		    {		    case 0 :		      /* = */		      if ( fabs ( operation -> montant - etat -> montant_valeur ) > 0.01 )			goto operation_refusee;		      break;		    case 1 :		      /* < */		      if ( operation -> devise == devise_montant -> no_devise )			{			  if ( operation -> montant >= etat -> montant_valeur )			    goto operation_refusee;			}		      else			{			  gfloat montant;			  if ( !devise_operation			       ||			       operation -> devise != devise_operation -> no_devise )			    devise_operation = g_slist_find_custom ( liste_struct_devises,								     GINT_TO_POINTER ( operation -> devise ),								     ( GCompareFunc ) recherche_devise_par_no ) -> data;			  if ( devise_montant -> passage_euro			       &&			       !strcmp ( devise_operation -> nom_devise, _("Euro") ) )			    montant = operation -> montant * devise_montant -> change;			  else			    if ( devise_operation -> passage_euro				 &&				 !strcmp ( devise_montant -> nom_devise, _("Euro") ))			      montant = operation -> montant / devise_operation -> change;			    else			      if ( operation -> une_devise_compte_egale_x_devise_ope )				montant = operation -> montant / operation -> taux_change - operation -> frais_change;			      else				montant = operation -> montant * operation -> taux_change - operation -> frais_change;			  montant = ( rint (montant * 100 )) / 100;			  if ( montant >= etat -> montant_valeur )			    goto operation_refusee;			}		      break;		    case 2 :		      /* <= */		      if ( operation -> devise == devise_montant -> no_devise )			{			  if ( operation -> montant > etat -> montant_valeur )			    goto operation_refusee;			}		      else			{			  gfloat montant;			  if ( !devise_operation			       ||			       operation -> devise != devise_operation -> no_devise )			    devise_operation = g_slist_find_custom ( liste_struct_devises,								     GINT_TO_POINTER ( operation -> devise ),								     ( GCompareFunc ) recherche_devise_par_no ) -> data;			  if ( devise_montant -> passage_euro			       &&			       !strcmp ( devise_operation -> nom_devise, _("Euro") ) )			    montant = operation -> montant * devise_montant -> change;			  else			    if ( devise_operation -> passage_euro				 &&				 !strcmp ( devise_montant -> nom_devise, _("Euro") ))			      montant = operation -> montant / devise_operation -> change;			    else			      if ( operation -> une_devise_compte_egale_x_devise_ope )				montant = operation -> montant / operation -> taux_change - operation -> frais_change;			      else				montant = operation -> montant * operation -> taux_change - operation -> frais_change;			  montant = ( rint (montant * 100 )) / 100;			  if ( montant > etat -> montant_valeur )			    goto operation_refusee;			}		      break;		    case 3 :		      /* > */		      if ( operation -> devise == devise_montant -> no_devise )			{			  if ( operation -> montant <= etat -> montant_valeur )			    goto operation_refusee;			}		      else			{			  gfloat montant;			  if ( !devise_operation			       ||			       operation -> devise != devise_operation -> no_devise )			    devise_operation = g_slist_find_custom ( liste_struct_devises,								     GINT_TO_POINTER ( operation -> devise ),								     ( GCompareFunc ) recherche_devise_par_no ) -> data;			  if ( devise_montant -> passage_euro			       &&			       !strcmp ( devise_operation -> nom_devise, _("Euro") ) )			    montant = operation -> montant * devise_montant -> change;			  else			    if ( devise_operation -> passage_euro				 &&				 !strcmp ( devise_montant -> nom_devise, _("Euro") ))			      montant = operation -> montant / devise_operation -> change;			    else			      if ( operation -> une_devise_compte_egale_x_devise_ope )				montant = operation -> montant / operation -> taux_change - operation -> frais_change;			      else				montant = operation -> montant * operation -> taux_change - operation -> frais_change;			  montant = ( rint (montant * 100 )) / 100;			  if ( montant <= etat -> montant_valeur )			    goto operation_refusee;			}		      break;		    case 4 :		      /* >= */		      if ( operation -> devise == devise_montant -> no_devise )			{			  if ( operation -> montant < etat -> montant_valeur )			    goto operation_refusee;			}		      else			{			  gfloat montant;			  if ( !devise_operation			       ||			       operation -> devise != devise_operation -> no_devise )			    devise_operation = g_slist_find_custom ( liste_struct_devises,								     GINT_TO_POINTER ( operation -> devise ),								     ( GCompareFunc ) recherche_devise_par_no ) -> data;			  if ( devise_montant -> passage_euro			       &&			       !strcmp ( devise_operation -> nom_devise, _("Euro") ) )			    montant = operation -> montant * devise_montant -> change;			  else			    if ( devise_operation -> passage_euro				 &&				 !strcmp ( devise_montant -> nom_devise, _("Euro") ))			      montant = operation -> montant / devise_operation -> change;			    else			      if ( operation -> une_devise_compte_egale_x_devise_ope )				montant = operation -> montant / operation -> taux_change - operation -> frais_change;			      else				montant = operation -> montant * operation -> taux_change - operation -> frais_change;			  montant = ( rint (montant * 100 )) / 100;			  if ( montant < etat -> montant_valeur )			    goto operation_refusee;			}		      break;		    }		}	      /* vrifie l'inclusion du montant */	      if ( etat -> utilise_inclusion )		{		  /* on calcule le montant de l'op dans la devise demande pour faire les comparaisons */		  gfloat montant;		  if ( operation -> devise == devise_montant -> no_devise )		    montant = operation -> montant;		  else		    {		      if ( !devise_operation			   ||			   operation -> devise != devise_operation -> no_devise )			devise_operation = g_slist_find_custom ( liste_struct_devises,								 GINT_TO_POINTER ( operation -> devise ),								 ( GCompareFunc ) recherche_devise_par_no ) -> data;		      if ( devise_montant -> passage_euro			   &&			   !strcmp ( devise_operation -> nom_devise, _("Euro") ) )			montant = operation -> montant * devise_montant -> change;		      else			if ( devise_operation -> passage_euro			     &&			     !strcmp ( devise_montant -> nom_devise, _("Euro") ))			  montant = operation -> montant / devise_operation -> change;			else			  if ( operation -> une_devise_compte_egale_x_devise_ope )			    montant = operation -> montant / operation -> taux_change - operation -> frais_change;			  else			    montant = operation -> montant * operation -> taux_change - operation -> frais_change;		      montant = ( rint (montant * 100 )) / 100;		    }		  if ( ( etat -> type_operateur_inf_inclusion			 &&			 montant < etat -> montant_inclusion_inf )		       ||		       ( !etat -> type_operateur_inf_inclusion			 &&			 montant <= etat -> montant_inclusion_inf ))		    goto operation_refusee;		  if ( ( etat -> type_operateur_sup_inclusion			 &&			 montant > etat -> montant_inclusion_sup )		       ||		       ( !etat -> type_operateur_sup_inclusion			 &&			 montant >= etat -> montant_inclusion_sup ))		    goto operation_refusee;		}	      /* on vrifie les R */	      if ( etat -> afficher_r )		{		  if ( ( etat -> afficher_r == 1			 &&			 operation -> pointe == 2 )		       ||		       ( etat -> afficher_r == 2			 &&			 operation -> pointe != 2 ))		    goto operation_refusee;		}	      /* 	      on vrifie les virements */	      if ( operation -> relation_no_operation )		{		  if ( !etat -> type_virement )		    goto operation_refusee;		  if ( etat -> type_virement == 1 )		    {		      /* on inclue l'op que si le compte de virement */		      /* est un compte de passif ou d'actif */		      p_tab_nom_de_compte_variable = p_tab_nom_de_compte + operation -> relation_no_compte;		      /* pour l'instant on n'a que le compte passif */		      if ( TYPE_DE_COMPTE != 2 )			goto operation_refusee;		      p_tab_nom_de_compte_variable = p_tab_nom_de_compte + i; 		    }		  else		    {		      if ( etat -> type_virement == 2 )			{			  /* on inclut l'op que si le compte de virement n'est */			  /* pas prsent dans l'tat */			  			  if ( g_slist_index ( etat -> no_comptes,					       GINT_TO_POINTER ( operation -> relation_no_compte )) != -1 )			    goto operation_refusee;			}		      else			{			  /* on inclut l'op que si le compte de virement est dans la liste */			  if ( g_slist_index ( etat -> no_comptes_virements,					       GINT_TO_POINTER ( operation -> relation_no_compte )) == -1 )			    goto operation_refusee;			}		    }		}	      else		{		  /* 		  l'op n'est pas un virement, si on doit exclure les non virement, c'est ici */		  if ( etat -> type_virement		       &&		       etat -> exclure_ope_non_virement )		    goto operation_refusee;		}	      if ( etat -> utilise_categ )		{		  /* on va maintenant vrifier que les catg sont bonnes */ 		  if ((( etat -> utilise_detail_categ			 &&			 g_slist_index ( etat -> no_categ,					 GINT_TO_POINTER ( operation -> categorie )) == -1 )		       ||		       ( etat -> exclure_ope_sans_categ			 &&			 !operation -> categorie ))		      &&		      !operation -> operation_ventilee )		    goto operation_refusee;		}	      /* vrification de l'imputation budgtaire */	      if (( etat -> utilise_ib		    &&		    etat -> utilise_detail_ib		    &&		    g_slist_index ( etat -> no_ib,				    GINT_TO_POINTER ( operation -> imputation )) == -1 )		  ||		  ( etat -> exclure_ope_sans_ib		    &&		    !operation -> imputation ))		goto operation_refusee;	      /* vrification du tiers */	      if ( etat -> utilise_tiers		   &&		   etat -> utilise_detail_tiers		   &&		   g_slist_index ( etat -> no_tiers,				   GINT_TO_POINTER ( operation -> tiers )) == -1 )		goto operation_refusee;	      /* vrifie la plage de date */	      if ( etat -> exo_date )		{		  /* on utilise l'exercice */		  if ( (( etat -> utilise_detail_exo == 1			  ||			  etat -> utilise_detail_exo == 2 )			&&			( operation -> no_exercice != no_exercice_recherche			  ||			  !operation -> no_exercice ))		       ||		       ( etat -> utilise_detail_exo == 3			 &&			 ( g_slist_index ( etat -> no_exercices,					   GINT_TO_POINTER ( operation -> no_exercice )) == -1			   ||			   !operation -> no_exercice )))		    goto operation_refusee;		}	      else		{		  /* on utilise une plage de dates */		  GDate *date_jour;		  GDate *date_tmp;		  date_jour = g_date_new ();		  g_date_set_time ( date_jour,				    time ( NULL ));		  switch ( etat -> no_plage_date )		    {		    case 0:		      /* toutes */		      break;		    case 1:		      /* plage perso */		      if ( !etat -> date_perso_debut			   ||			   !etat -> date_perso_fin			   ||			   g_date_compare ( etat -> date_perso_debut,					    operation -> date ) > 0			   ||			   g_date_compare ( etat -> date_perso_fin,					    operation -> date ) < 0 )			goto operation_refusee;		      break;		    case 2:		      /* cumul  ce jour */		      if ( g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 3:		      /* mois en cours */		      if ( g_date_month ( date_jour ) != g_date_month ( operation -> date ))			goto operation_refusee;		      break;		    case 4:		      /* anne en cours */		      if ( g_date_year ( date_jour ) != g_date_year ( operation -> date ))			goto operation_refusee;		      break;		    case 5:		      /* cumul mensuel */		      if ( g_date_month ( date_jour ) != g_date_month ( operation -> date )			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 6:		      /* cumul annuel */		      if ( g_date_year ( date_jour ) != g_date_year ( operation -> date )			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 7:		      /* mois prcdent */		      g_date_subtract_months ( date_jour,					       1 );		      if ( g_date_month ( date_jour ) != g_date_month ( operation -> date ))			goto operation_refusee;		      break;		    case 8:		      /* anne prcdente */		      g_date_subtract_years ( date_jour,					      1 );		      if ( g_date_year ( date_jour ) != g_date_year ( operation -> date ))			goto operation_refusee;		      break;		    case 9:		      /* 30 derniers jours */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_subtract_days ( date_tmp,					     30 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) > 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) < 0 )			goto operation_refusee;		      break;		    case 10:		      /* 3 derniers mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_subtract_months ( date_tmp,					       3 );		      g_date_subtract_months ( date_jour,					       1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) > 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) < 0 )			goto operation_refusee;		      break;		    case 11:		      /* 6 derniers mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_subtract_months ( date_tmp,					       6 );		      g_date_subtract_months ( date_jour,					       1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) > 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) < 0 )			goto operation_refusee;		      break;		    case 12:		      /* 12 derniers mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_subtract_months ( date_tmp,					       12 );		      g_date_subtract_months ( date_jour,					       1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) > 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) < 0 )			goto operation_refusee;		      break;		    case 13:		      /* 30 prochains jours */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_add_days ( date_tmp,					30 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) < 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 14:		      /* 3 prochains mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_add_months ( date_tmp,					  3 );		      g_date_add_months ( date_jour,					  1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) < 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 15:		      /* 6 prochains mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_add_months ( date_tmp,					  6 );		      g_date_add_months ( date_jour,					  1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) < 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		      break;		    case 16:		      /* 12 prochains mois */		      date_tmp = g_date_new_dmy ( g_date_day ( date_jour ),						  g_date_month ( date_jour ),						  g_date_year ( date_jour ) );		      g_date_add_months ( date_tmp,					  12 );		      g_date_add_months ( date_jour,					  1 );		      if ( g_date_compare ( date_tmp,					    operation -> date ) < 0			   ||			   g_date_compare ( date_jour,					    operation -> date ) > 0 )			goto operation_refusee;		    }		}	      liste_opes_selectionnees = g_slist_append ( liste_opes_selectionnees,							  operation );	    operation_refusee:	      pointeur_tmp = pointeur_tmp -> next;	    }	}      p_tab_nom_de_compte_variable++;    }  /*    ce niveau, on a rcupr toutes les ops qui entreront dans */  /* l'tat ; reste plus qu' les classer et les afficher */  /* on classe la liste et l'affiche en fonction du choix du type de classement */  etape_finale_affichage_etat ( liste_opes_selectionnees, affichage );}