Thhto
2022-11-17 ea6a4eec81a6a74e214aefc5971d701242c3e7d3
force-app/main/default/pages/NewQuoteIrai.page
@@ -1,4 +1,4 @@
<apex:page controller="NewQuoteIraiController" sidebar="false" action="{!init}" id="Page">
<apex:page controller="NewQuoteIraiController" sidebar="false" action="{!init}" id="Page" >
    <apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
@@ -85,11 +85,19 @@
        }
        
        function iraiJs() {
            var username = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
            var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val();
            // 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:j_id43:IraiUser")).val();
            var userid = j$(escapeVfId("Page:mainForm:block:j_id43:IraiUser_lkid")).val();
            var username2 = j$(escapeVfId("Page:mainForm:block:j_id46:IraiUser")).val();
            //obsap 新增经销商1字段 fy start
            var Agency1entrustc = j$(escapeVfId("Page:mainForm:block:SalesName1")).val();
            debugger
            //obsap 新增经销商1字段 fy end
            sforce.connection.sessionId = Session_ID;
            if(!userid&&username2){
                userid=username2;
            }
            var resultSet = sforce.connection.query( "SELECT Email,SFDCPosition_C__c FROM User WHERE Id = '" + userid + "'");
            var records = resultSet.getArray("records");
            
@@ -100,20 +108,38 @@
                mail = iraiUser.Email;
                SFDCPosition = iraiUser.SFDCPosition_C__c;
            }
            if (mail != null && mail.length > 0) {
               if (SFDCPosition != '营业助理'){
                   alert('请选择对应的营业助理.');
                   unblockUI();
               }
               else if (window.confirm('确定要委托该人员吗?\n' + mail)) {
                    QuoteIrai();
                    } else {
                       unblockUI();
            //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 = {!obsflag};
                    console.log('Salesdepartment:' + Salesdepartment);
                    var positioncheck = true;
                    // if (Salesdepartment == '5.华东' || Salesdepartment == '6.华南') {
                    //fy 20220512
                    if (Salesdepartment) {
                        mail = '{!obsap_mail}';
                        positioncheck = false;
                    }
            } else {
                alert('请选择委托人员.');
                    if (positioncheck && SFDCPosition != '营业助理'){
                        alert('请选择对应的营业助理.');
                        unblockUI();
                    }
                    else if (window.confirm('确定要委托该人员吗?\n' + mail)) {
                        QuoteIrai();
                    } else {
                        unblockUI();
                    }
                } else {
                    alert('请选择委托人员.');
                    unblockUI();
                }
            }else {
                alert('请选择第一经销商.');
                unblockUI();
            }
            //obsap 新增经销商1字段 fy end
        }
        
        function openpdf(type) {
@@ -289,18 +315,32 @@
                <!-- CHAN-BJQ4VZ 精琢技术 2019/12/10 End -->
                <table border="0">
                    <tr>
                        <th style="width:40px;">&nbsp;</th>
                        <th style="width:50px;">&nbsp;</th>
                        <!-- 产品配套检索按钮 -->
                        <td style="width:150px;"><apex:commandButton id="SetProduct" onclick="searchSetProduct();return false;" value="{!$Label.Set_Product}" rerender="dummy"/></td>
                        <td style="width:100px;"><apex:commandButton id="SetProduct" onclick="searchSetProduct();return false;" value="{!$Label.Set_Product}" rerender="dummy"/></td>
                        <!-- excel 导出按钮 -->
                        <td style="width:150px;"><apex:commandButton onclick="openQuoteExcelImport(event);return false;" value="{!$Label.Excel_Import}" rerender="dummy"/></td>
                        <td style="width:100px;"><apex:commandButton onclick="openQuoteExcelImport(event);return false;" value="{!$Label.Excel_Import}" rerender="dummy"/></td>
                        <td style="text-align:right;width:80px;"><apex:commandButton rerender="dummy" id="Btn_RowDelete" onclick="radioChecker2('del');return false;" value="{!$Label.deleteLabel}" style="width:60px;"/></td>
                        <td style="width:150px;">
                            <apex:commandButton rerender="dummy" id="Btn_RowUp" onclick="radioChecker2('up');return false;" value="{!$Label.Row_Up}" style="width:60px;"/>
                            <apex:commandButton rerender="dummy" id="Btn_RowDown" onclick="radioChecker2('down');return false;" value="{!$Label.Row_Down}" style="width:60px;"/>
                        </td>
                        <th style="text-align:right;width:80px;">{!$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.华南'))}"  > -->
                        <apex:variable value="identif1" var="identif1" rendered="{!!(loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&& obsflag)}"  >
                        <td style="width:150px;"><apex:outputPanel id="IraiUserId"><apex:inputField id="IraiUser" value="{!quo.IraiUser__c}"/></apex:outputPanel></td>
                        </apex:variable>
                        <!-- 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.华南')}"  > -->
                        <apex:variable value="identif" var="identif" rendered="{!loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&& obsflag}"  >
                        <!-- <th style="text-align:right;width:20px;">obsap人员</th> -->
                        <td style="text-align:center;width:20px;"><apex:selectList value="{!quo.IraiUser__c}" size="1" style="width:120px" id="IraiUser" onchange="ObsapUsersChange()"><apex:selectOptions value="{!ObsapUsers}" id="obsapUsersList"/></apex:selectList></td>
                        </apex:variable>
                        <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>
                        <!-- 2020/02/18  精琢技术  韩部长提出先隐藏 没必要  Start-->
@@ -318,33 +358,58 @@
                    <td>&nbsp;&nbsp;</td>
                </tr>
                <tr>
                     <td style="text-align:right;width:100px;"></td>
                     <th style="text-align:right;width:50px;">
                        {!$ObjectType.QuoteIrai__c.fields.MultiYearWarrantyTotalPrice__c.Label}
                    :&nbsp;</th>
                    <td style="width:470px;">
                        <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}"
                        style="text-align:right;width:180px;">
                            <apex:param value="{!qb.MultiYearWarrantyTotalPrice}"/>
                        </apex:outputtext>
                    </td>
                    <!-- <apex:variable id="contractWarranty" value="{!1}" var="abc" rendered="{!IF(trade   == '内貿',true,false)}">
                    <th style="text-align:right;width:50px;">
                        {!$ObjectType.Quote.fields.MultiYearWarrantyTotalPrice__c.label}
                    :&nbsp;</th>
                    <td style="width:470px;">
                        <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}"
                        style="text-align:right;width:180px;">
                            <apex:param value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
                        </apex:outputtext>
                    </td>
                    <th style="text-align:right;width:50px;">
                        {!$ObjectType.Quote.fields.multiYearWarranty__c.label}
                    :&nbsp;</th>
                    <td style="width:200px;"><apex:inputField id="multiYearWarranty" value="{!quo.multiYearWarranty__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
                    </apex:variable> -->
                    <td style="text-align:right;width:50px;"></td>
                    <th style="text-align:right;width:50px;" rowspan="2">
                       {!$ObjectType.QuoteIrai__c.fields.MultiYearWarrantyTotalPrice__c.Label}
                   :&nbsp;</th>
                   <!-- <td style="width:470px;"> -->
                       <!--obsap 新增经销商1字段 fy start-->
                   <td style="width:10px;" rowspan="2">
                       <!--obsap 新增经销商1字段 fy end-->
                       <apex:outputtext 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>
                   <!--obsap 新增经销商1字段 fy start-->
                   <th style="width:100px;">&nbsp;</th>
                   <td style="text-align:right;width:50px;"></td>
                   <td style="text-align:right;width:50px;"></td>
                   <th colspan="2" style="width:260px;text-align:center;">{!$Label.Sales_Name}</th>
                   <!--obsap 新增经销商1字段 fy end-->
                   <!-- <apex:variable id="contractWarranty" value="{!1}" var="abc" rendered="{!IF(trade   == '内貿',true,false)}">
                   <th style="text-align:right;width:50px;">
                       {!$ObjectType.Quote.fields.MultiYearWarrantyTotalPrice__c.label}
                   :&nbsp;</th>
                   <td style="width:470px;">
                       <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}"
                       style="text-align:right;width:180px;">
                           <apex:param value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
                       </apex:outputtext>
                   </td>
                   <th style="text-align:right;width:50px;">
                       {!$ObjectType.Quote.fields.multiYearWarranty__c.label}
                   :&nbsp;</th>
                   <td style="width:200px;"><apex:inputField id="multiYearWarranty" value="{!quo.multiYearWarranty__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
                   </apex:variable> -->
               </tr>
               <!--obsap 新增经销商1字段 fy start-->
               <tr>
                <td ></td>
                <td ></td>
                <td ></td>
                <th style="width:100px;text-align:right;">{!$Label.Sales_Name1}</th>
                <td colspan="2" style="width:260px;text-align:right;"><apex:inputField style="width:230px;" id="SalesName1"  value="{!quo.Agency1_entrust__c}"   onChange=""/></td>
                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start -->
                <th style="width:100px;text-align:right;">取消多年保</th>
                <td colspan="2" style="text-align:left;"><apex:inputField id="cancelMultiyearInsurance"  value="{!quo.cancelMultiyearInsurance__c}"   /></td>
                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end -->
                </tr>
                <!--obsap 新增经销商1字段 fy end-->
                <tr>
                    <td>&nbsp;</td>
                </tr>
@@ -473,9 +538,11 @@
                        <table border="0">
                            <tr>
                                <th style="width:15px">&nbsp;</th>
                                <td style="width:100px;" align="right"><apex:commandButton id="QuoteIraiBtn" action="{!checkIraiUser}" reRender="IraiUserId,message1" onclick="blockme();" oncomplete="iraiJs();return false;" value="发送委托邮件" style="width:90px;"/></td>
                                <td style="width:100px;" align="right"><apex:commandButton action="{!checkIraiUser}" reRender="IraiUserId,hiddenQuoid,message1" onclick="blockme();" oncomplete="save2btn();return false;" value="{!$Label.Save_Button}" style="width:90px;" disabled="{Save_button}" /></td>
                                <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>
                                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start -->
                                <td style="width:100px;" align="right"><apex:commandButton id="QuoteIraiBtn" action="{!checkIraiUser}" reRender="IraiUserId,message1" onclick="blockme();" oncomplete="iraiJs();return false;" value="发送委托邮件" style="width:90px;" disabled="{!Save_button}"/></td>
                                <!-- SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end -->
                                <td style="width:100px;" align="right"><apex:commandButton action="{!checkIraiUser}" reRender="IraiUserId,hiddenQuoid,message1" onclick="blockme();" oncomplete="save2btn();return false;" value="{!$Label.Save_Button}" style="width:90px;" disabled="{!Save_button}" /></td>
                                <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>