CALCULATEUR ARGUS AUTOMOBILE

DelphiCool Messages postés 455 Date d'inscription mardi 24 juillet 2001 Statut Membre Dernière intervention 10 mars 2009 - 27 févr. 2006 à 07:07
Oniria Messages postés 292 Date d'inscription dimanche 14 mars 2004 Statut Membre Dernière intervention 18 décembre 2014 - 10 déc. 2007 à 14:21
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/36265-calculateur-argus-automobile

Oniria Messages postés 292 Date d'inscription dimanche 14 mars 2004 Statut Membre Dernière intervention 18 décembre 2014 3
10 déc. 2007 à 14:21
Bonjour,

La base de données n'est plus à jour, je pense. Ça fait un moment que je l'ai créé. Il se base par rapport au condition argus du magazine.
Si ton programme est mieux, n'hésite pas à le poster.
Tu feras des heureux. Et si tu découvre des problèmes dans mon prog, n'hésite pas non plus à me le dire, je ferais les corrections qui s'imposent.
morpheus83 Messages postés 7 Date d'inscription dimanche 11 mai 2003 Statut Membre Dernière intervention 13 mai 2010
10 déc. 2007 à 10:49
salut, je vais comparer ton programme au miens.
a mon avis sa ne marche pas a 100%...
je suis commercial dans l'automobile, et j'ai mis au point un programme identique qui fonctionne a 100%.
a++.
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
28 févr. 2006 à 21:45
modification a faire (optimisation) :

INTERFACE :::

uses
Windows, SysUtils, Forms, ComCtrls, StdCtrls, ExtCtrls, Controls, Classes, dateutils;


IMPLEMENTATION :::

type
T5Matrix = array [0..4,0..4] of Integer;

var
GPS : T5Matrix = ...
GPS_Carto : T5Matrix = ...
Clim : T5Matrix = ...
Clim_auto : T5Matrix = ...
Regul : T5Matrix = ...
Cuir : T5Matrix = ...
Xenon : T5Matrix = ...
TOuvrant : T5Matrix = ...
ESP : T5Matrix = ...

km_mois : array[0..2] of integer = (1250,1700,2100);

...

procedure TForm1.Button1Click(Sender: TObject);
var prix, moinsvalue : real;
nb_km, ecart_km,
nb_mois, nb_annee, mois, Annee, moisVeh, AnneeVeh,
option, i : integer;
begin
prix := 0;
option := 0;
nb_km := 0;
i := 0;

// On récupére dans mois et Annee le mois et l'année en cours
mois := MonthOf(Date);
Annee := YearOf(Date);

// On fait pareil pour le véhicule
moisVeh := monthOf(DateTimePicker1.DateTime);
AnneeVeh := YearOf(DateTimePicker1.DateTime);

// La on calcule l'age en année
nb_Annee := Annee - AnneeVeh;

// La on calcule l'age en mois
if nb_Annee = 0 then
nb_mois := mois-moisVeh
else
if nb_Annee = 1 then begin
nb_mois:=12-moisVeh;
nb_mois:=nb_mois+mois;
end else begin
nb_mois:=12-moisVeh;
nb_mois:=nb_mois+mois;
nb_mois:=nb_mois+12*(nb_Annee-1);
end;
DateTimePicker1.Hint := format('Age du vehicule %d ans (%d mois)',[nb_Annee,nb_Mois]);

// calcul des options
if nb_Annee <= 5 then begin
i := nb_Annee - 1;
if i = -1 then i := 0;

if RadioGroup2.ItemIndex = 1 then
option := option+Clim[RadioGroup1.ItemIndex,i]
else
if RadioGroup2.ItemIndex = 2 then
option := option+Clim_auto[RadioGroup1.ItemIndex,i];

if RadioGroup3.ItemIndex = 1 then
option := option+GPS[RadioGroup1.ItemIndex,i]
else
if RadioGroup3.ItemIndex = 2 then
option := option+GPS_carto[RadioGroup1.ItemIndex,i];

if CheckBox1.Checked then option := option + Regul[RadioGroup1.ItemIndex,i];

if CheckBox2.Checked then option := option + Cuir[RadioGroup1.ItemIndex,i];

if CheckBox3.Checked then option := option + xenon[RadioGroup1.ItemIndex,i];

if CheckBox4.Checked then option := option + TOuvrant[RadioGroup1.ItemIndex,i];

if CheckBox5.Checked then option := option + ESP[RadioGroup1.ItemIndex,i];
end;
GroupBox2.Hint := format('Valeur Ajoutées par les options : %d euros',[option]);

// Calcul de l'excedent de km
if Edit1.Text <> '' then
nb_km := strtoint(Edit1.Text);

ecart_km := nb_mois * km_mois[RadioGroup4.ItemIndex];
Edit1.Hint := format('Le kilométrage normal est de %d km',[ecart_km]);

if nb_km = 0 then
ecart_km := 0
else
ecart_km := nb_km-ecart_km;

prix := strtoint(Edit2.Text) + option;
moinsvalue := prix * 0.005 * Trunc(ABS(ecart_km)/1000);

if ecart_km < 0 then
moinsvalue := moinsvalue/2;

if ecart_km > 0 then
prix := prix - moinsvalue
else
prix := prix + moinsvalue;

Edit3.Text := IntToStr(round(prix));

prix := prix-(prix*0.15);
Edit4.Text := IntToStr(round(prix));
end;
DelphiCool Messages postés 455 Date d'inscription mardi 24 juillet 2001 Statut Membre Dernière intervention 10 mars 2009
27 févr. 2006 à 19:47
Plutot effacer le fichier Argus.dof

Merci
Oniria Messages postés 292 Date d'inscription dimanche 14 mars 2004 Statut Membre Dernière intervention 18 décembre 2014 3
27 févr. 2006 à 13:37
Bonjour,
Il faut dans le fichier .dpr, enlever cette définition qui ne sert à rien pour cette appli(c'est une bibliothéque qui permet de gérer le port série).
DelphiCool Messages postés 455 Date d'inscription mardi 24 juillet 2001 Statut Membre Dernière intervention 10 mars 2009
27 févr. 2006 à 07:07
Salut

Il manque un paquet CPortLib7 ??
C'est une dll
Rejoignez-nous