#include "fivewin.ch"
#include "TSBrowse.ch"
#define CLR_PINK nRGB( 255, 128, 128)
#define CLR_NBLUE nRGB( 128, 128, 192)
#define CLR_NBROWN nRGB( 130, 99, 53)
#define CLR_CIAN nRGB( 213, 255, 255)
#define CLR_BLUES nRGB( 100, 88, 239)
#define CLR_1 nRGB( 190, 215, 190 )
#define CLR_2 nRGB( 230, 230, 230 )
#define CLR_3 nRGB( 217, 217, 255 )
*úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú*
Function Banco(oWnd,oMenuIt)
Local oDlg, oBrw, oRec, oLbx, hBorland,oFont,oDbf[1],oWndChild,aBrush[ 1 ], aBmp[ 1 ]
Local oToolBar1,oToolBar2,oToolBar3,oToolBar4,oToolBar5,oToolBar6
Local oImgList1,oImgList2,oImgList3,oImgList4,oImgList5,oImgList6
oMenuIt:Disable()
//oToolbar1:EnableButton(2,.F.)
Set Deleted On
SET 3DLOOK ON
If ( DbUseFile("Bancos.DBF",.T.,"DBFNTX") )
DataBase oDbf[1]
oDbf[1]:AddIndex("Cod_Ban","Cod_Ban")
oDbf[1]:AddIndex("Des_Ban","Des_Ban")
Else
Return Nil
EndIf
(oDbf[1]:SetOrder(1))
(oDbf[1]:GoTop())
Public Campos:={Ban_Cod,Ban_Des},;
Titulo:={'CODIGO','DESCRIPCION'},;
Anchos:={10,40}
DEFINE WINDOW oWndChild;
MDICHILD;
FROM 3, 10 TO 26.2, 76.3;
TITLE "Bancos Registrados" NOZOOM;
OF oWnd
SET MESSAGE OF oWndChild TO " " Font oMainFont
DEFINE FONT oFont NAME "Estrangelo Edessa" SIZE 07,19 BOLD
DEFINE DIALOG oDlg RESOURCE "Browsess" OF oWndChild Font oMainFont
DEFINE BRUSH aBrush[ 1 ] File "WPaper.Bmp"
oImgList1 = TImageList():New( 32, 32 )
oImgList2 = TImageList():New( 32, 32 )
oImgList1:AddMasked( TBitmap():Define( ,"Nuevo.Bmp", oWndChild ), /*nRGB(121,191,218)*/ )
oImgList1:AddMasked( TBitmap():Define( ,"Modif.Bmp", oWndChild ), /*nRGB(121,191,218)*/ )
oImgList1:AddMasked( TBitmap():Define( ,"BluePRT.Bmp", oWndChild ), /*nRGB( 255, 0, 255 )*/ )
oImgList1:AddMasked( TBitmap():Define( ,"Delete.BMP", oWndChild ), /*nRGB( 255, 0, 255 )*/ )
oImgList1:AddMasked( TBitmap():Define( ,"Exit.BMP", oWndChild ), /*nRGB( 255, 0, 255 )*/ )
oReBar = TReBar():New( oWndchild )
oToolBar1 = TToolBar():New( oReBar, 36, 36, oImgList1,.t. )
oToolBar3 = TToolBar():New( oReBar, 36, 36, oImgList2 )
DEFINE TBBUTTON OF oToolBar1 ACTION (Agrega_Ban(.T.,oDbf), oBrw:nRowPos:=1,oDlg:Update(), oBrw:Refresh()) TOOLTIP "Agregar Nuevo Banco"
oToolBar1:AddSeparator()
DEFINE TBBUTTON OF oToolBar1 ACTION (Agrega_Ban(.F.,oDbf), oBrw:SetFocus(), oBrw:nRowPos:=1, oBrw:Refresh()) TOOLTIP "Modificar Banco Registrado"
oToolBar1:AddSeparator()
DEFINE TBBUTTON OF oToolBar1 ACTION (P_Maest((oDbf[1]:cAlias),Campos,Titulo,Anchos,"MAESTRO DE BANCOS"),(oDbf[1]:cAlias)->(DbGoTop()),oBrw:nRowPos:=1, oBrw:Refresh()) TOOLTIP "Imprimir Maestro de Bancos"
oToolBar1:AddSeparator()
DEFINE TBBUTTON OF oToolBar1 ACTION IF (MsgYesNo(" Sr. Usuario, ¿ Deseas Borrar El Banco "+ALLTRIM((oDbf[1]:cAlias)->Ban_Des, "Por Favor, Seleccione")+"?"),;
((oDbf[1]:Delete()), oBrw:nRowPos:=1, oBrw:Refresh()), ) Tooltip "Eliminar Banco"
oToolBar1:AddSeparator()
DEFINE TBBUTTON OF oToolBar1 ACTION (oDbf[1]:Close(),oDlg:End(),oWndChild:End()) TOOLTIP "Volver..."
oToolBar1:AddSeparator()
oToolBar1:nWidth = 100
oToolBar3:nWidth = 10
oReBar:InsertBand( oToolBar1 )
oReBar:InsertBand( oToolBar3 )
Select( oDbf[1]:cAlias )
REDEFINE BROWSE oBrw ID 110 OF oDlg Update FONT oMainFont
oBrw:SetColor( { 1, 3, 5, 6, 13, 15 }, ;
{ CLR_BLACK, CLR_BLACK, CLR_BLACK, ;
{ CLR_WHITE, CLR_BLACK }, ; // degraded cursor background color
CLR_WHITE, CLR_BLACK } ) // text colors
oBrw:SetColor( { 2, 4, 6, 12, 14 },{ CLR_CIAN, ;
{ CLR_WHITE, CLR_NBLUE }, ; // degraded headers
{ CLR_WHITE, CLR_BLACK }, ; // degraded cursor
{ CLR_NBLUE, CLR_BLACK }, ; // degraded selected cells
{ CLR_NBLUE, CLR_BLACK } } ) // degraded active index header
oBrw:nHeightCell += 6
oBrw:nHeightHead += 16
oBrw:Set3DText( .T., .T. )
ADD COLUMN TO BROWSE oBrw DATA " " SIZE 15 HEADER " " 3DLOOK FALSE, TRUE, TRUE Picture "###" ALIGN DT_RIGHT,DT_CENTER, DT_RIGHT
ADD COLUMN TO BROWSE oBrw DATA (oDbf[1]:cAlias)->Ban_Cod Picture "######" HEADER "Código"+CRLF+" " SIZE 70 3DLOOK FALSE, TRUE, TRUE EDITABLE ALIGN DT_RIGHT, DT_CENTER, DT_RIGHT
ADD COLUMN TO BROWSE oBrw DATA (oDbf[1]:cAlias)->Ban_Des HEADER "Descripción Del"+CRLF+" Banco" SIZE 390 3DLOOK FALSE, TRUE, TRUE EDITABLE ALIGN DT_LEFT, DT_CENTER, DT_RIGHT
ADD COLUMN TO BROWSE oBrw DATA " " SIZE 15 HEADER " " 3DLOOK FALSE, TRUE, TRUE Picture "###" ALIGN DT_RIGHT,DT_CENTER, DT_RIGHT
oBrw:lLogicDrop := .t.
oBrw:lNoHScroll := .t.
oBrw:nAdjColumn := 4
oBrw:nFreeze := 4
oBrw:bKeyDown:= {|nKey| iif(nKey=13,(Agrega_Ban(.F.,oDbf), oBrw:SetFocus(), oBrw:nRowPos:=1, oBrw:Refresh()),)}
oBrw:bLDblClick := { || (Agrega_Com(.F.,oDbf), oBrw:nRowPos:=1, oBrw:Refresh()) }
ACTIVATE DIALOG oDlg;
NOWAIT ;
VALID ( IF( oDbf[1]:Used(), Eval( {|| oWndChild:End(), .T. } ), .T. ) ) On Init oDlg:Move(44,0)
ACTIVATE WINDOW oWndChild;
VALID ( oDbf[1]:Close(),oMenuIt:Enable(), .T. )
return nil
*úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú*
Function Agrega_Ban(GRABA,oDbf)
Local oDlg, Grabar:=.f.,;
Cod_Ciu,Des_Ciu,;
o102,o103,o200,o201,o202
SET 3DLOOK ON // Microsoft 3D Look
SELECT (oDbf[1]:cAlias)
Cod_Ciu :=IIF(Graba,0,(oDbf[1]:cAlias)->Ban_Cod)
Des_Ciu :=IIF(Graba,Space(50),(oDbf[1]:cAlias)->Ban_Des)
IF GRABA
DEFINE DIALOG oDlg RESOURCE "SCREEN_MANT" TITLE "Agregar Banco" Font oMainFont
REDEFINE GET o102 VAR Cod_Ciu ID 102 OF oDlg PICTURE '######';
VALID (Bus_Ban(Cod_Ciu,oDlg,oDbf));
UPDATE
ELSE
DEFINE DIALOG oDlg RESOURCE "SCREEN_MMANT" TITLE "Modificar Banco" Font oMainFont
REDEFINE SAY o200 VAR (oDbf[1]:cAlias)->Ban_Cod ID 200 OF oDlg PICTURE '######'
ENDIF
REDEFINE SAY o201 PROMPT "Código" ID 201 OF oDlg
REDEFINE SAY o202 PROMPT "Descripción" ID 202 OF oDlg
REDEFINE GET o103 VAR Des_Ciu ID 103 OF oDlg PICTURE '@!'
REDEFINE BUTTON ID 108 OF oDlg ACTION (Grabar:=.F., oDlg:End())
REDEFINE BUTTON ID 105 OF oDlg ACTION (Grabar:=.T., oDlg:End())
ACTIVATE DIALOG oDlg CENTERED
IF Grabar
IF Graba
If (Add_Rec((oDbf[1]:cAlias)))
(oDbf[1]:cAlias)->Ban_Cod:=Cod_Ciu
(oDbf[1]:cAlias)->Ban_Des:=Des_Ciu
EndIf
UnLock
Else
If (Rec_Lock((oDbf[1]:cAlias)))
(oDbf[1]:cAlias)->Ban_Cod:=Cod_Ciu
(oDbf[1]:cAlias)->Ban_Des:=Des_Ciu
EndIf
UnLock
ENDIF
ENDIF
(oDbf[1]:cAlias)->(DbGoTop())
RETURN NIL
*úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú*
Static Function Bus_Ban(_Com,oDlg,oDbf)
Local lRet:=.T.,Busca:=0,_Before,Descri:=Space(50)
_Before:=Select()
Select (oDbf[1]:cAlias)
(oDbf[1]:SetOrder(1))
If _Com<=0
MsgStop("Sr. Usuario, El Banco Debe ESPECIFICARSE","ENTRADA NO VALIDA")
lRet:=.F.
Else
If (oDbf[1]:cAlias)->(DbSeek(_Com))
MsgStop("Sr. Usuario, El Banco Buscado ya Existe","ENTRADA NO VALIDA")
lRet:=.F.
EndIf
(oDbf[1]:SetOrder(1))
If (oDbf[1]:cAlias)->(!DbSeek(_Com))
lRet:=.T.
EndIf
EndIf
(oDbf[1]:SetOrder(1))
Select &_Before
Return(lRet)
*úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú*