Skip to content

Commit

Permalink
Output to excel format changed as balance by account in balance by su…
Browse files Browse the repository at this point in the history
…bledger account
  • Loading branch information
efrain-jerv committed Jan 18, 2022
1 parent b789389 commit 7a5e91f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 29 deletions.
4 changes: 3 additions & 1 deletion BalanceEngine/Adapters/BalanceMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ static private BalanceEntryDto MapToBalanceBySubledgerAccount(BalanceEntry entry
dto.SubledgerAccountNumber = entry.SubledgerAccountNumber;
dto.SectorCode = entry.Sector.Code;
dto.InitialBalance = entry.InitialBalance;
dto.CurrentBalance = entry.CurrentBalance;
if (entry.ItemType == TrialBalanceItemType.Entry) {
dto.CurrentBalance = entry.CurrentBalance;
}
dto.DebtorCreditor = entry.ItemType == TrialBalanceItemType.Entry ?
entry.DebtorCreditor.ToString() : "";
dto.LastChangeDate = entry.ItemType == TrialBalanceItemType.Entry ?
Expand Down
70 changes: 42 additions & 28 deletions Reporting/Exporters/Excel/BalanceExcelExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,29 @@ private void SetTable(BalanceDto balance) {
}
}

private void FillOutSaldosCuenta(IEnumerable<BalanceEntryDto> entries) {
int i = 5;
foreach (var entry in entries) {
if (entry.ItemType == TrialBalanceItemType.Total) {

private void FillOutSaldosAuxiliar(IEnumerable<BalanceEntryDto> entries) {
int i = 4;
foreach (
var entry in entries) {
if (entry.ItemType == TrialBalanceItemType.Summary) {
i++;
_excelFile.SetCell($"C{i}", entry.AccountNumber);
_excelFile.SetCell($"D{i}", $"{entry.AccountName}");
_excelFile.SetCell($"D{i}", $"{entry.AccountName}"/* , Naturaleza {entry.DebtorCreditor}"*/);
_excelFile.SetCell($"F{i}", "");
_excelFile.SetCell($"G{i}", "");
_excelFile.SetRowStyleBold(i);

i++;
SetRowHeaderByAccount(i);

} else if (entry.ItemType == TrialBalanceItemType.Group) {
_excelFile.SetCell($"D{i}", entry.AccountName);
_excelFile.SetCell($"F{i}", (decimal)entry.CurrentBalance);
_excelFile.SetRowStyleBold(i);
i += 3;

} else {
_excelFile.SetCell($"A{i}", entry.LedgerNumber);
_excelFile.SetCell($"B{i}", entry.LedgerName);
_excelFile.SetCell($"C{i}", entry.AccountNumber);
_excelFile.SetCell($"D{i}", entry.AccountName);
_excelFile.SetCell($"E{i}", entry.SectorCode);
_excelFile.SetCell($"F{i}", (decimal)entry.CurrentBalance);
_excelFile.SetCell($"F{i}", (decimal) entry.CurrentBalance);
_excelFile.SetCell($"G{i}", entry.LastChangeDate.ToString("dd/MMM/yyyy"));
}

Expand All @@ -108,41 +105,58 @@ private void FillOutSaldosCuenta(IEnumerable<BalanceEntryDto> entries) {
}


private void SetRowHeaderByAccount(int i) {
_excelFile.SetCell($"A{i}", "Deleg");
_excelFile.SetCell($"B{i}", "Delegación");
_excelFile.SetCell($"C{i}", "Cuenta/Auxiliar");
_excelFile.SetCell($"D{i}", "Nombre de cuenta/Auxiliar");
_excelFile.SetCell($"E{i}", "Sector");
_excelFile.SetCell($"F{i}", "Saldo actual");
_excelFile.SetCell($"G{i}", "Último movimiento");
}

private void FillOutSaldosAuxiliar(IEnumerable<BalanceEntryDto> entries) {
int i = 4;
private void FillOutSaldosCuenta(IEnumerable<BalanceEntryDto> entries) {
int i = 5;
foreach (var entry in entries) {
if (entry.ItemType == TrialBalanceItemType.Summary) {
if (entry.ItemType == TrialBalanceItemType.Total) {
_excelFile.SetCell($"C{i}", entry.AccountNumber);
_excelFile.SetCell($"D{i}", $"{entry.AccountName}, Naturaleza {entry.DebtorCreditor}");
_excelFile.SetCell($"F{i}", (decimal)entry.CurrentBalance);
_excelFile.SetCell($"D{i}", $"{entry.AccountName}");
_excelFile.SetCell($"F{i}", "");
_excelFile.SetCell($"G{i}", "");
_excelFile.SetRowStyleBold(i);

i++;
SetRowHeaderByAccount(i);

} else if (entry.ItemType == TrialBalanceItemType.Group) {
_excelFile.SetCell($"D{i}", entry.AccountName);
_excelFile.SetCell($"F{i}", (decimal) entry.CurrentBalance);
_excelFile.SetRowStyleBold(i);
i += 3;

} else {
_excelFile.SetCell($"A{i}", entry.LedgerNumber);
_excelFile.SetCell($"B{i}", entry.LedgerName);
_excelFile.SetCell($"C{i}", entry.AccountNumber);
_excelFile.SetCell($"D{i}", entry.AccountName);
_excelFile.SetCell($"E{i}", entry.SectorCode);
_excelFile.SetCell($"F{i}", (decimal)entry.CurrentBalance);
_excelFile.SetCell($"F{i}", (decimal) entry.CurrentBalance);
_excelFile.SetCell($"G{i}", entry.LastChangeDate.ToString("dd/MMM/yyyy"));
}

i++;
}
}


private void SetRowHeaderByAccount(int i) {
_excelFile.SetCell($"A{i}", "Deleg");
_excelFile.SetCell($"B{i}", "Delegación");
if (_command.TrialBalanceType == TrialBalanceType.SaldosPorAuxiliarConsultaRapida) {
_excelFile.SetCell($"C{i}", "Cuenta");
_excelFile.SetCell($"D{i}", "Nombre de cuenta");
} else {
_excelFile.SetCell($"C{i}", "Cuenta/Auxiliar");
_excelFile.SetCell($"D{i}", "Nombre de cuenta/Auxiliar");
}

_excelFile.SetCell($"E{i}", "Sector");
_excelFile.SetCell($"F{i}", "Saldo actual");
_excelFile.SetCell($"G{i}", "Último movimiento");

_excelFile.SetRowStyleBold(i);
}

} // class BalanceExcelExporter

} // namespace Empiria.FinancialAccounting.Reporting.Exporters.Excel

0 comments on commit 7a5e91f

Please sign in to comment.