Está en la página 1de 7

*******/*******link de videos de bases de datos********/////

\\192.168.0.203\Area Tecnica\Capacitaciones\Grabaciones\Bases de datos

*************links de referencia del programa de builder*************


https://www.todoexpertos.com/categorias/tecnologia-e-internet/programacion/power-
builder/respuestas/2641261/vista-previa-en-un-datawindow
file:///C:/Users/Administrador.WIN-DTURFDB9NEU/Downloads/manual-de-power-builder-9-
1-espaol_compress.pdf
https://www.lawebdelprogramador.com/foros/Power-Builder/434503-reporte-crosstab-o-
grid-sin-lineas-de-division.html
https://www.youtube.com/watch?v=ARCCfqNNZHg
https://www.lawebdelprogramador.com/foros/Power-Builder/631485-
opensheetwithparm.html
https://infocenter-archive.sybase.com/help/index.jsp?topic=/
com.sybase.dc37781_1150/html/psref/CAICIFGE.htm
https://www.todoexpertos.com/categorias/tecnologia-e-internet/programacion/power-
builder/respuestas/2129268/enviar-mas-de-un-parametro-en-opensheetwithparm
https://www.kyocode.com/2019/04/cursores-sql-server/
https://www.programandoamedianoche.com/2009/11/cursores-en-sql-server/
http://powerbuilder-undiaalavez.blogspot.com/2011/02/crear-datawindow-dinamico.html
https://docs.appeon.com/pb2019/powerscript_reference/ch10s611.html

/////////**********/////////************
https://www.todoexpertos.com/categorias/tecnologia-e-internet/programacion/power-
builder/respuestas/9bexwimn8m6bg/activar-itemchamgedevent-en-datawindow-despues-
que-se-marque-desmarque-una-columna-de-tipo-check

/////***** EJERCICIO DE POWERBUILDER*******///////


*--**--*-*-*- TAREAS
**** VISUALIZAR EN EL COMBOBOX BIEN TODOS LOS REGISTROS// corregido
**datawindows(nombre)***dw_master_reporte********
*****preguntar a franklin el algoritmo para recurisividad del tipo
arbol**************
****** dos grid en factura ********
//////******** grid de productos en detalle factura para agregar ********///////
******//////*****manejo de uptade y commit*********//////
////////*********comit de la cabecera//******validaciones*******////

SELECT CODIGO_ART FROM V_ARTICULO


WHERE NOMBRE_ART= st_precio_arti.tex

messagebox("",CODIGO_ART)
messagebox("Aviso","Facturas")

messagebox("Aviso","Ventas")

:fecha_inicio AND :fecha_fin

string f1,f2
f1=string(em_1.text)
f2=string(em_2.text)
closewithreturn(this,f2)
//closewithreturn(this,cod_fac)
//openwithparm(w_preview_reportes,f1,f2)
date f_inicial,f_final
string cad,cad1
//n_reportes.abrir_factura(dw_master_reporte, cad)
//open(w_pre_rep_fac)
if message.stringparm<>"" then
//st_codigo.text=message.stringparm
cad=message.stringparm
cad1=message.stringparm
f_inicial=date(cad)
f_final=date(cad1)
n_reportes.abrir_venta(dw_master_reporte, f_inicial,f_final)
end if

///*****
SELECT "v_cliente"."codigo_cli",
"v_cliente"."nombre_cli",
"v_cliente"."telefono_cli"
INTO :cedula,
:nombre,
:tel
FROM "v_cliente" ;

//////****codigo cursor***///////

DECLARE custstatecursor CURSOR FOR


SELECT state FROM customer
GROUP BY state HAVING count(state)=1
UNION
SELECT state FROM customer
GROUP BY state
HAVING count(state)>1;
OPEN custstatecursor ;
//Populate the control with a single entry for
//every state in the customer table.
FOR n=1 TO li_nrows
FETCH NEXT custstatecursor INTO :ls_state;
this.additem( ls_state)
NEXT
CLOSE custstatecursor ;
//////*******/////****
// SACA EL PRECIO TOTAL
double sub
double pre
int ca
pre=double(st_precio_arti.text)
ca=integer(em_cantidad.text)
sub=ca*pre;

double sub
double pre
int ca
pre=25
ca=integer(dw_detalle_factura.getitemnumber(fila,4))
sub=ca*pre;
messagebox("aviso",sub)
dw_detalle_factura.setitem(fila, 5, sub)

sum(v_articulo.precio_art*v_detalle_factura.cantidad_dfa) as valor

//**/****
SELECT "v_articulo"."precio_art"
INTO :precio_ar
FROM "v_articulo",
"v_detalle_factura"
WHERE "v_articulo"."codigo_art" = "v_detalle_factura"."codigo_art" ;

///rcha
double sub
double precio_ar
string cod
int ca
int fila,n
fila=dw_detalle_factura.rowcount( )
cod=(dw_detalle_factura.getitemstring(fila,3))
SELECT precio_art INTO :precio_ar FROM V_ARTICULO where codigo_art = :cod;

if getitemnumber(fila,4) <> 0 then


ca=(dw_detalle_factura.getitemnumber(fila,4))
sub=ca*precio_ar;
messagebox("aviso2",sub)
dw_detalle_factura.setitem(fila, 5, sub)

end if

this.settransobject( sqlca )
//this.retrieve()
dw_detalle_factura.Modify('Codigo_Cfa.protect= 1')
dw_detalle_factura.Modify('Precio_Dfa.protect= 1')

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

// SACA EL PRECIO TOTAL


double sub
double pre
int ca
//pre=double(st_precio_arti.text)
//ca=integer(em_cantidad.text)
//sub=ca*pre;

// PARA OBTENER DATOS DEL DATAWINDOWS


int fila
string id
dw_cabecera_factura.accepttext( )
id=dw_cabecera_factura.getitemstring(1,1)

//agregar dw_detalle_factura
fila= dw_detalle_factura.rowcount( ) +1
dw_detalle_factura.insertrow( fila )
//dw_detalle_factura.setitem(fila, 1, "0005")
//dw_detalle_factura.setitem(fila, 2, st_codigo_art.text)
dw_detalle_factura.setitem(fila, 3, id)
//dw_detalle_factura.setitem( fila, 4, integer(em_cantidad.text))
//dw_detalle_factura.setitem( fila, 5, sub)
dw_detalle_factura.setitem(fila, 6, "")
dw_detalle_factura.setitem(fila, 7, "")

string cod
cod=uf_ultimodetalle()
messagebox("detalle",cod)

string ced,fec
date fecha
ced=dw_cabecera_factura.getitemstring(1,2)
fecha=dw_cabecera_factura.getitemdate(1,3)
fec=string(fecha)
if ced=" " or fec=" " then
messagebox("Aviso", "Faltan registros")
return
else
end if

*********//////////************//////////
for k=1 to dw_cabecera_factura.Rowcount()
ced = dw_cabecera_factura.getitemstring(k,'Codigo_cli')
fecha=string(dw_cabecera_factura.getitemdate(k,3))
if (isnull(ced) or ced = '') or (isnull(fecha) or fecha='') then
//muestra mensaje
Messagebox("Aviso", "Ha ocurrido un error al grabar cabecera")
rollback using sqlca;
exit
return
end if
next
messagebox("alerta1",dw_detalle_factura.Rowcount())

for nu=1 to dw_detalle_factura.Rowcount()


messagebox("alerta2",nu)
art = dw_detalle_factura.getitemstring(nu,3)
can = string(dw_detalle_factura.getitemnumber(nu,4))
if (isnull(art) or art = '') or (isnull(can) or can='') then
Messagebox("Aviso", "Ha ocurrido un error al grabar detalle-
cabecera")
rollback using sqlca;
exit
return
elseif dw_cabecera_factura.update( )=1 then
//messagebox( "nota",dw_cabecera_factura.update( ))
//id=dw_cabecera_factura.getitemstring(1,1)
if dw_detalle_factura.update()=1 then
commit using sqlca;
closewithreturn(this,1)
end if
end if

next

***---------------
string ced,fecha,art,can
date f1
int k,nu,fi,fac_fi
fac_fi=dw_cabecera_factura.Rowcount()

for k=1 to fac_fi


ced = dw_cabecera_factura.getitemstring(k,'Codigo_cli')
fecha=string(dw_cabecera_factura.getitemdate(k,3))
if (isnull(ced) or ced = '') or (isnull(fecha) or fecha='') then
//muestra mensaje
Messagebox("Aviso", "Ha ocurrido un error al grabar cabecera")
rollback using sqlca;
exit
return
else

messagebox("alerta1",dw_detalle_factura.Rowcount())
fi=dw_detalle_factura.Rowcount()
for nu=1 to fi
messagebox("alerta2",nu)
art = dw_detalle_factura.getitemstring(nu,3)
can = string(dw_detalle_factura.getitemnumber(nu,4))
if (isnull(art) or art = '') or (isnull(can) or can='') then
Messagebox("Aviso", "Ha ocurrido un error al grabar detalle-
cabecera")
rollback using sqlca;
exit
return
end if
next
end if
if dw_cabecera_factura.update( )=1 and dw_detalle_factura.update()=1 then
//messagebox( "nota",dw_cabecera_factura.update( ))
//id=dw_cabecera_factura.getitemstring(1,1)
commit using sqlca;
closewithreturn(this,1)
end if

next

string ced,fecha,art,can
date f1
int k,nu,fi,fac_fi,variable=0
fac_fi=dw_cabecera_factura.Rowcount()
for k=1 to fac_fi
fi=dw_detalle_factura.Rowcount()
for nu=1 to fi
messagebox("alerta2",nu)
art = dw_detalle_factura.getitemstring(nu,3)
can = string(dw_detalle_factura.getitemnumber(nu,4))
if (isnull(art) or art = '') or (isnull(can) or can='') then
Messagebox("Aviso", "Ha ocurrido un error al grabar detalle-
cabecera")
rollback using sqlca;
exit
return variable
end if
next

ced = dw_cabecera_factura.getitemstring(k,'Codigo_cli')
fecha=string(dw_cabecera_factura.getitemdate(k,3))
if (isnull(ced) or ced = '') or (isnull(fecha) or fecha='') then
//muestra mensaje
Messagebox("Aviso", "Ha ocurrido un error al grabar cabecera")
rollback using sqlca;
exit
return
else

messagebox("alerta1",dw_detalle_factura.Rowcount())

end if
if dw_cabecera_factura.update( )=1 and dw_detalle_factura.update()=1 then
//messagebox( "nota",dw_cabecera_factura.update( ))
//id=dw_cabecera_factura.getitemstring(1,1)
commit using sqlca;
closewithreturn(this,1)
end if
next

***********ARBOL***************
int fila,n
string nombre,codigo
SELECT count(distinct CODIGO_ART) INTO :fila
FROM V_ARTICULO where V_A_CODIGO_ART is null;

DECLARE Cursoruno CURSOR FOR


SELECT nombre_art FROM V_ARTICULO where V_A_CODIGO_ART is null;

OPEN CursorUno ;
FOR n=1 to fila
FETCH NEXT CursorUno INTO :nombre;
tv_padre_hijo.insertitemlast(0,nombre,n)
next
CLOSE CursorUno ;

/////////****sentencias*********////////
//SELECT * FROM "dba"."V_ARTICULO" where V_A_CODIGO_ART is null
//SELECT * FROM V_ARTICULO

//SELECT * FROM V_ARTICULO WHERE V_A_CODIGO_ART ='CO1'

//SELECT * FROM V_ARTICULO WHERE codigo_art in (select v_a_codigo_art from


v_articulo)
select count(v_a_codigo_art) from v_articulo where v_a_codigo_art in (select
codigo_art from v_articulo)

//SELECT * FROM V_ARTICULO WHERE v_a_codigo_art is not null and codigo_art LIKE
'%co1%'
//SELECT count(distinct CODIGO_ART) FROM V_ARTICULO where V_A_CODIGO_ART is null;

count(v_a_codigo_art)

También podría gustarte