1 2 3 4
| SELECT tblImmeubles.ImmId, tblDecomptes.DecId, tblDecomptes.DecImm, tblImmeubles.ImmNumero, tblImmeubles.ImmNatureTravaux, tblImmeubles.ImmNumeroOfl, tblImmeubles.ImmAdresse, tblCommunes.CommuneNom, tblProprietaires.PropNom, tblProprietaires.PropLocalite, tblGerances.GerNom, tblGerances.GerLocalite, tblDecomptes.DecDateDebut, tblDecomptes.DecDateFin, [ImmCFC0Logements]+[ImmCFC1Logements]+[ImmCFC2Logements]+[ImmCFC4Logements]+[ImmCFC5Logements]-[ImmReductionLogements] AS ImmCoutTotalLogements, Int([DecFondsPropres]*[DecTauxFondsPropres]+1*0.5)+Int([DecPretAsh]*[DecTauxPretAsh]+1*0.5)+Int([DecFondsPropresAutres]*[DecTauxFondsPropresAutres]+1*0.5)+Int([DecCapitalEmprunte]*[DecTauxCapitalEmprunte]+1*0.5)+Int([DecAmortissementBase]*[DecTauxAmortissement]+1*0.5)+Int((Int([DecFraisGenerauxBase]/[DecIpcIndiceInitial]*[DecIpcIndiceIndexe])+1*0.5)*[DecTauxFraisGeneraux]+1*0.5)+[DecRedevanceTerrain]+Int([DecTravauxSpeciaux]*[DecTauxTravauxSpeciaux]+1*0.5)-[DecEffortLoyers]+[DecFondsAttribution]-[DecFondsPrelevement]-[DecRevenuAutresParties] AS DecRevenuLocatifBrut, tblLogements.LogEntree, tblLogements.LogEtage, tblLogements.LogNumGerance, tblLocataires.LocDebutPeriode, tblLocataires.LocFinPeriode, IIf(Len([Loc1Nom] & " " & [Loc1Prenom])>20,Left([Loc1Nom] & " " & [Loc1Prenom],19) & ".",[Loc1Nom] & " " & [Loc1Prenom]) AS LocNomPrenom, tblLocataires.LocDecisionCantonOld, tblLocataires.LocDecisionCanton, Int([DecRevenuLocatifBrut]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5)+[LogDiffEtage] AS LogLoyerBrut, Int([DecAideCanton]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideCanton, Int([DecAideCommune]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideCommune, Int([DecAideTiers]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideTiers, [LogLoyerBrut]-[LogAideCanton]-[LogAideCommune]-[LogAideTiers] AS LogLoyerAbaisse, SupprimerAidesCanton([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideCantonSupp, SupprimerAidesCommune([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideCommuneSupp, SupprimerAidesTiers([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideTiersSupp, [LogLoyerAbaisse]+[LogAideCantonSupp]+[LogAideCommuneSupp]+[LogAideTiersSupp] AS LogLoyer, SupprimerAidesCanton([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideCantonSuppPrec, SupprimerAidesCommune([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideCommuneSuppPrec, SupprimerAidesTiers([LogLoyerBrut],[LogAideCanton],[LogAideCommune],[LogAideTiers],[LogLoyerAbaisse],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideTiersSuppPrec, [LogLoyerAbaisse]+[LogAideCantonSuppPrec]+[LogAideCommuneSuppPrec]+[LogAideTiersSuppPrec] AS LogLoyerPrec, Int([DecFondsPropresOld]*[DecTauxFondsPropresOld]+1*0.5)+Int([DecPretAshOld]*[DecTauxPretAshOld]+1*0.5)+Int([DecFondsPropresAutresOld]*[DecTauxFondsPropresAutresOld]+1*0.5)+Int([DecCapitalEmprunteOld]*[DecTauxCapitalEmprunteOld]+1*0.5)+Int([DecAmortissementBaseOld]*[DecTauxAmortissementOld]+1*0.5)+Int((Int([DecFraisGenerauxBaseOld]/[DecIpcIndiceInitialOld]*[DecIpcIndiceIndexeOld])+1*0.5)*[DecTauxFraisGenerauxOld]+1*0.5)+[DecRedevanceTerrainOld]+Int([DecTravauxSpeciauxOld]*[DecTauxTravauxSpeciauxOld]+1*0.5)-[DecEffortLoyersOld]+[DecFondsAttributionOld]-[DecFondsPrelevementOld]-[DecRevenuAutresPartiesOld] AS DecRevenuLocatifBrutOld, IIf([DecRevenuLocatifBrutOld]>0,Int([DecRevenuLocatifBrutOld]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5)+[LogDiffEtage],0) AS LogLoyerBrutOld, Int([DecAideCantonOld]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideCantonOld, Int([DecAideCommuneOld]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideCommuneOld, Int([DecAideTiersOld]/[ImmCoutTotalLogements]*[LogCout]/12+1*0.5) AS LogAideTiersOld, [LogLoyerBrutOld]-[LogAideCantonOld]-[LogAideCommuneOld]-[LogAideTiersOld] AS LogLoyerAbaisseOld, SupprimerAidesCanton([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideCantonSuppOldOld, SupprimerAidesCommune([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideCommuneSuppOldOld, SupprimerAidesTiers([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCantonOld],[LocLoyerDeterminantOld]) AS LogAideTiersSuppOldOld, [LogLoyerAbaisseOld]+[LogAideCantonSuppOldOld]+[LogAideCommuneSuppOldOld]+[LogAideTiersSuppOldOld] AS LogLoyerOldOld, SupprimerAidesCanton([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideCantonSuppOld, SupprimerAidesCommune([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideCommuneSuppOld, SupprimerAidesTiers([LogLoyerBrutOld],[LogAideCantonOld],[LogAideCommuneOld],[LogAideTiersOld],[LogLoyerAbaisseOld],[LocDecisionCanton],[LocLoyerDeterminant]) AS LogAideTiersSuppOld, [LogLoyerAbaisseOld]+[LogAideCantonSuppOld]+[LogAideCommuneSuppOld]+[LogAideTiersSuppOld] AS LogLoyerOld, IIf([LogLoyer]-[LogLoyerAfficheOld] Between -1 And 1,0,[LogLoyer]-[LogLoyerAfficheOld]) AS LogLoyerDifference, IIf([LocDebutPeriode]>[DecDateDebut],[LogLoyerPrec],IIf([LocDebutPeriode]=[DecDateDebut],[LogLoyerOldOld],[LogLoyerOld])) AS LogLoyerAfficheOld
FROM tblProprietaires INNER JOIN ((((tblGerances INNER JOIN (tblCommunes INNER JOIN tblImmeubles ON tblCommunes.CommuneId = tblImmeubles.ImmNumeroCommune) ON tblGerances.GerId = tblImmeubles.ImmGerance) INNER JOIN tblDecomptes ON tblImmeubles.ImmId = tblDecomptes.DecImm) INNER JOIN tblLogements ON tblImmeubles.ImmId = tblLogements.LogImm) INNER JOIN tblLocataires ON tblLogements.LogId = tblLocataires.LocLog) ON tblProprietaires.PropId = tblImmeubles.ImmProprietaire
WHERE (((tblLocataires.LocDebutPeriode)<=[DecDateFin]) AND ((tblLocataires.LocFinPeriode) Is Null Or (tblLocataires.LocFinPeriode)>=[DecDateDebut]))
ORDER BY tblImmeubles.ImmId, tblDecomptes.DecDateDebut DESC , tblLogements.LogNumGerance; |
Partager