方槍槍的java世界

          不要因?yàn)轱L(fēng)雨飄落就停止了你的腳步,真正的得失就在你的心中。 做喜歡做的事,不輕言放棄!

          My Links

          Blog Stats

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          cell 報表制作腳本舉例

           

          <%@ page contentType="text/html;charset=GBK"%>
          <%@ taglib uri="/tags/web-html" prefix="html"%>
          <%@ taglib uri="/tags/web-tianhe" prefix="templates"%>
          <%@ page import="java.math.BigDecimal"%>
          <%@ page import="java.util.List"%>
          <%@ page import="java.util.Map"%>
          <%@ page import="java.util.Date"%>


          <script language="Jscript">

          function setfilename()
          {
            filen="jsp/hr/personnel/Personnelreport.cll";  
            return filen;
          }
          function filldata()
          {
          <%
             List bodyList=(List)request.getAttribute("bodyList");  //表體數(shù)據(jù)
             Map headTailMap=(Map)request.getAttribute("headTailMap");  //表頭表尾數(shù)據(jù)
            
             int len = bodyList.size();
             String title= (String) headTailMap.get("title");//標(biāo)題
                String userName=(String)headTailMap.get("userName");//制表人
                String date=(String)headTailMap.get("dateId");//制表時間
          %>
               sheet = <%=0%>;
            content_col=1;
            //設(shè)置某頁行數(shù)
            CellRpt.SetRows(<%=len+4+1%>,sheet);//設(shè)置某頁行數(shù)(行數(shù),頁號)
            CellRpt.SetCols(15,sheet);//設(shè)置某頁列數(shù)(列數(shù),頁號)
            CellRpt.PrintSetOrient(1);//設(shè)置進(jìn)紙方式為橫放

            CellRpt.MergeCells(1,1,15,1);//將指定區(qū)域的單元格組合(區(qū)域起始點(diǎn)列號,行號,區(qū)域結(jié)束點(diǎn)列號,行號)
            CellRpt.SetCellFontStyle(1,1,sheet,2);//設(shè)置指定單元格的字體風(fēng)格(列號,行號,頁號,字體風(fēng)格)
             CellRpt.SetCellFontSize(1,1,sheet,20);//設(shè)置單元格字體大小(列號,行號,頁號,字號)
            CellRpt.SetCellAlign(1,1,sheet,36);//設(shè)置指定單元格的對齊方式(列號,行號,頁號,參數(shù))
            CellRpt.S(1,1,sheet,"<%=title%>");

            CellRpt.MergeCells(1,2,1,2);
            CellRpt.SetCellFontStyle(1,2,sheet,3);
             CellRpt.SetCellFontSize(1,2,sheet,10);
            CellRpt.SetCellAlign(1,2,sheet,36);
            CellRpt.S(1,2,sheet,"部門");

            CellRpt.MergeCells(2,2,2,2);
            CellRpt.SetCellFontStyle(2,2,sheet,3);
             CellRpt.SetCellFontSize(2,2,sheet,10);
            CellRpt.SetCellAlign(2,2,sheet,36);
            CellRpt.S(2,2,sheet,"姓名");

            CellRpt.MergeCells(3,2,3,2);
            CellRpt.SetCellFontStyle(3,2,sheet,3);
             CellRpt.SetCellFontSize(3,2,sheet,10);
            CellRpt.SetCellAlign(3,2,sheet,36);
            CellRpt.S(3,2,sheet,"性別");

            CellRpt.MergeCells(4,2,4,2);
            CellRpt.SetCellFontStyle(4,2,sheet,3);
             CellRpt.SetCellFontSize(4,2,sheet,10);
            CellRpt.SetCellAlign(4,2,sheet,36);
            CellRpt.S(4,2,sheet,"年齡");

            CellRpt.MergeCells(5,2,5,2);
            CellRpt.SetCellFontStyle(5,2,sheet,3);
             CellRpt.SetCellFontSize(5,2,sheet,10);
            CellRpt.SetCellAlign(5,2,sheet,36);
            CellRpt.S(5,2,sheet,"政治面貌");

            CellRpt.MergeCells(6,2,6,2);
            CellRpt.SetCellFontStyle(6,2,sheet,3);
             CellRpt.SetCellFontSize(6,2,sheet,10);
            CellRpt.SetCellAlign(6,2,sheet,36);
            CellRpt.S(6,2,sheet,"學(xué)歷");

            CellRpt.MergeCells(7,2,7,2);
            CellRpt.SetCellFontStyle(7,2,sheet,3);
             CellRpt.SetCellFontSize(7,2,sheet,10);
            CellRpt.SetCellAlign(7,2,sheet,36);
            CellRpt.S(7,2,sheet,"專業(yè)技術(shù)名稱");

            CellRpt.MergeCells(8,2,8,2);
            CellRpt.SetCellFontStyle(8,2,sheet,3);
             CellRpt.SetCellFontSize(8,2,sheet,10);
            CellRpt.SetCellAlign(8,2,sheet,36);
            CellRpt.S(8,2,sheet,"職業(yè)技能名稱");

            CellRpt.MergeCells(9,2,9,2);
            CellRpt.SetCellFontStyle(9,2,sheet,3);
             CellRpt.SetCellFontSize(9,2,sheet,10);
            CellRpt.SetCellAlign(9,2,sheet,36);
            CellRpt.S(9,2,sheet,"出生日期");

            CellRpt.MergeCells(10,2,10,2);
            CellRpt.SetCellFontStyle(10,2,sheet,3);
             CellRpt.SetCellFontSize(10,2,sheet,10);
            CellRpt.SetCellAlign(10,2,sheet,36);
            CellRpt.S(10,2,sheet,"入職時間");
           
            CellRpt.MergeCells(11,2,11,2);
            CellRpt.SetCellFontStyle(11,2,sheet,3);
             CellRpt.SetCellFontSize(11,2,sheet,10);
            CellRpt.SetCellAlign(11,2,sheet,36);
            CellRpt.S(11,2,sheet,"家庭地址");
           
            CellRpt.MergeCells(12,2,12,2);
            CellRpt.SetCellFontStyle(12,2,sheet,3);
             CellRpt.SetCellFontSize(12,2,sheet,10);
            CellRpt.SetCellAlign(12,2,sheet,36);
            CellRpt.S(12,2,sheet,"辦公電話");
           
            CellRpt.MergeCells(13,2,13,2);
            CellRpt.SetCellFontStyle(13,2,sheet,3);
             CellRpt.SetCellFontSize(13,2,sheet,10);
            CellRpt.SetCellAlign(13,2,sheet,36);
            CellRpt.S(13,2,sheet,"移動電話");
           
            CellRpt.MergeCells(14,2,14,2);
            CellRpt.SetCellFontStyle(14,2,sheet,3);
             CellRpt.SetCellFontSize(14,2,sheet,10);
            CellRpt.SetCellAlign(14,2,sheet,36);
            CellRpt.S(14,2,sheet,"員工狀態(tài)");
           
               content_row=3;

          <%
            BigDecimal sumEmpNum = new BigDecimal(bodyList.size());

                  for(int i = 0;i < bodyList.size();i++){
                 Map  bodyMap = (Map) bodyList.get(i);
                 String orgName = (String)bodyMap.get("ORGAN_NAME");//部門
              String empName = (String)bodyMap.get("EMP_NAME");//員工姓名
              String sex = (String)bodyMap.get("SEX");//性別
              String policital = (String)bodyMap.get("POLICITAL_STATUS");//政治面貌
              String edu = (String)bodyMap.get("EDUCATION");//學(xué)歷
              String tName = (String)bodyMap.get("NAME");//專業(yè)技術(shù)名稱
              String skillName = (String)bodyMap.get("SKILL_POST_NAME");//職業(yè)技能名稱
              String birthday = (String)bodyMap.get("BIRTHDAY");//生日
              String entryDay = (String)bodyMap.get("ENTRY_ENTERPRISE_DAT");//入職時間
              String addr = (String)bodyMap.get("ADDRESS");//家庭住址
              String officePhone = (String)bodyMap.get("OFFICE_PHONE");//辦公電話
              String mobilePhone = (String)bodyMap.get("MOBILE_PHONE");//移動電話
              String state = (String)bodyMap.get("STATE");//員工狀態(tài)
              String ageStr = "";
              if(sex == null || "".equals(sex)){
               sex = "";
              }else{
               switch(Integer.parseInt(sex)){
               case 0 : sex="男";break;
               case 1 : sex="女";break;
               } 
              }
              if(policital == null || "".equals(policital)){
               policital = "";
              }else{
               switch(Integer.parseInt(policital)){
               case 1 : policital="工人";break;
               case 2 : policital="農(nóng)民";break;
               case 3 : policital="知識分子";break;
               case 4 : policital="群眾";break;
               } 
              }
              if(edu == null || "".equals(edu)){
               edu = "";
              }else{
               switch(Integer.parseInt(edu)){
               case 1 : edu="小學(xué)";break;
               case 2 : edu="初中";break;
               case 3 : edu="高中";break;
               case 4 : edu="大學(xué)專科";break;
               case 5 : edu="大學(xué)本科";break;
               case 6 : edu="碩士";break;
               case 7 : edu="博士";break;
               } 
              }
              if(skillName == null || "".equals(skillName)){
               skillName = "";
              }else{
               switch(Integer.parseInt(skillName)){
               case 1 : skillName="企業(yè)人力資源管理";break;
               case 2 : skillName="計算機(jī)操作";break;
               case 3 : skillName="倉儲工";break;
               case 4 : skillName="企業(yè)經(jīng)營管理";break;
               case 5 : skillName="秘書";break;
               case 6 : skillName="物流管理";break;
               case 7 : skillName="卷煙商品營銷";break;
               case 8 : skillName="客戶服務(wù)管理";break;
               case 9 : skillName="企業(yè)信息管理";break;
               case 10 : skillName="汽車駕駛";break;
               case 11 : skillName="營業(yè)員";break;
               } 
              }
              if(birthday == null || "".equals(birthday)){
               birthday = "";
              }else{
               String yearBir = birthday.substring(0,4);
               String dateNow = new Date().toString();
               String yearNow = dateNow.substring(dateNow.length()-4,dateNow.length());
               int ageInt = Integer.parseInt(yearNow) - Integer.parseInt(yearBir);
               ageStr = String.valueOf(ageInt); 
              }
          %>
                  content_col=1;
             CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
            CellRpt.SetCellAlign(content_col,content_row,sheet,33);
            CellRpt.S(content_col,content_row,sheet,"<%=orgName%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,33);
            CellRpt.S(content_col,content_row,sheet,"<%=empName%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,33);
            CellRpt.S(content_col,content_row,sheet,"<%=sex%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=ageStr%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=policital%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=edu%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=tName%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=skillName%>");
            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=birthday%>");
            content_col++;
           
            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=entryDay%>");
            content_col++;
           
            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=addr%>");
            content_col++;
           
            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=officePhone%>");
            content_col++;
           
            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=mobilePhone%>");
            content_col++;
           
            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=state%>");

            content_row++;
          <%

          }
          %>
            content_col=1;
            CellRpt.MergeCells(content_col,content_row,content_col,content_row);
            CellRpt.SetCellFontStyle(content_col,content_row,sheet,0);
            CellRpt.SetCellAlign(content_col,content_row,sheet,33);
            CellRpt.S(content_col,content_row,sheet,"合計");

            content_col++;

            CellRpt.SetCellFontSize(content_col,content_row,sheet,10);
             CellRpt.SetCellAlign(content_col,content_row,sheet,34);
            CellRpt.S(content_col,content_row,sheet,"<%=sumEmpNum%>(人)");//總?cè)藬?shù)

           
            content_row++;
           
           
            CellRpt.MergeCells(1,content_row,3,content_row);
            CellRpt.SetCellFontSize(1,content_row,sheet,10);
             CellRpt.SetCellAlign(1,content_row,sheet,33);
            CellRpt.S(1,content_row,sheet,"制表人:"+"<%=userName%>");

            CellRpt.MergeCells(12,content_row,14,content_row);
            CellRpt.SetCellFontSize(12,content_row,sheet,10);
             CellRpt.SetCellAlign(12,content_row,sheet,34);
            CellRpt.S(12,content_row,sheet,"制表日期:"+"<%=date%>");

             var line_rowBegin=2; //從第二行開始
            var line_rowEnd=CellRpt.getRows(sheet)-2; //畫到倒數(shù)第三行
            var line_colBegin=1; //從第一列開始
            var line_colEnd=CellRpt.getCols(sheet);//畫到最后一列
            CellRpt.DrawGridLine(line_colBegin, line_rowBegin, line_colEnd,line_rowEnd, 0, 2,-1);//所有框畫細(xì)線
           
            //打印設(shè)置
             CellRpt.PrintRange(1,1,CellRpt.getCols(sheet),CellRpt.getRows(sheet));
            CellRpt.PrintSetTopTitle(1,6);
            CellRpt.PrintSetBottomTitle(content_row+1,content_row+1);
            CellRpt.PrintSetOrient(1);//打印方向:1為橫向,0為縱向
          }

          </script>

          posted on 2008-04-05 23:58 做強(qiáng)大的自己 閱讀(725) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 石台县| 沽源县| 沙河市| 望奎县| 青阳县| 博湖县| 永登县| 响水县| 饶平县| 北流市| 澄迈县| 皋兰县| 白玉县| 精河县| 泸定县| 锦屏县| 广安市| 宁明县| 长垣县| 响水县| 芮城县| 西藏| 沐川县| 乐都县| 汶上县| 清河县| 达州市| 溧阳市| 定安县| 综艺| 鹿邑县| 庆阳市| 五指山市| 河东区| 闽清县| 古丈县| 泸西县| 喀什市| 江川县| 麻江县| 汕尾市|