Skip to content

Commit

Permalink
Merge pull request #339 from ucdavis/JCS/RemoveCoaDetail
Browse files Browse the repository at this point in the history
Remove COA Detail
  • Loading branch information
jSylvestre authored Apr 9, 2024
2 parents ea54a04 + 945f78a commit 85d9bb7
Show file tree
Hide file tree
Showing 9 changed files with 500 additions and 262 deletions.
3 changes: 0 additions & 3 deletions Finjector.Core/Data/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ protected AppDbContext(DbContextOptions options) : base(options)
public virtual DbSet<Team> Teams { get; set; } = null!;
public virtual DbSet<TeamPermission> TeamPermissions { get; set; } = null!;

public virtual DbSet<CoaDetail> CoaDetails { get; set; } = null!;

protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
Coa.OnModelCreating(builder);
CoaDetail.OnModelCreating(builder);
Folder.OnModelCreating(builder);
FolderPermission.OnModelCreating(builder);
Team.OnModelCreating(builder);
Expand Down
1 change: 0 additions & 1 deletion Finjector.Core/Domain/Coa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class Coa
[Required]
[MaxLength(128)] //Actually 70 I think, but a little play...
public string SegmentString { get; set; } = string.Empty;
public CoaDetail Detail { get; set; } = null!;

[MaxLength(3)]
public string ChartType { get; set; } = string.Empty;
Expand Down
80 changes: 0 additions & 80 deletions Finjector.Core/Domain/CoaDetail.cs

This file was deleted.

43 changes: 0 additions & 43 deletions Finjector.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,5 @@ public static string ToUpperTrim(this string value)
return value.Trim().ToUpper();
}

/// <summary>
/// Return segmented detail values from a CoA string
/// </summary>
/// <param name="value">Should be either a PPM or GL string</param>
/// <returns></returns>
public static CoaDetail ToCoADetail(this string value)
{
var chartType = FinancialChartValidation.GetFinancialChartStringType(value);

if (chartType == FinancialChartStringType.Invalid)
{
return new CoaDetail();
}

var rtValue = new CoaDetail()
{
Id = value,
ChartType = chartType == FinancialChartStringType.Ppm ? Coa.ChartTypes.PPM : Coa.ChartTypes.GL
};

if (chartType == FinancialChartStringType.Ppm)
{
var parts = value.Split('-');
rtValue.Project = parts[0];
rtValue.Task = parts[1];
rtValue.Department = parts[2];
rtValue.NaturalAccount = parts[3];
}
if (chartType == FinancialChartStringType.Gl)
{
var parts = value.Split('-');
rtValue.Entity = parts[0];
rtValue.Fund = parts[1];
rtValue.Department = parts[2];
rtValue.NaturalAccount = parts[3];
rtValue.Purpose = parts[4];
rtValue.Program = parts[5];
rtValue.Project = parts[6];
rtValue.Activity = parts[7];
}

return rtValue;
}
}
}
Loading

0 comments on commit 85d9bb7

Please sign in to comment.