PSLine2000Documentation/Queries/LaborRateDataWithOverHead.md

3.3 KiB

LaborRateDataWithOverHead

Analysis generated on: 4/2/2025 10:01:20 AM

SQL Statement

SELECT CStr([DEPT#]) AS WC2, [RMSFILES#_SCBRP1A0].DPTDS, First([RMSFILES#_MFWKP100].[AL$RA]) AS PreLaborRate, Format(First([AL$RA])*(1+First([VAROH])),"$0.00") AS VOHRate, Format(First([AL$RA])*(1+First([FIXOH])),"$0.00") AS FOHRate, Format(First([AL$RA])*(1+First([ASBQ1])),"$0.00") AS TotalOHRate, First([AL$RA])*(1+First([ASBQ1])) AS LaborRate
FROM [RMSFILES#_MFWKP100] RIGHT JOIN [RMSFILES#_SCBRP1A0] ON [RMSFILES#_MFWKP100].WRKC2 = [RMSFILES#_SCBRP1A0].[DEPT#]
WHERE ((([RMSFILES#_MFWKP100].ACTIV)='1'))
GROUP BY CStr([DEPT#]), [RMSFILES#_SCBRP1A0].DPTDS
HAVING ((([RMSFILES#_SCBRP1A0].DPTDS)<>''))
ORDER BY CStr([DEPT#]);

Dependencies

Parameters

  • None

What it does

SQL Query Description

This SQL query retrieves data from two tables, [RMSFILES#_MFWKP100] and [RMSFILES#_SCBRP1A0], performing a right join based on the WRKC2 column in the first table and the DEPT# column in the second table.

Query Overview

The query calculates various rates and totals for labor costs, filtering out records where the activity status is not '1'. The results are grouped by department number and DPTDS (which seems to represent a department type or classification).

Selected Columns

The query selects the following columns:

  • WC2: The department number as a string, aliased as CStr([DEPT#]).
  • DPTDS: The DPTDS value from [RMSFILES#_SCBRP1A0], representing the department type or classification.
  • PreLaborRate: The first non-null value in the AL$RA column, multiplied by (1+First([VAROH])). This represents the pre-labor rate calculation.
  • VOHRate: The formatted result of the AL$RA column multiplied by (1+First([VAROH])), with a format of $0.00. This represents the variable overhead (VOH) rate calculation.
  • FOHRate: The formatted result of the AL$RA column multiplied by (1+First([FIXOH])), with a format of $0.00. This represents the fixed overhead (FOH) rate calculation.
  • TotalOHRate: The formatted result of the AL$RA column multiplied by (1+First([ASBQ1])), with a format of $0.00. This represents the total overhead rate calculation.
  • LaborRate: The first non-null value in the AL$RA column, multiplied by (1+First([ASBQ1])).

Filtering and Grouping

The query filters out records where the activity status is not '1' using the following condition: WHERE ((([RMSFILES#_MFWKP100].ACTIV)='1')). It then groups the results by two columns:

  • CStr([DEPT#]): The department number as a string.
  • [RMSFILES#_SCBRP1A0].DPTDS: The DPTDS value from [RMSFILES#_SCBRP1A0].

The results are further filtered to exclude any empty values for the DPTDS column using the following condition: HAVING ((([RMSFILES#_SCBRP1A0].DPTDS)\u003c\u003e'')). Finally, the query sorts the results by the department number column in ascending order using the following condition: ORDER BY CStr([DEPT#]);.

Example Use Case

This query appears to be used for labor cost calculations and rate analysis. The resulting data can be used to evaluate labor costs, identify trends, and make informed decisions about staffing and resource allocation.