I will go with the sharing of code on this forum with the odb file permits sharing with a copy and paste. The two qeiries are:
“Basic Billing”
SELECT "tbl_Organization"."Organization_ID",
"tbl_File"."File_ID", "tbl_Time"."ToDo_ID", "tbl_Time"."Date", "tbl_Time"."Start_Time",
"tbl_Time"."Stop_Time",
CASEWHEN( DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ) > 0, DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ), 1440 - DATEDIFF( 'MINUTE', "Stop_Time", "Start_Time" ) ) AS "Difference",
CASEWHEN( DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ) > 0, DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ), 1440 - DATEDIFF( 'MINUTE', "Stop_Time", "Start_Time" ) ) * "Hourly Rate" / 60 AS "Invoice",
RIGHT( CONCAT( '000', "File_ID" ), 3 ) AS "number",
"tbl_File"."Project_Title", "tbl_Individual"."Name",
"tbl_Organization"."Name", "tbl_Organization"."Address"
FROM "tbl_Time", "tbl_Organization", "tbl_ToDo", "tbl_Individual", "tbl_File"
WHERE "tbl_Time"."Organization_ID" = "tbl_Organization"."Organization_ID"
AND "tbl_Time"."ToDo_ID" = "tbl_ToDo"."ToDo_ID"
AND "tbl_ToDo"."Individual_ID" = "tbl_Individual"."Individual_ID"
AND "tbl_ToDo"."File_ID" = "tbl_File"."File_ID"
AND "tbl_Time"."Date" > :start
AND "tbl_Time"."Date" < :stop
“Grouped Billing”
SELECT "tbl_Organization"."Organization_ID" AS "OrganizationID",
MIN( "tbl_File"."File_ID" ) AS "FileID",
COUNT( "tbl_ToDo"."ToDo_ID" ) AS "Count",
SUM( CASEWHEN( DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ) > 0, DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ), 1440 - DATEDIFF( 'MINUTE', "Stop_Time", "Start_Time" ) ) ) AS "Minutes",
SUM( CASEWHEN( DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ) > 0, DATEDIFF( 'MINUTE', "Start_Time", "Stop_Time" ), 1440 - DATEDIFF( 'MINUTE', "Stop_Time", "Start_Time" ) ) * "Hourly Rate" / 60 ) AS "Invoice",
MIN( CONCAT( RIGHT( CONCAT( '000', "Organization_ID" ), 3 ), RIGHT( CONCAT( '000', "File_ID" ), 3 ) ) ) AS "number",
MIN( "tbl_File"."Project_Title" ) AS "ProjectTitle",
MIN( "tbl_Organization"."Name" ) AS "NameOrganization",
MIN( "tbl_Organization"."Address" ) AS "Address"
FROM "tbl_Time", "tbl_Organization", "tbl_ToDo", "tbl_Individual", "tbl_File"
WHERE "tbl_Time"."Organization_ID" = "tbl_Organization"."Organization_ID"
AND "tbl_Time"."ToDo_ID" = "tbl_ToDo"."ToDo_ID"
AND "tbl_ToDo"."Individual_ID" = "tbl_Individual"."Individual_ID"
AND "tbl_ToDo"."File_ID" = "tbl_File"."File_ID"
AND "tbl_Time"."Date" > :start
AND "tbl_Time"."Date" < :stop
GROUP BY "tbl_Organization"."Organization_ID"
Thanks for looking at this.
Richard