Sie sind auf Seite 1von 13

Mantenimiento de una BDD

Utilizar la tabla vendedor agregando los campos feing (fecha de ingreso) y grado estudios).

Realizar tambin las validaciones correspondientes en cada campo:

Paso 1.- crear una funcin a nivel de la aplicacin (file-new-project-Function)

Paso 2.- Crear el DataWindow estilo FreeForm de la tabla vendedor y realizar la validaciones respectivas en cada campo, aunque es opcional dependiendo del pr que este elaborando.

Al campo grado editarlo como un combo:


Seleccione dicho campo y en propiedades seleccionar la pestaa EDIT. En tipos de estilos existen seis tipos, seleccione DropDownListBox. Marca el check Always Show Arrow, para que tenga el aspecto de un com

Ingrese 3 valores en la grilla (code Table) como se muestra en el grfico.

Ademas dar formato de fecha y formato monetario a los campos: fecha de sueldo bsico; en la misma propiedad Edit pero seleccionado EDIT MASK Type.

Paso 3.- Disear el siguiente Formulario:

Nombre de la Ventana: Ventana02

Nombre de la Ventana: Ventana03

Script Open for aplicacin

// Profile Venta SQLCA.DBMS = "ODBC" SQLCA.AutoCommit = False SQLCA.DBParm = "Connectstring='DSN=venta" connect; If Sqlca.Sqlcode<>0 then Messagebox ("Error de Conexin",Sqlca.SqlErrText)

Halt else open(ventana02) end if Script clicked for pb_pri Dw_1.Scrolltorow(1) Dw_1.Setfocus() Script clicked for pb_ant Dw_1.ScrollPriorRow() Dw_1.Setfocus()

Script clicked for pb_Sgte Dw_1.ScrollNextRow() Dw_1.Setfocus()

Script clicked for pb_Ult long nf nf=dw_1.rowcount() dw_1.scrolltorow(nf) dw_1.setfocus() Script clicked for Cb_Nuevo IntNf long nf nf=dw_1.insertrow(0) dw_1.scrolltorow(nf)

dw_1.setfocus() dw_1.setcolumn("codv") cb_graba.enabled=true Script clicked for Cb_graba int res res=dw_1.update() if res=1 then commit using sqlca; //cd_recupera.enabled=false else rollback using sqlca; end if cb_recupera.triggerevent(clicked!) cb_graba.enabled=false End if Script clicked for Cb_Anula long nf nf=dw_1.getrow() if nf>0 then dw_1.deleterow(nf) dw_1.update() dw_1.scrolltorow(1) end if cb_recupera.triggerevent(clicked!) cb_anula.enabled=false Script clicked for Cb_Recupera

Dw_1.Retrieve() cb_graba.enabled=false cb_recupera.enabled=false Script clicked for Cb_Busca open(ventana03) Script clicked for Cb_Recupera dw_1.setfilter("") dw_1.filter() dw_1.setsort("#1 A") dw_1.sort() dw_1.retrieve() cb_graba.enabled=false Script clicked for Cb_Salir Halt Paso 4.- En la ventana 03 codificar los siguientes script Script Load for Ventana03 sle_1.text="" sle_1.setfocus()

Script Modify for sle_1 string cad long nf nf=ventana02.dw_1.getrow() cad="codv = '" + trim(sle_1.text) + "'" ventana02.dw_1.setfilter(cad)

ventana02.dw_1.filter()

if ventana02.dw_1.rowcount()=0 then ventana02.dw_1.setfilter("") ventana02.dw_1.filter() ventana02.dw_1.setsort("#1 A") ventana02.dw_1.sort( ) ventana02.dw_1.scrolltorow(nf) messagebox("Error","Cdigo no existe" + string(nf)) else close(ventana03) ventana02.cb_graba.enabled=true ventana02.dw_1.setfocus() ventana02.dw_1.setcolumn(1) end if

Elaboracion de una factura

Tablas Bsicas para la elaboracin de la factura

Los Script para cada evento 1.- W_Factura Open dw_1.settransobject(sqlca) dw_fac.Settransobject(Sqlca) dw_1.retrieve(" ") Cb_Nueva Clicked int f

select max(Nfac) into :xfac from fac_cab; if isnull(xfac) then xfac=0 end if xfac++ dw_1.reset() f=dw_fac.insertrow(0) dw_fac.scrolltorow(f) dw_fac.setitem(f,1,string(xfac,"000000")) dw_fac.setitem(f,3,today()) dw_fac.setcolumn(2) dw_1.setfocus() A nivel de Dw_1 (detalle factura elaborar el siguiente evento)
Ver imagen

En Event Id Seleccionar Pbm_dwnkey

Dw_1 Tecla (Keycode Key,UnsignedLong Keyflags)

if keydown(keyf2!) then int f f=dw_1.insertrow(0) dw_1.scrolltorow(f) dw_1.setfocus() int m m=dw_1.getitemnumber(1,"maxitem")

if isnull(m) then m=0 end if m++ dw_1.setitem(f,"item",m) dw_1.setitem(f,"nfac",string(xfac,"000000")) open(w_pro) end if Cb_Borrar Clicked //Borrar Item int fila fila=dw_1.getrow() if fila>0 then dw_1.deleterow(fila) dw_1.update() end if Cb_Totaliza Clicked dec tot,igv,neto tot=dw_1.getitemnumber(1,"totgen") igv=tot*0.18 ; neto=tot+igv st_venta.text=string(tot,"##,###.00") st_igv.text=string(igv,"#,###.00") st_neto.text=string(neto,"###,###.00") Cb_Graba Clicked //Compleatar los campos para La tabla Fac_Cabe

dw_fac.setitem(dw_fac.getrow(),"impor",dec(st_venta.text)) dw_fac.setitem(dw_fac.getrow(),"igv",dec(st_igv.text)) dw_fac.setitem(dw_fac.getrow(),"neto",dec(st_neto.text)) int r r=dw_fac.Update() if r=1 then commit; else Rollback; end if // Grabacion del detalle Factura r=dw_1.update() if r=1 then Commit; Else Rollback; End if // Actualizar La tabla Stock int Fila,xcan String Xcod For Fila=1 to Dw_1.Rowcount() Xcod=Dw_1.GetItemString(fila,"codpro") Xcan=Dw_1.GetItemNumber(Fila,"can")

Update Fac_deta

Set Stock = Stock - :Xcan Where Codpro= :Xcod; Next Commit; Dw_pro Activate ( en la ventana de consulta de productos) sle_1.setfocus() dw_1.retrieve()

Dw_pro Open dw_1.settransobject(sqlca) Dw_1 Tecla(Keycode Key, UnsignedLong KeyFlags) int r dec precio if key=keyenter! then r=dw_1.getrow() cad=dw_1.getitemstring(r,1) precio=dw_1.getitemNUmber(r,"puni") W_factura.dw_1.setitem(W_factura.dw_1.getrow(),"codpro",cad) W_factura.dw_1.setitem(W_factura.dw_1.getrow(),"puni",precio) W_factura.dw_1.setcolumn(4) close(parent) end if if key=keyescape! then dw_1.setfilter("") dw_1.filter() sle_1.text=""

sle_1.setfocus() end if Sle_1 Modified

string criterio criterio=" upper(Despro) Like '"+upper(sle_1.text)+"%'" dw_1.setfilter(criterio) dw_1.filter() dw_1.setfocus() dw_1.selectrow(1,true)

Das könnte Ihnen auch gefallen