📄 ufhmrp.pas
字号:
infoform.Width:=480;
infoform.Caption:='其它出入库类型';
infoform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.MgoodtypeClick(Sender: TObject);
begin
infoTypeform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.MUnitClick(Sender: TObject);
begin
infoform.infoGEh.DataSource:=DataE2.dsUnit;
infoform.Width:=480;
infoform.Caption:='单位资料';
infoform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.MDeptClick(Sender: TObject);
begin
infoform.infoGEh.DataSource:=DataE2.dsDept;
infoform.Width:=480;
infoform.Caption:='部门资料';
infoform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.MemployClick(Sender: TObject);
begin
infoform.infoGEh.DataSource:=DataE2.dsemploy;
infoform.Width:=700;
infoform.Caption:='员工资料';
infoform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.OprRightsItemClick(Sender: TObject);
begin
infoform.infoGEh.DataSource:=DataE2.dsOpr;
infoform.Width:=500;
infoform.Caption:='操作员及权限设置';
infoform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.ChangePwdClick(Sender: TObject);
begin
ChgPwdform.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.eventLogItemClick(Sender: TObject);
begin
//EventLogForm.showmodal;
InfoSchForm.xTableId :=(sender as TMenuItem).tag;
infoSchForm.caption :=(sender as TMenuItem).Caption ;
InfoSchForm.showModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.InitSystemInfo;
var
s,sRegcode:string;
begin
//get cfg information
with dataE2 do
begin
adoQuery1.close;
adoQuery1.sql.clear;
adoQuery1.sql.Add('select * from cfg');
adoQuery1.open;
sCustomer:=adoQuery1.fieldbyname('customer').asstring+HotelName;
sBillTail:=adoQuery1.fieldbyname('BillTail').asstring;
sAddress:=adoQuery1['address'];
sTelphone:=adoQuery1['telphone'];
sPrnMemo :=adoQuery1['Memo1'];
sPrnMemo2 :=adoQuery1['Memo2'];
sSelection:=adoQuery1.fieldbyname('selection').asstring;
sDataPath:=adoQuery1.fieldbyname('data').asstring;
myInvodate:=adoQuery1.fieldbyname('invodate').asdatetime;
//读入设置的系统参数
DecodeSelection;
//read customer infomation from .sys
try
DecodeOneHotel;
caption:=chr($b7)+chr($c9)+chr($ba)+chr($e3)+'进销存管理系统';
except
hotelname:=chr($c7)+chr($e5)+chr($d4)+chr($B6)+chr($b7)+chr($c9)+chr($ba)+chr($e3);
InstallDate:=date-1;
hotelspe:= 0 ;//0 or <0 ; //显示版
caption:=chr($b7)+chr($c9)+chr($ba)+chr($e3)+'进销存管理系统试用版';
end;
//read register code
sRegCode:=RegisterCode(SerialNo(EncodeString(hotelname,EncodeKey)),hotelId);
if sRegCode<>ReadRegistry then
begin
hotelspe:= -Hotelspe ;//0 or <0 ; //正式版未注册
installdate := now -1;
caption:=chr($b7)+chr($c9)+chr($ba)+chr($e3)+'进销存管理系统正式版未注册';
end;
if ( hotelspe > 0) and (installdate > now) then //security use
begin
AboutBox.ProductName.caption:=MainForm.caption;
Aboutbox.Comments.caption:=hotelName;
end else begin
bInputtip:=false;
bOutUnit2:=false;
bTwoUnit:=false;
end;
{if adoQuery1.fieldByname('USBDriver').asstring='U' then
s:=' U盘在线' else s:='';
StatusBar.panels[0].text :=s ;
StatusBar.panels[1].text :=sPrinter+' 打印开' ;
StatusBar.panels[2].text :=sPrinter+'fh' ;}
if hotelspe > 100 then //pos,避免自动转财务日
b7Seq :=true;
//获取计算机名
dataE2.myComputerName :=DataE2.getComputName;
//进行权限设置
SetMenuItems;
end;
end;
procedure TMainForm.FormActivate(Sender: TObject);
begin
StatusBar.Panels[1].Text:='操作员:'+datae2.myUsrName;
if bPass then
begin
InitSysteminfo;
bPass:=false;
end;
POSItem.Visible:=(dataE2.HotelSpe>100);
RepairItem.Visible:=(dataE2.HotelSpe=Motor);
if Pos('-',self.Caption)=0 then
self.Caption:=self.Caption+'-['+dataE2.sAccountName+']';
end;
procedure TMainForm.SetMenuItems;
var
I,J,m,K: Integer;
Temp,Temp1: TMenuItem;
sCaption,s:string;
bInit:boolean;
begin
//get cfg information
bInit:=true;
with dataE2 do
if OpenTable('select * from rights where number= :number and isPermit=0',myNumber) then
while not adoQuery1.Eof do
begin
s:=adoQuery1.fieldbyname('name').asstring;
for I := MainMenu1.items.count - 1 downto 0 do //一级菜单,如:进货管理
begin
Temp := MainMenu1.Items[i];
for J := Temp.count - 1 downto 0 do //二级菜单,如:操作员及权限
begin
sCaption:=Temp.items[j].caption;
k:=pos('(',sCaption)-1;
if k>0 then sCaption:=copy(sCaption,1,k);
//初始为true,
if bInit then
if not Temp.Items[J].Enabled then Temp.Items[J].Enabled:=true;
if sCaption = s then
Temp.Items[J].Enabled :=false;
Temp1 := Temp.Items[j]; //二级菜单,如:地区,客户类别,供应商类别
for m := Temp1.count - 1 downto 0 do
begin
sCaption:=Temp1.items[m].caption;
k:=pos('(',sCaption)-1;
if k>0 then sCaption:=copy(sCaption,1,k);
//初始为true,
if bInit then
if not Temp1.Items[m].Enabled then Temp1.Items[m].Enabled:=true;
if sCaption = s then
Temp1.Items[m].Enabled :=false;
end;
end;
end;
adoQuery1.Next;
if bInit then bInit:=not bInit;
end;
end;
procedure TMainForm.SuitParamsClick(Sender: TObject);
begin
SysParamForm.showModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.RestroeitemClick(Sender: TObject);
begin
//标志在恢复数据
//dataE2.gTableId :=-1;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
Backupform.Caption := '请选择正确的路径 - 数据恢复';
Backupform.cmdBackup.Visible:=false;
Backupform.cmdRestore.Visible:=true;
Backupform.showmodal;
end;
procedure TMainForm.ClearSuitItemClick(Sender: TObject);
begin
ClearForm.showmodal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.DeleteItemClick(Sender: TObject);
begin
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
DeleteForm.showmodal;
end;
procedure TMainForm.MVendorPurchaseTotalClick(Sender: TObject);
begin
dataE2.gTableId :=0;
InfoSchForm.xTableId :=(sender as TMenuItem).tag;
infoSchForm.caption :=(sender as TMenuItem).Caption ;
InfoSchForm.showModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.N53Click(Sender: TObject);
var
sHlpPathName:string;
begin
sHlpPathName:=ExtractFileDir(Application.ExeName)+'\fhE2help.chm';
HtmlHelp_(sHlpPathname);
//HtmlHelp_('d:\backupdata\myChm\');
end;
procedure TMainForm.ChangeOprItemClick(Sender: TObject);
begin
LoginForm.showModal;
SetMenuItems;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.FormResize(Sender: TObject);
begin
Panel2.height:=height-100;
end;
procedure TMainForm.MDIncomeClick(Sender: TObject);
begin
dataE2.gTableId :=33;
application.CreateForm(TDInComeForm, DIncomeForm);
DIncomeForm.ShowModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
DIncomeForm.Free;
end;
procedure TMainForm.MDExpenseClick(Sender: TObject);
begin
dataE2.gTableId :=43;
application.CreateForm(TDInComeForm, DIncomeForm);
DIncomeForm.ShowModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
DIncomeForm.Free;
end;
procedure TMainForm.PosSchItemClick(Sender: TObject);
begin
dataE2.gTableId :=23;
application.CreateForm(TPosSchform, PosSchform);
PosSchform.ShowModal;
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
PosSchform.Free;
end;
procedure TMainForm.DayAuditItemClick(Sender: TObject);
var
sErrInfo:string;
begin
inherited;
//sql2000,quersum.update
sErrInfo:='请确认进行日结处理'+chr(13);
sErrInfo:=sErrInfo+'原财务日:'+dateTostr(dataE2.myinvodate);
if application.messagebox(pchar(sErrInfo),'确认',MB_OKCANCEL+MB_ICONQUESTION+MB_DEFBUTTON2)=IDOK then
with dataE2 do
begin
adoConStore.begintrans;
try
sErrInfo:='结转POS单到销售单错误 ! ';
DayAuditPayed(myInvodate);
//非超市要统计未付款情况,及业务员
if hotelspe <100 then
DayAuditNoPay(myInvodate);
sErrInfo:='更新财务日错误 ! ';
adoCmd.commandtext:='update cfg set invodate=invodate+1 where invodate< getdate()';
adoCmd.execute;
adoConStore.commitTrans;
if adoquery1.active then adoquery1.close;
adoquery1.sql.Clear;
adoQuery1.sql.add('select invodate from cfg');
adoquery1.open;
if not adoquery1.eof then
myInvodate :=adoquery1.fieldbyname('invodate').asdatetime;
adoquery1.Close;
application.messagebox(pchar('日结完成 !,现财务日:'+dateTostr(myInvodate)),'确认',MB_OK+MB_ICONINFORMATION);
except
application.MessageBox(pchar(sErrInfo),'错误',MB_ok);
adoConstore.rollbacktrans;
end;
end;//end of datamodule2
DataE2.InsEvent((sender as TMenuItem).Caption,'正常进入'+(sender as TMenuItem).Caption);
end;
procedure TMainForm.BankDetailItemClick(Sender: TObject);
begin
InfoSchForm.xTableId :=(sender as TMenuItem).tag;
infoSchForm.caption :=(sender as TMenuItem).Caption ;
InfoSchForm.showModal;
end;
procedure TMainForm.LbeRpt1Click(Sender: TObject);
var
nRptTag:integer;
begin
if CheckRights(LbeRpt1.Caption) then
begin
case nLblTag of
0: nRptTag:=53;
1: nRptTag:=73;
2: nRptTag:=90;
else nRptTag:=58;
end;
InfoSchForm.xTableId :=nRpttag;
infoSchForm.caption :=(sender as tLabel).Caption ;
InfoSchForm.showModal;
end;
end;
procedure TMainForm.LbeRpt2Click(Sender: TObject);
var
nRptTag:integer;
begin
if CheckRights(LbeRpt2.Caption) then
begin
case nLblTag of
0: nRptTag:=52;
1: nRptTag:=72;
2: nRptTag:=91;
else nRptTag:=5; //no use
end;
InfoSchForm.xTableId :=nRpttag;
infoSchForm.caption :=(sender as tLabel).Caption ;
InfoSchForm.showModal;
end;
end;
procedure TMainForm.LbeRpt4Click(Sender: TObject);
var
nRptTag:integer;
begin
if CheckRights(LbeRpt4.Caption) then
begin
case nLblTag of
0: nRptTag:=51;
1: nRptTag:=71;
2: nRptTag:=96;
4: nRptTag:=99;
else nRptTag:=83;
end;
InfoSchForm.xTableId :=nRpttag;
infoSchForm.caption :=(sender as tLabel).Caption ;
InfoSchForm.showModal;
end;
end;
procedure TMainForm.LbeRpt5Click(Sender: TObject);
var
nRptTag:integer;
begin
if CheckRights(LbeRpt5.Caption) then
begin
case nLblTag of
0: nRptTag:=50;
1: nRptTag:=70;
2: nRptTag:=97;
else nRptTag:=5; //no use
end;
InfoSchForm.xTableId :=nRpttag;
infoSchForm.caption :=(sender as tLabel).Caption ;
InfoSchForm.showModal;
end;
end;
procedure TMainForm.LbeRpt7Click(Sender: TObject);
var
nRptTag:integer;
begin
if CheckRights(LbeRpt7.Caption) then
begin
case nLblTag of
0: nRptTag:=55;
1: nRptTag:=75;
2: nRptTag:=92;
else nRptTag:=5; //no use
end;
InfoSchForm.xTableId :=nRpttag;
infoSchForm.caption :=(sender as tLabel).Caption ;
InfoSchForm.showModal;
end;
end;
procedure TMainForm.LbeRpt8Click(Sender: TObject);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -