<apex:page controller="NewQuoteIraiController" sidebar="false" action="{!init}" id="Page" lightningStylesheets="true">
<!-- <apex:slds/> -->
<apex:includeLightning />
    <apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.NewQuoteIraiJS)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquerydoubletapjs)}"/>
    <!-- 标准控件弹出页面修改 start -->
    <apex:includeScript value="{!URLFOR($Resource.SelectFieldJs)}"/>
    <!-- 标准控件弹出页面修改 end -->
    <style type="text/css">
        #sbArea{
            /*display: flex;*/
            /*background-color: red;*/
            /*display: none;*/
            
        }
        #sbArea_contentsArea{
            /*display: none;*/
            /*left:50%;*/
        }

        #combobox-input-11-0-11{
            /*display: none;*/
        }
        #combobox-input-17-0-17{
            /*display: none;*/
        }
        body .pbTitle .mainTitle,.slds-vf-scope .pbTitle .mainTitle {
            font-weight: 700;
            color: black;
        }
        th {
            font-size: 1em;
            font-weight: bold;
            /*color: black;*/
        }

        body .slds-vf-data-table td,body .slds-vf-data-table .dataCell,.slds-vf-scope .slds-vf-data-table td,.slds-vf-scope .slds-vf-data-table .dataCell {
            background: #f2f3f3;
            border-width: 0 0 1px 1px;
            border-color: #e0e3e5;
            font-size: 1em;
            /*font-weight: bold;*/
            color: black;
        }
        body .pbBody table.list tr.headerRow td,body .pbBody table.list tr.headerRow th {
            background: #f2f3f3;
            border-width: 0 0 1px 1px;
            border-color: #e0e3e5;
            font-size: 1em;
            font-weight: bold;
            color: black;
            display: none;
        }
        *,*:before,*:after {
                font-size: 1em;
                /*font-weight: bold;*/
                color: black;
              -webkit-box-sizing: border-box;
              box-sizing: border-box;
          }
      body .pbBody table.list tr th, body .pbBody table.list tr td {
          border-top: 1px solid #ededed;
          border-bottom: 1px solid #ededed;
          white-space: normal;
      }
      body .slds-vf-messages,.slds-vf-scope .slds-vf-messages {
        color: rgb(255, 255, 255);
        position: relative;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        margin: .5rem;
        padding: .75rem 3rem .75rem 1.5rem;
        min-width: 30rem;
        min-height: 3.5rem;
        font-weight: 300;
        text-align: left;
        list-style: none;
        border-radius: .25rem;
        background-color: rgb(186,5,23)

    }
    body .slds-vf-messages,.slds-vf-scope .slds-vf-messages li{
        color: red;
        font-size: 15px;
    }
    </style>
    <apex:form id="mainForm">
        <apex:outputText id="SelectFieldFlag" />
        <apex:outputText id="hiddenQuoid" value="{!quoid}" style="display:none;"/>
        <apex:inputHidden id="Agency1_entrust__c" value="{!quo.Agency1_entrust__c}"/>
        <apex:inputHidden id="Agency2_entrust__c" value="{!quo.Agency2_entrust__c}"/>
        <apex:inputHidden id="changedAfterPrint" value="{!changedAfterPrint}"/>
        <apex:inputHidden id="productStatusUpdated" value="{!productStatusUpdated}"/>
        <apex:inputHidden id="idHiddenUserStateHospital" value="{!loginUser.State_Hospital__c}" />
        <apex:actionFunction action="{!setProductEntry}" name="setProductEntry" reRender="mainForm" oncomplete="unblockUI();calPriceAll();">
            <apex:param assignTo="{!setProduct_text}" name="setProduct_text" value=""/>
        </apex:actionFunction>
        <apex:actionFunction action="{!excelImport}" name="excelImport" reRender="mainForm" oncomplete="unblockUI();calPriceAll();">
            <apex:param assignTo="{!excel_text}" name="select_index" value=""/>
        </apex:actionFunction>
        <apex:actionFunction action="{!Save}" name="Save" reRender="mainForm,message1" oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!OppReflection}" name="OppReflection" reRender="mainForm" oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!QuoteIrai}" name="QuoteIrai" reRender="mainForm,message1" oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!msgChange}" name="msgChange" reRender="mainForm,message1" oncomplete="unblockUI();"/>
        
        <apex:pageBlock id="block">
            <apex:inputHidden value="{!quo.CurrencyIsoCode}" id="CurrencyIsoCode"/>
            <apex:inputHidden value="{!baseUrl}" id="baseUrl"/>
            <!--  CHAN-BJQ4VZ 精琢技术 2019/12/10 Start -->
            <apex:inputHidden value="{!qb.Estimation_List_Price}" id="hidden_Estimation"/>
            <apex:inputHidden value="{!errorMessage}" id="errorMessage"/>
            <apex:inputHidden value="{!qb.QuoteTotal_Page}" id="hidden_quoTotalPrice"/>
            <apex:inputHidden value="{!qb.MultiYearWarrantyTotalPrice}" id="hidden_MultiYearWarrantyTotalPrice_out"/>
            <!--  CHAN-BJQ4VZ 精琢技术 2019/12/10 END -->
            <apex:outputPanel id="message1">
                <!-- <apex:messages styleClass="editListError"/> -->
            </apex:outputPanel>
            <apex:outputPanel rendered="{!errorflg}" >
                <table width="100%">
                    <tr>
                        <td align="left"><div class="errorMsg" style="color: rgb(186,5,23);">{!errorMessage}</div></td>
                    </tr>
                </table>
            </apex:outputPanel>
            <apex:outputPanel rendered="{!succflg}" >
                <table width="100%">
                    <tr>
                        <td align="left"><div style="color:rgb(46, 132, 74)">{!succMessage}</div></td>
                    </tr>
                </table>
            </apex:outputPanel>
            <apex:outputPanel rendered="{!Messageflg}" >
                <table width="100%">
                    <tr>
                        <td align="left">{!Message}</td>
                    </tr>
                </table>
            </apex:outputPanel>
            <div style="background:rgb(240 238 238);white-space:nowrap;padding:10px;width:1100px;">
                <table border="0">
                    <tr>
                        <th style="text-align:right;width:60px;margin:10px;">{!$ObjectType.QuoteIrai__c.fields.IraiSubject__c.Label}：</th>
                        <td style="text-align:left;width:220px;margin:10px">
                            <div class="requiredInput"><div class="requiredBlock"></div><apex:inputField id="idVisitorPlace" value="{!quo.IraiSubject__c}" onblur="vpClear2_delay();" onfocus="setVisitorPlace();" style="width:210px;"/></div>
                            <apex:inputHidden id="idVisitorPlaceId" value="{!quo.Account__c}"/>
                            <apex:inputHidden id="idVisitorPlaceHidden" value="{!quo.IraiSubject__c}" />
                            <apex:inputHidden id="idVisitorPlaceHiddenId" value="{!quo.Account__c}" />                    
                        </td>
                        <th style="text-align:right;width:60px;margin:10px;">{!$ObjectType.QuoteIrai__c.fields.IraiName__c.Label}：</th>
                        <td style="text-align:left;width:220px;margin:10px;"><apex:inputField value="{!quo.IraiName__c}" style="width:220px;"/></td>
                        <th style="text-align:right;width:60px;margin:10px;padding-left:10px">  {!$ObjectType.QuoteIrai__c.fields.IraiComment__c.Label}：</th>
                        <td style="text-align:left;width:220px;margin:10px;"><apex:inputField value="{!quo.IraiComment__c}" style="width:220px;"/></td>
                        <th style="text-align:right;width:60px;margin:10px;padding-left:10px">{!$ObjectType.QuoteIrai__c.fields.QuoteProportion__c.Label}：</th>
                        <td style="text-align:left;width:60px;margin:10px;"><apex:inputField value="{!quo.QuoteProportion__c}" style="width:70px;text-align:right;"/></td>
                        <th style="text-align:left;width:20px;margin:10px;">%</th>
                        <th style="text-align:right;width:60px;margin:10px;">{!$ObjectType.QuoteIrai__c.fields.QuoteIrai_Status__c.Label}：</th>
                        <td style="text-align:left;width:80px;margin:10px;"><apex:outputField value="{!quo.QuoteIrai_Status__c}" style="width:80px;"/></td>
                    </tr>
                </table>
                 <!-- CHAN-BJQ4VZ 精琢技术 2019/12/10 Start -->
                <table border="0">
                    <tr>
                        <td>&nbsp;</td>
                        <!-- <th style="text-align:right">{!IF(displayFlg,'产品标准定价总额','')}</th> -->
                        <th style="text-align:center;width:50px;white-space:nowrap;padding:20px;">产品标准定价总额 :&nbsp;</th>
                        <td style="width:176px;padding:10px;">
                            <apex:outputText id="Estimation_Price"  value="{0, number, ###,##0.00}"
                            style="text-align:right;width:100px;">
                                <apex:param value="{!qb.Estimation_List_Price}" />
                            </apex:outputText>
                        </td>
                        <th style="text-align:right;width:100px;white-space:nowrap;padding:10px;">报价总额 :&nbsp;</th>
                       <!--  <th style="text-align:right;">{!IF(displayFlg,$Label.Total_Price,'')}</th> -->
                        <td style="width:180px;margin:10px;">
                            <apex:outputtext id="quoTotalPrice" value="{0, number, ###,##0.00}" 
                            style="text-align:right;width:100px;">
                                <apex:param value="{!qb.QuoteTotal_Page}"/>
                            </apex:outputtext>
                        </td>
                        <th style="text-align:right;width:50px;margin:10px;" rowspan="3">
                       {!$ObjectType.QuoteIrai__c.fields.MultiYearWarrantyTotalPrice__c.Label}
                   :&nbsp;</th>
                        <td style="width:100px;" rowspan="3">
                           <!--obsap 新增经销商1字段 fy end-->
                           <apex:outputtext style="width: :100px" id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
                           >
                           <!--obsap 新增经销商1字段 fy start-->
                           <!-- style="text-align:right;width:180px;"> -->
                           <!--obsap 新增经销商1字段 fy end-->
                               <apex:param value="{!qb.MultiYearWarrantyTotalPrice}"/>
                           </apex:outputtext>
                        </td>
                    </tr>
                </table>
                <!-- CHAN-BJQ4VZ 精琢技术 2019/12/10 End -->

                <!-- CHAN-BJQ4VZ 精琢技术 2019/12/10 Start -->
                <table>


               <!--obsap 新增经销商1字段 fy start-->
               <tr>
                <td ></td>
                <th style="width:100px;text-align:right;">{!$Label.Sales_Name1}：</th>




                <td colspan="2" style="width:260px;text-align:left;">
                    <apex:inputField style="width:230px;" id="SalesName1"  value="{!quo.Agency1_entrust__c}"   onChange="" />
                </td>







<!--                 <td colspan="2" style="width:260px;text-align:left;">
                    <apex:inputField  style="display: none" id="SalesName1"  value="{!quo.Agency1_entrust__c}"   onChange=""/>
                    <div id="lightningPage" style="height:50px;width: 250px;padding-top: 8px;"  onclick="getVal();" onchange="refreshSelectFieldValue(SelectFieldParamList,this)" ></div>
                    <apex:inputHidden id="SalesName1inputHidden" value="{!quo.Agency1_entrust__c}"/>
                </td> -->


                <th style="width:100px;text-align:right;margin:10px;">{!$Label.Sales_Name2}：</th>

                <td colspan="2" style="width:260px;text-align:left;"><apex:inputField style="width:230px;" id="SalesName2"  value="{!quo.Agency2_entrust__c}"   onChange=""/></td>
<!--                 <td colspan="2" style="width:260px;text-align:left;">
                    <apex:inputField style="width:230px;display: none;" id="SalesName2"  value="{!quo.Agency2_entrust__c}"   onChange="" />
                    <div id="lightningPage2" style="height:50px;width: 250px;padding-top: 8px;" onchange="refreshSelectFieldValue(SelectFieldParamList,this)" ></div>
                    <apex:inputHidden id="SalesName2inputHidden" value="{!quo.Agency2_entrust__c}"/>
                </td> -->
<!--                  <td colspan="2" style="width:260px;text-align:left;">
                    <c:SLDSDynamicLookup SLDSResourceName="{!$Resource.SLDS}" ObjectApiName="Account" DisplayFieldApiNames="Name" DisplayFieldsPattern="Name"  LabelName="Name" SetValueToField="{!quo.Agency1_entrust__c}" setStyleCss="width:230px;"/>
                  </td> -->
                
                
                </tr>
                <tr>
                <td style="height: 10px;"></td>
                </tr>
                <!--obsap 新增经销商1字段 fy end-->
                <!--DB202302464682【报价委托】报价委托改善224 fy start-->
               <tr>
                <td ></td>

                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start -->
                <th style="width:100px;text-align:right;">多年保：</th>
                <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start -->
                <td colspan="2" style="text-align:left;"><apex:inputField id="cancelMultiyearInsurance"  value="{!quo.cancelMultiyearInsurance__c}"  onChange="cancelMultiyearInsurancechange()"/></td><!-- onChange="cancelMultiyearInsurancechange()"-->
                <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy end -->
                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end -->

                <th style="text-align:right;width:80px;margin:10px;">{!$ObjectType.QuoteIrai__c.fields.IraiUser__c.Label}：</th>
                <!-- fy 20220512 -->
                <!-- <apex:variable value="identif1" var="identif1" rendered="{!!(loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&&(loginUser.Salesdepartment_text__c == '5.华东' || loginUser.Salesdepartment_text__c == '6.华南'))}"  > -->

                <!-- fy 20220512 -->
                <!-- <apex:variable value="identif" var="identif" rendered="{!loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&&(loginUser.Salesdepartment_text__c == '5.华东' || loginUser.Salesdepartment_text__c == '6.华南')}"  > -->

                <!-- <th style="text-align:right;width:20px;">obsap人员</th> -->
<!--                 <td style="text-align:center;width:20px;margin:10px;"><apex:selectList value="{!quo.IraiUser__c}" size="1" style="width:120px" id="IraiUser" onchange="ObsapUsersChange()"><apex:selectOptions value="{!ObsapUsers}" id="obsapUsersList"/></apex:selectList></td> -->
                <td style="text-align:center;width:20px;margin:10px;">OBSAP小组<apex:selectList value="{!quo.IraiUser__c}" size="1" style="width:120px;display: none;" id="IraiUser" onchange="ObsapUsersChange()"><apex:selectOptions value="{!ObsapUsers}" id="obsapUsersList"/></apex:selectList></td>

                <!-- 20230104 lt DB202212427301 start-->
                <!-- <th style="text-align:right;width:80px;">{!$ObjectType.QuoteIrai__c.fields.LastIraiUser__c.Label}</th>
                <td style="text-align:center;width:70px;"><apex:outputField id="LastIraiUser" value="{!quo.LastIraiUser__c}"/></td> -->
                <!-- 20230104 lt DB202212427301 end-->

                <!-- 20230104 lt DB202212427301 start-->
                <th style="text-align:right;width:190px;margin:10px;">紧急：</th>
                <td style="text-align:center;width:10px;margin:10px;"><apex:inputField id="Urgent" value="{!quo.Urgent__c}"/></td>
                <th style="text-align:right;width:190px;margin:10px;"></th>
                <td style="text-align:center;width:10px;margin:10px;"></td>
               </tr>
                <!--DB202302464682【报价委托】报价委托改善224 fy end-->
                <tr>

                    <td>&nbsp;</td>
                </tr>
            </table>
             <!-- CHAN-BJQ4VZ 精琢技术 2019/12/10 End -->
                             <table border="0">
                    <tr>
                        <th style="width:50px;margin:10px;">&nbsp;</th>
                        <!-- 产品配套检索按钮 -->
                        <td style="width:150px;margin:10px;"><apex:commandButton id="SetProduct" onclick="saveOldElm();searchSetProduct();return false;" value="{!$Label.Set_Product}" rerender="dummy"/></td>
                        <!-- excel 导出按钮 -->
                        <td style="width:150px;margin:10px;"><apex:commandButton onclick="openQuoteExcelImport(event);return false;" value="{!$Label.Excel_Import}" rerender="dummy"/></td>
                        <td style="text-align:right;width:90px;margin:10px;padding-right:10px; "><apex:commandButton rerender="dummy" id="Btn_RowDelete" onclick="radioChecker2('del');return false;" value="{!$Label.deleteLabel}" style="width:60px;"/></td>
                        <td style="width:300px;margin:10px;">
                            <apex:commandButton rerender="dummy" id="Btn_RowUp" onclick="radioChecker2('up');return false;" value="{!$Label.Row_Up}" style="width:100px;"/>
                            <apex:commandButton rerender="dummy" id="Btn_RowDown" onclick="radioChecker2('down');return false;" value="{!$Label.Row_Down}" style="width:100px;"/>
                        </td>
                        
                        <!-- 20230104 lt DB202212427301 end-->

                        <!-- 2020/02/18  精琢技术  韩部长提出先隐藏 没必要  Start-->
                        <!-- <th style="text-align:right;width:70px;">总计</th>
                        <td style="text-align:right;width:80px;">
                            <apex:outputtext id="Estimation_List_Price" value="{0, number, ###,##0.00}"><apex:param value="{!total_ListPrice}"/></apex:outputtext>
                            <apex:inputHidden id="hidden_Estimation_List" value="{!total_ListPrice}"/>
                        </td> -->
                        <!-- 2020/02/18  精琢技术  韩部长提出先隐藏 没必要  end-->
                    </tr>
                </table>
            </div>
<!--             <table>
                <tr>
                    <td>&nbsp;</td>
                </tr>
            </table> -->
            <table style="height:30px;width:1100px;background:rgb(240 238 238);width:1100px;border-top: 1px solid #ccc;border-bottom: 1px solid #ccc;color:rgb(76 76 76);" border="0">
                <tr >
                    <th style="text-align:center;width:30px;color:rgb(76 76 76);">&nbsp;<input type="checkbox" id="checkAll" onclick="selectAll()" style="height:15px;width:15px;"/></th>
                    <th style="text-align:center;width:30px;color:rgb(76 76 76);">No</th>
                    <th style="text-align:center;width:150px;color:rgb(76 76 76);">{!$Label.Asset_No}</th>
                    <th style="text-align:center;width:100px;color:rgb(76 76 76);">{!$Label.SFDA_Status}</th>
                    <th style="text-align:center;width:300px;color:rgb(76 76 76);">{!$Label.Product_Name}</th>
                    <th style="text-align:center;width:100px;color:rgb(76 76 76);">{!$Label.Quantity}</th>
                    <!-- CHAN-BHNBX6 2019/11/20 START -->
                    <th style="text-align:center;width:70px;color:rgb(76 76 76);">保修年限</th>
                    <!-- CHAN-BHNBX6 2019/11/20 END -->
                    <th style="text-align:center;width:85px;padding-right: 7px;color:rgb(76 76 76);">ListPrice</th>
                    <th style="text-align:center;width:100px;padding-right: 15px;color:rgb(76 76 76);">小计</th>
                    <!-- CHAN-BHNBX6 2019/11/20 START -->
                    <th style="text-align:center;width:100px;padding-right: 20px;color:rgb(76 76 76);">NoDiscount小计</th>
                    <!-- CHAN-BHNBX6 2019/11/20 END -->
                </tr>
            </table>
            <div id="iframelike" style="width:1100px;">
                <input type="hidden" id="ListPriceTotal" value="0" />
                <input type="hidden" id="UnitPriceTotal" value="0" />
                <apex:pageblocktable value="{!activities}" var="s" id="lists" style="width:1050px;text-align:center;background-color: white;">
                    <apex:column style="width:30px;text-align:center;" >
                        <input type="checkbox" name="checklist" value="{!s.lineNo}" style="height:15px;width:15px;"/>
                    </apex:column>
                    <!-- No -->
                    <apex:column style="width:20px;text-align:center;" >
                        <apex:outputLabel id="indexNo" value="{!IF(s.PageObject.Product2__c==null,null,s.lineNo + 1)}" style="width:10px;"/>
                    </apex:column>
                    <!-- 产品编号-->
                    <apex:column style="text-align:center;width:150px;">
                        <apex:inputText id="Assert" style="width:120px;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value)" />
                        <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start -->
                        <apex:inputHidden id="CanNotCancelledGurantee__c" value="{!s.CanNotCancelledGurantee}" />
                        <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start -->
                    </apex:column>
                    <!-- NMPA状态 -->
                    <apex:column style="width:100px;text-align:center;">
                        <apex:outputField style="width:75px;" id="Status__c" value="{!s.PageObject.SFDA_Status__c}"/>
                        <apex:inputHidden id="SFDA" value="{!s.PageObject.SFDA_Status__c}"/>
                    </apex:column>
                    <!-- 产品名称 -->
                    <apex:column style="width:300px;text-align:center;">
                        <div id="Page:mainForm:block:lists:{!s.lineNo}:NameLink"><apex:outputLink style="width:300px;" value="{!baseUrl}/{!s.PageObject.Product2__c}" id="Nametext1" target="_blank">{!s.PageObject.Name__c}</apex:outputLink></div>
                        <apex:inputHidden id="Name__c" value="{!s.PageObject.Name__c}"/>
                    </apex:column>
                    <!-- 数量 -->
                    <apex:column style="text-align:center;width:100px;">
                        <apex:inputField id="Quantity" style="width:70px;text-align:right;" value="{!s.PageObject.Quantity__c}" onChange="calPrice('{!s.lineNo}')"/>
                    </apex:column>
                    <!--    2019/11/12 保修年限 CHAN-BHNBX6  start -->
                    <apex:column style="width:50px;text-align:center;" >
                        <apex:outputLabel id="itemGuaranteePeriod" value="{!s.PageObject.GuaranteePeriod__c}" style="width:50px;"/>
                    </apex:column>
                    <!--    2019/11/12 保修年限 CHAN-BHNBX6  end -->
                    <!-- ListPrice-->
                    <apex:column style="width:85px;text-align:center;">
                        <apex:outputPanel layout="none" rendered="{!$ObjectType.QuoteIraiLineItem__c.fields.ListPrice__c.accessible}" >
                            <apex:outputText style="width:85px;" id="ListPricetext" value="{0, number, ###,##0.00}">
                                <apex:param value="{!s.ListPrice_Page}" />
                            </apex:outputText>
                        </apex:outputPanel>
                        <apex:inputHidden id="ListPrice" value="{!s.ListPrice_Page}"/>
                        <apex:outputPanel layout="none" rendered="{!!$ObjectType.QuoteIraiLineItem__c.fields.ListPrice__c.accessible}" >
                            <span style="width:85px;text-align:right;" id="Page:mainForm:block:lists:{!s.lineNo}:ListPricetext">{!IF(s.PageObject.Product2__c == null, ' ', 0.00)}</span>
                            <script type="text/javascript">
                                j$(escapeVfId('Page:mainForm:block:lists:'+ {!s.lineNo} + ':ListPrice')).val(toNum(0));
                            </script>
                        </apex:outputPanel>
                    </apex:column>
                    <!-- 小计 -->

                    <apex:column style="width:100px;text-align:center;">
                        <apex:outputPanel layout="none" rendered="{!$ObjectType.QuoteIraiLineItem__c.fields.ListPrice__c.accessible}" >
                            <apex:outputText style="width:80px;" id="ListPriceTotalText" value="{0, number, ###,##0.00}">
                                <apex:param value="{!s.ListPriceTotal_Page}" />
                            </apex:outputText>
                        </apex:outputPanel>
                        <apex:inputHidden id="ListPriceTotal" value="{!s.ListPriceTotal_Page}"/>
                        <apex:outputPanel layout="none" rendered="{!!$ObjectType.QuoteIraiLineItem__c.fields.ListPrice__c.accessible}" >
                            <span style="width:80px;text-align:right;" id="Page:mainForm:block:lists:{!s.lineNo}:ListPriceTotalText">{!IF(s.PageObject.Product2__c == null, ' ', 0.00)}</span>
                            <script type="text/javascript">
                                j$(escapeVfId('Page:mainForm:block:lists:'+ {!s.lineNo} + ':ListPriceTotal')).val(toNum(0));
                            </script>
                        </apex:outputPanel>
                        <apex:inputHidden id="Product_Id" value="{!s.PageObject.Product2__c}"/>
                        <apex:inputHidden id="lineNo" value="{!s.lineNo}"/>
                    </apex:column>
                    <!-- CHAN-BHNBX6  NodisCount 小计  2019/11/20 START -->
                    <apex:column style="width:100px;text-align:center;">
                        <apex:outputPanel layout="none" rendered="{!$ObjectType.QuoteIraiLineItem__c.fields.ServicePrice__c.accessible}" >
                            <apex:outputText style="width:80px;text-align:center;" id="NoDiscountTotalText" value="{0, number, ###,##0.00}">
                                <apex:param value="{!s.NoDiscountTotal_Page}" />
                            </apex:outputText>
                        </apex:outputPanel>
                        <apex:inputHidden id="NoDiscountTotal" value="{!s.NoDiscountTotal_Page}"/>
                        <apex:inputHidden id="NoDiscount" value="{!s.NoDiscount_Page}"/>
                        <apex:outputPanel layout="none" rendered="{!!$ObjectType.QuoteIraiLineItem__c.fields.ServicePrice__c.accessible}" >
                            <span style="width:80px;text-align:right;" id="Page:mainForm:block:lists:{!s.lineNo}:NoDiscountTotalText">{!IF(s.PageObject.Product2__c == null, ' ', 0.00)}</span>
                            <script type="text/javascript">
                                j$(escapeVfId('Page:mainForm:block:lists:'+ {!s.lineNo} + ':NoDiscountTotal')).val(toNum(0));
                            </script>
                        </apex:outputPanel>
                        
                        
                    </apex:column>
                    <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy start -->
                    <!-- <apex:column style="width:100px;text-align:right;">
                        <apex:outputPanel layout="none" rendered="{!IF(quo.cancelMultiyearInsurance__c =='要' ||(quo.cancelMultiyearInsurance__c =='不要' && s.CanNotCancelledGurantee == 'true' ),true,false)}" >
                            <apex:outputText style="width:80px;" id="NoDiscountTotalText" value="{0, number, ###,##0.00}">
                                <apex:param value="{!s.NoDiscountTotal_Page}" />
                            </apex:outputText>
                        </apex:outputPanel>
                        <apex:inputHidden id="NoDiscountTotal" value="{!s.NoDiscountTotal_Page}"/>
                        <apex:inputHidden id="NoDiscount" value="{!s.NoDiscount_Page}"/>
                        <apex:outputPanel layout="none" rendered="{!IF(quo.cancelMultiyearInsurance__c =='不要'&& s.CanNotCancelledGurantee == 'false'  ,true,false)}" >
                            <span style="width:80px;text-align:right;" id="Page:mainForm:block:lists:{!s.lineNo}:NoDiscountTotalText">{!IF(s.PageObject.Product2__c == null, ' ', 0.00)}</span>
                            <script type="text/javascript">
                                j$(escapeVfId('Page:mainForm:block:lists:'+ {!s.lineNo} + ':NoDiscountTotal')).val(toNum(0));
                            </script>
                        </apex:outputPanel>
                    </apex:column> -->
                    <!-- DB202212304166 【紧急-报价委托与购买意向】请将最后操作的报价委托状态放到购买意向中 fy end -->
                    <!-- CHAN-BHNBX6  NodisCount 小计  2019/11/20 END -->
                </apex:pageBlockTable>
            </div>

            <BR></BR>
            <table border="0">
                <tr>
                    <td style="width:550px;" align="right">
                        <apex:inputField value="{!quo.Note__c}" style="width:550px;height:55px;"/>
                    </td>
                    <td>
                        <table border="0">
                            <tr>
                                <th style="width:15px">&nbsp;</th>
                                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start -->
                                <td style="width:10px;" align="right"><apex:commandButton id="QuoteIraiBtn" action="{!checkIraiUser}" reRender="IraiUserId,message1" onclick="blockme();" oncomplete="iraiJs();return false;" value="发送委托邮件" style="white-space:nowrap;" disabled="{!Save_button}"/></td>
                                <th style="width:15px">&nbsp;</th>
                                <!-- <td style="width: 10px;"></td> -->
                                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end -->
                                <td style="width:10px;" align="right"><apex:commandButton action="{!checkIraiUser}" reRender="IraiUserId,hiddenQuoid,message1" onclick="blockme();" oncomplete="save2btn();return false;" value="{!$Label.Save_Button}" style="width:100px;" disabled="{!Save_button}" /></td>
                                <th style="width:1000px">&nbsp;</th>
                                <!-- 20230109 lt DB202212427301 start  注释 -->
                                <!-- <td style="width:100px;" align="right"><apex:commandButton onclick="oppReflection2btn();return false;" rerender="hiddenQuoid" value="{!$Label.Opp_Button}" style="width:90px;" disabled="{!Save_button}"/></td>
                                <td style="width:100px;" align="right"><apex:commandButton action="{!Back}" rerender="hiddenQuoid" value="不保存（返回）" style="width:90px;"/></td>
                                <td style="width:100px;" align="right"><apex:commandButton value="产品试用评价OPD" style="width:95px;" onclick="openpdf('OPD');return false;" disabled="{!pdf_button}"/></td>
                                <td style="width:100px;" align="right"><apex:commandButton value="产品试用评价SIS" style="width:95px;" onclick="openpdf('SIS');return false;" disabled="{!pdf_button}"/></td> -->
                                <!-- 20230109 lt DB202212427301 end  注释 -->
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </apex:pageBlock>
    </apex:form>
    <script type="text/javascript">
        var QuoteEntryMaxLine = {!QuoteEntryMaxLine};
        var displayCost = '{!displayCost}';
        var quoid = '{!quoid}';
        var Session_ID = '{!$Api.Session_ID}';
        var Price_Valid_Period = '{!$Label.Price_Valid_Period}';
        var Message_001 = '{!$Label.Message_001}';
        var Message_Please_Save_Quote = '{!$Label.Please_Save_Quote}';
        var Message_Check_Your_Clipboard = '{!$Label.Check_Your_Clipboard}';
        var Error_Message3 = '{!$Label.Error_Message3}';
        var Error_Message11 = '{!$Label.Error_Message11}';
        var Error_Message29 = '{!$Label.Error_Message29}';
        var Error_Message33 = '{!$Label.Error_Message33}';
        var Error_Message34 = '{!$Label.Error_Message34}';
        var Error_Message35 = '{!$Label.Error_Message35}';
        var Error_Message36 = '{!$Label.Error_Message36}';
        var Error_Message40 = '{!$Label.Error_Message40}';
        var Confirm_ChangedAfterPrint = '打印后行信息有变化，是否继续操作（报价编码会变新）？';
        var Confirm_PriceRefresh = '报价作成后{!$Label.Price_Valid_Period}天,还没有更新过价格，需要执行{!$Label.Status_Update}？';
        var Confirm_saveBtn = '您选择了委托人员，确定只是保存吗（不进行委托）？';
        window.sfdcPage.appendToOnloadQueue(function() { calonLoad() });
        var openQuoteExcelImportWindow = null;
        
        function vpClear2_delay(){
            var vp = 'Page:mainForm:block:idVisitorPlace';
            var vpHidden = 'Page:mainForm:block:idVisitorPlaceHidden';
            setTimeout(
                function() {
                    if(j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag") == "false") {
                        if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
                            vpClear2();
                        }
                    }
                },
                200
            );
        }
        
        function vpClear2(){
          resetValue('Page:mainForm:block:idVisitorPlace');
        }
        
        //訪問場所インスタント検索
        function setVisitorPlace(){
            try{
                var str = 'Page:mainForm:block:idVisitorPlace';
                var strPage = null;
                var options = {};
                
                var us = j$(escapeVfId('Page:mainForm:idDayEdit:idHiddenUserStateHospital')).value();
                
                strPage = '/apex/Xin_SearchVisitorPlace?r=' + encodeURI(us);
                options = {minchars:3, minwords:2, resultsClass:'visitorplace_results'};
                    
                jQuery(escapeVfId(str)).unbind();
                if (strPage != null) {
                    jQuery(escapeVfId(str)).suggest(strPage,options);
                }
            }catch(e){
                alert(e);
            }
        }
        
        function selectAll() {
            var checklist = j$("input[name='checklist']");
            var all = j$(escapeVfId("checkAll"));
            for(var i = 0; i < checklist.length; i++){
                if (all[0].checked == true) {
                    checklist[i].checked = true;
                } else {
                    checklist[i].checked = false;
                }
            }
        }
        
        function iraiJs() {
            console.log('====jinlaile-==');
            // var username = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
            // var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val();
            var username1 = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
            var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val();
            //var username2 = j$(escapeVfId("Page:mainForm:block:j_id46:IraiUser")).val();
            var username2 = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
            //obsap 新增经销商1字段 fy start
            var Agency1entrustc = j$(escapeVfId("Page:mainForm:block:SalesName1")).val();
            console.log('Agency1entrustc  =  ' + Agency1entrustc);
            // if(Agency1entrustc==null){
            //     Agency1entrustc = document.getElementById("Page:mainForm:block:SalesName1").value;
            // }
            //obsap 新增经销商1字段 fy end
            sforce.connection.sessionId = Session_ID;
            if(!userid&&username2){
                userid=username2;
            }
            // userid='0051000000CevhnAAB';
            console.log(username2+'====userid-=='+userid);
            var resultSet = sforce.connection.query( "SELECT Email,SFDCPosition_C__c FROM User WHERE Id = '" + userid + "'");
            var records = resultSet.getArray("records");
            console.log('====records -=='+records );
            var mail = null;
            var SFDCPosition;
            if (records != null && records.length > 0) {
                var iraiUser = records[0];
                mail = iraiUser.Email;
                SFDCPosition = iraiUser.SFDCPosition_C__c;
            }
            console.log('====Agency1entrustc -=='+Agency1entrustc );
            //obsap 新增经销商1字段 fy start
            if(Agency1entrustc != null&&Agency1entrustc !=""&&Agency1entrustc.length > 0){
                if (mail != null && mail.length > 0) {
                    // var Salesdepartment = '{!loginUser.Salesdepartment_text__c}';
                    //fy 20220512
                    var Salesdepartment = true;
                    console.log('Salesdepartment:' + Salesdepartment);
                    var positioncheck = true;
                    // if (Salesdepartment == '5.华东' || Salesdepartment == '6.华南') {
                    //fy 20220512
                    if (Salesdepartment) {
                        mail = '{!obsap_mail}';
                        positioncheck = false;
                    }
                    if (positioncheck && SFDCPosition != '营业助理'){
                        alert('请选择对应的营业助理.');
                        unblockUI();              
                    }
                    // 20230104 lt DB202212427301 start  注释
                    // else if (window.confirm('确定要委托该人员吗？\n' + mail)) {
                        // QuoteIrai();
                    // } 
                    // 20230104 lt DB202212427301 end
                    else {
                        QuoteIrai();   // 20230104 lt DB202212427301 end
                        // unblockUI(); // 20230104 lt DB202212427301 end
                    }
                } else {
                    alert('请选择委托人员.');
                    unblockUI();
                }
            }else {
                alert('请选择第一经销商.');
                unblockUI();
            }
            //obsap 新增经销商1字段 fy end
        }
                     


        //标准控件修改 start

        // //查询参数列表
        // let SelectFieldParamList=[
        //     //第一个输入框参数
        //     {
        //         //原输入框id
        //         inputFieldId:'Page:mainForm:block:SalesName1',
        //         //隐藏输入框id，用于修改后台值
        //         inputHiddenId:'Page:mainForm:block:SalesName1inputHidden',
        //         //新增lightning组件id
        //         lightningId:'lightningPage',
        //         //查询对象
        //         objType:'QuoteIrai__c',
        //         //查询字段
        //         field:'Agency1_entrust__c',
        //         //id
        //         recordId:'{!quo.Id}'
        //     },
        //     //第二个输入框参数
        //     {
        //         inputFieldId:'Page:mainForm:block:SalesName2',
        //         inputHiddenId:'Page:mainForm:block:SalesName2inputHidden',
        //         lightningId:'lightningPage2',
        //         objType:'QuoteIrai__c',
        //         field:'Agency2_entrust__c',
        //         recordId:'{!quo.Id}'
        //     },
        // ]
        // initLwc(SelectFieldParamList);


        //标准控件弹出页面修改 start
        //查询参数列表
        let SelectFieldParamList=[
            // 
            {
                //原apex:inputField的id值，需要在页面上获取
                inputFieldId : 'Page:mainForm:block:SalesName1',
                //查找字段所在对象
                ObjectType : 'QuoteIrai__c',
                //查找字段的api名称
                QueryFieldApiName : 'Agency1_entrust__c',
                //查找字段的查找对象
                SelectObj : 'Account',
                //搜索时使用的字段
                SelectFld : 'Name',

            },
            {
                //原apex:inputField的id值，需要在页面上获取
                inputFieldId : 'Page:mainForm:block:SalesName2',
                //查找字段所在对象
                ObjectType : 'QuoteIrai__c',
                //查找字段的api名称
                QueryFieldApiName : 'Agency2_entrust__c',
                //查找字段的查找对象
                SelectObj : 'Account',
                //搜索时使用的字段
                SelectFld : 'Name',
            },
        ]
        //初始化
        resetOpenPage(SelectFieldParamList);
        function unblockUI(){
            j$("#sbArea").fadeOut(500, function(){
                j$("#sbArea").remove();
            });
            resetOpenPage(SelectFieldParamList);
        }
        //标准控件弹出页面修改 end

        function getVal(){
            const inputFields = document.getElementById('lightningPage').querySelectorAll('input');
            console.log(inputFields);
        }
        function saveOldElm(){
            for (var i = SelectFieldParamList.length - 1; i >= 0; i--) {
                // SelectFieldParamList[i].oldParentElm=document.getElementById(SelectFieldParamList[i].inputFieldId).parentNode;
            }
        }
        // function initLwc(SelectFieldParamList){
        //     SelectFieldParamList.forEach(function(parm){
        //         $Lightning.use("c:LexSelectFieldApp", function() {
        //             $Lightning.createComponent(
        //                 "c:LexSelectFieldCmp",
        //                 {
        //                     "objApiName": parm.objType,
        //                     "fieldApiName": parm.field,
        //                     "recordId" : parm.recordId,
        //                 },
        //                 parm.lightningId,
        //                 function(cmp) {
        //                     console.log(cmp);
        //                     unblockUI();
        //                     setTimeout(()=>{
        //                         initLwcData(parm,0);
        //                     },1000);
        //                 }
        //             );
        //         });
        //     })
        // }
        // function initLwcData(parm,count){
        //     if(count>10)return;
        //     try{
        //         console.log(document.getElementById(parm.lightningId));
        //         console.log(document.getElementById(parm.lightningId).querySelectorAll('input'));
        //         if(!document.getElementById(parm.lightningId).querySelectorAll('input')){
        //             return;
        //         }
        //         let inp=document.getElementById(parm.lightningId).querySelectorAll('input')[0].id.replace('combobox-input-','');
        //         console.log('combobox-input-'+inp+'-0-' + inp);
        //         let comboxId='#combobox-input-'+inp+'-0-' + inp;
        //         let style = document.createElement('style');
        //         style.innerHTML=
        //             comboxId+'{'+
        //             'display:none'+
        //             '}';
        //         let ref=document.querySelector('style');
        //         ref.parentNode.insertBefore(style, ref);
        //         console.log(style);

        //         let objId=document.getElementById(parm.inputFieldId + '_lkid').value;
        //         if(objId==null||objId=='000000000000000AAA'||objId=='000000000000000'){
        //             return;
        //         }

        //         const inputFields = document.getElementById(parm.lightningId).querySelectorAll('input');
        //         let objName=document.getElementById(parm.inputFieldId + '_lkold').value;
        //         inputFields[0].click();
        //         setTimeout(()=>{
        //             lwcItem=document.getElementById(parm.lightningId);
        //             let liIrtem=lwcItem.querySelectorAll('lightning-base-combobox-item');
        //             console.log(liIrtem);
        //             let objId=document.getElementById(parm.inputFieldId + '_lkid').value;
        //             setNodeValue(liIrtem[1],objId).then(function (){
        //                 console.log(liIrtem[1].attributes.getNamedItem('data-value'));
        //                 liIrtem[1].click();
        //             })
        //         },1000);
        //         // inputFields[0].value = objName;
        //         // inputFields[1].value = objId;
        //         // let objId=document.getElementById(parm.inputFieldId + '_lkid').value;
        //         // if(objId==null||objId=='000000000000000AAA'||objId=='000000000000000'){
        //         //     return;
        //         // }
        //         // let lwcItem=document.getElementById(parm.lightningId);
        //         // let inputCmp=lwcItem.querySelectorAll('input');
        //         // console.log("initLwcData");
        //         // console.log(inputCmp);
        //         // console.log(objId);
        //         // if(inputCmp[0].name=='hiddenName'){
        //         //     setTimeout(()=>{
        //         //         initLwcData(parm);
        //         //     },1000);
        //         //     return;
        //         // }
        //         // inputCmp[0].click();
        //         // setTimeout(()=>{
        //         //     lwcItem=document.getElementById(parm.lightningId);
        //         //     let liIrtem=lwcItem.querySelectorAll('lightning-base-combobox-item');
        //         //     console.log(liIrtem);
        //         //     let objId=document.getElementById(parm.inputFieldId + '_lkid').value;
        //         //     setNodeValue(liIrtem[1],objId).then(function (){
        //         //         console.log(liIrtem[1].attributes.getNamedItem('data-value'));
        //         //         liIrtem[1].click();
        //         //     })
        //         // },1000);
        //     }catch(e){
        //         console.log("初始化失败：00");
        //         console.log(e);
        //         setTimeout(()=>{
        //             initLwcData(parm,count+1);
        //         },1000);
        //     }
        // }
        // function setNodeValue(node,setid){
        //     return new Promise(function(resolve, reject) {
        //         node.attributes.getNamedItem('data-value').value=setid;
        //         resolve();
        //     });
            
        // }
        // initLwc(SelectFieldParamList);

        

        // // let selectFieldFlag = 'Page:mainForm:SelectFieldFlag';
        // // //输入框id
        // // let inputFieldId='Page:mainForm:block:SalesName1';
        // // //存储值id，inputHidden,用于接收返回数值
        // // let inputHiddenId='Page:mainForm:Agency1_entrust__c';
        // // //输入框的值
        // // let accountValue = '{!quo.Agency1_entrust__c}';
        // // //查询对象api
        // // let ObjectType = 'Account';
        // // //查询结果字段名称
        // // let FieldNameList = '客户名,Id';
        // // //查询结果字段Api，与上列对应
        // // let FieldApiNameList = 'Name,Id';
        // // //查询查询条件名称
        // // let QueryFieldName = '姓名';
        // // //查询查询条件api
        // // let QueryFieldApiName = 'Name';
        // // //筛选器
        // // let QuertLimit='';
        // // let SelectObj='QuoteIrai__c';
        // // let SelectFld='Agency1_entrust__c';
        


        // function refreshSelectFieldValue(SelectFieldParamParam,p){
        //     let lwcItem=document.getElementById(SelectFieldParamParam.lightningId);
        //     console.log("temL:");
        //     let fla=false;
        //     console.log(lwcItem.children.length==0);
        //     if(lwcItem.children.length==0&&!lock1){
        //         lock1=true;
        //         fla=true;
        //         $Lightning.use("c:LexSelectFieldApp", function() {
        //             $Lightning.createComponent(
        //                 "c:LexSelectFieldCmp",
        //                 {
        //                     "objApiName": SelectFieldParamParam.objType,
        //                     "fieldApiName": SelectFieldParamParam.field,
        //                     "recordId" : SelectFieldParamParam.recordId,
        //                 },
        //                 SelectFieldParamParam.lightningId,
        //                 function(cmp) {
        //                     lock1=false;
        //                 }
        //             );
        //         });
        //     }
        //     if(fla){
        //         setTimeout(()=>{
        //             refreshSelectFieldValue(SelectFieldParamParam,true);
        //         },1000);                
        //     }

        //     try{
        //         let show=lwcItem.querySelectorAll('lightning-base-combobox-item');
        //         console.log('in！：');
        //         console.log(show);
        //         console.log(show[0]);
        //         console.log(show[0].dataset);
        //         console.log(show[0].dataset.value);
        //         console.log('out!:');
        //         if(show[0].dataset.value=="actionAdvancedSearch"){
        //             console.log("close!");

        //             show[0].onclick = function() {
        //                 // setSearchPage();
        //             };
        //             // show[0].hidden=true;
        //             // show[0].style.display='none';

        //         }
        //     }catch(e){
        //         console.log(e);
        //     }
        //     let lcm=document.getElementById(SelectFieldParamParam.lightningId);
        //     const inputFields = lcm.querySelectorAll('input');
        //     console.log("++++++++++++++++++++++++++++++++++");
        //     if (inputFields) {
        //         try{
        //             setTimeout(()=>{
        //                 let objName=inputFields[0].attributes.getNamedItem('data-value');
        //                 objName=objName.value;
        //                 let objId=inputFields[1].value;
        //                 if(objId=='000000000000000AAA'){
        //                     return;
        //                 }
        //                 j$(escapeVfId(SelectFieldParamParam.inputFieldId)).val(objName);
        //                 j$(escapeVfId(SelectFieldParamParam.inputFieldId + '_lkold')).val(objName);
        //                 j$(escapeVfId(SelectFieldParamParam.inputFieldId + '_lkid')).val(objId);
        //                 console.log('更新数值:');
        //                 console.log(objName);
        //                 console.log(objId);
        //             },100); 
        //         }catch(e){
        //             console.log(e);
        //         }
        //     } 
        // }
        // //标准控件修改 end





        function openpdf(type) {
            var qid = j$(escapeVfId("Page:mainForm:hiddenQuoid")).value();
            if (qid == '') {
                alert('请先做成报价委托。');
                return false;
            }
            if (window.confirm('是否新建'+type+'报告书？')) {
                try {
                    sforce.connection.sessionId = "{!GETSESSIONID()}";
                    var accid = j$(escapeVfId("Page:mainForm:block:idVisitorPlaceId")).value();
                    var recordType = type;
                    var repOwnerId = '{!$User.Id}';
                    
                    var pdfno = sforce.apex.execute("ControllerUtil", "selectCommonSequence", {valueField: 'EvaluationPDF_NextValue__c', formatField: 'EvaluationPDF_Format__c'});
                    
                    //新建OPD报告书
                    var rtn = sforce.apex.execute("Add_Report", "addReportOPWithEvaluationPDF", 
                        {repOwnerId: repOwnerId,
                         reportId: null,
                         dailyReportId: null,
                         eventId: null,
                         recordType: recordType,
                         aId: accid,
                         visitor1: null,
                         visitor2: null,
                         visitor3: null,
                         visitor4: null,
                         visitor5: null,
                         opp1: null,
                         opp2: null,
                         opp3: null,
                         opp4: null,
                         opp5: null,
                         reportDate: null,
                         evaluationPDFNumber: pdfno,
                         pro1: null
                        }
                    );
                    window.open('/apex/BeforeOPDPDF?qid=' + encodeURI(qid) + '&pdfNo=' + encodeURI(pdfno), 'BeforeOPDPDF');
                } catch(e) {
                    alert(e); 
                }
            } else {
                window.open('/apex/BeforeOPDPDF?qid=' + encodeURI(qid), 'BeforeOPDPDF');
            }
        }
        function blockme(){
            j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
            j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.8);
            j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.4);
            resizeShadowBox();
        }
        //ウィンドのサイズにあわせて位置を調整
        function resizeShadowBox(){
            var h = j$(document);
            var winH = j$(window).height();
            var winW = j$(window).width();
            console.log('调整位置============================');
            console.log(winH);
            console.log(winW);

            var screanWidth = window.screen.width;
            // if (screanWidth < winW) {
            //     winH = winH * winW / screanWidth;
            //     winW = winW * winW / screanWidth;
            // }
            var contents = j$("#sbArea_contentsArea")
            contents.css({"width":"auto","height":"auto"});
            var iSaBoxH = contents.outerHeight();
            var iSaBoxW = contents.outerWidth();
            
            if(winH >= iSaBoxH+10*2){
                var innerT = (winH-iSaBoxH)/2;
            }else{
                var innerT = 10;
                iSaBoxH = winH-10*2;
                iSaBoxW += 20;
            }
            if(winW >= iSaBoxW+10*2){
                var innerL = (winW-iSaBoxW)/2;
            }else{
                var innerL =10;
                iSaBoxW = winW-10*2;
            }
            var sbTop = h.scrollTop()
            
            var IE6browser = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
            if(!IE6browser){
                j$("#sbArea").css({"width":winW+"px","height":winH+"px","position":"fixed"});
            }else{
                j$("#sbArea").css({"width":winW+"px","height":winH+"px","top":h.scrollTop()+"px","left":h.scrollLeft()+"px"});
            }
            j$("#sbArea_contentsArea").css({"left":innerL+"px","top":innerT+"px","height":iSaBoxH+"px","width":iSaBoxW+"px"});
            j$("#sbArea_backArea").css({"width":winW+"px","height":winH+"px"});
        }
        calonLoad();
    </script>
    <style type="text/css">
        div#iframelike {
            height: 300px;
            overflow: auto;
        }
        div#iframelikeheader {
            height: 23px;
            overflow: auto;
        }
        input {
            font-size: 10.5px;
        }
        body {
            font-size: 10.5px;
        }
        
        .visitorplace_results {
            border: 1px solid gray;
            background-color: white;
            padding: 0;
            margin: 0;
            list-style: none;
            position: absolute;
            z-index: 10000;
            display: none;
            overflow:auto;
            white-space:nowrap;
            width:400px;
            height:250px;
        }
        .visitorplace_results li {
            padding: 2px 5px 2px 0px;
            margin-left : 2px;
            color: #101010;
            text-align: left;
        }
/*        #auraErrorMessage{
            display: none
        }
        .slds-scope .slds-has-error .slds-form-element__help {
            display: none;
        }*/
    </style>
</apex:page>