﻿<?xml version="1.0" encoding="utf-16"?>
<JiwaDocument xmlns:jiwa="http://www.jiwa.com.au/xml/schemas" Type="Plugin">
  <RecID>4c2e197b-5dca-4ec6-9f14-1422bda1b3d4</RecID>
  <Name>Purchase Order Reorder Method - Replenish to Minimum NO DIALOG</Name>
  <Description />
  <IsEnabled>true</IsEnabled>
  <IsIsolatedToOwnAppDomain>false</IsIsolatedToOwnAppDomain>
  <ExecutionOrder>0</ExecutionOrder>
  <Author>Jiwa Financials</Author>
  <Version>7.0.79.0</Version>
  <Code>Imports JiwaFinancials.Jiwa
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports System
Imports FarPoint.Win.Spread
Imports JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid
Imports System.Drawing
Imports System.Data
Imports System.Data.SqlClient	
Imports System.Collections.Generic 

Public Class FormPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaFormPlugin
	
	Private purchaseOrderForm As JiwaPurchaseOrdersUI.MainForm
	
    Overrides Public Function InitializeLifetimeService() As Object
        ' returning null here will prevent the lease manager
        ' from deleting the Object.
        Return Nothing
    End Function

#Region "Setup"
    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
		purchaseOrderForm = DirectCast(JiwaForm, JiwaPurchaseOrdersUI.MainForm)

		AddHandler purchaseOrderForm.FormClosed , AddressOf CleanupHandlers
		AddHandler purchaseOrderForm.AutoSearchUltraButton.Click, AddressOf AutoSearchUltraButton_Click	
		AddHandler purchaseOrderForm.PurchaseOrder.Lines.Added, AddressOf purchaseOrderForm_PurchaseOrder_Lines_Added
    End Sub


#End Region
	Private Sub CleanupHandlers
		RemoveHandler purchaseOrderForm.AutoSearchUltraButton.Click, AddressOf AutoSearchUltraButton_Click
	End Sub

	Private Sub purchaseOrderForm_PurchaseOrder_Lines_Added(item As JiwaPurchaseOrders.Line)
		If purchaseOrderForm.PurchaseOrder.IsAutoReordering = False And item.LineType = JiwaPurchaseOrders.Line.OrderLineType.Inventory And purchaseOrderForm.PurchaseOrder.OrderType &lt;&gt; JiwaPurchaseOrders.PurchaseOrder.PurchaseOrderType.BackToBack Then
			If Not purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem Is Nothing Then
	            If Not purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem.DataValue Is Nothing Then
	                Dim reorderMethod As JiwaApplication.IJiwaPurchaseOrderReorderMethod = TryCast(purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem.DataValue, JiwaApplication.IJiwaPurchaseOrderReorderMethod)
	                If Not reorderMethod Is Nothing Then
	                    If reorderMethod.name = "Replenish to Minimum" Then	
							Dim MyReplenishToMinimumMethod As ReplenishToMinimumReorderMethod = DirectCast(reorderMethod, ReplenishToMinimumReorderMethod)
							If MyReplenishToMinimumMethod.HasBeenRunOnceThisSession = True Then
								Dim reorderMethodStartParameters(7) As Object
								reorderMethodStartParameters(0) = MyReplenishToMinimumMethod.SP_Month
						        reorderMethodStartParameters(1) = IIf(MyReplenishToMinimumMethod.SP_SlowItem = 1, True,False)
						        reorderMethodStartParameters(2) = IIf(MyReplenishToMinimumMethod.SP_ObsoleteItem = 1, True,False)
						        reorderMethodStartParameters(3) = IIf(MyReplenishToMinimumMethod.SP_IncludeSalesOrder = 1, True,False)
						        reorderMethodStartParameters(4) = IIf(MyReplenishToMinimumMethod.SP_IncludeForwardOrder = 1, True,False)
						        reorderMethodStartParameters(5) = MyReplenishToMinimumMethod.SP_FOrderDateFrom
						        reorderMethodStartParameters(6) = MyReplenishToMinimumMethod.SP_FOrderDateTo
						        reorderMethodStartParameters(7) = MyReplenishToMinimumMethod.SP_IncludeBOMParent
								reorderMethod.LineExecute(item.RecID, reorderMethodStartParameters)								
							Else
						        Dim StartParameters(7) As Object
						        StartParameters(0) = DateAndTime.Month(JiwaApplication.Manager.Instance.Database.SysDateTime)
						        StartParameters(1) = False
						        StartParameters(2) = False
						        StartParameters(3) = False
						        StartParameters(4) = False
						        StartParameters(5) = Now
						        StartParameters(6) = Now
						        StartParameters(7) = 0
								
								'Dim MyReplenishToMinimumDialog As New ReplenishToMinimumDialog
								'MyReplenishToMinimumDialog.Start("", StartParameters)
						        'MyReplenishToMinimumDialog.Icon = purchaseOrderForm.Icon
						        'If MyReplenishToMinimumDialog.ShowDialog = DialogResult.OK Then
								Dim reorderMethodStartParameters(7) As Object
								reorderMethodStartParameters(0) = Month(JiwaApplication.Manager.Instance.SysDateTime) ' Month
						        reorderMethodStartParameters(1) = False ' MyReplenishToMinimumDialog.IncludeSlowMovingItems
						        reorderMethodStartParameters(2) = False ' MyReplenishToMinimumDialog.IncludeObsoleteItems
						        reorderMethodStartParameters(3) = False ' MyReplenishToMinimumDialog.IncludeBackordersOnUnprocessedSalesOrders
						        reorderMethodStartParameters(4) = False ' MyReplenishToMinimumDialog.IncludeForwardOrders
						        reorderMethodStartParameters(5) = JiwaApplication.Manager.Instance.SysDateTime ' MyReplenishToMinimumDialog.ForwardOrderFromDate
						        reorderMethodStartParameters(6) = JiwaApplication.Manager.Instance.SysDateTime ' MyReplenishToMinimumDialog.ForwardOrderToDate
						        reorderMethodStartParameters(7) = 0 'MyReplenishToMinimumDialog.BillOfMaterialsOption
								reorderMethod.LineExecute(item.RecID, reorderMethodStartParameters)
						        'End If	        	
							End If
						End If
	                End If
	            End If
	        End If
		End If
	End Sub

	
    Private Sub AutoSearchUltraButton_Click(sender As System.Object, e As System.EventArgs)
        If Not purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem Is Nothing Then
            If Not purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem.DataValue Is Nothing Then
                Dim reorderMethod As JiwaApplication.IJiwaPurchaseOrderReorderMethod = TryCast(purchaseOrderForm.ReorderMethodsUltraComboEditor.SelectedItem.DataValue, JiwaApplication.IJiwaPurchaseOrderReorderMethod)
                If Not reorderMethod Is Nothing Then
                    If reorderMethod.name = "Replenish to Minimum" Then					
				        Dim StartParameters(7) As Object
				        StartParameters(0) = DateAndTime.Month(JiwaApplication.Manager.Instance.Database.SysDateTime)
				        StartParameters(1) = False
				        StartParameters(2) = False
				        StartParameters(3) = False
				        StartParameters(4) = False
				        StartParameters(5) = Now
				        StartParameters(6) = Now
				        StartParameters(7) = 0
						
				        'Dim MyReplenishToMinimumDialog As New ReplenishToMinimumDialog
						'MyReplenishToMinimumDialog.Start("", StartParameters)
				        'MyReplenishToMinimumDialog.Icon = purchaseOrderForm.Icon
				        'If MyReplenishToMinimumDialog.ShowDialog = DialogResult.OK Then
							Dim reorderMethodStartParameters(7) As Object
							reorderMethodStartParameters(0) = Month(JiwaApplication.Manager.Instance.SysDateTime) ' Month
					        reorderMethodStartParameters(1) = False ' MyReplenishToMinimumDialog.IncludeSlowMovingItems
					        reorderMethodStartParameters(2) = False ' MyReplenishToMinimumDialog.IncludeObsoleteItems
					        reorderMethodStartParameters(3) = False ' MyReplenishToMinimumDialog.IncludeBackordersOnUnprocessedSalesOrders
					        reorderMethodStartParameters(4) = False ' MyReplenishToMinimumDialog.IncludeForwardOrders
					        reorderMethodStartParameters(5) = JiwaApplication.Manager.Instance.SysDateTime ' MyReplenishToMinimumDialog.ForwardOrderFromDate
					        reorderMethodStartParameters(6) = JiwaApplication.Manager.Instance.SysDateTime ' MyReplenishToMinimumDialog.ForwardOrderToDate
					        reorderMethodStartParameters(7) = 0 'MyReplenishToMinimumDialog.BillOfMaterialsOption
							reorderMethod.Execute(reorderMethodStartParameters)
				        'End If						
					End If
                End If
            End If
        End If
    End Sub

End Class

Public Class ReplenishToMinimumDialog
	Inherits System.Windows.Forms.Form
	
#Region "Variables"
    Private _Month As Integer = DateAndTime.Month(Now)
    Private _IncludeSlowMovingItems As Boolean
    Private _IncludeObsoleteItems As Boolean
    Private _IncludeBackordersOnUnprocessedSalesOrders As Boolean
    Private _IncludeForwardOrders As Boolean
    Private _ForwardOrderFromDate As Date = Now
    Private _ForwardOrderToDate As Date = Now
    Private _BillOfMaterialsOption As Integer
#End Region

#Region "Properties"
    Public Property Month As Integer
        Get
            Return _Month
        End Get
        Set(value As Integer)
            _Month = value
        End Set
    End Property

    Public Property IncludeSlowMovingItems As Boolean
        Get
            Return _IncludeSlowMovingItems
        End Get
        Set(value As Boolean)
            _IncludeSlowMovingItems = value
        End Set
    End Property

    Public Property IncludeObsoleteItems As Boolean
        Get
            Return _IncludeObsoleteItems
        End Get
        Set(value As Boolean)
            _IncludeObsoleteItems = value
        End Set
    End Property

    Public Property IncludeBackordersOnUnprocessedSalesOrders As Boolean
        Get
            Return _IncludeBackordersOnUnprocessedSalesOrders
        End Get
        Set(value As Boolean)
            _IncludeBackordersOnUnprocessedSalesOrders = value
        End Set
    End Property

    Public Property IncludeForwardOrders As Boolean
        Get
            Return _IncludeForwardOrders
        End Get
        Set(value As Boolean)
            _IncludeForwardOrders = value
        End Set
    End Property

    Public Property ForwardOrderFromDate As Date
        Get
            Return _ForwardOrderFromDate
        End Get
        Set(value As Date)
            _ForwardOrderFromDate = value
        End Set
    End Property

    Public Property ForwardOrderToDate As Date
        Get
            Return _ForwardOrderToDate
        End Get
        Set(value As Date)
            _ForwardOrderToDate = value
        End Set
    End Property

    Public Property BillOfMaterialsOption As Integer
        Get
            Return _BillOfMaterialsOption
        End Get
        Set(value As Integer)
            _BillOfMaterialsOption = value
        End Set
    End Property
#End Region

#Region "Setup"
    Public Overloads Function ShowDialog(owner As System.Windows.Forms.IWin32Window) As System.Windows.Forms.DialogResult
        Return MyBase.ShowDialog(owner)
    End Function

    Public Sub Start(Context As String, StartParameters() As Object)
        Month = StartParameters(0)
        IncludeSlowMovingItems = StartParameters(1)
        IncludeObsoleteItems = StartParameters(2)
        IncludeBackordersOnUnprocessedSalesOrders = StartParameters(3)
        IncludeForwardOrders = StartParameters(4)
        ForwardOrderFromDate = StartParameters(5)
        ForwardOrderToDate = StartParameters(6)
        BillOfMaterialsOption = StartParameters(7)
		SetupForm()
    End Sub

    Public Sub SetupForm()
		ReorderMonthUltraComboEditor.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList 
        For MyLoop As Integer = 1 To 12
            ReorderMonthUltraComboEditor.Items.Add(MyLoop, MonthName(MyLoop, True))
        Next MyLoop

        If _Month &gt; 0 And _Month &lt;= ReorderMonthUltraComboEditor.Items.Count Then
            ReorderMonthUltraComboEditor.SelectedIndex = _Month - 1
        Else
            If Now.Day &lt; 20 Then
                ReorderMonthUltraComboEditor.SelectedIndex = DateAndTime.Month(Now) - 1
            Else
                ReorderMonthUltraComboEditor.SelectedIndex = IIf(DateAndTime.Month(Now) &lt;&gt; 12, DateAndTime.Month(Now), 0)
            End If
        End If

        IncludeObsoleteItemsUltraCheckEditor.Checked = _IncludeObsoleteItems
        IncludeSlowMovingItemsUltraCheckEditor.Checked = _IncludeSlowMovingItems
        IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Checked = _IncludeBackordersOnUnprocessedSalesOrders
        IncludeForwardOrdersUltraCheckEditor.Checked = _IncludeForwardOrders

        FromUltraDateTimeEditor.Value = _ForwardOrderFromDate
        ToUltraDateTimeEditor.Value = _ForwardOrderToDate

		BillOfMaterialsUltraComboEditor.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList 
        With BillOfMaterialsUltraComboEditor
            .Items.Add(0, "Exclude BOM Parents")
            .Items.Add(1, "Include BOM Parents")
            .Items.Add(2, "Only BOM Parents")
            .SelectedIndex = 0
        End With
	
        If _BillOfMaterialsOption &gt;= 0 And _BillOfMaterialsOption &lt; BillOfMaterialsUltraComboEditor.Items.Count Then
            BillOfMaterialsUltraComboEditor.SelectedIndex = _BillOfMaterialsOption
        End If

        AddHandler OKUltraButton.Click, AddressOf OKUltraButton_Click
        AddHandler CancelUltraButton.Click, AddressOf CancelUltraButton_Click
        AddHandler ReorderMonthUltraComboEditor.AfterCloseUp, AddressOf ReorderMonthUltraComboEditor_AfterCloseUp
        AddHandler IncludeSlowMovingItemsUltraCheckEditor.CheckedChanged, AddressOf IncludeSlowMovingItemsUltraCheckEditor_CheckedChanged
        AddHandler IncludeObsoleteItemsUltraCheckEditor.CheckedChanged, AddressOf IncludeObsoleteItemsUltraCheckEditor_CheckedChanged
        AddHandler IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.CheckedChanged, AddressOf IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor_CheckedChanged
        AddHandler IncludeForwardOrdersUltraCheckEditor.CheckedChanged, AddressOf IncludeForwardOrdersUltraCheckEditor_CheckedChanged
        AddHandler FromUltraDateTimeEditor.ValueChanged, AddressOf FromUltraDateTimeEditor_ValueChanged
        AddHandler ToUltraDateTimeEditor.ValueChanged, AddressOf ToUltraDateTimeEditor_ValueChanged
        AddHandler BillOfMaterialsUltraComboEditor.AfterCloseUp, AddressOf BillOfMaterialsUltraComboEditor_AfterCloseUp
    End Sub
#End Region

#Region "Control event handlers"
    Private Sub IncludeSlowMovingItemsUltraCheckEditor_CheckedChanged(sender As System.Object, e As System.EventArgs)
        IncludeSlowMovingItems = IncludeSlowMovingItemsUltraCheckEditor.Checked
    End Sub

    Private Sub IncludeObsoleteItemsUltraCheckEditor_CheckedChanged(sender As System.Object, e As System.EventArgs)
        IncludeObsoleteItems = IncludeObsoleteItemsUltraCheckEditor.Checked
    End Sub

    Private Sub IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor_CheckedChanged(sender As System.Object, e As System.EventArgs)
        IncludeBackordersOnUnprocessedSalesOrders = IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Checked
    End Sub

    Private Sub IncludeForwardOrdersUltraCheckEditor_CheckedChanged(sender As System.Object, e As System.EventArgs)
        IncludeForwardOrders = IncludeForwardOrdersUltraCheckEditor.Checked
    End Sub

    Private Sub ReorderMonthUltraComboEditor_AfterCloseUp(sender As Object, e As System.EventArgs)
        _Month = ReorderMonthUltraComboEditor.SelectedIndex + 1
    End Sub

    Private Sub FromUltraDateTimeEditor_ValueChanged(sender As System.Object, e As System.EventArgs)
        ForwardOrderFromDate = FromUltraDateTimeEditor.Value
    End Sub

    Private Sub ToUltraDateTimeEditor_ValueChanged(sender As System.Object, e As System.EventArgs)
        ForwardOrderToDate = ToUltraDateTimeEditor.Value
    End Sub

    Private Sub BillOfMaterialsUltraComboEditor_AfterCloseUp(sender As Object, e As System.EventArgs)
        _BillOfMaterialsOption = BillOfMaterialsUltraComboEditor.SelectedIndex + 1
    End Sub

    Private Sub OKUltraButton_Click(sender As System.Object, e As System.EventArgs)
        DialogResult = System.Windows.Forms.DialogResult.OK
    End Sub

    Private Sub CancelUltraButton_Click(sender As System.Object, e As System.EventArgs)
        DialogResult = System.Windows.Forms.DialogResult.Cancel
    End Sub
#End Region	

