Search in sources :

Example 11 with AccountingDto

use of org.mifos.platform.accounting.AccountingDto in project head by mifos.

the class TallyMessageBuilderTest method testTallyMessageBuilderNegativeAmountDebit.

@Test(expected = TallyMessageBuilderException.class)
public void testTallyMessageBuilderNegativeAmountDebit() throws TallyMessageBuilderException {
    AccountingDto voucherEntry = new AccountingDto("branch", "2010-04-20", "Payment", "4365", "GL CODE NAME", "-4", "-6");
    new TallyMessageBuilder(VoucherType.JOURNAL, "branch").withVoucherDate(new Date()).addDebitEntry(voucherEntry).build();
}
Also used : AccountingDto(org.mifos.platform.accounting.AccountingDto) Date(java.util.Date) Test(org.junit.Test)

Example 12 with AccountingDto

use of org.mifos.platform.accounting.AccountingDto in project head by mifos.

the class AccountingDataCacheManager method accountingDataFromCache.

public List<AccountingDto> accountingDataFromCache(File file) {
    BufferedReader br;
    try {
        br = new BufferedReader(new FileReader(file));
    } catch (FileNotFoundException e) {
        LOGGER.error(file.toString(), e);
        throw new AccountingRuntimeException(file.toString(), e);
    }
    String line = null;
    // skip first line
    try {
        br.readLine();
    } catch (IOException e) {
        LOGGER.error("skipping header line", e);
        throw new AccountingRuntimeException("skipping header line", e);
    }
    List<AccountingDto> accountingData = new ArrayList<AccountingDto>();
    try {
        while ((line = br.readLine()) != null) {
            accountingData.add(parseLine(line));
        }
        br.close();
    } catch (IOException e) {
        throw new AccountingRuntimeException("reading line" + line, e);
    }
    return accountingData;
}
Also used : BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) ArrayList(java.util.ArrayList) FileReader(java.io.FileReader) IOException(java.io.IOException) AccountingDto(org.mifos.platform.accounting.AccountingDto) AccountingRuntimeException(org.mifos.platform.accounting.AccountingRuntimeException)

Aggregations

AccountingDto (org.mifos.platform.accounting.AccountingDto)12 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)5 LocalDate (org.joda.time.LocalDate)4 Date (java.util.Date)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 Ignore (org.junit.Ignore)2 AccountingRuntimeException (org.mifos.platform.accounting.AccountingRuntimeException)2 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 DecimalFormat (java.text.DecimalFormat)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 StringTokenizer (java.util.StringTokenizer)1 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 VoucherType (org.mifos.platform.accounting.VoucherType)1 TallyMessage (org.mifos.platform.accounting.tally.message.TallyMessage)1 TallyMessageBuilder (org.mifos.platform.accounting.tally.message.TallyMessageBuilder)1