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 5 by yamat0jp, Tue Dec 29 08:41:54 2015 UTC revision 6 by yamat0jp, Tue Dec 29 10:58:29 2015 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, IWCompGrids, IWCompButton, Variants, IWCompLabel;    IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants,
10      IWCompLabel,
11      IWDBStdCtrls, PngImage, IWCompExtCtrls, Data.DB;
12    
13  type  type
14    TCartForm = class(TIWAppForm)    TCartForm = class(TIWAppForm)
# Line 45  end; Line 47  end;
47  procedure TCartForm.IWAppFormRender(Sender: TObject);  procedure TCartForm.IWAppFormRender(Sender: TObject);
48  var  var
49    i, j, k: Integer;    i, j, k: Integer;
50      s: TStream;
51      pic: TIWImage;
52      png: TPngImage;
53  begin  begin
54      for i := 0 to IWGrid1.RowCount - 1 do
55        IWGrid1.Cell[i, 0].Control.Free;
56      IWGrid1.RowCount := 0;
57    with DM.FDQuery1 do    with DM.FDQuery1 do
58    begin    begin
59      Open;      Open;
60      IWGrid1.RowCount := RecordCount;      IWGrid1.RowCount := RecordCount;
61      if IWGrid1.RowCount = 0 then      if IWGrid1.RowCount = 0 then
62        IWGrid1.Caption:='カートの中身がありません';        IWGrid1.Caption := 'カートの中身がありません';
63      First;      First;
64      i := 0;      i := 0;
65      k := 0;      k := 0;
66      while Eof = false do      png := TPngImage.Create;
67      begin      try
68        IWGrid1.Cell[i, 1].Text := Fields.Fields[1].AsString;        while Eof = false do
69        IWGrid1.Cell[i, 2].Text := Fields.Fields[2].AsString;        begin
70        j := Fields.Fields[2].AsInteger * Fields.Fields[3].AsInteger;          if Fields.Fields[0].AsBytes <> nil then
71        inc(k,j);          begin
72        IWGrid1.Cell[i, 3].Text := IntToStr(j);            s := CreateBlobStream(Fields.Fields[0], bmRead);
73        IWGrid1.Cell[i, 4].Text := '削除';            try
74        IWGrid1.Cell[i, 4].Clickable := true;              png.LoadFromStream(s);
75        Next;            finally
76        inc(i);              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      end;      end;
95    end;    end;
96    IWLabel1.Text:=IntToStr(Trunc(k*1.08));    IWLabel1.Text := IntToStr(Trunc(k * 1.08));
97  end;  end;
98    
99  procedure TCartForm.IWButton1Click(Sender: TObject);  procedure TCartForm.IWButton1Click(Sender: TObject);
# Line 86  end; Line 111  end;
111  procedure TCartForm.IWGrid1CellClick(ASender: TObject;  procedure TCartForm.IWGrid1CellClick(ASender: TObject;
112    const ARow, AColumn: Integer);    const ARow, AColumn: Integer);
113  var  var
114    i, j: integer;    i, j: Integer;
115  begin  begin
116    with DM.FDQuery1 do    with DM.FDQuery1 do
117    begin    begin
118      RecNo:=ARow+1;      RecNo := ARow + 1;
119      i:=FieldByName('NUMBER').AsInteger;      i := FieldByName('NUMBER').AsInteger;
120      j:=FieldByName('SERIAL').AsInteger;      j := FieldByName('SERIAL').AsInteger;
121      SQL.Clear;      SQL.Clear;
122      SQL.Add('select * from cart_data');      SQL.Add('select * from cart_data');
123      Open;      Open;
124      Locate('NUMBER;SERIAL',VarArrayOf([i,j]),[]);      Locate('NUMBER;SERIAL', VarArrayOf([i, j]), []);
125      Delete;      Delete;
126    end;    end;
127    IWAppFormCreate(ASender);    IWAppFormCreate(ASender);

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

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