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

    r459 r460  
    11unit fODMedNVA;
    22
    3 interface                         
     3interface
    44
    55uses
     
    4141    Label2: TLabel;
    4242    btnSelect: TButton;
     43    Image1: TImage;
     44    memDrugMsg: TMemo;
    4345    procedure FormCreate(Sender: TObject);
    4446    procedure btnSelectClick(Sender: TObject);
     
    6870    procedure cboScheduleClick(Sender: TObject);
    6971    procedure cboRouteExit(Sender: TObject);
    70 
     72    procedure DispOrderMessage(const AMessage: string);
    7173
    7274
     
    8991      Change: TItemChange);
    9092    procedure FormKeyPress(Sender: TObject; var Key: Char);
     93
    9194  private
    9295    {selection}
     
    121124    FPtInstruct: string;
    122125    FAltChecked: Boolean;
     126    FShrinkDrugMsg: boolean;
    123127    FQOQuantity: Double;
    124128    FQODosage: string;
     
    129133    FDisabledCancelButton: TButton;
    130134    FShrinked: boolean;
     135    FQOInitial: boolean;
    131136    FRemoveText : Boolean;
    132137    {selection}
     
    291296  TX_NO_FUTURE_DATES  = 'Dates in the future are not allowed.';
    292297  TX_BAD_DATE         = 'Dates must be in the format mm/dd/yy or mm/yy';
    293 
     298  TX_CAP_FUTURE       = 'Invalid date';
    294299
    295300{ procedures inherited from fODBase --------------------------------------------------------- }
     
    300305var
    301306  ListCount: Integer;
    302   Restriction, x : string;
    303 begin
     307  Restriction, x: string;
     308begin
     309  frmFrame.pnlVisit.Enabled := false;
    304310  AutoSizeDisabled := True;
    305311 // ActivateOrderDialog(Piece(DialogInfo, ';', 1), DelayEvent, Self, 0);
    306312  inherited;
     313  AllowQuickOrder := True;
     314
    307315  if User.OrderRole in[OR_CLERK] then   // if user is clerk check restrictions else ok to write NonVA Order.
    308   begin
    309      CheckAuthForNVAMeds(Restriction);
    310      if Length(Restriction) > 0 then
    311      begin
    312        InfoBox(Restriction, TC_RESTRICT, MB_OK);
    313        Close;
    314        Exit;
    315      end;
    316   end;
     316    begin
     317      CheckAuthForNVAMeds(Restriction);
     318      if Length(Restriction) > 0 then
     319        begin
     320          CheckAuthForNVAMeds(Restriction);
     321          if Length(Restriction) > 0 then
     322            begin
     323              InfoBox(Restriction, TC_RESTRICT, MB_OK);
     324              Close;
     325              Exit;
     326            end;
     327        end;
     328    end;  // clerk restrictions
    317329
    318330  if DlgFormID = OD_MEDNONVA  then FNonVADlg := TRUE;
     
    363375  LoadOTCStatements(lbStatements.Items);
    364376  FRemoveText := True;
     377  FShrinkDrugMsg := False;
    365378end;
    366379
     
    376389 // TAccessibleStringGrid.UnwrapControl(grdDoses);
    377390  inherited;
     391  frmFrame.pnlVisit.Enabled := true;
    378392end;
    379393
     
    401415procedure TfrmODMedNVA.SetupDialog(OrderAction: Integer; const ID: string);
    402416var
     417  //AnInstr: string;
    403418  OrderID: string;
    404419begin
     
    429444    Changing := False;
    430445  end;
    431 
     446  { prevent the SIG from being part of the comments on pre-CPRS prescriptions }
     447  {if (OrderAction in [ORDER_COPY, ORDER_EDIT]) and (cboDosage.Text = '') then  //commented out by cla 2/27/04 - CQ 2591
     448  begin
     449    OrderID := Copy(Piece(ID, ';', 1), 2, Length(ID));
     450    AnInstr := TextForOrder(OrderID);
     451    pnlMessage.TabOrder := 0;
     452    OrderMessage(AnInstr);
     453    if OrderAction = ORDER_COPY
     454      then AnInstr := 'Copy: ' + AnInstr
     455      else AnInstr := 'Change: ' + AnInstr;
     456    Caption := AnInstr;
     457    memComment.Clear;  // sometimes the sig is in the comment
     458    lbStatements.Clear;
     459  end;}
    432460  ControlChange(Self);
    433461end;
     
    527555end;
    528556
    529 
    530557{ Navigate medication selection lists ------------------------------------------------------- }
    531558
     
    607634var
    608635  Offset: Integer;
     636  SelRect: TRect;
    609637begin
    610638  AListView.Selected.MakeVisible(FALSE);
     639  SelRect := AListView.Selected.DisplayRect(drBounds);   //  CQ: 6636
     640  FRowHeight := SelRect.Bottom - SelRect.Top;
    611641  Offset := AListView.Selected.Index - AListView.TopItem.Index;
    612642  Application.ProcessMessages;
     
    803833    Changing := True;
    804834    ResetOnMedChange;
    805   if (FActiveMedList = lstAll) and (lstAll.Selected <> nil) then  // orderable item
     835    if (FActiveMedList = lstQuick) and (lstQuick.Selected <> nil) then   // quick order
     836    begin
     837      ErrMsg := '';
     838      FIsQuickOrder := True;
     839      FQOInitial := True;
     840      Responses.QuickOrder := Integer(lstQuick.Selected.Data);
     841      txtMed.Tag  := StrToIntDef(Responses.IValueFor('ORDERABLE', 1), 0);
     842      IsActivateOI(ErrMsg, txtMed.Tag);
     843      if Length(ErrMsg)>0 then
     844      begin
     845        //btnSelect.Visible := False;
     846        btnSelect.Enabled := False;
     847        ShowMessage(ErrMsg);
     848        Exit;
     849      end;
     850      if txtMed.Tag = 0 then
     851      begin
     852        //btnSelect.Visible := False;
     853        btnSelect.Enabled := False;
     854        txtMed.SetFocus;
     855        Exit;
     856      end;
     857      SetOnMedSelect;   // set up for this medication
     858      SetOnQuickOrder;  // insert quick order responses
     859      ShowMedFields;
     860    end
     861    else if (FActiveMedList = lstAll) and (lstAll.Selected <> nil) then  // orderable item
    806862    begin
    807863      MedIEN := Integer(lstAll.Selected.Data);
     
    831887      ShowMedFields;
    832888    end
    833     else                                                                 // no selection
     889    else                                           // no selection
    834890    begin
    835891      MessageBeep(0);
     
    842898  else ShowMedSelect;                             // show the selection fields
    843899  FNoZERO   := False;
    844 
    845900end;
    846901
     
    848903begin
    849904  cboDosage.Items.Clear;
     905  chkPRN.Checked := False;
     906  cboSchedule.ItemIndex := -1;
     907  cboSchedule.Text := '';  // leave items intact
     908  memComment.Lines.Clear;
    850909  cboDosage.Text := '';
    851910  cboRoute.Items.Clear;
     
    867926  QOPiUnChk := False;
    868927  PKIEnviron := False;
    869   if GetPKISite and GetPKIUse then  //PKI check for crypto object on workstation
    870     begin
    871       try  //PKI object creation
    872         crypto := CoXuDigSigS.Create;
    873         crypto.GetCSP;
    874         StatusText(crypto.Reason);
    875         PKIEnviron := True;
    876       except
    877         on  E: Exception do
    878           begin
    879             {ShowMessage('An error has been encountered while trying to create PKI environment: '+ E.Message +
    880             '.  This order will be processed without Digital Signature encryption.');}
    881             PKIEnviron := False;
    882           end;
    883       end;
    884       crypto := nil;
    885     end;
    886   if PKIEnviron = False then
    887     if GetPKISite then PKIEnviron := True;
     928  if GetPKISite then PKIEnviron := True;
    888929  with CtrlInits do
    889930  begin
     
    950991 //   end;
    951992    pnlMessage.TabOrder := cboDosage.TabOrder + 1;
    952     OrderMessage(TextOf('Message'));
     993
     994 //   DispOrderMessage(TextOf('Message'));
    953995  end;
    954996end;
     
    9711013        with cboDosage do
    9721014          if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] else x := Text;
     1015
    9731016        SetControl(cboRoute,  'ROUTE', i);
    9741017        with cboRoute do
     
    10011044      else
    10021045        SetDosage(IValueFor('INSTR', 1));
    1003         SetControl(cboRoute,  'ROUTE',     1);
     1046        SetControl(cboDosage, 'DOSAGE', 1); // CQ: HDS00007776
    10041047        SetSchedule(IValueFor('SCHEDULE',  1));
    10051048      if (cboSchedule.Text = '') and FIsQuickOrder then
     
    11741217  NonPRNPart: string;
    11751218begin
     1219 
    11761220  cboSchedule.ItemIndex := -1;
    11771221  if Pos('PRN', x) > 0 then
     
    11791223    NonPRNPart := Trim(Copy(x, 1, Pos('PRN', x) - 1));
    11801224    cboSchedule.SelectByID(NonPRNPart);
    1181     if cboSchedule.ItemIndex > -1 then chkPRN.Checked := True else
    1182     begin
    1183       cboSchedule.SelectByID(x);
    1184       if cboSchedule.ItemIndex < 0 then cboSchedule.Text := x;
    1185     end;
     1225    if cboSchedule.ItemIndex < 0 then
     1226    begin
     1227      if NSSchedule then
     1228      begin
     1229        chkPRN.Checked := False;
     1230        cboSchedule.Text := '';
     1231      end else
     1232      begin
     1233        chkPRN.Checked := True;
     1234        cboSchedule.Items.Add(NonPRNPart);
     1235        cboSchedule.Text := NonPRNPart;
     1236      end;
     1237    end else
     1238      chkPRN.Checked := True;
    11861239  end else
    11871240  begin
    11881241    chkPRN.Checked := False;
    11891242    cboSchedule.SelectByID(x);
    1190     if cboSchedule.ItemIndex < 0 then cboSchedule.Text := x;
     1243    if cboSchedule.ItemIndex < 0 then
     1244    begin
     1245      if NSSchedule then
     1246      begin
     1247        cboSchedule.Text := '';
     1248      end
     1249      else
     1250      begin
     1251        cboSchedule.Items.Add(x);
     1252        cboSchedule.Text := x;
     1253        cboSchedule.SelectByID(x);
     1254      end;
     1255    end;
    11911256  end;
    11921257end;
     
    12461311var
    12471312  DispDrug: Integer;
    1248   x: string;
    1249 begin
    1250   inherited;
    1251   UpdateRelated(False);
     1313begin
     1314  inherited;
     1315UpdateRelated(False);
    12521316  DispDrug := StrToIntDef(ValueOf(FLD_DRUG_ID), 0);
    12531317  if cboDosage.Text = '' then    //cla 3/18/04
     
    12561320    cboDosage.ItemIndex := -1;
    12571321  end;
     1322  {  hds8084
    12581323  if DispDrug > 0 then
    12591324  begin
    12601325    if not FSuppressMsg then begin
    12611326      pnlMessage.TabOrder := cboDosage.TabOrder + 1;
    1262       OrderMessage(DispenseMessage(DispDrug));
     1327      DispOrderMessage(DispenseMessage(DispDrug));
    12631328    end;
    12641329    x := QuantityMessage(DispDrug);
    12651330  end
    12661331  else x := '';
     1332  }
    12671333  with cboDosage do
    12681334    if (ItemIndex > -1) and (Piece(Items[ItemIndex], U, 3) = 'NF')
     
    15891655                                then Responses.Update('ROUTE',    1, ValueOf(FLD_ROUTE_ID), x)
    15901656                                else Responses.Update('ROUTE',    1, '', x);
    1591  //     x := ValueOf(FLD_SCHEDULE);    Responses.Update('SCHEDULE', 1, x,  x);
     1657      x := ValueOf(FLD_SCHEDULE);    Responses.Update('SCHEDULE', 1, x,  x); // CQ:7297, 7534
    15921658    end;
    15931659  end; {case TabDose.TabIndex}
     
    15981664  if Length(calStart.Text) > 0 then
    15991665     Responses.Update('START', 1, calStart.Text, 'Start Date: ' + calStart.Text);  //cla 7-17-03
    1600 
     1666     
    16011667  x := ValueOf(FLD_STATEMENTS);
    16021668  Responses.Update('STATEMENTS',1, TX_WPTYPE, x);
     
    16971763                     if ItemIndex > -1  then Result := Piece(Items[ItemIndex], U, 4);
    16981764    FLD_SCHEDULE  : begin
    1699                       Result := cboSchedule.Text;
     1765                      Result := UpperCase(cboSchedule.Text);
    17001766                      if chkPRN.Checked then Result := Result + ' PRN';
    17011767                      if UpperCase(Copy(Result, Length(Result) - 6, Length(Result))) = 'PRN PRN'
     
    17681834  if Length(CurSchedule)=0 then Exit;
    17691835  ASchedule := Trim(CurSchedule);
    1770   if (Pos('^',ASchedule)=0) then
     1836  {if (Pos('^',ASchedule)=0) then  //GE  CQ7506
    17711837  begin
    17721838    PrnPos := Pos('PRN',ASchedule);
    17731839    if (PrnPos > 1) and (CharAt(ASchedule,PrnPos-1) <> ';') then
    17741840      Delete(ASchedule, PrnPos, Length(ASchedule));
    1775   end
    1776   else if (Pos('^',ASchedule)>0) then
     1841  end  }
     1842  if (Pos('^',ASchedule)>0) then
    17771843  begin
    17781844    PrnPos := Pos('PRN',ASchedule);
     
    19291995    begin
    19301996      Val(TabletNum, ie, code);
     1997      if ie = 0 then begin end;
    19311998      if code <> 0 then
    19321999        Exit;
     
    19672034
    19682035procedure TfrmODMedNVA.chkPRNClick(Sender: TObject);
    1969 begin
    1970   inherited;
    1971   if chkPRN.Checked then lblAdminTime.Caption := ''
     2036var
     2037  tempSch: string;
     2038  PRNPos: integer;
     2039begin
     2040  inherited;
     2041  {if chkPRN.Checked then lblAdminTime.Caption := ''
    19722042  else
    19732043  begin
    19742044    lblAdminTime.Caption := FAdminTimeLbl;
     2045  end;
     2046  ControlChange(Self);
     2047  }
     2048  if chkPRN.Checked then
     2049  begin
     2050     lblAdminTime.Caption := '';
     2051     PrnPos := Pos('PRN',cboSchedule.Text);
     2052     if (PrnPos < 1) then
     2053        UpdateStartExpires(cboSchedule.Text + ' PRN');
     2054  end
     2055  else
     2056  begin
     2057    if Length(Trim(cboSchedule.Text))>0 then
     2058    begin
     2059      tempSch := ';'+Trim(cboSchedule.Text);
     2060      UpdateStartExpires(tempSch);
     2061    end;
     2062    lblAdminTime.Caption := FAdminTimeLbl;
     2063   
    19752064  end;
    19762065  ControlChange(Self);
     
    21942283end;
    21952284
     2285procedure TfrmODMedNVA.DispOrderMessage(const AMessage: string);
     2286begin
     2287  if ContainsVisibleChar(AMessage) then
     2288  begin
     2289    image1.Visible := True;
     2290    memDrugMsg.Visible := True;
     2291    image1.Picture.Icon.Handle := LoadIcon(0, IDI_ASTERISK);
     2292    memDrugMsg.Lines.Clear;
     2293    memDrugMsg.Lines.SetText(PChar(AMessage));
     2294    if fShrinkDrugMsg then
     2295    begin
     2296      pnlBottom.Height := pnlBottom.Height + memDrugMsg.Height + 2;
     2297      fShrinkDrugMsg := False;
     2298    end;
     2299  end else
     2300  begin
     2301    image1.Visible := False;
     2302    memDrugMsg.Visible := False;
     2303    if not fShrinkDrugMsg then
     2304  //  begin
     2305  //    pnlBottom.Height := pnlBottom.Height - memDrugMsg.Height - 2;
     2306      fShrinkDrugMsg := True;
     2307 //   end;
     2308  end;
     2309end;
     2310
    21962311end.
Note: See TracChangeset for help on using the changeset viewer.