protected virtual void SyncWithDocumentCartLine(ScanHeader header, ScanLine line, INCartSplit cartSplit, decimal?qty) { bool emptyLine = line.Qty.GetValueOrDefault() == 0; INRegisterCartLine docCartLine = RegisterCartLines.Search <INRegisterCartLine.lineNbr>(line.LineNbr); if (docCartLine == null) { if (qty <= 0) { throw new PXArgumentException(nameof(qty)); } docCartLine = RegisterCartLines.Insert(); RegisterCartLines.Cache.SetValue <INRegisterCartLine.cartSplitLineNbr>(docCartLine, cartSplit.SplitLineNbr); } docCartLine = (INRegisterCartLine)RegisterCartLines.Cache.CreateCopy(docCartLine); docCartLine.Qty += qty; RegisterCartLines.Cache.Update(docCartLine); if (docCartLine.Qty == 0) { RegisterCartLines.Delete(docCartLine); } }