| // TODO ID項目のクリア(whatId__c, opp_id, service_id) | 
| function setVisitorPlaceDisabled() { | 
|     if (reporterEditFlg) { | 
|         document.getElementById('Page:mainForm:idDayEdit:idReporter_lkwgt').style.display = 'none'; | 
|     } | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idReporter'), reporterEditFlg); | 
|   | 
|     var actsize = j$(escapeVfId('idActSize')).value(); | 
|     var repFlg = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenReportReportFlg')).value(); | 
|     var accFlg = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenAccompanyingReportFlg')).value(); | 
|   | 
|     for (var i = 0; i < actsize; i++) { | 
|         strVD = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorDiv'; | 
|         strVP = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlace'; | 
|         strVP2 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlace2'; | 
|         strVPId = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlaceId'; | 
|         strVPHidden = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlaceHidden'; | 
|         strVPHiddenId = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlaceHiddenId'; | 
|         v1 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitor1'; | 
|         v2 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitor2'; | 
|         v3 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitor3'; | 
|         v4 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitor4'; | 
|         v5 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitor5'; | 
|         o1 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelOpp1'; | 
|         o2 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelOpp2'; | 
|         o3 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelOpp3'; | 
|         o4 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelOpp4'; | 
|         o5 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelOpp5'; | 
|   | 
|         s1 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelService1'; | 
|         // s2 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idRelService2'; | 
|         del = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idDelete'; | 
|         // 20200420 任务日报管理 add gzw start | 
|         //setButtonDisable(document.getElementById(del), false); | 
|         // 20200420 任务日报管理 add gzw end | 
|         vpCheck = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idFree_Input__c'; | 
|         if (document.getElementById(vpCheck).checked) { | 
|             document.getElementById(strVP).style.display = "none"; | 
|             document.getElementById(strVP2).style.display = "block"; | 
|             document.getElementById(strVP).value = ''; | 
|             document.getElementById(strVPId).value = ''; | 
|             document.getElementById(strVPHidden).value = ''; | 
|             document.getElementById(strVPHiddenId).value = ''; | 
|         } else { | 
|             document.getElementById(strVP).style.display = "block"; | 
|             document.getElementById(strVP2).style.display = "none"; | 
|             document.getElementById(strVP2).value = ''; | 
|         } | 
|   | 
|         if (j$(escapeVfId(strVD)).value() == null || j$(escapeVfId(strVD)).value() == '') { | 
|             setButtonDisable(document.getElementById(strVP), true); | 
|         } else { | 
|             if (j$(escapeVfId(strVPHidden)).value() == null || j$(escapeVfId(strVPHidden)).value() == '') { | 
|                 setButtonDisable(document.getElementById(strVP), false); | 
|             } | 
|         } | 
|         if (document.getElementById(vpCheck).checked) { | 
|             if (j$(escapeVfId(strVD)).value() == '病院' || j$(escapeVfId(strVD)).value() == '販売店' || j$(escapeVfId(strVD)).value() == '社内活動' || j$(escapeVfId(strVD)).value() == '社外イベント') { | 
|                 setButtonDisable(document.getElementById(vpCheck), false); | 
|             } else { | 
|                 setButtonDisable(document.getElementById(vpCheck), true); | 
|                 document.getElementById(vpCheck).checked = false; | 
|                 setButtonDisable(document.getElementById(strVP), true); | 
|             } | 
|   | 
|             setButtonDisable(document.getElementById(v1), true); | 
|             setButtonDisable(document.getElementById(v2), true); | 
|             setButtonDisable(document.getElementById(v3), true); | 
|             setButtonDisable(document.getElementById(v4), true); | 
|             setButtonDisable(document.getElementById(v5), true); | 
|   | 
|             setButtonDisable(document.getElementById(o1), true); | 
|             setButtonDisable(document.getElementById(o2), true); | 
|             setButtonDisable(document.getElementById(o3), true); | 
|             setButtonDisable(document.getElementById(o4), true); | 
|             setButtonDisable(document.getElementById(o5), true); | 
|             setButtonDisable(document.getElementById(s1), true); | 
|             // setButtonDisable(document.getElementById(s2), true); | 
|         } else { | 
|             if (j$(escapeVfId(strVD)).value() == '病院' || j$(escapeVfId(strVD)).value() == '販売店' || j$(escapeVfId(strVD)).value() == '社内活動' || j$(escapeVfId(strVD)).value() == '社外イベント') { | 
|                 setButtonDisable(document.getElementById(vpCheck), false); | 
|             } | 
|             if (j$(escapeVfId(strVD)).value() == '病院') { | 
|                 setButtonDisable(document.getElementById(v1), false); | 
|                 setButtonDisable(document.getElementById(v2), false); | 
|                 setButtonDisable(document.getElementById(v3), false); | 
|                 setButtonDisable(document.getElementById(v4), false); | 
|                 setButtonDisable(document.getElementById(v5), false); | 
|   | 
|                 setButtonDisable(document.getElementById(o1), false); | 
|                 setButtonDisable(document.getElementById(o2), false); | 
|                 setButtonDisable(document.getElementById(o3), false); | 
|                 setButtonDisable(document.getElementById(o4), false); | 
|                 setButtonDisable(document.getElementById(o5), false); | 
|                 setButtonDisable(document.getElementById(s1), false); | 
|                 // setButtonDisable(document.getElementById(s2), false); | 
|                 // ここからは以前の動きと同じにする | 
|                 // 販売店:商談入力可能 ほか:なにも出来ません | 
|             } else { | 
|                 if (j$(escapeVfId(strVD)).value() == '販売店') { | 
|                     setButtonDisable(document.getElementById(o1), false); | 
|                     setButtonDisable(document.getElementById(o2), false); | 
|                     setButtonDisable(document.getElementById(o3), false); | 
|                     setButtonDisable(document.getElementById(o4), false); | 
|                     setButtonDisable(document.getElementById(o5), false); | 
|                 } else { | 
|                     setButtonDisable(document.getElementById(o1), true); | 
|                     setButtonDisable(document.getElementById(o2), true); | 
|                     setButtonDisable(document.getElementById(o3), true); | 
|                     setButtonDisable(document.getElementById(o4), true); | 
|                     setButtonDisable(document.getElementById(o5), true); | 
|                 } | 
|                 setButtonDisable(document.getElementById(v1), true); | 
|                 setButtonDisable(document.getElementById(v2), true); | 
|                 setButtonDisable(document.getElementById(v3), true); | 
|                 setButtonDisable(document.getElementById(v4), true); | 
|                 setButtonDisable(document.getElementById(v5), true); | 
|   | 
|                 setButtonDisable(document.getElementById(s1), true); | 
|                 // setButtonDisable(document.getElementById(s2), true); | 
|             } | 
|         } | 
|         setBtnEnable(i, repFlg, accFlg); | 
|   | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idReportDate'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoStartHour'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoStartMinute'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoEndHour'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoEndMinute'), false); | 
|         setButtonDisable(document.getElementById('idBusinessTripYes'), false); | 
|         setButtonDisable(document.getElementById('idBusinessTripNo'), false); | 
|         if (document.getElementById('Page:mainForm:idDayEdit:idBusinessTrip').checked) { | 
|             document.getElementById('idBusinessTripYes').checked = true; | 
|         } else { | 
|             document.getElementById('idBusinessTripNo').checked = true; | 
|         } | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idStatus'), false); | 
|         setButtonDisable(document.getElementById('idSendMail'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idAddAct'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idFeedBack'), managerFlg); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idMailSendCheck'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idHome'), false); | 
|         setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idDaily'), false); | 
|         setButtonsDisable(j$("input.idSave"), false); | 
|         //setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idActivities:'+ i + ':idMinister'), true); | 
|         //setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idActivities:'+ i + ':idManager'), true); | 
|         //setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idActivities:'+ i + ':idMinisterComment'), true); | 
|         //setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idActivities:'+ i + ':idManagerComment'), true); | 
|     } | 
|     setDisabledByStatus(); | 
|     // vpChack1(); | 
| } | 
|   | 
| //20200827 访问场所不允许修改 zh start | 
| function vpChack1() { | 
|     var allLine = document.getElementById('Page:mainForm:idDayEdit:AllSize').value; | 
|     var repOwnerJob = document.getElementById('Page:mainForm:idDayEdit:idHiddenRepOwnerJob').value; | 
|     for (var i = 0; i < allLine; i++) { | 
|         var visitor = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorDiv').value; | 
|         var valCheck = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlaceHidden').value; | 
|         var disabledPlace = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':isDisabledVisitorPlace').value; | 
|         if (visitor != '' && visitor != null && disabledPlace == 'false') { | 
|             document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorDiv').disabled = true; | 
|         } | 
|         if (valCheck != null && valCheck != '' && disabledPlace == 'false') { | 
|             document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlace').disabled = true; | 
|         } | 
|         if (repOwnerJob == '销售服务') { | 
|             var puroposeTypeFSE1 = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idPuroposeTypeFSE1').value; | 
|             if (puroposeTypeFSE1 == '合同季报' && disabledPlace == 'false') { | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idPuroposeTypeFSE1').disabled = true; | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idActivityPurposeFSEDiv').disabled = true; | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idRelService1').disabled = true; | 
|   | 
|             } | 
|             //2021-09-29   mzy  点检改善开发 start | 
|             if(puroposeTypeFSE1 == '合同点检' && disabledPlace == 'false'){ | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idPuroposeTypeFSE1').disabled = true; | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idActivityPurposeFSEDiv').disabled = true; | 
|                 document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idRelService1').disabled = true; | 
|             } | 
|             //2021-09-29   mzy  点检改善开发 end | 
|         } | 
|   | 
|     } | 
|   | 
| } | 
| //20200827 访问场所不允许修改 zh end | 
|   | 
| // 20200420 任务日报管理 add gzw start | 
| function setDisabledByStatus() { | 
|     var actsize = j$(escapeVfId('idActSize')).value(); | 
|     for (var i = 0; i < actsize; i++) { | 
|         var EventStatus = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + i + ':idEventStatus')).text(); | 
|         console.log(EventStatus); | 
|         if (!!EventStatus) { | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + i + ':idfieldset')).attr('disabled', 'disabled'); | 
|         } | 
|         //sla信息更新按钮 zh | 
|         var valCheckService1 = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idRelService1').value; | 
|         //2021-09-29  mzy  点检改善开发  update satrt | 
|         var repOwnerJob = document.getElementById('Page:mainForm:idDayEdit:idHiddenRepOwnerJob').value; | 
|         if (repOwnerJob == '销售服务') { | 
|             var puroposeTypeFSE1 = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + i + ':idPuroposeTypeFSE1').value; | 
|             if (valCheckService1 != null && valCheckService1 != ""&&puroposeTypeFSE1=='合同季报') { | 
|                 document.getElementById(i + ':idRelService1Btn').disabled = false; | 
|                 document.getElementById(i + ':idRelService1Btn').style.cssText = "width: 100px; cursor: default; border-color: rgb(196, 196, 196);background-position: 0px -90px;" | 
|             } | 
|         } | 
|         //2021-09-29  mzy  点检改善开发  update end | 
|     } | 
| } | 
|   | 
| // 任务和日报管理 update by vivek 2020-05-23 start  | 
| function cancelsaveJS(index, eventid) { | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idCancelReasonFSE'; | 
|     var str1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idCancelReasonEscFSE'; | 
|     var strb = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idCancelReasonRemark'; | 
|     //2021-08-25 SWAG-C66D37 【委托】日报取消,OPD计划取消  start | 
|     var checkOPDbox = 'Page:mainForm:idDayEdit:idActivities:' + index + ':opd'; | 
|     //2021-08-25 SWAG-C66D37 【委托】日报取消,OPD计划取消  end | 
|     var celd = j$(escapeVfId(str)).value(); | 
|     var celd1 = j$(escapeVfId(str1)).value(); | 
|     var celrd = j$(escapeVfId(strb)).value(); | 
|     //2021-08-25 SWAG-C66D37 【委托】日报取消,OPD计划取消  start | 
|     var celOPDbox2 = j$(escapeVfId(checkOPDbox)).children()[0].alt; | 
|   | 
|     if (celOPDbox2 == '选取的') { | 
|         if (window.confirm('该医院的OPD计划是否确认取消?如需改期,请选择延期及理由或进入OPD计划进行延期。') == false) { | 
|             return; | 
|         } | 
|   | 
|     } | 
|     //2021-08-25 SWAG-C66D37 【委托】日报取消,OPD计划取消  end | 
|   | 
|   | 
|   | 
|     // 2020-09-22  mzy  任务管理改善  start | 
|     var istaskblankStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':idIsTaskBlank'; | 
|     var istaskblank = j$(escapeVfId(istaskblankStr)).value(); | 
|     var tskfseStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':tskidCancelReasonFSE'; | 
|     var tskfse =  j$(escapeVfId(tskfseStr)).value(); | 
|     var tskescStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':tskidCancelReasonEscFSE'; | 
|     var tskesc =  j$(escapeVfId(tskescStr)).value(); | 
|   | 
|     /*if (celd == '' && celd1 == '') { | 
|         alert('请填写取消理由。'); | 
|         return; | 
|     } else if (celd == '其他' || celd1 == '其他') { | 
|         if (celrd == '') { | 
|             alert('取消原因为其他,请补充其他原因。'); | 
|             return; | 
|         } else { | 
|             if (window.confirm('您是否要取消日历上的活动?')) { | 
|                 blockme(); | 
|                 ifCancelJS(index); | 
|   | 
|             } | 
|         } | 
|     } else { | 
|         if (window.confirm('您是否要取消日历上的活动?')) { | 
|             blockme(); | 
|             ifCancelJS(index); | 
|   | 
|         } | 
|     }*/ | 
|     //没任务 | 
|     if(istaskblank == 'true'){ | 
|         if (celd == '' && celd1 == '') { | 
|             alert('请填写取消理由。'); | 
|             return; | 
|         } else if (celd == '其他' || celd1 == '其他') { | 
|             if (celrd == '') { | 
|                 alert('取消原因为其他,请补充其他原因。'); | 
|                 return; | 
|             } | 
|         } | 
|     }else{ | 
|     //有任务   | 
|         if (tskfse == ''&&tskesc== ''){ | 
|             alert('请填写取消理由。'); | 
|             return; | 
|         } else if(tskfse =='其他' ||tskesc =='其他'){ | 
|             if(celrd == ''){ | 
|                 alert('取消原因为其他,请补充其他原因。'); | 
|                 return; | 
|             } | 
|         }  | 
|     } | 
|   | 
|     if (window.confirm('您是否要取消日历上的活动?')) { | 
|         blockme(); | 
|         ifCancelJS(index); | 
|   | 
|     } | 
|     // 2020-09-22  mzy  任务管理改善  end | 
| } | 
|   | 
| function delaysaveJS(index, eventid, taskDifferent, delayTaskDelay, latestDate) { | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idDelayDate'; | 
|     var reofse = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idDelayReasonFSE'; | 
|     var reoesc = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idDelayReasonEscFSE'; | 
|     var reo = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idDelayReason'; | 
|     var repd = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value(); | 
|     var reod = j$(escapeVfId(reo)).value(); | 
|     var reodfse = j$(escapeVfId(reofse)).value(); | 
|     var reodesc = j$(escapeVfId(reoesc)).value(); | 
|     var dlyd = j$(escapeVfId(str)).value(); | 
|     //2021-08-25  mzy  SWAG-C5784H 【委托】事件无法延期 start | 
|     //获取拜访区分 | 
|     var visitQF = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorDiv'; | 
|     var visitQFV = j$(escapeVfId(visitQF)).val(); | 
|     //2021-08-25   mzy  SWAG-C5784H 【委托】事件无法延期 end | 
|   | 
|     // 2020-09-22  mzy  任务管理改善  start | 
|     var istaskblankStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':idIsTaskBlank'; | 
|     var istaskblank = j$(escapeVfId(istaskblankStr)).value(); | 
|     var tskfseStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':tskidDelayReasonFSE'; | 
|     var tskfse =  j$(escapeVfId(tskfseStr)).value(); | 
|     var tskescStr = 'Page:mainForm:idDayEdit:idActivities:'+index+':tskidDelayReasonEscFSE'; | 
|     var tskesc =  j$(escapeVfId(tskescStr)).value(); | 
|     // 2020-09-22  mzy  任务管理改善  end | 
|   | 
|     // if(taskDifferent == ''){ | 
|     //     alert('手动创建的日报明细不支持延期。请取消。'); | 
|     //     return; | 
|     // }else{ | 
|   | 
|     // } | 
|     // if(reod == ''){ | 
|     //     alert('请填写延期理由。'); | 
|     //     return; | 
|     // } | 
|     // alert(delayTaskDelay); | 
|     // alert('=='+eventid); | 
|     /* if (reodfse == '' && reodesc == '') { | 
|         alert('请填写延期理由。'); | 
|         return; | 
|     } | 
|     if (reodfse == '其他' || reodesc == '其他') { | 
|         if (reod == '') { | 
|             alert('延期理由为其他,请补充其他原因'); | 
|             return; | 
|         } | 
|     } */ | 
|   | 
|     // 2021-09-22  mzy  任务管理改善  start | 
|      //没任务的 | 
|      if(istaskblank =='true'){         | 
|         if (reodfse == '' && reodesc == '') { | 
|             alert('请填写延期理由。'); | 
|             return; | 
|         } | 
|   | 
|         if (reodfse == '其他' || reodesc == '其他') { | 
|             if (reod == '') { | 
|                 alert('延期理由为其他,请补充其他原因'); | 
|                 return; | 
|             } | 
|         } | 
|     }else{ | 
|     //有任务的 | 
|         if(tskfse == ''&&tskesc == ''){ | 
|             alert('请填写延期理由。'); | 
|             return; | 
|         } | 
|   | 
|         if (tskfse == '其他' || tskesc == '其他') { | 
|             if (reod == '') { | 
|                 alert('延期理由为其他,请补充其他原因'); | 
|                 return; | 
|             } | 
|         }    | 
|     } | 
|     // 2021-09-22  mzy  任务管理改善  end | 
|   | 
|     if (eventid == '') { | 
|         // alert('eventid'+eventid); | 
|         alert('手动创建的日报明细不支持延期。请取消。'); | 
|         return; | 
|     } else if (dlyd == '') { | 
|         alert('请填写延期日期。'); | 
|         // setDisabledByStatus(); | 
|         return; | 
|     } else { | 
|         var reparr = repd.split('/'); | 
|         // var repyear = reparr[0]; | 
|         var repyear = parseInt(reparr[0], 10) | 
|         var repmonth = parseInt(reparr[1], 10); | 
|         var repday = reparr[2]; | 
|         var dlyarr = dlyd.split('-'); | 
|         var dlyyear = dlyarr[0]; | 
|         var dlymonth = parseInt(dlyarr[1], 10); | 
|         var dlyday = dlyarr[2]; | 
|         // alert(repyear+'=='+dlyyear+';'+repmonth+'=='+dlymonth+'=='+repmonth+1); | 
|         // alert(repyear+1); | 
|         var today = new Date(); | 
|         var dlyday = new Date(dlyd); | 
|         // console.log('延期时间/日期:------'+dlyd + '------今天日期:--'+today); | 
|         // console.log('延期时间/日期 > 今天日期:--'+(dlyday>today)); | 
|         //return; | 
|         if ((repyear == dlyyear && repmonth == dlymonth) || (repyear == dlyyear && dlymonth == repmonth + 1) || (repyear + 1 == dlyyear && dlymonth == 1)) { | 
|             if (repyear == dlyyear && repmonth == dlymonth && repday >= dlyday) { | 
|                 alert('不能延期到本月之前的日期。'); | 
|                 return; | 
|             }else if(today >= dlyday){ | 
|                 //2022-01-27  mzy  判断延期日期 必须在今天之后 start | 
|                 alert('延期日期必须填写今天之后的日期。'); | 
|                 return; | 
|                 //2022-01-27  mzy  判断延期日期 必须在今天之后  end | 
|             } else | 
|             if (taskDifferent == '') { | 
|                 //2021-08-25  mzy SWAG-C5784H 【委托】事件无法延期 start | 
|                 // alert(taskDifferent+'taskDifferent'); | 
|                 if (visitQFV == '販売店' && visitQFV == '病院' && visitQFV == '社外イベント') { | 
|                     alert('手动创建的日报明细不支持延期。请取消。'); | 
|                     return; | 
|                 } else { | 
|                     if (window.confirm('您是否要延期日历上的活动?')) { | 
|                         blockme(); | 
|                         ifDelayJS(index); | 
|                     } | 
|                 } | 
|                 //2021-08-25  mzy SWAG-C5784H 【委托】事件无法延期 end | 
|             } else if (taskDifferent == '主动任务' && delayTaskDelay == 'false') { | 
|                 if (window.confirm('您是否要延期日历上的活动?')) { | 
|                     blockme(); | 
|                     ifDelayJS(index); | 
|                 } | 
|             } else if (taskDifferent == '主动任务' && delayTaskDelay == 'true' && repmonth != dlymonth) { | 
|                 alert('主动任务只能延期到本月。'); | 
|                 return; | 
|             //2021-10-13  mzy  任务管理改善  satrt | 
|             //上级分配任务 和主动任务、被动任务平级  , 判断 是被动任务的地方也要 加上上级分配任务 | 
|             //} else if (taskDifferent == '被动任务') { | 
|             } else if (taskDifferent == '被动任务' ||taskDifferent == '上级分配任务') { | 
|             //2021-10-13  mzy  任务管理改善   end | 
|                 var ms = 60 * (1000 * 60 * 60 * 24) | 
|                 var last = new Date(new Date(latestDate).getTime() + ms); | 
|                 var lastDate = last.getFullYear() + '-' + last.getMonth() + '-' + last.getDate(); | 
|                 //alert(lastDate<dlyd); | 
|                 if (dlyd > lastDate) { | 
|                     alert('只能延期到' + lastDate + '之前的日期'); | 
|                     return; | 
|                 } else { | 
|                     if (window.confirm('您是否要延期日历上的活动?')) { | 
|                         blockme(); | 
|                         ifDelayJS(index); | 
|                     } | 
|                 } | 
|   | 
|             } else { | 
|                 if (window.confirm('您是否要延期日历上的活动?')) { | 
|                     blockme(); | 
|                     ifDelayJS(index); | 
|                 } | 
|             } | 
|             // else if(taskDifferent == '被动任务' && repmonth != dlymonth){ | 
|             //     alert('被动任务只能延期到本月。'); | 
|             // } | 
|   | 
|   | 
|         } else { | 
|             alert('只能延期到本月或者下个月。'); | 
|             return; | 
|         } | 
|   | 
|     } | 
| } | 
| // 20200420 任务日报管理 add gzw end | 
|   | 
| function setBtnEnable(i, repFlg, accFlg) { | 
|     strVD = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorDiv'; | 
|     strVP = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlace'; | 
|     strVP2 = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idVisitorPlace2'; | 
|   | 
|     b01 = 'idLead' + i; | 
|     b02 = 'idOpportunityView' + i; | 
|     b03 = 'idMaintenance_Contract' + i; | 
|     b04 = 'idRepair' + i; | 
|     b05 = 'idMC' + i; | 
|     b06 = 'idInspections' + i; | 
|     b07 = 'idAsset_Manual' + i; | 
|     b08 = 'idAccDC' + i; | 
|     // SWAG-BUF6R8  20201020 youchang start | 
|     //b09 = 'idRental_Apply' + i; | 
|     // SWAG-BUF6R8  20201020 youchang end | 
|     b10 = 'idOPD' + i; | 
|     b11 = 'idNTC' + i; | 
|     b12 = 'idONCALL' + i; | 
|     b13 = 'idReportAccompanied' + i; | 
|     b14 = 'idCityStatus' + i; | 
|     b15 = 'idClaim' + i; | 
|     b16 = 'idConflict' + i; | 
|     // GIR Solution 2019-12-12 by vivek start | 
|     b17 = 'idSolution' + i; | 
|     // GIR Solution 2019-12-12 by vivek end | 
|     b18 = 'idETApp' + i; | 
|     // SWAG-BUF6R8  20201020 youchang start | 
|     b19 = 'idOpds' + i; | 
|     // SWAG-BUF6R8  20201020 youchang end | 
|     // zh 20210521 ETAPP 日报联动 start | 
|     b20 = 'idETAPPAct' + i; | 
|     // zh 20210521 End | 
|   | 
|     if (j$(escapeVfId(strVD)).value() == '病院') { | 
|         setButtonDisable(document.getElementById(b01), false); | 
|         setButtonDisable(document.getElementById(b02), false); | 
|         setButtonDisable(document.getElementById(b03), false); | 
|         setButtonDisable(document.getElementById(b04), false); | 
|         setButtonDisable(document.getElementById(b05), false); | 
|         setButtonDisable(document.getElementById(b06), false); | 
|         setButtonDisable(document.getElementById(b07), false); | 
|         setButtonDisable(document.getElementById(b08), false); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         //setButtonDisable(document.getElementById(b09), false); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         setButtonDisable(document.getElementById(b17), false); | 
|         // GIR Solution 2019-12-12 by vivek end | 
|         setButtonDisable(document.getElementById(b18), false); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         setButtonDisable(document.getElementById(b19), false); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // zh 20210521 ETAPP 日报联动 start | 
|         setButtonDisable(document.getElementById(b20), false); | 
|         // zh 20210521 End | 
|         if (accFlg == 'true') { | 
|             setButtonDisable(document.getElementById(b13), true); | 
|         } else { | 
|             setButtonDisable(document.getElementById(b13), false); | 
|         } | 
|   | 
|         if (repFlg == 'true') { | 
|             setButtonDisable(document.getElementById(b10), true); | 
|             setButtonDisable(document.getElementById(b11), true); | 
|             setButtonDisable(document.getElementById(b12), true); | 
|             setButtonDisable(document.getElementById(b14), true); | 
|             //setButtonDisable(document.getElementById(b15), true); | 
|             setButtonDisable(document.getElementById(b16), true); | 
|         } else { | 
|             setButtonDisable(document.getElementById(b10), false); | 
|             setButtonDisable(document.getElementById(b11), false); | 
|             setButtonDisable(document.getElementById(b12), false); | 
|             setButtonDisable(document.getElementById(b14), false); | 
|             //setButtonDisable(document.getElementById(b15), false); | 
|             setButtonDisable(document.getElementById(b16), false); | 
|   | 
|         } | 
|     } | 
|     // 社内活動はReport__c関連ボタンのみを対応 | 
|     else if (j$(escapeVfId(strVD)).value() == '社内活動') { | 
|         setButtonDisable(document.getElementById(b01), true); | 
|         setButtonDisable(document.getElementById(b02), true); | 
|         setButtonDisable(document.getElementById(b03), true); | 
|         setButtonDisable(document.getElementById(b04), true); | 
|         setButtonDisable(document.getElementById(b05), true); | 
|         setButtonDisable(document.getElementById(b06), true); | 
|         setButtonDisable(document.getElementById(b07), true); | 
|         setButtonDisable(document.getElementById(b08), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         //setButtonDisable(document.getElementById(b09), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         setButtonDisable(document.getElementById(b12), true); | 
|         setButtonDisable(document.getElementById(b13), true); | 
|         //setButtonDisable(document.getElementById(b15), true); | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         setButtonDisable(document.getElementById(b17), true); | 
|         // GIR Solution 2019-12-12 by vivek end | 
|         setButtonDisable(document.getElementById(b18), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         setButtonDisable(document.getElementById(b19), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // zh 20210521 ETAPP 日报联动 start | 
|         setButtonDisable(document.getElementById(b20), true); | 
|         // zh 20210521 End | 
|         if (repFlg == 'true') { | 
|             setButtonDisable(document.getElementById(b10), true); | 
|             setButtonDisable(document.getElementById(b11), true); | 
|             setButtonDisable(document.getElementById(b14), true); | 
|             setButtonDisable(document.getElementById(b16), true); | 
|         } else { | 
|             setButtonDisable(document.getElementById(b10), false); | 
|             setButtonDisable(document.getElementById(b11), false); | 
|             setButtonDisable(document.getElementById(b14), false); | 
|             setButtonDisable(document.getElementById(b16), false); | 
|         } | 
|     } | 
|     // 社外イベントはOPD/NTCボタンのみを対応 | 
|     //    else if(j$(escapeVfId(strVD)).value() == '社外イベント'){ | 
|     //        setButtonDisable(document.getElementById(b01), true); | 
|     //        setButtonDisable(document.getElementById(b02), true); | 
|     //        setButtonDisable(document.getElementById(b03), true); | 
|     //        setButtonDisable(document.getElementById(b04), true); | 
|     //        setButtonDisable(document.getElementById(b06), true); | 
|     //        setButtonDisable(document.getElementById(b07), true); | 
|     //        setButtonDisable(document.getElementById(b12), true); | 
|     //        setButtonDisable(document.getElementById(b13), true); | 
|     //        setButtonDisable(document.getElementById(b14), true); | 
|     //        setButtonDisable(document.getElementById(b15), true); | 
|     //        setButtonDisable(document.getElementById(b16), true); | 
|     //         | 
|     //        if(repFlg == 'true'){ | 
|     //            setButtonDisable(document.getElementById(b10), true); | 
|     //            setButtonDisable(document.getElementById(b11), true); | 
|     //        } | 
|     //        else{ | 
|     //            setButtonDisable(document.getElementById(b10), false); | 
|     //            setButtonDisable(document.getElementById(b11), false); | 
|     //        } | 
|     //    } | 
|     else { | 
|         setButtonDisable(document.getElementById(b01), true); | 
|         setButtonDisable(document.getElementById(b02), true); | 
|         setButtonDisable(document.getElementById(b03), true); | 
|         setButtonDisable(document.getElementById(b04), true); | 
|         setButtonDisable(document.getElementById(b05), true); | 
|         setButtonDisable(document.getElementById(b06), true); | 
|         setButtonDisable(document.getElementById(b07), true); | 
|         setButtonDisable(document.getElementById(b08), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         //setButtonDisable(document.getElementById(b09), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         setButtonDisable(document.getElementById(b10), true); | 
|         setButtonDisable(document.getElementById(b11), true); | 
|         setButtonDisable(document.getElementById(b12), true); | 
|         setButtonDisable(document.getElementById(b13), true); | 
|         setButtonDisable(document.getElementById(b14), true); | 
|         //setButtonDisable(document.getElementById(b15), true); | 
|         setButtonDisable(document.getElementById(b16), true); | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         setButtonDisable(document.getElementById(b17), true); | 
|         // GIR Solution 2019-12-12 by vivek end | 
|         setButtonDisable(document.getElementById(b18), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         setButtonDisable(document.getElementById(b19), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // zh 20210521 ETAPP 日报联动 start | 
|         setButtonDisable(document.getElementById(b20), true); | 
|         // zh 20210521 End | 
|     } | 
| } | 
|   | 
| function checkLocation(index) { | 
|     var freeInput = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idFree_Input__c'); | 
|     // Manual Input判断 | 
|     if (freeInput.checked) { | 
|         alert(Error_Message15); | 
|         return false; | 
|     } | 
|   | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'; | 
|     var aName = j$(escapeVfId(str)).value(); | 
|     if (aName == '') { | 
|         // 訪問場所を設定してください。 | 
|         alert(Error_Message16); | 
|         return false; | 
|     } | 
|   | 
|     var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var vl = j$(escapeVfId(strVP)).value(); | 
|     if (vl.length == 0) { | 
|         // 訪問場所が存在しません。 | 
|         alert(Error_Message15); | 
|         return false; | 
|     } | 
|   | 
|     var match = sforce.apex.execute("Add_Report", "checkAccountMatch", { name: aName, id: vl }); | 
|     if (match == "NG") { | 
|         // 訪問場所IDマッチしていない | 
|         alert(Error_Message15); | 
|         return false; | 
|     } | 
|     return true; | 
| } | 
|   | 
| function searchVisitor2(index, val) { | 
|     if (!checkLocation(index)) { | 
|         return; | 
|     } | 
|   | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'; | 
|     var strId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var aName = j$(escapeVfId(str)).value(); | 
|     var aId = j$(escapeVfId(strId)).value(); | 
|   | 
|     var vp = aId; | 
|   | 
|     j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden')).val(aName); | 
|     j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId')).val(aId); | 
|     var strId1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1'; | 
|     var strHid1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1_IdHidden'; | 
|     var strVa1 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1_IdHidden')).value() | 
|     var strId2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2'; | 
|     var strHid2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2_IdHidden'; | 
|     var strVa2 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2_IdHidden')).value(); | 
|     var strId3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3'; | 
|     var strHid3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3_IdHidden'; | 
|     var strVa3 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3_IdHidden')).value(); | 
|     var strId4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4'; | 
|     var strHid4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4_IdHidden'; | 
|     var strVa4 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4_IdHidden')).value(); | 
|     var strId5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5'; | 
|     var strHid5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5_IdHidden'; | 
|     var strVa5 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5_IdHidden')).value(); | 
|   | 
|     var urlStr = '/apex/SearchVisitor?id1=' + strId1 + '&hId1=' + strHid1 + '&idVa1=' + strVa1 + '&id2=' + strId2 + '&hId2=' + strHid2 + '&idVa2=' + strVa2 + '&id3=' + strId3 + '&hId3=' + strHid3 + '&idVa3=' + strVa3 + '&id4=' + strId4 + '&hId4=' + strHid4 + '&idVa4=' + strVa4 + '&id5=' + strId5 + '&hId5=' + strHid5 + '&idVa5=' + strVa5 + '&val=' + val + '&vp=' + vp; | 
|     var w = window.open(urlStr, 'SearchVisitor', 'menubar=no,height=720,width=1086'); | 
|     w.focus(); | 
| } | 
|   | 
| function addLeadNew(index, eid) { | 
|     try { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = eid; | 
|         b01 = 'idLead' + index; | 
|         setButtonDisable(document.getElementById(b01), true); | 
|         addLeadNewJS(index); | 
|     } catch (e) { | 
|         alert(Error_Message26); | 
|     } | 
| } | 
|   | 
| function addLead(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|   | 
|         var visitor1 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1')).value(); | 
|         var visitor1id = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1_IdHidden')).value(); | 
|         var point = visitor1.indexOf(" ", 0); | 
|         var visitorPlace = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace')).value(); | 
|         var result = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idDescription')).value(); | 
|         //var urlStr = '/00Q/e?retURL=%2F00Q&RecordType=01210000000QiRfAAK&CF00N10000002CvC5_lkid=' + accountRecord[0].Hospital__r.Id + '&CF00N10000002CvC5=' + encodeURI(accountRecord[0].Hospital__r.Name); | 
|         var urlStr = '/00Q/e?retURL=%2F00Q&RecordType=01210000000QiRfAAK&CF00N10000002CvC5_lkid=' + accountRecord[0].Id + '&CF00N10000002CvC5=' + encodeURI(accountRecord[0].Name); | 
|         if (point > 0) { | 
|             urlStr = urlStr + '&name_lastlea2=' + encodeURI(visitor1.substring(0, point)); | 
|             urlStr = urlStr + '&name_firstlea2=' + encodeURI(visitor1.substring(point)); | 
|         } else if (visitor1 != '') { | 
|             urlStr = urlStr + '&name_lastlea2=' + encodeURI(visitor1); | 
|         } | 
|   | 
|         if (result != '') { | 
|             urlStr = urlStr + '&00N10000002CvBM=' + encodeURI(result); | 
|         } | 
|   | 
|         if (visitor1 != '') { | 
|             urlStr = urlStr + '&CF00N10000006ps6f=' + encodeURI(visitor1); | 
|             urlStr = urlStr + '&CF00N10000006ps6f_lkid=' + visitor1id; | 
|         } | 
|         urlStr = urlStr + '&lea3=' + encodeURI(visitorPlace) + '&lea5=' + encodeURI('直接拜访') + '&ent=Lead'; | 
|         urlStr = urlStr + '&saveURL=%2Fapex%2FSaveLeadFromReport%3Feid%3D' + eid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b01 = 'idLead' + index; | 
|     setButtonDisable(document.getElementById(b01), false); | 
| } | 
| // zys 20200630 Start | 
| function ETAppOpen(index) { | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var accid = j$(escapeVfId(str)).value(); | 
|   | 
|     //console.log("accid:"+accid); | 
|     if (!!accid && accid.startsWith("001")) { | 
|         if (!confirm('请先保存日报再跳转。日报是否已经保存?')) { | 
|             return; | 
|         } | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: accid }); | 
|         var hpid = accountRecord[0].Hospital__r.Id; | 
|         var urlStr = 'ocsmet://Activity/' + hpid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } else { | 
|         alert('没有选择医院,不能跳转'); | 
|     } | 
| } | 
| // zys 20200630 End | 
| // zh 20210520 Start | 
| function openETAPPAct(index) { | 
|     var but = 'idETAPPAct' + index; | 
|     setButtonDisable(document.getElementById(but), true); | 
|     var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var accid = j$(escapeVfId(str)).value(); | 
|     tempIndex = index; | 
|     tempActId = accid; | 
|     if (!!accid && accid.startsWith("001")) { | 
|         openETAPPActJS(index); | 
|         // var urlStr = '/apex/productsh?Id=' + accid; | 
|         // window.open(urlStr,'_blank',''); | 
|     } else { | 
|         alert('没有填写访问场所,不能跳转'); | 
|         setButtonDisable(document.getElementById(but), false); | 
|     } | 
| } | 
|   | 
| function openETAPPActNew(index, accid) { | 
|     var urlStr = '/apex/productsh?Id=' + accid; | 
|     window.open(urlStr, '_blank', ''); | 
|     var but = 'idETAPPAct' + index; | 
|     setButtonDisable(document.getElementById(but), false); | 
| } | 
| // zh 20210520 End | 
| function addInsReportNew(index, eid, insid) { | 
|     if (insid != "") { | 
|         // 点検報告書IDあれば、編集モードに | 
|         var urlStr = '/apex/OFSInsReportLayout?id=' + insid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } else { | 
|         try { | 
|             if (!checkLocation(index)) { | 
|                 return; | 
|             } | 
|   | 
|             tempIndex = index; | 
|             tempActId = eid; | 
|             b01 = 'idInspections' + index; | 
|             setButtonDisable(document.getElementById(b01), true); | 
|             addInsReportNewJS(index); | 
|         } catch (e) { | 
|             alert(Error_Message26); | 
|         } | 
|     } | 
| } | 
|   | 
| function addInsReport(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|   | 
|         var urlStr = '/apex/OFSInsReportLayout?rt=EndoscopeSystem&hpid=' + accountRecord[0].Id + '&ecid=' + eid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b01 = 'idInspections' + index; | 
|     setButtonDisable(document.getElementById(b01), false); | 
| } | 
| // GIR Solution 2019-12-12 by vivek start | 
| function addSolutionNew(index, eid) { | 
|     try { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = eid; | 
|         b17 = 'idSolution' + index; | 
|         setButtonDisable(document.getElementById(b17), true); | 
|         addSolutionNewJS(index); | 
|     } catch (e) { | 
|         alert(Error_Message26); | 
|     } | 
| } | 
|   | 
| function addSolution(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("ControllerUtil", "getAccountForJs", { id: vl }); | 
|         var urlStr = '/a3k/e?Name=*'; | 
|         // var urlStr = '/a3n/e?Name=*'; | 
|         // urlStr += '&Account_lkid=' + accountRecord[0].Id; | 
|         // urlStr += '&Account=' + encodeURI(accountRecord[0].Name); | 
|   | 
|         // urlStr += '&CF00Np00000044oDP_lkid=' + accountRecord[0].Department_Class__r.Id; | 
|         // urlStr += '&CF00Np00000044oDP=' + encodeURI(accountRecord[0].Department_Class__r.Name); | 
|         // urlStr += '&CF00Np00000044oDP_lkid=' + accountRecord[0].Id; | 
|         // urlStr += '&CF00Np00000044oDP=' + encodeURI(accountRecord[0].Name); | 
|         // urlStr += '&CF00Np00000044oD5_lkid=' + accountRecord[0].Hospital__r.Id; | 
|         // urlStr += '&CF00Np00000044oD5=' + encodeURI(accountRecord[0].Hospital__r.Name); | 
|         // urlStr += '&CF00Np00000044oSe_lkid=' + accountRecord[0].Department_Class__r.OwnerId; | 
|         // urlStr += '&CF00Np00000044oSe=' + encodeURI(accountRecord[0].Department_Class__r.Owner.Name); | 
|   | 
|         urlStr += '&CF00N10000008rq2Y_lkid=' + accountRecord[0].Id; | 
|         urlStr += '&CF00N10000008rq2Y=' + encodeURI(accountRecord[0].Name); | 
|         urlStr += '&CF00N10000008rq3f_lkid=' + accountRecord[0].Hospital__r.Id; | 
|         urlStr += '&CF00N10000008rq3f=' + encodeURI(accountRecord[0].Hospital__r.Name); | 
|         // urlStr += '&CF00N10000008rq2f_lkid=' + accountRecord[0].Department_Class__r.OwnerId; | 
|         // urlStr += '&CF00N10000008rq2f=' + encodeURI(accountRecord[0].Department_Class__r.Owner.Name); | 
|   | 
|         // urlStr += '&CF00Np00000045HcO_lkid=' + accountRecord[0].Hospital__r.OCM_Management_Province__r.GI_assistant__c; | 
|         // urlStr += '&CF00Np00000045HcO=' + encodeURI(accountRecord[0].Hospital__r.OCM_Management_Province__r.GI_assistant__r.Name); | 
|         // 测试环境CF00Np00000045HcO,正CF00N10000008rq2p | 
|         if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '1.华北') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000001OOLj'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("肖 娜"); | 
|         } else if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '2.东北') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000001OOSZ'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("金 丽华"); | 
|         } else if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '3.西北') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000007kteE'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("王 喆"); | 
|         } else if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '4.西南') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000001OORm'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("李 娟"); | 
|         } else if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '5.华东') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000000gW9G'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("杨 剑清"); | 
|         } else if (accountRecord[0].Hospital__r.Salesdepartment_HP__c == '6.华南') { | 
|             urlStr += '&CF00N10000008rq2p_lkid=00510000001OOJy'; | 
|             urlStr += '&CF00N10000008rq2p=' + encodeURI("王 志锋"); | 
|         } else { | 
|             urlStr += '&CF00N10000008rq2p_lkid='; | 
|             urlStr += '&CF00N10000008rq2p='; | 
|         } | 
|         // urlStr += '&00Np00000045Fdo=' + encodeURI(accountRecord[0].Province_formula__c); | 
|         // 测试环境CF00Np00000044oSZ | 
|         // var Visitor1 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:'+ index + ':idVisitor1_IdHidden')).value(); | 
|         // if (Visitor1 != '') { | 
|         //     var Visitor1Name = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:'+ index + ':idVisitor1')).value(); | 
|         //     urlStr += '&CF00Np00000044oSZ_lkid=' + Visitor1; | 
|         //     urlStr += '&CF00Np00000044oSZ=' + encodeURI(Visitor1Name); | 
|         // } | 
|   | 
|         urlStr = urlStr + '&saveURL=%2Fapex%2FSaveSolutionFromReport%3Feid%3D' + eid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b17 = 'idSolution' + index; | 
|     setButtonDisable(document.getElementById(b17), false); | 
| } | 
| // GIR Solution 2019-12-12 by vivek end | 
|   | 
| // SWAG-BUF6R8  20201020 youchang start | 
| function addOpdNew(index, eid) { | 
|     try { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = eid; | 
|         b19 = 'idOpds' + index; | 
|         setButtonDisable(document.getElementById(b19), true); | 
|         addOpdNewJS(index); | 
|     } catch (e) { | 
|         alert(Error_Message26); | 
|     } | 
| } | 
|   | 
| function addOpd(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|   | 
|         var urlStr = '/a3E/e?retURL=%2Fa3E%2Fo'; | 
|         var opp1 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1Id')).value(); //涉及的询价1 带值 | 
|         console.log('==opp1==' + opp1); | 
|         if (opp1 != '') { | 
|             var opp1Name = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1')).value(); | 
|             urlStr += '&CF00N10000008ps5W_lkid=' + opp1; | 
|             urlStr += '&CF00N10000008ps5W=' + encodeURI(opp1Name); | 
|             urlStr += '&00N10000008ps5X=' + encodeURI(opp1Name); | 
|         } | 
|         var opp2 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp2Id')).value(); //询价id2 带值 | 
|         console.log('==opp2==' + opp2); | 
|         if (opp2 != '') { | 
|             var opp2Name = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp2')).value(); | 
|             urlStr += '&CF00N10000008ps5Y_lkid=' + opp2; | 
|             urlStr += '&CF00N10000008ps5Y=' + encodeURI(opp2Name); | 
|             urlStr += '&00N10000008ps5Z=' + encodeURI(opp2Name); | 
|         } | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; //访问场所,带到opd上科室 | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|         urlStr += '&CF00N10000008ps4x_lkid=' + accountRecord[0].Id; | 
|         urlStr += '&CF00N10000008ps4x=' + encodeURI(accountRecord[0].Name); | 
|   | 
|         //2021-06-24   mzy start | 
|         urlStr += '&00N100000098amT=' + encodeURI('日报'); | 
|         //2021-06-24   mzy  end | 
|         //2021-04-30  mzy XLII-C2KAGS  start | 
|         urlStr += '&Name=*'; | 
|         //2021-04-30  mzy XLII-C2KAGS  end | 
|   | 
|         console.log('==accountRecord==' + accountRecord); | 
|         //urlStr =     Inspection_ID_LTV; | 
|         //urlStr = urlStr + 'retURL=%2Fa3E%2Fo'; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b19 = 'idOpds' + index; | 
|     setButtonDisable(document.getElementById(b19), false); | 
| } | 
|   | 
| //SWAG-BUF6R8  20201020 youchang end | 
|   | 
| function addAssetManualNew(index, eid) { | 
|     try { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = eid; | 
|         b07 = 'idAsset_Manual' + index; | 
|         setButtonDisable(document.getElementById(b07), true); | 
|         addAssetManualNewJS(index); | 
|     } catch (e) { | 
|         alert(Error_Message26); | 
|     } | 
| } | 
|   | 
| function addAssetManual(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|         var urlStr = '/02i/e?Name=*'; | 
|         urlStr += '&Account_lkid=' + accountRecord[0].Id; | 
|         urlStr += '&Account=' + encodeURI(accountRecord[0].Name); | 
|         urlStr += '&CF00N10000002CYBW_lkid=' + accountRecord[0].Department_Class__r.Id; | 
|         urlStr += '&CF00N10000002CYBW=' + encodeURI(accountRecord[0].Department_Class__r.Name); | 
|         urlStr += '&CF00N10000002CYBR_lkid=' + accountRecord[0].Hospital__r.Id; | 
|         urlStr += '&CF00N10000002CYBR=' + encodeURI(accountRecord[0].Hospital__r.Name); | 
|         var opp1 = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1Id')).value(); | 
|         if (opp1 != '') { | 
|             var opp1Name = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1')).value(); | 
|             urlStr += '&CF00N10000002CYBM_lkid=' + opp1; | 
|             urlStr += '&CF00N10000002CYBM=' + encodeURI(opp1Name); | 
|         } | 
|   | 
|         urlStr = urlStr + '&saveURL=%2Fapex%2FSaveAssetFromReport%3Feid%3D' + eid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b07 = 'idAsset_Manual' + index; | 
|     setButtonDisable(document.getElementById(b07), false); | 
| } | 
|   | 
| function addMaintenanceContractNew(index, eid) { | 
|     try { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = eid; | 
|         b03 = 'idMaintenance_Contract' + index; | 
|         setButtonDisable(document.getElementById(b03), true); | 
|         addMaintenanceContractNewJS(index); | 
|     } catch (e) { | 
|         alert(Error_Message26); | 
|     } | 
| } | 
|   | 
| function addMaintenanceContract(index, eid) { | 
|     try { | 
|         if (eid == null || eid == '') { | 
|             eid = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|         } | 
|   | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|         var urlStr = '/a0H/e?CF00N10000002Dx4q_lkid=' + accountRecord[0].Id; | 
|         urlStr += '&CF00N10000002Dx4q=' + encodeURI(accountRecord[0].Name); | 
|         urlStr += '&CF00N10000002Dx4p_lkid=' + accountRecord[0].Department_Class__r.Id; | 
|         urlStr += '&CF00N10000002Dx4p=' + encodeURI(accountRecord[0].Department_Class__r.Name); | 
|         urlStr += '&CF00N10000002Dx56_lkid=' + accountRecord[0].Hospital__r.Id; | 
|         urlStr += '&CF00N10000002Dx56=' + encodeURI(accountRecord[0].Hospital__r.Name); | 
|   | 
|         urlStr = urlStr + '&saveURL=%2Fapex%2FSaveMContractFromReport%3Feid%3D' + eid; | 
|         window.open(urlStr, '_blank', ''); | 
|     } catch (e) { | 
|         alert(e); | 
|     } | 
|     b03 = 'idMaintenance_Contract' + index; | 
|     setButtonDisable(document.getElementById(b03), false); | 
| } | 
|   | 
| function viewDisplay(index, id) { | 
|     var urlStr = ''; | 
|   | 
|     if (id == 'idONCALL') { | 
|         urlStr = OnCall_ID; | 
|     } else if (id == 'idMC') { | 
|         urlStr = MC_All; | 
|     } else { | 
|         if (!checkLocation(index)) { | 
|             return; | 
|         } | 
|         var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|         var vl = j$(escapeVfId(strVP)).value(); | 
|         var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|   | 
|         if (id == 'idInspections') { | 
|             // if(accountRecord[0].Hospital__r.OCM_Category__c == 'LTV'){ | 
|             if (accountRecord[0].Hospital__r.OCM_Category__c == 'H1') { | 
|                 urlStr = Inspection_ID_LTV; | 
|             } | 
|             // else if(accountRecord[0].Hospital__r.OCM_Category__c == 'SLTV'){ | 
|             else if (accountRecord[0].Hospital__r.OCM_Category__c == 'H0') { | 
|                 urlStr = Inspection_ID_SLTV; | 
|             } | 
|             // else if(accountRecord[0].Hospital__r.OCM_Category__c.indexOf('一般') == 0){ | 
|             else if (accountRecord[0].Hospital__r.OCM_Category__c.indexOf('M0') == 0 && | 
|                 accountRecord[0].Hospital__r.OCM_Category__c.indexOf('M1') == 0 && | 
|                 accountRecord[0].Hospital__r.OCM_Category__c.indexOf('L') == 0) { | 
|                 urlStr = Inspection_ID_General; | 
|             } else { | 
|                 urlStr = Inspection_AllAssets; | 
|             } | 
|         } else { | 
|             // if(accountRecord[0].Hospital__r.OCM_Category__c == 'LTV'){ | 
|             if (accountRecord[0].Hospital__r.OCM_Category__c == 'H1') { | 
|                 urlStr = Repair_ID_LTV; | 
|             } | 
|             // else if(accountRecord[0].Hospital__r.OCM_Category__c == 'SLTV'){ | 
|             else if (accountRecord[0].Hospital__r.OCM_Category__c == 'H0') { | 
|                 urlStr = Repair_ID_SLTV; | 
|             } | 
|             // else if(accountRecord[0].Hospital__r.OCM_Category__c.indexOf('一般') == 0){ | 
|             else if (accountRecord[0].Hospital__r.OCM_Category__c.indexOf('M0') == 0 && | 
|                 accountRecord[0].Hospital__r.OCM_Category__c.indexOf('M1') == 0 && | 
|                 accountRecord[0].Hospital__r.OCM_Category__c.indexOf('L') == 0) { | 
|                 urlStr = Repair_ID_General; | 
|             } else { | 
|                 urlStr = Repair_All; | 
|             } | 
|         } | 
|     } | 
|   | 
|     window.open(urlStr, '', ''); | 
| } | 
|   | 
| function PCLViewDisplay(index, uid) { | 
|     var urlStr = '/apex/OpportunityPCLNew'; | 
|   | 
|     if (!checkLocation(index)) { | 
|         return; | 
|     } | 
|     var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var vl = j$(escapeVfId(strVP)).value(); | 
|     var accountRecord = sforce.apex.execute("Add_Report", "getAccountForJs", { id: vl }); | 
|   | 
|     urlStr = urlStr + '?hpid=' + accountRecord[0].Hospital__r.Id; | 
|   | 
|     window.open(urlStr, '', ''); | 
| } | 
|   | 
| function reportBtn() { | 
|     var actsize = j$(escapeVfId('idActSize')).value(); | 
|     var repFlg = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenReportReportFlg')).value(); | 
|     var accFlg = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenAccompanyingReportFlg')).value(); | 
|     for (var i = 0; i < actsize; i++) { | 
|         setBtnEnable(i, repFlg, accFlg); | 
|     } | 
| } | 
|   | 
| function openPD(index, id, recordName, hiddenId, redId, reportId) { | 
|     if (j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value() == null || | 
|         j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value() == '') { | 
|         try { | 
|             if (id == null || id == '') { | 
|                 id = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenActId')).value(); | 
|             } | 
|             var reId = reportId; | 
|             var str = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'; | 
|             var aName = j$(escapeVfId(str)).value(); | 
|             var strId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|             var aId = j$(escapeVfId(strId)).value(); | 
|             vpCheck = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idFree_Input__c'; | 
|             if (document.getElementById(vpCheck).checked) { | 
|                 strId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace2'; | 
|             } | 
|             var aId = j$(escapeVfId(strId)).value(); | 
|             var strVisitor1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1_IdHidden'; | 
|             var visitor1 = j$(escapeVfId(strVisitor1)).value(); | 
|             var v1Str = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1')).value(); | 
|             var strVisitor2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2_IdHidden'; | 
|             var visitor2 = j$(escapeVfId(strVisitor2)).value(); | 
|             var strVisitor3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3_IdHidden'; | 
|             var visitor3 = j$(escapeVfId(strVisitor3)).value(); | 
|             var strVisitor4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4_IdHidden'; | 
|             var visitor4 = j$(escapeVfId(strVisitor4)).value(); | 
|             var strVisitor5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5_IdHidden'; | 
|             var visitor5 = j$(escapeVfId(strVisitor5)).value(); | 
|             var strOpp1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1Id'; | 
|             var opp1 = j$(escapeVfId(strOpp1)).value(); | 
|             var strOpp2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp2Id'; | 
|             var opp2 = j$(escapeVfId(strOpp2)).value(); | 
|             var strOpp3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp3Id'; | 
|             var opp3 = j$(escapeVfId(strOpp3)).value(); | 
|             var strOpp4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp4Id'; | 
|             var opp4 = j$(escapeVfId(strOpp4)).value(); | 
|             var strOpp5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp5Id'; | 
|             var opp5 = j$(escapeVfId(strOpp5)).value(); | 
|             var FlgRAC = j$(escapeVfId('Page:mainForm:idDayEdit:CreateRAC')).value(); | 
|             var strDescription = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idDescription'; | 
|             var description = j$(escapeVfId(strDescription)).value(); | 
|             var followOppsAdd = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1Id'; | 
|             var followOpps = j$(escapeVfId(followOppsAdd)).value(); | 
|             var strReportId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId; | 
|             var reportId = j$(escapeVfId(strReportId)).value(); | 
|             var repOwnerId = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenRepOwnerId')).value(); | 
|             var strReportDate = 'Page:mainForm:idDayEdit:idReportDate'; | 
|             var reportDate = j$(escapeVfId(strReportDate)).value(); | 
|             var rId = ''; | 
|             var strVisitDiv = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorDiv'; | 
|             var visitDiv = j$(escapeVfId(strVisitDiv)).value(); | 
|   | 
|             if (recordName == 'Product_Explanation') { | 
|                 // 製品説明 | 
|                 rId = sforce.apex.execute("Add_Report", "addReportPr", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, visitor1: visitor1, visitor2: visitor2, visitor3: visitor3, visitor4: visitor4, visitor5: visitor5, description: description, reportDate: reportDate }); | 
|             } else if (recordName == 'OPD' || recordName == 'SIS' || recordName == 'SIS_ET' || recordName == 'SIS_ENG') { | 
|                 // 20210107 SWAG-BX24F5 you start | 
|                 var idReporter2 = j$(escapeVfId('Page:mainForm:idDayEdit:idReporter2')).value(); | 
|                 console.log(recordName + '==2021==' + idReporter2); | 
|                 if (idReporter2 == '销售服务') { | 
|                     recordName = 'OPD'; | 
|   | 
|                 } else if (idReporter2 == '销售推广' && recordName == 'OPD') { | 
|                     //2021/01/27 liying start | 
|                     hiddenDivShowFlg = true; | 
|                     selectOPDSISReportType1(); | 
|                     return; | 
|                     // recordName = 'SIS'; | 
|                     // 20210107 SWAG-BX24F5 you end | 
|                     //2021/01/27 liying end | 
|                 } else if (hiddenDivShowFlg == false) { | 
|                     // 入力チェック完了したら、ここからdivを出す | 
|                     // divから作成する時、hiddenDivShowFlgをtrueにし、報告書作成ロジックへ | 
|                     hiddenDivShowFlg = true; | 
|                     selectOPDSISReportType(); | 
|                     return; | 
|                 } | 
|                 var sHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartHour')).value(); | 
|                 var sMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartMinute')).value(); | 
|                 var eHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndHour')).value(); | 
|                 var eMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndMinute')).value(); | 
|   | 
|                 if (sHour.length == 1) { | 
|                     sHour = '0' + sHour; | 
|                 } | 
|                 if (eHour.length == 1) { | 
|                     eHour = '0' + eHour; | 
|                 } | 
|                 var sTime = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() + ' ' + sHour + ':' + sMinute; | 
|                 var eTime = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() + ' ' + eHour + ':' + eMinute; | 
|   | 
|                 rId = sforce.apex.execute("Add_Report", "addReportOP2", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, visitor1: visitor1, visitor2: visitor2, visitor3: visitor3, visitor4: visitor4, visitor5: visitor5, opp1: opp1, opp2: opp2, opp3: opp3, opp4: opp4, opp5: opp5, reportDate: reportDate, sTime: sTime, eTime: eTime }); | 
|             } else if (recordName == 'NTC') { | 
|                 var sHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartHour')).value(); | 
|                 var sMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartMinute')).value(); | 
|                 var eHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndHour')).value(); | 
|                 var eMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndMinute')).value(); | 
|   | 
|                 if (sHour.length == 1) { | 
|                     sHour = '0' + sHour; | 
|                 } | 
|                 if (eHour.length == 1) { | 
|                     eHour = '0' + eHour; | 
|                 } | 
|                 var sTime = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() + ' ' + sHour + ':' + sMinute; | 
|                 var eTime = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() + ' ' + eHour + ':' + eMinute; | 
|                 var strMainPlace = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idMainPlace'; | 
|                 var mainPlace = j$(escapeVfId(strMainPlace)).value(); | 
|                 //rId = sforce.apex.execute("Add_Report","addReportNT",{repOwnerId:repOwnerId,reportId:reportId,dailyReportId:reId,eventId:id,recordType:recordName,aId:aId,visitor1:visitor1,visitor2:visitor2,visitor3:visitor3,visitor4:visitor4,visitor5:visitor5,sTime:sTime,eTime:eTime,mainPlace:mainPlace,visitDiv:visitDiv}); | 
|                 rId = sforce.apex.execute("Add_Report", "addReportNT", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, visitor1: visitor1, visitor2: visitor2, visitor3: visitor3, visitor4: visitor4, visitor5: visitor5, sTime: sTime, eTime: eTime, mainPlace: mainPlace }); | 
|             } else if (recordName == 'On_Call') { | 
|                 var sHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartHour')).value(); | 
|                 var sMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartMinute')).value(); | 
|                 var eHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndHour')).value(); | 
|                 var eMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndMinute')).value(); | 
|                 rId = sforce.apex.execute("Add_Report", "addReportOn", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, reportDate: reportDate, v1Str: v1Str, startHour: sHour, startMin: sMinute, endHour: eHour, endMin: eMinute, description: description }); | 
|             } else if (recordName == 'Visit_With') { | 
|                 rId = sforce.apex.execute("Add_Report", "addReportAc", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, reportDate: reportDate, description: description }); | 
|             } else if (recordName == 'MarketCondition' || recordName == 'Competitor') { | 
|                 rId = sforce.apex.execute("Add_Report", "addReportEx", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, visitor1: visitor1, reportDate: reportDate, description: description }); | 
|             } else if (recordName == 'Improvement') { | 
|                 rId = sforce.apex.execute("Add_Report", "addReportIm", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, reportDate: reportDate, description: description }); | 
|             } else if (recordName == 'Complaint') { | 
|                 rId = sforce.apex.execute("Add_Report", "addClaim", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, reportDate: reportDate, description: description }); | 
|             } else if (recordName == 'Rental_Apply' && FlgRAC == 'true') { | 
|                 // 新建备品申请书 | 
|                 rId = sforce.apex.execute("Add_Report", "addRA", { repOwnerId: repOwnerId, reportId: reportId, dailyReportId: reId, eventId: id, recordType: recordName, aId: aId, reportDate: reportDate, description: description, followOpps: opp1 }); | 
|             } else if (FlgRAC == 'false') { | 
|                 alert('用户没有新建备品借出申请的权限!'); | 
|             } else if (recordName == 'INS') { | 
|                 // 点检报告书 | 
|   | 
|             } | 
|   | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden')).val(aName); | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId')).val(aId); | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).val(rId); | 
|         } catch (e) { | 
|             alert(e); | 
|         } | 
|     } | 
|     if (j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value() == null || | 
|         j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value() == '') {} else { | 
|         urlStr = '/' + j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value() + '/e?retURL=%2F' + j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value(); | 
|         window.open(urlStr, '', ''); | 
|         changeRed(index, redId); | 
|     } | 
|   | 
|     setVisitorPlaceDisabled(); | 
|     //unblockUI(); | 
| } | 
|   | 
| function changeRed(index, id) { | 
|     str = id + index; | 
|     var element = document.getElementById(str); | 
|     //    element.style.color = 'red'; | 
|     element.className = 'btnRed'; | 
| } | 
|   | 
| function mailOpen() { | 
|     location.href = 'mailto:'; | 
| } | 
|   | 
| // TODO onfocusやめる | 
| function vpChack(index) { | 
|     changeFlg = 'false'; | 
|     v1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1'; | 
|     v2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2'; | 
|     v3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3'; | 
|     v4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4'; | 
|     v5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5'; | 
|   | 
|     o1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1'; | 
|     o2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp2'; | 
|     o3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp3'; | 
|     o4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp4'; | 
|     o5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp5'; | 
|   | 
|     s1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelService1'; | 
|     // s2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelService2'; | 
|     // SWAG-BUF6R8  20201020 youchang start | 
|     //bh1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRental_Apply_IdHidden'; | 
|     // SWAG-BUF6R8  20201020 youchang end | 
|     bh2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idOPD_IdHidden'; | 
|     bh3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idNTC_IdHidden'; | 
|     bh4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idONCALL_IdHidden'; | 
|     bh5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idReportAccompanied_IdHidden'; | 
|     bh6 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idCityStatus_IdHidden'; | 
|     bh7 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idClaim_IdHidden'; | 
|     bh8 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idConflict_IdHidden'; | 
|   | 
|     if (j$(escapeVfId(v1)).value() != null && j$(escapeVfId(v1)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(v2)).value() != null && j$(escapeVfId(v2)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(v3)).value() != null && j$(escapeVfId(v3)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(v4)).value() != null && j$(escapeVfId(v4)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(v5)).value() != null && j$(escapeVfId(v5)).value() != '') { changeFlg = 'true'; } | 
|   | 
|     if (j$(escapeVfId(o1)).value() != null && j$(escapeVfId(o1)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(o2)).value() != null && j$(escapeVfId(o2)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(o3)).value() != null && j$(escapeVfId(o3)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(o4)).value() != null && j$(escapeVfId(o4)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(o5)).value() != null && j$(escapeVfId(o5)).value() != '') { changeFlg = 'true'; } | 
|   | 
|     if (j$(escapeVfId(s1)).value() != null && j$(escapeVfId(s1)).value() != '') { changeFlg = 'true'; } | 
|     // if(j$(escapeVfId(s2)).value() != null && j$(escapeVfId(s2)).value() != ''){changeFlg = 'true';} | 
|   | 
|     //SWAG-BUF6R8  20201020 youchang start | 
|     //if(j$(escapeVfId(bh1)).value() != null && j$(escapeVfId(bh1)).value() != ''){changeFlg = 'true';} | 
|     //SWAG-BUF6R8  20201020 youchang end | 
|     if (j$(escapeVfId(bh2)).value() != null && j$(escapeVfId(bh2)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh3)).value() != null && j$(escapeVfId(bh3)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh4)).value() != null && j$(escapeVfId(bh4)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh5)).value() != null && j$(escapeVfId(bh5)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh6)).value() != null && j$(escapeVfId(bh6)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh7)).value() != null && j$(escapeVfId(bh7)).value() != '') { changeFlg = 'true'; } | 
|     if (j$(escapeVfId(bh8)).value() != null && j$(escapeVfId(bh8)).value() != '') { changeFlg = 'true'; } | 
|   | 
|     if (changeFlg == 'true') { | 
|         // 値を設定または報告書を作成した場合は変更できません。 | 
|         alert(Error_Message21); | 
|         document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorDiv').blur(); | 
|         document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idFree_Input__c').blur(); | 
|   | 
|         return true; | 
|     } else { | 
|         //blockme(); | 
|         //vpClear1(index); | 
|     } | 
|   | 
|     return false; | 
|   | 
| } | 
|   | 
| function vpClear1(index) { | 
|     vd = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorDiv')).value(); | 
|   | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace').value = ''; | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId').value = ''; | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden').value = ''; | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId').value = ''; | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorDivBefore').value = vd; | 
|   | 
|     setVisitorPlaceDisabled(); | 
|     unblockUI(); | 
| } | 
|   | 
| function vpClear2_delay(index) { | 
|     var vp = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'; | 
|     var vpHidden = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden'; | 
|     var disabledPlace = document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':isDisabledVisitorPlace').value; | 
|     //20210316 zh WLIG-BXZ8AN 【委托】【重要调查】担当可以修改日报中的访问场所 start | 
|     if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value() && j$(escapeVfId(vpHidden)).value() != '' && j$(escapeVfId(vpHidden)).value() != null && disabledPlace == 'false') { | 
|         alert('访问场所不允许被修改!'); | 
|         vpBefore = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden')).value(); | 
|         vpIdBefore = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId')).value(); | 
|         j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace')).val(vpBefore); | 
|         j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId')).val(vpIdBefore); | 
|         document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace').blur(); | 
|     } else { | 
|         //20210316 zh WLIG-BXZ8AN 【委托】【重要调查】担当可以修改日报中的访问场所 end | 
|         setTimeout( | 
|             function() { | 
|                 if (j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag") == "false") { | 
|                     if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) { | 
|                         vpClear2(index); | 
|                     } | 
|   | 
|                 } | 
|             }, | 
|             200 | 
|         ); | 
|     } | 
| } | 
|   | 
| function vpClear2(index) { | 
|     var vp = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'; | 
|     var vpHidden = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden'; | 
|     var vpId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|     var vpHiddenId = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId'; | 
|     if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value() || j$(escapeVfId(vpId)).value() != j$(escapeVfId(vpHiddenId)).value()) { | 
|         changeFlg = 'false'; | 
|         v1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor1'; | 
|         v2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor2'; | 
|         v3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor3'; | 
|         v4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor4'; | 
|         v5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitor5'; | 
|   | 
|         o1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp1'; | 
|         o2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp2'; | 
|         o3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp3'; | 
|         o4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp4'; | 
|         o5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelOpp5'; | 
|   | 
|         s1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelService1'; | 
|         // s2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRelService2'; | 
|         //SWAG-BUF6R8  20201020 youchang start | 
|         //bh1 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idRental_Apply_IdHidden'; | 
|         //SWAG-BUF6R8  20201020 youchang end | 
|         bh2 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idOPD_IdHidden'; | 
|         bh3 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idNTC_IdHidden'; | 
|         bh4 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idONCALL_IdHidden'; | 
|         bh5 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idReportAccompanied_IdHidden'; | 
|         bh6 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idCityStatus_IdHidden'; | 
|         bh7 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idClaim_IdHidden'; | 
|         bh8 = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idConflict_IdHidden'; | 
|   | 
|         if (j$(escapeVfId(v1)).value() != null && j$(escapeVfId(v1)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(v2)).value() != null && j$(escapeVfId(v2)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(v3)).value() != null && j$(escapeVfId(v3)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(v4)).value() != null && j$(escapeVfId(v4)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(v5)).value() != null && j$(escapeVfId(v5)).value() != '') { changeFlg = 'true'; } | 
|   | 
|         if (j$(escapeVfId(o1)).value() != null && j$(escapeVfId(o1)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(o2)).value() != null && j$(escapeVfId(o2)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(o3)).value() != null && j$(escapeVfId(o3)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(o4)).value() != null && j$(escapeVfId(o4)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(o5)).value() != null && j$(escapeVfId(o5)).value() != '') { changeFlg = 'true'; } | 
|   | 
|         if (j$(escapeVfId(s1)).value() != null && j$(escapeVfId(s1)).value() != '') { changeFlg = 'true'; } | 
|         // if(j$(escapeVfId(s2)).value() != null && j$(escapeVfId(s2)).value() != ''){changeFlg = 'true';} | 
|         //SWAG-BUF6R8  20201020 youchang start | 
|         //if(j$(escapeVfId(bh1)).value() != null && j$(escapeVfId(bh1)).value() != ''){changeFlg = 'true';} | 
|         //SWAG-BUF6R8  20201020 youchang end | 
|         if (j$(escapeVfId(bh2)).value() != null && j$(escapeVfId(bh2)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh3)).value() != null && j$(escapeVfId(bh3)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh4)).value() != null && j$(escapeVfId(bh4)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh5)).value() != null && j$(escapeVfId(bh5)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh6)).value() != null && j$(escapeVfId(bh6)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh7)).value() != null && j$(escapeVfId(bh7)).value() != '') { changeFlg = 'true'; } | 
|         if (j$(escapeVfId(bh8)).value() != null && j$(escapeVfId(bh8)).value() != '') { changeFlg = 'true'; } | 
|   | 
|         unblockUI(); | 
|         if (changeFlg == 'true') { | 
|             // 値を設定または報告書を作成した場合は変更できません。 | 
|             alert(Error_Message21); | 
|             //vp = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace')).value(); | 
|             vpBefore = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHidden')).value(); | 
|             vpIdBefore = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceHiddenId')).value(); | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace')).val(vpBefore); | 
|             j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId')).val(vpIdBefore); | 
|             document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace').blur(); | 
|             return; | 
|         } | 
|     } | 
|     resetValue('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace'); | 
| } | 
|   | 
| function ckDate(datestr) { | 
|     // 正規表現による書式チェック | 
|     if (!datestr.match(/^\d{4}\/\d{1,2}\/\d{1,2}$/)) { | 
|         return true; | 
|     } | 
|   | 
|     var vDate = datestr.split("/"); | 
|     var vYear = vDate[0] - 0; | 
|     var vMonth = vDate[1] - 1; // Javascriptは、0-11で表現 | 
|     var vDay = vDate[2] - 0; | 
|     // 月,日の妥当性チェック | 
|     if (vMonth >= 0 && vMonth <= 11 && vDay >= 1 && vDay <= 31) { | 
|         var vDt = new Date(vYear, vMonth, vDay); | 
|         if (isNaN(vDt)) { | 
|             return true; | 
|         } else if (vDt.getFullYear() == vYear && vDt.getMonth() == vMonth && vDt.getDate() == vDay) { | 
|             return false; | 
|         } else { | 
|             return true; | 
|         } | 
|     } else { | 
|         return true; | 
|     } | 
| } | 
|   | 
| function openPDNew(index, id, recordName, hiddenId, redId, reportId) { | 
|     var hiId = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value(); | 
|     var rsflg = j$(escapeVfId('reportStatusFlg')).value(); | 
|     j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).val(null);// 2021-12-07 yjk 每次打开弹框 | 
|     hiddenDivShowFlg = false; | 
|     if (rsflg == "false") { | 
|         if (hiId == "") { | 
|             alert("无法新建报告书"); | 
|             return false; | 
|         } else { | 
|             urlStr = '/' + j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':' + hiddenId)).value(); | 
|             window.open(urlStr, '', ''); | 
|             return false; | 
|         } | 
|     } | 
|     setButtonDisabled(); | 
|     // TODO katus hiId != null って判断できますか? | 
|     if (hiId != null) { | 
|         //blockme(); | 
|         var reportDate = j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value(); | 
|         if (reportDate == null || reportDate == '') { | 
|             // 日付を入力してください。 | 
|             alert(Error_Message22); | 
|             setVisitorPlaceDisabled(); | 
|             return false; | 
|         } | 
|         if (ckDate(reportDate)) { | 
|             // 日付はYYYY/MM/DDで入力してください。 | 
|             alert(Error_Message23); | 
|             setVisitorPlaceDisabled(); | 
|             return false; | 
|         } | 
|   | 
|         var sHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartHour')).value(); | 
|         var sMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActStartMinute')).value(); | 
|         var eHour = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndHour')).value(); | 
|         var eMinute = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idActEndMinute')).value(); | 
|   | 
|         if (sHour == null || sHour == '' || sMinute == null || sMinute == '' || eHour == null || eHour == '' || eMinute == null || eMinute == '') { | 
|             // 勤務時間を設定してください。 | 
|             alert(Error_Message24); | 
|             setVisitorPlaceDisabled(); | 
|             return false; | 
|         } else { | 
|             if (sHour.match(/[^0-9]+/) || sMinute.match(/[^0-9]+/) || eHour.match(/[^0-9]+/) || eMinute.match(/[^0-9]+/)) { | 
|                 alert(Error_Message39); | 
|                 setVisitorPlaceDisabled(); | 
|                 return false; | 
|             } | 
|   | 
|             var repoStartHourNum = parseInt(sHour, 10); | 
|             var repoStartMinuteNum = parseInt(sMinute, 10); | 
|             var repoEndHourNum = parseInt(eHour, 10); | 
|             var repoEndMinuteNum = parseInt(eMinute, 10); | 
|             // 範囲チェック | 
|             if (repoStartHourNum < 0 || repoStartHourNum > 23 || repoStartMinuteNum < 0 || repoStartMinuteNum > 59 || repoEndHourNum < 0 || repoEndHourNum > 23 || repoEndMinuteNum < 0 || repoEndMinuteNum > 59) { | 
|                 alert(Error_Message39); | 
|                 setVisitorPlaceDisabled(); | 
|                 return false; | 
|             } | 
|             // 逆転チェック | 
|             else if (repoStartHourNum > repoEndHourNum || (repoStartHourNum == repoEndHourNum && repoStartMinuteNum > repoEndMinuteNum)) { | 
|                 alert(Error_Message2); | 
|                 setVisitorPlaceDisabled(); | 
|                 return false; | 
|             } | 
|         } | 
|         var vpCheck = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idFree_Input__c'; | 
|         var aName = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace')).value(); | 
|         if (document.getElementById(vpCheck).checked) { | 
|             aName = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlace2')).value(); | 
|         } | 
|   | 
|         if (aName == null || aName == '') { | 
|             // 訪問場所を設定してください。 | 
|             alert(Error_Message16); | 
|             setVisitorPlaceDisabled(); | 
|             return; | 
|         } | 
|         if (document.getElementById(vpCheck).checked == false) { | 
|             var strVP = 'Page:mainForm:idDayEdit:idActivities:' + index + ':idVisitorPlaceId'; | 
|             var vp = j$(escapeVfId(strVP)).value(); | 
|             if (vp.length == 0) { | 
|                 // 訪問場所が存在しません。 | 
|                 alert(Error_Message15); | 
|                 return; | 
|             } | 
|   | 
|             if (vp.substring(0, 3) == '001') { | 
|                 var match = sforce.apex.execute("Add_Report", "checkAccountMatch", { name: aName, id: vp }); | 
|                 if (match == "NG") { | 
|                     // 訪問場所IDマッチしていない | 
|                     alert("无法确定访问场所,请再设定一次访问场所。"); | 
|                     return; | 
|                 } | 
|             } | 
|             //            if (vp.substring(0, 3) == '701') { | 
|             //                var match = sforce.apex.execute("Add_Report","checkCampaignMatch",{name:aName,id:vp}); | 
|             //                if(match == "NG"){ | 
|             //                    // 訪問場所IDマッチしていない | 
|             //                    alert("无法确定访问场所,请再设定一次访问场所。"); | 
|             //                    return; | 
|             //                } | 
|             //            } | 
|         } | 
|         // 1、和NOTES关联的部分不变,目的(计划)修改为“主题(NOTES)”,非必填写;但是现在这个项目是必须填写,造成了担当日报无法提交 | 
|         // var puropose = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:'+ index + ':idPurpose')).value(); | 
|         // if(puropose == null || puropose == ''){ | 
|         //     // 目的(計画)を設定してください。 | 
|         //     alert(Error_Message17); | 
|         //     setVisitorPlaceDisabled();  | 
|         //     return; | 
|         // } | 
|         var FsePuro = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idPuroposeTypeFSE1')).value(); | 
|         var EscFsePuro = j$(escapeVfId('Page:mainForm:idDayEdit:idActivities:' + index + ':idPuroposeType1')).value(); | 
|         var puroposeType = (FsePuro == null || FsePuro == '') ? EscFsePuro : FsePuro; | 
|         if (puroposeType == null || puroposeType == '') { | 
|             // 活動区分を設定してください。 | 
|             alert(Error_Message18); | 
|             setVisitorPlaceDisabled(); | 
|             return; | 
|         } | 
|   | 
|         tempIndex = index; | 
|         tempActId = id; | 
|         tempRecordTypeName = recordName; | 
|         tempBtnIdHidden = hiddenId; | 
|         tempRedId = redId; | 
|         tempReportId = reportId; | 
|   | 
|         var idStatus = j$(escapeVfId('Page:mainForm:idDayEdit:idStatus')).value(); | 
|         var hidUserId = j$(escapeVfId('idHiddenUserId')).value(); | 
|         var hidUserBatchUser = j$(escapeVfId('idHiddenUserBatchUser')).value(); | 
|         var hidUserProfileId = j$(escapeVfId('idHiddenUserProfileId')).value(); | 
|         var hidRepOwnerManagerId = j$(escapeVfId('idHiddenRepOwnerManagerId')).value(); | 
|         var hidOwnerBuchangApprovalManager = j$(escapeVfId('hidOwnerBuchangApprovalManager')).value(); | 
|         var hidROBuchangAMSales = j$(escapeVfId('hidROBuchangAMSales')).value(); | 
|   | 
|         if ((hidUserProfileId != '00e10000000Y3o5' || hidUserBatchUser != 'true') && | 
|             idStatus == '承認' && | 
|             hidUserId != hidRepOwnerManagerId && | 
|             hidUserId != hidOwnerBuchangApprovalManager && | 
|             hidUserId != hidROBuchangAMSales) { | 
|             alert('已经批准的日报中,不能新建报告书'); | 
|             setVisitorPlaceDisabled(); | 
|             return; | 
|         } | 
|         // 活動1,2,3 も保存したいです。そしてTriggerにて商談などに情報を積み上げます | 
|   | 
|         openPDNewJS(index); | 
|     } else { | 
|         setVisitorPlaceDisabled(); | 
|     } | 
|     //} | 
| } | 
|   | 
| function checkBusinessTrip(checkFlg) { | 
|     document.getElementById('Page:mainForm:idDayEdit:idBusinessTrip').checked = checkFlg; | 
|     checkBusinessTripJs(); | 
| } | 
|   | 
| function clearVisitorId(index, id) { | 
|     document.getElementById('Page:mainForm:idDayEdit:idActivities:' + index + ':' + id).value = ''; | 
| } | 
|   | 
| function setDisabled() { | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoStartHour'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoStartMinute'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoEndHour'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idRepoEndMinute'), true); | 
|     setButtonDisable(document.getElementById('idBusinessTripYes'), true); | 
|     setButtonDisable(document.getElementById('idBusinessTripNo'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idStatus'), true); | 
|     setButtonDisable(document.getElementById('idSendMail'), true); | 
|     // TODO katsu なぜ 19 ですか? | 
|     for (var j = 19; j < document.forms['Page:mainForm'].elements.length; j++) { | 
|         setButtonDisable(document.forms['Page:mainForm'].elements[j], true); | 
|     } | 
| } | 
|   | 
| function setComment() { | 
|     var actsize = j$(escapeVfId('idActSize')).value(); | 
|     for (var i = 0; i < actsize; i++) { | 
|         var ministerComment = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idMinisterManager:idMinisterComment'; | 
|         var managerComment = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idMinisterManager:idManagerComment'; | 
|         j$(escapeVfId(ministerComment)).attr('disabled', ministerCommentEditFlg); | 
|         j$(escapeVfId(managerComment)).attr('disabled', managerCommentEditFlg); | 
|     } | 
|     setButtonsDisable(j$("input.idSaveComment"), ministerCommentEditFlg && managerCommentEditFlg); | 
| } | 
|   | 
| function checkGetActive() { | 
|     if (j$(escapeVfId('Page:mainForm:idDayEdit:idReporter')).value() == null || j$(escapeVfId('Page:mainForm:idDayEdit:idReporter')).value() == '') { | 
|         // 報告者を設定してください。 | 
|         alert(Error_Message19); | 
|         return; | 
|     } | 
|   | 
|     if (j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() == null || j$(escapeVfId('Page:mainForm:idDayEdit:idReportDate')).value() == '') { | 
|         // 日付を設定してください。 | 
|         alert(Error_Message20); | 
|         return; | 
|     } | 
|   | 
|     blockme(); | 
|     setTimeout("getDailyReportJs()", 50); | 
| } | 
|   | 
| function checkComment() { | 
|     var com = j$(escapeVfId('Page:mainForm:idManagerComment:idComment')).value(); | 
|     if (com.length > 255) { | 
|         alert(Error_Message46); | 
|         return false; | 
|     } | 
|   | 
|     return true; | 
| } | 
|   | 
| function closeComment() { | 
|     window.close(); | 
| } | 
|   | 
| function setButtonDisabled() { | 
|     var actsize = j$(escapeVfId('idActSize')).value(); | 
|     for (var i = 0; i < actsize; i++) { | 
|         b01 = 'idLead' + i; | 
|         b02 = 'idOpportunityView' + i; | 
|         b03 = 'idMaintenance_Contract' + i; | 
|         b04 = 'idRepair' + i; | 
|         b05 = 'idMC' + i; | 
|         b06 = 'idInspections' + i; | 
|         b07 = 'idAsset_Manual' + i; | 
|         b08 = 'idAccDC' + i; | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         //b09 = 'idRental_Apply' + i; | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         b10 = 'idOPD' + i; | 
|         b11 = 'idNTC' + i; | 
|         b12 = 'idONCALL' + i; | 
|         b13 = 'idReportAccompanied' + i; | 
|         b14 = 'idCityStatus' + i; | 
|         b15 = 'idClaim' + i; | 
|         b16 = 'idConflict' + i; | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         b17 = 'idSolution' + i; | 
|         b18 = 'idETApp' + i; | 
|         // GIR Solution 2019-12-12 by vivek end | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         b19 = 'idOpds' + i; | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // zh 20210521 ETAPP 日报联动 start | 
|         b20 = 'idETAPPAct' + i; | 
|         // zh 20210521 End | 
|         del = 'Page:mainForm:idDayEdit:idActivities:' + i + ':idDelete'; | 
|   | 
|         setButtonDisable(document.getElementById(b01), true); | 
|         setButtonDisable(document.getElementById(b02), true); | 
|         setButtonDisable(document.getElementById(b03), true); | 
|         setButtonDisable(document.getElementById(b04), true); | 
|         setButtonDisable(document.getElementById(b05), true); | 
|         setButtonDisable(document.getElementById(b06), true); | 
|         setButtonDisable(document.getElementById(b07), true); | 
|         setButtonDisable(document.getElementById(b08), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         //setButtonDisable(document.getElementById(b09), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         setButtonDisable(document.getElementById(b10), true); | 
|         setButtonDisable(document.getElementById(b11), true); | 
|         setButtonDisable(document.getElementById(b12), true); | 
|         setButtonDisable(document.getElementById(b13), true); | 
|         setButtonDisable(document.getElementById(b14), true); | 
|         //setButtonDisable(document.getElementById(b15), true); | 
|         setButtonDisable(document.getElementById(b16), true); | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         setButtonDisable(document.getElementById(b17), true); | 
|         // GIR Solution 2019-12-12 by vivek start | 
|         //setButtonDisable(document.getElementById(del), true); | 
|         setButtonDisable(document.getElementById(b18), true); | 
|         // SWAG-BUF6R8  20201020 youchang start | 
|         setButtonDisable(document.getElementById(b19), true); | 
|         // SWAG-BUF6R8  20201020 youchang end | 
|         // zh 20210521 ETAPP 日报联动 start | 
|         setButtonDisable(document.getElementById(b20), true); | 
|         // zh 20210521 End | 
|     } | 
|   | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idAddAct'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idHome'), true); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idDaily'), true); | 
|     setButtonsDisable(j$("input.idSave"), true); | 
| } | 
|   | 
| // OPD/SIS 関連 | 
| function selectOPDSISReportType() { | 
|     j$("#glayLayer").show(); | 
|     j$("#divOPD").show(); | 
|     //2021/01/27 liying start | 
|     var radios = document.getElementsByName("OPD/SIS"); | 
|     setButtonDisable(radios[0], false); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:OPDCreate'), false); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:OPDCancel'), false); | 
| } | 
| // OPD/SIS 関連 | 
| function selectOPDSISReportType1() { | 
|     j$("#glayLayer").show(); | 
|     j$("#divOPD").show(); | 
|     //2021/01/27 liying start | 
|     var radios1 = document.getElementsByName("OPD/SIS"); | 
|     setButtonDisable(radios1[0], false); | 
|     setButtonDisable(radios1[1], false); | 
|     setButtonDisable(radios1[2], false); | 
|     // //20210127 liying end | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:OPDCreate'), false); | 
|     setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:OPDCancel'), false); | 
| } | 
|   | 
|   | 
| function createOPDSISReport() { | 
|     j$("#glayLayer").hide(); | 
|     j$("#divOPD").hide(); | 
|     hiddenDivShowFlg = true; | 
|     resetOPDSISRadio(); | 
|     openPD(tempIndex, tempActId, tempRecordTypeName, tempBtnIdHidden, tempRedId, tempReportId); | 
| } | 
|   | 
| function changeOPDSISRecordName(val) { | 
|     tempRecordTypeName = val; | 
| } | 
|   | 
| function resetOPDSISRadio() { | 
|     var radios = document.getElementsByName("OPD/SIS"); | 
|     radios[0].checked = "checked"; | 
| } | 
|   | 
| function closeOPDSISDiv() { | 
|     j$("#glayLayer").hide(); | 
|     j$("#divOPD").hide(); | 
|     hiddenDivShowFlg = false; | 
|     resetOPDSISRadio(); | 
|     setVisitorPlaceDisabled(); | 
|     if (allDisableFlg) { | 
|         setDisabled(); | 
|         if (cancelRequestFlg) { | 
|             setButtonDisable(document.getElementById('Page:mainForm:idDayEdit:idCancelRequest'), false); | 
|         } | 
|         reportBtn(); // reportボタンを復活 | 
|         setComment(); // 反馈设置 | 
|     } | 
| } |