📄 unit_kaibiaojl.pas
字号:
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='update bid_sj_qingbiao set sj_zuizhongbj='
+quotedstr(cell1.GetCellString(3,nowrow,0));
if trim(cell1.GetCellString(4,nowrow,0))='' then
adoquery.SQL.Text:=adoquery.SQL.Text
+',SJ_SUANSHUBJ='+quotedstr(cell1.GetCellString(3,nowrow,0));
adoquery.SQL.Text:=adoquery.SQL.Text
+' where bd_isbn in'
+'(select bd_isbn from bid_biaoduan_xinxi where 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+') and bd_name='''+trim(com_project.text)
+''') and sj_xuhao='+quotedstr(cell1.GetCellString(1,nowrow,0))
+' and dw_name='+quotedstr(cell1.GetCellString(2,nowrow,0));
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end
else if nowcol=4 then
begin
if (trim(cell1.GetCellString(1,nowrow,0))='')
and (trim(cell1.GetCellString(2,nowrow,0))='') then exit;
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='update bid_sj_qingbiao set sj_youhuibj='
+quotedstr(cell1.GetCellString(4,nowrow,0))
+',SJ_SUANSHUBJ='+quotedstr(cell1.GetCellString(4,nowrow,0))
+' where bd_isbn in'
+'(select bd_isbn from bid_biaoduan_xinxi where 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+') and bd_name='''+trim(com_project.text)
+''') and sj_xuhao='+quotedstr(cell1.GetCellString(1,nowrow,0))
+' and dw_name='+quotedstr(cell1.GetCellString(2,nowrow,0));
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end
else if nowcol=5 then
begin
if (trim(cell1.GetCellString(1,nowrow,0))='')
and (trim(cell1.GetCellString(2,nowrow,0))='') then exit;
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='update bid_sj_qingbiao set sj_toubiaobh='
+quotedstr(cell1.GetCellString(4,nowrow,0))+' where bd_isbn in'
+'(select bd_isbn from bid_biaoduan_xinxi where 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+') and bd_name='''+trim(com_project.text)
+''') and sj_xuhao='+quotedstr(cell1.GetCellString(1,nowrow,0))
+' and dw_name='+quotedstr(cell1.GetCellString(2,nowrow,0));
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
end;
end;
procedure Tfrm_Kaibiaojl.GetINfor;
var
adoquery:tadoquery;
i:integer;
begin
if trim(com_zhaobiao.text)='施工' then
begin
if cell1.OpenFile(SPATH+'report\shigong\pingbiao\kbjl.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowSideLabel(0, 0); //不显示行标
cell1.ShowTopLabel(0, 0); //不显示列标
if com_project.ItemIndex>=0 then
cell1.SetCellDouble(2,4,0,com_project.ItemIndex+1);
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.sql.text:=' select b.pb_xuhao,a.dw_name,b.pb_toubiaobj,b.pb_xiuzhengbj,b.pb_baozhengjin,b.pb_gongqi from bid_danwei_xinxi a, '
+' bid_pingbiao b,bid_biaoduan_xinxi C where a.dw_id=b.dw_id AND b.bd_isbn=c.bd_isbn and c.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+') and bd_name='''+trim(com_project.text)+''' order by b.pb_xuhao';
adoquery.Open;
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(1,i+6,0,adoquery.fieldbyname('pb_xuhao').AsString);
cell1.SetCellString(2,i+6,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,i+6,0,adoquery.fieldbyname('pb_toubiaobj').AsString);
cell1.SetCellString(4,i+6,0,adoquery.fieldbyname('pb_xiuzhengbj').AsString);
if adoquery.FieldByName('pb_baozhengjin').AsInteger=1 then
cell1.SetCellString(5,i+6,0,'√')
else if adoquery.FieldByName('pb_baozhengjin').AsInteger=0 then
cell1.SetCellString(5,i+6,0,'×');
cell1.SetCellString(6,i+6,0,adoquery.fieldbyname('pb_gongqi').AsString);
adoquery.Next;
end;
except
freeandnil(adoquery);
end;
end;
if trim(com_zhaobiao.text)='监理' then
begin
if cell1.OpenFile(SPATH+'report\jianli\pingbiao\kbjl.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowSideLabel(0, 0); //不显示行标
cell1.ShowTopLabel(0, 0); //不显示列标
if com_project.ItemIndex>=0 then
cell1.SetCellDouble(2,4,0,com_project.ItemIndex+1);
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.sql.text:=' select b.pb_xuhao,a.dw_name,b.pb_toubiaobj,b.pb_xiuzhengbj,b.pb_baozhengjin,b.pb_gongqi from bid_danwei_xinxi a, '
+' bid_pingbiao b,bid_biaoduan_xinxi C where a.dw_id=b.dw_id AND b.bd_isbn=c.bd_isbn and c.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+') and bd_name='''+trim(com_project.text)+''' order by b.pb_xuhao';
adoquery.Open;
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(1,i+6,0,adoquery.fieldbyname('pb_xuhao').AsString);
cell1.SetCellString(2,i+6,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,i+6,0,adoquery.fieldbyname('pb_toubiaobj').AsString);
cell1.SetCellString(4,i+6,0,adoquery.fieldbyname('pb_xiuzhengbj').AsString);
if adoquery.FieldByName('pb_baozhengjin').AsInteger=1 then
cell1.SetCellString(5,i+6,0,'√')
else if adoquery.FieldByName('pb_baozhengjin').AsInteger=0 then
cell1.SetCellString(5,i+6,0,'×');
adoquery.Next;
end;
except
freeandnil(adoquery);
end;
end;
end;
procedure Tfrm_Kaibiaojl.LoadSJSource;
var
adoquery:tadoquery;
i:Integer;
begin
if com_project.ItemIndex<0 then exit;
if cell1.OpenFile(SPATH+'report\sheji\pingbiao\kbjl.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.SetCellString(2,4,0,inttostr(com_project.ItemIndex+1));
adoquery:=Tadoquery.Create(nil);
try
adoquery.close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:='select dw_name,sj_xuhao,sj_zuizhongbj,sj_youhuibj,sj_toubiaobh'
+' from bid_sj_qingbiao a,bid_biaoduan_xinxi b where a.bd_isbn=b.bd_isbn and'
+' b.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+') and b.bd_name='+quotedstr(com_project.text)
+' order by sj_xuhao';
adoquery.Open;
if sjSource=0 then
begin
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(1,i+6,0,adoquery.fieldbyname('sj_xuhao').AsString);
cell1.SetCellString(2,i+6,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,i+6,0,adoquery.fieldbyname('sj_zuizhongbj').AsString);
cell1.SetCellString(4,i+6,0,adoquery.fieldbyname('sj_youhuibj').AsString);
cell1.SetCellString(5,i+6,0,adoquery.fieldbyname('sj_toubiaobh').AsString);
adoquery.Next;
end;
end
else if sjSource=1 then
begin
//设置报表的样式
if adoquery.RecordCount<(Cell1.GetRows(0)-8) then
begin
cell1.DeleteRow(6,Cell1.GetRows(0)-8-adoquery.RecordCount,0);
end;
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(1,i+6,0,adoquery.fieldbyname('sj_xuhao').AsString);
cell1.SetCellString(2,i+6,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,i+6,0,adoquery.fieldbyname('sj_zuizhongbj').AsString);
cell1.SetCellString(4,i+6,0,adoquery.fieldbyname('sj_youhuibj').AsString);
cell1.SetCellString(5,i+6,0,adoquery.fieldbyname('sj_toubiaobh').AsString);
adoquery.Next;
end;
end;
finally
freeandnil(adoquery);
end;
end;
procedure Tfrm_Kaibiaojl.com_projectchange(sender:tobject);
begin
if (com_zhaobiao.Text='施工') or (com_zhaobiao.Text='监理') then
getinfor
else if com_zhaobiao.text='设计' then
begin
sjSource:=0;
LoadSJSource;
end;
end;
procedure Tfrm_Kaibiaojl.BitBtn2Click(Sender:TObject);
begin
inherited;
if bopen=true then exit;
if com_project.items.indexof(com_project.text)<0 then exit;
if (com_zhaobiao.Text='设计') and (sjSource=0) then exit;
cell1.SaveFile(GetFilePath+inttostr(com_project.items.indexof(com_project.text)+1)+'_kbjl.cll',1);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -