Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B-20948 MAIN #13688

Merged
merged 12 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ func SubTotalExpenses(expenseDocuments models.MovingExpenses) map[string]float64
if expense.MovingExpenseType == nil || expense.Amount == nil {
continue
} // Added quick nil check to ensure SSW returns while moving expenses are being added still
var nilPPMDocumentStatus *models.PPMDocumentStatus
if expense.Status != nilPPMDocumentStatus && (*expense.Status == models.PPMDocumentStatusRejected || *expense.Status == models.PPMDocumentStatusExcluded) {
continue
}
expenseType, addToTotal := getExpenseType(expense)
expenseDollarAmt := expense.Amount.ToDollarFloatNoRound()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,102 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatValuesShipmentSumma
suite.Equal("SAC", sswPage2.SAC)
}

func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatValuesShipmentSummaryWorksheetFormPage2ExcludeRejectedOrExcludedExpensesFromTotal() {
fortGordon := factory.FetchOrBuildOrdersDutyLocation(suite.DB())
orderIssueDate := time.Date(2018, time.December, 23, 0, 0, 0, 0, time.UTC)
locator := "ABCDEF-01"
singlePPM := models.PPMShipment{
Shipment: models.MTOShipment{
ShipmentLocator: &locator,
},
}
order := models.Order{
IssueDate: orderIssueDate,
OrdersType: internalmessages.OrdersTypePERMANENTCHANGEOFSTATION,
OrdersNumber: models.StringPointer("012346"),
NewDutyLocationID: fortGordon.ID,
TAC: models.StringPointer("NTA4"),
SAC: models.StringPointer("SAC"),
HasDependents: true,
SpouseHasProGear: true,
}
paidWithGTCCFalse := false
paidWithGTCCTrue := true
tollExpense := models.MovingExpenseReceiptTypeTolls
oilExpense := models.MovingExpenseReceiptTypeOil
approvedStatus := models.PPMDocumentStatusApproved
excludedStatus := models.PPMDocumentStatusExcluded
rejectedStatus := models.PPMDocumentStatusRejected
amount := unit.Cents(10000)
smallerAmount := unit.Cents(5000)
movingExpenses := models.MovingExpenses{
// APPROVED
{
MovingExpenseType: &tollExpense,
Amount: &amount,
PaidWithGTCC: &paidWithGTCCFalse,
Status: &approvedStatus,
},
{
MovingExpenseType: &oilExpense,
Amount: &smallerAmount,
PaidWithGTCC: &paidWithGTCCTrue,
Status: &approvedStatus,
},
// EXCLUDED
{
MovingExpenseType: &tollExpense,
Amount: &amount,
PaidWithGTCC: &paidWithGTCCTrue,
Status: &excludedStatus,
},
{
MovingExpenseType: &tollExpense,
Amount: &amount,
PaidWithGTCC: &paidWithGTCCFalse,
Status: &excludedStatus,
},
{
MovingExpenseType: &oilExpense,
Amount: &smallerAmount,
PaidWithGTCC: &paidWithGTCCFalse,
Status: &excludedStatus,
},
// REJECTED
{
MovingExpenseType: &oilExpense,
Amount: &amount,
PaidWithGTCC: &paidWithGTCCFalse,
Status: &rejectedStatus,
},
{
MovingExpenseType: &tollExpense,
Amount: &amount,
PaidWithGTCC: &paidWithGTCCTrue,
Status: &rejectedStatus,
},
}

ssd := models.ShipmentSummaryFormData{
Order: order,
MovingExpenses: movingExpenses,
PPMShipment: singlePPM,
}

mockPPMCloseoutFetcher := &mocks.PPMCloseoutFetcher{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in INT PR but match what is currently in INT so these are fine.

sswPPMComputer := NewSSWPPMComputer(mockPPMCloseoutFetcher)
sswPage2, err := sswPPMComputer.FormatValuesShipmentSummaryWorksheetFormPage2(ssd, false)
suite.NoError(err)
suite.Equal("$0.00", sswPage2.TollsGTCCPaid)
suite.Equal("$100.00", sswPage2.TollsMemberPaid)
suite.Equal("$0.00", sswPage2.OilMemberPaid)
suite.Equal("$50.00", sswPage2.OilGTCCPaid)
suite.Equal("$50.00", sswPage2.TotalGTCCPaid)
suite.Equal("$100.00", sswPage2.TotalMemberPaid)
suite.Equal("NTA4", sswPage2.TAC)
suite.Equal("SAC", sswPage2.SAC)
}

func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatValuesShipmentSummaryWorksheetFormPage3() {
yuma := factory.FetchOrBuildCurrentDutyLocation(suite.DB())
fortGordon := factory.FetchOrBuildOrdersDutyLocation(suite.DB())
Expand Down