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

📄 tcyyxz.pas

📁 日昌餐饮管理系统是用Delphi7+SQL写的管理系统
💻 PAS
字号:
unit tcyyxz;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, CheckLst, DB, DBTables, Grids, DBGrids;

type
  TtcyyForm = class(TForm)
    CheckListBox1: TCheckListBox;
    Label1: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    DBGrid2: TDBGrid;
    Query2: TQuery;
    UpdateSQL1: TUpdateSQL;
    DataSource2: TDataSource;
    Query1: TQuery;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    Edit2: TEdit;
    DBGrid1: TDBGrid;
    Label5: TLabel;
    DataSource1: TDataSource;
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure DBGrid2DblClick(Sender: TObject);
    procedure CheckListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  tcyyForm: TtcyyForm;
  tfje:real;

implementation

uses qtmain;

{$R *.dfm}

procedure TtcyyForm.FormActivate(Sender: TObject);
begin
     qtform.fkwj.Close;
     qtform.fkwj.Parameters[0].Value:=qtform.lsQdjh.Value;
     qtform.fkwj.Parameters[1].Value:=date+strtotime('00:00:00');
     qtform.fkwj.Parameters[2].Value:=date+time;
     qtform.fkwj.Open;
     if tfje=-1 then
     begin
      tfje:=0;
      while not qtform.fkwj.Eof do
      begin
       tfje:=tfje+qtform.fkwjfkje.AsFloat;
       qtform.fkwj.Next;
      end;
     end;
     edit2.Text:=floattostr(tfje);
     query1.Open;
     CheckListBox1.Items.Clear;
     while not query1.Eof do
      begin
        CheckListBox1.Items.Add(query1.FieldByName('tcmc').AsString+'——'+query1.FieldByName('tcbh').AsString);
        query1.Next;
      end;
     query1.Close;
     query2.ParamByName('cs').AsString:=qtform.lsQdjh.AsString;
     query2.ParamByName('cs1').AsDateTime:=date+strtotime('00:00:00');
     query2.ParamByName('cs2').AsDateTime:=date+strtotime('23:59:59');
     query2.Open;
end;

procedure TtcyyForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     qtform.fkwj.Close;
     query2.ApplyUpdates;
     query2.Close;
end;

procedure TtcyyForm.DBGrid2DblClick(Sender: TObject);
begin
     if query2.RecordCount>0 then
     query2.Delete;
end;

procedure TtcyyForm.CheckListBox1Click(Sender: TObject);
var i,j:integer;
    stt:string;
begin
     query2.First;
     while not query2.Eof do query2.Delete;
     for i:=0 to checklistbox1.Items.Count -1 do
     begin
       if checklistbox1.Checked[i] then
       begin
         Query2.Append;
         Query2.FieldByName('djh').Value:=qtForm.lsQdjh.AsString;
         Query2.FieldByName('pzr').Value:=edit1.Text;
         Query2.FieldByName('rq').Value:=date+time;
         Query2.FieldByName('bh').Value:=qtform.lsQbh.AsString;
         j:=pos('——',checklistbox1.Items.Strings[i]);
         stt:=copy(checklistbox1.Items.Strings[i],j+4,10);
         Query2.FieldByName('tcyybh').Value:=stt;
         stt:=copy(checklistbox1.Items.Strings[i],1,j);
         Query2.FieldByName('tcyymc').Value:=stt;
         Query2.Post;
       end;
     end;
end;

end.

⌨️ 快捷键说明

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