use of org.compiere.model.MPriceList in project lar_361 by comitsrl.
the class SubOrder method getM_PriceList_Version_ID.
// getC_BPartner_Location_ID
/**
* Get M_PriceList_Version_ID. Set Currency
* @return plv
*/
public int getM_PriceList_Version_ID() {
if (m_M_PriceList_Version_ID == 0) {
int M_PriceList_ID = p_pos.getM_PriceList_ID();
if (m_bpartner != null && m_bpartner.getM_PriceList_ID() != 0)
M_PriceList_ID = m_bpartner.getM_PriceList_ID();
//
MPriceList pl = MPriceList.get(p_ctx, M_PriceList_ID, null);
setCurrency(MCurrency.getISO_Code(p_ctx, pl.getC_Currency_ID()));
//
MPriceListVersion plv = pl.getPriceListVersion(p_posPanel.getToday());
if (plv != null && plv.getM_PriceList_Version_ID() != 0) {
m_M_PriceList_Version_ID = plv.getM_PriceList_Version_ID();
}
}
return m_M_PriceList_Version_ID;
}
use of org.compiere.model.MPriceList in project adempiere by adempiere.
the class InventoryUtil method getCreatePriceList.
public static MPriceList getCreatePriceList(String value, boolean IsSOPriceList) {
Properties ctx = Env.getCtx();
int C_Currency_ID = Env.getContextAsInt(ctx, "$C_Currency_ID");
String whereClause = MPriceList.COLUMNNAME_Name + "=?" + " AND " + MPriceList.COLUMNNAME_IsSOPriceList + "=?" + " AND " + MPriceList.COLUMNNAME_C_Currency_ID + "=?";
MPriceList pl = new Query(ctx, MPriceList.Table_Name, whereClause, null).setParameters(new Object[] { value, IsSOPriceList, C_Currency_ID }).setClient_ID().setOnlyActiveRecords(true).firstOnly();
if (pl == null) {
pl = new MPriceList(ctx, 0, null);
pl.setName(value);
pl.setIsSOPriceList(IsSOPriceList);
pl.setC_Currency_ID(C_Currency_ID);
}
setGeneratedTag(pl);
pl.setIsTaxIncluded(false);
pl.saveEx();
//
Timestamp ValidFrom = TimeUtil.getDay(1970, 1, 1);
MPriceListVersion plv = pl.getPriceListVersion(ValidFrom);
if (plv == null) {
plv = new MPriceListVersion(pl);
plv.setValidFrom(ValidFrom);
plv.setM_DiscountSchema_ID(getM_DiscountSchema_ID());
setGeneratedTag(plv);
plv.saveEx();
}
//
return pl;
}
use of org.compiere.model.MPriceList in project adempiere by adempiere.
the class InventoryUtil method getCreatePriceList.
public static MPriceList getCreatePriceList(String value, boolean IsSOPriceList) {
Properties ctx = Env.getCtx();
int C_Currency_ID = Env.getContextAsInt(ctx, "$C_Currency_ID");
String whereClause = MPriceList.COLUMNNAME_Name + "=?" + " AND " + MPriceList.COLUMNNAME_IsSOPriceList + "=?" + " AND " + MPriceList.COLUMNNAME_C_Currency_ID + "=?";
MPriceList pl = new Query(ctx, MPriceList.Table_Name, whereClause, null).setParameters(new Object[] { value, IsSOPriceList, C_Currency_ID }).setClient_ID().setOnlyActiveRecords(true).firstOnly();
if (pl == null) {
pl = new MPriceList(ctx, 0, null);
pl.setName(value);
pl.setIsSOPriceList(IsSOPriceList);
pl.setC_Currency_ID(C_Currency_ID);
}
setGeneratedTag(pl);
pl.setIsTaxIncluded(false);
pl.saveEx();
//
Timestamp ValidFrom = TimeUtil.getDay(1970, 1, 1);
MPriceListVersion plv = pl.getPriceListVersion(ValidFrom);
if (plv == null) {
plv = new MPriceListVersion(pl);
plv.setValidFrom(ValidFrom);
plv.setM_DiscountSchema_ID(getM_DiscountSchema_ID());
setGeneratedTag(plv);
plv.saveEx();
}
//
return pl;
}
use of org.compiere.model.MPriceList in project adempiere by adempiere.
the class CPOS method loadPriceListVersion.
// getM_PriceList_ID
/**
* Load Price List Version from Price List
* @param priceListId
* @return
* @return MPriceListVersion
*/
protected MPriceListVersion loadPriceListVersion(int priceListId) {
priceListVersionId = 0;
this.priceListId = priceListId;
MPriceList priceList = MPriceList.get(ctx, priceListId, null);
//
MPriceListVersion priceListVersion = priceList.getPriceListVersion(getToday());
if (priceListVersion != null && priceListVersion.getM_PriceList_Version_ID() != 0) {
priceListVersionId = priceListVersion.getM_PriceList_Version_ID();
}
// Default Return
return priceListVersion;
}
use of org.compiere.model.MPriceList in project adempiere by adempiere.
the class DistributionRunOrders method groovy.
public String groovy(String A_TrxName, Properties A_Ctx, int P_M_Warehouse_ID, int P_M_PriceList_Version_ID, int P_M_DistributionList_ID) {
MPriceListVersion plv = new MPriceListVersion(A_Ctx, P_M_PriceList_Version_ID, A_TrxName);
MPriceList pl = new MPriceList(A_Ctx, plv.getM_PriceList_ID(), A_TrxName);
MWarehouse w = new MWarehouse(A_Ctx, P_M_Warehouse_ID, A_TrxName);
MDistributionRun dr = new MDistributionRun(A_Ctx, 0, A_TrxName);
dr.setName(plv.getName());
dr.setIsActive(true);
dr.setAD_Org_ID(w.getAD_Org_ID());
dr.saveEx();
MProductPrice[] products = plv.getProductPrice(true);
int seq = 10;
for (MProductPrice pp : products) {
int M_Product_ID = pp.getM_Product_ID();
BigDecimal QtyAvailable = MStorage.getQtyAvailable(P_M_Warehouse_ID, M_Product_ID, 0, 0, A_TrxName);
BigDecimal QtyOnHand = MPPMRP.getQtyOnHand(A_Ctx, P_M_Warehouse_ID, M_Product_ID, A_TrxName);
MDistributionRunLine drl = new MDistributionRunLine(A_Ctx, 0, A_TrxName);
drl.setM_DistributionRun_ID(dr.get_ID());
drl.setLine(seq);
drl.setM_Product_ID(M_Product_ID);
drl.setM_DistributionList_ID(P_M_DistributionList_ID);
drl.setDescription(Msg.translate(A_Ctx, "QtyAvailable") + " = " + QtyAvailable + " | " + Msg.translate(A_Ctx, "QtyOnHand") + " = " + QtyOnHand);
drl.setTotalQty(QtyAvailable);
drl.saveEx();
}
return "";
}
Aggregations