Code: Select all
*****************************************************************************
Function CadDup()
// Lançamentos no Contas a Pagar
*****************************************************************************
local oDlgAna, oBrw, nTotal:=0, nTotalPago:=0, nOpc:=1 //, dData1:=ctod(space(8)), dData2:=ctod(space(8))
private dData1:=ctod(space(8)), dData2:=ctod(space(8))
use tabfil alias FIL index tabfil shared new
use tabcpi alias CPI index tabcpi shared new
use tabpco alias PCO index tabpco shared new
use tabpsb alias PSB index tabpsb shared new
use tabban alias BAN index tabban shared new
use tabcai alias CAI index tabcai shared new
use tabved alias VED index tabved shared new
DEFINE DIALOG oDlgAna RESOURCE "CONTAS"
REDEFINE BITMAP RESOURCE "BARRA" ID 60 OF oDlgAna
sele CPI
set order to 8
set relation to loja into FIL
DbGoBottom()
REDEFINE RADIO oOpc VAR nOpc ID 64,65 OF oDlgAna UPDATE
REDEFINE VGET oData1 VAR dData1 ID 66 OF oDlgAna UPDATE CALENDARIO WHEN nOpc = 2
REDEFINE VGET oData2 VAR dData2 ID 67 OF oDlgAna UPDATE CALENDARIO WHEN nOpc = 2
REDEFINE BUTTON oBmpGer ID 70 OF oDlgAna PROMPT "&Gerar" ACTION (Verifica_Opcao(@nOpc,@dData1,@dData2,oBrw,@nTotal,@nTotalPago),oBrw:SetFocus(),oBrw:UpStable(),oBrw:Refresh())
REDEFINE BROWSE oBrw ALIAS "CPI" CELLED ID 61 OF oDlgAna
ADD COLUMN TO oBrw TITLE "C.Custo" ;
DATA FieldWBlock( "ccusto", Select( "CPI" ) ) ;
SIZE 55 ;
VALID { |uVar| Busca_Codigo( uVar, oBrw ) } ;
POSTEDIT { || Pesquisa_Codigo() } ;
ALIGN DT_LEFT ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "Filial" ;
DATA FieldWBlock( "loja", Select( "CPI" ) ) ;
SIZE 55 ;
VALID { |uVar| Busca_Fil( uVar, oBrw ) } ;
ALIGN DT_LEFT ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "No. Título" ;
DATA FieldWBlock( "dupli", Select( "CPI" ) ) ;
SIZE 79 ;
ALIGN DT_LEFT ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "Histórico" ;
DATA FieldWBlock( "historico", Select( "CPI" ) ) ;
SIZE 240 ;
ALIGN DT_LEFT ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "Vencimento" ;
DATA FieldWBlock( "venc", Select( "CPI" ) ) ;
SIZE 77 ;
ALIGN DT_CENTER ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "Valor" ;
DATA FieldWBlock( "valor", Select( "CPI" ) ) ;
SIZE 95 ;
PICTURE "@E 999,999.99" ;
POSTEDIT { || SomaTotal(@nTotal,@nTotalPago,oBrw) } ;
ALIGN DT_RIGHT ;
EDITABLE MOVE DT_MOVE_NEXT
ADD COLUMN TO oBrw TITLE "Dt.Pagto" ;
DATA CPI->dpag ;
SIZE 77 ;
ALIGN DT_CENTER
ADD COLUMN TO oBrw TITLE "Vl. Pago" ;
DATA CPI->pago ;
SIZE 95 ;
PICTURE "@E 999,999.99" ;
ALIGN DT_RIGHT
ADD COLUMN TO oBrw TITLE "Cód. Vend" ;
DATA FieldWBlock( "codven", Select( "CPI" ) ) ;
SIZE 79 ;
ALIGN DT_LEFT ;
EDITABLE MOVE DT_MOVE_NEXT
oBrw:lMChange:=.f.
oBrw:SetColor( { 1, 3, 5, 7 }, { CLR_BLACK, CLR_BLACK, CLR_WHITE, CLR_BLACK } )
oBrw:SetColor( { 2, 4, 6, 8 }, ;
{ { CLR_TK, CLR_TK }, ; // degraded cells background color
{ CLR_WHITE, CLR_GRAY }, ; // degraded headers background color
{ CLR_KGC, CLR_KGC }, ; // degraded focused line
{ CLR_WHITE, CLR_GRAY} } ) // degraded order column background color
oBrw:SetColor( { 1, 2 },{ CLR_BLACK, { || Checa_Data() } },8 )
oBrw:lAutoEdit := .T.
oBrw:SetDeleteMode( .T., .F. )
oBrw:SetAppendMode( .T. )
oBrw:SetBtnGet( 1, "Prod16", { | oGet, dVar | aRect := GetCoors( oGet:hWnd ), ;
dVar := PesqPco( oGet:Value(), aRect[ 1 ], aRect[ 4 ], oGet:oWnd ), ;
oGet:cText( dVar ), oGet:Refresh(), oGet:KeyDown( VK_RETURN, 0 ) }, 16 )
oBrw:SetBtnGet( 2, "Prod16", { | oGet, dVar | aRect := GetCoors( oGet:hWnd ), ;
dVar := PesqFil( oGet:Value(), aRect[ 1 ], aRect[ 4 ], oGet:oWnd ), ;
oGet:cText( dVar ), oGet:Refresh(), oGet:KeyDown( VK_RETURN, 0 ) }, 16 )
oBrw:SetBtnGet( 9, "Prod16", { | oGet, dVar | aRect := GetCoors( oGet:hWnd ), ;
dVar := PesqVed( oGet:Value(), aRect[ 1 ], aRect[ 4 ], oGet:oWnd ), ;
oGet:cText( dVar ), oGet:Refresh(), oGet:KeyDown( VK_RETURN, 0 ) }, 16 )
REDEFINE BUTTON oBmpLis ID 69 OF oDlgAna PROMPT "&Listar" ACTION (RelatFrh( 'Agendamento de Títulos a Pagar', { 'CPI','FIL' }, 'agenda', 'R',,,, .f., {'CPI','FIL'} ),oBrw:GoTop(),oBrw:SetFocus(),oBrw:Refresh()) WHEN nOpc = 2
REDEFINE BUTTON oBmpBai ID 63 OF oDlgAna PROMPT "&Baixar" ACTION (Baixa(@nTotal,@nTotalPago,oBrw),oBrw:SetFocus(),oBrw:Refresh())
REDEFINE BUTTON oBmpImp ID 62 OF oDlgAna PROMPT "&Imprimir" ACTION (Imprime(),oBrw:SetFocus(),oBrw:Refresh())
REDEFINE BUTTON oBmpSai ID 68 OF oDlgAna PROMPT "&Fechar" ACTION (Libera_tudo(oDlgAna), oDlgAna:End())
ACTIVATE DIALOG oDlgAna CENTERED ON INIT oDlgAna:lHelpIcon:=.F.
DbCloseAll()
Libera_tudo(oDlgAna)
return nil