conditional customer

Dec 08, 2005 3 Replies

I need to be able to require a customer when a specific item is being sold. I have successfully created a DLL with vb6 and set the registry to call the DLL on the add item hook.



So far, I can get a messagebox when the customer is blank. So I think I'm pretty close but can't get across the finish line.



Here's what I think I need. How can I determine the transactionentry.item? Can I see other info like the itemlookupcode or department? How can I call the setcustomer function?



Any help appreciated.



Here is my project code



Public Function Process(Session As Object) As Boolean Dim Entry As Object ' Really TransactionEntry Dim xItem As String xItem = "BLANK" 'Check to see if customer is loaded If Not Session.Transaction.Customer.Loaded Then 'Check to see if the item is on "the list" For Each Entry In Session.Transaction.Entries 'This didn't work 'If Entry.Item = 606 Then 'This didn't work Call SetCustomer



MsgBox "Checking item with a blank customer", vbInformation, "ITEM" 'End If Next End If Process = True End Function


I think the add item hook should pass the item but can't find a good reference for this either. I suppose if I had the ID of the item I could do a sql call to determine any other related item data but if it is already exposed in qsrules, no need.


Entry.Item.ID

I don't know of any way to call up the Sustomer List Screen from QSRules. You can use a FireEvent from QSBridge, but that only works from a browser - you could set a flag in a Session.VariableX, then use Status.html to use the FireEvent to Show the Customer List when that Flag is found, but that's an ugly workaround. It might make more sense to use Status.html for the entire add-in....

Thanks for the info. I'll quit barking up that tree. I think I'll change the trigger to the tender trigger and display a message and return a false if customer isn't loaded and the specific item is in the transaction.entries.

If the client doesn't buy into that solution, any idea of the level of effort (cost) to do the add-in through status.html?

I solved my own question.

Here's a solution if anyone else is interested. Uses a hook on start tender and opens a customer screen if the customer is blank and the item description is "distributor"

Public Function Process(session As Object) As Boolean Dim xflag As Boolean Dim xitem As String xflag = False Process = True If Not session.Transaction.Customer.Loaded Then Dim E As Integer For E = 1 To session.Transaction.Entries.Count If session.Transaction.Entries.Element(E).Description = "DISTRIBUTOR" Then xflag = True Next If xflag = True Then MsgBox "This transaction requires a customer", vbOKOnly, "AOIPRO Message" SendKeys "{F7}" Process = False End If End If End Function

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required