| <apex:page id="Page" showHeader="false" sidebar="false" Controller="SetPersonalTargetEngController" action="{!init}"> | 
| <head> | 
| <title>部门担当者ENG目标设定(医院担当)</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"> | 
| function checkMoney(val, id) { | 
|     // changeFlgセット | 
|     j$(escapeVfId('Page:Form:editBlock: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; | 
|         j$(escapeVfId(id)).val(toNumComma(val)); | 
|     } | 
|     calc(); | 
| } | 
|   | 
| function checkAll(checker) { | 
|     for (var i = 0; i < {!pSize}; i++) { | 
|         j$(escapeVfId('Page:Form:headBlock:postRepeat:' + i + ':post'))[0].checked = checker.checked; | 
|     } | 
|     searchByFilterJs(); | 
| } | 
|   | 
| function calc() { | 
|     var isorgtbl = j$('div[name=bodyTable]'); | 
|     var tbl = document.getElementById('MainTable'); | 
|     var datarows = tbl.rows.length; | 
|     // 如果MainTable没有分成4部分 | 
|     if (isorgtbl.length == 0) { | 
|         datarows -= 2; | 
|     } | 
|     var allSum = 0; | 
|     var cols = [0, 0, 0, 0, 0, 0, 0, 0]; | 
|     // 行 | 
|     for (var i = 0; i < datarows; i++) { | 
|         var rowSum = 0; | 
|         // 列 | 
|         for (var j = 0; j < 8; j++) { | 
|             var amount = 0; | 
|              | 
|             var raw = j$(escapeVfId('Page:Form:editBlock: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; | 
|         } | 
|         j$(escapeVfId('Page:Form:editBlock:dbRepeat:' + i + ':totalrow')).text(toNumComma(rowSum)); | 
|     } | 
|     // 列 | 
|     for (var j = 0; j < 8; j++) { | 
|         j$(escapeVfId('totalcol' + j)).text(toNumComma(cols[j])); | 
|     } | 
|     // 総計 | 
|     j$(escapeVfId('totalAll')).text(toNumComma(allSum)); | 
| } | 
|   | 
| function saveJs() { | 
|     blockme(); | 
|     if (window.confirm('确定要保存吗?')) { | 
|         save(); | 
|     } else { | 
|         unblockUI(); | 
|     } | 
| } | 
|   | 
| function nextJs() { | 
|     blockme(); | 
|     if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) { | 
|         if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并去下年度\n点击 [取消] 只去下年度,不保存')) { | 
|             next(true); | 
|         } else { | 
|             next(false); | 
|         } | 
|     } else { | 
|         next(false); | 
|     } | 
| } | 
|   | 
| function prevJs() { | 
|     blockme(); | 
|     if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) { | 
|         if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并去上年度\n点击 [取消] 只去上年度,不保存')) { | 
|             prev(true); | 
|         } else { | 
|             prev(false); | 
|         } | 
|     } else { | 
|         prev(false); | 
|     } | 
| } | 
|   | 
| function searchByDptJs() { | 
| //    if (val != null && val != "") { | 
|         blockme(); | 
|         if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) { | 
|             if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) { | 
|                 searchByDpt(true); | 
|             } else { | 
|                 searchByDpt(false); | 
|             } | 
|         } else { | 
|             searchByDpt(false); | 
|         } | 
| //    } | 
| } | 
|   | 
| function searchByProvinceJs() { | 
| //    if (val != null && val != "") { | 
|         blockme(); | 
|         if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) { | 
|             if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) { | 
|                 searchByProvince(true); | 
|             } else { | 
|                 searchByProvince(false); | 
|             } | 
|         } else { | 
|             searchByProvince(false); | 
|         } | 
| //    } | 
| } | 
|   | 
| function searchByFilterJs() { | 
| //    if (val != null && val != "") { | 
|         blockme(); | 
|         if (j$(escapeVfId('Page:Form:editBlock:changeFlg')).value() == 1) { | 
|             if (window.confirm('目标金额有变化,要保存已做的修改吗?\n点击 [确定] 保存并继续\n点击 [取消] 不保存')) { | 
|                 searchByFilter(true); | 
|             } else { | 
|                 searchByFilter(false); | 
|             } | 
|         } else { | 
|             searchByFilter(false); | 
|         } | 
| //    } | 
| } | 
| </script> | 
| </head> | 
|   | 
| <apex:form id="Form"> | 
|     <apex:outputPanel id="MessageP"> | 
|         <apex:pagemessages /> | 
|     </apex:outputPanel> | 
|      | 
|     <apex:actionFunction name="save" action="{!saveBtn}" rerender="MessageP,editBlock" 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="searchByFilter" action="{!searchByFilter}" rerender="Form" oncomplete="unblockUI();"> | 
|         <apex:param name="saveFlg" assignTo="{!saveFlg}" value="" /> | 
|     </apex:actionFunction> | 
|      | 
|     <font style="font-size:15px;font-weight:700;">录入担当者各自的ENG目标 (注:请输入含税金额)</font> | 
|      | 
|     <apex:pageBlock id="headBlock" tabStyle="Report"> | 
|         <table  id="ConditionTable" border="0" width="100%"> | 
|             <tr> | 
|                 <!-- <apex:outputPanel rendered="{!loginUser.ProfileId == $Label.ProfileId_SystemAdmin}" layout="none"> --> | 
|                 <!-- <td width="170">本部 <apex:selectList value="{!salesDpt}" size="1" style="width:120px;" disabled="{!!(loginUser.ProfileId == $Label.ProfileId_SystemAdmin || loginUser.ProfileId == $Label.ProfileId_103)}" onchange="searchByDptJs();return false;"><apex:selectOptions value="{!salesDptOpts}"/></apex:selectList></td> --> | 
|                 <!-- </apex:outputPanel> --> | 
|                 <td width="179">省 <apex:inputField id="province" value="{!loginUser.Province__c}" style="width:140px;" onchange="searchByProvinceJs();return false;"></apex:inputField> | 
|                 <script type="text/javascript"> | 
|                     var isadmin = {!(loginUser.ProfileId == $Label.ProfileId_SystemAdmin || loginUser.ProfileId == $Label.ProfileId_103 || loginUser.ProfileId == $Label.ProfileId_2S6_ENG)}; | 
|                     if (!isadmin) { | 
|                         j$(escapeVfId('Page:Form:headBlock:province')).attr("disabled",true); | 
|                     } | 
|                 </script> | 
|                 </td> | 
|                 <!-- <td width="170"> | 
|                     医院担当  | 
|                     <apex:selectList value="{!productUser}" size="1" style="width:100px;" onchange="searchByFilterJs();return false;"> | 
|                         <apex:selectOptions value="{!productUserOptions}"/> | 
|                     </apex:selectList>    | 
|                 </td> --> | 
|                 <td width="60"><apex:inputCheckBox id="checkAll" value="{!checkAll}" onchange="checkAll(this);return false;"/><apex:outputLabel value="全选" for="checkAll"/></td> | 
|                 <td> | 
|                     <apex:repeat value="{!plist}" var="p" id="postRepeat"> | 
|                         <apex:inputCheckBox value="{!p.check}" id="post" onchange="searchByFilterJs();return false;"/><apex:outputLabel value="{!p.positionName}" for="post"/>    | 
|                     </apex:repeat> | 
|                 </td> | 
|             </tr> | 
|         </table> | 
|          | 
|         <table id="ButtonTable" border="0" width="100%"> | 
|             <tr> | 
|                 <td width="10%" align="right"></td> | 
|                 <td align="center"> | 
|                     <apex:commandButton value="保存" rerender="dummy" onclick="saveJs();return false;" rendered="{!Not(isPast)}"/> | 
|                 </td> | 
|                 <td width="10%" 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="editBlock" tabStyle="Report"> | 
|         <!-- バック側にパラメータを増やしたくないため、1になれないパラメータを入れます --> | 
|         <!-- ここの値は1かどうかの判断のみで使います --> | 
|         <apex:inputHidden id="changeFlg" value="{!saveFlg}"/> | 
|         <table class="list" style="border-bottom-width: 0px;" border="0" cellspacing="0" cellpadding="0" id="MainTable"> | 
|             <colgroup> | 
|                 <!-- <col width="10%" /> --> | 
|                 <col width="15%" /> | 
|                 <col width="25%" /> | 
|                 <col width="10%" /> | 
|                 <col width="10%" /> | 
|                 <col width="10%" /> | 
|                 <col width="15%" /> | 
|                 <col /> | 
|             </colgroup> | 
|             <thead> | 
|                 <tr class="headerRow"> | 
|                     <!-- <th class="headerRow  booleanColumn">本部</th> --> | 
|                     <th class="headerRow  booleanColumn">省</th> | 
|                     <th class="headerRow  booleanColumn">角色</th> | 
|                     <th class="headerRow  booleanColumn">担当</th> | 
|                     <th class="headerRow  booleanColumn">职位</th> | 
|                     <th class="headerRow  booleanColumn">负责产品分类</th> | 
|                     <apex:repeat value="{!opportunity_category}" var="oc" id="opportunityCategoryRepeat"> | 
|                         <th class="headerRow  booleanColumn"><apex:outputText id="categoryValue" value="{!oc}"></apex:outputText></th> | 
|                     </apex:repeat> | 
|                     <th class="headerRow  booleanColumn" style="background-color:#AAAACC;">合计</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"> | 
|                     <!-- <td class="dataCell"></td> --> | 
|                     <td class="dataCell"></td> | 
|                     <td class="dataCell"></td> | 
|                     <td class="dataCell"></td> | 
|                     <td class="dataCell"></td> | 
|                     <td class="dataCell" style="text-align:center;">合计</td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol0"></td> | 
| <!--                     <td class="dataCell" style="text-align:right;" id="totalcol1"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol2"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol3"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol4"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol5"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol6"></td> | 
|                     <td class="dataCell" style="text-align:right;" id="totalcol7"></td> --> | 
|                     <td class="dataCell" style="text-align:right;" id="totalAll"></td> | 
|                 </tr> | 
|                 <apex:repeat value="{!dataBeans}" var="dbs" id="dbRepeat"> | 
|                     <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}"> | 
|                         <!-- <td class="dataCell">{!dbs.user.Salesdepartment__c}</td> --> | 
|                         <td class="dataCell">{!dbs.user.Province__c}</td> | 
|                         <td class="dataCell">{!dbs.user.UserRole.Name}</td> | 
|                         <td class="dataCell">{!dbs.user.Alias}</td> | 
|                         <td class="dataCell">{!dbs.user.Post__c}</td> | 
|                         <td class="dataCell" style="word-wrap:break-word;max-width:70px;">{!SUBSTITUTE(dbs.user.Product_specialist_incharge_product__c, ";", "; ")}</td> | 
|                         <apex:variable value="{!1}" var="cnt2" /> | 
|                         <apex:repeat value="{!dbs.amount}" var="amount" id="amountRepeat"> | 
|                             <td class="dataCell" style="text-align:right;"> | 
|                                 <apex:inputField id="inAmountValue" value="{!amount.Amount}" 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:editBlock: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;"> | 
|                             <apex:outputText id="totalrow" style="width:92%;" 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> | 
| <script type="text/javascript"> | 
| j$(function() { | 
|     var blockHeight = j$(window).innerHeight() - j$(escapeVfId('Page:Form:headBlock')).height() - 110; | 
|     j$(escapeVfId('MainTable')).tablefix({height: blockHeight, fixRows: 2, fixCols: 0}); | 
| }); | 
| calc(); | 
| </script> | 
|     </apex:pageBlock> | 
| </apex:form> | 
| </apex:page> |