use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class GenerateReplenishPlanReport method getPrintFormat.
/**
* @return
*/
private MPrintFormat getPrintFormat() {
MPrintFormat pf = null;
if (Ini.isClient()) {
pf = (MPrintFormat) getProcessInfo().getTransientObject();
} else {
pf = (MPrintFormat) getProcessInfo().getSerializableObject();
}
if (pf == null) {
pf = MPrintFormat.get(getCtx(), 0, MTable.getTable_ID("M_ReplenishPlanLine"));
}
int count = pf.getItemCount();
int weeksToDisplay = END_WEEK - START_WEEK + 1;
int startIndx = START_WEEK;
int endIndx = END_WEEK;
for (int i = 0; i < count; i++) {
MPrintFormatItem pfi = pf.getItem(i);
String columnName = pfi.getColumnName().toLowerCase();
if (columnName != null && columnName.startsWith("week")) {
int index = Integer.parseInt(columnName.substring(4));
if (index > weeksToDisplay) {
if (pfi.isPrinted())
pfi.setIsPrinted(false);
} else {
int displayWeek = startIndx + (index - 1);
String printName = weekDateInfo.get(displayWeek);
pfi.setPrintName(printName);
pfi.setIsPrinted(true);
pfi.setIsSuppressNull(false);
pfi.setIsSuppressRepeats(false);
pfi.setMaxWidth(35);
pfi.setIsFixedWidth(true);
pfi.setIsHeightOneLine(false);
// pfi.set_ValueOfColumn("DisplayLogic", "@" + columnName +
// "@!0");
pfi.setLineAlignmentType(X_AD_PrintFormatItem.LINEALIGNMENTTYPE_TrailingRight);
pfi.setFieldAlignmentType(X_AD_PrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight);
// Dynamic sequencing is required as we are showing & hiding
// elements based on week difference.
pfi.setSeqNo(50 + index * 10);
if (displayWeek > (startIndx + 1) && displayWeek < (endIndx - 1)) {
pfi.setAD_PrintColor_ID(RED_AD_PrintColor_ID);
} else {
pfi.setAD_PrintColor_ID(-1);
}
}
}
pfi.saveEx();
log.fine(pfi.toString());
}
pf.setTranslation();
// no
pf = MPrintFormat.get(getCtx(), pf.getAD_PrintFormat_ID(), true);
// cache
return pf;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method createNewFormat.
// getPrintFormats
/**
* Create and Launch new Format for table
* @param AD_Table_ID table
*/
private File createNewFormat(int AD_Table_ID, HttpServletRequest request, GridTab m_curTab, MQuery m_query) {
WebSessionCtx wsc = WebSessionCtx.get(request);
MPrintFormat pf = MPrintFormat.createFromTable(wsc.ctx, AD_Table_ID);
File file = launchReport(pf, request, m_curTab, m_query);
return file;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method launchReport.
// copyFormatFromClient
/**
* Launch Report
* @param pp Key=AD_PrintFormat_ID
*/
private File launchReport(KeyNamePair pp, HttpServletRequest request, GridTab m_curTab, MQuery m_query) {
WebSessionCtx wsc = WebSessionCtx.get(request);
MPrintFormat pf = MPrintFormat.get(wsc.ctx, pp.getKey(), false);
File file = launchReport(pf, request, m_curTab, m_query);
return file;
}
use of org.compiere.print.MPrintFormat in project adempiere by adempiere.
the class WReport method createNewFormat.
/**
* Create and Launch new Format for table
* @param AD_Table_ID table
*/
private void createNewFormat(int AD_Table_ID) {
MPrintFormat pf = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
launchReport(pf);
}
Aggregations