Ignore:
Timestamp:
Jul 6, 2008, 8:20:14 PM (16 years ago)
Author:
Kevin Toppenberg
Message:

Uploading from OR_30_258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/foia-cprs/CPRS-Chart/Orders/rODBase.pas

    r459 r460  
    6868  end;
    6969
     70  TPFSSActive = record
     71    PFSSActive: boolean;
     72    PFSSChecked: boolean;
     73  end;
     74
    7075{ General Calls }
    7176function AskAnotherOrder(ADialog: Integer): Boolean;
     
    7580procedure LoadDialogDefinition(Dest: TList; const DialogName: string);
    7681procedure LoadOrderPrompting(Dest: TList; ADialog: Integer);
    77 procedure LoadResponses(Dest: TList; const OrderID: string);
     82//procedure LoadResponses(Dest: TList; const OrderID: string);
     83procedure LoadResponses(Dest: TList; const OrderID: string; var HasObjects: boolean);
    7884procedure PutNewOrder(var AnOrder: TOrder; ConstructOrder: TConstructOrder; OrderSource: string);
    7985//procedure PutNewOrderAuto(var AnOrder: TOrder; ADialog: Integer); // no longer used
     
    8894procedure SetDefaultCoPayToNewOrder(AnOrderID, CoPayInfo:string);
    8995procedure ValidateNumericStr(const x, Dom: string; var ErrMsg: string);
    90 
     96function IsPFSSActive: boolean;
    9197
    9298{ Quick Order Calls }
     
    126132implementation
    127133
    128 uses TRPCB,uOrders;
     134uses TRPCB, uOrders, uODBase;
    129135
    130136var
     
    133139  uLastQuantityMsg: string;
    134140  uMedRoutes: TStringList;
     141  uPFSSActive: TPFSSActive;
    135142
    136143{ Common Internal Calls }
     
    175182        begin
    176183          IVDurVal := Copy(IVDuration,1,length(IVDuration)-1);
    177           TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + ' hours';
     184          TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + 'hours';
    178185        end
    179186        else if (Pos('D',upperCase(IVDuration))>0) then
    180187        begin
    181188          IVDurVal := Copy(IVDuration,1,length(IVDuration)-1);
    182           TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + ' days';
     189          TResponse(ResponseList.Items[j]).IValue := 'for ' + IVDurVal + 'days';
    183190        end
    184191        else if ((Pos('ML',upperCase(IVDuration))>0) or (Pos('CC',upperCase(IVDuration))>0)) then
    185192        begin
    186193          IVDurVal := Copy(IVDuration,1,length(IVDuration)-2);
    187           TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + ' ml';
     194          TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + 'ml';
    188195        end
    189196        else if (Pos('L',upperCase(IVDuration))>0) then
    190197        begin
    191198          IVDurVal := Copy(IVDuration,0,length(IVDuration)-1);
    192           TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + ' L';
     199          TResponse(ResponseList.Items[j]).IValue := 'with total volume ' + IVDurVal + 'L';
    193200        end;
    194201      end;
     
    371378end;
    372379
    373 procedure ExtractToResponses(Dest: TList);
     380procedure ExtractToResponses(Dest: TList; var HasObjects: boolean);
    374381{ load a list with TResponse records, assumes source strings are in RPCBrokerV.Results }
    375382var
    376383  i: Integer;
    377384  AResponse: TResponse;
     385  WPContainsObjects, TxContainsObjects: boolean;
     386  TempBroker: TStrings;
    378387begin
    379388  i := 0;
    380   with RPCBrokerV do while i < Results.Count do
    381   begin
    382     if CharAt(Results[i], 1) = '~' then
     389  HasObjects := FALSE;
     390  TempBroker := TStringlist.Create;
     391  TempBroker.Assign(RPCBrokerV.Results);
     392  try
     393  with TempBroker do while i < Count do
     394  begin
     395    if CharAt(Strings[i], 1) = '~' then
    383396    begin
    384397      AResponse := TResponse.Create;
    385398      with AResponse do
    386399      begin
    387         PromptIEN := StrToIntDef(Piece(Copy(Results[i], 2, 255), U, 1), 0);
    388         Instance := StrToIntDef(Piece(Results[i], U, 2), 0);
    389         PromptID := Piece(Results[i], U, 3);
     400        PromptIEN := StrToIntDef(Piece(Copy(Strings[i], 2, 255), U, 1), 0);
     401        Instance := StrToIntDef(Piece(Strings[i], U, 2), 0);
     402        PromptID := Piece(Strings[i], U, 3);
    390403        Inc(i);
    391         while (i < Results.Count) and (CharAt(Results[i], 1) <> '~') do
     404        while (i < Count) and (CharAt(Strings[i], 1) <> '~') do
    392405        begin
    393           if CharAt(Results[i], 1) = 'i' then IValue := Copy(Results[i], 2, 255);
    394           if CharAt(Results[i], 1) = 'e' then EValue := Copy(Results[i], 2, 255);
    395           if CharAt(Results[i], 1) = 't' then
     406          if CharAt(Strings[i], 1) = 'i' then IValue := Copy(Strings[i], 2, 255);
     407          if CharAt(Strings[i], 1) = 'e' then EValue := Copy(Strings[i], 2, 255);
     408          if CharAt(Strings[i], 1) = 't' then
    396409          begin
    397410            if Length(EValue) > 0 then EValue := EValue + CRLF;
    398             EValue := EValue + Copy(Results[i], 2, 255);
     411            EValue := EValue + Copy(Strings[i], 2, 255);
    399412            IValue := TX_WPTYPE;  // signals that this is a word processing field
    400413          end;
    401414          Inc(i);
    402415        end; {while i}
     416        if IValue <> TX_WPTYPE then ExpandOrderObjects(IValue, TxContainsObjects);
     417        ExpandOrderObjects(EValue, WPContainsObjects);
     418        HasObjects := HasObjects or WPContainsObjects or TxContainsObjects;
    403419        Dest.Add(AResponse);
    404420      end; {with AResponse}
    405421    end; {if CharAt}
    406422  end; {With RPCBrokerV}
    407 end;
    408 
    409 procedure LoadResponses(Dest: TList; const OrderID: string);
     423  finally
     424    TempBroker.Free;
     425  end;
     426end;
     427
     428procedure LoadResponses(Dest: TList; const OrderID: string; var HasObjects: boolean);
    410429begin
    411430  CallV('ORWDX LOADRSP', [OrderID]);
    412   ExtractToResponses(Dest);
     431  ExtractToResponses(Dest, HasObjects);
    413432end;
    414433
     
    427446    Param[1].Value := IntToStr(Encounter.Provider);
    428447    Param[2].PType := literal;
     448    (*if loc > 0 then Param[2].Value := IntToStr(Loc)
     449    else Param[2].Value := IntToStr(Encounter.Location);*)
    429450    Param[2].Value := IntToStr(Encounter.Location);
    430451    Param[3].PType := literal;
     
    659680end;
    660681
     682function IsPFSSActive: boolean;
     683begin
     684  with uPFSSActive do
     685    if not PFSSChecked then
     686      begin
     687        PFSSActive := (sCallV('ORWPFSS IS PFSS ACTIVE?', [nil]) = '1');
     688        PFSSChecked := True;
     689      end;
     690  Result := uPFSSActive.PFSSActive
     691end;
    661692
    662693{ Medication Calls }
Note: See TracChangeset for help on using the changeset viewer.