PdcStatusManagement.TryStatus

From External Bemet Wiki
Jump to navigation Jump to search

Declaration

TryStatus(strCalcNr As String, strStatusIdent As String) as Boolean

Description

This function checks if a particular calculation can have a certain status. For example you can not change the status of a calculation to completely invoiced if there are still delivery note lines of this calculations that have not been invoiced yet.

Notes

The strStatusIdent refers to a value in the cs_autostatusname column. Only active statuses can be used.

Code example

This code example first checks which status the calculation would get after saving an invoice with the specified lines. And then checks if this calculation is allowed to have that status.

			Dim strFutureStatus As String = PDC.App.Calculations.StatusManagement.CalcLiveInvoiceStatus(aCalcNr, aTFRIDStringList, aDelNoteNrStringList, aDelNotePosStringList)
			Dim strError As String = ""
			If Not PDC.App.Calculations.StatusManagement.TryStatus(aCalcNr, strFutureStatus) Then
				strError = PDC.App.LastError
				_ErrMsg.Append(strError)
				Return False
			End If

Availability

Available since August 2020 (From version 5.6)