Zeit_verk_Std.sql 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. SELECT T1."order_number" AS "Order Number",
  2. T1."order_position" AS "Order Position",
  3. T1."labour_type" AS "Labour Type",
  4. T2."code" AS "Code_Labour_Types",
  5. T2."description" AS "Description_Labour_Types",
  6. T3."order_number" AS "Order Number_Labours",
  7. T3."order_position" AS "Order Position_Labours",
  8. T3."order_position_line" AS "Order Position Line_Labours",
  9. '0' + (rtrim((((T4."subsidiary"))))) AS "Subsidiary_Labours",
  10. T3."is_invoiced" AS "Is Invoiced_Labours",
  11. T3."invoice_type" AS "Invoice Type_Labours",
  12. T3."invoice_number" AS "Invoice Number_Labours",
  13. T3."employee_no" AS "Employee No_Labours",
  14. T3."mechanic_no" AS "Mechanic No_Labours",
  15. T3."labour_operation_id" AS "Labour Operation Id_Labours",
  16. T3."is_nominal" AS "Is Nominal_Labours",
  17. T3."net_price_in_order" AS "Net Price In Order_Labours",
  18. T3."rebate_percent" AS "Rebate Percent_Labours",
  19. T3."goodwill_percent" AS "Goodwill Percent_Labours",
  20. T3."charge_type" AS "Charge Type_Labours",
  21. T3."text_line" AS "Text Line_Labours",
  22. 10 AS "AW/Std.",
  23. ((convert(FLOAT, T3."time_units"))) / 10 AS "verk. Std.",
  24. 'verk. Std.' AS "Zeitkategorie",
  25. '' AS "Zeitkategorie2",
  26. T4."employee_number" AS "Employee Number_Employee",
  27. T4."name" AS "Name_Employee",
  28. (rtrim((((T4."employee_number"))))) + ' - ' + T4."name" AS "Monteur",
  29. T5."invoice_number" AS "Invoice Number_Invoices",
  30. T5."invoice_date" AS "Invoice Date_Invoices",
  31. T5."invoice_date" AS "Datum",
  32. T3."time_units" AS "Time Units_Labours",
  33. (convert(FLOAT, T3."time_units")) AS "Time_Units_Zahl"
  34. FROM (
  35. "dbo"."invoices" T5 LEFT JOIN (
  36. (
  37. (
  38. "dbo"."order_positions" T1 LEFT JOIN "dbo"."labour_types" T2 ON T1."labour_type" = T2."code"
  39. ) LEFT JOIN "dbo"."labours" T3 ON T1."order_number" = T3."order_number"
  40. ) LEFT JOIN "dbo"."employees" T4 ON T3."mechanic_no" = T4."employee_number"
  41. ) ON (T3."invoice_number" = T5."invoice_number")
  42. AND (T3."invoice_type" = T5."invoice_type")
  43. )
  44. WHERE (((convert(FLOAT, T3."time_units"))) <> 0)
  45. -- order by "Order Number" asc,"Order Position" asc