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

📄 ufhmrp1.pas

📁 飞恒进销存(超市批发)管理系统V5.1(含源程序) 语言:Delphi 6/7 相关控件:FastReport 2.4以上, Ehlib 3.4以上 1.数据库为fhe2db_V51.da
💻 PAS
📖 第 1 页 / 共 3 页
字号:
ImgDcombine1.Visible:=false;
Imgpay.Visible:=false;
Imgpay1.Visible:=false;
Imgcharge.Visible:=false;
Imgcharge1.Visible:=false;
image25.Visible:=false;
image26.Visible:=false;
image27.Visible:=false;
image28.Visible:=false;
image29.Visible:=false;
image32.Visible:=false;
image33.Visible:=false;
image34.Visible:=false;
LbeRpt1.Caption:='当前库存明细表';
LbeRpt2.Caption:='商品货位表';
LbeRpt3.Caption:='';
LbeRpt4.Caption:='库存不足报警';
LbeRpt5.Caption:='库存积压报警';
LbeRpt6.Caption:='';
LbeRpt7.Caption:='库存数量汇总表';
LbeRpt8.Caption:='';
ImgRpt1.Visible:=true;
ImgRpt2.Visible:=true;
ImgRpt3.Visible:=false;
ImgRpt4.Visible:=true;
ImgRpt5.Visible:=true;
ImgRpt6.Visible:=false;
ImgRpt7.Visible:=true;
ImgRpt8.Visible:=false;
end;


procedure TMainForm.ExitItemClick(Sender: TObject);
begin
  if messagedlg('欢迎使用本系统!'+char(13)+'真的要退出吗?',mtconfirmation,[mbYes,mbNo],0)=6 then
    close
  else exit;
end;

procedure TMainForm.N65Click(Sender: TObject);
begin
  application.CreateForm(TGoodDform, GoodDform);
  GoodDform.ShowModal;
  GoodDform.Free;
end;

procedure TMainForm.Label7Click(Sender: TObject);
begin
  exitItem.Click;
end;

procedure TMainForm.MBankClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsBank;
  infoform.Width:=450;
  infoform.Caption:='现金银行';
  infoform.showmodal;
end;

procedure TMainForm.MIetypeClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsIetype;
  infoform.Width:=450;
  infoform.Caption:='收入支出类别';
  infoform.showmodal;
end;

procedure TMainForm.MpaytypeClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dspaytype;
  infoform.Width:=450;
  infoform.Caption:='收付款方式';
  infoform.showmodal;
end;

procedure TMainForm.MIOTYPEClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsIOTYPE;
  infoform.Width:=450;
  infoform.Caption:='其它出入库类型';
  infoform.showmodal;
end;

procedure TMainForm.MgoodtypeClick(Sender: TObject);
begin
  infoTypeform.showmodal;
end;

procedure TMainForm.MUnitClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsUnit;
  infoform.Width:=450;
  infoform.Caption:='单位资料';
  infoform.showmodal;
end;

procedure TMainForm.MDeptClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsDept;
  infoform.Width:=450;
  infoform.Caption:='部门资料';
  infoform.showmodal;
end;

procedure TMainForm.MemployClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsemploy;
  infoform.Width:=700;
  infoform.Caption:='员工资料';
  infoform.showmodal;
end;

procedure TMainForm.OprRightsItemClick(Sender: TObject);
begin
  infoform.infoGEh.DataSource:=DataE2.dsOpr;
  infoform.Width:=500;
  infoform.Caption:='操作员及权限设置';
  infoform.showmodal;
end;

procedure TMainForm.ChangePwdClick(Sender: TObject);
begin
  ChgPwdform.showmodal;
end;

procedure TMainForm.eventLogItemClick(Sender: TObject);
begin
  EventLogForm.showmodal;
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 then
    begin
      AboutBox.ProductName.caption:=MainForm.caption;
      Aboutbox.Comments.caption:=hotelName;
    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;

    //进行权限设置
    SetMenuItems;
  end;

end;

procedure TMainForm.FormActivate(Sender: TObject);
begin
  if bPass then
  begin
    InitSysteminfo;
    bPass:=false;
  end;
end;

procedure TMainForm.SetMenuItems;
var
  I,J,K: Integer;
  Temp: TMenuItem;
  sCaption,s:string;
begin
  //get cfg information
  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 not Temp.Items[J].Enabled then Temp.Items[J].Enabled:=true;

        if sCaption = s then
          Temp.Items[J].Enabled :=false;
      end;
    end;
    adoQuery1.Next;
  end;

end;

procedure TMainForm.SuitParamsClick(Sender: TObject);
begin
  SysParamForm.showModal;
end;

procedure TMainForm.RestroeitemClick(Sender: TObject);
begin
  //标志在恢复数据
  dataE2.gTableId :=-2;
  Backupform.showmodal;
end;

