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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dear junmagoncia, have a question for you ,can you help ? 2

Status
Not open for further replies.
Jan 20, 2007
237
0
0
US
Hi junmagoncia,
I would like to be able in the SALES ORDER form, when i create a new sales order#, that when i input in the PO NUMBER txtbox, to check if that po # was already in the table, that way, i will avoid creating another sales order for the same PO #.


Can you help please ?

i have been looking for the prg files and scx but no luck, i am wondering if you can point me to what prg file i need to modify and what will the code to add there, to advise the user, "that PO # already exist "
Thanks in advance
Ernesto
 
Version 5.0i
sopost.prg and sopost.scx
sopost.scx field txtsopost_ponum, you need to write a custom function for lostfocus method.

Edgar
Integrated Bar Code Systems, Inc.
 
Hi Edgar,
Thanks for taking care, i am not able to open the sopost.scx, i tried yesterday and could not open it, i am getting error "Error loading file-record number3 <LW_SLSORD<OR ONE if its members> Parent:Class definition SBTFORM IS NOT FOUND", I am opening from the ide the path is S:\PRO50\SO but i got that error.
so i am fried on that
i was searching on the prg file, anything associated with that field name but can't find anything.

yeah we need to search for that value in the associated table after txtbox lostfocus, if found, then tell the user that the po number already exist.
don't know what to do, to get access to that form
Thanks
ERNESTO
 
Try This:
thread640-1609689

or search for : "Can not open screen form " in this forum.
This applies to all respective SBT forms.

Hope this helps

Edgar
Integrated Bar Code Systems, Inc.
 
HI Edgar,
I was able to opened the form sopost.scx, under the lostfocus event, there is the code below

Code:
LOCAL ll_return

ll_return = .t.

ll_return = g_objevt("GV") OR .t.

= DODEFAULT()

= g_losfcs("L", THIS, ll_return)

RETURN

Can you help me here, on what code do i need to write to search for an existing Po number ?
once this is changed, all the companies that are defined in SBT, that use the sopost form, will have this field validated.
can you help with the code needed
Thanks in advance
 
Hi Ernesto,

Good day to you.

I'm sorry my friend, I was busy this couple of months in preparation of our new project in the company.

But anyways, let me clarify some or few things before showing solution to your scenario.

First of all, I candidly understand your situation. You have an internal problem of double encoding and/or issuance of receipt of a particular customer's PO and you want a control of it right in SBT system. This is fine, if your internal procedure tells you to issue one receipt one PO policy. But what about for customer having several ordered item in just one PO? When this transaction is printed to posting document, sales invoice or delivery receipt to be exact, tendency is that, this is not enough to be printed in just one receipt and you need another page(another SI/DR #series) to print it all, w/c become another number series (other country are using the pre-printed sales invoice). Maybe this is why SBT is thinking in the global demand of SBT system. But in your part, perhaps you're dealing with few item in customer's PO therefore, your need is applicable.

Also, PONumber is coming from your clients, and the possibility is that it can be repeated by other customer, so we'll used the CustNo+PONum to look for if this is recorded already or not.

Below is the source code to answer your need and let us make it simple direct to point and trying to avoid the spaghetti code of SBT (sopost.prg, this is too hard to trace, unless you need). I just put a pop up message to prompt your user that the same PO is already there. Its up to them to continue, or try to rectify my code according to what you really suitable most to you.

Start here. (assume sbt engine is in q:\sbtsys\pro50)
1. Open vfp5 and enter the ff.
1.1 set path to q:\sbtsys\pro50,q:\sbtsys\pro50\so &&tells vfp to look something in the folder.
1.2 set defa to q:\sbtsys\pro50\so &&change default directory
1.3 modi form sopost &&the target form of sbt
(note i know the 3steps is fine but if you have an error try)
set classlib to q:\sbtsys\pro50\sbtlib (and other classlib if needed)

2. In the field that you mentioned above, replace the codes as you see below:

**************************code starts here Ernesto****************
LOCAL ll_return

**new code 2017.03.03
_opntbl=select() &&to save active dbf open at a moment
sele a_somast &&when seek command is executed, your record pointer will change, let us keep it to a variable so you can go back
_order=order() &&to restore current index of somaster
_gorecn=recno() &&current record pointer
doit=.t. &&doit, a variable if to continue or not
_SoCustNo=left(allt(thisform.txtsomast_custno.value),6) &&custcode
_SoPoNumb=left(allt(this.value)+space(20),20) &&ponumber must be in overall char 20
if seek((_SoPoNumb+_SoCustNo),"a_somast","ponum1") &&if PO exist, prompt user
if MESSAGEBOX("P.O Number for this customer already exist. Do you want to continue...",4+32+256,"PoNum: "+ALLTRIM(a_somast.ponum))=7
doit=.f. &&if you dont want to continue, the do it(doit) is false
endif
endif
if doit &&if do it, execute orignal code
**marking of the original code of SBT
ll_return = .t.

ll_return = g_objevt("GV") OR .t.

= DODEFAULT()

= g_losfcs("L", THIS, ll_return)
**end of original code
else &&if not, disable the line item command button to stop him
thisform.cmblb_line.enabled=.f.
thisform.cmblb_cancel.setfocus()
endif


sele a_somast
go _gorecn &&recall current location before seek command
set order to _order &&return index if any
sele (_opntbl) &&go back if open other database
this.value=_SoPoNumb &&make sure ponumber has no blank space from left
RETURN

********
I did not include the history file soymst to shorten the tread and expected you to do so. But if you can't, don't hesitate to ask.


Best,


JunMagoncia
Manila,
Philippines
 
I would like to acknowledged and thanks to Edgar. He's doing great also in this thread.

have a blessed day guys,

best,

JunMagoncia
Manila,
Philippines
 
Hello JunMagoncia,
Thanks so much, for getting back to me.
if i want to include, to look in the history file, all i need to do is add this code
here, see below

Code:
if seek((_SoPoNumb+_SoCustNo),"a_somast","ponum1") &&if PO exist, prompt user
 if seek(_SoPoNumb+_SoCustNo),"a_soymst","ponum1")
  if MESSAGEBOX("P.O Number for this customer already exist. Do you want to continue...",4+32+256,"PoNum: "+ALLTRIM(a_somast.ponum))=7

   doit=.f. &&if you dont want to continue, the do it(doit) is false	
  endif
 endif && for seeking on a_somast
endif  && for seeking on a_soymst

can you please correct me ?
Thanks so much
Ernesto
 
Ernesto:
The purpose of this forum is not to do your work for you. We'll give you whatever help and advice you need, but after that it's up to you.
You should be grateful that Mandaragit has done most of the coding for you.

Edgar
Integrated Bar Code Systems, Inc.
 
I am very grateful for that, what make you think, is it not, just wanted to confirm it, don't see why that bothers you, as i am not being mean, at all.
Thank you
Smileys
 
Hi Ernesto/Smileys

Hey guy, I have forgotten we do have a different time zone. Probably its maybe night time in your location. But anyway, good morning to you. Lets us reference my location, hehehe...

You're doing good and your code is almost there. But let me tune a little bit how to look in the current and history file and adding some PO information like showing where it seek(current/history) and display name,date of order and amount to help user decide. Because if it seek that a PO date is too old(in history), maybe it beyond the issue of double PO. Also, if blank POnumber, the routine will not go there.

Below is the new code for portion of the previous modification

************start here
**this time, let us not include in the search task, for blank PONumber
*Date/Time of Modification: 2017.03.04/5:55am
_PoNumval=allt(this.value)
if !empty(_poNumval) &&exclude PO seek if no PO Reference number
if seek((_SoPoNumb+_SoCustNo),"a_somast","ponum1")
if MESSAGEBOX("P.O Number for this customer already exist in current file."+chr(13)+space(5)+"Customer: "+allt(a_arcust.company)+;
chr(13)+space(5)+"Order Date: "+dtoc(a_somast.ordate)+chr(13)+space(5)+"Amount: "+tran(a_somast.ordamt+a_somast.shpamt,"9,999,999.99")+;
chr(13)+"Do you want to continue...",4+32+256,"PoNum: "+ALLTRIM(a_somast.ponum))=7
doit=.f.
endif
else
if seek((_SoPoNumb+_SoCustNo),"a_soymst","ponum1")
if MESSAGEBOX("P.O Number for this customer already exist in history file."+chr(13)+space(5)+"Customer: "+allt(a_arcust.company)+;
chr(13)+space(5)+"Order Date: "+dtoc(a_soymst.ordate)+chr(13)+space(5)+"Amount: "+tran(a_soymst.ordamt+a_soymst.shpamt,"9,999,999.99")+;
chr(13)+"Do you want to continue...",4+32+256,"PoNum: "+ALLTRIM(a_soymst.ponum))=7
doit=.f.
endif
endif
endif
endif &&if user input PO#

************end

Hpe this helps

best,

JunMagoncia
Manila,
Philippines
 
 http://files.engineering.com/getfile.aspx?folder=8f027243-97f9-4aba-a06a-08278dbe98d5&file=soform.docx
Dear JunMagoncia,
Thanks so much for showing your friendship, your capacity, your availability and your love for helping others, there is always good people everywhere, i really apreciate, to see some codes from where i can learn from others smarter than me,
Edgar is a good guy too but simply, he just want me to make an effort, instead of of confirming, no problem with that, only wanted to reply, that you don't have to answer, i never asked with bad attitude, if a question is posted and the person who read it, don't want to answer, that is fine, if so, then is better.

Peace for all
Thanks to all
Ernesto[bigsmile]
 
Hi Ernesto

Thank you for being friendly to every one. And yes Edgar is good too. In fact, I think better than I am. I saw some of his thread.

Remember that there are always many ways to kill a cat, and maybe that's the way Edgar wanted to help you. I mean he challenged you to think and "do it" (or DOIT, my variable in your problem, hehehe), independently and I admired you so much of thinking it positively. Me too, is also different. As soon as possible, if things are invented, I don't want them to reinvent, instead of share. But I'd like to challenge people finding solution/s for things that something new or does't exist yet, but I'm not saying that my approach is the best practice.

But anyways, have blessed Sunday to all!


Best,

JunMagoncia
Manila,
Philippines
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top