Handling analytical accounting proposals using the SDK
 
This topic explains how to handle analytical accounting proposals using the SDK. It will give you details about how to insert, update or delete a complete proposal and how to consult, insert, update or delete details.
 
In the SDK several methods are available for handling the analytical accounting proposals of your Venice installation.
 
Insert
What?
This method allows you to insert a complete proposal, but only via the user interface (using the proposal dialog of Venice).
How?
Use the Insert method (using the proposal dialog of Venice, eInsertMode = imDialog).
 
Update
What?
This method allows you to update a complete proposal, but only via the user interface (using the proposal dialog of Venice). Using this method to update a proposal without user interface is also possible but the changes will be limited to the data of the header and to fields which can be modified in the grid of the corresponding Venice module only.
How?
Use the Update method without (eUpdateMode != umDialog) or with user interface (using the proposal dialog of Venice, eUpdateMode = umDialog)
 
Delete
What?
This method allows you to delete a complete proposal, but without user interface. You can also use this method to test if a proposal can be deleted without actually deleting it.
How?
Use the Delete method (for testing only, set eDeleteMode to dmTestOnly)
 
PrepareProposal
What?
This method allows you to completely handle (insert, update, delete and consult) all parts of a proposal: header and details, without user interface.
How?
If you want to securely handle analytical accounting proposals, make sure to follow these steps:
 
Preparing the object
In this step, you prepare the object for inserting a new proposal, duplicating, updating or consulting an existing one by calling the PrepareProposal method, by stating the appropriate 'ePrepareAction'.
It will load the necessary data of all related records in accordance with the action you requested:
   
  Header data   Detail data
paInsert   Data of the current proposal (overridden by the Init method)   None
paDuplicate   Data of the proposal you want to duplicate   Detail data of the proposal you want to duplicate
paUpdate   Data of the proposal you want to update   Detail data of the proposal you want to update
paView   Data of the proposal you want to consult   Detail data of the proposal you want to consult
After calling the PrepareProposal, most of the properties, that are read-only in a normal situation, are no longer read-only and can be set. After calling the WriteProposal or the CancelProposal method is called (see 'Write or cancel'), these properties are read-only again.
After the necessary data is loaded, you must provide all new header data.
Make sure that that data is correctly provided (using the properties of your object) before you proceed with the next steps.
If you are updating an existing proposal, this method will lock the proposal until the WriteProposal or the CancelProposal method is called (see 'Write or cancel').
During the period of time between calling the PrepareProposal method and the WriteProposal method or the CancelProposal method (see 'Write or cancel'), your application will use up 1 Import-user, except when the PrepareProposal method was called using the value 'paView' for the parameter ePrepareAction.
Therefore, the option 'Import' must be installed in order to manipulate (create, duplicate or change) analytical accounting proposals in the SDK.
Note that not all of the header fields you updated will be written to disk and will remain unchanged, eg. the proposal code and type.
 
Execute the actual action
Now, you must provide all the necessary data for the details, depending on the action you want to execute:
Insert new detail   Update existing detail   Delete existing detail   Consult existing detail   Number of details
InsertDetailSel   UpdateDetailSel   DeleteDetail   GetDetail   GetNumDetails
 
Write or cancel
The final step is to save the provided data to disk using the WriteProposal method or cancel the preparations using the CancelProposal method.

Remarks
Make sure that this step is always executed, especially in situations where an exception is thrown, by providing accurate error handling!