procedure TMainForm.ClearSuitItemClick(Sender: TObject);
begin
  ClearForm.showmodal;
end;

procedure TMainForm.DeleteItemClick(Sender: TObject);
begin
  DeleteForm.showmodal;
end;

procedure TMainForm.MVendorPurchaseTotalClick(Sender: TObject);
begin
  InfoSchForm.xTableId :=(sender as TMenuItem).tag;
  infoSchForm.caption  :=(sender as TMenuItem).Caption ;
  InfoSchForm.showModal;
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;
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;
  DIncomeForm.Free;
end;

procedure TMainForm.MDExpenseClick(Sender: TObject);
begin
  dataE2.gTableId :=43;
  application.CreateForm(TDInComeForm, DIncomeForm);
  DIncomeForm.ShowModal;
  DIncomeForm.Free;
end;

procedure TMainForm.PosSchItemClick(Sender: TObject);
begin
  dataE2.gTableId :=23;

  application.CreateForm(TPosSchform, PosSchform);
  PosSchform.ShowModal;
  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);
      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
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
  case nLblTag of
    0: nRptTag:=53;
    1: nRptTag:=73;
    2: nRptTag:=90;
    else nRptTag:=5;  //no use
  end;
  InfoSchForm.xTableId :=nRpttag;
  infoSchForm.caption  :=(sender as tLabel).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.LbeRpt2Click(Sender: TObject);
var
  nRptTag:integer;
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;

procedure TMainForm.LbeRpt4Click(Sender: TObject);
var
  nRptTag:integer;
begin
  case nLblTag of
    0: nRptTag:=51;
    1: nRptTag:=71;
    2: nRptTag:=96;
    else nRptTag:=5;  //no use
  end;
  InfoSchForm.xTableId :=nRpttag;
  infoSchForm.caption  :=(sender as tLabel).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.LbeRpt5Click(Sender: TObject);
var
  nRptTag:integer;
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;

procedure TMainForm.LbeRpt7Click(Sender: TObject);
var
  nRptTag:integer;
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;

procedure TMainForm.LbeRpt8Click(Sender: TObject);
var
  nRptTag:integer;
begin
  case nLblTag of
    0: nRptTag:=54;
    1: nRptTag:=74;
    else nRptTag:=5;  //no use
  end;
  InfoSchForm.xTableId :=nRpttag;
  infoSchForm.caption  :=(sender as tLabel).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.LbeRpt1MouseLeave(Sender: TObject);
begin
  (sender as Tlabel).Font.Color:=clWindowText;
  (sender as Tlabel).Cursor:=crdefault;
end;

procedure TMainForm.PosTurnItemClick(Sender: TObject);
begin
  InfoSchForm.xTableId :=(sender as TMenuItem).tag;
  infoSchForm.caption  :=(sender as TMenuItem).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.N57Click(Sender: TObject);
begin
  RegCodeForm.showModal;
end;

procedure TMainForm.Image32Click(Sender: TObject);
begin
  MDExpense.Click;  
end;

procedure TMainForm.Image34Click(Sender: TObject);
begin
  MDIncome.Click;
end;

procedure TMainForm.Image25Click(Sender: TObject);
begin
  BackupItem.Click;
end;

procedure TMainForm.Image27Click(Sender: TObject);
begin
  ChangePwd.Click;
end;

procedure TMainForm.Image29Click(Sender: TObject);
begin
  Restroeitem.Click;
end;

procedure TMainForm.Image28Click(Sender: TObject);
begin
  OprRightsItem.Click;
end;

procedure TMainForm.Image26Click(Sender: TObject);
begin
  SuitParams.Click;
end;

procedure TMainForm.VIPCardItemClick(Sender: TObject);
begin
  BasicdataForm.xTableId :=(sender as TMenuItem).tag;
  BasicdataForm.caption  :=(sender as TMenuItem).Caption ;
  BasicdataForm.showModal;
end;

procedure TMainForm.CardDiscountItemClick(Sender: TObject);
begin
  InfoSchForm.xTableId :=(sender as TMenuItem).tag;
  infoSchForm.caption  :=(sender as TMenuItem).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.CardTotalItemClick(Sender: TObject);
begin
  InfoSchForm.xTableId :=(sender as TMenuItem).tag;
  infoSchForm.caption  :=(sender as TMenuItem).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.CardDetailItemClick(Sender: TObject);
begin
  InfoSchForm.xTableId :=(sender as TMenuItem).tag;
  infoSchForm.caption  :=(sender as TMenuItem).Caption ;
  InfoSchForm.showModal;
end;

procedure TMainForm.POS1Click(Sender: TObject);
begin
  try
    Application.CreateForm(TPosMachineForm,PosMachineForm);
    PosMachineForm.showmodal;
  finally
    PosMachineForm.free;
  end;
end;

end.

⌨️ 快捷键说明

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