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/fOrders.pas

    r459 r460  
    8989    sptVert: TSplitter;
    9090    mnuViewExpired: TMenuItem;
     91    mnuViewInformation: TMenuItem;
     92    mnuViewDemo: TMenuItem;
     93    mnuViewVisits: TMenuItem;
     94    mnuViewPrimaryCare: TMenuItem;
     95    mnuViewMyHealtheVet: TMenuItem;
     96    mnuInsurance: TMenuItem;
     97    mnuViewFlags: TMenuItem;
     98    mnuViewReminders: TMenuItem;
     99    mnuViewRemoteData: TMenuItem;
     100    mnuViewPostings: TMenuItem;
     101    mnuOptimizeFields: TMenuItem;
    91102    procedure mnuChartTabClick(Sender: TObject);
    92103    procedure FormCreate(Sender: TObject);
     
    146157    procedure hdrOrdersMouseDown(Sender: TObject; Button: TMouseButton;
    147158      Shift: TShiftState; X, Y: Integer);
     159    procedure ViewInfo(Sender: TObject);
     160    procedure mnuViewInformationClick(Sender: TObject);
     161    procedure mnuOptimizeFieldsClick(Sender: TObject);
     162    procedure hdrOrdersSectionClick(HeaderControl: THeaderControl;
     163      Section: THeaderSection);
     164    procedure sptHorzMoved(Sender: TObject);
    148165  private
    149166    { Private declarations }
     
    188205    procedure UseDefaultSort;
    189206    procedure SynchListToOrders;
     207//    procedure ActivateDeactiveRenew;
    190208    procedure ValidateSelected(const AnAction, WarningMsg, WarningTitle: string);
    191209    procedure ViewAlertedOrders(OrderIEN: string; Status: integer; DispGrp: string;
     
    196214    function MeasureColumnHeight(AnOrder: TOrder; Index: Integer; Column: integer):integer;
    197215    function GetPlainText(AnOrder: TOrder; index: integer):string;
     216    function PatientStatusChanged: boolean;   
    198217    procedure UMEventOccur(var Message: TMessage); message UM_EVENTOCCUR;
     218    function CheckOrderStatus: boolean;
    199219  public
    200220    procedure setSectionWidths; //CQ6170
     
    229249    property EvtColWidth: integer       read FEvtColWidth        write FEvtColWidth;
    230250    property DontCheck: boolean         read FDontCheck          write FDontCheck;
    231     property ParentComplexOrderID: string       read FParentComplexOrderID        write FParentComplexOrderID; 
     251    property ParentComplexOrderID: string       read FParentComplexOrderID        write FParentComplexOrderID;
    232252  end;
    233253
     
    247267     fOMNavA, rCore, fOCSession, fOrdersPrint, fOrdersTS, fEffectDate, fODActive, fODChild,
    248268     fOrdersCopy, fOMVerify, fODAuto, rODBase, uODBase, rMeds,fODValidateAction, fMeds, uInit, fBALocalDiagnoses,
    249   fODConsult;
     269     fODConsult, fClinicWardMeds, fActivateDeactivate;
    250270
    251271{$R *.DFM}
     
    970990          if ((TOrder(Items.Objects[i]).DGroupName = 'Inpt. Meds') or
    971991              (TOrder(Items.Objects[i]).DGroupName = 'Out. Meds') or
    972               (TOrder(Items.Objects[i]).DGroupName = 'IV Fluids')) then
     992              (TOrder(Items.Objects[i]).DGroupName = 'Clin. Orders') or
     993              (TOrder(Items.Objects[i]).DGroupName = 'Infusion')) then
    973994            begin
    974995              tmpList.Add('');
     
    9931014          ReportBox(tmpList, 'Order Details - ' + BigOrderID, True);
    9941015        end;
     1016      StatusText('');
     1017      if (frmFrame.TimedOut) or (frmFrame.CCOWDrivedChange) then Exit; //code added to correct access violation on timeout
    9951018      Selected[i] := False;
    996       StatusText('');
    997     end;
     1019      end;
    9981020  finally
    9991021    tmpList.Free;
     
    13241346      7: result := ChartRev;
    13251347      8: result := NameOfStatus(Status);
    1326       9:
    1327       begin
    1328         result := MixedCase(Anorder.OrderLocName);
    1329         if (Index > 0) and (result = TOrder(lstOrders.Items.Objects[Index - 1]).OrderLocName) then result := '';
    1330       end;
     1348      9: result := MixedCase(Anorder.OrderLocName);
     1349      //begin AGP change 26.52 display all location for orders.
     1350        //result := MixedCase(Anorder.OrderLocName);
     1351        //if (Index > 0) and (result = TOrder(lstOrders.Items.Objects[Index - 1]).OrderLocName) then result := '';
     1352      //end;
    13311353    end;
    13321354  end;
     
    14351457  NextIndex: Integer;
    14361458begin
    1437 
     1459  if PatientStatusChanged then exit;
    14381460  if BILLING_AWARE then //CQ5114
    14391461     fODConsult.displayDXCode := ''; //CQ5114
     
    15341556  BadList  := TStringList.Create;
    15351557  CheckedList := TStringList.Create;
    1536   with lstOrders do for i := 0 to Items.Count - 1 do if Selected[i] then
    1537   begin
    1538     AnOrder := TOrder(Items.Objects[i]);
    1539     //AGP Change 25.34 to fix problem with renewing inpatient meds from an outpatient location
    1540     if (AnAction = 'RN') and (AnOrder.Status=6) and (AnOrder.DGroupName = 'Inpt. Meds') and (Patient.inpatient) and (IsClinicLoc(Encounter.Location)) then
    1541        begin
    1542          Selected[i] := False;
    1543          MessageDlg('You can not renew inpatient medication order on a clinic location for selected inpatient.', mtWarning, [mbOK], 0);
    1544        end;
    1545     if (AnAction = 'RN') or (AnAction = 'EV') then // or (AnAction = 'RW') then
    1546     begin
    1547       if not IsValidSchedule(AnOrder.ID) then
    1548       begin
    1549         if (AnAction = 'RN') then
    1550           ShowMessage('The order contains invalid schedule and can not be renewed.')
    1551         else if (AnAction = 'EV') then
    1552           ShowMessage('The order contains invalid schedule and can not be changed to event delayed order.');
    1553         //else if (AnAction = 'RW') then
    1554         //  ShowMessage('The order contains invalid schedule and can not be copied.);
     1558  try
     1559    with lstOrders do for i := 0 to Items.Count - 1 do if Selected[i] then
     1560    begin
     1561      AnOrder := TOrder(Items.Objects[i]);
     1562      if (AnAction = 'RN') and (AnOrder.Status=6) and (AnOrder.DGroupName = 'Inpt. Meds') and (Patient.inpatient) and (IsClinicLoc(Encounter.Location)) then
     1563         begin
     1564           Selected[i] := False;
     1565           MessageDlg('You cannot renew inpatient medication order on a clinic location for selected inpatient.', mtWarning, [mbOK], 0);
     1566         end;
     1567      if ((AnAction = 'RN') or (AnAction = 'EV')) and (AnOrder.EnteredInError = 0) then  //AGP Changes PSI-04053
     1568      begin
     1569        if not IsValidSchedule(AnOrder.ID) then
     1570        begin
     1571          if (AnAction = 'RN') then
     1572            ShowMessage('The order contains invalid schedule and can not be renewed.')
     1573          else if (AnAction = 'EV') then
     1574            ShowMessage('The order contains invalid schedule and can not be changed to event delayed order.');
     1575
     1576          Selected[i] := False;
     1577          Continue;
     1578        end;
     1579      end;
     1580      //AGP CHANGE ORDER ENTERED IN ERROR TO ALLOW SIGNATURE AND VERIFY ACTIONS 26.23
     1581      if ((AnOrder.EnteredInError = 1) and ((AnOrder.Status = 1) or (AnOrder.Status = 13)))  and ((AnAction <> 'ES') and (AnAction <> 'VR')) then
     1582         begin
     1583            InfoBox(AnOrder.Text + WarningMsg + 'This order has been mark as Entered in error.', WarningTitle, MB_OK);
     1584            Selected[i] := False;
     1585            Continue;
     1586         end;
     1587      if ((AnAction <> OA_RELEASE) and (AnOrder.EnteredInError = 0)) or (((AnOrder.EnteredInError = 1) and ((AnOrder.Status = 1) or (AnOrder.Status = 13))) and
     1588            (AnAction = 'ES')) then
     1589         ValidateOrderAction(AnOrder.ID, AnAction, ErrMsg)
     1590      //AGP END Changes
     1591        else ErrMsg := '';
     1592      if (Length(ErrMsg)>0) and (Pos('COMPLEX-PSI',ErrMsg)<1) then
     1593      begin
     1594        InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
    15551595        Selected[i] := False;
    15561596        Continue;
    15571597      end;
    1558     end;
    1559     if AnAction <> OA_RELEASE then ValidateOrderAction(AnOrder.ID, AnAction, ErrMsg)
    1560       else ErrMsg := '';
    1561     if (Length(ErrMsg)>0) and (Pos('COMPLEX-PSI',ErrMsg)<1) then
    1562     begin
    1563       InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
    1564       Selected[i] := False;
    1565       Continue;
    1566     end;
    1567     if (Length(ErrMsg)>0) and IsFirstDoseNowOrder(AnOrder.ID) and (AnAction <> 'RL') then
    1568     begin
    1569       InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
    1570       Selected[i] := False;
    1571       Continue;
    1572     end;
    1573     if (Length(ErrMsg)>0) and ( (AnAction = OA_CHGEVT) or (AnAction = OA_EDREL) ) then
    1574     begin
    1575       InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
    1576       Selected[i] := False;
    1577       Continue;
    1578     end;
    1579     AParentID := '';
    1580     IsValidActionOnComplexOrder(AnOrder.ID, AnAction,TListBox(lstOrders),CheckedList,ErrMsg, AParentID);
    1581     TOrder(Items.Objects[i]).ParentID := AParentID;
    1582     if (Length(ErrMsg)=0) and (AnAction=OA_EDREL) then
     1598      if (Length(ErrMsg)>0) and IsFirstDoseNowOrder(AnOrder.ID) and (AnAction <> 'RL') then
     1599      begin
     1600        InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
     1601        Selected[i] := False;
     1602        Continue;
     1603      end;
     1604      if (Length(ErrMsg)>0) and ( (AnAction = OA_CHGEVT) or (AnAction = OA_EDREL) ) then
     1605      begin
     1606        InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
     1607        Selected[i] := False;
     1608        Continue;
     1609      end;
     1610      AParentID := '';
     1611      IsValidActionOnComplexOrder(AnOrder.ID, AnAction,TListBox(lstOrders),CheckedList,ErrMsg, AParentID);
     1612      TOrder(Items.Objects[i]).ParentID := AParentID;
     1613      if (Length(ErrMsg)=0) and (AnAction=OA_EDREL) then
     1614         begin
     1615           if (AnOrder.Signature = 2) and (not VerbTelPolicyOrder(AnOrder.ID)) then
     1616              begin
     1617                ErrMsg := 'Need to be signed first.';
     1618                Selected[i] := False;
     1619              end;
     1620         end;
     1621
     1622      if (AnAction = OA_CHGEVT) or (AnAction = OA_EDREL) then
     1623         begin
     1624           if Length(ErrMsg)>0 then
     1625              begin
     1626                Selected[i] := False;
     1627                Badlist.Add(AnOrder.Text + '^' + ErrMsg);
     1628              end
     1629           else
     1630             GoodList.Add(AnOrder.Text);
     1631         end;
     1632
     1633      if (Length(ErrMsg) > 0) and (AnAction <> OA_CHGEVT) and (AnAction <> OA_EDREL) then
     1634         begin
     1635           if Pos('COMPLEX-PSI',ErrMsg)>0 then ErrMsg := TX_COMPLEX;
     1636           InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
     1637           Selected[i] := False;
     1638         end;
     1639
     1640      if Selected[i] and (not OrderIsLocked(AnOrder.ID, AnAction)) then Selected[i] := False;
     1641
     1642    end; //with
     1643
     1644    if ((AnAction = OA_CHGEVT) or (AnAction = OA_EDREL)) then
    15831645       begin
    1584          if (AnOrder.Signature = 2) and (not VerbTelPolicyOrder(AnOrder.ID)) then
    1585             begin
    1586               ErrMsg := 'Need to be signed first.';
    1587               Selected[i] := False;
    1588             end;
     1646        if (BadList.Count = 1) and (GoodList.Count < 1 ) then
     1647          InfoBox(Piece(BadList[0],'^',1) + WarningMsg + Piece(BadList[0],'^',2), WarningTitle, MB_OK);
     1648        if ((BadList.Count >= 1) and (GoodList.Count >= 1)) or ( BadList.Count > 1 )then
     1649          DisplayOrdersForAction(BadList,GoodList,AnAction);
    15891650       end;
    1590 
    1591     if (AnAction = OA_CHGEVT) or (AnAction = OA_EDREL) then
    1592        begin
    1593          if Length(ErrMsg)>0 then
    1594             begin
    1595               Selected[i] := False;
    1596               Badlist.Add(AnOrder.Text + '^' + ErrMsg);
    1597             end
    1598          else
    1599            GoodList.Add(AnOrder.Text);
    1600        end;
    1601 
    1602     if (Length(ErrMsg) > 0) and (AnAction <> OA_CHGEVT) and (AnAction <> OA_EDREL) then
    1603        begin
    1604          if Pos('COMPLEX-PSI',ErrMsg)>0 then ErrMsg := TX_COMPLEX;
    1605          InfoBox(AnOrder.Text + WarningMsg + ErrMsg, WarningTitle, MB_OK);
    1606          Selected[i] := False;
    1607        end;
    1608 
    1609     if Selected[i] and (not OrderIsLocked(AnOrder.ID, AnAction)) then Selected[i] := False;
    1610    
    1611   end; //with
    1612 
    1613   if ((AnAction = OA_CHGEVT) or (AnAction = OA_EDREL)) then
    1614      begin
    1615       if (BadList.Count = 1) and (GoodList.Count < 1 ) then
    1616         InfoBox(Piece(BadList[0],'^',1) + WarningMsg + Piece(BadList[0],'^',2), WarningTitle, MB_OK);
    1617       if ((BadList.Count >= 1) and (GoodList.Count >= 1)) or ( BadList.Count > 1 )then
    1618         DisplayOrdersForAction(BadList,GoodList,AnAction);
    1619      end;
     1651  finally
     1652    GoodList.Free;
     1653    BadList.Free;
     1654    CheckedList.Free;
     1655  end;
    16201656end;
    16211657
     
    16821718  SelectedList := TList.Create;
    16831719  try
    1684     ValidateSelected(OA_DC, TX_NO_DC, TC_NO_DC);        // validate DC action on each order
     1720    //if CheckOrderStatus = True then Exit;
     1721    ValidateSelected(OA_DC, TX_NO_DC, TC_NO_DC); // validate DC action on each order
     1722    //ActivateDeactiveRenew;   AGP 26.53 TURN OFF UNTIL FINAL DECISION CAN BE MADE
    16851723    MakeSelectedList(SelectedList);                     // build list of orders that remain
    16861724    // updating the Changes object happens in ExecuteDCOrders, based on individual order
     
    17531791begin
    17541792  inherited;
    1755   if not EncounterPresentEDO then Exit; 
     1793  if not EncounterPresentEDO then Exit;
    17561794  if NoneSelected(TX_NOSEL) then Exit;
    17571795  if not AuthorizedUser then Exit;
     
    17641802  SelectedList := TList.Create;
    17651803  try
     1804    if CheckOrderStatus = True then Exit;
    17661805    ValidateSelected(OA_CHGEVT, TX_NO_CV, TC_NO_CV);   // validate Change Event action on each order
    17671806    MakeSelectedList(SelectedList);                     // build list of orders that remain
     
    17991838  SelectedList := TList.Create;
    18001839  try
     1840    if CheckOrderStatus = True then Exit;
    18011841    ValidateSelected(OA_HOLD, TX_NO_HOLD, TC_NO_HOLD);  // validate hold action on each order
    18021842    MakeSelectedList(SelectedList);                     // build list of orders that remain
     
    18241864  SelectedList := TList.Create;
    18251865  try
     1866    if CheckOrderStatus = True then Exit;
    18261867    ValidateSelected(OA_UNHOLD, TX_NO_UNHOLD, TC_NO_UNHOLD);  // validate release hold action
    18271868    MakeSelectedList(SelectedList);                           // build list of selected orders
     
    18501891  SelectedList := TList.Create;
    18511892  try
     1893    if CheckOrderStatus = True then Exit;
    18521894    ValidateSelected(OA_RENEW, TX_NO_RENEW, TC_NO_RENEW);  // validate renew action for each
    18531895    MakeSelectedList(SelectedList);                       // build list of orders that remain
     
    20262068  try
    20272069    if NoneSelected(TX_NOSEL) then Exit;
     2070    if CheckOrderStatus = True then Exit;
    20282071    ValidateSelected(OA_CHANGE, TX_NO_CHANGE, TC_NO_CHANGE);
    20292072    if (FCurrentView.EventDelay.PtEventIFN>0) and
     
    20672110    if NoneSelected(TX_NOSEL) then Exit;
    20682111    NewOrderCreated := False;
     2112    if CheckOrderStatus = True then Exit;
    20692113    ValidateSelected(OA_COPY, TX_NO_COPY, TC_NO_COPY);
    20702114    if (FCurrentView.EventDelay.PtEventIFN>0) and (PtEvtCompleted(FCurrentView.EventDelay.PtEventIFN, FCurrentView.EventDelay.EventName)) then
     
    22692313       UBACore.CompleteUnsignedBillingInfo(rpcGetUnsignedOrdersBillingData(OrderListSCEI) );
    22702314    end;
    2271    
     2315
    22722316   {billing Aware}
    22732317    ExecuteReleaseOrderChecks(SelectedList);            // call order checking
     
    22792323      if Active and (FollowUp = NF_ORDER_REQUIRES_ELEC_SIGNATURE) then
    22802324        UnsignedOrderAlertFollowup(Piece(RecordID, U, 2));
    2281     UpdateExpiringMedAlerts(Patient.DFN);
    2282     UpdateUnverifiedMedAlerts(Patient.DFN);
    2283     UpdateUnverifiedOrderAlerts(Patient.DFN);
     2325      if Active then
     2326      begin
     2327        UpdateExpiringMedAlerts(Patient.DFN);
     2328        UpdateUnverifiedMedAlerts(Patient.DFN);
     2329        UpdateUnverifiedOrderAlerts(Patient.DFN);
     2330      end;
    22842331    if not uInit.TimedOut then
    22852332      begin
     
    23702417      NF_DNR_EXPIRING                  :
    23712418        ViewAlertedOrders('', STS_EXPIRING, '', False, True, 'All Services, Expiring');
    2372       NF_MEDICATIONS_EXPIRING          :
     2419      NF_MEDICATIONS_EXPIRING_INPT          :
     2420        begin
     2421          ViewAlertedOrders('', STS_EXPIRING, 'PHARMACY', False, True, 'Medications, Expiring');
     2422        end;
     2423      NF_MEDICATIONS_EXPIRING_OUTPT          :
    23732424        begin
    23742425          ViewAlertedOrders('', STS_EXPIRING, 'PHARMACY', False, True, 'Medications, Expiring');
     
    25092560    if (ALocation > 0) and (ALocation <> Encounter.Location) then
    25102561    begin
    2511       if InfoBox(TX_NEW_LOC1 + AName + TX_NEW_LOC2, TC_NEW_LOC, MB_YESNO) = IDYES
    2512         then Encounter.Location := ALocation;
     2562    //gary
     2563      Encounter.Location := frmClinicWardMeds.ClinicOrWardLocation(Alocation);
     2564   //   if InfoBox(TX_NEW_LOC1 + AName + TX_NEW_LOC2, TC_NEW_LOC, MB_YESNO) = IDYES
     2565   //     then Encounter.Location := ALocation;
    25132566    end;
    25142567    if Encounter.Location = 0
     
    30453098  inherited SetFontSize( FontSize );
    30463099  RedrawOrderList;
     3100  mnuOptimizeFieldsClick(self);
     3101  lstSheets.Repaint;
     3102  lstWrite.Repaint;
     3103  btnDelayedOrder.Repaint;
    30473104end;
    30483105
     
    30503107begin
    30513108  inherited;
     3109  if PatientStatusChanged then exit;
    30523110  //frmFrame.UpdatePtInfoOnRefresh;
    30533111end;
     
    30563114begin
    30573115  inherited;
     3116  if PatientStatusChanged then exit;
    30583117  //frmFrame.UpdatePtInfoOnRefresh;
    30593118end;
     
    30623121begin
    30633122  inherited;
     3123  if PatientStatusChanged then exit;
    30643124  //frmFrame.UpdatePtInfoOnRefresh;
    30653125end;
     
    30683128begin
    30693129  inherited;
     3130  if PatientStatusChanged then exit; 
    30703131  //frmFrame.UpdatePtInfoOnRefresh;
    30713132end;
     
    31863247var
    31873248  i: integer;
    3188   totalSectionsWidth: integer;
     3249  totalSectionsWidth, originalwidth: integer;
    31893250begin
    31903251  inherited;
    31913252  //CQ6170
    31923253  totalSectionsWidth := getTotalSectionsWidth;
    3193 
    3194      if totalSectionsWidth > lstOrders.Width - 5 then
    3195         begin
    3196         for i := 0 to hdrOrders.Sections.Count-1 do
    3197            begin
    3198            hdrOrders.Sections[i].Width := origWidths[i];
    3199            lstOrders.Invalidate;
    3200            end;
    3201         end;
     3254  if totalSectionsWidth > lstOrders.Width - 5 then
     3255  begin
     3256    originalwidth := 0;
     3257    for i := 0 to hdrOrders.Sections.Count - 1 do
     3258      originalwidth := originalwidth + origWidths[i];
     3259    if originalwidth < totalSectionsWidth then
     3260    begin
     3261      for i := 0 to hdrOrders.Sections.Count - 1 do
     3262        hdrOrders.Sections[i].Width := origWidths[i];
     3263      lstOrders.Invalidate;
     3264    end;
     3265  end;
    32023266  //end CQ6170
    32033267end;
     
    32093273end;
    32103274
     3275function TfrmOrders.PatientStatusChanged: boolean;
     3276const
     3277
     3278  msgTxt1 = 'Patient status was changed from ';
     3279  msgTxt2 = 'CPRS needs to refresh patient information to display patient latest record.';
     3280   //GE CQ9537  - Change message text
     3281  msgTxt3 = 'Patient has been admitted. ';
     3282  msgTxt4 = CRLF + 'You will be prompted to sign your orders.  Any new orders subsequently' +
     3283            CRLF +'entered and signed will be directed to the inpatient staff.';
     3284var
     3285  PtSelect: TPtSelect;
     3286  IsInpatientNow: boolean;
     3287  ptSts: string;
     3288begin
     3289  result := False;
     3290  SelectPatient(Patient.DFN, PtSelect);
     3291  IsInpatientNow := Length(PtSelect.Location) > 0;
     3292  if Patient.Inpatient <> IsInpatientNow then
     3293  begin
     3294    if (not Patient.Inpatient) then   //GE CQ9537  - Change message text
     3295       MessageDlg(msgTxt3 + msgTxt4, mtWarning, [mbOK], 0)
     3296    else
     3297       begin
     3298          if Patient.Inpatient then ptSts := 'Inpatient to Outpatient.';
     3299          MessageDlg(msgTxt1 + ptSts + #13#10#13 + msgTxt2, mtWarning, [mbOK], 0);
     3300       end;
     3301    frmFrame.mnuFileRefreshClick(Application);
     3302    Result := True;
     3303  end;
     3304end;
     3305
     3306function TfrmOrders.CheckOrderStatus: boolean;
     3307var
     3308i: integer;
     3309AnOrder: TOrder;
     3310begin
     3311    Result := False;
     3312    with lstOrders do for i := 0 to Items.Count - 1 do if Selected[i] then
     3313    begin
     3314      AnOrder := TOrder(Items.Objects[i]);
     3315      if AnORder.Status <> GetOrderStatus(AnOrder.ID) then
     3316         begin
     3317           MessageDlg('The Order status has changed.' + #13#10#13 + 'CPRS needs to refresh patient information to display the correct order status', mtWarning, [mbOK], 0);
     3318           frmFrame.mnuFileRefreshClick(Application);
     3319           Result := True;
     3320           EXIT;
     3321         end;
     3322    end;
     3323end;
     3324
     3325(*procedure TfrmOrders.ActivateDeactiveRenew;
     3326var
     3327  i: Integer;
     3328  AnOrder: TOrder;
     3329  tmpArr: TStringList;
     3330begin
     3331    tmpArr := TStringList.Create;
     3332    with lstOrders do for i := 0 to Items.Count - 1 do if Selected[i] then
     3333    begin
     3334      AnOrder := TOrder(Items.Objects[i]);
     3335      if AnOrder.Status = 5 then tmpArr.Add(AnOrder.ID);
     3336    end;
     3337    if tmpArr <> nil then frmActivateDeactive.fActivateDeactive(tmpArr);
     3338end;  *)
     3339
     3340procedure TfrmOrders.ViewInfo(Sender: TObject);
     3341begin
     3342  inherited;
     3343  frmFrame.ViewInfo(Sender);
     3344end;
     3345
     3346procedure TfrmOrders.mnuViewInformationClick(Sender: TObject);
     3347begin
     3348  inherited;
     3349  mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled;
     3350  mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled;
     3351  mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled;
     3352  mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No');
     3353  mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No');
     3354  mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled;
     3355  mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled;
     3356  mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled;
     3357  mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled;
     3358end;
     3359
     3360procedure TfrmOrders.mnuOptimizeFieldsClick(Sender: TObject);
     3361var
     3362  totalSectionsWidth, unitvalue: integer;
     3363begin
     3364  totalSectionsWidth := pnlRight.Width - 3;
     3365  if totalSectionsWidth < 16 then exit;
     3366  unitvalue := round(totalSectionsWidth / 16);
     3367  with hdrOrders do
     3368  begin
     3369    Sections[1].Width := unitvalue;
     3370    Sections[2].Width := pnlRight.Width - (unitvalue * 10) - 5;
     3371    Sections[3].Width := unitvalue * 2;
     3372    Sections[4].Width := unitvalue * 2;
     3373    Sections[5].Width := unitvalue;
     3374    Sections[6].Width := unitvalue;
     3375    Sections[7].Width := unitvalue;
     3376    Sections[8].Width := unitvalue;
     3377    Sections[9].Width := unitvalue;
     3378  end;
     3379  hdrOrdersSectionResize(hdrOrders, hdrOrders.Sections[0]);
     3380  hdrOrders.Repaint;
     3381end;
     3382
     3383procedure TfrmOrders.hdrOrdersSectionClick(HeaderControl: THeaderControl;
     3384  Section: THeaderSection);
     3385begin
     3386  inherited;
     3387  //if Section = hdrOrders.Sections[1] then
     3388    mnuOptimizeFieldsClick(self);
     3389end;
     3390
     3391procedure TfrmOrders.sptHorzMoved(Sender: TObject);
     3392begin
     3393  inherited;
     3394  mnuOptimizeFieldsClick(self);
     3395end;
     3396
    32113397end.
    32123398
Note: See TracChangeset for help on using the changeset viewer.