⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dealstatetjfrm.pas

📁 一个电力企业的后台管理程序
💻 PAS
📖 第 1 页 / 共 2 页
字号:
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealGZ a,DealedGZ b ';
       Open;


     end;
   end;
   if CmBox_SelectTJStyle.Text='按任意时间统计' then
   begin
     QRLbl_DateRangeGZBX.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_Start.date)+FormatDateTime('hh"时"mm"分"',TimePicker_Start.Time)+'至'+FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_End.date)+FormatDateTime('hh"时"mm"分"',TimePicker_End.Time);

     StartTime:=DatePicker_Start.Date;
     EndTime:=DatePicker_End.Date;

     ReplaceTime(StartTime,TimePicker_Start.time);
     ReplaceTime(EndTime,TimePicker_End.time);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealGZ';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedGZ';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealGZ as  select count(*) NotDealNum from ClientElecOut where state<>2 and state<>7 and zzflsj>=:StartTime and zzflsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedGZ as  select count(*) DealedNum from ClientElecOut where (state=2 or state=7) and zzflsj>=:StartTime and zzflsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealGZ a,DealedGZ b ';
       Open;


     end;
   end;
//   QRep_GZCX.Preview;
   QRep_GZCX.PreviewModeless;
   QRep_GZCX.Hide;
 end;


//信息故障统计
 if RdBtn_YKZX.Checked=True then
 begin
   if CmBox_SelectTJStyle.Text='按月统计' then
   begin
      QRLbl_DateRangeYKZX.Caption:=IntToStr(CurYear)+'年'+Edt_OnlyMonthSelect.Text+'月';

      with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealYK';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedYK';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealYK as  select count(*) NotDealNum from YkGcZx where state<>2 and state<>7 and state<>8 and year(slTime)='''+inttostr(CurYear)+''' and Month(sltime)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedYK as  select count(*) DealedNum from YkGcZx where (state=2 or state=7 or state=8) and year(sltime)='''+inttostr(CurYear)+''' and Month(sltime)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealYK a,DealedYK b ';
       Open;


     end;
   end;

   if CmBox_SelectTJStyle.Text='按日统计' then
   begin
     QRLbl_DateRangeYKZX.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker.date);

     DecodeDate(DatePicker.DateTime,Uyear,Umonth,Uday);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealYK';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedYK';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealYK as  select count(*) NotDealNum from YkGcZx where state<>2 and state<>7 and state<>8 and year(sltime)='''+IntToStr(Uyear)+''' and month(sltime)='''+IntToStr(Umonth)+''' and Day(sltime)='''+IntToStr(Uday)+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedYK as  select count(*) DealedNum from YkGcZx where (state=2 or state=7 or state=8) and year(sltime)='''+IntToStr(Uyear)+''' and month(sltime)='''+IntToStr(Umonth)+''' and Day(sltime)='''+IntToStr(Uday)+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealYK a,DealedYK b ';
       Open;


     end;
   end;
   if CmBox_SelectTJStyle.Text='按任意时间统计' then
   begin
     QRLbl_DateRangeYKZX.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_Start.date)+FormatDateTime('hh"时"mm"分"',TimePicker_Start.Time)+'至'+FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_End.date)+FormatDateTime('hh"时"mm"分"',TimePicker_End.Time);

     StartTime:=DatePicker_Start.Date;
     EndTime:=DatePicker_End.Date;

     ReplaceTime(StartTime,TimePicker_Start.time);
     ReplaceTime(EndTime,TimePicker_End.time);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealYK';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedYK';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealYK as  select count(*) NotDealNum from YkGcZx where state<>2 and state<>7 and state<>8 and sltime>=:StartTime and sltime<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedYK as  select count(*) DealedNum from YkGcZx where (state=2 or state=7 or state=8) and sltime>=:StartTime and sltime<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealYK a,DealedYK b ';
       Open;


     end;
   end;
//   QRep_GZCX.Preview;
   QRep_YKZX.PreviewModeless;
   QRep_YKZX.Hide;
 end;


//用户投诉统计
 if RdBtn_YHTS.Checked=True then
 begin
   if CmBox_SelectTJStyle.Text='按月统计' then
   begin
      QRLbl_DateRangeYHTS.Caption:=IntToStr(CurYear)+'年'+Edt_OnlyMonthSelect.Text+'月';

      with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealTS';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedTS';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealTS as  select count(*) NotDealNum from ClientComp where state<>2 and state<>3 and state<>7 and year(slsj)='''+inttostr(CurYear)+''' and Month(slsj)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedTS as  select count(*) DealedNum from ClientComp where (state=2 or state=3 or state=7) and year(slsj)='''+inttostr(CurYear)+''' and Month(slsj)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealTS a,DealedTS b ';
       Open;


     end;
   end;

   if CmBox_SelectTJStyle.Text='按日统计' then
   begin
     QRLbl_DateRangeYHTS.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker.date);

     DecodeDate(DatePicker.DateTime,Uyear,Umonth,Uday);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealTS';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedTS';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealTS as  select count(*) NotDealNum from ClientComp where state<>2 and state<>3 and state<>7 and year(slsj)='''+IntToStr(Uyear)+''' and month(slsj)='''+IntToStr(Umonth)+''' and Day(slsj)='''+IntToStr(Uday)+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedTS as  select count(*) DealedNum from ClientComp where (state=2 or state=3 or state=7) and year(slsj)='''+IntToStr(Uyear)+''' and month(slsj)='''+IntToStr(Umonth)+''' and Day(slsj)='''+IntToStr(Uday)+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealTS a,DealedTS b ';
       Open;


     end;
   end;
   if CmBox_SelectTJStyle.Text='按任意时间统计' then
   begin
     QRLbl_DateRangeYHTS.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_Start.date)+FormatDateTime('hh"时"mm"分"',TimePicker_Start.Time)+'至'+FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_End.date)+FormatDateTime('hh"时"mm"分"',TimePicker_End.Time);

     StartTime:=DatePicker_Start.Date;
     EndTime:=DatePicker_End.Date;

     ReplaceTime(StartTime,TimePicker_Start.time);
     ReplaceTime(EndTime,TimePicker_End.time);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealTS';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedTS';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealTS as  select count(*) NotDealNum from ClientComp where state<>2 and state<>3 and state<>7 and slsj>=:StartTime and slsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedTS as  select count(*) DealedNum from ClientComp where (state=2 or state=3 or state=7) and slsj>=:StartTime and slsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealTS a,DealedTS b ';
       Open;


     end;
   end;
//   QRep_GZCX.Preview;
   QRep_YHTS.PreviewModeless;
   QRep_YHTS.Hide;
 end;

//用户咨询统计
 if RdBtn_YHZX.Checked=True then
 begin
   if CmBox_SelectTJStyle.Text='按月统计' then
   begin
      QRLbl_DateRangeYHZX.Caption:=IntToStr(CurYear)+'年'+Edt_OnlyMonthSelect.Text+'月';

      with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealZX';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedZX';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealZX as  select count(*) NotDealNum from ClientAsk where state<>2 and state<>7 and year(slsj)='''+inttostr(CurYear)+''' and Month(slsj)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedZX as  select count(*) DealedNum from ClientAsk where (state=2 or state=7) and year(slsj)='''+inttostr(CurYear)+''' and Month(slsj)='''+Edt_OnlyMonthSelect.Text+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealZX a,DealedZX b ';
       Open;


     end;
   end;

   if CmBox_SelectTJStyle.Text='按日统计' then
   begin
     QRLbl_DateRangeYHZX.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker.date);

     DecodeDate(DatePicker.DateTime,Uyear,Umonth,Uday);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealZX';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedZX';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealZX as  select count(*) NotDealNum from ClientAsk where state<>2 and state<>7 and year(slsj)='''+IntToStr(Uyear)+''' and month(slsj)='''+IntToStr(Umonth)+''' and Day(slsj)='''+IntToStr(Uday)+'''';
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedZX as  select count(*) DealedNum from ClientAsk where (state=2 or state=7) and year(slsj)='''+IntToStr(Uyear)+''' and month(slsj)='''+IntToStr(Umonth)+''' and Day(slsj)='''+IntToStr(Uday)+'''';
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealZX a,DealedZX b ';
       Open;


     end;
   end;
   if CmBox_SelectTJStyle.Text='按任意时间统计' then
   begin
     QRLbl_DateRangeYHZX.Caption:=FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_Start.date)+FormatDateTime('hh"时"mm"分"',TimePicker_Start.Time)+'至'+FormatDateTime('yyyy"年"mm"月"dd"日"',DatePicker_End.date)+FormatDateTime('hh"时"mm"分"',TimePicker_End.Time);

     StartTime:=DatePicker_Start.Date;
     EndTime:=DatePicker_End.Date;

     ReplaceTime(StartTime,TimePicker_Start.time);
     ReplaceTime(EndTime,TimePicker_End.time);

     with DM_DealStateTJ.Qr_DealStateTj do
      begin
       close; sql.Clear;
       sql.Text:='drop view NotDealZX';
       try
        ExecSQL;
       except
       end;


       close; sql.Clear;
       sql.Text:='drop view DealedZX';
       try
        ExecSQL;
       except
       end;

       close; sql.Clear;
       sql.Text:='create view NotDealZX as  select count(*) NotDealNum from ClientAsk where state<>2 and state<>7 and slsj>=:StartTime and slsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;


       close; sql.Clear;
       sql.Text:='create view DealedZX as  select count(*) DealedNum from ClientAsk where (state=2 or state=7) and slsj>=:StartTime and slsj<=:EndTime';
       ParamByName('StartTime').asDateTime:=StartTime;
       ParamByName('EndTime').asDateTime:=EndTime;
       ExecSQL;

       close; sql.Clear;
       sql.Text:='select a.NotDealNum,b.DealedNum from NotDealZX a,DealedZX b ';
       Open;


     end;
   end;
//   QRep_GZCX.Preview;
   QRep_YHZX.PreviewModeless;
   QRep_YHZX.Hide;
 end;


end;

procedure TForm_DealStateTJ.FormDestroy(Sender: TObject);
begin
   Form_DealStateTJ:=nil;
end;

procedure TForm_DealStateTJ.CmBox_SelectTJStyleKeyPress(Sender: TObject;
  var Key: Char);
begin
key:=#0;
end;

procedure TForm_DealStateTJ.Edt_OnlyMonthSelectKeyPress(Sender: TObject;
  var Key: Char);
begin
 key:=#10;
end;

procedure TForm_DealStateTJ.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if screen.FormCount=2 then WebIsHide(0);
  Action:=CaFree;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -