Idiot needs help :)
Posted: Fri Jul 02, 2021 1:51 pm
First, I am the world's worst programmer, I freely admit that. Never learned anything about it but got forced into it about a decade ago when my partner (who was the programmer) retired. I use the 'find something that works, copy it, and make changes' approach as I don't understand the 'infrastructure' of things.
I'm now virtually retired (at 71), but a good friend who still uses my POS program asked me for a favor (well... he bribed me with a bottle of Amaretto - he owns a liquor store.)
He wants a function that will let him scan an item and check the on hand quantity, allow him to edit it, allow him to print a shelf -label, or just move on and scan the next item.
I have been fighting with it for over a week and can't get the basics to work. I can handle the label printing (have routine that I can copy or reference), I can handle the database lookup and qty replacement. I can't get the screen to refresh properly.
I'm using OLD stuff (xBase build 355 and eXpress build 254)
If someone can help me out of their inherent kindness... WONDERFUL.... If I have to pay someone a few bucks to do so - it's worth it to me to avoid losing what little is left of my sanity
Idea is:
- enter or scan an item, it looks up the description (to make sure right item) and the on hand quantity and displays them.
- options to simply move on to next item, edit the quantity, print a label for that item, or close routine.
I can do the database lookups and edit and have routine for printing label. It's the screen refreshing and variable display stuff that's causing my wife to check into reservations for me at the Louisiana State Home for the Really Befuddled.
Attached are 3 screen shots: basic initial entry screen, display if item found, and screen if editing qty. Also below is my feeble attempt at the main function for this.
If any of you kind souls (who have pulled my ass out of the fire a few times in the past) desire to help me I THANK YOU FROM THE BOTTOM OF MY HEART. If you want a few bucks for your trouble - no prob. If you happen to live near New Orleans (moved there from Tampa number of years ago), you're welcome to come over and visit for an evening of interesting conversation supported by beer, wine, or whatever your pleasure is
Optimistically yours... bruce
************************
************************
NOTES:
- scanner used will be programmed with header of [enter] and terminator of [enter]
so p_id CANNOT be blank, focus stays in PID field until p_id has a value, then runs p_lkup()
to verify legit UPC / product ID
if legit, get and display description and on hand qty
if not, msgbox saying invalid UPC/ID ,and then reset variables and set focus to PID
- NEXT button will reset variables and set focus to PID, remove description and qty displays from screen
and get ready to scan next item to check
- EDIT button will allow for entry of corrected on hand qty and update products file,
then set focus to NEXTBUTT
- PRINT button will print 1 label to Zebra printer using routine already written,
then will return focus to NEXTBUTT
- eXit button will close products file and close window
*******************************************************************************
procedure qty_chk()
local getlist:={}
local p_id:=space(20), qty:=0, dscr:='', show:=.f., newqty:=0, editqty:=.f.
// open products file set index to UPC
if o_products(.f.,.t.)
dbsetorder(2)
dbgotop()
else
msgbox('Cannot open PRODUCTS file')
return
endif
@ 1.5, 1 dcsay "Enter/Scan ID" saysize 15 //saycolor 9
@ 1.5, 18 dcget p_id;
GETID 'PID';
TABSTOP;
PICT '@!' ;
VALID {||(!empty(p_id) .and. p_lkup(p_id, @qty, @dscr, @show), DC_GetRefresh(GetList) ) }
@ 3, 1 dcsay 'Desc:' saycolor 9 HIDE{||show = .f.}
@ 3,13 dcsay dscr saycolor 9 HIDE{||show = .f.}
@4.5, 1 dcsay "On Hand Qty:" saycolor 9 saysize 12 HIDE{||show = .f.}
@4.5, 13 dcsay qty saycolor 9 saysize 5 sayfont '14.Arial.Bold' HIDE{||show = .f.}
@5.5, 1 dcsay 'New Qty:' HIDE {||!editqty}
@5.5, 13 dcget newqty GETID 'NEQ' HIDE {||!editqty}
@ 7, 1 DCPUSHBUTTON CAPTION '~Next' SIZE 9,1.2;
ACTION {|| re_set(),SetAppFocus(DC_GetObject(Getlist,'PID')) };
ID 'NEXTBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_N
@ 7, 10 DCPUSHBUTTON CAPTION '~Edit' SIZE 9,1.2;
ACTION {||editqty:=.t.,DC_GetRefresh(GetList), SetAppFocus(DC_GetObject(Getlist,'NEWQ')) };
ID 'EDITBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_E
@ 7, 19 DCPUSHBUTTON CAPTION '~Print' SIZE 9,1.2;
ACTION {|| PrintLabel() };
ID 'PRINTBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_P
@ 7, 28 DCPUSHBUTTON CAPTION 'E~xit' SIZE 9,1.2;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)};
ID 'EXITBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_X
dcgetoptions noescapekey noresize nominbutton nomaxbutton;
BITMAP m_bkg;
COLOR XBPSYSCLR_TRANSPARENT;
sayfont '10.arial'
DCREAD GUI MODAL FIT;
TITLE 'Product Lookup';
options getoptions
return
*****************************************************
procedure re_set()
// resets variables for new product lookup
// p_id:=space(20), qty:=0, dscr:='', show:=.f., newqty:=0, editqty:=.f.
return
*****************************************************
function p_lkup(p_id, qty, dscr, show)
// looks up product description and on hand qty
// first looks for UPC match, if none then Product ID match
// if not found, message box saying not found and reset p_id to space(20)
return good
*****************************************************
procedure printlabel()
// prints 1 label on Zebra printer
return
*******************
I'm now virtually retired (at 71), but a good friend who still uses my POS program asked me for a favor (well... he bribed me with a bottle of Amaretto - he owns a liquor store.)
He wants a function that will let him scan an item and check the on hand quantity, allow him to edit it, allow him to print a shelf -label, or just move on and scan the next item.
I have been fighting with it for over a week and can't get the basics to work. I can handle the label printing (have routine that I can copy or reference), I can handle the database lookup and qty replacement. I can't get the screen to refresh properly.
I'm using OLD stuff (xBase build 355 and eXpress build 254)
If someone can help me out of their inherent kindness... WONDERFUL.... If I have to pay someone a few bucks to do so - it's worth it to me to avoid losing what little is left of my sanity

Idea is:
- enter or scan an item, it looks up the description (to make sure right item) and the on hand quantity and displays them.
- options to simply move on to next item, edit the quantity, print a label for that item, or close routine.
I can do the database lookups and edit and have routine for printing label. It's the screen refreshing and variable display stuff that's causing my wife to check into reservations for me at the Louisiana State Home for the Really Befuddled.
Attached are 3 screen shots: basic initial entry screen, display if item found, and screen if editing qty. Also below is my feeble attempt at the main function for this.
If any of you kind souls (who have pulled my ass out of the fire a few times in the past) desire to help me I THANK YOU FROM THE BOTTOM OF MY HEART. If you want a few bucks for your trouble - no prob. If you happen to live near New Orleans (moved there from Tampa number of years ago), you're welcome to come over and visit for an evening of interesting conversation supported by beer, wine, or whatever your pleasure is

Optimistically yours... bruce
************************
************************
NOTES:
- scanner used will be programmed with header of [enter] and terminator of [enter]
so p_id CANNOT be blank, focus stays in PID field until p_id has a value, then runs p_lkup()
to verify legit UPC / product ID
if legit, get and display description and on hand qty
if not, msgbox saying invalid UPC/ID ,and then reset variables and set focus to PID
- NEXT button will reset variables and set focus to PID, remove description and qty displays from screen
and get ready to scan next item to check
- EDIT button will allow for entry of corrected on hand qty and update products file,
then set focus to NEXTBUTT
- PRINT button will print 1 label to Zebra printer using routine already written,
then will return focus to NEXTBUTT
- eXit button will close products file and close window
*******************************************************************************
procedure qty_chk()
local getlist:={}
local p_id:=space(20), qty:=0, dscr:='', show:=.f., newqty:=0, editqty:=.f.
// open products file set index to UPC
if o_products(.f.,.t.)
dbsetorder(2)
dbgotop()
else
msgbox('Cannot open PRODUCTS file')
return
endif
@ 1.5, 1 dcsay "Enter/Scan ID" saysize 15 //saycolor 9
@ 1.5, 18 dcget p_id;
GETID 'PID';
TABSTOP;
PICT '@!' ;
VALID {||(!empty(p_id) .and. p_lkup(p_id, @qty, @dscr, @show), DC_GetRefresh(GetList) ) }
@ 3, 1 dcsay 'Desc:' saycolor 9 HIDE{||show = .f.}
@ 3,13 dcsay dscr saycolor 9 HIDE{||show = .f.}
@4.5, 1 dcsay "On Hand Qty:" saycolor 9 saysize 12 HIDE{||show = .f.}
@4.5, 13 dcsay qty saycolor 9 saysize 5 sayfont '14.Arial.Bold' HIDE{||show = .f.}
@5.5, 1 dcsay 'New Qty:' HIDE {||!editqty}
@5.5, 13 dcget newqty GETID 'NEQ' HIDE {||!editqty}
@ 7, 1 DCPUSHBUTTON CAPTION '~Next' SIZE 9,1.2;
ACTION {|| re_set(),SetAppFocus(DC_GetObject(Getlist,'PID')) };
ID 'NEXTBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_N
@ 7, 10 DCPUSHBUTTON CAPTION '~Edit' SIZE 9,1.2;
ACTION {||editqty:=.t.,DC_GetRefresh(GetList), SetAppFocus(DC_GetObject(Getlist,'NEWQ')) };
ID 'EDITBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_E
@ 7, 19 DCPUSHBUTTON CAPTION '~Print' SIZE 9,1.2;
ACTION {|| PrintLabel() };
ID 'PRINTBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_P
@ 7, 28 DCPUSHBUTTON CAPTION 'E~xit' SIZE 9,1.2;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)};
ID 'EXITBUTT';
TABSTOP;
ACCELKEY xbeK_ALT_X
dcgetoptions noescapekey noresize nominbutton nomaxbutton;
BITMAP m_bkg;
COLOR XBPSYSCLR_TRANSPARENT;
sayfont '10.arial'
DCREAD GUI MODAL FIT;
TITLE 'Product Lookup';
options getoptions
return
*****************************************************
procedure re_set()
// resets variables for new product lookup
// p_id:=space(20), qty:=0, dscr:='', show:=.f., newqty:=0, editqty:=.f.
return
*****************************************************
function p_lkup(p_id, qty, dscr, show)
// looks up product description and on hand qty
// first looks for UPC match, if none then Product ID match
// if not found, message box saying not found and reset p_id to space(20)
return good
*****************************************************
procedure printlabel()
// prints 1 label on Zebra printer
return
*******************