buli
2022-05-13 08a21f49f2eaf9cfc19ceb67b196cc36ba689305
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<apex:page id="Page" Controller="SearchProductController" sidebar="false" showHeader="false" action="{!init}">
  <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
 
    <script>
       var QuoteEntryMaxLine = 150;
         
       function setProductList() {
            var nextLine = top.window.opener.getLastLineNoNext(window.opener.document);
            var hasCheckedCnt = 0;
            var checklist = j$("input[name='checklist']");
 
            // var is_hidden_all = j$(escapeVfId("isHiddenAllsearch")).val();
            //alert('is_hidden_all=====>'+ is_hidden_all);
 
            for(var i=0; i<checklist.length; i++){
                    if (checklist[i].checked) {
                        hasCheckedCnt++;
                        if (nextLine < QuoteEntryMaxLine) {
                            SetProductId(nextLine, i);
                            nextLine++;
                        } else {
                            //alert('Over Max Line ' + QuoteEntryMaxLine);
                            return false;
                        }
                    }
            }
            if (hasCheckedCnt == 0) {
                alert(top.window.opener.Error_Message34);
                return false;
            }
            window.opener.doReroad();
            top.window.close();
        }
 
        function setProductOne(lineno, i) {
            SetProductId(lineno, i);
            window.opener.doReroad();
            top.window.close();
        }
 
        function doSearch() {
            blockme();
            serContact.call();
        }
 
        function SetProductId(lineno, i) {
 
          var ProductCode = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":ProductCode")).text();
            if (ProductCode.indexOf('0000000000') == 0) {
                ProductCode = ProductCode.substring(10);
            }
            var ProductECCode = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":ProductECCode")).text();
          var name = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Name")).text();
 
          var PbeId = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":hidId")).text();
            var pId = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":pId")).text();
            //XHL-20190428-UpdateStart
            // var productSet = j$(escapeVfId("Page:mainForm:idSearchSetProduct:productSet")).val();
            // var productSetLabel = j$(escapeVfId("Page:mainForm:idSearchSetProduct:productSet") + ' option:selected').text();
            //XHL-20190428-UpdateEnd
            var salesprice = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Salesprice")).text();
            var salespriceA = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SalespriceA")).text();
            var salespriceB = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SalespriceB")).text();
            var salespriceC = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SalespriceC")).text();
            var pm = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":ProductModel")).text();
            var productDescription = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":ProductDescription")).text();
            var salespriceR = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SalespriceR")).text();
            var hiddenflg = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Hiddenflg")).text();
            var is_hidden_all = j$(escapeVfId("isHiddenAllsearch")).val();
            var specialDealer = j$(escapeVfId("specialDealer")).val();
            //alert('Salesprice=====>'+ salesprice);
            var openFlag = j$(escapeVfId("openFlag")).val();
            if (openFlag == 'opp') {
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:" + (lineno - 1) + ":product")).val(name);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:" + (lineno - 1) + ":productId")).val(pId);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:" + (lineno - 1) + ":isProductModel")).val(pm);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":price0")).val(salesprice);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":unitPrice")).val(salespriceR);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":hiddenflg")).val(hiddenflg);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":description")).val(productDescription);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":productCode")).text(ProductCode);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":productCodeHidden")).val(ProductCode);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":productEC")).text(ProductECCode);
                window.opener.j$(escapeVfId("allPage:allForm:allBlock:records:"+ (lineno - 1) +":productECHidden")).val(ProductECCode);
                if (specialDealer == 'true') {
                    window.opener.j$(escapeVfId("isHiddenAll")).val(is_hidden_all);
                }
                
                
            } else {
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":indexNo")).text(parseInt(lineno)+1);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProductName")).val(name);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProductCode")).text(ProductCode);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProductCodeHidden")).val(ProductCode);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProductEC")).text(ProductECCode);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProductECHidden")).val(ProductECCode);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":PbeId")).val(PbeId);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ProId")).val(pId);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":UnitPrice")).val(salespriceR);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":hiddenflg")).val(hiddenflg);
                //window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":UnitPriceHidden")).val(salesprice);
                //XHL-20190428-UpdateStart
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Set")).text('{!$Label.SingleProduct}');
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":SetName")).val('{!$Label.SingleProduct}');
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":SingleProduct")).val('true');
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":hidSet")).val('{!$Label.SingleProduct}');
                //XHL-20190428-UpdateEnd
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":price0")).val(salesprice);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":price1")).val(salespriceA);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":price2")).val(salespriceB);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":price3")).val(salespriceC);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Distingush")).val(null);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":isProductModel")).val(pm);
                window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Description")).val(productDescription);
 
                if (specialDealer == 'true') {
                    window.opener.j$(escapeVfId("isHiddenAll")).val(is_hidden_all);
                }
            }
 
        }
 
    </script>
    
    <style type="text/css">
        div#iframelike {
            color: #fff;
            height: 300px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
    <apex:outputPanel id="all">
        <apex:outputPanel id="message1">
            <apex:messages styleClass="editListError"/>
        </apex:outputPanel>
        <apex:form id="mainForm">
 
            <apex:actionFunction action="{!serContact}" name="serContact" reRender="mainForm,message1" oncomplete="unblockUI();"/>
 
            <input type="hidden" id="openFlag" value="{!openFlag}"/>
            <input type="hidden" value="{!is_hidden_all}" id="isHiddenAllsearch"/>
            <input type="hidden" value="{!specialDealer}" id="specialDealer"/>
            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Product_Search}">
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <colgroup>
                        <col width="12" />
                        <col width="20" />
                        <col width="20" />
                        <col width="200" />
                        <col width="20" />
                        <col width="100" />
                        <col width="120" />
                        <col width="208" />
                    </colgroup>
                    <tr>
                        <td> </td>
                        <th>{!$Label.Search_Condition}</th>
                        <td> </td>
                        <th>{!$Label.Asset_No}</th>
                        <td> </td>
                        <td> </td>
                        <td> </td>
                        <td> </td>
                    </tr>
                    <tr>
                        <td> </td>
                        <td> </td>
                        <td> </td>
                        <td><apex:inputText id="searchName" value="{!SearchName}" style="width:200px" required="false"/></td>
                        <td><apex:commandButton value="{!$Label.Search}" onclick="doSearch();return false;" style="width:100px" /></td>
                        <!-- XHL-20190428-UpdateStart -->
             <!--            <th style="text-align:right;width:90px;"><apex:outputLabel value="{!$ObjectType.QuoteLineItem.fields.Set__c.label}" rendered="{!oppflg}"/></th>
                        <td><apex:selectList id="productSet" value="{!productSetVal}" rendered="{!oppflg}" size="1" style="width:100px;float:right;">
                            <apex:selectOptions value="{!productSet}"/>
                            </apex:selectList>
                        </td> -->
                        <!-- XHL-20190428-UpdateEnd -->
                        <td> <apex:commandButton value="{!$Label.Add_Product}" rendered="{!oppflg}" style="width:100px;float:right;" disabled="{!Hascl}" rerender="dummy" onclick="setProductList();return false;"/></td>
                    </tr>
                    <tr>
                        <td style="border-bottom: 1px solid #888;" colspan="15"> </td>
                    </tr>
                </table>
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <tr>
                        <td width="12"> </td>
                        <th valign="top">{!$Label.Search_Result}</th>
                        <td width="20"> </td>
                        <td>
                            <table border="0">
                                <tr>
                                    <td>
                                    <div id="iframelike" style="width:800px">
                                    <apex:pageBlockTable id="idRezultVisitor" value="{!cl}" var="c" border="1" columns="7" columnsWidth="25px,125px,125px,90px,95px,130,210px">
 
                                        <apex:column style="width:15px;" >
                                            <apex:outputText style="display: none;" id="hidId" value="{!c.pbeId}"/>
                                            <apex:outputText style="display: none;" id="pId" value="{!c.pbe.Product__c}"/>
                                            <apex:facet name="header">{!$Label.Selected}</apex:facet>
                                            <input type="checkbox" name="checklist" value="" style="width:10px;"/>
                                        </apex:column>
 
                                        <apex:column >
                                            <apex:facet name="header">{!$ObjectType.Product_Search__c.fields.name.label}</apex:facet>
                                            <apex:outputText style="display: none;" id="Name" value="{!c.pbe.Name}" />
                                            <apex:outputLink id="NameLink" value="#" onclick="setProductOne('{!lineno}','{!c.idx}');return false;">{!c.pbe.Name}</apex:outputLink>
                                        </apex:column> 
 
                                        <apex:column >
                                            <apex:facet name="header">{!$ObjectType.Product_Search__c.fields.ProductCode__c.Label}</apex:facet>
                                            <apex:outputField id="ProductCode" value="{!c.pbe.ProductCode__c}" />
                                        </apex:column>
 
                                        <apex:column >
                                            <apex:facet name="header">{!$ObjectType.Product_Search__c.fields.Product_ECCode__c.Label}</apex:facet>
                                            <apex:outputField id="ProductECCode" value="{!c.pbe.Product_ECCode__c}" />
                                        </apex:column>
 
                                        <apex:column >
                                            <apex:facet name="header">{!$ObjectType.Product_Search__c.fields.ProductModels1__c.Label}</apex:facet>
                                            <apex:outputField id="ProductModels" value="{!c.pbe.ProductModels1__c}" />
                                            <apex:outputText id="ProductModel" value="{!c.pbe.ProductModels1__c}" style="display: none;"/>
                                        </apex:column>
 
                                        <apex:column >
                                            <apex:facet name="header">{!$ObjectType.PricebookEntry.fields.SalesPrice__c.label}</apex:facet>
                                            <apex:outputText id="SalespriceR" value="{!c.salespriceR}" />
                                            <apex:outputText id="Salesprice" value="{!c.salesprice}" style="display: none;"/>
                                            <apex:outputText id="SalespriceA" value="{!c.salespriceA}" style="display: none;"/>
                                            <apex:outputText id="SalespriceB" value="{!c.salespriceB}" style="display: none;"/>
                                            <apex:outputText id="SalespriceC" value="{!c.salespriceC}" style="display: none;"/>
                                            <apex:outputText id="Hiddenflg" value="{!c.hiddenflg}" style="display: none;"/>
                                        </apex:column> 
 
<!--                                         <apex:column >
                                         <apex:facet name="header">{!$ObjectType.PricebookEntry.fields.Pricebook2Id.label}</apex:facet>
                                            <apex:outputText id="Pricebook" value="{!c.pbId}" /> 
                                        </apex:column> -->
 
                                         <apex:column >
                                            <apex:facet name="header">{!$ObjectType.Product_Search__c.fields.ProductDescription__c.label}</apex:facet>
                                            <apex:outputField id="ProductDescription" value="{!c.pbe.ProductDescription__c}" />
                                        </apex:column> 
 
                                         
                                    </apex:pageBlockTable>
                                    </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
        </apex:form>
    </apex:outputPanel>
    <script type="text/javascript">
        // フォーカスセット
        j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName'))[0].focus();
        j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName')).val(j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName')).val());
 
    </script>
  
</apex:page>