Statistiques
| Révision:

root / UFRapProfilP.pas @ 3

Historique | Voir | Annoter | Télécharger (5,236 ko)

1
unit UFRapProfilP ;
2

    
3
interface
4

    
5
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, OleCtrls, StdCtrls, ComCtrls, DB, DBClient, ExtCtrls, QRCtrls,
8
  QuickRpt, QRPrntr, MidasLib, UVariables, gnugettext;
9

    
10
type
11
  TFRapProfilP = class(TForm)
12
    QRRapport: TQuickRep;
13
    PHBRapport: TQRBand;
14
    DBRapport: TQRBand;
15
    QRLTitre: TQRLabel;
16
    QRLConso: TQRLabel;
17
    QRLPerf: TQRLabel;
18
    QRLProfil: TQRLabel;
19
    QRDBTProfil: TQRDBText;
20
    CDSRapport: TClientDataSet;
21
    SFProfil: TStringField;
22
    PFBRapport: TQRBand;
23
    QRLUser: TQRLabel;
24
    QRLWarning: TQRLabel;
25
    QRLMemo: TQRLabel;
26
    QRMMemo: TQRMemo;
27
    QRSDDate: TQRSysData;
28
    QRSEntete: TQRShape;
29
    IFAgeInit: TIntegerField;
30
    FFPVInit: TFloatField;
31
    FFProtInit: TFloatField;
32
    FFLipInit: TFloatField;
33
    FFValFin: TFloatField;
34
    FFRC: TFloatField;
35
    SFAdLib: TStringField;
36
    FFPDMoy: TFloatField;
37
    FFPrecocite: TFloatField;
38
    FFEntretien: TFloatField;
39
    FFPVmr2: TFloatField;
40
    QRLInit: TQRLabel;
41
    QRLPVInit: TQRLabel;
42
    QRLAgeInit: TQRLabel;
43
    QRLProtInit: TQRLabel;
44
    QRLLipInit: TQRLabel;
45
    QRLFin: TQRLabel;
46
    QRLValFin: TQRLabel;
47
    QRLAdLib: TQRLabel;
48
    QRLPrecocite: TQRLabel;
49
    QRLPVmr2: TQRLabel;
50
    QRLPDMoy: TQRLabel;
51
    QRLEntretien: TQRLabel;
52
    QRDBTAdLib: TQRDBText;
53
    QRDBTAgeInit: TQRDBText;
54
    QRDBTProtInit: TQRDBText;
55
    QRDBTPVInit: TQRDBText;
56
    QRDBTLipInit: TQRDBText;
57
    QRDBTValFin: TQRDBText;
58
    QRDBTPDMoy: TQRDBText;
59
    QRDBTEntretien: TQRDBText;
60
    QRDBTPrecocite: TQRDBText;
61
    QRDBTPVmr2: TQRDBText;
62
    QRLRC: TQRLabel;
63
    QRDBTRC: TQRDBText;
64
    QRIInraPorc: TQRImage;
65
    QRLInraPorc: TQRLabel;
66
    QRLSexe: TQRLabel;
67
    QRDBTSexe: TQRDBText;
68
    SFSexe: TStringField;
69
    procedure FormCreate(Sender: TObject);
70
  private
71
    { D?clarations priv?es }
72
  public
73
    { D?clarations publiques }
74
  end;
75

    
76
var
77
  FRapProfilP: TFRapProfilP;
78

    
79
implementation
80

    
81
uses
82
  UStrings, UCalcul, UUtil, UFProfilP, UFPrevRap ;
83

    
84
{$R *.dfm}
85

    
86
{ TFRapProfilP }
87

    
88
procedure TFRapProfilP.FormCreate(Sender: TObject);
89
begin
90
  if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1
91
  then
92
    Font.Name := 'Arial Unicode MS';
93
  TranslateComponent(Self);
94
  // Licence
95
  if IsEducation and (Length (Course) > 0)
96
  then
97
    QRLUSer.Caption := Format('%s (%s)', [Course, Company])
98
  else
99
  if IsComplete or IsEducation
100
  then
101
    QRLUSer.Caption := Format('%s %s (%s)', [FirstName, LastName, Company])
102
  else
103
  if IsEvaluation
104
  then
105
    QRLUSer.Caption := StrEvaluation
106
  else
107
  begin
