1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- namespace Comal.Classes
- {
- public class V6Labour : V6Object
- {
- public string Code { get; set; }
- public string Description { get; set; }
- public double Minutes { get; set; }
- public double Cost { get; set; }
-
- public override void ValidateQuery(string sql, List<string> errors)
- {
- ValidateField(sql,nameof(Code), errors);
- ValidateField(sql,nameof(Description), errors);
- ValidateField(sql, nameof(Minutes), errors);
- ValidateField(sql, nameof(Cost), errors);
- }
- public static String SQL =
- "select \n" +
- $" la.code as {nameof(Code)}, \n" +
- $" la.code as {nameof(Description)}, \n" +
- $" sum(bl.lab_time) as {nameof(Minutes)}, \n" +
- $" sum(bl.cost) as {nameof(Cost)} \n" +
- "from \n" +
- " bom_labour bl \n" +
- "left outer join \n" +
- " quote_item qi on qi.quote_item_id = bl.quote_item_id \n" +
- "left outer join \n" +
- " quote q on q.quote_id = qi.quote_id \n" +
- "left outer join \n" +
- " (select lab_area_lib_id, lab_area_id, case when descr LIKE '%Cutting%' then 'CUTTING' when descr LIKE '%Site%' OR descr LIKE '%fixings%' OR descr LIKE '%S/Glz%' then 'SITE' else 'FABRICATION' end as code from lab_area) la on la.lab_area_lib_id = bl.lab_area_lib_id and la.lab_area_id = bl.lab_area_id \n" +
- "where \n" +
- " 1=1 \n" +
- "group by \n" +
- " la.code";
-
- }
- }
|