ТМС:Кассир:Поддержка постоянно открытого окна отложенных чеков

Материал из wiki.standart-n.ru
Версия от 13:59, 12 января 2018; Olgav (обсуждение | вклад)

(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

uses System, Classes, DB, IBDatabase, IBQuery, IBCustomDataSet,

    Controls, ExtCtrls, ZKassa, Graphics, dateutils, FR, ScriptRes,
    Graphics, Forms, Dialogs, StdCtrls ,
    ComCtrls, ExtCtrls, StrUtils, Windows, Classes, SysUtils;

const

 cl1 = $008866FF;
 cl2 = $00CCDDFF;

var

 iq: TIBQuery;
 pn: tpanel;
 id: Integer;

procedure Click; begin

 SendKey(116,false,false,false);

end;

begin

 if fmMain.tmScript.Tag mod 10 = 0 then
 begin
   if (UserID=6) then
   begin
     if fmMain.aopXFunc.Tag = 0 then fmMain.acF5.Execute;
     id := -1;
     if fmMain.frDefCheques1.fdCheques.Active then id := fmMain.frDefCheques1.fdCheques.FieldByName('id').AsInteger;
     fmMain.frDefCheques1.fdCheques.Active := False;
     fmMain.frDefCheques1.fdCheques.Active := True;
     if id <> -1 then fmMain.frDefCheques1.fdCheques.Locate('id', id, SetOf([]));
   end
   else
   begin
     pn := fmMain.pnClient.FindChildControl('script_panel_defer');
     if pn = nil then
       begin             
         pn := tpanel.create(nil);   
         pn.Name := 'script_panel_defer';
         pn.Parent := fmMain.pnClient;
         pn.Align := alTop;   
         pn.Height := 0;
         pn.Font.Style:=[fsBold];
         pn.Caption := 'Внимание! Есть отложенный чек, для перехода нажмите здесь или F5!!!';
         pn.Color := cl1;  
       end;
                         
     iq := TIBQuery.create(nil);
     iq.Transaction := CurrDB.DefaultTransaction;
     iq.SQL.Text := 'select count(*) from docs where doc_type=3 and status = 2';
     iq.Active := True;
     pn.Visible := iq.Fields.Fields[0].AsInteger > 0;
     if pn.Visible then
      begin
       pn.Height := 30;           
       pn.OnClick := 'Click'; 
      end; 
     iq.Free;                  
   end;
 end
 if ((fmMain.tmScript.Tag mod 2 = 0) and (userid<>6)) then
   begin
     pn := fmMain.pnClient.FindChildControl('script_panel_defer');
     if pn <> nil and pn.Visible then   
       if pn.Color = cl1 then
        begin
         pn.Color := cl2;
         pn.Font.Style:=[]; 
        end
       else
        begin
         pn.Color := cl1;
         pn.Font.Style:=[fsBold];
        end;
   end;


end;