unit3.pas

来自「pasa人力资源考勤管理系统」· PAS 代码 · 共 355 行

PAS
355
字号
unit Unit3;

interface

uses
  main,datamol,publicfunction,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Mask, ExtCtrls, ppDB, Db, ADODB, ppDBPipe, ppDBBDE, ppBands,
  ppCtrls, ppPrnabl, ppClass, ppCache, ppComm, ppRelatv, ppProd, ppReport,
  ppVar;

type
  Tform3 = class(TForm)
    MaskEdit1: TMaskEdit;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    Edit2: TEdit;
    ppReport6: TppReport;
    ppHeaderBand3: TppHeaderBand;
    ppLabel32: TppLabel;
    ppLabel39: TppLabel;
    ppLabel42: TppLabel;
    ppLabel79: TppLabel;
    ppLabel81: TppLabel;
    ppLabel84: TppLabel;
    ppLabel85: TppLabel;
    ppLabel86: TppLabel;
    ppLabel92: TppLabel;
    ppLabel95: TppLabel;
    ppLabel96: TppLabel;
    ppLabel97: TppLabel;
    ppLabel98: TppLabel;
    ppLabel99: TppLabel;
    ppLabel100: TppLabel;
    ppLabel101: TppLabel;
    ppLabel102: TppLabel;
    ppLabel103: TppLabel;
    ppLabel104: TppLabel;
    ppLabel105: TppLabel;
    ppLabel106: TppLabel;
    ppLabel107: TppLabel;
    ppLabel108: TppLabel;
    ppLabel110: TppLabel;
    ppLabel111: TppLabel;
    ppLabel112: TppLabel;
    ppLabel113: TppLabel;
    ppLabel114: TppLabel;
    ppLabel115: TppLabel;
    ppLabel116: TppLabel;
    ppLabel117: TppLabel;
    ppLabel118: TppLabel;
    ppLabel119: TppLabel;
    ppLabel120: TppLabel;
    ppLine9: TppLine;
    ppDetailBand3: TppDetailBand;
    ppDBText30: TppDBText;
    ppDBText37: TppDBText;
    ppDBText45: TppDBText;
    ppDBText48: TppDBText;
    ppDBText66: TppDBText;
    ppDBText68: TppDBText;
    ppDBText69: TppDBText;
    ppDBText70: TppDBText;
    ppDBText71: TppDBText;
    ppDBText72: TppDBText;
    ppDBText73: TppDBText;
    ppDBText74: TppDBText;
    ppDBText75: TppDBText;
    ppDBText76: TppDBText;
    ppDBText77: TppDBText;
    ppDBText78: TppDBText;
    ppDBText79: TppDBText;
    ppDBText80: TppDBText;
    ppDBText81: TppDBText;
    ppDBText82: TppDBText;
    ppDBText83: TppDBText;
    ppDBText84: TppDBText;
    ppDBText85: TppDBText;
    ppDBText86: TppDBText;
    ppDBText87: TppDBText;
    ppDBText88: TppDBText;
    ppDBText89: TppDBText;
    ppDBText90: TppDBText;
    ppDBText91: TppDBText;
    ppDBText92: TppDBText;
    ppDBText93: TppDBText;
    ppDBText94: TppDBText;
    ppDBText95: TppDBText;
    ppDBText96: TppDBText;
    ppLine7: TppLine;
    ppFooterBand3: TppFooterBand;
    ppBDEPipeline5: TppBDEPipeline;
    ADOCommand2: TADOCommand;
    ADODataSet2: TADODataSet;
    DataSource2: TDataSource;
    ADODataSet2workno: TStringField;
    ADODataSet2name: TStringField;
    ADODataSet2monthy: TStringField;
    ADODataSet2dept: TStringField;
    ADODataSet2ot01: TBCDField;
    ADODataSet2ot02: TBCDField;
    ADODataSet2ot03: TBCDField;
    ADODataSet2ot04: TBCDField;
    ADODataSet2ot05: TBCDField;
    ADODataSet2ot06: TBCDField;
    ADODataSet2ot07: TBCDField;
    ADODataSet2ot08: TBCDField;
    ADODataSet2ot09: TBCDField;
    ADODataSet2ot10: TBCDField;
    ADODataSet2ot11: TBCDField;
    ADODataSet2ot12: TBCDField;
    ADODataSet2ot13: TBCDField;
    ADODataSet2ot14: TBCDField;
    ADODataSet2ot15: TBCDField;
    ADODataSet2ot16: TBCDField;
    ADODataSet2ot17: TBCDField;
    ADODataSet2ot18: TBCDField;
    ADODataSet2ot19: TBCDField;
    ADODataSet2ot20: TBCDField;
    ADODataSet2ot21: TBCDField;
    ADODataSet2ot22: TBCDField;
    ADODataSet2ot23: TBCDField;
    ADODataSet2ot24: TBCDField;
    ADODataSet2ot25: TBCDField;
    ADODataSet2ot26: TBCDField;
    ADODataSet2ot27: TBCDField;
    ADODataSet2ot28: TBCDField;
    ADODataSet2ot29: TBCDField;
    ADODataSet2ot30: TBCDField;
    ADODataSet2ot31: TBCDField;
    ADODataSet2total: TBCDField;
    radiogroup1: TRadioGroup;
    ADOQuery1: TADOQuery;
    ppLabel1: TppLabel;
    ADOQuery1dept: TStringField;
    ppLabel5: TppLabel;
    ppSystemVariable1: TppSystemVariable;
    ppSystemVariable2: TppSystemVariable;
    ppLine1: TppLine;
    ppLine3: TppLine;
    ppLine5: TppLine;
    ppLine6: TppLine;
    ppLine8: TppLine;
    ppLine10: TppLine;
    ppLine11: TppLine;
    ppLine12: TppLine;
    ppLine20: TppLine;
    ppLine21: TppLine;
    ppLine43: TppLine;
    ppLine44: TppLine;
    ppLine45: TppLine;
    ppLine46: TppLine;
    ppLine47: TppLine;
    ppLine48: TppLine;
    ppLine49: TppLine;
    ppLine50: TppLine;
    ppLine51: TppLine;
    ppLine52: TppLine;
    ppLine53: TppLine;
    ppLine54: TppLine;
    ppLine55: TppLine;
    ppLine56: TppLine;
    ppLine57: TppLine;
    ppLine58: TppLine;
    ppLine59: TppLine;
    ppLine60: TppLine;
    ppLine61: TppLine;
    ppLine62: TppLine;
    ppLine63: TppLine;
    ppLine64: TppLine;
    ppLine65: TppLine;
    ppLine66: TppLine;
    ppLine67: TppLine;
    ppLine69: TppLine;
    ppLine70: TppLine;
    ppLine71: TppLine;
    ppLine72: TppLine;
    ppLine73: TppLine;
    Label2: TLabel;
    ppLabel2: TppLabel;
    ppLine2: TppLine;
    ppLine4: TppLine;
    ppLine13: TppLine;
    ppLine14: TppLine;
    ppLine15: TppLine;
    ppLine16: TppLine;
    ppLine17: TppLine;
    ppLine18: TppLine;
    ppLine19: TppLine;
    ppLine22: TppLine;
    ppLine23: TppLine;
    ppLine24: TppLine;
    ppLine25: TppLine;
    ppLine26: TppLine;
    ppLine27: TppLine;
    ppLine28: TppLine;
    ppLine29: TppLine;
    ppLine30: TppLine;
    ppLine31: TppLine;
    ppLine32: TppLine;
    ppLine33: TppLine;
    ppLine34: TppLine;
    ppLine35: TppLine;
    ppLine36: TppLine;
    ppLine37: TppLine;
    ppLine38: TppLine;
    ppLine39: TppLine;
    ppLine40: TppLine;
    ppLine41: TppLine;
    ppLine42: TppLine;
    ppLine68: TppLine;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button2Click(Sender: TObject);
    procedure ppReport6BeforePrint(Sender: TObject);
    procedure ppReport6PreviewFormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    function printcondition :string;
    { Public declarations }
  end;

