📄 bushy_monedit.pas
字号:
QueryPageLeft1.Post;
end;
1:
begin
QueryPageRight1.Locate('指标代码',ResultValue,[]);
QueryPageRight1.Edit;
QueryPageRight1.fieldbyname('测算值').AsFloat:=curResult;
QueryPageRight1.Post;
end;
2:
begin
QueryPageLeft2.Locate('指标代码',ResultValue,[]);
QueryPageLeft2.Edit;
QueryPageLeft2.fieldbyname('测算值').AsFloat:=curResult;
QueryPageLeft2.Post;
end;
3:
begin
QueryPageRight2.Locate('指标代码',ResultValue,[]);
QueryPageRight2.Edit;
QueryPageRight2.fieldbyname('测算值').AsFloat:=curResult;
QueryPageRight2.Post;
end;
end;
IsModifyIndex:=False;
end;
procedure TBusHYMonRep.FormShow(Sender: TObject);
begin
PostIndex:='';
end;
procedure TBusHYMonRep.RefreshPage;
begin
QueryPageLeft1.Next;
QueryPageLeft1.Prior;
QueryPageRight1.Next;
QueryPageRight1.Prior;
QueryPageLeft2.Next;
QueryPageLeft2.Prior;
QueryPageRight2.Next;
QueryPageRight2.Prior;
end;
procedure TBusHYMonRep.OpenAllPage;
begin
QueryPageLeft1.Close;
QueryPageLeft1.SQL.Clear;
QueryPageLeft1.SQL.Add('select * from 公交行业统计月报_z where 统计年份='+ComboBox1.text+
' and 统计月份='+ComboBox2.text+' and 城市代码='+''''+Edit9.Text+''''+
' and 指标代码 in (select 指标代码 from 公交行业统计月报指标定义表 where 显示页码=1 and 显示位置=1)');
QueryPageLeft1.Open;
QueryPageRight1.Close;
QueryPageRight1.SQL.Clear;
QueryPageRight1.SQL.Add('select * from 公交行业统计月报_z where 统计年份='+ComboBox1.text+
' and 统计月份='+ComboBox2.text+' and 城市代码='+''''+Edit9.Text+''''+
' and 指标代码 in (select 指标代码 from 公交行业统计月报指标定义表 where 显示页码=1 and 显示位置=2)');
QueryPageRight1.Open;
QueryPageLeft2.Close;
QueryPageLeft2.SQL.Clear;
QueryPageLeft2.SQL.Add('select * from 公交行业统计月报_z where 统计年份='+ComboBox1.text+
' and 统计月份='+ComboBox2.text+' and 城市代码='+''''+Edit9.Text+''''+
' and 指标代码 in (select 指标代码 from 公交行业统计月报指标定义表 where 显示页码=2 and 显示位置=1)');
QueryPageLeft2.Open;
QueryPageRight2.Close;
QueryPageRight2.SQL.Clear;
QueryPageRight2.SQL.Add('select * from 公交行业统计月报_z where 统计年份='+ComboBox1.text+
' and 统计月份='+ComboBox2.text+' and 城市代码='+''''+Edit9.Text+''''+
' and 指标代码 in (select 指标代码 from 公交行业统计月报指标定义表 where 显示页码=2 and 显示位置=2)');
QueryPageRight2.Open;
ADOQuery4.SQL.Clear;
ADOQuery4.SQL.Add('select * from 公交行业统计月报表 where 统计年份='+
ComboBox1.Text+' and 统计月份='+ComboBox2.text+
' and 城市代码='+''''+Edit9.text+'''');
ADOQuery4.Open;
end;
procedure TBusHYMonRep.SpeedButton2Click(Sender: TObject);
begin
if(Edit9.Text='')then
begin
showmessage('请选择城市代码!');
exit;
end;
if(not CheckYearMon)then exit;
if(BitBtn3.Enabled=true)then
begin
MessageBox(self.Handle,'请先确认你的添加,修改,删除结果。','注意',MB_OK);
exit;
end;
ButtonEnable(nil);
DBMemo1.ReadOnly:=true;
OpenAllPage;
AddPrnQuery;
curYear:= ComboBox1.Text;
curMon:= ComboBox2.Text;
if(ADOQPrintMon.RecordCount<=0)then
begin
MessageBox(self.Handle,'没有数据','消息',MB_OK);
end;
end;
function TBusHYMonRep.AddPrnQuery:boolean;
begin
if(not CheckYearMon)then
begin
AddPrnQuery:=false;
exit;
end;
ADOQPrintMon.Close;
ADOQPrintMon.SQL.Clear;
ADOQPrintMon.SQL.Add('select * from 公交行业统计月报_z where 统计年份='+ComboBox1.text+
' and 统计月份='+ComboBox2.text+' and 城市代码='+''''+Edit9.text+'''');
try
ADOQPrintMon.Open;
AddPrnQuery:=true;
except
AddPrnQuery:=false;
end;
end;
procedure TBusHYMonRep.BitBtn7Click(Sender: TObject);
begin
Close;
end;
procedure TBusHYMonRep.BitBtn8Click(Sender: TObject);
var iRow,iCol,iRecNum:integer;
begin
if(ADOQPrintMon.Active=false)then
begin
if(not AddPrnQuery)then
begin
exit;
end;
end;
if DeviceDetect=0 then
begin
exit;
end;
//AddPrn;
if(PrnInfoFrm.ShowModal<>mrOK)then
begin
exit;
end;
PrintInit(ExtractFilePath(Application.ExeName),'BusCorMonInputTab');
iRow := 1 ;
iRecNum := 1 ;
ADOQPrintMon.First;
iCol := 4;
for iRecNum := 0 to 80 do
begin
if (iRecNum>=0) and (iRecNum<=19) then
begin
iRow := iRecNum+8;
iCol := 4;
end
else if (iRecNum >= 20) and (iRecNum <= 39) then
begin
iCol:= 8;
iRow:= iRecNum - 20+8;
end;
if (iRecNum >= 40) and ( iRecNum <= 60)then
begin
iCol:= 4;
iRow:= iRecNum - 10 + 8;
end;
if (iRecNum >= 61) and (iRecNum <= 80)then
begin
iCol:= 8;
iRow:= iRecNum - 31+ 8;
end;
WriteCell(iRow,iCol,Converter(ADOQPrintMon.FieldByName('测算值').AsString));
case iRecNum of
0:
begin
//WriteCell(iRow-6,1,'填报单位:' + Edit8.text);
//WriteCell(iRow-4,1,'法人代码:' + Edit9.text);
WriteCell(iRow-5,4,ComboBox1.Text + ' 年' + ComboBox2.Text + ' 月');
WriteCell(iRow+20,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
WriteCell(iRow+20,4,'统计人员:' + PrnInfoFrm.StatPerson);
WriteCell(iRow+20,6,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
end
;
40:
begin
//WriteCell(iRow-6,1,'填报单位:' + Edit8.text);
//WriteCell(iRow-4,1,'法人代码:' + Edit9.text);
WriteCell(iRow-5,4,ComboBox1.Text + ' 年' + ComboBox2.Text + ' 月');
WriteCell(iRow+21,1,'统计负责人:' + PrnInfoFrm.StatMainPerson);
WriteCell(iRow+21,4,'统计人员:' + PrnInfoFrm.StatPerson);
WriteCell(iRow+21,6,'填报日期:' + DateToStr(PrnInfoFrm.StatDate));
end
;
else ;
end;
ADOQPrintMon.Next;
end;
PrintExcelShow;
PrintPreview;
CloseActiveBook;
//end;
end;
procedure TBusHYMonRep.QueryPageLeft1AfterScroll(DataSet: TDataSet);
var
SavePlace: TBookmark;
tmpstr:string;
begin
if(PostIndex<>'')then
begin
tmpstr:=PostIndex;
PostIndex:='';
SavePlace := DataSet.GetBookmark;
try
CheckBalanceRel(tmpstr);
except
try
CheckBalanceRel(tmpstr);
except
end;
end;
DataSet.GotoBookmark(SavePlace);
DataSet.FreeBookmark(SavePlace);
end;
end;
procedure TBusHYMonRep.QueryPageLeft1AfterPost(DataSet: TDataSet);
begin
if(not IsModifyIndex) then
PostIndex:=DataSet.FieldByName('指标代码').AsString;
end;
procedure TBusHYMonRep.QueryPageLeft1AfterEdit(DataSet: TDataSet);
begin
if(((DataSet.FieldByName('指标类型').AsString='固定指标') or (DataSet.FieldByName('指标类型').AsString='')) and (not IsModifyIndex))then
DataSet.Cancel;
end;
procedure TBusHYMonRep.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
QueryPageLeft1.close;
QueryPageRight1.close;
QueryPageLeft2.close;
QueryPageRight2.close;
end;
procedure TBusHYMonRep.DBGrid1Exit(Sender: TObject);
var
tempnum:single;
begin
try
tempnum:=QueryPageLeft1.FieldByName('测算值').AsFloat;
except
MessageBox(self.Handle,'请输入数字!','错误',MB_OK);
QueryPageLeft1.FieldByName('测算值').AsFloat:=0;
end;
end;
procedure TBusHYMonRep.ComboBox1Change(Sender: TObject);
begin
if((curYear<>ComboBox1.text) or (curMon<>ComboBox2.text))then
begin
BitBtn2.Enabled:=false;
BitBtn4.Enabled:=false;
BitBtn6.Enabled:=false;
BitBtn3.Enabled:=False;
BitBtn5.Enabled:=False;
BitBtn8.Enabled:=false;
end else
begin
ButtonEnable(nil);
end;
end;
procedure TBusHYMonRep.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if(Key=Char(VK_RETURN))then
DBGrid1.DataSource.DataSet.Next;
end;
procedure TBusHYMonRep.DBGrid2KeyPress(Sender: TObject; var Key: Char);
begin
if(Key=Char(VK_RETURN))then
DBGrid2.DataSource.DataSet.Next;
end;
procedure TBusHYMonRep.DBGrid3KeyPress(Sender: TObject; var Key: Char);
begin
if(Key=Char(VK_RETURN))then
DBGrid3.DataSource.DataSet.Next;
end;
procedure TBusHYMonRep.DBGrid4KeyPress(Sender: TObject; var Key: Char);
begin
if(Key=Char(VK_RETURN))then
DBGrid4.DataSource.DataSet.Next;
end;
procedure TBusHYMonRep.SpeedButton1Click(Sender: TObject);
begin
if(CitySelectForm.showmodal=mrok)then
BusHYMonRep.Edit9.Text:=CitySelectForm.Edit1.Text;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -