Okay so sorry,
Im getting a popup error saying "There is a missing keyword in the FOR...ENDFOR or DO CASE....ENDCASE command structure. Here is the code that im running; the program is crashing in the second line in this code "case shiploca=' '
do case
case shiploca=' '
skip
case retailponu # ' '
select cus
seek 'PETCO '
locate for '#'+m->storenum+' '$cusname while cusname='PETCO '
if !found()
exit
endif
* we have a store
trandate = date()
if val(cus->cusdelday) > 0
do while str(dow(m->trandate),1) <> cus->cusdelday ;
trandate = m->trandate + 1
endif
select tran
loopit = .f.
seek 'O'+cus->cuscode
do while trantype = 'O'.and.;
cuscode = cus->cuscode.and.!loopit.and.!eof()
if po == m->po
loopit = .t.
endif
skip
seek 'i'+cus->cuscode
do while trantype = 'i'.and. cuscode = cus->cuscode.and.!loopit.and.!eof()
if po = m->po
loopit = .t.
endif
skip
enddo
select temptran
locate for po = m->po
if !eof()
loopit = .t.
endif
select tran
if loopit
select dbfdata
continue
loop
endif
mtrannum = NextTran()
select temptran
if add_rec( 3 )
replace ;
Cuscode with cus->Cuscode, ;
Cusname with cus->Cusname, ;
Salesman with cus->CusSalesmn, ;
Trancol with cus->CusCol, ;
Trandue with cus->Cusdaysdue, ;
Trandisc with cus->Cusdisc, ;
Billto with cus->Billto, ;
Trantype with 'O', ;
trannum with m->mtrannum, ;
Trandate with m->trandate, ;
PO with m->PO, ;
trandisc with 2
endif
select dbfdata
skip
case poline # ' '
total = 0
mline = 0
line = '0'
do while m->storenum = trim(shiploca) .and. !eof()
mitem=alltrim(vendorstyl)
do case
case len(mitem)=1
mitem='000'+mitem
case len(mitem)=2
mitem='00'+mitem
case len(mitem)=3
mitem='0'+mitem
endcase
select inv
seek trim(m->mitem) &&seek trim(petcopo->c)
if !found()
do errormess with 'Item '+trim(m->mitem)+' is unknown' &&do errormess with 'Item '+trim(petcopo->c)+' is unknown'
select dbfdata
skip
loop
* record this unknown
endif
line = str(mline+1,3,0)
mline = val(line)
* 08/12/05 11:00am made discount a memvar previously was inv->discount
* okc gives 2% on livestock 0% on frozen
discount = 'N'
if sku01disc>0
discount = 'Y'
endif
select tempstat
if upper(dbfdata->unitmeasur) # 'CASE'
append blank
replace ;
trannum with m->mtrannum, ;
tranline with m->line, ;
prodnum with inv->prodnum, ;
ordqty with val(dbfdata->qtyordered), ;
shipqty with val(dbfdata->qtyordered), ;
descript with inv->sku01desc, ;
price with inv->sku01prc, ;
searchcode with inv->searchcode, ;
taxable with inv->taxable, ;
printlabel with 'N', ;
updated with .f., ;
discount with m->discount, ;
com_rate with inv->com_rate, ;
category with inv->category
dbcommit()
total = m->total + shipqty * inv->sku01prc
select inv
rec_lock()
if reserved + tempstat->shipqty < 900000 && n,6
replace reserved with reserved + tempstat->shipqty
else
replace reserved with 900000
endif
dbcommit()
unlock
select tempstat
else
* do the case thing
select tempstat
for i = 1 to val(dbfdata->qtyordered)
append blank
replace ;
trannum with m->mtrannum, ;
tranline with m->line, ;
prodnum with inv->prodnum, ;
ordqty with inv->sku01qty, ;
shipqty with inv->sku01qty, ;
descript with inv->sku01desc, ;
price with inv->sku01prc, ;
searchcode with inv->searchcode, ;
taxable with inv->taxable, ;
printlabel with 'N', ;
updated with .f., ;
discount with m->discount, ;
com_rate with inv->com_rate, ;
category with inv->category
dbcommit()
total = m->total + shipqty * inv->sku01prc
select inv
rec_lock()
if reserved + tempstat->shipqty < 900000 && n,6
replace reserved with reserved + tempstat->shipqty
else
replace reserved with 900000
endif
dbcommit()
unlock
if i < val(dbfdata->qtyordered)
line = str(mline+1,3,0)
mline = val(line)
endif
select tempstat
next
endif case thing
select dbfdata
if !eof()
skip
endif
enddo
select dbfdata
for num = 1 to 2
line = str(val(m->line)+1,3,0)
if num = 1
if lcharge1 = ' '
line = str(val(m->line)-1,3,0)
loop
endif
code = lcharge1
ord = 0
ship = 1
endif
if num = 2
if lcharge2 = ' '
loop
endif
code = lcharge2
ord = 1
ship = 1
endif
select inv
seek code
if !found()
* record this unknown
endif
select tempstat
append blank
replace ;
trannum with m->mtrannum, ;
tranline with m->line
replace ;
prodnum with inv->prodnum, ;
ordqty with m->ord, ;
shipqty with m->ship
replace ;
descript with inv->sku01desc, ;
price with inv->sku01prc, ;
searchcode with inv->searchcode, ;
taxable with inv->taxable
replace ;
printlabel with 'N', ;
updated with .f., ;
discount with m->discount, ;
com_rate with inv->com_rate, ;
category with inv->category
select inv
rec_lock()
replace reserved with reserved + tempstat->shipqty
dbcommit()
unlock
total = m->total + m->ship * inv->sku01prc
select dbfdata
next
* endfor
select temptran
replace trantotal with m->total
select dbfdata
enddo
endcase
**********************************************************************
enddo
Thanks for your help