Skip to content

Commit

Permalink
Merge pull request #14423 from transcom/B-21636-Fix-PPTAS-Fields
Browse files Browse the repository at this point in the history
added check before TAC query
  • Loading branch information
deandreJones authored Dec 17, 2024
2 parents 5c2ff7a + 12165f2 commit 2403557
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions pkg/services/pptas_report/pptas_report_list_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,31 +513,33 @@ func buildServiceItemCrate(serviceItem models.MTOServiceItem) pptasmessages.Crat

// inputs all TAC related fields and builds full line of accounting string
func inputReportTAC(report *models.PPTASReport, pptasShipment *pptasmessages.PPTASShipment, orders models.Order, appCtx appcontext.AppContext, tacFetcher services.TransportationAccountingCodeFetcher, loa services.LineOfAccountingFetcher) error {
tac, err := tacFetcher.FetchOrderTransportationAccountingCodes(models.DepartmentIndicator(*orders.DepartmentIndicator), orders.IssueDate, *orders.TAC, appCtx)
if err != nil {
return err
} else if len(tac) < 1 {
return nil
}

if tac[0].LineOfAccounting != nil {
longLoa := loa.BuildFullLineOfAccountingString(*tac[0].LineOfAccounting)

pptasShipment.Loa = &longLoa
pptasShipment.FiscalYear = tac[0].TacFyTxt
pptasShipment.Appro = tac[0].LineOfAccounting.LoaBafID
pptasShipment.Subhead = tac[0].LineOfAccounting.LoaTrsySfxTx
pptasShipment.ObjClass = tac[0].LineOfAccounting.LoaObjClsID
pptasShipment.Bcn = tac[0].LineOfAccounting.LoaAlltSnID
pptasShipment.SubAllotCD = tac[0].LineOfAccounting.LoaSbaltmtRcpntID
pptasShipment.Aaa = tac[0].LineOfAccounting.LoaTrnsnID
pptasShipment.TypeCD = tac[0].LineOfAccounting.LoaJbOrdNm
pptasShipment.Paa = tac[0].LineOfAccounting.LoaInstlAcntgActID
pptasShipment.CostCD = tac[0].LineOfAccounting.LoaPgmElmntID
pptasShipment.Ddcd = tac[0].LineOfAccounting.LoaDptID

if report.OrderNumber == nil {
report.OrderNumber = tac[0].LineOfAccounting.LoaDocID
if orders.DepartmentIndicator != nil && orders.TAC != nil && !orders.IssueDate.IsZero() {
tac, err := tacFetcher.FetchOrderTransportationAccountingCodes(models.DepartmentIndicator(*orders.DepartmentIndicator), orders.IssueDate, *orders.TAC, appCtx)
if err != nil {
return err
} else if len(tac) < 1 {
return nil
}

if tac[0].LineOfAccounting != nil {
longLoa := loa.BuildFullLineOfAccountingString(*tac[0].LineOfAccounting)

pptasShipment.Loa = &longLoa
pptasShipment.FiscalYear = tac[0].TacFyTxt
pptasShipment.Appro = tac[0].LineOfAccounting.LoaBafID
pptasShipment.Subhead = tac[0].LineOfAccounting.LoaTrsySfxTx
pptasShipment.ObjClass = tac[0].LineOfAccounting.LoaObjClsID
pptasShipment.Bcn = tac[0].LineOfAccounting.LoaAlltSnID
pptasShipment.SubAllotCD = tac[0].LineOfAccounting.LoaSbaltmtRcpntID
pptasShipment.Aaa = tac[0].LineOfAccounting.LoaTrnsnID
pptasShipment.TypeCD = tac[0].LineOfAccounting.LoaJbOrdNm
pptasShipment.Paa = tac[0].LineOfAccounting.LoaInstlAcntgActID
pptasShipment.CostCD = tac[0].LineOfAccounting.LoaPgmElmntID
pptasShipment.Ddcd = tac[0].LineOfAccounting.LoaDptID

if report.OrderNumber == nil {
report.OrderNumber = tac[0].LineOfAccounting.LoaDocID
}
}
}

Expand Down

0 comments on commit 2403557

Please sign in to comment.