Search in sources :

Example 1 with I_M_PriceList

use of org.compiere.model.I_M_PriceList in project metasfresh-webui-api by metasfresh.

the class ProductsProposalRowsLoader method retrieveCurrencyCode.

private CurrencyCode retrieveCurrencyCode(final PriceListVersionId priceListVersionId) {
    final I_M_PriceList priceList = priceListsRepo.getPriceListByPriceListVersionId(priceListVersionId);
    final CurrencyId currencyId = CurrencyId.ofRepoId(priceList.getC_Currency_ID());
    return currenciesRepo.getCurrencyCodeById(currencyId);
}
Also used : I_M_PriceList(org.compiere.model.I_M_PriceList) CurrencyId(de.metas.money.CurrencyId)

Example 2 with I_M_PriceList

use of org.compiere.model.I_M_PriceList in project metasfresh-webui-api by metasfresh.

the class OrderProductProposalsService method getOrderById.

public Order getOrderById(@NonNull final OrderId orderId) {
    final I_C_Order orderRecord = ordersRepo.getById(orderId);
    final ZonedDateTime datePromised = TimeUtil.asZonedDateTime(orderRecord.getDatePromised());
    final PriceListId priceListId = PriceListId.ofRepoId(orderRecord.getM_PriceList_ID());
    final I_M_PriceList priceList = priceListsRepo.getById(priceListId);
    final PriceListVersionId priceListVersionId = priceListsRepo.retrievePriceListVersionId(priceListId, datePromised);
    final BPartnerId bpartnerId = BPartnerId.ofRepoId(orderRecord.getC_BPartner_ID());
    final String bpartnerName = bpartnersService.getBPartnerName(bpartnerId);
    return Order.builder().orderId(orderId).soTrx(SOTrx.ofBoolean(orderRecord.isSOTrx())).datePromised(datePromised).bpartnerId(bpartnerId).bpartnerName(bpartnerName).pricingSystemId(priceListsRepo.getPricingSystemId(priceListId)).priceListId(priceListId).priceListVersionId(priceListVersionId).countryId(CountryId.ofRepoIdOrNull(priceList.getC_Country_ID())).currencyId(CurrencyId.ofRepoId(priceList.getC_Currency_ID())).lines(ordersRepo.retrieveOrderLines(orderId, I_C_OrderLine.class).stream().map(this::toOrderLine).collect(ImmutableList.toImmutableList())).build();
}
Also used : I_M_PriceList(org.compiere.model.I_M_PriceList) I_C_Order(org.compiere.model.I_C_Order) ZonedDateTime(java.time.ZonedDateTime) PriceListId(de.metas.pricing.PriceListId) BPartnerId(de.metas.bpartner.BPartnerId) I_C_OrderLine(de.metas.handlingunits.model.I_C_OrderLine) PriceListVersionId(de.metas.pricing.PriceListVersionId)

Aggregations

I_M_PriceList (org.compiere.model.I_M_PriceList)2 BPartnerId (de.metas.bpartner.BPartnerId)1 I_C_OrderLine (de.metas.handlingunits.model.I_C_OrderLine)1 CurrencyId (de.metas.money.CurrencyId)1 PriceListId (de.metas.pricing.PriceListId)1 PriceListVersionId (de.metas.pricing.PriceListVersionId)1 ZonedDateTime (java.time.ZonedDateTime)1 I_C_Order (org.compiere.model.I_C_Order)1