Code: Select all
#include "FiveWin.ch"
static oClients, oClient, oName
static cName
static oSplit
FUNCTION EMPRESAS( oWnd, lOque, cTitle )
local oLbx, oIco, oBar, oGet, oGraph, oItem[10], oEvolucao
cTitle := "Linha de Produtos"
if oClients != nil
return nil
endif
SET DELETE ON
lIncluindo:=.f.
DEFINE FONT oFntLBX NAME "Courier New" SIZE 0, -12
DEFINE FONT fntArial NAME "Arial" SIZE 16, 28
DEFINE FONT fntHelvetica NAME "Helv" SIZE 8, 8
DEFINE FONT fntHelv2 NAME "Helv" SIZE 6, 6
ACTIVATE FONT fntHelvetica
//
// -> Rotina de abertura de DBFs e Inicializacao de variaveis
AbreTabelas()
CarregaTabela()
if recco()=0
lIncluindo:=.t.
endif
M->NOME := PADR( VerifyINI( "CLIENTE", "NOME" , EMPRESA->Nome , cPath+"nfw.ini", .f. ), 45 )
M->ENDERECO := PADR( VerifyINI( "CLIENTE", "ENDERECO", EMPRESA->Endereco , cPath+"nfw.ini", .f. ), 45 )
M->BAIRRO := PADR( VerifyINI( "CLIENTE", "BAIRRO" , EMPRESA->Bairro , cPath+"nfw.ini", .f. ), 25 )
M->CIDADE := PADR( VerifyINI( "CLIENTE", "CIDADE" , EMPRESA->Cidade , cPath+"nfw.ini", .f. ), 25 )
M->CEP := PADR( VerifyINI( "CLIENTE", "CEP" , EMPRESA->Cep , cPath+"nfw.ini", .f. ), 09 )
M->ESTADO := PADR( VerifyINI( "CLIENTE", "ESTADO" , EMPRESA->Estado , cPath+"nfw.ini", .f. ), 02 )
M->CONTATO := PADR( VerifyINI( "CLIENTE", "CONTATO" , EMPRESA->Contato , cPath+"nfw.ini", .f. ), 20 )
M->TELEFONE := PADR( VerifyINI( "CLIENTE", "TELEFONE", EMPRESA->Telefone , cPath+"nfw.ini", .f. ), 14 )
M->FAX := PADR( VerifyINI( "CLIENTE", "FAX" , EMPRESA->Fax , cPath+"nfw.ini", .f. ), 14 )
M->CGC := PADR( VerifyINI( "CLIENTE", "CGC" , EMPRESA->Cgc , cPath+"nfw.ini", .f. ), 20 )
M->INSCR := PADR( VerifyINI( "CLIENTE", "IE" , EMPRESA->Inscr , cPath+"nfw.ini", .f. ), 20 )
M->EMAIL := PADR( VerifyINI( "CLIENTE", "EMAIL" , EMPRESA->Obs , cPath+"nfw.ini", .f. ), 45 )
DEFINE DIALOG oDlg RESOURCE "dlgEmpresa"
REDEFINE GET oCtrl101 VAR M->NOME VALID LiberaBTN(oBTN011) ID 101 OF oDlg
REDEFINE GET oCtrl102 VAR M->ENDERECO VALID LiberaBTN(oBTN011) ID 102 OF oDlg
REDEFINE GET oCtrl103 VAR M->BAIRRO VALID LiberaBTN(oBTN011) ID 103 OF oDlg
REDEFINE GET oCtrl104 VAR M->CIDADE VALID LiberaBTN(oBTN011) ID 104 OF oDlg
REDEFINE GET oCtrl105 VAR M->CEP VALID LiberaBTN(oBTN011) ID 105 OF oDlg
REDEFINE GET oCtrl106 VAR M->ESTADO VALID LiberaBTN(oBTN011) ID 106 OF oDlg
REDEFINE GET oCtrl107 VAR M->CONTATO VALID LiberaBTN(oBTN011) ID 107 OF oDlg
REDEFINE GET oCtrl108 VAR M->TELEFONE VALID LiberaBTN(oBTN011) ID 108 OF oDlg
REDEFINE GET oCtrl109 VAR M->FAX VALID LiberaBTN(oBTN011) ID 109 OF oDlg
REDEFINE GET oCtrl110 VAR M->CGC VALID LiberaBTN(oBTN011) ID 110 OF oDlg
REDEFINE GET oCtrl111 VAR M->INSCR VALID LiberaBTN(oBTN011) ID 111 OF oDlg
REDEFINE GET oCtrl112 VAR M->EMAIL VALID LiberaBTN(oBTN011) ID 112 OF oDlg
REDEFINE SAY oCtrl113 VAR STR(RECNO(),2)+"/"+STR(RECCO(),2) ID 113 OF oDlg
//
REDEFINE BTNBMP ID 5 OF oDlg RESOURCE "bmp_pagant" TOOLTIP "Primeiro registro" ACTION ( dbGoTop() , CarregaTabela(), LimpaCampos(), oCtrl101:Setfocus(), oCtrl113:SetText(STR(RECNO(),2)+"/"+STR(RECCO(),2)) )
REDEFINE BTNBMP ID 6 OF oDlg RESOURCE "bmp_regant" TOOLTIP "Registro Anterior" ACTION ( dbSkip(-1) , CarregaTabela(), LimpaCampos(), oCtrl101:Setfocus(), oCtrl113:SetText(STR(RECNO(),2)+"/"+STR(RECCO(),2)) )
REDEFINE BTNBMP ID 7 OF oDlg RESOURCE "bmp_regsig" TOOLTIP "Proximo registro" ACTION ( dbSkip(), IIF(RECNO()>RECCO(),(lIncluindo:=.f., oBTN011:Disable()),), CarregaTabela(), LimpaCampos(), oCtrl101:Setfocus(), oCtrl113:SetText(STR(RECNO(),2)+"/"+STR(RECCO(),2)) )
REDEFINE BTNBMP ID 8 OF oDlg RESOURCE "bmp_pagsig" TOOLTIP "Ultimo registro" ACTION ( dbGoBottom(), CarregaTabela(), LimpaCampos(), oCtrl101:Setfocus(), oCtrl113:SetText(STR(RECNO(),2)+"/"+STR(RECCO(),2)) )
REDEFINE BTNBMP ID 9 OF oDlg RESOURCE "bmp_RegNovo" TOOLTIP "Novo registro" ACTION ( lIncluindo:=.t., dbGoBottom(), dbSkip(), CarregaTabela("NOVO"), LimpaCampos(), oCtrl101:Setfocus(), oCtrl113:SetText(STR(RECNO(),2)+"/"+STR(RECCO(),2)) )
REDEFINE BTNBMP ID 10 OF oDlg RESOURCE "bmp_RegCanc" TOOLTIP "Exclui registro" ACTION ( rLock(), dbDelete(), dbCommitAll(), dbPack(), dbSkip(-1) )
REDEFINE BTNBMP oBTN011 ID 11 OF oDlg RESOURCE "bmp_floppy" TOOLTIP "Salva registro" ACTION ( sv_emp(), oBTN011:Disable(), lIncluindo:=.f. )
//
REDEFINE BTNBMP ID 4 OF oDlg PROMPT "Fechar esta tela" RESOURCE "bmpbtn24" TOOLTIP "Fechar esta tela" ACTION ( dbCloseAll(), oDlg:End() ) LEFT
oBTN011:Disable()
ACTIVATE DIALOG oDlg CENTERED ;
VALID ( oDlg := nil, dbCloseAll(), .t. )
return nil
static function sv_emp()
dbSelectArea( "EMPRESA" )
if lIncluindo
dbAppend()
else
rLock()
endif
SalvaTabela()
dbCommitAll()
return .t.
static function fun(oBtn)
return .t.
static function LiberaBTN(oBtn)
oBtn:Enable()
return .t.
static function LimpaCampos
oCtrl101:Refresh()
oCtrl102:Refresh()
oCtrl103:Refresh()
oCtrl104:Refresh()
oCtrl105:Refresh()
oCtrl106:Refresh()
oCtrl107:Refresh()
oCtrl108:Refresh()
oCtrl109:Refresh()
oCtrl110:Refresh()
oCtrl111:Refresh()
return .t.
static function AbreTabelas
//
//-> Abre arquivos de dados
dbCloseAll()
USE EMPRESA EXCLUSIVE
InitVars()
return nil
static function CarregaTabela( TIPO_ACAO )
IF TIPO_ACAO = "NOVO"
GOTO BOTT
SKIP
ENDIF
M->NOME := EMPRESA->NOME
M->ENDERECO := EMPRESA->ENDERECO
M->BAIRRO := EMPRESA->BAIRRO
M->CIDADE := EMPRESA->CIDADE
M->CEP := EMPRESA->CEP
M->ESTADO := EMPRESA->ESTADO
M->CONTATO := EMPRESA->CONTATO
M->TELEFONE := EMPRESA->TELEFONE
M->FAX := EMPRESA->FAX
M->CGC := EMPRESA->CGC
M->INSCR := EMPRESA->INSCR
IF TIPO_ACAO = "NOVO"
M->CIDADE := 'SAO PAULO '
M->ESTADO := 'SP'
M->TELEFONE := '( ) - '
M->FAX := '( ) - '
M->CEP := ' - '
ENDIF
return .t.
static function SalvaTabela
EMPRESA->NOME := M->NOME
EMPRESA->ENDERECO := M->ENDERECO
EMPRESA->BAIRRO := M->BAIRRO
EMPRESA->CIDADE := M->CIDADE
EMPRESA->CEP := M->CEP
EMPRESA->ESTADO := M->ESTADO
EMPRESA->CONTATO := M->CONTATO
EMPRESA->TELEFONE := M->TELEFONE
EMPRESA->FAX := M->FAX
EMPRESA->CGC := M->CGC
EMPRESA->INSCR := M->INSCR
EMPRESA->OBS := M->EMAIL
COMMIT
return .t.
Code: Select all
dlgEmpresa DIALOG 72, 61, 316, 157
STYLE 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Cadastro de Empresa"
FONT 8, "Helv"
{
GROUPBOX "Dados de Empresa", 99, 6, 2, 251, 131, BS_GROUPBOX
CONTROL "", 100, "static", SS_WHITERECT | WS_CHILD | WS_VISIBLE | WS_BORDER, 163, 175, 102, 32
CONTROL "101", 101, "EDIT", WS_BORDER | WS_TABSTOP, 69, 14, 180, 12
CONTROL "102", 102, "EDIT", WS_BORDER | WS_TABSTOP, 69, 31, 180, 12
CONTROL "103", 103, "EDIT", WS_BORDER | WS_TABSTOP, 69, 47, 88, 12
CONTROL "104", 104, "EDIT", WS_BORDER | WS_TABSTOP, 161, 47, 88, 12
CONTROL "105", 105, "EDIT", WS_BORDER | WS_TABSTOP, 69, 64, 55, 12
CONTROL "106", 106, "EDIT", WS_BORDER | WS_TABSTOP, 129, 64, 28, 12
CONTROL "107", 107, "EDIT", WS_BORDER | WS_TABSTOP, 161, 64, 88, 12
CONTROL "108", 108, "EDIT", WS_BORDER | WS_TABSTOP, 69, 81, 88, 12
CONTROL "109", 109, "EDIT", WS_BORDER | WS_TABSTOP, 161, 81, 88, 12
CONTROL "112", 112, "EDIT", WS_BORDER | WS_TABSTOP, 69, 115, 180, 12
PUSHBUTTON "&Fechar", 4, 175, 137, 82, 15
LTEXT "Razão Social:", -1, 12, 17, 50, 8
LTEXT "Endereco:", -1, 12, 33, 50, 8
LTEXT "Bairro/Cidade:", -1, 12, 49, 50, 8
LTEXT "CEP/UF/Contato:", -1, 12, 66, 55, 8
LTEXT "Telefone/Fax:", -1, 12, 83, 55, 8
LTEXT "Email:", -1, 12, 117, 55, 8
ICON "icon_info", -1, 320, 192, 18, 20
CONTROL "TBtnBmp", 7, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 40, 138, 14, 14
CONTROL "TBtnBmp", 8, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 57, 138, 14, 14
CONTROL "TBtnBmp", 5, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 6, 138, 14, 14
CONTROL "TBtnBmp", 6, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 23, 138, 14, 14
CONTROL "TBtnBmp", 9, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 138, 14, 14
CONTROL "TBtnBmp", 10, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 91, 138, 14, 14
CONTROL "TBtnBmp", 11, "TBtnBmp", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 107, 138, 14, 14
CONTROL "110", 110, "EDIT", WS_BORDER | WS_TABSTOP, 69, 98, 88, 12
CONTROL "111", 111, "EDIT", WS_BORDER | WS_TABSTOP, 161, 98, 88, 12
LTEXT "CGC/INSCR:", -1, 12, 100, 55, 8
LTEXT "Text", 113, 125, 138, 47, 14, WS_BORDER | WS_GROUP
}
bmp_pagant BITMAP
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 07 77 77 07 77 77 77'
'70 07 77 70 07 77 77 77 00 07 77 00 07 77 77 70'
'00 07 70 00 07 77 77 00 00 07 00 00 07 77 77 70'
'00 07 70 00 07 77 77 77 00 07 77 00 07 77 77 77'
'70 07 77 70 07 77 77 77 77 07 77 77 07 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77'
}
bmp_regant BITMAP
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 70 77 77 77 77 77'
'77 77 00 77 77 77 77 77 77 70 00 77 77 77 77 77'
'77 00 00 77 77 77 77 77 70 00 00 77 77 77 77 77'
'77 00 00 77 77 77 77 77 77 70 00 77 77 77 77 77'
'77 77 00 77 77 77 77 77 77 77 70 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77'
}
bmp_pagsig BITMAP
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 70 77 77 70 77 77 77 77 70'
'07 77 70 07 77 77 77 70 00 77 70 00 77 77 77 70'
'00 07 70 00 07 77 77 70 00 00 70 00 00 77 77 70'
'00 07 70 00 07 77 77 70 00 77 70 00 77 77 77 70'
'07 77 70 07 77 77 77 70 77 77 70 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77'
}
bmp_regsig BITMAP
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 07 77 77 77 77 77 77'
'77 00 77 77 77 77 77 77 77 00 07 77 77 77 77 77'
'77 00 00 77 77 77 77 77 77 00 00 07 77 77 77 77'
'77 00 00 77 77 77 77 77 77 00 07 77 77 77 77 77'
'77 00 77 77 77 77 77 77 77 07 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77'
}
bmp_RegNovo BITMAP
{
'42 4D F4 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 0E 00 00 00 0E 00 00 00 01 00 04 00 00 00'
'00 00 70 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 BF 00 00 BF'
'00 00 00 BF BF 00 BF 00 00 00 BF 00 BF 00 BF BF'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 00 77 77'
'77 77 77 77 77 00 77 77 77 77 77 77 77 00 77 77'
'77 00 77 77 77 00 77 77 77 00 77 77 77 00 77 77'
'77 00 77 77 77 00 77 70 00 00 00 07 77 00 77 70'
'00 00 00 07 77 00 77 77 77 00 77 77 77 00 77 77'
'77 00 77 77 77 00 77 77 77 00 77 77 77 00 77 77'
'77 77 77 77 77 00 77 77 77 77 77 77 77 00 77 77'
'77 77 77 77 77 00 77 77 77 77 77 00 77 77 77 77'
'77 77 77 00'
}
bmp_RegCanc BITMAP
{
'42 4D 04 01 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 C4 0E 00 00 C4 0E 00 00 10 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'00 77 77 00 77 77 77 77 70 07 70 07 77 77 77 77'
'77 00 00 77 77 77 77 77 77 70 07 77 77 77 77 77'
'77 00 00 77 77 77 77 77 70 07 70 07 77 77 77 77'
'00 77 77 00 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77'
'77 77 77 77'
}
bmp_floppy BITMAP
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 C4 0E 00 00 C4 0E 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 77 77 77 77 77 77 77 77 77 00'
'00 00 00 00 00 07 70 33 00 00 00 77 03 07 70 33'
'00 00 00 77 03 07 70 33 00 00 00 77 03 07 70 33'
'00 00 00 00 03 07 70 33 33 33 33 33 33 07 70 33'
'00 00 00 00 33 07 70 30 77 77 77 77 03 07 70 30'
'77 77 77 77 03 07 70 30 77 77 77 77 03 07 70 30'
'77 77 77 77 03 07 70 30 77 77 77 77 00 07 70 30'
'77 77 77 77 07 07 70 00 00 00 00 00 00 07 77 77'
'77 77 77 77 77 77'
}