Page 1 of 1

Process a sales order programatically

PostPosted: Thu Nov 12, 2015 11:15 am
by indikad
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 )

Re: Process a sales order programatically  Topic is solved

PostPosted: Fri Nov 13, 2015 10:11 am
by Scott.Pearce
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