📄 zfrm_autogetbidu.~pas
字号:
// 计算其他分数
procedure Tzfrm_AutoGetBid.z_ACountScroreP();
var
I,J: integer;
begin
// 得到 选择值
J := ListView1.Items.Count-1 ;
for I:=0 to J do
begin
// 得到 ListView1 中值
if ListView1.Items.Item[I].SubItems[6] = '废标' then continue ;
z_AutoGet.z_Auto_g_ui_id := ListView1.Items.Item[I].StateIndex ; // 单位编号
z_AutoGet.z_Auto_g_gb_id := StrToInt(ListView1.Items.Item[I].SubItems[7]) ; // 定标编号
// 质量
z_TenderQualityP ; //***//
// 3, 业绩
z_TenderachievementP ; //***//
// 4, 安全文明
z_TendercivilizationP(); //***//
// 5, 考评
z_TenderCheckP ; //***//
// 6, 类似经验
z_TenderExperienceP ; //***//
// 7, 质量体系认证
z_TenderQualitySystemP ; //***//
// 8, 技术创新
z_TenderTechnoNewP ; //***//
// 9, 企业行为
z_TenderActionP ; //***//
end; // for - end
//
end;
// 1, 投标报价
procedure Tzfrm_AutoGetBid.z_TenderReportPriceP();
var
I,J: integer;
x,a,s: Double;
z_ai_id: integer; // 项目编号
ParamTabName: string;
begin
// 得到 选择值
// 得到参数表名
z_ai_id := 4 ;
ParamTabName := 'tm_funcparam' + IntToStr(z_ai_id) ;
zh_Select_SQL := 'select a from ' + ParamTabName + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
// 得到 参数a值
a := z_PublicQuery4F(zh_Select_SQL) ; //***//
x := 0 ;
zh_Select_SQL := 'select s from ' + ParamTabName + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
// 得到 参数s值
s := z_PublicQuery4F(zh_Select_SQL) ; //***//
J := ListView1.Items.Count-1 ;
for I:=0 to J do
begin
// 得到 ListView1 中值
if ListView1.Items.Item[I].SubItems[6] = '废标' then continue ;
if ListView1.Items.Item[I].SubItems[1] <> '' then // 最终标价
x := StrToFloat(ListView1.Items.Item[I].SubItems[1]) ;
z_AutoGet.z_Auto_g_gb_id := StrToInt(ListView1.Items.Item[I].SubItems[7]) ; // 定标编号
// 判断公式
if abs(1-x/z_TenderPriceD)<=a then
begin
// 得 满分
// 得到 参数s值
zh_Select_SQL := 'select s from ' + ParamTabName + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
s := z_PublicQuery4F(zh_Select_SQL) ; //***//
//zh_Insert_SQL := 'insert into tm_autogetbidlist values('+ IntToStr(z_AutoGet.z_Auto_g_gb_id) + ', ' + IntToStr(z_ai_id) + ', ' + FloatToStr(s) + ')' ;
//zh_PublicInsDelUpdQueryP(zh_Insert_SQL); //*****//
end;
if abs(1-x/z_TenderPriceD)>a then
begin
// 判断公式
if (x/z_TenderPriceD-1)>=0 then
begin // 公式1
// 得到 参数s值
zh_Select_SQL := 'select s-(((' + FloatToStr(x) + '/y)-1)/a)*b from ' + ParamTabName + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
s := z_PublicQuery4F(zh_Select_SQL) ; //***//
end
else // 公式2
begin
zh_Select_SQL := 'select s-((1-(' + FloatToStr(x) + '/y))/a)*b from ' + ParamTabName + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
s := z_PublicQuery4F(zh_Select_SQL) ; //***//
end;
end; // if - end
if s<0 then s := 0 ;
s := StrToFloat(Format('%2.2f', [s]));
zh_Insert_SQL := 'insert into tm_autogetbidlist values('+ IntToStr(z_AutoGet.z_Auto_g_gb_id) + ', ' + IntToStr(z_ai_id) + ', ' + FloatToStr(s) + ')' ;
zh_PublicInsDelUpdQueryP(zh_Insert_SQL); //*****//
end; // for - end
//
end;
procedure Tzfrm_AutoGetBid.z_SelectedListViewGetValuesP();
var
I,J: integer;
begin
// 得到 选择值
J := ListView1.Items.Count-1 ;
for I:=0 to J do
begin
if ListView1.Items.Item[I].Selected then
begin
z_AutoGet.z_Auto_g_ui_id := ListView1.Items.Item[I].StateIndex ; // 单位编号
z_AutoGet.z_Auto_ui_name := ListView1.Items.Item[I].Caption ; // 单位名称
z_AutoGet.z_Auto_gb_tenderflag := ListView1.Items.Item[I].SubItems[0] ; // 中标
if ListView1.Items.Item[I].SubItems[1] <> '' then // 最终标价
z_AutoGet.z_Auto_gb_reportprice := StrToFloat(ListView1.Items.Item[I].SubItems[1]) ;
if ListView1.Items.Item[I].SubItems[2] <> '' then // 总分数
z_AutoGet.z_Auto_gb_sumscore := StrToFloat(ListView1.Items.Item[I].SubItems[2]) ;
if ListView1.Items.Item[I].SubItems[3] <> '' then // 商务标分
z_AutoGet.z_Auto_gb_business := StrToFloat(ListView1.Items.Item[I].SubItems[3]) ;
if ListView1.Items.Item[I].SubItems[4] <> '' then // 答辩
z_AutoGet.z_Auto_answer := StrToFloat(ListView1.Items.Item[I].SubItems[4]) ;
if ListView1.Items.Item[I].SubItems[5] <> '' then // 技术标分
z_AutoGet.z_Auto_techno := StrToFloat(ListView1.Items.Item[I].SubItems[5]) ;
z_AutoGet.z_Auto_cancel := ListView1.Items.Item[I].SubItems[6] ; // 废标
z_AutoGet.z_Auto_g_gb_id := StrToInt(ListView1.Items.Item[I].SubItems[7]) ; // 定标编号
Break ;
end;
end;
//
end;
procedure Tzfrm_AutoGetBid.z_UpdateParamPriceP();
var
g_ai_id: integer; // 项目编号 For Table Name
z_ai_id: integer; // 项目编号
ParamTabName: string;
begin
// 更新参数表 - 评标价
// 应该从数据库中得到, "最终报价"的项目编号为 14
z_ai_id := 14 ;
zh_Select_SQL := 'select ai_preid from tm_assessitem where g_ai_id=' + '''' + IntToStr(z_ai_id) + '''' ;
// 得到 项目编号 For Table Name
g_ai_id := StrToInt(FloatToStr(z_PublicQuery4F(zh_Select_SQL))) ;
// 得到参数表名
ParamTabName := 'tm_funcparam' + IntToStr(g_ai_id) ;
// 更新数据
try {try <1> S}
zh_Update_SQL := 'update ' + ParamTabName + ' set y=' + FloatToStr(z_TenderPriceD) + ' where g_fp_id=' + IntToStr(z_FuncParamPlanI) ;
Query1.Close;
Query1.SQL.Clear ;
Query1.SQL.Add(zh_Update_SQL);
Query1.Prepare ;
Query1.ExecSQL ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查或系统管理员联系',
'数据库错',
MB_OK+MB_ICONError) ;
Exit ;
end; {try <1> E}
//
end;
procedure Tzfrm_AutoGetBid.z_GetTenderPriceP();
var
z_count: integer;
z_max: Double;
z_min: Double;
begin
// 得到评标价
// 'select min(gb_reportprice) from tm_autogetbid
// where (gb_reportprice<>0) and (pi_code=:pi_code)';
zh_Select_SQL := 'select count(gb_reportprice) from tm_autogetbid where (gb_reportprice<>0) and pi_code=' + '''' + zh_ci_codeS + '''' ;
z_count := StrToInt(FloatToStr(z_PublicQuery4F(zh_Select_SQL))) ;
if z_count<5 then
begin
// 有效标书小于5
zh_Select_SQL := 'select avg(gb_reportprice) from tm_autogetbid where (gb_reportprice<>0) and pi_code=' + '''' + zh_ci_codeS + '''' ;
//
end
else
begin
// 有效标书大于5
{
zh_Select_SQL := 'select avg(gb_reportprice) from tm_autogetbid ' ;
zh_Select_SQL := zh_Select_SQL + ' where (gb_reportprice <> (select min(gb_reportprice) from tm_autogetbid where gb_reportprice <>0)) ' ;
zh_Select_SQL := zh_Select_SQL + ' and (gb_reportprice <> (select max(gb_reportprice) from tm_autogetbid where gb_reportprice <>0)) ' ;
zh_Select_SQL := zh_Select_SQL + ' and (gb_reportprice <> 0 ) and (pi_code=' + '''' + zh_ci_codeS + '''' + ')' ;
}
zh_Select_SQL := 'select min(gb_reportprice) from tm_autogetbid where (gb_reportprice<>0) and pi_code=' + '''' + zh_ci_codeS + '''' ;
z_min := z_PublicQuery4F(zh_Select_SQL) ;
zh_Select_SQL := 'select max(gb_reportprice) from tm_autogetbid where (gb_reportprice<>0) and pi_code=' + '''' + zh_ci_codeS + '''' ;
z_max := z_PublicQuery4F(zh_Select_SQL) ;
zh_Select_SQL := 'select (sum(gb_reportprice)-' + FloatToStr(z_max) + '-' + FloatToStr(z_min) + ')/(' + IntToStr(z_count) + '-2) from tm_autogetbid where (gb_reportprice<>0) and pi_code=' + '''' + zh_ci_codeS + '''' ;
//
end;
z_TenderPriceD := z_PublicQuery4F(zh_Select_SQL) ;
//edit1.text:= format('%m ',[i]);
Label9.Caption := Format('%m',[z_TenderPriceD]) + ' 元' ;
//
end;
procedure Tzfrm_AutoGetBid.z_SelectListView1P();
var
I,J: integer;
z_ui_id: integer; // 单位编号
z_ai_id: integer; // 项目编号
begin
// 得到最终报价
J := ListView1.Items.Count-1 ;
for I:=0 to J do
begin
z_ui_id := ListView1.Items.Item[I].StateIndex ;
// 应该从数据库中得到, "最终报价"的项目编号为 14
z_ai_id := 14 ;
zh_Select_SQL := 'select x from tm_assessdata where (g_ui_id = :z_ui_id) and (g_ai_id = :z_ai_id)' ;
try {try <1> S}
Query4.Close ;
Query4.SQL.Clear ;
Query4.SQL.Add(zh_Select_SQL) ;
Query4.ParamByName('z_ui_id').AsInteger := z_ui_id ;
Query4.ParamByName('z_ai_id').AsInteger := z_ai_id ;
Query4.Prepare ;
Query4.Open ;
Query4.First ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查或系统管理员联系',
'数据库错',
MB_OK+MB_ICONError) ;
Exit ;
end; {try <1> E}
if Query4.RecordCount = 0 then
begin
//ListView1.Items.Item[I].SubItems[6] := '废标' ;
// 更新 定标记录表
try {try <1> S}
zh_Update_SQL := 'update tm_autogetbid set gb_reportprice=:gb_reportprice, gb_cancellation =:gb_cancellation where (pi_code=:pi_code) and (g_ui_id=:g_ui_id)' ;
//showmessage(zh_Insert_SQL);
Query1.Close;
Query1.SQL.Clear ;
Query1.SQL.Add(zh_Update_SQL);
Query1.ParamByName('gb_reportprice').AsInteger := 0 ;
Query1.ParamByName('gb_cancellation').AsString := '废标' ;
Query1.ParamByName('pi_code').AsString := zh_ci_codeS ;
Query1.ParamByName('g_ui_id').AsInteger := z_ui_id ;
Query1.Prepare ;
Query1.ExecSQL ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查',
'数据库错',
MB_OK+MB_ICONError);
Exit ;
end; {try <1> E}
continue ;
end;
//ListView1.Items.Item[I].SubItems[1] := Query4.Fields[0].AsString ;
try {try <1> S}
zh_Update_SQL := 'update tm_autogetbid set gb_reportprice=:gb_reportprice where (pi_code=:pi_code) and (g_ui_id=:g_ui_id)' ;
//showmessage(zh_Insert_SQL);
Query1.Close;
Query1.SQL.Clear ;
Query1.SQL.Add(zh_Update_SQL);
Query1.ParamByName('gb_reportprice').AsFloat := Query4.Fields[0].AsFloat ;
Query1.ParamByName('pi_code').AsString := zh_ci_codeS ;
Query1.ParamByName('g_ui_id').AsInteger := z_ui_id ;
Query1.Prepare ;
Query1.ExecSQL ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查',
'数据库错',
MB_OK+MB_ICONError);
Exit ;
end; {try <1> E}
//
end; // for - end
// 刷新 listView1
z_FlashBidListView1P ; //***//
//
end;
procedure Tzfrm_AutoGetBid.z_FlashBidListView1P();
var
NewItem: TListItem;
begin
// 3, 显示
ListView1.Items.Clear ;
zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' ;
try {try <1> S}
Query4.Close ;
Query4.SQL.Clear ;
Query4.SQL.Add(zh_Select_SQL) ;
Query4.Prepare ;
Query4.Open ;
Query4.First ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查或系统管理员联系',
'数据库错',
MB_OK+MB_ICONError) ;
Exit ;
end; {try <1> E}
while not Query4.Eof do
begin {while <1> S}
// 有记录开放"计算评标价"
BitBtn1.Enabled := True ;
NewItem:=ListView1.Items.add ;
// 保存单位编号
NewItem.StateIndex := Query4.Fields[2].AsInteger ;
//
NewItem.Caption := Query4.Fields[3].AsString ;
NewItem.SubItems.Add(Query4.Fields[4].AsString) ;
NewItem.SubItems.Add(Query4.Fields[5].AsString) ;
NewItem.SubItems.Add(Query4.Fields[6].AsString) ;
NewItem.SubItems.Add(Query4.Fields[7].AsString) ;
NewItem.SubItems.Add(Query4.Fields[8].AsString) ;
NewItem.SubItems.Add(Query4.Fields[9].AsString) ;
NewItem.SubItems.Add(Query4.Fields[10].AsString) ;
// 定标编号
NewItem.SubItems.Add(Query4.Fields[0].AsString) ;
NewItem.ImageIndex := 0 ;
Query4.Next ;
end; {while <1> E}
//
end;
procedure Tzfrm_AutoGetBid.z_ShowBidUnitP();
begin
// 1, 检查表或视图中,有没有记录
ListView1.Items.Clear ;
zh_Select_SQL := 'select * from tm_autogetbidunitV where pi_code=' + '''' + zh_ci_codeS + '''' ;
Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add(zh_Select_SQL);
Query2.Open;
if Query2.RecordCount=0 then
begin
// 2, 如没有, 向定标记录表中,插入记录(只有单位编号)
zh_Select_SQL := 'select g_ui_id from tm_bidunitinfo where pi_code=' + '''' + zh_ci_codeS + '''' ;
Query3.Close;
Query3.SQL.Clear;
Query3.SQL.Add(zh_Select_SQL);
Query3.Open;
if Query3.RecordCount=0 then Exit ;
Query3.First;
while not Query3.Eof do
begin
// 得到,新的“定标记录”序列值
zh_GetNewIdS := 'ge_gb_id' ;
//z_I := zh_GetNewIdF(zh_GetNewIdS) ;
try {try <1> S}
zh_Insert_SQL := 'insert into tm_autogetbid (g_gb_id, pi_code, g_ui_id) values(:g_gb_id, :pi_code, :g_ui_id)' ;
//showmessage(zh_Insert_SQL);
Query1.Close;
Query1.SQL.Clear ;
Query1.SQL.Add(zh_Insert_SQL);
Query1.ParamByName('g_gb_id').AsInteger := zh_GetNewIdF(zh_GetNewIdS) ;
Query1.ParamByName('pi_code').AsString := zh_ci_codeS ;
Query1.ParamByName('g_ui_id').AsInteger := Query3.Fields[0].AsInteger ;
Query1.Prepare ;
Query1.ExecSQL ;
except
// 数据库错
Application.MessageBox(
'数据库连接错误,请您检查',
'数据库错',
MB_OK+MB_ICONError);
Exit ;
end; {try <1> E}
Query3.Next;
end; // while - end
end; // if - end
// 3, 显示
z_FlashBidListView1P ;
//
end;
procedure Tzfrm_AutoGetBid.z_InitComboBox1P();
var
temp: string;
begin
//
zh_Select_SQL := 'select * from tm_assessitemplan' ;
Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add(zh_Select_SQL);
Query2.Open;
ComboBox1.Items.Clear;
Query2.First;
// 方案代码
z_FuncParamPlanI := Query2.Fields[0].AsInteger ;
temp := Query2.Fields[1].AsString ;
while not Query2.Eof do
begin
ComboBox1.Items.Add(Trim(Query2.Fields[1].AsString));
Query2.Next;
end;
ComboBox1.ItemIndex:=0;
ComboBox2.ItemIndex:=0;
//ComboBox1.Text := temp ;
//
end;
////////////////////// 用户自定义- <结束> //////////////////////
procedure Tzfrm_AutoGetBid.Button1Click(Sender: TObject);
begin
// 工程参数设置
zfrm_ProjectParam.ShowModal ;
//
end;
procedure Tzfrm_AutoGetBid.BitBtn1Click(Sender: TObject);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -