attach a document to sales order with file watcher  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

attach a document to sales order with file watcher

Postby indikad » Tue Aug 24, 2021 7:11 pm

below is a code sample that works on Jiwa 7.2.1 ( on the UI on save ending ) - this attaches a pdf file to the current sales order

Can someone share the bit of code that can replace the line below for Jiwa 7.0.175 ( older version ) pls and that too on the SalesOrder file watcher plugin ( csv import ). This line wont compile with error
"manager is not a member of JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder"
Code: Select all
Dim sdoc As JiwaFinancials.Jiwa.JiwaApplication.Documents.Document =  oSalesOrder.Manager.CollectionItemFactory.CreateCollectionItem(Of JiwaFinancials.Jiwa.JiwaApplication.Documents.Document)()


Code: Select all
Private Sub SalesOrderSaveEnding( sender As Object ,  e As System.EventArgs )
Dim oSalesOrder As JiwaSales.SalesOrder.SalesOrder   = DirectCast( sender , JiwaSales.SalesOrder.SalesOrder )
      Dim sdoc As JiwaFinancials.Jiwa.JiwaApplication.Documents.Document =  oSalesOrder.Manager.CollectionItemFactory.CreateCollectionItem(Of JiwaFinancials.Jiwa.JiwaApplication.Documents.Document)()
      sdoc.FileBinary = System.IO.File.ReadAllBytes("C:\temp\test.pdf")
       sdoc.Description = "test.pdf"
           sdoc.DocumentType = oSalesOrder.Documents.DocumentTypes.GetDefaultDocumentType()
           sdoc.PhysicalFileName = "C:\temp\test.pdf"
         oSalesOrder.Documents.Add(sdoc)
      'oSalesOrder.Save()' // optional depending
End Sub
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: attach a document to sales order with file watcher  Topic is solved

Postby SBarnes » Wed Aug 25, 2021 2:50 pm

In having a look at a plugin I had from back then and looking inside the old Jiwa Application DLL at the actual document object I am pretty sure a collection Item didn't have manager so there was no factory you can just new one up and all should be good as when it needs the manager it uses the old instance one.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests