I have installed the device hub. I am a bit of rookie when it comes to customisations hence asking here.
What I am trying to achieve is when I quick process from Sales order screen I want to print Cash Slip for order type CSL to DOCKET printer and normal SO invoice for when order type is SO to BROTHER printer. This works fine, however we trying to automate it to send it to the respective printer when quick process is over.
I followed this link below to start the process which is quite helpful.
I added my code on the top of my code as below to address IF else to see if this solves my problem. however I am receiving the error below. I am not sure how i progress from here. Any suggestion would be appreciated.
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
#region Event Handlers
public delegate void QuickProcessDelegate(SOOrder order);
[PXOverride]
public void QuickProcess(SOOrder order, QuickProcessDelegate baseMethod)
{
baseMethod(order); // Run standard Quick Process logic
if (order == null) return;
string orderType = order.OrderType;
string refNbr = order.OrderNbr;
var reportParams = new Dictionary<string, string>
{
{ "OrderType", orderType },
{ "RefNbr", refNbr }
};
string selectedPrinterID = orderType == "CSL" ? "Docket" : "Brother";
var printSettings = new PrintSettings
{
PrintWithDeviceHub = true,
DefinePrinterManually = true,
PrinterID = selectedPrinterID
};
SMPrintJobMaint g = PXGraph.CreateInstance<SMPrintJobMaint>();
// Fix: Pass a proper Guid? (null as nullable Guid)
g.AddPrintJob("SO643000", printSettings, (Guid?)null, reportParams, CancellationToken.None);
}
#endregion
}
}
