Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Unit4.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations) (download) (as text)
Tue Dec 29 08:41:54 2015 UTC (8 years, 2 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 2750 byte(s)
だんだんとできてきました
1 unit Unit4;
2
3 interface
4
5 uses
6 Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,
7 IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
8 IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
9 IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants, IWCompLabel;
10
11 type
12 TCartForm = class(TIWAppForm)
13 IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
14 IWGrid1: TIWGrid;
15 IWButton1: TIWButton;
16 IWButton2: TIWButton;
17 IWLabel1: TIWLabel;
18 procedure IWAppFormRender(Sender: TObject);
19 procedure IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer);
20 procedure IWAppFormCreate(Sender: TObject);
21 procedure IWButton2Click(Sender: TObject);
22 procedure IWButton1Click(Sender: TObject);
23 public
24 end;
25
26 implementation
27
28 {$R *.dfm}
29
30 uses Unit3, Unit7;
31
32 procedure TCartForm.IWAppFormCreate(Sender: TObject);
33 begin
34 with DM.FDQuery1 do
35 begin
36 SQL.Clear;
37 SQL.Add('select thumbnail,name,volume,price,number,serial from cart_data join item_data');
38 SQL.Add(' on (cart_data.serial = item_data.serial)');
39 SQL.Add(' where number = :num');
40 Params.ParamByName('num').AsInteger := DM.FDTable1.FieldByName('NUMBER')
41 .AsInteger;
42 end;
43 end;
44
45 procedure TCartForm.IWAppFormRender(Sender: TObject);
46 var
47 i, j, k: Integer;
48 begin
49 with DM.FDQuery1 do
50 begin
51 Open;
52 IWGrid1.RowCount := RecordCount;
53 if IWGrid1.RowCount = 0 then
54 IWGrid1.Caption:='�J�[�g�����g������������';
55 First;
56 i := 0;
57 k := 0;
58 while Eof = false do
59 begin
60 IWGrid1.Cell[i, 1].Text := Fields.Fields[1].AsString;
61 IWGrid1.Cell[i, 2].Text := Fields.Fields[2].AsString;
62 j := Fields.Fields[2].AsInteger * Fields.Fields[3].AsInteger;
63 inc(k,j);
64 IWGrid1.Cell[i, 3].Text := IntToStr(j);
65 IWGrid1.Cell[i, 4].Text := '����';
66 IWGrid1.Cell[i, 4].Clickable := true;
67 Next;
68 inc(i);
69 end;
70 end;
71 IWLabel1.Text:=IntToStr(Trunc(k*1.08));
72 end;
73
74 procedure TCartForm.IWButton1Click(Sender: TObject);
75 begin
76 if IWGrid1.RowCount > 0 then
77 TPayForm.Create(WebApplication).Show;
78 Release;
79 end;
80
81 procedure TCartForm.IWButton2Click(Sender: TObject);
82 begin
83 Release;
84 end;
85
86 procedure TCartForm.IWGrid1CellClick(ASender: TObject;
87 const ARow, AColumn: Integer);
88 var
89 i, j: integer;
90 begin
91 with DM.FDQuery1 do
92 begin
93 RecNo:=ARow+1;
94 i:=FieldByName('NUMBER').AsInteger;
95 j:=FieldByName('SERIAL').AsInteger;
96 SQL.Clear;
97 SQL.Add('select * from cart_data');
98 Open;
99 Locate('NUMBER;SERIAL',VarArrayOf([i,j]),[]);
100 Delete;
101 end;
102 IWAppFormCreate(ASender);
103 end;
104
105 end.

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