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
@@ -0,0 +1,26 @@
using General_Ledger_Service.DTOs.Accounts;
using General_Ledger_Service.DTOs.Reports;
using General_Ledger_Service.Models;
//using
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IAccountRepository
{
Task<Account?> GetByIdAsync(long accountId);
Task<Account?> GetByCodeAsync(string accountCode);
Task<Account?> GetByNameAndParentAsync(string accountName, long? parentAccountId);
Task<int> GetAncestorDepthAsync(long parentAccountId);
Task<string?> GetAncestorBreadcrumbAsync(long accountId);
Task<List<AccountTreeNode>> GetDescendantTreeAsync(long accountId);
Task<bool> WouldCreateCycleAsync(long accountId, long newParentId);
Task<(List<Account> Items, int TotalCount)> SearchAsync(short? accountTypeId, bool? isActive, bool? isPostable, int? page, int? pageSize);
Task<Account> AddAsync(Account account);
Task<List<TrialBalanceRowDto>> GetTrialBalanceAsync(DateOnly asOfDate);
Task<List<BalanceSheetLeafRowDto>> GetBalanceSheetLeafRowsAsync(DateOnly asOfDate);
Task<List<ProfitAndLossLeafRowDto>> GetProfitAndLossLeafRowsAsync(DateOnly periodStart, DateOnly periodEnd);
Task<List<CashFlowWorkingCapitalChangeDto>> GetCashFlowWorkingCapitalChangesAsync(DateOnly periodStart, DateOnly periodEnd, long cashAccountRootId);
Task<List<CashFlowLineDto>> GetCashFlowCategoryLinesAsync(string category, DateOnly periodStart, DateOnly periodEnd, long cashAccountRootId);
Task<decimal> GetCashBalanceAsync(DateOnly asOfDate, long cashAccountRootId);
}
}
@@ -0,0 +1,13 @@
using General_Ledger_Service.Enums;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IAuditLogRepository
{
Task AddAsync(AuditLog log);
Task<(List<AuditLog> Items, int TotalCount)> ListAsync(
List<AuditCategory> categories, string? entityName, AuditAction? action,
string? performedBy, DateOnly? from, DateOnly? to, int? page, int? pageSize);
}
}
@@ -0,0 +1,23 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IBankRepository
{
Task<BankAccount?> GetByIdAsync(long bankAccountId);
Task<BankAccount> AddAsync(BankAccount bankAccount);
Task<List<BankAccount>> GetAllAsync();
Task<BankStatementLine?> GetStatementLineByIdAsync(long stmtLineId);
Task AddStatementLinesAsync(IEnumerable<BankStatementLine> lines);
Task<CashAccount> AddCashAccountAsync(CashAccount cashAccount);
Task<List<CashAccount>> GetAllCashAccountsAsync();
Task<CashAccount?> GetCashAccountByIdAsync(long cashAccountId);
Task<bool> AnyDefaultCashAccountAsync();
void RemoveCashAccount(CashAccount cashAccount);
Task<bool> CashAccountNumberExistsAsync(string accountNumber);
Task<CashAccountType?> GetCashAccountTypeByNameAsync(string name);
Task<CashAccountType> AddCashAccountTypeAsync(CashAccountType cashAccountType);
Task<List<CashAccountType>> GetAllCashAccountTypesAsync();
}
}
@@ -0,0 +1,14 @@
using General_Ledger_Service.DTOs.Reports;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IBudgetRepository
{
Task<Budget?> GetByIdAsync(long budgetId);
Task<Budget> AddAsync(Budget budget);
Task AddLinesAsync(IEnumerable<BudgetLine> lines);
Task<List<Budget>> GetAllAsync();
Task<List<BudgetVsActualRowDto>> GetBudgetVsActualAsync(long budgetId);
}
}
@@ -0,0 +1,28 @@
using General_Ledger_Service.Enums;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IChequeRepository
{
Task<ChequeBook> AddChequeBookAsync(ChequeBook chequeBook);
Task<ChequeBook?> GetChequeBookByIdAsync(long chequeBookId);
Task<ChequeBook?> GetChequeBookByNoAsync(string chequeBookNo, bool includePages = false);
Task<bool> ChequeBookNoExistsAsync(string chequeBookNo);
Task<(List<ChequeBook> Items, int TotalCount)> ListChequeBooksAsync(
long? bankAccountId, long? branchId, ChequeBookStatus? status, int? page, int? pageSize);
Task AddChequePagesAsync(IEnumerable<ChequePage> pages);
Task<ChequePage?> GetChequePageByNoAsync(string chequeNo);
Task<bool> ChequeNoExistsAsync(string chequeNo);
Task<(List<ChequePage> Items, int TotalCount)> ListChequePagesAsync(
string? chequeBookNo, ChequeIssueStatus? issueStatus, ChequePayeeType? payeeType,
long? payeeId, int? page, int? pageSize);
Task<ReceivedCheque> AddReceivedChequeAsync(ReceivedCheque receivedCheque);
Task<ReceivedCheque?> GetReceivedChequeByIdAsync(long receivedChequeId);
Task<(List<ReceivedCheque> Items, int TotalCount)> ListReceivedChequesAsync(
long? companyId, long? branchId, ReceivedChequeStatus? status,
ReceivedChequeFromType? receivedFromType, int? page, int? pageSize);
}
}
@@ -0,0 +1,15 @@
using General_Ledger_Service.DTOs.CostCenters;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface ICostCenterRepository
{
Task<CostCenter?> GetByIdAsync(long costCenterId);
Task<CostCenter?> GetByCodeAsync(string code);
Task<int> GetAncestorDepthAsync(long parentCostCenterId);
Task<string?> GetAncestorBreadcrumbAsync(long costCenterId);
Task<List<CostCenterTreeNode>> GetDescendantTreeAsync(long costCenterId);
Task<CostCenter> AddAsync(CostCenter costCenter);
}
}
@@ -0,0 +1,10 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface ICurrencyRepository
{
Task<List<Currency>> GetAllAsync();
Task<string> GetBaseCurrencyCodeAsync();
}
}
@@ -0,0 +1,18 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IFiscalCalendarRepository
{
Task<FiscalYear?> GetFiscalYearByIdAsync(int fiscalYearId);
Task<bool> HasOverlappingFiscalYearRangeAsync(DateOnly startDate, DateOnly endDate);
Task<FiscalYear> AddFiscalYearAsync(FiscalYear fiscalYear);
Task<AccountingPeriod?> GetPeriodByIdAsync(int periodId);
Task<AccountingPeriod?> GetPeriodByDateAsync(DateOnly date);
Task<List<AccountingPeriod>> GetPeriodsByFiscalYearIdAsync(int fiscalYearId);
Task AddPeriodRangeAsync(IEnumerable<AccountingPeriod> periods);
Task<PeriodLockLog> AddPeriodLockLogAsync(PeriodLockLog log);
}
}
@@ -0,0 +1,16 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IFixedAssetRepository
{
Task<FixedAsset?> GetByIdAsync(long assetId);
Task<FixedAsset?> GetByCodeAsync(string assetCode);
Task<FixedAsset> AddAsync(FixedAsset asset);
Task<List<FixedAsset>> GetAllAsync();
Task<DepreciationSchedule?> GetLatestScheduleByAssetIdAsync(long assetId);
Task<DepreciationSchedule> AddScheduleAsync(DepreciationSchedule schedule);
Task<AssetDisposal> AddDisposalAsync(AssetDisposal disposal);
Task<decimal> GetDepreciationAddBackAsync(DateOnly periodStart, DateOnly periodEnd);
}
}
@@ -0,0 +1,18 @@
using General_Ledger_Service.DTOs.Reports;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IJournalEntryRepository
{
Task<JournalEntry?> GetJournalEntryByJournalNoAsync(string journalNo);
Task<int> CountJournalEntriesForYearAsync(int year);
Task<JournalEntry> AddJournalEntryAsync(JournalEntry entry);
Task AddJournalEntryLinesAsync(IEnumerable<JournalEntryLine> lines);
Task<List<GeneralLedgerLineDto>> GetGeneralLedgerLinesAsync(long accountId, DateOnly periodStart, DateOnly periodEnd);
Task<List<GeneralLedgerLineDto>> GetGeneralLedgerLinesForAllAccountsAsync(DateOnly periodStart, DateOnly periodEnd);
Task<JournalCorrection> AddJournalCorrectionAsync(JournalCorrection correction);
}
}
@@ -0,0 +1,10 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface IRecurringJournalTemplateRepository
{
Task<RecurringJournalTemplate?> GetByIdAsync(long templateId);
Task<RecurringJournalTemplate> AddAsync(RecurringJournalTemplate template);
}
}
@@ -0,0 +1,10 @@
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface ISystemConfigRepository
{
Task<SystemConfig?> GetByKeyAsync(string configKey);
Task<List<SystemConfig>> GetAllAsync();
}
}
+19
View File
@@ -0,0 +1,19 @@
using General_Ledger_Service.DTOs.Reports;
using General_Ledger_Service.Models;
namespace General_Ledger_Service.Interfaces.Repositories
{
public interface ITaxRepository
{
Task<TaxType?> GetTaxTypeByCodeAsync(string code);
Task<List<TaxType>> GetAllTaxTypesAsync();
Task<TaxCode?> GetEffectiveTaxCodeByCodeAsync(string code, DateOnly txnDate);
Task<TaxCode?> GetByCodeAsync(string code);
Task<TaxCode> AddTaxCodeAsync(TaxCode taxCode);
Task<List<TaxCode>> GetAllTaxCodesAsync();
// Accounting_System_Design_LKAS.md Section 11.7 - Income Tax Computation.
Task<decimal> GetNonDeductibleExpensesAsync(DateOnly periodStart, DateOnly periodEnd);
Task<decimal> GetAccountCreditActivityAsync(long accountId, DateOnly periodStart, DateOnly periodEnd);
}
}
+14
View File
@@ -0,0 +1,14 @@
using System.Text.Json;
using General_Ledger_Service.DTOs.Accounts;
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IAccountService
{
Task<ApiResponse> CreateAccountAsync(CreateAccountRequest request);
Task<ApiResponse> GetAccountByCodeAsync(string accountCode, string? expand);
Task<ApiResponse> UpdateAccountAsync(string accountCode, Dictionary<string, JsonElement> payload);
Task<ApiResponse> ListAccountsAsync(ListAccountsRequest request);
}
}
+10
View File
@@ -0,0 +1,10 @@
using General_Ledger_Service.DTOs.AuditLog;
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IAuditLogService
{
Task<ApiResponse> ListAsync(ListAuditLogRequest request);
}
}
+24
View File
@@ -0,0 +1,24 @@
using General_Ledger_Service.DTOs.Bank;
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IBankService
{
Task<ApiResponse> CreateBankAccountAsync(CreateBankAccountRequest request);
Task<ApiResponse> ImportStatementLinesAsync(long bankAccountId, Stream fileStream);
Task<ApiResponse> ReconcileStatementLineAsync(long stmtLineId, ReconcileStatementLineRequest request);
Task<ApiResponse> ListCashAndBankAccountsAsync(string? accountType);
Task<ApiResponse> CreateCashAccountAsync(CreateCashAccountRequest request);
Task<ApiResponse> ListCashAccountTypesAsync();
/// <summary>Renames a cash account — the only field a default cash account allows changing.</summary>
Task<ApiResponse> UpdateCashAccountAsync(long cashAccountId, UpdateCashAccountRequest request);
/// <summary>Activates/deactivates a cash account. Throws if deactivating the default one.</summary>
Task<ApiResponse> SetCashAccountStatusAsync(long cashAccountId, SetCashAccountStatusRequest request);
/// <summary>Deletes a cash account. Throws if it is the default one.</summary>
Task<ApiResponse> DeleteCashAccountAsync(long cashAccountId);
}
}
+12
View File
@@ -0,0 +1,12 @@
using General_Ledger_Service.DTOs.Budget;
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IBudgetService
{
Task<ApiResponse> CreateAsync(CreateBudgetRequest request);
Task<ApiResponse> AddLinesAsync(long budgetId, List<BudgetLineRequest> request);
Task<ApiResponse> ListAsync();
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Text.Json;
using General_Ledger_Service.DTOs.Cheques;
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IChequeService
{
Task<ApiResponse> CreateChequeBookAsync(CreateChequeBookRequest request);
Task<ApiResponse> GetChequeBookByNoAsync(string chequeBookNo, string? expand);
Task<ApiResponse> ListChequeBooksAsync(ListChequeBooksRequest request);
Task<ApiResponse> IssueChequePageAsync(string chequeNo, IssueChequePageRequest request);
Task<ApiResponse> UpdateChequePageStatusAsync(string chequeNo, Dictionary<string, JsonElement> payload);
Task<ApiResponse> GetChequePageByNoAsync(string chequeNo);
Task<ApiResponse> ListChequePagesAsync(ListChequePagesRequest request);
Task<ApiResponse> CreateReceivedChequeAsync(CreateReceivedChequeRequest request);
Task<ApiResponse> UpdateReceivedChequeStatusAsync(long receivedChequeId, Dictionary<string, JsonElement> payload);
Task<ApiResponse> GetReceivedChequeByIdAsync(long receivedChequeId);
Task<ApiResponse> ListReceivedChequesAsync(ListReceivedChequesRequest request);
}
}
+11
View File
@@ -0,0 +1,11 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.CostCenters;
namespace General_Ledger_Service.Interfaces.Services
{
public interface ICostCenterService
{
Task<ApiResponse> CreateCostCenterAsync(CreateCostCenterRequest request);
Task<ApiResponse> GetCostCenterByCodeAsync(string costCenterCode, string? expand);
}
}
+9
View File
@@ -0,0 +1,9 @@
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface ICurrencyService
{
Task<ApiResponse> ListCurrenciesAsync();
}
}
+9
View File
@@ -0,0 +1,9 @@
using General_Ledger_Service.DTOs.Common;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IDevToolsService
{
ApiResponse GenerateApiKey();
}
}
@@ -0,0 +1,14 @@
using System.Text.Json;
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.FiscalCalendar;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IFiscalCalendarService
{
Task<ApiResponse> CreateFiscalYearAsync(CreateFiscalYearRequest request);
Task<ApiResponse> GeneratePeriodsAsync(int fiscalYearId, GeneratePeriodsRequest request);
Task<ApiResponse> LockPeriodAsync(int periodId, Dictionary<string, JsonElement> payload);
Task<ApiResponse> GetPeriodByDateAsync(DateOnly date);
}
}
+12
View File
@@ -0,0 +1,12 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.FixedAssets;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IFixedAssetService
{
Task<ApiResponse> CreateAsync(CreateFixedAssetRequest request);
Task<ApiResponse> CreateTransactionAsync(string assetCode, CreateFixedAssetTransactionRequest request);
Task<ApiResponse> ListAsync();
}
}
@@ -0,0 +1,11 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.JournalEntries;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IJournalEntryService
{
Task<ApiResponse> CreateAsync(CreateJournalEntryRequest request);
Task<ApiResponse> GetByJournalNoAsync(string journalNo);
}
}
@@ -0,0 +1,11 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.RecurringTemplates;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IRecurringTemplateService
{
Task<ApiResponse> CreateAsync(CreateRecurringTemplateRequest request);
Task<ApiResponse> GenerateAsync(long templateId);
}
}
+10
View File
@@ -0,0 +1,10 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.Reports;
namespace General_Ledger_Service.Interfaces.Services
{
public interface IReportService
{
Task<ApiResponse> GenerateAsync(ListReportsRequest request);
}
}
@@ -0,0 +1,11 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.SystemConfig;
namespace General_Ledger_Service.Interfaces.Services
{
public interface ISystemConfigService
{
Task<ApiResponse> UpdateAsync(string key, UpdateSystemConfigRequest request);
Task<ApiResponse> ListAsync();
}
}
+13
View File
@@ -0,0 +1,13 @@
using General_Ledger_Service.DTOs.Common;
using General_Ledger_Service.DTOs.Tax;
namespace General_Ledger_Service.Interfaces.Services
{
public interface ITaxService
{
Task<ApiResponse> CreateTaxCodeAsync(CreateTaxCodeRequest request);
Task<ApiResponse> CalculateTaxAsync(CalculateTaxRequest request);
Task<ApiResponse> ListTaxTypesAsync();
Task<ApiResponse> ListTaxCodesAsync();
}
}