« Float (rtl) » : différence entre les versions
(Page créée avec « {{latest}} <source lang='delphi'>Function Float(const V:Variant):Variant;</source> Cette fonction convertit un variant en variant de type Float. {|class="wikitable" |- |... ») |
Aucun résumé des modifications |
||
| Ligne 16 : | Ligne 16 : | ||
<source lang='delphi'> | <source lang='delphi'> | ||
//Procedure Ventiler; | |||
var vCessionBienDetail : TCessionBienDetail; | |||
vTotal : float; | |||
vValeur : float; | |||
vMontant: float; | |||
begin | begin | ||
if cleRepartition.value = repartitionSortie_MontantAcquisition then | |||
vTotal := GetTotalMtAcquisition | |||
else if clerepartition.value = repartitionSortie_valeurnette then | |||
vTotal := GetTotalValeurNette | |||
else | |||
vTotal := GetTotalValeurBrute; | |||
// vTotal,vMontant,vValeur may be very large amount | |||
// convert to float to compute the a/b*c | |||
vTotal := Float(vTotal); | |||
vMontant := Float(montant.value); | |||
forEach vCessionBienDetail in cessionBienDetailList do | |||
begin | |||
if cleRepartition.value = repartitionSortie_MontantAcquisition then | |||
vValeur := vCessionBienDetail.BienComptable.montantAcquisition.value | |||
else if clerepartition.value = repartitionSortie_valeurnette then | |||
vValeur := vCessionBienDetail.GetValeurNetteSortie | |||
else | |||
vValeur := vCessionBienDetail.GetValeurBrute; | |||
if vTotal <> 0 then | |||
vCessionBienDetail.prixCession.value := (vMontant / vTotal) * vValeur; | |||
vCessionBienDetail.Calculer; | |||
end; | |||
end; | end; | ||
</source> | </source> | ||
Version du 21 juillet 2014 à 11:05
Function Float(const V:Variant):Variant;
Cette fonction convertit un variant en variant de type Float.
| Result | Le variant converti en Float |
| V | Le variant à convertir |
Exemple :
//Procedure Ventiler;
var vCessionBienDetail : TCessionBienDetail;
vTotal : float;
vValeur : float;
vMontant: float;
begin
if cleRepartition.value = repartitionSortie_MontantAcquisition then
vTotal := GetTotalMtAcquisition
else if clerepartition.value = repartitionSortie_valeurnette then
vTotal := GetTotalValeurNette
else
vTotal := GetTotalValeurBrute;
// vTotal,vMontant,vValeur may be very large amount
// convert to float to compute the a/b*c
vTotal := Float(vTotal);
vMontant := Float(montant.value);
forEach vCessionBienDetail in cessionBienDetailList do
begin
if cleRepartition.value = repartitionSortie_MontantAcquisition then
vValeur := vCessionBienDetail.BienComptable.montantAcquisition.value
else if clerepartition.value = repartitionSortie_valeurnette then
vValeur := vCessionBienDetail.GetValeurNetteSortie
else
vValeur := vCessionBienDetail.GetValeurBrute;
if vTotal <> 0 then
vCessionBienDetail.prixCession.value := (vMontant / vTotal) * vValeur;
vCessionBienDetail.Calculer;
end;
end;
Voir aussi: