Calculated field on form?

Thanks! I know the table the information is in as it's updated when the Supplier charges us differently to the expected PO price... just need to get it where I want it!



--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> I am not an accountant. I have no idea where you would find that info or what the ramifications of not paying the PO price would be.
>
> Good Luck :o)
>
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > They do but they show the price that was on the Purchase Order and not the price that has gone through on the AP Invoice that we actually got charged.
> >
> >
> >
> > --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> > >
> > > Doesn't past and current pricing show in the 'Have I purchased before' and 'Do I have any on order' Tabs ??
> > >
> > > --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> > > >
> > > > Brilliant! Got Std Material Cost working (even figured out a row error that kept popping up!) and now been asked for Last Price Paid (ie, the cost that actually went through on the AP Invoice).
> > > >
> > > > Think this might be much more complicated though - would this be better with a BPM to update a UD field on the part with the last price? Thanks.
> > > >
> > >
> >
>
I want to show the Std part cost on the Purchase Advisor but am unsure on the best way... a BPM that updates a UD field on the Part Table or Foreign Key/Calculated field on the form?

The problem with the foreign key is that I can't get to the PartCost table as far as I can see... any suggestions?

We're on 8.03.409a. Thanks.
We have heavily customized the Purchase Advisor screen.
Added boxes for Std Cost, and ytd usage, prev ytd usage and 2yr ago usage. Added tabs to display legacy data stored in UD14, Time Phase info and Where used info. And we use UD10 to store part sourcing info. You can weed out what you don't need. This is V8.03.405a.

'//**************************************************
'// Custom VB.NET code for PurchaseAdvisorEntryForm
'// Created: 5/14/2007 1:25:10 PM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO


Module Script


'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **

Private WithEvents PartList_DataView As DataView
Private WithEvents edvPartList As EpiDataView
'// End Wizard Added Module Level Variables **


'// Add Custom Module Level Variables Here **
Private WithEvents partAdapter As PartAdapter
Dim dsWhereUsedData As DataSet
Private WithEvents edvWhereUsed As EpiDataView
Private WithEvents timephasAdapter As TimePhasAdapter
Private WithEvents edvTimePhas As EpiDataView
Sub InitializeCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization

edvPartList = CType(oTrans.EpiDataViews("PartList"), EpiDataView)
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

InitializeProcCallDataViews()
partAdapter = New partAdapter(oTrans)
partAdapter.BOConnect()

edvWhereUsed = new EpiDataView()
edvWhereUsed.dataview = new DataView(partAdapter.WhereUsedData.PartWhereUsed)
if not (oTrans.EpiDataViews.ContainsKey("WUView")) then oTrans.Add("WUView",edvWhereUsed)

timephasAdapter = New timephasAdapter(oTrans)
timephasAdapter.BOConnect()

edvTimePhas = new EpiDataView()
edvTimePhas.dataView = New DataView(timephasAdapter.TimePhasData.TimePhas)
If Not (oTrans.EpiDataViews.ContainsKey("TimePhasView")) Then oTrans.Add("TimePhasView",edvTimePhas)
'// End Custom Method Calls
End Sub



Sub DestroyCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
partAdapter.Dispose()
partAdapter = Nothing
edvWhereUsed = Nothing
timephasAdapter.Dispose()
timephasAdapter = Nothing
edvTimePhas = Nothing
'// End Custom Code Disposal
End Sub

Private Sub InitializeProcCallDataViews()
Dim whereClause As String
whereClause = "Key1 ='$%' And Key2 ='$%' And Key3 ='$%' And Key4 ='$%' And Key5 ='$%'"
csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",True)
csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",True)
End Sub


Private Sub PartList_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles PartList_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column.ColumnName

Case "PartNum"
'Dim whereClause As String
' whereClause = "Key1 ='" + args.ProposedValue + "'"
' csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
' Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
' Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
'Dim whereClause1 As String = "PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'"
' txtUprev.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
' txtUytd.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
' txtStdCost.Text = getStdCost(args.ProposedValue.ToString()).ToString()
Case Else

End Select

End Sub

Private Function ytdUsage (ByVal clause As string) As Integer

Dim ytdUsed As Integer = 0
Dim recSelected As Boolean

Dim dsSearch As DataSet
dsSearch = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans, "PartTranHistAdapter", recSelected, False, clause, True)
If recSelected Then
For Each dr As DataRow In dsSearch.Tables(0).Rows
ytdUsed = ytdUsed + dr("TranQty")
Next

End If
Return ytdUsed
End Function

Private Function getStdCost(ByVal pn as String) As Decimal
Dim stdCost As Decimal = 0
Dim recordSelected As Boolean
Dim showSearch As Boolean = False
Dim whereClause As String = "partNum = '" & pn & "' And costID = '1'"
Dim dsCost As DataSet = SearchFunctions.listLookup(PurchaseAdvisorEntryForm, "PartCostSearchAdapter", recordSelected, showSearch, whereClause)
If (recordSelected = True)
stdCost = dsCost.Tables(0).Rows(0)("StdMaterialCost")
End If

Return stdCost
End Function

Private Sub edvPartList_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPartList.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("PartNum")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
partAdapter.clearData()
timephasAdapter.clearData()
edvWhereUsed.EpiDataChanged()
edvTimePhas.EpiDataChanged()
If (args.Row > -1) Then
Dim whereClause As String
whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "'"
csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "' BY INT(Key2)"
csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",False)

Dim morePages as Boolean
Dim dsWhereUsed As DataSet = partAdapter.GetPartWhereUsed(view.dataView(args.Row)("PartNum"),0,1,morePages)

Dim blTimePhas As Boolean = timephasAdapter.GoProcessTimePhase(view.dataView(args.Row)("PartNum"), "MfgSys", False, False)

Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
Dim ldopppy as date = DateAdd(DateInterval.Year, -1, ldoppy)
txt2YrAgo.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopppy + "' AND TranDate <= '" + ldoppy + "'").ToString()
txtUprev.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
txtUytd.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
txtStdCost.Text = getStdCost(view.dataView(args.Row)("PartNum")).ToString()
End If
End If
End Sub



Private Sub ugdTimePhase_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdTimePhase.BackColorChanged
'// ** Place Event Handling Code Here **
If ugdTimePhase.BackColor <> System.Drawing.Color.Silver Then
ugdTimePhase.BackColor = System.Drawing.Color.Silver
End If
End Sub


Private Sub ugdEpiCustom1_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdEpiCustom1.BackColorChanged
'// ** Place Event Handling Code Here **
If ugdEpiCustom1.BackColor <> System.Drawing.Color.Silver Then
ugdEpiCustom1.BackColor = System.Drawing.Color.Silver
End If
End Sub


End Module


--- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@...> wrote:
>
> I want to show the Std part cost on the Purchase Advisor but am unsure on the best way... a BPM that updates a UD field on the Part Table or Foreign Key/Calculated field on the form?
>
> The problem with the foreign key is that I can't get to the PartCost table as far as I can see... any suggestions?
>
> We're on 8.03.409a. Thanks.
>
Thank you! Will have a look through today :)



--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> We have heavily customized the Purchase Advisor screen.
> Added boxes for Std Cost, and ytd usage, prev ytd usage and 2yr ago usage. Added tabs to display legacy data stored in UD14, Time Phase info and Where used info. And we use UD10 to store part sourcing info. You can weed out what you don't need. This is V8.03.405a.
>
> '//**************************************************
> '// Custom VB.NET code for PurchaseAdvisorEntryForm
> '// Created: 5/14/2007 1:25:10 PM
> '//**************************************************
> Imports System
> Imports System.Data
> Imports System.Diagnostics
> Imports System.Windows.Forms
> Imports System.ComponentModel
> Imports Microsoft.VisualBasic
> Imports Epicor.Mfg.UI
> Imports Epicor.Mfg.UI.FrameWork
> Imports Epicor.Mfg.UI.ExtendedProps
> Imports Epicor.Mfg.UI.FormFunctions
> Imports Epicor.Mfg.UI.Customization
> Imports Epicor.Mfg.UI.Adapters
> Imports Epicor.Mfg.UI.Searches
> Imports Epicor.Mfg.BO
>
>
> Module Script
>
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
> '// Begin Wizard Added Module Level Variables **
>
> Private WithEvents PartList_DataView As DataView
> Private WithEvents edvPartList As EpiDataView
> '// End Wizard Added Module Level Variables **
>
>
> '// Add Custom Module Level Variables Here **
> Private WithEvents partAdapter As PartAdapter
> Dim dsWhereUsedData As DataSet
> Private WithEvents edvWhereUsed As EpiDataView
> Private WithEvents timephasAdapter As TimePhasAdapter
> Private WithEvents edvTimePhas As EpiDataView
> Sub InitializeCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
> '// Begin Wizard Added Variable Intialization
>
> edvPartList = CType(oTrans.EpiDataViews("PartList"), EpiDataView)
> '// End Wizard Added Variable Intialization
> '// Begin Custom Method Calls
>
> InitializeProcCallDataViews()
> partAdapter = New partAdapter(oTrans)
> partAdapter.BOConnect()
>
> edvWhereUsed = new EpiDataView()
> edvWhereUsed.dataview = new DataView(partAdapter.WhereUsedData.PartWhereUsed)
> if not (oTrans.EpiDataViews.ContainsKey("WUView")) then oTrans.Add("WUView",edvWhereUsed)
>
> timephasAdapter = New timephasAdapter(oTrans)
> timephasAdapter.BOConnect()
>
> edvTimePhas = new EpiDataView()
> edvTimePhas.dataView = New DataView(timephasAdapter.TimePhasData.TimePhas)
> If Not (oTrans.EpiDataViews.ContainsKey("TimePhasView")) Then oTrans.Add("TimePhasView",edvTimePhas)
> '// End Custom Method Calls
> End Sub
>
>
>
> Sub DestroyCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
> '// Begin Custom Code Disposal
> partAdapter.Dispose()
> partAdapter = Nothing
> edvWhereUsed = Nothing
> timephasAdapter.Dispose()
> timephasAdapter = Nothing
> edvTimePhas = Nothing
> '// End Custom Code Disposal
> End Sub
>
> Private Sub InitializeProcCallDataViews()
> Dim whereClause As String
> whereClause = "Key1 ='$%' And Key2 ='$%' And Key3 ='$%' And Key4 ='$%' And Key5 ='$%'"
> csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",True)
> csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",True)
> End Sub
>
>
> Private Sub PartList_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles PartList_Column.ColumnChanged
> '// ** Argument Properties and Uses **
> '// args.Row("[FieldName]")
> '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Select Case args.Column.ColumnName
>
> Case "PartNum"
> 'Dim whereClause As String
> ' whereClause = "Key1 ='" + args.ProposedValue + "'"
> ' csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
> ' Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
> ' Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
> 'Dim whereClause1 As String = "PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'"
> ' txtUprev.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
> ' txtUytd.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
> ' txtStdCost.Text = getStdCost(args.ProposedValue.ToString()).ToString()
> Case Else
>
> End Select
>
> End Sub
>
> Private Function ytdUsage (ByVal clause As string) As Integer
>
> Dim ytdUsed As Integer = 0
> Dim recSelected As Boolean
>
> Dim dsSearch As DataSet
> dsSearch = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans, "PartTranHistAdapter", recSelected, False, clause, True)
> If recSelected Then
> For Each dr As DataRow In dsSearch.Tables(0).Rows
> ytdUsed = ytdUsed + dr("TranQty")
> Next
>
> End If
> Return ytdUsed
> End Function
>
> Private Function getStdCost(ByVal pn as String) As Decimal
> Dim stdCost As Decimal = 0
> Dim recordSelected As Boolean
> Dim showSearch As Boolean = False
> Dim whereClause As String = "partNum = '" & pn & "' And costID = '1'"
> Dim dsCost As DataSet = SearchFunctions.listLookup(PurchaseAdvisorEntryForm, "PartCostSearchAdapter", recordSelected, showSearch, whereClause)
> If (recordSelected = True)
> stdCost = dsCost.Tables(0).Rows(0)("StdMaterialCost")
> End If
>
> Return stdCost
> End Function
>
> Private Sub edvPartList_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPartList.EpiViewNotification
> '// ** Argument Properties and Uses **
> '// view.dataView(args.Row)("PartNum")
> '// args.Row, args.Column, args.Sender, args.NotifyType
> '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
> partAdapter.clearData()
> timephasAdapter.clearData()
> edvWhereUsed.EpiDataChanged()
> edvTimePhas.EpiDataChanged()
> If (args.Row > -1) Then
> Dim whereClause As String
> whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "'"
> csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
> whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "' BY INT(Key2)"
> csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",False)
>
> Dim morePages as Boolean
> Dim dsWhereUsed As DataSet = partAdapter.GetPartWhereUsed(view.dataView(args.Row)("PartNum"),0,1,morePages)
>
> Dim blTimePhas As Boolean = timephasAdapter.GoProcessTimePhase(view.dataView(args.Row)("PartNum"), "MfgSys", False, False)
>
> Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
> Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
> Dim ldopppy as date = DateAdd(DateInterval.Year, -1, ldoppy)
> txt2YrAgo.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopppy + "' AND TranDate <= '" + ldoppy + "'").ToString()
> txtUprev.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
> txtUytd.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
> txtStdCost.Text = getStdCost(view.dataView(args.Row)("PartNum")).ToString()
> End If
> End If
> End Sub
>
>
>
> Private Sub ugdTimePhase_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdTimePhase.BackColorChanged
> '// ** Place Event Handling Code Here **
> If ugdTimePhase.BackColor <> System.Drawing.Color.Silver Then
> ugdTimePhase.BackColor = System.Drawing.Color.Silver
> End If
> End Sub
>
>
> Private Sub ugdEpiCustom1_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdEpiCustom1.BackColorChanged
> '// ** Place Event Handling Code Here **
> If ugdEpiCustom1.BackColor <> System.Drawing.Color.Silver Then
> ugdEpiCustom1.BackColor = System.Drawing.Color.Silver
> End If
> End Sub
>
>
> End Module
>
>
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > I want to show the Std part cost on the Purchase Advisor but am unsure on the best way... a BPM that updates a UD field on the Part Table or Foreign Key/Calculated field on the form?
> >
> > The problem with the foreign key is that I can't get to the PartCost table as far as I can see... any suggestions?
> >
> > We're on 8.03.409a. Thanks.
> >
>
Brilliant! Got Std Material Cost working (even figured out a row error that kept popping up!) and now been asked for Last Price Paid (ie, the cost that actually went through on the AP Invoice).

Think this might be much more complicated though - would this be better with a BPM to update a UD field on the part with the last price? Thanks.

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> We have heavily customized the Purchase Advisor screen.
> Added boxes for Std Cost, and ytd usage, prev ytd usage and 2yr ago usage. Added tabs to display legacy data stored in UD14, Time Phase info and Where used info. And we use UD10 to store part sourcing info. You can weed out what you don't need. This is V8.03.405a.
>
> '//**************************************************
> '// Custom VB.NET code for PurchaseAdvisorEntryForm
> '// Created: 5/14/2007 1:25:10 PM
> '//**************************************************
> Imports System
> Imports System.Data
> Imports System.Diagnostics
> Imports System.Windows.Forms
> Imports System.ComponentModel
> Imports Microsoft.VisualBasic
> Imports Epicor.Mfg.UI
> Imports Epicor.Mfg.UI.FrameWork
> Imports Epicor.Mfg.UI.ExtendedProps
> Imports Epicor.Mfg.UI.FormFunctions
> Imports Epicor.Mfg.UI.Customization
> Imports Epicor.Mfg.UI.Adapters
> Imports Epicor.Mfg.UI.Searches
> Imports Epicor.Mfg.BO
>
>
> Module Script
>
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
> '// Begin Wizard Added Module Level Variables **
>
> Private WithEvents PartList_DataView As DataView
> Private WithEvents edvPartList As EpiDataView
> '// End Wizard Added Module Level Variables **
>
>
> '// Add Custom Module Level Variables Here **
> Private WithEvents partAdapter As PartAdapter
> Dim dsWhereUsedData As DataSet
> Private WithEvents edvWhereUsed As EpiDataView
> Private WithEvents timephasAdapter As TimePhasAdapter
> Private WithEvents edvTimePhas As EpiDataView
> Sub InitializeCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
> '// Begin Wizard Added Variable Intialization
>
> edvPartList = CType(oTrans.EpiDataViews("PartList"), EpiDataView)
> '// End Wizard Added Variable Intialization
> '// Begin Custom Method Calls
>
> InitializeProcCallDataViews()
> partAdapter = New partAdapter(oTrans)
> partAdapter.BOConnect()
>
> edvWhereUsed = new EpiDataView()
> edvWhereUsed.dataview = new DataView(partAdapter.WhereUsedData.PartWhereUsed)
> if not (oTrans.EpiDataViews.ContainsKey("WUView")) then oTrans.Add("WUView",edvWhereUsed)
>
> timephasAdapter = New timephasAdapter(oTrans)
> timephasAdapter.BOConnect()
>
> edvTimePhas = new EpiDataView()
> edvTimePhas.dataView = New DataView(timephasAdapter.TimePhasData.TimePhas)
> If Not (oTrans.EpiDataViews.ContainsKey("TimePhasView")) Then oTrans.Add("TimePhasView",edvTimePhas)
> '// End Custom Method Calls
> End Sub
>
>
>
> Sub DestroyCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
> '// Begin Custom Code Disposal
> partAdapter.Dispose()
> partAdapter = Nothing
> edvWhereUsed = Nothing
> timephasAdapter.Dispose()
> timephasAdapter = Nothing
> edvTimePhas = Nothing
> '// End Custom Code Disposal
> End Sub
>
> Private Sub InitializeProcCallDataViews()
> Dim whereClause As String
> whereClause = "Key1 ='$%' And Key2 ='$%' And Key3 ='$%' And Key4 ='$%' And Key5 ='$%'"
> csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",True)
> csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",True)
> End Sub
>
>
> Private Sub PartList_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles PartList_Column.ColumnChanged
> '// ** Argument Properties and Uses **
> '// args.Row("[FieldName]")
> '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Select Case args.Column.ColumnName
>
> Case "PartNum"
> 'Dim whereClause As String
> ' whereClause = "Key1 ='" + args.ProposedValue + "'"
> ' csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
> ' Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
> ' Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
> 'Dim whereClause1 As String = "PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'"
> ' txtUprev.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
> ' txtUytd.Text = ytdUsage("PartNum = '" + args.ProposedValue.ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
> ' txtStdCost.Text = getStdCost(args.ProposedValue.ToString()).ToString()
> Case Else
>
> End Select
>
> End Sub
>
> Private Function ytdUsage (ByVal clause As string) As Integer
>
> Dim ytdUsed As Integer = 0
> Dim recSelected As Boolean
>
> Dim dsSearch As DataSet
> dsSearch = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans, "PartTranHistAdapter", recSelected, False, clause, True)
> If recSelected Then
> For Each dr As DataRow In dsSearch.Tables(0).Rows
> ytdUsed = ytdUsed + dr("TranQty")
> Next
>
> End If
> Return ytdUsed
> End Function
>
> Private Function getStdCost(ByVal pn as String) As Decimal
> Dim stdCost As Decimal = 0
> Dim recordSelected As Boolean
> Dim showSearch As Boolean = False
> Dim whereClause As String = "partNum = '" & pn & "' And costID = '1'"
> Dim dsCost As DataSet = SearchFunctions.listLookup(PurchaseAdvisorEntryForm, "PartCostSearchAdapter", recordSelected, showSearch, whereClause)
> If (recordSelected = True)
> stdCost = dsCost.Tables(0).Rows(0)("StdMaterialCost")
> End If
>
> Return stdCost
> End Function
>
> Private Sub edvPartList_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPartList.EpiViewNotification
> '// ** Argument Properties and Uses **
> '// view.dataView(args.Row)("PartNum")
> '// args.Row, args.Column, args.Sender, args.NotifyType
> '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
> partAdapter.clearData()
> timephasAdapter.clearData()
> edvWhereUsed.EpiDataChanged()
> edvTimePhas.EpiDataChanged()
> If (args.Row > -1) Then
> Dim whereClause As String
> whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "'"
> csm.UpdateProcCallDataView("UD14Adapter","UD14",whereClause,"UD14View",False)
> whereClause = "Key1 ='" + view.dataView(args.Row)("PartNum") + "' BY INT(Key2)"
> csm.UpdateProcCallDataView("UD10Adapter","UD10",whereClause,"UD10View",False)
>
> Dim morePages as Boolean
> Dim dsWhereUsed As DataSet = partAdapter.GetPartWhereUsed(view.dataView(args.Row)("PartNum"),0,1,morePages)
>
> Dim blTimePhas As Boolean = timephasAdapter.GoProcessTimePhase(view.dataView(args.Row)("PartNum"), "MfgSys", False, False)
>
> Dim ldopy as date = DateAdd(DateInterval.Second, -3, DateAdd(DateInterval.Year, DateDiff(DateInterval.Year, Date.MinValue, Now()), Date.MinValue))
> Dim ldoppy as date = DateAdd(DateInterval.Year, -1, ldopy)
> Dim ldopppy as date = DateAdd(DateInterval.Year, -1, ldoppy)
> txt2YrAgo.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopppy + "' AND TranDate <= '" + ldoppy + "'").ToString()
> txtUprev.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldoppy + "' AND TranDate <= '" + ldopy + "'").ToString()
> txtUytd.Text = ytdUsage("PartNum = '" + view.dataView(args.Row)("PartNum").ToString() + "' AND TranType = 'STK-MTL' AND TranDate > '" + ldopy + "'").ToString()
> txtStdCost.Text = getStdCost(view.dataView(args.Row)("PartNum")).ToString()
> End If
> End If
> End Sub
>
>
>
> Private Sub ugdTimePhase_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdTimePhase.BackColorChanged
> '// ** Place Event Handling Code Here **
> If ugdTimePhase.BackColor <> System.Drawing.Color.Silver Then
> ugdTimePhase.BackColor = System.Drawing.Color.Silver
> End If
> End Sub
>
>
> Private Sub ugdEpiCustom1_BackColorChanged(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ugdEpiCustom1.BackColorChanged
> '// ** Place Event Handling Code Here **
> If ugdEpiCustom1.BackColor <> System.Drawing.Color.Silver Then
> ugdEpiCustom1.BackColor = System.Drawing.Color.Silver
> End If
> End Sub
>
>
> End Module
>
>
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > I want to show the Std part cost on the Purchase Advisor but am unsure on the best way... a BPM that updates a UD field on the Part Table or Foreign Key/Calculated field on the form?
> >
> > The problem with the foreign key is that I can't get to the PartCost table as far as I can see... any suggestions?
> >
> > We're on 8.03.409a. Thanks.
> >
>
Doesn't past and current pricing show in the 'Have I purchased before' and 'Do I have any on order' Tabs ??

--- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@...> wrote:
>
> Brilliant! Got Std Material Cost working (even figured out a row error that kept popping up!) and now been asked for Last Price Paid (ie, the cost that actually went through on the AP Invoice).
>
> Think this might be much more complicated though - would this be better with a BPM to update a UD field on the part with the last price? Thanks.
>
They do but they show the price that was on the Purchase Order and not the price that has gone through on the AP Invoice that we actually got charged.



--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> Doesn't past and current pricing show in the 'Have I purchased before' and 'Do I have any on order' Tabs ??
>
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > Brilliant! Got Std Material Cost working (even figured out a row error that kept popping up!) and now been asked for Last Price Paid (ie, the cost that actually went through on the AP Invoice).
> >
> > Think this might be much more complicated though - would this be better with a BPM to update a UD field on the part with the last price? Thanks.
> >
>
I am not an accountant. I have no idea where you would find that info or what the ramifications of not paying the PO price would be.

Good Luck :o)

--- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@...> wrote:
>
> They do but they show the price that was on the Purchase Order and not the price that has gone through on the AP Invoice that we actually got charged.
>
>
>
> --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> >
> > Doesn't past and current pricing show in the 'Have I purchased before' and 'Do I have any on order' Tabs ??
> >
> > --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> > >
> > > Brilliant! Got Std Material Cost working (even figured out a row error that kept popping up!) and now been asked for Last Price Paid (ie, the cost that actually went through on the AP Invoice).
> > >
> > > Think this might be much more complicated though - would this be better with a BPM to update a UD field on the part with the last price? Thanks.
> > >
> >
>