Hola !!, aqui les paso el codigo :
*replace totalfaca1.importea with totalfaca1.importea + totalfaca1.importea
LPARAMETERS nKeyCode, nShiftAltCtrl
SET EXCLUSIVE ON
SELECT clientes
pack
SET DELETED on
IF nkeycode = 13
SET DATE TO dmy
SET CENTURY on
thisform.text1.Value = DATE()
SELECT clientes
SET ORDER TO tag xcodigo
SEEK thisform.text4.value
IF .NOT. FOUND()
thisform.text2.Value = 0
thisform.text5.Value = 0
thisform.text10.Value = SPACE(70)
SELECT facturas
GO top
thisform.refresh
ENDIF
IF FOUND()
IF .not. clientes.iva = "Resp. No Inscri"
SET DELETED on
thisform.text2.Value = clientes.nombre
thisform.text5.Value = clientes.cuit
thisform.text10.Value = clientes.iva
thisform.text9.Value = clientes.domicilio
thisform.text11.Value = clientes.ciudad
*SET STEP ON
m.cod = thisform.text4.value
SET SAFETY off
SELECT cursordetalle
zap
SELECT facturas
IF facturas.condicion = "Cta. Cte."
thisform.optiongroup1.option2.Value = 1
endif
SET ORDER TO tag tcod
SEEK thisform.text4.value
IF FOUND()
*replace facturas.total WITH 0
*replace facturas.subtotal WITH 0
*replace facturas.subtotal1 WITH 0
*replace facturas.total WITH 0
*IF facturas.condicion = "Contado"
*thisform.optiongroup1.value = 1
*endif
*IF facturas.condicion = "Cta. Cte."
*thisform.optiongroup1.value = 2
*ENDIF
PUBLIC c
STORE facturas.c TO c
SELECT detalle
SET ORDER TO XC
SEEK facturas.c
IF FOUND()
DO WHILE NOT EOF() AND facturas.c = detalle.c
SELECT cursordetalle
APPEND BLANK
replace cursordetalle.codigoa WITH detalle.codigoa
replace cursordetalle.cantidad WITH detalle.cantidad
replace cursordetalle.descripcion WITH detalle.descripcion
replace cursordetalle.precio WITH detalle.precio
replace cursordetalle.importe WITH detalle.importe
replace cursordetalle.c WITH detalle.c
SELECT detalle
SKIP
ENDDO
ELSE
SELECT cursordetalle
APPEND BLANK
endif
else
SELECT cursordetalle
APPEND blank
*SELECT clientes
*SET ORDER TO tag xcodigo
*SEEK thisform.text4.value
*IF FOUND()
*SET DELETED on
*thisform.text2.Value = clientes.nombre
*thisform.text5.Value = clientes.cuit
*thisform.text10.Value = clientes.iva
*ENDIF
endif
thisform.refresh
thisform.text4.Value = m.cod
SELECT facturas
endif
ENDIF
IF clientes.iva = "Resp. No Inscri"
=messagebox("El cliente es responsable no inscripto por favor dirigirse ha la factura B", 0+64,"Programa de Facturacion")
endif
ENDIF
*endif