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

📄 xfdhcx.pas

📁 集成酒店桑拿食管管理的完整程序
💻 PAS
字号:
unit xfdhcx;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, Grids, DBGrids, ExtCtrls, Buttons, StdCtrls, Mask, ComCtrls;

type
  Txfdhcxform = class(TForm)
    Bevel1: TBevel;
    cx: TQuery;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    dhcx: TQuery;
    Panel3: TPanel;
    cxbut: TBitBtn;
    BitBtn1: TBitBtn;
    Panel2: TPanel;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    Label1: TLabel;
    Label3: TLabel;
    begdate: TDateTimePicker;
    begtime: TDateTimePicker;
    enddate: TDateTimePicker;
    endtime: TDateTimePicker;
    dh: TEdit;
    Splitter1: TSplitter;
    GroupBox1: TGroupBox;
    xj: TCheckBox;
    GroupBox2: TGroupBox;
    md: TCheckBox;
    Label2: TLabel;
    Edit1: TEdit;
    xf: TCheckBox;
    BitBtn2: TBitBtn;
    print: TQuery;
    procedure FormCreate(Sender: TObject);
    procedure cxbutClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure DataSource2DataChange(Sender: TObject; Field: TField);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  xfdhcxform: Txfdhcxform;

implementation
uses dataproc, xfdhprin;

{$R *.DFM}
var
  acc:string;

procedure Txfdhcxform.FormCreate(Sender: TObject);
begin
   shortdateformat:='yyyy-MM-dd';
   dh.text:='';
   edit1.text:='';
   begdate.DateTime:=now-1;
   enddate.DateTime:=now;
   begtime.Time:=strtotime('00:00:00');
   endtime.Time:=strtotime('23:59:00');
end;

procedure Txfdhcxform.cxbutClick(Sender: TObject);
var  tj:string;
begin
  tj:='';
  if xf.Checked then
  begin
    if tj='' then
    begin
     if trim(dh.Text)<>'' then tj:=' and CAST(djcode AS decimal(25,8))>='+trim(dh.Text)+'' ;
    end
     else
      if trim(dh.Text)<>'' then tj:=tj+' and CAST(djcode AS decimal(25,8))>='+trim(dh.Text)+'';
    if tj='' then
    begin
     if trim(edit1.Text)<>'' then tj:=' and CAST(djcode AS decimal(25,8))<='+trim(edit1.Text)+'' ;
    end
     else
      if trim(edit1.Text)<>'' then tj:=tj+' and CAST(djcode AS decimal(25,8))<='+trim(edit1.Text)+'';
  end;
  if xj.Checked then
  begin
   if tj='' then
      tj:=' and isxj=1 ' else
      tj:=tj+' and isxj=1 ';
  end;
  if md.Checked then
  begin
   if tj='' then
      tj:=' and ismd=1 ' else
      tj:=tj+' and ismd=1 ';
  end;
    dhcx.Active:=false;
    dhcx.SQL.Clear;
    dhcx.SQL.Add('select  CAST(djcode AS decimal(25,8)) as 消费单号, sum(money) as 合计,accno  as 记录号 from lscustom where  regtime>=:pbegtime and regtime<=:pendtime '+tj+'group by CAST(djcode AS decimal(25,8)),accno  order by CAST(djcode AS decimal(25,8))');
    dhcx.ParamByName('pbegtime').asstring:=formatdatetime('yyyy-MM-dd',begdate.date)+' '+formatdatetime('hh:mm:ss',begtime.time);
    dhcx.ParamByName('pendtime').asstring:=formatdatetime('yyyy-MM-dd',enddate.date)+' '+formatdatetime('hh:mm:ss',endtime.time);
    dhcx.Prepare;
    dhcx.Open;
    dbgrid2.Fields[0].DisplayLabel:='消费单号';
    dbgrid2.Fields[1].DisplayLabel:='合计';
    dbgrid2.Fields[2].DisplayLabel:='记录号';
