⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createhtml.java

📁 一个用于监控WEB服务器和数据库服务器的客户端程序。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 *
 */
package com.jobcn.task;

import java.io.IOException;
import java.sql.*;
import com.jobcn.database.DataBase;

/**
 *
 * @remark:
 * @author: Stephen
 * @date: 2005-3-21
 * @version:
 *
 * @upd_remark:
 * @upd_user:
 * @upd_date:
 */
final public class CreateHtml extends AbstractCreateHtml {
    //constructer1
    public CreateHtml() {
        super(new StringBuffer(1024));
    }

    //constructer2
    public CreateHtml(StringBuffer sb) {
        super(sb);
    }

    public void printHeader() {
        sb.append("<html>\n");
        sb.append("<head>\n");
        sb.append("	<title>本月各部目标及进度</title>\n");
        sb.append("	<link href=\"/BOSS_CSS/css.css\" rel=\"stylesheet\" type=\"text/css\">\n");
        sb.append("</head>\n");
    }

    public void printBody() {
        //公司月份目标
        //[0][1] 表示2000年1月份, [4][5] 表示2004年5月份, [10][12] 表示2009年12月份
        int[][] ActDestTractMoney = new int[10][13];
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 13; j++) {
                ActDestTractMoney[i][j] = 5000000;
            }
        }
        ActDestTractMoney[4][8] = 2000000;
        ActDestTractMoney[4][9] = 2000000;
        ActDestTractMoney[4][10] = 1850000;
        ActDestTractMoney[4][11] = 2200000;
        ActDestTractMoney[5][12] = 5000000;

        ActDestTractMoney[5][1] = 2000000;
        ActDestTractMoney[5][2] = 1000000;
        ActDestTractMoney[5][3] = 5000000;

        java.text.DecimalFormat nf = new java.text.DecimalFormat("###,###"); //整数number
        // format
        java.text.DecimalFormat Pernf = new java.text.DecimalFormat("###0.00"); //百分比

        String strDate = (new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm")).format(new java.util.Date());
        String strYear = strDate.substring(0, 4);
        String strMonth = strDate.substring(5, 7);
        String strDay = strDate.substring(8, 10);

        String strYearMonth = strDate.substring(0, 7);
        String strIMonth = String.valueOf(Integer.parseInt(strMonth));
        String strIDay = String.valueOf(Integer.parseInt(strDay));

        //本月公司整体销售目标:来源于公司月分目标ActDestTractMoney[][]
        int ComDestTractMoney = ActDestTractMoney[Integer.parseInt(strYear) - 2000][Integer.parseInt(strMonth)];

        DataBase db = new DataBase();
        Connection DBConn = null;
        Statement stmt = null;
        ResultSet RS = null, RS1 = null;
        String SQL = "";

        //String DepartId = "";
        String DepartName = "", PersonName = "", PersonExt = "";

        int ManagerDestMoney = 0, TractMoney = 0, TractMoney_Today = 0;
        int ManagerDestMoneyTotal = 0, TractMoneyTotal = 0, TractMoney_TodayTotal = 0;
        double DestAchieveRate = 0.00, ComDestAchieveRate = 0.00;

        String deptChartData = "", deptDayChartData = ""; //图表数据:各部门本月销售统计图和各部门本日销售统计图

        /*------sql:
         select aa.DepartID, aa.DepartName, aa.PersonName, aa.PersonExt,
         aa.ManagerDestMoney, ISNULL(bb.TractMoney,0) TractMoney, ISNULL(cc.TractMoney_Today,0) TractMoney_Today,
         (case when aa.ManagerDestMoney=0 then 0.00 else ISNULL(bb.TractMoney,0)/(aa.ManagerDestMoney*1.00) end) DestAchieveRate
         from(select sde.DeptID DepartID, sde.DepartName, ISNULL(sde.SaleDest,0) ManagerDestMoney,
         hp.name PersonName, hp.OfficePhone_Ext PersonExt
         --select top 1 * from SaleMoneyDest_Dept_EveryMonth
         --select top 1 * from HrPerson
         from SaleMoneyDest_Dept_EveryMonth sde, HrPerson hp
         where sde.ManagerPerID=hp.ID
         and  sde.YearNum='2005'
         and  sde.MonthNum='3'
         --order by sde.DeptID
         ) aa,--各部门销售经理目标
         (select hp.DepartID, SUM(CONVERT(FLOAT,ctr.TractMoney)) TractMoney
         --select top 1 * from FNCusTractRec
         --select top 1 * from HrPerson
         from FNCusTractRec ctr, HrPerson hp
         where ctr.PersonID=hp.ID
         and CONVERT(VARCHAR(7),ctr.TractDate,120)='2005-03'
         group by hp.DepartID
         --order by hp.DepartID
         ) bb,--各部门销售人员销售业绩汇总(本月)
         (select hp.DepartID, SUM(CONVERT(FLOAT,ctr.TractMoney)) TractMoney_Today
         --select top 1 * from FNCusTractRec
         --select top 1 * from HrPerson
         from FNCusTractRec ctr, HrPerson hp
         where ctr.PersonID=hp.ID
         and CONVERT(VARCHAR(10),ctr.TractDate,120)='2005-03-16'
         group by hp.DepartID
         --order by hp.DepartID
         ) cc--各部门销售人员销售业绩汇总(本日)
         where aa.DepartID *=bb.DepartID
         and aa.DepartID *=cc.DepartID
         */
        SQL = "select aa.DepartID, aa.DepartName, aa.PersonName, aa.PersonExt, " + "aa.ManagerDestMoney, ISNULL(bb.TractMoney,0) TractMoney, ISNULL(cc.TractMoney_Today,0) TractMoney_Today, "
                        + "(case when aa.ManagerDestMoney=0 then 0.00 else ISNULL(bb.TractMoney,0)/(aa.ManagerDestMoney*1.00) end) DestAchieveRate " + "from(select sde.DeptID DepartID, sde.DepartName, ISNULL(sde.SaleDest,0) ManagerDestMoney, "
                        + "hp.name PersonName, hp.OfficePhone_Ext PersonExt " + "from SaleMoneyDest_Dept_EveryMonth sde, HrPerson hp " + "where sde.ManagerPerID=hp.ID " + "and  sde.YearNum='" + strYear + "' " + "and  sde.MonthNum='" + strIMonth + "' "
                        + ") aa, " + "(select hp.DepartID, SUM(CONVERT(FLOAT,ctr.TractMoney)) TractMoney " + "from FNCusTractRec ctr, HrPerson hp " + "where ctr.PersonID=hp.ID " + "and CONVERT(VARCHAR(7),ctr.TractDate,120)='" + strYearMonth + "' "
                        + "group by hp.DepartID " + ") bb, " + "(select hp.DepartID, SUM(CONVERT(FLOAT,ctr.TractMoney)) TractMoney_Today " + "from FNCusTractRec ctr, HrPerson hp  " + "where ctr.PersonID=hp.ID "
                        + "and CONVERT(VARCHAR(10),ctr.TractDate,120)='" + strDate.substring(0, 10) + "' " + "group by hp.DepartID " + ") cc " + "where aa.DepartID *=bb.DepartID " + "and aa.DepartID *=cc.DepartID ";
        //System.out.println(SQL);
        try {
            DBConn = db.connect();
            stmt = DBConn.createStatement();
            RS = stmt.executeQuery(SQL + " order by convert(int,aa.DepartID) asc");
            while (RS.next()) {
                DepartName = RS.getString("DepartName");
                TractMoney = RS.getInt("TractMoney");
                TractMoney_Today = RS.getInt("TractMoney_Today");
                deptChartData = deptChartData + DepartName.replaceAll("销售", "") + "," + Integer.toString(TractMoney) + ",";
                deptDayChartData = deptDayChartData + DepartName.replaceAll("销售", "") + "," + Integer.toString(TractMoney_Today) + ",";
            }

            deptChartData = deptChartData.substring(0, deptChartData.length() - 1);
            deptDayChartData = deptDayChartData.substring(0, deptDayChartData.length() - 1);

            RS.close();
            //stmt.close();

            sb.append("<body topmargin='0' leftmargin='0'>\n");
            sb.append("<br>\n");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -