Develop and Download Open Source Software

Browse Subversion Repository

Diff of /Unit4.pas

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

revision 2 by yamat0jp, Sat Dec 19 14:35:42 2015 UTC revision 5 by yamat0jp, Tue Dec 29 08:41:54 2015 UTC
# Line 3  unit Unit4; Line 3  unit Unit4;
3  interface  interface
4    
5  uses  uses
6    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes;    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  type
12    TPayForm = class(TIWAppForm)    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    public
24    end;    end;
25    
# Line 14  implementation Line 27  implementation
27    
28  {$R *.dfm}  {$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:='カートの中身がありません';
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.  end.

Legend:
Removed from v.2  
changed lines
  Added in v.5

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