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

📄 frm_payoutu.~pas

📁 快餐店管理系统 很好的参考材料 谢谢您的合作
💻 ~PAS
字号:
unit frm_payoutU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, frm_infoU, StdCtrls, DB, Grids, DBGrids,Control_payoutU,
  ClassesU, Control_typeU;

type
  Tfrm_payout = class(Tfrm_info)
    Label1: TLabel;
    edt_date: TEdit;
    cbx_type: TComboBox;
    Label2: TLabel;
    Label3: TLabel;
    edt_fee: TEdit;
    Label4: TLabel;
    Memo_remark: TMemo;
    Label5: TLabel;
    Label6: TLabel;
    cbx_type_s: TComboBox;
    procedure btn_addClick(Sender: TObject);
    procedure edt_feeKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure DBGrid_infoCellClick(Column: TColumn);
    procedure btn_delClick(Sender: TObject);
    procedure btn_editClick(Sender: TObject);
    procedure cbx_type_sChange(Sender: TObject);
  private
    { Private declarations }
  public
    procedure FillData;
  end;

var
  frm_payout: Tfrm_payout;

implementation

{$R *.dfm}
procedure Tfrm_payout.FillData;
begin
  DataSource_info.DataSet:=Control_payoutU.GetPayoutArray;
  self.DBGrid_info.Columns[0].Visible  :=false;
  FillCBXDataByTypeArray(self.cbx_type,1);
  FillCBXDataByTypeArray(self.cbx_type_s,1);
  self.cbx_type_s.Items.Append('全部');
end;
procedure Tfrm_payout.btn_addClick(Sender: TObject);
var
  Payout:TPayout;
begin
  inherited;
 if((edt_fee.Text='') or (cbx_type.Text='')) then
        begin
           MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;
     
      Payout:=TPayout.Create;
      Payout.id:=self.cbx_type.Tag;
      Payout.FeeType:=self.cbx_type.Text;
      Payout.FeeDate:=DateToStr(Now);
      Payout.Fee:=StrToFloat(self.edt_fee.Text);
      Payout.Remark:=self.Memo_remark.Text;
      
      if(Control_PayoutU.AddPayout(Payout)) then
        begin
          MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK);

          //刷新内容
          FillData;
        end
      else
        begin
          MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION);
          exit;
        end;
end;

procedure Tfrm_payout.edt_feeKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if not((key in ['0'..'9',#8,#13,#46])) then
    key:=#0;
end;

procedure Tfrm_payout.FormShow(Sender: TObject);
begin
  inherited;
FillData;
end;

procedure Tfrm_payout.DBGrid_infoCellClick(Column: TColumn);
begin
  inherited;
if self.DBGrid_info.Fields[0].IsNull then
    exit;
  self.cbx_type.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
  self.cbx_type.Text:=self.DBGrid_info.Fields[1].Value;
  self.edt_date.Text:=DateToStr(self.DBGrid_info.Fields[2].Value);
  self.edt_fee.Text:=FloattoStr(self.DBGrid_info.Fields[3].Value);
  self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value;
end;

procedure Tfrm_payout.btn_delClick(Sender: TObject);
begin
  inherited;
if MessageBox(Handle, '您确定要删除该支出信息', '信息',
     MB_ICONQUESTION or MB_OKCANCEL) = IDOK then
    begin
      Control_PayoutU.DelPayout(self.cbx_type.Tag);
      FillData;
      if self.DBGrid_info.Fields[0].IsNull then
        exit;
      self.cbx_type.Tag:=self.DBGrid_info.Fields[0].Value;//保存id
      self.cbx_type.Text:=self.DBGrid_info.Fields[1].Value;
      self.edt_date.Text:=DateToStr(self.DBGrid_info.Fields[2].Value);
      self.edt_fee.Text:=FloattoStr(self.DBGrid_info.Fields[3].Value);
      self.Memo_remark.Text:=self.DBGrid_info.Fields[1].Value;
    end;
end;

procedure Tfrm_payout.btn_editClick(Sender: TObject);
var
  Payout:TPayout;
begin
  inherited;
 if edt_Fee.Text ='' then
    begin
       MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION);
      exit;
    end
  else
    begin
        if((edt_fee.Text='') or (cbx_type.Text='')) then
        begin
           MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION);
           exit;
        end;

      Payout:=TPayout.Create;
      Payout.id:=self.cbx_type.Tag;
      Payout.FeeType:=self.cbx_type.Text;
      Payout.FeeDate:=DateToStr(Now);
      Payout.Fee:=StrToFloat(self.edt_fee.Text);
      Payout.Remark:=self.Memo_remark.Text;
      if(Control_PayoutU.EditPayout(Payout)) then
        begin
          MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK);
          //刷新内容
          FillData;
        end
      else
         begin
          MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION);
          exit;
         end;
          self.cbx_type.SetFocus;
    end;
end;

procedure Tfrm_payout.cbx_type_sChange(Sender: TObject);
begin
  inherited;
DataSource_info.DataSet:=GetPayoutByPayoutID(self.cbx_type_s.Text);
  self.DBGrid_info.Columns[0].Visible  :=false;
end;

end.

⌨️ 快捷键说明

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