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

Upgrade to version 27

File:
1 edited

Legend:

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

    r456 r829  
    55uses
    66  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    7   fAutoSz, Buttons, ExtCtrls, StdCtrls, ORCtrls, ORFn, fODBase, uOrders;
     7  fAutoSz, Buttons, ExtCtrls, StdCtrls, ORCtrls, ORFn, fODBase, uOrders,
     8  VA508AccessibilityManager;
    89
    910type
     
    5859  TX_NO_TEXT     = 'No fields have been entered - cannot save as quick order.';
    5960  TC_NO_TEXT     = 'Save as Quick Order';
     61  TX_DUP_NAME = 'There is already a quick order with that name.' + CRLF +
     62                'Please either delete the original or enter a different name.';
     63  TC_DUP_NAME = 'Unable to save quick order';
     64  TC_DUP_RENAME = 'Unable to rename quick order';
    6065
    6166function EditCommonList(ADisplayGroup: Integer): Boolean;
     
    8489        ItemIndex := 0;
    8590      end;
     91      ActiveControl := lstQuickList;
    8692      ShowModal;
    8793      if OKPressed then
     
    128134      else
    129135        DGroupName := NameOfDGroup(ResponseSet.DisplayGroup);
     136      if DGroupName = 'Inpt. Meds' then
     137        begin
     138          ResponseSet.DisplayGroup := InptDisp;
     139          DGroupName := NameOfDGroup(InptDisp);
     140        end;
    130141      Caption := 'Add Quick Order (' + DGroupName + ')';
    131142      lblQuickList.Caption := 'Common List for ' + DGroupName;
     
    145156        ItemIndex := 0;
    146157      end;
     158      ActiveControl := txtDisplayName;
    147159      ShowModal;
    148160      if OKPressed then
     
    213225var
    214226  AName: string;
     227  i: integer;
    215228begin
    216229  inherited;
     
    219232    if ItemIndex < 0 then Exit;
    220233    AName := Piece(Items[ItemIndex], U, 2);
    221     if ExecuteRename(AName, TX_QO_RENAME)
    222       then Items[ItemIndex] := Piece(Items[ItemIndex], U, 1) + U + AName;
    223   end;
     234    if ExecuteRename(AName, TX_QO_RENAME) then
     235    begin
     236      i := Items.IndexOf(AName);
     237      if (i > -1) and (i <> ItemIndex) then
     238        InfoBox(TX_DUP_NAME, TC_DUP_RENAME, MB_ICONERROR or MB_OK)
     239      else
     240        Items[ItemIndex] := Piece(Items[ItemIndex], U, 1) + U + AName;
     241    end;
     242  end;
     243
    224244end;
    225245
     
    247267
    248268procedure TfrmSaveQuickOrder.cmdOKClick(Sender: TObject);
    249 begin
    250   inherited;
    251   if txtDisplayName.Enabled and (txtDisplayName.Text = '') then
    252   begin
    253     InfoBox(TX_DNAME_REQ, TC_DNAME_REQ, MB_OK);
    254     Exit;
     269var
     270  i: integer;
     271begin
     272  inherited;
     273  if txtDisplayName.Enabled then
     274  begin
     275    if (txtDisplayName.Text = '') then
     276    begin
     277      InfoBox(TX_DNAME_REQ, TC_DNAME_REQ, MB_OK);
     278      Exit;
     279    end;
     280    for i := 0 to lstQuickList.Count - 1 do
     281      if (UpperCase(lstQuickList.DisplayText[i]) = UpperCase(txtDisplayName.Text)) and (i > 0) then
     282      begin
     283        InfoBox(TX_DUP_NAME, TC_DUP_NAME, MB_ICONERROR or MB_OK);
     284        lstQuickList.ItemIndex := i;
     285        Exit;
     286      end;
    255287  end;
    256288  OKPressed := True;
Note: See TracChangeset for help on using the changeset viewer.