Skip to content

Commit

Permalink
Fixed the edge case scenario for end date being less than actual star… (
Browse files Browse the repository at this point in the history
#208)

* Fixed the edge case scenario for end date being less than actual start date. Bug 5591

* Committing changes for oracle batch name. Need to update config map for this.

* update oracle batch number format

* Merge branch 'main' into Bug-5591
  • Loading branch information
Prashanthi-Sivanarayana authored Aug 6, 2024
1 parent 5f503f0 commit a26c06b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
{
_oracleBatchNumber = Convert.ToInt32(serializedPFXData[0].ofm_oracle_batch_name) + 1;
_cgiBatchNumber = (Convert.ToInt32(serializedPFXData[0].ofm_batch_number) + 1).ToString("D9").Substring(0, 9);
oracleBatchName = _BCCASApi.clientCode + fiscalyear?.Substring(2) + "OFM" + (_oracleBatchNumber).ToString("D5");
oracleBatchName = _BCCASApi.clientCode + fiscalyear?.Substring(2) + "OFM" + (_oracleBatchNumber).ToString("D13");
}
else
{
Expand Down Expand Up @@ -363,7 +363,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
termsName = "Immediate".PadRight(header.FieldLength("termsName")),//setting it to immediate for successful testing, this needs to be dynamic going forward.
goodsDate = string.Empty.PadRight(header.FieldLength("goodsDate")),//optional field so set to null
invoiceRecDate = headeritem.First().ofm_invoice_received_date?.ToString("yyyyMMdd"),//ideally is is 4 days before current date
oracleBatchName = (_BCCASApi.clientCode + fiscalyear?.Substring(2) + "OFM" + (_oracleBatchNumber).ToString("D5")).PadRight(header.FieldLength("oracleBatchName")),//6225OFM00001 incremented by 1 for each header
oracleBatchName = (_BCCASApi.clientCode + fiscalyear?.Substring(2) + "OFM" + (_oracleBatchNumber).ToString("D13")).PadRight(header.FieldLength("oracleBatchName")),//6225OFM00001 incremented by 1 for each header
SIN = string.Empty.PadRight(header.FieldLength("SIN")), //optional field set to blank
payflag = _BCCASApi.InvoiceHeader.payflag,// Static value: Y (separate chq for each line)
description = string.Concat(headeritem.First()?.ofm_facility?.name).PadRight(header.FieldLength("description")),// can be used to pass extra info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private async Task<JsonObject> CreateSinglePayment(ExpenseApplication expenseInf
}

private async Task<JsonObject> CreatePaymentsInBatch(ExpenseApplication expenseInfo,
DateTime startDate,
DateTime originalStartDate,
DateTime endDate,
decimal? monthlyExpenseAmount,
Application baseApplication,
Expand All @@ -438,13 +438,10 @@ private async Task<JsonObject> CreatePaymentsInBatch(ExpenseApplication expenseI
{
List<HttpRequestMessage> createPaymentRequests = [];
int nextLineNumber = await GetNextInvoiceLineNumber(baseApplication.Id);

DateTime startDate = new(originalStartDate.Year, originalStartDate.Month, 1);
for (DateTime paymentDate = startDate; paymentDate <= endDate; paymentDate = paymentDate.AddMonths(1))
{



DateTime invoiceDate = (paymentDate == startDate) ? paymentDate.Date.GetPreviousBusinessDay(holidaysList) : paymentDate.Date.GetLastBusinessDayOfThePreviousMonth(holidaysList).GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
{
DateTime invoiceDate = (paymentDate == startDate) ? originalStartDate.Date.GetPreviousBusinessDay(holidaysList) : paymentDate.Date.GetLastBusinessDayOfThePreviousMonth(holidaysList).GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
DateTime invoiceReceivedDate = invoiceDate.AddBusinessDays(_BCCASApi.PayableInDays, holidaysList);
DateTime effectiveDate = invoiceDate;
Guid? fiscalYear = invoiceDate.MatchFiscalYear(fiscalYears);
Expand Down

0 comments on commit a26c06b

Please sign in to comment.