root / UFRapSensSimulP.pas @ 3
Historique | Voir | Annoter | Télécharger (13,439 ko)
1 | 3 | avalancogn | unit UFRapSensSimulP ;
|
---|---|---|---|
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 | TFRapSensSimulP = class(TForm)
|
||
12 | QRRapport: TQuickRep; |
||
13 | PHBRapport: TQRBand; |
||
14 | QRLTitre: TQRLabel; |
||
15 | PFBRapport: TQRBand; |
||
16 | QRLUser: TQRLabel; |
||
17 | QRLWarning: TQRLabel; |
||
18 | QRSDDate: TQRSysData; |
||
19 | QRSEntete: TQRShape; |
||
20 | CDSRapport: TClientDataSet; |
||
21 | IFAgeDeb_1: TIntegerField; |
||
22 | IFAgeFin_1: TIntegerField; |
||
23 | FFPoidsDeb_1: TFloatField; |
||
24 | FFPoidsFin_1: TFloatField; |
||
25 | FFConso_1: TFloatField; |
||
26 | FFIngere_1: TFloatField; |
||
27 | FFTMP_1: TFloatField; |
||
28 | FFP2_1: TFloatField; |
||
29 | FFRC_1: TFloatField; |
||
30 | IFAgeDeb_2: TIntegerField; |
||
31 | IFAgeFin_2: TIntegerField; |
||
32 | FFPoidsDeb_2: TFloatField; |
||
33 | FFPoidsFin_2: TFloatField; |
||
34 | FFConso_2: TFloatField; |
||
35 | FFIngere_2: TFloatField; |
||
36 | FFTMP_2: TFloatField; |
||
37 | FFP2_2: TFloatField; |
||
38 | FFRC_2: TFloatField; |
||
39 | IFAgeDeb_3: TIntegerField; |
||
40 | IFAgeFin_3: TIntegerField; |
||
41 | FFPoidsDeb_3: TFloatField; |
||
42 | FFPoidsFin_3: TFloatField; |
||
43 | FFConso_3: TFloatField; |
||
44 | FFIngere_3: TFloatField; |
||
45 | FFTMP_3: TFloatField; |
||
46 | FFP2_3: TFloatField; |
||
47 | FFRC_3: TFloatField; |
||
48 | IFAgeDeb_4: TIntegerField; |
||
49 | IFAgeFin_4: TIntegerField; |
||
50 | FFPoidsDeb_4: TFloatField; |
||
51 | FFPoidsFin_4: TFloatField; |
||
52 | FFConso_4: TFloatField; |
||
53 | FFIngere_4: TFloatField; |
||
54 | FFTMP_4: TFloatField; |
||
55 | FFP2_4: TFloatField; |
||
56 | FFRC_4: TFloatField; |
||
57 | IFAgeDeb_5: TIntegerField; |
||
58 | IFAgeFin_5: TIntegerField; |
||
59 | FFPoidsDeb_5: TFloatField; |
||
60 | FFPoidsFin_5: TFloatField; |
||
61 | FFConso_5: TFloatField; |
||
62 | FFIngere_5: TFloatField; |
||
63 | FFTMP_5: TFloatField; |
||
64 | FFP2_5: TFloatField; |
||
65 | FFRC_5: TFloatField; |
||
66 | CDSSimul: TClientDataSet; |
||
67 | SFSimul: TStringField; |
||
68 | DBRapport: TQRBand; |
||
69 | QRDBTRC_5: TQRDBText; |
||
70 | QRDBTP2_5: TQRDBText; |
||
71 | QRDBTTMP_5: TQRDBText; |
||
72 | QRDBTAliTot_5: TQRDBText; |
||
73 | QRDBTAgeFin_5: TQRDBText; |
||
74 | QRDBTAgeDeb_5: TQRDBText; |
||
75 | QRDBTPoidsFin_5: TQRDBText; |
||
76 | QRDBTPoidsDeb_5: TQRDBText; |
||
77 | QREDuree_5: TQRExpr; |
||
78 | QREGMQ_5: TQRExpr; |
||
79 | QREAliMoy_5: TQRExpr; |
||
80 | QREPD_5: TQRExpr; |
||
81 | QRELD_5: TQRExpr; |
||
82 | QREWastage_5: TQRExpr; |
||
83 | QRDBTRC_4: TQRDBText; |
||
84 | QRDBTP2_4: TQRDBText; |
||
85 | QRDBTTMP_4: TQRDBText; |
||
86 | QRDBTAliTot_4: TQRDBText; |
||
87 | QRDBTAgeFin_4: TQRDBText; |
||
88 | QRDBTAgeDeb_4: TQRDBText; |
||
89 | QRDBTPoidsFin_4: TQRDBText; |
||
90 | QRDBTPoidsDeb_4: TQRDBText; |
||
91 | QREDuree_4: TQRExpr; |
||
92 | QREGMQ_4: TQRExpr; |
||
93 | QREAliMoy_4: TQRExpr; |
||
94 | QREPD_4: TQRExpr; |
||
95 | QRELD_4: TQRExpr; |
||
96 | QREWastage_4: TQRExpr; |
||
97 | QRDBTRC_3: TQRDBText; |
||
98 | QRDBTP2_3: TQRDBText; |
||
99 | QRDBTTMP_3: TQRDBText; |
||
100 | QRDBTAliTot_3: TQRDBText; |
||
101 | QRDBTAgeFin_3: TQRDBText; |
||
102 | QRDBTAgeDeb_3: TQRDBText; |
||
103 | QRDBTPoidsFin_3: TQRDBText; |
||
104 | QRDBTPoidsDeb_3: TQRDBText; |
||
105 | QREDuree_3: TQRExpr; |
||
106 | QREGMQ_3: TQRExpr; |
||
107 | QREAliMoy_3: TQRExpr; |
||
108 | QREPD_3: TQRExpr; |
||
109 | QRELD_3: TQRExpr; |
||
110 | QREWastage_3: TQRExpr; |
||
111 | QRDBTRC_2: TQRDBText; |
||
112 | QRDBTP2_2: TQRDBText; |
||
113 | QRDBTTMP_2: TQRDBText; |
||
114 | QRDBTAliTot_2: TQRDBText; |
||
115 | QRDBTAgeFin_2: TQRDBText; |
||
116 | QRDBTAgeDeb_2: TQRDBText; |
||
117 | QRDBTPoidsFin_2: TQRDBText; |
||
118 | QRDBTPoidsDeb_2: TQRDBText; |
||
119 | QREDuree_2: TQRExpr; |
||
120 | QREGMQ_2: TQRExpr; |
||
121 | QREAliMoy_2: TQRExpr; |
||
122 | QREPD_2: TQRExpr; |
||
123 | QRELD_2: TQRExpr; |
||
124 | QREWastage_2: TQRExpr; |
||
125 | QREWastage_1: TQRExpr; |
||
126 | QRELD_1: TQRExpr; |
||
127 | QREPD_1: TQRExpr; |
||
128 | QREAliMoy_1: TQRExpr; |
||
129 | QREGMQ_1: TQRExpr; |
||
130 | QREDuree_1: TQRExpr; |
||
131 | QRLPerf: TQRLabel; |
||
132 | QRLPoidsDeb: TQRLabel; |
||
133 | QRLPoidsFin: TQRLabel; |
||
134 | QRDBTPoidsDeb_1: TQRDBText; |
||
135 | QRDBTPoidsFin_1: TQRDBText; |
||
136 | QRLAgeDeb: TQRLabel; |
||
137 | QRLAgeFin: TQRLabel; |
||
138 | QRDBTAgeDeb_1: TQRDBText; |
||
139 | QRDBTAgeFin_1: TQRDBText; |
||
140 | QRLDuree: TQRLabel; |
||
141 | QRLGMQ: TQRLabel; |
||
142 | QRLPD: TQRLabel; |
||
143 | QRLLD: TQRLabel; |
||
144 | QRLAliTot: TQRLabel; |
||
145 | QRLAliMoy: TQRLabel; |
||
146 | QRDBTAliTot_1: TQRDBText; |
||
147 | QRLWastage: TQRLabel; |
||
148 | QRLFeed: TQRLabel; |
||
149 | QRLTMP: TQRLabel; |
||
150 | QRDBTTMP_1: TQRDBText; |
||
151 | QRLP2: TQRLabel; |
||
152 | QRDBTP2_1: TQRDBText; |
||
153 | QRLRC: TQRLabel; |
||
154 | QRDBTRC_1: TQRDBText; |
||
155 | QRLCaract: TQRLabel; |
||
156 | QRLSimulNo: TQRLabel; |
||
157 | QRLNo1: TQRLabel; |
||
158 | QRLabel1: TQRLabel; |
||
159 | QRLabel2: TQRLabel; |
||
160 | QRLabel3: TQRLabel; |
||
161 | QRLabel4: TQRLabel; |
||
162 | QRSDRapport: TQRSubDetail; |
||
163 | QRDBTProfil: TQRDBText; |
||
164 | QRLProfil: TQRLabel; |
||
165 | QRLSeqAli: TQRLabel; |
||
166 | QRLRation: TQRLabel; |
||
167 | QRDBTSeqAli: TQRDBText; |
||
168 | QRDBTRation: TQRDBText; |
||
169 | QRDBTSimulNo: TQRDBText; |
||
170 | QRDBTVariation: TQRDBText; |
||
171 | QRLVariation: TQRLabel; |
||
172 | SFProfil: TStringField; |
||
173 | SFSeqAli: TStringField; |
||
174 | SFRation: TStringField; |
||
175 | SFVariation: TStringField; |
||
176 | CDSRapport_Simul_: TStringField; |
||
177 | QRLSimul: TQRLabel; |
||
178 | QRDBTSimul: TQRDBText; |
||
179 | QRLMemo: TQRLabel; |
||
180 | QRMMemo: TQRMemo; |
||
181 | QRIInraPorc: TQRImage; |
||
182 | QRLInraPorc: TQRLabel; |
||
183 | FFpDeb_1: TFloatField; |
||
184 | FFpFin_1: TFloatField; |
||
185 | FFlDeb_1: TFloatField; |
||
186 | FFlFin_1: TFloatField; |
||
187 | FFpDeb_2: TFloatField; |
||
188 | FFpFin_2: TFloatField; |
||
189 | FFlDeb_2: TFloatField; |
||
190 | FFlFin_2: TFloatField; |
||
191 | FFpDeb_3: TFloatField; |
||
192 | FFpFin_3: TFloatField; |
||
193 | FFlDeb_3: TFloatField; |
||
194 | FFlFin_3: TFloatField; |
||
195 | FFpDeb_4: TFloatField; |
||
196 | FFpFin_4: TFloatField; |
||
197 | FFlDeb_4: TFloatField; |
||
198 | FFlFin_4: TFloatField; |
||
199 | FFpDeb_5: TFloatField; |
||
200 | FFpFin_5: TFloatField; |
||
201 | FFlDeb_5: TFloatField; |
||
202 | FFlFin_5: TFloatField; |
||
203 | QREFeed_5: TQRExpr; |
||
204 | QREFeed_4: TQRExpr; |
||
205 | QREFeed_3: TQRExpr; |
||
206 | QREFeed_2: TQRExpr; |
||
207 | QREFeed_1: TQRExpr; |
||
208 | procedure FormCreate(Sender: TObject);
|
||
209 | private
|
||
210 | { D?clarations priv?es }
|
||
211 | public
|
||
212 | { D?clarations publiques }
|
||
213 | end;
|
||
214 | |||
215 | var
|
||
216 | FRapSensSimulP: TFRapSensSimulP; |
||
217 | |||
218 | implementation
|
||
219 | |||
220 | uses
|
||
221 | UStrings, UFindRec, UCalcul, UUtil, UFSimulP, UFPrevRap ; |
||
222 | |||
223 | {$R *.dfm}
|
||
224 | |||
225 | { TFRapSimulP }
|
||
226 | |||
227 | procedure TFRapSensSimulP.FormCreate(Sender: TObject);
|
||
228 | var
|
||
229 | i, k, t: integer; |
||
230 | c: double; |
||
231 | begin
|
||
232 | if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
||
233 | then
|
||
234 | Font.Name := 'Arial Unicode MS';
|
||
235 | TranslateComponent(Self); |
||
236 | // Licence
|
||
237 | if IsEducation and (Length (Course) > 0) |
||
238 | then
|
||
239 | QRLUSer.Caption := Format('%s (%s)', [Course, Company])
|
||
240 | else
|
||
241 | if IsComplete or IsEducation |
||
242 | then
|
||
243 | QRLUSer.Caption := Format('%s %s (%s)', [FirstName, LastName, Company])
|
||
244 | else
|
||
245 | if IsEvaluation
|
||
246 | then
|
||
247 | QRLUSer.Caption := StrEvaluation |
||
248 | else
|
||
249 | begin
|
||
250 | QRLUSer.Caption := StrReadOnly; |
||
251 | QRLUser.Font.Color := clRed; |
||
252 | end;
|
||
253 | with CDSSimul do |
||
254 | begin
|
||
255 | CreateDataSet; |
||
256 | for k := 1 to 5 do |
||
257 | begin
|
||
258 | Append; |
||
259 | FieldValues['_Simul_'] := Format (StrSimulNo, [k]);
|
||
260 | FieldValues['_Variation_'] := Format (StrVariation, [FSimulP.CBVariable.Items[FSimulP.CBVariable.ItemIndex], TabSimulP[k].Variation * 100]); |
||
261 | Post; |
||
262 | end;
|
||
263 | end;
|
||
264 | with CDSRapport do |
||
265 | begin
|
||
266 | CreateDataSet; |
||
267 | Append; |
||
268 | for k := 1 to 5 do |
||
269 | begin
|
||
270 | t := TabSimulP[k].Result.NbJSim; |
||
271 | PSimulP := ListSimulP[FindIdxSimulP (FSimulP.CBSensSimul.Text)]; |
||
272 | PProfilP := ListProfilP[FindIdxProfilP (FindNomProfilP (PSimulP.Profil))]; |
||
273 | FieldValues['_Simul_'] := PSimulP.Nom;
|
||
274 | FieldValues['_Profil_'] := FindNomProfilP (PSimulP.Profil);
|
||
275 | FieldValues['_SeqAli_'] := FindNomSeqAliP (PSimulP.SeqAli);
|
||
276 | FieldValues['_Ration_'] := FindNomRationP (PSimulP.Ration);
|
||
277 | FieldValues[Format('_AgeDeb_%d_', [k])] := TabSimulP[k].Result.TabResult[1, 1]; |
||
278 | FieldValues[Format('_AgeFin_%d_', [k])] := TabSimulP[k].Result.TabResult[1, t] + 1; |
||
279 | FieldValues[Format('_PoidsDeb_%d_', [k])] := TabSimulP[k].Result.TabResult[2, 1]; |
||
280 | FieldValues[Format('_PoidsFin_%d_', [k])] := TabSimulP[k].Result.TabResult[2, t] + TabSimulP[k].Result.TabResult[84, t]; |
||
281 | FieldValues[Format('_pDeb_%d_', [k])] := TabSimulP[k].Result.TabResult[49, 1]; |
||
282 | FieldValues[Format('_pFin_%d_', [k])] := TabSimulP[k].Result.TabResult[49, t] + TabSimulP[k].Result.TabResult[79, t] / 1000; |
||
283 | FieldValues[Format('_lDeb_%d_', [k])] := TabSimulP[k].Result.TabResult[50, 1]; |
||
284 | FieldValues[Format('_lFin_%d_', [k])] := TabSimulP[k].Result.TabResult[50, t] + TabSimulP[k].Result.TabResult[80, t] / 1000; |
||
285 | c := 0;
|
||
286 | for i := 1 to t do |
||
287 | c := c + TabSimulP[k].Result.TabResult[113, i];
|
||
288 | FieldValues[Format('_Conso_%d_', [k])] := c;
|
||
289 | c := 0;
|
||
290 | for i := 1 to t do |
||
291 | c := c + TabSimulP[k].Result.TabResult[11, i];
|
||
292 | FieldValues[Format('_Ingere_%d_', [k])] := c;
|
||
293 | if FatInfo = 0 |
||
294 | then // P2 |
||
295 | FieldValues[Format('_P2_%d_', [k])] := CalcP2(FieldValues[Format('_lFin_%d_', [k])]) |
||
296 | else // User defined |
||
297 | FieldValues[Format('_P2_%d_', [k])] := CalcUserFat(CalcPVV(FieldValues[Format('_PoidsFin_%d_', [k])]), FieldValues[Format('_pFin_%d_', [k])], FieldValues[Format('_lFin_%d_', [k])]); |
||
298 | if LeanInfo = 0 |
||
299 | then // TMP |
||
300 | FieldValues[Format('_TMP_%d_', [k])] := CalcTMP(CalcPVV(FieldValues[Format('_PoidsFin_%d_', [k])]), FieldValues[Format('_pFin_%d_', [k])], FieldValues[Format('_lFin_%d_', [k])]) |
||
301 | else // User defined |
||
302 | FieldValues[Format('_TMP_%d_', [k])] := CalcUserLean(CalcPVV(FieldValues[Format('_PoidsFin_%d_', [k])]), FieldValues[Format('_pFin_%d_', [k])], FieldValues[Format('_lFin_%d_', [k])]); |
||
303 | FieldValues[Format('_RC_%d_', [k])] := CalcRC(FieldValues[Format('_PoidsFin_%d_', [k])], CalcRCStd(PProfilP.PVFin, PProfilP.Carcasse), FieldValues[Format('_PoidsFin_%d_', [k])]) * 100; |
||
304 | end;
|
||
305 | Post; |
||
306 | end;
|
||
307 | QRMMemo.Lines.Add(FSimulP.CBSensSimul.Hint); |
||
308 | if FeedInfo = 0 |
||
309 | then // Indice de consommation |
||
310 | QREFeed_1.Expression := 'IF(CDSRapport._PoidsDeb_1_ = CDSRapport._PoidsFin_1_, 0, CDSRapport._Conso_1_ / (CDSRapport._PoidsFin_1_ - CDSRapport._PoidsDeb_1_))'
|
||
311 | else // Efficacit? alimentaire |
||
312 | QREFeed_1.Expression := 'IF(CDSRapport._Conso_1_ = 0, 0, (CDSRapport._PoidsFin_1_ - CDSRapport._PoidsDeb_1_) / CDSRapport._Conso_1_)';
|
||
313 | if FeedInfo = 0 |
||
314 | then // Indice de consommation |
||
315 | QREFeed_2.Expression := 'IF(CDSRapport._PoidsDeb_2_ = CDSRapport._PoidsFin_2_, 0, CDSRapport._Conso_2_ / (CDSRapport._PoidsFin_2_ - CDSRapport._PoidsDeb_2_))'
|
||
316 | else // Efficacit? alimentaire |
||
317 | QREFeed_2.Expression := 'IF(CDSRapport._Conso_2_ = 0, 0, (CDSRapport._PoidsFin_2_ - CDSRapport._PoidsDeb_2_) / CDSRapport._Conso_2_)';
|
||
318 | if FeedInfo = 0 |
||
319 | then // Indice de consommation |
||
320 | QREFeed_3.Expression := 'IF(CDSRapport._PoidsDeb_3_ = CDSRapport._PoidsFin_3_, 0, CDSRapport._Conso_3_ / (CDSRapport._PoidsFin_3_ - CDSRapport._PoidsDeb_3_))'
|
||
321 | else // Efficacit? alimentaire |
||
322 | QREFeed_3.Expression := 'IF(CDSRapport._Conso_3_ = 0, 0, (CDSRapport._PoidsFin_3_ - CDSRapport._PoidsDeb_3_) / CDSRapport._Conso_3_)';
|
||
323 | if FeedInfo = 0 |
||
324 | then // Indice de consommation |
||
325 | QREFeed_4.Expression := 'IF(CDSRapport._PoidsDeb_4_ = CDSRapport._PoidsFin_4_, 0, CDSRapport._Conso_4_ / (CDSRapport._PoidsFin_4_ - CDSRapport._PoidsDeb_4_))'
|
||
326 | else // Efficacit? alimentaire |
||
327 | QREFeed_4.Expression := 'IF(CDSRapport._Conso_4_ = 0, 0, (CDSRapport._PoidsFin_4_ - CDSRapport._PoidsDeb_4_) / CDSRapport._Conso_4_)';
|
||
328 | if FeedInfo = 0 |
||
329 | then // Indice de consommation |
||
330 | QREFeed_5.Expression := 'IF(CDSRapport._PoidsDeb_5_ = CDSRapport._PoidsFin_5_, 0, CDSRapport._Conso_5_ / (CDSRapport._PoidsFin_5_ - CDSRapport._PoidsDeb_5_))'
|
||
331 | else // Efficacit? alimentaire |
||
332 | QREFeed_5.Expression := 'IF(CDSRapport._Conso_5_ = 0, 0, (CDSRapport._PoidsFin_5_ - CDSRapport._PoidsDeb_5_) / CDSRapport._Conso_5_)';
|
||
333 | QRLAgeDeb.Caption := Format('%s (%s)', [QRLAgeDeb.Caption, _('d')]); |
||
334 | QRLAgeFin.Caption := Format('%s (%s)', [QRLAgeFin.Caption, _('d')]); |
||
335 | QRLDuree.Caption := Format('%s (%s)', [QRLDuree.Caption, _('d')]); |
||
336 | QRLPoidsDeb.Caption := Format('%s (%s)', [QRLPoidsDeb.Caption, _('kg')]); |
||
337 | QRLPoidsFin.Caption := Format('%s (%s)', [QRLPoidsFin.Caption, _('kg')]); |
||
338 | QRLGMQ.Caption := Format('%s (%s/%s)', [QRLGMQ.Caption, _('g'), _('d')]); |
||
339 | QRLPD.Caption := Format('%s (%s/%s)', [QRLPD.Caption, _('g'), _('d')]); |
||
340 | QRLLD.Caption := Format('%s (%s/%s)', [QRLLD.Caption, _('g'), _('d')]); |
||
341 | QRLAliTot.Caption := Format('%s (%s)', [QRLAliTot.Caption, _('kg')]); |
||
342 | QRLAliMoy.Caption := Format('%s (%s/%s)', [QRLAliMoy.Caption, _('g'), _('d')]); |
||
343 | QRLWastage.Caption := Format('%s (%%)', [QRLWastage.Caption]);
|
||
344 | if FeedInfo = 0 |
||
345 | then // Indice de consommation |
||
346 | QRLFeed.Caption := Format('%s (%s/%s)', [_('Average feed-to-gain ratio'), _('kg feed'), _('kg gain')]) |
||
347 | else // Efficacit? alimentaire |
||
348 | QRLFeed.Caption := Format('%s (%s/%s)', [_('Average gain-to-feed ratio'), _('kg gain'), _('kg feed')]); |
||
349 | if FatInfo = 0 |
||
350 | then // P2 |
||
351 | QRLP2.Caption := Format('%s (%s)', [_('Backfat thickness at slaughter'), _('mm')]) |
||
352 | else // User defined |
||
353 | if Length(UserFatLongName) = 0 |
||
354 | then
|
||
355 | QRLP2.Caption := Format('%s (%s)', [_('User-defined backfat thickness'), _('mm')]) |
||
356 | else
|
||
357 | QRLP2.Caption := Format('%s (%s)', [UserFatLongName, _('mm')]); |
||
358 | if LeanInfo = 0 |
||
359 | then // TMP |
||
360 | QRLTMP.Caption := Format('%s (%%)', [_('Lean meat at slaughter')]) |
||
361 | else // User defined |
||
362 | if Length(UserLeanLongName) = 0 |
||
363 | then
|
||
364 | QRLTMP.Caption := Format('%s (%%)', [_('User-defined lean meat')]) |
||
365 | else
|
||
366 | QRLTMP.Caption := Format('%s (%%)', [UserLeanLongName]);
|
||
367 | QRLRC.Caption := Format('%s (%%)', [QRLRC.Caption]);
|
||
368 | RegisterPreviewClass(TQRPrevRapInterface); |
||
369 | // QRRapport.PreviewModal;
|
||
370 | // RegisterPreviewClass(TQRStandardPreviewInterface);
|
||
371 | end;
|
||
372 | |||
373 | end. |