385. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/22/2018 1:29:31 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.

385.1 Files compared

# Location File Last Modified
1 v1603_release_60.zip\CRM_solutions\VCCMResources.zip\WebResources ftp_VistAMultiNoteSpecialTreatmentControljsSpecialAE7FB08E-011B-E811-8130-1289A8FDD3DA Tue May 22 14:39:24 2018 UTC
2 v1603_release_60.zip\CRM_solutions\VCCMResources.zip\WebResources ftp_VistAMultiNoteSpecialTreatmentControljsSpecialAE7FB08E-011B-E811-8130-1289A8FDD3DA Wed Jun 20 16:38:27 2018 UTC

385.2 Comparison summary

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

385.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

385.4 Active regular expressions

No regular expressions were active.

385.5 Comparison detail

  1   /// <refer ence path= '../../../ triipcrm_/ TR_KU_V201 5_2_902/js /jquery.mi n.js' />
  2   /// <refer ence path= "SampleJso nData.js"  />
  3   /// <refer ence path= "../../../ ftp_/WebSe rviceSecur ityLib/js/ WebService SecurityLi brary.js"  />
  4  
  5   //SpecialT reatmentCo ntrolScrip tLib.js
  6  
  7   //Contains  variables  and funct ions used  by the Spe cialTreatm entControl .html page
  8  
  9   //Static V ariables
  10   var sptr_c rmOdataEnd Point = '/ XRMService s/2011/Org anizationD ata.svc';
  11   var sptr_c ontext = G etGlobalCo ntext();
  12   var sptr_s erverUrl =  sptr_cont ext.getCli entUrl();
  13  
  14   //var sptr _Enrollmen tEligibili tySummaryU RLbase = ' https:// URL /WebParts/ DEV/api/es r/Enrollme ntEligibil itySummary /2.0/json/ ';    //OLD MANU AL DEV URL
  15   var sptr_e esummaryUR Lbase = '' ;
  16   var sptr_E nrollmentE ligibility SummaryURL base = '';
  17   //Set Defa ult Servic e Return v alue = nul l
  18   var sptr_E nrollmentE ligibility SummaryDat a = null;
  19   var sptr_r egardingob jectid = n ull;
  20   var sptr_t anConfigur ation = fa lse;
  21  
  22   function s ptr_Settin gsWebServi ceURL_resp onse(sptr_ settingDat a, sptr_la stSkip, sp tr_eesumma ryURLbase_ NA) {
  23       try {
  24           // sptr_lastS kip is the  starting  point in t he result  (use if mo re than 50  records)  //Not used  in this s cenario
  25           va r sptr_Dac Url = null ;
  26           va r sptr_Enr ollmentEli gibilitySu mmaryApiUr l = null;
  27           fo r (var i =  0; i <= s ptr_settin gData.d.re sults.leng th - 1; i+ +) {
  28                //Get in fo
  29                if (sptr _settingDa ta.d.resul ts[i].ftp_ DACURL !=  null) { sp tr_DacUrl  = sptr_set tingData.d .results[i ].ftp_DACU RL; }
  30                if (sptr _settingDa ta.d.resul ts[i].ftp_ ESREnrollm entEligibi litySummar yAPIURL !=  null) { s ptr_Enroll mentEligib ilitySumma ryApiUrl =  sptr_sett ingData.d. results[i] .ftp_ESREn rollmentEl igibilityS ummaryAPIU RL; }
  31                break;
  32           }
  33  
  34           if  (sptr_Dac Url != nul l && sptr_ Enrollment Eligibilit ySummaryAp iUrl != nu ll) {
  35                //Constr uct full w eb service  URL
  36                sptr_Enr ollmentEli gibilitySu mmaryURLba se = sptr_ DacUrl + s ptr_Enroll mentEligib ilitySumma ryApiUrl;
  37  
  38                //Get th e Related  Request Id  (Support  control fo r progress  note enti ty and req uest/incid ent entity  only)
  39                var sptr _entityNam e = parent .Xrm.Page. data.entit y.getEntit yName();
  40                if (sptr _entityNam e == 'inci dent') {
  41                    //Pr ocess inci dent recor d and get  the curren t id
  42                    var  sptr_reque stId = par ent.Xrm.Pa ge.data.en tity.getId ();
  43                    if ( sptr_reque stId != nu ll && sptr _requestId  != "") {
  44                         sptr_regar dingobject id = sptr_ requestId;
  45                    }
  46                    else  { return  false; }
  47                }
  48                else {
  49                    var  sptr_reque stId = par ent.Xrm.Pa ge.getAttr ibute('reg ardingobje ctid').get Value();
  50                    if ( sptr_reque stId == nu ll) {
  51                         alert("ERR OR: THE CU RRENT PROG RESS NOTE  DOES NOT H AVE A REQU EST IDENTI FIER, DISA BILITY DAT A CANNOT B E DISPLAYE D, PLEASE  CONTACT TE CHNICAL SU PPORT!");
  52                         return fal se;
  53                    }
  54                    sptr _regarding objectid =  sptr_requ estId[0].i d;
  55                }
  56  
  57                var sptr _veteranId  = null;   //From req uest custo merid
  58  
  59                var sptr _requestDa ta = sptr_ getSingleE ntityDataS ync('Incid entSet', ' CustomerId ', sptr_re gardingobj ectid);
  60                if (sptr _requestDa ta != null ) {
  61                    if ( sptr_reque stData.d.C ustomerId  != null) {
  62                         //Set as v eteran id
  63                         sptr_veter anId = spt r_requestD ata.d.Cust omerId.Id
  64                    }
  65                }
  66  
  67                //Get IC N via web  service an d get Serv ice Connec ted disabi lities, Ap pointments  and Medic ations the reafter
  68                //Preser ved Variab les
  69                var sptr _veteranFi rstName =  '';
  70                var sptr _veteranLa stName = ' ';
  71                var sptr _SSN = '';
  72                var sptr _DOB = '';
  73  
  74                if (sptr _veteranId  != null)  {
  75                    //Ge t data for  ICN looku p
  76                    var  sptr_conta ctData = s ptr_getSin gleEntityD ataSync('C ontactSet' , 'FirstNa me, LastNa me, ftp_Da teofBirth,  Governmen tId', sptr _veteranId );
  77                    if ( sptr_conta ctData !=  null) {
  78                         if (sptr_c ontactData .d.FirstNa me != null ) { sptr_v eteranFirs tName = sp tr_contact Data.d.Fir stName; }
  79                         if (sptr_c ontactData .d.LastNam e != null)  { sptr_ve teranLastN ame = sptr _contactDa ta.d.LastN ame; }
  80                         if (sptr_c ontactData .d.ftp_Dat eofBirth ! = null) {  sptr_DOB =  sptr_cont actData.d. ftp_Dateof Birth; }
  81                         if (sptr_c ontactData .d.Governm entId != n ull) { spt r_SSN = sp tr_contact Data.d.Gov ernmentId;  }
  82                    }
  83  
  84                    //Pe rform MVI  Search for  Service C onnected D isabilitie s
  85                    sptr _unattende dMviSearch SCD(sptr_v eteranFirs tName, spt r_veteranL astName, s ptr_DOB, s ptr_SSN);
  86                }
  87                else {
  88                    aler t("ERROR:  UNABLE TO  OBTAIN VET ERAN DATA,  DISABILIT Y DATA CAN NOT BE DIS PLAYED, PL EASE CONTA CT TECHNIC AL SUPPORT !");
  89                    retu rn false;
  90                }
  91           }
  92           el se {
  93                alert("E RROR: THE  ENROLLMENT  ELIGIBILI TY SUMMARY  WEB SERVI CE URL IS  MISSING, P LEASE CONT ACT TECHNI CAL SUPPOR T!");
  94           }
  95       }
  96       catch  (err) {
  97           al ert("Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_S ettingsWeb ServiceURL _response) : " + err. message);
  98       }
  99   }
  100  
  101   function s ptr_unatte ndedMviSea rchSCD(fir stname, la stname, do bdate, ssn ) {
  102       try {
  103           va r filter =  "";
  104           va r filterPr efix = "$s elect=*&$f ilter=";
  105           va r edipi =  "";
  106           va r dobstrin g = "";
  107           if  (dobdate  != null) {
  108                dobstrin g = dobdat e;
  109           }
  110  
  111           if  (ssn != " " && ssn ! = null) {
  112                ssn = ss n.replace( /-/g, "");
  113           }
  114  
  115           // if we have  edipi, se arch using  just it
  116           if  (edipi !=  "") {
  117                filter =  sptr_buil dQueryFilt erSCD("crm e_EDIPI",  edipi, fal se);
  118                filter + = sptr_bui ldQueryFil terSCD("cr me_ClassCo de", 'MIL' , true);
  119                filter + = sptr_bui ldQueryFil terSCD("cr me_SearchT ype", 'Sea rchByIdent ifier', tr ue);
  120  
  121                //set se arch type  as unatten ded
  122                filter + = " and cr me_IsAtten ded eq fal se";
  123           }
  124           el se {
  125                //otherw ise search  using las tname, fir stname, ss n, dob
  126                filter =  sptr_buil dQueryFilt erSCD("crm e_LastName ", lastnam e, false);  //assumin g lastname  will neve r be blank
  127  
  128                if (firs tname != " " && first name != nu ll) {
  129                    filt er += sptr _buildQuer yFilterSCD ("crme_Fir stName", f irstname,  true);
  130                }
  131  
  132                if (ssn  != "" && s sn != null ) {
  133                    filt er += sptr _buildQuer yFilterSCD ("crme_SSN ", ssn, tr ue);
  134                }
  135  
  136                if (dobs tring != " ") {
  137                    filt er += " an d crme_DOB String eq  '" + dobst ring + "'" ;
  138                }
  139                filter + = sptr_bui ldQueryFil terSCD("cr me_SearchT ype", 'Sea rchByFilte r', true);
  140  
  141                //set se arch type  as attende d (for now )
  142                filter + = " and cr me_IsAtten ded eq tru e";
  143           }
  144  
  145           fi lter = enc odeURIComp onent(filt er);
  146           fi lter = fil terPrefix  + filter;
  147           SD K.REST.ret rieveMulti pleRecords ("crme_per son", filt er, sptr_u nattendedM viSearchCa llbackSCD,  function  (error) {  alert(erro r.message) ; sptr_get ServiceCon nectedDisa bilities(" "); }, spt r_unattend edMviSearc hComplete) ;
  148       }
  149       catch  (err) {
  150           al ert('Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_u nattendedM viSearchSC D): ' + er r.message) ;
  151       }
  152   }
  153  
  154   function s ptr_unatte ndedMviSea rchComplet e() {
  155       //do n othing
  156   }
  157  
  158   function s ptr_buildQ ueryFilter SCD(field,  value, an d) {
  159       try {
  160           if  (value ==  '') {
  161                if (and)  {
  162                    retu rn " and "  + field +  " eq null ";
  163                } else {
  164                    retu rn field +  " eq null ";
  165                }
  166           }
  167           el se {
  168                if (and)  {
  169                    retu rn " and "  + field +  " eq '" +  value + " '";
  170                } else {
  171                    retu rn field +  " eq '" +  value + " '";
  172                }
  173           }
  174       }
  175       catch  (err) {
  176           al ert('Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_b uildQueryF ilterSCD):  ' + err.m essage);
  177       }
  178   }
  179  
  180   function s ptr_unatte ndedMviSea rchCallbac kSCD(retur nData) {
  181       try {
  182           if  (returnDa ta != null  && return Data.lengt h >= 1) {
  183                // check  for excep tions 1st
  184                if (retu rnData[0]. crme_Excep tionOccure d || (retu rnData[0]. crme_Retur nMessage ! = null &&  returnData [0].crme_R eturnMessa ge == "An  unexpected  error occ ured durin g the MVI  search. Pl ease try a gain or co ntact your  system ad ministrato r if the p roblem per sists."))  {
  185                    //do  nothing,  pass empty  ICN
  186                    sptr _getServic eConnected Disabiliti es("");
  187                }
  188                else {
  189                    var  patientMvi Identifier  = returnD ata[0].crm e_PatientM viIdentifi er == null  ? "" : re turnData[0 ].crme_Pat ientMviIde ntifier;
  190                    if ( patientMvi Identifier  != "") {
  191                         var idpart s = patien tMviIdenti fier.split ("^");
  192  
  193                         if (idpart s.length >  0) {
  194                             var na tionalId =  idparts[0 ];
  195                             _icn =  nationalI d;
  196                             //Pass  on the IC N and cont inue with  SCD
  197                             sptr_g etServiceC onnectedDi sabilities (_icn);
  198                         }
  199                    }
  200                }
  201           }
  202           el se {
  203                //Return  empty ICN
  204                sptr_get ServiceCon nectedDisa bilities(" ");
  205           }
  206       }
  207       catch  (err) {
  208           al ert('Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_u nattendedM viSearchCa llbackSCD) : ' + err. message);
  209       }
  210   }
  211  
  212   function s ptr_getSer viceConnec tedDisabil ities(sptr _patientIC N) {
  213       try {
  214           // ******Deve loper Bypa ss for mis sing ICN** ****
  215           if  (sptr_pat ientICN ==  '' || spt r_patientI CN == null ) {
  216                if ((par ent.Xrm.Pa ge.context .getUserId ()).toUppe rCase() ==  "{CA50050 4-CBC5-E51 1-8173-000 C2941CE19} ") {
  217                    aler t("Develop er ICN byp ass applie d!");
  218                    sptr _patientIC N = "12345 6V123456";
  219                }
  220           }
  221  
  222           // Verify Pat ient ICN
  223           if  (sptr_pat ientICN ==  '' || spt r_patientI CN == null ) {
  224                //No ICN , do not p roceed
  225                return f alse;
  226           }
  227  
  228           // Construct  Service Pa rameters
  229           va r sptr_ido bject = {} ;
  230           sp tr_idobjec t.National Id = '0000 00' + sptr _patientIC N + '00000 0';
  231           va r sptr_ser viceParams  = [{
  232                key: "id entifier",
  233                type: "c :string",
  234                value: J SON.string ify(sptr_i dobject)
  235           }] ;
  236  
  237           // Call the w eb service  security  function
  238           Cr mSecurityT okenEncryp tion(sptr_ Enrollment Eligibilit ySummaryUR Lbase, spt r_serviceP arams, spt r_serverUr l, sptr_ge tEsrEnroll mentJSON_r esponse);
  239       }
  240       catch  (err) {
  241           al ert("Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_g etServiceC onnectedDi sabilities ): " + err .message);
  242       }
  243   }
  244  
  245   function s ptr_getEsr Enrollment JSON_respo nse(sptr_e rror, sptr _getesrres ponse) {
  246       try {
  247           // NOTE:Expec ting JSON  result, if  changed t o XML modi fy code ac cordingly.
  248  
  249           // Set JSON D ata to Nul l;
  250           sp tr_Enrollm entEligibi litySummar yData = nu ll;
  251  
  252           // Check for  non ESR se rvice erro r
  253           if  (sptr_err or != null ) {
  254                alert("A n ESR Secu re Service  error occ ured:\n "  + sptr_err or + " \nD ebugInfo:  " + sptr_g etesrrespo nse);
  255           }
  256           el se {
  257                //Test f or ESR ser vice error
  258                if (sptr _getesrres ponse.Erro rOccurred  == true) {
  259                    aler t("An ESR  Secure Ser vice error  occurred: \n " + spt r_getesrre sponse.Err orMessage  + " \nDebu gInfo: " +  sptr_gete srresponse .DebugInfo );
  260                }
  261                else {
  262                    //Se t Data Ret urned
  263                    sptr _Enrollmen tEligibili tySummaryD ata = sptr _getesrres ponse;
  264                }
  265           }
  266  
  267           // Get TAN Co nfiguratio n status
  268           va r sptr_cur rentUserId  = parent. Xrm.Page.c ontext.get UserId();
  269           va r sptr_cur rentUserDa ta = sptr_ getSingleE ntityDataS ync('Syste mUserSet',  'msdyusd_ USDConfigu rationId,  ftp_Facili tySiteId',  sptr_curr entUserId) ;
  270           if  (sptr_cur rentUserDa ta != null ) {
  271                if (sptr _currentUs erData.d.m sdyusd_USD Configurat ionId != n ull) {
  272                    if ( sptr_curre ntUserData .d.msdyusd _USDConfig urationId. Name != nu ll) {
  273                         //TAN logi c
  274                         if (sptr_c urrentUser Data.d.msd yusd_USDCo nfiguratio nId.Name = = 'TAN Con figuration ') {
  275                             sptr_t anConfigur ation = tr ue;
  276                         }
  277                    }
  278                }
  279           }
  280  
  281           // Build the  Grid
  282           sp tr_BuildGr id();
  283       }
  284       catch  (err) {
  285           al ert("Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_g etEsrEnrol lmentJSON_ response):  " + err.m essage);
  286       }
  287   }
  288  
  289   function s ptr_FormLo ad() {
  290       try {
  291  
  292           // Get the Re lated Requ est info ( Support co ntrol for  progress n ote entity  and reque st/inciden t entity o nly)
  293           va r sptr_ent ityName =  parent.Xrm .Page.data .entity.ge tEntityNam e();
  294           if  (sptr_ent ityName ==  'incident ') {
  295                //Test i f workload  encounter , if not s top
  296                if (pare nt.Xrm.Pag e.getAttri bute('ftp_ notetype_c ode').getV alue() !=  "100000001 ") {
  297                    retu rn false;
  298                }
  299           }
  300           el se {
  301                //Test i f workload  encounter , if not s top
  302                if (pare nt.Xrm.Pag e.getAttri bute('ftp_ isworkload encounter' ).getValue () != true ) {
  303                    retu rn false;
  304                }
  305           }
  306  
  307           // Set all Sp ecial Trea tment Cont rol attrib utes to di sabled
  308           pa rent.Xrm.P age.getCon trol("ftp_ servicecon nectedcond ition").se tDisabled( true);
  309           pa rent.Xrm.P age.getCon trol("ftp_ combatvete ran").setD isabled(tr ue);
  310           pa rent.Xrm.P age.getCon trol("ftp_ agentorang eexposure" ).setDisab led(true);
  311           pa rent.Xrm.P age.getCon trol("ftp_ ionizingra diationexp osure").se tDisabled( true);
  312           pa rent.Xrm.P age.getCon trol("ftp_ southwesta siaconditi ons").setD isabled(tr ue);
  313           pa rent.Xrm.P age.getCon trol("ftp_ shipboardh azardandde fense").se tDisabled( true);
  314           pa rent.Xrm.P age.getCon trol("ftp_ militaryse xualtrauma ").setDisa bled(true) ;
  315           pa rent.Xrm.P age.getCon trol("ftp_ headandorn eckcancer" ).setDisab led(true);
  316  
  317           // GET CRM SE TTINGS WEB  SERVICE U RLS
  318           va r sptr_con ditionalFi lter = "(m cs_name eq  'Active S ettings')" ;
  319           sp tr_getMult ipleEntity DataAsync( 'mcs_setti ngSet', 'f tp_DACURL,  ftp_ESREn rollmentEl igibilityS ummaryAPIU RL', sptr_ conditiona lFilter, ' mcs_name',  'asc', 0,  sptr_Sett ingsWebSer viceURL_re sponse, sp tr_eesumma ryURLbase) ;
  320       }
  321       catch  (err) {
  322           al ert("Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_F ormLoad):  " + err.me ssage);
  323       }
  324   }
  325  
  326   function s ptr_BuildG rid() {
  327       try {
  328           // Temporary  action: js on result  is empty,  use sample  data
  329           // ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********
  330           // if (sptr_E nrollmentE ligibility SummaryDat a == null  || sptr_En rollmentEl igibilityS ummaryData  == '') {  sptr_Enrol lmentEligi bilitySumm aryData =  json_resul t2[0]; }
  331           // ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ********
  332  
  333           // When paren t entity i s incident , do not p opulate re quired
  334           va r sptr_par entInciden t = false;
  335           if  (parent.X rm.Page.da ta.entity. getEntityN ame() == ' incident')  { sptr_pa rentIncide nt = true;  }
  336  
  337           // Data from  parentnode  'enrollme ntDetermin ationInfo'  
  338           va r $sptr_en rollmentDe terminatio nInfo = nu ll;
  339           va r $sptr_pr imaryEligi bility = n ull;
  340           va r $sptr_ty pe = null;
  341           va r sptr_typ eText = nu ll;
  342           va r $sptr_en rollmentCa tegoryName  = null;
  343           va r sptr_enr ollmentCat egoryNameT ext = null ;
  344           va r $sptr_sp ecialFacto rs = null;
  345           va r $sptr_en vContamina ntsInd = n ull;
  346           va r sptr_env Contaminan tsIndText  = null;
  347           va r $sptr_ra diationExp osureInd =  null;
  348           va r sptr_rad iationExpo sureIndTex t = null;
  349           va r $sptr_ag entOrangeI nd = null;
  350           va r sptr_age ntOrangeIn dText = nu ll;
  351           va r $sptr_ca mpLejeuneI nd = null;
  352           va r sptr_cam pLejeuneIn dText = nu ll;
  353           va r $sptr_se rviceConne ctionAward  = null;
  354           va r $sptr_se rviceConne ctedPercen tage = nul l;
  355           va r sptr_ser viceConnec tedPercent ageText =  null;
  356           va r $sptr_ra tedDisabil ities = nu ll;
  357  
  358           va r $sptr_ag entOrangeL ocation =  null;
  359           va r sptr_age ntOrangeLo cationText  = null;
  360           va r $sptr_ra diationExp osureMetho d = null;
  361           va r sptr_rad iationExpo sureMethod Text = nul l;
  362  
  363           va r $sptr_no seThroatRa diumInfo =  null;
  364           va r $sptr_di agnosedWit hCancer =  null;
  365           va r sptr_dia gnosedWith CancerText  = null;
  366  
  367           va r $sptr_mi litarySexu alTraumaIn fo = null;
  368           va r $sptr_mi lSexTrauma Status = n ull;
  369           va r sptr_mil SexTraumaS tatusText  = null;
  370  
  371           // Data from  parentnode  'military ServiceInf o' 
  372           va r $sptr_mi litaryServ iceInfo =  null;
  373           va r $sptr_co mbatVetera nEligibili tyEndDate  = null;
  374           va r sptr_com batVeteran Eligibilit yEndDateTe xt = null;
  375           va r $sptr_sh adIndicato r = null;
  376           va r sptr_sha dIndicator Text = nul l;
  377  
  378           va r sptr_rat edDisabili tyPercenta geTotal =  0;
  379           va r sptr_det ailrowcoun t = 0;
  380  
  381           if  (sptr_Enr ollmentEli gibilitySu mmaryData  != null) {
  382                $sptr_en rollmentDe terminatio nInfo = sp tr_Enrollm entEligibi litySummar yData.Data .Enrollmen tDetermina tionInfo;
  383           }
  384  
  385           if  ($sptr_en rollmentDe terminatio nInfo != n ull) {
  386                $sptr_pr imaryEligi bility = $ sptr_enrol lmentDeter minationIn fo.Primary Eligibilit y;
  387                if ($spt r_primaryE ligibility  != null)  {
  388                    $spt r_type = $ sptr_prima ryEligibil ity.Type;
  389                    if ( $sptr_type  != null)  { sptr_typ eText = $s ptr_type;  }
  390                }
  391                $sptr_en rollmentCa tegoryName  = $sptr_e nrollmentD eterminati onInfo.Enr ollmentCat egoryName;
  392                if ($spt r_enrollme ntCategory Name != nu ll) { sptr _enrollmen tCategoryN ameText =  $sptr_enro llmentCate goryName;  }
  393  
  394                $sptr_sp ecialFacto rs = $sptr _enrollmen tDetermina tionInfo.S pecialFact ors;
  395                if ($spt r_specialF actors !=  null) {
  396                    $spt r_envConta minantsInd  = $sptr_s pecialFact ors.EnvCon taminantsI nd;
  397                    if ( $sptr_envC ontaminant sInd != nu ll) { sptr _envContam inantsIndT ext = $spt r_envConta minantsInd ; }
  398  
  399                    $spt r_radiatio nExposureI nd = $sptr _specialFa ctors.Radi ationExpos ureInd;
  400                    if ( $sptr_radi ationExpos ureInd !=  null) { sp tr_radiati onExposure IndText =  $sptr_radi ationExpos ureInd; }
  401  
  402                    $spt r_agentOra ngeInd = $ sptr_speci alFactors. AgentOrang eInd;
  403                    if ( $sptr_agen tOrangeInd  != null)  { sptr_age ntOrangeIn dText = $s ptr_agentO rangeInd;  }
  404  
  405                    $spt r_campLeje uneInd = $ sptr_speci alFactors. CampLejeun eInd;
  406                    if ( $sptr_camp LejeuneInd  != null)  { sptr_cam pLejeuneIn dText = $s ptr_campLe jeuneInd;  }
  407  
  408                    $spt r_agentOra ngeLocatio n = $sptr_ specialFac tors.Agent OrangeLoca tion;
  409                    if ( $sptr_agen tOrangeLoc ation != n ull) { spt r_agentOra ngeLocatio nText = $s ptr_agentO rangeLocat ion; }
  410  
  411                    $spt r_radiatio nExposureM ethod = $s ptr_specia lFactors.R adiationEx posureMeth od;
  412                    if ( $sptr_radi ationExpos ureMethod  != null) {  sptr_radi ationExpos ureMethodT ext = $spt r_radiatio nExposureM ethod; }
  413                }
  414  
  415                $sptr_se rviceConne ctionAward  = $sptr_e nrollmentD eterminati onInfo.Ser viceConnec tionAward;
  416                if ($spt r_serviceC onnectionA ward != nu ll) {
  417                    $spt r_serviceC onnectedPe rcentage =  $sptr_ser viceConnec tionAward. ServiceCon nectedPerc entage;
  418                    if ( $sptr_serv iceConnect edPercenta ge != null ) { sptr_s erviceConn ectedPerce ntageText  = $sptr_se rviceConne ctedPercen tage; }
  419  
  420                    //Re ference to  grid
  421                    var  sptr_grid  = document .getElemen tById("spe cialTreatm entGrid");
  422                    var  sptr_row =  sptr_grid .insertRow (1);
  423                    var  sptr_cell1  = sptr_ro w.insertCe ll(0);
  424                    sptr _cell1.inn erHTML = " Service Co nnected: "  + sptr_se rviceConne ctedPercen tageText +  "%";
  425  
  426                    //Ch eck servic e connecte d percenta ge
  427                    if ( sptr_servi ceConnecte dPercentag eText != n ull && spt r_serviceC onnectedPe rcentageTe xt > 0) {
  428                         if (sptr_t anConfigur ation == f alse) {
  429                             parent .Xrm.Page. getControl ("ftp_serv iceconnect edconditio n").setDis abled(fals e);
  430                             if (sp tr_parentI ncident ==  false) {
  431                                 pa rent.Xrm.P age.getAtt ribute("ft p_servicec onnectedco ndition"). setRequire dLevel("re quired");
  432                             }
  433                         }
  434                    }
  435  
  436                    var  sptr_detai lrowcount  = 1;
  437  
  438                    $spt r_ratedDis abilities  = $sptr_se rviceConne ctionAward .RatedDisa bilities;
  439                    //Ge t each dis ability li sted
  440                    for  (var i = 0 ; !!$sptr_ ratedDisab ilities &&  Array.isA rray($sptr _ratedDisa bilities.R atedDisabi lity) && i  <= $sptr_ ratedDisab ilities.Ra tedDisabil ity.length  - 1; i++)  {
  441                         var sptr_r atedDisabi lityPercen t = 0;
  442                         var sptr_d isability  = null;
  443                         if (Number ($sptr_rat edDisabili ties.Rated Disability [i].Percen tage) > 0)  {
  444                             sptr_r atedDisabi lityPercen tageTotal  = sptr_rat edDisabili tyPercenta geTotal +  Number($sp tr_ratedDi sabilities .RatedDisa bility[i]. Percentage );
  445                             sptr_r atedDisabi lityPercen t = Number ($sptr_rat edDisabili ties.Rated Disability [i].Percen tage);
  446                         }
  447  
  448                         //Add to d etail grid
  449                         sptr_detai lrowcount  = sptr_det ailrowcoun t + 1;
  450                         var sptr_r ow = sptr_ grid.inser tRow(sptr_ detailrowc ount);
  451                         var sptr_c ell1 = spt r_row.inse rtCell(0);
  452                         sptr_cell1 .innerHTML  = $sptr_r atedDisabi lities.Rat edDisabili ty[i].Disa bility + "  (" + sptr _ratedDisa bilityPerc ent.toStri ng() + "%  SC)";
  453                    };
  454                }
  455  
  456                $sptr_no seThroatRa diumInfo =  $sptr_enr ollmentDet ermination Info.NoseT hroatRadiu mInfo;
  457                if ($spt r_noseThro atRadiumIn fo != null ) {
  458                    $spt r_diagnose dWithCance r = $sptr_ noseThroat RadiumInfo .Diagnosed WithCancer ;
  459                    if ( $sptr_diag nosedWithC ancer != n ull) { spt r_diagnose dWithCance rText = $s ptr_diagno sedWithCan cer; }
  460                }
  461  
  462                $sptr_mi litarySexu alTraumaIn fo = $sptr _enrollmen tDetermina tionInfo.M ilitarySex ualTraumaI nfo;
  463                if ($spt r_military SexualTrau maInfo !=  null) {
  464                    $spt r_milSexTr aumaStatus  = $sptr_m ilitarySex ualTraumaI nfo.Status ;
  465                    if ( $sptr_milS exTraumaSt atus != nu ll) { sptr _milSexTra umaStatusT ext = $spt r_milSexTr aumaStatus ; }
  466                }
  467           }
  468  
  469           if  (sptr_Enr ollmentEli gibilitySu mmaryData  != null) {
  470                $sptr_mi litaryServ iceInfo =  sptr_Enrol lmentEligi bilitySumm aryData.Da ta.Militar yServiceIn fo;
  471           }
  472           if  ($sptr_mi litaryServ iceInfo !=  null) {
  473                $sptr_co mbatVetera nEligibili tyEndDate  = $sptr_mi litaryServ iceInfo.Co mbatVetera nEligibili tyEndDate;
  474                if ($spt r_combatVe teranEligi bilityEndD ate != nul l) {
  475                    sptr _combatVet eranEligib ilityEndDa teText = s ptr_combat VeteranEli gibilityEn dDateText  = $sptr_co mbatVetera nEligibili tyEndDate;
  476                }
  477                $sptr_sh adIndicato r = $sptr_ militarySe rviceInfo. ShadIndica tor;
  478                if ($spt r_shadIndi cator != n ull) { spt r_shadIndi catorText  = $sptr_sh adIndicato r; }
  479           }
  480  
  481           // If no elig ibility sp ecified, s et to fals e
  482           if  (sptr_typ eText == n ull || spt r_typeText  == '') {  sptr_typeT ext = fals e; }
  483  
  484           // Change boo lean value s to false  if not ma rked true
  485           if  (sptr_env Contaminan tsIndText  != 'true')  { sptr_en vContamina ntsIndText  = false;  }
  486           if  (sptr_rad iationExpo sureIndTex t != 'true ') { sptr_ radiationE xposureInd Text = fal se; }
  487           if  (sptr_age ntOrangeIn dText != ' true') { s ptr_agentO rangeIndTe xt = false ; }
  488           if  (sptr_cam pLejeuneIn dText != ' true') { s ptr_campLe jeuneIndTe xt = false ; }
  489  
  490           if  (sptr_dia gnosedWith CancerText  != 'true' ) { sptr_d iagnosedWi thCancerTe xt = false ; }
  491           if  (sptr_sha dIndicator Text != 't rue') { sp tr_shadInd icatorText  = false;  }
  492  
  493           // Change all  True/Fals e to Yes/N o and Hide  No column s
  494           if  (sptr_typ eText == f alse) { sp tr_typeTex t = 'No';  }
  495  
  496           if  (sptr_tan Configurat ion == fal se) {
  497                if (sptr _envContam inantsIndT ext == "tr ue") {
  498                    sptr _envContam inantsIndT ext = "Yes ";
  499                    pare nt.Xrm.Pag e.getContr ol("ftp_so uthwestasi acondition s").setDis abled(fals e);
  500                    if ( sptr_paren tIncident  == false)  {
  501                         parent.Xrm .Page.getA ttribute(" ftp_southw estasiacon ditions"). setRequire dLevel("re quired");
  502                    }
  503                }
  504                if (sptr _radiation ExposureIn dText == " true") {
  505                    sptr _radiation ExposureIn dText = "Y es";
  506                    pare nt.Xrm.Pag e.getContr ol("ftp_io nizingradi ationexpos ure").setD isabled(fa lse);
  507                    if ( sptr_paren tIncident  == false)  {
  508                         parent.Xrm .Page.getA ttribute(" ftp_ionizi ngradiatio nexposure" ).setRequi redLevel(" required") ;
  509                    }
  510                }
  511                if (sptr _agentOran geIndText  == "true")  {
  512                    sptr _agentOran geIndText  = "Yes";
  513                    pare nt.Xrm.Pag e.getContr ol("ftp_ag entorangee xposure"). setDisable d(false);
  514                    if ( sptr_paren tIncident  == false)  {
  515                         parent.Xrm .Page.getA ttribute(" ftp_agento rangeexpos ure").setR equiredLev el("requir ed");
  516                    }
  517                }
  518                if (sptr _diagnosed WithCancer Text == "t rue") {
  519                    sptr _diagnosed WithCancer Text = "Ye s";
  520                    pare nt.Xrm.Pag e.getContr ol("ftp_he adandornec kcancer"). setDisable d(false);
  521                    if ( sptr_paren tIncident  == false)  {
  522                         parent.Xrm .Page.getA ttribute(" ftp_headan dorneckcan cer").setR equiredLev el("requir ed");
  523                    }
  524                }
  525  
  526                if (sptr _milSexTra umaStatusT ext == nul l || sptr_ milSexTrau maStatusTe xt == '')  {
  527                    //*s ptr_disabi lityGrid.h ideColumn( "militaryS exualTraum a"); 
  528                } else {
  529                    pare nt.Xrm.Pag e.getContr ol("ftp_mi litarysexu altrauma") .setDisabl ed(false);
  530                    if ( sptr_paren tIncident  == false)  {
  531                         parent.Xrm .Page.getA ttribute(" ftp_milita rysexualtr auma").set RequiredLe vel("requi red");
  532                    }
  533                }
  534  
  535                if (sptr _combatVet eranEligib ilityEndDa teText !=  null && sp tr_combatV eteranElig ibilityEnd DateText ! = '') {
  536                    sptr _combatVet eranEligib ilityEndDa teText = ' Yes';
  537                    pare nt.Xrm.Pag e.getContr ol("ftp_co mbatvetera n").setDis abled(fals e);
  538                    if ( sptr_paren tIncident  == false)  {
  539                         parent.Xrm .Page.getA ttribute(" ftp_combat veteran"). setRequire dLevel("re quired");
  540                    }
  541                }
  542  
  543                if (sptr _shadIndic atorText = = "true")  {
  544                    sptr _shadIndic atorText =  "Yes";
  545                    pare nt.Xrm.Pag e.getContr ol("ftp_sh ipboardhaz ardanddefe nse").setD isabled(fa lse);
  546                    if ( sptr_paren tIncident  == false)  {
  547                         parent.Xrm .Page.getA ttribute(" ftp_shipbo ardhazarda nddefense" ).setRequi redLevel(" required") ;
  548                    }
  549                }
  550           }
  551       }
  552       catch  (err) {
  553           al ert("Speci al Treatme nt Control  Grid Web  Resource F unction Er ror(sptr_B uildGrid):  " + err.m essage);
  554       }
  555   }
  556  
  557   function s ptr_execut eCrmOdataG etRequest( sptr_jsonQ uery, sptr _aSync, sp tr_aSyncCa llback, sp tr_skipCou nt, sptr_o ptionArray ) {
  558       //This  function  executes a  CRM Odata  web servi ce call to  retrieve  Crm data
  559       //*spt r_jsonQuer y* - a pro perly form atted CRM  Odata Quer y string ( required)
  560       //*spt r_aSync* -  specify ' true' to e xecute asy nchronousl y otherwis e 'false'  (required)
  561       //*spt r_aSyncCal lback* - s pecify the  name of t he return  function t o call upo n completi on (requir ed if sptr _aSync = t rue.  Othe rwise '')
  562       //*spt r_skipCoun t* - Initi al setting  is always  '0', incr ements by  50 per CRM  SDK Odata  standards  (required )
  563       //*spt r_optionAr ray* - is  an optiona l array or  single va lue, that  contains a dditional  task speci fic variab les that c an be pass ed between  functions  (pass 'nu ll' if not  used)
  564       try {
  565           va r sptr_ent ityData =  null;
  566           $. ajax({
  567                type: 'G ET',
  568                contentT ype: 'appl ication/js on; charse t=utf-8',
  569                datatype : 'json',
  570                url: spt r_jsonQuer y,
  571                beforeSe nd: functi on (XMLHtt pRequest)  {
  572                    XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json');
  573                },
  574                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  575                    sptr _entityDat a = data;
  576                    if ( sptr_aSync  == true)  {
  577                         sptr_aSync Callback(s ptr_entity Data, sptr _skipCount , sptr_opt ionArray);
  578                    }
  579                },
  580                error: f unction (X MLHttpRequ est, textS tatus, err orThrown)  {
  581                    aler t('Fail: A jax Error  in sptr_ex ecuteCrmOd ataGetRequ est: ' + e rrorThrown  + " Reque st: " + sp tr_jsonQue ry);
  582                },
  583                async: s ptr_aSync,
  584                cache: f alse
  585           }) ;
  586           re turn sptr_ entityData ;
  587       }
  588       catch  (err) {
  589           al ert('An er ror occure d in the s ptr_execut eCrmOdataG etRequest  function.   Error Det ail Messag e: ' + err );
  590       }
  591   }
  592  
  593   function s ptr_getMul tipleEntit yDataAsync (sptr_enti tySetName,  sptr_attr ibuteSet,  sptr_condi tionalFilt er, sptr_s ortAttribu te, sptr_s ortDirecti on, sptr_s kipCount,  sptr_aSync Callback,  sptr_optio nArray) {
  594       //This  function  returns a  CRM JSON d ataset for  all entit y records  matching c riteria pr ovided Asy ncronously
  595       //*spt r_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  596       //*spt r_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  597       //*spt r_conditio nalFilter*  - is the  conditiona l filter v alue place d on the d ata values  retrived  e.g. 'Stat eCode/Valu e eq 0'  t o retrieve  active co ntact reco rds only
  598       //*spt r_sortAttr ibute* - i s a string  containin g the name  of the at tribute to  sort the  result set  by e.g. ' LastName'
  599       //*spt r_sortDire ction* - i s a string  specifyin g the sort  as Ascend ing or Des cending e. g. 'asc' o r 'desc'
  600       //*spt r_skipCoun t* - is th e starting  point in  the result  (use if m ore than 5 0), (Put 0  if not us ed)
  601       //*spt r_aSyncCal lback* - i s the name  of the fu nction to  call when  returning  the result
  602       //*spt r_optionAr ray* - is  an optiona l array, t hat contai ns additio nal task s pecific va riables th at can be  passed bet ween funct ions
  603  
  604       try {
  605           va r sptr_jso nQuery = s ptr_server Url + sptr _crmOdataE ndPoint +  '/' + sptr _entitySet Name + '?$ select=' +  sptr_attr ibuteSet +  '&$filter =' + sptr_ conditiona lFilter +  '&$orderby =' + sptr_ sortAttrib ute + ' '  + sptr_sor tDirection  + '&$skip =' + sptr_ skipCount;
  606           sp tr_execute CrmOdataGe tRequest(s ptr_jsonQu ery, true,  sptr_aSyn cCallback,  sptr_skip Count, spt r_optionAr ray);
  607       }
  608       catch  (err) {
  609           al ert('An er ror occure d in the s ptr_getMul tipleEntit yDataAsync  function.   Error De tail Messa ge: ' + er r);
  610       }
  611   }
  612  
  613   function s ptr_getSin gleEntityD ataSync(sp tr_entityS etName, sp tr_attribu teSet, spt r_entityId ) {
  614       //This  function  returns a  CRM JSON d ataset for  a single  entity rec ord based  on the ent ity id pro vided Sync ronously
  615       //*spt r_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  616       //*spt r_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  617       //*spt r_entityId * - is the  Guid for  the entity  record
  618  
  619       try {
  620           va r sptr_ent ityIdNoBra cket = spt r_entityId .replace(/ ({|})/g, ' ');
  621           va r sptr_sel ectString  = '(guid'  + "'" + sp tr_entityI dNoBracket  + "'" + ' )?$select= ' + sptr_a ttributeSe t;
  622           va r sptr_jso nQuery = s ptr_server Url + sptr _crmOdataE ndPoint +  '/' + sptr _entitySet Name + spt r_selectSt ring;
  623           va r sptr_ent ityData =  sptr_execu teCrmOdata GetRequest (sptr_json Query, fal se, '', 0,  null);
  624           re turn sptr_ entityData ;
  625       }
  626       catch  (err) {
  627           al ert('An er ror occure d in the s ptr_getSin gleEntityD ataSync fu nction.  E rror Detai l Message:  ' + err);
  628       }
  629   }