I have also noted that when Immunization is given, on exiting form, it is required to post in Inventory file and that is where error shows up sometime. I am showing my code here:
===================
On Exit
//var vLoop as int var vLot as String var vCode as String var vDescription as String var vManufacturer as String var vExpDate as String var vQuantity as Int var vProc as String var vCombvaccine as String
var vVaccineCode as String
var vList as String var vImmEntry as String
Subroutine IndividualVaccine (vstring as String)
var vLoop as Int var vRSHandle as Int var vNoOfRecords as Int var vNDC as String var vVISDate as String
vRSHandle = @XResultSetSearch(@FN, "Inventory", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!QAH=>0", "!ExpDate=>" + (@Date-1), "!VaccineCode=" + vString) if(vRSHandle > -1) { vNoOfRecords = @XResultSetTotal(vRSHandle) //WriteLN ("Total Records: " + @Str (vNoofRecords)) XResultSetSort (vRSHandle, "ExpDate:-1") //for vLoop = 1 to vNoOfRecords XResultSetCurrentPosition(vRSHandle, 1)
vCode = @XResultSetValue(vRSHandle, "VaccineCode") //WriteLN ("This is vCode Value: " + vCode) if vCode = vString then {
vDescription = @XResultSetValue(vRSHandle, "Description") vNDC = @XResultSetValue(vRSHandle, "NDC") vManufacturer = @XResultSetValue(vRSHandle, "Manufacturer") vLot = @XResultSetValue(vRSHandle, "LotNumber") vExpDate = @XResultSetValue(vRSHandle, "ExpDate") vExpDate = udf_formatDate (vExpDate)
vVISDate = @XResultSetValue(vRSHandle, "VISDate") vVISDate = udf_formatDate (vVISDate)
vQuantity = @XResultSetValue(vRSHandle, "QAH") vQuantity = vQuantity - 1 xResultsetValue (vRSHandle, "QAH", vQuantity)
If vImmEntry = "" then {
vImmEntry = vDescription +", " + "NDC: " + vNDC + ", " + "Manufacturer: " + vManufacturer + ", " + "Lot#: " + vLot + ", " + "Expiratory Date: " + vExpDate + ", " + "VIS Date: " + vVISDate } Else if vImmEntry <> "" then { vImmEntry = vImmEntry + @NewLine ( ) + vDescription +", " + "NDC: " + vNDC + ", " + "Manufacturer: " + vManufacturer + ", " + "Lot#: " + vLot + ", " + "Expiratory Date: " + vExpDate + ", " + "VIS Date: " + vVISDate
}
//WriteLN (vDescription +", " + "Manufacturer: " + vManufacturer + ", " + "Lot#: " + vLot + ", " + "Expiratory Date: " + vExpDate) //vProc = Proc // vProc = @Del (vProc, @In (vProc, vCode), 1) //WriteLN ("Remaining Procedure Codes: " + vProc)
} //vLastName = @XResultSetValue(vRSHandle, "Last") //WriteLn(@Str(vLoop) + " Of " + @Str(vNoOfRecords) + " First: " + vFirstName + " Last: " + vLastName) //next XResultSetClose(vRSHandle) }
End SubRoutine
If @IsNew and DN <> "" and Not @IsBlank (IMM) and Not @ISBlank (D1) then //Last Three conditions are to prevent misfiring
{
vList = @XListValues (@FN, "Inventory!VaccineCode") //writeLn (vList) for n = 1 to @Len (vProc) vVaccinecode = @Mid(vProc, n, 1) If @FindStringArray (vList, vVaccineCode) > 0 then { IndividualVaccine (vVaccineCode) //WriteLN ("You were Here") } Next If @In (IMM, vImmEntry) < 1 then {
IMM = IMM + @NewLine ( ) + vImmEntry } PrintLabOrder (vImmEntry) //This routine is in Global Code
}
================================================
Subroutine below is posted from GlobalCode:
Subroutine PrintLabOrder ( vString as String) var vFont as String = " Times New Roman" var vFontsize as Int = 17 var vDiag1 as String = @Right (cond1, 6) var vDiag2 as String = @Right (cond2, 6) var vDiag3 as String = @Right (cond3, 6) var vName as String var vAddress as String var vDate as string var vMedicareNumber as String var vMedicaidNumber as String var vEx as String var vBD as String var vSex as String var vAge as String var vPhone as String var vCopy as Int = 2 var n as Int //var vPrinter as String = "\\Vital\HP5L" var vPrinter as String = @GlobalValue ("PrintLab") //var vPrinter as String = "DocuCom PDF Driver"
var vImm as String
For n = 2 to 10 SetThisElement ("D" + @str (n)) If vImm <> "" then { if ThisElement <> "" then { vImm = vImm + ", " + ThisElement } } Else { vImm = ThisElement } UnsetThisElement ( ) next
vAddress = @xlookup (@FN, RecNumber, "Index!RecNumber", "Address") + ", " + @xlookup (@FN, RecNumber, "Index!RecNumber", "City") + ", " + @xlookup (@FN, RecNumber, "Index!RecNumber", "ST") + " " + @xlookup (@FN, RecNumber, "Index!RecNumber", "Zip")
vName = @xlookup (@FN, RecNumber, "Index!RecNumber", "P_LastName") + ", " + @xlookup (@FN, RecNumber, "Index!RecNumber", "First") + " " + @xlookup (@FN, RecNumber, "Index!RecNumber", "MI")
vDate = @Mid (date1, 6,2) + "/" + @Right (date1, 2) + "/" + @Mid (date1, 3, 2) vBD = @Mid (BD, 6,2) + "/" + @Right (BD, 2) + "/" + @Mid (BD, 3, 2)
vSex = @Left (Sex, 1)
If @in (Age, "Years") > 0 then { vAge = @Replace (Age, "Years", "Y") } Else If @in (Age, "Year") > 0 then { vAge = @Replace (Age, "Year", "M") } Else If @in (Age, "Months") > 0 then { vAge = @Replace (Age, "Months", "M") } Else If @in (Age, "Month") > 0 then { vAge = @Replace (Age, "Month", "M") }
If Ins1 = "M" then { vMedicareNumber = RecNumber } Else { vMedicareNumber = "" }
If Ins1 = "P" then { vMedicaidNumber = RecNumber } Else if Ins2 = "P" then { vMedicaidNumber = @xlookup (@FN, RecNumber, "Index!RecNumber", "ID2") } If vMedicaidNumber <> "" then { vMedicaidNumber = vMedicaidNumber + @xlookup (@FN, RecNumber, "Index!RecNumber", "Chart") }
vEx = @xlookup (@FN, RecNumber, "Index!RecNumber", "vEx")
vPhone = @xlookup (@FN, RecNumber, "Index!RecNumber", "Phone") For n = 1 to vCopy
RestoreDefaultPrinter() AlternateDefaultPrinter (vPrinter) NewPage (850, 1100) PrintPagePaper (28) //value, xpos, ypos, coln width, Font, Fontsize, Measureonly, Alignment PrintString (vString, 45, 25, 0, vFont,12, 0) If Tine <> "" and (@IsBlank (D2) or @IsBlank (D3) ) then { PrintString (Tine, 45, @PageExtentY ( ), 0, vFont,vFontsize, 0) } PrintString (vImm, 45, @PageExtentY ( ), 0, vFont, 12, 0) PrintString (vDiag1, 478, 120, 0, vFont, vFontsize, 0) PrintString (vDiag3, 600, 120, 0, vFont, vFontsize, 0) PrintSTring (DN, 135,135, 0, vFont, vFontsize, 0) PrintString (vDiag2, 478, 135, 0, vFont, vFontsize, 0) PrintString (vName, 35, 245, 0, vFont, vFontsize, 0) PrintString (vBD, 488, 245, 0, vFont, vFontsize, 0) PrintString (vAddress, 50, 275, 0, vFont, vFontsize, 0) PrintString (vAge, 25, 310, 0, vFont, vFontsize, 0) PrintString (vSex, 80, 310, 0, vFont, vFontsize, 0) PrintString (vDate, 260, 310, 0, vFont, vFontsize, 0) PrintString (@Time, 435, 310, 0, vFont, vFontsize, 0) PrintString (vPhone, 100, 340, 0, vFont, vFontsize, 0) PrintString (vMedicareNumber, 70, 415, 0, vFont, vFontsize, 0) PrintString (vEX, 250, 415, 0, vFont, vFontsize, 0) PrintString (vMedicaidNumber, 310, 415, 0, vFont, vFontsize, 0) PrintString (Lab, 112, 810, 700, vFont, vFontsize, 0) FinishPage( ) RestoreDefaultPrinter()
Next
End SubRoutine
========================
Thanks, Bharat
|