#Construction Tracking
#Loan Draws Interactive HTML Report
Create a modified version of the ct_g_LoanDraws procedure which returns all the same fields, but broken down by cost code (as it exists natively in the ct_DrawsBudget table), instead of grouped by title and header
Add “BondAllocation”, “LoanAllocation”, and “EntityAllocation” columns to ct_DrawsBudget table, which will be used to indicate the amount allocated to be spent against from each source of funds, for each cost code
DECLARE @CostCode VARCHAR(50) = '020300',
@DrawId INT = 158,
@DrawType VARCHAR(50) = 'Total'
DECLARE @GLCode VARCHAR(50)
SELECT @GLCode = (SELECT Value FROM ct_Params WHERE ParamType = 'Draw Type' AND [Description] = @DrawType)
IF @DrawType = 'Total'
BEGIN
SELECT *
FROM CT_INVOICES i
INNER JOIN CT_DRAWBATCHES b
ON i.DrawBatchId = b.DrawBatchId
WHERE CostCode = @CostCode
AND i.DrawBatchID < @DrawId
AND (i.GLCode = (SELECT Value FROM ct_Params WHERE ParamType = 'Draw Type' AND [Description] = 'Loan')
OR i.GLCode = (SELECT Value FROM ct_Params WHERE ParamType = 'Draw Type' AND [Description] = 'Bond')
)
END
ELSE
SELECT *
FROM CT_INVOICES i
INNER JOIN CT_DRAWBATCHES b
ON i.DrawBatchId = b.DrawBatchId
WHERE CostCode = @CostCode
AND i.DrawBatchID < @DrawId
AND i.GLCode = @GLCode
[ { Header: "Hard Costs", Titles: [ { Title: "Site Costs", CostCodes: [ "CostCode": "020101", "CostCode": "020102" ] SortOrder: 8 }, { Title: "Vertical Costs", CostCodes: [ "CostCode": "030201", "CostCode": "030204" ] SortOrder: 9 } ] } ]
getDrawInvoicesByCostCode(TimeFrame, DrawType, DrawId)
getDrawInvoicesByCostCode(‘previous’, ‘loan’)
getDrawInvoicesByCostCode(‘previous’, ‘total’)
getDrawInvoicesByCostCode(‘current’, ‘loan’)
getDrawInvoicesByCostCode(‘current’, ‘total’)
getDrawInvoicesByCostCode(‘advanced’, ‘total’)
set up angular service function to return structured JSON data object from getDrawLoans web method
create HTML template and angular controller to display nested arrays using example logic:
<table> <tbody> <tr ng-repeat-start="header in headers"> </tr> <tr ng-repeat-start="title in titles"> </tr> <tr ng-repeat="costcode in costcodes" ng-repeat-end> </tr> </tbody> </table>