Programmer:Item Package v2: Difference between revisions
Content added Content deleted
(Created page with " ==Create New or Update Item Package== <syntaxhighlight lang="csharp"> </syntaxhighlight> {{SeeAlsoStockV2}} {{NavigateDeveloper}}") |
No edit summary |
||
Line 1: | Line 1: | ||
==Create New or Update Item Package== |
==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(); |
|||
} |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
==Delete== |
|||
<syntaxhighlight lang="csharp"> |
|||
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); |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
==Invoice with Item Package== |
|||
<syntaxhighlight lang="csharp"> |
|||
</syntaxhighlight> |
|||
{{SeeAlsoStockV2}} |
{{SeeAlsoStockV2}} |
Revision as of 08:31, 18 August 2022
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
- Item Group v2
- Stock Item (Item Maintenance) v2
- Item Package v2
- Stock Adjustment v2
- Stock Transfer v2
- Stock Assembly v2
- Get Stock Cost and Stock Balance with Costing - [1.8, 1.9] [2.0]
- Item Opening Balance Maintenance - [1.8, 1.9] [2.0]
Go to top
|
Resources For AutoCount Software Developers
|