LogikalLabour.cs 896 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using InABox.Integration.Logikal;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace PRSDesktop.Integrations.Logikal
  5. {
  6. public class LogikalLabour : LogikalBOMItem, ILogikalLabour
  7. {
  8. public TimeSpan Duration { get; set; }
  9. public override void ValidateQuery(string sql, List<string> errors)
  10. {
  11. base.ValidateQuery(sql, errors);
  12. }
  13. public static String SQL = $@"
  14. select
  15. cast(t.[timetype] as text) as {nameof(Code)},
  16. t.[name] as {nameof(Description)},
  17. sum(t.[totalminutes]/60.0) as {nameof(Quantity)},
  18. c.[price] as {nameof(Cost)}
  19. from
  20. labourtimes t
  21. join
  22. labourcosts c on t.[timetype] = c.[type]
  23. join
  24. elevations e on t.[elevationid] = e.[elevationid]
  25. where
  26. t.[totalminutes] > 0.0
  27. and
  28. t.[ismain] = 1
  29. group by
  30. t.[timetype],
  31. t.[Name],
  32. c.[price]
  33. ";
  34. }
  35. }