Fixes Issue 7244: Change Invoice and Order on SO and Sales Invoice
authorSathiyan Sivaprakasam <sathiyan.sivaprakasam@openbravo.com>
Fri, 26 Jun 2009 11:49:07 +0530
changeset 4068 ed12d262cab5
parent 4067 c514d884966b
child 4069 c260d5eeac1d
Fixes Issue 7244: Change Invoice and Order on SO and Sales Invoice
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/utility/reporting/Report.java
src/org/openbravo/erpCommon/utility/reporting/ReportManager.java
src/org/openbravo/erpCommon/utility/reporting/Report_data.xsql
src/org/openbravo/erpReports/C_OrderJR.jrxml
src/org/openbravo/erpReports/RptC_Invoice.jrxml
src/org/openbravo/erpReports/RptC_OrderPO.jrxml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Jun 26 11:06:39 2009 +0530
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Jun 26 11:49:07 2009 +0530
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?xml version="1.0" encoding="UTF-8"?>
 <data>
 <!--101--><AD_MESSAGE>
 <!--101-->  <AD_MESSAGE_ID><![CDATA[101]]></AD_MESSAGE_ID>
@@ -64066,6 +64066,18 @@
 <!--90DBF95BB32E4A2CAFDFFCCF64D7C63D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--90DBF95BB32E4A2CAFDFFCCF64D7C63D--></AD_MESSAGE>
 
+<!--912C10610C3A45C9B329BD418EAEB0E5--><AD_MESSAGE>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <AD_MESSAGE_ID><![CDATA[912C10610C3A45C9B329BD418EAEB0E5]]></AD_MESSAGE_ID>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <VALUE><![CDATA[Sales]]></VALUE>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <MSGTEXT><![CDATA[Sales]]></MSGTEXT>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <MSGTIP><![CDATA[Sales]]></MSGTIP>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--912C10610C3A45C9B329BD418EAEB0E5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--912C10610C3A45C9B329BD418EAEB0E5--></AD_MESSAGE>
+
 <!--9210E705A80B442688E09A6C7C6BAEBA--><AD_MESSAGE>
 <!--9210E705A80B442688E09A6C7C6BAEBA-->  <AD_MESSAGE_ID><![CDATA[9210E705A80B442688E09A6C7C6BAEBA]]></AD_MESSAGE_ID>
 <!--9210E705A80B442688E09A6C7C6BAEBA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/utility/reporting/Report.java	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpCommon/utility/reporting/Report.java	Fri Jun 26 11:49:07 2009 +0530
@@ -58,6 +58,7 @@
   private String orgId;
   private boolean deleteReport = false;
   private boolean multiReports = false;
+  private String checkSalesOrder;
 
   public String getDocTypeId() {
     return docTypeId;
@@ -101,6 +102,7 @@
 
     multiReports = multiReport;
     if (reportData.length == 1) {
+      checkSalesOrder=reportData[0].getField("isSalesOrderTransaction");
       orgId = reportData[0].getField("ad_Org_Id");
       docTypeId = reportData[0].getField("docTypeTargetId");
 
@@ -226,5 +228,12 @@
   public void setDeleteable(boolean deleteable) {
     deleteReport = deleteable;
   }
+  public String getCheckSalesOrder() {
+		return checkSalesOrder;
+  }
+
+  public void setCheckSalesOrder(String checkSalesOrder) {
+	this.checkSalesOrder = checkSalesOrder;
+  }
 
 }
--- a/src/org/openbravo/erpCommon/utility/reporting/ReportManager.java	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpCommon/utility/reporting/ReportManager.java	Fri Jun 26 11:49:07 2009 +0530
@@ -96,7 +96,6 @@
 
     final HashMap<String, Object> designParameters = populateDesignParameters(variables, report);
     designParameters.put("TEMPLATE_LOCATION", templateLocation);
-
     JasperPrint jasperPrint = null;
 
     try {
@@ -131,7 +130,12 @@
       JRFormatFactory jrFormatFactory = new JRFormatFactory();
       jrFormatFactory.setDatePattern(variables.getJavaDateFormat());
       designParameters.put(JRParameter.REPORT_FORMAT_FACTORY, jrFormatFactory);
-
+      String salesOrder=report.getCheckSalesOrder();
+      if(salesOrder!=null && salesOrder.equals("Y")){
+    	  designParameters.put("DOCUMENT_NAME", Utility.messageBD(_connectionProvider, "Sales", language)+" "+Utility.messageBD(_connectionProvider, "Invoice", language));
+      }else{
+    	  designParameters.put("DOCUMENT_NAME", Utility.messageBD(_connectionProvider, "Purchase", language)+" "+Utility.messageBD(_connectionProvider, "Invoice", language));
+      }
       jasperPrint = fillReport(designParameters, jasperReport);
 
     } catch (final JRException exception) {
--- a/src/org/openbravo/erpCommon/utility/reporting/Report_data.xsql	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpCommon/utility/reporting/Report_data.xsql	Fri Jun 26 11:49:07 2009 +0530
@@ -39,7 +39,8 @@
 				'' as ourreference,
 				'' as cusreference,
 				'' as bpartner_id,
-				'' as bpartner_language
+				'' as bpartner_language,
+				'' as isSalesOrderTransaction
 			from
 				c_order
 			where
@@ -90,6 +91,7 @@
 				c_invoice.documentno as ourreference,
 				c_invoice.poreference as cusreference,
 				c_invoice.c_bpartner_id as bpartner_id,
+				c_invoice.issotrx as isSalesOrderTransaction,
 				c_bpartner.ad_language as bpartner_language
 			from
 				c_invoice left join c_doctype on c_invoice.c_doctypetarget_id = c_doctype.c_doctype_id
--- a/src/org/openbravo/erpReports/C_OrderJR.jrxml	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpReports/C_OrderJR.jrxml	Fri Jun 26 11:49:07 2009 +0530
@@ -197,7 +197,7 @@
 					<reportElement
 						x="2"
 						y="39"
-						width="120"
+						width="158"
 						height="26"
 						key="staticText-2"/>
 					<box>					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -208,7 +208,7 @@
 					<textElement>
 						<font size="20"/>
 					</textElement>
-				<text><![CDATA[ORDER]]></text>
+				<text><![CDATA[SALES ORDER]]></text>
 				</staticText>
 				<staticText>
 					<reportElement
--- a/src/org/openbravo/erpReports/RptC_Invoice.jrxml	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpReports/RptC_Invoice.jrxml	Fri Jun 26 11:49:07 2009 +0530
@@ -185,6 +185,9 @@
 	<parameter name="DOCUMENT_ID" isForPrompting="true" class="java.lang.String">
 		<defaultValueExpression ><![CDATA["'1000032'"]]></defaultValueExpression>
 	</parameter>
+	<parameter name="DOCUMENT_NAME" isForPrompting="false" class="java.lang.String">
+		<defaultValueExpression ><![CDATA["'INVOICE'"]]></defaultValueExpression>
+	</parameter>
 	<parameter name="ATTACH" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="BASE_WEB" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="BASE_DESIGN" isForPrompting="false" class="java.lang.String">
@@ -314,26 +317,7 @@
 					</textElement>
 				<text><![CDATA[Invoice Number]]></text>
 				</staticText>
-				<staticText>
-					<reportElement
-						style="Report_Title"
-						x="8"
-						y="0"
-						width="182"
-						height="50"
-						forecolor="#666666"
-						key="staticText-5"/>
-					<box leftPadding="5">					<pen lineWidth="0.0"/>
-					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<bottomPen lineWidth="0.0" lineColor="#000000"/>
-					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-</box>
-					<textElement textAlignment="Left">
-						<font fontName="Bitstream Vera Sans" size="36"/>
-					</textElement>
-				<text><![CDATA[INVOICE]]></text>
-				</staticText>
+				
 				<staticText>
 					<reportElement
 						style="Group_Data_Label"
@@ -415,8 +399,17 @@
 					<textElement textAlignment="Right">
 						<font/>
 					</textElement>
+				
 				<textFieldExpression   class="java.lang.String"><![CDATA[$F{ENTITY}]]></textFieldExpression>
 				</textField>
+				
+				<textField>
+					<reportElement x="15" y="14" width="305" height="37"/>
+					<textElement>
+						<font size="26"/>
+					</textElement>
+					<textFieldExpression class="java.lang.String"><![CDATA[$P{DOCUMENT_NAME}]]></textFieldExpression>
+				</textField>
 				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
--- a/src/org/openbravo/erpReports/RptC_OrderPO.jrxml	Fri Jun 26 11:06:39 2009 +0530
+++ b/src/org/openbravo/erpReports/RptC_OrderPO.jrxml	Fri Jun 26 11:49:07 2009 +0530
@@ -391,7 +391,7 @@
 						style="Report_Title"
 						x="14"
 						y="1"
-						width="152"
+						width="266"
 						height="46"
 						forecolor="#666666"
 						key="staticText-29"/>
@@ -402,9 +402,9 @@
 					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 </box>
 					<textElement textAlignment="Left">
-						<font fontName="Bitstream Vera Sans" size="36"/>
+						<font fontName="Bitstream Vera Sans" size="26"/>
 					</textElement>
-				<text><![CDATA[ORDER]]></text>
+				<text><![CDATA[PURCHASE ORDER]]></text>
 				</staticText>
 				<staticText>
 					<reportElement