FINERACT-2426: Fix ChartOfAcountsConstants typo to ChartOfAccountsConstants (#5284)

This commit is contained in:
Kengne-yvana
2026-01-06 16:38:33 -06:00
committed by GitHub
parent e17303fcb9
commit 5c04216841
3 changed files with 103 additions and 101 deletions
@@ -18,9 +18,9 @@
*/ */
package org.apache.fineract.infrastructure.bulkimport.constants; package org.apache.fineract.infrastructure.bulkimport.constants;
public final class ChartOfAcountsConstants { public final class ChartOfAccountsConstants {
private ChartOfAcountsConstants() { private ChartOfAccountsConstants() {
} }
@@ -35,7 +35,7 @@ import org.apache.fineract.accounting.journalentry.data.JournalEntryData;
import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.bulkimport.constants.ChartOfAcountsConstants; import org.apache.fineract.infrastructure.bulkimport.constants.ChartOfAccountsConstants;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.infrastructure.bulkimport.data.Count; import org.apache.fineract.infrastructure.bulkimport.data.Count;
import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandler; import org.apache.fineract.infrastructure.bulkimport.importhandler.ImportHandler;
@@ -93,9 +93,9 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = chartOfAccountsSheet.getRow(rowIndex); row = chartOfAccountsSheet.getRow(rowIndex);
if (ImportHandlerUtils.isNotImported(row, ChartOfAcountsConstants.STATUS_COL)) { if (ImportHandlerUtils.isNotImported(row, ChartOfAccountsConstants.STATUS_COL)) {
glAccounts.add(readGlAccounts(row)); glAccounts.add(readGlAccounts(row));
if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row) != null) { if (ImportHandlerUtils.readAsString(ChartOfAccountsConstants.OFFICE_COL, row) != null) {
flagForOpBal = Boolean.TRUE; flagForOpBal = Boolean.TRUE;
} else { } else {
flagForOpBal = Boolean.FALSE; flagForOpBal = Boolean.FALSE;
@@ -108,10 +108,10 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
private GLAccountData readGlAccounts(final Row row) { private GLAccountData readGlAccounts(final Row row) {
String accountType = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_TYPE_COL, row); String accountType = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.ACCOUNT_TYPE_COL, row);
EnumOptionData accountTypeEnum = GLAccountType.fromString(accountType); EnumOptionData accountTypeEnum = GLAccountType.fromString(accountType);
String accountName = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_NAME_COL, row); String accountName = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.ACCOUNT_NAME_COL, row);
String usage = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_USAGE_COL, row); String usage = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.ACCOUNT_USAGE_COL, row);
Long usageId = null; Long usageId = null;
EnumOptionData usageEnum = null; EnumOptionData usageEnum = null;
if (usage != null && usage.equals(GLAccountUsage.DETAIL.toString())) { if (usage != null && usage.equals(GLAccountUsage.DETAIL.toString())) {
@@ -121,20 +121,20 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
usageId = 2L; usageId = 2L;
usageEnum = new EnumOptionData(usageId, null, null); usageEnum = new EnumOptionData(usageId, null, null);
} }
Boolean manualEntriesAllowed = ImportHandlerUtils.readAsBoolean(ChartOfAcountsConstants.MANUAL_ENTRIES_ALLOWED_COL, row); Boolean manualEntriesAllowed = ImportHandlerUtils.readAsBoolean(ChartOfAccountsConstants.MANUAL_ENTRIES_ALLOWED_COL, row);
Long parentId = null; Long parentId = null;
if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.PARENT_ID_COL, row) != null) { if (ImportHandlerUtils.readAsString(ChartOfAccountsConstants.PARENT_ID_COL, row) != null) {
parentId = Long.parseLong(Objects.requireNonNull(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.PARENT_ID_COL, row))); parentId = Long.parseLong(Objects.requireNonNull(ImportHandlerUtils.readAsString(ChartOfAccountsConstants.PARENT_ID_COL, row)));
} }
String glCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL, row); String glCode = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.GL_CODE_COL, row);
Long tagId = null; Long tagId = null;
CodeValueData tagIdCodeValueData = null; CodeValueData tagIdCodeValueData = null;
if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL, row) != null if (ImportHandlerUtils.readAsString(ChartOfAccountsConstants.TAG_ID_COL, row) != null
&& !ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL, row).equals("0")) { && !ImportHandlerUtils.readAsString(ChartOfAccountsConstants.TAG_ID_COL, row).equals("0")) {
tagId = Long.parseLong(Objects.requireNonNull(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL, row))); tagId = Long.parseLong(Objects.requireNonNull(ImportHandlerUtils.readAsString(ChartOfAccountsConstants.TAG_ID_COL, row)));
tagIdCodeValueData = new CodeValueData().setId(tagId); tagIdCodeValueData = new CodeValueData().setId(tagId);
} }
String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row); String description = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.DESCRIPTION_COL, row);
return new GLAccountData().setName(accountName).setParentId(parentId).setGlCode(glCode) return new GLAccountData().setName(accountName).setParentId(parentId).setGlCode(glCode)
.setManualEntriesAllowed(manualEntriesAllowed).setType(accountTypeEnum).setUsage(usageEnum).setDescription(description) .setManualEntriesAllowed(manualEntriesAllowed).setType(accountTypeEnum).setUsage(usageEnum).setDescription(description)
.setTagId(tagIdCodeValueData).setRowIndex(row.getRowNum()); .setTagId(tagIdCodeValueData).setRowIndex(row.getRowNum());
@@ -164,7 +164,7 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
.build(); // .build(); //
commandsSourceWritePlatformService.logCommandSource(commandRequest); commandsSourceWritePlatformService.logCommandSource(commandRequest);
successCount++; successCount++;
Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAcountsConstants.STATUS_COL); Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAccountsConstants.STATUS_COL);
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
@@ -172,7 +172,7 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
LOG.error("Problem occurred in importEntity function", ex); LOG.error("Problem occurred in importEntity function", ex);
errorMessage = ImportHandlerUtils.getErrorMessage(ex); errorMessage = ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage, ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage,
ChartOfAcountsConstants.STATUS_COL); ChartOfAccountsConstants.STATUS_COL);
} }
} }
if (flagForOpBal) { if (flagForOpBal) {
@@ -185,25 +185,25 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
.withJson(payload).build(); .withJson(payload).build();
commandsSourceWritePlatformService.logCommandSource(commandRequest); commandsSourceWritePlatformService.logCommandSource(commandRequest);
successCount++; successCount++;
Cell statusCell = chartOfAccountsSheet.getRow(1).createCell(ChartOfAcountsConstants.STATUS_COL); Cell statusCell = chartOfAccountsSheet.getRow(1).createCell(ChartOfAccountsConstants.STATUS_COL);
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
errorCount++; errorCount++;
LOG.error("Problem occurred in importEntity function", ex); LOG.error("Problem occurred in importEntity function", ex);
errorMessage = ImportHandlerUtils.getErrorMessage(ex); errorMessage = ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, 1, errorMessage, ChartOfAcountsConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, 1, errorMessage, ChartOfAccountsConstants.STATUS_COL);
} }
} }
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL, ImportHandlerUtils.writeString(ChartOfAccountsConstants.STATUS_COL,
chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX), chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
TemplatePopulateImportConstants.STATUS_COLUMN_HEADER); TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
return Count.instance(successCount, errorCount); return Count.instance(successCount, errorCount);
} }
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL, ImportHandlerUtils.writeString(ChartOfAccountsConstants.STATUS_COL,
chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX), chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
TemplatePopulateImportConstants.STATUS_COLUMN_HEADER); TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
return Count.instance(successCount, errorCount); return Count.instance(successCount, errorCount);
@@ -233,11 +233,11 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
final String locale, String dateFormat) { final String locale, String dateFormat) {
LocalDate transactionDate = DateUtils.getBusinessLocalDate(); LocalDate transactionDate = DateUtils.getBusinessLocalDate();
Long officeId = ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.OFFICE_COL_ID, row); Long officeId = ImportHandlerUtils.readAsLong(ChartOfAccountsConstants.OFFICE_COL_ID, row);
String currencyCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.CURRENCY_CODE, row); String currencyCode = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.CURRENCY_CODE, row);
String accountToBeDebitedCredited = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_NAME_COL, row); String accountToBeDebitedCredited = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.ACCOUNT_NAME_COL, row);
String glCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL, row); String glCode = ImportHandlerUtils.readAsString(ChartOfAccountsConstants.GL_CODE_COL, row);
GLAccount glAccount = this.glAccountRepository.findOneByGlCodeWithNotFoundDetection(glCode); GLAccount glAccount = this.glAccountRepository.findOneByGlCodeWithNotFoundDetection(glCode);
Long glAccountIdToDebitedCredited = glAccount.getId(); Long glAccountIdToDebitedCredited = glAccount.getId();
if (glAccountIdToDebitedCredited == null) { if (glAccountIdToDebitedCredited == null) {
@@ -250,13 +250,13 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
// readAsString(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, row); // readAsString(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, row);
if (accountToBeDebitedCredited != null) { if (accountToBeDebitedCredited != null) {
if (ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.CREDIT_AMOUNT, row) != null) { if (ImportHandlerUtils.readAsLong(ChartOfAccountsConstants.CREDIT_AMOUNT, row) != null) {
credits.add(new CreditDebit(glAccountIdToDebitedCredited, credits.add(new CreditDebit(glAccountIdToDebitedCredited,
BigDecimal.valueOf(ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.CREDIT_AMOUNT, row)))); BigDecimal.valueOf(ImportHandlerUtils.readAsLong(ChartOfAccountsConstants.CREDIT_AMOUNT, row))));
} else if (ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.DEBIT_AMOUNT, row) != null) { } else if (ImportHandlerUtils.readAsLong(ChartOfAccountsConstants.DEBIT_AMOUNT, row) != null) {
debits.add(new CreditDebit(glAccountIdToDebitedCredited, debits.add(new CreditDebit(glAccountIdToDebitedCredited,
BigDecimal.valueOf(ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.DEBIT_AMOUNT, row)))); BigDecimal.valueOf(ImportHandlerUtils.readAsLong(ChartOfAccountsConstants.DEBIT_AMOUNT, row))));
} }
} }
@@ -26,7 +26,7 @@ import java.util.Map;
import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.accounting.glaccount.domain.GLAccountType; import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage; import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage;
import org.apache.fineract.infrastructure.bulkimport.constants.ChartOfAcountsConstants; import org.apache.fineract.infrastructure.bulkimport.constants.ChartOfAccountsConstants;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants; import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.infrastructure.bulkimport.populator.AbstractWorkbookPopulator; import org.apache.fineract.infrastructure.bulkimport.populator.AbstractWorkbookPopulator;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
@@ -103,22 +103,23 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
private void setRules(Sheet chartOfAccountsSheet) { private void setRules(Sheet chartOfAccountsSheet) {
CellRangeAddressList accountTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList accountTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.ACCOUNT_TYPE_COL, ChartOfAcountsConstants.ACCOUNT_TYPE_COL); ChartOfAccountsConstants.ACCOUNT_TYPE_COL, ChartOfAccountsConstants.ACCOUNT_TYPE_COL);
CellRangeAddressList accountUsageRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList accountUsageRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.ACCOUNT_USAGE_COL, ChartOfAcountsConstants.ACCOUNT_USAGE_COL); ChartOfAccountsConstants.ACCOUNT_USAGE_COL, ChartOfAccountsConstants.ACCOUNT_USAGE_COL);
CellRangeAddressList manualEntriesAllowedRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList manualEntriesAllowedRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.MANUAL_ENTRIES_ALLOWED_COL, ChartOfAcountsConstants.MANUAL_ENTRIES_ALLOWED_COL); ChartOfAccountsConstants.MANUAL_ENTRIES_ALLOWED_COL, ChartOfAccountsConstants.MANUAL_ENTRIES_ALLOWED_COL);
CellRangeAddressList parentRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList parentRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.PARENT_COL, ChartOfAcountsConstants.PARENT_COL); ChartOfAccountsConstants.PARENT_COL, ChartOfAccountsConstants.PARENT_COL);
CellRangeAddressList tagRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList tagRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.TAG_COL, ChartOfAcountsConstants.TAG_COL); ChartOfAccountsConstants.TAG_COL, ChartOfAccountsConstants.TAG_COL);
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.OFFICE_COL, ChartOfAcountsConstants.OFFICE_COL); // validation for opening bal ChartOfAccountsConstants.OFFICE_COL, ChartOfAccountsConstants.OFFICE_COL); // validation for opening bal
// office column // office column
CellRangeAddressList currencyCodeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CellRangeAddressList currencyCodeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
ChartOfAcountsConstants.CURRENCY_CODE, ChartOfAcountsConstants.CURRENCY_CODE);// validation for currency ChartOfAccountsConstants.CURRENCY_CODE, ChartOfAccountsConstants.CURRENCY_CODE);// validation for
// code for opening // currency
// balance // code for opening
// balance
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet) chartOfAccountsSheet); DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet) chartOfAccountsSheet);
setNames(chartOfAccountsSheet, accountTypesNoDuplicatesList, offices); setNames(chartOfAccountsSheet, accountTypesNoDuplicatesList, offices);
@@ -183,10 +184,10 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
if (row == null) { if (row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
} }
writeFormula(ChartOfAcountsConstants.PARENT_ID_COL, row, writeFormula(ChartOfAccountsConstants.PARENT_ID_COL, row,
"IF(ISERROR(VLOOKUP($E" + (rowNo + 1) + ",$T$2:$U$" + (glAccounts.size() + 1) + ",2,FALSE))," + "\"\",(VLOOKUP($E" "IF(ISERROR(VLOOKUP($E" + (rowNo + 1) + ",$T$2:$U$" + (glAccounts.size() + 1) + ",2,FALSE))," + "\"\",(VLOOKUP($E"
+ (rowNo + 1) + ",$T$2:$U$" + (glAccounts.size() + 1) + ",2,FALSE)))"); + (rowNo + 1) + ",$T$2:$U$" + (glAccounts.size() + 1) + ",2,FALSE)))");
writeFormula(ChartOfAcountsConstants.TAG_ID_COL, row, writeFormula(ChartOfAccountsConstants.TAG_ID_COL, row,
"IF(ISERROR(VLOOKUP($H" + (rowNo + 1) + ",$V$2:$W$" + (glAccounts.size() + 1) + ",2,FALSE))," + "\"\",(VLOOKUP($H" "IF(ISERROR(VLOOKUP($H" + (rowNo + 1) + ",$V$2:$W$" + (glAccounts.size() + 1) + ",2,FALSE))," + "\"\",(VLOOKUP($H"
+ (rowNo + 1) + ",$V$2:$W$" + (glAccounts.size() + 1) + ",2,FALSE)))"); + (rowNo + 1) + ",$V$2:$W$" + (glAccounts.size() + 1) + ",2,FALSE)))");
} }
@@ -209,39 +210,39 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
for (String accountType : accountTypesNoDuplicatesList) { for (String accountType : accountTypesNoDuplicatesList) {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
Row row = chartOfAccountsSheet.createRow(rowIndex); Row row = chartOfAccountsSheet.createRow(rowIndex);
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_TYPE_COL, row, accountType); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_TYPE_COL, row, accountType);
List<String> accountNamesandTags = accountTypeToAccountNameAndTag.get(accountType); List<String> accountNamesandTags = accountTypeToAccountNameAndTag.get(accountType);
if (!accountNamesandTags.isEmpty()) { if (!accountNamesandTags.isEmpty()) {
for (String accountNameandTag : accountNamesandTags) { for (String accountNameandTag : accountNamesandTags) {
if (chartOfAccountsSheet.getRow(rowIndex) != null) { if (chartOfAccountsSheet.getRow(rowIndex) != null) {
List<String> accountNameAndTagAr = Splitter.on('-').splitToList(accountNameandTag); List<String> accountNameAndTagAr = Splitter.on('-').splitToList(accountNameandTag);
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_NAME_COL, row, accountNameAndTagAr.get(0)); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_NAME_COL, row, accountNameAndTagAr.get(0));
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_ID_COL, row, accountNameAndTagAr.get(1)); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_ID_COL, row, accountNameAndTagAr.get(1));
if (accountNameAndTagAr.get(2).equals("null")) { if (accountNameAndTagAr.get(2).equals("null")) {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_COL, row, ""); writeString(ChartOfAccountsConstants.LOOKUP_TAG_COL, row, "");
} else { } else {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_COL, row, accountNameAndTagAr.get(2)); writeString(ChartOfAccountsConstants.LOOKUP_TAG_COL, row, accountNameAndTagAr.get(2));
} }
if (accountNameAndTagAr.get(3).equals("0")) { if (accountNameAndTagAr.get(3).equals("0")) {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, row, ""); writeString(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, row, "");
} else { } else {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, row, accountNameAndTagAr.get(3)); writeString(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, row, accountNameAndTagAr.get(3));
} }
rowIndex++; rowIndex++;
} else { } else {
row = chartOfAccountsSheet.createRow(rowIndex); row = chartOfAccountsSheet.createRow(rowIndex);
List<String> accountNameAndTagAr = Splitter.on('-').splitToList(accountNameandTag); List<String> accountNameAndTagAr = Splitter.on('-').splitToList(accountNameandTag);
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_NAME_COL, row, accountNameAndTagAr.get(0)); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_NAME_COL, row, accountNameAndTagAr.get(0));
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_ID_COL, row, accountNameAndTagAr.get(1)); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_ID_COL, row, accountNameAndTagAr.get(1));
if (accountNameAndTagAr.get(2).equals("null")) { if (accountNameAndTagAr.get(2).equals("null")) {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_COL, row, ""); writeString(ChartOfAccountsConstants.LOOKUP_TAG_COL, row, "");
} else { } else {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_COL, row, accountNameAndTagAr.get(2)); writeString(ChartOfAccountsConstants.LOOKUP_TAG_COL, row, accountNameAndTagAr.get(2));
} }
if (accountNameAndTagAr.get(3).equals("0")) { if (accountNameAndTagAr.get(3).equals("0")) {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, row, ""); writeString(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, row, "");
} else { } else {
writeString(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, row, accountNameAndTagAr.get(3)); writeString(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, row, accountNameAndTagAr.get(3));
} }
rowIndex++; rowIndex++;
} }
@@ -258,14 +259,14 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
if (chartOfAccountsSheet.getRow(rowIndex) != null) { if (chartOfAccountsSheet.getRow(rowIndex) != null) {
Row row = chartOfAccountsSheet.getRow(rowIndex); Row row = chartOfAccountsSheet.getRow(rowIndex);
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.getName()); writeString(ChartOfAccountsConstants.LOOKUP_OFFICE_COL, row, office.getName());
writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId()); writeLong(ChartOfAccountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId());
rowIndex++; rowIndex++;
} else { } else {
Row row = chartOfAccountsSheet.createRow(rowIndex); Row row = chartOfAccountsSheet.createRow(rowIndex);
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.getName()); writeString(ChartOfAccountsConstants.LOOKUP_OFFICE_COL, row, office.getName());
writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId()); writeLong(ChartOfAccountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId());
rowIndex++; rowIndex++;
} }
@@ -275,52 +276,53 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
private void setLayout(Sheet chartOfAccountsSheet) { private void setLayout(Sheet chartOfAccountsSheet) {
Row rowHeader = chartOfAccountsSheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX); Row rowHeader = chartOfAccountsSheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.ACCOUNT_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.ACCOUNT_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.ACCOUNT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.ACCOUNT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.ACCOUNT_USAGE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.ACCOUNT_USAGE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.MANUAL_ENTRIES_ALLOWED_COL, chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.MANUAL_ENTRIES_ALLOWED_COL,
TemplatePopulateImportConstants.SMALL_COL_SIZE); TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.PARENT_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.PARENT_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.PARENT_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.PARENT_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.GL_CODE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.GL_CODE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.TAG_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.TAG_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.TAG_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.TAG_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.DESCRIPTION_COL, TemplatePopulateImportConstants.EXTRALARGE_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.DESCRIPTION_COL, TemplatePopulateImportConstants.EXTRALARGE_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.OFFICE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.OFFICE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.OFFICE_COL_ID, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.OFFICE_COL_ID, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.CURRENCY_CODE, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.CURRENCY_CODE, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.DEBIT_AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.DEBIT_AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.CREDIT_AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.CREDIT_AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_ACCOUNT_TYPE_COL, chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_ACCOUNT_TYPE_COL,
TemplatePopulateImportConstants.SMALL_COL_SIZE); TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_ACCOUNT_NAME_COL, chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_ACCOUNT_NAME_COL,
TemplatePopulateImportConstants.MEDIUM_COL_SIZE); TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_ACCOUNT_ID_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_ACCOUNT_ID_COL,
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_TAG_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_TAG_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
// adding lookup for opening balance bulk import // adding lookup for opening balance bulk import
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_OFFICE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE); chartOfAccountsSheet.setColumnWidth(ChartOfAccountsConstants.LOOKUP_OFFICE_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
writeString(ChartOfAcountsConstants.ACCOUNT_TYPE_COL, rowHeader, "Account Type*"); writeString(ChartOfAccountsConstants.ACCOUNT_TYPE_COL, rowHeader, "Account Type*");
writeString(ChartOfAcountsConstants.GL_CODE_COL, rowHeader, "GL Code *"); writeString(ChartOfAccountsConstants.GL_CODE_COL, rowHeader, "GL Code *");
writeString(ChartOfAcountsConstants.ACCOUNT_USAGE_COL, rowHeader, "Account Usage *"); writeString(ChartOfAccountsConstants.ACCOUNT_USAGE_COL, rowHeader, "Account Usage *");
writeString(ChartOfAcountsConstants.MANUAL_ENTRIES_ALLOWED_COL, rowHeader, "Manual entries allowed *"); writeString(ChartOfAccountsConstants.MANUAL_ENTRIES_ALLOWED_COL, rowHeader, "Manual entries allowed *");
writeString(ChartOfAcountsConstants.PARENT_COL, rowHeader, "Parent"); writeString(ChartOfAccountsConstants.PARENT_COL, rowHeader, "Parent");
writeString(ChartOfAcountsConstants.PARENT_ID_COL, rowHeader, "Parent Id"); writeString(ChartOfAccountsConstants.PARENT_ID_COL, rowHeader, "Parent Id");
writeString(ChartOfAcountsConstants.ACCOUNT_NAME_COL, rowHeader, "Account Name"); writeString(ChartOfAccountsConstants.ACCOUNT_NAME_COL, rowHeader, "Account Name");
writeString(ChartOfAcountsConstants.TAG_COL, rowHeader, "Tag"); writeString(ChartOfAccountsConstants.TAG_COL, rowHeader, "Tag");
writeString(ChartOfAcountsConstants.TAG_ID_COL, rowHeader, "Tag Id"); writeString(ChartOfAccountsConstants.TAG_ID_COL, rowHeader, "Tag Id");
writeString(ChartOfAcountsConstants.DESCRIPTION_COL, rowHeader, "Description *"); writeString(ChartOfAccountsConstants.DESCRIPTION_COL, rowHeader, "Description *");
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_TYPE_COL, rowHeader, "Lookup Account type"); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_TYPE_COL, rowHeader, "Lookup Account type");
writeString(ChartOfAcountsConstants.LOOKUP_TAG_COL, rowHeader, "Lookup Tag"); writeString(ChartOfAccountsConstants.LOOKUP_TAG_COL, rowHeader, "Lookup Tag");
writeString(ChartOfAcountsConstants.LOOKUP_TAG_ID_COL, rowHeader, "Lookup Tag Id"); writeString(ChartOfAccountsConstants.LOOKUP_TAG_ID_COL, rowHeader, "Lookup Tag Id");
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_NAME_COL, rowHeader, "Lookup Account name *"); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_NAME_COL, rowHeader, "Lookup Account name *");
writeString(ChartOfAcountsConstants.LOOKUP_ACCOUNT_ID_COL, rowHeader, "Lookup Account Id"); writeString(ChartOfAccountsConstants.LOOKUP_ACCOUNT_ID_COL, rowHeader, "Lookup Account Id");
// adding lookup for opening balance bulk import // adding lookup for opening balance bulk import
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, rowHeader, "Lookup Office Name"); writeString(ChartOfAccountsConstants.LOOKUP_OFFICE_COL, rowHeader, "Lookup Office Name");
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, rowHeader, "Lookup Office Id"); writeString(ChartOfAccountsConstants.LOOKUP_OFFICE_ID_COL, rowHeader, "Lookup Office Id");
} }