USE [Purchases&Agreements02_Def]
GO

UPDATE [Purchases&Agreements02_Def].[dbo].tblType SET tName='Purchase' WHERE nID=1 and tName='Purchase Order'
GO

USE LicenseManager02_Def 
GO

DELETE FROM [LicenseManager02_Def].[dbo].tblDtsFields WHERE nID IN (674,675,676,677,678,679,681,693,720,721,722,723,740)
GO

INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (674, N'PurchaseLineItem', 16, N'Invoice_Date', 1, 8, 50, N'[Related Purchase] Purchase Date', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Purchase Date', N'nID;nID|nRelID;nID', N'674', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (675, N'PurchaseLineItem', 16, N'Sub_Type', 1, 103, 50, N'[Related Purchase Line Item] Type', 0, 0, N'tblInvType', 2050, 0, 0, 1, N'1', 0, 1, 680, N'Type', N'nID;nID|nRelID;nID', N'675', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (676, N'PurchaseLineItem', 16, N'Quantity', 1, 102, 50, N'[Related Purchase Line Item] Quantity', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Quantity', N'nID;nID|nRelID;nID', N'676', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (677, N'PurchaseLineItem', 16, N'Line_Item_Total', 1, 5, 50, N'[Related Purchase Line Item] Total', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Total', N'nID;nID|nRelID;nID', N'677', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (678, N'PurchaseLineItem', 16, N'Start_Date', 1, 8, 50, N'[Related Purchase Line Item] Start Date', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Start Date', N'nID;nID|nRelID;nID', N'678', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (679, N'PurchaseLineItem', 16, N'End_Date', 1, 8, 50, N'[Related Purchase Line Item] End Date', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'End Date', N'nID;nID|nRelID;nID', N'679', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (681, N'PurchaseLineItem', 16, N'nID', 1, 102, 4, N'[Related Purchase Line Item] ID', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 0, 680, N'Issue', N'nID;nID|nRelID;nID', N'681', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (693, N'PurchaseLineItem', 16, N'Line_Item_Status', 1, 103, 3, N'[Related Purchase Line Item] Status', 0, 0, N'tblPurchSubstate', 2050, 0, 0, 1, N'1', 0, 1, 680, N'Status', N'nID;nID|nRelID;nID', N'693', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (720, N'PurchaseLineItem', 16, N'Expires_', 1, 103, 50, N'[Related Purchase Line Item] Duration', 0, 0, N'tblDuration', 2050, 0, 0, 1, N'1', 0, 1, 680, N'Duration', N'nID;nID|nRelID;nID', N'720', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 3, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (721, N'PurchaseLineItem', 16, N'Company', 1, 103, 50, N'[Related Purchase] Supplier', 0, 0, N'Supplier', 16, 0, 0, 1, N'1', 0, 1, 680, N'Supplier', N'nID;nID|nRelID;nID', N'721', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (722, N'PurchaseLineItem', 16, N'Invoice_Number', 1, 10, 255, N'[Related Purchase] Invoice Number', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Invoice Number', N'nID;nID|nRelID;nID', N'722', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (723, N'PurchaseLineItem', 16, N'PO_Number', 1, 10, 255, N'[Related Purchase] PO Number', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'PO Number', N'nID;nID|nRelID;nID', N'723', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (740, N'PurchaseLineItem', 16, N'Line_Item_Description', 1, 12, 0, N'[Related Purchase Line Item] Description', 0, 0, NULL, NULL, 0, 0, 1, N'1', 0, 1, 680, N'Description', N'nID;nID|nRelID;nID', N'740', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (741, N'PurchaseLineItem', 16, N'tBriefDescription', 1, 10, 255, N'[Related Purchase] Name', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Name', N'nID;nID|nRelID;nID', N'741', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (742, N'PurchaseLineItem', 16, N'Auto_Renew', 1, 103, 3, N'[Related Purchase] Auto Renew', 0, 0, N'tblYesNo', 16, 0, 0, 1, N'1', 0, 1, 680, N'Auto Renew Purchase', N'nID;nID|nRelID;nID', N'742', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (743, N'PurchaseLineItem', 16, N'Auto_Renewal_Date', 1, 8, 0, N'[Related Purchase] Auto Renewal Date', 0, 0, NULL, NULL, 0, 0, 1, N'1', 0, 1, 680, N'Auto Renewal Date', N'nID;nID|nRelID;nID', N'743', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (744, N'PurchaseLineItem', 16, N'Auto_Renewal_Interval', 1, 103, 3, N'[Related Purchase] Auto Renewal Interval', 1, 0, N'tblAutoRenewInterval', 2050, 0, 0, 1, N'1', 0, 1, 680, N'Auto Renewal Interval', N'nID;nID|nRelID;nID', N'744', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (745, N'PurchaseLineItem', 16, N'nSubstateID', 1, 103, 3, N'[Related Purchase] Status', 0, 0, N'tblPurchSubstate', 2050, 0, 0, 1, N'1', 0, 1, 680, N'Status', N'nID;nID|nRelID;nID', N'745', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (746, N'PurchaseLineItem', 16, N'nOriginatorID', 1, 103, 3, N'[Related Purchase] Contact', 0, 0, N'tblUser', 16, 0, 0, 1, N'1', 0, 1, 680, N'Contact', N'nID;nID|nRelID;nID', N'746', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (747, N'PurchaseLineItem', 16, N'SubTotal', 1, 5, 50, N'[Related Purchase] Total', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Total', N'nID;nID|nRelID;nID', N'747', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (748, N'PurchaseLineItem', 16, N'Total_with_Tax', 1, 5, 50, N'[Related Purchase] Total with Tax', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Total with Tax', N'nID;nID|nRelID;nID', N'748', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (749, N'PurchaseLineItem', 16, N'Account_Number', 1, 10, 100, N'[Related Purchase] Account or Contract #', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Account or Contract #', N'nID;nID|nRelID;nID', N'749', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (750, N'PurchaseLineItem', 16, N'Requisition_Number', 1, 10, 100, N'[Related Purchase] Requisition Number', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'Requisition Number', N'nID;nID|nRelID;nID', N'750', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
INSERT [LicenseManager02_Def].[dbo].[tblDtsFields] ([nID], [tTableName], [nTableDSType], [tName], [nDataViewID], [nDataType], [nDataSize], [tCaption], [fChoiceOrder], [fRequired], [tFieldValuesTable], [nValueTableDSType], [fEnabled], [fKeepHistory], [fCanQueryBy], [tDestinationTab], [fEditable], [fVisible], [nRelatedField], [tLabelCaption], [tAliasSourceTable], [tBoundControlName], [nDestinationTabID], [tWhere], [fIncludeInDefaultReports], [nRelationshipType], [nContainerType], [nControlType], [tValueTableIDFld], [tValueTableNameFld], [nRevisionNumber], [tOrigCaption]) VALUES (751, N'PurchaseLineItem', 16, N'nPurchaseID', 1, 102, 4, N'[Related Purchase] ID', 0, 0, NULL, 0, 0, 0, 1, N'1', 0, 1, 680, N'ID', N'nID;nID|nRelID;nID', N'751', 3, NULL, 0, 6, 1, NULL, NULL, NULL, 2, NULL)
GO

DELETE FROM [LicenseManager02_Def].[dbo].[tblSystemLayouts] WHERE nID=22
GO

INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 0, N'Purchase #', 1, 681)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 15, N'Purchase Name', 2, 741)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 20, N'Description', 3, 740)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 10, N'Type', 4, 675)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 8, N'Quantity', 6, 676)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 8, N'Cost', 8, 677)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 10, N'From', 9, 678)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 10, N'To', 10, 679)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 10, N'Status', 11, 693)
INSERT [LicenseManager02_Def].[dbo].[tblSystemLayouts] ([nID], [tAlign], [nWidth], [tTitle], [nRow], [nDtsFieldID]) VALUES (22, N'Left', 10, N'PO Number', 13, 723)
GO

DELETE FROM [LicenseManager02_Def].[dbo].tblMail WHERE nID=40
GO

INSERT [LicenseManager02_Def].[dbo].[tblMail] ([nID], [tFrom], [tRecipients], [mCC], [tSubject], [mBodyText], [mAttachments], [bHTMLBody], [bSendIndividually], [nParentType], [bSendToQueue], [mBCC]) VALUES (40, N'Software Expiring Soon', N'', N'', N'Software <F:Software Type> Expiring Soon', N'<table style="background: rgb(209, 219, 236); margin: 0px; width: 100%; height: 100%; padding-top: 3%; padding-bottom: 3%;">	<tbody>		<tr>			<td>			<table style="margin: 2% 10%; border: 1px solid rgb(146, 162, 181); border-image: none; width: 80%; border-collapse: collapse; background-color: white;">				<tbody>					<tr style="background-color: rgb(232, 238, 250);">						<td style="padding: 10px; height: 60px; font-family: verdana,geneva,sans-serif; border-right-color: currentColor; border-bottom-color: rgb(146, 162, 181); border-right-width: medium; border-bottom-width: 1px; border-right-style: none; border-bottom-style: solid;"><img alt="logo" src="http://localhost/connect/theme/images/logos/logol.gif" /></td>						<td style="padding: 10px; height: 60px; text-align: right; font-family: verdana,geneva,sans-serif; font-size: 10pt; border-bottom-color: rgb(146, 162, 181); border-left-color: currentColor; border-bottom-width: 1px; border-left-width: medium; border-bottom-style: solid; border-left-style: none;"><br />						&lt;F:Software Type&gt; &lt;F:Serial Number&gt;&nbsp;<br />						<a href="http://localhost/connect?View=Resources%2FMy%20Assets;&amp;nId==&lt;Issue Number&gt;&amp;Qry=27">View the&nbsp;License record </a></td>					</tr>					<tr>						<td colspan="2" style="padding: 15px;">						<p style="text-align: center; font-family: verdana,geneva,sans-serif; font-size: 13pt;"><span style="font-family: Verdana, sans-serif; font-size: 13pt;"><strong>The Software&nbsp;&lt;F:Software Type&gt; &lt;F:Serial Number&gt; is Expiring Soon</strong></span></p>
						<p style="font-family: verdana,geneva,sans-serif; font-size: 13pt;"><span style="font-size: 10pt;"><span style="font-family: verdana,geneva,sans-serif;"><span style="color: rgb(51, 102, 153);">Hello &nbsp;&lt;F:Contact&gt;,</span></span></span></p>
						<div>&nbsp;</div>
						<div><span style="font-size: 10pt;"><span style="font-family: verdana,geneva,sans-serif;"><span style="color: rgb(51, 102, 153);">This is a reminder that the&nbsp;Software License&nbsp;&lt;F:Software Type&gt;&nbsp;is expiring on </span><span style="color: rgb(165, 42, 42);"><strong>&lt;F:[Related Purchase Line Item] End Date&gt;</strong></span><span style="color: rgb(51, 102, 153);">.</span></span></span></div>
						<div><span style="font-size: 10pt;"><span style="font-family: verdana,geneva,sans-serif;"><span style="color: rgb(51, 102, 153);">The purchase&nbsp;order of type&nbsp;&lt;F:[Related Purchase Line Item] Type&gt; was purchased on </span></span></span><font color="#336699" face="Verdana" size="2">&lt;F:[Related Purchase] Purchase Date&gt; from&nbsp;&lt;F:[Related Purchase] Supplier&gt; and has the following Serial Number: </font></div>
						<div><font color="#336699" face="Verdana" size="2">&nbsp;</font></div>
						<div><font color="#336699" face="Verdana" size="2"><span style="font-size: 10pt;"><span style="font-family: verdana,geneva,sans-serif;"><span style="color: rgb(51, 102, 153);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Serial Number:&nbsp;<strong>&lt;F:Serial Number&gt;</strong></span></span></span></font></div>
						<div><font color="#336699" face="Verdana" size="2">&nbsp;</font></div>
						<div><font color="#336699" face="Verdana" size="2"><span style="font-size: 10pt;"><span style="font-family: verdana,geneva,sans-serif;"><span style="color: rgb(51, 102, 153);">The purchase&nbsp;covers </span></span></span><font color="#336699" face="Verdana" size="2">&lt;F:[Related Purchase Line Item] Quantity&gt; entitlements and started on <strong>&lt;F:[Related Purchase Line Item] Start Date&gt;.</strong> </font></font></div>
						<div><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2">&nbsp;</font></font></div>
						<div><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2">&nbsp;</font></font></div>
						<div><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2">&nbsp;</font></font></div>
						<div><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2">&nbsp;</font></font></div>
						<div><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2"><font color="#336699" face="Verdana" size="2">Vizor Software</font></font></font></div>						</td>					</tr>				</tbody>			</table>			</td>		</tr>	</tbody></table>
<div><p>&nbsp;</p></div>', N'', 1, 0, 3, 0, N'')
GO

UPDATE [LicenseManager02_Def].[dbo].tblSystemConditions SET tName = (SELECT tCaption FROM [LicenseManager02_Def].[dbo].tblDtsFields WHERE nID=nDtsFieldID) WHERE nDtsFieldID IN(674,675,676,677,678,679,681,693,720,721,722,723,740)
GO

USE [Users_mdb]
GO

DROP VIEW PurchaseLineItem
GO

CREATE VIEW [PurchaseLineItem]
AS
SELECT     A.nID, A.Line_Item_Number, A.Line_Item, A.Quantity, A.Line_Item_Description, A.Line_Item_Unit_Price, A.Line_Item_Total, A.Sub_Type, 
                      CAST(A.Line_Item_Number AS nvarchar) + ' - ' + A.Line_Item_Description AS tName, A.Start_Date, A.End_Date, A.Line_Item_Status, A.Expires_, C.Company, 
                      C.PO_Number, C.Invoice_Date, C.Invoice_Number, C.tBriefDescription, C.Auto_Renew, C.Auto_Renewal_Date, C.Auto_Renewal_Interval, C.nSubstateID, 
                      C.nOriginatorID, C.SubTotal, C.Total_with_Tax, C.Account_Number, C.Requisition_Number, C.nID AS nPurchaseID
FROM         [Purchases&Agreements01_Dat].dbo.tblDts AS A LEFT OUTER JOIN
                      [Purchases&Agreements01_Dat].dbo.tblLineItem AS B ON A.nID = B.nRelID LEFT OUTER JOIN
                      [Purchases&Agreements01_Dat].dbo.tblDts AS C ON B.nID = C.nID
WHERE     (A.Type = 3)

GO
