FoxPro/Visual FoxPro - CODIGO DE ERROR 1807

 
Vista:

CODIGO DE ERROR 1807

Publicado por Mauro (14 intervenciones) el 25/03/2008 18:53:55
Estos son los procedimientos del Formulario , con respecto a las tablas son nativas de VFP.
Los errores los emite en la linea 7,30,50,77,201,225,244, ademas me hace mencion del codigo de Error 1807, al igual que tambien me dice
SQL: La Clausula GRUOP BY falta o no es valida secuencia ON...

gracias por la ayuda

wfechai = thisform.text2.value
wfechaf = thisform.text3.value
set default to &wminidir.
set exact on
do case
case wcobra="a"
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf)group by c.nro_fact order by c.nro_fact desc into cursor str
whtitulo = 'relación de facturas desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)
wordtxt = '( para '+str(wfechaf-wfechai, 4, 0)+' dias, en '+alltrim(wmoneda)+' )'
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001a.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001a.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_fech.doc"
delete file "fac_fech.doc"
wait window at 12, 34 nowait 'generando reporte ....... por favor espere.'+chr(13)+'este proceso puede demorar algunos minutos'
of2w = newobject("frx2word", "c:moni7msoexp")
of2w.savefolder = sys(5)+curdir()
of2w.doc_filename = "fac_fech"
nsuccess = of2w.reportform("fa001a")
w_loca = sys(5)+curdir()+wname
wait window at 14, 38 'fin de proceso. archivo en carpeta '+w_loca+chr(13)+'puede ser leido con word. '+chr(13)+chr(13)+cpreskey
endcase
case wcobra="b"
if whcod_empre=''
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf) group by c.nro_fact order by c.sold_to, c.nro_fact desc into cursor str
else
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf and c.sold_to=whcod_empre) group by c.nro_fact order by c.nro_fact desc into cursor str
endif
whtitulo = 'relación de facturas por cliente'
wordtxt = 'desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)+'. en '+alltrim(wmoneda)
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001b.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001b.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_clte.doc"
delete file "fac_clte.doc"
set message to 'generando reporte ....... por favor espere '
do en_texto with "fa001b", "fac_clte"
endcase
case wcobra="c"
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf) group by c.nro_fact order by c.nro_fact desc into cursor trf
select sum(cantidad), sum(round(cantidad*prec_unit, wredon)), avg(prec_unit), nro_fact, alltrim(item) as item from facturas group by nro_fact, item order by item, nro_fact into cursor trf
select trf.item, trc.fecha_fact, trc.sold_to, trc.nro_fact, trf.avg_prec_unit, trf.sum_cantidad, trf.sum_exp_2, trc.sum_costo_item, trc.sum_exp_3, trc.impto, trc.miscela, trc.descuento from trf, trc where trc.nro_fact=trf.nro_fact order by trf.item, trc.fecha_fact into cursor trf
whtitulo = 'relación de facturas por item, ordenado por fechas'
if whcod_item<>''
set filter to alltrim(tr.item)=alltrim(whcod_item)
whtitulo = 'relacion de facturas para un producto'
else
whtitulo = 'relacion de facturas por producto, (ordenado por codigo de articulo)'
endif
wordtxt = 'desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)+'. en '+alltrim(wmoneda)
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001c.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001c.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_item.doc"
delete file "fac_item.doc"
set message to 'generando reporte ....... por favor espere '
do en_texto with "fa001c", "fac_item"
endcase
endcase
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:CODIGO DE ERROR 1807

Publicado por Gabriel Sánchez (112 intervenciones) el 25/03/2008 21:12:45
Hola: Si estas trabajando con vfp 9 -->
En la versión 9 de Visual FoxPro, cuando haces una consulta
debes colocar en el group by todos los campos que no están afectados por el Count, sum.

Ejm: Tu primera consulta quedaría asi:

select count(item), sum(f.costo_item), ;
sum(round(f.cantidad*f.prec_unit, wredon)), ;
c.sold_to, c.nro_fact, c.fecha_fact, c.impto, ;
c.miscela, c.descuento, f.item, ;
f.costo_item, f.prec_unit, f.cantidad ;
from comefac c, facturas f ;
where c.nro_fact=f.nro_fact ;
and (c.fecha_fact>=wfechai ;
and c.fecha_fact<=wfechaf) ;
group by c.sold_to, c.nro_fact, c.fecha_fact, c.impto, ;
c.miscela, c.descuento, f.item, ;
f.costo_item, f.prec_unit, f.cantidad ;
order by c.nro_fact desc ;
into cursor str

O en todo caso podrias ´decir a fox que se comporte como una version 7
mediante este comando:

SET ENGINEBEHAVIOR 70

wfechai = thisform.text2.value
wfechaf = thisform.text3.value
set default to &wminidir.
set exact on
do case
case wcobra="a"
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf)group by c.nro_fact order by c.nro_fact desc into cursor str
whtitulo = 'relación de facturas desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)
wordtxt = '( para '+str(wfechaf-wfechai, 4, 0)+' dias, en '+alltrim(wmoneda)+' )'
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001a.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001a.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_fech.doc"
delete file "fac_fech.doc"
wait window at 12, 34 nowait 'generando reporte ....... por favor espere.'+chr(13)+'este proceso puede demorar algunos minutos'
of2w = newobject("frx2word", "c:moni7msoexp")
of2w.savefolder = sys(5)+curdir()
of2w.doc_filename = "fac_fech"
nsuccess = of2w.reportform("fa001a")
w_loca = sys(5)+curdir()+wname
wait window at 14, 38 'fin de proceso. archivo en carpeta '+w_loca+chr(13)+'puede ser leido con word. '+chr(13)+chr(13)+cpreskey
endcase
case wcobra="b"
if whcod_empre=''
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf) group by c.nro_fact order by c.sold_to, c.nro_fact desc into cursor str
else
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento, f.item, f.costo_item, f.prec_unit, f.cantidad from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf and c.sold_to=whcod_empre) group by c.nro_fact order by c.nro_fact desc into cursor str
endif
whtitulo = 'relación de facturas por cliente'
wordtxt = 'desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)+'. en '+alltrim(wmoneda)
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001b.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001b.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_clte.doc"
delete file "fac_clte.doc"
set message to 'generando reporte ....... por favor espere '
do en_texto with "fa001b", "fac_clte"
endcase
case wcobra="c"
select count(item), sum(f.costo_item), sum(round(f.cantidad*f.prec_unit, wredon)), c.sold_to, c.nro_fact, c.fecha_fact, c.impto, c.miscela, c.descuento from comefac c, facturas f where c.nro_fact=f.nro_fact and (c.fecha_fact>=wfechai and c.fecha_fact<=wfechaf) group by c.nro_fact order by c.nro_fact desc into cursor trf
select sum(cantidad), sum(round(cantidad*prec_unit, wredon)), avg(prec_unit), nro_fact, alltrim(item) as item from facturas group by nro_fact, item order by item, nro_fact into cursor trf
select trf.item, trc.fecha_fact, trc.sold_to, trc.nro_fact, trf.avg_prec_unit, trf.sum_cantidad, trf.sum_exp_2, trc.sum_costo_item, trc.sum_exp_3, trc.impto, trc.miscela, trc.descuento from trf, trc where trc.nro_fact=trf.nro_fact order by trf.item, trc.fecha_fact into cursor trf
whtitulo = 'relación de facturas por item, ordenado por fechas'
if whcod_item<>''
set filter to alltrim(tr.item)=alltrim(whcod_item)
whtitulo = 'relacion de facturas para un producto'
else
whtitulo = 'relacion de facturas por producto, (ordenado por codigo de articulo)'
endif
wordtxt = 'desde '+dtoc(wfechai)+' hasta '+dtoc(wfechaf)+'. en '+alltrim(wmoneda)
do case
case thisform.optiongroup1.value=1
set message to 'procesando ....... por favor espere '
report form fa001c.frx noconsole preview
case thisform.optiongroup1.value=2
set message to 'imprimiendo ....... por favor espere '
report form fa001c.frx to printer noconsole
case thisform.optiongroup1.value=3
wname = "fac_item.doc"
delete file "fac_item.doc"
set message to 'generando reporte ....... por favor espere '
do en_texto with "fa001c", "fac_item"
endcase
endcase

SET ENGINEBEHAVIOR 90

Suerte.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:CODIGO DE ERROR 1807

Publicado por fabio alvarez (2 intervenciones) el 11/04/2014 04:35:13
Gracias por el aporte...me sirvio muchiiiiisimo
un abrazo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar