fix
This commit is contained in:
parent
9f9a65557d
commit
2f0065e609
@ -35,14 +35,14 @@ namespace BankBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { entry.CardNumber.ToString(), entry.DateCreate.ToShortDateString(), entry.ComputerName, entry.Sum.ToString(), entry.OrderStatus.ToString() },
|
||||
Texts = new List<string> { entry.CardNumber.ToString(), },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.OperationsRequests.Sum(x => x.Sum)}\t",
|
||||
Text = "",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment =
|
||||
PdfParagraphAlignmentType.Right
|
||||
@ -75,14 +75,14 @@ namespace BankBusinessLogic.OfficePackage
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { entry.CardNumber.ToString(), entry.DateCreate.ToShortDateString(), entry.ComputerName, entry.Sum.ToString(), entry.OrderStatus.ToString() },
|
||||
Texts = new List<string> { entry.CardNumber.ToString(), },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.OperationsRequests.Sum(x => x.Sum)}\t",
|
||||
Text = "",
|
||||
Style = "Normal",
|
||||
ParagraphAlignment =
|
||||
PdfParagraphAlignmentType.Right
|
||||
|
@ -16,13 +16,13 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
private Body? _docBody;
|
||||
|
||||
/// <summary>
|
||||
/// Получение типа выравнивания
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private static JustificationValues
|
||||
GetJustificationValues(WordJustificationType type)
|
||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
@ -31,6 +31,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Настройки страницы
|
||||
/// </summary>
|
||||
@ -45,13 +46,13 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
properties.AppendChild(pageSize);
|
||||
return properties;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Задание форматирования для абзаца
|
||||
/// </summary>
|
||||
/// <param name="paragraphProperties"></param>
|
||||
/// <returns></returns>
|
||||
private static ParagraphProperties?
|
||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
{
|
||||
if (paragraphProperties == null)
|
||||
{
|
||||
@ -80,6 +81,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
return properties;
|
||||
}
|
||||
|
||||
protected override void CreateWord(WordInfo info)
|
||||
{
|
||||
_wordDocument = WordprocessingDocument.Create(info.FileName,
|
||||
@ -88,6 +90,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
mainPart.Document = new Document();
|
||||
_docBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
protected override void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
@ -117,6 +120,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
}
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
|
||||
protected override void SaveWord(WordInfo info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
@ -126,6 +130,86 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CreateTable(WordTable table)
|
||||
{
|
||||
if (_docBody == null || table == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Table docTable = new Table();
|
||||
TableProperties tableProps = new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new BottomBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new LeftBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new RightBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideHorizontalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideVerticalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
}
|
||||
)
|
||||
);
|
||||
docTable.AppendChild(tableProps);
|
||||
TableGrid tableGrid = new TableGrid();
|
||||
for (int i = 0; i < table.Columns; i++)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn());
|
||||
}
|
||||
docTable.AppendChild(tableGrid);
|
||||
TableRow tableRow = new TableRow();
|
||||
foreach (var text in table.Headers)
|
||||
{
|
||||
tableRow.AppendChild(CreateTableCell(text));
|
||||
}
|
||||
int height = table.RowText.Count;
|
||||
int width = table.Columns;
|
||||
docTable.AppendChild(tableRow);
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
tableRow = new TableRow();
|
||||
for (int j = 0; j < width; j++)
|
||||
{
|
||||
var element = table.RowText[i][j];
|
||||
tableRow.AppendChild(CreateTableCell(element));
|
||||
}
|
||||
docTable.AppendChild(tableRow);
|
||||
}
|
||||
_docBody.AppendChild(docTable);
|
||||
}
|
||||
|
||||
private TableCell CreateTableCell(string element)
|
||||
{
|
||||
var tableParagraph = new Paragraph();
|
||||
var run = new Run();
|
||||
run.AppendChild(new Text { Text = element });
|
||||
tableParagraph.AppendChild(run);
|
||||
var tableCell = new TableCell();
|
||||
tableCell.AppendChild(tableParagraph);
|
||||
return tableCell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -462,17 +462,21 @@ namespace BankManagersClientApp.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region//работа с отчётами
|
||||
#region//Reports
|
||||
[HttpGet]
|
||||
|
||||
public IActionResult RequestsListReport()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
ViewBag.Accounts = APIClient.GetRequest<List<AccountViewModel>>($"api/account/getaccountlist?managerid={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult TransfersWithdrawalsListReport()
|
||||
[HttpGet]
|
||||
public IActionResult TransfersWithdrawalsListReport()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Список заяыок по счетам</h2>
|
||||
<h2 class="display-4">Список заявок по счетам</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
@ -18,10 +18,11 @@
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<asp:RadioButton id="Word" name="Word" GroupName="format">Получить в формате Word</asp:RadioButton>
|
||||
<asp:RadioButton id="Excel" name="Excel" GroupName="format">Получить в формате Excel</asp:RadioButton>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-9"></div>
|
||||
<div class="col-1"><input type="submit" value="Получить в формате Word" class="btn btn-primary" /></div>
|
||||
<div class="col-1"><input type="submit" value="Получить в формате Excel" class="btn btn-primary" /></div>
|
||||
<div class="col-9" />
|
||||
<div class="col-1"><input type="submit" value="Получить список" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user