高章伟
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
<apex:page id="Page" showHeader="false" sidebar="false" Controller="SetProductTargetController" action="{!init}">
<head>
<title>各省重点产品目标设定</title>
    
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.jqueryTableFix)}"/>
 
<script type="text/javascript">
window.onload = function getInfo() { 
 
    } 
function Secin(){
        
}
function DisableAllButtons (actionText) {
    var button = document.getElementById("Page:Form:headBlock:setTarget");
    button.disabled = true;
    button.classList.add("btnDisabled");
    // for (var i = 0; i < buttons.length; i++) {
    //     var button = buttons[i];
    //     button.disabled = true;
    //     button.classList.add("btnDisabled");
    //     // if ( actionText != null && actionText != "" ) button.value = actionText;
    // }
}
function UpdateJs(actionText) {
    blockme();
    if (window.confirm('确定要反应到目标吗?')) {
        Update();
        DisableAllButtons(actionText);
    } else {
        unblockUI();
    }
}
function checkMoney(val, id) {
    // changeFlgセット
    j$(escapeVfId('Page:Form:dataBlock:changeFlg')).val(1);
    var ids = id.split(":");
    var isChangedid = ids[0] + ":" + ids[1] + ":" + ids[2] + ":" + ids[3] + ":" + ids[4] + ":isChanged";
    j$(escapeVfId(isChangedid)).val("1");
    j$(escapeVfId(id))[0].style.background="#FFFF33";
    if (val != null && val != "") {
        if (isNaN(parseFloat(val))) {
            alert("请输入数值");
            j$(escapeVfId(id)).val("");
            return;
        }
        val = localParseFloat(val);
        val = Math.round(val * 100) / 100;
        
        var targetCategory = j$('#targetCategory').value();
        if (targetCategory == '重点产品目标(金额)') {
            j$(escapeVfId(id)).val(toNumComma(val));
        } else {
            j$(escapeVfId(id)).val(number_format_common(val, 0, "", ","));
        } 
    }
    calc();
}
 
function calc() {
     var isorgtbl = j$('div[name=bodyTable]');
    var tbl = document.getElementById('bodyTable');
    var datarows = tbl.rows.length;
    // 如果MainTable没有分成4部分
    if (isorgtbl.length == 0) {
        //datarows -= 2;
    }
    var allSum = 0;
    // xiongyl
     var cols = new Array({!titleSize});
    for (var i =0;i<cols.length;i++){
        cols[i] =0;
        }
    var targetCategory = j$('#targetCategory').value();
    // 行
    for (var i = 0; i < datarows; i++) {
        var rowSum = 0;
        // 列
        for (var j = 0; j < cols.length; j++) {
            var amount = 0;
            
            var raw = j$(escapeVfId('Page:Form:dataBlock:dbRepeat:' + i + ':amountRepeat:' + j + ':inAmountValue')).value();
            raw = (raw + '').replace(/[^0-9+\-Ee.]/g, '');
            
            var amount = localParseFloat(raw);
            rowSum = rowSum + amount;
            cols[j] = cols[j] + amount;
            allSum = allSum + amount;
        }
        if (targetCategory == '重点产品目标(金额)') {
            j$(escapeVfId('Page:Form:dataBlock:dbRepeat:' + i + ':totalrow')).text(toNumComma(rowSum));
        } else {
            j$(escapeVfId('Page:Form:dataBlock:dbRepeat:' + i + ':totalrow')).text(number_format_common(rowSum, 0, "", ","));
        }
    }
    // 列
    for (var j = 0; j < cols.length; j++) {
        if (targetCategory == '重点产品目标(金额)') {
            j$(escapeVfId('totalcol' + j)).text(toNumComma(cols[j]));
        } else {
            j$(escapeVfId('totalcol' + j)).text(number_format_common(cols[j], 0, "", ","));
        }
    }
    // 総計
    if (targetCategory == '重点产品目标(金额)') {
        j$(escapeVfId('totalAll')).text(toNumComma(allSum));
    } else {
        j$(escapeVfId('totalAll')).text(number_format_common(allSum, 0, "", ","));
    }
}
 
function saveJs() {
    blockme();
    if (window.confirm('确定要保存吗?')) {
        var button = document.getElementById("Page:Form:headBlock:setTarget");
        button.disabled = false;
        button.className = 'btn';
        // button.class ="btn";
        save();
    } else {
        unblockUI();
    }
}
 
function nextJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('要保存已做的修改吗?\n点击 [确定] 保存并去下年度\n点击 [取消] 只去下年度,不保存')) {
            next(true);
        } else {
            next(false);
        }
    } else {
        next(false);
    }
}
 
function prevJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('要保存已做的修改吗?\n点击 [确定] 保存并去上年度\n点击 [取消] 只去上年度,不保存')) {
            prev(true);
        } else {
            prev(false);
        }
    } else {
        prev(false);
    }
}
 
function checkOwner(val, id, rownum) {
    // changeFlgセット
    j$(escapeVfId('Page:Form:dataBlock:changeFlg')).val(1);
    var ids = id.split(":");
    var isChangedid = ids[0] + ":" + ids[1] + ":" + ids[2] + ":" + ids[3] + ":" + ids[4] + ":isChanged";
    j$(escapeVfId(isChangedid)).val("1");
    j$(escapeVfId(id))[0].style.background="#FFFF33";
}
 
function searchByDptJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) {
            searchByDpt(true);
        } else {
            searchByDpt(false);
        }
    } else {
        searchByDpt(false);
    }
}
 
function searchByProvinceJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) {
            searchByProvince(true);
        } else {
            searchByProvince(false);
        }
    } else {
        searchByProvince(false);
    }
}
 
function searchByCategoryJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) {
            searchByCategory(true);
        } else {
            searchByCategory(false);
        }
    } else {
        searchByCategory(false);
    }
}
 
function searchByImpKeyJs() {
    blockme();
    if (j$(escapeVfId('Page:Form:dataBlock:changeFlg')).value() == 1) {
        if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) {
            searchByImpKey(true);
        } else {
            searchByImpKey(false);
        }
    } else {
        searchByImpKey(false);
    }
}
//CHAN-BDQBLX  20210204 ljh start 
function exportJs() {
    if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) {
        if (window.confirm('重点产品的目标数量有变化,请先点击保存按钮,在进行导出操作')) {
            return;
        } 
    } 
    exportcsv();
}
//CHAN-BDQBLX  20210204 ljh end 
/*****************************/
var heightAjustment = 160;
var widthAjustment = 15;
function windowResize() {
    
    blockHeight = j$(window).innerHeight() - j$(escapeVfId('Page:Form:headBlock')).height()-j$(escapeVfId('MessageBlock')).height() -  heightAjustment;
    sbwidth = scrollbarWidth();
    blockWidth = j$(escapeVfId('Page:Form:headBlock')).width() - j$('div#in_Div_L').width() - widthAjustment - sbwidth*2;
    allblockWidth = j$(escapeVfId('Page:Form:headBlock')).width() - widthAjustment - sbwidth;
    allblockHeight = blockHeight + j$('div#out_Div').height();
    j$(escapeVfId('Page:Form:dataBlock')).css('height', blockHeight + 98 + 'px');
    j$('div#in_Div').css('width', blockWidth + 'px');
    j$('div#out_Div').css('width', blockWidth + 'px');
    j$('div#all').css('width', allblockWidth + 'px');
    j$('div#in_Div').css('height', blockHeight + 'px');
    j$('div#in_Div_L').css('height', blockHeight + 'px');
    j$('div#all').css('height', allblockHeight + 'px');
 
    // Table tr の height をあわせる
    var tbl = document.getElementById('leftTable');
    var tbl2 = document.getElementById('bodyTable');
    var tbl3 = document.getElementById('crossTable');
    var tbl4 = document.getElementById('topTable');
    for(var i = 0; i< tbl.rows.length;i++){
        if(document.getElementById("Page:Form:dataBlock:dbRepeat_L:"+i+":owner_mlktp")){
          document.getElementById("Page:Form:dataBlock:dbRepeat_L:"+i+":owner_mlktp").style.display="none";
          document.getElementById("Page:Form:dataBlock:dbRepeat_L:"+i+":owner").style.width="80%";
        }
        //j$("Page:Form:dataBlock:dbRepeat_L:"+i+":owner_mlktp").attr('display','none');
        //j$("Page:Form:dataBlock:dbRepeat_L:"+i+":owner").css("width","80%");
        
    }
    for (var i = 0; i < tbl4.rows.length; i++) {
     var ht3 = j$(tbl3.rows[i]).height();
     var ht4= j$(tbl4.rows[i]).height();
     if (ht4 < ht3) {
            j$(tbl4.rows[i]).css('height', ht3 + 'px');
        } else {
            j$(tbl3.rows[i]).css('height', ht4 + 'px');
        }
 }
    for (var i = 0; i < tbl2.rows.length; i++) {
        var ht1 = j$(tbl.rows[i]).height();
        var ht2 = j$(tbl2.rows[i]).height();
       
        if (ht2 < ht1) {
            j$(tbl2.rows[i]).css('height', ht1 + 'px');
        } else {
            j$(tbl.rows[i]).css('height', ht2 + 'px');
        }
        
    }
    
    if (j$('table#bodyTable').height() > j$('div#in_Div').height()) {
        j$('div#in_Div').css('width', (blockWidth + sbwidth) + 'px');
        j$('div#all').css('width', (allblockWidth + sbwidth) + 'px');
    } else {
       j$('div#out_Div').css('width', (blockWidth + sbwidth) + 'px');
       j$('div#in_Div').css('width', (blockWidth + sbwidth) + 'px');
       j$('div#all').css('width', (allblockWidth + sbwidth) + 'px');
    }
    if (j$('table#bodyTable').width() > j$('div#in_Div').width()) {
        j$('div#in_Div').css('height', (blockHeight + sbwidth) +'px');
        j$('div#all').css('height', (allblockHeight + sbwidth) +'px');
    }
}
window.onresize = windowResize;
//CHAN-BDQBLX  20210205 ljh start 
var popupBox;
popupBox = new SimpleDialog("CSVImportDialogId", false);  // 不可拖动
popupBox.createDialog();
function openPopupCSV() {
    popupBox.setTitle("导入CSV文件");
    popupBox.importContentNode(document.getElementById("{!$Component.Form.popupBox}"));
    popupBox.show(document.getElementById("{!$Component.Form.popupBox}"));
function remoteLocationPost() {
    blockme();
    var fbody = document.getElementById("file_input").files[0];
    if (typeof fbody === "undefined") {
        alert("请选择CSV文件");
        return;
    }
    else {
        var reader = new FileReader();
        reader.readAsText(fbody,"gb2312");//在前台改乱码问题
        reader.onload = function(val) {
 
            // if(this.result.split("\n").length - 1 > {!detailCountLimit}){
            //     alert("文件不可超过" + {!detailCountLimit} + "行");
            //     return;
            // }
            passToController(this.result);
            popupBox.hide();
        } 
    }
}
//CHAN-BDQBLX  20210205 ljh end
</script>
<style>
.TestCss{
    width:80%;
}
div#out_Div {
  position:relative;
  overflow: hidden;
  width: 820px;
}
div#out_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  width: 413px;
}
div#in_Div {
  position:relative;
  overflow: auto;
  width: 837px;
  height: 314px;
}
div#in_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  width: 413px;
  height: 297px;
}
div#all {
  overflow: hidden;
  width: 1250px;
}
</style>
</head>
 
<apex:form id="Form">
<div id="MessageBlock">
    <apex:outputPanel id="MessageP">
        <apex:pagemessages />
    </apex:outputPanel>
</div>
    <apex:actionFunction name="Update" action="{!UpdateBtn}" rerender="MessageP,dataBlock,ButtonTable" oncomplete="unblockUI();" />
    <apex:actionFunction name="save" action="{!saveBtn}" rerender="MessageP,dataBlock,ButtonTable" oncomplete="unblockUI();" />
    <apex:actionFunction name="next" action="{!next}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="prev" action="{!previous}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="searchByDpt" action="{!searchByDpt}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="searchByProvince" action="{!searchByProvince}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="searchByCategory" action="{!searchByCategory}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
<!--    <apex:actionFunction name="searchByImpKey" action="{!searchByImpKey}" rerender="Form" oncomplete="unblockUI();">
        <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" />
    </apex:actionFunction>
    -->
    <font style="font-size:15px;font-weight:700;display:{!IF(target_category == '重点产品目标(金额)','','none')}">录入重点产品的目标&nbsp;(注:请输入含税金额)</font>
    <font style="font-size:15px;font-weight:700;display:{!IF(target_category == '重点产品目标(金额)','none','')}">录入重点产品的目标&nbsp;(注:请输入整数)</font>
    <!--CHAN-BDQBLX  20210205 ljh start  -->
    <apex:actionFunction name="exportcsv" action="{!exportBycsv}"/>
    <apex:actionFunction name="passToController" action="{!importCSVFile}" rerender="Form, MessageP" oncomplete="unblockUI();">
         <apex:param name="csvData" value="" />
    </apex:actionFunction>
    <!--CHAN-BDQBLX  20210205 ljh end -->
    <!--CHAN-BDQBLX  20210205 ljh start -->
    <apex:outputPanel style="display:none">
            <apex:outputPanel id="popupBox" layout="block">
                <input type="file" id="file_input" name="attFile" accept=".csv" /><br/>
                <center>
                    <apex:commandButton value="确认" onclick="remoteLocationPost(); return false;" style="width: 20%; margin: 20px 10px 0px 10px" />
                    <apex:commandButton value="取消" onclick="popupBox.hide();" style="width: 20%; margin: 20px 10px 0px 10px" />
                </center>
            </apex:outputPanel>
    </apex:outputPanel>
    <!--CHAN-BDQBLX  20210205 ljh end -->
    <apex:pageBlock id="headBlock" tabStyle="Report">
        <table id="ButtonTable" border="0" width="100%">
            <tr>
                <td>
                    本部&nbsp;<apex:selectList value="{!salesDpt}" size="1" style="width:120px" onchange="searchByDptJs();return false;"><apex:selectOptions value="{!salesDptOpts}"/></apex:selectList>&nbsp;&nbsp;&nbsp;
                    省&nbsp;<apex:inputField value="{!opp.SAP_Province__c}" id="province" style="width:140px" onchange="searchByProvinceJs();return false;"></apex:inputField>&nbsp;&nbsp;&nbsp;
                   <!-- 重点目标分类&nbsp;<apex:selectList value="{!target_category}" size="1" style="width:140px" onchange="searchByCategoryJs();return false;"><apex:selectOptions value="{!targetOpts}"/></apex:selectList>&nbsp;&nbsp;&nbsp;
                    重点产品&nbsp;
                    <apex:selectList value="{!opp.Important_Key_product_category__c}" id="impKey" size="1" style="width:200px;" onchange="searchByImpKeyJs();return false;">
                        <apex:selectOptions value="{!impProductOptions}"/>
                    </apex:selectList>-->
                    <input type="hidden" id="targetCategory" value="{!target_category}"/>
                     <input type="hidden" id="titleSize" value="{!titleSize}"/>
                </td>
                <!-- ljh 样式调整 20210204 start -->
                <!--CHAN-BDQBLX  20210204 ljh end -->
                <td align="right">
                    <apex:commandButton value="反应到目标" rerender="dummy" onclick="UpdateJs(this);return false;" rendered="{!Not(isPast)}" id="setTarget"/>
                    <apex:commandbutton onclick="exportJs();return false;" id="export" value="导出数据模板"></apex:commandbutton>
                    <apex:commandButton onclick="openPopupCSV(); return false;" value="导入" rerender="Form"/>
                </td>
                <!--CHAN-BDQBLX  20210204 ljh end -->
            </tr>
        </table>
        <table id="ButtonTable" border="0" width="100%">
            <tr>
                <td width="15%"></td>
                <td align="center">
                    <apex:commandButton value="保存" rerender="dummy" onclick="saveJs();return false;" rendered="{!Not(isPast) && loginUser.ProfileId == $Label.ProfileId_SystemAdmin}"/>
                </td>
                <td width="15%" align="right"><apex:commandButton action="{!backBtn}" value="返回" rerender="dummy"/></td>
            </tr>
            <tr>
                <td width="15%" align="left" ><apex:commandLink value="上年度" style="color:blue;" rendered="{!previousRendered}" onclick="prevJs();return false;"/></td>
                <td align="center"><apex:outputText id="Year" value="{!currentPeriod}" style="color:blue;"/></td>
                <td width="15%" align="right"><apex:commandLink value="下年度" style="color:blue;" rendered="{!nextRendered}" onclick="nextJs();return false;"/></td>
            </tr>
        </table>
    </apex:pageBlock>
    
    <apex:pageBlock id="dataBlock" tabStyle="Report">
        <!-- バック側にパラメータを増やしたくないため、1になれないパラメータを入れます -->
        <!-- ここの値は1かどうかの判断のみで使います -->
            <apex:inputHidden id="changeFlg" value="{!saveFlg}"/>
            <div id="Div_all">
            <div id="out_Div_L">
                <table class="list" style="border-bottom-width: 0px;table-layout:fixed;" border="0"  cellspacing="0" cellpadding="0" id="crossTable">
                     <thead>
                <tr class="headerRow" id="Head_L">
                <th width="140px" class="headerRow  booleanColumn">销售本部</th>
                <th width="110px" class="headerRow  booleanColumn">省</th>
                <th width="160px" class="headerRow  booleanColumn">担当</th>
                </tr>
            </thead> 
            <tbody>
                <apex:variable value="{!1}" var="cnt" />
                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" bgcolor="#AAAACC" id="dataRow_HL">
                <td class="dataCell" ></td>
                <td class="dataCell" ></td>
                <td class="dataCell" style="text-align:center;">合计</td>
                </tr>
            </tbody>
        </table>
            </div>
             <div id="out_Div" >
        <table class="list" style="border-collapse: collapse;border-bottom-width: 0px;table-layout:fixed;" id="topTable">
                    <thead>
                         <tr class="headerRow" id="header_R">
                <apex:repeat value="{!opportunity_category}" var="oc" id="opportunityCategoryRepeat">
                    <th width="85px" style="white-space: normal;" class="headerRow  booleanColumn"><apex:outputText id="categoryValue" value="{!oc}"></apex:outputText></th>
                </apex:repeat>
                <th width="85" class="headerRow  booleanColumn" style="background-color:#AAAACC;">合计</th>
                </tr>
                    </thead>
                    <tbody>
 
                    <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" bgcolor="#AAAACC"  id="dataRow_HR"  >
                <apex:variable value="{!0}" var="cntTotal" />
                <apex:repeat value="{!opportunity_category}" var="oc" id="titleRepeat">
                <td class="dataCell" style="text-align:right;" id="totalcol{!cntTotal}"></td>
                <apex:variable value="{!cntTotal + 1}" var="cntTotal" />     
                        </apex:repeat>
                <td class="dataCell" style="text-align:right;" id="totalAll"></td>
            </tr>
                    </tbody>
                </table>
        </div>
    <div id="in_Div_L">
        <table class="list" style="table-layout:fixed;border-bottom-width: 0px;" border="0"  cellspacing="0" cellpadding="0" id="leftTable">
            <tbody>
                
                <apex:repeat value="{!dataBeans}" var="dbs" id="dbRepeat_L">
                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}">
                <td class="dataCell" width="140px">{!dbs.department}</td>
                <td class="dataCell" width="110px"><apex:outputField value="{!dbs.opportunity.SAP_Province__c}"></apex:outputField></td>
                <td class="dataCell" width="160px"><apex:inputField id="owner" value="{!dbs.opportunity.Owner_System__c}" onchange="checkOwner(this.value, this.id, {!cnt});" style="width:80%;"></apex:inputField>
                <script type="text/javascript">
                    var ispast = {!isPast};
                    if (ispast) {
                        j$(escapeVfId('Page:Form:dataBlock:dbRepeat_L:' + {!cnt-1} + ':owner')).attr("disabled",true);
                    }
                </script>
                </td></tr>
 
                </apex:repeat>
            </tbody>
        </table>
        </div>
       
        <div id="in_Div" >
        <table class="list" style="border-collapse: collapse;border-bottom-width: 0px;table-layout:fixed;" id="bodyTable">
                    
                    <tbody>
                <apex:repeat value="{!dataBeans}" var="dbs" id="dbRepeat">
                    <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" >
                    <apex:variable value="{!1}" var="cnt2" />
                    <apex:repeat value="{!dbs.amount}" var="amount" id="amountRepeat">
                    <td class="dataCell" style="text-align:right;width:86px">
                    <apex:inputField id="inAmountValue" value="{!amount.Num_Of_OPD__c}" style="width:92%; text-align:right;" onchange="checkMoney(this.value, this.id);"></apex:inputField>
                    <script type="text/javascript">
                        var ispast = {!isPast};
                        if (ispast) {
                        j$(escapeVfId('Page:Form:dataBlock:dbRepeat:' + {!cnt-1} + ':amountRepeat:' + {!cnt2-1} + ':inAmountValue')).attr("disabled",true);
                        }
                    </script>
                    </td>
                    <apex:variable value="{!cnt2 + 1}" var="cnt2" />
                    </apex:repeat>
                    <td class="dataCell" style="text-align:right; background-color:#AAAACC;width:86px;">
                    <apex:outputText id="totalrow" value="{0,number,#,##0.00}">
                    <apex:param value="" />
                    </apex:outputText>
                    <apex:inputHidden id="isChanged" value="{!dbs.isChanged}"/>
                    </td>
                </tr>
                <apex:variable value="{!cnt + 1}" var="cnt" />
            </apex:repeat>
                    </tbody>
        </table>
        </div>
        </div>
<script type="text/javascript">
 
calc();
j$('div#in_Div').scroll(function() {
    j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
    j$('div#in_Div_L').scrollTop(j$(this).scrollTop());
});
j$('div#out_Div').scroll(function() {
    j$('div#in_Div').scrollLeft(j$(this).scrollLeft());
});
j$('div#in_Div_L').scroll(function() {
    j$('div#in_Div').scrollTop(j$(this).scrollTop());
});
windowResize();
</script>
    </apex:pageBlock>
</apex:form>
</apex:page>