PROBLEMA CON LISTBOX

PROBLEMA CON LISTBOX

Postby JOSEMAR » Mon Jan 21, 2008 7:49 pm

HOLA A TODOS:

HARBOUR +FWH 2.4
DISCULPEN LA VERSION ARCAICA PERO NO ME HAN AUTORIZADO LAS ACTUALIZACIONES, EN FIN .
TENGO UNA CAPTURA DONDE ACEPTO LA CLAVE DE UN PRODUCTOR, ESTE VERIFICA QUE EXISTA EN MAESTRO DE PRODUCTORES Y OTRA BASE DE DATOS, QUIERO QUE AL ACEPTAR LA CLAVE ME DESPLEGUE SUS MOVIMINETOS DE CREDITO POR MEDIO DE UN LISTBOX Y SEGUIR ACEPTANDO MAS DATOS, PERO AL ENTRAR AL PROGRAMA SE QUEDA PENSANDO Y LE DOY UN CLICK EN CUALQUIR PARTE Y ME DICE QUE EL PROGRAMA NO RESPONDE.
SI ALGUIEN ME PUDIERA DAR UNA MANITA SE LO AGRADECERIA MUCHO.
DE ANTEMANO MIL GRACIAS.
AHI LES DEJO EL CODIGO FUENTE:

memvar patres
Function AVI000()
local oSay, oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7, oSay8
local oSay9, oSay10, oSay11, osay12, oSay13, oSay14, oSay15, oSay16
local oGet1, oGet2, oGet3, oGet4, oGet5, oGet6, oGet7, oGet8, oGet9, oGet
LOCAL oFont9, oBtm, oBtm2, oFont10
LOCAL oBmp, oBmp1, oBmp2, oBarrbtm
local oLbx
local oTbmp
local oTbmp1
local oBtnBmp
local oBtnBmp2
local oBtnBmp3
local oBtnBmp4
local oNlab
local oIcono3
local obrush2
public oBmp3
YACAP:=0
YACTA:=0
aLab:={}
aDes:={}
cLab:=space(4)
cDes:=space(20)
okeysup:=.t.
cNumlab:=space(4)
kcvelab:=space(4)
qcvelab:=space(4)
cNumlab2:=0
CNOMBRE:=space(40)
CDESCON:=SPACE(20)
Cconso:=space(6)
casoc:=space(4)
cnomeji:=space(20)
csupest:=0
csupred:=0
ecicloe:=space(4)
ezafra:=space(7)
etippag=space(15)
fuera3=.f.
GRABARS:=.f.
ok:=.f.
ok1:=.f.
ok2:=.f.
ok3:=.f.
ok4:=.f.

cnumtp:=flg_1:=nU:=regs:=Ctarifa:=CCVENVA:=eciclo:=CCANT:=ccant2:=CSUP:=CTARCAN:=CCICLO:=CIMPORTE:=0
cfecexp:=date()
GRABARS:=.f.

USE (patres+"\maepro") ALIAS maepro shared new
INDEX ON maepro->CVENVA to c:\temp\MAEPRO
set index to c:\temp\maepro
close data

USE (patres+"\fide") ALIAS fide shared new
INDEX ON fide->claveconso to c:\temp\fide
set index to c:\temp\fide
close data

USE (patres+"\maelab") ALIAS maelab shared new
INDEX ON maelab->cvelab to c:\temp\MAELAB
set index to c:\temp\MAELAB
INDEX ON maelab->descon to c:\temp\LABOR
set index to c:\temp\LABOR
close data

USE (patres+"\aviacum") ALIAS avipas shared new
INDEX ON avipas->CVENVA TO c:\temp\avipas
set index to c:\temp\avipas
close data

USE (patres+"\aviacum") alias avipas shared new
set index to c:\temp\avipas


USE (patres+"\maepro") alias maepro shared new
set index to c:\temp\maepro

USE (patres+"\fide") alias fide shared new
set index to c:\temp\fide

USE (patres+"\maelab") alias maelab shared new
set index to c:\temp\MAELAB

USE (patres+"\maelab") alias labor shared new
FILAVIS(aDEs,aLab,cDes,cLab)
set index to c:\temp\LABOR


// use &patres\CAPPAG alias CAPPAG shared new


CAPPAG()

DbCloseAll()

return nil

function CAPPAG()

DEFINE FONT oFont9 NAME "arial" SIZE 05,14 BOLD


// DO WHILE .t.
DEFINE BRUSH oBrush2 style null

// DEFINE BITMAP oBmp3 resource "lupa"

DEFINE BITMAP oBmp resource "pintura5"

DEFINE ICON oIcono3 resource "logo1"

DEFINE BITMAP oBmp1 resource "pintura1"


DEFINE DIALOG oDlg RESOURCE "AVI000" OF oVentana;
brush obrush2 icon oicono3 font oFont9

redefine say oSay1 id 101 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay2 id 104 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay3 id 106 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay4 id 108 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay6 id 113 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay13 id 123 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
redefine say oSay15 id 125 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
oDlg:bPainted = { | hDC | PalBmpDraw( hDC, 0, 0, oBmp:hBitmap ) }
oIcono3:bPainted = { | hDC | PalBmpDraw( hDC, 0, 0, oIcono3:hIcon ) }
// oVentana:bPainted := { | hDC | InstertBmp( hDC , oBmp3 , oVentana ) }


REDEFINE GET oGet VAR CCVENVA picture "999999" ID 102 OF oDlg;
COLOR "R+/bg+" font oFont9;
VALID empty(ccvenva).or.Eval ( { || filcta1(ccvenva),;
IF (CCVENVA < 100000,;
(msgStop ("La longitud de la cuenta debe ser de 6 digitos"), .F.),;
IF (!maepro->(dbSeek(CCVENVA)),;
(msgStop ("No Existe Productor "), ok:=.F. ),;
(oSay7:settext(oemtoansi(cnombre:=maepro->nombre1)),;
(oSay14:settext(csupest:=maepro->has_est)),;
(oSay16:settext(csupred:=maepro->hasest_red)),;
(oSay10:settext(casoc:=maepro->asoc),ok:=.t.),;
IF (!fide->(dbSeek((MAEPRO->CLAVECONSO))),;
(msgStop("Productor Sin Fideicomiso"), ok:=.F. ),(ok:=.t.)) )))})


REDEFINE LISTBOX oLbx fields TRANSFORM(avipas->CVENVA,"9/99-999"),OemToansi(avipas->descon),TRANSFORM(avipas->ciclo,"9"),;
transform(avipas->sup,"9999.99"),transform(avipas->importe,"99999999,999.99"),OemToansi(avipas->num_sem),;
TRANSFORM(dtoc(avipas->fecexp),"99.99.9999") alias "avipas" font oFont9;
ID 121 OF oDlg head "CLAVE ","CONCEPTO ","CIC"," SUP "," IMPORTE "," NUMSEM "," FEC.EXP. ";
COLOR "R+/BG+"
oLbx:refresh()

oLbx:aJustify={.t.,.f.,.t.,.t.,.t.,.t.,.t.}

oLbx:nLinestyle=11
oLbx:nClrbackhead=nRGB(0,150,151)
oLbx:nClrforehead=nRGB(78,20,240)
oLbx:nClrforefocus=nRGB(249,216,32)
oLbx:nClrbackfocus=nRGB(249,29,83)

oLbx:nClrpane:={||iif((ordkeyno())%2==0,RGB(0,213,213),rgb(0,150,151))}
REDEFINE BTNBMP oBtnBmp4 ID 130 OF odlg prompt "Nvo. Reg." noborder Font oFont9;
ACTION (fuera3:=.t.,REFREAVIS(),oGet:setfocus())

// (oSay10:settext(casoc:=maepro->asoc)),(cconso:=maepro->claveconso),.t.) ))) } )
REDEFINE SAY oSay7 var Cnombre id 103 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)

REDEFINE SAY oSay10 var Casoc id 117 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)

REDEFINE SAY oSay14 var Csupest id 124 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)

REDEFINE SAY oSay16 var Csupred id 126 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)

REDEFINE GET oGet1 VAR Cfecexp ID 105 of oDlg COLOR "R+/BG+" font oFont9

REDEFINE GET oGet2 VAR Csup picture "9999.99" ID 107 of oDlg COLOR "R+/BG+" font oFont9;
VALID Eval ( { ||;
IF (Csup = 0,;
(msgStop ("La superfice Debe Ser Mayor Que Cero"),.F.),;
((redondea(csup),compsup(csup,csupest),oGet2:cText(cSup),oSay11:settext(cSup)),okeysup))})

REDEFINE SAY oSay11 var cSup id 122 of oDlg picture "999.99" font oFont9 color rgb(78,20,240),rgb(0,150,151)

REDEFINE combobox oNlab VAR clab items aDes ID 109 OF ODLG STYLE CBS_DROPDOWN picture "@20(X)" COLOR "R+/BG+" ;
VALID Eval ( { || muelabar(CLAB),vericta(clab,ccvenva,yacap),vericap(clab,ccvenva,yacap),;
if (YACAP=1,((MSGSTOP("Ya Se Capturo Esta Labor Para Este Productor"),ok2:=.f.),(ok2:=.T.)),;
IF (!maelab->(dbSeek(clab)),;
(msgStop ("No Existe Labor"), ok2:=.F. ),;
(oSay8:settext(cdescon:=maelab->descon),MUEVEDATAS(),;
(oSay9:settext(cimporte:=csup*MAELAB->TARIFA)),(pregunta(osay9),oGet:setfocus()),ok2:=.T.) ) ) } )
oNlab:refresh()
//oNlab:setcolor():=rgb(78,20,240),rgb(0,150,151)
oNlab:setfocus()
/*
REDEFINE DBCOMBO oNlab VAR cnumlab ID 109 OF ODLG picture "@20(X)" COLOR "R+/BG+" ;
alias "labor" itemfield labor->("cvelab") listfield labor->("descon") ;
VALID Eval ( { || muelabar(CNUMLAB),vericta(cnumlab,ccvenva,yacap),vericap(cnumlab,ccvenva,yacap),;
if (YACAP=1,((MSGSTOP("Ya Se Capturo Esta Labor Para Este Productor"),ok2:=.f.),(ok2:=.T.)),;
IF (!maelab->(dbSeek(cnumlab)),;
(msgStop ("No Existe Labor"), ok2:=.F. ),;
(oSay8:settext(cdescon:=maelab->descon),MUEVEDATAS(),;
(oSay9:settext(cimporte:=csup*MAELAB->TARIFA)),(pregunta(osay9),oGet:setfocus()),ok2:=.T.) ) ) } )
*/
// REDEFINE SAY oSay12 var kcvelab id 123 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
REDEFINE SAY oSay8 var Cdescon id 110 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)

redefine say oSay9 var cImporte id 114 of oDlg picture "9999,999.99" font oFont9 color rgb(78,20,240),rgb(0,150,151)
REDEFINE BTNBMP oBtnBmp2 ID 116 OF odlg RESOURCE "SALIDA" noborder ;
ACTION (FUERA3:=.t.,odlg:End())
oBtnBmp2:nClrpane=rgb(0,150,151)
/*
REDEFINE BTNBMP oBtnBmp3 ID 119 OF odlg RESOURCE "CANCELAR" ;
ACTION (.t.,REFREAVIS(),oGet:setfocus())
oBtnBmp3:nClrpane=nRGB(40,168,34)
*/
REDEFINE BTNBMP oBtnBmp4 ID 120 OF odlg prompt "Nvo. Reg." noborder Font oFont9;
ACTION (fuera3:=.t.,REFREAVIS(),oGet:setfocus())
// odlg:blostfocus={ || oBtnBmp4:nClrpane=nRGB(249,29,83)}

oBtnBmp4:nClrpane=rgb(0,150,151)

ACTIVATE DIALOG oDlg CENTER
/*
on paint (oGet:setfocus())
If GetKeyState(VK_ESCAPE).or.empty(CCVENVA)
exit
endif
*/
// else
// GRABAAVIS()
return .t.
//enddo
release font oFont9
oFont3:end()

RETURN NIL

FUNCTION MUEVEDATAS()
ctarifa:=maelab->tarifa
cciclo:=maelab->ciclo
ctarcan:=maelab->tarifa_can
eciclo:=maelab->ciclo
ecicloe:=maelab->edi_ciclo
ezafra:=maelab->edi_zafra
etippag:=maelab->tip_pag
cnumtp:=maelab->num_tp
RETURN (CTARIFA,CTARCAN)

/*
function CALIMPAS(CCANT,CTARIFA)
cImporte:=cCant*ctarifa
oSay9:settext(cimporte)
return (cImporte)
*/

function GRABAAVIS()
if (ccvenva=0.or.cSup=0.or.cnombre=space(40).or.cdescon=space(20))
(msgStop ("Registro En Blanco"), ok:=.F.)
return .f.
endif
use (patres+"\CAPPAG") alias CAPPAG new

CAPPAG->(dbAppend())
replace CAPPAG->CVENVA with CCVENVA
replace CAPPAG->nombre1 with cnombre
replace CAPPAG->fecexp with cfecexp
replace CAPPAG->sup with csup
replace CAPPAG->tarifa_can with ctarcan
replace CAPPAG->tarifa with ctarifa
replace CAPPAG->cantidad with ccant
replace CAPPAG->importe with cImporte
replace CAPPAG->asoc with casoc
replace CAPPAG->nomeji with cnomeji
replace CAPPAG->numlab with VAL(clab)
replace CAPPAG->descon with cdescon
replace CAPPAG->ciclo with eciclo
replace CAPPAG->edi_ciclo with ecicloe
replace CAPPAG->edi_zafra with ezafra
replace CAPPAG->tip_pag with etippag
replace CAPPAG->num_tp with cnumtp
replace CAPPAG->fecha with dtos(cappag->fecexp)
replace CAPPAG->clave with str(ccvenva,6,0)
replace CAPPAG->cvelab with str(ccvenva,6,0)+clab
replace CAPPAG->ntp_cve with cnumtp+str(ccvenva,6,0)
commit
//IMPPAGHDS()
REFREAVIS()
close cappag
return nil

/*
FUNCTION IMPPAGHDS()
rep06()
return nil
*/

function REFREAVIS()
flg_1:=ctarifa:=eciclo:=CCANT:=CSUP:=CTARCAN:=CCICLO:=CIMPORTE:=0
cnombre:=space(30)
cNUMLAB:=space(4)
cAsoc:=space(4)
cdescon:=space(20)
oNlab:refresh()
oDlg:refresh()
oSay1:refresh()
oSay2:refresh()
oSay3:refresh()
oSay4:refresh()
oSay6:refresh()
oSay7:refresh()
oSay8:refresh()
oSay9:refresh()
oSay10:refresh()
oSay11:refresh()
//oGet:refresh()
//oGet1:refresh()
oGet2:refresh()
return nil

function muelabar(CLAB,ccvenva,yacap)
oNlab:settext(clab)
return(clab)

function vericap(clab,ccvenva,yacap)
kcvelab:=str(ccvenva,6,0)+clab
use (patres+"\cappag") alias klab new
index on klab->cvelab to c:\temp\cvelab
set index to c:\temp\cvelab
IF klab->(dbSeek(kcvelab))
YACAP:=1
msgstop("ya existe labor capturada")
close klab
retuRn (ok3:=.f.,oget:setfocus())
ELSE
YACAP:=0
ENDIF
close klab
// osay12:settext(kcvelab)
RETURN (YACAP,kcvelab)

function vericta(clab,ccvenva,yacap)
qcvelab:=str(ccvenva,6,0)+clab
use (patres+"\aviacum") alias aviacum new
index on aviacum->cvelab to c:\temp\cvelaba
set index to c:\temp\cvelaba
IF aviacum->(dbSeek(qcvelab))
YACTA:=1
msgstop("Ya Se Dio Credito Para Esta Labor")
close aviacum
retuRn (ok3:=.f.,oget:setfocus())
ELSE
YACTA:=0
ENDIF
close AVIACUM
RETURN (YACTA,qcvelab)

function compsup(csup,csupest)
if csup>csupred
msgstop("Superficie Mayor Que La Estimada")
okeysup:=.f.
return (okeysup,oGet2:setfocus())
else
okeysup:=.t.
return(okeysup)
endif

function FILAVIS(aLab,aDes,cLab,cDes)
set filter to labor->id_prog=4
cLab:=labor->cvelab
cDes:=labor->descon
do while labor->(!eof())
// aadd(aLab,labor->descon)
aadd(aLab,labor->cvelab+" "+labor->descon)
aadd(aDes,labor->descon)
labor->(dbskip())
enddo

return nil

function pregunta(osay9)
// redefine say oSay9 var cImporte id 114 of oDlg picture "9999,999.99" font oFont9 color rgb(78,20,240),rgb(0,150,151) FONT oFont9
If MsgYesNo( OemToAnsi("¨Desea Grabar El Registro"),"Grabar Registro")
(GRABAAVIS(),oGet:setfocus(),ok4:=.t.)
else
(REFREAVIS(),oGet:setfocus(),ok4:=.t.)
endif
return nil

function REDONDEA(cSup)
W_SUP:=cSup
C_LET:=STR(cSup,9,2)
DEC:=SUBSTR(C_LET,8,2)
if VAL(DEC) <=20
DECIM := 00/100
ENDIF
if VAL(DEC) >20.AND.VAL(DEC)<=25
DECIM := 25/100
ENDIF
if VAL(DEC) >25.AND.VAL(DEC)<=35
DECIM := 25/100
ENDIF
if VAL(DEC) >35.AND.VAL(DEC)<=50
DECIM := 50/100
ENDIF
if VAL(DEC) >50.AND.VAL(DEC)<=65
DECIM := 50/100
ENDIF
if VAL(DEC) >65.AND.VAL(DEC)<=75
DECIM := 75/100
ENDIF
if VAL(DEC) >75.AND.VAL(DEC)<=85
DECIM := 75/100
ENDIF
if VAL(DEC) >85
DECIM := 1.00
ENDIF
HASREDON := INT(W_SUP)+DECIM
cSup:=HASREDON
oGet2:ctext(csup)
oSay11:settext(cSup)
RETURN (cSup)

FUNCTION inicCTA1()
set filter to
return nil


FUNCTION filcta1(CCVENVA)
msgstop("comienza folto")

set filter to
set filter to avipas->cvenva=ccvenva
msgstop("ttermina filtor")
//oGet1:setfocus()
//oLbx:upstable()
//oLbx:refresh()

go top
RETURN .t.
SALUDOS, JOSE MARQUEZ
JUAN DIAZ COVARRUBIAS,VERACRUZ ,MEXICO
JOSEMAR
 
Posts: 73
Joined: Thu Dec 06, 2007 4:51 pm
Location: J.D.COVARRUBIAS,VER.,MEXICO

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 99 guests