Jump to content

.NET API - Sales Order and Purchase Order addresses not being filled out when Customer/Vendor are set


 Share

Recommended Posts

I feel like there's something I'm missing.

I can successfully create a Sales Order and a Purchase Order with line items in Sage50 using the .NET API (not ODBC). The issue I'm having is that while the correct vendor/customer are set, the address for that entity is not being set and is left blank. I can't seem to find anything in the API that will allow them to be filled out. Even setting the addresses manually still results in the items being blank.

Is there something I'm not doing correctly?

                Vendor v = Peachtree_Functions.GetVendorByName("VENDOR NAME HERE");

                PurchaseOrder po = Peachtree_Functions.Company.Factories.PurchaseOrderFactory.Create();
                po.VendorReference = v.Key;
                po.CustomerReference = null;
                po.Date = DateTime.Now;
                po.ReferenceNumber = Peachtree_Functions.GetNewPONumber();
                po.ShipToAddress.Address = v.MailToContact.Address;
                po.MainAddress.Address = v.MailToContact.Address;

                PurchaseOrderLine pol = po.AddLine();
                pol.Quantity = 5;
                pol.UnitPrice = 2.55M;
                pol.Amount = pol.Quantity * pol.UnitPrice;
                pol.Description = "Test Line Item for Purchase Orders";
                pol.InventoryItemReference = null;

                po.Save();

I've also attached a picture of the resultant Purchase Order screen. If I was to manually select the vendor the correct addresses would be filled out.

Capture.PNG

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...