use of org.compiere.model.MProductPrice in project adempiere by adempiere.
the class MPriceListVersionTest method testQuery.
public void testQuery() throws Exception {
MPriceListVersion plv = new MPriceListVersion(getCtx(), 101, getTrxName());
//red1 tested also with (true) and (false)
MProductPrice[] pp = plv.getProductPrice("AND isActive='Y'");
assertTrue("product must have prices", pp.length > 0);
}
use of org.compiere.model.MProductPrice 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