108
    QRLUSer.Caption := StrReadOnly;
109
    QRLUser.Font.Color := clRed;
110
  end;
111
  with CDSRapport do
112
  begin
113
    CreateDataSet;
114
    Append;
115
    FieldValues['_Profil_'] := FProfilP.CBProfil.Text;
116
    FieldValues['_Sexe_'] := FProfilP.CBSexe.Text;
117
    FieldValues['_AgeInit_'] := FProfilP.PBAgeInit.AsInteger;
118
    FieldValues['_PVInit_'] := FProfilP.PBPVInit.AsFloat;
119
    FieldValues['_ProtInit_'] := FProfilP.PBProtInit.AsFloat;
120
    FieldValues['_LipInit_'] := FProfilP.PBLipInit.AsFloat;
121
    if FProfilP.RBFinDuree.Checked
122
    then // Dur?e
123
      FieldValues['_ValFin_'] := FProfilP.PBDuree.AsInteger
124
    else // Poids vif
125
      FieldValues['_ValFin_'] := FProfilP.PBPVFin.AsFloat;
126
    FieldValues['_RC_'] := FProfilP.PBCarcasse.AsFloat;
127
    case FProfilP.CBEquation.ItemIndex of
128
      0: // a+b*PV
129
        FieldValues['_AdLib_'] := Format('%s=%s+%s*%s', [FProfilP.CBUnite.Text, DblToStr(FProfilP.PBCoefA.AsFloat, FProfilP.PBCoefA.Decimals), DblToStr(FProfilP.PBCoefB.AsFloat, FProfilP.PBCoefB.Decimals), _('BW')]);
130
      1: // a*PV^b
131
        FieldValues['_AdLib_'] := Format('%s=%s*%s^%s', [FProfilP.CBUnite.Text, DblToStr(FProfilP.PBCoefA.AsFloat, FProfilP.PBCoefA.Decimals), _('BW'), DblToStr(FProfilP.PBCoefB.AsFloat, FProfilP.PBCoefB.Decimals)]);
132
      2: // a*(1-exp(-b*PV))
133
        FieldValues['_AdLib_'] := Format('%s=%s*(1-exp(-%s*%s))', [FProfilP.CBUnite.Text, DblToStr(FProfilP.PBCoefA.AsFloat, FProfilP.PBCoefA.Decimals), DblToStr(FProfilP.PBCoefB.AsFloat, FProfilP.PBCoefB.Decimals), _('BW')]);
134
      3:
135
        FieldValues['_AdLib_'] := Format('Gamma: %s=(%s*(%s*%s*exp(-%s*%s))+1)*%s', [FProfilP.CBUnite.Text, DblToStr(FProfilP.PBCoefA.AsFloat, FProfilP.PBCoefA.Decimals), DblToStr(FProfilP.PBCoefB.AsFloat, FProfilP.PBCoefB.Decimals), _('BW'), DblToStr(FProfilP.PBCoefB.AsFloat, FProfilP.PBCoefB.Decimals), _('BW'), _('Maintenance')]);
136
      else
137
        FieldValues['_AdLib_'] := '';
138
    end;
139
    FieldValues['_PDMoy_'] := FProfilP.PBPDMoy.AsFloat;
140
    FieldValues['_Precocite_'] := FProfilP.PBComport.AsFloat;
141
    FieldValues['_Entretien_'] := FProfilP.PBEntretien.AsFloat;
142
    FieldValues['_PVmr2_'] := FProfilP.PBPVmr2.AsFloat;
143
    Post;
144
  end ;
145
  QRMMemo.Lines.Add(FProfilP.CBProfil.Hint);
146
  if FProfilP.RBFinDuree.Checked
147
  then // Dur?e
148
    QRLValFin.Caption := FProfilP.RBFinDuree.Caption
149
  else // Poids vif
150
    QRLValFin.Caption := FProfilP.RBFinPoids.Caption;
151
  if FProfilP.RBFinDuree.Checked
152
  then // Dur?e
153
    QRDBTValFin.Mask := '0'
154
  else // Poids vif
155
    QRDBTValFin.Mask := '0.0';
156
  RegisterPreviewClass(TQRPrevRapInterface);
157
//  QRRapport.PreviewModal;
158
//  RegisterPreviewClass(TQRStandardPreviewInterface);
159
end;
160

    
161
end.