QuickBooks Integrator 2020 Delphi Edition

Questions / Feedback?

GetGroupUpdateAggregate Method

Generates a group aggregate for use in another component's Update request.

function GetGroupUpdateAggregate(): String;

Remarks

There is not exposed a way to directly edit the contents of a line item group when submitting an Update request with a component from this package. You can change the Quantity, but you cannot change the line items contained inside the group line. The LineItemGroups component is used to parse a line item group aggregate. You may then make changes to the individual line items, and then call the GetGroupUpdateAggregate to return an xml aggregate containing your changes. This is then set to the Aggregate property of the line you wish to modify in your Update.

For instance, the following code changes the BillableStatus of all line items and line item groups in the Bill retrieved from QuickBooks.


Bill.Get("123456");
for (int i = 0; i < Bill1.LineItems.Count; i++) {
  if (!Bill.LineItems[i].GroupName.Equals("")) {	  // this is a group line
	  LineItemGroups.GroupType = gtBill;
	  LineItemGroups.ParseAggregate(Bill.LineItems[0].Aggregate);
		for (int j = 0; j < LineItemGroups.LineItems.Count) {
			LineItemGroups.LineItems[j].BillableStatus = bsHasBeenBilled;
		}
		LineItemGroups.QBXMLVersion = Bill.QBXMLVersion; // so that the proper fields are included in the update aggregate.		
		Bill1.LineItems[i].Aggregate = LineItemGroups.GetGroupUpdateAggregate();
	} else { // regular line item
	  Bill.LineItems[i].BillableStatus = bsHasBeenBilled;
  }
}
Bill.Update();

Copyright (c) 2021 /n software inc. - All rights reserved.
QuickBooks Integrator 2020 Delphi Edition - Version 20.0 [Build 7941]