Ignore:
Timestamp:
Jul 7, 2010, 4:31:10 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrade to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Orders/fODDietLT.pas

    r456 r829  
    55uses
    66  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    7   fAutoSz, ExtCtrls, StdCtrls, ORFn;
     7  fAutoSz, ExtCtrls, StdCtrls, ORFn, fODBase, rODBase, VA508AccessibilityManager;
    88
    99type
     
    3636
    3737procedure CheckLateTray(const StartTime: string; var LateTrayFields: TLateTrayFields; IsOutpatient: boolean; AMeal: char = #0);
     38procedure LateTrayCheck(SomeResponses: TResponses; EventId: integer; IsOutpatient: boolean; var LateTrayFields: TLateTrayFields);
     39procedure LateTrayOrder(LateTrayFields: TLateTrayFields; IsInpatient: boolean);
    3840
    3941implementation
     
    192194end;
    193195
     196procedure LateTrayCheck(SomeResponses: TResponses; EventId: integer; IsOutpatient: boolean; var LateTrayFields: TLateTrayFields);
     197var
     198  AResponse, AnotherResponse: TResponse;
     199begin
     200  if IsOutpatient then
     201  begin
     202    AResponse := SomeResponses.FindResponseByName('ORDERABLE', 1);
     203    if (EventID = 0) and (AResponse <> nil) and (Copy(AResponse.EValue, 1, 3) <> 'NPO') then
     204    begin
     205      AResponse := SomeResponses.FindResponseByName('START', 1);
     206      AnotherResponse := SomeResponses.FindResponseByName('MEAL', 1);
     207      if (AResponse <> nil) and (AnotherResponse <> nil) then
     208        CheckLateTray(AResponse.IValue, LateTrayFields, True, CharAt(AnotherResponse.IValue, 1));
     209    end;
     210  end
     211  else
     212  begin
     213    AResponse := SomeResponses.FindResponseByName('ORDERABLE', 1);
     214    if (EventID = 0) and (AResponse <> nil) and (Copy(AResponse.EValue, 1, 3) <> 'NPO') then
     215    begin
     216      AResponse := SomeResponses.FindResponseByName('START', 1);
     217      if AResponse <> nil then CheckLateTray(AResponse.IValue, LateTrayFields, False);
     218    end;
     219  end;
     220end;
     221
     222procedure LateTrayOrder(LateTrayFields: TLateTrayFields; IsInpatient: boolean);
     223const
     224  TX_EL_SAVE_ERR    = 'An error occurred while saving this late tray order.';
     225  TC_EL_SAVE_ERR    = 'Error Saving Late Tray Order';
     226var
     227  NewOrder: TOrder;
     228  CanSign: integer;
     229begin
     230  NewOrder := TOrder.Create;
     231  try
     232    with LateTrayFields do OrderLateTray(NewOrder, LateMeal, LateTime, IsBagged);
     233    if NewOrder.ID <> '' then
     234    begin
     235      if IsInpatient then
     236        begin
     237          if (Encounter.Provider = User.DUZ) and User.CanSignOrders
     238            then CanSign := CH_SIGN_YES
     239            else CanSign := CH_SIGN_NA;
     240        end
     241      else
     242        begin
     243          CanSign := CH_SIGN_NA;
     244        end;
     245      Changes.Add(CH_ORD, NewOrder.ID, NewOrder.Text, '', CanSign);
     246      SendMessage(Application.MainForm.Handle, UM_NEWORDER, ORDER_NEW, Integer(NewOrder))
     247    end
     248    else InfoBox(TX_EL_SAVE_ERR, TC_EL_SAVE_ERR, MB_OK);
     249  finally
     250    NewOrder.Free;
     251  end;
     252end;
     253
    194254// ---------- frmODDietLT procedures ---------------
    195255procedure TfrmODDietLT.FormCreate(Sender: TObject);
Note: See TracChangeset for help on using the changeset viewer.