Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Stevens BrianMRO

View GitHub Profile
@BrianMRO
BrianMRO / UploadLabelControlFile.cs
Created November 18, 2020 20:54
UploadLabelControlFile
View UploadLabelControlFile.cs
protected virtual bool UploadLabelControlFile(StringBuilder labelSB, string language)
{
byte[] labelBytes = Encoding.ASCII.GetBytes(labelSB.ToString());
// Define a unique filename for the label control file
string filename = "label-" +
Guid.NewGuid().ToString() +
"." +
language.ToLower();
@BrianMRO
BrianMRO / DHPrint.cs
Created November 18, 2020 20:56
DHPrint
View DHPrint.cs
/// <summary>
/// DHPrint - DeviceHub Print - Sends an uploaded file to a printer via Device Hub
/// </summary>
/// <param name="mergedFile">The label control file (as PX.SM.FileInfo)</param>
/// <param name="printer">The SMPrinter for the Device Hub PrinterID</param>
public static void DHPrint(FileInfo mergedFile, SMPrinter printer)
{
Dictionary<string, string> parameters = new Dictionary<string, string> { {
"FILEID",
mergedFile.UID.ToString()
@BrianMRO
BrianMRO / BarCodeScan.txt
Created November 18, 2020 20:57
BarCodeScan
View BarCodeScan.txt
add field "LotSerialNbr"
{
special = BarCodeScan
}
@BrianMRO
BrianMRO / gist:86e23999660ecdae676cbf77f007c457
Created November 25, 2020 00:10
EPApproval Cache Attached
View gist:86e23999660ecdae676cbf77f007c457
#region EPApproval Cache Attached
[PXDBDate()]
[PXDefault(typeof(SSRQRequisition.requestDate), PersistingCheck = PXPersistingCheck.Nothing)]
protected virtual void EPApproval_DocDate_CacheAttached(PXCache sender)
{
}
[PXDBInt()]
[PXDefault(typeof(SSRQRequisition.customerID), PersistingCheck = PXPersistingCheck.Nothing)]
protected virtual void EPApproval_BAccountID_CacheAttached(PXCache sender)
@BrianMRO
BrianMRO / Refactor_OwnerID_Step1
Created February 4, 2021 18:55
Refactor OwnerID - Step 1
View Refactor_OwnerID_Step1
USE [MyDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF COL_LENGTH('dbo.XXMyTable', 'OldOwnerID') IS NULL
@BrianMRO
BrianMRO / Refactor_OwnerID_Step2
Created February 4, 2021 19:03
Refactor OwnerID - Step 2
View Refactor_OwnerID_Step2
USE [MyDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF COL_LENGTH('dbo.XXMyTable', 'OwnerID') IS NOT NULL AND COL_LENGTH('dbo.XXMyTable', 'OldOwnerID') IS NOT NULL
@BrianMRO
BrianMRO / Refactor_OwnerID_Step3
Last active February 4, 2021 19:32
Refactor OwnerID - Step 3
View Refactor_OwnerID_Step3
#region OwnerID
[Owner(DisplayName = "Owner")]
public virtual int? OwnerID { get; set; }
public abstract class ownerID : PX.Data.BQL.BqlInt.Field<ownerID> { }
#endregion
#region IAssign Members
int? PX.Data.EP.IAssign.OwnerID
{
get { return OwnerID; }
@BrianMRO
BrianMRO / dynamic_list
Last active February 9, 2021 20:54
Dynamic Lists
View dynamic_list
protected void _(Events.RowSelected<XXMyDAC> e)
{
XXMyDAC row = x.Row;
if(*condition*) // Substitute your conditional logic here
{
SelectableValues2 listattr = new SelectableValues2();
PXStringListAttribute.SetList<XXMyDAC.myField>
(e.Cache, row, listattr.AllowedValues, listattr.AllowedLabels);
}
@BrianMRO
BrianMRO / PXRestrictor
Created February 9, 2021 20:44
Restrictors for Selectors
View PXRestrictor
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRestrictor(typeof(
Where<INLocationExt.usrXXMyCondition, NotEqual<ConditionType.condition1>>
), "")]
protected virtual void INTran_ToLocationID_CacheAttached(PXCache sender) { }
@BrianMRO
BrianMRO / Acumatica_Mobile_SmartPanel_Example.txt
Created May 12, 2021 17:59
Acumatica Mobile 2021R1 Smart Panel Example
View Acumatica_Mobile_SmartPanel_Example.txt
add screen IN202500 {
add container "StockItemSummary" {
...
add recordAction "CreateTagAction" {
displayName = "Create Tag"
redirect = true
redirectToDialog = "IN202500D1"
}
}
add dialog IN202500D1 {