Distribution_GL Initialization

This commit is contained in:
2026-10-20 13:07:07 +05:30
commit 3f16e0cb44
194 changed files with 35659 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
namespace General_Ledger_Service.Models
{
public class AccountType
{
public short Id { get; set; }
public string Name { get; set; } = string.Empty;
public string NormalBalance { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
public class Account
{
public long AccountId { get; set; }
public string AccountCode { get; set; } = string.Empty;
public string AccountName { get; set; } = string.Empty;
public long? ParentAccountId { get; set; }
public short AccountTypeId { get; set; }
public bool IsControlAccount { get; set; }
public bool IsPostable { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public string? CashFlowCategory { get; set; }
public string? IncomeStatementSection { get; set; }
public string? BalanceSheetClassification { get; set; }
public bool IsTaxDeductible { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public Account? ParentAccount { get; set; }
public AccountType AccountType { get; set; } = null!;
public Currency Currency { get; set; } = null!;
}
}
+16
View File
@@ -0,0 +1,16 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class AuditLog
{
public long AuditLogId { get; set; }
public AuditCategory Category { get; set; }
public string EntityName { get; set; } = string.Empty;
public string EntityId { get; set; } = string.Empty;
public AuditAction Action { get; set; }
public string? Description { get; set; }
public string? PerformedBy { get; set; }
public DateTime OccurredAt { get; set; }
}
}
+72
View File
@@ -0,0 +1,72 @@
namespace General_Ledger_Service.Models
{
public class BankAccount
{
public long BankAccountId { get; set; }
public string AccountName { get; set; } = string.Empty;
public string? BankName { get; set; }
public string? AccountNumber { get; set; }
public long GlAccountId { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
public Account GlAccount { get; set; } = null!;
public Currency Currency { get; set; } = null!;
}
public class BankStatementLine
{
public long StmtLineId { get; set; }
public long BankAccountId { get; set; }
public DateOnly TxnDate { get; set; }
public string? Description { get; set; }
public decimal Amount { get; set; }
public bool IsReconciled { get; set; }
public long? MatchedJournalId { get; set; }
public DateTime CreatedAt { get; set; }
public BankAccount BankAccount { get; set; } = null!;
public JournalEntry? MatchedJournal { get; set; }
}
// Separate from BankAccount - a cash account is not a bank account, just the same "level"
// of concept (both are cash-and-bank master data referencing a GL account), decided
// 2026-07-22 after starting from (and rejecting) a single-table CASH/BANK discriminator.
public class CashAccount
{
public long CashAccountId { get; set; }
public string AccountName { get; set; } = string.Empty;
public int CashAccountTypeId { get; set; }
public string AccountNumber { get; set; } = string.Empty;
public long GlAccountId { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
// Exactly one CashAccount is ever marked default — seeded once (BankService's seed
// check) so there is always at least one cash account to fall back to. Protected from
// delete/deactivate (BankService.UpdateCashAccountStatusAsync/DeleteCashAccountAsync);
// only its AccountName may be changed.
public bool IsDefault { get; set; }
public DateTime CreatedAt { get; set; }
public CashAccountType CashAccountType { get; set; } = null!;
public Account GlAccount { get; set; } = null!;
public Currency Currency { get; set; } = null!;
}
// Grows at runtime - creating a CashAccount with a cashAccountTypeName not already present
// here causes a new row to be added on the fly (BankService.CreateCashAccountAsync), so it
// appears in the list for future selections without a migration.
public class CashAccountType
{
public int CashAccountTypeId { get; set; }
public string Name { get; set; } = string.Empty;
// Nullable - existing rows (incl. the seeded Petty Cash/Till Cash/Safe Cash/Cash in
// Transit types) predate this column. BankService.CreateCashAccountAsync lazily creates
// and backfills this the first time a type is used to back a new cash account (retrofit
// 2026-07-31) - the GL node for a type that's never been used yet simply doesn't exist.
public long? GlAccountId { get; set; }
public DateTime CreatedAt { get; set; }
public Account? GlAccount { get; set; }
}
}
+29
View File
@@ -0,0 +1,29 @@
namespace General_Ledger_Service.Models
{
public class Budget
{
public long BudgetId { get; set; }
public int FiscalYearId { get; set; }
public string Name { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
public FiscalYear FiscalYear { get; set; } = null!;
public ICollection<BudgetLine> Lines { get; set; } = new List<BudgetLine>();
}
public class BudgetLine
{
public long BudgetLineId { get; set; }
public long BudgetId { get; set; }
public long AccountId { get; set; }
public int PeriodId { get; set; }
public long? CostCenterId { get; set; }
public decimal BudgetedAmount { get; set; }
public DateTime CreatedAt { get; set; }
public Budget Budget { get; set; } = null!;
public Account Account { get; set; } = null!;
public AccountingPeriod Period { get; set; } = null!;
public CostCenter? CostCenter { get; set; }
}
}
+105
View File
@@ -0,0 +1,105 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class ChequeBook
{
public long ChequeBookId { get; set; }
public long BranchId { get; set; }
public long BankAccountId { get; set; }
public string ChequeBookNo { get; set; } = string.Empty;
public string StartChequeNo { get; set; } = string.Empty;
public string EndChequeNo { get; set; } = string.Empty;
public int TotalLeaves { get; set; }
public DateOnly ReceivedDate { get; set; }
public ChequeBookStatus Status { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; }
public string? CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public string? ModifiedBy { get; set; }
public DateTime? ModifiedAt { get; set; }
public BankAccount BankAccount { get; set; } = null!;
public List<ChequePage> Pages { get; set; } = [];
}
public class ChequePage
{
public long ChequePageId { get; set; }
public long ChequeBookId { get; set; }
public string ChequeNo { get; set; } = string.Empty;
public ChequeIssueStatus IssueStatus { get; set; }
// Set only once issued - no Supplier/Customer/Employee master table exists in this
// service, so PayeeId is a loose external reference (no FK), same treatment as
// AuditLog.EntityId.
public ChequePayeeType? PayeeType { get; set; }
public long? PayeeId { get; set; }
public string? PayeeName { get; set; }
public DateOnly? IssueDate { get; set; }
public decimal? Amount { get; set; }
public string? CurrencyCode { get; set; }
// Loose reference - no Voucher table exists in this service.
public long? VoucherId { get; set; }
public string? ReferenceNo { get; set; }
public string? Purpose { get; set; }
public bool IsCrossCheque { get; set; }
public bool IsAccountPayee { get; set; }
public bool IsPostDated { get; set; }
public DateOnly? ClearedDate { get; set; }
public bool ClearedByBank { get; set; }
public string? CancelReason { get; set; }
public string? Notes { get; set; }
public string? PrintedBy { get; set; }
public DateTime? PrintedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public ChequeBook ChequeBook { get; set; } = null!;
public Currency? Currency { get; set; }
}
// No ChequeBook link by design - these cheques are received from the other side (customers/
// suppliers/etc.), not issued from one of this company's own cheque books.
public class ReceivedCheque
{
public long ReceivedChequeId { get; set; }
public long CompanyId { get; set; }
public long? BranchId { get; set; }
public ReceivedChequeFromType ReceivedFromType { get; set; }
public long? ReceivedFromId { get; set; }
public string ReceivedFromName { get; set; } = string.Empty;
// Plain free text, not a FK - no bank-master table exists in this service, same
// precedent as BankAccount.BankName already being free text.
public string? DrawerBankName { get; set; }
public string? DrawerBankBranch { get; set; }
public string? AccountHolderName { get; set; }
public string ChequeNo { get; set; } = string.Empty;
public DateOnly ChequeDate { get; set; }
public decimal Amount { get; set; }
public DateOnly ReceivedDate { get; set; }
public long? DepositBankAccountId { get; set; }
public DateOnly? DepositDate { get; set; }
public ReceivedChequeStatus Status { get; set; }
public string? ReferenceType { get; set; }
public long? ReferenceId { get; set; }
public string? Notes { get; set; }
public string? CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public BankAccount? DepositBankAccount { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
namespace General_Ledger_Service.Models
{
public class CostCenter
{
public long CostCenterId { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public long? ParentCostCenterId { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public CostCenter? ParentCostCenter { get; set; }
}
}
+36
View File
@@ -0,0 +1,36 @@
namespace General_Ledger_Service.Models
{
public class Currency
{
public string CurrencyCode { get; set; } = string.Empty;
public string CurrencyName { get; set; } = string.Empty;
public string? Symbol { get; set; }
public short DecimalPlaces { get; set; }
public bool IsBaseCurrency { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
}
public class CurrencyRoundingRule
{
public string CurrencyCode { get; set; } = string.Empty;
public string RoundingMethod { get; set; } = string.Empty;
public long? RoundingAccountId { get; set; }
public DateTime CreatedAt { get; set; }
public Currency Currency { get; set; } = null!;
public Account? RoundingAccount { get; set; }
}
public class ExchangeRate
{
public long RateId { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public DateOnly RateDate { get; set; }
public decimal RateToBase { get; set; }
public string RateSource { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
public Currency Currency { get; set; } = null!;
}
}
+41
View File
@@ -0,0 +1,41 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class FiscalYear
{
public int FiscalYearId { get; set; }
public string YearName { get; set; } = string.Empty;
public DateOnly StartDate { get; set; }
public DateOnly EndDate { get; set; }
public bool IsClosed { get; set; }
public DateTime CreatedAt { get; set; }
}
public class AccountingPeriod
{
public int PeriodId { get; set; }
public int FiscalYearId { get; set; }
public short PeriodNumber { get; set; }
public DateOnly StartDate { get; set; }
public DateOnly EndDate { get; set; }
public PeriodStatus Status { get; set; }
public bool LockGl { get; set; }
public string? LockReason { get; set; }
public DateTime CreatedAt { get; set; }
public FiscalYear FiscalYear { get; set; } = null!;
}
public class PeriodLockLog
{
public long LogId { get; set; }
public int PeriodId { get; set; }
public PeriodLockAction Action { get; set; }
public string? ModuleLocked { get; set; }
public string? Reason { get; set; }
public DateTime CreatedAt { get; set; }
public AccountingPeriod Period { get; set; } = null!;
}
}
+59
View File
@@ -0,0 +1,59 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class FixedAsset
{
public long AssetId { get; set; }
public string AssetCode { get; set; } = string.Empty;
public string AssetName { get; set; } = string.Empty;
public long AssetAccountId { get; set; }
public long AccumDeprAccountId { get; set; }
public long DeprExpenseAccountId { get; set; }
public long GainLossAccountId { get; set; }
public DateOnly AcquisitionDate { get; set; }
public decimal AcquisitionCost { get; set; }
public decimal ResidualValue { get; set; }
public int UsefulLifeMonths { get; set; }
public DepreciationMethod DepreciationMethod { get; set; }
public decimal? DepreciationRatePercent { get; set; }
public FixedAssetStatus Status { get; set; }
public DateTime CreatedAt { get; set; }
public Account AssetAccount { get; set; } = null!;
public Account AccumDeprAccount { get; set; } = null!;
public Account DeprExpenseAccount { get; set; } = null!;
public Account GainLossAccount { get; set; } = null!;
}
public class DepreciationSchedule
{
public long ScheduleId { get; set; }
public long AssetId { get; set; }
public int PeriodId { get; set; }
public decimal DepreciationAmount { get; set; }
public decimal AccumulatedDepreciation { get; set; }
public decimal NetBookValue { get; set; }
public long? JournalId { get; set; }
public DateTime CreatedAt { get; set; }
public FixedAsset Asset { get; set; } = null!;
public AccountingPeriod Period { get; set; } = null!;
public JournalEntry? Journal { get; set; }
}
public class AssetDisposal
{
public long DisposalId { get; set; }
public long AssetId { get; set; }
public DateOnly DisposalDate { get; set; }
public decimal? Proceeds { get; set; }
public decimal? NetBookValueAtDisposal { get; set; }
public decimal? GainLoss { get; set; }
public long? JournalId { get; set; }
public DateTime CreatedAt { get; set; }
public FixedAsset Asset { get; set; } = null!;
public JournalEntry? Journal { get; set; }
}
}
+61
View File
@@ -0,0 +1,61 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class JournalEntry
{
public long JournalId { get; set; }
public string JournalNo { get; set; } = string.Empty;
public int PeriodId { get; set; }
public DateOnly EntryDate { get; set; }
public string JournalType { get; set; } = string.Empty;
public string? SourceModule { get; set; }
public string? Reference { get; set; }
public string? Narration { get; set; }
public bool IsPosted { get; set; }
public bool IsReversed { get; set; }
public long? ReversalOfId { get; set; }
public JournalEntryStatus EntryStatus { get; set; }
public string? PreparedBy { get; set; }
public DateTime CreatedAt { get; set; }
public AccountingPeriod Period { get; set; } = null!;
public JournalEntry? ReversalOf { get; set; }
public ICollection<JournalEntryLine> Lines { get; set; } = new List<JournalEntryLine>();
}
public class JournalEntryLine
{
public long LineId { get; set; }
public long JournalId { get; set; }
public long AccountId { get; set; }
public decimal DebitAmount { get; set; }
public decimal CreditAmount { get; set; }
public string CurrencyCode { get; set; } = string.Empty;
public decimal ExchangeRate { get; set; }
public decimal BaseDebit { get; set; }
public decimal BaseCredit { get; set; }
public long? CostCenterId { get; set; }
public string? Memo { get; set; }
public DateTime CreatedAt { get; set; }
public JournalEntry Journal { get; set; } = null!;
public Account Account { get; set; } = null!;
public CostCenter? CostCenter { get; set; }
public Currency Currency { get; set; } = null!;
}
public class JournalCorrection
{
public long CorrectionId { get; set; }
public long OriginalJournalId { get; set; }
public long CorrectionJournalId { get; set; }
public JournalCorrectionType CorrectionType { get; set; }
public string Reason { get; set; } = string.Empty;
public string? CorrectedBy { get; set; }
public DateTime CreatedAt { get; set; }
public JournalEntry OriginalJournal { get; set; } = null!;
public JournalEntry CorrectionJournal { get; set; } = null!;
}
}
+30
View File
@@ -0,0 +1,30 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class RecurringJournalTemplate
{
public long TemplateId { get; set; }
public string TemplateName { get; set; } = string.Empty;
public RecurrencePattern RecurrencePattern { get; set; }
public DateOnly NextRunDate { get; set; }
public DateOnly? EndDate { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public ICollection<RecurringJournalTemplateLine> Lines { get; set; } = new List<RecurringJournalTemplateLine>();
}
public class RecurringJournalTemplateLine
{
public long LineId { get; set; }
public long TemplateId { get; set; }
public long AccountId { get; set; }
public decimal DebitAmount { get; set; }
public decimal CreditAmount { get; set; }
public DateTime CreatedAt { get; set; }
public RecurringJournalTemplate Template { get; set; } = null!;
public Account Account { get; set; } = null!;
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace General_Ledger_Service.Models
{
public class SystemConfig
{
public string ConfigKey { get; set; } = string.Empty;
public string ConfigValue { get; set; } = string.Empty;
public string? Description { get; set; }
public bool IsEditable { get; set; }
public bool IsLocked { get; set; }
public DateTime CreatedAt { get; set; }
}
}
+33
View File
@@ -0,0 +1,33 @@
using General_Ledger_Service.Enums;
namespace General_Ledger_Service.Models
{
public class TaxType
{
public int TaxTypeId { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
public class TaxCode
{
public long TaxCodeId { get; set; }
public int TaxTypeId { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public decimal RatePercent { get; set; }
public TaxCalculationBasis CalculationBasis { get; set; }
public TaxAppliesTo AppliesTo { get; set; }
public long? OutputTaxAccountId { get; set; }
public long? InputTaxAccountId { get; set; }
public DateOnly EffectiveFrom { get; set; }
public DateOnly? EffectiveTo { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public TaxType TaxType { get; set; } = null!;
public Account? OutputTaxAccount { get; set; }
public Account? InputTaxAccount { get; set; }
}
}