src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml
changeset 9910 6767429386d8
parent 7031 2aac4501bbd5
child 9911 444911e2b851
--- a/src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,17 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW MA_SEQUENCE_EMPLOYEE_COST">
-    <view name="MA_SEQUENCE_EMPLOYEE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, 
-CASE c_salary_category_cost.costuom
-WHEN 'H' THEN ma_sequence.costcenteruse * c_salary_category_cost.cost
-WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * c_salary_category_cost.cost
-WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * c_salary_category_cost.cost
-ELSE NULL
-END AS cost
-FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version, ma_costcenter_employee, c_salary_category_cost, m_product, ma_sequenceproduct
-WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_employee.ma_costcenter_version_id AND ma_costcenter_employee.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max
-FROM ma_costcenter_version ccv
-WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND c_salary_category_cost.datefrom = ((SELECT max(sc.datefrom) AS max
-FROM c_salary_category_cost sc
-WHERE sc.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND sc.datefrom <= ma_processplan_version.datefrom))
-GROUP BY ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, c_salary_category_cost.cost, c_salary_category_cost.costuom, ma_sequence.costcenteruse]]></view>
+    <view name="MA_SEQUENCE_EMPLOYEE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id,  CASE c_salary_category_cost.costuom WHEN 'H' THEN ma_sequence.costcenteruse * c_salary_category_cost.cost WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * c_salary_category_cost.cost WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * c_salary_category_cost.cost ELSE NULL END AS cost FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version,  ma_costcenter_employee, c_salary_category_cost, m_product,  ma_sequenceproduct WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_employee.ma_costcenter_version_id AND ma_costcenter_employee.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max FROM ma_costcenter_version ccv WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND c_salary_category_cost.datefrom = ((SELECT max(sc.datefrom) AS max FROM c_salary_category_cost sc WHERE sc.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND sc.datefrom <= ma_processplan_version.datefrom)) GROUP BY ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, c_salary_category_cost.cost, c_salary_category_cost.costuom, ma_sequence.costcenteruse]]></view>
   </database>