init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,88 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.Core.ConnectionType;
|
||||
using Kreta.Resources;
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace Kreta.BusinessLogic.Helpers.Nyomtatvanyok.Excel
|
||||
{
|
||||
public class PedagogusokBeNemIrtOraiHaviBontasban : BaseNyomtatvanyExcel
|
||||
{
|
||||
public PedagogusokBeNemIrtOraiHaviBontasban(IConnectionType connectionType, bool isMultisheetExcel = false) : base(connectionType, isMultisheetExcel)
|
||||
{
|
||||
StoredProcedure = "uspGetNemNaplozottOrakSzama";
|
||||
ExcelPackage = new ExcelPackage();
|
||||
|
||||
//Munkalap tulajdonságok beállítása
|
||||
SetWorkbookProperties();
|
||||
}
|
||||
|
||||
public override void CreateSheet(Dictionary<string, string> dbParameters, int sheetIndex = 1)
|
||||
{
|
||||
DbParameters = dbParameters;
|
||||
|
||||
// Adatforrás összeállítása
|
||||
SetExcelDataSet();
|
||||
|
||||
var table = DataSet.Tables[0];
|
||||
|
||||
var rows = table.Rows.Cast<DataRow>();
|
||||
|
||||
var groupByTanarRows = rows.GroupBy(g => g["Tanar"])
|
||||
.Select(s =>
|
||||
new
|
||||
{
|
||||
Tanar = SDAConvert.ToString(s.Key),
|
||||
Data = s
|
||||
}).OrderBy(o => o.Tanar).ToList();
|
||||
|
||||
// Munkalap összeállítása
|
||||
var worksheet = CreateSheet(ExcelNyomtatvanyResource.Osszesito, 1, eOrientation.Landscape, true, 2);
|
||||
worksheet.Column(1).Width = 35;
|
||||
worksheet.Column(2).Width = 13;
|
||||
|
||||
AddLabelCell(worksheet, 1, 1, ExcelNyomtatvanyResource.Pedagogusok, HeaderStyleBottomBorderedBGGray);
|
||||
AddLabelCell(worksheet, 1, 2, NyomtatvanyokResource.OktAzon, HeaderStyleBottomBorderedBGGray);
|
||||
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
worksheet.Column(2 + i).Width = 6;
|
||||
|
||||
AddLabelCell(worksheet, 1, 2 + i, GetHonapTextForIndex(i), HeaderStyleBottomBorderedBGGray);
|
||||
}
|
||||
|
||||
AddLabelCell(worksheet, 1, 13, AdatszolgaltatasokResource.Osszesen, HeaderStyleBottomBorderedBGGray);
|
||||
|
||||
var rowIndex = 2;
|
||||
|
||||
foreach (var tanarGroup in groupByTanarRows)
|
||||
{
|
||||
AddLabelCell(worksheet, rowIndex, 1, tanarGroup.Tanar, NormalStyleBottomBordered);
|
||||
AddLabelCell(worksheet, rowIndex, 2, tanarGroup.Data.Select(s => SDAConvert.ToString(s["TanarOktAzon"])).FirstOrDefault(), NormalStyleBottomBordered);
|
||||
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
var value = tanarGroup.Data.Where(x => SDAConvert.ToString(x["Honap"]) == GetHonapTextForIndex(i))
|
||||
.Select(s => SDAConvert.ToNullableInt32(s["Darab"])).FirstOrDefault();
|
||||
|
||||
AddNumberCell(worksheet, rowIndex, 2 + i, value, IntegerStyleBottomBordered);
|
||||
}
|
||||
|
||||
AddAggregateFormulaCell(worksheet, rowIndex, 13, "SUM", rowIndex, 2, rowIndex, 12, true, IntegerStyleBottomBordered);
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
AddLabelRange(worksheet, rowIndex, 11, rowIndex, 12, AdatszolgaltatasokResource.Osszesen, HeaderStyleBottomBorderedBGGray);
|
||||
AddAggregateFormulaCell(worksheet, rowIndex, 13, "SUM", 2, 13, rowIndex - 1, 13, true, IntegerStyleBottomBordered);
|
||||
}
|
||||
|
||||
// 09, 10, 11, 12, 01, 02, 03, 04, 05, 06
|
||||
private static string GetHonapTextForIndex(int index)
|
||||
{
|
||||
return (index + 8 > 12 ? index - 4 : index + 8).ToString("00");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue