using System.Data; using System.Data.Common; using AccountsDAL.DTO.Voucher; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; namespace AccountsDAL.CustomCode.Voucher { public interface IVoucherDAL { // ── Save/Update Voucher — full-parity port (see VoucherQB.cs's Save/Update region for // context). Every insert takes the DTO + transaction; deletes/lookups take scalar ids. Task InsertVoucherHeader(VoucherDTO voucher, LoginDTO loginDTO, DbTransaction tx); Task UpdateVoucherHeader(VoucherDTO voucher, LoginDTO loginDTO, DbTransaction tx); Task InsertVoucherDetail(VoucherDetailDTO detail, DateTime headerVoucherDate, DateTime headerValidTillDate, LoginDTO loginDTO, DbTransaction tx); Task InsertVoucherAddon(VoucherAddonDTO addon, LoginDTO loginDTO, DbTransaction tx); Task InsertBillAllocation(VoucherBillAllocationDTO billAllocation, LoginDTO loginDTO, DbTransaction tx); Task InsertCostCenter(VoucherCostCenterDTO costCenter, LoginDTO loginDTO, DbTransaction tx); Task InsertInstrument(VoucherInstrumentDTO instrument, LoginDTO loginDTO, DbTransaction tx); Task InsertVoucherTDS(VoucherTDSDTO tds, LoginDTO loginDTO, DbTransaction tx); Task DeleteAllChildrenForVoucher(int voucherId, LoginDTO loginDTO, DbTransaction tx); // ── Delete/Cancel Voucher — full-parity port (see VoucherQB.cs's Delete/Cancel region) ── Task DeleteChildrenExceptDetailsForVoucher(int voucherId, LoginDTO loginDTO, DbTransaction tx); Task DetachBillAllocationAgainstReferences(int voucherId, LoginDTO loginDTO, DbTransaction tx); Task DeleteBizDimensionForVoucher(int voucherId, LoginDTO loginDTO, DbTransaction tx); Task DeleteVoucherHeader(int voucherId, LoginDTO loginDTO, DbTransaction tx); Task SoftCancelVoucherHeader(int voucherId, int modifiedById, DateTime modifiedOn, LoginDTO loginDTO, DbTransaction tx); Task DeleteVoucherDetailById(int voucherDetailId, LoginDTO loginDTO, DbTransaction tx); Task> GetVoucherDetailIds(int voucherId, LoginDTO loginDTO); Task GetBizTransactionTypeForSave(int bizTransactionTypeId, LoginDTO loginDTO); Task GetPeriodDateRange(int periodId, LoginDTO loginDTO); Task GetAccountTypeInfo(int accountId, LoginDTO loginDTO); Task> ExecutePostSaveDbObjects(int voucherId, int clientId, LoginDTO loginDTO, DbTransaction tx); // ── Read ────────────────────────────────────────────────────────────── // GetVoucher full-parity port — split into granular typed fetches so VoucherBLL.GetVoucher // can stitch the nested structure, run TDS/cost-center-applicability enrichment, and handle // cross-OU stitching itself (orchestration belongs in BLL, not DAL). Task GetVoucherHeader(int voucherId, LoginDTO loginDTO); Task> GetVoucherDetails(int voucherId, LoginDTO loginDTO); Task> GetVoucherAddons(int voucherId, LoginDTO loginDTO); Task> GetVoucherBillAllocationsForVoucher(int voucherId, LoginDTO loginDTO); Task> GetVoucherBillAllocationsForDetail(int voucherDetailId, LoginDTO loginDTO); Task> GetVoucherCostCentersForVoucher(int voucherId, LoginDTO loginDTO); Task> GetVoucherInstrumentsForVoucher(int voucherId, LoginDTO loginDTO); Task> GetVoucherTDSForVoucher(int voucherId, LoginDTO loginDTO); Task> GetVoucherDetailParameters(int voucherId, LoginDTO loginDTO); Task GetVoucherBizTypeCostCenterRequiredCount(int voucherId, LoginDTO loginDTO); Task> GetCostCategoryConditionAccountGroupIds(LoginDTO loginDTO); Task> GetAllTDSCategoryAccounts(LoginDTO loginDTO); Task GetInterVoucherDetailId(int interAccountId, int interVoucherId, double voucherDetailAmount, LoginDTO loginDTO); Task GetAccountForInterSwap(int accountId, LoginDTO loginDTO); Task GetVoucherTDS(CriteriaDTO criteriaDTO, LoginDTO loginDTO); Task GetSelectListVoucherTDS(CriteriaDTO criteriaDTO, LoginDTO loginDTO); Task GetBillAllocation(int voucherId, LoginDTO loginDTO); Task GetPendingBillAllocation(BillAllocationFilterDTO filterDTO, LoginDTO loginDTO); Task GetSelectListBillAllocation(CriteriaDTO criteriaDTO, LoginDTO loginDTO); Task PaymentEntryValidationCount(string referenceNumber, LoginDTO loginDTO); Task GetSelectListVoucher(int FirstNumber, int MaxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, bool IsCount = false); Task GetSelectListVoucherInstrument(CriteriaDTO criteriaDTO, LoginDTO loginDTO); // ── Write ───────────────────────────────────────────────────────────── Task UpdateBillAllocation(VoucherBillAllocationDTO dto, LoginDTO loginDTO); Task> AutoPendingBillAllocation(BillAllocationFilterDTO filterDTO, LoginDTO loginDTO); Task LoadBRS(int firstNumber, int maxResult, CriteriaDTO criteriaDTO, LoginDTO loginDTO, bool count = false); Task UpdateBRS(List brsLoadDTOs, LoginDTO loginDTO); Task ReAccountPost(int voucherId, LoginDTO loginDTO); // ── Opening Balance Save/Update ───────────────────────────────────────── Task GetFirstPeriodId(LoginDTO loginDTO); Task GetVoucherOnOU(int bizTransactionTypeId, int ouId, LoginDTO loginDTO); Task SaveOpeningVoucherDetail(VoucherDetailDTO detail, int newVoucherDetailId, int voucherId, LoginDTO loginDTO, DbTransaction tx); Task UpdateOpeningVoucherDetail(VoucherDetailDTO detail, LoginDTO loginDTO, DbTransaction tx); Task SaveOpeningBillAllocation(VoucherBillAllocationDTO allocation, int newBillAllocationId, int voucherDetailId, LoginDTO loginDTO, DbTransaction tx); Task UpdateOpeningBillAllocation(VoucherBillAllocationDTO allocation, LoginDTO loginDTO, DbTransaction tx); // ── Re-Account-Post (period/account/OU-scoped ledger rebuild) ─────────── Task> GetActiveOUIds(LoginDTO loginDTO); Task ReAccountPostingFast(int periodId, int accountId, int ouId, LoginDTO loginDTO); Task GetVoucherDetailForOpeningBalance(int bizTransactionTypeId, int ouId, int voucherAccountId, LoginDTO loginDTO); Task FindDuplicateReferenceNumberVoucher(int ouId, int periodId, int bizTransactionTypeId, int accountId, string referenceNumber, LoginDTO loginDTO); Task GetUsedVoucherInBillAllocation(int voucherId, LoginDTO loginDTO); Task GetVoucherSummaryInfo(int voucherId, LoginDTO loginDTO); } }