root / UFRapSimulP.pas @ 3
Historique | Voir | Annoter | Télécharger (7,147 ko)
1 | 3 | avalancogn | unit UFRapSimulP ;
|
---|---|---|---|
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 | TFRapSimulP = class(TForm)
|
||
12 | QRRapport: TQuickRep; |
||
13 | PHBRapport: TQRBand; |
||
14 | DBRapport: TQRBand; |
||
15 | QRLTitre: TQRLabel; |
||
16 | QRLCaract: TQRLabel; |
||
17 | QRLPerf: TQRLabel; |
||
18 | QRLSimul: TQRLabel; |
||
19 | QRLProfil: TQRLabel; |
||
20 | QRLSeqAli: TQRLabel; |
||
21 | QRLRation: TQRLabel; |
||
22 | QRLPoidsDeb: TQRLabel; |
||
23 | QRLPoidsFin: TQRLabel; |
||
24 | QRDBTSimul: TQRDBText; |
||
25 | QRDBTProfil: TQRDBText; |
||
26 | QRDBTSeqAli: TQRDBText; |
||
27 | QRDBTRation: TQRDBText; |
||
28 | QRDBTPoidsDeb: TQRDBText; |
||
29 | QRDBTPoidsFin: TQRDBText; |
||
30 | QRLAgeDeb: TQRLabel; |
||
31 | QRLAgeFin: TQRLabel; |
||
32 | QRDBTAgeDeb: TQRDBText; |
||
33 | QRDBTAgeFin: TQRDBText; |
||
34 | QRLDuree: TQRLabel; |
||
35 | QRLGMQ: TQRLabel; |
||
36 | QREDuree: TQRExpr; |
||
37 | QREGMQ: TQRExpr; |
||
38 | QRLPD: TQRLabel; |
||
39 | QRLLD: TQRLabel; |
||
40 | QRLAliTot: TQRLabel; |
||
41 | QRLAliMoy: TQRLabel; |
||
42 | QRDBTAliTot: TQRDBText; |
||
43 | QREAliMoy: TQRExpr; |
||
44 | QREPD: TQRExpr; |
||
45 | QRELD: TQRExpr; |
||
46 | QRLWastage: TQRLabel; |
||
47 | QRLTMP: TQRLabel; |
||
48 | QRDBTTMP: TQRDBText; |
||
49 | QRLP2: TQRLabel; |
||
50 | QRDBTP2: TQRDBText; |
||
51 | CDSRapport: TClientDataSet; |
||
52 | SFSimul: TStringField; |
||
53 | SFProfil: TStringField; |
||
54 | SFSeqAli: TStringField; |
||
55 | SFRation: TStringField; |
||
56 | IFAgeDeb: TIntegerField; |
||
57 | IFAgeFin: TIntegerField; |
||
58 | FFPoidsDeb: TFloatField; |
||
59 | FFPoidsFin: TFloatField; |
||
60 | FFpFin: TFloatField; |
||
61 | FFlFin: TFloatField; |
||
62 | FFConso: TFloatField; |
||
63 | FFTMP: TFloatField; |
||
64 | FFP2: TFloatField; |
||
65 | PFBRapport: TQRBand; |
||
66 | QRLUser: TQRLabel; |
||
67 | QRLWarning: TQRLabel; |
||
68 | QRLMemo: TQRLabel; |
||
69 | QRMMemo: TQRMemo; |
||
70 | QRSDDate: TQRSysData; |
||
71 | QRSEntete: TQRShape; |
||
72 | QRLRC: TQRLabel; |
||
73 | QRDBTRC: TQRDBText; |
||
74 | FFRC: TFloatField; |
||
75 | QRIInraPorc: TQRImage; |
||
76 | QRLInraPorc: TQRLabel; |
||
77 | QRLFeed: TQRLabel; |
||
78 | QREFeed: TQRExpr; |
||
79 | QREWastage: TQRExpr; |
||
80 | FFIngere: TFloatField; |
||
81 | FFpDeb: TFloatField; |
||
82 | FFlDeb: TFloatField; |
||
83 | procedure FormCreate(Sender: TObject);
|
||
84 | private
|
||
85 | { D?clarations priv?es }
|
||
86 | public
|
||
87 | { D?clarations publiques }
|
||
88 | end;
|
||
89 | |||
90 | var
|
||
91 | FRapSimulP: TFRapSimulP; |
||
92 | |||
93 | implementation
|
||
94 | |||
95 | uses
|
||
96 | UStrings, UCalcul, UUtil, UFSimulP, UFPrevRap ; |
||
97 | |||
98 | {$R *.dfm}
|
||
99 | |||
100 | { TFRapSimulP }
|
||
101 | |||
102 | procedure TFRapSimulP.FormCreate(Sender: TObject);
|
||
103 | var
|
||
104 | i, t: integer; |
||
105 | c: double; |
||
106 | begin
|
||
107 | if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1 |
||
108 | then
|
||
109 | Font.Name := 'Arial Unicode MS';
|
||
110 | TranslateComponent(Self); |
||
111 | // Licence
|
||
112 | if IsEducation and (Length (Course) > 0) |
||
113 | then
|
||
114 | QRLUSer.Caption := Format('%s (%s)', [Course, Company])
|
||
115 | else
|
||
116 | if IsComplete or IsEducation |
||
117 | then
|
||
118 | QRLUSer.Caption := Format('%s %s (%s)', [FirstName, LastName, Company])
|
||
119 | else
|
||
120 | if IsEvaluation
|
||
121 | then
|
||
122 | QRLUSer.Caption := StrEvaluation |
||
123 | else
|
||
124 | begin
|
||
125 | QRLUSer.Caption := StrReadOnly; |
||
126 | QRLUser.Font.Color := clRed; |
||
127 | end;
|
||
128 | t := PResSimulP.NbJSim; |
||
129 | with CDSRapport do |
||
130 | begin
|
||
131 | CreateDataSet; |
||
132 | Append; |
||
133 | FieldValues['_Simul_'] := FSimulP.CBSimul.Text;
|
||
134 | FieldValues['_Profil_'] := FSimulP.CBProfil.Text;
|
||
135 | FieldValues['_SeqAli_'] := FSimulP.CBSeqAli.Text;
|
||
136 | FieldValues['_Ration_'] := FSimulP.CBRation.Text;
|
||
137 | FieldValues['_AgeDeb_'] := PResSimulP.TabResult[1, 1]; |
||
138 | FieldValues['_AgeFin_'] := PResSimulP.TabResult[1, t] + 1; |
||
139 | FieldValues['_PoidsDeb_'] := PResSimulP.TabResult[2, 1]; |
||
140 | FieldValues['_PoidsFin_'] := PResSimulP.TabResult[83, t]; |
||
141 | FieldValues['_pDeb_'] := PResSimulP.TabResult[49, 1]; |
||
142 | FieldValues['_pFin_'] := PResSimulP.TabResult[49, t] + PResSimulP.TabResult[79, t] / 1000; |
||
143 | FieldValues['_lDeb_'] := PResSimulP.TabResult[50, 1]; |
||
144 | FieldValues['_lFin_'] := PResSimulP.TabResult[50, t] + PResSimulP.TabResult[80, t] / 1000; |
||
145 | c := 0;
|
||
146 | for i := 1 to t do |
||
147 | c := c + PResSimulP.TabResult[113, i];
|
||
148 | FieldValues['_Conso_'] := c;
|
||
149 | c := 0;
|
||
150 | for i := 1 to t do |
||
151 | c := c + PResSimulP.TabResult[11, i];
|
||
152 | FieldValues['_Ingere_'] := c;
|
||
153 | if FatInfo = 0 |
||
154 | then // P2 |
||
155 | FieldValues['_P2_'] := CalcP2(FieldValues['_lFin_']) |
||
156 | else // User defined |
||
157 | FieldValues['_P2_'] := CalcUserFat(CalcPVV(FieldValues['_PoidsFin_']), FieldValues['_pFin_'], FieldValues['_lFin_']); |
||
158 | if LeanInfo = 0 |
||
159 | then // TMP |
||
160 | FieldValues['_TMP_'] := CalcTMP(CalcPVV(FieldValues['_PoidsFin_']), FieldValues['_pFin_'], FieldValues['_lFin_']) |
||
161 | else // User defined |
||
162 | FieldValues['_TMP_'] := CalcUserLean(CalcPVV(FieldValues['_PoidsFin_']), FieldValues['_pFin_'], FieldValues['_lFin_']); |
||
163 | FieldValues['_RC_'] := CalcRC(FieldValues['_PoidsFin_'], CalcRCStd(PProfilP.PVFin, PProfilP.Carcasse), FieldValues['_PoidsFin_']) * 100; |
||
164 | Post; |
||
165 | end;
|
||
166 | QRMMemo.Lines.Add(FSimulP.CBSimul.Hint); |
||
167 | if FeedInfo = 0 |
||
168 | then // Indice de consommation |
||
169 | QREFeed.Expression := 'IF(CDSRapport._PoidsDeb_ = CDSRapport._PoidsFin_, 0, CDSRapport._Conso_ / (CDSRapport._PoidsFin_ - CDSRapport._PoidsDeb_))'
|
||
170 | else // Efficacit? alimentaire |
||
171 | QREFeed.Expression := 'IF(CDSRapport._Conso_ = 0, 0, (CDSRapport._PoidsFin_ - CDSRapport._PoidsDeb_) / CDSRapport._Conso_)';
|
||
172 | QRLAgeDeb.Caption := Format('%s (%s)', [QRLAgeDeb.Caption, _('d')]); |
||
173 | QRLAgeFin.Caption := Format('%s (%s)', [QRLAgeFin.Caption, _('d')]); |
||
174 | QRLDuree.Caption := Format('%s (%s)', [QRLDuree.Caption, _('d')]); |
||
175 | QRLPoidsDeb.Caption := Format('%s (%s)', [QRLPoidsDeb.Caption, _('kg')]); |
||
176 | QRLPoidsFin.Caption := Format('%s (%s)', [QRLPoidsFin.Caption, _('kg')]); |
||
177 | QRLGMQ.Caption := Format('%s (%s/%s)', [QRLGMQ.Caption, _('g'), _('d')]); |
||
178 | QRLPD.Caption := Format('%s (%s/%s)', [QRLPD.Caption, _('g'), _('d')]); |
||
179 | QRLLD.Caption := Format('%s (%s/%s)', [QRLLD.Caption, _('g'), _('d')]); |
||
180 | QRLAliTot.Caption := Format('%s (%s)', [QRLAliTot.Caption, _('kg')]); |
||
181 | QRLAliMoy.Caption := Format('%s (%s/%s)', [QRLAliMoy.Caption, _('g'), _('d')]); |
||
182 | QRLWastage.Caption := Format('%s (%%)', [QRLWastage.Caption]);
|
||
183 | if FeedInfo = 0 |
||
184 | then // Indice de consommation |
||
185 | QRLFeed.Caption := Format('%s (%s/%s)', [_('Average feed-to-gain ratio'), _('kg feed'), _('kg gain')]) |
||
186 | else // Efficacit? alimentaire |
||
187 | QRLFeed.Caption := Format('%s (%s/%s)', [_('Average gain-to-feed ratio'), _('kg gain'), _('kg feed')]); |
||
188 | if FatInfo = 0 |
||
189 | then // P2 |
||
190 | QRLP2.Caption := Format('%s (%s)', [_('Backfat thickness at slaughter'), _('mm')]) |
||
191 | else // User defined |
||
192 | if Length(UserFatLongName) = 0 |
||
193 | then
|
||
194 | QRLP2.Caption := Format('%s (%s)', [_('User-defined backfat thickness'), _('mm')]) |
||
195 | else
|
||
196 | QRLP2.Caption := Format('%s (%s)', [UserFatLongName, _('mm')]); |
||
197 | if LeanInfo = 0 |
||
198 | then // TMP |
||
199 | QRLTMP.Caption := Format('%s (%%)', [_('Lean meat at slaughter')]) |
||
200 | else // User defined |
||
201 | if Length(UserLeanLongName) = 0 |
||
202 | then
|
||
203 | QRLTMP.Caption := Format('%s (%%)', [_('User-defined lean meat')]) |
||
204 | else
|
||
205 | QRLTMP.Caption := Format('%s (%%)', [UserLeanLongName]);
|
||
206 | QRLRC.Caption := Format('%s (%%)', [QRLRC.Caption]);
|
||
207 | RegisterPreviewClass(TQRPrevRapInterface); |
||
208 | // QRRapport.PreviewModal;
|
||
209 | // RegisterPreviewClass(TQRStandardPreviewInterface);
|
||
210 | end;
|
||
211 | |||
212 | end. |