Programmer:Item Package v2: Difference between revisions

From AutoCount Resource Center
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==
<syntaxhighlight lang="csharp">
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)
<syntaxhighlight lang="csharp">
{
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

Go to menu

Go to top
Resources For AutoCount Software Developers