Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (9 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

File:
1 edited

Legend:

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

    r829 r1679  
    2222  TfrmODGen = class(TfrmODBase)
    2323    sbxMain: TScrollBox;
     24    lblOrderSig: TLabel;
     25    VA508CompMemOrder: TVA508ComponentAccessibility;
    2426    procedure FormCreate(Sender: TObject);
    2527    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    2628    procedure cmdAcceptClick(Sender: TObject);
     29    procedure VA508CompMemOrderStateQuery(Sender: TObject; var Text: string);
    2730  private
    2831    FilterOut: boolean;
     
    3538      Direction, InsertAt: Integer);
    3639    procedure PlaceControls;
    37     procedure PlaceDateTime(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    38     procedure PlaceFreeText(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     40    procedure PlaceDateTime(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
     41    procedure PlaceFreeText(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    3942    procedure PlaceHidden(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    40     procedure PlaceNumeric(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    41     procedure PlaceSetOfCodes(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    42     procedure PlaceYesNo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    43     procedure PlaceLookup(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    44     procedure PlaceMemo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     43    procedure PlaceNumeric(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
     44    procedure PlaceSetOfCodes(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
     45    procedure PlaceYesNo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
     46    procedure PlaceLookup(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
     47    procedure PlaceMemo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    4548    procedure PlaceLabel(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
    4649    procedure TrimAllMemos;
     50    function SetComponentName(Editor: TWinControl; Index: Integer; DialogCtrl: TDialogCtrl): Boolean;
    4751  protected
    4852    FFormCloseCalled : Boolean;
     
    8488  IDs,TSstr, AttendStr: string;
    8589begin
    86   FFormCloseCalled := false;
     90  FFormCloseCalled := false;   
    8791  inherited;
    8892  FilterOut := True;
     
    243247end;
    244248
     249procedure TfrmODGen.VA508CompMemOrderStateQuery(Sender: TObject;
     250  var Text: string);
     251begin
     252  inherited;
     253  Text := memOrder.Text;
     254end;
     255
    245256procedure TfrmODGen.Validate(var AnErrMsg: string);
    246257var
     
    328339    DialogCtrl.Preserve := Length(DialogItem.EDefault) > 0;
    329340    case DialogItem.DataType of
    330     'D': PlaceDateTime(DialogCtrl, DialogItem);
    331     'F': PlaceFreeText(DialogCtrl, DialogItem);
     341    'D': PlaceDateTime(DialogCtrl, DialogItem, I);
     342    'F': PlaceFreeText(DialogCtrl, DialogItem, i);
    332343    'H': PlaceHidden(DialogCtrl, DialogItem);
    333     'N': PlaceNumeric(DialogCtrl, DialogItem);
    334     'P': PlaceLookup(DialogCtrl, DialogItem);
    335     'R': PlaceDateTime(DialogCtrl, DialogItem);
    336     'S': PlaceSetOfCodes(DialogCtrl, DialogItem);
    337     'W': PlaceMemo(DialogCtrl, DialogItem);
    338     'Y': PlaceYesNo(DialogCtrl, DialogItem);
     344    'N': PlaceNumeric(DialogCtrl, DialogItem, i);
     345    'P': PlaceLookup(DialogCtrl, DialogItem, i);
     346    'R': PlaceDateTime(DialogCtrl, DialogItem, i);
     347    'S': PlaceSetOfCodes(DialogCtrl, DialogItem, i);
     348    'W': PlaceMemo(DialogCtrl, DialogItem, i);
     349    'Y': PlaceYesNo(DialogCtrl, DialogItem, i);
    339350    end;
    340351    FDialogCtrlList.Add(DialogCtrl);
     
    343354end;
    344355
    345 procedure TfrmODGen.PlaceDateTime(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     356procedure TfrmODGen.PlaceDateTime(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    346357const
    347358  NUM_CHAR = 22;
     
    354365    TORDateBox(Editor).DateOnly := Pos('T', DialogItem.Domain) = 0;
    355366    with TORDateBox(Editor) do RequireTime := (not DateOnly) and (Pos('R', DialogItem.Domain) > 0); //v26.48 - RV  PSI-05-002
     367    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     368  //  TORDateBox(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    356369    TORDateBox(Editor).Text := DialogItem.EDefault;
    357370    TORDateBox(Editor).Hint := DialogItem.HelpText;
     
    364377end;
    365378
    366 procedure TfrmODGen.PlaceFreeText(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     379procedure TfrmODGen.PlaceFreeText(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    367380begin
    368381  with DialogCtrl do
     
    374387                     HT_FRAME * FCharHt);
    375388    TEdit(Editor).MaxLength := StrToIntDef(Piece(DialogItem.Domain, ':', 2), 0);
     389    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     390  //  TCaptionEdit(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    376391    TEdit(Editor).Text := DialogItem.EDefault;
    377392    TEdit(Editor).Hint := DialogItem.HelpText;
     
    384399end;
    385400
    386 procedure TfrmODGen.PlaceNumeric(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     401procedure TfrmODGen.PlaceNumeric(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    387402const
    388403  NUM_CHAR = 16;
     
    394409    Editor.SetBounds(FEditorLeft, FEditorTop, NUM_CHAR * FCharWd, HT_FRAME * FCharHt);
    395410    TEdit(Editor).MaxLength := NUM_CHAR;
     411    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     412   // TCaptionEdit(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    396413    TEdit(Editor).Text := DialogItem.EDefault;
    397414    TEdit(Editor).Hint := DialogItem.HelpText + '|' + DialogItem.Domain;
     
    404421end;
    405422
    406 procedure TfrmODGen.PlaceSetOfCodes(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     423procedure TfrmODGen.PlaceSetOfCodes(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    407424const
    408425  NUM_CHAR = 32;
     
    417434    TORComboBox(Editor).ListItemsOnly := True;
    418435    TORComboBox(Editor).Pieces := '2';
     436    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     437  //  TORComboBox(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    419438    Editor.SetBounds(FEditorLeft, FEditorTop, NUM_CHAR * FCharWd, HT_FRAME * FCharHt);
    420439    x := DialogItem.Domain;
     
    427446    TORComboBox(Editor).SelectByID(DialogItem.IDefault);
    428447    //TORComboBox(Editor).Text := DialogItem.EDefault;
    429     TORComboBox(Editor).Hint := DialogItem.HelpText;
     448    TORComboBox(Editor).RpcCall := DialogItem.HelpText;
    430449    if Length(DialogItem.HelpText) > 0 then TORComboBox(Editor).ShowHint := True;
    431450    TORComboBox(Editor).OnChange := ControlChange;
     
    435454end;
    436455
    437 procedure TfrmODGen.PlaceYesNo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     456procedure TfrmODGen.PlaceYesNo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    438457const
    439458  NUM_CHAR = 9;
     
    446465    TORComboBox(Editor).ListItemsOnly := True;
    447466    TORComboBox(Editor).Pieces := '2';
     467    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     468    //TORComboBox(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    448469    Editor.SetBounds(FEditorLeft, FEditorTop, NUM_CHAR * FCharWd, HT_FRAME * FCharHt);
    449470    TORComboBox(Editor).Items.Add('0^No');
     
    451472    TORComboBox(Editor).SelectByID(DialogItem.IDefault);
    452473    //TORComboBox(Editor).Text := DialogItem.EDefault;
    453     TORComboBox(Editor).Hint := DialogItem.HelpText;
     474    TORComboBox(Editor).RpcCall := DialogItem.HelpText;
    454475    if Length(DialogItem.HelpText) > 0 then TORComboBox(Editor).ShowHint := True;
    455476    TORComboBox(Editor).OnChange := ControlChange;
     
    459480end;
    460481
    461 procedure TfrmODGen.PlaceLookup(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     482procedure TfrmODGen.PlaceLookup(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    462483const
    463484  NUM_CHAR = 32;
     
    482503    TORComboBox(Editor).Pieces := '2';
    483504    TORComboBox(Editor).LongList := True;
     505     SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     506   // TORComboBox(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    484507    // 2nd bar piece of hint is not visible, hide xref, global ref, & screen code in tab pieces
    485     TORComboBox(Editor).Hint := DialogItem.HelpText + '|' + XRef + #9 + GblRef + #9 +
     508    TORComboBox(Editor).RpcCall := DialogItem.HelpText + '|' + XRef + #9 + GblRef + #9 +
    486509                                DialogItem.ScreenRef;
    487510    if ( compareText(TsID,DialogItem.Id)=0 ) or (compareText(TSDomain,DialogItem.Domain)=0)then
     
    538561begin
    539562  inherited;
    540   XRef := Piece(TORComboBox(Sender).Hint, '|', 2);
     563  XRef := Piece(TORComboBox(Sender).RpcCall, '|', 2);
    541564  GblRef    := Piece(XRef, #9, 2);
    542565  ScreenRef := Piece(XRef, #9, 3);
     
    545568end;
    546569
    547 procedure TfrmODGen.PlaceMemo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     570procedure TfrmODGen.PlaceMemo(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem; CurrentItemNumber: Integer);
    548571const
    549572  NUM_LINES = 3;
     
    556579                     sbxMain.Width - FEditorLeft - WD_MARGIN - GetSystemMetrics(SM_CXVSCROLL),
    557580                     (FCharHt * NUM_LINES) + HT_FRAME);
     581    SetComponentName(Editor, CurrentItemNumber, DialogCtrl);
     582   // TCaptionMemo(Editor).Name := DialogCtrl.ID + IntToStr(CurrentItemNumber);
    558583    TMemo(Editor).Text := DialogItem.EDefault;
    559584    TMemo(Editor).Hint := DialogItem.HelpText;
     
    574599
    575600procedure TfrmODGen.PlaceLabel(DialogCtrl: TDialogCtrl; DialogItem: TDialogItem);
     601var
     602  ht: integer;
    576603begin
    577604  with DialogCtrl do
     
    580607    Prompt.Parent := sbxMain;
    581608    Prompt.Caption := DialogItem.Prompt;
     609    ht := Prompt.Height;   // CQ#15849
     610    if ht < FCharHt then
     611      ht := FCharHt;
    582612    Prompt.AutoSize := False;
    583     Prompt.SetBounds(WD_MARGIN, FEditorTop + HT_LBLOFF, FLabelWd, FCharHt);
     613    Prompt.SetBounds(WD_MARGIN, FEditorTop + HT_LBLOFF, FLabelWd, ht);
    584614    Prompt.Alignment := taRightJustify;
    585615    Prompt.Visible := True;
     
    604634begin
    605635  inherited;
     636  TrimAllMemos;
    606637  Application.ProcessMessages;
    607   TrimAllMemos;
    608638end;
    609639
     
    632662end;
    633663
     664function TfrmODGen.SetComponentName(Editor: TWinControl; Index: Integer; DialogCtrl: TDialogCtrl): Boolean;
     665Var
     666 I: Integer;
     667 SaveName: String;
     668begin
     669 //strip all non alphanumeric characters to create the save name
     670 SaveName := '';
     671 //Check for blank id
     672 if DialogCtrl.ID = '' then DialogCtrl.ID := 'EMPTY';
     673
     674 for i := 1 to length(DialogCtrl.ID) do begin
     675   if (DialogCtrl.ID[i] in ['A'..'Z']) or (DialogCtrl.ID[i] in ['a'..'z']) or (DialogCtrl.ID[i] in ['0'..'9']) then
     676    SaveName := SaveName + DialogCtrl.ID[i];
     677 end;
     678 SaveName := SaveName + '_' + IntToStr(Index);
     679
     680 //extra backup - make sure that the component name doesn't already exist
     681 //Now set up the component name
     682 try
     683  Editor.Name := SaveName;
     684 except
     685  Editor.Name := SaveName + '_' + IntToStr(Index);
     686 end;
     687end;
     688
    634689end.
    635690
Note: See TracChangeset for help on using the changeset viewer.