Procedure

TfrmODMeds.SetOnQuickOrder

Module

fODMeds

Last Modified

7/15/2014 3:26:42 PM

Visibility

Private

Owner

TfrmODMeds

Declaration

procedure SetOnQuickOrder;

Calls Hierarchy


TfrmODMeds.SetOnQuickOrder
 ├TResponses.InstanceCount
 ├TResponses.NextInstance
 ├TfrmODMeds.SetDosage
 ├TResponses.IValueFor
 ├TResponses.SetControl
 │ ├TResponses.FindResponseByName
 │ └AssignBPText
 │   ├DisplayGroupToLinkType
 │   │ └DisplayGroupByName
 │   ├TResponses.EValueFor
 │   ├GetServiceIEN
 │   ├TResponses.IValueFor
 │   ├GetProcedureIEN
 │   ├ExpandOrderObjects
 │   │ ├TdmodShared.BoilerplateOK
 │   │ │ ├ErrCount
 │   │ │ ├AddErr
 │   │ │ └TdmodShared.LoadTIUObjects
 │   │ │   └GetObjectList
 │   │ └GetTemplateText
 │   │   └TEncounter.GetVisitStr
 │   │     └TEncounter.GetVisitCategory
 │   ├SetTemplateDialogCanceled
 │   ├CheckBoilerplate4Fields
 │   ├ExecuteTemplateOrBoilerPlate
 │   └WasTemplateDialogCanceled
 ├TfrmODMeds.SetSchedule
 ├TfrmODMeds.ValueOf
 │ ├GetSingleDoseSchedule
 │ ├GetSingleDoseScheduleEX
 │ ├TfrmODMeds.FieldsForDose
 │ │ └TfrmODMeds.ConstructedDoseFields
 │ ├TfrmODMeds.FieldsForDrug
 │ ├GetComplexDoseSchedule
 │ │ └TfrmODMeds.ValFor
 │ └GetComplexDoseScheduleEX
 │   └TfrmODMeds.ValFor
 ├TfrmODMeds.DispOrderMessage
 ├DispenseMessage
 ├QuantityMessage
 ├TfrmODMeds.chkDoseNowClick
 │ └TfrmODMeds.ControlChange
 │   ├TResponses.Clear
 │   ├TResponses.Update
 │   │ ├TResponses.FindResponseByName
 │   │ └TResponses.IENForPrompt
 │   ├TfrmODMeds.FindCommonDrug
 │   │ ├TfrmODMeds.FindDoseFields
 │   │ ├SaveDrug
 │   │ └KillDrug
 │   ├TfrmODMeds.ConstructedDoseFields
 │   ├TfrmODMeds.ValueOf...
 │   ├TfrmODMeds.lblAdminSchGetText
 │   ├TfrmODMeds.ValFor
 │   ├TfrmODMeds.InpatientSig
 │   │ ├TfrmODMeds.ValueOf...
 │   │ └TfrmODMeds.CheckDecimal
 │   │   └TfrmODMeds.TextDosage
 │   ├TfrmODMeds.OutpatientSig
 │   │ ├TfrmODMeds.ValueOf...
 │   │ └TfrmODMeds.CheckDecimal...
 │   └TResponses.GetOrderText
 │     ├TResponses.NextInstance
 │     ├TResponses.FindResponseByName
 │     ├TResponses.FormatResponse
 │     │ └TResponses.FindResponseByIEN
 │     └TResponses.AppendChildren
 │       ├TResponses.FindPromptByIEN
 │       ├TResponses.FindResponseByIEN
 │       └TResponses.FormatResponse...
 ├TResponses.FindResponseByName
 ├TfrmODMeds.SetPickup
 ├QOHasRouteDefined
 ├GetPickupForLocation
 ├NameOfDGroup
 │ └LoadDGroupMap
 ├TfrmODMeds.ValueOfResponse
 │ └TResponses.IValueFor
 └TfrmODMeds.UpdateStartExpires
   ├TfrmODMeds.ValFor
   ├TfrmODMeds.lblAdminSchSetText
   ├TfrmODMeds.lblAdminSchGetText
   ├LoadAdminInfo
   ├FMToday
   │ └FMNow
   └TfrmODMeds.DisplayDoseNow

Called-By Hierarchy


 TfrmODMeds.SetOnQuickOrder
   TfrmODMeds.SetupDialog┤ 
TfrmODMeds.btnSelectClick┘ 
TfrmODMeds.UMDelayClick┘   

Calls

Name Declaration Comments
TfrmODMeds.chkDoseNowClick procedure chkDoseNowClick(Sender: TObject); -
DispenseMessage function DispenseMessage(AnIEN: Integer): string; -
TfrmODMeds.DispOrderMessage procedure DispOrderMessage(const AMessage: string); -
TResponses.FindResponseByName function FindResponseByName(const APromptID: string; AnInstance: Integer): TResponse; -
GetPickupForLocation function GetPickupForLocation(const Loc: string): string; -
TResponses.InstanceCount function InstanceCount(const APromptID: string): Integer; -
TResponses.IValueFor function IValueFor(const APromptID: string; AnInstance: Integer): string; -
NameOfDGroup function NameOfDGroup(IEN: Integer): string; -
TResponses.NextInstance function NextInstance(const APromptID: string; LastInstance: Integer): Integer; -
QOHasRouteDefined function QOHasRouteDefined(AQOID: integer): boolean; -
QuantityMessage function QuantityMessage(AnIEN: Integer): string; -
TResponses.SetControl procedure SetControl(AControl: TControl; const APromptID: string; AnInstance: Integer); -
TfrmODMeds.SetDosage procedure SetDosage(const x: string); -
TfrmODMeds.SetPickup procedure SetPickup(const x: string); -
TfrmODMeds.SetSchedule procedure SetSchedule(const x: string); -
TfrmODMeds.UpdateStartExpires procedure UpdateStartExpires(const CurSchedule: string); -
TfrmODMeds.ValueOf function ValueOf(FieldID: Integer; ARow: Integer = -1): string; -
TfrmODMeds.ValueOfResponse function ValueOfResponse(FieldID: Integer; AnInstance: Integer = 1): string; -

Called-By

Name Declaration Comments
TfrmODMeds.btnSelectClick procedure btnSelectClick(Sender: TObject); -
TfrmODMeds.SetupDialog procedure SetupDialog(OrderAction: Integer; const ID: string); override; -


Source

1851  procedure TfrmODMeds.SetOnQuickOrder;
1852  var
1853    AResponse: TResponse;
1854    x,LocRoute,TempSch,DispGrp, SchType: string;
1855    i, DispDrug: Integer;
1856  begin
1857    // txtMed already set by SetOnMedSelect
1858    with Responses do
1859    begin
1860      if (InstanceCount('INSTR') > 1) or (InstanceCount('DAYS') > 0) then // complex dose
1861      begin
1862        grdDoses.RowCount := HigherOf(InstanceCount('INSTR')+2, 4);
1863        i := Responses.NextInstance('INSTR', 0);
1864        while i > 0 do
1865        begin
1866          SetDosage(IValueFor('INSTR', i));
1867          with cboDosage do
1868            //agp change QO code to populate the Grid with the same fields after selection CQ 15933
1869            //if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex]
1870            if ItemIndex > -1 then x := Piece(Text, TAB, 1) + TAB + Items[ItemIndex]
1871           else x := IValueFor('INSTR',i); //AGP Change 26.41 for CQ 9102 PSI-05-015 affect copy and edit functionality
1872          grdDoses.Cells[COL_DOSAGE, i] := x;
1873          SetControl(cboRoute,  'ROUTE', i);
1874          with cboRoute do
1875            if ItemIndex > -1 then x := Text + TAB + Items[ItemIndex] else x := Text;
1876          grdDoses.Cells[COL_ROUTE,  i] := x;
1877          SetSchedule(UpperCase(IValueFor('SCHEDULE', i)));
1878          if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = True) then cboSchedule.ItemIndex := -1;
1879          x := cboSchedule.Text;
1880          if chkPRN.Checked then x := x + ' PRN';
1881          with cboSchedule do
1882            if ItemIndex > -1 then x := x + TAB + Items[ItemIndex];
1883          grdDoses.Cells[COL_SCHEDULE, i] := x;
1884          if chkPRN.Checked = True then grdDoses.Cells[COL_CHKXPRN,i] := '1';
1885          grdDoses.Cells[COL_DURATION, i] := IValueFor('DAYS', i);
1886          if FInptDlg then
1887            begin
1888              if IValueFor('ADMIN', i) <> '' then grdDoses.Cells[COL_ADMINTIME, i] := IValueFor('ADMIN', i)
1889              else if (cboSchedule.ItemIndex > -1) and (chkPRN.Checked = false) then
1890                 grdDoses.Cells[COL_ADMINTIME, i] := Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex],U,4)
1891              else grdDoses.Cells[COL_ADMINTIME, i] := '';
1892              if grdDoses.Cells[COL_ADMINTIME, i] = '' then grdDoses.Cells[COL_ADMINTIME, i] := 'Not Defined';
1893              if FAdminTimeText <> '' then grdDoses.Cells[COL_ADMINTIME, i] := FAdminTimeText;
1894              //done to prevent admin time showing up in schedules that should not have admin times. Also remove Not Defined for schedule
1895              //should not show the admin time
1896              if (cboSchedule.ItemIndex > -1) or (chkPRN.Checked = True) then
1897                begin
1898                  SchType := '';
1899                  if (cboSchedule.ItemIndex > -1) then SchType := Piece(cboSchedule.Items.Strings[cboSchedule.itemIndex],U,3);
1900                  if (SchType = 'P') or (SchType = 'O') or (SchType = 'OC') or (ChkPRN.Checked = True) then
1901                    grdDoses.Cells[COL_ADMINTIME, i] := '';
1902                end;
1903            end;
1904          chkPRN.Checked := false;
1905          if      IValueFor('CONJ', i) = 'A' then x := 'AND'
1906          else if IValueFor('CONJ', i) = 'T' then x := 'THEN'
1907          else if IValueFor('CONJ', i) = 'X' then x := 'EXCEPT'
1908          else x := '';
1909          grdDoses.Cells[COL_SEQUENCE, i] := x;
1910          i := Responses.NextInstance('INSTR', i);
1911        end; {while}
1912      end else                                      // single dose
1913      begin
1914        if FIsQuickOrder then
1915        begin
1916          FQODosage := IValueFor('INSTR', 1);
1917          SetDosage(FQODosage);
1918          TempSch := cboSchedule.Text;
1919        end
1920        else
1921          SetDosage(IValueFor('INSTR', 1));
1922        SetControl(cboRoute,  'ROUTE',     1);
1923        SetSchedule(UpperCase(IValueFor('SCHEDULE',  1)));
1924        if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = False) then
1925        begin
1926          cboSchedule.SelectByID(TempSch);
1927          cboSchedule.Text := TempSch;
1928        end;
1929        if (cboSchedule.Text = '') and (FIsQuickOrder) and (NSSchedule = True) then cboSchedule.ItemIndex := -1;
1930        if ((cboSchedule.Text = 'OTHER') and FIsQuickOrder)  then
1931           FNSSOther := True;
1932        DispDrug := StrToIntDef(ValueOf(FLD_DRUG_ID), 0);
1933        if Length(ValueOf(FLD_QTYDISP))>10 then
1934        begin
1935          lblQuantity.Caption := Copy(ValueOf(FLD_QTYDISP),0,7) + '...';
1936          lblQuantity.Hint := ValueOf(FLD_QTYDISP);
1937        end;
1938        if DispDrug > 0 then
1939        begin
1940          DispOrderMessage(DispenseMessage(DispDrug));
1941          x := QuantityMessage(DispDrug);
1942        end;
1943        if Length(x) > 0
1944          then lblQtyMsg.Caption := TX_QTY_PRE + x + TX_QTY_POST
1945          else lblQtyMsg.Caption := '';
1946      end;
1947      SetControl(memComment ,  'COMMENT',  1);
1948      SetControl(cboPriority,  'URGENCY',  1);
1949      if FInptDlg then
1950      begin
1951        SetControl(chkDoseNow, 'NOW', 1);
1952        chkDoseNowClick(Self);
1953      end else
1954      begin
1955        SetControl(txtSupply,   'SUPPLY',  1);
1956        txtSupply.Text := Trim(txtSupply.Text);
1957        spnSupply.Position   := StrToIntDef(txtSupply.Text, 0);
1958        { setting .Tag=1 was commented out because xfer & change were not auto-calculating }
1959        //if spnSupply.Position <> 0 then txtSupply.Tag   := 1;
1960        if Length(IValueFor('QTY',1))>0 then
1961        begin
1962          FQOQuantity := StrToFloat(IValueFor('QTY',1));
1963          txtQuantity.Text := FloatToStr(FQOQuantity);
1964        end;
1965        SetControl(txtQuantity, 'QTY',     1);
1966        SetControl(txtRefills,  'REFILLS', 1);
1967        spnRefills.Position  := StrToIntDef(txtRefills.Text, 0);
1968        AResponse := Responses.FindResponseByName('PICKUP', 1);
1969        if AResponse <> nil then SetPickup(AResponse.IValue);
1970        if (FIsQuickOrder) and (FOrderAction = ORDER_QUICK) then
1971        begin
1972          if not QOHasRouteDefined(Responses.QuickOrder) then
1973          begin
1974            LocRoute := GetPickupForLocation(IntToStr(Encounter.Location));
1975            SetPickup(LocRoute);
1976          end;
1977        end;
1978        DispGrp := NameOfDGroup(Responses.DisplayGroup);
1979        if (AResponse = nil) or ((StrToIntDef(Piece(Responses.CopyOrder,';',1),0)>0) and AnsiSameText('Out. Meds',DispGrp)) then
1980        begin
1981          LocRoute := GetPickupForLocation(IntToStr(Encounter.Location));
1982          SetPickup(LocRoute);
1983        end;
1984        if ValueOf(FLD_PICKUP) = '' then SetPickup(FLastPickup);
1985  //      AResponse := Responses.FindResponseByName('SC',     1);
1986        Responses.FindResponseByName('SC',     1);
1987      end; {if FInptDlg..else}
1988    end; {with}
1989   if (FInptDlg) then
1990    begin
1991      x := ValueOfResponse(FLD_SCHEDULE, 1);
1992      if Length(x) > 0 then UpdateStartExpires(x);
1993    end;
1994  end;