﻿<?xml version="1.0" encoding="utf-16"?>
<JiwaDocument xmlns:jiwa="http://www.jiwa.com.au/xml/schemas" Type="JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin">
  <RecID>dd9b863f-90dc-4cd6-8c48-b38c0dde0b78</RecID>
  <Name>File Watcher Stock Transfer</Name>
  <Description>Example plugin which watches folders in C:\ProgramData\Jiwa Financials\Jiwa 7\Import.  Several folders are watched - the XML folder imports XML documents, the folders in the CSV folder imports various types of documents.  Documents are moved into a pending folder whilst processing, then into a failed or succeeded folder depending on the outcome of the import.</Description>
  <IsEnabled>true</IsEnabled>
  <IsIsolatedToOwnAppDomain>false</IsIsolatedToOwnAppDomain>
  <ExecutionOrder>0</ExecutionOrder>
  <Author />
  <Version>7.0.108.0</Version>
  <Code>Imports JiwaFinancials.Jiwa
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.Data
Imports System.IO
Imports Microsoft.VisualBasic.FileIO.TextFieldParser

Public Class FormPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaFormPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
    End Sub

    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
    End Sub
End Class

Public Class BusinessLogicPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaBusinessLogicPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
    End Sub

End Class

Public Class ApplicationManagerPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaApplicationManagerPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub Setup(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaApplicationManagerPlugin.Setup
    End Sub

End Class

Public Class CustomFieldPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaCustomFieldPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub FormatCell(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.FormatCell
    End Sub

    Public Sub ReadData(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ReadData
    End Sub

    Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ButtonClicked
    End Sub

End Class

Public Class LineCustomFieldPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaLineCustomFieldPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub FormatCell(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostItem As JiwaApplication.IJiwaLineCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaLineCustomFieldPlugin.FormatCell
    End Sub

    Public Sub ReadData(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Row As Integer, ByVal HostItem As JiwaApplication.IJiwaLineCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaLineCustomFieldPlugin.ReadData
    End Sub

    Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostItem As JiwaApplication.IJiwaLineCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaLineCustomFieldPlugin.ButtonClicked
    End Sub

End Class

Public Class SystemSettingPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaSystemSettingPlugin

    Public Overrides Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

    Public Sub FormatCell(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal SystemSetting As JiwaApplication.SystemSettings.Setting) Implements JiwaApplication.IJiwaSystemSettingPlugin.FormatCell
    End Sub

    Public Sub ReadData(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Row As Integer, ByVal SystemSetting As JiwaApplication.SystemSettings.Setting) Implements JiwaApplication.IJiwaSystemSettingPlugin.ReadData
    End Sub

    Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal SystemSetting As JiwaApplication.SystemSettings.Setting) Implements JiwaApplication.IJiwaSystemSettingPlugin.ButtonClicked
    End Sub

End Class

Public Class ScheduledExecutionPlugin
	Inherits System.MarshalByRefObject
	Implements JiwaApplication.IJiwaScheduledExecutionPlugin

	Private _plugin As JiwaApplication.Plugin.Plugin 
	Private XMLWatcher As JiwaFileWatcher
	Private Web_XMLWatcher As JiwaFileWatcher
	Private CSVSalesOrderWatcher As JiwaFileWatcher	
	Private CSVPaxarWatcher As JiwaFileWatcher	
	Private CSVWageEasyWatcher As JiwaFileWatcher
	Private CSVJournalWatcher As JiwaFileWatcher	
	Private CSVPurchaseOrderWatcher As JiwaFileWatcher
	Private XMLQueueWatcher As JiwaFileWatcher
	Private CSVStockTransferWatcher As JiwaFileWatcher
	      
    Public Sub Execute(ByVal Plugin As JiwaApplication.Plugin.Plugin, ByVal Schedule As JiwaApplication.Schedule.Schedule) Implements JiwaApplication.IJiwaScheduledExecutionPlugin.Execute

    End Sub

    Public Sub OnServiceStart(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaScheduledExecutionPlugin.OnServiceStart
		_plugin = Plugin

		' Start watching the folders
'		XMLWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\XML")		       
'		AddHandler XMLWatcher.FileImport, AddressOf XMLFileImport
'		XMLWatcher.ImportAllFilesInWatchFolder()
			
'		CSVSalesOrderWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\Sales Orders")		       
'		AddHandler CSVSalesOrderWatcher.FileImport, AddressOf CSVSalesOrderImport
'		CSVSalesOrderWatcher.ImportAllFilesInWatchFolder()
			
		CSVPaxarWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\Paxar")		       
		AddHandler CSVPaxarWatcher.FileImport, AddressOf CSVPaxarImport
		CSVPaxarWatcher.ImportAllFilesInWatchFolder()
			
		CSVWageEasyWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\Wage Easy Journals")		       
		AddHandler CSVWageEasyWatcher.FileImport, AddressOf CSVWageEasyImport
		CSVWageEasyWatcher.ImportAllFilesInWatchFolder()
			
		CSVJournalWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\Journals")		       
		AddHandler CSVJournalWatcher.FileImport, AddressOf CSVJournalImport
		CSVJournalWatcher.ImportAllFilesInWatchFolder()
			
		CSVPurchaseOrderWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\Purchase Orders")		       
		AddHandler CSVPurchaseOrderWatcher.FileImport, AddressOf CSVPurchaseOrderImport
		CSVPurchaseOrderWatcher.ImportAllFilesInWatchFolder()
			
		XMLQueueWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\XML Queue")		       
		AddHandler XMLQueueWatcher.FileImport, AddressOf XMLQueueImport
		XMLQueueWatcher.ImportAllFilesInWatchFolder()
	'''''''''''''''''''''''''''''''''

		
		CSVStockTransferWatcher = New JiwaFileWatcher(Plugin, "C:\ProgramData\Jiwa Financials\Jiwa 7\Import\CSV\StkTransfer")
		AddHandler CSVStockTransferWatcher.FileImport, AddressOf CSVStockTransferImport
		CSVStockTransferWatcher.ImportAllFilesInWatchFolder()

	End Sub

    Public Sub OnServiceStopping(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaScheduledExecutionPlugin.OnServiceStopping        
		If Not XMLWatcher Is Nothing Then
        	XMLWatcher.StopWatching 
		End If

		If Not Web_XMLWatcher Is Nothing Then
        	Web_XMLWatcher.StopWatching 
		End If
					
		If Not CSVSalesOrderWatcher Is Nothing Then
        	CSVSalesOrderWatcher.StopWatching 
		End If
			
		If Not CSVPaxarWatcher Is Nothing Then
        	CSVPaxarWatcher.StopWatching 
		End If
			
		If Not CSVWageEasyWatcher Is Nothing Then
        	CSVWageEasyWatcher.StopWatching 
		End If
			
		If Not CSVJournalWatcher Is Nothing Then
        	CSVJournalWatcher.StopWatching 
		End If
			
		If Not CSVPurchaseOrderWatcher Is Nothing Then
        	CSVPurchaseOrderWatcher.StopWatching 
		End If
			
		If Not XMLQueueWatcher Is Nothing Then
        	XMLQueueWatcher.StopWatching 
		End If
		
		If Not CSVStockTransferWatcher Is Nothing Then
			CSVStockTransferWatcher.StopWatching
		End If
		
    End Sub
		
	Private Sub XMLFileImportEDI(ByVal FileName As String)
        ' Import the file using the import queue manager
        Dim importQueueManager As JiwaImportQManager.ImportQueueItemCollection = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaImportQManager.ImportQueueItemCollection)(Nothing)
        
		Dim queueItem As New JiwaImportQManager.ImportQueueItem
		queueItem.TransformedXML = File.ReadAllText(FileName)
		queueItem.Status = JiwaImportQManager.ImportQueueItem.ImportQueueItemStatuses.ReadyForImport
		importQueueManager.Add(queueItem)
		queueItem.Process()
		If queueItem.Status = JiwaImportQManager.ImportQueueItem.ImportQueueItemStatuses.Failed Then
			Throw New System.Exception(queueItem.ImportErrorMessage) 
		Else
			XMLQueueWatcher.LogToEventLog(String.Format("Imported EDI XML from File '{0}'", FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)				
		End If
	End Sub
		
	Private Sub XMLFileImportWeb(ByVal FileName As String)
        ' Import the file using the import queue manager
        Dim importQueueManager As JiwaImportQManager.ImportQueueItemCollection = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaImportQManager.ImportQueueItemCollection)(Nothing)
        
		Dim queueItem As New JiwaImportQManager.ImportQueueItem
		queueItem.TransformedXML = File.ReadAllText(FileName)
		queueItem.Status = JiwaImportQManager.ImportQueueItem.ImportQueueItemStatuses.ReadyForImport
		importQueueManager.Add(queueItem)
		queueItem.Process()
		If queueItem.Status = JiwaImportQManager.ImportQueueItem.ImportQueueItemStatuses.Failed Then
			Throw New System.Exception(queueItem.ImportErrorMessage) 
		Else
			XMLQueueWatcher.LogToEventLog(String.Format("Imported Web XML from File '{0}'", FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)				
		End If
	End Sub
		

	
	Private Sub CSVSalesOrderImport(ByVal FileName As String)						
		'SAMPLE CSV INPUT FILE
		'=======================================================================
		'OrderNo,OrderDate,DebtorAccountNo,PartNo,QuantityOrdered,PriceExGST
		'
		'File contents:
		'
		'000100,2006-05-30,1001,1170,5,15.45
		'000100,2006-05-30,1001,1171,5,15.45
		'000100,2006-05-30,1001,1172,5,15.45
		'000100,2006-05-30,1001,1173,5,15.45
		'000101,2006-06-01,1002,1170,5,15.45
		'=======================================================================
		Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)		
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = False
				
			Dim csvFields As String() 
			Dim previousOrderNo As String = Nothing
			Dim newKey As String = ""
			Dim debtor As JiwaApplication.Entities.Debtor.Debtor = New JiwaApplication.Entities.Debtor.Debtor 
			Dim inventory As JiwaApplication.Entities.Inventory.Inventory = New JiwaApplication.Entities.Inventory.Inventory								
			    csvParser.ReadFields	
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields
											
				If Not previousOrderNo Is Nothing AndAlso csvFields(0) &lt;&gt; previousOrderNo Then
					' The order No. has changed - save the currently assembled sales order
					salesOrder.Save()
					CSVSalesOrderWatcher.LogToEventLog(String.Format("Imported Sales Order Invoice No. '{0}' With Order No. '{1}' from File '{2}'", salesOrder.InvoiceNo, salesOrder.OrderNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
				End If
					
				If previousOrderNo Is Nothing OrElse csvFields(0) &lt;&gt; previousOrderNo Then
					' Create a new order						
					debtor.ReadRecordFromAccountNo(csvFields(2))
					salesOrder.CreateNew(JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes.e_NewSalesOrder, debtor.DebtorID)
					salesOrder.OrderNo = csvFields(0)
					salesOrder.InitiatedDate = csvFields(1)
				End If					
										 
				inventory.ReadRecordFromPartNo(csvFields(3))
					
				salesOrder.SalesOrderLines.AddInventoryItem(inventory.InventoryID, JiwaSales.SalesOrder.SalesOrderLineCollection.SalesOrderLineInventorySeedTypes.e_SalesOrderLineInventoryID, newKey)
				salesOrder.SalesOrderLines(newKey).QuantityOrdered = csvFields(4)
				salesOrder.SalesOrderLines(newKey).DiscountedPrice = csvFields(5)
					
				previousOrderNo = csvFields(0)
			Loop				
				
			If salesOrder.SalesOrderLines.Count &gt; 0 Then
				salesOrder.Save()
				CSVSalesOrderWatcher.LogToEventLog(String.Format("Imported Sales Order Invoice No. '{0}' With Order No. '{1}' from File '{2}'", salesOrder.InvoiceNo, salesOrder.OrderNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)				
			End If					
			
		End Using			
	End Sub
		
	Private Sub CSVPaxarImport(ByVal FileName As String)						
		'SAMPLE CSV INPUT FILE
		'=======================================================================			
		'Column 3 = Invoice No.
		'Column 35 = Quantity Picked
		'Column 36 = Invoice Line ID
		'
		'File contents:
		'		
		',,100487,20060919,1436,8667020004748,,331771,20060919,C,331771,20060919,20060919,20060919,09A735096C074FB7A,1.0,0.05,1,Toll Ipec,,,,,,09A735096C074FB7A,331771,D01 - Inserted By Mathew 19/09,brodie,2,VSM-On-M,,,9336920000013,B22B,1,0577553ac5564f7da934,,,,,
		',,100487,20060919,1436,8667020004748,,331771,20060919,C,331771,20060919,20060919,20060919,09A735096C074FB7A,1.0,0.05,1,Toll Ipec,,,,,,09A735096C074FB7A,331771,D01 - Inserted By Mathew 19/09,brodie,3,VSM-On-XL,,,9336920000037,B22B,2,5e4181ee9f2441f99f69,,,,,
		'
		'=======================================================================
		Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)		
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = False
				
			Dim csvFields As String() 
			Dim previousInvoiceNo As String = Nothing
				
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields
											
				If Not previousInvoiceNo Is Nothing AndAlso csvFields(2) &lt;&gt; previousInvoiceNo Then
					' The order No. has changed - save the sales order
					salesOrder.Save()
					CSVPaxarWatcher.LogToEventLog(String.Format("Updated Sales Order Invoice No. '{0}' from Paxar CSV File '{1}'", salesOrder.InvoiceNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
				End If
					
				If previousInvoiceNo Is Nothing OrElse csvFields(2) &lt;&gt; previousInvoiceNo Then
					' Read the order					
					salesOrder.Find(JiwaApplication.IJiwaNavigable.ReadModes.Actual, "SO_Main.InvoiceNo", csvFields(2), "")
				End If
				
				For Each salesOrderLine As JiwaSales.SalesOrder.SalesOrderLine In SalesOrder.SalesOrderLines
					If salesOrderLine.RecID = csvFields(35) Then
						salesOrderLine.QuantityThisDelivery = CDec(csvFields(34))
						salesOrderLine.QuantityDemand = salesOrderLine.QuantityBackOrdered ' Force any backorders onto demand. 
						salesOrderLine.Picked = True
						Exit For
					End If
				Next
					
				previousInvoiceNo = csvFields(2)
			Loop				
				
			If salesOrder.SalesOrderLines.Count &gt; 0 Then
				salesOrder.Save()
				CSVPaxarWatcher.LogToEventLog(String.Format("Updated Sales Order Invoice No. '{0}' from Paxar CSV File '{1}'", salesOrder.InvoiceNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
			End If					
			
		End Using			
	End Sub
		
	Private Sub CSVWageEasyImport(ByVal FileName As String)						
		'1) 2 digit number between 1 &amp; 12 entered by the user. No specific use
		'2) Date dd/mm/yyyy
		'3) "G" - stands For general ledger batch
		'4) G/L account code - up To 20 chars
		'5) batch reference - will always contain the word "PAY" + the 2 digit number
		'In 1st column above
		'6) transaction reference - a description Of Each line item
		'7) amount - negative (ie credit) amounts will contain preceeding  -sign
		'8) 0,0,"","" - these fields are Not used by payroll so will always contain
		'these same settings
		'
		'SAMPLE CSV INPUT FILE
		'=======================================================================
		'Unused, TransPostDateTime/PostDateTime, Unused, AccountNo, Description, Reference, Amount, Unused, Unused, Unused, Unused
		'
		'File contents:
		'				
		'"01","24/10/2014","G","4160-900-00","PAY (01)","Super (SS)     ",-300.00,0,0,"",""
		'"01","24/10/2014","G","4160-900-00","PAY (01)","Super Contr.   ",-85.00,0,0,"",""
		'"01","24/10/2014","G","4160-900-00","PAY (01)","Social Club    ",-4.00,0,0,"",""
		'"01","24/10/2014","G","4160-900-00","PAY (01)","Super (SS)     ",-150.00,0,0,"",""
		'"01","24/10/2014","G","4160-900-00","PAY (01)","Social Club    ",-4.00,0,0,"",""
		'"01","24/10/2014","G","6010-200-00","PAY (01)","Ordinary",13333.35,0,0,"",""
		'"01","24/10/2014","G","6010-200-00","PAY (01)","Ordinary",5700.02,0,0,"",""
		'"01","24/10/2014","G","6010-200-00","PAY (01)","Ordinary",3032.27,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Net",-10345.35,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Tax",-2599.00,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Net",-3890.02,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Tax",-1656.00,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Net",-1618.27,0,0,"",""
		'"01","24/10/2014","G","4140-900-00","PAY (01)","Tax",-1414.00,0,0,"",""
		'
		'=======================================================================
		Dim journalSet As JiwaJournalSets.JournalSet = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaJournalSets.JournalSet)(Nothing)		
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = True
				
			Dim csvFields As String() 
			journalSet.CreateNew
								
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields
				
				Dim journalLine As New JiwaJournalSets.Line
				journalLine.GLAccount.ReadRecordFromAccountNo(csvFields(3))
				journalLine.TransPostDateTime = csvFields(1)
				journalLine.Reference = csvFields(4)
				If CDec(csvFields(6)) &gt; 0 Then
					journalLine.DebitAmount = System.Math.Abs(CDec(csvFields(6)))
				Else
					journalLine.CreditAmount = System.Math.Abs(CDec(csvFields(6)))
				End If
					
				journalSet.Lines.Add(journalLine)
			Loop				
				
			If journalSet.Lines.count &gt; 0 Then
				journalSet.PostedDate = journalSet.Lines(1).TransPostDateTime
				journalSet.Description = journalSet.Lines(1).Reference
				journalSet.Save()
				CSVWageEasyWatcher.LogToEventLog(String.Format("Created Journal Set No. '{0}' from Wage Easy CSV File '{1}'", journalSet.SetNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
			End If					
			
		End Using			
	End Sub
		
	Private Sub CSVJournalImport(ByVal FileName As String)						
		'1) Set Type (Normal / Pending / Errored)
		'2) Date dd/mm/yyyy
		'3) G/L account code - up To 20 chars
		'4) Batch reference
		'5) Transaction reference - a description Of Each line item
		'6) Amount - negative (ie credit) amounts will contain preceeding  -sign
		'these same settings
		'
		'SAMPLE CSV INPUT FILE
		'=======================================================================
		'SetType, TransPostDateTime/PostDateTime, AccountNo, Description, Reference, Amount
		'
		'File contents:
		'				
		'"Pending","24/10/2012","2015-200-00","PAY (01)","Super (SS)",-300.00
		'"Pending","24/10/2012","2810-000-03","PAY (01)","Other",200.00
		'"Pending","24/10/2012","2810-000-02","PAY (01)","Sundry",100.00
		'	
		'=======================================================================
		Dim journalSet As JiwaJournalSets.JournalSet = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaJournalSets.JournalSet)(Nothing)		
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = True
				
			Dim csvFields As String() 
			journalSet.CreateNew
								
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields
				
				Dim journalLine As New JiwaJournalSets.Line
				journalLine.GLAccount.ReadRecordFromAccountNo(csvFields(2))
				journalLine.TransPostDateTime = csvFields(1)
				journalLine.Reference = csvFields(3)
				journalLine.Remark = csvFields(4)
				If CDec(csvFields(5)) &gt; 0 Then
					journalLine.DebitAmount = System.Math.Abs(CDec(csvFields(5)))
				Else
					journalLine.CreditAmount = System.Math.Abs(CDec(csvFields(5)))
				End If
					
				Select Case csvFields(0).ToString.ToLower
					Case "pending"
						journalset.SetType = JiwaJournalSets.JournalSet.SetTypes.Pending 					
				End Select
					
				journalSet.Lines.Add(journalLine)
			Loop				
				
			If journalSet.Lines.count &gt; 0 Then
				journalSet.PostedDate = journalSet.Lines(1).TransPostDateTime
				journalSet.Description = journalSet.Lines(1).Reference
				journalSet.Save()
				CSVJournalWatcher.LogToEventLog(String.Format("Created Journal Set No. '{0}' from CSV File '{1}'", journalSet.SetNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
			End If					
			
		End Using			
	End Sub
		
	Private Sub CSVPurchaseOrderImport(ByVal FileName As String)						
		'SAMPLE CSV INPUT FILE
		'=======================================================================
		'AccountNo,OrderNo,OrderedDate,PartNo,Quantity,HomeLandedCost
		'
		'File contents:
		'					
		'5001,100600,28/05/2014,1170,3,105
		'5001,100601,23/06/2014,1171,1,80.85
		'5001,100602,23/06/2014,1171,2,80.85
		'5001,100603,19/06/2014,1171,2,80.85
		'	
		'=======================================================================
		Dim purchaseOrder As JiwaPurchaseOrders.PurchaseOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaPurchaseOrders.PurchaseOrder)(Nothing)			
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = False
				
			Dim csvFields As String() 
			Dim previousOrderNo As String = Nothing
			Dim inventory As JiwaApplication.Entities.Inventory.Inventory = New JiwaApplication.Entities.Inventory.Inventory								
			Dim NewLineKey As String = ""
				
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields
											
				If Not previousOrderNo Is Nothing AndAlso csvFields(1) &lt;&gt; previousOrderNo Then
					' The order No. has changed - save the currently assembled purchase order
					purchaseOrder.Save()
					CSVPurchaseOrderWatcher.LogToEventLog(String.Format("Imported Purchase Order No. '{0}' from File '{1}'", purchaseOrder.OrderNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)
				End If
					
				If previousOrderNo Is Nothing OrElse csvFields(1) &lt;&gt; previousOrderNo Then
					' Create a new order						
					purchaseOrder.CreateNew(JiwaPurchaseOrders.PurchaseOrder.SupplierType.Creditor, JiwaPurchaseOrders.PurchaseOrder.NewOrderSeedTypes.CreditorAccountNo, csvFields(0), JiwaPurchaseOrders.PurchaseOrder.PurchaseOrderType.DefaultOrderType)
					purchaseOrder.OrderNo = csvFields(1)
					purchaseOrder.OrderDate = csvFields(2)
				End If					
				
				inventory.ReadRecordFromPartNo(csvFields(3))
				
				purchaseOrder.Lines.AddInventoryItem(inventory.InventoryID, NewLineKey)																			
				purchaseOrder.Lines(NewLineKey).Quantity = CDec(csvFields(4))
				purchaseOrder.Lines(NewLineKey).Cost = CDec(csvFields(5))
					
				previousOrderNo = csvFields(1)
			Loop				
				
			If purchaseOrder.Lines.Count &gt; 0 Then
				purchaseOrder.Save()
				CSVPurchaseOrderWatcher.LogToEventLog(String.Format("Imported Purchase Order No. '{0}' from File '{1}'", purchaseOrder.OrderNo, FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)				
			End If					
			
		End Using			
	End Sub
		
	Public Sub XMLQueueImport(ByVal FileName As String)
		Dim SQLParam As SqlParameter
			
		' Read the file contents
		Dim fileText As String = File.ReadAllText(FileName)
		Dim XMLDocument As New System.Xml.XmlDocument
        XMLDocument.LoadXml(fileText)
			
		' Insert into the table
		With JiwaApplication.Manager.Instance.Database 
			Dim SQL As String = "INSERT INTO IM_ImportQueue(ImportQueueID, OriginalXML, TransformedXML, Status, AddedToQueueDateTime, AddedToQueueByStaffID, LastSavedDateTime, LastSavedByStaffID, ImportErrorMessage, ImportBatchID, BatchNo, ItemNo, ImportSuccessMessage) " &amp; 
									"SELECT NewID()" &amp;
	                                ", @OriginalXML" &amp;
	                                ", @TransformedXML" &amp; 
	                                ", @Status" &amp;
	                                ", @AddedToQueueDateTime" &amp;
	                                ", @AddedToQueueByStaffID" &amp;
	                                ", @LastSavedDateTime" &amp;
	                                ", @LastSavedByStaffID" &amp;
	                                ", @ImportErrorMessage" &amp;
	                                ", @ImportBatchID" &amp;
	                                ", @BatchNo" &amp;
	                                ", @ItemNo" &amp;
	                                ", @ImportSuccessMessage"

            Using SQLCmd As SqlCommand = New SqlCommand(SQL, .SQLConnection, .SQLTransaction)
                SQLParam = New SqlParameter("@OriginalXML", System.Data.SqlDbType.Text)
                SQLParam.Value = XMLDocument.OuterXml
                SQLCmd.Parameters.Add(SQLParam)

                SQLParam = New SqlParameter("@TransformedXML", System.Data.SqlDbType.Text)
                SQLParam.Value = XMLDocument.OuterXml
                SQLCmd.Parameters.Add(SQLParam)

				SQLParam = New SqlParameter("@Status", System.Data.SqlDbType.TinyInt)
                SQLParam.Value = 0
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@AddedToQueueDateTime", System.Data.SqlDbType.DateTime)
                SQLParam.Value = Now
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@AddedToQueueByStaffID", System.Data.SqlDbType.Char)
                SQLParam.Value = JiwaApplication.Manager.Instance.Staff.RecID
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@LastSavedDateTime", System.Data.SqlDbType.DateTime)
                SQLParam.Value = Now
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@LastSavedByStaffID", System.Data.SqlDbType.Char)
                SQLParam.Value = JiwaApplication.Manager.Instance.Staff.RecID
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@ImportErrorMessage", System.Data.SqlDbType.VarChar)
                SQLParam.Value = ""
                SQLCmd.Parameters.Add(SQLParam)
				
				SQLParam = New SqlParameter("@ImportBatchID", System.Data.SqlDbType.Char)
                SQLParam.Value = ""
                SQLCmd.Parameters.Add(SQLParam)
				
				SQLParam = New SqlParameter("@BatchNo", System.Data.SqlDbType.Char)
                SQLParam.Value = ""
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@ItemNo", System.Data.SqlDbType.Int)
                SQLParam.Value = 0
                SQLCmd.Parameters.Add(SQLParam)
					
				SQLParam = New SqlParameter("@ImportSuccessMessage", System.Data.SqlDbType.VarChar)
                SQLParam.Value = ""
                SQLCmd.Parameters.Add(SQLParam)
					
                SQLCmd.ExecuteNonQuery()
            End Using
		End With
	End Sub

	Private Sub CSVStockTransferImport(ByVal FileName As String)						
		'SAMPLE CSV INPUT FILE
		'=======================================================================
		'PartNo,Variance,Warehouse
		'
		'File contents:
		'
		'1170,5,15.45
		'1171,-5,15.45
		'1172,5,15.45
		'
		'=======================================================================
		Dim StockTransfer As JiwaStockTransfer.StockTransfer = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaStockTransfer.StockTransfer)(Nothing)		
					
		Using csvParser As New FileIO.TextFieldParser(FileName)				
			csvParser.TextFieldType = FileIO.FieldType.Delimited
			csvParser.Delimiters = New String() {","}
			csvParser.HasFieldsEnclosedInQuotes = False
				
			Dim csvFields As String() 
			Dim previousOrderNo As String = Nothing
			Dim newKey As String = ""
			Dim inventory As JiwaApplication.Entities.Inventory.Inventory = New JiwaApplication.Entities.Inventory.Inventory								
			csvParser.ReadFields
			
			StockTransfer.CreateNew()
			stockTransfer.TransferDate = JiwaApplication.Manager.Instance.SysDateTime
			Do While Not csvParser.EndOfData
				csvFields = csvParser.ReadFields											 
				inventory.ReadRecordFromPartNo(csvFields(0))
				
				Dim line As New JiwaStockTransfer.Line
				If CDec(csvFields(1)) &gt; 0 Then
					'  Writing On
				    line.FromInventory.PartNo = "External"

				    line.ToInventory.ReadRecordFromPartNo(csvFields(0))
				    line.TransferQuantity = CDec(csvFields(1))
				    line.ToPartExpiryDate = JiwaApplication.Manager.Instance.SysDateTime   ' &lt;-- The need for this seems to be a bug, but just setting the expiry date is a workaround - otherwise the Save method fails later.
				Else
					'Writing off
				    line.ToInventory.PartNo = "External"
				    line.FromInventory.ReadRecordFromPartNo(csvFields(0))
				    line.TransferQuantity = System.Math.Abs(CDec(csvFields(1)))
					line.FromPartExpiryDate = JiwaApplication.Manager.Instance.SysDateTime 
				    line.ToPartExpiryDate = JiwaApplication.Manager.Instance.SysDateTime   ' &lt;-- The need for this seems to be a bug, but just setting the expiry date is a workaround - otherwise the Save method fails later.
				End If					
			    stockTransfer.Lines.Add(line)
			Loop				
				
			If stockTransfer.Lines.Count &gt; 0 Then
				stockTransfer.Save()
				CSVStockTransferWatcher.LogToEventLog(String.Format("Imported Stock Transfer No. '{0}'  from File '{1}'", StockTransfer.TransferNo,  FileName), System.Diagnostics.EventLogEntryType.SuccessAudit)				
			End If					
			
		End Using			
	End Sub


End Class
	
Public Class JiwaFileWatcher
	Private Plugin As JiwaApplication.Plugin.Plugin 
	Public Property FileSystemWatcher As FileSystemWatcher
	Public Property BaseFolder As String
			
	Public Event FileImport(ByVal FullPath As String)
			
	Public ReadOnly Property WatchFolder As String	
		Get 
			Return Path.Combine(BaseFolder, "Watch")
		End Get
	End Property
		
	Public ReadOnly Property PendingFolder As String	
		Get 
			Return Path.Combine(BaseFolder, "Pending")
		End Get
	End Property
		
	Public ReadOnly Property FailedFolder As String	
		Get 
			Return Path.Combine(BaseFolder, "Failed")
		End Get
	End Property
		
	Public ReadOnly Property SucceededFolder As String	
		Get 
			Return Path.Combine(BaseFolder, "Succeeded")
		End Get
	End Property
			
	Public Sub New(Plugin As JiwaApplication.Plugin.Plugin, ByVal BaseFolder As String)
		Me.BaseFolder = BaseFolder
		Me.Plugin = Plugin
			
		If Not System.IO.Directory.Exists(Me.BaseFolder) Then
			System.IO.Directory.CreateDirectory(Me.BaseFolder)
		End If
			
		If Not System.IO.Directory.Exists(Me.WatchFolder) Then
			System.IO.Directory.CreateDirectory(Me.WatchFolder)
		End If
			
		If Not System.IO.Directory.Exists(Me.PendingFolder) Then
			System.IO.Directory.CreateDirectory(Me.PendingFolder)
		End If
			
		If Not System.IO.Directory.Exists(Me.FailedFolder) Then
			System.IO.Directory.CreateDirectory(Me.FailedFolder)
		End If
			
		If Not System.IO.Directory.Exists(Me.SucceededFolder) Then
			System.IO.Directory.CreateDirectory(Me.SucceededFolder)
		End If
			
		FileSystemWatcher = New FileSystemWatcher
		FileSystemWatcher.Path = Me.WatchFolder 
		FileSystemWatcher.NotifyFilter = (NotifyFilters.LastWrite Or NotifyFilters.FileName)
		FileSystemWatcher.Filter = "*.*"
		FileSystemWatcher.EnableRaisingEvents = True
			
		AddHandler FileSystemWatcher.Created, AddressOf OnCreated
			
		LogToEventLog(String.Format("Started monitoring folder: '{0}'", Me.WatchFolder), System.Diagnostics.EventLogEntryType.SuccessAudit)
	End Sub
	
	Public Sub ImportAllFilesInWatchFolder()		
		' Import any files already in the watch folder
		For Each file As String In System.IO.Directory.EnumerateFiles(Me.WatchFolder)
			OnFileImport(file)
		Next				
	End Sub
		
	Private Sub OnFileImport(ByVal FullPath As String)
		If System.IO.File.Exists(FullPath) Then
			Dim pendingFileNameAndPath As String = Path.Combine(Me.PendingFolder, System.IO.Path.GetFileName(FullPath)) &amp; "." &amp; now.ToString("yyyy-MM-ddTHmmss.FFF")
				
			Try
				' Wait until we can get exclusive access, or until we exceed the retry period.
				Dim retryCount As Integer = 0
				Dim maxRetries As Integer = 5					
				
				Do While True
					Try
						Using fs As New FileStream(FullPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None, 100)
							fs.ReadByte 
							Exit Do
						End Using
					Catch ex As System.Exception
						If retryCount &gt; maxRetries Then
							Exit Do
						Else
							retryCount += 1
							System.Threading.Thread.Sleep(500)
						End If
					End Try
				Loop
					
				' Move to pending folder				
				System.IO.File.Move(Path.Combine(Me.WatchFolder, System.IO.Path.GetFileName(FullPath)), pendingFileNameAndPath)									
					
				' Raise the event so the work is done
				RaiseEvent FileImport(pendingFileNameAndPath)
						
				' Move to succeeded folder
				System.IO.File.Move(pendingFileNameAndPath, Path.Combine(Me.SucceededFolder, System.IO.Path.GetFileName(pendingFileNameAndPath)))
				
				LogToEventLog(String.Format("Imported File '{0}'", FullPath), System.Diagnostics.EventLogEntryType.SuccessAudit)
			Catch ex As System.Exception
				' Move to failed folder
				System.IO.File.Move(pendingFileNameAndPath, Path.Combine(Me.FailedFolder, System.IO.Path.GetFileName(pendingFileNameAndPath)))
				LogToEventLog(String.Format("Failed to import File '{0}' - Error: {1}", FullPath, ex.Message), System.Diagnostics.EventLogEntryType.Error)
					
				'Dim email As JiwaApplication.JiwaEmail.EmailMessage = JiwaApplication.BusinessLogicFactory.Instance.CreateBusinessLogic(Of JiwaApplication.JiwaEmail.EmailMessage)
				'email.SystemSettings.UseOutlookForEmail = False ' Cannot use outlook from within a Windows Service - make sure your other system settings like SMTP server are configured.
				'email.CreateNew() 
				'email.EmailTo = "youremail@yourdomain.com.au"
				'email.EmailSubject = "test email"
				'email.EmailBody = String.Format("Document '{0}' failed to import - error message is '{1}'", pendingFileNameAndPath, ex.Message)
				'email.Save()
			End Try		
		End If
	End Sub
		
	Private Sub OnCreated(source As Object, e As FileSystemEventArgs)
		OnFileImport(e.FullPath)
	End Sub
		
	Public Sub StopWatching()
		RemoveHandler FileSystemWatcher.Created, AddressOf OnCreated
	End Sub
		
	Public Sub LogToEventLog(ByVal Message As String, ByVal EventLogEntryType As System.Diagnostics.EventLogEntryType)
		Dim Log As New System.Diagnostics.EventLog("Application")
		Log.Source = String.Format("Jiwa Plugin : {0}", Me.Plugin.Name )
		Log.WriteEntry(Message, EventLogEntryType)
		Log.Close()
	End Sub
		
End Class</Code>
  <ExceptionPolicy>Report</ExceptionPolicy>
  <Language>VisualBasic</Language>
  <ReferenceCollection>
    <Reference>
      <RecID>f4f1bdde-09f7-430e-bad8-0ac3d1191b46</RecID>
      <AssemblyFullName>JiwaApplication, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaApplication.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaApplication.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>d616f933-4306-40f2-a23f-dae4417c26d9</RecID>
      <AssemblyFullName>mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>mscorlib.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>aba8967e-0fdb-4593-b68d-3dfbeef8eee9</RecID>
      <AssemblyFullName>Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>Microsoft.VisualBasic.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>f2454817-b8fd-4023-a33b-8ae3f5e92ebd</RecID>
      <AssemblyFullName>System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>69e97ce6-65be-46b3-ab8d-236a85b40de6</RecID>
      <AssemblyFullName>System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Windows.Forms.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>007f766b-eb90-4061-9a6e-4b5a09bd358c</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinToolbars.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinToolbars.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinToolbars.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>40a7ad25-4286-4c61-af28-b0455772df30</RecID>
      <AssemblyFullName>Infragistics4.Win.Misc.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.Misc.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.Misc.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>7a1337e3-4e82-41d5-9739-74807b5bb6bf</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinStatusBar.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinStatusBar.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinStatusBar.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>49201fd8-2467-41b5-bd2c-df392da95702</RecID>
      <AssemblyFullName>FarPoint.Win.Spread, Version=7.35.20132.1, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.Spread.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\FarPoint.Win.Spread.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>ceb763b7-c24c-4e2a-a7a8-94d00286d54c</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinTabControl.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinTabControl.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinTabControl.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>f9656290-e903-4399-8feb-f0cef520c7ca</RecID>
      <AssemblyFullName>System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>System.Drawing.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>5be732f9-3d75-4809-8aef-4f01df4352b8</RecID>
      <AssemblyFullName>JiwaODBC, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaODBC.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaODBC.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>bfcbdac4-2dbd-4aec-a761-9b39f492178c</RecID>
      <AssemblyFullName>System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Data.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>cb3c50da-a645-495f-908d-c1b4837536c8</RecID>
      <AssemblyFullName>Infragistics4.Win.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>cddcb72a-f85a-495a-8a06-ba38ff6512c1</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinEditors.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinEditors.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinEditors.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>227cf2b2-9deb-4458-b87d-9c1d8e9794f4</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinExplorerBar.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinExplorerBar.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinExplorerBar.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>fdfcadaa-44b1-4759-806e-a759bc91e91d</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinTree.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinTree.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinTree.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>d5286e63-4cd6-40e3-a40b-e4752814031b</RecID>
      <AssemblyFullName>System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Xml.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>4db621b2-85c3-4df7-9856-df5c3411785a</RecID>
      <AssemblyFullName>CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.CrystalReports.Engine.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>d3a82c2f-2cdb-43e7-9314-401f8ce04dea</RecID>
      <AssemblyFullName>CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.Shared.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Shared\13.0.2000.0__692fbea5521e1304\CrystalDecisions.Shared.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>e0252b69-3282-4f91-af5a-aadc1ef52a27</RecID>
      <AssemblyFullName>CrystalDecisions.Windows.Forms, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.Windows.Forms.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Windows.Forms\13.0.2000.0__692fbea5521e1304\CrystalDecisions.Windows.Forms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>ac451fea-1815-4da7-8eb9-5982c3bdd2bf</RecID>
      <AssemblyFullName>ZetaHtmlEditControl, Version=1.1.0.3, Culture=neutral, PublicKeyToken=2e2e5ba5da72b6c0</AssemblyFullName>
      <AssemblyName>ZetaHtmlEditControl.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\ZetaHtmlEditControl.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>298caea2-fa03-4bc5-835f-742add8eac08</RecID>
      <AssemblyFullName>Infragistics4.Win.AppStylistSupport.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.AppStylistSupport.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.AppStylistSupport.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>5f68354f-01db-4b92-a056-163ada8be8c9</RecID>
      <AssemblyFullName>JiwaLib, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaLib.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaLib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>1094d62f-b8fd-47ef-ab9a-d1ec598aea4b</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinSchedule.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinSchedule.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinSchedule.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>17785010-7d80-4c39-8720-e43dd9163dc6</RecID>
      <AssemblyFullName>Infragistics4.Win.UltraWinGrid.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Win.UltraWinGrid.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Win.UltraWinGrid.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>891037c7-79d7-4d9e-a6a7-a5d487693e91</RecID>
      <AssemblyFullName>Microsoft.SqlServer.Dac, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>Microsoft.SqlServer.Dac.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Microsoft.SqlServer.Dac.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c5c35339-340a-4368-9a29-37cf7225a296</RecID>
      <AssemblyFullName>JiwaEncryption, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaEncryption.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaEncryption.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>dd6744ba-488d-4107-a638-db98c3ca725c</RecID>
      <AssemblyFullName>System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Runtime.Serialization.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>7e8db53e-60af-4840-8652-03bc6f816b3d</RecID>
      <AssemblyFullName>Infragistics4.Shared.v13.1, Version=13.1.20131.2060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb</AssemblyFullName>
      <AssemblyName>Infragistics4.Shared.v13.1.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\Infragistics4.Shared.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>1c016240-63b0-4204-88b0-48d66794af6d</RecID>
      <AssemblyFullName>System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Core.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>12b6334e-26b8-456a-b772-b1284dad2099</RecID>
      <AssemblyFullName>JiwaSendEmail, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaSendEmail.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaSendEmail.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>13fefc98-06d1-42bb-8d7d-564643dc711a</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.ClientDoc.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\13.0.2000.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ClientDoc.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>76519b6c-46a0-49f8-9eb1-5ebbfb8ffdf2</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.Controllers.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.Controllers\13.0.2000.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.Controllers.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>0e059e20-eb44-4bd9-ac2a-555ace75b8ba</RecID>
      <AssemblyFullName>CrystalDecisions.ReportAppServer.ReportDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304</AssemblyFullName>
      <AssemblyName>CrystalDecisions.ReportAppServer.ReportDefModel.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ReportDefModel\13.0.2000.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ReportDefModel.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>634345ca-3209-4c38-a8e6-65a2dea28c0b</RecID>
      <AssemblyFullName>FarPoint.Win, Version=7.35.20132.1, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\FarPoint.Win.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c6a9dd35-7612-4471-87a0-e9ca5d725ed8</RecID>
      <AssemblyFullName>System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>System.Security.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>bd49cf4d-025f-4bdd-97c3-f7309ffae419</RecID>
      <AssemblyFullName>JiwaImportQManager, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaImportQManager.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaImportQManager.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>a3d48305-f33b-4dcf-a983-8942b0ccb944</RecID>
      <AssemblyFullName>JiwaSales, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaSales.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaSales.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>08c0d47a-cf82-48db-a381-82a481839a74</RecID>
      <AssemblyFullName>JiwaJournalSets, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaJournalSets.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaJournalSets.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>b9f0364d-3c7c-45af-af6f-2d3e7ce15773</RecID>
      <AssemblyFullName>JiwaPurchaseOrders, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaPurchaseOrders.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaPurchaseOrders.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>8be9914e-9236-4a96-86c4-042101c09c69</RecID>
      <AssemblyFullName>JiwaStockTransfer, Version=7.0.117.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaStockTransfer.dll</AssemblyName>
      <AssemblyLocation>C:\Program Files (x86)\Jiwa Financials\Jiwa 7\JiwaStockTransfer.dll</AssemblyLocation>
    </Reference>
  </ReferenceCollection>
</JiwaDocument>