end;

procedure Txfdhcxform.BitBtn1Click(Sender: TObject);
begin
   close;
end;

procedure Txfdhcxform.DataSource2DataChange(Sender: TObject;
  Field: TField);
begin
   if DataSource1.DataSet=nil then exit;
         cx.Active :=false;
         cx.sql.clear;
         cx.sql.add('select lscustom.handno,cusitem.cusname,lscustom.cusprice,lscustom.cusnum,lscustom.money,lscustom.isxj,lscustom.ismd,lscustom.regtime,lscustom.czy,pdid,Proid,lscustom.djcode  as  djcode from lscustom,cusitem');
         cx.sql.add('  where (lscustom.cuscode=cusitem.cuscode) and accno=:paccno and CAST(lscustom.djcode AS decimal(25,8))=:pcode  ');
         if dhcx.Fields[0].asstring='' then
         cx.ParamByName('pcode').asinteger:=0 else
         cx.ParamByName('pcode').asinteger:=dhcx.Fields[0].asinteger;
         cx.ParamByName('paccno').asstring:=dhcx.Fields[2].asstring;
         cx.Prepare;
         cx.Open;
         chinesegrid(dbgrid1);
         cx.active:=true;

end;

procedure Txfdhcxform.BitBtn2Click(Sender: TObject);
begin
     print.Active;
     print.SQL.Clear;
     print.SQL.Add('delete from  xfdhprint');
     print.Prepare;
     print.ExecSQL;
     while not dhcx.Eof do
     begin
       print.SQL.Clear;
       print.SQL.Add('insert into xfdhprint values(:code1,:money1,:accno1,:code2,:money2,:accno2,:code3,:money3,:accno3) ');
       print.ParamByName('code1').asstring:=dhcx.fieldbyname('消费单号').asstring;
       print.ParamByName('money1').asstring:=dhcx.fieldbyname('合计').asstring;
       print.ParamByName('accno1').asfloat:=dhcx.fieldbyname('记录号').asfloat;
       dhcx.Next;
       if dhcx.Eof then
       begin
         print.ParamByName('code2').asstring:='';
         print.ParamByName('money2').asstring:='';
         print.ParamByName('accno2').asstring:='';
         print.ParamByName('code3').asstring:='';
         print.ParamByName('money3').asstring:='';
         print.ParamByName('accno3').asstring:='';
       end else
       begin
         print.ParamByName('code2').asstring:=dhcx.fieldbyname('消费单号').asstring;
         print.ParamByName('money2').asstring:=dhcx.fieldbyname('合计').asstring;
         print.ParamByName('accno2').asfloat:=dhcx.fieldbyname('记录号').asfloat;
         dhcx.Next;
         print.ParamByName('code3').asstring:=dhcx.fieldbyname('消费单号').asstring;
         print.ParamByName('money3').asstring:=dhcx.fieldbyname('合计').asstring;
         print.ParamByName('accno3').asfloat:=dhcx.fieldbyname('记录号').asfloat;
         dhcx.Next;
       end;
       print.Prepare;
       print.ExecSQL;
     end;
     print.Active:=false;
     print.SQL.Clear;
     print.SQL.Add('select * from  xfdhprint order by CAST(code1 AS decimal(25,8))');
     print.Prepare;
     print.Open;
     application.CreateForm(Txfdhprintform,xfdhprintform);
     xfdhprintform.QRLabel6.Caption:=formatdatetime('yyyy''年''MM''月''d''日'' hh:mm',begdate.Datetime)+'至'+formatdatetime('yyyy''年''MM''月''d''日'' hh:mm',enddate.Datetime);
     xfdhprintform.hide;
    // if RadioButton2.Checked then
     xfdhprintform.qr1.Preview;// else
  //   xfdhprintform.qr1.Print;

     xfdhprintform.free;
     
end;

end.

⌨️ 快捷键说明

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