I am at a loss for doing this task, been working on it for a month now.
I need to calculate when units have their audits due. I also need to placed the units into a status, "late", "not filed", "not due", "timely"
Business Rule: If the unit population is >4000 its due annually, six months after their fiscal year ends.
Business Rule: Units can have any months for their fiscal year end month
Business Rule: If the unit population is <4000 the audit is due at a minimum every 24 months. Some can and do file it annually even though they need not.
With the help of others this is how my query looks so far, but I still cannot determine not due from not filed. I'm am just at a loss.
SELECT dbo_localUnitAudit.CountyCd, dbo_localUnitAudit.LocalUnitType, dbo_localUnitAudit.LocalUnitCd, dbo_localUnitAudit.FiscalYear, dbo_localUnitAudit.Type, dbo_localUnitAudit.Extension, dbo_localUnitAudit.AuditReceivedDate, Format(DateSerial([FiscalYear],[FiscalEndMM]+7,0),'mm/dd/yyyy') AS AuditDue, IIf([auditreceiveddate]>[auditdue],"LATE",IIf([auditreceiveddate]<=[auditdue],"TIMELY",IIf([auditreceiveddate] Is Null And DateAdd("m",GetDUeMths([population]),[auditdue] Is Null),"NOT FILED",IIf([auditdue]>Date(),"NOT DUE")))) AS AnnualAuditFiledTimely, DateAdd("m",GetDueMths([Population]),([auditdue])) AS NextAuditDue, dbo_localUnitAudit.Auditor, dbo_localUnitAudit.Notes, dbo_localUnitAudit.AuditLocation, dbo_localUnitAudit.ID, dbo_Population.Population, dbo_Population.CensusYear
FROM dbo_Population INNER JOIN (dbo_LocalUnit INNER JOIN dbo_localUnitAudit ON (dbo_LocalUnit.CountyCd = dbo_localUnitAudit.CountyCd) AND (dbo_LocalUnit.LocalUnitType = dbo_localUnitAudit.LocalUnitType) AND (dbo_LocalUnit.LocalUnitCd = dbo_localUnitAudit.LocalUnitCd)) ON (dbo_Population.LocalUnitCd = dbo_LocalUnit.LocalUnitCd) AND (dbo_Population.LocalUnitType = dbo_LocalUnit.LocalUnitType) AND (dbo_Population.CountyCd = dbo_LocalUnit.CountyCd)
WHERE (((dbo_Population.CensusYear)="2000"));
I need to calculate when units have their audits due. I also need to placed the units into a status, "late", "not filed", "not due", "timely"
Business Rule: If the unit population is >4000 its due annually, six months after their fiscal year ends.
Business Rule: Units can have any months for their fiscal year end month
Business Rule: If the unit population is <4000 the audit is due at a minimum every 24 months. Some can and do file it annually even though they need not.
With the help of others this is how my query looks so far, but I still cannot determine not due from not filed. I'm am just at a loss.
SELECT dbo_localUnitAudit.CountyCd, dbo_localUnitAudit.LocalUnitType, dbo_localUnitAudit.LocalUnitCd, dbo_localUnitAudit.FiscalYear, dbo_localUnitAudit.Type, dbo_localUnitAudit.Extension, dbo_localUnitAudit.AuditReceivedDate, Format(DateSerial([FiscalYear],[FiscalEndMM]+7,0),'mm/dd/yyyy') AS AuditDue, IIf([auditreceiveddate]>[auditdue],"LATE",IIf([auditreceiveddate]<=[auditdue],"TIMELY",IIf([auditreceiveddate] Is Null And DateAdd("m",GetDUeMths([population]),[auditdue] Is Null),"NOT FILED",IIf([auditdue]>Date(),"NOT DUE")))) AS AnnualAuditFiledTimely, DateAdd("m",GetDueMths([Population]),([auditdue])) AS NextAuditDue, dbo_localUnitAudit.Auditor, dbo_localUnitAudit.Notes, dbo_localUnitAudit.AuditLocation, dbo_localUnitAudit.ID, dbo_Population.Population, dbo_Population.CensusYear
FROM dbo_Population INNER JOIN (dbo_LocalUnit INNER JOIN dbo_localUnitAudit ON (dbo_LocalUnit.CountyCd = dbo_localUnitAudit.CountyCd) AND (dbo_LocalUnit.LocalUnitType = dbo_localUnitAudit.LocalUnitType) AND (dbo_LocalUnit.LocalUnitCd = dbo_localUnitAudit.LocalUnitCd)) ON (dbo_Population.LocalUnitCd = dbo_LocalUnit.LocalUnitCd) AND (dbo_Population.LocalUnitType = dbo_LocalUnit.LocalUnitType) AND (dbo_Population.CountyCd = dbo_LocalUnit.CountyCd)
WHERE (((dbo_Population.CensusYear)="2000"));