Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /Unit4.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (hide annotations) (download) (as text)
Tue Dec 29 10:58:29 2015 UTC (8 years, 2 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 3454 byte(s)
当分進みそうにないので
1 yamat0jp 1 unit Unit4;
2    
3     interface
4    
5     uses
6 yamat0jp 5 Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,
7     IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
8     IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
9 yamat0jp 6 IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants,
10     IWCompLabel,
11     IWDBStdCtrls, PngImage, IWCompExtCtrls, Data.DB;
12 yamat0jp 1
13     type
14 yamat0jp 5 TCartForm = class(TIWAppForm)
15     IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
16     IWGrid1: TIWGrid;
17     IWButton1: TIWButton;
18     IWButton2: TIWButton;
19     IWLabel1: TIWLabel;
20     procedure IWAppFormRender(Sender: TObject);
21     procedure IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer);
22     procedure IWAppFormCreate(Sender: TObject);
23     procedure IWButton2Click(Sender: TObject);
24     procedure IWButton1Click(Sender: TObject);
25 yamat0jp 1 public
26     end;
27    
28     implementation
29    
30     {$R *.dfm}
31    
32 yamat0jp 5 uses Unit3, Unit7;
33 yamat0jp 1
34 yamat0jp 5 procedure TCartForm.IWAppFormCreate(Sender: TObject);
35     begin
36     with DM.FDQuery1 do
37     begin
38     SQL.Clear;
39     SQL.Add('select thumbnail,name,volume,price,number,serial from cart_data join item_data');
40     SQL.Add(' on (cart_data.serial = item_data.serial)');
41     SQL.Add(' where number = :num');
42     Params.ParamByName('num').AsInteger := DM.FDTable1.FieldByName('NUMBER')
43     .AsInteger;
44     end;
45     end;
46    
47     procedure TCartForm.IWAppFormRender(Sender: TObject);
48     var
49     i, j, k: Integer;
50 yamat0jp 6 s: TStream;
51     pic: TIWImage;
52     png: TPngImage;
53 yamat0jp 5 begin
54 yamat0jp 6 for i := 0 to IWGrid1.RowCount - 1 do
55     IWGrid1.Cell[i, 0].Control.Free;
56     IWGrid1.RowCount := 0;
57 yamat0jp 5 with DM.FDQuery1 do
58     begin
59     Open;
60     IWGrid1.RowCount := RecordCount;
61     if IWGrid1.RowCount = 0 then
62 yamat0jp 6 IWGrid1.Caption := '�J�[�g�����g������������';
63 yamat0jp 5 First;
64     i := 0;
65     k := 0;
66 yamat0jp 6 png := TPngImage.Create;
67     try
68     while Eof = false do
69     begin
70     if Fields.Fields[0].AsBytes <> nil then
71     begin
72     s := CreateBlobStream(Fields.Fields[0], bmRead);
73     try
74     png.LoadFromStream(s);
75     finally
76     s.Free;
77     end;
78     pic := TIWImage.Create(IWGrid1);
79     pic.Picture.Assign(png);
80     IWGrid1.Cell[i, 0].Control := pic;
81     end;
82     IWGrid1.Cell[i, 1].Text := Fields.Fields[1].AsString;
83     IWGrid1.Cell[i, 2].Text := Fields.Fields[2].AsString;
84     j := Fields.Fields[2].AsInteger * Fields.Fields[3].AsInteger;
85     inc(k, j);
86     IWGrid1.Cell[i, 3].Text := IntToStr(j);
87     IWGrid1.Cell[i, 4].Text := '����';
88     IWGrid1.Cell[i, 4].Clickable := true;
89     Next;
90     inc(i);
91     end;
92     finally
93     png.Free;
94 yamat0jp 5 end;
95     end;
96 yamat0jp 6 IWLabel1.Text := IntToStr(Trunc(k * 1.08));
97 yamat0jp 5 end;
98    
99     procedure TCartForm.IWButton1Click(Sender: TObject);
100     begin
101     if IWGrid1.RowCount > 0 then
102     TPayForm.Create(WebApplication).Show;
103     Release;
104     end;
105    
106     procedure TCartForm.IWButton2Click(Sender: TObject);
107     begin
108     Release;
109     end;
110    
111     procedure TCartForm.IWGrid1CellClick(ASender: TObject;
112     const ARow, AColumn: Integer);
113     var
114 yamat0jp 6 i, j: Integer;
115 yamat0jp 5 begin
116     with DM.FDQuery1 do
117     begin
118 yamat0jp 6 RecNo := ARow + 1;
119     i := FieldByName('NUMBER').AsInteger;
120     j := FieldByName('SERIAL').AsInteger;
121 yamat0jp 5 SQL.Clear;
122     SQL.Add('select * from cart_data');
123     Open;
124 yamat0jp 6 Locate('NUMBER;SERIAL', VarArrayOf([i, j]), []);
125 yamat0jp 5 Delete;
126     end;
127     IWAppFormCreate(ASender);
128     end;
129    
130 yamat0jp 1 end.

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