| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using InABox.Integration.V6;
- namespace PRSDesktop.Integrations.V6
- {
- public class V6Labour : V6Object, IV6Labour
- {
- public string Code { get; set; }
- public string Description { get; set; }
- public double Quantity { 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(Quantity), errors);
- ValidateField(sql, nameof(Cost), errors);
- }
- public static String SQL = $@"select
- la.code as {nameof(Code)},
- la.code as {nameof(Description)},
- sum(bl.lab_time/60.0) as {nameof(Quantity)},
- sum(bl.cost) as {nameof(Cost)}
- from
- bom_labour bl
- left outer join
- quote_item qi on qi.quote_item_id = bl.quote_item_id
- left outer join
- quote q on q.quote_id = qi.quote_id
- left outer join
- (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
- where
- 1=1
- group by
- la.code";
-
- }
- }
|