📄 jysj.pas
字号:
unit jysj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, Grids, DBGrids, StdCtrls, ExtCtrls;
type
TjysjForm = class(TForm)
DataSource1: TDataSource;
Query1: TQuery;
Panel1: TPanel;
DBGrid1: TDBGrid;
Panel2: TPanel;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
zh: TComboBox;
Query2: TQuery;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure zhKeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Panel1Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
jysjForm: TjysjForm;
implementation
uses dataproc;
{$R *.DFM}
procedure init;
begin
with jysjForm do
begin //特殊 custom 表中 djcode 指 消费单号
Query1.sql.text:='select HandNo,Djcode,status=(select sexname from lssex where sex=custom.sex),AccNo,mqaccno=(select accno from nowin where HandNo=custom.HandNo),';
Query1.sql.add('CusName=(select CusName from cusitem where Cuscode=custom.Cuscode),CusNum,CusPrice,Money,Regtime,IsXj,IsMd,');
Query1.sql.add('iszy=Proid,czy,ispd=pdid from custom where AccNo not in (select AccNo from nowin)');
Query1.Open;
if Query1.Eof then
begin
Query1.sql.Clear;
Query1.Active:=false;
DBGrid1.Visible:=false;
Panel2.Visible:=false;
Panel1.Caption:='数据整理完毕!按任意键退出';
Panel1.Font.Color:=clBlue;
// Panel1.Font.Height:=24;
Panel1.Font.Name:='隶书';
Panel1.Font.Size:=18;
Panel1.Font.Pitch:=fpDefault;
ActiveControl:=nil;
end
else
begin
Panel2.Visible:=true;
DBGrid1.Visible:=true;
if Query1.RecordCount<=11 then DBGrid1.Height:=30+Query1.RecordCount*22;
ChineseGrid(DBGrid1);
DBGrid1.Fields[3].displaylabel:='消费帐号';
DBGrid1.Fields[4].displaylabel:='目前帐号';
DBGrid1.Fields[6].displaylabel:='数量';
DBGrid1.Fields[7].displaylabel:='单价';
// DBGrid1.Fields[5].displaylabel:='';
dbgrid1.Columns[6].width:=30;
dbgrid1.Columns[7].width:=30;
dbgrid1.Columns[8].width:=30;
end;
end;
end;
//'0' ' 空''1' ' 满''2' ' 脏''3' ' 修''4' ' 免''5' ' 订''6' ' 通'
procedure TjysjForm.FormCreate(Sender: TObject);
begin
Query2.SQL.text:='update room1 set status='''+'1'+''' where status<>'''+'1'+''' and status<>'''+'4'+''' and status<>'''+'7'+''' and status<>'''+'6'+''' and RoomNo in (select HandNo from nowin where isbj=1)';
Query2.SQL.add('update room1 set status='''+'0'+''' where status<>'''+'0'+''' and status<>'''+'7'+''' and status<>'''+'2'+''' and status<>'''+'3'+''' and RoomNo not in (select HandNo from nowin where isbj=1)');
Query2.SQL.add('update mansan set status='''+'1'+''' where status<>'''+'1'+''' and status<>'''+'7'+''' and status<>'''+'4'+''' and status<>'''+'6'+''' and RoomNo in (select HandNo from nowin where isbj=0 and sex='''+'1'+''')');
Query2.SQL.add('update mansan set status='''+'0'+''' where status<>'''+'0'+''' and status<>'''+'7'+''' and RoomNo not in (select HandNo from nowin where isbj=0 and sex='''+'1'+''')');
Query2.SQL.add('update womansan set status='''+'1'+''' where status<>'''+'1'+''' and status<>'''+'7'+''' and status<>'''+'4'+''' and status<>'''+'6'+''' and RoomNo in (select HandNo from nowin where isbj=0 and sex='''+'0'+''')');
Query2.SQL.add('update womansan set status='''+'0'+''' where status<>'''+'0'+''' and status<>'''+'7'+''' and RoomNo not in (select HandNo from nowin where isbj=0 and sex='''+'0'+''')');
Query2.SQL.add('update jy1 set status='''+'1'+''' where status<>'''+'1'+''' and status<>'''+'4'+''' and status<>'''+'6'+''' and RoomNo in (select HandNo from nowin where isbj=0 and sex='''+'3'+''')');
Query2.SQL.add('update jy1 set status='''+'0'+''' where status<>'''+'0'+''' and RoomNo not in (select HandNo from nowin where isbj=0 and sex='''+'3'+''')');
Query2.SQL.add('delete deposit where accno not in (select accno from qbnowin)') ;
Query2.ExecSQL;
Query2.sql.Clear;
Query2.Active:=false;
Query2.SQL.text:='select DISTINCT accno from nowin';
Query2.Open;
zh.Items.Clear;
while not Query2.Eof do
begin
zh.Items.Add(Query2.Fields[0].asstring);
Query2.Next;
end;
Query2.sql.Clear;
Query2.Active:=false;
init;
end;
procedure TjysjForm.Button3Click(Sender: TObject);
begin
zh.Visible:=true;
zh.Text:='';
end;
procedure TjysjForm.zhKeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then
zh.Visible:=false;
if (key=#13) and (trim(zh.text)<>'') then
begin
Query2.SQL.text:='update custom set accno='''+trim(zh.Text)+''' where Djcode='''+Query1.fieldbyname('Djcode').asstring+''' and handno='''+Query1.fieldbyname('handno').asstring+'''';
Query2.ExecSQL;
Query2.sql.Clear;
Query2.Active:=false;
init;
exit;
end;
key:=#0;
end;
procedure TjysjForm.Button1Click(Sender: TObject);
begin
{ Query2.SQL.text:='update custom set accno='''+Query1.fieldbyname('mqaccno').asstring+''' where Djcode='''+Query1.fieldbyname('Djcode').asstring+''' and handno='''+Query1.fieldbyname('handno').asstring+'''';
Query2.ExecSQL;
Query2.sql.Clear;
Query2.Active:=false; }
init;
end;
procedure TjysjForm.Button2Click(Sender: TObject);
begin
Query2.SQL.text:='delete custom where AccNo='''+Query1.fieldbyname('AccNo').asstring+''' and handno='''+Query1.fieldbyname('handno').asstring+'''';
Query2.ExecSQL;
Query2.sql.Clear;
Query2.Active:=false;
init;
end;
procedure TjysjForm.Panel1Click(Sender: TObject);
begin
if not Panel2.Visible then
close;
end;
procedure TjysjForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if not Panel2.Visible then
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -