Skip to content

Commit

Permalink
Inventory Item Label to print one label per unit of each item received
Browse files Browse the repository at this point in the history
  • Loading branch information
DhirenChhapgar committed Dec 19, 2017
1 parent e3dac21 commit 21d33a1
Show file tree
Hide file tree
Showing 9 changed files with 1,202 additions and 1 deletion.
28 changes: 28 additions & 0 deletions CustomizationSource/_project/Code_PopulateUsrNumbers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Graph ClassName="PopulateUsrNumbers" Source="#CDATA" IsNew="True" FileType="NewFile">
<CDATA name="Source"><![CDATA[using System;
using PX.Data;
using Customization;
namespace PXInventoryLabelReportExtPkg
{
//Customization plugin is used to execute custom actions after customization project was published
public class PopulateUsrNumbers : CustomizationPlugin
{
//This method executed after customization was published and website was restarted.
public override void UpdateDatabase()
{
//Where 1000 could be max possible value for unit per item - adjust as per your need
int iNumberOfLabels = 1000;
UsrNumbers usrNumberMax = PXSelectGroupBy<UsrNumbers, Aggregate<Max<UsrNumbers.number>>>.Select(new PXGraph());
if (usrNumberMax != null)
{
for (int i = (usrNumberMax.Number.GetValueOrDefault(0) + 1); i <= iNumberOfLabels; i++)
{
PXDatabase.Insert<UsrNumbers>(new PXDataFieldAssign<UsrNumbers.number>(i));
}
}
}
}
}]]></CDATA>
</Graph>
18 changes: 18 additions & 0 deletions CustomizationSource/_project/Code_UsrNumbers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Graph ClassName="UsrNumbers" Source="#CDATA" IsNew="True" FileType="NewFile">
<CDATA name="Source"><![CDATA[using System;
using PX.Data;
namespace PXInventoryLabelReportExtPkg
{
[Serializable]
public class UsrNumbers : IBqlTable
{
#region Number
[PXDBInt(IsKey = true)]
[PXUIField(DisplayName = "Number")]
public virtual int? Number { get; set; }
public abstract class number : IBqlField { }
#endregion
}
}]]></CDATA>
</Graph>
2 changes: 2 additions & 0 deletions CustomizationSource/_project/ProjectMetadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="PXInventoryLabelReportExtPkg" level="0" description="" />
Loading

0 comments on commit 21d33a1

Please sign in to comment.