📄 fpypk.pas
字号:
unit Fpypk;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Fbase, Grids;
type
TF_pypk = class(TF_base)
StringGrid1: TStringGrid;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_pypk: TF_pypk;
implementation
uses Fkcpd;
{$R *.dfm}
procedure TF_pypk.FormShow(Sender: TObject);
var
grow,gcol:integer;
begin
inherited;
F_kcpd.Adoquery1.First;
with stringgrid1 do
begin
cells[0,0]:='行号';
cells[1,0]:='商品编号';
cells[2,0]:='商品全称';
cells[3,0]:='库存数量';
cells[4,0]:='盘点数量';
cells[5,0]:='盘点盈亏数量';
cells[6,0]:='盘点盈亏金额';
for grow:=1 to F_kcpd.Adoquery1.RecordCount do
begin
cells[0,grow]:=inttostr(grow);
for gcol:=1 to 6 do
begin
with F_kcpd.ADOQuery1 do
begin
if gcol<=2 then
cells[gcol,grow]:=Fields[gcol-1].AsString;
if (gcol=3) and (floattostr(Fields[2].asfloat)<>'') then
cells[3,grow]:=floattostr(Fields[2].asfloat);
if (gcol=4) and (Fields[3].AsVariant<>null) then
cells[4,grow]:=floattostr(Fields[3].asfloat);
if (gcol=5) and (Fields[3].AsVariant<>null) then
cells[5,grow]:=floattostr(Fields[3].AsFloat-Fields[2].asfloat);
if (gcol=6) and (Fields[3].AsVariant<>null) then
cells[6,grow]:=format('%10.4f',[strtofloat(cells[5,grow])* Fields[8].asfloat]);
end;
end;
F_kcpd.Adoquery1.Next;
end;
end;
stringgrid1.RowCount:=F_kcpd.Adoquery1.RecordCount+1;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -