maintenance: title: FORM_VTE_SCHEDULING ;; mlmname: FORM_VTE_SCHEDULING;; arden: version 2.5;; version: 1.00;; institution: St.Clair Hospital ;; author: Sandy Zhang ;; specialist: ;; date: 2017-10-26;; validation: testing;; library: purpose: Automatic scheduling of VTE Prophylaxis Meds (enoxaparin 30mg Q12 and Q24, enoxaparin 40mg Q24H, heparin, and rivaroxaban 10mg) ;; explanation: Change history 10.26.2017 SZ Created for CSR #33689 - CPOE-VTE auto schedule ;; keywords: Automatic Medication Scheduling, VTE Scheduling ;; citations: ;; knowledge: type: data-driven;; data: standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; (this_communication,this_form,client_info_obj) := argument; worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent; error_message:=""; field_list := this_form.fields; comm_primary_obj := this_communication.PrimaryObj; order_set_name := comm_primary_obj.OrderSetName; order_name := comm_primary_obj.Name; continue_processing := false; // Restrict who sees the "valdation" alerts userguid := this_communication.userguid; useridcode:= read last {" Select idcode from cv3user with (nolock) where guid = " || SQL(userguid)}; FireOnUser:= ("tspicuzzatest","dwarnicktest","ageorgulistest","dbellissimotest"); ClientGuid := this_communication.ClientGUID; VisitGuid := this_communication.ClientVisitGUID; ChartGuid := this_communication.ChartGuid; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; CurrentMinute:= extract minute NOW; CurrentHour := extract hour NOW; NextHour := extract hour NOW + 1; HourAfterNext:= extract hour NOW + 2; Included_Orders := ("Heparin Inj", "Enoxaparin Inj", "Rivaroxaban 10mg Tab"); // GATHER INFORMATION ABOUT THIS ORDER Frequency := last of (field_list where field_list.DataItemName = "frequencycode"); FrequencyValue := Frequency.Value; Route := last of (field_list where field_list.DataItemName = "orderroutecode"); RouteValue := Route.Value; RequestedTime:= last of (field_list where field_list.DataItemName = "RequestedTime"); RequestedTimeValue := RequestedTime.value; RequestedDate:= last of (field_list where field_list.DataItemName = "RequestedDate"); Dose:= last of (field_list where field_list.DataItemName = "DosageLow"); UOM:= last of (field_list where field_list.DataItemName = "Uom"); if (order_name = "Heparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q8H" or FrequencyValue.FrequencySummary = "Q12H" or FrequencyValue.FrequencySummary = "Q6H") and (uom.Value = "units") then continue_processing := true; found_heparin := "yay we found heparin SQ 5000 units Q8 or Q12"; endif; if (order_name = "Enoxaparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q24H") and (dose.Value = 40) and (uom.Value = "mg") then continue_processing := true; found_enoxaparin_40 := "yay we found enoxaparin SQ 40mg Q24"; endif; if (order_name = "Enoxaparin Inj") and (Route.Value = "SQ") and (FrequencyValue.FrequencySummary = "Q12H" or FrequencyValue.FrequencySummary = "Q24H") and (dose.Value = 30) and (uom.Value = "mg") then continue_processing := true; found_enoxaparin_30 := "yay we found enoxaparin SQ 30mg Q12 or Q24"; endif; if (order_name = "Rivaroxaban 10mg Tab") and (FrequencyValue.FrequencySummary = "Q24H") then continue_processing := true; found_rivaroxaban_10 := "yay we found rivaroxaban 10mg Q24"; endif; if ( continue_processing = true ) then checkpoint_1 := "continue_processing = true"; // insert time when form is closing and there{{{SINGLE-QUOTE}}}s NO scheduled time If (CallingEvent = "FormClose") and (not exist RequestedTimeValue.ReqTimeValue) then checkpoint_2 := "form is closing and there{{{SINGLE-QUOTE}}}s NO scheduled time"; // Gather information about the drug (DrugKey, TherapeuticCategory, ExcludedClassType, PrimaryTherapeuticCategory) := read last { " select dm.DrugKey, ocmi.TherapeuticCategory , " || " ( select top 1 ctv.Value " || " from cv3catalogclasstypevalue ctv with (nolock) " || " join CV3ClassType ct on ct.guid = ctv.ClassTypeGUID and ct.code = {{{SINGLE-QUOTE}}}PRX_AutoSched_Exclude_for_MLM{{{SINGLE-QUOTE}}} and ct.UserDictionaryCode = {{{SINGLE-QUOTE}}}Medication_Auto_Scheduling{{{SINGLE-QUOTE}}} " || " where ctv.Value = {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} and ctv.catalogmasterguid = " || this_communication.ItemID || " ) " || " ,case when CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory) > 0 " || " then substring (ocmi.TherapeuticCategory, 1, CHARINDEX ({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},ocmi.TherapeuticCategory)-2)" || " else ocmi.TherapeuticCategory " || " end " || " from CV3OrderCatalogMasterItem ocmi with (nolock) " || " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid " || " where ocmi.guid = " || this_communication.ItemID || " " }; // Gather information about the frequency // Determine Frequency Interval ( "Q3H" = "3" & "hr(s)" ) (FrequencyInterval,FrequencyTimeUOM) := read last { " select timefromvalue,TimeUom from CV3Frequency with (nolock) " || " where code = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}}" }; // Determine if it is a QxH Frequency If FrequencyValue.FrequencySummary matches pattern "Q%H" then FrequencyQxH := "Yes"; else FrequencyQxH := "No"; endif; // Determine Schedule Type ("A" = "Fixed" start time...BID,QHS etc... "S" = "Variable" start time....Q4H, Q8H etc...) ScheduleType := read last { " select case when SUBSTRING(value,CHARINDEX({{{SINGLE-QUOTE}}}|{{{SINGLE-QUOTE}}},Value)+1,LEN(1)) = {{{SINGLE-QUOTE}}}A{{{SINGLE-QUOTE}}} then {{{SINGLE-QUOTE}}}Fixed{{{SINGLE-QUOTE}}} else {{{SINGLE-QUOTE}}}Variable{{{SINGLE-QUOTE}}} end " || " from CV3UserDictionaryValue with (nolock) " || " WHERE UserDictionaryCode = {{{SINGLE-QUOTE}}}PRX_Dosing Frequency{{{SINGLE-QUOTE}}} AND Active = 1 AND Value like {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "%{{{SINGLE-QUOTE}}} " }; // Convert the Frequency Code to Doses Per Day (DosesPerDay) := read last { " select count (fsd.ScheduledTime) from CV3CodedFreqTranslation cft with (nolock) " || " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid " || " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and " || " FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 " }; // For the selected Frequency, find the first dose of the day and next scheduled dose today (NextScheduledDoseTomorrow,NextScheduledDoseToday) := read last { " select top 1 " || " (select top 1 fsdx.ScheduledTime from CV3FixedScheduleDefinition fsdx with (nolock) where fsdx.ParentGUID = cft.guid " || " order by fsdx.ScheduledTime), " || " (select top 1 fsdy.ScheduledTime from CV3FixedScheduleDefinition fsdy with (nolock) where fsdy.ParentGUID = cft.guid " || " and fsdy.ScheduledTime > REPLACE(CONVERT(VARCHAR(5), GETDATE(), 108), {{{SINGLE-QUOTE}}}:{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}}) " || " order by fsdy.ScheduledTime ) " || " from CV3CodedFreqTranslation cft with (nolock) " || " join CV3FixedScheduleDefinition fsd with (nolock) on fsd.ParentGUID = cft.guid " || " where cft.FrequencyCode = {{{SINGLE-QUOTE}}}" || FrequencyValue.FrequencySummary || "{{{SINGLE-QUOTE}}} and FrequencyClass = {{{SINGLE-QUOTE}}}{{{SINGLE-QUOTE}}} and cft.active = 1 " }; // If there are no more scheduled doses for today, use the first scheduled dose tomorrow If NextScheduledDoseToday is not null then NextScheduledDoseTime:= NextScheduledDoseToday; NextScheduledDoseDay := "today"; NextScheduledDoseDate:= (Now) FORMATTED WITH "%.2t"; else NextScheduledDoseTime:= NextScheduledDoseTomorrow; NextScheduledDoseDay := "tomorrow"; NextScheduledDoseDate:= (Now + 1 day) FORMATTED WITH "%.2t"; endif; // format from 1600 to 16:00 and 900 to 09:00 NextScheduledDoseTime:= NextScheduledDoseTime formatted with "%4.4d"; // Zero Pad to 4 characters (900 becomes 0900) NextScheduledDoseTime:= (SUBSTRING 2 CHARACTERS STARTING AT 1 FROM NextScheduledDoseTime) || ":" || // hours (SUBSTRING 2 CHARACTERS STARTING AT 3 FROM NextScheduledDoseTime); // minutes // -------------------------------------## Main Algorithm ##-------------------------------------------------- // ------------------ CHECK #1 ------------------ // Proceed if this is not a "one-time" order and not in a Hold session If (FrequencyInterval is not null and ScheduleType is not null and worksheetinfo.sessiontype <> "Hold" ) then checkpoint_3 := "order is not a one-time order and not in a Hold session"; // GATHER INFORMATION ABOUT MOST RECENTLY ADMINISTERED ORDER (past 1 days) OF THE SAME CATEGORY (ExistingOrderLastGiven, ExistingOrderFrequency, ExistingOrderHoursSinceGiven, ExistingOrderName, ExistingOrderTherapeuticCategory, ExistingOrderDrugKey, ExistingRoute, ExistingNextTaskPending, ExistingNextTaskCanceled, ExistingOrderDose, ExistingOrderDoseUOM) := read last { " select oto.performedfromdtm, o.FrequencyCode, datediff (HH, oto.performedfromdtm, getdate()), " || " o.name, ocmi.TherapeuticCategory, dm.DrugKey, ot.OrderRoute " || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) " || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid " || " and oto2.SignificantDtm > getdate()-1 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}) " || " ,(select top 1 oto2.SignificantDtm from cv3ordertaskoccurrence oto2 with (nolock) " || " where oto2.clientguid = ot.clientguid and oto2.orderguid = o.guid and oto2.ordertaskguid = ot.guid " || " and oto2.SignificantDtm > getdate()-1 and oto2.taskstatuscode = {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}), oto.TaskDose, oto.TaskUom " || " from cv3ordercatalogmasteritem ocmi with (nolock) " || " join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid " || " join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid " || " and o.ClientGUID = " || ClientGuid || " " || " and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}" || TherapeuticCategory || "{{{SINGLE-QUOTE}}} " || " join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid " || " join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid " || " and oto.ordertaskguid = ot.guid and oto.SignificantDtm > getdate()-1 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} " || " order by oto.performedfromdtm " }; ExistingOrderDose := ExistingOrderDose as number; (ExistingOrderInterval) := read last {"select timefromvalue from CV3Frequency with (nolock) where code = {{{SINGLE-QUOTE}}}" || ExistingOrderFrequency || "{{{SINGLE-QUOTE}}}"}; ExistingNextTaskPendingDate:= ExistingNextTaskPending FORMATTED WITH "%.2t"; ExistingNextTaskPendingTime:= extract hour ExistingNextTaskPending || ":" || extract minute ExistingNextTaskPending; ExistingNextTaskCanceledDate:= ExistingNextTaskCanceled FORMATTED WITH "%.2t"; ExistingNextTaskCanceledTime:= extract hour ExistingNextTaskCanceled || ":" || extract minute ExistingNextTaskCanceled; // Determine how the order compares to the most recently charted order of the same therapeutic category DrugMatch := "No"; FrequencyMatch:= "No"; RouteMatch := "No"; DoseMatch := "No"; UOMMatch := "No"; matching_drug_cluster := "No"; // ------------------ CHECK #2 ------------------ // Searches patient chart for an order that matches the "Included_Orders" list index_list_included_orders := 1 seqto (count Included_Orders); matching_drug_list := (); // loops existing orders for patient to see if there{{{SINGLE-QUOTE}}}s a match to "Included_Orders" list for J in index_list_included_orders do current_order_lookup := Included_Orders[J]; // looks back 1 day to see if there{{{SINGLE-QUOTE}}}s a previous order that was administered and matches the drug cluster list. name_of_matching_drug := read last { "select ocmi.Name from cv3ordercatalogmasteritem ocmi with (nolock) join cv3drugmapping dm with (nolock) on dm.catalogitemguid = ocmi.guid join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid and oto.ordertaskguid = ot.guid and oto.SignificantDtm > getdate()-1 and oto.taskstatuscode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} where o.ClientGUID = " || sql(ClientGuid) || "and o.chartguid = " || sql(ChartGuid) || "and o.clientvisitguid = " || sql(VisitGuid) || "and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}" || TherapeuticCategory || "{{{SINGLE-QUOTE}}} and ocmi.Name like {{{SINGLE-QUOTE}}}%" || current_order_lookup || "%{{{SINGLE-QUOTE}}}" }; if (exist name_of_matching_drug) then check_2 := "Yes"; matching_drug_list := matching_drug_list || name_of_matching_drug; endif; enddo; if (exist matching_drug_list) then matching_drug_cluster := "Yes"; // move on to check #3 endif; if (matching_drug_cluster = "No") then Scenario := "1"; // move to scheduling routine If ScheduleType = "Variable" then // variable is example: Q8H BID = Fixed TargetHour := NextHour; // move to scheduling routine TargetDate := NOW; else // Fixed Start Time = BID, QD, QHS RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time"; RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime; RequestedDate.Value := NextScheduledDoseDate; endif; endif; //if (matching_drug_cluster = "No") then // ------------------ end of CHECK #2 ------------------ // current Drug{{{SINGLE-QUOTE}}}s key matches existing order{{{SINGLE-QUOTE}}}s drug key if (DrugKey = ExistingOrderDrugKey) or (order_name = ExistingOrderName) then DrugMatch := "Yes"; endif; if FrequencyValue.FrequencySummary = ExistingOrderFrequency then FrequencyMatch := "Yes"; endif; if RouteValue = ExistingRoute then RouteMatch := "Yes"; endif; if dose.Value = ExistingOrderDose then DoseMatch := "Yes"; endif; if uom.Value = ExistingOrderDoseUOM then UOMMatch := "Yes"; endif; if (matching_drug_cluster = "Yes") then // carried over from check #2 // potential issue here is that SQL // ------------------ CHECK #3 ------------------ if (DrugMatch = "Yes") then check_3 := "yes"; // ------------------ CHECK #4 ------------------ if (FrequencyMatch = "Yes") then check_4 := "No - Continue new order where previous order left off"; Scenario := "2"; // Same Drug / Same Frequency // continue new order with same schedule as old order If ExistingNextTaskPending is not null then TargetHour := extract hour ExistingNextTaskPending; // this is the next scheduled dose TargetDate := ExistingNextTaskPending; else TargetHour := extract hour ExistingNextTaskCanceled; TargetDate := ExistingNextTaskCanceled; endif; // if targethour is null then take lastgiven + frequencyinterval if (not exist TargetHour) then TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval; TargetDate := ExistingOrderLastGiven; endif; else // Yes path for part of CHECK #4 // schedule new order for last charted DTM + duration of new frequency check_4 := "Yes - Schedule new order for last charted DTM + Duration of new frequency"; Scenario := "3"; // Same Drug / Different Frequency / QxH TargetHour := extract hour ExistingOrderLastGiven + FrequencyInterval; TargetDate := ExistingOrderLastGiven; endif;// end of CHECK #4 // if (FrequencyMatch = "Yes") then else // part of CHECK #3 // if (DrugMatch = "Yes") then check_3 := "No"; // see if previous order (not-matching current order) was a "one time" order // ------------------ CHECK #5 ------------------ // Different Drug // One-Time Dose?? If (ExistingOrderInterval is null) then // For Q12H, ExistingOrderInterval = 12. For BID, ExistingOrderInterval = 2. For Now, STAT, Once, ExistingOrderInterval = NULL // Different Drug / One-Time Dose - Yes check_5 := "Yes"; // ------------------ CHECK #6 ------------------ // check if last dose charted was heparin if (ExistingOrderName = "Heparin Inj") then check_6 := "Yes"; Scenario := "4"; // schedule new order 8 hour after last charted DTM TargetHour := extract hour ExistingOrderLastGiven + 8; TargetDate := ExistingOrderLastGiven; else check_6 := "No"; Scenario := "5"; // schedule new order 24 hour after last charted DTM TargetHour := extract hour ExistingOrderLastGiven + 24; TargetDate := ExistingOrderLastGiven; endif; //if (ExistingOrderName = "Heparin Inj") // ------------------ end of CHECK #6 ------------------ else // part of Check #5 // If (ExistingOrderInterval is null) then previous order{{{SINGLE-QUOTE}}}s last charted dose is a one-time order // For Now, STAT, Once, ExistingOrderInterval = NULL // Different Drug / One-Time Dose - No check_5 := "No"; // ------------------ CHECK #7 ------------------ If (ExistingOrderHoursSinceGiven > ExistingOrderInterval) then // Different Drug / Not One-Time Dose / Outside the Span check_7 := "No"; Scenario := "7"; If ScheduleType = "Variable" then // Variable Start Time TargetHour := NextHour; TargetDate := NOW; else // Fixed Start Time RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time"; RequestedTimeValue.ReqTimeValue := NextScheduledDoseTime; RequestedDate.Value := NextScheduledDoseDate; endif; else // within span check_7 := "Yes"; Scenario := "6"; // Different Drug / Not One-Time Dose / Within the Span If ExistingNextTaskPending is not null then ExistingNextTaskTime := ExistingNextTaskPendingTime; ExistingNextTaskDate := ExistingNextTaskPendingDate; ExistingNextTaskDTM := ExistingNextTaskPending FORMATTED WITH "%.4t"; CalculatedHour:= extract hour ExistingNextTaskPending; RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time"; RequestedTimeValue.ReqTimeValue := ExistingNextTaskTime; RequestedDate.Value := ExistingNextTaskDate; elseif ExistingNextTaskCanceledDate is not null then ExistingNextTaskTime := ExistingNextTaskCanceledTime; ExistingNextTaskDate := ExistingNextTaskCanceledDate; ExistingNextTaskDTM := ExistingNextTaskCanceled FORMATTED WITH "%.4t"; CalculatedHour:= extract hour ExistingNextTaskCanceled; RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time"; RequestedTimeValue.ReqTimeValue := ExistingNextTaskTime; RequestedDate.Value := ExistingNextTaskDate; else TargetHour := extract hour ExistingOrderLastGiven + ExistingOrderInterval; TargetDate := ExistingOrderLastGiven; endif; // Is there a Pending task (if not use next Canceled task) endif; // Check #7 //If (ExistingOrderHoursSinceGiven > ExistingOrderInterval) then endif; // Check #5 // If (ExistingOrderInterval is null) then // ------------------ end of CHECK #5 ------------------ // is last dose charted a "one time" order? endif;// end of CHECK #3 // if (DrugMatch = "Yes") then endif; // if (matching_drug_cluster = "Yes") then // carried over from check #2 endif; // CHECK #1 // If (FrequencyInterval is not null and // -------------------------------------## end of Main Algorithm ##-------------------------------------------------- // -------------------------------------## Scheduling Routine ##-------------------------------------------------- // SCHEDULED TIME ADJUSTMENTS - for variable start time frequencies If TargetHour is not null and FrequencyTimeUOM = "hr(s)" then // Adjust for Calculated Dose Hour greater than 24 (next dose falls after midnight today) If (TargetHour < 24) then // CalculatedHour := TargetHour formatted with "%2.2d"; 09.22.2017 DW HD# 2763521 This formatting introduced on 6/1/2015 created an issue with the top of the hour >=45 scheuling programming. CalculatedHour := TargetHour; ElseIf (TargetHour >= 24 and TargetHour < 48) then CalculatedHour := TargetHour - 24; TargetDate := TargetDate + 1 day; ElseIf (TargetHour >= 48) then CalculatedHour := TargetHour - 48; TargetDate := TargetDate + 2 day; endif; // Adjust for Calculated Dose Time that is in the past...begin now (existing med has missed recent doses) TimeNow := (extract year NOW) FORMATTED WITH "%2.2d" || (extract month NOW) FORMATTED WITH "%2.2d" || (extract day NOW) FORMATTED WITH "%2.2d" || (extract hour NOW) FORMATTED WITH "%2.2d" || (extract minute NOW) FORMATTED WITH "%2.2d"; TimeScheduled:= (extract year TargetDate) FORMATTED WITH "%2.2d" || (extract month TargetDate) FORMATTED WITH "%2.2d" || (extract day TargetDate) FORMATTED WITH "%2.2d" || CalculatedHour FORMATTED WITH "%2.2d" || "00"; if TimeScheduled < TimeNow then CalculatedHour :=NextHour; TargetDate := NOW; endif; // Adjust for Administration time calculated for < 15 minutes...offset the time by an hour If CurrentMinute >= 45 and CalculatedHour = (EXTRACT HOUR Now) +1 then CalculatedHour := CalculatedHour + 1; Scenario := Scenario || " B"; else CalculatedHour := CalculatedHour ; Scenario := Scenario || " A"; endif; // The Adjustments could have placed the start time to after midnight....if so, adjust date and hour If CalculatedHour >= 24 then CalculatedHour := CalculatedHour - 24; a := "in calc hour"; TargetDate := TargetDate + 1 day; endif; // Format the date and time as required by the form fields CalculatedTime := CalculatedHour || ":00"; CalculatedDate := TargetDate FORMATTED WITH "%.2t"; // Send the calculated time to the order form field RequestedTimeValue.ReqTimeCode := "Scheduled/Start Time"; RequestedTimeValue.ReqTimeValue := CalculatedTime; RequestedDate.Value := CalculatedDate; endif; // Target Time (variable hourly shedules) // -------------------------------------## end of Scheduling Routine ##-------------------------------------------------- endif; // If (CallingEvent = "FormClose") and (not exist RequestedTimeValue.ReqTimeValue) then endif; // if ( continue_processing = true ) then ;; priority: 50 ;; evoke: // no evoke ;; logic: conclude true; ;; action: return this_communication, this_form; ;; Urgency: 50;; end: