door_print.pas
来自「pasa人力资源考勤管理系统」· PAS 代码 · 共 463 行
PAS
463 行
unit door_print;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls, ppDB, ppDBPipe, ppDBBDE, Db,
ADODB, ppCtrls, ppBands, ppVar, ppPrnabl, ppClass, ppCache, ppComm,
ppRelatv, ppProd, ppReport,publicfunction,main;
type
Tdoorprint = class(TForm)
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
MaskEdit3: TMaskEdit;
MaskEdit1: TMaskEdit;
MaskEdit2: TMaskEdit;
Label2: TLabel;
Label3: TLabel;
RadioGroup2: TRadioGroup;
Panel1: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ppReport1: TppReport;
DSdor: TDataSource;
ADODor: TADODataSet;
ppBDEPipeline1: TppBDEPipeline;
Query1: TADOQuery;
ComboBox1: TComboBox;
Ado_mingxi: TADODataSet;
DataSource1: TDataSource;
ppBDEPipeline2: TppBDEPipeline;
ppReport2: TppReport;
ppHeaderBand2: TppHeaderBand;
ppDetailBand2: TppDetailBand;
ppLabel1: TppLabel;
ppLabel8: TppLabel;
ppLabel9: TppLabel;
ppLabel11: TppLabel;
ppLabel12: TppLabel;
ppSystemVariable1: TppSystemVariable;
ppSystemVariable2: TppSystemVariable;
ppLabel13: TppLabel;
ppLabel14: TppLabel;
ppLabel15: TppLabel;
ppLabel17: TppLabel;
ppLabel20: TppLabel;
ppDBText7: TppDBText;
ppDBText8: TppDBText;
ppDBText10: TppDBText;
ppDBText12: TppDBText;
ppDBText15: TppDBText;
ppLine1: TppLine;
ppLine2: TppLine;
ppTitleBand1: TppTitleBand;
ppLabel28: TppLabel;
ppSystemVariable7: TppSystemVariable;
ppLabel29: TppLabel;
ppLabel30: TppLabel;
ppSystemVariable8: TppSystemVariable;
ppLabel31: TppLabel;
ppHeaderBand1: TppHeaderBand;
ppLabel2: TppLabel;
ppLabel3: TppLabel;
ppLabel4: TppLabel;
ppLabel6: TppLabel;
ppLabel10: TppLabel;
ppDetailBand1: TppDetailBand;
ppDBText1: TppDBText;
ppDBText2: TppDBText;
ppDBText3: TppDBText;
ppDBText5: TppDBText;
ppDBText9: TppDBText;
ComboBox2: TComboBox;
Query2: TADOQuery;
Adodordate: TADODataSet;
dsdordate: TDataSource;
ppLabel21: TppLabel;
ppReport3: TppReport;
ppHeaderBand3: TppHeaderBand;
ppDetailBand3: TppDetailBand;
ppBDEPipeline3: TppBDEPipeline;
ppLabel22: TppLabel;
ppLabel23: TppLabel;
ppLabel24: TppLabel;
ppDBText16: TppDBText;
ppLabel25: TppLabel;
ppDBText17: TppDBText;
ppDBText18: TppDBText;
ppLabel26: TppLabel;
ppDBText19: TppDBText;
ppLabel32: TppLabel;
ppLabel33: TppLabel;
ppDBText20: TppDBText;
ppLabel36: TppLabel;
ppDBText23: TppDBText;
ppLine3: TppLine;
ppLine4: TppLine;
ppLabel37: TppLabel;
ppLabel38: TppLabel;
ppLabel39: TppLabel;
ppSystemVariable3: TppSystemVariable;
ppSystemVariable4: TppSystemVariable;
ppLabel40: TppLabel;
ppSummaryBand1: TppSummaryBand;
ppLabel41: TppLabel;
ppDBCalc1: TppDBCalc;
ppLine5: TppLine;
ppLine6: TppLine;
ppLabel27: TppLabel;
ppLabel42: TppLabel;
ppSummaryBand2: TppSummaryBand;
ppLabel43: TppLabel;
ppDBCalc2: TppDBCalc;
ppSummaryBand3: TppSummaryBand;
ppLabel44: TppLabel;
ppDBCalc3: TppDBCalc;
ppLabel45: TppLabel;
ppLabel46: TppLabel;
ppLabel47: TppLabel;
ADODorworkno: TStringField;
ADODorcardno: TStringField;
ADODordept: TStringField;
ADODorname: TStringField;
ADODormonthycount: TIntegerField;
ADODormonthy: TStringField;
Adodordateworkno: TStringField;
Adodordatecardno: TStringField;
Adodordatename: TStringField;
Adodordatedept: TStringField;
Adodordatedaytimes: TIntegerField;
Adodordaterq: TStringField;
Ado_mingxiworkno: TStringField;
Ado_mingxicardno: TStringField;
Ado_mingxiname: TStringField;
Ado_mingxidept: TStringField;
Ado_mingxitimes: TDateTimeField;
Ado_mingxireReader: TStringField;
Ado_mingximark: TStringField;
Ado_mingxinoid: TStringField;
Ado_mingxiphoto: TStringField;
Ado_mingxireadok: TBooleanField;
ppLabel5: TppLabel;
ppDBText4: TppDBText;
ppDBText6: TppDBText;
ppLabel7: TppLabel;
ppDBText11: TppDBText;
ppLabel16: TppLabel;
ppLabel18: TppLabel;
ppDBText13: TppDBText;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
function printcondition :string;
procedure FormCreate(Sender: TObject);
procedure ppReport1PreviewFormCreate(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure ppReport2PreviewFormCreate(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure MaskEdit2Exit(Sender: TObject);
procedure MaskEdit1KeyPress(Sender: TObject; var Key: Char);
procedure MaskEdit1Exit(Sender: TObject);
procedure ppReport3PreviewFormCreate(Sender: TObject);
procedure ppReport3BeforePrint(Sender: TObject);
procedure ppReport1BeforePrint(Sender: TObject);
procedure ppReport2BeforePrint(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure RadioGroup1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
doorprint: Tdoorprint;
implementation
{$R *.DFM}
procedure Tdoorprint.BitBtn2Click(Sender: TObject);
begin
Close;
end;
function Tdoorprint.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 Tdoorprint.BitBtn1Click(Sender: TObject);
var
s:string;
begin
s:=printcondition;
if (maskEdit3.Text<>' / ')and(RadioGroup1.ItemIndex=0)and(RadioGroup2.ItemIndex=0)then
begin
AdoDor.Close;
ADoDor.CommandText:='Select * From dor03 where monthy='''+MaskEdit3.Text+''' order by monthy,dept';//月份,部门,个人月汇总次数,工号
ADODor.open;
ppreport1.Print;
end
else if (MaskEdit3.Text<>' / ')and(RadioGroup1.ItemIndex=1)and(RadioGroup2.ItemIndex=0)then
begin
ADoDor.Close;
ADoDor.CommandText:='Select * From dor03 where dept='''+ComboBox2.Text+''' and monthy='''+MaskEdit3.Text+''' order by monthy,dept ';//月份,部门,个人月汇总次数,工号
ADODor.open;
ppreport1.Print;
end
else if (maskEdit1.Text<>' / ')and(RadioGroup1.ItemIndex=2)and(RadioGroup2.ItemIndex=0)then
begin
AdoDor.Close;
ADoDor.CommandText:='Select * from dor03 where '+s+' and monthy='''+MaskEdit3.Text+''' order by monthy,dept'; //月份,部门,个人月汇总次数,工号
ADODor.Open;
ppreport1.Print;
end
else if ((maskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=0)and(RadioGroup2.ItemIndex=1)then
begin
Ado_mingxi.Close;
Ado_mingxi.CommandText:='Select * from dor01 where convert(varchar,times,111) between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' order by workno,dept,times';
Ado_mingxi.Open;
// pplabel1.Caption:=companyname1;
ppreport2.Print;
end
else if ((maskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=1)and(RadioGroup2.ItemIndex=1)then
begin
Ado_mingxi.Close;
Ado_mingxi.CommandText:='Select * from dor01 where '+s+'and convert(varchar,times,111) between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' order by workno,dept,times';
Ado_mingxi.Open;
pplabel1.Caption:=companyname1;
ppreport2.Print;
end
else if ((maskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=2)and(RadioGroup2.ItemIndex=1)then
begin
Ado_mingxi.Close;
Ado_mingxi.CommandText:='Select * from dor01 where '+s+'and convert(varchar,times,111) between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' order by workno,dept,times';
Ado_mingxi.Open;
pplabel1.Caption:=companyname1;
ppreport2.Print;
end //门禁出入日汇总
else if ((MaskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=0)and(RadioGroup2.ItemIndex=2)then
begin
Adodordate.Close;
Adodordate.CommandText:='Select * from dor02 where rq between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' order by workno,dept,rq';
Adodordate.Open;
ppreport3.Print;
end
else if ((MaskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=1)and(RadioGroup2.ItemIndex=2)then
begin
Adodordate.Close;
Adodordate.CommandText:='Select * from dor02 where rq between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' and '+s+' order by workno,dept,rq' ;
Adodordate.Open;
ppreport3.Print;
end
else if ((MaskEdit1.Text<>' / / ') and (MaskEdit2.Text<>' / / '))and(RadioGroup1.ItemIndex=2)and(RadioGroup2.ItemIndex=2)then
begin
if (Edit1.Text='') or (Edit2.Text='') then
begin
Application.messagebox('输入正确的工号进行查询!!!','系统提示',32);
exit;
end
else
begin
Adodordate.Close;
Adodordate.CommandText:='Select * from dor02 where rq between '''+MaskEdit1.Text+'''and'''+MaskEdit2.Text+''' and '+s+' order by workno,dept,rq' ;
Adodordate.Open;
ppreport3.Print;
end;
end;
end;
procedure Tdoorprint.FormCreate(Sender: TObject);
begin
Query1.SQL.Clear;
ComboBox1.Clear;
Query1.Close;
Query1.SQL.Add('Select distinct dept From dor01 where dept is not null');
Query1.open;
Query1.First;
while not Query1.Eof do
begin
combobox1.items.add(Query1.fieldbyname('dept').asstring);
Query1.next;
end;
ComboBox2.Clear;
Query2.Close;
Query2.SQL.Clear;
Query2.Close;
Query2.SQL.Add('Select distinct dept From dor03 where dept is not null');
Query2.open;
Query2.First;
while not Query2.Eof do
begin
combobox2.items.add(Query2.fieldbyname('dept').asstring);
Query2.next;
end;
Adodordate.Close;
Adodordate.CommandText:='Select * From dor02 order by workno,dept,rq';
Adodordate.Open;
end;
procedure Tdoorprint.ppReport1PreviewFormCreate(Sender: TObject);
begin
Tppreport(sender).previewform.windowstate:=wsmaximized;
end;
procedure Tdoorprint.Edit1Exit(Sender: TObject);
begin
Edit2.Text:=Edit1.Text;
radiogroup1.ItemIndex:=2;
end;
procedure Tdoorprint.ppReport2PreviewFormCreate(Sender: TObject);
begin
tppreport(sender).previewform.windowstate:=wsmaximized;
end;
procedure Tdoorprint.RadioGroup2Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex=1 then
begin
MaskEdit1.Visible:=True;
MaskEdit2.Visible:=True;
MaskEdit3.Visible:=False;
Label2.caption:='开始';
Label3.visible:=True;
ComboBox1.Visible:=True;
ComboBox2.Visible:=False;
MaskEdit1.SetFocus;
end
else if radioGroup2.ItemIndex=2 then
begin
MaskEdit1.Visible:=True;
MaskEdit2.Visible:=True;
MaskEdit3.Visible:=False;
Label2.caption:='开始';
Label3.visible:=True;
ComboBox1.Visible:=True;
ComboBox2.Visible:=False;
MaskEdit1.SetFocus;
end
else if RadioGroup2.ItemIndex=0 then
begin
Label3.visible:=False;
MaskEdit1.Visible:=False;
MaskEdit2.Visible:=False;
MaskEdit3.Visible:=True;
Label2.caption:='月份';
ComboBox2.Visible:=True;
ComboBox1.Visible:=False;
MaskEdit3.SetFocus;
end
end;
procedure Tdoorprint.FormKeyPress(Sender: TObject; var Key: Char);
begin
// if (activecontrol=MaskEdit1) or (activecontrol=MaskEdit2) then exit;
if key=#13 then
begin
selectnext(activecontrol,true,true);
key:=#0;
end;
end;
procedure Tdoorprint.MaskEdit2Exit(Sender: TObject);
begin
if trim(maskedit2.text)<>' / / ' then
if (not isdate(maskedit1.Text)) or (not isdate(maskedit2.text)) then
begin
Application.MessageBox('对不起,您输入的不是有效日期','Warning',mb_ok+mb_iconwarning);
maskedit1.SetFocus;
exit;
end;
end;
procedure Tdoorprint.MaskEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
selectnext(activecontrol,true,true);
end;
end;
procedure Tdoorprint.MaskEdit1Exit(Sender: TObject);
begin
if trim(maskedit1.text)<>' / / ' then
if (not isdate(maskedit1.Text))then
begin
Application.MessageBox('对不起,您输入的不是有效日期','Warning',mb_ok+mb_iconwarning);
exit;
end;
end;
procedure Tdoorprint.ppReport3PreviewFormCreate(Sender: TObject);
begin
Tppreport(sender).previewform.windowstate:=wsmaximized;
end;
procedure Tdoorprint.ppReport3BeforePrint(Sender: TObject);
begin
pplabel22.Caption:= companyname1;
pplabel23.caption:='日期范围'+MaskEdit1.Text+'----'+MaskEdit2.Text+'';
pplabel40.Caption:=pubworkname;
end;
procedure Tdoorprint.ppReport1BeforePrint(Sender: TObject);
begin
pplabel31.Caption:=companyname1;
pplabel27.Caption:=pubworkname;
pplabel21.Caption:='月份'+':'+maskedit3.Text+'';
end;
procedure Tdoorprint.ppReport2BeforePrint(Sender: TObject);
begin
pplabel1.Caption:= companyname1;
pplabel42.Caption:=pubworkname;
pplabel8.Caption:='日期'+maskedit1.Text+'----'+maskedit2.Text+'';
end;
procedure Tdoorprint.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
selectnext(activecontrol,true,true);
end;
end;
procedure Tdoorprint.RadioGroup1Click(Sender: TObject);
begin
case radiogroup1.ItemIndex of
0:
begin
Edit1.Text:='';
Edit2.Text:='';
combobox2.Text:='';
combobox1.Text:='';
end;
1:
begin
Edit1.Text:='';
Edit2.Text:='';
end;
2:
begin
Edit1.SetFocus;
Combobox2.Text:='';
Combobox1.Text:='';
end;
end;
end;
procedure Tdoorprint.ComboBox1Change(Sender: TObject);
begin
radiogroup1.ItemIndex:=1;
end;
procedure Tdoorprint.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=cafree;
doorprint:=nil;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?