Exemplo n.º 1
0
        /// <summary>
        /// 导出业务---》管理 关系
        /// </summary>
        /// <param name="period"></param>
        /// <returns></returns>
        public FileResult BusinessToAch(string period)
        {
            var obj      = new v_AchievementBusinessDepartMappingVersionExportDto();
            var dataList = _purchaseOrderService.GetBusinessToAchMappingVersion(period);

            using (var excelPackage = new ExcelPackage())
            {
                var sheet1 = excelPackage.Workbook.Worksheets.Add("业务架构-管理架构对应关系");
                EpPlusHelper.AddHeader(sheet1,
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.Year)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.Month)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.BusinessDepartID)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.BusinessDepartName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.AchievementDepartID)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.AchievementDepartName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <v_AchievementBusinessDepartMappingVersionExportDto>(s => s.Status))
                                       );
                EpPlusHelper.AddObjects(
                    sheet1, 2, dataList,
                    _ => _.Year,
                    _ => _.Month,
                    _ => _.BusinessDepartID,
                    _ => _.BusinessDepartName,
                    _ => _.AchievementDepartID,
                    _ => _.AchievementDepartName,
                    _ => _.Status == 0?"正常":"失效"
                    );

                var    sss       = excelPackage.GetAsByteArray();
                string sFileName = $"业务架构-管理架构对应关系{DateTime.Now}.xlsx";
                return(File(sss, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: sFileName));
            }
        }
Exemplo n.º 2
0
        public FileResult ExportVersion(string period)
        {
            var obj      = new PurchaseRequirementDeptShareRatioVersionExportDto();
            var dataList = _purchaseOrderService.GetPurchaseRequirementDeptShareRatioVersions(period);

            using (var excelPackage = new ExcelPackage())
            {
                var sheet1 = excelPackage.Workbook.Worksheets.Add("集采需求拆分");
                EpPlusHelper.AddHeader(sheet1,
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.POCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.POLineNum)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.Period)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.PRCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.PECode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.DepartID)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.DepartNamePath)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.ShareProportion)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <PurchaseRequirementDeptShareRatioVersionExportDto>(s => s.CreateTime))
                                       );
                EpPlusHelper.AddObjects(
                    sheet1, 2, dataList,
                    _ => _.POCode,
                    _ => _.POLineNum,
                    _ => _.Period,
                    _ => _.PRCode,
                    _ => _.PECode,
                    _ => _.DepartID,
                    _ => _.DepartNamePath,
                    _ => _.ShareProportion,
                    _ => _.CreateTime
                    );

                var createTimeColumn = sheet1.Column(9);
                createTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";
                createTimeColumn.AutoFit();

                var    sss       = excelPackage.GetAsByteArray();
                string sFileName = $"集采需求拆分{DateTime.Now}.xlsx";
                return(File(sss, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: sFileName));
            }
        }
Exemplo n.º 3
0
        public FileResult ExportSplit(int expenseType, string period)
        {
            var obj      = new ExpenseAccountExportDto();
            var dataList = _expenseService.GetExpenseAccountExportDtos(expenseType, period);

            var _dic = EnumHelper.GetValueAndDesc <CommonEnum.EnumCostAccountSplitStep>();

            using (var excelPackage = new ExcelPackage())
            {
                foreach (var d in _dic)
                {
                    var sheet1 = excelPackage.Workbook.Worksheets.Add(d.Value);
                    EpPlusHelper.AddHeader(sheet1,
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ExpenseCode)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ExpenseLineNum)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.DepartID)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.DepartNamePath)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Period)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Amount)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.MaterialClassCode)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.MaterialClassName)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.MaterialCode)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.MaterialName)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ExpenseItem)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ExpenseItemName)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ProjectCode)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ProjectName)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.CompanyCode)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.CompanyName)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Status)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Ratio)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Step)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.Formula)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.IsClose)),
                                           obj.GetDescription(ClassHelper.GetPropertyName <ExpenseAccountExportDto>(s => s.ExpenseTypeName))
                                           );
                    EpPlusHelper.AddObjects(
                        sheet1, 2, dataList.Where(s => s.Step == d.Key).ToList(),
                        _ => _.ExpenseCode,
                        _ => _.ExpenseLineNum,
                        _ => _.DepartID,
                        _ => _.DepartNamePath,
                        _ => _.Period,
                        _ => _.Amount,
                        _ => _.MaterialClassCode,
                        _ => _.MaterialClassName,
                        _ => _.MaterialCode,
                        _ => _.MaterialName,
                        _ => _.ExpenseItem,
                        _ => _.ExpenseItemName,
                        _ => _.ProjectCode,
                        _ => _.ProjectName,
                        _ => _.CompanyCode,
                        _ => _.CompanyName,
                        _ => _.Status,
                        _ => _.Ratio,
                        _ => _.StepName,
                        _ => _.Formula,
                        _ => _.IsClose,
                        _ => _.ExpenseTypeName
                        );
                }

                var    sss       = excelPackage.GetAsByteArray();
                string sFileName = $"费用-导出拆分结果{DateTime.Now}.xlsx";
                return(File(sss, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: sFileName));
            }
        }
Exemplo n.º 4
0
        public FileResult ExportHistory(int expenseType, string period)
        {
            var obj      = new ExpenseLineConfirmHistoryExportDto();
            var dataList = _expenseService.GetExpenseHistory(expenseType, period);

            using (var excelPackage = new ExcelPackage())
            {
                var sheet1 = excelPackage.Workbook.Worksheets.Add("费用月成本历史表");
                EpPlusHelper.AddHeader(sheet1,
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ExpenseCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ExpenseLineNum)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.DepartID)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.DepartNamePath)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Period)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Amount)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.MaterialClassCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.MaterialClassName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.MaterialCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.MaterialName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ExpenseItem)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ExpenseItemName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ProjectCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.ProjectName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.CompanyCode)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.CompanyName)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Status)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Ratio)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Step)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.Formula)),
                                       obj.GetDescription(ClassHelper.GetPropertyName <ExpenseLineConfirmHistoryExportDto>(s => s.IsClose))
                                       );
                EpPlusHelper.AddObjects(
                    sheet1, 2, dataList.ToList(),
                    _ => _.ExpenseCode,
                    _ => _.ExpenseLineNum,
                    _ => _.DepartID,
                    _ => _.DepartNamePath,
                    _ => _.Period,
                    _ => _.Amount,
                    _ => _.MaterialClassCode,
                    _ => _.MaterialClassName,
                    _ => _.MaterialCode,
                    _ => _.MaterialName,
                    _ => _.ExpenseItem,
                    _ => _.ExpenseItemName,
                    _ => _.ProjectCode,
                    _ => _.ProjectName,
                    _ => _.CompanyCode,
                    _ => _.CompanyName,
                    _ => _.Status,
                    _ => _.Ratio,
                    _ => _.Step,
                    _ => _.Formula,
                    _ => _.IsClose
                    );

                var    sss       = excelPackage.GetAsByteArray();
                string sFileName = $"费用历史{DateTime.Now}.xlsx";
                return(File(sss, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: sFileName));
            }
        }
Exemplo n.º 5
0
        public FileResult ExportHistory(string period)
        {
            var objHistory = new PurchaseOrderLineConfirmHistoryExportDto();
            var dataList   = _purchaseOrderService.GetPurchaseOrderLineConfirmHistory(period);

            using (var excelPackage = new ExcelPackage())
            {
                var sheet1 = excelPackage.Workbook.Worksheets.Add("成本支出月成本历史表");
                EpPlusHelper.AddHeader(sheet1,
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POCode)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POLineNum)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.Period)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.Amount)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.MaterialClassName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.MaterialName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.ExpenseItemName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.ProjectCode)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.ProjectType)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.ProjectName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.CompanyName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.DepartNamePath)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.SupplierName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.ContentTypeName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.OrderEnumName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.CreateTime)),


                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.PRCode)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.PRDepartID)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.PRDepartNamePath)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POCreateTime)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POLineAmount)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POLineBeginTime)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.POLineEndTime)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.CustID)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.CustName)),
                                       objHistory.GetDescription(ClassHelper.GetPropertyName <PurchaseOrderLineConfirmHistoryExportDto>(s => s.TaxCode))
                                       );
                EpPlusHelper.AddObjects(sheet1, 2, dataList,
                                        _ => _.POCode,
                                        _ => _.POLineNum,
                                        _ => _.Period,
                                        _ => _.Amount,
                                        _ => _.MaterialClassName,
                                        _ => _.MaterialName,
                                        _ => _.ExpenseItemName,
                                        _ => _.ProjectCode,
                                        _ => _.ProjectType,
                                        _ => _.ProjectName,
                                        _ => _.CompanyName,
                                        _ => _.DepartNamePath,
                                        _ => _.SupplierName,
                                        _ => _.ContentTypeName,
                                        _ => _.OrderEnumName,
                                        _ => _.CreateTime,
                                        _ => _.PRCode,
                                        _ => _.PRDepartID,
                                        _ => _.PRDepartNamePath,
                                        _ => _.POCreateTime,
                                        _ => _.POLineAmount,
                                        _ => _.POLineBeginTime,
                                        _ => _.POLineEndTime,
                                        _ => _.CustID,
                                        _ => _.CustName,
                                        _ => _.TaxCode
                                        );
                var createTimeColumn = sheet1.Column(16);
                createTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";
                createTimeColumn.AutoFit();
                //excelPackage.Save();

                var    sss       = excelPackage.GetAsByteArray();
                string sFileName = $"成本支出{DateTime.Now}.xlsx";
                return(File(sss, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileDownloadName: sFileName));
            }
        }