Ejemplo n.º 1
0
        private void TemplateBuildStringWriter(Application excel)
        {
            excel.Cells[1, 1]  = EmployeeWelfare.ConstParemeter.Name;
            excel.Cells[1, 2]  = EmployeeWelfare.ConstParemeter.SocialType;
            excel.Cells[1, 3]  = EmployeeWelfare.ConstParemeter.SocialBase;
            excel.Cells[1, 4]  = EmployeeWelfare.ConstParemeter.SocialYM;
            excel.Cells[1, 5]  = EmployeeWelfare.ConstParemeter.FundAccount;
            excel.Cells[1, 6]  = EmployeeWelfare.ConstParemeter.FundBase;
            excel.Cells[1, 7]  = EmployeeWelfare.ConstParemeter.FundYM;
            excel.Cells[1, 8]  = EmployeeWelfare.ConstParemeter.SupplyAccount;
            excel.Cells[1, 9]  = EmployeeWelfare.ConstParemeter.SupplyBase;
            excel.Cells[1, 10] = EmployeeWelfare.ConstParemeter.YangLaoBase;
            excel.Cells[1, 11] = EmployeeWelfare.ConstParemeter.ShiYeBase;
            excel.Cells[1, 12] = EmployeeWelfare.ConstParemeter.YiLiaoBase;

            for (int i = 0; i < EmployeeWelfareListViewState.Count; i++)
            {
                int j = i + 2;
                excel.Cells[j, 1] = EmployeeWelfareListViewState[i].Owner.Name;
                excel.Cells[j, 2] = EmployeeWelfareListViewState[i].SocialSecurity.Type.Name;
                excel.Cells[j, 3] = EmployeeWelfareListViewState[i].SocialSecurity.Base;
                if (EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth != null)
                {
                    List <string> SocialSecurityYearMonth =
                        EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth);
                    excel.Cells[j, 4] =
                        string.Format("{0}年{1}月", SocialSecurityYearMonth[0], SocialSecurityYearMonth[1]);
                }

                excel.Cells[j, 5] = "'" + EmployeeWelfareListViewState[i].AccumulationFund.Account;
                excel.Cells[j, 6] = EmployeeWelfareListViewState[i].AccumulationFund.Base;

                if (EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth != null)
                {
                    List <string> AccumulationFundYearMonth =
                        EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth);
                    excel.Cells[j, 7] =
                        string.Format("{0}年{1}月", AccumulationFundYearMonth[0], AccumulationFundYearMonth[1]);
                }

                excel.Cells[j, 8]  = "'" + EmployeeWelfareListViewState[i].AccumulationFund.SupplyAccount;
                excel.Cells[j, 9]  = EmployeeWelfareListViewState[i].AccumulationFund.SupplyBase;
                excel.Cells[j, 10] = EmployeeWelfareListViewState[i].SocialSecurity.YangLaoBase;
                excel.Cells[j, 11] = EmployeeWelfareListViewState[i].SocialSecurity.ShiYeBase;
                excel.Cells[j, 12] = EmployeeWelfareListViewState[i].SocialSecurity.YiLiaoBase;
            }
        }
Ejemplo n.º 2
0
 private bool HandleWelfare()
 {
     if (_TheDataToBind.EmployeeWelfare != null)
     {
         _ItsView.AccumulationFundBase          = _TheDataToBind.EmployeeWelfare.AccumulationFund.Base.ToString();
         _ItsView.AccumulationFundAccount       = _TheDataToBind.EmployeeWelfare.AccumulationFund.Account;
         _ItsView.AccumulationFundSupplyAccount = _TheDataToBind.EmployeeWelfare.AccumulationFund.SupplyAccount;
         _ItsView.AccumulationFundSupplyBase    = _TheDataToBind.EmployeeWelfare.AccumulationFund.SupplyBase.ToString();
         _ItsView.AccumulationFundYearMonth     =
             EmployeeWelfare.YearAndMonth(_TheDataToBind.EmployeeWelfare.AccumulationFund.EffectiveYearMonth);
         _ItsView.SocialSecurityBase      = _TheDataToBind.EmployeeWelfare.SocialSecurity.Base.ToString();
         _ItsView.YangLaoBase             = _TheDataToBind.EmployeeWelfare.SocialSecurity.YangLaoBase.ToString();
         _ItsView.ShiYeBase               = _TheDataToBind.EmployeeWelfare.SocialSecurity.ShiYeBase.ToString();
         _ItsView.YiLiaoBase              = _TheDataToBind.EmployeeWelfare.SocialSecurity.YiLiaoBase.ToString();
         _ItsView.SocialSecurityType      = _TheDataToBind.EmployeeWelfare.SocialSecurity.Type;
         _ItsView.SocialSecurityYearMonth =
             EmployeeWelfare.YearAndMonth(_TheDataToBind.EmployeeWelfare.SocialSecurity.EffectiveYearMonth);
     }
     _ItsView.EmployeeWelfareHistory = _TheDataToBind.EmployeeWelfareHistory;
     return(true);
 }
Ejemplo n.º 3
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            var          workbook  = new HSSFWorkbook();
            MemoryStream ms        = new MemoryStream();
            HSSFSheet    sheet     = workbook.CreateSheet() as HSSFSheet;
            HSSFRow      headerRow = sheet.CreateRow(0) as HSSFRow;

            headerRow.CreateCell(0).SetCellValue(EmployeeWelfare.ConstParemeter.Name);
            headerRow.CreateCell(1).SetCellValue(EmployeeWelfare.ConstParemeter.SocialType);
            headerRow.CreateCell(2).SetCellValue(EmployeeWelfare.ConstParemeter.SocialBase);
            headerRow.CreateCell(3).SetCellValue(EmployeeWelfare.ConstParemeter.SocialYM);
            headerRow.CreateCell(4).SetCellValue(EmployeeWelfare.ConstParemeter.FundAccount);
            headerRow.CreateCell(5).SetCellValue(EmployeeWelfare.ConstParemeter.FundBase);
            headerRow.CreateCell(6).SetCellValue(EmployeeWelfare.ConstParemeter.FundYM);
            headerRow.CreateCell(7).SetCellValue(EmployeeWelfare.ConstParemeter.SupplyAccount);
            headerRow.CreateCell(8).SetCellValue(EmployeeWelfare.ConstParemeter.SupplyBase);
            headerRow.CreateCell(9).SetCellValue(EmployeeWelfare.ConstParemeter.YangLaoBase);
            headerRow.CreateCell(10).SetCellValue(EmployeeWelfare.ConstParemeter.ShiYeBase);
            headerRow.CreateCell(11).SetCellValue(EmployeeWelfare.ConstParemeter.YiLiaoBase);
            // handling value.
            int rowIndex = 1;

            for (int i = 0; i < EmployeeWelfareListViewState.Count; i++)
            {
                HSSFRow dataRow = sheet.CreateRow(rowIndex) as HSSFRow;
                dataRow.CreateCell(0).SetCellValue(EmployeeWelfareListViewState[i].Owner.Name);
                dataRow.CreateCell(1).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.Type.Name);
                dataRow.CreateCell(2).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.Base.ToString());
                if (EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth != null)
                {
                    List <string> SocialSecurityYearMonth =
                        EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].SocialSecurity.EffectiveYearMonth);
                    dataRow.CreateCell(3).SetCellValue(string.Format("{0}年{1}月", SocialSecurityYearMonth[0], SocialSecurityYearMonth[1]));
                }
                dataRow.CreateCell(4).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.Account);
                dataRow.CreateCell(5).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.Base.ToString());

                if (EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth != null)
                {
                    List <string> AccumulationFundYearMonth =
                        EmployeeWelfare.YearAndMonth(EmployeeWelfareListViewState[i].AccumulationFund.EffectiveYearMonth);
                    dataRow.CreateCell(6).SetCellValue(string.Format("{0}年{1}月", AccumulationFundYearMonth[0], AccumulationFundYearMonth[1]));
                }
                dataRow.CreateCell(7).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.SupplyAccount);
                dataRow.CreateCell(8).SetCellValue(EmployeeWelfareListViewState[i].AccumulationFund.SupplyBase.ToString());
                dataRow.CreateCell(9).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.YangLaoBase.ToString());
                dataRow.CreateCell(10).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.ShiYeBase.ToString());
                dataRow.CreateCell(11).SetCellValue(EmployeeWelfareListViewState[i].SocialSecurity.YiLiaoBase.ToString());

                rowIndex++;
            }

            workbook.Write(ms);
            ms.Flush();
            ms.Position = 0;

            sheet     = null;
            headerRow = null;
            workbook  = null;
            ExcelExportUtility.OutputExcel(Server, Response, "员工福利表", ms);
            // Export("员工福利表.xls");
        }
