by JOSEMAR » Thu Dec 27, 2007 8:27 pm
hola angel yo qui de nuevo.
no le entiendo pero te dejo mi fuente haber se lehayas , me da error de compilacion en el arreglo
MEMVAR PATRES
Function AVI000()
local oSay, oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7, oSay8
local oSay9, oSay10, oSay11, osay12, oSay13, oSay14, oSay15, oSay16, oSay17
local oGet1, oGet2, oGet3, oGet4, oGet5, oGet6, oGet7, oGet8, oGet9, oGet
LOCAL oFont9, oBtm, oBtm2, oFont10
LOCAL oBmp, oBmp1, oBmp2, oBarrbtm
local oTbmp
local oTbmp1
local oBtnBmp
local oBtnBmp2
local oBtnBmp3
local oBtnBmp4
local oNlab
local oIcono3
local obrush2
public oBmp3
YACAP:=0
YACTA:=0
yafide:=0
okeysup:=.t.
cNumlab:=space(4)
//cNumlab:=0
kcvelab:=space(4)
qcvelab:=space(4)
cNumlab2:=0
CNOMBRE:=space(40)
CDESCON:=SPACE(20)
Cconso:=space(6)
Ccvecon:=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.
cnumtp:=flg_1:=nU:=regs:=Ctarifa:=CCVENVA:=eciclo:=CCANT:=ccant2:=CSUP:=CTARCAN:=CCICLO:=CIMPORTE:=0
cfecexp:=date()
GRABARS:=.f.
ok:=.f.
ok1:=.f.
afile2:={}
USE (patres+"\maelab") ALIAS maelab
//INDEX ON maelab->CVElab to c:\temp\MAELAB
//INDEX ON maelab->N_LAB 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
cTipo:=(maelab)->descon
do while (maelab)->(!eof())
aadd(afile2,subs(maelab)->descon,1,2)
(maelab)->(dbskip())
enddo
USE (patres+"\maepro") ALIAS maepro
INDEX ON maepro->CVENVA to c:\temp\MAEPRO
set index to c:\temp\maepro
close data
USE (patres+"\fide") ALIAS fide
INDEX ON fide->claveconso to c:\temp\fide
set index to c:\temp\fide
close data
USE (patres+"\maelab") ALIAS maelab
INDEX ON maelab->CVElab to c:\temp\MAELAB
//INDEX ON maelab->N_LAB 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+"\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()
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 icon oIcono3;
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 rgb(78,20,240),rgb(0,150,151) font oFont9;
VALID empty(ccvenva).or.Eval ( { ||;
IF (CCVENVA < 100000,;
(msgStop ("La longitud de la cuenta debe ser de 6 digitos"), ok:=.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"), .F. ),(.t.)) )))})
// (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 rgb(78,20,240),rgb(0,150,151) font oFont9
REDEFINE GET oGet2 VAR Csup picture "9999.99" ID 107 of oDlg COLOR rgb(78,20,240),rgb(0,150,151) 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)
// ALERT(STR(LABOR->(FIELDPOS("CVELAB"))))
REDEFINE combobox oNlab VAR ctipo items afile2 ID 109 OF ODLG COLOR rgb(78,20,240),rgb(0,150,151) picture "@x(20)" ;
VALID Eval ( { || (oNlab:settext(cnumlab)),vericta(cnumlab,ccvenva,yacap),vericap(cnumlab,ccvenva,yacap),;
if (YACAP=1,((MSGSTOP("Ya Se Capturo Esta Labor Para Este Productor"),ok1:=.f.),(ok1:=.T.)),;
IF (!maelab->(dbSeek(cnumlab)),;
(msgStop ("No Existe Labor"),ok1:=.F. ),;
(oSay8:settext(cdescon:=maelab->descon),MUEVEDATAS(),;
(oSay9:settext(cimporte:=csup*MAELAB->TARIFA)),;
(pregunta(osay9),oGet:setfocus()),(ok1:=.T.)) ) ) } )
/*
// ALERT(STR(LABOR->(FIELDPOS("CVELAB"))))
REDEFINE combobox oNlab VAR ctipo items afile2 ID 109 OF ODLG COLOR rgb(78,20,240),rgb(0,150,151) picture "@x(20)" ;
alias "labor" itemfield "CVELAB" listfield "descon" ;
VALID Eval ( { || (oNlab:settext(cnumlab)),vericta(cnumlab,ccvenva,yacap),vericap(cnumlab,ccvenva,yacap),;
if (YACAP=1,((MSGSTOP("Ya Se Capturo Esta Labor Para Este Productor"),ok1:=.f.),(ok1:=.T.)),;
IF (!maelab->(dbSeek(cnumlab)),;
(msgStop ("No Existe Labor"),ok1:=.F. ),;
(oSay8:settext(cdescon:=maelab->descon),MUEVEDATAS(),;
(oSay9:settext(cimporte:=csup*MAELAB->TARIFA)),;
(pregunta(osay9),oGet:setfocus()),(ok1:=.T.)) ) ) } )
*/
// VALID Eval ( { || muelabar(CNUMLAB),vericta(cnumlab,ccvenva,yacap),vericap(cnumlab,ccvenva,yacap),;
// (oSay8:settext(cdescon:=maelab->descon),MUEVEDATAS(),;
// (oSay9:settext(cimporte:=csup*MAELAB->TARIFA)),;
// (pregunta(osay9),oGet:setfocus()),(.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" noborder;
ACTION (fuera3:=.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(cnumlab)
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)+cnumlab
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(CNUMLAB,ccvenva,yacap)
oNlab:settext(cnumlab)
//oNlab:Ctext(cnumlab)
return(cnumlab)
function vericap(cnumlab,ccvenva,yacap)
kcvelab:=str(ccvenva,6,0)+cnumlab
use (patres+"\cappag") alias klab new
index on klab->cvelab to c:\temp\avio\aviores\cvelab
set index to c:\temp\cvelab
IF klab->(dbSeek(kcvelab))
YACAP:=1
msgstop("ya existe labor capturada")
close klab
retuRn (ok:=.f.,oget:setfocus())
ELSE
YACAP:=0
ENDIF
close klab
// osay12:settext(kcvelab)
RETURN (YACAP,kcvelab)
function vericta(cnumlab,ccvenva,yacap)
qcvelab:=str(ccvenva,6,0)+cnumlab
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 (ok:=.f.,oget:setfocus())
ELSE
YACTA:=0
ENDIF
close AVIACUM
RETURN (YACTA,qcvelab)
/*
function verifide(yafide,ccvecon)
//use (patres+"\fide") alias fide new
//index on aviacum->cvelab to c:\temp\fide
set index to c:\temp\fide
if !aviacum->(dbSeek(ccvecon))
yafide:=1
msgstop("Productor Sin Fideicomiso")
yafide:=0
RETURN (YAfide)
endif
*/
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()
set filter to LABOR->id_prog=4
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(),ok:=.t.)
else
(REFREAVIS(),oGet:setfocus(),ok:=.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)
SALUDOS, JOSE MARQUEZ
JUAN DIAZ COVARRUBIAS,VERACRUZ ,MEXICO