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 1 by yamat0jp, Sun Nov 22 11:18:44 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    System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,    Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWVCLComponent,
7    FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,    IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,
8    FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf,    IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
9    FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.IB,    IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants, IWCompLabel;
   FireDAC.Phys.IBDef, Data.DB, FireDAC.Comp.Client, FireDAC.Comp.DataSet;  
10    
11  type  type
12    TDataModule1 = class(TDataModule)    TCartForm = class(TIWAppForm)
13      FDTable1: TFDTable;      IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
14      FDTable1NAME: TWideStringField;      IWGrid1: TIWGrid;
15      FDTable2: TFDTable;      IWButton1: TIWButton;
16      FDTable2NAME: TWideStringField;      IWButton2: TIWButton;
17      FDTable2MAKER: TWideStringField;      IWLabel1: TIWLabel;
18      FDTable2STOCK: TIntegerField;      procedure IWAppFormRender(Sender: TObject);
19      FDTable2WEIGHT: TIntegerField;      procedure IWGrid1CellClick(ASender: TObject; const ARow, AColumn: Integer);
20      FDTable2DATE: TDateField;      procedure IWAppFormCreate(Sender: TObject);
21      FDTable2COMMENT: TMemoField;      procedure IWButton2Click(Sender: TObject);
22      FDTable2CATEGORY: TWideStringField;      procedure IWButton1Click(Sender: TObject);
     FDTable2IMAGE: TBlobField;  
     FDTable2PRICE: TIntegerField;  
     item: TDataSource;  
     user: TDataSource;  
     FDConnection1: TFDConnection;  
     FDTable3: TFDTable;  
     form: TDataSource;  
     FDQuery1: TFDQuery;  
     cart: TDataSource;  
     FDTable2THUMBNAIL: TBlobField;  
     FDTable1EMAIL: TWideStringField;  
     FDTable1ADDRESS: TWideStringField;  
     FDTable1NUMBER: TIntegerField;  
     FDTable1PASSWORD: TWideStringField;  
     FDTable2SERIAL: TIntegerField;  
     FDTable1BIRTH: TDateField;  
     FDTable3NAME: TWideStringField;  
     FDTable3BGCOLOR: TIntegerField;  
   private  
     { Private 宣言 }  
23    public    public
     { Public 宣言 }  
24    end;    end;
25    
 function DM: TDataModule1;  
   
26  implementation  implementation
27    
28  {%CLASSGROUP 'Vcl.Controls.TControl'}  {$R *.dfm}
29    
30  uses ServerController;  uses Unit3, Unit7;
31    
32  {$R *.dfm}  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  function DM: TDataModule1;  procedure TCartForm.IWAppFormRender(Sender: TObject);
46    var
47      i, j, k: Integer;
48  begin  begin
49    result:=UserSession.DM;    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;  end;
104    
105  end.  end.

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

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