Statistiques
| Révision:

root / UFRapRationT.pas

Historique | Voir | Annoter | Télécharger (3,344 ko)

1 3 avalancogn
unit UFRapRationT ;
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
  TFRapRationT = class(TForm)
12
    QRRapport: TQuickRep;
13
    PHBRapport: TQRBand;
14
    DBRapport: TQRBand;
15
    QRLTitre: TQRLabel;
16
    QRLRation: TQRLabel;
17
    QRDBTRation: TQRDBText;
18
    CDSRapport: TClientDataSet;
19
    SFRation: TStringField;
20
    PFBRapport: TQRBand;
21
    QRLUser: TQRLabel;
22
    QRLWarning: TQRLabel;
23
    QRLMemo: TQRLabel;
24
    QRMMemo: TQRMemo;
25
    QRSDDate: TQRSysData;
26
    QRSEntete: TQRShape;
27
    DSRelation: TDataSource;
28
    CDSRegles: TClientDataSet;
29
    SFIndex: TStringField;
30
    IFNo: TIntegerField;
31
    SFModeFin: TStringField;
32
    SFConso: TStringField;
33
    QRLRegles: TQRLabel;
34
    QRLNo: TQRLabel;
35
    QRShape2: TQRShape;
36
    QRLModeFin: TQRLabel;
37
    QRLConso: TQRLabel;
38
    QRSDRegles: TQRSubDetail;
39
    QRDBTConso: TQRDBText;
40
    QRDBTNo: TQRDBText;
41
    QRDBTModeFin: TQRDBText;
42
    CDSRapport_StrEtat_: TStringField;
43
    CDSRapport_Etat_: TIntegerField;
44
    CDSRegles_Etat_: TIntegerField;
45
    TBRapport: TQRBand;
46
    QRDBTEtat: TQRDBText;
47
    QRIInraPorc: TQRImage;
48
    QRLInraPorc: TQRLabel;
49
    procedure FormCreate(Sender: TObject);
50
  private
51
    { D?clarations priv?es }
52
  public
53
    { D?clarations publiques }
54
  end;
55
56
var
57
  FRapRationT: TFRapRationT;
58
59
implementation
60
61
uses
62
  UStrings, UUtil, UFRationT, UFPrevRap ;
63
64
{$R *.dfm}
65
66
{ TFRapRationT }
67
68
procedure TFRapRationT.FormCreate(Sender: TObject);
69
var
70
  etat, regle, nb : integer;
71
begin
72
  if Screen.Fonts.IndexOf('Arial Unicode MS') <> -1
73
  then
74
    Font.Name := 'Arial Unicode MS';
75
  TranslateComponent(Self);
76
  // Licence
77
  if IsEducation and (Length (Course) > 0)
78
  then
79
    QRLUSer.Caption := Format('%s (%s)', [Course, Company])
80
  else
81
  if IsComplete or IsEducation
82
  then
83
    QRLUSer.Caption := Format('%s %s (%s)', [FirstName, LastName, Company])
84
  else
85
  if IsEvaluation
86
  then
87
    QRLUSer.Caption := StrEvaluation
88
  else
89
  begin
90
    QRLUSer.Caption := StrReadOnly;
91
    QRLUser.Font.Color := clRed;
92
  end;
93
  with CDSRapport do
94
  begin
95
    CreateDataSet;
96
    for etat := 0 to 2 do
97
    begin
98
      Append;
99
      FieldValues['_Ration_'] := FRationT.CBRation.Text;
100
      FieldValues['_Etat_'] := etat;
101
      FieldValues['_StrEtat_'] := FRationT.TC.Tabs[etat];
102
      Post;
103
    end;
104
  end ;
105
  QRMMemo.Lines.Add(FRationT.CBRation.Hint);
106
  with CDSRegles do
107
  begin
108
    CreateDataSet;
109
    for etat := 0 to 2 do
110
    begin
111
      case etat of
112
        0 : // Gestation
113
          nb := PRationT.NbRuleGest;
114
        1 : // Lactation
115
          nb := PRationT.NbRuleLact;
116
        else // I.S.S.F.
117
          nb := PRationT.NbRuleISSF;
118
      end;
119
      for regle := 1 to nb do
120
      begin
121
        Append;
122
        FieldValues['_Ration_'] := FRationT.CBRation.Text;
123
        FieldValues['_Etat_'] := etat;
124
        FieldValues['_No_'] := regle;
125
        FieldValues['_ModeFin_'] := FRationT.StrModeFin(etat, regle);
126
        FieldValues['_Conso_'] := FRationT.StrEquation(etat, regle);
127
        Post;
128
      end;
129
    end;
130
  end;
131
  RegisterPreviewClass(TQRPrevRapInterface);
132
//  QRRapport.PreviewModal;
133
//  RegisterPreviewClass(TQRStandardPreviewInterface);
134
end;
135
136
end.