Handling accounting proposals using the SDK
 
This topic explains how to handle 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 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?
Type Method (using the proposal dialog of Venice, eInsertMode = imDialog)
Accounting proposal Insert
 
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?
Type Method without (eUpdateMode != umDialog) or with user interface (using the proposal dialog of Venice, eUpdateMode = umDialog)
Accounting proposal Update
 
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?
Type Method (for testing only, set eDeleteMode to dmTestOnly)
Accounting proposal Delete
 
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 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) accounting proposals in the SDK.
Not all of the header fields you updated will be written to disk and will stay unchanged, e.g. when creating an accounting proposal for financial documents.
 
Execute the actual action
Now, you must provide all the necessary data for the details, depending on the action you want to execute:
Type   Insert new detail   Update existing detail   Delete existing detail   Consult existing detail   Number of details
Accounting proposal        
Details
 
InsertDetailSel
 
UpdateDetailSel
 
DeleteDetail
 
GetDetail
 
GetNumDetails

Remarks
The default (English) prefixes for the accounts, available in Venice, are also provided for use in the details. It is recommended that they are used to avoid errors against the formatting rules of the account number (parameter bsAccount, see InsertDetailSel method).
Valid prefixes are a(ccount), c(ustomer), s(upplier), d(eposits), b(anks), p(ostal cheques) and (Cas)h.
For more information on the use of prefixes, you should consult the help of your Venice installation.
 
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!