378. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/22/2018 1:29:26 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

378.1 Files compared

# Location File Last Modified
1 v1603_release_60.zip\CRM_solutions\VCCMResources.zip\WebResources ftp_RequestJScriptMHVMedicationRefillGridjs88C29F49-31FB-E711-812D-1289A8FDD3DA Tue May 22 14:39:24 2018 UTC
2 v1603_release_60.zip\CRM_solutions\VCCMResources.zip\WebResources ftp_RequestJScriptMHVMedicationRefillGridjs88C29F49-31FB-E711-812D-1289A8FDD3DA Fri Jun 8 21:34:29 2018 UTC

378.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1168
Changed 1 2
Inserted 0 0
Removed 0 0

378.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

378.4 Active regular expressions

No regular expressions were active.

378.5 Comparison detail

  1   /// <refer ence path= "../../JSc ript/VCCM. MHVHelper. js" />
  2   /// <refer ence path= "../../JSc ript/VCCM. USDHelper. js" />
  3  
  4   var track_ popUpData  = null,
  5       _selec tedMedData Item = nul l;
  6  
  7   var testPr escription Data = { " ErrorOccur red": fals e, "ErrorM essage": n ull, "Stat us": null,  "DebugInf o": null,  "Data": [{  "Mhv": {  "Prescript ionList":  [{ "IsRefi llable": f alse, "IsT rackable":  true, "Pr escription Id": "4661 695", "Ref illStatus" : "submitt ed", "Refi llRemainin g": "3", " RefillSubm itDate": " Tue, 27 Fe b 2018 16: 57:41 EST" , "Dispens edDate": " Fri, 23 Fe b 2018 00: 00:00 EST" , "Quantit y": "120",  "Facility Name": "SL C4", "Stat ionNumber" : "991", " Prescripti onNumber":  "3636178" , "Prescri ptionName" : "ACETAMI NOPHEN 500 MG TAB" }] , "ErrorOc cured": fa lse, "Erro rMessage":  null }, " FacilityCo de": "991" , "Facilit yName": "S LC4 TEST L AB", "Fill s": [{ "Da ysSupplyDi spensed":  "30", "Dis penseDate" : "2018022 3", "Quant ityDispens ed": "120" , "Release Date": "20 180223", " Routing":  "M" }], "D osages": [ { "Dose":  "500 MG",  "RelativeS tart": "0" , "Relativ eStop": "5 27040", "R outeName":  "PO", "Un its": "MG" , "Schedul eName": "Q 6H PRN" }] , "LastFil led": "201 80223", "L astFilledD ate": "000 1-01-01T00 :00:00", " LocalId":  "5520457;O ", "MedSta tus": "urn :sct:55561 003", "Med StatusName ": "active ", "MedTyp e": "urn:s ct:7363900 0", "Name" : "ACETAMI NOPHEN 500 MG TAB", " Orders": [ { "DaysSup ply": "30" , "FillCos t": ".6",  "FillsAllo wed": "3",  "FillsRem aining": " 3", "Order Uid": "urn :va:order: F0E0:94362 3:17420603 ", "Ordere d": "20180 1051210",  "Pharmacis tName": "V CCMPHYSICI ANONE,FIRS T", "Pharm acistUid":  "urn:va:u ser:F0E0:5 9920", "Pr edecessor" : null, "P rescriptio nId": "363 6178", "Pr oviderName ": "VCCMPH YSICIANONE ,FIRST", " ProviderUi d": "urn:v a:user:F0E 0:59920",  "QuantityO rdered": " 120", "VaR outing": " M" }], "Ov erallStart ": "201802 23", "Over allStop":  "20190224" , "Patient Instructio n": "NOT M ORE THAN F OUR (4) GR AMS of ACE TAMINOPHEN  PER DAY ( 8 TABLETS) . COMMENT  01/5/18",  "ProductFo rmName": " TAB", "Pro ducts": [] , "Qualifi edName": " ACETAMINOP HEN 500MG  TAB", "Sig ": "TAKE O NE TABLET  BY MOUTH E VERY SIX ( 6) HOURS,  IF NEEDED  NOT MORE T HAN FOUR ( 4) GRAMS O F ACETAMIN OPHEN PER  DAY (8 TAB LETS). COM MENT 01/5/ 18", "Stop ped": "201 90224", "T ype": "Pre scription" , "Uid": " urn:va:med :F0E0:9436 23:1742060 3", "VaSta tus": "ACT IVE", "VaT ype": "O"  }, { "Mhv" : { "Presc riptionLis t": [{ "Is Refillable ": false,  "IsTrackab le": false , "Prescri ptionId":  "4661696",  "RefillSt atus": "su bmitted",  "RefillRem aining": " 2", "Refil lSubmitDat e": "Tue,  27 Feb 201 8 16:57:41  EST", "Di spensedDat e": null,  "Quantity" : "1", "Fa cilityName ": "SLC4",  "StationN umber": "9 91", "Pres criptionNu mber": "36 36179", "P rescriptio nName": "I NSULIN SYR INGE 0.5ML  LOW DOSE  29G 0.5IN"  }], "Erro rOccured":  false, "E rrorMessag e": null } , "Facilit yCode": "6 60", "Faci lityName":  "SALT LAK E CITY HCS ", "Fills" : [{ "Days SupplyDisp ensed": "1 ", "Dispen seDate": " 20180223",  "Quantity Dispensed" : "1", "Re leaseDate" : "", "Rou ting": "W"  }], "Dosa ges": [{ " Dose": "",  "Relative Start": "0 ", "Relati veStop": " 527040", " RouteName" : "SC", "U nits": "",  "Schedule Name": "2X WEEK" }],  "LastFille d": "20180 223", "Las tFilledDat e": "0001- 01-01T00:0 0:00", "Lo calId": "5 520458;O",  "MedStatu s": "urn:s ct:5556100 3", "MedSt atusName":  "active",  "MedType" : "urn:sct :73639000" , "Name":  "BD INSULI N 0.5ML 29 G 0.5in SY RINGE/NDL" , "Orders" : [{ "Days Supply": " 1", "FillC ost": ".04 ", "FillsA llowed": " 2", "Fills Remaining" : "2", "Or derUid": " urn:va:ord er:F0E0:94 3623:17420 608", "Ord ered": "20 1801051551 ", "Pharma cistName":  "VCCMPHYS ICIANONE,F IRST", "Ph armacistUi d": "urn:v a:user:F0E 0:59920",  "Predecess or": null,  "Prescrip tionId": " 3636179",  "ProviderN ame": "VCC MPHYSICIAN ONE,FIRST" , "Provide rUid": "ur n:va:user: F0E0:59920 ", "Quanti tyOrdered" : "1", "Va Routing":  "W" }], "O verallStar t": "20180 223", "Ove rallStop":  "20190224 ", "Patien tInstructi on": "", " ProductFor mName": "S YRINGE/NDL ", "Produc ts": [], " QualifiedN ame": "BD  INSULIN 0. 5ML 29G 0. 5in SYRING E/NDL", "S ig": "USE  SYRINGE AN D NEEDLE(S ) UNDER TH E SKIN TWO  (2) TIMES  PER WEEK" , "Stopped ": "201902 24", "Type ": "Prescr iption", " Uid": "urn :va:med:F0 E0:943623: 17420608",  "VaStatus ": "ACTIVE ", "VaType ": "O" },  { "Mhv": {  "Prescrip tionList":  [], "Erro rOccured":  false, "E rrorMessag e": null } , "Facilit yCode": "6 60", "Faci lityName":  "SALT LAK E CITY HCS ", "Fills" : [], "Dos ages": [{  "Dose": "8 50 MG", "R elativeSta rt": "0",  "RelativeS top": "432 00", "Rout eName": "P O", "Units ": "MG", " ScheduleNa me": "BID  W/FOOD (2X DAILY)" }] , "LastFil led": null , "LastFil ledDate":  "0001-01-0 1T00:00:00 ", "LocalI d": "23943 13S;O", "M edStatus":  "urn:sct: 73425007",  "MedStatu sName": "n ot active" , "MedType ": "urn:sc t:73639000 ", "Name":  "METFORMI N HCL 850M G TAB,ORAL ", "Orders ": [{ "Day sSupply":  "30", "Fil lCost": nu ll, "Fills Allowed":  "1", "Fill sRemaining ": null, " OrderUid":  "urn:va:o rder:F0E0: 943623:174 20609", "O rdered": " 2018010516 02", "Phar macistName ": null, " Pharmacist Uid": null , "Predece ssor": nul l, "Prescr iptionId":  null, "Pr oviderName ": "VCCMPH YSICIANONE ,FIRST", " ProviderUi d": "urn:v a:user:F0E 0:59920",  "QuantityO rdered": " 60", "VaRo uting": "W " }], "Ove rallStart" : null, "O verallStop ": null, " PatientIns truction":  "", "Prod uctFormNam e": "TAB,O RAL", "Pro ducts": [] , "Qualifi edName": " METFORMIN  HCL 850MG  TAB,ORAL",  "Sig": "T AKE ONE TA BLET BY MO UTH TWO (2 ) TIMES PE R DAY, WIT H FOOD", " Stopped":  null, "Typ
  8   e": "Presc ription",  "Uid": "ur n:va:med:F 0E0:943623 :17420609" , "VaStatu s": "PENDI NG", "VaTy pe": "O" } , { "Mhv":  { "Prescr iptionList ": [{ "IsR efillable" : false, " IsTrackabl e": true,  "Prescript ionId": "4 661694", " RefillStat us": "subm itted", "R efillRemai ning": "4" , "RefillS ubmitDate" : "Tue, 27  Feb 2018  16:57:41 E ST", "Disp ensedDate" : "Fri, 23  Feb 2018  00:00:00 E ST", "Quan tity": "16 0", "Facil ityName":  "SLC4", "S tationNumb er": "991" , "Prescri ptionNumbe r": "36361 77", "Pres criptionNa me": "ACET AMINOPHEN  160MG/5ML  ALC-F LIQU ID" }], "E rrorOccure d": false,  "ErrorMes sage": nul l }, "Faci lityCode":  "660", "F acilityNam e": "SALT  LAKE CITY  HCS", "Fil ls": [{ "D aysSupplyD ispensed":  "15", "Di spenseDate ": "201802 05", "Quan tityDispen sed": "160 ", "Releas eDate": "2 0180223",  "Routing":  "M" }, {  "DaysSuppl yDispensed ": "15", " DispenseDa te": "2018 0223", "Qu antityDisp ensed": "1 60", "Rele aseDate":  "", "Routi ng": "M" } ], "Dosage s": [{ "Do se": "", " RelativeSt art": "0",  "Relative Stop": "52 7040", "Ro uteName":  "PO", "Uni ts": "", " ScheduleNa me": "Q6H"  }], "Last Filled": " 20180223",  "LastFill edDate": " 0001-01-01 T00:00:00" , "LocalId ": "552045 6;O", "Med Status": " urn:sct:55 561003", " MedStatusN ame": "act ive", "Med Type": "ur n:sct:7363 9000", "Na me": "ACET AMINOPHEN  160MG/5ML  LIQUID,ORA L", "Order s": [{ "Da ysSupply":  "15", "Fi llCost": " 2.08", "Fi llsAllowed ": "5", "F illsRemain ing": "4",  "OrderUid ": "urn:va :order:F0E 0:943623:1 7420693",  "Ordered":  "20180223 1441", "Ph armacistNa me": "EDWA RDS,DARIAN  A", "Phar macistUid" : "urn:va: user:F0E0: 59953", "P redecessor ": null, " Prescripti onId": "36 36177", "P roviderNam e": "VCCMP HYSICIANTW O,SECOND",  "Provider Uid": "urn :va:user:F 0E0:59921" , "Quantit yOrdered":  "160", "V aRouting":  "M" }], " OverallSta rt": "2018 0205", "Ov erallStop" : "2019020 6", "Patie ntInstruct ion": "NOT  MORE THAN  FOUR (4)  GRAMS OF A CETAMINOPH EN PER DAY ", "Produc tFormName" : "LIQUID, ORAL", "Pr oducts": [ ], "Qualif iedName":  "ACETAMINO PHEN 160MG /5ML LIQUI D,ORAL", " Sig": "TAK E 1/2 TEAS POONFUL (8 0 MGS/2.5  MLS) BY MO UTH, DRINK  ENTIRE AM OUNT EVERY  SIX (6) H OURS NOT M ORE THAN F OUR (4) GR AMS OF ACE TAMINOPHEN  PER DAY",  "Stopped" : "2019020 6", "Type" : "Prescri ption", "U id": "urn: va:med:F0E 0:943623:1 7420693",  "VaStatus" : "ACTIVE" , "VaType" : "O" }, {  "Mhv": {  "Prescript ionList":  [{ "IsRefi llable": f alse, "IsT rackable":  false, "P rescriptio nId": "466 1693", "Re fillStatus ": "submit ted", "Ref illRemaini ng": "11",  "RefillSu bmitDate":  "Tue, 27  Feb 2018 1 6:57:41 ES T", "Dispe nsedDate":  "Fri, 02  Feb 2018 0 0:00:00 ES T", "Quant ity": "5",  "Facility Name": "SL C4", "Stat ionNumber" : "991", " Prescripti onNumber":  "3636176" , "Prescri ptionName" : "LISINOP RIL 5MG TA B" }], "Er rorOccured ": false,  "ErrorMess age": null  }, "Facil ityCode":  "660", "Fa cilityName ": "SALT L AKE CITY H CS", "Fill s": [{ "Da ysSupplyDi spensed":  "10", "Dis penseDate" : "2018020 2", "Quant ityDispens ed": "5",  "ReleaseDa te": "2018 0202", "Ro uting": "M " }], "Dos ages": [{  "Dose": "2 .5 MG", "R elativeSta rt": "0",  "RelativeS top": "508 320", "Rou teName": " PO", "Unit s": "MG",  "ScheduleN ame": "QDA Y" }], "La stFilled":  "20180202 ", "LastFi lledDate":  "0001-01- 01T00:00:0 0", "Local Id": "5520 455;O", "M edStatus":  "urn:sct: 55561003",  "MedStatu sName": "a ctive", "M edType": " urn:sct:73 639000", " Name": "LI SINOPRIL 5 MG TAB", " Orders": [ { "DaysSup ply": "10" , "FillCos t": ".255" , "FillsAl lowed": "1 1", "Fills Remaining" : "11", "O rderUid":  "urn:va:or der:F0E0:9 43623:1742 0692", "Or dered": "2 0180223143 6", "Pharm acistName" : "EDWARDS ,DARIAN A" , "Pharmac istUid": " urn:va:use r:F0E0:599 53", "Pred ecessor":  null, "Pre scriptionI d": "36361 76", "Prov iderName":  "VCCMPHYS ICIANTWO,S ECOND", "P roviderUid ": "urn:va :user:F0E0 :59921", " QuantityOr dered": "5 ", "VaRout ing": "M"  }], "Overa llStart":  "20180202" , "Overall Stop": "20 190121", " PatientIns truction":  "", "Prod uctFormNam e": "TAB",  "Products ": [], "Qu alifiedNam e": "LISIN OPRIL 5MG  TAB", "Sig ": "TAKE O NE-HALF TA BLET BY MO UTH EVERY  DAY", "Sto pped": "20 190121", " Type": "Pr escription ", "Uid":  "urn:va:me d:F0E0:943 623:174206 92", "VaSt atus": "AC TIVE", "Va Type": "O"  }, { "Mhv ": { "Pres criptionLi st": [], " ErrorOccur ed": false , "ErrorMe ssage": nu ll }, "Fac ilityCode" : "660", " FacilityNa me": "SALT  LAKE CITY  HCS", "Fi lls": [],  "Dosages":  [{ "Dose" : "150 MG" , "Relativ eStart": " 0", "Relat iveStop":  "0", "Rout eName": "P O", "Units ": "MG", " ScheduleNa me": "BID  (2XDAILY)"  }], "Last Filled": n ull, "Last FilledDate ": "0001-0 1-01T00:00 :00", "Loc alId": "1N ;O", "MedS tatus": "u rn:sct:555 61003", "M edStatusNa me": "acti ve", "MedT ype": "urn :sct:32950 5003", "Na me": "RANI TIDINE HCL  150MG TAB ", "Orders ": [{ "Day sSupply":  null, "Fil lCost": nu ll, "Fills Allowed":  null, "Fil lsRemainin g": null,  "OrderUid" : "urn:va: order:F0E0 :943623:17 420465", " Ordered":  "201706261 122", "Pha rmacistNam e": null,  "Pharmacis tUid": nul l, "Predec essor": nu ll, "Presc riptionId" : null, "P roviderNam e": "VCCMP HYSICIANTW O,SECOND",  "Provider Uid": "urn :va:user:F 0E0:59921" , "Quantit yOrdered":  null, "Va Routing":  null }], " OverallSta rt": null,  "OverallS top": null , "Patient Instructio n": null,  "ProductFo rmName": " TAB", "Pro ducts": [] , "Qualifi edName": " RANITIDINE  HCL 150MG  TAB", "Si g": "TAKE  ONE TABLET  BY MOUTH  TWO (2) TI MES A DAY"
  9   , "Stopped ": null, " Type": "OT C", "Uid":  "urn:va:m ed:F0E0:94 3623:17420 465", "VaS tatus": "A CTIVE", "V aType": "N " }, { "Mh v": { "Pre scriptionL ist": [{ " IsRefillab le": false , "IsTrack able": fal se, "Presc riptionId" : "4659991 ", "Refill Status": " refillinpr ocess", "R efillRemai ning": "1" , "RefillS ubmitDate" : "Thu, 22  Feb 2018  15:59:49 E ST", "Disp ensedDate" : "Thu, 25  Jan 2018  00:00:00 E ST", "Quan tity": "30 ", "Facili tyName": " SLC4", "St ationNumbe r": "991",  "Prescrip tionNumber ": "363613 1", "Presc riptionNam e": "TRETI NOIN 0.01%  TOP GEL"  }], "Error Occured":  false, "Er rorMessage ": null },  "Facility Code": "66 0", "Facil ityName":  "SALT LAKE  CITY HCS" , "Fills":  [{ "DaysS upplyDispe nsed": "90 ", "Dispen seDate": " 20170626",  "Quantity Dispensed" : "30", "R eleaseDate ": "201801 25", "Rout ing": "W"  }, { "Days SupplyDisp ensed": "9 0", "Dispe nseDate":  "20180125" , "Quantit yDispensed ": "30", " ReleaseDat e": "", "R outing": " M" }, { "D aysSupplyD ispensed":  "90", "Di spenseDate ": "201804 15", "Quan tityDispen sed": "30" , "Release Date": "",  "Routing" : "M" }],  "Dosages":  [{ "Dose" : "", "Rel ativeStart ": "0", "R elativeSto p": "43200 ", "RouteN ame": "",  "Units": " ", "Schedu leName": " QHS(BEDTIM E)" }], "L astFilled" : "2018041 5", "LastF illedDate" : "0001-01 -01T00:00: 00", "Loca lId": "552 0406;O", " MedStatus" : "urn:sct :55561003" , "MedStat usName": " active", " MedType":  "urn:sct:7 3639000",  "Name": "T RETINOIN 0 .01% 15GM  GEL,TOP",  "Orders":  [{ "DaysSu pply": "90 ", "FillCo st": "20.7 3", "Fills Allowed":  "3", "Fill sRemaining ": "1", "O rderUid":  "urn:va:or der:F0E0:9 43623:1742 0464", "Or dered": "2 0170626111 3", "Pharm acistName" : "DAVIS,N ANCY E", " Pharmacist Uid": "urn :va:user:F 0E0:59919" , "Predece ssor": nul l, "Prescr iptionId":  "3636131" , "Provide rName": "V CCMPHYSICI ANTWO,SECO ND", "Prov iderUid":  "urn:va:us er:F0E0:59 921", "Qua ntityOrder ed": "30",  "VaRoutin g": "W" }] , "Overall Start": "2 0170626",  "OverallSt op": "2018 0627", "Pa tientInstr uction": " TAKE AS DI RECTED BY  PHYSICIAN" , "Product FormName":  "GEL,TOP" , "Product s": [], "Q ualifiedNa me": "TRET INOIN 0.01 % 15GM GEL ,TOP", "Si g": "APPLY  APPLICATI ON(S) TO T HE AFFECTE D AREA AT  BEDTIME FO R 30 DAYS  TAKE AS DI RECTED BY  PHYSICIAN" , "Stopped ": "201806 27", "Type ": "Prescr iption", " Uid": "urn :va:med:F0 E0:943623: 17420464",  "VaStatus ": "ACTIVE ", "VaType ": "O" },  { "Mhv": {  "Prescrip tionList":  [{ "IsRef illable":  false, "Is Trackable" : false, " Prescripti onId": "46 59992", "R efillStatu s": "submi tted", "Re fillRemain ing": "3",  "RefillSu bmitDate":  "Tue, 27  Feb 2018 1 6:57:41 ES T", "Dispe nsedDate":  null, "Qu antity": " 22", "Faci lityName":  "SLC4", " StationNum ber": "991 ", "Prescr iptionNumb er": "3636 130", "Pre scriptionN ame": "ZOL MITRIPTAN  2.5MG TAB  PKG 6" }],  "ErrorOcc ured": fal se, "Error Message":  null }, "F acilityCod e": "660",  "Facility Name": "SA LT LAKE CI TY HCS", " Fills": [{  "DaysSupp lyDispense d": "90",  "DispenseD ate": "201 70626", "Q uantityDis pensed": " 22", "Rele aseDate":  "", "Routi ng": "W" } ], "Dosage s": [{ "Do se": "2.5  MG", "Rela tiveStart" : "0", "Re lativeStop ": "43200" , "RouteNa me": "PO",  "Units":  "MG", "Sch eduleName" : "5XWEEK"  }], "Last Filled": " 20170626",  "LastFill edDate": " 0001-01-01 T00:00:00" , "LocalId ": "552040 5;O", "Med Status": " urn:sct:55 561003", " MedStatusN ame": "act ive", "Med Type": "ur n:sct:7363 9000", "Na me": "ZOLM ITRIPTAN 2 .5MG TAB",  "Orders":  [{ "DaysS upply": "9 0", "FillC ost": "417 .12", "Fil lsAllowed" : "3", "Fi llsRemaini ng": "3",  "OrderUid" : "urn:va: order:F0E0 :943623:17 420463", " Ordered":  "201706261 110", "Pha rmacistNam e": "DAVIS ,NANCY E",  "Pharmaci stUid": "u rn:va:user :F0E0:5991 9", "Prede cessor": n ull, "Pres criptionId ": "363613 0", "Provi derName":  "VCCMPHYSI CIANTWO,SE COND", "Pr oviderUid" : "urn:va: user:F0E0: 59921", "Q uantityOrd ered": "22 ", "VaRout ing": "W"  }], "Overa llStart":  "20170626" , "Overall Stop": "20 180627", " PatientIns truction":  "MAY BE R EPEATED AF TER TWO (2 ) HOURS, B UT NO MORE  THEN FOUR  (4) DOSES  WITHIN 24  HOUR PERI OD.", "Pro ductFormNa me": "TAB" , "Product s": [], "Q ualifiedNa me": "ZOLM ITRIPTAN 2 .5MG TAB",  "Sig": "T AKE ONE TA BLET BY MO UTH FIVE ( 5) TIMES P ER WEEK FO R 30 DAYS  MAY BE REP EATED AFTE R TWO (2)  HOURS, BUT  NO MORE T HEN FOUR ( 4) DOSES W ITHIN 24 H OUR PERIOD .", "Stopp ed": "2018 0627", "Ty pe": "Pres cription",  "Uid": "u rn:va:med: F0E0:94362 3:17420463 ", "VaStat us": "ACTI VE", "VaTy pe": "O" } , { "Mhv":  { "Prescr iptionList ": [{ "IsR efillable" : false, " IsTrackabl e": false,  "Prescrip tionId": " 4659990",  "RefillSta tus": "ref illinproce ss", "Refi llRemainin g": "1", " RefillSubm itDate": " ", "Dispen sedDate":  "Thu, 25 J an 2018 00 :00:00 EST ", "Quanti ty": "30",  "Facility Name": "SL C4", "Stat ionNumber" : "991", " Prescripti onNumber":  "3636129" , "Prescri ptionName" : "METFORM IN HCL 500 MG SA TAB"  }], "Erro rOccured":  false, "E rrorMessag e": null } , "Facilit yCode": "6 60", "Faci lityName":  "SALT LAK E CITY HCS ", "Fills" : [{ "Days SupplyDisp ensed": "9 0", "Dispe nseDate":  "20170626" , "Quantit yDispensed ": "30", " ReleaseDat e": "20180 125", "Rou ting": "W"  }, { "Day sSupplyDis pensed": " 90", "Disp enseDate":  "20180125 ", "Quanti tyDispense d": "30",  "ReleaseDa te": "", " Routing":  "M" }, { " DaysSupply Dispensed" : "90", "D ispenseDat e": "20180 415", "Qua ntityDispe nsed": "30 ", "Releas eDate": "" , "Routing ": "M" }],
  10    "Dosages" : [{ "Dose ": "", "Re lativeStar t": "0", " RelativeSt op": "4320 0", "Route Name": "PO ", "Units" : "", "Sch eduleName" : "QPM(EVE NING)" }],  "LastFill ed": "2018 0415", "La stFilledDa te": "0001 -01-01T00: 00:00", "L ocalId": " 5520404;O" , "MedStat us": "urn: sct:555610 03", "MedS tatusName" : "active" , "MedType ": "urn:sc t:73639000 ", "Name":  "METFORMI N HCL 500M G TAB,SA",  "Orders":  [{ "DaysS upply": "9 0", "FillC ost": "1.7 1", "Fills Allowed":  "3", "Fill sRemaining ": "1", "O rderUid":  "urn:va:or der:F0E0:9 43623:1742 0462", "Or dered": "2 0170626110 7", "Pharm acistName" : "DAVIS,N ANCY E", " Pharmacist Uid": "urn :va:user:F 0E0:59919" , "Predece ssor": nul l, "Prescr iptionId":  "3636129" , "Provide rName": "V CCMPHYSICI ANTWO,SECO ND", "Prov iderUid":  "urn:va:us er:F0E0:59 921", "Qua ntityOrder ed": "30",  "VaRoutin g": "W" }] , "Overall Start": "2 0170626",  "OverallSt op": "2018 0627", "Pa tientInstr uction": " TAKE WITH  EVENING ME AL", "Prod uctFormNam e": "TAB,S A", "Produ cts": [],  "Qualified Name": "ME TFORMIN HC L 500MG TA B,SA", "Si g": "TAKE  1 BY MOUTH  EVERY EVE NING FOR 3 0 DAYS TAK E WITH EVE NING MEAL" , "Stopped ": "201806 27", "Type ": "Prescr iption", " Uid": "urn :va:med:F0 E0:943623: 17420462",  "VaStatus ": "ACTIVE ", "VaType ": "O" },  { "Mhv": {  "Prescrip tionList":  [], "Erro rOccured":  false, "E rrorMessag e": null } , "Facilit yCode": "6 60", "Faci lityName":  "SALT LAK E CITY HCS ", "Fills" : [{ "Days SupplyDisp ensed": "3 0", "Dispe nseDate":  "20170615" , "Quantit yDispensed ": "15", " ReleaseDat e": "", "R outing": " W" }, { "D aysSupplyD ispensed":  "30", "Di spenseDate ": "201801 25", "Quan tityDispen sed": "15" , "Release Date": "",  "Routing" : "M" }],  "Dosages":  [{ "Dose" : "50 MG",  "Relative Start": "0 ", "Relati veStop": " 43200", "R outeName":  "PO", "Un its": "MG" , "Schedul eName": "Q DAY" }], " LastFilled ": "201802 14", "Last FilledDate ": "0001-0 1-01T00:00 :00", "Loc alId": "55 20395;O",  "MedStatus ": "urn:sc t:73425007 ", "MedSta tusName":  "not activ e", "MedTy pe": "urn: sct:736390 00", "Name ": "LOSART AN POTASSI UM 100MG T AB", "Orde rs": [{ "D aysSupply" : "30", "F illCost":  "3.6", "Fi llsAllowed ": "11", " FillsRemai ning": "10 ", "OrderU id": "urn: va:order:F 0E0:943623 :17420448" , "Ordered ": "201706 150914", " Pharmacist Name": "DA VIS,NANCY  E", "Pharm acistUid":  "urn:va:u ser:F0E0:5 9919", "Pr edecessor" : null, "P rescriptio nId": "363 6120", "Pr oviderName ": "VCCMPH YSICIANONE ,FIRST", " ProviderUi d": "urn:v a:user:F0E 0:59920",  "QuantityO rdered": " 15", "VaRo uting": "W " }], "Ove rallStart" : "2017061 5", "Overa llStop": " 20180616",  "PatientI nstruction ": "TAKE A S DIRECTED  ", "Produ ctFormName ": "TAB",  "Products" : [], "Qua lifiedName ": "LOSART AN POTASSI UM 100MG T AB", "Sig" : "TAKE ON E-HALF TAB LET BY MOU TH EVERY D AY FOR 30  DAYS TAKE  AS DIRECTE D", "Stopp ed": "2018 02231453",  "Type": " Prescripti on", "Uid" : "urn:va: med:F0E0:9 43623:1742 0448", "Va Status": " DISCONTINU ED", "VaTy pe": "O" } , { "Mhv":  { "Prescr iptionList ": [], "Er rorOccured ": false,  "ErrorMess age": null  }, "Facil ityCode":  "660", "Fa cilityName ": "SALT L AKE CITY H CS", "Fill s": [{ "Da ysSupplyDi spensed":  "30", "Dis penseDate" : "2017061 5", "Quant ityDispens ed": "30",  "ReleaseD ate": "",  "Routing":  "W" }], " Dosages":  [{ "Dose":  "", "Rela tiveStart" : "0", "Re lativeStop ": "15840" , "RouteNa me": "PO",  "Units":  "", "Sched uleName":  "QPM(EVENI NG)" }], " LastFilled ": "201706 15", "Last FilledDate ": "0001-0 1-01T00:00 :00", "Loc alId": "55 20394;O",  "MedStatus ": "urn:sc t:73425007 ", "MedSta tusName":  "not activ e", "MedTy pe": "urn: sct:736390 00", "Name ": "METFOR MIN HCL 50 0MG TAB,SA ", "Orders ": [{ "Day sSupply":  "30", "Fil lCost": "1 .71", "Fil lsAllowed" : "11", "F illsRemain ing": "11" , "OrderUi d": "urn:v a:order:F0 E0:943623: 17420447",  "Ordered" : "2017061 50911", "P harmacistN ame": "DAV IS,NANCY E ", "Pharma cistUid":  "urn:va:us er:F0E0:59 919", "Pre decessor":  null, "Pr escription Id": "3636 119", "Pro viderName" : "VCCMPHY SICIANONE, FIRST", "P roviderUid ": "urn:va :user:F0E0 :59920", " QuantityOr dered": "3 0", "VaRou ting": "W"  }], "Over allStart":  "20170615 ", "Overal lStop": "2 0180616",  "PatientIn struction" : "TAKE WI TH EVENING  MEAL", "P roductForm Name": "TA B,SA", "Pr oducts": [ ], "Qualif iedName":  "METFORMIN  HCL 500MG  TAB,SA",  "Sig": "TA KE AS DIRE CTED BY MO UTH EVERY  EVENING TA KE WITH EV ENING MEAL ", "Stoppe d": "20170 626", "Typ e": "Presc ription",  "Uid": "ur n:va:med:F 0E0:943623 :17420447" , "VaStatu s": "DISCO NTINUED",  "VaType":  "O" }] };
  11   var config Data = nul l,
  12       _setti ngs = null ,
  13       _veter an = null;
  14       //_med sFromCRM =  [];
  15   var gridCo lumns = [
  16       { fiel d: "IsRefi llable", V A: "isRefi llable", V APath: "Mh v.Prescrip tionList[0 ].IsRefill able", typ e: "boolea n", hidden : true },
  17       { fiel d: "Refill Button",
  18           VA Path: null ,
  19           ti tle: " ",
  20           ty pe: "butto n",
  21           te mplate: fu nction(pDa taItem){
  22                return " <input typ e='button'  value='Re fill'"
  23                    + (p DataItem.I sRefillabl e ?  " tit le='Submit  a refill  for this p rescriptio n to MyHea ltheVet.'"  : " title ='This pre scription  is not ref illable at  this time .'")
  24                    + "  class='Crm Button' on click='ref illButtonC lick(this) ;' "
  25                    + (p DataItem.I sRefillabl e ? "" : " disabled=' disabled'" )
  26                    + "/ >";
  27           },
  28           he aderTeampl ate: "",
  29           gr oupable: f alse,
  30           so rtable: fa lse,
  31           fi lterable:  false
  32       },
  33       { fiel d: "IsTrac kable", VA : "isTrack able", VAP ath: "Mhv. Prescripti onList[0]. IsTrackabl e", type:  "boolean",  hidden: t rue },
  34       {
  35           fi eld: "Trac kButton",
  36           VA Path: null ,
  37           ti tle: " ",
  38           ty pe: "butto n",
  39           te mplate: fu nction (pD ataItem) {
  40                return " <input typ e='button'  value='Tr ack'"
  41                    + (p DataItem.I sTrackable  ? " title ='Track th e submitte d refill f or this pr escription .'" : " ti tle='This  prescripti on is not  trackable  at this ti me.'")
  42                    + "  class='Crm Button' on click='tra ckButtonCl ick(this); ' "
  43                    + (p DataItem.I sTrackable  ? "" : "d isabled='d isabled'")
  44                    + "/ >";
  45           },
  46           he aderTeampl ate: "",
  47           gr oupable: f alse,
  48           so rtable: fa lse,
  49           fi lterable:  false
  50       },
  51       { fiel d: "Prescr iptionId",  VA: "pres criptionId ", VAPath:  "Mhv.Pres criptionLi st[0].Pres criptionId ", hidden:  true, typ e: "string " },/*this  is the in ternal ID? , not the  same as th e rxnumber */
  52       { fiel d: "Prescr iptionNumb er", title : "Rx Numb er", VA: " prescripti onNumber",  VAPath: " Mhv.Prescr iptionList [0].Prescr iptionNumb er", showI nPopup: tr ue, popupO rder: 1, t ype:"strin g" },
  53       {
  54           fi eld: "Name ",
  55           ti tle: "Med  Name",
  56           VA : "prescri ptionName" ,
  57           VA Path: "Mhv .Prescript ionList[0] .Prescript ionName",
  58           te mplate: fu nction (pD ataItem) {
  59                return " <a href='# ' onclick= 'return in foAnchorCl ick(this); '><i class ='glyphico n glyphico n-info-sig n'></i></a > " + pDat aItem.Name ;
  60           },
  61           sh owInPopup:  true,
  62           po pupOrder:  2,
  63           ty pe: "strin g"
  64       },
  65       {
  66           fi eld: "Refi llStatus",
  67           ti tle: "Refi ll Status" ,
  68           VA : "refillS tatus",
  69           VA Path: "Mhv .Prescript ionList[0] .RefillSta tus",
  70           te mplate: fu nction (pD ataItem) {
  71                return " <span " +
  72                             "style ='cursor:"  + VCCM.MH VHelper.Ge tRefillSta tusCursor( pDataItem. RefillStat us) + "' "  +
  73                             "title ='" + VCCM .MHVHelper .GetRefill StatusTool tip(pDataI tem.Refill Status) +  "'" +
  74                         "'>" +
  75                             VCCM.M HVHelper.G etRefillSt atusLabel( pDataItem. RefillStat us)
  76                         "</span>";
  77                
  78           },
  79           ty pe: "strin g"
  80       },
  81       {
  82           fi eld: "Fill sRemaining ",
  83           ti tle: "Refi lls Left",
  84           VA : "refillR emaining",
  85           VA Path: "Mhv .Prescript ionList[0] .RefillRem aining",
  86           te mplate: fu nction (pD ataItem) {
  87                return " <span " +
  88                             "style ='cursor:"  + VCCM.MH VHelper.Ge tRefillSta tusCursor( pDataItem. RefillStat us) + "' "  +
  89                             "title ='" + VCCM .MHVHelper .GetRefill StatusTool tip(pDataI tem.Refill Status) +  "'" +
  90                         "'>" +
  91                             pDataI tem.FillsR emaining +
  92                         "</span>";
  93           },
  94           ty pe: "numbe r"
  95       },
  96       {
  97           fi eld: "Refi llSubmitDa te",
  98           ti tle: "Refi ll Submitt ed On",
  99           VA : "refillS ubmitDate" ,
  100           VA Path: "Mhv .Prescript ionList[0] .RefillSub mitDate",
  101           te mplate: fu nction (pD ataItem) {
  102                return ! !pDataItem .RefillSub mitDate ?  (new Date( pDataItem. RefillSubm itDate)).t oLocaleDat eString()  : "";
  103           },
  104           ty pe: "datet ime"
  105       },
  106       {
  107           fi eld: "Last Ordered",
  108           ti tle: "Disp ensed Date ",
  109           VA : "dispens edDate",
  110           VA Path: "Mhv .Prescript ionList[0] .Dispensed Date",
  111           te mplate: fu nction (pD ataItem) {
  112                return ! !pDataItem .LastOrder ed ? (new  Date(pData Item.LastO rdered)).t oLocaleDat eString()  : "";
  113           },
  114           sh owInPopup:  true,
  115           po pupOrder:  3,
  116           ty pe: "datet ime",
  117           hi dden: true  
  118       },
  119       { fiel d: "Quanti ty", title : "Quantit y", VA: "q uantity",  VAPath: "M hv.Prescri ptionList[ 0].Quantit y", showIn Popup: tru e, popupOr der: 7, ty pe: "numbe r" },
  120       { fiel d: "Facili tyName", t itle: "Fac ility", VA : "facilit yName", VA Path: "Mhv .Prescript ionList[0] .FacilityN ame", hidd en: true,  type: "str ing" },
  121       { fiel d: "Statio nNumber",  title: "St ation Numb er", VA: " stationNum ber", VAPa th: "Mhv.P rescriptio nList[0].S tationNumb er", hidde n: true, t ype: "stri ng" },
  122       { fiel d: "Concat enatedFaci lity", tit le: "Facil ity", temp late: func tion (pDat aItem) { r eturn pDat aItem.Stat ionNumber  + "-" + pD ataItem.Fa cilityName ; }, type:  "string"  },
  123       { fiel d: "Patien tInstructi on", title : "Instruc tions", hi dden: true , VA: "Pat ientInstru ction", VA Path: "Pat ientInstru ction", sh owInPopup:  true, pop upOrder: 4 , type: "s tring" },
  124       { fiel d: "Provid erName", t itle: "Pro vider Name ", hidden:  true, VA:  "Provider Name", VAP ath: "Orde rs[0].Prov iderName",  showInPop up: true,  popupOrder : 5, type:  "string"  },
  125       { fiel d: "DaysSu pply", tit le: "Days  Supply", h idden: tru e, VA: "Da ysSupply",  VAPath: " Orders[0]. DaysSupply ", showInP opup: true , popupOrd er: 6, typ e: "number " }
  126   ];
  127  
  128   $(document ).ready(fu nction ()  {
  129       doPage Load();
  130   });
  131  
  132   function d oPageLoad( ) {
  133       showLo adingMessa ge("Loadin g prescrip tions from  MyHealthe Vet...");
  134  
  135       //load  test data  in AWS en vironment
  136         if (locati on.href.in dexOf("htt ps:// URL                               /VCCMDEV")  > -1) {
  137           se tTimeout(
  138                function  () {
  139                    $("# testDataMe ssageDiv") .show();
  140                    proc essCombine dMedicatio nResponse( testPrescr iptionData );
  141                },
  142                500
  143           );
  144       }
  145       else {
  146           tr y {
  147                configDa ta = parse DataParame tersFromUr l(location .search);
  148                findActi veSettings (findMHVSe ssionToken , queryMHV Medication API);
  149           }
  150           ca tch (err)  {
  151                //Displa y Error... .
  152                alert("D ocument re ady error:  " + err.m essage);
  153           }
  154       }
  155   }
  156  
  157   function f indActiveS ettings(pC allbackFun ction, pCa llbackFunc tion2) {
  158       //get  the Active  Settings  record fro m either t he parent  request fo rm or dire ctly from  CRM
  159       if (!! _settings)  {
  160           if  (typeof p CallbackFu nction ==  "function" ) { pCallb ackFunctio n(pCallbac kFunction2 ); }
  161       }
  162       else {
  163           if  (!!parent ._retrieve dSettings)  {
  164                _setting s = parent ._retrieve dSettings;
  165                if (type of pCallba ckFunction  == "funct ion") { pC allbackFun ction(pCal lbackFunct ion2); }
  166           }
  167           el se {
  168                var quer yString =  "$select=* &$filter=m cs_name eq  'Active S ettings'";
  169                try{
  170                    SDK. REST.retri eveMultipl eRecords(
  171                         "mcs_setti ng",
  172                         queryStrin g,
  173                         function ( retrievedR ecords) {
  174                             if (ty peof retri evedRecord s != "unde fined" &&  !!retrieve dRecords & & retrieve dRecords.l ength == 1 ) _setting s = retrie vedRecords [0];
  175                         },
  176                         errorHandl er,
  177                         function ( ) {
  178                             if (!! _settings)  {
  179                                 if  (typeof p CallbackFu nction ==  "function" ) { pCallb ackFunctio n(pCallbac kFunction2 ); }
  180                             }
  181                         }
  182                    );
  183                }
  184                catch (e ) {
  185                    show ErrorMessa ge("Error  retrieving  Active Se ttings: "  + e.messag e);
  186                }
  187           }
  188       }
  189   }
  190   function f indMHVSess ionToken(p CallbackFu nction, pP assthrough Object) {
  191       if (!! parent._MH VID) {
  192           va r mhvIdArr ay = paren t._MHVID.s plit(",");  //request  form _MHV ID variabl e will be  single ID  if we've a lready pro cessed the  full list  of availa ble MHVIDs , otherwis e, it coul d be a lis t of one o re more co mma-separa ted IDs
  193           if  (!!_setti ngs && !!_ settings.f tp_DACURL  && !!_sett ings.ftp_M HVSessionA PIURL) {
  194                var pass throughObj ect = !!pP assthrough Object ? p Passthroug hObject :  {};
  195                //this r etrieves t oken and s aves it to  cookie.
  196                VCCM.MHV Helper.Get SessionTok en(
  197                    _set tings.ftp_ DACURL + _ settings.f tp_MHVSess ionAPIURL,
  198                    mhvI dArray,
  199                    pCal lbackFunct ion,
  200                    pass throughObj ect,
  201                    func tion (e) {
  202                         showErrorM essage("Th e MHV Sess ion API di d not retu rn a sessi on token f or this ve teran's MH V correlat ion ID.");
  203                    }
  204                );
  205           }
  206           el se {
  207                showErro rMessage(" Configurat ion error:  Check the  MHV Activ e Session  API value  on the Act ive Settin gs record. ");
  208           }
  209       }
  210       else {
  211           ha ndleNoAcco unt();
  212       }
  213   }
  214   function h andleNoAcc ount() {
  215       //cann ot query a ny MHV API s w/o an M HV ID or a n MHV sess ion token,
  216       //whic h is captu red and co pied to US D Replacem ent parame ters at en d of Veter an Alerts  page,
  217       //and  then made  available  to Request  form (her e, 'parent ') via the  form_onLo adWithPara meters fun ction
  218       if (!! !parent._I CN || pare nt._ICN ==  "MISSING" ) {
  219           $( "#noMHVAcc ountMessag e").text(" This veter an was not  found in  MVI, so yo u cannot s ubmit or t rack presc ription re fills via  USD.");
  220           $( "#MHVSignu pButton"). hide();
  221       }
  222       showDi v("#noMHVA ccountCont ainer"); / /so, promp t for MHV  account si gnup.
  223   }
  224  
  225   function b tnRefreshG rid_click( pButton) {
  226       showLo adingMessa ge("Loadin g prescrip tions from  MyHealthe Vet...");
  227       setTim eout(
  228           fu nction ()  {
  229                findMHVS essionToke n(queryMHV Medication API);
  230           },
  231           10 00
  232       );
  233   }
  234   function q ueryMHVMed icationAPI (pMHVObjec t, pPassth roughObjec t) {
  235       if (!! _settings  && !!_sett ings.ftp_D ACURL && ! !_settings .ftp_Medic ationCombi nedAPIURL)  {
  236           sh owLoadingM essage("Lo ading pres criptions  from MyHea ltheVet... ");
  237           VC CM.MHVHelp er.Retriev eCombinedM edicationL ist(
  238           // VCCM.MHVHe lper.Retri eveActiveP rescriptio ns(
  239                _setting s.ftp_DACU RL + _sett ings.ftp_M edicationC ombinedAPI URL,
  240                pMHVObje ct.Token,
  241                parent._ ICN,
  242                "3.0",
  243                "FtPCRM" ,
  244                function  (pRespons e) {
  245                    if ( !!pRespons e) {
  246                         processCom binedMedic ationRespo nse(pRespo nse);
  247                    }
  248                    else  {
  249                         showErrorM essage("No  respone f rom MHV Ac tive Presc riptions A PI.");
  250                    }
  251                },
  252                function  (e) {
  253                    show ErrorMessa ge("Error  querying M HV Active  Prescripti ons API: "  + e.messa ge);
  254                }
  255           );
  256       }
  257       else {
  258           sh owErrorMes sage("Conf iguration  error: Che ck the Med ication Co mbined API  URL value  on the Ac tive Setti ngs record .");
  259       }
  260   }
  261   function p rocessComb inedMedica tionRespon se(pRespon se) {
  262       if (pR esponse.Er rorOccurre d == false ) {
  263           me dsFromMHV  = [];
  264           // combined m edication  api respon se schema:  Response  { Data: [  { Mhv: { P rescriptio nList: []  } } ] }
  265           va r retrieve dMedicatio ns = getDe epProperty ("Data", p Response);
  266           if  (!!retrie vedMedicat ions && Ar ray.isArra y(retrieve dMedicatio ns) && ret rievedMedi cations.le ngth > 0)  {
  267                for (var  i = 0; i  < retrieve dMedicatio ns.length;  i++) {
  268                    var  thisMedica tionFromAP I = retrie vedMedicat ions[i];
  269                    var  thisMedica tionsMHVPr escription List = get DeepProper ty("Mhv.Pr escription List", thi sMedicatio nFromAPI);
  270                    if ( !!thisMedi cationsMHV Prescripti onList &&  Array.isAr ray(thisMe dicationsM HVPrescrip tionList)  && thisMed icationsMH VPrescript ionList.le ngth > 0)  {
  271                         var newMed Obj = { Po pupFields:  [] };
  272                         for (var j  = 0; j <  gridColumn s.length;  j++) {
  273                             if (gr idColumns[ j].type !=  "button")  {
  274                                 va r columnVa lue = getD eepPropert y(gridColu mns[j].VAP ath, thisM edicationF romAPI);
  275                                 ne wMedObj[gr idColumns[ j].field]  = columnVa lue;
  276                                 if  (gridColu mns[j].sho wInPopup = = true) {
  277                                      newMedOb j.PopupFie lds[gridCo lumns[j].p opupOrder  - 1] = { L abel: grid Columns[j] .title, Va lue: colum nValue, ty pe: gridCo lumns[j].t ype };
  278                                 }
  279                             }
  280                         }
  281                         medsFromMH V.push(new MedObj);
  282                    }
  283                }
  284           }
  285           re nderMedica tions(meds FromMHV);
  286       }
  287       else {
  288           sh owErrorMes sage("Erro r querying  Medicatio n Combined  API: " +  pResponse. ErrorMessa ge);
  289       }
  290   }
  291   function r enderMedic ations(pDa ta) {
  292       try{
  293           if  (!!pData  && Array.i sArray(pDa ta)) {
  294                var medi cationGrid  = $("#med icationGri dDiv").ken doGrid({
  295                    colu mns: gridC olumns,
  296                    sort able: true ,
  297                    edit able: fals e,
  298                    resi zable: tru e,
  299                    navi gatable: t rue,
  300                    noRe cords: {
  301                         template:  "No refill able medic ations fou nd in MHV. "
  302                    },
  303                    scro llable: fa lse,
  304                    page able: {
  305                         pageSize:  4
  306                    },
  307                    data Source: pD ata,
  308                    data Bound: fun ction (e)  {
  309                         //tbd
  310                    }
  311                });
  312                showDiv( "#Medicati onPickerCo ntainer");
  313           }
  314           el se {
  315                showErro rMessage(" Error rend ering medi cations on  grid: Emp ty data ar ray for Ke ndo grid." );
  316           }
  317       }
  318       catch  (e) {
  319           sh owErrorMes sage("Erro r renderin g medicati ons on gri d: " + e.m essage);
  320       }
  321   }
  322  
  323   function M HVSignupBu ttonClick( ) {
  324       //aler t("As of 1 /18/18, MH V Registra tion is no t yet impl emented!") ;
  325       VCCM.U SDHelper.C opyDataToR eplacement Parameters ("MHV", [" Registrati onAPIURL="  + _settin gs.ftp_DAC URL + _set tings.ftp_ MHVRegistr ationAPIUR L], false) ;
  326       VCCM.U SDHelper.O penUSDURL( "http://ev ent?eventn ame=MHVReg istrationB uttonClick ed");
  327   }
  328  
  329   function r efillButto nClick(pBu tton) {
  330       var th isRow = $( pButton).c losest("tr ");
  331       var me dicationGr id = $('#m edicationG ridDiv').d ata('kendo Grid');
  332       var me dDataItem  = medicati onGrid.dat aItem(this Row);
  333  
  334       findMH VSessionTo ken(submit Refill, me dDataItem) ;
  335   }
  336   function s ubmitRefil l(pMHVObje ct, pMedDa taItem) {
  337       if (!! pMedDataIt em.Prescri ptionId) {
  338           if  (!!_setti ngs && !!_ settings.f tp_DACURL  && !!_sett ings.ftp_M HVRefillAP IURL) {
  339                if (!!pM HVObject & & !!pMHVOb ject.Token ) {
  340                    pare nt.Xrm.Pag e.ui.setFo rmNotifica tion("Subm itting pre scription  refill to  MyHealtheV et...", "I NFO", "ref ill_" + pM edDataItem .Prescript ionId);
  341                    VCCM .MHVHelper .SubmitPre scriptionR efill(
  342                         _settings. ftp_DACURL  + _settin gs.ftp_MHV RefillAPIU RL,
  343                         pMHVObject .Token,
  344                         pMedDataIt em.Prescri ptionId.to String(),
  345                         function ( pResponse)  {
  346                             if (!! pResponse)  {
  347                                 va r msg = "S ubmitted r efill for  " + pMedDa taItem.Nam e + ". MyH ealtheVet  updates re fill data  overnight,  so this p rescriptio n's status  and count  of remain ing refill s may not  change unt il tomorro w at the e arliest.";
  348                                 pa rent.Xrm.U tility.ale rtDialog(m sg, functi on () {
  349                                      parent.X rm.Page.ui .setFormNo tification (msg, "INF O", "refil l_" + pMed DataItem.P rescriptio nId);
  350                                 }) ;
  351                             }
  352                             else {
  353                                 al ert("No re spone from  MHV Refil l API.");
  354                             }
  355                         },
  356                         function ( e) {
  357                             alert( "Error sub mitting re fill: " +  e.message) ;
  358                         }
  359                    );
  360                }
  361                else {
  362                    aler t("No MHV  Session To ken is ava ilable to  submit thi s prescrip tion to My HealtheVet  for refil l");
  363                }
  364           }
  365           el se {
  366                alert("C onfigurati on error:  Check the  MHV Refill  API value  on the Ac tive Setti ngs record .");
  367           }
  368       }
  369       else {
  370           al ert("Missi ng prescri ption ID." );
  371       }
  372   }
  373  
  374   function t rackButton Click(pBut ton) {
  375       var th isRow = $( pButton).c losest("tr ");
  376       var me dicationGr id = $('#m edicationG ridDiv').d ata('kendo Grid');
  377       var me dDataItem  = medicati onGrid.dat aItem(this Row);
  378  
  379       findMH VSessionTo ken(getTra ckingInfo,  medDataIt em);
  380   }
  381   function g etTracking Info(pMHVO bject, pMe dDataItem)  {
  382       if (!! pMedDataIt em.Prescri ptionId) {
  383           if  (!!_setti ngs && !!_ settings.f tp_DACURL  && !!_sett ings.ftp_M HVTracking APIURL) {
  384                if (!!pM HVObject & & !!pMHVOb ject.Token ) {
  385                    VCCM .MHVHelper .TrackPres cription(
  386                         _settings. ftp_DACURL  + _settin gs.ftp_MHV TrackingAP IURL,
  387                         pMHVObject .Token,
  388                         pMedDataIt em.Prescri ptionId.to String(),
  389                         function ( pResponse)  {
  390                             if (!! pResponse)  {
  391                                 va r track_co ntext = Ge tGlobalCon text();
  392                                 va r track_se rverUrl =  track_cont ext.getCli entUrl();
  393                                 tr ack_popUpD ata = pRes ponse;
  394                                 // construct  pop-up
  395                                 va r kendoTra ckingPopUp  = $("#tra ckingPopUp ");
  396                                 va r kendoPop UpTitle =  "Track Pre scription" ;
  397                                 va r kendoPop UpUrl = tr ack_server Url +  "/W ebResource s/ftp_/Req uest/MHVPr escription Tracker.ht ml";
  398                                 if  (typeof k endoTracki ngPopUp !=  'undefine d' && kend oTrackingP opUp != nu ll) {
  399                                      kendoTra ckingPopUp .kendoWind ow({
  400                                          widt h: "60%",
  401                                          moda l: true,
  402                                          heig ht: "40%",
  403                                          ifra me: true,
  404                                          resi zable: tru e,
  405                                          titl e: kendoPo pUpTitle,
  406                                          cont ent: kendo PopUpUrl,
  407                                          visi ble: false ,
  408                                          posi tion: {
  409                                               top: "10px ",
  410                                               left: "100 px"
  411                                          }
  412                                      });
  413                                      var trac kingPopUpW indow = $( "#tracking PopUp").da ta('kendoW indow');
  414                                      tracking PopUpWindo w.open();
  415                                 }
  416                             }
  417                             else {
  418                                 al ert("No re spone from  MHV Track ing API.") ;
  419                             }
  420                         },
  421                         function ( e) {
  422                             alert( "Error fro m MHV Trac king API:  " + e.mess age);
  423                         }
  424                    );
  425                }
  426                else {
  427                    aler t("No MHV  Session To ken is ava ilable to  track this  prescript ion's refi ll in MyHe altheVet." );
  428                }
  429           }
  430           el se {
  431                alert("C onfigurati on error:  Check the  MHV Tracki ng API val ue on the  Active Set tings reco rd.");
  432           }
  433       }
  434       else {
  435           al ert("Missi ng prescri ption ID." );
  436       }
  437   }
  438  
  439   function i nfoAnchorC lick(pElem ent) {
  440       var th isRow = $( pElement). closest("t r");
  441       var me dicationGr id = $('#m edicationG ridDiv').d ata('kendo Grid');
  442       var me dDataItem  = medicati onGrid.dat aItem(this Row);
  443       _selec tedMedData Item = med DataItem;
  444       //cons truct pop- up
  445       var in foPopupDiv  = $("#inf oPopup");
  446       if (ty peof infoP opupDiv !=  'undefine d' && info PopupDiv ! = null) {
  447           in foPopupDiv .kendoWind ow({
  448                modal: t rue,
  449                //minWid th: 275,
  450                //minHei ght: 400,
  451                width: " 50%",             
  452                height:  "80%",
  453                iframe:  true,
  454                draggabl e: true,
  455                resizabl e: true,
  456                title: " Additional  Info",
  457                content:  VCCM.MHVH elper._get ServerUrl( ) + "/WebR esources/f tp_/Reques t/MHVMedic ationRefil lGridInfoP opup.html" ,
  458                visible:  false,
  459                position : {
  460                    top:  "5%",
  461                    left : "25%"
  462                }
  463           }) ;
  464           va r infoPopu p = $("#in foPopup"). data('kend oWindow');
  465           in foPopup.op en();
  466  
  467           $( document). on("click" , ".k-over lay", func tion () {
  468                infoPopu p.close();
  469           }) ;
  470       }
  471       return  false;
  472   }
  473  
  474  
  475   /*helper f unctions*/
  476   function p arseDataPa rametersFr omUrl(pQue ryString)  {
  477       //exam ple query  string (un encoded):  contactid= {32CA1B55- DC81-E611- 9445-00505 68D743D}&f ullname=TI FINKLE, AN DREW&sensi tivity=tru e&IsUSD=tr ue
  478       var fu llParamete rArray = p QueryStrin g.substr(1 ).split("& ");
  479  
  480       //clea n up the U RL query s tring and  split each  member in to a key/v alue pair
  481       for (v ar i in fu llParamete rArray) {
  482           fu llParamete rArray[i]  = fullPara meterArray [i].replac e(/\+/g, "  ").split( "=");
  483       }
  484  
  485       var fu llObject =  {};
  486       for (v ar i in fu llParamete rArray) {
  487           va r thisPara meterName  = fullPara meterArray [i][0];
  488           va r thisPara meterValue  = fullPar ameterArra y[i][1];
  489           fu llObject[t hisParamet erName] =  thisParame terValue;
  490           if  (thisPara meterName. toLowerCas e() == "da ta") {
  491                var data Object = { };
  492                var cust omDataArra y = decode URICompone nt(thisPar ameterValu e).split(" &");
  493                for (var  j in cust omDataArra y) {
  494                    cust omDataArra y[j] = cus tomDataArr ay[j].repl ace(/\+/g,  " ").spli t("=");
  495                    data Object[cus tomDataArr ay[j][0]]  = customDa taArray[j] [1];
  496                }
  497                fullObje ct[thisPar ameterName ] = dataOb ject;
  498           }
  499       }
  500       return  fullObjec t;
  501   }
  502   function e rrorHandle r(error) {
  503       alert( error.mess age);
  504   }
  505   function g etDeepProp erty(pPath , pObject)  {
  506       if (!! pPath) {
  507           va r pathAsAr ray = pPat h.split(". ");
  508           va r returnOb j = !!pObj ect ? pObj ect : wind ow[pathAsA rray.shift ()];
  509           if  (typeof r eturnObj ! = "undefin ed") {
  510                while (! !returnObj  && pathAs Array.leng th > 0) {
  511                    var  nextLevel  = pathAsAr ray.shift( );
  512                    var  isArrayQue ry = nextL evel.index Of("[") >  -1 && next Level.inde xOf("]") = = nextLeve l.indexOf( "[") + 2;
  513                    var  nextLevelN ame = !isA rrayQuery  ? nextLeve l : nextLe vel.split( "[")[0];
  514                    var  nextLevelA rrayMember  = !isArra yQuery ? n ull : pars eInt((next Level.spli t("[")[1]) .substr(0,  (nextLeve l.split("[ ")[1].leng th)));
  515  
  516                    retu rnObj = is ArrayQuery  ? returnO bj[nextLev elName][ne xtLevelArr ayMember]  : returnOb j[nextLeve lName];
  517  
  518                }
  519                return r eturnObj;
  520           }
  521           el se {
  522                return u ndefined;
  523           }
  524       }
  525       else {
  526           re turn undef ined;
  527       }
  528   }
  529   function A rrayIndexO fObjectByA ttribute(p Array, pAt tr, pValue ) {
  530       for (v ar i = 0;  i < pArray .length; i  += 1) {
  531           if  (pArray[i ][pAttr] = == pValue)  {
  532                return i ;
  533           }
  534       }
  535       return  -1;
  536   }
  537   function g etDeepProp erty(pPath , pObject)  {
  538       if (!! pPath) {
  539           va r pathAsAr ray = pPat h.split(". ");
  540           va r returnOb j = !!pObj ect ? pObj ect : wind ow[pathAsA rray.shift ()];
  541           if  (typeof r eturnObj ! = "undefin ed") {
  542                while (! !returnObj  && pathAs Array.leng th > 0) {
  543                    var  nextLevel  = pathAsAr ray.shift( );
  544                    var  isArrayQue ry = nextL evel.index Of("[") >  -1 && next Level.inde xOf("]") = = nextLeve l.indexOf( "[") + 2;
  545                    var  nextLevelN ame = !isA rrayQuery  ? nextLeve l : nextLe vel.split( "[")[0];
  546                    var  nextLevelA rrayMember  = !isArra yQuery ? n ull : pars eInt((next Level.spli t("[")[1]) .substr(0, (nextLevel .split("[" )[1].lengt h)));
  547  
  548                    retu rnObj = is ArrayQuery  ? returnO bj[nextLev elName][ne xtLevelArr ayMember]  : returnOb j[nextLeve lName];
  549                    
  550                }
  551                return r eturnObj;
  552           }
  553           el se {
  554                return u ndefined;
  555           }
  556       }
  557       else {
  558           re turn undef ined;
  559       }
  560   }
  561   function s howLoading Message(pM essage) {
  562       $("#pr ogressText ").html(pM essage);
  563       showDi v("#loadin gGifDiv");
  564   }
  565   function s howErrorMe ssage(pMes sage) {
  566       $("#er rorText"). html(pMess age);
  567       showDi v("#errorC ontainer") ;
  568   }
  569   function s howDiv(pDi vToShow) {
  570       var kn ownDivs =  [
  571                    "#lo adingGifDi v",
  572                    "#er rorContain er",
  573                    "#Me dicationPi ckerContai ner",
  574           "# newRecordM essageCont ainer",
  575           "# noMHVAccou ntContaine r"
  576       ];
  577       for (v ar d = 0;  d < knownD ivs.length ; d++) {
  578           if  (knownDiv s[d] == pD ivToShow)  {
  579                $(knownD ivs[d]).sh ow();
  580           }
  581           el se {
  582                $(knownD ivs[d]).hi de();
  583           }
  584       }
  585   }