public static MMovementCartBean addToMovementCart(Properties ctx,StockMovementBean bean,MMovementCartBean cartBean,boolean isSales,boolean ifAdd) throws OperationException, ProductNotFoundException, ProductNotOnPriceListException {
  ArrayList<ItemBean> oldItems;
  if (cartBean == null) {
    cartBean=new MMovementCartBean();
    oldItems=new ArrayList<ItemBean>();
  }
 else {
    oldItems=cartBean.getItems();
  }
  ArrayList<ItemBean> oldItemsClone=(ArrayList)oldItems.clone();
  ArrayList itemsToBeAdded=getMMovementItems(ctx,bean);
  oldItems=addToMMovementList(ctx,oldItemsClone,itemsToBeAdded,ifAdd);
  Integer priceListId=POSTerminalManager.getPriceListId(ctx,isSales);
  oldItems=setMMovementItemCosts(ctx,priceListId,oldItems,isSales);
  cartBean.setItems(oldItems);
  cartBean.setPricelistId(priceListId);
  return cartBean;
}

public static MMovementCartBean addToMovementCart ( Properties ctx , StockMovementBean bean , MMovementCartBean cartBean , boolean isSales , boolean ifAdd ) throws OperationException , ProductNotFoundException , ProductNotOnPriceListException { ArrayList < ItemBean > oldItems ; if ( cartBean == null ) { cartBean = new MMovementCartBean ( ) ; oldItems = new ArrayList < ItemBean > ( ) ; } else { oldItems = cartBean . getItems ( ) ; } ArrayList < ItemBean > oldItemsClone = ( ArrayList ) oldItems . clone ( ) ; ArrayList itemsToBeAdded = getMMovementItems ( ctx , bean ) ; oldItems = addToMMovementList ( ctx , oldItemsClone , itemsToBeAdded , ifAdd ) ; Integer priceListId = POSTerminalManager . getPriceListId ( ctx , isSales ) ; oldItems = setMMovementItemCosts ( ctx , priceListId , oldItems , isSales ) ; cartBean . setItems ( oldItems ) ; cartBean . setPricelistId ( priceListId ) ; return cartBean ; }
add to movement cart ( stock transfer cart )
