Programmer:Item Opening Maintenance v2: Difference between revisions

Content added Content deleted
(Created page with "==Technical Specification== #Quantity of the Item Opening must not be zero #*When adding a new entry to Item Opening, zero qty entry will be removed before saving to database...")
 
No edit summary
Line 133: Line 133:


===Adding two entries of same ItemCode to Item Opening===
===Adding two entries of same ItemCode to Item Opening===
This example shows the increase of '''Seq''' when 2nd entry of Item Opening has the same '''ItemCode''', '''UOM''', '''Location''' and '''BatchNo''' from the 1st entry.
Following example shows the increase of '''Seq''' when 2nd entry of Item Opening has the same '''ItemCode''', '''UOM''', '''Location''' and '''BatchNo''' from the 1st entry.
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
public void NewTwoEntriesOfSameItem(AutoCount.Authentication.UserSession userSession)
public void NewTwoEntriesOfSameItem(AutoCount.Authentication.UserSession userSession)
Line 185: Line 185:


==Delete Item Opening entry==
==Delete Item Opening entry==
There may be time when existing item opening entry has to be deleted before adding / update to Item Opening.
When existing item opening entry has to be deleted before adding / update to Item Opening.<br/>
This can avoid the error of '''"Sequence for Item 'FG00001', UOM 'UNIT', Location 'HQ', BatchNo '' is not correct."'''
Checking the existing record can avoid the error of '''"Sequence for Item 'FG00001', UOM 'UNIT', Location 'HQ', BatchNo '' is not correct."'''<br/>
Highlighted shows the function to get the list of keys and deletion of existing keys.
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp" highlight="22,23">
public void CheckNewEntryBeforeAdding(AutoCount.Authentication.UserSession userSession)
public void CheckNewEntryBeforeAdding(AutoCount.Authentication.UserSession userSession)
{
{
Line 242: Line 243:
</syntaxhighlight>
</syntaxhighlight>


Function to find a list of keys that is/are matching.
<syntaxhighlight lang="csharp">
public List<long> GetExistItemOpeningKey(DataTable table, string itemCode, string uom, string location, string batchNo)
{
return table.AsEnumerable().Where(r =>
r.RowState != DataRowState.Deleted &&
r.Field<string>("ItemCode") == itemCode &&
r.Field<string>("UOM") == uom &&
r.Field<string>("Location") == location &&
r.Field<string>("BatchNo") == batchNo
).Select(r => r.Field<long>("ItemOpeningKey"))
.ToList();
}
</syntaxhighlight>


{{SeeAlsoStockV2}}
{{SeeAlsoStockV2}}