Emp report update

This commit is contained in:
Илья Федотов 2024-08-01 16:03:03 +04:00
parent 12188b768d
commit 45cf0818fc
5 changed files with 95 additions and 10 deletions

View File

@ -87,6 +87,8 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{ {
Title = "Список оплат электротоваров", Title = "Список оплат электротоваров",
ListProduct = GetProducts(model), ListProduct = GetProducts(model),
DateTo = model.DateTo,
DateFrom = model.DateFrom
}); });
return document; return document;
} }
@ -110,7 +112,9 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{ {
var document = _saveToWord.CreateDoc(new WordInfoEmployee { var document = _saveToWord.CreateDoc(new WordInfoEmployee {
Title = "Список оплат электротоваров", Title = "Список оплат электротоваров",
ListProduct = GetProducts(model) ListProduct = GetProducts(model),
DateFrom = model.DateFrom,
DateTo = model.DateTo,
}); });
return document; return document;
} }

View File

@ -23,7 +23,19 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
CellToName = "C1" CellToName = "C1"
}); });
uint rowIndex = 2; InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "A",
RowIndex = 2,
Text = $"С {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters {
CellFromName = "A2",
CellToName = "H2"
});
uint rowIndex = 3;
foreach (var product in info.ListProduct) { foreach (var product in info.ListProduct) {
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "A", ColumnName = "A",
@ -37,38 +49,92 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = "Номер оплаты:", Text = "Номер оплаты:",
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder,
}); });
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "C", ColumnName = "c",
RowIndex = rowIndex,
StyleInfo = ExcelStyleInfoType.TextWithBroder,
});
MergeCells(new ExcelMergeParameters {
CellFromName = $"B{rowIndex}",
CellToName = $"C{rowIndex}"
});
InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "D",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = paymeant.PaymeantID.ToString(), Text = paymeant.PaymeantID.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "D", ColumnName = "E",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = "В количестве:", Text = "В количестве:",
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder,
}); });
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "E", ColumnName = "F",
RowIndex = rowIndex,
StyleInfo = ExcelStyleInfoType.TextWithBroder,
});
MergeCells(new ExcelMergeParameters {
CellFromName = $"E{rowIndex}",
CellToName = $"F{rowIndex}"
});
InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "G",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = paymeant.ProducCount.ToString(), Text = paymeant.ProducCount.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "F", ColumnName = "H",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = "Статус оплаты:", Text = "Статус оплаты:",
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "G", ColumnName = "I",
RowIndex = rowIndex,
StyleInfo = ExcelStyleInfoType.TextWithBroder,
});
MergeCells(new ExcelMergeParameters {
CellFromName = $"H{rowIndex}",
CellToName = $"I{rowIndex}"
});
InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "J",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = paymeant.PaymeantStatus.ToString(), Text = paymeant.PaymeantStatus.ToString(),
StyleInfo = ExcelStyleInfoType.TextWithBroder StyleInfo = ExcelStyleInfoType.TextWithBroder
}); });
InsertCellInWorksheet(new ExcelCellParameters {
ColumnName = "k",
RowIndex = rowIndex,
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
MergeCells(new ExcelMergeParameters {
CellFromName = $"J{rowIndex}",
CellToName = $"K{rowIndex}"
});
rowIndex++; rowIndex++;
} }
InsertCellInWorksheet(new ExcelCellParameters { InsertCellInWorksheet(new ExcelCellParameters {

View File

@ -24,7 +24,16 @@ namespace ElectronicsShopBusinessLogic.OfficePackage
} }
}); });
foreach (var data in info.ListProduct) { CreateParagraph(new WordParagraph {
Texts = new List<(string, WordTextProperties)> { ($"С {info.DateFrom} по {info.DateTo}", new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties {
Size = "24",
JustificationType = WordJustificationType.Both
}
});
foreach (var data in info.ListProduct) {
CreateParagraph(new WordParagraph { CreateParagraph(new WordParagraph {
Texts = new List<(string, WordTextProperties)> { (data.ProductName, new WordTextProperties { Bold = true, Size = "24", }) }, Texts = new List<(string, WordTextProperties)> { (data.ProductName, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties { TextProperties = new WordTextProperties {

View File

@ -6,6 +6,9 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels
{ {
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List<ReportProductInPaymeantsViewModel> ListProduct { get; set; } = new(); public List<ReportProductInPaymeantsViewModel> ListProduct { get; set; } = new();
} }
} }

View File

@ -7,6 +7,9 @@ namespace ElectronicsShopBusinessLogic.OfficePackage.HelperModels
{ {
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List<ReportProductInPaymeantsViewModel> ListProduct { get; set; } = new(); public List<ReportProductInPaymeantsViewModel> ListProduct { get; set; } = new();
} }
} }