LogikalLabour.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 BillOfMaterialsSQL =
  14. "select \n" +
  15. $" cast(t.[timetype] as text) as {nameof(Code)}, \n" +
  16. $" t.[name] as {nameof(Description)}, \n" +
  17. $" sum(t.[totalminutes]/60.0) as {nameof(Quantity)}, \n" +
  18. $" c.[price] as {nameof(Cost)} \n" +
  19. "from \n" +
  20. " labourtimes t \n" +
  21. "join \n" +
  22. " labourcosts c on t.[timetype] = c.[type] \n" +
  23. "left outer join \n" +
  24. " elevations e on t.[elevationid] = e.[elevationid] \n" +
  25. "where \n" +
  26. " t.[totalminutes] > 0.0 \n" +
  27. "and \n" +
  28. " t.[ismain] = 1 \n" +
  29. "group by \n" +
  30. " t.[timetype], \n" +
  31. " t.[name], \n" +
  32. " c.[price]";
  33. public static String DesignSQL =
  34. "select \n" +
  35. $" cast(t.[timetype] as text) as {nameof(Code)}, \n" +
  36. $" t.[name] as {nameof(Description)}, \n" +
  37. $" sum(t.[totalminutes]/60.0) as {nameof(Quantity)}, \n" +
  38. $" c.[price] as {nameof(Cost)} \n" +
  39. "from \n" +
  40. " labourtimes t \n" +
  41. "join \n" +
  42. " labourcosts c on t.[timetype] = c.[type] \n" +
  43. "left outer join \n" +
  44. " elevations e on t.[elevationid] = e.[elevationid] \n" +
  45. "where \n" +
  46. " t.[totalminutes] > 0.0 \n" +
  47. "and \n" +
  48. " t.[ismain] = 1 \n" +
  49. "group by \n" +
  50. " t.[timetype], \n" +
  51. " t.[name], \n" +
  52. " c.[price]";
  53. }
  54. }