use of org.compiere.model.MClientInfo in project adempiere by adempiere.
the class Doc_Invoice method updateProductPO.
// landedCosts
/**
* Update ProductPO PriceLastInv
* @param as accounting schema
*/
private void updateProductPO(MAcctSchema as) {
MClientInfo ci = MClientInfo.get(getCtx(), as.getAD_Client_ID());
if (ci.getC_AcctSchema1_ID() != as.getC_AcctSchema_ID())
return;
StringBuffer sql = new StringBuffer("UPDATE M_Product_PO po " + "SET PriceLastInv = " + // select
"(SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,po.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) " + "FROM C_Invoice i, C_InvoiceLine il " + "WHERE i.C_Invoice_ID=il.C_Invoice_ID" + " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID");
//jz + " AND ROWNUM=1 AND i.C_Invoice_ID=").append(get_ID()).append(") ")
if (//jz
DB.isOracle()) {
sql.append(" AND ROWNUM=1 ");
} else {
sql.append(" AND il.C_InvoiceLine_ID = (SELECT MIN(il1.C_InvoiceLine_ID) " + "FROM C_Invoice i1, C_InvoiceLine il1 " + "WHERE i1.C_Invoice_ID=il1.C_Invoice_ID" + " AND po.M_Product_ID=il1.M_Product_ID AND po.C_BPartner_ID=i1.C_BPartner_ID").append(" AND i1.C_Invoice_ID=").append(get_ID()).append(") ");
}
sql.append(" AND i.C_Invoice_ID=").append(get_ID()).append(") ").append("WHERE EXISTS (SELECT * " + "FROM C_Invoice i, C_InvoiceLine il " + "WHERE i.C_Invoice_ID=il.C_Invoice_ID" + " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID" + " AND i.C_Invoice_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("Updated=" + no);
}
use of org.compiere.model.MClientInfo in project adempiere by adempiere.
the class ASPGenerateLevel method doIt.
// prepare
/**
* Process
* @return info
* @throws Exception
*/
protected String doIt() throws Exception {
log.info("ASP_Status=" + p_ASP_Status + ", AD_Menu_ID=" + p_AD_Menu_ID + ", IsGenerateFields=" + p_IsGenerateFields);
MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
int AD_Tree_ID = clientInfo.getAD_Tree_Menu_ID();
// Yamel Senih [ 9223372036854775807 ]
// Change Constructor
MTree thisTree = new MTree(getCtx(), AD_Tree_ID, true, true, true, null, get_TrxName());
// End Yamel Senih
MTreeNode node;
if (p_AD_Menu_ID > 0)
node = thisTree.getRoot().findNode(p_AD_Menu_ID);
else
node = thisTree.getRoot();
// Navigate the menu and add every non-summary node
if (node != null && node.isSummary()) {
Enumeration<?> en = node.preorderEnumeration();
while (en.hasMoreElements()) {
MTreeNode nn = (MTreeNode) en.nextElement();
if (!nn.isSummary())
addNodeToLevel(nn);
}
}
if (noWindows > 0)
addLog("Window " + noWindows);
if (noTabs > 0)
addLog("Tab " + noTabs);
if (noFields > 0)
addLog("Field " + noFields);
if (noProcesses > 0)
addLog("Process " + noProcesses);
if (noParameters > 0)
addLog("Process Parameter " + noParameters);
if (noForms > 0)
addLog("Form " + noForms);
if (noBrowses > 0)
addLog("noBrowses " + noBrowses);
if (noTasks > 0)
addLog("Task " + noTasks);
if (noWorkflows > 0)
addLog("Workflow " + noWorkflows);
return "@OK@";
}
use of org.compiere.model.MClientInfo in project adempiere by adempiere.
the class Doc_Order method updateProductPO.
// createFact
/**
* Update ProductPO PriceLastPO
* @param as accounting schema
*/
private void updateProductPO(MAcctSchema as) {
MClientInfo ci = MClientInfo.get(getCtx(), as.getAD_Client_ID());
if (ci.getC_AcctSchema1_ID() != as.getC_AcctSchema_ID())
return;
StringBuffer sql = new StringBuffer("UPDATE M_Product_PO po " + "SET PriceLastPO = (SELECT currencyConvert(ol.PriceActual,ol.C_Currency_ID,po.C_Currency_ID,o.DateOrdered,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) " + "FROM C_Order o, C_OrderLine ol " + "WHERE o.C_Order_ID=ol.C_Order_ID" + " AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID ");
//jz + " AND ROWNUM=1 AND o.C_Order_ID=").append(get_ID()).append(") ")
if (//jz
DB.isOracle()) {
sql.append(" AND ROWNUM=1 ");
} else
sql.append(" AND ol.C_OrderLine_ID = (SELECT MIN(ol1.C_OrderLine_ID) " + "FROM C_Order o1, C_OrderLine ol1 " + "WHERE o1.C_Order_ID=ol1.C_Order_ID" + " AND po.M_Product_ID=ol1.M_Product_ID AND po.C_BPartner_ID=o1.C_BPartner_ID").append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
sql.append(" AND o.C_Order_ID=").append(get_ID()).append(") ").append("WHERE EXISTS (SELECT * " + "FROM C_Order o, C_OrderLine ol " + "WHERE o.C_Order_ID=ol.C_Order_ID" + " AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID" + " AND o.C_Order_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("Updated=" + no);
}
use of org.compiere.model.MClientInfo in project adempiere by adempiere.
the class SMJReportViewer method dynInit.
//renderReport
/**
* Dynamic Init
*/
private void dynInit() {
SmjReportLogic logic = new SmjReportLogic();
data = logic.getDataReport(m_AD_PInstance_ID, trxName);
generalTitle = logic.getGeneralTitle(reportId, trxName);
clientName = logic.getOrgName(trxName);
// if (clientName.equals("") || clientName.length()<=0){
// clientName = logic.getClientName(trxName);
// }
clientNIT = logic.getOrgNIT(trxName);
periodName = logic.getPeriodName(p_C_Period_ID, trxName);
currencyName = logic.getCurrency(trxName);
codeFont = logic.getCodeFont(trxName, p_AD_PrintFont_ID);
city = logic.getClientCity(trxName);
//logo
Properties prop = Env.getCtx();
MOrgInfo oi = MOrgInfo.get(prop, Env.getAD_Org_ID(prop), null);
logoId = oi.getLogo_ID();
if (logoId <= 0) {
MClientInfo ci = MClientInfo.get(prop);
logoId = ci.getLogoReport_ID();
if (logoId <= 0)
logoId = ci.getLogo_ID();
}
SmjPdfReport pdf = new SmjPdfReport();
baosPDF = pdf.generate(data, trxName, generalTitle, clientName, clientNIT, periodName, currencyName, m_columns, codeFont, city, logoId);
filePdf = pdf.tofile(baosPDF.toByteArray(), generalTitle);
revalidate();
}
use of org.compiere.model.MClientInfo in project adempiere by adempiere.
the class LayoutEngine method createStandardHeaderFooter.
// isYspaceFor
/**************************************************************************
* Create Standard Header/Footer
* <pre>
* title C Page x of x
* Copyright who date&time
* </pre>
*/
private void createStandardHeaderFooter() {
MClientInfo ci = MClientInfo.get(Env.getCtx());
PrintElement element = null;
if (ci.getLogoReport_ID() > 0) {
element = new ImageElement(ci.getLogoReport_ID(), false);
} else {
// 48x15
element = new ImageElement(org.compiere.Adempiere.getImageLogoSmall(true));
}
// element = new ImageElement(org.compiere.Adempiere.getImageLogo()); // 100x30
element.layout(48, 15, false, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft);
element.setLocation(m_header.getLocation());
m_headerFooter.addElement(element);
//
MPrintTableFormat tf = m_format.getTableFormat();
Font font = tf.getPageHeader_Font();
Color color = tf.getPageHeaderFG_Color();
//
element = new StringElement("@*ReportName@", font, color, null, true);
element.layout(m_header.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center);
element.setLocation(m_header.getLocation());
m_headerFooter.addElement(element);
//
//
element = new StringElement("@Page@ @*Page@ @of@ @*PageCount@", font, color, null, true);
element.layout(m_header.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight);
element.setLocation(m_header.getLocation());
m_headerFooter.addElement(element);
// Footer
font = tf.getPageFooter_Font();
color = tf.getPageFooterFG_Color();
//
element = new StringElement(Adempiere.ADEMPIERE_R, font, color, null, true);
/** You can use the following to customize reports for your product name */
// element = new StringElement(Adempiere.NAME, font, color, null, true);
element.layout(m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft);
Point ft = m_footer.getLocation();
// 2pt above min
ft.y += m_footer.height - element.getHeight() - 2;
element.setLocation(ft);
m_headerFooter.addElement(element);
//
element = new StringElement("@*Header@", font, color, null, true);
element.layout(m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center);
element.setLocation(ft);
m_headerFooter.addElement(element);
//
element = new StringElement("@*CurrentDateTime@", font, color, null, true);
element.layout(m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight);
element.setLocation(ft);
m_headerFooter.addElement(element);
}
Aggregations