📄 unit_pingbiaohxr.pas
字号:
unit Unit_pingbiaohxr;
interface
uses
unit_parentform,Dialogs,forms,SysUtils,DB, ADODB;
type
TFrm_pingbiaohxr= class(TFrm_ParentForm)
procedure FormCreate(Sender: TObject);
procedure Com_xmnameChange(sender:Tobject);
procedure Com_zhaoBiaoChange(Sender:Tobject);
procedure Com_GclxnameChange(Sender: TObject);
procedure bb_reflashclick(Sender:Tobject);
procedure BitBtn1Click(Sender: TObject);
procedure Bib_PriviewClick(Sender: TObject);
procedure BitBtn2Click(Sender:TObject);
procedure Cell1MouseLClick(Sender: TObject; col, row,updn: Integer);
procedure Com_ProjectChange(Sender: TObject);
procedure LoadSource;
procedure Getbiaoduan;
end;
var
Frm_pingbiaohxr:TFrm_pingbiaohxr;
implementation
uses
unit_public,SystemObject,DataModule,DataAccessCommonShell;
procedure TFrm_pingbiaohxr.getbiaoduan;
var
adoquery:tadoquery;
i:Integer;
begin
com_project.Items.Clear;
com_project.text:='请选择';
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:='select bd_name 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+') order by bd_bianhao';
adoquery.Open;
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
com_project.Items.Add(adoquery.fieldbyname('bd_name').asstring);
adoquery.Next;
end;
finally
freeandnil(adoquery);
end;
end;
procedure TFrm_pingbiaohxr.LoadSource;
var
adoquery:tadoquery;
str,ssql:string;
exist:boolean;//判断单位是否已经存在
I,j,RecordCount,sl:Integer;
bianhao:Integer;
bd_name:string;//记录表段名称
//count,houxuanR:Integer;//记录表段个数,候选人次数
procedure setrow; //调整cell1的列数
var
i:integer;
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:=' select bd_name 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+') order by bd_bianhao';
adoquery.Open;
RecordCount:=adoquery.RecordCount;
if adoquery.RecordCount<=19 then //不足报表列数
begin
cell1.Deleterow(6,(19-adoquery.RecordCount)*3,0);
end;
if adoquery.RecordCount>19 then //不足报表列数
begin
cell1.InsertRow(63,(adoquery.RecordCount-19)*3,0);
for i:=20 to adoquery.RecordCount do
begin
cell1.MergeCells(1,6+(i-1)*3,1,8+(i-1)*3);
cell1.SetCellString(2,(i+1)*3,0,cell1.getCellString(2,(I-1)*3,0));
cell1.SetCellString(2,(i+1)*3+1,0,cell1.getCellString(2,(I-1)*3+1,0));
cell1.SetCellString(2,(i+1)*3+2,0,cell1.getCellString(2,(I-1)*3+2,0));
end;
end;
adoquery.First;
ssql:='';
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(1,6+i*3,0,adoquery.fieldbyname('bd_name').AsString);
{ssql:=ssql+ ' exec pb_get_houxuanr '''+adoquery.fieldbyname('bd_name').AsString+''','''+trim(xmbdgc.XM_ISBn)
+''','+xmbdgc.gCLX_ID+','+xmbdgc.BDLX_ID; }
adoquery.Next;
end;
finally
freeandnil(adoquery);
end;
end;
begin
if trim(com_zhaobiao.text)='施工' then
begin
if cell1.OpenFile(SPATH+'report\shigong\pingbiao\zbhxr.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowTopLabel(0, 0); //不显示列标
setrow;
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:=' exec pb_get_houxuanr '''+trim(xmbdgc.XM_ISBn)
+''','+xmbdgc.gCLX_ID+','+xmbdgc.BDLX_ID;
adoquery.Open;
WHILE NOT ADOQUERY.EOF DO //for i:=0 to adoquery.RecordCount-1 do
begin
if cell1.GetCellString(3,5+(adoquery.FieldByName('bd_bianhao').AsInteger)*3,0)<>'' then
BEGIN
ADOQUERY.NEXT;
continue;
END;
exist:=false;
for j:=6 to cell1.GetRows(0) do
begin
if trim(cell1.GetCellString(3,j,0))=trim(adoquery.fieldbyname('dw_name').AsString) then
begin
exist:=true;
break;
end;
exist:=false;
end;
if exist=true then
begin
adoquery.Next;
continue;
end;
bianhao:=(adoquery.FieldByName('bd_bianhao').AsInteger)-1;
for j:=(6+bianhao*3) to (8+bianhao*3) do
begin
if cell1.GetCellString(3,5+(adoquery.FieldByName('bd_bianhao').AsInteger)*3,0)='' then
begin
if trim(cell1.GetCellString(3,j,0))<>'' then continue;
cell1.SetCellString(3,j,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(4,j,0,adoquery.fieldbyname('pb_pingbiaoj').AsString);
if adoquery.fieldbyname('pb_zhongbiao').AsInteger=1 then
cell1.SetCellString(5,j,0,'√')
else
cell1.SetCellString(5,j,0,'×');
break;
end;
end;
adoquery.Next;
{adoquery.SQL.Text:=' exec pb_get_houxuanr '''+cell1.GetCellString(1,6+i*3,0)+''','''+trim(xmbdgc.XM_ISBn)
+''','+xmbdgc.gCLX_ID+','+xmbdgc.BDLX_ID;
adoquery.Open;
adoquery.First;
for j:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(3,6+i*3+j,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(4,6+i*3+j,0,adoquery.fieldbyname('pb_pingbiaoj').AsString);
if adoquery.fieldbyname('pb_zhongbiao').AsInteger=1 then
cell1.SetCellString(5,6+i*3+j,0,'√')
else
cell1.SetCellString(5,6+i*3+j,0,'×');
adoquery.Next;
// cell1.SetCellString(3,6+i*3+j,0,adoquery.fieldbyname('pb_pingbiaoj').AsString);
end;}
end;
finally
freeandnil(adoquery);
end;
end
else if trim(com_zhaobiao.text)='监理' then
begin
if cell1.OpenFile(SPATH+'report\jianli\pingbiao\zbhxr.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowTopLabel(0, 0); //不显示列标
setrow;
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
for i:=0 to recordcount-1 do
begin
adoquery.Close;
adoquery.SQL.Text:=' exec Get_jl_houxuanR '''+cell1.GetCellString(1,6+i*3,0)+''','''+trim(xmbdgc.XM_ISBn)
+''','+xmbdgc.gCLX_ID+','+xmbdgc.BDLX_ID;
adoquery.Open;
adoquery.first;
if adoquery.RecordCount>3 then sl:=3
else sl:=adoquery.RecordCount;
for j:=0 to sl-1 do
begin
cell1.SetCellString(3,6+i*3+j,0,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(4,6+i*3+j,0,adoquery.fieldbyname('pb_suanshubj').AsString);
if adoquery.fieldbyname('pb_zhongbiao').AsInteger=1 then
cell1.SetCellString(5,6+i*3+j,0,'√')
else
cell1.SetCellString(5,6+i*3+j,0,'×');
adoquery.next;
end;
end;
finally
freeandnil(adoquery);
end;
end
else if com_zhaobiao.Text='设计' then
begin
panel1.Visible:=true;
Getbiaoduan;
if cell1.OpenFile(SPATH+'report\sheji\pingbiao\zbhxr.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
cell1.ShowSideLabel(0,0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -