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

📄 trrepfrm.pas

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

procedure TForm_TrRep.Sqltrue(anyqry:TQuery;sqlstr:string);
begin
  with anyqry do
  begin
    close;  sql.clear;  sql.text:=sqlstr;  prepare;
    SelStartDateTime:=Form_prgramstatic.DatePicker_Start.date;
    SelEndDateTime:=Form_prgramstatic.DatePicker_End.date;
    replacetime(SelStartDateTime,Form_prgramstatic.TimePicker_Start.time);
    replacetime(SelEndDateTime,Form_prgramstatic.TimePicker_End.time);
    ParamByName('Start').asdatetime:=SelStartDateTime;
    ParamByName('End').asdatetime:=SelEndDateTime;
    open;
  end;
end;

procedure TForm_TrRep.QuickRep1Preview(Sender: TObject);
begin
  with TMyPreview.Create(application) do
    begin
      QRPreview1.QRPrinter := TQRPrinter(sender);
      CurRep := self.QuickRep1;
      Show;
    end;
end;

procedure TForm_TrRep.FormCreate(Sender: TObject);
//var
  //year,month,day:word;
begin
  i:=0;  j:=0;
  //decodedate(Form_prgramstatic.DatePicker_Start.date,year,month,day);
  QRLabel1.Caption:='计划部审批统计 (  月统计)';
  QRLabel11.Caption:='0'; QRLabel12.Caption:='0'; QRLabel14.Caption:='0'; QRLabel15.Caption:='0'; QRLabel33.Caption:='0';//用电负控
  QRLabel16.Caption:='0'; QRLabel4.Caption:='0';  QRLabel19.Caption:='0'; QRLabel20.Caption:='0'; QRLabel34.Caption:='0';//营业管理
  QRLabel21.Caption:='0'; QRLabel23.Caption:='0'; QRLabel25.Caption:='0'; QRLabel26.Caption:='0'; QRLabel35.Caption:='0';//通信所
  QRLabel27.Caption:='0'; QRLabel28.Caption:='0'; QRLabel30.Caption:='0'; QRLabel31.Caption:='0'; QRLabel36.Caption:='0';//调度所
  QRLabel42.Caption:='0'; QRLabel43.Caption:='0'; QRLabel45.Caption:='0'; QRLabel46.Caption:='0'; QRLabel47.Caption:='0';//计算机中心
  QRLabel49.Caption:='0'; QRLabel50.Caption:='0'; QRLabel52.Caption:='0'; QRLabel53.Caption:='0'; QRLabel54.Caption:='0';//计量中心
  QRLabel56.Caption:='0'; QRLabel57.Caption:='0'; QRLabel59.Caption:='0'; QRLabel60.Caption:='0'; QRLabel61.Caption:='0';//客户服务中心
  QRLabel63.Caption:='0'; QRLabel64.Caption:='0'; QRLabel66.Caption:='0'; QRLabel67.Caption:='0'; QRLabel68.Caption:='0';//生产部
  QRLabel17.Caption:='0'; QRLabel18.Caption:='0'; QRLabel24.Caption:='0'; QRLabel29.Caption:='0'; QRLabel44.Caption:='0';//合计

  QRLabel33.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_ydfkzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel11.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select LSID,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_ydfkzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel11.Caption:=OutNoDo(QRLabel11.Caption,Plan_ydfkzx);
  QRLabel12.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_ydfkzx+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_ydfkzx+'%'+#39+' and jdbm not like '+#39+'%'+Plan_ydfkzx+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel15.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_ydfkzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel14.Caption:=IntToStr(StrToInt(QRLabel33.Caption)-StrToInt(QRLabel11.Caption)-StrToInt(QRLabel12.Caption)-StrToInt(QRLabel15.Caption));

  QRLabel34.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_yyglb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel16.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_yyglb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel16.Caption:=OutNoDo(QRLabel16.Caption,Plan_yyglb);
  QRLabel4.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_yyglb+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_yyglb+'%'+#39+' and jdbm not like '+#39+'%'+Plan_yyglb+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel20.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_yyglb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel19.Caption:=IntToStr(StrToInt(QRLabel34.Caption)-StrToInt(QRLabel16.Caption)-StrToInt(QRLabel4.Caption)-StrToInt(QRLabel20.Caption));

  QRLabel35.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_txs+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel21.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_txs+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel21.Caption:=OutNoDo(QRLabel21.Caption,Plan_txs);
  QRLabel23.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_txs+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_txs+'%'+#39+' and jdbm not like '+#39+'%'+Plan_txs+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel26.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_txs+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel25.Caption:=IntToStr(StrToInt(QRLabel35.Caption)-StrToInt(QRLabel21.Caption)-StrToInt(QRLabel23.Caption)-StrToInt(QRLabel26.Caption));

  QRLabel36.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_dds+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel27.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_dds+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel27.Caption:=OutNoDo(QRLabel27.Caption,Plan_dds);
  QRLabel28.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_dds+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_dds+'%'+#39+' and jdbm not like '+#39+'%'+Plan_dds+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel31.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_dds+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel30.Caption:=IntToStr(StrToInt(QRLabel36.Caption)-StrToInt(QRLabel27.Caption)-StrToInt(QRLabel28.Caption)-StrToInt(QRLabel31.Caption));

  QRLabel47.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_jsjzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel42.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_jsjzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel42.Caption:=OutNoDo(QRLabel42.Caption,Plan_jsjzx);
  QRLabel43.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_jsjzx+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_jsjzx+'%'+#39+' and jdbm not like '+#39+'%'+Plan_jsjzx+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel46.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_jsjzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel45.Caption:=IntToStr(StrToInt(QRLabel47.Caption)-StrToInt(QRLabel42.Caption)-StrToInt(QRLabel43.Caption)-StrToInt(QRLabel46.Caption));

  QRLabel54.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_jlzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel49.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_jlzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel49.Caption:=OutNoDo(QRLabel49.Caption,Plan_jlzx);
  QRLabel50.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_jlzx+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_jlzx+'%'+#39+' and jdbm not like '+#39+'%'+Plan_jlzx+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel53.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_jlzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel52.Caption:=IntToStr(StrToInt(QRLabel54.Caption)-StrToInt(QRLabel49.Caption)-StrToInt(QRLabel50.Caption)-StrToInt(QRLabel53.Caption));

  QRLabel61.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_khfwzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel56.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_khfwzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel56.Caption:=OutNoDo(QRLabel56.Caption,Plan_khfwzx);
  QRLabel57.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where ((state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_khfwzx+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_khfwzx+'%'+#39+' and jdbm not like '+#39+'%'+Plan_khfwzx+'%'+#39+')) and sltime>=:Start and sltime<=:End');
  QRLabel60.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_khfwzx+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel59.Caption:=IntToStr(StrToInt(QRLabel61.Caption)-StrToInt(QRLabel56.Caption)-StrToInt(QRLabel57.Caption)-StrToInt(QRLabel60.Caption));

  QRLabel68.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where dfdw like '+#39+'%'+Plan_scb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  {QRLabel63.Caption}Sqltrue(DM_Static.Qr_YkGcZx,'select lsid,jdbm,dftime,xdtime from YkGcZx where state=7 and dfdw like '+#39+'%'+Plan_scb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel63.Caption:=OutNoDo(QRLabel63.Caption,Plan_scb);
  QRLabel64.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where (state=0 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_scb+'%'+#39+') or (state=9 and getdate()>xdtime and dfdw like '+#39+'%'+Plan_scb+'%'+#39+' and jdbm not like '+#39+'%'+Plan_scb+'%'+#39+') and sltime>=:Start and sltime<=:End');
  QRLabel67.Caption:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=8 and dfdw like '+#39+'%'+Plan_scb+'%'+#39+' and sltime>=:Start and sltime<=:End');
  QRLabel66.Caption:=IntToStr(StrToInt(QRLabel68.Caption)-StrToInt(QRLabel63.Caption)-StrToInt(QRLabel64.Caption)-StrToInt(QRLabel67.Caption));

  QRLabel17.Caption:=IntToStr(StrToInt(QRLabel11.Caption)+StrToInt(QRLabel16.Caption)+StrToInt(QRLabel21.Caption)+StrToInt(QRLabel27.Caption)+StrToInt(QRLabel42.Caption)+StrToInt(QRLabel49.Caption)+StrToInt(QRLabel56.Caption)+StrToInt(QRLabel63.Caption));
  QRLabel18.Caption:=IntToStr(StrToInt(QRLabel12.Caption)+StrToInt(QRLabel4.Caption)+StrToInt(QRLabel23.Caption)+StrToInt(QRLabel28.Caption)+StrToInt(QRLabel43.Caption)+StrToInt(QRLabel50.Caption)+StrToInt(QRLabel57.Caption)+StrToInt(QRLabel64.Caption));
  QRLabel24.Caption:=IntToStr(StrToInt(QRLabel14.Caption)+StrToInt(QRLabel19.Caption)+StrToInt(QRLabel25.Caption)+StrToInt(QRLabel30.Caption)+StrToInt(QRLabel45.Caption)+StrToInt(QRLabel52.Caption)+StrToInt(QRLabel59.Caption)+StrToInt(QRLabel66.Caption));
  QRLabel29.Caption:=IntToStr(StrToInt(QRLabel15.Caption)+StrToInt(QRLabel20.Caption)+StrToInt(QRLabel26.Caption)+StrToInt(QRLabel31.Caption)+StrToInt(QRLabel46.Caption)+StrToInt(QRLabel53.Caption)+StrToInt(QRLabel60.Caption)+StrToInt(QRLabel67.Caption));
  QRLabel44.Caption:=IntToStr(StrToInt(QRLabel33.Caption)+StrToInt(QRLabel34.Caption)+StrToInt(QRLabel35.Caption)+StrToInt(QRLabel36.Caption)+StrToInt(QRLabel47.Caption)+StrToInt(QRLabel54.Caption)+StrToInt(QRLabel61.Caption)+StrToInt(QRLabel68.Caption));

  QRLabel38.Caption:=DateTimeToStr(SelStartDateTime); QRLabel40.Caption:=DateTimeToStr(SelEndDateTime);
end;

Function TForm_TrRep.OutNoDo(lblcaption:string;conststr:string):string;
var
  k:integer;
begin
  result:='0';
  with DM_Static.Qr_YkGcZx do
  begin
    if RecordCount>0 then
    begin
      while not eof do
      begin
        for k:=1 to 10 do
        begin
          A[1,k]:='';   A[2,k]:='';
        end;
        NoDoStr:=FieldByName('jdbm').AsString;
        if pos(',',NoDoStr)>0 then
        begin
          i:=0;
          while pos(',',NoDoStr)>0 do
          begin
            DoInt:=pos(',',NoDoStr);
            i:=i+1;
            A[1,i]:=copy(NoDoStr,1,DoInt-1);
            NoDoStr:=copy(NoDoStr,Doint+1,150);
          end;
          if pos(',',NoDoStr)=0 then
          begin
            i:=i+1;
            A[1,i]:=trim(NoDoStr);
          end;
          NoDoStr:=FieldByName('dftime').AsString;
          j:=0;
          while pos(';',NoDoStr)>0 do
          begin
            DoInt:=pos(';',NoDoStr);
            j:=j+1;
            A[2,j]:=copy(NoDoStr,1,DoInt-1);
            NoDoStr:=copy(NoDoStr,Doint+1,150);
          end;
          if pos(';',NoDoStr)=0 then
          begin
            j:=j+1;
            A[2,j]:=trim(NoDoStr);
          end;
          for k:=1 to i do
          begin
            if A[1,k]=conststr then
            begin
              if StrToDateTime(trim(A[2,k]))>FieldByName('Xdtime').AsDateTime then
              begin
                lblcaption:=IntToStr(StrToInt(lblcaption)+1);
                result:=lblcaption;
              end;
            end;
          end;
        end else
          result:=sqlopen(DM_Static.Qr_YkGcZx,'select Count(*) Number from YkGcZx where state=7 and dfdw like '+#39+'%'+conststr+'%'+#39+' and sltime>=:Start and sltime<=:End');
        next;
      end;
    end;
  end;
end;

end.

⌨️ 快捷键说明

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