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

Upgrading to version 27

File:
1 edited

Legend:

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

    r456 r830  
    88  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    99  fPage, StdCtrls, Menus, ORCtrls, ORFn, ExtCtrls, ComCtrls, rOrders, uConst,
    10   rMeds, ORNet;
     10  rMeds, ORNet, fBase508Form, VA508AccessibilityManager;
    1111
    1212type
     
    8383    mnuViewPostings: TMenuItem;
    8484    mnuOptimizeFields: TMenuItem;
     85    SortbyStatusthenLocation1: TMenuItem;
     86    SortbyClinicOrderthenStatusthenStopDate1: TMenuItem;
     87    SortbyDrugalphabeticallystatusactivestatusrecentexpired1: TMenuItem;
     88    N3: TMenuItem;
     89    pnlView: TPanel;
     90    txtView: TVA508StaticText;
    8591    procedure mnuChartTabClick(Sender: TObject);
    8692    procedure FormCreate(Sender: TObject);
     
    136142    procedure hdrMedsInMouseUp(Sender: TObject; Button: TMouseButton;
    137143      Shift: TShiftState; X, Y: Integer);
    138     //procedure ActivateDeactiveRenew(AListBox: TListBox);
     144    procedure ActivateDeactiveRenew(AListBox: TListBox);
    139145    procedure ViewInfo(Sender: TObject);
    140146    procedure mnuViewInformationClick(Sender: TObject);
     
    146152    procedure hdrMedsInSectionClick(HeaderControl: THeaderControl;
    147153      Section: THeaderSection);
     154    procedure SortbyStatusthenLocation1Click(Sender: TObject);
     155    procedure SortbyClinicOrderthenStatusthenStopDate1Click(
     156      Sender: TObject);
     157    procedure SortbyDrugalphabeticallystatusactivestatusrecentexpired1Click(
     158      Sender: TObject);
    148159  private
    149160    FIterating: Boolean;
     
    159170    uNonVAOrdersOut:  TStringList;
    160171    ChildODList: TStringList;
     172    FSortView: integer;
    161173    function ListSelected(const ErrMsg: string): TListBox;
    162174    procedure ValidateSelected(AListBox: TListBox; const AnAction, WarningMsg, WarningTitle: string);
     
    170182    function GetMedList(Control: TWinControl): TList;
    171183    function GetPharmacyOrders(Control: TWinControl): TStringList;
    172     function PatientStatusChanged: boolean;
     184    //function PatientStatusChanged: boolean;
    173185    procedure ClearChildODList;
     186    procedure SetViewCaption(Caption : String);
     187    procedure lstMedsInRightClickHandler(var Msg: TMessage; var Handled: Boolean);
     188    procedure lstMedsNonVARightClickHandler(var Msg: TMessage; var Handled: Boolean);
     189    procedure lstMedsOutRightClickHandler(var Msg: TMessage; var Handled: Boolean);
    174190  public
    175191    procedure RefreshMedLists;
     
    184200    function GetTotalSectionsWidth(Sender: TObject) : integer;
    185201    function CheckMedStatus(ActiveList: TListBox): boolean;
     202    property SortView: integer read FSortView write FSortView;
    186203  end;
    187204
     
    223240uses uCore, rCore, fFrame, fRptBox, uOrders, fODBase, fOrdersDC, fOrdersHold,
    224241     fOrdersRenew, fOMNavA, fOrdersRefill, fMedCopy, fOrders, fODChild, rODBase,
    225      StrUtils, fActivateDeactivate;
     242     StrUtils, fActivateDeactivate, VA2006Utils, VA508AccessibilityRouter,
     243  VAUtils;
    226244
    227245{$R *.DFM}
     
    532550begin
    533551  inherited;
     552  FixHeaderControlDelphi2006Bug(hdrMedsIn);
     553  FixHeaderControlDelphi2006Bug(hdrMedsOut);
     554  FixHeaderControlDelphi2006Bug(hdrMedsNonVA);
    534555  PageID := CT_MEDS;
    535   lstMedsIn.Color := ReadOnlyColor;
    536   lstMedsOut.Color := ReadOnlyColor;
    537556  uMedListIn  := TList.Create;
    538557  uMedListOut := TList.Create;
     
    598617     end;
    599618  //end CQ9622
     619  AddMessageHandler(lstMedsIn, lstMedsInRightClickHandler);
     620  AddMessageHandler(lstMedsNonVA, lstMedsNonVARightClickHandler);
     621  AddMessageHandler(lstMedsOut, lstMedsOutRightClickHandler);
    600622end;
    601623
     
    603625begin
    604626  inherited;
     627  RemoveMessageHandler(lstMedsOut, lstMedsOutRightClickHandler);
     628  RemoveMessageHandler(lstMedsNonVA, lstMedsNonVARightClickHandler);
     629  RemoveMessageHandler(lstMedsIn, lstMedsInRightClickHandler);
    605630  ClearChildODList;
    606631  ClearMedList(uMedListIn);
     
    641666      if AnID <> '' then
    642667        begin
    643           tmpList.Assign(DetailMedLM(AnID));
     668          FastAssign(DetailMedLM(AnID), tmpList);
    644669        end;
    645670      AnOrder := Piece(Strings[i], U, 2);
     
    649674          tmpList.Add(StringOfChar('=', 74));
    650675          tmpList.Add('');
    651           tmpList.AddStrings(MedAdminHistory(AnOrder));
     676          FastAddStrings(MedAdminHistory(AnOrder), tmpList);
    652677        end;
    653678      if CheckOrderGroup(AnOrder)=1 then  // if it's UD group
     
    665690      end;
    666691      if tmpList.Count > 0 then ReportBox(tmpList, ATitle, True);
    667       if frmFrame.CCOWDrivedChange then   
     692      if (frmFrame.TimedOut) or (frmFrame.CCOWDrivedChange) then Exit; //code added to correct access violation on timeout
    668693        Exit;
    669694    end;
     
    704729procedure TfrmMeds.RefreshMedLists;
    705730var
    706   i: Integer;
     731  i,view: Integer;
    707732  AMed: TMedListRec;
    708733begin
     
    711736  lstMedsNonVA.Clear;
    712737  StatusText('Retrieving active medications...');
    713   LoadActiveMedLists(uMedListIn, uMedListOut, uMedListNonVA);
     738  view := self.FSortView;
     739  //AGP Fix for CQ 10410 added view arguement to control Meds Tab sort criteria
     740  LoadActiveMedLists(uMedListIn, uMedListOut, uMedListNonVA, view);
     741  if view <> self.FSortView then
     742    begin
     743      self.FSortView := view;
     744      if view = 1 then
     745        begin
     746          self.SortbyStatusthenLocation1.Checked := True;
     747          SetViewCaption(SortbyStatusthenLocation1.Caption);
     748          self.SortbyClinicOrderthenStatusthenStopDate1.Checked := False;
     749          self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.checked := false;
     750        end
     751      else if view = 2 then
     752        begin
     753          self.SortbyStatusthenLocation1.Checked := False;
     754          self.SortbyClinicOrderthenStatusthenStopDate1.Checked := True;
     755          SetViewCaption(SortbyClinicOrderthenStatusthenStopDate1.Caption);
     756          self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Checked := false;
     757        end
     758      else if view = 3 then
     759        begin
     760          self.SortbyStatusthenLocation1.Checked := False;
     761          self.SortbyClinicOrderthenStatusthenStopDate1.Checked := false;
     762          self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Checked := true;
     763          SetViewCaption(SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Caption);
     764        end
     765    end;
    714766  uPharmacyOrdersIn.Clear;
    715767  uPharmacyOrdersOut.Clear;
     
    735787    lstMedsOut.Items.AddObject(GetPlainText(lstMedsOut, i), AMed);
    736788  end;
    737  
     789
    738790        StatusText('');
    739791end;
     
    769821  // replace pharmacy text with order text if this is a change
    770822  if CharAt(AnAction, 1) = 'X' then result := Piece(AnAction, U, 3);
    771   if AMed.IVFluid then Indent := Pos(#10 + 'in ', result) else Indent := Pos(#13, result);
     823  if AMed.IVFluid then Indent := Pos(CRLF + 'in ', result) else Indent := Pos(#13, result);
    772824  if Indent > 0 then
    773825  begin
    774826    if AMed.IVFluid then
    775827    begin
    776       Detail := Copy(result, Indent + 1, Length(result));
     828      Detail := Copy(result, Indent + Length(CRLF), Length(result));
    777829      result := Copy(result, 1, Indent - 1);
    778830    end else
     
    928980              Canvas.Font.Color := clHighlightText;
    929981              //Canvas.FillRect(ARect);
    930               Canvas.Font.Color := clWhite;
     982              Canvas.Font.Color := Get508CompliantColor(clWhite);
    931983           end;
    932         if (ColorToRGB(clWindowText) = ColorToRGB(clBlack)) and (Canvas.Font.Color <> clWhite) then
    933           Canvas.Font.Color := clBlue;
     984        if (Canvas.Font.Color <> Get508CompliantColor(clWhite)) then
     985          Canvas.Font.Color := Get508CompliantColor(clBlue);
    934986        if (Length(Piece(AnAction,'^',4)) > 0) then
    935987          AMed.Location := Piece(AnAction,'^',4);
     
    9811033  inherited;
    9821034 
    983   if PatientStatusChanged then exit;
     1035  //if PatientStatusChanged then exit;
    9841036  with lstMedsOut do for i := 0 to Items.Count -1 do
    9851037    Selected[i] := false;
     
    9881040end;
    9891041
     1042procedure TfrmMeds.lstMedsInRightClickHandler(var Msg: TMessage;
     1043  var Handled: Boolean);
     1044begin
     1045  if Msg.Msg = WM_RBUTTONUP then
     1046  begin
     1047    lstMedsIn.RightClickSelect := (lstMedsIn.SelCount < 1);
     1048    lstMedsInClick(lstMedsIn);
     1049  end;
     1050end;
     1051
    9901052procedure TfrmMeds.lstMedsOutClick(Sender: TObject);
    9911053var
     
    9941056  inherited;
    9951057 
    996   if PatientStatusChanged then exit;
     1058  //if PatientStatusChanged then exit;
    9971059  with lstMedsIn do for i := 0 to Items.Count -1 do
    9981060    Selected[i] := false;
     
    10011063end;
    10021064
     1065procedure TfrmMeds.lstMedsOutRightClickHandler(var Msg: TMessage;
     1066  var Handled: Boolean);
     1067begin
     1068  if Msg.Msg = WM_RBUTTONUP then
     1069  begin
     1070    lstMedsOut.RightClickSelect := (lstMedsOut.SelCount < 1);
     1071    lstMedsOutClick(lstMedsOut);
     1072  end;
     1073end;
     1074
    10031075procedure TfrmMeds.hdrMedsOutSectionResize(HeaderControl: THeaderControl; Section: THeaderSection);
    10041076begin
     
    10351107begin
    10361108  inherited;
    1037   if PatientStatusChanged then exit;
     1109  //if PatientStatusChanged then exit;
    10381110  if lstMedsOut.SelCount > 0 then
    10391111  begin
     
    10711143    begin
    10721144      ValidateSelected(ActiveList, OA_DC, TX_NO_DC, TC_NO_DC);
    1073       //ActivateDeactiveRenew(ActiveList); AGP 26.53 TURN OFF UNTIL FINAL DECISION CAN BE MADE
     1145      ActivateDeactiveRenew(ActiveList); //AGP 26.53 TURN OFF UNTIL FINAL DECISION CAN BE MADE
    10741146      MakeSelectedList(ActiveList, SelectedList);
    10751147      if ExecuteDCOrders(SelectedList,DelEvt) then
    10761148      begin
     1149        if frmFrame.TimedOut = true then  exit;
    10771150        ResetSelectedForList(ActiveList);
    10781151        SynchListToOrders(ActiveList, SelectedList);
     
    11081181      if ExecuteHoldOrders(SelectedList) then
    11091182      begin
     1183        if frmFrame.TimedOut = true then  exit;
    11101184        AddSelectedToChanges(SelectedList);
    11111185        ResetSelectedForList(ActiveList);
     
    11141188    end;
    11151189  finally
    1116     ActiveList.SetFocus;
     1190    if frmFrame.TimedOut = false then ActiveList.SetFocus;
    11171191    FIterating := False;
    11181192    SelectedList.Free;
     
    11521226      if ExecuteRenewOrders(SelectedList) then
    11531227      begin
     1228        if frmFrame.TimedOut = true then  exit;
    11541229        AddSelectedToChanges(SelectedList);
    11551230        ResetSelectedForList(ActiveList);
     
    11581233   end;
    11591234  finally
    1160     ActiveList.SetFocus;
     1235    if frmFrame.TimedOut = false then ActiveList.SetFocus;
    11611236    FIterating := False;
    11621237    SelectedList.Free;
     
    11931268    if not ShowMsgOn(ChangeIFNList.Count = 0, TX_NOSEL, TC_NOSEL)
    11941269      then ChangeOrders(ChangeIFNList, DelayEvent);
     1270    if frmFrame.TimedOut = true then  exit;
    11951271    SynchListToOrders(ActiveList, SelectedList);    // rehighlights
    11961272    Activelist.SetFocus;
     
    12251301  if (Length(AuthErr)>0) then
    12261302  begin
    1227     ShowMessage(AuthErr);
     1303    ShowMsg(AuthErr);
    12281304    if not EncounterPresent then Exit;
    12291305  end;
     
    12411317  DoesDestEvtOccur := False;
    12421318  ActiveList := ListSelected(TX_NOSEL);
     1319  if not assigned(ActiveList) then exit; 
    12431320  if CheckMedStatus(ActiveList) = True then Exit;
    12441321  if ActiveList = nil then Exit;
     
    13431420      end;
    13441421    end;
     1422    if frmFrame.TimedOut = true then  exit;
    13451423    SynchListToOrders(ActiveList, SelectedList);    // rehighlights
    13461424    if IsTransferAction then
     
    13521430    frmOrders.PtEvtCompleted(TempEvent.PtEventIFN,TempEvent.EventName,True);
    13531431  finally
    1354     ActiveList.SetFocus;
     1432    if frmFrame.TimedOut = false then  ActiveList.SetFocus;
    13551433    FActionOnMedsTab := False;
    13561434    uAutoAC := False;
     
    14111489      if ExecuteRefillOrders(SelectedList) then
    14121490      begin
     1491        if frmFrame.TimedOut = true then  exit;
    14131492        ResetSelectedForList(ActiveList);
    14141493        SynchListToOrders(ActiveList, SelectedList);
     
    14161495    end;
    14171496  finally
    1418     ActiveList.SetFocus;
     1497    if frmFrame.TimedOut = false then ActiveList.SetFocus;
    14191498    FIterating := False;
    14201499    SelectedList.Free;
     
    15391618begin
    15401619  inherited;
    1541   if PatientStatusChanged then exit;
     1620  //if PatientStatusChanged then exit;
    15421621end;
    15431622
     
    15451624begin
    15461625  inherited;
    1547   if PatientStatusChanged then exit; 
     1626  //if PatientStatusChanged then exit;
    15481627end;
    15491628
     
    15531632begin
    15541633  inherited;
    1555   if PatientStatusChanged then exit; 
     1634  //if PatientStatusChanged then exit;
    15561635  with lstMedsIn do for i := 0 to Items.Count -1 do
    15571636     Selected[i] := false;
     
    15701649  inherited;
    15711650   if not FIterating then ResetSelectedForList(TListBox(Sender));
     1651end;
     1652
     1653procedure TfrmMeds.lstMedsNonVARightClickHandler(var Msg: TMessage;
     1654  var Handled: Boolean);
     1655begin
     1656  if Msg.Msg = WM_RBUTTONUP then
     1657  begin
     1658    lstMedsNonVA.RightClickSelect := (lstMedsNonVA.SelCount < 1);
     1659    lstMedsNonVAClick(lstMedsNonVA);
     1660  end;
    15721661end;
    15731662
     
    17251814end;
    17261815
    1727 function TfrmMeds.PatientStatusChanged: boolean;
     1816{function TfrmMeds.PatientStatusChanged: boolean;
    17281817const
    17291818
     
    17521841    Result := True;
    17531842  end;
    1754 end;
     1843end;}
    17551844
    17561845function TfrmMeds.GetTotalSectionsWidth(Sender: TObject) : integer;
     
    17921881     for i := 0 to hdrMedsNonVA.Sections.Count - 1 do
    17931882        OrigNonVASecWidths[i] := hdrMedsNonVA.Sections[i].Width;
     1883end;
     1884
     1885procedure TfrmMeds.SetViewCaption(Caption: String);
     1886begin
     1887  txtView.Caption := StringReplace(Caption,'&','',[rfReplaceAll]);
    17941888end;
    17951889
     
    19462040end;
    19472041
    1948 (*procedure TfrmMeds.ActivateDeactiveRenew(AListBox: TListBox);
     2042procedure TfrmMeds.ActivateDeactiveRenew(AListBox: TListBox);
    19492043var
    19502044  i: Integer;
     
    19632057      end;
    19642058    if tmpArr <> nil then frmActivateDeactive.fActivateDeactive(tmpArr, AListBox);
    1965 end; *)
     2059end;
    19662060
    19672061procedure TfrmMeds.ViewInfo(Sender: TObject);
     
    20522146end;
    20532147
     2148procedure TfrmMeds.SortbyStatusthenLocation1Click(Sender: TObject);
     2149begin
     2150  inherited;
     2151  self.FSortView := 1;
     2152  self.SortbyStatusthenLocation1.Checked := True;
     2153  SetViewCaption(SortbyStatusthenLocation1.Caption);
     2154  self.SortbyClinicOrderthenStatusthenStopDate1.Checked := False;
     2155  self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Checked := false;
     2156  self.RefreshMedLists;
     2157end;
     2158
     2159procedure TfrmMeds.SortbyClinicOrderthenStatusthenStopDate1Click(
     2160  Sender: TObject);
     2161begin
     2162  inherited;
     2163  self.FSortView := 2;
     2164  self.SortbyStatusthenLocation1.Checked := False;
     2165  self.SortbyClinicOrderthenStatusthenStopDate1.Checked := True;
     2166  SetViewCaption(SortbyClinicOrderthenStatusthenStopDate1.Caption);
     2167  self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Checked := false;
     2168  self.RefreshMedLists;
     2169end;
     2170
     2171procedure TfrmMeds.SortbyDrugalphabeticallystatusactivestatusrecentexpired1Click(
     2172  Sender: TObject);
     2173begin
     2174  inherited;
     2175  self.FSortView := 3;
     2176  self.SortbyStatusthenLocation1.Checked := False;
     2177  self.SortbyClinicOrderthenStatusthenStopDate1.Checked := false;
     2178  self.SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Checked := true;
     2179  SetViewCaption(SortbyDrugalphabeticallystatusactivestatusrecentexpired1.Caption);
     2180  self.RefreshMedLists;
     2181end;
     2182
     2183initialization
     2184  SpecifyFormIsNotADialog(TfrmMeds);
     2185
    20542186end.
    20552187
Note: See TracChangeset for help on using the changeset viewer.