« 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 |
||
| (3 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
{{ | {{Version700}} | ||
<source lang='delphi'>Function Float(const V:Variant):Variant;</source> | <source lang='delphi'>Function Float(const V:Variant):Variant;</source> | ||
| 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> | ||
| Ligne 27 : | Ligne 57 : | ||
{{Footer|Développement DSM}} | {{Footer|Développement DSM}} | ||
[[category:RTL Variant]] | [[category:RTL Variant]] | ||
[[Category: | [[Category:Version700]] | ||
Dernière version du 13 janvier 2015 à 09:51
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: