📄 unit_yezhubd.pas
字号:
unit Unit_YeZhuBd;
interface
uses
unit_parentform,Dialogs,forms,SysUtils,DB, ADODB;
type
TFrm_yezhubd = class(TFrm_ParentForm)
procedure FormCreate(Sender: TObject);
procedure Com_xmnameChange(sender:Tobject);
procedure Com_zhaoBiaoChange(Sender:Tobject);
procedure Com_GclxnameChange(Sender: TObject);
procedure Cell1EditFinish(Sender: TObject;var text: WideString; var approve: Integer);
procedure bb_reflashClick(Sender: TObject);
procedure chooseloadfile;
procedure BitBtn2Click(Sender:TObject);
end;
var
frm_yezhubd:Tfrm_yezhubd;
implementation
uses
unit_public,SystemObject,DataModule,DataAccessCommonShell;
procedure TFrm_yezhubd.chooseloadfile;
var
adoquery:tadoquery;
i:Integer;
biaodi,bdcsz,xishu:real;
iPage,irow:Integer;
begin
if cell1.OpenFile(SPATH+'report\Others\yzbd.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowSideLabel(0, 0); //不显示行标
cell1.ShowTopLabel(0, 0); //不显示列标
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.Close;
adoquery.SQL.Text:=' select a.bd_isbn,a.bd_bianhao,b.bd_biaodicsz,b.bd_xishu from bid_biaoduan_xinxi a left join '
+' bid_biaoduan_xishu b on a.bd_isbn=b.bd_isbn where a.xmgczb_id in (select xmgczb_id from bid_xmgczb '
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') order by a.bd_bianhao ';
adoquery.Open;
adoquery.first;
// 控制载入数据
setCellSheet(cell1,adoquery.RecordCount,20);
if (adoquery.Recordcount mod 20)<=10 then
begin
cell1.DeleteRow(8,5,(adoquery.Recordcount div 20));
cell1.SetRowHeight(1,170,1,adoquery.Recordcount div 20);
end;
//加载整页信息
for i:=0 to adoquery.RecordCount-1 do
begin
ipage:=i div 20;
irow:=i mod 20;
if irow<10 then
begin
cell1.SetCellString((i mod 10)+2,4,ipage,mintomax1(i+1));
if adoquery.fieldbyname('bd_biaodicsz').AsString<>'' then
cell1.SetCellDouble((i mod 10)+2,5,ipage,adoquery.fieldbyname('bd_biaodicsz').AsFloat);
if adoquery.fieldbyname('bd_xishu').AsString<>'' then
cell1.SetCellDouble((i mod 10)+2,6,ipage,adoquery.fieldbyname('bd_xishu').AsFloat);
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=adoquery.fieldbyname('bd_biaodicsz').AsInteger;
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=adoquery.fieldbyname('bd_xishu').asfloat;
if (bdcsz<>0) or (xishu<>0) then
begin
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble((i mod 10)+2,7,ipage,biaodi);
end;
end;
if irow>=10 then
begin
cell1.SetCellString((i mod 10)+2,9,ipage,mintomax1(i+1));
if adoquery.fieldbyname('bd_biaodicsz').AsString<>'' then
cell1.SetCellDouble((i mod 10)+2,10,ipage,adoquery.fieldbyname('bd_biaodicsz').AsFloat);
if adoquery.fieldbyname('bd_xishu').AsString<>'' then
cell1.SetCellDouble((i mod 10)+2,11,ipage,adoquery.fieldbyname('bd_xishu').AsFloat);
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=adoquery.fieldbyname('bd_biaodicsz').AsInteger;
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=adoquery.fieldbyname('bd_xishu').asfloat;
if (bdcsz<>0) or (xishu<>0) then
begin
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble((i mod 10)+2,12,ipage,biaodi);
end;
end;
adoquery.Next;
end;
{ if adoquery.RecordCount=10 then
begin
cell1.DeleteRow(8,5,0);
for i:=2 to 11 do
begin
cell1.SetCellDouble(i,5,0,adoquery.fieldbyname('bd_biaodicsz').AsFloat);
cell1.SetCellDouble(i,6,0,adoquery.fieldbyname('bd_xishu').AsFloat);
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=adoquery.fieldbyname('bd_biaodicsz').AsInteger;
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=adoquery.fieldbyname('bd_xishu').AsInteger;
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble(i,7,0,biaodi);
adoquery.Next;
end;
end;
if adoquery.RecordCount>10 then
begin
for i:=adoquery.RecordCount+2 to 11 do
cell1.SetCellString(i,9,0,' ');
for i:=0 to adoquery.RecordCount-1 do
begin
if i<=10 then
begin
cell1.SetCellDouble(i+2,5,0,adoquery.fieldbyname('bd_biaodicsz').AsFloat);
cell1.SetCellDouble(i+2,6,0,adoquery.fieldbyname('bd_xishu').AsFloat);
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=adoquery.fieldbyname('bd_biaodicsz').AsInteger;
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=adoquery.fieldbyname('bd_xishu').AsInteger;
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble(i+2,7,0,biaodi);
end;
if i>10 then
begin
cell1.SetCellDouble(i-9,5,0,adoquery.fieldbyname('bd_biaodicsz').AsFloat);
cell1.SetCellDouble(i-9,6,0,adoquery.fieldbyname('bd_xishu').AsFloat);
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=adoquery.fieldbyname('bd_biaodicsz').AsInteger;
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=adoquery.fieldbyname('bd_xishu').AsInteger;
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble(i-9,7,0,biaodi);
end;
adoquery.Next;
end;
end;
if adoquery.RecordCount<10 then
begin
cell1.DeleteRow(8,5,0);
cell1.SetRowHeight(1,170,1,0);
for i:=adoquery.RecordCount+2 to 11 do
cell1.SetCellString(i,4,0,' ');
adoquery.first;
for i:=2 to adoquery.RecordCount+1 do
begin
if trim(adoquery.fieldbyname('bd_biaodicsz').asstring)<>'' then
cell1.SetCellDouble(i,5,0,strtofloat(adoquery.fieldbyname('bd_biaodicsz').asstring))
else
cell1.setcellstring(i,5,0,'');
if trim(adoquery.fieldbyname('bd_xishu').asstring)<>'' then
cell1.SetCellDouble(i,6,0,strtofloat(adoquery.fieldbyname('bd_xishu').asstring))
else
cell1.setcellstring(i,6,0,'');
if adoquery.fieldbyname('bd_biaodicsz').AsString='' then bdcsz:=0
else bdcsz:=strtofloat(adoquery.fieldbyname('bd_biaodicsz').asstring);
if adoquery.fieldbyname('bd_xishu').AsString='' then xishu:=0
else xishu:=strtofloat(adoquery.fieldbyname('bd_xishu').asstring);
biaodi:=bdcsz*(100+xishu)/100;
cell1.SetCellDouble(i,7,0,biaodi);
adoquery.Next;
end;
end; }
finally
freeandnil(adoquery);
end;
end;
procedure TFrm_yezhubd.Cell1EditFinish(Sender: TObject;var text: WideString; var approve: Integer);
var
adoquery:tadoquery;
nowrow,nowcol,nowpage,icol:integer;
str:string;
biaodi,bdcsz,xishu:real;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -