Statistiques
| Révision:

root / UFRapBesLactE.pas @ 3

Historique | Voir | Annoter | Télécharger (8,307 ko)

1 3 avalancogn
unit UFRapBesLactE ;
2
3
interface
4
5
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, OleCtrls, StdCtrls, ComCtrls, DB, DBClient, ExtCtrls, Math,
8
  QRCtrls, QuickRpt, QRPrntr, MidasLib, UVariables, gnugettext;
9
10
type
11
  TFRapBesLactE = class(TForm)
12
    QRRapport: TQuickRep;
13
    PHBRapport: TQRBand;
14
    DBRapport: TQRBand;
15
    QRLTitre: TQRLabel;
16
    CDSRapport: TClientDataSet;
17
    IFCycle: TIntegerField;
18
    FFGMQPort: TFloatField;
19
    FFPdsMB: TFloatField;
20
    FFP2MB: TFloatField;
21
    IFDureeLact: TIntegerField;
22
    FFBesEMEnt: TFloatField;
23
    FFBesEMLait: TFloatField;
24
    FFBesEMTot: TFloatField;
25
    FFAppED: TFloatField;
26
    FFAppEM: TFloatField;
27
    FFAppEN: TFloatField;
28
    FFBesAli: TFloatField;
29
    FFLys: TFloatField;
30
    FFMet: TFloatField;
31
    FFMetCys: TFloatField;
32
    FFTrp: TFloatField;
33
    FFThr: TFloatField;
34
    FFPhe: TFloatField;
35
    FFPheTyr: TFloatField;
36
    FFLeu: TFloatField;
37
    FFIle: TFloatField;
38
    FFVal: TFloatField;
39
    FFHis: TFloatField;
40
    FFArg: TFloatField;
41
    QREBesENTot: TQRExpr;
42
    QRLBesENTot: TQRLabel;
43
    QREPctPort: TQRExpr;
44
    QREPctEnt: TQRExpr;
45
    QRDBText3: TQRDBText;
46
    QRDBText2: TQRDBText;
47
    QRLPoids: TQRLabel;
48
    QRLCaract: TQRLabel;
49
    QRLMiseBas: TQRLabel;
50
    QRLP2: TQRLabel;
51
    QRLAge: TQRLabel;
52
    QRLSevres: TQRLabel;
53
    QRLPdsPt: TQRLabel;
54
    QRDBTPdsMB: TQRDBText;
55
    QRDBTP2MB: TQRDBText;
56
    QRDBTAgeMB: TQRDBText;
57
    QRLNRJ: TQRLabel;
58
    QRLAA: TQRLabel;
59
    QRLNRJEnt: TQRLabel;
60
    QRLNRJPort: TQRLabel;
61
    QRLNRJTot: TQRLabel;
62
    QRDBTEMEnt: TQRDBText;
63
    QRLEMEnt: TQRLabel;
64
    QRLPctEnt: TQRLabel;
65
    QRDBTEMPort: TQRDBText;
66
    QRLEMPort: TQRLabel;
67
    QRLPctPort: TQRLabel;
68
    QRDBTBesEMTot: TQRDBText;
69
    QRLBesEMTot: TQRLabel;
70
    QREArgPctLys: TQRExpr;
71
    QREHisPctLys: TQRExpr;
72
    QREValPctLys: TQRExpr;
73
    QREIlePctLys: TQRExpr;
74
    QRELeuPctLys: TQRExpr;
75
    QREPheTyrPctLys: TQRExpr;
76
    QREPhePctLys: TQRExpr;
77
    QREThrPctLys: TQRExpr;
78
    QRETrpPctLys: TQRExpr;
79
    QREMetCysPctLys: TQRExpr;
80
    QREMetPctLys: TQRExpr;
81
    QRELysPctLys: TQRExpr;
82
    QREArgAli: TQRExpr;
83
    QREHisAli: TQRExpr;
84
    QREValAli: TQRExpr;
85
    QREIleAli: TQRExpr;
86
    QRELeuAli: TQRExpr;
87
    QREPheTyrAli: TQRExpr;
88
    QREPheAli: TQRExpr;
89
    QREThrAli: TQRExpr;
90
    QRETrpAli: TQRExpr;
91
    QREMetCysAli: TQRExpr;
92
    QREMetAli: TQRExpr;
93
    QRELysAli: TQRExpr;
94
    QRLAATot: TQRLabel;
95
    QRLAAAli: TQRLabel;
96
    QRLPctLys: TQRLabel;
97
    QRLLys: TQRLabel;
98
    QRLMet: TQRLabel;
99
    QRLMetCys: TQRLabel;
100
    QRLTrp: TQRLabel;
101
    QRLThr: TQRLabel;
102
    QRLPhe: TQRLabel;
103
    QRLPheTyr: TQRLabel;
104
    QRLLeu: TQRLabel;
105
    QRLIle: TQRLabel;
106
    QRLVal: TQRLabel;
107
    QRLHis: TQRLabel;
108
    QRLArg: TQRLabel;
109
    QRDBTLysTot: TQRDBText;
110
    QRDBTMetTot: TQRDBText;
111
    QRDBTMetCysTot: TQRDBText;
112
    QRDBTTrpTot: TQRDBText;
113
    QRDBTThrTot: TQRDBText;
114
    QRDBTPheTot: TQRDBText;
115
    QRDBTPheTyrTot: TQRDBText;
116
    QRDBTLeuTot: TQRDBText;
117
    QRDBTIleTot: TQRDBText;
118
    QRDBTValTot: TQRDBText;
119
    QRDBTHisTot: TQRDBText;
120
    QRDBTArgTot: TQRDBText;
121
    QRShape1: TQRShape;
122
    QRLDeficit: TQRLabel;
123
    QRDBTBesAli: TQRDBText;
124
    QRLBesAli: TQRLabel;
125
    QREDefEN: TQRExpr;
126
    QRLDefEN: TQRLabel;
127
    QRDBTDefEM: TQRDBText;
128
    QRLDefEM: TQRLabel;
129
    QRDBTDefAli: TQRDBText;
130
    QRLDefAli: TQRLabel;
131
    FFDefEM: TFloatField;
132
    FFDefAli: TFloatField;
133
    QRLMin: TQRLabel;
134
    QRECaAli: TQRExpr;
135
    QREPAli: TQRExpr;
136
    QRLabel2: TQRLabel;
137
    QRLabel3: TQRLabel;
138
    QRLP: TQRLabel;
139
    QRLCa: TQRLabel;
140
    QRDBTPTot: TQRDBText;
141
    QRDBTCaTot: TQRDBText;
142
    FFP: TFloatField;
143
    FFCa: TFloatField;
144
    FFSevres: TFloatField;
145
    PFBRapport: TQRBand;
146
    QRLUser: TQRLabel;
147
    QRLWarning: TQRLabel;
148
    QRLabel1: TQRLabel;
149
    QRLabel4: TQRLabel;
150
    QRLabel5: TQRLabel;
151
    QRLabel6: TQRLabel;
152
    QREAppEM: TQRExpr;
153
    QREAppEN: TQRExpr;
154
    QREAppAli: TQRExpr;
155
    SFProfil: TStringField;
156
    QRShape6: TQRShape;
157
    QRDBTCycle: TQRDBText;
158
    QRLCycle: TQRLabel;
159
    QRLProfil: TQRLabel;
160
    QRDBTProfil: TQRDBText;
161
    QRSDDate: TQRSysData;
162
    QRIInraPorc: TQRImage;
163
    QRLInraPorc: TQRLabel;
164
    procedure FormCreate(Sender: TObject);
165
  private
166
    { D?clarations priv?es }
167
  public
168
    { D?clarations publiques }
169
  end;
170
171
var
172
  FRapBesLactE: TFRapBesLactE;
173
174
implementation
175
176
uses
177
  UStrings, UUtil, UFBesLactE, UFPrevRap ;
178
179
{$R *.dfm}
180
181
{ TFRapBesLactE }
182
183
procedure TFRapBesLactE.FormCreate(Sender: TObject);
184
var
185
  Cycle: integer;
186
begin
187
  if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1
188
  then
189
    Font.Name := 'Arial Unicode MS';
190
  TranslateComponent(Self);
191
  // Licence
192
  if IsEducation and (Length (Course) > 0)
193
  then
194
    QRLUSer.Caption := Format('%s (%s)', [Course, Company])
195
  else
196
  if IsComplete or IsEducation
197
  then
198
    QRLUSer.Caption := Format('%s %s (%s)', [FirstName, LastName, Company])
199
  else
200
  if IsEvaluation
201
  then
202
    QRLUSer.Caption := StrEvaluation
203
  else
204
  begin
205
    QRLUSer.Caption := StrReadOnly;
206
    QRLUser.Font.Color := clRed;
207
  end;
208
  with CDSRapport do
209
  begin
210
    CreateDataSet;
211
    for Cycle := 1 to NB_CYCLES do
212
    begin
213
      Append;
214
      FieldValues['_Cycle_'] := Cycle ;
215
      FieldValues['_Profil_'] := FBesLactE.CBProfil.Text ;
216
      FieldValues['_DureeLact_'] := PPRofilT.DureeLact ;
217
      FieldValues['_Sevres_'] := PProfilT.Porcelets[Cycle].Sevres ;
218
      FieldValues['_GMQPort_'] := (PProfilT.Porcelets[Cycle].PdsSev - PProfilT.Porcelets[Cycle].PdsNais) * PProfilT.Porcelets[Cycle].Sevres / PPRofilT.DureeLact ;
219
      FieldValues['_PdsMB_'] := PProfilT.Truies[Cycle].PdsApMB ;
220
      FieldValues['_P2MB_'] := PProfilT.Truies[Cycle].P2MB ;
221
      FieldValues['_BesEMEnt_'] := FBesLactE.BesEMEntTot[Cycle] ;
222
      FieldValues['_BesEMLait_'] := FBesLactE.BesEMLaitTot[Cycle] ;
223
      FieldValues['_BesEMTot_'] := FBesLactE.BesEMTot[Cycle] ;
224
      FieldValues['_AppED_'] := FBesLactE.AppEDTot[Cycle] ;
225
      FieldValues['_AppEM_'] := FBesLactE.AppEMTot[Cycle] ;
226
      FieldValues['_AppEN_'] := FBesLactE.AppENTot[Cycle] ;
227
      if (FBesLactE.AppEMTot[Cycle] = 0)
228
      then
229
        FieldValues['_BesAli_'] := 0
230
      else
231
        FieldValues['_BesAli_'] := FBesLactE.BesEMTot[Cycle] * FBesLactE.AppAliTot[Cycle] / FBesLactE.AppEMTot[Cycle] ;
232
      if (FBesLactE.BesEMTot[Cycle] > FBesLactE.AppEMTot[Cycle] / PProfilT.DureeLact)
233
      then // D?ficit
234
      begin
235
        FieldValues['_DefEM_'] := FBesLactE.BesEMTot[Cycle] - FBesLactE.AppEMTot[Cycle] / PProfilT.DureeLact ;
236
        FieldValues['_DefAli_'] := FBesLactE.BesEMTot[Cycle] * FBesLactE.AppAliTot[Cycle] / FBesLactE.AppEMTot[Cycle] - FBesLactE.AppAliTot[Cycle] / PProfilT.DureeLact ;
237
      end
238
      else // Exc?s
239
      begin
240
        FieldValues['_DefEM_'] := 0 ;
241
        FieldValues['_DefAli_'] := 0 ;
242
      end ;
243
      FieldValues['_Lys_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 1], PProfilT.DureeLact)) ;
244
      FieldValues['_Met_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 2], PProfilT.DureeLact)) ;
245
      FieldValues['_MetCys_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 13], PProfilT.DureeLact)) ;
246
      FieldValues['_Trp_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 4], PProfilT.DureeLact)) ;
247
      FieldValues['_Thr_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 5], PProfilT.DureeLact)) ;
248
      FieldValues['_Phe_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 6], PProfilT.DureeLact)) ;
249
      FieldValues['_PheTyr_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 14], PProfilT.DureeLact)) ;
250
      FieldValues['_Leu_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 8], PProfilT.DureeLact)) ;
251
      FieldValues['_Ile_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 9], PProfilT.DureeLact)) ;
252
      FieldValues['_Val_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 10], PProfilT.DureeLact)) ;
253
      FieldValues['_His_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 11], PProfilT.DureeLact)) ;
254
      FieldValues['_Arg_'] := Mean (Slice (FBesLactE.BesAA[Cycle, 12], PProfilT.DureeLact)) ;
255
      FieldValues['_P_'] := Mean (Slice (FBesLactE.BesP[Cycle], PProfilT.DureeLact)) ;
256
      FieldValues['_Ca_'] := Mean (Slice (FBesLactE.BesCa[Cycle], PProfilT.DureeLact)) ;
257
      Post;
258
    end ;
259
  end ;
260
  RegisterPreviewClass(TQRPrevRapInterface);
261
//  QRRapport.PreviewModal;
262
//  RegisterPreviewClass(TQRStandardPreviewInterface);
263
end;
264
265
end.