Skip to main content
Solved

Automate printing to multiple printers for certain reports

  • September 15, 2023
  • 5 replies
  • 175 views

We are moving from an older ERP to Acumatica. One of the things we had in our old system that when we printed a Work Order the printout would print to our Dot Matrix DFX-9000 and also print the WO confirmation onto our Canon iR-ADV. This is also the case with our remote locations as they would print a WO that would print to the dot matrix and also the local Canon. It would also in certain instances trigger a third print that would print the confirmation at head office as well. 

We have device hub setup with all the printers and everything works as long as it’s going to one printer. How would we trigger when certain reports are printed it also prints copies to different printers at the same time. For example Florida location prints a Work order to the dot matrix, once that happens it knows to trigger another report to print the confirmation to the Florida Canon and also the Canon in NY.

This is the same for invoices, needs to print locally and at head office accounting as well. 

Best answer by darylbowman

This may save you several days of messing around 😉

Understand, this is by no means a working code block.

public PXAction<SOShipment> printLabelsToStation;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Print Labels To Station")]
public virtual IEnumerable PrintLabelsToStation(PXAdapter adapter)
{
	var shipmentGraph = adapter.View.Graph as SOShipmentEntry;
	SOShipment shipment = shipmentGraph.Document.Current;
	if (shipment is null) return adapter.Get();

	Guid? printerID = // get printerID
	if (printerID is null)
		throw new PXException("No packing station printer has been selected");

	PXLongOperation.StartOperation(shipmentGraph, delegate ()
	{
		SMPrintJobMaint printGraph = PXGraph.CreateInstance<SMPrintJobMaint>();

        var reportParams = new Dictionary<string, string>();

        var printSettings = new PrintSettings
        {
            PrintWithDeviceHub = true,
            DefinePrinterManually = true
            PrinterID = printerID,
            NumberOfCopies = 1
        };

        printGraph.AddPrintJob($"Label for x", printSettings, (string)null, reportParams, null);
	});

	return adapter.Get();
}

 

View original
Did this topic help you find an answer to your question?

5 replies

darylbowman
Captain II
Forum|alt.badge.img+13

I don’t think this is an out-of-the-box feature, although I’m not positive. I can confirm that this is absolutely possible with a customization.

Since you are already using DeviceHub, this would be a matter of overriding a few actions and building in the logic of where to print when.


  • Author
  • Freshman I
  • 2 replies
  • September 15, 2023

I agree it’s definitely achievable with customization. I already know it’s not an out-of-the-box feature. I’ve been messing around in our sandbox environment but I’m not a developer so it will take longer to figure out but I’ll get there.  


darylbowman
Captain II
Forum|alt.badge.img+13
  • 1738 replies
  • Answer
  • September 15, 2023

This may save you several days of messing around 😉

Understand, this is by no means a working code block.

public PXAction<SOShipment> printLabelsToStation;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Print Labels To Station")]
public virtual IEnumerable PrintLabelsToStation(PXAdapter adapter)
{
	var shipmentGraph = adapter.View.Graph as SOShipmentEntry;
	SOShipment shipment = shipmentGraph.Document.Current;
	if (shipment is null) return adapter.Get();

	Guid? printerID = // get printerID
	if (printerID is null)
		throw new PXException("No packing station printer has been selected");

	PXLongOperation.StartOperation(shipmentGraph, delegate ()
	{
		SMPrintJobMaint printGraph = PXGraph.CreateInstance<SMPrintJobMaint>();

        var reportParams = new Dictionary<string, string>();

        var printSettings = new PrintSettings
        {
            PrintWithDeviceHub = true,
            DefinePrinterManually = true
            PrinterID = printerID,
            NumberOfCopies = 1
        };

        printGraph.AddPrintJob($"Label for x", printSettings, (string)null, reportParams, null);
	});

	return adapter.Get();
}

 


  • Author
  • Freshman I
  • 2 replies
  • September 15, 2023

Thank you


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 38 replies
  • November 3, 2023

Hi @rrodic ,

                    If iam not wrong you are printing multiple reports with Acumtica Device Hub on a Single Click.  If this is the case then YES,  This is possible with customization, I have done this type of Customization Previously

 

We can print the reports using “SMPrintJobMaint.CreatePrintJobGroup()” Method. First Create an action button and pass the inputs to the above method, Then its done 

Let me know if you are facing any issues

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings