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

Remove COA Detail #339

Merged
merged 4 commits into from
Apr 9, 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
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