Ejemplo n.º 4
0
 private void SearchEmployeeWelfare()
 {
     try
     {
         List <EmployeeWelfare> employeeWelfarelist = new List <EmployeeWelfare>();
         //List<Employee> employeeList =
         //    _IEmployeeFacade.GetEmployeeBasicInfoByBasicCondition(_View.EmployeeName, _View.EmployeeType,
         //                                                          _View.PositionId, _View.DepartmentId,
         //                                                          _View.RecursionDepartment,
         //                                                          Convert.ToInt32(_View.EmployeeStatusId),
         //                                                          _View.CompanyId);
         //employeeList =
         //    HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Operator, HrmisPowers.A605);
         List <Employee> employeeList =
             EmployeeLogic.GetEmployeeBasicInfoByBasicConditionRetModel(_View.EmployeeName, _View.EmployeeType,
                                                                        _View.PositionId, null,
                                                                        _View.DepartmentId, _View.CompanyId, _View.RecursionDepartment, HrmisPowers.A605, _Operator.Id,
                                                                        Convert.ToInt32(_View.EmployeeStatusId), null);
         if (employeeList != null)
         {
             foreach (Employee employee in employeeList)
             {
                 EmployeeWelfare welfare =
                     _IEmployeeWelfareFacade.GetEmployeeWelfareByAccountID(employee.Account.Id);
                 if (welfare == null)
                 {
                     welfare = EmployeeWelfare.EmptyWelfare();
                 }
                 welfare.AccumulationFund.BaseTemp = welfare.AccumulationFund.Base == null
                                                         ? ""
                                                         : welfare.AccumulationFund.Base.ToString();
                 welfare.AccumulationFund.SupplyBaseTemp = welfare.AccumulationFund.SupplyBase == null
                                                         ? ""
                                                         : welfare.AccumulationFund.SupplyBase.ToString();
                 welfare.SocialSecurity.BaseTemp = welfare.SocialSecurity.Base == null
                                                       ? ""
                                                       : welfare.SocialSecurity.Base.ToString();
                 welfare.SocialSecurity.YangLaoBaseTemp = welfare.SocialSecurity.YangLaoBase == null
                                                       ? ""
                                                       : welfare.SocialSecurity.YangLaoBase.ToString();
                 welfare.SocialSecurity.ShiYeBaseTemp = welfare.SocialSecurity.ShiYeBase == null
                                                       ? ""
                                                       : welfare.SocialSecurity.ShiYeBase.ToString();
                 welfare.SocialSecurity.YiLiaoBaseTemp = welfare.SocialSecurity.YiLiaoBase == null
                                                       ? ""
                                                       : welfare.SocialSecurity.YiLiaoBase.ToString();
                 welfare.AccumulationFund.EffectiveYearMonthTemp =
                     EmployeeWelfare.YearAndMonth(welfare.AccumulationFund.EffectiveYearMonth);
                 welfare.SocialSecurity.EffectiveYearMonthTemp =
                     EmployeeWelfare.YearAndMonth(welfare.SocialSecurity.EffectiveYearMonth);
                 welfare.Owner = employee.Account;
                 employeeWelfarelist.Add(welfare);
             }
         }
         _View.EmployeeWelfareList = employeeWelfarelist;
         _View.Message             =
             string.Format(
                 "<span class='font14b'>共查到 </span><span class='fontred'>{0}</span><span class='font14b'> 条信息</span>",
                 employeeList == null ? 0 : employeeList.Count);
     }
     catch (Exception ex)
     {
         _View.Message = string.Format("<span class='fontred'>{0}</span>", ex.Message);
     }
 }