| 7 |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompGrids, |
IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl, IWControl, IWCompGrids, |
| 8 |
IWDBGrids, IWCompButton, IWCompExtCtrls, IWVCLComponent, |
IWDBGrids, IWCompButton, IWCompExtCtrls, IWVCLComponent, |
| 9 |
IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout, |
IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout, |
| 10 |
IWTemplateProcessorHTML, PngImage, Data.DB; |
IWTemplateProcessorHTML, PngImage, Data.DB, IWCompLabel, IWDBStdCtrls, |
| 11 |
|
FireDAC.Comp.Client; |
| 12 |
|
|
| 13 |
type |
type |
| 14 |
TCartForm = class(TIWAppForm) |
TPayForm = class(TIWAppForm) |
| 15 |
IWButton1: TIWButton; |
IWButton1: TIWButton; |
| 16 |
IWButton2: TIWButton; |
IWButton2: TIWButton; |
| 17 |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML; |
| 18 |
IWGrid1: TIWGrid; |
IWDBLabel1: TIWDBLabel; |
| 19 |
procedure IWAppFormCreate(Sender: TObject); |
procedure IWButton2Click(Sender: TObject); |
|
procedure IWAppFormDestroy(Sender: TObject); |
|
| 20 |
procedure IWButton1Click(Sender: TObject); |
procedure IWButton1Click(Sender: TObject); |
| 21 |
public |
public |
| 22 |
end; |
end; |
| 25 |
|
|
| 26 |
{$R *.dfm} |
{$R *.dfm} |
| 27 |
|
|
| 28 |
uses Unit3, Unit1, ServerController, Unit4; |
uses Unit3, Unit1; |
| 29 |
|
|
| 30 |
procedure TCartForm.IWAppFormCreate(Sender: TObject); |
procedure TPayForm.IWButton1Click(Sender: TObject); |
| 31 |
var |
var |
| 32 |
i: integer; |
s: TFDQuery; |
|
s: TStream; |
|
|
png: TPngImage; |
|
|
img: TIWImageFile; |
|
|
j: integer; |
|
| 33 |
begin |
begin |
| 34 |
with DM.FDQuery1 do |
with DM.FDQuery1 do |
| 35 |
begin |
begin |
| 36 |
SQL.Clear; |
Open('select number,serial from cart_data where number = :num;', |
| 37 |
SQL.Add('select name,maker,thumbnail,volume,price'); |
[DM.FDTable1.FieldByName('NUMBER').AsInteger]); |
| 38 |
SQL.Add(' from item_data join cart_data'); |
s := TFDQuery.Create(nil); |
|
SQL.Add(' on (item_data.serial = cart_data.serial) where number = :num;'); |
|
|
Params.ParamByName('num').AsInteger := UserSession.user_number; |
|
|
Open; |
|
|
end; |
|
|
IWGrid1.ColumnCount := DM.FDQuery1.Fields.Count; |
|
|
IWGrid1.RowCount := DM.FDQuery1.RecordCount; |
|
|
for i := 0 to IWGrid1.RowCount - 1 do |
|
|
begin |
|
|
png := TPngImage.Create; |
|
| 39 |
try |
try |
| 40 |
for j := 0 to IWGrid1.ColumnCount - 1 do |
s.Connection := DM.FDConnection1; |
| 41 |
begin |
s.Open('select * from recent_data;'); |
| 42 |
case j of |
while s.Eof = false do |
| 43 |
2: |
if Date + 30 < s.FieldByName('DATE').AsDateTime then |
| 44 |
begin |
s.Delete |
|
s := DM.FDQuery1.CreateBlobStream |
|
|
(DM.FDQuery1.FieldByName('THUMBNAIL'), bmRead); |
|
|
try |
|
|
png.LoadFromStream(s); |
|
|
img:=TIWImageFile.Create(IWGrid1); |
|
|
img.Picture.Assign(png); |
|
|
IWGrid1.Cell[i, j].Control :=img; |
|
|
finally |
|
|
s.Free; |
|
|
end; |
|
|
end; |
|
|
4: |
|
|
IWGrid1.Cell[i, j].Text := |
|
|
(DM.FDQuery1.Fields[3].AsInteger * DM.FDQuery1.Fields[4] |
|
|
.AsInteger).ToString; |
|
| 45 |
else |
else |
| 46 |
IWGrid1.Cell[i, j].Text := DM.FDQuery1.Fields[j].AsString; |
s.Next; |
| 47 |
end; |
while Eof = false do |
| 48 |
|
begin |
| 49 |
|
if s.Locate('SERIAL', s.FieldByName('SERIAL').AsInteger, []) = false |
| 50 |
|
then |
| 51 |
|
s.AppendRecord([Fields.Fields[0].AsInteger, |
| 52 |
|
Fields.Fields[1].AsInteger, Date]); |
| 53 |
|
Delete; |
| 54 |
end; |
end; |
| 55 |
finally |
finally |
| 56 |
png.Free; |
s.Free; |
| 57 |
end; |
end; |
|
DM.FDQuery1.Next; |
|
| 58 |
end; |
end; |
| 59 |
|
WebApplication.ShowMessage('お買い上げありがとうございました'); |
| 60 |
|
Release; |
| 61 |
|
IWForm1.Page := true; |
| 62 |
end; |
end; |
| 63 |
|
|
| 64 |
procedure TCartForm.IWAppFormDestroy(Sender: TObject); |
procedure TPayForm.IWButton2Click(Sender: TObject); |
|
begin |
|
|
DM.FDQuery1.Close; |
|
|
end; |
|
|
|
|
|
procedure TCartForm.IWButton1Click(Sender: TObject); |
|
| 65 |
begin |
begin |
| 66 |
Release; |
Release; |
|
if Sender = IWButton1 then |
|
|
TPayForm.Create(WebApplication).Show |
|
|
else |
|
|
TIWForm1.Create(WebApplication).Show; |
|
| 67 |
end; |
end; |
| 68 |
|
|
| 69 |
end. |
end. |