intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
sb.append(" AND Activity2.Act_id >= ? AND Activity2.Act_id <= ? ");
}
sb.append(" ORDER BY Amount.Act_id, IsDebit");
JdbcTable db = new JdbcTable(sb.toString(), view, new int[]{Types.DATE, Types.DATE, Types.INTEGER, Types.INTEGER});
try {
//invoice date
db.setObject(new java.sql.Date(
jTextField1.getDate().getTime()),
Types.DATE);
db.setObject(new java.sql.Date(
jTextField2.getDate().getTime()),
Types.DATE);
if (intField1.getText().length() != 0 && intField2.getText().length() != 0 &&
intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
db.setObject(intField1.getInteger(), Types.INTEGER);
db.setObject(intField2.getInteger(), Types.INTEGER);
}
} catch (Exception e) {
Log.log(Log.DEBUG, this, "Error trying to execute sql=" + sb.toString());
Log.log(Log.DEBUG, this, "Error =" + e);
return "";
}
if (isJFreeReport) {
db.GetFirstRecord();
return new TransactionTable(db.resultSet);
}
if (!db.GetFirstRecord()) {
return "";
}
//Print the Report header
if (intField1.getText().length() != 0 && intField2.getText().length() != 0 &&
intField2.getInteger().intValue() >= intField1.getInteger().intValue()) {
jTextArea.append(Translator.getTranslation("Start Transaction number") + " " + intField1.getText());
jTextArea.append(newline);
jTextArea.append(Translator.getTranslation("Stop Transaction number") + " " + intField2.getText());
jTextArea.append(newline);
}
AddReportHeaders();
Integer processingTransaction;
boolean bNewRecordExists;
do {
processingTransaction = (Integer) db.getObject("Amount.Act_id", null);
initializeRow(fieldSize, 5);
addField(Translator.getTranslation("Transaction"), fieldSize, 1,
-1, false);
addField(Translator.getTranslation("InvDate"), fieldSize, 2,
-1, false);
addField(Translator.getTranslation("Commentary"), fieldSize, 3,
-1, false);
addField(Translator.getTranslation("Fileing information"), fieldSize, 4,
-1, false);
addField(Translator.getTranslation("RegDate"), fieldSize, 5,
-1, false);
jTextArea.append(sbRow.toString());
jTextArea.append(newline);
if (SetupInfo.getBoolProperty(SetupInfo.SHOW_PERIOD_ID)){
jTextArea.append(renderIntegerField(
db.getObject("PeriodId", null), fieldSize[1]));
}
else{
jTextArea.append(renderIntegerField(
db.getObject("Amount.Act_id", null), fieldSize[1]));
}
jTextArea.append(renderDateField(
db.getObject("InvDate", null), fieldSize[2]));
jTextArea.append(renderField((String)
db.getObject("Activity2.Notes", null), fieldSize[3]));
jTextArea.append(renderField((String)
db.getObject("FileInfo", null), fieldSize[4]));
jTextArea.append(renderDateField(
db.getObject("RegDate", null), fieldSize[5]));
jTextArea.append(newline);
initializeRow(fieldAccSize, 8);
addField(Translator.getTranslation("Account"), fieldAccSize, 2,
-1, false);
addField(Translator.getTranslation("Account name"), fieldAccSize, 4,
-1, false);
addField(Translator.getTranslation("Commentary"), fieldAccSize, 5,
-1, false);
addField(Translator.getTranslation("Customer"), fieldAccSize, 6,
-1, false);
addField(Translator.getTranslation("Debit"), fieldAccSize, 7,
-1, true);
addField(Translator.getTranslation("Credit"), fieldAccSize, 8,
-1, true);
jTextArea.append(sbRow.toString());
jTextArea.append(newline);
double fDebitTotal = 0;
double fCreditTotal = 0;
IntHolder iType = new IntHolder();
do {
initializeRow(fieldAccSize, 8);
addField(db.getObject("Amount.Account", iType),
fieldAccSize, 2, iType.iValue, false);
addField(db.getObject("AccDesc", iType),
fieldAccSize, 4, iType.iValue, false);
addField(db.getObject("Amount.Notes", iType),
fieldAccSize, 5, iType.iValue, false);
String cust = (String) db.getObject("CustName", iType);
if (cust == null) {
cust = "";
}
addField(cust,
fieldAccSize, 6, iType.iValue, false);
if (((Integer) db.getObject("IsDebit", null)).intValue() == 1) {
addField(db.getObject("Amount.Amount", iType),
fieldAccSize, 7, iType.iValue, false);
fDebitTotal += ((Double)
db.getObject("Amount.Amount", null)).doubleValue();
} else {
addField(db.getObject("Amount.Amount", iType),
fieldAccSize, 8, iType.iValue, false);
fCreditTotal += ((Double)
db.getObject("Amount.Amount", null)).doubleValue();
}
jTextArea.append(sbRow.toString());
jTextArea.append(newline);
bNewRecordExists = db.GetNextRecord();
} while (bNewRecordExists && processingTransaction.intValue()
== ((Integer) db.getObject("Amount.Act_id", null)).intValue());
initializeRow(fieldAccSize, 6);
addField("---------------", fieldAccSize, 7, -1, true);
addField("---------------", fieldAccSize, 8, -1, true);
jTextArea.append(sbRow.toString());