Develop and Download Open Source Software

Browse Subversion Repository

Diff of /Unit5.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by yamat0jp, Sun Nov 22 11:18:44 2015 UTC revision 10 by yamat0jp, Sat Jan 16 23:06:35 2016 UTC
# Line 6  uses Line 6  uses
6    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,
7    IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,    IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
8    IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,    IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
9    IWBaseHTMLControl, IWControl, IWCompButton;    IWBaseHTMLControl, IWControl, IWCompButton, IWCompGrids, IWCompListbox,
10      IWCompLabel, IWDBStdCtrls;
11    
12  type  type
13    TIWForm3 = class(TIWAppForm)    TIWForm3 = class(TIWAppForm)
     IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;  
14      IWButton1: TIWButton;      IWButton1: TIWButton;
15      IWButton2: TIWButton;      IWButton2: TIWButton;
16      IWButton3: TIWButton;      IWButton3: TIWButton;
17      IWButton4: TIWButton;      IWButton4: TIWButton;
18        IWGrid1: TIWGrid;
19        IWComboBox1: TIWComboBox;
20        IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
21        IWLabel1: TIWLabel;
22        IWLabel2: TIWLabel;
23        procedure IWButton1Click(Sender: TObject);
24        procedure IWAppFormRender(Sender: TObject);
25        procedure IWButton4Click(Sender: TObject);
26        procedure IWAppFormCreate(Sender: TObject);
27        procedure IWComboBox1Change(Sender: TObject);
28    public    public
29    end;    end;
30    
# Line 22  implementation Line 32  implementation
32    
33  {$R *.dfm}  {$R *.dfm}
34    
35    uses Unit3;
36    
37    procedure TIWForm3.IWAppFormCreate(Sender: TObject);
38    var
39      s: string;
40    begin
41      IWComboBox1.Items.Clear;
42      IWComboBox1.Items.Add(' -- All -- ');
43      IWComboBox1.ItemIndex := 0;
44      DM.FDQuery1.Open('select * from order_data order by email;');
45      while DM.FDQuery1.Eof = false do
46      begin
47        s := DM.FDQuery1.FieldByName('USER').AsString + '=' +
48          DM.FDQuery1.FieldByName('EMAIL').AsString;
49        if IWComboBox1.Items.IndexOf(s) = -1 then
50          IWComboBox1.Items.Add(s);
51        DM.FDQuery1.Next;
52      end;
53    end;
54    
55    procedure TIWForm3.IWAppFormRender(Sender: TObject);
56    var
57      i: integer;
58      j: integer;
59    begin
60      IWGrid1.RowCount := DM.FDQuery1.RecordCount + 1;
61      with IWGrid1 do
62      begin
63        Cell[0, 0].Text := '日付';
64        Cell[0, 1].Text := 'ご注文';
65        Cell[0, 2].Text := 'メーカー';
66        Cell[0, 3].Text := '個数';
67      end;
68      DM.FDQuery1.First;
69      for i := 1 to IWGrid1.RowCount - 1 do
70      begin
71        for j := 0 to IWGrid1.ColumnCount - 1 do
72          IWGrid1.Cell[i, j].Text := DM.FDQuery1.Fields.Fields[j + 4].AsString;
73        DM.FDQuery1.Next;
74      end;
75    end;
76    
77    procedure TIWForm3.IWButton1Click(Sender: TObject);
78    begin
79      IWAppFormCreate(Sender);
80      IWAppFormRender(Sender);
81    end;
82    
83    procedure TIWForm3.IWButton4Click(Sender: TObject);
84    begin
85      Release;
86    end;
87    
88    procedure TIWForm3.IWComboBox1Change(Sender: TObject);
89    begin
90      if IWComboBox1.ItemIndex = 0 then
91      begin
92        DM.FDQuery1.Filtered := false;
93        IWLabel1.Text := '';
94        IWLabel2.Text := '';
95      end
96      else
97      begin
98        DM.FDQuery1.Filter := 'EMAIL = ' +
99          QuotedStr(IWComboBox1.Items.ValueFromIndex[IWComboBox1.ItemIndex]);
100        DM.FDQuery1.Filtered := true;;
101        IWLabel1.Text := DM.FDQuery1.FieldByName('ADDRESS').AsString;
102        IWLabel2.Text := DM.FDQuery1.FieldByName('USER').AsString;
103      end;
104      IWAppFormRender(Sender);
105    end;
106    
107  end.  end.

Legend:
Removed from v.1  
changed lines
  Added in v.10

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26