4.3.1 Documents connected to an order

Public Function Document_Add(sOrderID As String) As Long

- Returns Handymans internal id for the new document or 0 if operation was cancelled. The order must exist in Handyman.

Public Function Document_Modify(sOrderID As String, lDocumentID As Long) As Boolean

- Displays or changes the document and related information. Printing is available in the dialog. Returns True if the document or related information is changed.

Public Function Document_Delete(sOrderID As String, lDocumentID As Long) As Boolean

- Deletes the specified document. Returns False if the operation was cancelled.


Public Function Document_SetAsUploaded(sOrderID As String, lDocumentID As Long, lReportType As Long, lChecklistID As Long, lBoligmappaDocumentID As String) As Long

- Lets external system report back to Handyman that a document or saved report has been uploaded to Boligmappa.
  Writes the Boligmappa document id to the database and sets upload date to now().

Only Checklists (lReportType=1) and Declaration of conformity (lReportType=2) reports is saved in Handyman, and is therefore the only valid values for lReportType.

To upload documents (Pictures PDF-files etc) use:
- lDocumentID= id from previous functions used to access the document in Handyman
- lReportType=0
- lChecklistID=0
- lBoligmappDocumentID = returned document id from BoligmappaWEB-Service after successful upload   
  This is a BigInt value in the Handyman database, so we use string as datatype here to avoid truncation of high numbers.

To upload reports (Cheklists or Declaration of conformity) use:
- lDocumentID=0
- lReportType= 1 for Checklists, 2 for Declaration of conformity
- lChecklistID= Checklist id from previous functions used to access the document in Handyman OR 0 if Delaration of conformity
- lBoligmappDocumentID=0

Return values from function:
0 = Unknown order number
1 = Successful update
2 = Illegal report type
3 = Any other error (Use text logging to get more information about error)