' VB Script Document ' Caller Script, to start the export Script for WinLine document metadata. ' ' Digital Data ' Ludwig-Rinn-Straße 16 ' 35452 Heuchelheim ' Tel.: 0641 / 202360 ' E-Mail: info-flow(at)digitaldata.works ' ' Version Number: 1.1.0.0 ' Version Date: 12.11.2020 On Error Resume Next '########## set variables ########## DIM MacroParameter(3) 'Set Debug Messages on (Enabled) or of. DebugMode = "disEnabled" 'Set die WinLine Macro which should be executed at the end DocMetaDataExport_Macro = "EXPORT-WINLINE_DOCUMENT_METADATA" 'Get current MandantorNr, like "500M". WinLineCurrentMandatorNr = Value (0,11) 'Get current meso year, like 1440 ((2020 - 1900) * 12 = 1440). WinLineCurrentYear = Value (0,5) 'The current type from program var (1= Anfrage/Angebot; 2= Auftrag/Bestellung; 3= Lieferschein; 4=Rechnung) WinLineDocType = Value (0,20) 'The current type from doc head (1= Anfrage/Angebot; 2= Auftrag/Bestellung; 3= Lieferschein; 4=Rechnung) DocType = Value (25,139) 'debitor doc = 1 / creditor doc = 2 PostingType = Value (357,6) 'Current "Laufnummer" DocRunningNr = Value (0,31) 'Current "Laufnummer" - special case "Lieferschein" DocDeliveryNoteNrRunningNr = Value (0,69) 'Number of the Offer ("Angebot") DocOfferNr = Value (0,34) 'Number of the Order ("Angebot") DocOrderNr = Value (0,35) 'Number of delivery note ("Lieferschein") DocDeliveryNoteNr = Value (0,36) 'Number of the Invoice ("Rechung") DocInvoiceNr = Value (0,37) 'Unique Key for T025 c000 DocAccountAndRunningNr = Value (25,0) 'When the doc ("Beleg") was created DocCreated = Value (25,59) 'When the doc ("Beleg") was last changed DocLastChange = Value (25,60) 'The ten "Belegkopfnotizen" DocHeadText1 = Value (25,63) DocHeadText2 = Value (25,64) DocHeadText3 = Value (25,65) DocHeadText4 = Value (25,66) DocHeadText5 = Value (25,67) DocHeadText6 = Value (25,68) DocHeadText7 = Value (25,69) DocHeadText8 = Value (25,70) DocHeadText9 = Value (25,71) DocHeadText10 = Value (25,72) '#################################### '########## preparing part ########## 'Reset Error Var Err.Clear 'Special case on delivery note, replace order runningnr with delivery note nr IF (DocDeliveryNoteNrRunningNr <> "") Then DocAccountAndRunningNr = Replace(DocAccountAndRunningNr, DocRunningNr, DocDeliveryNoteNrRunningNr) end if '############################### '########## main part ########## 'DocHeadText7 = Shop Rechnungsnummer; DocHeadText8 = Trackingnummer IF ((DocDeliveryNoteNr <> "") or (DocInvoiceNr <> "")) and ((DocHeadText7 <> "") or (DocHeadText8 <> "")) and (PostingType = 1) Then IF DebugMode = "Enabled" THEN MSGBOX "Calling Macro: " & DocMetaDataExport_Macro & vbCrLf & vbCrLf & _ "DocAccountAndRunningNr: " & DocAccountAndRunningNr & vbCrLf & _ "PostingType: " & PostingType & vbCrLf & _ "WinLineDocType: " & WinLineDocType & vbCrLf & _ "DocType: " & DocType, vbInformation, "DEBUG - Info: Export Metadata - Parameters ok!" END IF MacroParameter(0) = DebugMode MacroParameter(1) = DocAccountAndRunningNr MacroParameter(2) = DocType MacroParameter(3) = PostingType pParams = MacroParameter 'CWLStart.MacroCommands.MRunMacroSuspended doesnt work when "Belegumstellung" is used. Use: "MRunMacro"!!! CWLStart.MacroCommands.MRunMacro DocMetaDataExport_Macro, pParams 'CWLStart.MacroCommands.MWait 500 ELSE IF DebugMode = "Enabled" THEN MSGBOX "Calling Macro: " & DocMetaDataExport_Macro & vbCrLf & vbCrLf & _ "DocAccountAndRunningNr: " & DocAccountAndRunningNr & vbCrLf & _ "PostingType: " & PostingType & vbCrLf & _ "WinLineDocType: " & WinLineDocType & vbCrLf & _ "DocType: " & DocType, vbCritical, "DEBUG - Info: Export Metadata - Parameters MISSING!" END IF ResultValue = "" end if '###############################