by JOSEMAR » Fri Jul 04, 2008 12:29 am
y aqui el codigo fuente
MEMVAR PATRES
Function her020()
local oSay, oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7, oSay8
local oSay9, oSay10, oSay11
local oGet1, oGet2, oGet3, oGet4, oGet5, oGet6, oGet7, oGet8, oGet9, oGet
LOCAL oFont9, oBtm, oBtm2, oFont10
LOCAL oBmp, oBmp1, oBmp2
local oTbmp
local oTbmp1
local oBtnBmp
local oBtnBmp2
local oBtnBmp3
local oBtnBmp4
local oNlab
local oIcono3
public oLBX
aLab:={}
aDes:={}
cLab:=space(4)
cDes:=space(20)
cNumlab:=space(4)
cNumlab2:=0
CNOMBRE:=space(40)
CDESCON:=SPACE(20)
casoc:=space(4)
cnomeji:=space(20)
ecicloe:=space(4)
ezafra:=space(7)
etippag=space(15)
vencim:=SPACE(16)
cnumtp:=space(2)
fuera3=.f.
fuera=.f.
GRABARS:=.f.
flg_1:=nU:=regs:=Ctarifa:=CCVENVA:=eciclo:=CCANT:=ccant2:=CSUP:=CTARCAN:=CCICLO:=CIMPORTE:=0
cfecexp:=date()
GRABARS:=.f.
//COPY FILE C:\AVIO\AVIORES\HERBICID.DBF TO C:\AVIO\AVIORES\TMP_HER.DBF
COPY FILE (PATRES+"\HERBICID.DBF") TO (PATRES+"\TMP_HER.DBF")
USE (patres+"\TMP_HER") ALIAS TMP_HER SHARED NEW
INDEX ON TMP_HER->CVENVA TO c:\temp\TMP_HER
set index to c:\temp\TMP_HER
close data
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+"\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+"\maelab") alias idlab shared new
sort to c:\temp\paso on descon for idlab->id_prog=2
filherr(aDEs,aLab,cDes,cLab)
close idlab
USE (patres+"\maepro") alias maepro shared new
set index to c:\temp\MAEPRO
USE (patres+"\maelab") alias maelab shared new
set index to c:\temp\MAELAB
USE (patres+"\maelab") alias labor shared new
set index to c:\temp\LABOR
//tmpher:=select()
USE (patres+"\TMP_HER") alias TMP_HER shared new
set index to c:\temp\TMP_HER
CAPHERS()
DbCloseAll()
return nil
function CAPHERS()
DEFINE FONT oFont9 NAME "arial" SIZE 05,14
//DO WHILE .t.
DEFINE BITMAP oBmp resource "pintura5"
DEFINE ICON oIcono3 resource "logo1"
DEFINE BITMAP oBmp1 resource "pintura1"
DEFINE DIALOG oDlg RESOURCE "HER020" OF oVentana icon oIcono3 font oFont9
// REDEFINE BITMAP oTbmp ID 122 ADJUST RESOURCE "graminea" OF oDlg
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 oSay5 id 111 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)
oDlg:bPainted = { | hDC | PalBmpDraw( hDC, 0, 0, oBmp:hBitmap ) }
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 ( { || leetemp(ccvenva),;
IF (CCVENVA < 100000,;
(msgStop ("La longitud de la cuenta debe ser de 6 digitos"), .F.),;
IF (!maepro->(dbSeek(CCVENVA)),;
(msgStop ("No Existe Productor "), .F. ),;
(oSay7:settext(oemtoansi(cnombre:=maepro->nombre1)),;
(oSay10:settext(casoc:=maepro->asoc)),(LEETEMP(CCVENVA)),.T.) ) ) } )
REDEFINE LISTBOX oLbx fields TRANSFORM(TMP_HER->CVENVA,"9/99-999"),OemToansi(TMP_HER->descon),OemToansi(TMP_HER->edi_ciclo),;
transform(TMP_HER->sup,"9999.99"),transform(TMP_HER->cantidad,"999,999.99"),;
TRANSFORM(dtoc(TMP_HER->fecexp),"99.99.9999") alias "TMP_HER" font oFont9;
ID 121 OF oDlg head "CLAVE ","CONCEPTO ","CIC"," SUP ","CANTIDAD "," FEC.EXP. ";
COLOR "R+/BG+"
//oLbx:refresh()
oLbx:aJustify={.t.,.f.,.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:bgotfocus = {|| oGet1:setfocus()}
//oLbx:nClrpane:={||iif((ordkeyno())%2==0,RGB(0,213,213),rgb(0,150,151))}
oLbx:nClrpane:={||iif((ordkeyno(dbselectarea("tmp_her")))%2==0,RGB(0,213,213),rgb(0,150,151))}
//oLbx:bgotfocus = {|| oGet1:setfocus(),DBCLOSEAREA("TMP_HER")}
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 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.),;
(.t.))})
/*
REDEFINE DBCOMBO oNlab VAR cnumlab ID 109 OF ODLG COLOR rgb(78,20,240),rgb(0,150,151) ;
alias "labor" itemfield "CVELAB" listfield "descon" ;
VALID Eval ( { || muelabhr(CNUMLAB),;
IF (!maelab->(dbSeek(cnumlab)),;
(msgStop ("No Existe Labor"), .F. ),;
(oSay8:settext(cdescon:=maelab->descon),muevedathr(),;
(oSay11:settext(CCANT:=CSUP*MAELAB->TARIFA_CAN)),;
(oget4:CTEXT(cCant)),.T.) ) } )
*/
REDEFINE combobox oNlab VAR clab items aDes ID 109 OF ODLG STYLE CBS_DROPDOWNLIST picture "@20(X)" COLOR rgb(78,20,240),rgb(0,150,151) ;
VALID Eval ( { || muelabhr(CLAB),;
IF (!maelab->(dbSeek(clab)),;
(msgStop ("No Existe Labor"), ok2:=.F. ),;
(oSay8:settext(cdescon:=maelab->descon),muevedathr(),;
(oSay11:settext(ccant:=csup*MAELAB->TARIFA_can)),;
(oGet4:ctext(cCant)),ok2:=.T.) ) } )
oNlab:refresh()
//oNlab:setcolor():=rgb(78,20,240),rgb(0,150,151)
oNlab:setfocus()
REDEFINE SAY oSay8 var Cdescon id 110 of oDlg font oFont9 color rgb(78,20,240),rgb(0,150,151)
REDEFINE SAY oSay11 var CCANT id 118 of oDlg picture "999999.99" font oFont9 color rgb(78,20,240),rgb(0,150,151)
REDEFINE GET oGet4 VAR Ccant ID 112 of oDlg picture "999999.99" COLOR rgb(78,20,240),rgb(0,150,151) font oFont9 ;
valid (CALIMPS(ccant,ctarifa),.t.)
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 oBtnBmp ID 115 OF odlg RESOURCE "PRN2" NOBORDER ;
ACTION (FUERA3:=.t.,GRABARS())
oBtnBmp:nClrpane=nRGB(0,150,151)
REDEFINE BTNBMP oBtnBmp2 ID 116 OF odlg RESOURCE "SALIDA" NOBORDER;
ACTION (FUERA3:=.t.,odlg:End())
oBtnBmp2:nClrpane=nRGB(0,150,151)
REDEFINE BTNBMP oBtnBmp3 ID 119 OF odlg RESOURCE "CANCELAR" NOBORDER;
ACTION (REFRESCAS(),oGet:setfocus())
oBtnBmp3:nClrpane=nRGB(0,150,151)
REDEFINE BTNBMP oBtnBmp4 ID 120 OF odlg prompt "Nvo. Reg." NOBORDER Font oFont9;
ACTION (REFRESCAS(),oGet:setfocus())
oBtnBmp4:nClrpane=nRGB(0,150,151)
ACTIVATE DIALOG oDlg CENTER
/*
on paint (oGet:setfocus())
If GetKeyState(VK_ESCAPE).or.empty(CCVENVA)
exit
endif
*/
// else
// GRABARS()
return .t.
//enddo
release font oFont9
oFont3:end()
RETURN NIL
FUNCTION muevedathr()
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
vencim:=maelab->fec_ven
RETURN (CTARIFA,CTARCAN)
function CALIMPS(CCANT,CTARIFA)
cImporte:=cCant*ctarifa
oSay9:settext(cimporte)
return (cImporte)
function GRABARS()
if (ccvenva=0.or.cSup=0.or.cCant=0.or.cImporte=0)
(msgStop ("algunos De Los Registros Estan en En Blanco"), fuera:=.F.)
return .f.
endif
use (patres+"\HERBICID") alias HERBICID shared new
HERBICID->(dbAppend())
replace HERBICID->CVENVA with CCVENVA
replace HERBICID->nombre1 with cnombre
replace HERBICID->fecexp with cfecexp
replace HERBICID->sup with csup
replace HERBICID->tarifa_can with ctarcan
replace HERBICID->tarifa with ctarifa
replace HERBICID->cantidad with ccant
replace HERBICID->importe with cImporte
replace HERBICID->asoc with casoc
replace HERBICID->nomeji with cnomeji
replace HERBICID->numlab with VAL(clab)
replace HERBICID->descon with cdescon
replace HERBICID->ciclo with eciclo
replace HERBICID->edi_ciclo with ecicloe
replace HERBICID->edi_zafra with ezafra
replace HERBICID->tip_pag with etippag
replace HERBICID->num_tp with cnumtp
replace HERBICID->fecha with dtos(HERBICID->fecexp)
replace HERBICID->clave with str(ccvenva,6,0)
replace HERBICID->cvelab with str(ccvenva,6,0)+clab
replace HERBICID->ntp_cve with cnumtp+str(ccvenva,6,0)
commit
IMPPAGHDS()
// MSGALERT("DESPUES DE IMPRIMIR ANTES DE REFRESCAR")
REFRESCAS()
// MSGALERT("DESPUES DE REFRESCAR ANTES DE CERRAR HERBICID")
close herbicid
// MSGALERT("DESPUES DE CERRAR HERBICID")
return nil
FUNCTION IMPPAGHDS()
rep06()
return nil
function REFRESCAS()
flg_1:=ctarifa:=eciclo:=CCANT:=CSUP:=CTARCAN:=CCICLO:=CIMPORTE:=0
cnombre:=space(30)
cNUMLAB:=space(4)
cNUMLAB2:=0
cdescon:=space(20)
oNlab:refresh()
oDlg:refresh()
oSay1:refresh()
oSay2:refresh()
oSay3:refresh()
oSay4:refresh()
oSay5:refresh()
oSay6:refresh()
oSay7:refresh()
oSay8:refresh()
oSay9:refresh()
oSay10:refresh()
oSay11:refresh()
oGet:refresh()
//oGet1:refresh()
oGet2:refresh()
oGet4:refresh()
//oGet:setfocus() ///
oLbx:refresh()
return nil
function muelabhr(CNUMLAB)
oNlab:settext(cnumlab)
return(cnumlab)
function filherr(aLab,aDes,cLab,cDes)
use c:\temp\paso alias paso shared new
cLab:=PASO->cvelab
cDes:=PASO->descon
do while PASO->(!eof())
// aadd(aLab,paso->descon)
aadd(aLab,PASO->cvelab+" "+PASO->descon)
aadd(aDes,PASO->descon)
PASO->(dbskip())
enddo
close paso
return nil
FUNCTION LEETEMP(ccvenva)
/*
IF USED("TMP_HER")
DBCLOSEAREA("TMP_HER")
ENDIF
USE (patres+"\TMP_HER") ALIAS TMP_HER SHARED NEW
INDEX ON TMP_HER->CVENVA TO c:\temp\TMP_HER
*/
dbselectarea("tmp_her")
//dbUSEarea(.T.,"C:\AVIO\AVIORES\tmp_her","TMP_HER",.T.)
set filter to
set filter to TMP_HER->cvenva=ccvenva
oGet:setfocus()
oGet:refresh()
//oLbx:upstable()
oLbx:refresh()
DBGOTOP()
//ordkeyno("c:\temp\TMP_HER")
RETURN NIL
/*
function FILTHERS()
set filter to id_prog=2
return nil
*/
/*
FUNCTION inicial()
set filter to
DBGOTOP()
return nil
*/
SALUDOS, JOSE MARQUEZ
JUAN DIAZ COVARRUBIAS,VERACRUZ ,MEXICO