Search in sources :

Example 1 with CLogger

use of org.compiere.util.CLogger in project adempiere by adempiere.

the class Info method getSQLText.

//  getSQLText
/**
	 *  Get SQL WHERE parameter
	 *  @param s string
	 *  @return Upper case text with wild cards as configured
	 */
public static String getSQLText(String s) {
    s = s.toUpperCase();
    //  Check the configuration for the wild card pattern to apply
    //  It can be "%*" for first-only, "*%" for last-only, "%*%" for both or "*" for none.
    //  The pattern string must start and/or end with a "%" symbol.  The "*" symbol can be any string.
    //  The default is last-only.  "%" or "%%" are valid and will be interpreted as both.
    String wildCardPattern = MSysConfig.getValue(SYSCONFIG_INFO_AUTO_WILDCARD, "*%", Env.getAD_Client_ID(Env.getCtx()));
    if (wildCardPattern.startsWith("%")) {
        if (!s.startsWith("%"))
            s = "%" + s;
    }
    if (wildCardPattern.endsWith("%")) {
        if (!s.endsWith("%"))
            s += "%";
    }
    // Need static logger
    CLogger mlog = CLogger.get();
    mlog.fine("String with wild cards: " + s);
    return s;
}
Also used : CLogger(org.compiere.util.CLogger)

Example 2 with CLogger

use of org.compiere.util.CLogger in project adempiere by adempiere.

the class ServerReportCtl method startDocumentPrint.

/**
	 * Start Document Print for Type with specified printer.
	 * @param type
	 * @param customPrintFormat
	 * @param recordId
	 * @param printerName
	 * @param processInfo
     * @return
     */
public static boolean startDocumentPrint(int type, MPrintFormat customPrintFormat, int recordId, String printerName, ProcessInfo processInfo) {
    String trxName;
    if (processInfo != null)
        trxName = processInfo.getTransactionName();
    else
        trxName = null;
    ReportEngine reportEngine = ReportEngine.get(Env.getCtx(), type, recordId, trxName);
    if (reportEngine == null) {
        CLogger log = CLogger.getCLogger(ServerReportCtl.class);
        log.warning("NoDocPrintFormat");
        return false;
    }
    if (customPrintFormat != null) {
        // Use custom print format if available
        reportEngine.setPrintFormat(customPrintFormat);
    }
    if (reportEngine.getPrintFormat() != null) {
        MPrintFormat format = reportEngine.getPrintFormat();
        // ==============================
        if (format.getJasperProcess_ID() > 0) {
            boolean result = runJasperProcess(recordId, reportEngine, true, printerName, processInfo);
            return (result);
        } else // Standard Print Format (Non-Jasper)
        // ==================================
        {
            // set generated PDF
            if (processInfo != null)
                processInfo.setPDFReport(reportEngine.getPDF());
            createOutput(reportEngine, printerName);
            ReportEngine.printConfirm(type, recordId, trxName);
        }
    }
    return true;
}
Also used : CLogger(org.compiere.util.CLogger)

Example 3 with CLogger

use of org.compiere.util.CLogger in project adempiere by adempiere.

the class LastInvoiceCostingMethod method process.

public MCostDetail process() {
    CLogger logger = CLogger.getCLogger(LastInvoiceCostingMethod.class);
    boolean isReturnTrx = costDetail.getQty().signum() < 0;
    int precision = accountSchema.getCostingPrecision();
    BigDecimal price = costDetail.getAmt();
    if (costDetail.getQty().signum() != 0)
        price = costDetail.getAmt().divide(costDetail.getQty(), precision, BigDecimal.ROUND_HALF_UP);
    if (costDetail.getC_OrderLine_ID() != 0) {
        if (!isReturnTrx) {
            if (costDetail.getQty().signum() != 0)
                dimension.setCurrentCostPrice(price);
            else {
                BigDecimal currentCost = dimension.getCurrentCostPrice().add(costDetail.getAmt());
                dimension.setCurrentCostPrice(currentCost);
            }
        }
        dimension.add(costDetail.getAmt(), costDetail.getQty());
        logger.finer("Inv - LastInv - " + dimension);
    } else if (// AR Shipment Detail Record
    costDetail.getM_InOutLine_ID() != 0 || costDetail.getM_MovementLine_ID() != 0 || costDetail.getM_InventoryLine_ID() != 0 || costDetail.getM_ProductionLine_ID() != 0 || costDetail.getC_ProjectIssue_ID() != 0 || costDetail.getPP_Cost_Collector_ID() != 0) {
        dimension.setCurrentQty(dimension.getCurrentQty().add(costDetail.getQty()));
        logger.finer("QtyAdjust - LastInv - " + dimension);
        dimension.saveEx();
    }
    return costDetail;
}
Also used : CLogger(org.compiere.util.CLogger) BigDecimal(java.math.BigDecimal)

Example 4 with CLogger

use of org.compiere.util.CLogger in project adempiere by adempiere.

the class MultiMap method printToLog.

//	toString
/**
	 *  dump all keys - values to log
	 */
public void printToLog() {
    CLogger log = CLogger.getCLogger(getClass());
    log.fine("MultiMap.printToLog");
    int size = m_keys.size();
    for (int i = 0; i < size; i++) {
        Object k = m_keys.get(i);
        Object v = m_values.get(i);
        log.finest(k == null ? "null" : k.toString() + "=" + v == null ? "null" : v.toString());
    }
}
Also used : CLogger(org.compiere.util.CLogger)

Example 5 with CLogger

use of org.compiere.util.CLogger in project adempiere by adempiere.

the class LastPOPriceCostingMethod method process.

public MCostDetail process() {
    CLogger logger = CLogger.getCLogger(LastPOPriceCostingMethod.class);
    boolean isReturnTrx = costDetail.getQty().signum() < 0;
    int precision = accountSchema.getCostingPrecision();
    BigDecimal price = costDetail.getAmt();
    if (costDetail.getQty().signum() != 0)
        price = costDetail.getAmt().divide(costDetail.getQty(), precision, BigDecimal.ROUND_HALF_UP);
    if (costDetail.getC_OrderLine_ID() != 0) {
        if (!isReturnTrx) {
            if (costDetail.getQty().signum() != 0)
                dimension.setCurrentCostPrice(price);
            else {
                BigDecimal currentCost = dimension.getCurrentCostPrice().add(costDetail.getAmt());
                dimension.setCurrentCostPrice(currentCost);
            }
        }
        dimension.add(costDetail.getAmt(), costDetail.getQty());
        logger.finer("PO - LastPO - " + dimension);
    } else if (// AR Shipment Detail Record
    costDetail.getM_InOutLine_ID() != 0 || costDetail.getM_MovementLine_ID() != 0 || costDetail.getM_InventoryLine_ID() != 0 || costDetail.getM_ProductionLine_ID() != 0 || costDetail.getC_ProjectIssue_ID() != 0 || costDetail.getPP_Cost_Collector_ID() != 0) {
        dimension.setCurrentQty(dimension.getCurrentQty().add(costDetail.getQty()));
        logger.finer("QtyAdjust - LastPO - " + dimension);
        dimension.saveEx();
    }
    return costDetail;
}
Also used : CLogger(org.compiere.util.CLogger) BigDecimal(java.math.BigDecimal)

Aggregations

CLogger (org.compiere.util.CLogger)6 BigDecimal (java.math.BigDecimal)2