Este código realiza una serie de cálculos
basados en los valores ingresados en varios controles de texto en un
formulario. Calcula un posible descuento y muestra un mensaje de descuento o la
ausencia de uno, según ciertos criterios. Finalmente, muestra el resultado
final en text18.
La programación se basa en botones de cálculos como por ejemplos los siguientes :
- Calculo
- Liampiar pantalla
- Salir
- Consulta General (Tabla)
- Consulta Individual (Tabla)
- Guardar Registros
- Actualizar registros
- Eliminar Registros
- Consultar Reporte
Thisform.text12.value=(thisform.text6.Value)*(thisform.text10.Value)
Thisform.text13.value=(thisform.text7.Value)*(thisform.text11.Value)
Thisform.text14.value=(thisform.text12.Value)+(thisform.text13.Value)
Thisform.text15.value=(thisform.text14.Value)*12/100
Thisform.text16.value=(thisform.text14.Value)+(thisform.text15.Value)
IF thisform.text16.Value >= 500
thisform.text17.Value=(thisform.text16.value)*3/100
ELSE
thisform.label15.caption=" Usted no tiene descuento "
ENDIF
thisform.text18.Value=(thisform.text16.value)-(thisform.text17.value)
Limpiar pantalla
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=0
thisform.text5.Value=""
thisform.text6.Value=0
thisform.text7.Value=0
thisform.text8.Value=""
thisform.text9.Value=""
thisform.text10.Value=0
thisform.text11.Value=0
thisform.text12.Value=0
thisform.text13.Value=0
thisform.text14.Value=0
thisform.text15.Value=0
thisform.text16.Value=0
thisform.text17.Value=0
thisform.text18.Value=0
thisform.text19.SetFocus
thisform.text1.SetFocus
nAnswer = MESSAGEBOX('USTED DESEA SALIR DEL PROGRAMA?', 4 + 32 + 256, 'Mi Aplicación')
IF nAnswer = 6
WAIT window("Usted esta saliendo del programa") TIME 3
CLEAR WINDOW
* Aquí va el
código que se ejecutará si el usuario selecciona "Sí"
ELSE
ENDIF
USE tablakenny
IF (thisform.text19.value)>0
LOCATE FOR cod=(thisform.text19.value)
IF FOUND()
thisform.text1.Value=empresa
thisform.text2.Value=atencion
thisform.text3.Value=cliente
thisform.text4.Value=cedula
thisform.text5.Value=fecha
thisform.text6.Value=cantidad
thisform.text7.Value=a
thisform.text8.Value=descripcio
thisform.text9.Value=b
thisform.text10.Value=p_unitario
thisform.text11.Value=c
thisform.text12.Value=total
thisform.text13.Value=d
thisform.text14.Value=subtotal
thisform.text15.Value=iva_12
thisform.text16.Value=t_pagar
thisform.text17.Value=des_3_500
thisform.text18.Value=t_sg_des
thisform.text19.value=cod
thisform.text1.SetFocus
ELSE
MESSAGEBOX("NO EXISTE")
thisform.text19.Value=0
thisform.text1.SetFocus
ENDIF
CLOSE ALL
endif
IF (thisform.text19.Value)>=0
USE tablakenny
LOCATE FOR cod=(thisform.text19.Value)
IF FOUND()
MESSAGEBOX("YA EXISTE")
Thisform.text19.Value=0
thisform.text19.SetFocus
ELSE
APPEN BLANK
IF EMPTY(THISFORM.TEXT1.VALUE).OR.EMPTY(THISFORM.TEXT2.VALUE).OR.EMPTY(THISFORM.TEXT3.VALUE).OR.EMPTY(THISFORM.TEXT4.VALUE).OR.EMPTY(THISFORM.TEXT5.VALUE).OR.EMPTY(THISFORM.TEXT6.VALUE).OR.EMPTY(THISFORM.TEXT7.VALUE).OR.EMPTY(THISFORM.TEXT8.VALUE).OR.EMPTY(THISFORM.TEXT9.VALUE).OR.EMPTY(THISFORM.TEXT10.VALUE).OR.EMPTY(THISFORM.TEXT11.VALUE).OR.EMPTY(THISFORM.TEXT12.VALUE).OR.EMPTY(THISFORM.TEXT13.VALUE).OR.EMPTY(THISFORM.TEXT14.VALUE).OR.EMPTY(THISFORM.TEXT15.VALUE).OR.EMPTY(THISFORM.TEXT16.VALUE).OR.EMPTY(THISFORM.TEXT17.VALUE).OR.EMPTY(THISFORM.TEXT18.VALUE).OR.EMPTY(THISFORM.TEXT19.VALUE)
MESSAGEBOX("faltan datos")
else
MESSAGEBOX("SE ESTAN GUARDANDO LOS DATOS")
replace empresa WITH(thisform.text1.Value)
replace atencion WITH(thisform.text2.value)
replace cliente WITH(thisform.text3.Value)
replace cedula WITH(thisform.text4.Value)
replace fecha WITH(thisform.text5.Value)
replace cantidad WITH(thisform.text6.Value)
replace a WITH(thisform.text7.Value)
replace descripcio WITH(thisform.text8.Value)
replace b WITH(thisform.text9.Value)
replace p_unitario WITH(thisform.text10.Value)
replace c WITH(thisform.text11.Value)
replace total WITH(thisform.text12.Value)
replace d WITH(thisform.text13.Value)
replace subtotal WITH(thisform.text14.Value)
replace iva_12 WITH(thisform.text15.Value)
replace t_pagar WITH (thisform.text16.value)
replace des_3_500 WITH (thisform.text17.Value)
replace t_sg_des WITH(thisform.text18.Value)
replace cod WITH(thisform.text19.Value)
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=0
thisform.text5.Value=""
thisform.text6.Value=0
thisform.text7.Value=0
thisform.text8.Value=""
thisform.text9.Value=""
thisform.text10.Value=0
thisform.text11.Value=0
thisform.text12.Value=0
thisform.text13.Value=0
thisform.text14.Value=0
thisform.text15.Value=0
thisform.text16.Value=0
thisform.text17.Value=0
thisform.text18.Value=0
thisform.text19.SetFocus
thisform.text1.SetFocus
CLOSE ALL
ENDIF
ENDIF
ENDIF
Actualizar registros
USE tablakenny
IF (thisform.text19.value)>0
LOCATE FOR cod=(thisform.text19.value)
IF EMPTY(THISFORM.TEXT1.VALUE).OR.EMPTY(THISFORM.TEXT2.VALUE).OR.EMPTY(THISFORM.TEXT3.VALUE).OR.EMPTY(THISFORM.TEXT4.VALUE).OR.EMPTY(THISFORM.TEXT5.VALUE).OR.EMPTY(THISFORM.TEXT6.VALUE).OR.EMPTY(THISFORM.TEXT7.VALUE).OR.EMPTY(THISFORM.TEXT8.VALUE).OR.EMPTY(THISFORM.TEXT9.VALUE).OR.EMPTY(THISFORM.TEXT10.VALUE).OR.EMPTY(THISFORM.TEXT11.VALUE).OR.EMPTY(THISFORM.TEXT12.VALUE).OR.EMPTY(THISFORM.TEXT13.VALUE).OR.EMPTY(THISFORM.TEXT14.VALUE).OR.EMPTY(THISFORM.TEXT15.VALUE).OR.EMPTY(THISFORM.TEXT16.VALUE).OR.EMPTY(THISFORM.TEXT17.VALUE).OR.EMPTY(THISFORM.TEXT18.VALUE).OR.EMPTY(THISFORM.TEXT19.VALUE)
MESSAGEBOX("faltan datos")
else
WAIT window("SE ESTAN GUARDANDO LOS DATOS") TIME 2
replace empresa WITH(thisform.text1.Value)
replace atencion WITH(thisform.text2.value)
replace cliente WITH(thisform.text3.Value)
replace cedula WITH(thisform.text4.Value)
replace fecha WITH(thisform.text5.Value)
replace cantidad WITH(thisform.text6.Value)
replace a WITH(thisform.text7.Value)
replace descripcio WITH(thisform.text8.Value)
replace b WITH(thisform.text9.Value)
replace p_unitario WITH(thisform.text10.Value)
replace c WITH(thisform.text11.Value)
replace total WITH(thisform.text12.Value)
replace d WITH(thisform.text13.Value)
replace subtotal WITH(thisform.text14.Value)
replace iva_12 WITH(thisform.text15.Value)
replace t_pagar WITH (thisform.text16.value)
replace des_3_500 WITH (thisform.text17.Value)
replace t_sg_des WITH(thisform.text18.Value)
replace cod WITH(thisform.text19.Value)
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=0
thisform.text5.Value=""
thisform.text6.Value=0
thisform.text7.Value=0
thisform.text8.Value=""
thisform.text9.Value=""
thisform.text10.Value=0
thisform.text11.Value=0
thisform.text12.Value=0
thisform.text13.Value=0
thisform.text14.Value=0
thisform.text15.Value=0
thisform.text16.Value=0
thisform.text17.Value=0
thisform.text18.Value=0
thisform.text19.SetFocus
thisform.text1.SetFocus
CLOSE ALL
ENDIF
ENDIF
Eliminar Registros
USE tablakenny
IF thisform.text19.Value>0
LOCATE FOR cod=( thisform.text19.Value)
IF FOUND()
thisform.text1.Value=empresa
thisform.text2.Value=atencion
thisform.text3.Value=cliente
thisform.text4.Value=cedula
thisform.text5.Value=fecha
thisform.text6.Value=cantidad
thisform.text7.Value=a
thisform.text8.Value=descripcio
thisform.text9.Value=b
thisform.text10.Value=p_unitario
thisform.text11.Value=c
thisform.text12.Value=total
thisform.text13.Value=d
thisform.text14.Value=subtotal
thisform.text15.Value=iva_12
thisform.text16.Value=t_pagar
thisform.text17.Value=des_3_500
thisform.text18.Value=t_sg_des
thisform.text19.value=cod
WAIT WINDOW("Se estan eliminando los datos ") time 3
DELETE
PACK
thisform.text1.Value=""
thisform.text2.Value=""
thisform.text3.Value=""
thisform.text4.Value=0
thisform.text5.Value=""
thisform.text6.Value=0
thisform.text7.Value=0
thisform.text8.Value=""
thisform.text9.Value=""
thisform.text10.Value=0
thisform.text11.Value=0
thisform.text12.Value=0
thisform.text13.Value=0
thisform.text14.Value=0
thisform.text15.Value=0
thisform.text16.Value=0
thisform.text17.Value=0
thisform.text18.Value=0
thisform.text19.SetFocus
thisform.text1.SetFocus
BROWSE
MESSAGEBOX("REGISTRO ELIMINADO")
CLOSE ALL
ENDIF
ENDIF
Consultar Reporte
REPORT FORM "REPORTFINAL" PREVIEW
A continuación mostraremos una imagen del Reporte General.
Elaborado por : Kenny España Vera
Comentarios
Publicar un comentario