高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<apex:page Controller="AgencyCampaignController" sidebar="false" id="allPage" 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.CommonUtilJs)}"/>
<script>
function refreshPageSizeJs() {
    refreshPageSize();
}
//function makecontactJs() {
//    makecontact();
//}
//function deleteJs(line) {
    //blockme();
//    deleteLine(line);
//}
function checkAll() {
    var productCount = j$(escapeVfId('allPage:allForm:productInfoSection:productRecoedsCount')).value();
    if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
        //console.log(productCount);
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked',true);
        }
    } else {
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked',false);
        }
    }
}
 
function contactCheckAll() {
    var productCount = j$(escapeVfId('lineInfoListSize')).value();
    if (j$(escapeVfId('contactChecker')).attr('checked') == 'checked') {
        //console.log(productCount);
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:contactInfoSection:BlockTablefill:' + i + ':contactRowCheckbox')).attr('checked',true);
        }
    } else {
        for (var i = 0; i < productCount; i++) {
            j$(escapeVfId('allPage:allForm:contactInfoSection:BlockTablefill:' + i + ':contactRowCheckbox')).attr('checked',false);
        }
    }
}
 
function fillJs() {
    var cnt = {!productRecoedsCount};
    var value_one = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill:0:Special_Campaign_Price')).value();
    var value_ogl = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill:0:OrderGoods_Limit')).value();
    var value_sec = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill:0:Campaign_StartDate')).value();
    var value_the = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill:0:Campaign_EndDate')).value();
    for (var i = 0; i < cnt; i++) {
        if(j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked') == 'checked'){
            document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSCP').value = value_one;
            document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputOGL').value = value_ogl;
            document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputCSC').value = value_sec;
            document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputCEC').value = value_the;
 
        }//else{
        //  document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSCP').value = '';
        //  document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputCSC').value = '';
        //  document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputCEC').value = '';
        //}
    }
}
 
function ComputePrice(j) {
    var z
    var a = j.id;
    var i=a.substring(0,a.lastIndexOf(':'));
    z  =  parseFloat(j$(escapeVfId(i+':inputSCP')).value());
    if(isNaN(z)){z=0.00;}
    if(z!=null&&z!=0&&z!=''){
    j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
    }else{
    j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
    }
}
 
 
function saveJs() {
    blockme();
    //beforeSaveJs();
    save();
}
 
function searchHospitalJs() {
    blockme();
    searchHospital();
}
 
//function showParentManagementCodeJs(){
//    showParentManagementCode();
//}
 
function showcategory2Js() {
    showcategory2();
}
 
function showcategory3Js() {
    showcategory3();
}
function showcategory4Js() {
    showcategory4();
}
function showcategory5Js() {
    showcategory5();
}
 
</script>
<style>
    .dateFormat  {
        display: none;
    }
</style>
    <apex:form id="allForm">
        <!--<apex:actionFunction name="deleteLine" action="{!deleteLine}" rerender="contactInfoSection, message">
        <apex:param name="firstParam" assignTo="{!lineNo}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="showParentManagementCode" action="{!showParentManagementCode}" rerender="searchBlock" />
        <apex:actionFunction name="makecontact" action="{!makecontact}" rerender="contactInfoSection, message" />-->
        <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="productInfoSection" />
        <apex:actionFunction name="save" action="{!save}" rerender="message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="showcategory2" action="{!showcategory2}" rerender="searchBlock, message">
        </apex:actionFunction>
        <apex:actionFunction name="showcategory3" action="{!showcategory3}" rerender="searchBlock, message">
        </apex:actionFunction>
        <apex:actionFunction name="showcategory4" action="{!showcategory4}" rerender="searchBlock, message">
        </apex:actionFunction>
        <apex:actionFunction name="showcategory5" action="{!showcategory5}" rerender="searchBlock, message">
        </apex:actionFunction>
        <apex:actionFunction name="searchHospital" action="{!searchHospital}" rerender="productInfoSection, message" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
            <apex:pageBlock id="searchBlock">
                <table>
                    <colgroup>
                        <col width="50px"/>
                        <col width="100px"/>
                        <col width="60px"/>
                        <col width="20px"/>
                        <col width="100px"/>
                        <col width="60px"/>
                        <col width="20px"/>
                        <col width="100px"/>
                        <col width="60px"/>
                        <col width="20px"/>
                        <col width="100px"/>
                        <col width="60px"/>
                        <col width="20px"/>
                        <col width="100px"/>
                        <col width="60px"/>
                        <col width="20px"/>
                        <col width="80px"/>
                    </colgroup>
                    <tr>
                        <td align="right"></td>
                        <td align="right">促销编码:</td>
                        <td style="text-align:left; width:70px;" colspan = "2">
                        <apex:outputField value="{!consumable_P.Name}"/>
                        </td>
                        <!--<td align="right">经销商名称:</td>
                        <td style="text-align:left; width:70px;" colspan = "3">
                        <apex:inputField value="{!dpc.Agent_Ref__c}" onchange="showParentManagementCodeJs();return false;"/>
                        </td>
                        <td align="right" colspan = "3">经销商合同名称:</td>
                        <td style="text-align:left; width:70px;" colspan = "4">
                        <apex:selectList value="{!accContact}" size="1" style="width:150px" ><apex:selectOptions value="{!accContactList}"/></apex:selectList>
                        </td>
                        <td align="right"><apex:commandButton value="追加" style="width: 100px;" onclick="makecontactJs();return false;" /></td>-->
                    </tr>
                    <tr>
                        <td colspan = "16" style="height: 10px"></td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td align="right">第1分类:</td>
                        <td style="text-align:left; width:70px;">
                        <apex:selectList id="StateMaster" value="{!category1}" size="1" style="width:90px"  onchange="showcategory2Js();return false;">
                            <apex:selectOptions value="{!category1OptionList}"/>
                        </apex:selectList>
                        </td>
                        <td/>
                        <td align="right">第2分类:</td>
                        <td style="text-align:left; width:70px;"><apex:selectList value="{!category2}" size="1" style="width:90px" onchange="showcategory3Js();return false;"><apex:selectOptions value="{!category2OptionList}"/></apex:selectList>
                        </td>
                        <td/>
                        <td align="right">第3分类:</td>
                        <td style="text-align:left; width:70px;"><apex:selectList value="{!category3}" size="1" style="width:90px"  onchange="showcategory4Js();return false;"><apex:selectOptions value="{!category3OptionList}"/></apex:selectList>
                        </td>
                        <td/>
                        <td align="right">第4分类:</td>
                        <td style="text-align:left; width:70px;"><apex:selectList value="{!category4}" size="1" style="width:90px"  onchange="showcategory5Js();return false;" ><apex:selectOptions value="{!category4OptionList}"/></apex:selectList>
                        </td>
                        <td/>
                        <td align="right">第5分类:</td>
                        <td style="text-align:left; width:70px;"><apex:selectList value="{!category5}" size="1" style="width:90px"><apex:selectOptions value="{!category5OptionList}"/></apex:selectList>
                        </td>
                        <td align="right" rowspan = "3"><apex:commandButton value="检索" style="width: 100px;" onclick="searchHospitalJs();return false;" /></td>
                    </tr>
                    <tr>
                        <td colspan = "15" style="height: 10px"></td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td align="right">关键字:</td>
                        <td style="text-align:left; width:70px;" colspan = "3">
                            <apex:inputText value="{!keyword}"/>
                            <c:helpicon helpText="可以使用关键字检索产品型号和产品名称。"/>
                        </td>
                        <td align="right" >特约店产品</td>
                        <td  align="left"><apex:inputCheckbox value="{!Pro2DealerFlag}" id="Pro2DealerFlag"  style="width:20px"/>
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
 
            <!--<apex:pageBlock title="合同信息" id="contactInfoSection">
                <apex:pageBlockTable value="{!lineInfoList}" var="a" id="BlockTablefill">
                    <apex:column headerValue="经销商名称" >
                        <apex:outputField value="{!a.accountIn.Agent_Ref__c}" style="width: 80px;" id="Agent_Ref"/>
                    </apex:column>
                    <apex:column headerValue="经销商合同名称" >
                        <apex:outputField value="{!a.accountIn.Name}" style="width: 80px;" id="contactName"/>
                    </apex:column>
                    <apex:column headerValue="操作" >
                        <apex:commandButton onclick="deleteJs({!a.line});return false;" value="删除" style="margin-left:30px;width:100px" rerender="dummy"/>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlock>-->
 
 
            <apex:pageBlock title="合同信息" id="contactInfoSection">
            <!--<apex:inputHidden id="contactInfoCount" value="{!lineInfoListSize}"/>-->
            <input type="hidden" id="lineInfoListSize" value="{!lineInfoListSize}" />
                <table class="list" border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <colgroup>
                        <col width="10%" />
                        <col width="40%" />
                        <col width="40%" />
                    </colgroup>
                    <tr class="headerRow">
                        <th><input type='checkbox' onClick='contactCheckAll()' id='contactChecker'/>选择</th>
                        <th>经销商名称</th>
                        <th>经销商合同名称</th>
                    </tr>
                    <apex:repeat value="{!lineInfoList}" var="records" id="BlockTablefill">
                        <tr class="dataRow">
                            <td>
                            <apex:inputCheckbox value="{!records.check}" id="contactRowCheckbox"/>
                            </td>
                             <td class="dataCell">
                                <apex:outputField value="{!records.accountIn.Agent_Ref__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.accountIn.Name}"/>
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
            </apex:pageBlock>
 
 
 
 
 
 
 
            <apex:pageBlock title="产品信息" id="productInfoSection">
            <apex:pageBlockButtons location="top"  >
                <apex:commandButton onclick="saveJs();" value="保存" style="margin-left:30px;width:100px" rerender="dummy" />
            </apex:pageBlockButtons>
            <apex:outputPanel style="float:right;"  >
                <apex:pageBlockTable value="{!dpc}" var="a" id="BlockTablefill">
                    <apex:column headerValue="促销价格" >
                        <apex:inputField value="{!a.Special_Campaign_Price__c}" style="width: 80px;" id="Special_Campaign_Price"/>
                    </apex:column>
                    <apex:column headerValue="促销数量" >
                        <apex:inputField value="{!a.OrderGoods_Limit__c}" style="width: 80px;" id="OrderGoods_Limit"/>
                    </apex:column>
                    <apex:column headerValue="促销开始日">
                        <apex:inputField value="{!a.Campaign_StartDate__c}" style="width: 80px;" id="Campaign_StartDate"/>
                    </apex:column>
                    <apex:column headerValue="促销结束日">
                        <apex:inputField value="{!a.Campaign_EndDate__c}" style="width: 80px;" id="Campaign_EndDate"/>
                    </apex:column>
                    <apex:column >
                        <apex:commandButton onclick="fillJs();" value="批量应用" style="margin-left:30px;width:100px" rerender="dummy" />
                    </apex:column>
                </apex:pageBlockTable>
            </apex:outputPanel>
 
            <apex:inputHidden id="productRecoedsCount" value="{!productRecoedsCount}"/>
                <table class="list" border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                    <colgroup>
                        <col width="6%" />
                        <col width="30%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                        <col width="8%" />
                    </colgroup>
                    <tr class="headerRow">
                        <th><input type='checkbox' onClick='checkAll()' id='checker'/>选择</th>
                        <th>产品名称</th>
                        <th>第1分类</th>
                        <th>第2分类</th>
                        <th>第3分类</th>
                        <th>第4分类</th>
                        <th>第5分类</th>
                        <th>促销价格</th>
                        <th>促销数量</th>
                        <th>促销开始日</th>
                        <th>促销结束日</th>
 
                    </tr>
                    <apex:repeat value="{!productInfoListview}" var="records" id="productInfoListview">
                        <tr class="dataRow">
                            <td>
                            <apex:inputCheckbox value="{!records.check}" id="consumablesCountproRowCheckbox"/>
                            </td>
                             <td class="dataCell">
                                <apex:outputField value="{!records.pro.Name__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.pro.Category1__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.pro.Category2__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.pro.Category3__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.pro.Category4__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:outputField value="{!records.pro.Category5__c}"/>
                            </td>
                            <td class="dataCell">
                                <apex:inputField onblur="ComputePrice(this)" value="{!records.dealerPro.Special_Campaign_Price__c}" style="width: 80px;" id="inputSCP"/>
                            </td>
                            <td class="dataCell">
                                <apex:inputField value="{!records.dealerPro.OrderGoods_Limit__c}" style="width: 80px;" id="inputOGL"/>
                            </td>
                            <td class="dataCell">
                                <apex:inputField value="{!records.dealerPro.Campaign_StartDate__c}" style="width: 80px;" id="inputCSC"/>
                            </td>
                            <td class="dataCell">
                                <apex:inputField value="{!records.dealerPro.Campaign_EndDate__c}" style="width: 80px;" id="inputCEC"/>
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
                <table style="width: 100%">
                    <tr>
                        <td>
                            <!-- Page X of Y -->  
                            <!-- PageNumber:当前页面所在位置,ResultSize:记录总条数,PageSize:每页记录条数 -->  
                            <apex:outputText value="{!(currentpage * pagesize)+1-pagesize}-{!IF((currentpage * pagesize)>totalcount, totalcount,
                             (currentpage * pagesize))} 共 {!totalcount} 个" />  
                        </td>
                        <td align="center">
                            <div class="paginator line1">
                            <span class="prevNextLinks">
                            <span class="prevNext">
                            <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToFirst}" oncomplete="refreshPageSizeJs();" title="首页" >
                            <img src="/s.gif" title="首页" alt="首页" class="{!if((hasPrevious),'first','firstoff')}"/>
                            </apex:commandLink>
                            </span>
                            <span class="prevNext">
                            <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection"  action="{!moveToPrevious}" oncomplete="refreshPageSizeJs();"  title="上一页">
                            <img src="/s.gif" title="上一页" alt="上一页" class="{!if((hasPrevious),'prev','prevoff')}"/>上一页
                            </apex:commandLink>
                            </span>
                            <!--  -->
                            <span class="prevNext" >
                            <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToNext}" oncomplete="refreshPageSizeJs();" title="下一页">下一页
                            <img src="/s.gif" title="下一页" alt="下一页" class="{!if((hasNext),'next','nextoff')}"/>
                            </apex:commandLink>
                            </span>
                            <span class="prevNext">
                            <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToLast}"  oncomplete="refreshPageSizeJs();" title="尾页">
                            <img src="/s.gif" title="尾页" alt="尾页" class="{!if((hasNext),'last','lastoff')}"/>
                            </apex:commandLink>
                            </span>
                            </span>
                            </div>
                         </td>
                         <td align="right" width="20%">
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>