Index: cprs/trunk/CPRS-Chart/rCore.pas
===================================================================
--- cprs/trunk/CPRS-Chart/rCore.pas	(revision 456)
+++ cprs/trunk/CPRS-Chart/rCore.pas	(revision 830)
@@ -104,5 +104,4 @@
 { General calls }
 
-function GetProgramFilesPath: String;
 function ExternalName(IEN: Int64; FileNumber: Double): string;
 function PersonHasKey(APerson: Int64; const AKey: string): Boolean;
@@ -118,4 +117,5 @@
 function GetUserInfo: TUserInfo;
 function GetUserParam(const AParamName: string): string;
+procedure GetUserListParam(Dest: TStrings; const AParamName: string);
 function HasSecurityKey(const KeyName: string): Boolean;
 function HasMenuOptionAccess(const OptionName: string): Boolean;
@@ -152,4 +152,6 @@
 procedure ListProviderTop(Dest: TStrings);
 function SubSetOfProviders(const StartFrom: string; Direction: Integer): TStrings;
+function SubSetOfCosigners(const StartFrom: string; Direction: Integer; Date: TFMDateTime;
+  ADocType: integer; ATitle: integer): TStrings;
 procedure ListClinicTop(Dest: TStrings);
 function SubSetOfClinics(const StartFrom: string; Direction: Integer): TStrings;
@@ -210,7 +212,5 @@
 function HasRemoteData(const DFN: string; var ALocations: TStringList): Boolean;
 function CheckHL7TCPLink: Boolean;
-function UseVistaWeb: Boolean;
 function GetVistaWebAddress(value: string): string;
-procedure ChangeVistaWebParam(value: string);
 
 implementation
@@ -219,5 +219,4 @@
 
 var
-  uFMToday: TFMDateTime;                         // Today's date in Fileman format.
   uPtListDfltSort: string = '';                  // Current user's patient selection list default sort order.
 
@@ -225,6 +224,5 @@
 
 function FormatSSN(const x: string): string;
- {places the dashes in a social security number }
-
+{ places the dashes in a social security number }
 //vwpt code 4/17/0  see below
 var
@@ -267,6 +265,5 @@
 { return the current date in Fileman format }
 begin
-  if uFMToday = 0 then uFMToday := Int(FMNow);
-  Result := uFMToday;
+  Result := Int(FMNow);
 end;
 
@@ -318,5 +315,5 @@
 begin
   CallV('ORWPT CLINRNG', [nil]);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -328,15 +325,4 @@
 
 { General calls }
-
-function GetProgramFilesPath: String;
-Const
-  CSIDL_PROGRAM_FILES = $0026;
-var
-  Path: array[0..Max_Path] of Char;
-begin
-  Path := '';
-  SHGetSpecialFolderPath(0,Path,CSIDL_PROGRAM_FILES,false);
-  Result := Path;
-end;
 
 function ExternalName(IEN: Int64; FileNumber: Double): string;
@@ -441,4 +427,17 @@
 end;
 
+procedure GetUserListParam(Dest: TStrings; const AParamName: string);
+var
+  tmplst: TStringList;
+begin
+  tmplst := TStringList.Create;
+  try
+    tCallV(tmplst, 'ORWU PARAMS', [AParamName]);
+    FastAssign(tmplst, Dest);
+  finally
+    tmplst.Free;
+  end;
+end;
+
 function HasSecurityKey(const KeyName: string): Boolean;
 { returns true if the currently logged in user has a given security key }
@@ -472,5 +471,5 @@
     //UpdateUnsignedOrderAlerts(Patient.DFN);      //moved to AFTER signature and DC actions
     tCallV(tmplst, 'ORWORB FASTUSER', [nil]);
-    Dest.Assign(tmplst);
+    FastAssign(tmplst, Dest);
   finally
     tmplst.Free;
@@ -593,5 +592,5 @@
   CallV('ORQPT SPECIALTIES', [nil]);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -601,5 +600,5 @@
   CallV('ORQPT TEAMS', [nil]);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -609,5 +608,5 @@
   CallV('ORQPT WARDS', [nil]);
   //MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -623,4 +622,18 @@
   CallV('ORWU NEWPERS', [StartFrom, Direction, 'PROVIDER']);
 //  MixedCaseList(RPCBrokerV.Results);
+  Result := RPCBrokerV.Results;
+end;
+
+function SubSetOfCosigners(const StartFrom: string; Direction: Integer; Date: TFMDateTime;
+  ADocType: integer; ATitle: integer): TStrings;
+{ returns a pointer to a list of cosigners (for use in a long list box) -  The return value is
+  a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
+begin
+  if ATitle > 0 then ADocType := 0;
+  // CQ #17218 - Correcting order of parameters for this call
+  //  CallV('ORWU2 COSIGNER', [StartFrom, Direction, Date, ATitle, ADocType]);
+  CallV('ORWU2 COSIGNER', [StartFrom, Direction, Date, ADocType, ATitle]);
+
+  //  MixedCaseList(RPCBrokerV.Results);
   Result := RPCBrokerV.Results;
 end;
@@ -726,5 +739,5 @@
     end;
     MixedCaseList(tmplst);
-    Dest.Assign(tmplst);
+    FastAssign(tmplst, Dest);
   finally
     tmplst.Free;
@@ -738,5 +751,5 @@
   SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -747,5 +760,5 @@
   SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -756,5 +769,5 @@
   SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -784,5 +797,5 @@
     end;
     MixedCaseList(Results);
-    Dest.Assign(Results);
+    FastAssign(Results, Dest);
   end;
 end;
@@ -800,5 +813,5 @@
     SortByPiece(TStringList(RPCBrokerV.Results), U, 2);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -832,4 +845,5 @@
 
 //END VWPT ADDITIONS
+
 procedure ListPtByLast5(Dest: TStrings; const Last5: string);
 var
@@ -851,5 +865,5 @@
   end;
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -873,5 +887,5 @@
   end;
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -902,5 +916,5 @@
   end;
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -931,5 +945,5 @@
   end;
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -939,5 +953,5 @@
   CallV('ORWPT TOP', [nil]);
   MixedCaseList(RPCBrokerV.Results);
-  Dest.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, Dest);
 end;
 
@@ -1045,7 +1059,6 @@
 
 function GetPtIDInfo(const DFN: string): TPtIDInfo;  //*DFN*
-{ returns the identifiers displayed upon patient selection
 //VWPT ADD HRN   ,ALT HRN (FUTURE)
-  Pieces: SSN[1]^DOB[2]^SEX[3]^VET[4]^SC%[5]^WARD[6]^RM-BED[7]^NAME[8]^HRN[9]^ALTHRN[10] }
+//  Pieces: SSN[1]^DOB[2]^SEX[3]^VET[4]^SC%[5]^WARD[6]^RM-BED[7]^NAME[8]^HRN[9]^ALTHRN[10] }
  // Pieces: SSN[1]^DOB[2]^SEX[3]^VET[4]^SC%[5]^WARD[6]^RM-BED[7]^NAME[8] }
 var
@@ -1125,5 +1138,5 @@
   //VWPT add HRN and ALTERNATE HRN used with PID hl7 segments
   ADMITTIME[10]^CONVERTED[11]^SVCONN[12]^SC%[13]^ICN[14]^Age[15]^TreatSpec[16]^HRN[17]^AltHRN[18] }
-//  BEFORE THIS VWPT WAS         ADMITTIME[10]^CONVERTED[11]^SVCONN[12]^SC%[13]^ICN[14]^Age[15]^TreatSpec[16] }
+ //  BEFORE THIS VWPT WAS         ADMITTIME[10]^CONVERTED[11]^SVCONN[12]^SC%[13]^ICN[14]^Age[15]^TreatSpec[16] }
 var
   x: string;
@@ -1148,5 +1161,4 @@
     ServiceConnected := Piece(x, U, 12) = '1';
     SCPercent := StrToIntDef(Piece(x, U, 13), 0);
-
     //VWPT ADD HRN   AltHRN (future)
     HRN := Piece(x, U, 17);
@@ -1229,5 +1241,5 @@
     MixedCaseList(Results);
     SetListFMDateTime('mmm dd,yyyy hh:nn', TStringList(Results), U, 2);
-    Dest.Assign(Results);
+    FastAssign(Results, Dest);
   end;
   (*
@@ -1245,5 +1257,5 @@
       Results[i] := x;
     end;
-    Dest.Assign(Results);
+    FastAssign(Results, Dest);
   end;
   *)
@@ -1267,5 +1279,5 @@
       Results[i] := x;
     end;
-    Dest.Assign(Results);
+    FastAssign(Results, Dest);
   end;
 end;
@@ -1301,5 +1313,5 @@
 begin
   CallV('ORWCIRN FACLIST', [DFN]);
-  ALocations.Assign(RPCBrokerV.Results);
+  FastAssign(RPCBrokerV.Results, ALocations);
   Result := not (Piece(RPCBrokerV.Results[0], U, 1) = '-1');
 
@@ -1320,10 +1332,4 @@
  end;
 
-function UseVistaWeb: Boolean;
- begin;
-   CallV('ORWCIRN VISTAWEB',[nil]);
-   result := RPCBrokerV.Results[0] = '1';
- end;
-
 function GetVistaWebAddress(value: string): string;
 begin
@@ -1332,9 +1338,4 @@
 end;
 
-procedure ChangeVistaWebParam(value: string);
-  begin
-    CallV('ORWCIRN WEBCH',[value]);
-  end;
-
 function GetDefaultPrinter(DUZ: Int64; Location: integer): string;
 begin
@@ -1342,6 +1343,3 @@
 end;
 
-initialization
-  uFMToday := 0;
-
 end.
