From AutoCount Resource Center
Create New or Update Item Package
public void NewOrUpdateItemPackage(string packageCode, UserSession userSession)
{
//string packageCode = "PackA";
string desc = "Packing A";
AutoCount.Stock.ItemPackage.ItemPackageCommand cmd =
AutoCount.Stock.ItemPackage.ItemPackageCommand.Create(userSession, userSession.DBSetting);
AutoCount.Stock.ItemPackage.ItemPackage pack = cmd.Edit(packageCode);
AutoCount.Stock.ItemPackage.ItemPackageDetail packDtl = null;
if (pack == null)
{
pack = cmd.AddNew();
pack.PackageCode = packageCode;
}
else
{
pack.ClearDetails();
}
pack.Description = desc;
pack.IsActive = true;
packDtl = pack.AddDetail();
packDtl.ItemCode = "Item1";
packDtl.Description = "Item 1";
packDtl.UOM = "UNIT";
packDtl.Qty = 1;
packDtl.TaxType = "S-10";
packDtl.PurchaseTaxType = null;
packDtl.UnitPrice = 15M;
packDtl.PurchasePrice = 10M;
packDtl = pack.AddDetail();
packDtl.ItemCode = "Item2";
packDtl.Description = "Item 2";
packDtl.UOM = "UNIT";
packDtl.Qty = 1;
packDtl.TaxType = "S-5";
packDtl.PurchaseTaxType = null;
packDtl.UnitPrice = 12M;
packDtl.PurchasePrice = 5M;
//Save the Item Package
pack.Save();
}
Delete
public void DeleteItemPackage(string packageCode, UserSession userSession)
{
AutoCount.Stock.ItemPackage.ItemPackageCommand cmd =
AutoCount.Stock.ItemPackage.ItemPackageCommand.Create(userSession, userSession.DBSetting);
AutoCount.Stock.ItemPackage.ItemPackage pack = cmd.Edit(packageCode);
if (pack != null)
{
long[] packingKeys = new long[] { pack.DocKey };
cmd.Delete(packingKeys);
}
}
Invoice with Item Package
See Also