2023-07-24 11:14:07 +05:00
|
|
|
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
|
|
using ClosedXML.Excel;
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
|
|
|
|
|
|
public class HeadExcelBlockWriter : IExcelBlockWriter
|
|
|
|
{
|
2023-07-24 16:27:31 +05:00
|
|
|
private static readonly (int, int) customerCell = (2, 2);
|
|
|
|
private static readonly (int, int) depositCell = (4, 2);
|
|
|
|
private static readonly (int, int) clusterCell = (5, 2);
|
|
|
|
private static readonly (int, int) wellCell = (6, 2);
|
2023-07-24 11:14:07 +05:00
|
|
|
|
2023-07-24 16:27:31 +05:00
|
|
|
private const int dateRow = 9;
|
|
|
|
private const int dateFromColumn = 2;
|
|
|
|
private const int dateFromToColumn = 3;
|
2023-07-24 11:14:07 +05:00
|
|
|
|
2023-07-24 16:27:31 +05:00
|
|
|
private const int depthRow = 10;
|
|
|
|
private const int depthFromColumn = 2;
|
|
|
|
private const int depthToColumn = 3;
|
|
|
|
|
2023-07-24 11:14:07 +05:00
|
|
|
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
|
|
|
|
{
|
2023-07-24 16:27:31 +05:00
|
|
|
sheet.Cell(customerCell.Item1, customerCell.Item2).Value = report.Head.Customer;
|
|
|
|
sheet.Cell(depositCell.Item1, depositCell.Item2).Value = report.Head.Deposit;
|
2023-07-25 17:07:50 +05:00
|
|
|
sheet.Cell(clusterCell.Item1, clusterCell.Item2).Value = report.Head.Cluster;
|
|
|
|
sheet.Cell(wellCell.Item1, wellCell.Item2).Value = report.Head.Well;
|
2023-07-24 11:14:07 +05:00
|
|
|
|
2023-07-25 17:07:50 +05:00
|
|
|
sheet.Cell(dateRow, dateFromColumn).Value = report.ReportDate;
|
|
|
|
sheet.Cell(dateRow, dateFromToColumn).Value = report.ReportDate.AddDays(1);
|
2023-07-24 11:14:07 +05:00
|
|
|
|
2023-07-25 17:07:50 +05:00
|
|
|
sheet.Cell(depthRow, depthFromColumn).Value = report.Head.DepthFrom;
|
|
|
|
sheet.Cell(depthRow, depthToColumn).Value = report.Head.DepthTo;
|
2023-07-24 11:14:07 +05:00
|
|
|
}
|
|
|
|
}
|