#Region "Designer"
    Public Sub New()
        InitializeComponent()
    End Sub

 'Form overrides dispose to clean up the component list.
    &lt;System.Diagnostics.DebuggerNonUserCode()&gt; _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Icontainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    &lt;System.Diagnostics.DebuggerStepThrough()&gt; _
    Private Sub InitializeComponent()
        Dim Appearance4 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
        Dim Appearance2 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
        Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
        Dim Appearance3 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
        Me.ReorderMonthUltraLabel = New Infragistics.Win.Misc.UltraLabel()
        Me.ReorderMonthUltraComboEditor = New Infragistics.Win.UltraWinEditors.UltraComboEditor()
        Me.IncludeSlowMovingItemsUltraCheckEditor = New Infragistics.Win.UltraWinEditors.UltraCheckEditor()
        Me.IncludeObsoleteItemsUltraCheckEditor = New Infragistics.Win.UltraWinEditors.UltraCheckEditor()
        Me.IncludeForwardOrdersUltraCheckEditor = New Infragistics.Win.UltraWinEditors.UltraCheckEditor()
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor = New Infragistics.Win.UltraWinEditors.UltraCheckEditor()
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox = New Infragistics.Win.Misc.UltraGroupBox()
        Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
        Me.ToUltraLabel = New Infragistics.Win.Misc.UltraLabel()
        Me.ToUltraDateTimeEditor = New Infragistics.Win.UltraWinEditors.UltraDateTimeEditor()
        Me.FromUltraDateTimeEditor = New Infragistics.Win.UltraWinEditors.UltraDateTimeEditor()
        Me.FromUltraLabel = New Infragistics.Win.Misc.UltraLabel()
        Me.BillOfMaterialsUltraLabel = New Infragistics.Win.Misc.UltraLabel()
        Me.BillOfMaterialsUltraComboEditor = New Infragistics.Win.UltraWinEditors.UltraComboEditor()
        Me.CancelUltraButton = New Infragistics.Win.Misc.UltraButton()
        Me.OKUltraButton = New Infragistics.Win.Misc.UltraButton()
        CType(Me.ReorderMonthUltraComboEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.IncludeSlowMovingItemsUltraCheckEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.IncludeObsoleteItemsUltraCheckEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.IncludeForwardOrdersUltraCheckEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.SuspendLayout()
        Me.TableLayoutPanel1.SuspendLayout()
        CType(Me.ToUltraDateTimeEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.FromUltraDateTimeEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.BillOfMaterialsUltraComboEditor, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'ReorderMonthUltraLabel
        '
        Appearance4.TextVAlignAsString = "Middle"
        Me.ReorderMonthUltraLabel.Appearance = Appearance4
        Me.ReorderMonthUltraLabel.Location = New System.Drawing.Point(12, 12)
        Me.ReorderMonthUltraLabel.Name = "ReorderMonthUltraLabel"
        Me.ReorderMonthUltraLabel.Size = New System.Drawing.Size(100, 22)
        Me.ReorderMonthUltraLabel.TabIndex = 1
        Me.ReorderMonthUltraLabel.Text = "Reorder Month"
        '
        'ReorderMonthUltraComboEditor
        '
        Me.ReorderMonthUltraComboEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.ReorderMonthUltraComboEditor.Location = New System.Drawing.Point(158, 12)
        Me.ReorderMonthUltraComboEditor.Name = "ReorderMonthUltraComboEditor"
        Me.ReorderMonthUltraComboEditor.Size = New System.Drawing.Size(132, 21)
        Me.ReorderMonthUltraComboEditor.TabIndex = 43
        '
        'IncludeSlowMovingItemsUltraCheckEditor
        '
        Me.IncludeSlowMovingItemsUltraCheckEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.IncludeSlowMovingItemsUltraCheckEditor.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.IncludeSlowMovingItemsUltraCheckEditor.Location = New System.Drawing.Point(12, 40)
        Me.IncludeSlowMovingItemsUltraCheckEditor.Name = "IncludeSlowMovingItemsUltraCheckEditor"
        Me.IncludeSlowMovingItemsUltraCheckEditor.Size = New System.Drawing.Size(278, 20)
        Me.IncludeSlowMovingItemsUltraCheckEditor.TabIndex = 44
        Me.IncludeSlowMovingItemsUltraCheckEditor.Text = "Include Slow Moving Items"
        '
        'IncludeObsoleteItemsUltraCheckEditor
        '
        Me.IncludeObsoleteItemsUltraCheckEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.IncludeObsoleteItemsUltraCheckEditor.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.IncludeObsoleteItemsUltraCheckEditor.Location = New System.Drawing.Point(12, 66)
        Me.IncludeObsoleteItemsUltraCheckEditor.Name = "IncludeObsoleteItemsUltraCheckEditor"
        Me.IncludeObsoleteItemsUltraCheckEditor.Size = New System.Drawing.Size(278, 20)
        Me.IncludeObsoleteItemsUltraCheckEditor.TabIndex = 45
        Me.IncludeObsoleteItemsUltraCheckEditor.Text = "Include Obsolete Items"
        '
        'IncludeForwardOrdersUltraCheckEditor
        '
        Me.IncludeForwardOrdersUltraCheckEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.IncludeForwardOrdersUltraCheckEditor.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.IncludeForwardOrdersUltraCheckEditor.Location = New System.Drawing.Point(12, 118)
        Me.IncludeForwardOrdersUltraCheckEditor.Name = "IncludeForwardOrdersUltraCheckEditor"
        Me.IncludeForwardOrdersUltraCheckEditor.Size = New System.Drawing.Size(278, 20)
        Me.IncludeForwardOrdersUltraCheckEditor.TabIndex = 46
        Me.IncludeForwardOrdersUltraCheckEditor.Text = "Include Forward Orders"
        '
        'IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor
        '
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.CheckAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Location = New System.Drawing.Point(12, 92)
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Name = "IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor"
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Size = New System.Drawing.Size(278, 20)
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.TabIndex = 47
        Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor.Text = "Include Backorders On Unprocessed Sales Orders"
        '
        'ForwardOrderExpectedDeliveryDateRangeUltraGroupBox
        '
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Controls.Add(Me.TableLayoutPanel1)
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Location = New System.Drawing.Point(12, 154)
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Name = "ForwardOrderExpectedDeliveryDateRangeUltraGroupBox"
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Size = New System.Drawing.Size(278, 79)
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.TabIndex = 48
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.Text = "Forward Order Expected Delivery Date Range"
        '
        'TableLayoutPanel1
        '
        Me.TableLayoutPanel1.ColumnCount = 4
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.0!))
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.0!))
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15.0!))
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.0!))
        Me.TableLayoutPanel1.Controls.Add(Me.ToUltraLabel, 2, 1)
        Me.TableLayoutPanel1.Controls.Add(Me.ToUltraDateTimeEditor, 3, 1)
        Me.TableLayoutPanel1.Controls.Add(Me.FromUltraDateTimeEditor, 1, 1)
        Me.TableLayoutPanel1.Controls.Add(Me.FromUltraLabel, 0, 1)
        Me.TableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.TableLayoutPanel1.Location = New System.Drawing.Point(3, 16)
        Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
        Me.TableLayoutPanel1.RowCount = 3
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.Size = New System.Drawing.Size(272, 60)
        Me.TableLayoutPanel1.TabIndex = 0
        '
        'ToUltraLabel
        '
        Appearance2.TextHAlignAsString = "Right"
        Appearance2.TextVAlignAsString = "Middle"
        Me.ToUltraLabel.Appearance = Appearance2
        Me.ToUltraLabel.Dock = System.Windows.Forms.DockStyle.Fill
        Me.ToUltraLabel.Location = New System.Drawing.Point(138, 19)
        Me.ToUltraLabel.Name = "ToUltraLabel"
        Me.ToUltraLabel.Size = New System.Drawing.Size(34, 22)
        Me.ToUltraLabel.TabIndex = 50
        Me.ToUltraLabel.Text = "To"
        '
        'ToUltraDateTimeEditor
        '
        Me.ToUltraDateTimeEditor.DateTime = New Date(2011, 3, 24, 0, 0, 0, 0)
        Me.ToUltraDateTimeEditor.Dock = System.Windows.Forms.DockStyle.Fill
        Me.ToUltraDateTimeEditor.Location = New System.Drawing.Point(178, 19)
        Me.ToUltraDateTimeEditor.Name = "ToUltraDateTimeEditor"
        Me.ToUltraDateTimeEditor.Size = New System.Drawing.Size(91, 21)
        Me.ToUltraDateTimeEditor.TabIndex = 49
        Me.ToUltraDateTimeEditor.Value = New Date(2011, 3, 24, 0, 0, 0, 0)
        '
        'FromUltraDateTimeEditor
        '
        Me.FromUltraDateTimeEditor.DateTime = New Date(2011, 3, 24, 0, 0, 0, 0)
        Me.FromUltraDateTimeEditor.Dock = System.Windows.Forms.DockStyle.Fill
        Me.FromUltraDateTimeEditor.Location = New System.Drawing.Point(43, 19)
        Me.FromUltraDateTimeEditor.Name = "FromUltraDateTimeEditor"
        Me.FromUltraDateTimeEditor.Size = New System.Drawing.Size(89, 21)
        Me.FromUltraDateTimeEditor.TabIndex = 51
        Me.FromUltraDateTimeEditor.Value = New Date(2011, 3, 24, 0, 0, 0, 0)
        '
        'FromUltraLabel
        '
        Appearance1.TextHAlignAsString = "Right"
        Appearance1.TextVAlignAsString = "Middle"
        Me.FromUltraLabel.Appearance = Appearance1
        Me.FromUltraLabel.Dock = System.Windows.Forms.DockStyle.Fill
        Me.FromUltraLabel.Location = New System.Drawing.Point(3, 19)
        Me.FromUltraLabel.Name = "FromUltraLabel"
        Me.FromUltraLabel.Size = New System.Drawing.Size(34, 22)
        Me.FromUltraLabel.TabIndex = 52
        Me.FromUltraLabel.Text = "From"
        '
        'BillOfMaterialsUltraLabel
        '
        Me.BillOfMaterialsUltraLabel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Appearance3.TextVAlignAsString = "Middle"
        Me.BillOfMaterialsUltraLabel.Appearance = Appearance3
        Me.BillOfMaterialsUltraLabel.Location = New System.Drawing.Point(12, 248)
        Me.BillOfMaterialsUltraLabel.Name = "BillOfMaterialsUltraLabel"
        Me.BillOfMaterialsUltraLabel.Size = New System.Drawing.Size(100, 22)
        Me.BillOfMaterialsUltraLabel.TabIndex = 49
        Me.BillOfMaterialsUltraLabel.Text = "Bill Of Materials"
        '
        'BillOfMaterialsUltraComboEditor
        '
        Me.BillOfMaterialsUltraComboEditor.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.BillOfMaterialsUltraComboEditor.Location = New System.Drawing.Point(18, 276)
        Me.BillOfMaterialsUltraComboEditor.Name = "BillOfMaterialsUltraComboEditor"
        Me.BillOfMaterialsUltraComboEditor.Size = New System.Drawing.Size(272, 21)
        Me.BillOfMaterialsUltraComboEditor.TabIndex = 50
        '
        'CancelUltraButton
        '
        Me.CancelUltraButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.CancelUltraButton.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.CancelUltraButton.Location = New System.Drawing.Point(218, 313)
        Me.CancelUltraButton.Name = "CancelUltraButton"
        Me.CancelUltraButton.Size = New System.Drawing.Size(75, 23)
        Me.CancelUltraButton.TabIndex = 51
        Me.CancelUltraButton.Text = "Cancel"
        '
        'OKUltraButton
        '
        Me.OKUltraButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.OKUltraButton.Location = New System.Drawing.Point(137, 313)
        Me.OKUltraButton.Name = "OKUltraButton"
        Me.OKUltraButton.Size = New System.Drawing.Size(75, 23)
        Me.OKUltraButton.TabIndex = 52
        Me.OKUltraButton.Text = "OK"
        '
        'ReplenishToMinimum
        '
        Me.AcceptButton = Me.OKUltraButton
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.CancelUltraButton
        Me.ClientSize = New System.Drawing.Size(305, 347)
        Me.Controls.Add(Me.OKUltraButton)
        Me.Controls.Add(Me.CancelUltraButton)
        Me.Controls.Add(Me.BillOfMaterialsUltraComboEditor)
        Me.Controls.Add(Me.BillOfMaterialsUltraLabel)
        Me.Controls.Add(Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox)
        Me.Controls.Add(Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor)
        Me.Controls.Add(Me.IncludeForwardOrdersUltraCheckEditor)
        Me.Controls.Add(Me.IncludeObsoleteItemsUltraCheckEditor)
        Me.Controls.Add(Me.IncludeSlowMovingItemsUltraCheckEditor)
        Me.Controls.Add(Me.ReorderMonthUltraComboEditor)
        Me.Controls.Add(Me.ReorderMonthUltraLabel)
        Me.Name = "ReplenishToMinimum"
        Me.Text = "Replenish To Minimum"
        CType(Me.ReorderMonthUltraComboEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.IncludeSlowMovingItemsUltraCheckEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.IncludeObsoleteItemsUltraCheckEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.IncludeForwardOrdersUltraCheckEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ForwardOrderExpectedDeliveryDateRangeUltraGroupBox.ResumeLayout(False)
        Me.TableLayoutPanel1.ResumeLayout(False)
        Me.TableLayoutPanel1.PerformLayout()
        CType(Me.ToUltraDateTimeEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.FromUltraDateTimeEditor, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.BillOfMaterialsUltraComboEditor, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents ReorderMonthUltraLabel As Infragistics.Win.Misc.UltraLabel
    Friend WithEvents ReorderMonthUltraComboEditor As Infragistics.Win.UltraWinEditors.UltraComboEditor
    Friend WithEvents IncludeSlowMovingItemsUltraCheckEditor As Infragistics.Win.UltraWinEditors.UltraCheckEditor
    Friend WithEvents IncludeObsoleteItemsUltraCheckEditor As Infragistics.Win.UltraWinEditors.UltraCheckEditor
    Friend WithEvents IncludeForwardOrdersUltraCheckEditor As Infragistics.Win.UltraWinEditors.UltraCheckEditor
    Friend WithEvents IncludeBackordersOnUnprocessedSalesOrdersUltraCheckEditor As Infragistics.Win.UltraWinEditors.UltraCheckEditor
    Friend WithEvents ForwardOrderExpectedDeliveryDateRangeUltraGroupBox As Infragistics.Win.Misc.UltraGroupBox
    Friend WithEvents FromUltraDateTimeEditor As Infragistics.Win.UltraWinEditors.UltraDateTimeEditor
    Friend WithEvents ToUltraLabel As Infragistics.Win.Misc.UltraLabel
    Friend WithEvents ToUltraDateTimeEditor As Infragistics.Win.UltraWinEditors.UltraDateTimeEditor
    Friend WithEvents BillOfMaterialsUltraLabel As Infragistics.Win.Misc.UltraLabel
    Friend WithEvents BillOfMaterialsUltraComboEditor As Infragistics.Win.UltraWinEditors.UltraComboEditor
    Friend WithEvents CancelUltraButton As Infragistics.Win.Misc.UltraButton
    Friend WithEvents OKUltraButton As Infragistics.Win.Misc.UltraButton
    Friend WithEvents FromUltraLabel As Infragistics.Win.Misc.UltraLabel
    Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
#End region
End Class

Public Class BusinessLogicPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaBusinessLogicPlugin
	
	Private _PurchaseOrderObject As JiwaPurchaseOrders.PurchaseOrder 
	

    Overrides Public 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
		_PurchaseOrderObject = DirectCast(JiwaBusinessLogic, JiwaPurchaseOrders.PurchaseOrder)
			
		Dim reorderMethod As ReplenishToMinimumReorderMethod  = New  ReplenishToMinimumReorderMethod
		reorderMethod.Name = "Replenish to Minimum"
		reorderMethod.Description = ""	
		
	
		Dim oldIsReading As Boolean = _PurchaseOrderObject.IsReading 
		
		Try
			_PurchaseOrderObject.IsReading = True
			_PurchaseOrderObject.ReOrderMethods.add(reorderMethod)
		Finally
			_PurchaseOrderObject.IsReading  = oldIsReading
		End Try		
		
    End Sub


	
End Class

Public Class ReplenishToMinimumReorderMethod
	Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod
	
	Private _Name As String = ""
	Private _Description As String = ""
	Private _Collection As System.Collections.Ienumerable 
	Private _HasBeenRunOnceThisSession As Boolean
	Private _SP_Month As Integer
	Private _SP_SlowItem As Integer
	Private _SP_ObsoleteItem As Integer
	Private _SP_IncludeSalesOrder As Integer
	Private _SP_IncludeForwardOrder As Integer
	Private _SP_FOrderDateFrom As Date = Now
	Private _SP_FOrderDateTo As Date = Now
	Private _SP_IncludeBOMParent As Integer
	
	Public Property Name As String Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod.Name
        Get
			Return _Name
        End Get
        Set(value As String)
			_Name = value
        End Set
    End Property
	
	Public Property Description As String Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod.Description
        Get
			Return _Description
        End Get
        Set(value As String)
			_Description = value
        End Set
    End Property

    Public Property Collection As System.Collections.Ienumerable  Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod.Collection
        Get
			Return _Collection
        End Get
        Set(value As System.Collections.Ienumerable)
			_Collection = value
        End Set
    End Property

    Public Property HasBeenRunOnceThisSession As Integer
        Get
			Return _HasBeenRunOnceThisSession
        End Get
        Set(value As Integer)
			_HasBeenRunOnceThisSession = value
        End Set
    End Property

Public Property SP_Month As Integer
        Get
			Return _SP_Month
        End Get
        Set(value As Integer)
			_SP_Month = value
        End Set
    End Property

    Public Property SP_SlowItem As Integer
        Get
			Return _SP_SlowItem
        End Get
        Set(value As Integer)
			_SP_SlowItem = value
        End Set
    End Property

    Public Property SP_ObsoleteItem As Integer
        Get
			Return _SP_ObsoleteItem
        End Get
        Set(value As Integer)
			_SP_ObsoleteItem = value
        End Set
    End Property

    Public Property SP_IncludeSalesOrder As Integer
        Get
			Return _SP_IncludeSalesOrder
        End Get
        Set(value As Integer)
			_SP_IncludeSalesOrder = value
        End Set
    End Property

    Public Property SP_IncludeForwardOrder As Integer
        Get
			Return _SP_IncludeForwardOrder
        End Get
        Set(value As Integer)
			_SP_IncludeForwardOrder = value
        End Set
    End Property

    Public Property SP_FOrderDateFrom As Date
        Get
			Return _SP_FOrderDateFrom
        End Get
        Set(value As Date)
			_SP_FOrderDateFrom = value
        End Set
    End Property

    Public Property SP_FOrderDateTo As Date
        Get
			Return _SP_FOrderDateTo
        End Get
        Set(value As Date)
			_SP_FOrderDateTo = value
        End Set
    End Property

    Public Property SP_IncludeBOMParent As Integer
        Get
			Return _SP_IncludeBOMParent
        End Get
        Set(value As Integer)
			_SP_IncludeBOMParent = value
        End Set
    End Property

    Public Sub Execute(StartParameters() As Object) Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod.Execute
		Dim PurchaseOrderObject As JiwaPurchaseOrders.PurchaseOrder = DirectCast(_Collection,JiwaPurchaseOrders.ReorderMethodCollection).PurchaseOrder
		Dim oldIsAutoReordering As Boolean = PurchaseOrderObject.IsAutoReordering

		Try
			
			PurchaseOrderObject.IsAutoReordering = True
			
			Dim SP_OrderType As JiwaPurchaseOrders.PurchaseOrder.SupplierType = PurchaseOrderObject.OrderSupplierType
			Dim SP_CreditorNoBegin As String = ""
			Dim SP_CreditorNoEnd As String = ""
			If SP_OrderType = JiwaPurchaseOrders.PurchaseOrder.SupplierType.Creditor   Then
				SP_CreditorNoBegin = PurchaseOrderObject.Creditor.AccountNo
				SP_CreditorNoEnd = PurchaseOrderObject.Creditor.AccountNo
			Else
				SP_CreditorNoBegin = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID  
				SP_CreditorNoEnd = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID 
			End If

			Dim SP_LogicalWarehouseName As String = PurchaseOrderObject.LogicalWarehouseResidingIn.Description   
			Dim SP_PhysicalWarehouseName As String = PurchaseOrderObject.LogicalWarehouseResidingIn.PhysicalWarehouse.Description 
			_SP_Month  = StartParameters(0)
            _SP_SlowItem = IIf(StartParameters(1) = True, 1, 0)
            _SP_ObsoleteItem= IIf(StartParameters(2) = True, 1, 0)
            _SP_IncludeSalesOrder  = IIf(StartParameters(3) = True, 1, 0)
            _SP_IncludeForwardOrder = IIf(StartParameters(4) = True, 1, 0)
			_SP_FOrderDateFrom  = StartParameters(5)
			_SP_FOrderDateTo= StartParameters(6)
			Dim SP_PartNoBegin As String = ""
			Dim SP_PartNoEnd As String = ""
			_SP_IncludeBOMParent  = StartParameters(7)
			Dim SP_CentralWarehouseID As String 
			If SP_OrderType = JiwaPurchaseOrders.PurchaseOrder.SupplierType.Creditor   Then
				SP_CentralWarehouseID = PurchaseOrderObject.Creditor.AccountNo
			Else
				SP_CentralWarehouseID = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID  
			End If	
			Dim SP_FirstGroup As Integer = 0
			
			Dim MyInventoryIDs As List(Of String)
			Dim MyQuantities As List(Of Double)
			
			ExecuteStoredProcedure(SP_OrderType, SP_CreditorNoBegin, SP_CreditorNoEnd,  SP_LogicalWarehouseName,  SP_PhysicalWarehouseName,  SP_Month, SP_SlowItem, SP_ObsoleteItem, SP_IncludeSalesOrder, SP_IncludeForwardOrder, SP_FOrderDateFrom, SP_FOrderDateTo, SP_PartNoBegin,  SP_PartNoEnd,  SP_IncludeBOMParent, SP_CentralWarehouseID,  SP_FirstGroup, MyInventoryIDs, MyQuantities)

			Dim newKey As String = ""
			Dim MyLoop As Integer=0
			For Each InventoryID As String In MyInventoryIDs
				PurchaseOrderObject.Lines.AddInventoryItem(InventoryID, newKey) 
				PurchaseOrderObject.Lines(newKey).Quantity = MyQuantities(MyLoop)
				MyLoop += 1
			Next InventoryID
		Finally
			PurchaseOrderObject.IsAutoReordering = oldIsAutoReordering
		End Try		

    End Sub

    Public Sub LineExecute(ByVal LineKey As String, StartParameters() As Object) Implements JiwaApplication.IJiwaPurchaseOrderReorderMethod.LineExecute
		Dim PurchaseOrderObject As JiwaPurchaseOrders.PurchaseOrder = DirectCast(_Collection,JiwaPurchaseOrders.ReorderMethodCollection).PurchaseOrder
		Dim oldIsAutoReordering As Boolean = PurchaseOrderObject.IsAutoReordering

		Dim SP_OrderType As JiwaPurchaseOrders.PurchaseOrder.SupplierType = PurchaseOrderObject.OrderSupplierType
		Dim SP_CreditorNoBegin As String = ""
		Dim SP_CreditorNoEnd As String = ""
		If SP_OrderType = JiwaPurchaseOrders.PurchaseOrder.SupplierType.Creditor   Then
			SP_CreditorNoBegin = PurchaseOrderObject.Creditor.AccountNo
			SP_CreditorNoEnd = PurchaseOrderObject.Creditor.AccountNo
		Else
			SP_CreditorNoBegin = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID  
			SP_CreditorNoEnd = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID 
		End If

		Dim SP_LogicalWarehouseName As String = PurchaseOrderObject.LogicalWarehouseResidingIn.Description   
		Dim SP_PhysicalWarehouseName As String = PurchaseOrderObject.LogicalWarehouseResidingIn.PhysicalWarehouse.Description 
		_SP_Month = StartParameters(0)
        _SP_SlowItem = IIf(StartParameters(1) = True, 1, 0)
        _SP_ObsoleteItem = IIf(StartParameters(2) = True, 1, 0)
        _SP_IncludeSalesOrder = IIf(StartParameters(3) = True, 1, 0)
        _SP_IncludeForwardOrder= IIf(StartParameters(4) = True, 1, 0)
		_SP_FOrderDateFrom = StartParameters(5)
		_SP_FOrderDateTo = StartParameters(6)
		Dim SP_PartNoBegin As String = PurchaseOrderObject.Lines(LineKey).PartNo
		Dim SP_PartNoEnd As String = PurchaseOrderObject.Lines(LineKey).PartNo
		_SP_IncludeBOMParent = StartParameters(7)
		Dim SP_CentralWarehouseID As String 
		If SP_OrderType = JiwaPurchaseOrders.PurchaseOrder.SupplierType.Creditor   Then
			SP_CentralWarehouseID = PurchaseOrderObject.Creditor.AccountNo
		Else
			SP_CentralWarehouseID = PurchaseOrderObject.LogicalWarehouseOrderingFrom.IN_LogicalID  
		End If	
		Dim SP_FirstGroup As Integer = 0
		
		Dim MyInventoryIDs As List(Of String)
		Dim MyQuantities As List(Of Double)
		
		ExecuteStoredProcedure(SP_OrderType, SP_CreditorNoBegin, SP_CreditorNoEnd,  SP_LogicalWarehouseName,  SP_PhysicalWarehouseName,  SP_Month, SP_SlowItem, SP_ObsoleteItem, SP_IncludeSalesOrder, SP_IncludeForwardOrder, SP_FOrderDateFrom, SP_FOrderDateTo, SP_PartNoBegin,  SP_PartNoEnd,  SP_IncludeBOMParent, SP_CentralWarehouseID,  SP_FirstGroup, MyInventoryIDs, MyQuantities, LineKey)

		Dim newKey As String = ""
		
		If MyInventoryIDs.Count &gt; 0 Then
			PurchaseOrderObject.Lines(LineKey).Quantity =MyQuantities(0)
		End If
    End Sub

    Private Sub ExecuteStoredProcedure(ByVal SP_OrderType As Integer, ByVal SP_CreditorNoBegin As String,ByVal SP_CreditorNoEnd As String, ByVal SP_LogicalWarehouseName As String, ByVal SP_PhysicalWarehouseName As String, ByVal SP_Month As Integer, ByVal SP_SlowItem As Integer, ByVal SP_ObsoleteItem As Integer, ByVal SP_IncludeSalesOrder As Integer, ByVal SP_IncludeForwardOrder As Integer, ByVal SP_FOrderDateFrom As Date, ByVal SP_FOrderDateTo As Date, ByVal SP_PartNoBegin As String, ByVal SP_PartNoEnd As String, ByVal SP_IncludeBOMParent As Integer, ByVal SP_CentralWarehouseID As String, ByVal SP_FirstGroup As Integer, ByRef InventoryIDs As List(Of String), ByRef Quantities As List(Of Double), Optional LineKey As String = "") 
	    Dim SQLParam As System.Data.SqlClient.SqlParameter = Nothing
       	Dim SQLReader As System.Data.SqlClient.SqlDataReader = Nothing

        Try
			InventoryIDs = New List(Of String)
			Quantities = New List(Of Double)
			With JiwaApplication.Manager.Instance.Database
	            Using SQLCmd As New System.Data.SqlClient.SqlCommand("usp_JIWA_PurchaseOrder_ReplenishToMinimum", .SQLConnection)
	                With SQLCmd
	                    .CommandType = CommandType.StoredProcedure
						
	                    SQLParam = New SqlParameter("@SP_OrderType", SqlDbType.Int)
	                    SQLParam.Value = SP_OrderType
	                    SQLCmd.Parameters.Add(SQLParam)
						
	                    SQLParam = New SqlParameter("@SP_CreditorNoBegin", SqlDbType.varchar)
	                    SQLParam.Value = SP_CreditorNoBegin
	                    SQLCmd.Parameters.Add(SQLParam)		
						
	                    SQLParam = New SqlParameter("@SP_CreditorNoEnd", SqlDbType.varchar)
	                    SQLParam.Value = SP_CreditorNoEnd
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_LogicalWarehouseName", SqlDbType.varchar)
	                    SQLParam.Value = SP_LogicalWarehouseName
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_PhysicalWarehouseName", SqlDbType.varchar)
	                    SQLParam.Value = SP_PhysicalWarehouseName
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_Month", SqlDbType.tinyint)
	                    SQLParam.Value = SP_Month
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_SlowItem", SqlDbType.tinyint)
	                    SQLParam.Value = SP_SlowItem
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_ObsoleteItem", SqlDbType.tinyint)
	                    SQLParam.Value = SP_ObsoleteItem
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_IncludeSalesOrder", SqlDbType.tinyint)
	                    SQLParam.Value = SP_IncludeSalesOrder
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_IncludeForwardOrder", SqlDbType.tinyint)
	                    SQLParam.Value = SP_IncludeForwardOrder
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_FOrderDateFrom", SqlDbType.datetime)
	                    SQLParam.Value = SP_FOrderDateFrom
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_FOrderDateTo", SqlDbType.datetime)
	                    SQLParam.Value = SP_FOrderDateTo
	                    SQLCmd.Parameters.Add(SQLParam)	
						
	                    SQLParam = New SqlParameter("@SP_PartNoBegin", SqlDbType.varchar)
	                    SQLParam.Value = SP_PartNoBegin
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_PartNoEnd", SqlDbType.varchar)
	                    SQLParam.Value = SP_PartNoEnd
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_IncludeBOMParent", SqlDbType.TINYINT)
	                    SQLParam.Value = SP_IncludeBOMParent
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_CentralWarehouseID", SqlDbType.char)
	                    SQLParam.Value = SP_CentralWarehouseID
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_FirstGroup", SqlDbType.tinyint)
	                    SQLParam.Value = SP_FirstGroup
	                    SQLCmd.Parameters.Add(SQLParam)	
												
	                    SQLParam = New SqlParameter("@SP_StartingRegion", SqlDbType.varchar)
	                    SQLCmd.Parameters.Add(SQLParam)	
														
	                    SQLParam = New SqlParameter("@SP_EndingRegion", SqlDbType.varchar)
	                    SQLCmd.Parameters.Add(SQLParam)	
								
	                    SQLParam = New SqlParameter("@SP_ExcludeNotSent", SqlDbType.tinyint)
	                    SQLCmd.Parameters.Add(SQLParam)							
	                End With
				
	                SQLReader = SQLCmd.ExecuteReader()
					If LineKey.Trim.Length = 0 Then
	                    Do While SQLReader.Read = True
	                        InventoryIDs.Add(.Sanitise(SQLReader, "InventoryID"))
							Quantities.Add(.Sanitise(SQLReader, "OrderQty"))
	                    Loop
					Else
						If SQLReader.Read Then
	                        InventoryIDs.Add(.Sanitise(SQLReader, "InventoryID"))
							Quantities.Add(.Sanitise(SQLReader, "OrderQty"))
						End If
					End If
	            End Using
			End With
        Finally
            If Not SQLReader Is Nothing Then
                SQLReader.Close()
            End If
        End Try
				

        End Sub
	
End Class

Public Class ApplicationManagerPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaApplicationManagerPlugin

    Overrides Public 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

    Overrides Public 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

    Overrides Public 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</Code>
  <ExceptionPolicy>Report</ExceptionPolicy>
  <PluginFormCollection>
    <PluginForm>
      <RecID>909b1f20-6774-43a2-805e-bec9346b0ae8</RecID>
      <Description>Purchase Orders</Description>
      <ClassName>JiwaFinancials.Jiwa.JiwaPurchaseOrdersUI.PurchaseOrders</ClassName>
    </PluginForm>
  </PluginFormCollection>
  <BusinessLogicCollection>
    <BusinessLogic>
      <RecID>40790cc8-3f85-4192-8b0c-672a093a3674</RecID>
      <Description>Purchase Orders</Description>
      <ClassName>JiwaFinancials.Jiwa.JiwaPurchaseOrders.PurchaseOrder</ClassName>
      <Assembly>JiwaPurchaseOrders, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</Assembly>
    </BusinessLogic>
  </BusinessLogicCollection>
  <ReferenceCollection>
    <Reference>
      <RecID>59062b56-b6da-400e-8737-deed6df2a9c7</RecID>
      <AssemblyFullName>JiwaPurchaseOrdersUI, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaPurchaseOrdersUI.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaPurchaseOrdersUI.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>39f03726-bf79-4316-9c6d-940852dd689f</RecID>
      <AssemblyFullName>mscorlib, Version=4.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>259235b5-6da4-410c-a1c1-7fa34830f31e</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>8e7931bc-ef4f-4c01-a623-1cd6ff2dca12</RecID>
      <AssemblyFullName>System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Xml.Linq.dll</AssemblyName>
      <AssemblyLocation>C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>de31406c-b33e-4f30-8d29-d0dfa643749a</RecID>
      <AssemblyFullName>FarPoint.Win.Spread, Version=7.35.20132.1, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.Spread.dll</AssemblyName>
      <AssemblyLocation>C:\WINDOWS\assembly\GAC_MSIL\FarPoint.Win.Spread\7.35.20132.1__327c3516b1b18457\FarPoint.Win.Spread.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>22f1bebd-2a09-4e6a-ade6-6a03268bd0cf</RecID>
      <AssemblyFullName>JiwaApplication, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaApplication.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaApplication.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>158bf160-4d81-46f5-9a1d-b4be99db55ac</RecID>
      <AssemblyFullName>System.Windows.Forms, Version=4.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>e5a3a84e-4793-4d83-89f5-100ff4180bac</RecID>
      <AssemblyFullName>System, Version=4.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>910705e7-9359-4a5e-b65f-639d0b2dbd04</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.Misc.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.Misc.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>3b34e1ec-48ce-424b-891c-2f21426511f2</RecID>
      <AssemblyFullName>JiwaPurchaseOrders, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaPurchaseOrders.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaPurchaseOrders.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>12a4cc2a-7579-46d1-9b63-af011529b1a0</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinEditors.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinEditors.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>13167df4-2943-4d7d-938d-3f54e0c7b7f7</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinTabControl.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinTabControl.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>8a7bcc13-0a32-4151-a3c7-2636c4f99e03</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinToolbars.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinToolbars.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>34d6dcac-c039-4ef2-bf5d-c8b0b4e1f8b8</RecID>
      <AssemblyFullName>System.Drawing, Version=4.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>8837ae2d-b114-4d30-a7a1-a948fc020ef5</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>0e7e69a3-f348-41fb-958f-65a10406ec44</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinStatusBar.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinStatusBar.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>393f32e7-c11e-4442-a63d-88c43ad66e74</RecID>
      <AssemblyFullName>FarPoint.Win, Version=7.35.20132.1, Culture=neutral, PublicKeyToken=327c3516b1b18457</AssemblyFullName>
      <AssemblyName>FarPoint.Win.dll</AssemblyName>
      <AssemblyLocation>C:\WINDOWS\assembly\GAC_MSIL\FarPoint.Win\7.35.20132.1__327c3516b1b18457\FarPoint.Win.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>faf2bef9-6c44-4671-85f1-c978546f6a0c</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Win.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>fec14db9-ce35-413a-b4c5-6dfc1a3a489c</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:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Shared.v13.1\v4.0_13.1.20131.2060__7dd5c3163f2cd0cb\Infragistics4.Shared.v13.1.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>0d8fe4d6-13d5-466b-9f02-990a7da901a7</RecID>
      <AssemblyFullName>JiwaODBC, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaODBC.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaODBC.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>7a12c281-8c5e-457c-acc6-70c8e154f58e</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>9972feee-b0dc-4297-830b-1ea3a66ce000</RecID>
      <AssemblyFullName>JiwaLib, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaLib.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaLib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>c3b6f74c-2020-456b-8b88-f5867dc90662</RecID>
      <AssemblyFullName>JiwaCreditorsUI, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaCreditorsUI.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaCreditorsUI.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>144d1d49-c22f-4846-ae1f-87c19fe7885e</RecID>
      <AssemblyFullName>System.Data, Version=4.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>32d2b666-43cd-4c91-a279-a8d63f47729a</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>0b97fd2a-247a-44d5-821e-4cfbf4b039a8</RecID>
      <AssemblyFullName>JiwaJournalSets, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaJournalSets.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaJournalSets.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>3279497b-0b28-48f0-96c2-113e5ecc57df</RecID>
      <AssemblyFullName>JiwaWhouseTransfer, Version=7.0.79.0, Culture=neutral, PublicKeyToken=16681e4ff68950ef</AssemblyFullName>
      <AssemblyName>JiwaWhouseTransfer.dll</AssemblyName>
      <AssemblyLocation>C:\JiwaTFS\Jiwa 6\Jiwa\Built Files\JiwaWhouseTransfer.dll</AssemblyLocation>
    </Reference>
  </ReferenceCollection>
</JiwaDocument>