- fix broken randon timesheet generator
- minor fixes
This commit is contained in:
@@ -86,9 +86,9 @@ public static class TimesheetIO
|
|||||||
|
|
||||||
foreach ((DateTime, DateTime, bool) tuple in timesheet.Value)
|
foreach ((DateTime, DateTime, bool) tuple in timesheet.Value)
|
||||||
{
|
{
|
||||||
worksheet.Cells[17 + tuple.Item1.Day, 2].Value = tuple.Item1.Hour + ":" + (tuple.Item1.Minute == 0 ? "00" : tuple.Item1.Minute.ToString());
|
worksheet.Cells[16 + tuple.Item1.Day, 2].Value = tuple.Item1.Hour + ":" + (tuple.Item1.Minute == 0 ? "00" : tuple.Item1.Minute.ToString());
|
||||||
worksheet.Cells[17 + tuple.Item1.Day, 3].Value = tuple.Item2.Hour + ":" + (tuple.Item2.Minute == 0 ? "00" : tuple.Item1.Minute.ToString());
|
worksheet.Cells[16 + tuple.Item1.Day, 3].Value = tuple.Item2.Hour + ":" + (tuple.Item2.Minute == 0 ? "00" : tuple.Item1.Minute.ToString());
|
||||||
if (tuple.Item3) worksheet.Cells[17 + tuple.Item1.Day, 5].Value = "1:00";
|
if (tuple.Item3) worksheet.Cells[16 + tuple.Item1.Day, 5].Value = "1:00";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 17; i <= 47; i++)
|
for (int i = 17; i <= 47; i++)
|
||||||
@@ -98,7 +98,7 @@ public static class TimesheetIO
|
|||||||
}
|
}
|
||||||
|
|
||||||
worksheet.Cells[48, 6].Formula = "SUM(F17:F47)";
|
worksheet.Cells[48, 6].Formula = "SUM(F17:F47)";
|
||||||
package.SaveAs(new FileInfo(@$"{filePath}/{month}.xlsx"));
|
package.SaveAs(new FileInfo(@$"{filePath}/{Constants.MonthsGerman.IndexOf(month):D2} - {month}.xlsx"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,21 +45,21 @@ public class TimesheetService
|
|||||||
ApplicationName = applicationName,
|
ApplicationName = applicationName,
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (string month in Constants.Months)
|
foreach (Person person in persons)
|
||||||
{
|
{
|
||||||
if (month == Constants.Months[0]) continue;
|
foreach (string month in Constants.Months)
|
||||||
List<(DateTime, DateTime, bool)> timesheetValue = new List<(DateTime, DateTime, bool)>();
|
|
||||||
|
|
||||||
// Aktuelles Datum
|
|
||||||
DateTime now = DateTime.Now;
|
|
||||||
// Erster Tag des aktuellen Monats (00:00:00 Uhr)
|
|
||||||
DateTime firstDayOfMonth = new DateTime(now.Year, Constants.Months.IndexOf(month), 1, 0, 0, 0);
|
|
||||||
// Letzter Tag des aktuellen Monats (23:59:59 Uhr)
|
|
||||||
DateTime lastDayOfMonth = new DateTime(now.Year, Constants.Months.IndexOf(month), DateTime.DaysInMonth(now.Year, Constants.Months.IndexOf(month)),
|
|
||||||
23, 59, 59);
|
|
||||||
|
|
||||||
foreach (Person person in persons)
|
|
||||||
{
|
{
|
||||||
|
if (month == Constants.Months[0]) continue;
|
||||||
|
List<(DateTime, DateTime, bool)> timesheetValue = new List<(DateTime, DateTime, bool)>();
|
||||||
|
|
||||||
|
// Aktuelles Datum
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
// Erster Tag des aktuellen Monats (00:00:00 Uhr)
|
||||||
|
DateTime firstDayOfMonth = new DateTime(now.Year, Constants.Months.IndexOf(month), 1, 0, 0, 0);
|
||||||
|
// Letzter Tag des aktuellen Monats (23:59:59 Uhr)
|
||||||
|
DateTime lastDayOfMonth = new DateTime(now.Year, Constants.Months.IndexOf(month), DateTime.DaysInMonth(now.Year, Constants.Months.IndexOf(month)),
|
||||||
|
23, 59, 59);
|
||||||
|
|
||||||
// Beispiel: Liste die nächsten 10 Ereignisse im ITM Kalender auf
|
// Beispiel: Liste die nächsten 10 Ereignisse im ITM Kalender auf
|
||||||
var requestItm = service.Events.List("on089es7kq4ugi3rqvslkn7720@group.calendar.google.com");
|
var requestItm = service.Events.List("on089es7kq4ugi3rqvslkn7720@group.calendar.google.com");
|
||||||
requestItm.TimeMinDateTimeOffset = firstDayOfMonth;
|
requestItm.TimeMinDateTimeOffset = firstDayOfMonth;
|
||||||
@@ -81,7 +81,7 @@ public class TimesheetService
|
|||||||
{
|
{
|
||||||
DateTime dayStart = (DateTime) eventItem.Start.DateTime;
|
DateTime dayStart = (DateTime) eventItem.Start.DateTime;
|
||||||
DateTime dayEnd = (DateTime) eventItem.End.DateTime;
|
DateTime dayEnd = (DateTime) eventItem.End.DateTime;
|
||||||
timesheetValue.Add((dayStart, dayEnd, false));
|
timesheetValue.Add((dayStart, dayEnd, (dayEnd.Hour > 13)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public partial class LeanderShiftPlannerMainWindow : Window
|
|||||||
{
|
{
|
||||||
ProgressbarCalculaion.IsIndeterminate = true;
|
ProgressbarCalculaion.IsIndeterminate = true;
|
||||||
await _appService.TimesheetService.GenerateGoogleTimeSheets(_appService.PersonService.GetGoogleTimeSheetList());
|
await _appService.TimesheetService.GenerateGoogleTimeSheets(_appService.PersonService.GetGoogleTimeSheetList());
|
||||||
|
await _appService.TimesheetService.GenerateRandomTimeSheets(_appService.PersonService.GetRandomTimeSheetList());
|
||||||
ProgressbarCalculaion.IsIndeterminate = false;
|
ProgressbarCalculaion.IsIndeterminate = false;
|
||||||
|
|
||||||
int error = TimesheetIO.ExportTimesheets(_appService.PersonService.GetPersonList().ToList());
|
int error = TimesheetIO.ExportTimesheets(_appService.PersonService.GetPersonList().ToList());
|
||||||
|
|||||||
Reference in New Issue
Block a user