Muy buenas.. Estoy haciendo un sistema de factura e inventario pero no se como hacer un kardex..

tengo mi formulario con maestro detalle....de mi tabla principal (detalle_factura) y tengo un botón que calcula el iva,subtotal y total y luego los almacena en mi tabla y los muestra en el grid..pero no se como hacer que lo que debite en mi factura afecte a mi inventario y luego lo refleje como un kardex para llevar el control de lo que queda en inventario al momento que se hace la factura y estos son mis códigos del botón guardar

IF EMPTY(thisform.text1.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text1.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text2.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text2.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text3.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text3.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text4.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text4.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text5.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text5.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text6.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text6.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text7.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text7.SetFocus
RETURN
ENDIF
IF EMPTY(thisform.text8.Value)
WAIT WINDOW "CÓDIGO INCORRECTO...." nowait
thisform.text8.SetFocus
RETURN
ENDIF
LOCAL valor1,valor2,valor3,valor4,valor5,valor6,valor7,valor8,valor9,valor10,valor11
valor1 = ALLTRIM(thisform.text1.Value)
valor2 = ALLTRIM(thisform.text2.Value)
valor3 = ALLTRIM(thisform.text3.Value)
valor4 = ALLTRIM(thisform.text4.Value)
valor5 = ALLTRIM(thisform.text5.Value)
valor6 = ALLTRIM(thisform.text6.Value)
valor7 = ALLTRIM(thisform.text7.Value)
valor8 = ALLTRIM(thisform.text8.Value)
valor9 = ALLTRIM(thisform.text9.Value)
valor10 = ALLTRIM(thisform.text10.Value)
valor11= ALLTRIM(thisform.text11.Value)
INSERT INTO detalle_factura (n_factura,cod_producto,des_producto,cantidad,nom_cliente,cod_cliente,precio_unitario,fecha,tipo_iva,subtotal,total);
VALUES (valor1,valor2,valor3,valor4,valor5,valor6,valor7,valor8,valor9,valor10,valor11)
WAIT windows " DATOS GUARDADOS..." nowait
SCATTER MEMVAR memo blank
thisform.Refresh

Ahora necesito relacionar mi tabla detalle_factura con mi tabla inventario pero no se como les ruego me ayuden

Añade tu respuesta

Haz clic para o