var
  form3: Tform3;

implementation

//'uses main,publicfunction ;
{$R *.DFM}


function TForm3.printcondition:string;
begin
  result:='';
  case RadioGroup1.itemindex of
     0:result:='';
     1:if combobox1.items.indexof(combobox1.text)<>-1 then result:='dept='''+combobox1.text+''' ';
     2:if (trim(edit1.text)<>'') and (trim(edit2.text)<>'') then result:='workno between '''+edit1.text+''' and '''+edit2.text+''' ';
  end;
end;

procedure Tform3.FormCreate(Sender: TObject);
begin

   adoquery1.close;
   adoquery1.sql.clear;
   adoquery1.sql.text:='select dept from pub05010';
   adoquery1.open;
   combobox1.items.clear;
   while not adoquery1.eof do
   begin
      combobox1.items.add(adoquery1.fieldbyname('dept').asstring);
      adoquery1.next;
   end;
     maskedit1.text:=formatdatetime('yyyy/mm',now);
   RadioGroup1.itemindex:=0;
end;


procedure Tform3.Button1Click(Sender: TObject);
var
  s :string;
begin
 s:=printcondition;
 Label2.Visible:=true;
 Label2.BringToFront;
 Label2.Update;
 application.ProcessMessages;
 if  maskedit1.text<>'' then

 adocommand2.commandtext:='exec ot_prco '''+maskedit1.text+''' ' ;
 adocommand2.execute;
 adodataset2.close;
 if s<>'' then
 begin
 adodataset2.commandtext:='select * from ot_total where '+s+'   order by dept,workno '
 end else
 adodataset2.commandtext:='select * from ot_total order by dept,workno ' ;
 adodataset2.Open;
 Label2.Visible:=false;
 ppreport6.print;
 end;



procedure Tform3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  action:=cafree;
  form3:=nil;
end;

procedure Tform3.Button2Click(Sender: TObject);
begin
 close;
end;

procedure Tform3.ppReport6BeforePrint(Sender: TObject);
var
  day:integer;
begin
  pplabel4.caption:=companyname1;
  pplabel3.caption:=combobox1.text;
  ppLabel5.caption:='制表人:'+pubworkname;
  pplabel39.caption:=maskedit1.text+' 加班统计';
  //ppDBText1.Visible:=true;
 { day:=getdays(copy(MaskEdit1.Text,6,2),copy(MaskEdit1.text,1,4));
  if day=30 then
    begin
      ppdbtext95.Visible:=false;
      pplabel119.Visible:=false;
    end ;
  if  day=29 then
    begin
      ppdbtext95.Visible:=false;
      pplabel119.Visible:=false;
      ppdbtext94.Visible:=false;
      pplabel118.Visible:=false;
    end ;
   if  day=28 then
    begin
      ppdbtext95.Visible:=false;
      pplabel119.Visible:=false;
      ppdbtext94.Visible:=false;
      pplabel118.Visible:=false;
      ppdbtext93.Visible:=false;
      pplabel117.Visible:=false;
    end ; }
  // pplabel41.caption:=maskedit1.text+'加班统计';
  // pplabel8.caption:=pubworkname;
end;

procedure Tform3.ppReport6PreviewFormCreate(Sender: TObject);
begin
 // tppReport(Sender).PreviewForm.WindowState:=wsMaximized;
  tppreport(sender).previewform.windowstate:=wsmaximized;
end;

procedure Tform3.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
  begin
    key:=#0;
    selectnext(activecontrol,true,true);
 end;
end;

end.

⌨️ 快捷键说明

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