response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
XmlDocument xmlDocument = null;
ReportGeneralLedgerJournalData[] data = null;
String strPosition = "0";
ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ReportGeneralLedgerJournal", false,
"", "", "imprimir();return false;", false, "ad_reports", strReplaceWith, false, true);
toolbar.setEmail(false);
if (vars.commandIn("FIND") || vars.commandIn("DEFAULT")
&& !vars.getSessionValue("ReportGeneralLedgerJournal.initRecordNumber").equals("0")) {
String strCheck = buildCheck(strShowClosing, strShowReg, strShowOpening);
String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
String strOrgFamily = getFamily(strTreeOrg, strOrg);
if (strRecord.equals("")) {
data = ReportGeneralLedgerJournalData.select(this, Utility.getContext(this, vars,
"#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, DateTimeData.nDaysAfter(
this, strDateTo, "1"), strDocument, strcAcctSchemaId, strOrgFamily, strCheck,
initRecordNumber, intRecordRange);
if (data != null && data.length > 0)
strPosition = ReportGeneralLedgerJournalData.selectCount(this, Utility.getContext(this,
vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strDateFrom, DateTimeData.nDaysAfter(
this, strDateTo, "1"), strDocument, strcAcctSchemaId, strOrgFamily, strCheck,
data[0].dateacct, data[0].identifier);
} else {
data = ReportGeneralLedgerJournalData.selectDirect(this, Utility.getContext(this, vars,
"#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strTable, strRecord, initRecordNumber,
intRecordRange);
if (data != null && data.length > 0)
strPosition = ReportGeneralLedgerJournalData.selectCountDirect(this, Utility.getContext(
this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strTable, strRecord, data[0].dateacct,
data[0].identifier);
}
} else if (vars.commandIn("DIRECT")) {
data = ReportGeneralLedgerJournalData.selectDirect(this, Utility.getContext(this, vars,
"#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strTable, strRecord, initRecordNumber,
intRecordRange);
if (data != null && data.length > 0)
strPosition = ReportGeneralLedgerJournalData.selectCountDirect(this, Utility.getContext(
this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strTable, strRecord, data[0].dateacct,
data[0].identifier);
} else if (vars.commandIn("DIRECT2")) {
data = ReportGeneralLedgerJournalData.selectDirect2(this, Utility.getContext(this, vars,
"#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strFactAcctGroupId, initRecordNumber,
intRecordRange);
if (data != null && data.length > 0)
strPosition = ReportGeneralLedgerJournalData.selectCountDirect2(this, Utility.getContext(
this, vars, "#User_Client", "ReportGeneralLedger"), Utility.getContext(this, vars,
"#AccessibleOrgTree", "ReportGeneralLedger"), strFactAcctGroupId, data[0].dateacct,
data[0].identifier);
}
if (data == null || data.length == 0) {
String discard[] = { "sectionSchema" };
toolbar
.prepareRelationBarTemplate(false, false,
"submitCommandForm('XLS', false, null, 'ReportGeneralLedgerJournal.xls', 'EXCEL');return false;");
xmlDocument = xmlEngine.readXmlTemplate(
"org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal", discard)
.createXmlDocument();
data = ReportGeneralLedgerJournalData.set("0");
data[0].rownum = "0";
} else {
/*
* String[] discard = {"withoutPrevious", "withoutNext"}; if (data==null || data.length==0 ||
* initRecordNumber<=1) discard[0] = new String("hasPrevious"); if (data==null ||
* data.length==0 || data.length<intRecordRange) discard[1] = new String("hasNext");
* xmlDocument =xmlEngine.readXmlTemplate(
* "org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal",
* discard).createXmlDocument();
*/
boolean hasPrevious = !(data == null || data.length == 0 || initRecordNumber <= 1);
boolean hasNext = !(data == null || data.length == 0 || data.length < intRecordRange);
toolbar
.prepareRelationBarTemplate(true, true,
"submitCommandForm('XLS', false, null, 'ReportGeneralLedgerJournal.xls', 'EXCEL');return false;");
xmlDocument = xmlEngine.readXmlTemplate(
"org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal").createXmlDocument();
String jsDisablePreviousNext = "function checkPreviousNextButtons(){";
if (!hasPrevious)
jsDisablePreviousNext += "disableToolBarButton('linkButtonPrevious');";
if (!hasNext)
jsDisablePreviousNext += "disableToolBarButton('linkButtonNext');";
jsDisablePreviousNext += "}";
xmlDocument.setParameter("jsDisablePreviousNext", jsDisablePreviousNext);
}
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "",
"C_DocType DocBaseType", "", Utility.getContext(this, vars, "#AccessibleOrgTree",
"ReportGeneralLedgerJournal"), Utility.getContext(this, vars, "#User_Client",
"ReportGeneralLedgerJournal"), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportGeneralLedgerJournal",
strDocument);
xmlDocument.setData("reportDocument", "liststructure", comboTableData.select(false));
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
xmlDocument.setParameter("toolbar", toolbar.toString());
try {
WindowTabs tabs = new WindowTabs(this, vars,
"org.openbravo.erpCommon.ad_reports.ReportGeneralLedgerJournal");
xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());