Process sales order. Stop the Print Type dialog appearing  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Process sales order. Stop the Print Type dialog appearing

Postby DannyC » Tue Oct 04, 2022 1:31 pm

Hi,

When I process a sales order via the sales order screen I want to stop the print selection from appearing & just process the sales order.
Process print.png
Process print.png (5.99 KiB) Viewed 2011 times


In my scenario based on a debtor custom checkbox, if the debtor is ticked then when a sales order is processed just print and email without displaying the dialog above.
What's the trick to stopping it displaying?
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Process sales order. Stop the Print Type dialog appeari  Topic is solved

Postby Scott.Pearce » Tue Oct 04, 2022 2:25 pm

Handle the SalesOrderForm.UltraToolbarsManager1.ToolClick event (Add your handler in SetupBeforeHandlers so your handler is executed first).

In *your* SalesOrderForm.UltraToolbarsManager1.ToolClick handler, create a reports collection and add to it the reports you want to print, i.e.:

Code: Select all
'if this is a special debtor as per your debtor custom field

    Dim candidateReportsToPrint As JiwaApplication.JiwaCollection(Of JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport) = salesOrderForm.SalesOrder.GetCandidateReportsToPrint()

    Dim reportsToPrint As JiwaApplication.JiwaCollection(Of JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport) = Manager.CollectionFactory.CreateCollection(Of JiwaApplication.JiwaCollection(Of JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport), JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport)

    For Each salesOrderReport As JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport In candidateReportsToPrint
        'Put an if statement here to determine if it's a report you want to print
        reportsToPrint.Add(salesOrderReport)
    Next

    salesOrderForm.SalesOrder.Process(reportsToPrint)

    'Re-read after processing
    salesOrderForm.ProposedDrillDownID = salesOrderForm.SalesOrder.InvoiceID
    salesOrderFormReadRecord(ProposedDrillDownID)   

    'This stops the Jiwa handler from executing (you have already done the work).
    Throw New JiwaApplication.Exceptions.ClientCancelledException
'Else
    'Don't do anything and the dialog will display as per normal
'End If

Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Process sales order. Stop the Print Type dialog appeari

Postby DannyC » Tue Oct 04, 2022 3:11 pm

Thanks Scott.

That did the trick! Muchos gracias
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Process sales order. Stop the Print Type dialog appeari

Postby Scott.Pearce » Tue Oct 04, 2022 3:12 pm

No problem.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Process sales order. Stop the Print Type dialog appeari

Postby DannyC » Thu May 04, 2023 5:26 pm

Client has come back to me with a little issue.

When the period is locked, they get the dialog that the period is locked. All good there.
But the sales order sits there with the save & cancel active & it would seem the user defaults to saving the order.
This sets the sales order as processed, but really it hasn't.

When the user clicks OK on the Period Lock dialog, I want to automatically cancel.

I've tried just doing a read but that doesn't work.
Code: Select all
salesOrder.Read(salesOrder.InvoiceID);


Tried doing this also but that didn't help either.
Code: Select all
throw new JiwaFinancials.Jiwa.JiwaApplication.Exceptions.ClientCancelledException();


How can I get the sales order to automatically cancel when the period lock dialog is displayed?
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Process sales order. Stop the Print Type dialog appeari

Postby SBarnes » Thu May 04, 2023 5:39 pm

I would suspect that the sales order is throwing an exception and has bailed out leaving the order in the state it is then the user interface has shown the exception in a message box, the easiest way I can think of getting around the problem is attaching to one of the processing events like when processing starts and check the period yourself if its locked then show the user a message box and then simply reread the order and finally throw a client cancel exception to stop any further events.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 16 guests