details: /erp/devel/pi-engdev/rev/bb7be45c3e44
changeset: 6973:bb7be45c3e44
user: Manoharan Iyyadurai <manoharan.iyyadurai <at> openbravo.com>
date: Mon Apr 12 20:20:02 2010 +0530
summary: Retrieved data from data base for transactions tab.
diffstat:
src/org/openbravo/erpCommon/ad_forms/Transactions.html | 22 ++-
src/org/openbravo/erpCommon/ad_forms/Transactions.java | 86 ++++++++------
src/org/openbravo/erpCommon/ad_forms/Transactions.xml | 14 ++
src/org/openbravo/erpCommon/ad_forms/TransactionsDao.java | 49 ++++++++
4 files changed, 125 insertions(+), 46 deletions(-)
diffs (truncated from 320 to 300 lines):
diff -r 4c3077f2aa2a -r bb7be45c3e44
src/org/openbravo/erpCommon/ad_forms/Transactions.html
--- a/src/org/openbravo/erpCommon/ad_forms/Transactions.html Fri Apr 09
13:11:15 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Transactions.html Mon Apr 12
20:20:02 2010 +0530
@@ -76,14 +76,14 @@
<input type="hidden" name="inpTabId" value="" id="fieldTabId">
<input type="hidden" name="inpLastFieldChanged" id="paramChanged" value="">
<input type="hidden" name="inpwindowId" value="" id="fieldWindowId">
- <!-- input type="hidden" name="inpkeyColumnId" value="" id="C_Invoice_ID"
-->
+ <input type="hidden" name="inpkeyColumnId" value=""
id="Fin_Financial_Account_ID">
<input type="hidden" name="inpTableId" value="" id="fieldTableId">
<input type="hidden" name="inpKeyName" value="inpC_Invoice_ID">
<input type="hidden" name="inpKeyReferenceColumnName">
<input type="hidden" name="inpTableReferenceId">
<input type="hidden" name="inpKeyReferenceId">
<input type="hidden" name="inpSecondKey">
-<!-- <input type="hidden" name="inpcInvoiceId" value=""
id="C_Invoice_ID"></input> -->
+ <input type="hidden" name="inpfinFinancialAccountId" value=""
id="Fin_Financial_Account_ID"></input>
<input type="hidden" name="inpdocstatus" value=""
id="fieldDocStatus"></input>
<input type="hidden" name="inpprocessing" value=""
id="fieldProcessing"></input>
<!-- <table>
@@ -232,7 +232,11 @@
<span
style="font-size:8pt;font-weight:normal;">Account:</span>
</td>
<td style="border: 0px none;">
- <span style="font-size: 8pt;">10100-checking</span>
+ <span style="font-size: 8pt;" id="accountNo"></span>
+ <input type="text" value="" name="accountNo"
id="accountNo">
+ </td>
+ <td style="border: 0px none;">
+ <span style="font-size: 8pt;" id="name"></span>
</td>
</tr>
<tr>
@@ -240,10 +244,10 @@
<span style="font-size:8pt;font-weight:normal;">Last
Reconciliation:</span>
</td>
<td style="border: 0px none;">
- <span style="font-size: 8pt;">05/12/2009</span>
+ <span style="font-size: 8pt;"
id="lastReconcilDate"></span>
</td>
<td align="left" style="border: 0px none;color: blue">
- <span style="font-size: 8pt;font-weight: bold;color:
#0000FF;text-align: left">6 Items to match</span>
+ <span style="font-size: 8pt;font-weight: bold;color:
#0000FF;text-align: left" id="noOfRecords">6 Items to match</span>
</td>
</tr>
<tr><td style="border: none;"> </td></tr>
@@ -255,7 +259,7 @@
<span
style="font-size:8pt;font-weight:bold;color:#000000;">Starting Balance</span>
</td>
<td style="border: none;" align="right">
- <span style="font-size: 8pt;padding-right:
100px;">2000</a></span>
+ <span style="font-size: 8pt;padding-right: 100px;"
id="startingbalance"></a></span>
</td>
</tr>
@@ -264,7 +268,7 @@
<span
style="font-size:8pt;font-weight:bold;color:#000000;">Financial Account
Balance</span>
</td>
<td style="border: none;" align="right">
- <span style="font-size: 8pt;padding-right:
100px;">200</span>
+ <span style="font-size: 8pt;padding-right: 100px;"
id="currentBalance"></span>
</td>
</tr>
@@ -273,7 +277,7 @@
<span
style="font-size:8pt;font-weight:bold;color:#000000;">Intermediate Account
Balance</span>
</td>
<td style="border: none;" align="right">
- <span style="font-size: 8pt;padding-right:
100px;">10</span>
+ <span style="font-size: 8pt;padding-right: 100px;"
id="interAccBalance"></span>
</td>
</tr>
@@ -282,7 +286,7 @@
<span
style="font-size:8pt;font-weight:bold;color:#000000;">Total Balance</span>
</td>
<td style="border: none;" align="right">
- <span style="font-size: 8pt;padding-right:
100px;">210</span>
+ <span style="font-size: 8pt;padding-right: 100px;"
id="totalBalance"></span>
</td>
</tr>
</table>
diff -r 4c3077f2aa2a -r bb7be45c3e44
src/org/openbravo/erpCommon/ad_forms/Transactions.java
--- a/src/org/openbravo/erpCommon/ad_forms/Transactions.java Fri Apr 09
13:11:15 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Transactions.java Mon Apr 12
20:20:02 2010 +0530
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.PrintWriter;
+import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -13,12 +14,15 @@
import org.apache.log4j.Logger;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.data.FieldProvider;
import org.openbravo.erpCommon.businessUtility.WindowTabs;
import org.openbravo.erpCommon.utility.LeftTabsBar;
import org.openbravo.erpCommon.utility.NavigationBar;
import org.openbravo.erpCommon.utility.OBError;
import org.openbravo.erpCommon.utility.ToolBar;
import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.utils.FormatUtilities;
import org.openbravo.xmlEngine.XmlDocument;
/**
@@ -29,7 +33,6 @@
private static final long serialVersionUID = 1L;
private static Logger log4j = Logger.getLogger(Transactions.class);
- // private static final String windowId = "94EAA455D2644E04AB25D93BE5157B6D";
private static final String formClassName =
"org.openbravo.erpCommon.ad_forms.Transactions";
public void doPost(HttpServletRequest request, HttpServletResponse response)
@@ -44,68 +47,76 @@
String windowNameEnUS = "";
String tabNameEnUS = "";
{
- TransactionsData[] data = TransactionsData.selectWindowData(this,
vars.getLanguage(),
- formClassName);
- if (data == null || data.length == 0) {
+ List<Tab> data = TransactionsDao.getWindowData(formClassName);
+ if (data == null || data.size() == 0) {
throw new ServletException(formClassName + ": Error on window data");
}
- windowId = data[0].adWindowId;
- tabId = data[0].adTabId;
- tableId = data[0].adTableId;
- tabName = data[0].tabname;
- windowName = data[0].windowname;
- tabNameEnUS = data[0].tabnameEnUs;
- windowNameEnUS = data[0].windownameEnUs;
+ Tab tab = data.get(0);
+ windowId = tab.getWindow().getId();
+ tabId = tab.getId();
+ tableId = tab.getTable().getId();
+ tabName = tab.getTable().getName();
+ windowName = tab.getWindow().getName();
+ tabNameEnUS = tab.getTable().getName();
+ windowNameEnUS = tab.getWindow().getName();
}
if (vars.commandIn("DEFAULT")) {
- // printPageDataSheet(response, vars);
- printPageDataSheet(response, vars, windowName, tabName, windowId, tabId,
tableId,
- windowNameEnUS, tabNameEnUS);
+
+ String strFinFinancialAccountId =
vars.getGlobalVariable("inpfinFinancialAccountId", windowId
+ + "|Fin_Financial_Account_ID", "");
+ if ("".equals(strFinFinancialAccountId))
+ response.sendRedirect(strDireccion + "/" +
FormatUtilities.replace(windowNameEnUS) + "/"
+ + FormatUtilities.replace(tabNameEnUS) +
"_Relation.html?Command=RELATION");
+ else
+ printPageDataSheet(response, vars, strFinFinancialAccountId,
windowName, tabName, windowId,
+ tabId, tableId, windowNameEnUS, tabNameEnUS);
} else if (vars.commandIn("NEW")) {
- printPageDataSheet(response, vars, windowName, tabName, windowId, tabId,
tableId,
- windowNameEnUS, tabNameEnUS);
+ String strFinFinancialAccountId =
vars.getGlobalVariable("inpfinFinancialAccountId", windowId
+ + "|Fin_Financial_Account_ID", "");
+ printPageDataSheet(response, vars, strFinFinancialAccountId, windowName,
tabName, windowId,
+ tabId, tableId, windowNameEnUS, tabNameEnUS);
}
}
private void printPageDataSheet(HttpServletResponse response,
VariablesSecureApp vars,
- String windowName, String tabName, String windowId, String tabId, String
tableId,
- String windowNameEnUS, String tabNameEnUS) throws IOException,
ServletException {
+ String strFinFinancialAccountId, String windowName, String tabName,
String windowId,
+ String tabId, String tableId, String windowNameEnUS, String tabNameEnUS)
throws IOException,
+ ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: dataSheet");
- // String[] discard = { "newDiscard", "" };
String strCommand = "EDIT";
- // String strDateFormat = vars.getSessionValue("#AD_SqlDateFormat");
-
+ FieldProvider[] data =
TransactionsDao.getAccTrxData(strFinFinancialAccountId);
+ if (data == null || data.length == 0) {
+ throw new ServletException(formClassName + ": Error when getting data");
+ }
XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
"org/openbravo/erpCommon/ad_forms/Transactions").createXmlDocument();
xmlDocument.setParameter("theme", vars.getTheme());
xmlDocument.setParameter("directory", "var baseDirectory = \"" +
strReplaceWith + "/\";\n");
xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage()
+ "\";");
- xmlDocument.setParameter("command", strCommand); // TODO : Need to get the
property.
- // strCommand
- xmlDocument.setParameter("commandType", strCommand); // TODO : Need to get
the property.
- // strCommand
- xmlDocument.setParameter("windowName", windowName); // TODO : Need to get
the property.
- // windowName
- xmlDocument.setParameter("tabName", tabName); // TODO : Need to get the
property. tabName
- xmlDocument.setParameter("windowId", windowId); // TODO : Need to get the
property. windowId
- xmlDocument.setParameter("tabId", tabId); // TODO : Need to get the
property. tabId
- xmlDocument.setParameter("tableId", tableId); // TODO : Need to get the
property. tableId
- xmlDocument.setParameter("KeyName", ""); // TODO : Need to get the
property. keyName
- xmlDocument.setParameter("windowPath", Utility.getTabURL(this, tabId,
"E")); // TODO : Need to
+ xmlDocument.setParameter("command", strCommand);
+ xmlDocument.setParameter("commandType", strCommand);
+ xmlDocument.setParameter("windowName", windowName);
+ xmlDocument.setParameter("tabName", tabName);
+ xmlDocument.setParameter("windowId", windowId);
+ xmlDocument.setParameter("tabId", tabId);
+ xmlDocument.setParameter("tableId", tableId);
+ xmlDocument.setParameter("KeyName", "");
+ xmlDocument.setParameter("windowPath", Utility.getTabURL(this, tabId,
"E"));
ToolBar toolbar = new ToolBar(this, vars.getLanguage(),
"FinancialAccount", (strCommand
- .equals("NEW")), "", "", "", "".equals("Y"), "FinancialAccount",
strReplaceWith, true);
- // toolbar.setTabId("tabId");
+ .equals("NEW") || (data == null || data.length == 0)),
+ "document.frmMain.inpfinFinancialAccountId", "", "", "".equals("Y"),
"FinancialAccount",
+ strReplaceWith, true);
+
toolbar.prepareEditionTemplate("N".equals("Y"), false,
vars.getSessionValue("#ShowTest", "N")
.equals("Y"), "STD", false);
xmlDocument.setParameter("toolbar", toolbar.toString());
try {
- // WindowTabs tabs = new WindowTabs(this, vars, "tabId", windowId,
false);
WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId);
xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
@@ -129,7 +140,7 @@
xmlDocument.setParameter("messageMessage", myMessage.getMessage());
}
}
-
+ xmlDocument.setData("structure1", data);
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println(xmlDocument.print());
@@ -139,4 +150,5 @@
public String getServletInfo() {
return "Transactions Servlet";
}
+
}
diff -r 4c3077f2aa2a -r bb7be45c3e44
src/org/openbravo/erpCommon/ad_forms/Transactions.xml
--- a/src/org/openbravo/erpCommon/ad_forms/Transactions.xml Fri Apr 09
13:11:15 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/Transactions.xml Mon Apr 12
20:20:02 2010 +0530
@@ -25,5 +25,19 @@
<PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
<PARAMETER id="paramToolBar" name="toolbar" default=""/>
<PARAMETER id="tdleftTabs" name="leftTabs" default=""/>
+
+ <structure name="structure1">
+ <FIELD id="Fin_Financial_Account_ID"
attribute="value">finFinancialAccountId</FIELD>
+
+ <FIELD id="accountNo" attribute="value">accountNo</FIELD>
+ <FIELD id="name" attribute="value">name</FIELD>
+
+ <FIELD id="lastReconcilDate" attribute="value">lastReconcilDate</FIELD>
+ <FIELD id="startingbalance" attribute="value">startingbalance</FIELD>
+ <FIELD id="currentBalance" attribute="value">currentBalance</FIELD>
+ <FIELD id="interAccBalance"
attribute="displayformat">"interAccBalance"</FIELD>
+ <FIELD id="totalBalance" attribute="saveformat">totalBalance</FIELD>
+
+ </structure>
</REPORT>
diff -r 4c3077f2aa2a -r bb7be45c3e44
src/org/openbravo/erpCommon/ad_forms/TransactionsDao.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/TransactionsDao.java Mon Apr 12
20:20:02 2010 +0530
@@ -0,0 +1,49 @@
+package org.openbravo.erpCommon.ad_forms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBQuery;
+import org.openbravo.erpCommon.utility.OBObjectFieldProvider;
+import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.model.financialmgmt.payment.FIN_FinaccTransaction;
+
+public class TransactionsDao {
+
+ public static List<Tab> getWindowData(String className) {
+
+ final List<Object> parameters = new ArrayList<Object>();
+ final StringBuilder whereClause = new StringBuilder();
+ whereClause.append(" as td");
+ whereClause.append(" left outer join td.window");
+ whereClause.append(" left outer join td.masterDetailForm ");
+ whereClause.append(" where td.masterDetailForm = td.masterDetailForm.id");
+ whereClause.append(" and td.window = td.window.id");
+ whereClause.append(" and UPPER(td.masterDetailForm.javaClassName) =
UPPER(?)");
+ parameters.add(className);
+
+ OBContext.getOBContext().setInAdministratorMode(true);
+ final OBQuery<Tab> obQuery = OBDal.getInstance().createQuery(Tab.class,
whereClause.toString());
+ obQuery.setParameters(parameters);
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits