private void CreateCoverdDateSection(WeekReportModel report) { var coveredDate = _summarySheet.Cell(_summaryRowIndex, _summaryColumnIndex); coveredDate.Style.DateFormat.Format = "MMM dd, yyyy"; coveredDate.Value = report.From.ToString("MMM dd, yyyy") + " - " + report.To.ToString("MMM dd, yyyy"); coveredDate.Style.Font.FontSize = FontSize; }
public void ExportWeeklyReport(WeekReportModel report, string path) { XLWorkbook workbookForSaving = new XLWorkbook(); WorkSheetMaker maker = new WorkSheetMaker(workbookForSaving); maker.MakeWeeklySummary(report); foreach (var daily in report.DailyReports.Where(r => !r.IsTotalForEntireWeek)) { maker.Make(daily); } workbookForSaving.SaveAs(path); }
public IXLWorksheet MakeWeeklySummary(WeekReportModel report) { SetDefaultValues(); _summarySheet = _workbook.Worksheets.Add("Summary"); CreateCoverdDateSection(report); CreateSectionPerDay(report.DailyReports); CreateSummaryGrandTotalAmountSection(report); DrawLedger(); SetAutoAdjustToWeekSummaryContent(); return(_summarySheet); }
private void CreateSummaryGrandTotalAmountSection(WeekReportModel report) { _indexOfSummaryTotal = _indexOfSummaryTotal + 2; var totalLabel = _summarySheet.Cell(_indexOfSummaryTotal, 1); totalLabel.Value = "Grand Total"; totalLabel.DataType = XLCellValues.Text; totalLabel.Style.Font.FontSize = FontSize; totalLabel.Style.Font.Bold = true; var totalCell = _summarySheet.Cell(_indexOfSummaryTotal, 2); totalCell.Value = report.Total; totalCell.Style.NumberFormat.Format = "#,##0.00_);[Red](#,##0.00)"; totalCell.DataType = XLCellValues.Number; totalCell.Style.Font.FontSize = FontSize; _indexOfSummaryTotal++; var settledlabel = _summarySheet.Cell(_indexOfSummaryTotal, 1); settledlabel.Value = "Settled"; settledlabel.DataType = XLCellValues.Text; settledlabel.Style.Font.FontSize = FontSize; var settledCell = _summarySheet.Cell(_indexOfSummaryTotal, 2); settledCell.Value = report.Settled; settledCell.Style.NumberFormat.Format = "#,##0.00_);[Red](#,##0.00)"; settledCell.DataType = XLCellValues.Number; settledCell.Style.Font.FontSize = FontSize; _indexOfSummaryTotal++; var forFundingLabel = _summarySheet.Cell(_indexOfSummaryTotal, 1); forFundingLabel.Value = "For Funding"; forFundingLabel.DataType = XLCellValues.Text; forFundingLabel.Style.Font.FontSize = FontSize; var forFundingAmountCell = _summarySheet.Cell(_indexOfSummaryTotal, 2); forFundingAmountCell.Value = report.Remaining; forFundingAmountCell.Style.NumberFormat.Format = "#,##0.00_);[Red](#,##0.00)"; forFundingAmountCell.DataType = XLCellValues.Number; forFundingAmountCell.Style.Border.TopBorder = XLBorderStyleValues.Medium; forFundingAmountCell.Style.Font.FontSize = FontSize; }