From ea6a4eec81a6a74e214aefc5971d701242c3e7d3 Mon Sep 17 00:00:00 2001
From: Thhto <997058689@qq.com>
Date: 星期四, 17 十一月 2022 14:40:04 +0800
Subject: [PATCH]  SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy

---
 force-app/main/default/pages/NewQuoteIrai.page |  163 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 115 insertions(+), 48 deletions(-)

diff --git a/force-app/main/default/pages/NewQuoteIrai.page b/force-app/main/default/pages/NewQuoteIrai.page
index 8c32313..b55d6d4 100644
--- a/force-app/main/default/pages/NewQuoteIrai.page
+++ b/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 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�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 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�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 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�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 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�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>

--
Gitblit v1.9.1