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 11 by yamat0jp, Fri Jul 22 23:40:03 2016 UTC revision 17 by yamat0jp, Wed Aug 24 12:31:07 2016 UTC
# Line 8  uses Line 8  uses
8    IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,    IWTemplateProcessorHTML, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
9    IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants,    IWBaseHTMLControl, IWControl, IWCompGrids, IWCompButton, Variants,
10    IWCompLabel,    IWCompLabel,
11    IWDBStdCtrls, PngImage, IWCompExtCtrls, Data.DB;    IWDBStdCtrls, IWCompExtCtrls, Data.DB, Jpeg;
12    
13  type  type
14    TCartForm = class(TIWAppForm)    TCartForm = class(TIWAppForm)
# Line 36  begin Line 36  begin
36    with DM.FDQuery1 do    with DM.FDQuery1 do
37    begin    begin
38      SQL.Clear;      SQL.Clear;
39      SQL.Add('select thumbnail,name,volume,price,number,serial from cart_data join item_data');      SQL.Add('select thumbnail,name,volume,price,number,serial from cart_data,item_data');
40      SQL.Add(' on (cart_data.serial = item_data.serial)');      SQL.Add(' where cart_data.serial = item_data.serial');
41      SQL.Add(' where number = :num');      SQL.Add(' and number = :num');
42      Params.ParamByName('num').AsInteger := UserSession.user_number;      ParamByName('num').AsInteger := UserSession.user_number;
43    end;    end;
44  end;  end;
45    
# Line 48  var Line 48  var
48    i, j, k: Integer;    i, j, k: Integer;
49    s: TStream;    s: TStream;
50    pic: TIWImage;    pic: TIWImage;
51    png: TPngImage;    jpg: TJpegImage;
52  begin  begin
53    for i := 0 to IWGrid1.RowCount - 1 do    for i := 0 to IWGrid1.RowCount - 1 do
54      IWGrid1.Cell[i, 0].Control.Free;      IWGrid1.Cell[i, 0].Control.Free;
# Line 62  begin Line 62  begin
62      First;      First;
63      i := 0;      i := 0;
64      k := 0;      k := 0;
65      png := TPngImage.Create;      jpg := TJpegImage.Create;
66      try      try
67        while Eof = false do        while Eof = false do
68        begin        begin
69          if Fields.Fields[0].AsBytes <> nil then          if Fields.Fields[0].IsNull = false then
70          begin          begin
71            s := CreateBlobStream(Fields.Fields[0], bmRead);            s := CreateBlobStream(Fields.Fields[0], bmRead);
72            try            try
73              png.LoadFromStream(s);              jpg.LoadFromStream(s);
74            finally            finally
75              s.Free;              s.Free;
76            end;            end;
77            pic := TIWImage.Create(IWGrid1);            pic := TIWImage.Create(IWGrid1);
78            pic.Picture.Assign(png);            pic.Picture.Assign(jpg);
79            IWGrid1.Cell[i, 0].Control := pic;            IWGrid1.Cell[i, 0].Control := pic;
80          end;          end;
81          IWGrid1.Cell[i, 1].Text := Fields.Fields[1].AsString;          IWGrid1.Cell[i, 1].Text := Fields.Fields[1].AsString;
# Line 89  begin Line 89  begin
89          inc(i);          inc(i);
90        end;        end;
91      finally      finally
92        png.Free;        jpg.Free;
93      end;      end;
94    end;    end;
95    IWLabel1.Text := Format('(合計) %d + (消費税) %d = %d円',    IWLabel1.Text := Format('(合計) %d + (消費税) %d = %d円',
# Line 97  begin Line 97  begin
97  end;  end;
98    
99  procedure TCartForm.IWButton1Click(Sender: TObject);  procedure TCartForm.IWButton1Click(Sender: TObject);
100    var
101      s: TUserForm;
102  begin  begin
103    if (UserSession.user_number <> 0) and    if (UserSession.user_number <> 0) and (IWGrid1.RowCount > 0) then
104      (DM.FDTable1.FieldByName('EMAIL').AsString = '') then      if DM.FDTable1.FieldByName('EMAIL').AsString = '' then
105      TUserForm.Create(WebApplication).Show;      begin
106    if IWGrid1.RowCount > 0 then        s := TUserForm.Create(WebApplication);
107      TPayForm.Create(WebApplication).Show;        s.pay := IWGrid1.RowCount>0;
108          s.Show;
109        end
110        else
111          TPayForm.Create(WebApplication).Show;
112    Release;    Release;
113  end;  end;
114    
# Line 121  begin Line 127  begin
127      RecNo := ARow + 1;      RecNo := ARow + 1;
128      i := FieldByName('NUMBER').AsInteger;      i := FieldByName('NUMBER').AsInteger;
129      j := FieldByName('SERIAL').AsInteger;      j := FieldByName('SERIAL').AsInteger;
130      SQL.Clear;      Open('select * from cart_data;');
     SQL.Add('select * from cart_data');  
     Open;  
131      if Locate('NUMBER;SERIAL', VarArrayOf([i, j]), []) = true then      if Locate('NUMBER;SERIAL', VarArrayOf([i, j]), []) = true then
132        Delete;        Delete;
133    end;    end;

Legend:
Removed from v.11  
changed lines
  Added in v.17

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