📄 main.pas
字号:
deptrecorder, salaryway, qianka, original, result, medrecord, insrecord,
arrange,atdchange, salset, saldata, salcal, account,
jiben, factory, process, borrow,
endmoney,yearend, zeromoney, product, labor, cvcode,
per_sallist, othermoney, personalreport, salary, saldatareport,
atddealrep, salarysum, masterbrow, form_mianqianka, reportdsg,
definecolor, backup, restore, screensave, search, changecard, pubpersonal,
turnrule, hetongdata, formpersonal1, report_tax,
report_date, u_tc, U_tc1, salsum, salaryjia, salsumjia,bank, eduset,
empreq, empset, empface, empsave,edurecord,meal, sendcard, bankset,
salnameset, zhantao, addzt, goods, dingdan, zjll;
{$R *.DFM}
procedure Tformmain.displayhint(sender: TObject);
begin
if application.hint='' then
statusbarpro1.panels[0].text:='Ready'
else
statusbarpro1.panels[0].text:=getlonghint(application.hint);
end;
procedure Tformmain.FormCreate(Sender: TObject);
var
w,h:integer;
CSize : DWORD;
Computer : PChar;
INI:TINIFile;
begin
// connectsql; //设置datamod中的database1的connection
application.onhint:=displayhint;
application.OnException:=Datamod.Errorpro;
Qrypublic.Close;
Qrypublic.Sql.Text:='Select * from pub01010';
Qrypublic.Open; //在状态栏中要显示的参数
caption:=Qrypublic.Fieldbyname('name1').asstring+'-人事考勤薪资管理系统';
font.Charset:=CHINESEBIG5_CHARSET;
w:=GetSystemMetrics(SM_CXFULLSCREEN); //分辨率
h:=GetSystemMetrics(SM_CYFULLSCREEN);
if (w>800) and (h>600) then
begin
statusbarpro1.Panels[1].Width:=180;
statusbarpro1.Panels[2].Width:=80;
statusbarpro1.Panels[3].Width:=80;
statusbarpro1.Panels[4].Width:=130;
statusbarpro1.Panels[4].Width:=150;
statusbarpro1.Panels[0].Width:=w-620;
if fileexists(ExtractFilePath(Application.exename)+'Icon\peace.jpg') then
Image1.Picture.LoadFromFile(ExtractFilePath(Application.exename)+'Icon\peace.jpg');
end;
inidesktop('Menu'); //使用自定义桌面
statusbarpro1.panels[0].text:='Ready';
Computer := #0;
CSize := MAX_COMPUTERNAME_LENGTH + 1;
try
GetMem( Computer, CSize );
if GetComputerName( Computer, CSize ) then
ComputerName := Computer;
finally
FreeMem( Computer );
end;
statusbarpro1.Panels[1].text:='Server:'+server+' DataBase:'+database;
statusbarpro1.Panels[2].Text:=computername;
statusbarpro1.panels[3].text:=pubworkname;
statusbarpro1.panels[4].text:=formatdatetime('yyyy'+dateseparator+'mm'+dateseparator+'dd hh'+timeseparator+'mm'+timeseparator+'ss',now);
showbackground;
//初始化菜单项
default:=0;
login;
worknolong:=0;
cardnolong:=0;
with datamod.ADOQuery1 do
begin
sql.text:='select worknolength,cardnolength from pub08010';
open;
if not eof then
begin
worknolong:=fields[0].AsInteger ;
cardnolong:=fields[1].AsInteger ;
end;
close;
end;
with datamod.ADOQuery2 do
begin
sql.Text:='select name1 from pub01010';
open;
if not eof then
companyname1:=fieldbyname('name1').asstring;
close
end;
screencount:=0;
sresult:=TClipboard.Create; //初始化共用查询变量
ini:=TINIFile.create(extractfilepath(application.exename)+'Data\System.ini');
if ini.ReadInteger('TreeView','Enable',1)=1 then
begin
if not assigned(formpubpersonal) then
formpubpersonal:=TFormpubpersonal.create(self);
formpubpersonal.show;
end;
end;
procedure Tformmain.Outlook1ItemClick(Sender: TObject; Item: String);
begin
if item='人事基本资料' then per_basic.click;
if item='异动单' then per_move.Click;
if item='调薪作业' then per_adjust.Click;
if item='奖惩单维护' then per_reward.Click;
if item='员工离职资料' then per_leave.Click;
if item='停薪留职作业' then per_stop.Click;
if item='换班作业' then changeschement.Click;
if item='班别异动作业' then changesche.Click;
if item='读卡钟数据' then atd_read.Click;
if item='考勤资料处理' then atd_handle.Click;
if item='加班单维护' then atd_overtime.Click;
if item='考勤资料维护' then atd_atddata.Click;
if item='原始资料维护' then atd_originaldata.Click;
if item='厂证管理' then cardClick(sender);
if item='公司行事历' then company_celendar.Click;
if item='部门行事历' then company_dept_celendar.Click;
if item='考勤参数设定' then atd_basic.Click;
if item='班次资料' then atd_sche.Click;
if item='万年历' then year.click;
if item='计算器' then Calculator.click;
if item='密码权限设定' then password_set.click;
if item='更改密码' then password_change.Click;
if item='薪资参数设定' then sal_basicClick(sender);
if item='员工薪资设定' then N2Click(sender);
if item='薪资总表' then sal_totalClick(sender);
if item='其它项目设定' then N4Click(sender);
if item='员工薪资条' then N13Click(sender);
end;
//主菜单中的万年历
procedure Tformmain.YearClick(Sender: TObject);
begin
Outlook1.ActiveTab:=9;
if not assigned(formyear) then
formyear:=TFormyear.create(application);
formyear.show;
end;
//主菜单中的计算器
procedure Tformmain.CalculatorClick(Sender: TObject);
begin
Outlook1.ActiveTab:=9;
rxcalculator1.execute;
end;
//选用何种窗体样式--outlook式
procedure Tformmain.view_outlookClick(Sender: TObject);
begin
if not outlook1.Visible then
outlook1.visible:=true;
end;
//不选用outlook式
procedure Tformmain.view_hideClick(Sender: TObject);
begin
if outlook1.Visible then
outlook1.visible:=false;
end;
//在窗体底端的状态栏中显示系统时间
procedure Tformmain.Timer1Timer(Sender: TObject);
var i:integer;
s:string;
begin
{ statusbarpro1.panels[4].text:=formatdatetime('yyyy'+dateseparator+'mm'+dateseparator+'dd hh'+timeseparator+'mm'+timeseparator+'ss',now);
if self.MDIChildCount>0 then
begin
try
if (lowercase(self.ActiveMDIChild.Name)='formpersonal') or (lowercase(self.activemdichild.name)='formfactory') then exit;
with self.ActiveMDIChild do
begin
statusbarpro1.Panels[5].text:='当前资料笔数:0';
for i:=0 to componentcount-1 do
begin
try
if (findcomponent('pagecontrol1')<>nil) and (findcomponent('dbgrid1')<>nil) then
begin
//s1:=TWincontrol(components[i]).name;
//s2:=TWincontrol(components[i]).parent.name;
if (components[i].ClassType<>tadodataset) and (copy(TWincontrol(components[i]).name,1,3)<>'ADO') AND (copy(TWincontrol(components[i]).name,1,3)<>'ado') and (copy(TWincontrol(components[i]).name,1,11)<>'StringField') and (copy(TWincontrol(components[i]).name,1,8)<>'BCDField')
AND (copy(TWincontrol(components[i]).name,1,13)<>'DateTimeField') and (copy(TWincontrol(components[i]).name,1,12)<>'IntegerField') and (copy(TWincontrol(components[i]).name,1,2)<>'pp') then
if (TWincontrol(components[i]).parent.name=TPagecontrol(Findcomponent('pagecontrol1')).ActivePage.name) and (components[i].ClassType=TDBGrid) then
begin
statusbarpro1.panels[5].text:='当前资料笔数:'+inttostr(tablerecord(TDBGrid(components[i]).DataSource.DataSet));
break;
end;
end
else
if components[i].classtype=TDBGrid then
begin
statusbarpro1.panels[5].text:='当前资料笔数:'+inttostr(tablerecord(TDBGrid(components[i]).DataSource.DataSet));
break;
end;
except
end;
end; //for
end; //with
except
end;
end else statusbarpro1.panels[5].text:='当前资料笔数:0'; }
end;
procedure Tformmain.companynameClick(Sender: TObject);
var
companyname:string;
ClickOk:Boolean;
begin
clickok:=InputQuery('更改公司名称','请输入公司名称:',companyname);
if clickok and (companyname<>'') then
begin
Datamod.Query1.Close;
Datamod.Query1.SQL.Text:='Update pub01010 set name1='''+companyname+''' ';
Datamod.Query1.execsql;
caption:=companyname+'-人事考勤薪资管理系统';
end;
Outlook1.ActiveTab:=9;
end;
//打开关于对话框
procedure Tformmain.aboutClick(Sender: TObject);
begin
if not assigned(formabout) then
formabout:=TFormabout.create(application);
formabout.show;
Outlook1.ActiveTab:=9;
end;
//公司基本资料
procedure Tformmain.company_basicClick(Sender: TObject);
begin
if not assigned(formcom) then
formcom:=tformcom.create(application);
formcom.show;
end;
//国别代码设定
procedure Tformmain.company_countryClick(Sender: TObject);
begin
if not assigned(formcontrycode) then
formcontrycode:=tformcontrycode.create(application);
formcontrycode.show;
end;
//部门基本资料
procedure Tformmain.company_deptClick(Sender: TObject);
begin
if not assigned(formdept) then
formdept:=tformdept.create(application);
formdept.show;
end;
//部门树状图
procedure Tformmain.company_orgaClick(Sender: TObject);
begin
if not assigned(formdchart) then
formdchart:=tformdchart.create(application);
formdchart.show;
end;
//公司行事历
procedure Tformmain.company_celendarClick(Sender: TObject);
begin
if not assigned(formcomrecorder) then
formcomrecorder:=tformcomrecorder.create(application);
formcomrecorder.show;
Outlook1.ActiveTab:=7;
end;
//人事基本设定的一系列作业,如职称代码,籍贯代码等,它们用的是一个窗体
procedure Tformmain.personal_profClick(Sender: TObject);
begin
case (sender as tmenuitem).tag of
1: begin
if not assigned(formallkind1) then
begin
formallkind1:=tformallkind.create(self);
with formallkind1 do
begin
Caption:='职称';
dbnavigator1.DataSource :=datamod.dsprof; //职称
show;
end;
end
else
formallkind1.Show;
formallkind1.PageControl1.ActivePageIndex :=0;
end;
2: begin
if not assigned(formallkind2) then
begin
formallkind2:=tformallkind.create(self);
with formallkind2 do
begin
Caption:='职等职级设定';
dbnavigator1.DataSource :=dsgrade; //级别
show;
end;
end
else
formallkind2.show;
formallkind2.PageControl1.ActivePageIndex :=1;
end;
3: begin
if not assigned(formallkind3) then
begin
formallkind3:=tformallkind.create(self);
with formallkind3 do
begin
caption:='籍贯';
dbnavigator1.DataSource :=dsprov; //籍贯
show;
end;
end
else
formallkind3.show;
formallkind3.PageControl1.ActivePageIndex :=2;
end;
4: begin
if not assigned(formallkind4) then
begin
formallkind4:=tformallkind.create(application);
with formallkind4 do
begin
caption:='学历';
dbnavigator1.DataSource :=dsdegree; //学历
show;
end;
end
else
formallkind4.show;
formallkind4.PageControl1.ActivePageIndex :=3;
end;
5: begin
if not assigned(formallkind5) then
begin
formallkind5:=tformallkind.create(application);
with formallkind5 do
begin
caption:='科系';
dbnavigator1.DataSource :=dscourse; //科系
show;
end;
end
else
formallkind5.show;
formallkind5.PageControl1.ActivePageIndex :=4;
end;
6:begin
if not assigned(formallkind) then
begin
formallkind6:=tformallkind.create(application);
with formallkind6 do
begin
caption:='专长';
dbnavigator1.DataSource :=dsspec; //专长
show;
end;
end
else
formallkind6.show;
formallkind6.PageControl1.ActivePageIndex :=9;
end;
7: begin
if not assigned(formallkind7) then
begin
formallkind7:=tformallkind.create(application);
with formallkind7 do
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -