Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For you programmers out there, need help with this project 1

Status
Not open for further replies.

pronet74

MIS
Mar 9, 2004
192
US
In the PO section, when a user changes the Req Date in a line item, to give them the option to change all the line items for that order. I have Macola 7.5.103e, with Flexibiliy, running on PSQL. I have done the OE part of it, where they wanted the same thing, but this one is giving me a little bit of a problem.
 
In the past I wrote a piece of flex that did this for the OE side and made the proper entries into the audit trail files if required.

The POOrdhdr and POordline are set up relatively the same. How did you do it in OE? I think you can take what you got and modify it for the PO screen.

Give me a holler and I will try to help you.

Andy Baldwin
abaldeagle@adelphia.net

Andy Baldwin
 
If anyone wants here is the code. Its not very neat, but it works.

For the OE Entry:


Public Completed As Variant
Public MsgAnswer As Variant
Public ShipDateChange As Variant
Public ListCountItems As Variant
Public Datekey As Variant
Public I As Variant
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const EM_SetSel = &HB1
Private Macola As New ADODB.Connection
Public ord As Variant
Public statstmt As Variant
Public KitFound As Variant


Private Sub OpenMacolaConnection()
Dim sConnStr As String
Dim sUID As String
Dim sPwd As String

' Set User Name and Password
sUID = "SUPERVISOR"
sPwd = "debits"

sConnStr = "dsn=MACOLA70"

Macola.Open sConnStr, sUID, sPwd
End Sub

Private Sub macForm_CloseForm()
' Explicitly Close and Release Your Connection
If Macola.State = adStateOpen Then Macola.Close
Set Macola = Nothing
End Sub

Private Sub BILLNAME_GotFocus()
If OE0101.macForm.mode = Change Then
MsgAnswer = MsgBox("Do you wish to change all line items to the changed date?", vbYesNo)
ShipDateChange = ShipDate.Text
Completed = False
I = 0
End If
End Sub

Private Sub DiscPct1_GotFocus()
If Completed = False Then
ord = ItemNo.Text
KIT = "K"
Call OpenMacolaConnection
Set statrs = New ADODB.Recordset
statstmt = "SELECT OEORDLIN.ITEM_NO, OEORDLIN.ITM_CODE FROM OEORDLIN WHERE (OEORDLIN.ITEM_NO = '" & ord & "' AND OEORDLIN.ITM_CODE = '" & KIT & "')"
statrs.Open statstmt, Macola, adOpenforward, adLockReadOnly, adCmdText

If statrs.EOF = False Then
statrs.MoveFirst

Do While Not statrs.EOF
If statrs("ITM_CODE") = "K" Then
KitFound = True
End If

statrs.MoveNext
Loop
End If
Call macForm_CloseForm
End If

If KitFound = True And Completed = False Then
MsgBox ("This order has kits, you have to update the dates manually.")
Completed = True
KitFound = False
End If

If OE0101.macForm.mode = Change Then
If MsgAnswer = 6 And Completed = False Then

If I + 1 < ListCountItems Then
Datekey = ""
datelength = Len(ShipDateChange)
For J = 1 To datelength
If Mid(ShipDateChange, J, 1) <> "/" Then
Datekey = Datekey + Mid(ShipDateChange, J, 1)
End If
Next J
I = I + 1
Requested.SetFocus
'Requested.SetFocus
Else
Completed = True
End If
End If
End If
End Sub

Private Sub ItemNo_GotFocus()
If OE0101.macForm.mode = Change Then
Completed = True
'SendKeys "{ESC}"
End If
End Sub

Private Sub ListBox_GotFocus()
If OE0101.macForm.mode = Change Then
ListCountItems = ListBox.Count
If MsgAnswer = 6 And Completed = False Then
SendKeys "{Enter}"
Else
Completed = True
End If
End If
End Sub

Private Sub Promised_GotFocus()
If OE0101.macForm.mode = Change Then
If MsgAnswer = 6 And Completed = False Then
SendKeys (Datekey)
SendKeys "{Tab}"
End If
End If
End Sub

Private Sub ReqShip_GotFocus()
If OE0101.macForm.mode = Change Then
If MsgAnswer = 6 And Completed = False Then
SendKeys (Datekey)
SendKeys "{Enter}"
End If
End If
End Sub

Private Sub ReqShip_LoseFocus(AllowLoseFocus As Boolean)
If OE0101.macForm.mode = Change Then
If Completed = True Then
SendKeys "{ESC}"
SendKeys "{DOWN}"
End If
End If
End Sub


Private Sub Requested_GotFocus()
If OE0101.macForm.mode = Change Then
If MsgAnswer = 6 And Completed = False Then
SendKeys (Datekey)
SendKeys "{Tab}"
End If
End If
End Sub



For the PO:

Public TotalLineNumbers As Variant
Public OldReqDate As Variant
Public NewReqDate As Variant
Public MsgAnswer As Variant
Public I As Variant
Public Completed As Variant
Public PassReq As Variant
Public DateChangeMsg As Variant


Private Sub ExpCost_GotFocus()
If I + 1 <= TotalLineNumbers And macForm.mode = Change And DateChangeMsg = 6 Then
SendKeys "{Tab}"
End If
End Sub

Private Sub ItemDesc_GotFocus()
If I + 1 <= TotalLineNumbers And macForm.mode = Change And DateChangeMsg = 6 Then
SendKeys "{Tab}"
End If
End Sub

Private Sub ITEMDESCRIPTION2_GotFocus()
If I + 1 <= TotalLineNumbers And macForm.mode = Change And DateChangeMsg = 6 Then
SendKeys "{Tab}"
End If
End Sub

Private Sub ItmNo_GotFocus()
If I + 1 <= TotalLineNumbers And macForm.mode = Change And DateChangeMsg = 6 Then
SendKeys "{Tab}"
End If
End Sub

Private Sub LineNo_GotFocus()
TotalLineNumbers = LineNo.Text - 1
If MsgAnswer = 6 And DateChangeMsg = 6 Then
If I + 1 <= TotalLineNumbers Then
Completed = False
LineNo.Text = I + 2
I = I + 1
SendKeys "{Tab}"
Else
Completed = True
MsgAnswer = 0
End If
End If
End Sub

Private Sub LineNo_LoseFocus(AllowLoseFocus As Boolean)
If LineNo.Text = 1 Then
DateChangeMsg = 0
DateChangeMsg = MsgBox("Is this going to be a date change?", vbYesNo)
If DateChangeMsg = 6 Then
OldDateReq = ReqDate.Text
End If
End If
End Sub

Private Sub PromiseDate_GotFocus()
If macForm.mode = Change And DateChangeMsg = 6 Then
PassReq = True
If LineNo.Text = 1 And Completed = False Then
NewReqDate = ReqDate.Text
MsgAnswer = MsgBox("Do you wish for all line items to have the Requested Date?", vbYesNo)
End If

If MsgAnswer = 6 And DateChangeMsg = 6 Then
SendKeys "{Enter}"
End If
End If
End Sub

Private Sub QtyOrder_GotFocus()
If I + 1 <= TotalLineNumbers And macForm.mode = Change And DateChangeMsg = 6 Then
SendKeys "{Tab}"
End If
End Sub

Private Sub ReqDate_GotFocus()
If macForm.mode = Change And DateChangeMsg = 6 And MsgAnswer = 6 Then
OldReqDate = ReqDate.Text
If LineNo.Text <> 1 Then
ReqDate.Text = NewReqDate
OldReqDate = ""
SendKeys "{Tab}"
Else
MsgAnswer = 0
I = 0
End If
End If
End Sub

Private Sub ReqDate_LoseFocus(AllowLoseFocus As Boolean)
If macForm.mode = Change Then
If MsgAnswer = 6 And DateChangeMsg = 6 Then
NewReqDate = ReqDate.Text
End If
PassReq = False
End If

If OldDateReq <> ReqDate.Text Then
DateChange = 2
Else
DateChange = 1
End If

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top