How to get Purchase New / ReRent / Purchase Consumable Document Details

I have created Purchase New, ReRent and Purchase Consumable documents by using Movement.NewMovement API object and the document gets created without any issue but I am unable to fetch same created document. I tried below mentioned code but I don’t get that document through that moreover it doesn’t return product details only get header information.

Please provide me the correct API to fetch all movements.

MovementList ExistingTrans = MovementList.GetMovementList(oTradingPartner.TradingPartnerID, MovementType.ReRent, true, JobSiteID);


** foreach (MovementListItem item in ExistingTrans)**
** {**
** }**

Hi.

Please find the code below that may be used to create and then fetch Transactions.

    BusinessPartner partner = BusinessPartner.GetBusinessPartnerByName("Vendor");
    TradingPartner destination = TradingPartner.GetTradingPartner("Branch");
    StockingLocation location = StockingLocation.GetStockingLocation(destination.StockingLocationID, false);

    Movement trans = Movement.NewMovement(MovementType.ReRent, false);
    trans.BusinessPartnerType = PartnerTypes.Vendor;
    trans.DestinationID = location.StockingLocationID;
    trans.BusinessPartnerID = partner.BusinessPartnerID;
    trans.Notes = "Additional Notes Here";
    trans.DestinationType =  PartnerTypes.BranchOffice;
    trans.PlannedReturnDate = DateTime.Now.AddDays(10).ToShortDateString();
    trans.MovementProducts["CS027"].Quantity = 10;
    trans.MovementProducts["PN-001"].Quantity = 10;
    trans.Save();
    string movementNumber = trans.MovementNumber;

    var movements = MovementList.GetMovementList(destination.TradingPartnerID, MovementType.All, false, Guid.Empty);
    var movement = movements.FirstOrDefault(mov => mov.Number == movementNumber);

    Console.WriteLine(movement.Notes);
    Console.ReadLine();

Thanks for posting.

Hi,

I think I had mentioned I was able to create movement transaction also able to get created movement document header information like movement number & notes etc. however I am not able fetch product to be used in that transaction.

So please let me know how I can fetch movement product details used in that transaction.

Hi [dsalhotra]

however I am not able fetch product to be used in that transaction.

In the above example “CS027”, “PN-001” are products added to a new Transaction.

If you’d to fetch an already saved Transaction you may use the following code at the end of the above example -
var movementProducts = MovementProductList.GetMovementProductList(movement.MovementID);

Thanks for posting.