#include "FIVEWIN.CH"
FUNCTION buscotxto(lcapital)
local cinit := GetWinDir()+"\mega.ini"
local dgr := GetpvProfString("camino","renpath",,cinit)
local dgrc := GetpvProfString("camino","rencpath",,cinit)
local programa := GetpvProfString("camino","curproga",,cinit)
local memo:=GetpvProfString("camino","curpath",,cinit) +"\" + iif(!lcapital, "padron.dbf","padroncf.dbf")
local memo1:= GetpvProfString("camino","curpath",,cinit) +"\" + iif(!lcapital, "padron.cdx","padroncf.cdx")
if !lcapital
waitrun(dgr + "import") // (1)
else
waitrun(dgrc + "importo") // (2)
endif
sysrefresh()
waiton()
if file(memo)
erase &memo
erase &memo1
endif
if !lcapital
use padron
copy to &memo
dbclosearea()
erase padron.dbf
if !pasaje1("padron");return nil ;endif
delete tag cuit
index on field4 tag cuit
cierroalias(alias())
else
use padroncf
copy to &memo
dbclosearea()
erase padroncf.dbf
if !pasaje1("padroncf");return nil ;endif
delete tag cuit
index on field4 tag cuit
cierroalias(alias())
endif
waitoff()
if msgyesno("Desea Actualizar las bases de datos" + CRLF + "Clientes y proveedores","Mensaje del sistema")
if !lcapital
actualcli(.t.)
actualcli(.f.)
else
actucap(.t.)
actucap(.f.)
endif
endif
return nil
/******************************************************************************/
function actualcli(lcliente)
local oRen
local oMae
local oProve
local aObj := array(0)
local cTexto:= "Actualizando alícuotas rentas de clientes"
local ntotal := 0
if !pasaje("padron");return nil ;endif
database oRen
aadd(aObj,oRen)
oRen:setorder(1)
if lcliente
if !pasaje("maeclie");cldata(aObj) ;return nil ;endif
database oMae
aadd(aObj,oMae)
oMae:setorder(3)
ntotal := oMae:RecCount()
oMae:beof := {|| nil}
oMae:gotop()
MUESTRO(oMae, oRen,ntotal,ctexto,.t.)
else
if !pasaje("maepro");cldata(aObj) ;return nil ;endif
database oProve
aadd(aObj,oProve)
oProve:setorder(3)
oProve:beof := {|| nil}
oProve:gotop()
cTexto:= "Actualizando alícuotas rentas de proveedores"
MUESTRO(oProve, oRen,ntotal,ctexto,.f.)
endif
cldata(aObj)
return nil
/******************************************************************************/
STATIC FUNCTION MUESTRO(oDbf,oRen,nTotal,ctexto, lcliente)
local odlg
local oMtr
local oSay
local nRetiene := ""
local nPercibe := ""
local cCuit := ""
DEFINE DIALOG odlg resource "dia_indexo"
odlg:cCaption := cTexto
REDEFINE PROGRESS oMtr id 160 of odlg
REDEFINE SAY oSay var ctexto id 125
ACTIVATE DIALOG odlg CENTERED NOWAIT ON INIT ( oMtr:SetRange( 1, ntotal ),oMtr:setpos(0))
odbf:gotop()
do
oMtr:nPosition +=1
cCuit := STRTRAN(oDbf:cuit, "-", "")
oRen:seek(cCuit)
if oRen:found()
if reviso(oDbf)
nPercibe := strtran(oRen:field8,",",".")
nRetiene := strtran(oRen:field9,",",".")
oDbf:percibe := val( nPercibe )
oDbf:retiene := val( nRetiene)
oDbf:save()
oDbf:commit()
oDbf:unlock()
endif
elseif lcliente .and. oDbf:nropcia = 1
oDbf:percibe := 3
oDbf:retiene := 1.75
oDbf:save()
oDbf:commit()
oDbf:unlock()
endif
oDbf:skip()
sysrefresh()
until oDbf:eof()
odlg:end()
return nil
/******************************************************************************/
function actucap(lcliente) //actualizacion alicuotas de capital
local oRen
local oMae
local oProve
local aObj := array(0)
local cTexto:= "Alícuotas rentas capital de clientes"
local ntotal := 0
if !pasaje("padroncf");return nil ;endif
database oRen
aadd(aObj,oRen)
oRen:setorder(1)
if lcliente
if !pasaje("maeclie");cldata(aObj) ;return nil ;endif
database oMae
aadd(aObj,oMae)
oMae:setorder(3)
ntotal := oMae:RecCount()
oMae:beof := {|| nil}
waiton()
do
if reviso(oMae)
oMae:percap := 0
oMae:retcap := 0
oMae:save()
oMae:commit()
oMae:unlock()
endif
oMae:skip()
sysrefresh()
until oMae:eof()
waitoff()
MUESTRO1(oMae, oRen,ntotal,ctexto,.t.)
else
if !pasaje("maepro");cldata(aObj) ;return nil ;endif
database oProve
aadd(aObj,oProve)
oProve:setorder(3)
oProve:beof := {|| nil}
oProve:gotop()
waiton()
do
if reviso(oProve)
oProve:percap := 0
oProve:retcap := 0
oProve:save()
oProve:commit()
oProve:unlock()
endif
oProve:skip()
sysrefresh()
until oProve:eof()
waitoff()
ntotal := oProve:RecCount()
oProve:beof := {|| nil}
cTexto:= "Alícuotas rentas capital de proveedores"
MUESTRO1(oProve, oRen,ntotal,ctexto,.f.)
endif
cldata(aObj)
return nil
/******************************************************************************/
STATIC FUNCTION MUESTRO1(oDbf,oRen,nTotal,ctexto, lcliente)
local odlg
local oMtr
local oSay
local nRetiene := ""
local nPercibe := ""
local cCuit := ""
DEFINE DIALOG odlg resource "dia_indexo"
odlg:cCaption := cTexto
REDEFINE PROGRESS oMtr id 160 of odlg
REDEFINE SAY oSay var ctexto id 125
ACTIVATE DIALOG odlg CENTERED NOWAIT ON INIT ( oMtr:SetRange( 1, ntotal ),oMtr:setpos(0))
odbf:gotop()
do
oMtr:nPosition +=1
cCuit := STRTRAN(oDbf:cuit, "-", "")
oRen:seek(cCuit)
if oRen:found()
if reviso(oDbf)
nPercibe := strtran(oRen:field8,",",".")
nRetiene := strtran(oRen:field9,",",".")
oDbf:percap := val( nPercibe )
oDbf:retcap := val( nRetiene)
oDbf:save()
oDbf:commit()
oDbf:unlock()
endif
endif
oDbf:skip()
sysrefresh()
until oDbf:eof()
odlg:end()
return nil
/******************************************************************************/