Merge with development

This commit is contained in:
hieplq 2015-08-14 05:58:25 +08:00
commit d6da6ee556
8 changed files with 31 additions and 49 deletions

View File

@ -109,8 +109,12 @@ public class CommissionCalc extends SvrProcess
{ {
if (m_com.isListDetails()) if (m_com.isListDetails())
{ {
sql.append("SELECT h.C_Currency_ID, (l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,") sql.append("SELECT h.C_Currency_ID, CASE WHEN h.GrandTotal <> 0 ")
.append(" (l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,") .append(" THEN (l.LineNetAmt*al.Amount/h.GrandTotal) ")
.append(" ELSE 0 END AS Amt,")
.append(" CASE WHEN h.GrandTotal <> 0 ")
.append(" THEN (l.QtyInvoiced*al.Amount/h.GrandTotal) ")
.append(" ELSE 0 END AS Qty,")
.append(" NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo,") .append(" NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo,")
.append(" COALESCE(prd.Value,l.Description), h.DateInvoiced ") .append(" COALESCE(prd.Value,l.Description), h.DateInvoiced ")
.append("FROM C_Payment p") .append("FROM C_Payment p")
@ -125,8 +129,11 @@ public class CommissionCalc extends SvrProcess
} }
else else
{ {
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,") sql.append("SELECT h.C_Currency_ID, ")
.append(" SUM(l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,") .append(" SUM(CASE WHEN h.GrandTotal <> 0 ")
.append(" THEN l.LineNetAmt*al.Amount/h.GrandTotal ELSE 0 END) AS Amt,")
.append(" SUM(CASE WHEN h.GrandTotal <> 0 ")
.append(" THEN l.QtyInvoiced*al.Amount/h.GrandTotal ELSE 0 END) AS Qty,")
.append(" NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ") .append(" NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ")
.append("FROM C_Payment p") .append("FROM C_Payment p")
.append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)") .append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)")

View File

@ -2953,7 +2953,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
if (!Util.isEmpty(retValue)) // interrupt on first error if (!Util.isEmpty(retValue)) // interrupt on first error
{ {
log.severe (retValue); log.config(retValue); // no need to save an AD_Issue error on each callout
return retValue; return retValue;
} }
} // for each callout } // for each callout

View File

@ -2312,8 +2312,8 @@ public abstract class PO
} }
} }
m_newValues = new Object[size]; m_newValues = new Object[size];
m_createNew = false;
} }
m_createNew = false;
if (!newRecord) if (!newRecord)
CacheMgt.get().reset(p_info.getTableName()); CacheMgt.get().reset(p_info.getTableName());
else if (get_ID() > 0 && success) else if (get_ID() > 0 && success)
@ -2678,10 +2678,10 @@ public abstract class PO
else else
{ {
if (m_trxName == null) if (m_trxName == null)
log.log(Level.WARNING, "Update return " + no + " instead of 1" log.saveError("SaveError", "Update return " + no + " instead of 1"
+ " - " + p_info.getTableName() + "." + where); + " - " + p_info.getTableName() + "." + where);
else else
log.log(Level.WARNING, "Update return " + no + " instead of 1" log.saveError("SaveError", "Update return " + no + " instead of 1"
+ " - [" + m_trxName + "] - " + p_info.getTableName() + "." + where); + " - [" + m_trxName + "] - " + p_info.getTableName() + "." + where);
} }
return ok; return ok;

View File

@ -632,7 +632,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
thead thead = new thead(); thead thead = new thead();
tbody tbody = new tbody(); tbody tbody = new tbody();
Boolean [] colSuppressRepeats = m_layout == null ? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats; Boolean [] colSuppressRepeats = m_layout == null || m_layout.colSuppressRepeats == null? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats;
Object [] preValues = new Object [colSuppressRepeats.length]; Object [] preValues = new Object [colSuppressRepeats.length];
int printColIndex = -1; int printColIndex = -1;
// for all rows (-1 = header row) // for all rows (-1 = header row)
@ -778,7 +778,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
//just run with on record //just run with on record
if (row == 0) if (row == 0)
addCssInfo(item, col); addCssInfo(item, printColIndex);
} }
else if (obj instanceof PrintData) else if (obj instanceof PrintData)
@ -902,7 +902,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
delimiter = '\t'; delimiter = '\t';
try try
{ {
Boolean [] colSuppressRepeats = m_layout == null ? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats; Boolean [] colSuppressRepeats = m_layout == null || m_layout.colSuppressRepeats == null? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats;
Object [] preValues = new Object [colSuppressRepeats.length]; Object [] preValues = new Object [colSuppressRepeats.length];
int printColIndex = -1; int printColIndex = -1;
// for all rows (-1 = header row) // for all rows (-1 = header row)
@ -1234,7 +1234,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
public void createXLS(File outFile, Language language) public void createXLS(File outFile, Language language)
throws Exception throws Exception
{ {
Boolean [] colSuppressRepeats = m_layout == null ? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats; Boolean [] colSuppressRepeats = m_layout == null || m_layout.colSuppressRepeats == null? LayoutEngine.getColSuppressRepeats(m_printFormat):m_layout.colSuppressRepeats;
PrintDataExcelExporter exp = new PrintDataExcelExporter(getPrintData(), getPrintFormat(), colSuppressRepeats); PrintDataExcelExporter exp = new PrintDataExcelExporter(getPrintData(), getPrintFormat(), colSuppressRepeats);
exp.export(outFile, language); exp.export(outFile, language);
} }

View File

@ -1606,7 +1606,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
int[] columnMaxWidth = new int[columnCount]; int[] columnMaxWidth = new int[columnCount];
int[] columnMaxHeight = new int[columnCount]; int[] columnMaxHeight = new int[columnCount];
boolean[] fixedWidth = new boolean [columnCount]; boolean[] fixedWidth = new boolean [columnCount];
colSuppressRepeats = new Boolean[columnCount]; Boolean [] colSuppressRepeats = new Boolean[columnCount];
String[] columnJustification = new String[columnCount]; String[] columnJustification = new String[columnCount];
HashMap<Integer,Integer> additionalLines = new HashMap<Integer,Integer>(); HashMap<Integer,Integer> additionalLines = new HashMap<Integer,Integer>();
@ -1781,6 +1781,9 @@ public class LayoutEngine implements Pageable, Printable, Doc
table.layout(0,0,false, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft); table.layout(0,0,false, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft);
if (m_tableElement == null) if (m_tableElement == null)
m_tableElement = table; m_tableElement = table;
if (format == m_format)
this.colSuppressRepeats = colSuppressRepeats;
return table; return table;
} // layoutTable } // layoutTable

View File

@ -20,6 +20,7 @@
<cq:advisorNode namePattern="^org\.apache\.xerces$" componentType="osgi.bundle" versionOverride="[2.9.0,2.9.1)"/> <cq:advisorNode namePattern="^org\.apache\.xerces$" componentType="osgi.bundle" versionOverride="[2.9.0,2.9.1)"/>
<cq:advisorNode namePattern="^org\.apache\.xml\.serializer$" componentType="osgi.bundle" versionOverride="[2.7.1,2.7.2)"/> <cq:advisorNode namePattern="^org\.apache\.xml\.serializer$" componentType="osgi.bundle" versionOverride="[2.7.1,2.7.2)"/>
<cq:advisorNode namePattern="^org\.apache\.felix\.webconsole$" versionOverride="[4.2.2,4.2.2]"/> <cq:advisorNode namePattern="^org\.apache\.felix\.webconsole$" versionOverride="[4.2.2,4.2.2]"/>
<cq:advisorNode namePattern="^org\.apache\.felix\.webconsole\.plugins\.ds$" versionOverride="[1.0.0,1.0.0]"/>
<cq:advisorNode namePattern="^org\.objectweb(\..+)?" componentType="osgi.bundle" versionOverride="[5.0.1,5.0.1]"/> <cq:advisorNode namePattern="^org\.objectweb(\..+)?" componentType="osgi.bundle" versionOverride="[5.0.1,5.0.1]"/>
<cq:advisorNode namePattern="^javax\.jms$" componentType="osgi.bundle" versionOverride="[1.1.0,1.1.1)"/> <cq:advisorNode namePattern="^javax\.jms$" componentType="osgi.bundle" versionOverride="[1.1.0,1.1.1)"/>
<cq:advisorNode namePattern="^javax\.ejb$" componentType="osgi.bundle" versionOverride="[3.1.1,3.1.2)"/> <cq:advisorNode namePattern="^javax\.ejb$" componentType="osgi.bundle" versionOverride="[3.1.1,3.1.2)"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -11,21 +11,16 @@ import static org.compiere.model.SystemIDs.PROCESS_RPT_FINSTATEMENT;
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INOUT;
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY; import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter; import java.io.CharArrayWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import net.sf.compilo.report.ReportProcessor;
import net.sf.jasperreports.engine.JasperPrint;
import org.adempiere.util.ProcessUtil; import org.adempiere.util.ProcessUtil;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
@ -379,6 +374,7 @@ public class Process {
// Report // Report
if ((process.isReport() || jasperreport)) if ((process.isReport() || jasperreport))
{ {
pi.setReportingProcess(true);
r.setIsReport(true); r.setIsReport(true);
ReportEngine re=null; ReportEngine re=null;
if (!jasperreport) if (!jasperreport)
@ -418,11 +414,12 @@ public class Process {
} }
else else
{ {
JasperPrint jp = getJasperReportPrint( m_cs.getCtx(), pi); Trx trx = trxName == null ? Trx.get(Trx.createTrxName("WebPrc"), true) : Trx.get(trxName, true);
ByteArrayOutputStream wr = new ByteArrayOutputStream(); pi.setPrintPreview (false);
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jp, wr); pi.setIsBatch(true);
ProcessUtil.startJavaProcess(Env.getCtx(), pi, trx, true, null);
file_type ="pdf"; file_type ="pdf";
r.setData(wr.toByteArray()); r.setData(java.nio.file.Files.readAllBytes(pi.getPDFReport().toPath()));
r.setReportFormat(file_type); r.setReportFormat(file_type);
ok = true; ok = true;
} }
@ -675,32 +672,6 @@ public class Process {
return null; return null;
} }
private static JasperPrint getJasperReportPrint(Properties ctx, ProcessInfo pi)
{
try
{
JasperPrint jasperPrint;
ReportProcessor rp = new ReportProcessor(ctx, pi);
jasperPrint = rp.runReport();
if(jasperPrint == null)
{
log.finer("ReportStarter.startProcess Cannot process JasperPrint Object");
return null;
}
else
return jasperPrint;
}
catch (Exception ex)
{
log.saveError("ReportStarter.startProcess: Can not run report - ", ex);
return null;
// return ex.getMessage();
}
}
static public ReportEngine start (ProcessInfo pi) static public ReportEngine start (ProcessInfo pi)
{ {
if (log.isLoggable(Level.INFO)) log.info("start - " + pi); if (log.isLoggable(Level.INFO)) log.info("start - " + pi);