Have a table that I'm extracting from the State mainframe that contains info about our Tranactions for our Agency for the current year. I'm having to break out this data into seperate queries to get our different Divisions allotments, Encumbrances, and our expenditures. The problem I'm having is not being able to refrence the data back together as the allotments may have a transaction objcode but not a matching Expenditure Objcode and can be the other way around. I have a table which I'm using that contain all the objcodes that I pull the description name for the objcode and trying to figure out how to make that table be set as the Standard for the objcode so that it will pull in the Objcode so that if their is not a amount I can have it place $0.00 in the amount field for that Division's Objcode so I can match it to expenditure for that Objcode and vise versa. Example would be:
Objcode ObjName ALLOTMENTS EXPENDITURES Encumbrance
230010 PRINTING 50,000.00 0.00 10,798.11
230030 PHOTOCOPY 0.00 0.00 22.14
230040 BOOK BIND 0.00 1,404.50 0.00
In this example I would only get a allotment amount for the 230010 code and not the other two and I need to get a 0.00 amount for them to match the Expenditure and Encumbrance when I try to create the report above.
This is the query to extract the allotments but I can't figure out how to create a 0.00 amount for a objcode if there is not a alloment for that objcode. Note your see also where I change the Trn_amt to from a neg to pos number due to the mainframes function and need to do this for viewing purpose of the staff.
TranHist2009DataTbl.FID, TranHist2009DataTbl.BE_CD, TranHist2009DataTbl.IBI, TranHist2009DataTbl.CAT, TranHist2009DataTbl.APPR_YR, TranHist2009DataTbl.GL_CD, TranHist2009DataTbl.OBJ, ObjectCodeNameTbl.OBJ_NM, TranHist2009DataTbl.PROGRAM_STD, TranHist2009DataTbl.PROGRAM_AGENCY, TranHist2009DataTbl.PROD, TranHist2009DataTbl.FUND_EXT, TranHist2009DataTbl.GL_EXT, TranHist2009DataTbl.OBJ_EXT, TranHist2009DataTbl.PROGRAM_EXT, TranHist2009DataTbl.INTER_INTRA, TranHist2009DataTbl.TRN_CD, TranHist2009DataTbl.EXOP_ID, TranHist2009DataTbl.EXOP_VER_NBR, TranHist2009DataTbl.TRN_DT, TranHist2009DataTbl.TRN_AMT, [trn_amt]<0 AS TranAmt, IIf([tranamt]<0,[TRN_AMT]*[tranamt],[Trn_Amt]*-1) AS TranActionAmt, TranHist2009DataTbl.AGENCY_DOC_NBR, TranHist2009DataTbl.VENDOR_ID, TranHist2009DataTbl.VENDOR_NM1, TranHist2009DataTbl.NBI, TranHist2009DataTbl.SCND_DOC_NBR, TranHist2009DataTbl.OTHER_SUBVENDOR_ID, TranHist2009DataTbl.INVOICE_NBR, TranHist2009DataTbl.BF_ORG, TranHist2009DataTbl.BF_EXOP, TranHist2009DataTbl.BF_OBJ, TranHist2009DataTbl.BF_CAT, TranHist2009DataTbl.CHK_ID, TranHist2009DataTbl.CHK_DT, TranHist2009DataTbl.TRN_DESC, TranHist2009DataTbl.ORGN_FUND_SOURCE, TranHist2009DataTbl.OTHER_DOC_NBR, TranHist2009DataTbl.ADD_DT, TranHist2009DataTbl.TRN_QTY, TranHist2009DataTbl.PROD_UNIT, TranHist2009DataTbl.PROD_TIME, TranHist2009DataTbl.FINAL_PYMT_IND, TranHist2009DataTbl.SITE, TranHist2009DataTbl.USER_NBR, TranHist2009DataTbl.AVBL_IND, TranHist2009DataTbl.ALI, TranHist2009DataTbl.ADD_TS, TranHist2009DataTbl.TERMINAL, TranHist2009DataTbl.EXOP_SET, TranHist2009DataTbl.VOUCHER_TYPE, TranHist2009DataTbl.CLEAR_FUND, TranHist2009DataTbl.REVOLVE_FUND, TranHist2009DataTbl.EXOP_OVERRIDE_IND, TranHist2009DataTbl.GROUPING, TranHist2009DataTbl.BATCH_ID, TranHist2009DataTbl.AVBL_OVERRIDE_IND, TranHist2009DataTbl.BOOKKEEPING, TranHist2009DataTbl.SUBS_GL, TranHist2009DataTbl.SUBS_EXT_GL, TranHist2009DataTbl.AVBL_OVERRIDE_GP, TranHist2009DataTbl.MEMO_BLKT, TranHist2009DataTbl.PROCESS_IND, TranHist2009DataTbl.BF_APPR_YR, TranHist2009DataTbl.MINORITY, TranHist2009DataTbl.PRIOR_PERIOD, TranHist2009DataTbl.PROP_BEG, TranHist2009DataTbl.RECORD_TYPE, TranHist2009DataTbl.CTRT_GRNT_LOC, TranHist2009DataTbl.CTRT_GRNT_FLOW, TranHist2009DataTbl.PROP_QTY, TranHist2009DataTbl.TRN_USE_IND, TranHist2009DataTbl.CTRT_GRNT_USE_IND, TranHist2009DataTbl.PROJECT_ID, TranHist2009DataTbl.CFI, TranHist2009DataTbl.BF_CFI, TranHist2009DataTbl.SWDN, TranHist2009DataTbl.ACCRUAL, TranHist2009DataTbl.GRANT_ALI, TranHist2009DataTbl.GRANT_AVBL, TranHist2009DataTbl.SOURCE, TranHist2009DataTbl.CAT_EXT, TranHist2009DataTbl.CONTRACT_ALI, TranHist2009DataTbl.CONTRACT_AVBL, TranHist2009DataTbl.PROJECT_ALI, TranHist2009DataTbl.PROJECT_AVBL, TranHist2009DataTbl.ASOF_MTH_YR, TranHist2009DataTbl.FY_END, TranHist2009DataTbl.IW_DT, CatTbl.CAT_NM, OCATbl.OCA_NM
FROM ((TranHist2009DataTbl INNER JOIN CatTbl ON TranHist2009DataTbl.CAT = CatTbl.CAT) INNER JOIN OCATbl ON TranHist2009DataTbl.OCA = OCATbl.OCA) INNER JOIN ObjectCodeNameTbl ON TranHist2009DataTbl.OBJ = ObjectCodeNameTbl.OBJ
GROUP BY TranHist2009DataTbl.OLO, TranHist2009DataTbl.L2_CD, TranHist2009DataTbl.L3_CD, TranHist2009DataTbl.L4_CD, TranHist2009DataTbl.L5_CD, "45" & [L2_cd], "45" & [L2_cd] & [L3_cd] & [L4_cd] & [L5_cd], TranHist2009DataTbl.AU_CD, TranHist2009DataTbl.GRANT_NBR, TranHist2009DataTbl.GRANT_YR, TranHist2009DataTbl.CONTRACT_NBR, TranHist2009DataTbl.CONTRACT_YR, TranHist2009DataTbl.OCA, TranHist2009DataTbl.GF_CD, TranHist2009DataTbl.SF_CD, TranHist2009DataTbl.FID, TranHist2009DataTbl.BE_CD, TranHist2009DataTbl.IBI, TranHist2009DataTbl.CAT, TranHist2009DataTbl.APPR_YR, TranHist2009DataTbl.GL_CD, TranHist2009DataTbl.OBJ, ObjectCodeNameTbl.OBJ_NM, TranHist2009DataTbl.PROGRAM_STD, TranHist2009DataTbl.PROGRAM_AGENCY, TranHist2009DataTbl.PROD, TranHist2009DataTbl.FUND_EXT, TranHist2009DataTbl.GL_EXT, TranHist2009DataTbl.OBJ_EXT, TranHist2009DataTbl.PROGRAM_EXT, TranHist2009DataTbl.INTER_INTRA, TranHist2009DataTbl.TRN_CD, TranHist2009DataTbl.EXOP_ID, TranHist2009DataTbl.EXOP_VER_NBR, TranHist2009DataTbl.TRN_DT, TranHist2009DataTbl.TRN_AMT, TranHist2009DataTbl.AGENCY_DOC_NBR, TranHist2009DataTbl.VENDOR_ID, TranHist2009DataTbl.VENDOR_NM1, TranHist2009DataTbl.NBI, TranHist2009DataTbl.SCND_DOC_NBR, TranHist2009DataTbl.OTHER_SUBVENDOR_ID, TranHist2009DataTbl.INVOICE_NBR, TranHist2009DataTbl.BF_ORG, TranHist2009DataTbl.BF_EXOP, TranHist2009DataTbl.BF_OBJ, TranHist2009DataTbl.BF_CAT, TranHist2009DataTbl.CHK_ID, TranHist2009DataTbl.CHK_DT, TranHist2009DataTbl.TRN_DESC, TranHist2009DataTbl.ORGN_FUND_SOURCE, TranHist2009DataTbl.OTHER_DOC_NBR, TranHist2009DataTbl.ADD_DT, TranHist2009DataTbl.TRN_QTY, TranHist2009DataTbl.PROD_UNIT, TranHist2009DataTbl.PROD_TIME, TranHist2009DataTbl.FINAL_PYMT_IND, TranHist2009DataTbl.SITE, TranHist2009DataTbl.USER_NBR, TranHist2009DataTbl.AVBL_IND, TranHist2009DataTbl.ALI, TranHist2009DataTbl.ADD_TS, TranHist2009DataTbl.TERMINAL, TranHist2009DataTbl.EXOP_SET, TranHist2009DataTbl.VOUCHER_TYPE, TranHist2009DataTbl.CLEAR_FUND, TranHist2009DataTbl.REVOLVE_FUND, TranHist2009DataTbl.EXOP_OVERRIDE_IND, TranHist2009DataTbl.GROUPING, TranHist2009DataTbl.BATCH_ID, TranHist2009DataTbl.AVBL_OVERRIDE_IND, TranHist2009DataTbl.BOOKKEEPING, TranHist2009DataTbl.SUBS_GL, TranHist2009DataTbl.SUBS_EXT_GL, TranHist2009DataTbl.AVBL_OVERRIDE_GP, TranHist2009DataTbl.MEMO_BLKT, TranHist2009DataTbl.PROCESS_IND, TranHist2009DataTbl.BF_APPR_YR, TranHist2009DataTbl.MINORITY, TranHist2009DataTbl.PRIOR_PERIOD, TranHist2009DataTbl.PROP_BEG, TranHist2009DataTbl.RECORD_TYPE, TranHist2009DataTbl.CTRT_GRNT_LOC, TranHist2009DataTbl.CTRT_GRNT_FLOW, TranHist2009DataTbl.PROP_QTY, TranHist2009DataTbl.TRN_USE_IND, TranHist2009DataTbl.CTRT_GRNT_USE_IND, TranHist2009DataTbl.PROJECT_ID, TranHist2009DataTbl.CFI, TranHist2009DataTbl.BF_CFI, TranHist2009DataTbl.SWDN, TranHist2009DataTbl.ACCRUAL, TranHist2009DataTbl.GRANT_ALI, TranHist2009DataTbl.GRANT_AVBL, TranHist2009DataTbl.SOURCE, TranHist2009DataTbl.CAT_EXT, TranHist2009DataTbl.CONTRACT_ALI, TranHist2009DataTbl.CONTRACT_AVBL, TranHist2009DataTbl.PROJECT_ALI, TranHist2009DataTbl.PROJECT_AVBL, TranHist2009DataTbl.ASOF_MTH_YR, TranHist2009DataTbl.FY_END, TranHist2009DataTbl.IW_DT, CatTbl.CAT_NM, OCATbl.OCA_NM
HAVING (((TranHist2009DataTbl.GL_CD) Like "931*") AND ((TranHist2009DataTbl.CFI)<>"c"));
Objcode ObjName ALLOTMENTS EXPENDITURES Encumbrance
230010 PRINTING 50,000.00 0.00 10,798.11
230030 PHOTOCOPY 0.00 0.00 22.14
230040 BOOK BIND 0.00 1,404.50 0.00
In this example I would only get a allotment amount for the 230010 code and not the other two and I need to get a 0.00 amount for them to match the Expenditure and Encumbrance when I try to create the report above.
This is the query to extract the allotments but I can't figure out how to create a 0.00 amount for a objcode if there is not a alloment for that objcode. Note your see also where I change the Trn_amt to from a neg to pos number due to the mainframes function and need to do this for viewing purpose of the staff.
TranHist2009DataTbl.FID, TranHist2009DataTbl.BE_CD, TranHist2009DataTbl.IBI, TranHist2009DataTbl.CAT, TranHist2009DataTbl.APPR_YR, TranHist2009DataTbl.GL_CD, TranHist2009DataTbl.OBJ, ObjectCodeNameTbl.OBJ_NM, TranHist2009DataTbl.PROGRAM_STD, TranHist2009DataTbl.PROGRAM_AGENCY, TranHist2009DataTbl.PROD, TranHist2009DataTbl.FUND_EXT, TranHist2009DataTbl.GL_EXT, TranHist2009DataTbl.OBJ_EXT, TranHist2009DataTbl.PROGRAM_EXT, TranHist2009DataTbl.INTER_INTRA, TranHist2009DataTbl.TRN_CD, TranHist2009DataTbl.EXOP_ID, TranHist2009DataTbl.EXOP_VER_NBR, TranHist2009DataTbl.TRN_DT, TranHist2009DataTbl.TRN_AMT, [trn_amt]<0 AS TranAmt, IIf([tranamt]<0,[TRN_AMT]*[tranamt],[Trn_Amt]*-1) AS TranActionAmt, TranHist2009DataTbl.AGENCY_DOC_NBR, TranHist2009DataTbl.VENDOR_ID, TranHist2009DataTbl.VENDOR_NM1, TranHist2009DataTbl.NBI, TranHist2009DataTbl.SCND_DOC_NBR, TranHist2009DataTbl.OTHER_SUBVENDOR_ID, TranHist2009DataTbl.INVOICE_NBR, TranHist2009DataTbl.BF_ORG, TranHist2009DataTbl.BF_EXOP, TranHist2009DataTbl.BF_OBJ, TranHist2009DataTbl.BF_CAT, TranHist2009DataTbl.CHK_ID, TranHist2009DataTbl.CHK_DT, TranHist2009DataTbl.TRN_DESC, TranHist2009DataTbl.ORGN_FUND_SOURCE, TranHist2009DataTbl.OTHER_DOC_NBR, TranHist2009DataTbl.ADD_DT, TranHist2009DataTbl.TRN_QTY, TranHist2009DataTbl.PROD_UNIT, TranHist2009DataTbl.PROD_TIME, TranHist2009DataTbl.FINAL_PYMT_IND, TranHist2009DataTbl.SITE, TranHist2009DataTbl.USER_NBR, TranHist2009DataTbl.AVBL_IND, TranHist2009DataTbl.ALI, TranHist2009DataTbl.ADD_TS, TranHist2009DataTbl.TERMINAL, TranHist2009DataTbl.EXOP_SET, TranHist2009DataTbl.VOUCHER_TYPE, TranHist2009DataTbl.CLEAR_FUND, TranHist2009DataTbl.REVOLVE_FUND, TranHist2009DataTbl.EXOP_OVERRIDE_IND, TranHist2009DataTbl.GROUPING, TranHist2009DataTbl.BATCH_ID, TranHist2009DataTbl.AVBL_OVERRIDE_IND, TranHist2009DataTbl.BOOKKEEPING, TranHist2009DataTbl.SUBS_GL, TranHist2009DataTbl.SUBS_EXT_GL, TranHist2009DataTbl.AVBL_OVERRIDE_GP, TranHist2009DataTbl.MEMO_BLKT, TranHist2009DataTbl.PROCESS_IND, TranHist2009DataTbl.BF_APPR_YR, TranHist2009DataTbl.MINORITY, TranHist2009DataTbl.PRIOR_PERIOD, TranHist2009DataTbl.PROP_BEG, TranHist2009DataTbl.RECORD_TYPE, TranHist2009DataTbl.CTRT_GRNT_LOC, TranHist2009DataTbl.CTRT_GRNT_FLOW, TranHist2009DataTbl.PROP_QTY, TranHist2009DataTbl.TRN_USE_IND, TranHist2009DataTbl.CTRT_GRNT_USE_IND, TranHist2009DataTbl.PROJECT_ID, TranHist2009DataTbl.CFI, TranHist2009DataTbl.BF_CFI, TranHist2009DataTbl.SWDN, TranHist2009DataTbl.ACCRUAL, TranHist2009DataTbl.GRANT_ALI, TranHist2009DataTbl.GRANT_AVBL, TranHist2009DataTbl.SOURCE, TranHist2009DataTbl.CAT_EXT, TranHist2009DataTbl.CONTRACT_ALI, TranHist2009DataTbl.CONTRACT_AVBL, TranHist2009DataTbl.PROJECT_ALI, TranHist2009DataTbl.PROJECT_AVBL, TranHist2009DataTbl.ASOF_MTH_YR, TranHist2009DataTbl.FY_END, TranHist2009DataTbl.IW_DT, CatTbl.CAT_NM, OCATbl.OCA_NM
FROM ((TranHist2009DataTbl INNER JOIN CatTbl ON TranHist2009DataTbl.CAT = CatTbl.CAT) INNER JOIN OCATbl ON TranHist2009DataTbl.OCA = OCATbl.OCA) INNER JOIN ObjectCodeNameTbl ON TranHist2009DataTbl.OBJ = ObjectCodeNameTbl.OBJ
GROUP BY TranHist2009DataTbl.OLO, TranHist2009DataTbl.L2_CD, TranHist2009DataTbl.L3_CD, TranHist2009DataTbl.L4_CD, TranHist2009DataTbl.L5_CD, "45" & [L2_cd], "45" & [L2_cd] & [L3_cd] & [L4_cd] & [L5_cd], TranHist2009DataTbl.AU_CD, TranHist2009DataTbl.GRANT_NBR, TranHist2009DataTbl.GRANT_YR, TranHist2009DataTbl.CONTRACT_NBR, TranHist2009DataTbl.CONTRACT_YR, TranHist2009DataTbl.OCA, TranHist2009DataTbl.GF_CD, TranHist2009DataTbl.SF_CD, TranHist2009DataTbl.FID, TranHist2009DataTbl.BE_CD, TranHist2009DataTbl.IBI, TranHist2009DataTbl.CAT, TranHist2009DataTbl.APPR_YR, TranHist2009DataTbl.GL_CD, TranHist2009DataTbl.OBJ, ObjectCodeNameTbl.OBJ_NM, TranHist2009DataTbl.PROGRAM_STD, TranHist2009DataTbl.PROGRAM_AGENCY, TranHist2009DataTbl.PROD, TranHist2009DataTbl.FUND_EXT, TranHist2009DataTbl.GL_EXT, TranHist2009DataTbl.OBJ_EXT, TranHist2009DataTbl.PROGRAM_EXT, TranHist2009DataTbl.INTER_INTRA, TranHist2009DataTbl.TRN_CD, TranHist2009DataTbl.EXOP_ID, TranHist2009DataTbl.EXOP_VER_NBR, TranHist2009DataTbl.TRN_DT, TranHist2009DataTbl.TRN_AMT, TranHist2009DataTbl.AGENCY_DOC_NBR, TranHist2009DataTbl.VENDOR_ID, TranHist2009DataTbl.VENDOR_NM1, TranHist2009DataTbl.NBI, TranHist2009DataTbl.SCND_DOC_NBR, TranHist2009DataTbl.OTHER_SUBVENDOR_ID, TranHist2009DataTbl.INVOICE_NBR, TranHist2009DataTbl.BF_ORG, TranHist2009DataTbl.BF_EXOP, TranHist2009DataTbl.BF_OBJ, TranHist2009DataTbl.BF_CAT, TranHist2009DataTbl.CHK_ID, TranHist2009DataTbl.CHK_DT, TranHist2009DataTbl.TRN_DESC, TranHist2009DataTbl.ORGN_FUND_SOURCE, TranHist2009DataTbl.OTHER_DOC_NBR, TranHist2009DataTbl.ADD_DT, TranHist2009DataTbl.TRN_QTY, TranHist2009DataTbl.PROD_UNIT, TranHist2009DataTbl.PROD_TIME, TranHist2009DataTbl.FINAL_PYMT_IND, TranHist2009DataTbl.SITE, TranHist2009DataTbl.USER_NBR, TranHist2009DataTbl.AVBL_IND, TranHist2009DataTbl.ALI, TranHist2009DataTbl.ADD_TS, TranHist2009DataTbl.TERMINAL, TranHist2009DataTbl.EXOP_SET, TranHist2009DataTbl.VOUCHER_TYPE, TranHist2009DataTbl.CLEAR_FUND, TranHist2009DataTbl.REVOLVE_FUND, TranHist2009DataTbl.EXOP_OVERRIDE_IND, TranHist2009DataTbl.GROUPING, TranHist2009DataTbl.BATCH_ID, TranHist2009DataTbl.AVBL_OVERRIDE_IND, TranHist2009DataTbl.BOOKKEEPING, TranHist2009DataTbl.SUBS_GL, TranHist2009DataTbl.SUBS_EXT_GL, TranHist2009DataTbl.AVBL_OVERRIDE_GP, TranHist2009DataTbl.MEMO_BLKT, TranHist2009DataTbl.PROCESS_IND, TranHist2009DataTbl.BF_APPR_YR, TranHist2009DataTbl.MINORITY, TranHist2009DataTbl.PRIOR_PERIOD, TranHist2009DataTbl.PROP_BEG, TranHist2009DataTbl.RECORD_TYPE, TranHist2009DataTbl.CTRT_GRNT_LOC, TranHist2009DataTbl.CTRT_GRNT_FLOW, TranHist2009DataTbl.PROP_QTY, TranHist2009DataTbl.TRN_USE_IND, TranHist2009DataTbl.CTRT_GRNT_USE_IND, TranHist2009DataTbl.PROJECT_ID, TranHist2009DataTbl.CFI, TranHist2009DataTbl.BF_CFI, TranHist2009DataTbl.SWDN, TranHist2009DataTbl.ACCRUAL, TranHist2009DataTbl.GRANT_ALI, TranHist2009DataTbl.GRANT_AVBL, TranHist2009DataTbl.SOURCE, TranHist2009DataTbl.CAT_EXT, TranHist2009DataTbl.CONTRACT_ALI, TranHist2009DataTbl.CONTRACT_AVBL, TranHist2009DataTbl.PROJECT_ALI, TranHist2009DataTbl.PROJECT_AVBL, TranHist2009DataTbl.ASOF_MTH_YR, TranHist2009DataTbl.FY_END, TranHist2009DataTbl.IW_DT, CatTbl.CAT_NM, OCATbl.OCA_NM
HAVING (((TranHist2009DataTbl.GL_CD) Like "931*") AND ((TranHist2009DataTbl.CFI)<>"c"));