FoxPro/Visual FoxPro - LIMPIAR TABLAS

 
Vista:
Imágen de perfil de EUSEBIOSANTANA

LIMPIAR TABLAS

Publicado por EUSEBIOSANTANA (33 intervenciones) el 07/02/2012 18:35:28
¡Hola a todos! - ¡Gracias por estar allá!

Ahí les traigo un rompecabezas. pués a mí ya me la rompió.

Tengo un formulario de pagos en donde se ha agregado varias tablas. Realizo el pago y envío a la impresora el recibo, pero el problema es que después de imprimir el recibo la talba "dbTemp1" tiene que limpiarse y quedar sin ninguna información porque es una tabla de uso temporal. El código que uso, no se si será el necesario porque no tengo mucho conocimiento de programación, es el siguiente:


ESTE CODIGO VA EN EL BOTÓN "GUARDAR"

cMessageTitle = 'CONTROL DE PAGOS DE LOS ASOCIADOS -> Guardar'
cMessageText = '¿Desea guardar el registro actual?'
nDialogType = 4 + 32 + 256
* 4 = Yes and No buttons
* 32 = Question mark icon
* 256 = Second button is default

nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)

DO CASE
CASE nAnswer = 6

* Se transfiere el monto a la tabla dbAsociados.
SELECT dbAsociados
replace monto WITH monto - thisform.pageframe1.page4.text5.value
thisform.Refresh

***********************************************************
* Se transfieren los datos a la tabla dbPagos_soc
SELECT dbPagos_soc
GO bottom
APPEND blank
replace balance WITH thisform.pageframe1.page4.m1.Value
replace codigo WITH thisform.pageframe1.page4.c1.Value
replace nombre WITH TRIM(thisform.pageframe1.page4.n1.Value)+[ ]+TRIM
(thisform.pageframe1.page4.a1.Value)
replace fecha WITH thisform.pageframe1.page4.text2.Value
replace descripcion WITH thisform.pageframe1.page4.text3.Value
replace bauche WITH thisform.pageframe1.page4.text4.Value
replace monto WITH thisform.pageframe1.page4.text5.Value
replace balance WITH thisform.pageframe1.page4.m1.Value
IF thisform.pageframe1.page4.combo1.Value = "Otros"
replace bancos WITH thisform.pageframe1.page4.texto5.Value
ELSE
replace bancos WITH thisform.pageframe1.page4.combo1.Value
ENDIF
*********************************************************

* Se transfieren los datos a la tabla dbContabilidad.

SELECT dbContabilidad
APPEND BLANK
replace codigo WITH thisform.pageframe1.page4.c1.Value;
fecha WITH thisform.pageframe1.page4.text2.Value;
descripcion WITH thisform.pageframe1.page4.text3.Value;
ingresos WITH thisform.pageframe1.page4.text5.Value
SUM ingresos TO thisform.pageframe1.page4.texto2.Value
SUM egresos TO thisform.pageframe1.page4.texto3.Value
thisform.pageframe1.page4.texto4.Value = thisform.pageframe1.page4.Text5.value -
thisform.pageframe1.page4.texto3.Value
GO bottom
replace dbContabilidad.total WITH thisform.pageframe1.page4.texto4.value
thisform.pageframe1.page4.grid1.Refresh

*******************************************************************************************************

AQUÍ ES DONDE ESTÁ EL PROBLEMA

* abro la tabla dbTemp1 en exclusiva.
SET PATH TO ../aguilasmatapalo
IF NOT USED("dbTemp1")
USE dbTemp1 IN 0 EXCLUSIVE
ENDIF
SELECT dbTemp1

* Transfiero los datos a la tabla dbTemp1

APPEND BLANK
Replace codigo WITH thisform.pageframe1.page4.c1.Value
Replace nombre WITH TRIM(thisform.pageframe1.page4.n1.Value)+[ ]+TRIM
(thisform.pageframe1.page4.a1.Value)
Replace fecha WITH thisform.pageframe1.page4.text2.Value
replace num WITH thisform.pageframe1.page4.txtNum.Value
Replace descripcion WITH thisform.pageframe1.page4.text3.Value
Replace bauche WITH thisform.pageframe1.page4.text4.Value
Replace monto with thisform.pageframe1.page4.text5.Value
Replace bancos WITH thisform.pageframe1.page4.combo1.Value
Replace balance with thisform.pageframe1.page4.m1.Value

* Mando a imprimir con los datos transferidos a la tabla dbTemp1

cMessageTitle = 'IMPRIMIR'
cMessageText = '¿DESEA IMPRIMIR ESTE REGISTRO?'
nDialogType = 4 + 32 + 256
* 4 = Yes and No buttons
* 32 = Question mark icon
* 256 = Second button is default

nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)
DO CASE
CASE nAnswer = 6

REPORT FORM ..\aguilasmatapalo\reports\prtPagos_soc.FRX PREVIEW

* Trato de limpiar la tabla "DBTEMP1"

CON ESTE ME DICE QUE LA TABLA YA ESTÁ ABIERTA

SET EXCLUSIVE OFF
SET PATH TO ../aguilasmatapalo
USE dbTemp1 IN 0 EXCLUSIVE
ZAP
SELECT dbTemp1

Y CON ESTE ME DICE QUE DEBO DE ABRIR LA TABLA EN MODO
EXCLUSIVO

SET EXCLUSIVE OFF
ZAP

CASE nAnswer = 7
thisform.refresh
ENDCASE
CASE nAnswer = 7
thisform.refresh
ENDCASE


AGRADEZCO CUALQUIER COLABORACIÓN.

Gracias a todos.
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

LIMPIAR TABLAS

Publicado por saul (728 intervenciones) el 07/02/2012 21:54:45
AQUÍ ES DONDE ESTÁ EL PROBLEMA

*!* * abro la tabla dbTemp1 en exclusiva.
*!* SET PATH TO ../aguilasmatapalo
*!* IF NOT USED("dbTemp1")
*!* USE dbTemp1 IN 0 EXCLUSIVE
*!* ENDIF
*!* SELECT dbTemp1


*Yo usando tu mismas lineas de codigo haria esto
*1.-Creas un cursor temporal
*2.-Le pones el nombre de usuario y un codigo aliatorio Sys(3)
*3.-Lo usuas y luego lo cieras porque no te servira hasta la nueva impresion

*4.- Con esto no quiere decir que tu codigo sea lo mejor.. yo no lo hago asi.. (no tengo porque crear temporales hace un cursor tipo sql y listo.. con tus campos que te servira.

* Transfiero los datos a la tabla dbTemp1
_ccodigous ="SAUL"

xCursor = ALLTRIM(_ccodigous) + SYS(3)

CREATE CURSOR &xCursor(;
codigo C(5),;
nombre C(65),;
fecha D(8),;
num C(10),;
descripcion C(80),;
vauche C(15),;
monto N(12,2),;
bancos N(12,2),;
balance N(12,2))

SELECT dbTemp1
APPEND BLANK
Replace codigo WITH thisform.pageframe1.page4.c1.Value
Replace nombre WITH TRIM(thisform.pageframe1.page4.n1.Value)+[ ]+TRIM
(thisform.pageframe1.page4.a1.Value)
Replace fecha WITH thisform.pageframe1.page4.text2.Value
replace num WITH thisform.pageframe1.page4.txtNum.Value
Replace descripcion WITH thisform.pageframe1.page4.text3.Value
Replace bauche WITH thisform.pageframe1.page4.text4.Value
Replace monto with thisform.pageframe1.page4.text5.Value
Replace bancos WITH thisform.pageframe1.page4.combo1.Value
Replace balance with thisform.pageframe1.page4.m1.Value

* Mando a imprimir con los datos transferidos a la tabla dbTemp1

cMessageTitle = 'IMPRIMIR'
cMessageText = '¿DESEA IMPRIMIR ESTE REGISTRO?'
nDialogType = 4 + 32 + 256
* 4 = Yes and No buttons
* 32 = Question mark icon
* 256 = Second button is default

nAnswer = MESSAGEBOX(cMessageText, nDialogType, cMessageTitle)
DO CASE
CASE nAnswer = 6

REPORT FORM ..\aguilasmatapalo\reports\prtPagos_soc.FRX PREVIEW

USE IN dbTemp1
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