- Code: Select all Expand view
- Function Add_Modify_Client(oParent,lNew,cCode)
Local oDlg,o4007,o4008,o4009,o4010,o4011,o4012,o4013,o4014,o4015,o4016,o4017,oQry[5],oBrush
Local Codigo:=Space(5),Descrip:=Space(40),Direccion:=Space(40),City_Code:=Space(5),City_Name:=Space(40)
IF lNew
oQry[1] := oConected:Query( "SELECT * FROM Equivalencia ORDER BY Sucursal_Banco" )
Define brush oBrush File "FondoCliente.Png"
DEFINE DIALOG oDlg RESOURCE "Agregar_Cliente" Font oFont //Brush oBrush Transparent
Redefine IMAGE oImage Id 4001 File "NewClientTitle.Png" OF oDlg Transparent
Redefine Get o4007 Var Codigo Id 4007 Of oDlg Picture "@#####" Valid Valida_Cod_Suc(Codigo,oDlg) //(Seek_Sucursal(Codigo,oDlg))
Else
oQry[1] := oConected:Query( "SELECT * FROM Equivalencia WHERE Sucursal_Banco="+cCode )
Descrip:=oQry[1]:Nombre_Sucursal
Direccion:=oQry[1]:Direccion
City_Code:=oQry[1]:Codigo_Prosegur
oQry[2]:=oConected:Query("SELECT * FROM Destino_Regional WHERE Codi_Ciudad="+Str(Val(cCode)))
City_Name:=oQry[2]:Ciudad
Define brush oBrush File "FondoCliente.PNG"
DEFINE DIALOG oDlg RESOURCE "Modificar_Cliente" Font oFont //Brush oBrush //Transparent
Redefine IMAGE oImage Id 4001 File "ModifiClientTitle.Png" OF oDlg Transparent
Redefine Get o4007 Var cCode Id 4007 Of oDlg Picture "@e#####" //Color CLR_BLACK,CLR_WHITE Update
oDlg:Update()
ENDIF
//Redefine Group Id 4006 Of oDlg //Transparent
Redefine Get o4008 var Descrip Id 4008 Of oDlg Picture "@!" Update
Redefine Get o4009 Var Direccion Id 4009 Of oDlg Picture "@!" Update
Redefine Get o4010 Var City_Code Id 4010 Of oDlg Picture "@#####" Valid(Search_City(City_Code,o4012,City_Name)) Update
//Redefine Say o4012 Var City_Name Id 4012 Of oDlg Update
Redefine Say o4012 Var City_Name Id 4012 Of oDlg Font oFont Picture "@!" Color CLR_BLACK, CLR_WHITE Update
Activate Dialog oDlg Centered
Return Nil
*-------------------------------------------------------------------------------------------------------
Function Valida_Cod_Suc(Codigo,oDlg)
Local lRet:=.F.,oQrys
oQrys:=oConected:Query("SELECT * FROM Equivalencia WHERE Sucursal_Banco='"+Codigo+"' Order by Sucursal_Banco" )
*msgAlert(oQrys:nRecCount)
IF oQrys:nRecCount<>0
xBrowse(oQrys)
lRet:=.F.
MsgAlert("Sr. Usuario, El Cliente que intenta Crear ya EXISTE...","Error...")
Else
lRet:=.T.
ENDIF
Return lRet
*-------------------------------------------------------------------------------------------------------
Function Seek_Sucursal( Codigo, oDlg )
LOCAL nSeek,oQry
oQry = oConected:Query( "SELECT * FROM Equivalencia" )
nSeek:= oQry:Seek( Codigo, 1, , , .F.) // lSoft := .T.
*nSeek:= oQry:Locate( { Codigo }, {"Sucursal_Banco"} )
xBrowse(oQry)
MsgAlert(nSeek)
if nSeek == 0 .AND. !Empty(Codigo)
Devuelve:=.T.
ElseIf nSeek ==0 .AND. !Empty(Codigo)
Devuelve:=.F.
elseIf nSeek>0
Devuelve:=.F.
MsgAlert("Sr. Usuario, El Cliente que intenta Crear ya EXISTE...","Error...")
endif
RETURN Devuelve
*-------------------------------------------------------------------------------------------------------
Function Search_City(Codigo,o4012,City_Name)
Local lRet:=.F.,oQrys,cRet
oQrys:=oConected:Query("SELECT * FROM Destino_Regional WHERE Codi_Ciudad="+Alltrim(Str(Int(Val(Codigo)))))
IF oQrys:nRecCount<>0
City_Name:=oQrys:Ciudad
o4012:SetText(City_Name)
lRet:=.t.
Else
MsgAlert("Sr. Usuario, La Ciudad Ingresada No Existe...","Error...")
lRet:=.F.
ENDIF
*oDlg:VarPut(City_Name)
MsgAlert(o4012:SetText(oQrys:Ciudad))
o4012:Refresh()
Return lRet
Espero puedan ayudarme... de ante mano, gracias.