1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| Private Function CalculTaux() As Currency
Dim i As Integer
Dim temp As String, chaine_avant As String, chaine_apres As String
Dim SommeFacture As Currency
Dim CaObjCas As Currency
Dim SommeCaObj As Currency
Dim CalculTauxTmp As Currency
SommeFacture = 0
CaObjCas = 0
SommeCaObj = 0
CalculTauxTmp = 0
If Rst1.Fields("typ_ope_lxa") = "%" Then
CalculTaux = Rst1.Fields("mnt_lxa")
Else
If Rst1.Fields("typ_ope_lxa") = "F" And Rst1.Fields("cod_soc") = "00" Then
CalculTaux = Rst1.Fields("mnt_val_lxa") * 100 / Rst1.Fields("caf_obj")
Else
Set Rst6 = dbsGEDEON.OpenRecordset(Requete("xxx"), dbOpenDynaset)
CaObjCas = Rst6.Fields(0)
Set Rst2 = dbsGEDEON.OpenRecordset(Requete("yyy"), dbOpenDynaset)
If IsNull(Rst2.Fields(0)) Then
Set Rst3 = dbsGEDEON.OpenRecordset(Requete("zzz"), dbOpenDynaset)
If Not IsNull(Rst3.Fields(0)) Then
SommeFacture = Rst3.Fields(0)
Else
SommeFacture = 0
End If
Else
SommeFacture = Rst2.Fields(0)
End If
If Rst1.Fields("mnt_val_lxa") = SommeFacture Then
Set Rst4 = dbsGEDEON.OpenRecordset(Requete("rrr"), dbOpenDynaset)
If IsNull(Rst4.Fields(0)) Then
Set Rst5 = dbsGEDEON.OpenRecordset(Requete("sss"), dbOpenDynaset)
If Not IsNull(Rst5.Fields(0)) Then
CalculTauxTmp = Rst5.Fields(0)
Else
CalculTauxTmp = 0
End If
Else
CalculTauxTmp = Rst4.Fields(0)
End If
Else
SommeCaObj = CaObjCas
Set Rst7 = dbsGEDEON.OpenRecordset(Requete("aaa"), dbOpenDynaset)
If Rst7.RecordCount <> 0 Then
SommeCaObj = SommeCaObj + Rst7.Fields(0)
End If
Set Rst8 = dbsGEDEON.OpenRecordset(Requete("bbb"), dbOpenDynaset)
If Rst8.RecordCount <> 0 Then
SommeCaObj = SommeCaObj + Rst8.Fields(0)
End If
CalculTauxTmp = Rst1.Fields("mnt_val_lxa") * CaObjCas / SommeCaObj
End If
CalculTaux = CalculTauxTmp * 100 / CaObjCas
End If
End If
'mes petits essais
Print #NumFicExp, "======"
Print #NumFicExp, CalculTaux
CalculTauxTmp = Format(CalculTaux, "0000.000")
Print #NumFicExp, "0.000"
Print #NumFicExp, CalculTauxTmp
CalculTauxTmp = Format(CalculTaux, "###0.000")
Print #NumFicExp, "###0.000"
Print #NumFicExp, CalculTaux
Print #NumFicExp, "======"
End Function |
Partager