| Function CreatePR(arrPositions As Variant,doc As NotesUIDocument, hazard As Boolean) As NotesDocument |
| Dim s As New NotesSession |
| Dim ws As New NotesUIWorkspace |
| Dim i As Integer |
| Dim iPosCount As Integer |
| Dim sPrefixNF As String |
| Dim sPrefixPR As String |
| Dim rtItem As NotesRichTextItem |
| Dim dbCurrent As NotesDatabase |
| Dim dbBF As NotesDatabase |
| Dim uiDocPR As NotesUIDocument |
| Set dbCurrent = s.Currentdatabase |
| Dim object As NotesEmbeddedObject |
| If Left(dbCurrent.Title,3) = "***" Then |
| Set dbBF = s.Getdatabase("EuropeNotesDev1/Servers/XXX","Firma\IT\DEV_Purchase.nsf", False) |
| Set uiDocPR = ws.Composedocument("EuropeNotesDev1/Servers/XXX", "Firma\IT\DEV_Purchase.nsf", "PReq") |
| Else |
| Set dbBF = s.Getdatabase(dbCurrent.Server, "XXX\Purchase.nsf", False) |
| Set uiDocPR = ws.Composedocument(dbCurrent.Server, "XXX\Purchase.nsf", "PReq") |
| End If |
| 'If hazard = True Then |
| ' Print "Test4" |
| ' Call uiDocPR.Fieldsettext("HazardMaterialNF","True") |
| ' Print "Test5" |
| ' Else |
| ' Print "Test4_1" |
| ' Call uiDocPR.Fieldsettext("HazardMaterialNF","False") |
| ' Print "Test5_1" |
| ' End If |
| Call uiDocPR.Fieldsettext("UNIDLinkToNachforderung", doc.Document.Universalid) |
| Call uiDocPR.Fieldsettext("Currency3B","EUR") |
| 'Call uiDocPR.Fieldsettext("UpdateNachforderung","") |
| For i = 0 To UBound(arrPositions) |
| sPrefixNF = "P" & arrPositions(i) |
| sPrefixPR = "_" & CStr(i+1) |
| Print "TEST" |
| Call uiDocPR.Fieldsettext("QTY" & sPrefixPR, doc.Fieldgettext(sPrefixNF & "Mge")) |
| Call uiDocPR.Fieldsettext("DESC" & sPrefixPR, doc.Fieldgettext(sPrefixNF & "ArtBeschr")) |
| Call uiDocPR.Fieldsettext("PRTNO" & sPrefixPR, doc.Fieldgettext(sPrefixNF & "ANR")) |
| Call uiDocPR.Fieldsettext("LESTUNITPRICE" & sPrefixPR, doc.Fieldgettext(sPrefixNF & "EP")) |
| Next |
| Set CreatePR = uiDocPR.Document |
| doc.Document.StatusOfPR = uiDocPR.Document.Getitemvalue("Status") |
| doc.Document.PRID = uiDocPR.Document.Getitemvalue("ReqNo") |
| ' Set rtitem = New NotesRichTextItem(doc.Document,"PRLINK") |
| ' Call rtitem.Appenddoclink(uidocPR.Document, "", "") |
| ' Set object = rtitem.Embedobject(EMBED_OBJECT, "", "") |
| doc.Document.TriggerPRJ = "1" |
| End Function |