📄 unit_tongguozigesqr.pas
字号:
unit Unit_tongguozigesqr;
interface
uses
Unit_ParentForm,SysUtils,Dialogs,Controls,adodb;
type
Tfrm_tongguozigesqr = class(TFrm_ParentForm)
procedure FormCreate(Sender: TObject);
procedure Com_zhaoBiaoChange(Sender: TObject);
procedure Com_GclxnameChange(Sender: TObject);
procedure Com_xmnameChange(Sender: TObject);
procedure Com_LeibieChange(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure btn_xiangxiOnChcik(Sender:Tobject);
procedure bb_savetodataClick(Sender: TObject);
procedure Cell1MouseLClick(Sender: TObject; col, row, updn: Integer);
procedure Cell1EditFinish(Sender: TObject;var text: WideString; var approve: Integer);
procedure bb_reflashClick(Sender: TObject);
//procedure ChooseLoadFile; //打开cell中文件
procedure LoadFile;//得到数据
procedure Getbiaoduan;
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
uses
Unit_PUBLIC,SystemObject,datamodule,DataAccessCommonShell;
procedure Tfrm_tongguozigesqr.Getbiaoduan;
begin
if com_zhaobiao.Text='施工' then
begin
com_leibie.text:='请选择';
GetXMleibie(com_LeiBie);
if com_leibie.Items[0]='无类别' then
begin
com_leibie.ItemIndex:=0;
com_leibie.Enabled:=false;
end
else
com_leibie.Enabled:=true;
btn_xiangxi.Visible:=false;
panel1.Visible:=true;
end;
if com_zhaobiao.Text='监理' then
begin
btn_xiangxi.Visible:=true;
panel1.Visible:=false;
end;
end;
procedure Tfrm_tongguozigesqr.LoadFile;
var
i,j:Integer;
iPage,iRow:Integer;
adoquery:tadoquery;
str:string;
top:string;
begin
if com_zhaobiao.Text='施工' then
begin
if cell1.OpenFile(SPATH+'report\shigong\yushen\tgzgyssqr.cll','')=0 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 cs_renshu from bid_canshu_SAVE 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+') ';
adoquery.open;
if strtoint(GetLeiBie(com_leibie.Text))>0 then
cell1.SetCellString(1,4,0,com_leibie.text)
else
cell1.SetCellString(1,4,0,' ');
top:=adoquery.fieldbyname('cs_renshu').AsString;
if top='' then
begin
freeandnil(adoquery);
exit;
end;
adoquery.Close;
{if com_leibie.ItemIndex=0 then
adoquery.SQL.Text:='select top '+trim(top)+' b.dwbm_id,a.dw_name,(c.ys_caiwu+c.ys_jishu+c.ys_jingyan) as ys_total,b.wj2_tgduanshu '
+' from bid_danwei_xinxi a '
+' ,bid_wenjian2 b,bid_yushen_defen c,bid_canshu_save d where b.wj2_leixing=1 and a.dw_id=b.dw_id and b.dw_id=c.dw_ID '
+' and b.xmgczb_id=c.xmgczb_id and c.xmgczb_id=d.xmgczb_id and c.ys_caiwu>=ISNULL(d.CS_CAIWU_HEGE,0) AND '
+' c.ys_jishu>=ISNULL(d.cs_jishu_hege,0) and c.ys_jingyan>=ISNULL(d.cs_jingyan_hege,0) and '
+' (c.ys_caiwu+c.ys_jishu+c.ys_jingyan)>=ISNULL(d.cs_zuidixian,0) 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+') '
+' order by b.ys_total DESC '
else}
adoquery.SQL.Text:='select top '+trim(top)+' b.dwbm_id,a.dw_name,(c.ys_caiwu+c.ys_jishu+c.ys_jingyan) as ys_total,b.wj2_tgduanshu '
+' from bid_danwei_xinxi a '
+' ,bid_wenjian2 b,bid_yushen_defen c,bid_canshu_save d where b.wj2_leixing=1 and a.dw_id=b.dw_id and b.dw_id=c.dw_ID '
+' and b.xmgczb_id=c.xmgczb_id and c.xmgczb_id=d.xmgczb_id and c.ys_caiwu>=ISNULL(d.CS_CAIWU_HEGE,0) '
+' and b.wj2_leibie=c.bd_leibie and b.wj2_leibie='+trim(getleibie(com_leibie.text))
+' AND c.ys_jishu>=ISNULL(d.cs_jishu_hege,0) and c.ys_jingyan>=ISNULL(d.cs_jingyan_hege,0) and '
+' (c.ys_caiwu+c.ys_jishu+c.ys_jingyan)>=ISNULL(d.cs_zuidixian,0) 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 b.wj2_fhx=1 and b.wj2_qzx=1'
+' order by b.ys_total DESC';
adoquery.open;
if adoquery.RecordCount=0 then exit;
setCellSheet(cell1,adoquery.RecordCount,25);
for i:=0 to adoquery.RecordCount-1 do
begin
iPage:=i div 25;
irow:=i mod 25;
cell1.SetCellDouble(1,irow+6,ipage,adoquery.fieldbyname('dwbm_id').AsInteger);
cell1.SetCellString(2,irow+6,ipage,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,irow+6,ipage,adoquery.fieldbyname('ys_total').AsString);
cell1.SetCellString(4,irow+6,ipage,adoquery.fieldbyname('wj2_tgduanshu').AsString);
adoquery.Next;
end;
finally
freeandnil(adoquery);
end;
end;
if com_zhaobiao.Text='监理' then
begin
if cell1.openfile(SPATH+'report\jianli\yushen\tgzgyssqr.cll','')<>1 then
begin
showmessage('文件打开错误');
exit;
end;
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;
if adoquery.Recordcount>1 then
cell1.InsertCol(3,adoquery.RecordCount-1,0);
adoquery.First;
for i:=0 to adoquery.RecordCount-1 do
begin
cell1.SetCellString(3+i,5,0,adoquery.fieldbyname('bd_name').AsString);
adoquery.Next;
end;
finally
freeandnil(adoquery);
end;
btn_xiangxi.Enabled:=true;
end;
end;
{procedure Tfrm_tongguozigesqr.ChooseLoadFile;
begin
cell1.ShowSideLabel(0, 0); //不显示行标
cell1.ShowTopLabel(0, 0); //不显示列标
LoadFile;
end; }
procedure Tfrm_tongguozigesqr.FormCreate(Sender: TObject);
begin
GetItems(com_xmname,com_zhaobiao,com_gclxname,1);
inherited;
panel1.Visible:=true;
label1.Caption:='请选择类别';
caption:='通过资格预审申请人一览表';
panel2.Caption:='通过资格预审申请人一览表';
com_project.Visible:=false;
com_leibie.Left:=70;
com_leibie.OnChange:=Com_LeibieChange;
bb_reflash.visible:=true;
bb_reflash.OnClick:=bb_reflashclick;
bb_savetodata.Visible:=true;
btn_xiangxi.Visible:=true;
btn_xiangxi.Left:=360;
btn_xiangxi.Parent:=panel3;
btn_xiangxi.top:=10;
btn_xiangxi.caption:='载入数据';
btn_xiangxi.OnClick:=btn_xiangxiOnChcik;
GetBiaoduan;
bb_savetodata.OnClick:=bb_savetodataclick;
cell1.OnMouseLClick:=Cell1MouseLClick;
cell1.OnEditFinish:=Cell1EditFinish;
LoadFile;
end;
procedure Tfrm_tongguozigesqr.bb_savetodataClick(Sender: TObject);
var
adoquery:tadoquery;
i:integer;
sql:string;
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.Close;
sql:='';
for i:=6 to 30 do
begin
if (cell1.GetCellString(2,i,cell1.GetCurSheet)<>'') and
(cell1.GetCellString(4,i,cell1.GetCurSheet)<>'') then
begin
sql:=sql+' update bid_wenjian2 set wj2_tgduanshu='+trim(cell1.GetCellString(4,i,cell1.GetCurSheet))
+' where wj2_leixing=1 and wj2_leibie='+getleibie(com_leibie.text)+' and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(cell1.GetCellString(2,i,cell1.GetCurSheet))+''') ; ';
end;
end;
if sql<>'' then
begin
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=sql;
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
end;
finally
freeandnil(adoquery);
end;
end;
procedure Tfrm_tongguozigesqr.Cell1MouseLClick(Sender: TObject; col, row, updn: Integer);
var
adoquery:tadoquery;
begin
if updn=0 then
begin
IF COM_ZHAOBIAO.Text<>'施工' then exit;
if (col=4) and (trim(cell1.GetCellString(4,row,cell1.getcursheet))<>'') then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=' update bid_wenjian2 set wj2_tgduanshu='
+trim(cell1.GetCellString(4,row,cell1.getcursheet))
+' where wj2_leixing=1 and wj2_leibie='+getleibie(com_leibie.text)
+' and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(cell1.GetCellString(2,row,cell1.getcursheet))+''') ';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
end;
end;
procedure Tfrm_tongguozigesqr.Cell1EditFinish(Sender: TObject;var text: WideString; var approve: Integer);
var
adoquery:tadoquery;
begin
if com_zhaobiao.Text<>'施工' then exit;
if (cell1.GetCurrentCol=4) and (trim(cell1.GetCellString(4,cell1.GetCurrentRow,cell1.getcursheet))<>'') then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=' update bid_wenjian2 set wj2_tgduanshu='
+trim(cell1.GetCellString(4,cell1.GetCurrentRow,cell1.getcursheet))
+' where wj2_leixing=1 and wj2_leibie='
+getleibie(com_leibie.text)+' and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(cell1.GetCellString(2,cell1.GetCurrentRow,cell1.getcursheet))+''') ';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
end;
procedure Tfrm_tongguozigesqr.Com_LeibieChange(Sender: TObject);
begin
inherited;
LoadFile;
end;
procedure Tfrm_tongguozigesqr.Com_zhaobiaoChange(Sender:TObject);
begin
inherited;
getbiaoduan;
loadfile;
end;
procedure Tfrm_tongguozigesqr.Com_xmnameChange(Sender:TObject);
begin
inherited;
Getbiaoduan;
loadfile;
end;
procedure Tfrm_tongguozigesqr.Com_GclxnameChange(Sender: TObject);
begin
inherited;
Getbiaoduan;
loadfile;
end;
procedure Tfrm_tongguozigesqr.bb_reflashClick(Sender: TObject);
begin
inherited;
LoadFile;
end;
procedure Tfrm_tongguozigesqr.btn_xiangxiOnChcik(Sender:Tobject);
var
adoquery:tadoquery;
i,j,recordcount,ipage,irow:integer;
top:Integer;
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:='select cs_renshu from bid_canshu_SAVE 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+') ';
adoquery.Open;
if adoquery.FieldByName('cs_renshu').AsString='' then
begin
freeandnil(adoquery);
exit;
end;
top:=adoquery.FieldByName('cs_renshu').AsInteger;
adoquery.Close;
adoquery.SQL.Text:='select top '+inttostr(top)+' b.dwbm_id,a.dw_name,bd_name from bid_danwei_xinxi a,'
+' bid_wenjian2 b,bid_ys_jl c,bid_canshu_save d,bid_biaoduan_xinxi e where b.wj2_leixing=1'
+' and a.dw_id=b.dw_id and b.dw_id=c.dw_ID and b.xmgczb_id=d.xmgczb_id and b.bd_isbn=c.bd_isbn'
+' and b.bd_isbn=e.bd_isbn and c.ysjl_caiwu>=ISNULL(d.CS_CAIWU_HEGE,0) AND'
+' c.ysjl_jishu>=ISNULL(d.cs_jishu_hege,0) and c.ysjl_jingyan>=ISNULL(d.cs_jingyan_hege,0) and'
+' (c.ysjl_caiwu+c.ysjl_jishu+c.ysjl_jingyan)>=ISNULL(d.cs_zuidixian,0) and e. 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 wj2_fhx=1 and wj2_qzx=1 order by dwbm_id';
adoquery.open;
j:=0;
recordcount:=0;
for i:=0 to adoquery.RecordCount-1 do
begin
if j<> adoquery.FieldByName('dwbm_id').AsInteger then
begin
recordcount:=recordcount+1;
j:=adoquery.FieldByName('dwbm_id').AsInteger;
end;
adoquery.Next;
end;
setcellsheet(cell1,recordcount,25);
adoquery.First;
I:=0;
while not adoquery.Eof do
begin
if recordcount=adoquery.FieldByName('dwbm_id').AsInteger then
begin
for j:=3 to cell1.GetCols(0) do
begin
if trim(cell1.GetCellString(j,5,0))=adoquery.FieldByName('bd_name').AsString then
cell1.SetCellString(j,irow+5,ipage,'√');
end;
end
else
begin
i:=i+1;
irow:=i mod 25;
ipage:=i div 25;
cell1.SetCellString(1,irow+5,ipage,adoquery.fieldbyname('dwbm_id').AsString);
cell1.SetCellString(2,irow+5,ipage,adoquery.fieldbyname('dw_name').AsString);
recordcount:=adoquery.FieldByName('dwbm_id').AsInteger;
for j:=3 to cell1.GetCols(0) do
begin
if trim(cell1.GetCellString(j,5,0))=adoquery.FieldByName('bd_name').AsString then
cell1.SetCellString(j,irow+5,ipage,'√');
end;
end;
adoquery.Next;
end;
finally
freeandnil(adoquery);
end;
btn_xiangxi.Enabled:=false;
end;
procedure Tfrm_tongguozigesqr.BitBtn2Click(Sender: TObject);
begin
inherited;
if trim(Com_zhaobiao.text)='施工' then
begin
getcellXuhao(cell1,6,30);
cell1.SaveFile(GetFilePath+GetLeiBie(com_leibie.text)+'_tgzgyssqr.cll',1);
cell1.openfile(GetFilePath+GetLeiBie(com_leibie.Text)+'_tgzgyssqr.cll','');
end;
if trim(Com_zhaobiao.text)='监理' then
begin
getcellXuhao(cell1,6,30);
cell1.SaveFile(GetFilePath+'tgzgyssqr.cll',1);
cell1.openfile(GetFilePath+'tgzgyssqr.cll','');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -