Process a sales order programatically  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Process a sales order programatically

Postby indikad » Thu Nov 12, 2015 11:15 am

I need to be able to process a sales order within given conditions( in the save end event )

I see that there is a method available
Code: Select all
oSalesOrder.SalesOrder.Process

the parameters asked for this method seems to be -
Code: Select all
ReportCollection as JiwaCollection (of SalesOrderReport)
 and
RunNo as String


However I am not sure what values to pass in and where to get these values from.

appreciate any help. ( a sample code with be very helpful )
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Process a sales order programatically  Topic is solved

Postby Scott.Pearce » Fri Nov 13, 2015 10:11 am

Well, if you do not wish to print anything, i.e. just process the sales order, you don't need to pass anything - it's an optional parameter.

Normally, the sales order form pops up a dialog asking about which (if any) reports to print. From this a report collection is built and passed to .Process(). Process() then processes the sales order and does the printing for you. Here's what our form does when you click the process button on the toolbar:

Code: Select all
            Try
                Dim candidateReportsToPrint As JiwaApplication.JiwaCollection(Of JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport) = SalesOrder.GetCandidateReportsToPrint()
                Dim processSalesOrderDialog As JiwaSalesUI.SalesOrder.ProcessSingleOrder = JiwaApplication.Manager.Instance.StartDialog(56, New Object() {candidateReportsToPrint}, Me, "Sales Order Entry")

                If processSalesOrderDialog.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
                    Dim reportsToPrint As New JiwaApplication.JiwaCollection(Of JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport)
                    If processSalesOrderDialog.PrintType <> ProcessSingleOrder.PrintTypes.PrintTypeNoReport Then
                        ' get selections and print
                        For Each salesOrderReport As JiwaApplication.PrintGroup.SalesOrderReports.SalesOrderReport In candidateReportsToPrint
                            If processSalesOrderDialog.PrintType = PrintReportSelection.PrintTypes.PrintTypeReportType Then
                                If salesOrderReport.DocumentType = processSalesOrderDialog.PrintTypeSelectedIndex Then
                                    reportsToPrint.Add(salesOrderReport)
                                End If
                            Else
                                If salesOrderReport.Equals(candidateReportsToPrint(processSalesOrderDialog.PrintTypeSelectedIndex + 1)) Then
                                    reportsToPrint.Add(salesOrderReport)
                                    Exit For
                                End If
                            End If
                        Next
                    End If
                    SalesOrder.Process(reportsToPrint)
                End If
            Finally
                ' no matter what, we re-read
                ProposedDrillDownID = _SalesOrder.InvoiceID
                ReadRecord(ProposedDrillDownID)
            End Try
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests