unitdmhotel.pas

来自「自己做过的工程」· PAS 代码 · 共 1,062 行 · 第 1/4 页

PAS
1,062
字号
       end;

    if (usernameCK=true) and (sroomnoCK=true) and (arrivetimeCK=false) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where username='+
                            ''''+ls_username+''''+' and sroomno='+''''+ls_sroomno+'''';
       end;

    if (usernameCK=true) and (sroomnoCK=false) and (arrivetimeCK=true) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where username='+
                            ''''+ls_username+''''+
                            ' and arrivetime='+''''+datetostr(ls_arrivetime)+'''';
       end;

    if (usernameCK=true) and (sroomnoCK=false) and (arrivetimeCK=false) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where username='+
                            ''''+ls_username+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=true) and (arrivetimeCK=true) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where  sroomno='+
                            ''''+ls_sroomno+''''+
                            ' and arrivetime='+''''+datetostr(ls_arrivetime)+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=true) and (arrivetimeCK=false) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where sroomno='+''''+ls_sroomno+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=false) and (arrivetimeCK=true) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book where arrivetime='+''''+datetostr(ls_arrivetime)+'''';
       end;
    //如无条件
    if (usernameCK=false) and (sroomnoCK=false) and (arrivetimeCK=false) then
       begin
           ds_sroom_book_query.CommandText:='select * from sroom_book';
       end;

    ds_sroom_book_query.Prepared:=true;
    ds_sroom_book_query.Open;
end;

//包间状况
procedure TDMHotel.SupDetailQuery(ls_username:string;ls_sroomno:string;ls_entertime:Tdatetime;ls_ischeck:string;usernameCK:boolean;sroomnoCK:boolean;entertimeCK:boolean);
begin
    ds_sup_detail_query.Close;
    ds_sup_detail_query.Prepared:=false;

    if (usernameCK=true) and (sroomnoCK=true) and (entertimeCK=true) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where username='+
                            ''''+ls_username+''''+' and sroomno='+''''+ls_sroomno+''''+
                            ' and entertime>'+''''+datetostr(ls_entertime)+''''+
                            ' and entertime<'+''''+datetostr(ls_entertime+1)+''''+
                            ' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=true) and (sroomnoCK=true) and (entertimeCK=false) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where username='+
                            ''''+ls_username+''''+' and sroomno='+''''+ls_sroomno+''''+
                            ' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=true) and (sroomnoCK=false) and (entertimeCK=true) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where username='+
                            ''''+ls_username+''''+
                            ' and entertime>'+''''+datetostr(ls_entertime)+''''+
                            ' and entertime<'+''''+datetostr(ls_entertime+1)+''''+
                            ' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=true) and (sroomnoCK=false) and (entertimeCK=false) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where username='+
                            ''''+ls_username+''''+' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=true) and (entertimeCK=true) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where  sroomno='+
                            ''''+ls_sroomno+''''+
                            ' and entertime>'+''''+datetostr(ls_entertime)+''''+
                            ' and entertime<'+''''+datetostr(ls_entertime+1)+''''+
                            ' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=true) and (entertimeCK=false) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where sroomno='+
                            ''''+ls_sroomno+''''+' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    if (usernameCK=false) and (sroomnoCK=false) and (entertimeCK=true) then
       begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where entertime>'+
                            ''''+datetostr(ls_entertime)+''''+
                            ' and entertime<'+''''+datetostr(ls_entertime+1)+''''+
                            ' and ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;
    //如无条件
    if (usernameCK=false) and (sroomnoCK=false) and (entertimeCK=false) then
        begin
           ds_sup_detail_query.CommandText:='select * from sup_detail where ischeck='+''''+ls_ischeck+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

    ds_sup_detail_query.Prepared:=true;
    ds_sup_detail_query.Open;
end;

//客房预定
procedure TDMHotel.RoomBookQuery(ls_username:string;ls_roomid:string;ls_booktime:Tdatetime;usernameCK:boolean;roomidCK:boolean;booktimeCK:boolean);
begin
    ADODataSetroombookquery.Close;
    ADODataSetroombookquery.Prepared:=false;

    if (usernameCK=true) and (roomidCK=true) and (booktimeCK=true) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where username='+
                            ''''+ls_username+''''+' and roomid='+''''+ls_roomid+''''+
                            ' and booktime='+''''+datetostr(ls_booktime)+'''';
       end;

    if (usernameCK=true) and (roomidCK=true) and (booktimeCK=false) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where username='+
                            ''''+ls_username+''''+' and roomid='+''''+ls_roomid+'''';
       end;

    if (usernameCK=true) and (roomidCK=false) and (booktimeCK=true) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where username='+
                            ''''+ls_username+''''+
                            ' and booktime='+''''+datetostr(ls_booktime)+'''';
       end;

    if (usernameCK=true) and (roomidCK=false) and (booktimeCK=false) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where username='+
                            ''''+ls_username+'''';
       end;

    if (usernameCK=false) and (roomidCK=true) and (booktimeCK=true) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where  roomid='+
                            ''''+ls_roomid+''''+
                            ' and booktime='+''''+datetostr(ls_booktime)+'''';
       end;

    if (usernameCK=false) and (roomidCK=true) and (booktimeCK=false) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where roomid='+''''+ls_roomid+'''';
       end;

    if (usernameCK=false) and (roomidCK=false) and (booktimeCK=true) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book where booktime='+''''+datetostr(ls_booktime)+'''';
       end;

    //如无条件
    if (usernameCK=false) and (roomidCK=false) and (booktimeCK=false) then
       begin
           ADODataSetroombookquery.CommandText:='select * from room_book';
       end;

    ADODataSetroombookquery.Prepared:=true;
    ADODataSetroombookquery.Open;
end;

//客房状况
procedure TDMHotel.RoomQuery(ls_username:string;ls_roomid:string;ls_intime:Tdatetime;ls_leftornot:string;usernameCK:boolean;roomidCK:boolean;intimeCK:boolean);
begin
    ADODataSetroominquery.Close;
    ADODataSetroominquery.Prepared:=false;

    if (usernameCK=true) and (roomidCK=true) and (intimeCK=true) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where username='+
                            ''''+ls_username+''''+' and roomid='+''''+ls_roomid+''''+
                            ' and intime>'+''''+datetostr(ls_intime)+''''+
                            ' and intime<'+''''+datetostr(ls_intime+1)+''''+
                            ' and leftornot='+''''+ls_leftornot+'''';
       end;

    if (usernameCK=true) and (roomidCK=true) and (intimeCK=false) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where username='+
                            ''''+ls_username+''''+' and roomid='+''''+ls_roomid+''''+
                            ' and leftornot='+''''+ls_leftornot+'''';
       end;

    if (usernameCK=true) and (roomidCK=false) and (intimeCK=true) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where username='+
                            ''''+ls_username+''''+
                            ' and intime>'+''''+datetostr(ls_intime)+''''+
                            ' and intime<'+''''+datetostr(ls_intime+1)+''''+
                            ' and leftornot='+''''+ls_leftornot+'''';
       end;

    if (usernameCK=true) and (roomidCK=false) and (intimeCK=false) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where username='+
                            ''''+ls_username+''''+' and leftornot='+''''+ls_leftornot+'''';
       end;

    if (usernameCK=false) and (roomidCK=true) and (intimeCK=true) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where  roomid='+
                            ''''+ls_roomid+''''+
                            ' and intime>'+''''+datetostr(ls_intime)+''''+
                            ' and intime<'+''''+datetostr(ls_intime+1)+''''+
                            ' and leftornot='+''''+ls_leftornot+'''';
       end;

    if (usernameCK=false) and (roomidCK=true) and (intimeCK=false) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where roomid='+
                            ''''+ls_roomid+''''+' and leftornot='+''''+ls_leftornot+'''';
       end;
    if (usernameCK=false) and (roomidCK=false) and (intimeCK=true) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where intime>'+
                            ''''+datetostr(ls_intime)+''''+' and intime<'+''''+datetostr(ls_intime+1)+''''+
                            ' and leftornot='+''''+ls_leftornot+'''';
       end;
    //如无条件
    if (usernameCK=false) and (roomidCK=false) and (intimeCK=false) then
       begin
           ADODataSetroominquery.CommandText:='select * from room_in where leftornot='+''''+ls_leftornot+'''';
       end;

    ADODataSetroominquery.Prepared:=true;
    ADODataSetroominquery.Open;

end;

//包间帐务查询
procedure TDMHotel.SroomCheckQuery(ls_sroomno:string;ls_Bchecktime:Tdatetime;ls_Echecktime:Tdatetime;ls_issign:string;sroomnoCK:boolean;ischeckCK:boolean;checktimeCK:boolean);
begin
    ds_sup_check_query.Close;
    ds_sup_check_query.Prepared:=false;

    if (sroomnoCK=true) and (ischeckCK=true) and (checktimeCK=true) then
       begin
           ds_sup_check_query.CommandText:='select * from sup_detail where sroomno='+
                            ''''+ls_sroomno+''''+' and ischeck='+''''+'yes'+''''+
                            ' and checktime>'+''''+datetostr(ls_Bchecktime)+''''+
                            ' and checktime<'+''''+datetostr(ls_Echecktime+1)+''''+
                            ' and issign='+''''+ls_issign+''''+
                            ' and iscancellation='+''''+'0'+'''';
       end;

⌨️ 快捷键说明

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