Programmer:Item Opening Maintenance v2: Difference between revisions

no edit summary
(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:
 
===Adding two entries of same ItemCode to Item Opening===
ThisFollowing 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">
public void NewTwoEntriesOfSameItem(AutoCount.Authentication.UserSession userSession)
Line 185:
 
==Delete Item Opening entry==
There may be time whenWhen existing item opening entry has to be deleted before adding / update to Item Opening.<br/>
ThisChecking 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)
{
Line 242 ⟶ 243:
</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}}