#Include "hwgui.ch" STATIC Thisform FUNCTION hwg_clientes Close All OpenDbf() Sele Clientes FOR nI:= 1 TO FCOUNT() ; &(TYPE(FIELD(nI))+FIELD(nI)) := IF(TYPE(FIELD(nI))=="C",SPACE(LEN(&(FIELD(nI)))),IF(TYPE(FIELD(nI))=="N",0,IF(TYPE(FIELD(nI))=="L",.F.,IF(TYPE(FIELD(nI))=="D",CTOD(""),""))) ) ; NEXT Igual_Var() DbSetOrder(1) Go Top PRIVATE vBuscaCliente := "", cClinasc := Dtoc(Clinasc), cCliulco := Dtoc(Cliulco), NovoCliente:= .T. PRIVATE HwgClientes, oGroup1, OBrwClientes, oGroup2, oLabel1, oCliende, oLabel2, oBloqueio ; , oLabel3, oCliBair, oClicep, oLabel4, oCliesta, oLabel5, oClinasc, oLabel6 ; , oClicgc, oLabel7, oCliinsc, oLabel8, oEmail, oLabel9, oGroup3, oClifone ; , oLabel10, oClifonecom, oLabel11, oClicelular, oLabel12, oLimete, oLabel13, oDiasAtrazo ; , oLabel14, oCliulco, oLabel15, oLabel16, oBuscaCliente, oButtonex1, oButtonex2, oButtonex3 ; , oButtonex4, oButtonex5, xSituacao INIT DIALOG HwgClientes TITLE "Cadastro de Clientes" ; AT -98,-43 SIZE 1194,592 CLIPPER NOEXIT ; STYLE WS_POPUP+WS_CAPTION+WS_SYSMENU+WS_SIZEBOX+DS_CENTER Thisform := HwgClientes @ 11,21 BROWSE OBrwClientes DATABASE SIZE 1173,290 ; STYLE WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-16,400,,,) ; ON POSCHANGE {||Hwg_CarregaClientes() } // CREATE OBrwClientes // SCRIPT GENARATE BY DESIGNER OBrwClientes:headColor := 16711680 OBrwClientes:alias := 'clientes' OBrwClientes:nColumns := 4 SELECT (OBrwClientes:alias) OBrwClientes:AddColumn( HColumn():New("Código", FieldBlock( 'Clicodi' ) ,'N',10, 0 ,.F.,2,2,,,,,,,,,)) OBrwClientes:AddColumn( HColumn():New("Nome do cliente", FieldBlock( 'Clinome' ) ,'C',60, 0 ,.F.,0,,,,,,,,,,)) OBrwClientes:AddColumn( HColumn():New("Cidade", FieldBlock( 'Clicida' ) ,'C',30, 0 ,.F.,0,,,,,,,,,,)) OBrwClientes:AddColumn( HColumn():New("Telefone", FieldBlock( 'Clifone' ) ,'C',20, 0 ,.F.,0,,,,,,,,,,)) // END BROWSE SCRIPT - OBrwClientes @ 6,4 GROUPBOX oGroup1 CAPTION "Clientes" SIZE 1184,315 ; STYLE BS_LEFT ; COLOR 16711680 ; FONT HFont():Add( 'Arial',0,-13,400,,,) @ 15,345 SAY oLabel1 CAPTION "Endereço" SIZE 97,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 115,345 GET oCliende VAR cCliende SIZE 810,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 934,345 SAY oLabel2 CAPTION "Situação" SIZE 91,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) If Bloqueio = .F. @ 1033,345 SAY xSituacao CAPTION "ATIVO" SIZE 140,25 STYLE SS_CENTER BACKCOLOR 4563464 ; FONT HFont():Add( 'Arial',0,-21,400,,,) Else @ 1033,345 SAY xSituacao CAPTION "BLOQUEADO" SIZE 140,25 STYLE SS_CENTER BACKCOLOR 255 ; FONT HFont():Add( 'Arial',0,-21,400,,,) Endif @ 15,381 SAY oLabel3 CAPTION "Bairro" SIZE 74,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 115,381 GET oCliBair VAR cCliBair SIZE 434,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 556,381 SAY oLabel4 CAPTION "Cep" SIZE 45,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 605,381 GET oClicep VAR cClicep SIZE 150,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 769,381 SAY oLabel5 CAPTION "Estado" SIZE 72,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 846,381 GET oCliesta VAR cCliesta SIZE 46,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 903,381 SAY oLabel6 CAPTION "Data de Nacto" SIZE 145,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 1053,381 GET oClinasc VAR cClinasc SIZE 123,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 15,419 SAY oLabel7 CAPTION "Cnpj/Cpf" SIZE 94,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 115,417 GET oClicgc VAR cClicgc SIZE 288,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 419,417 SAY oLabel8 CAPTION "Inscr.Estadual/R.G" SIZE 184,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 603,417 GET oCliinsc VAR cCliinsc SIZE 288,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 15,453 SAY oLabel9 CAPTION "Email" SIZE 66,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 115,453 GET oEmail VAR cEmail SIZE 776,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 903,430 SAY oLabel10 CAPTION "Principal" SIZE 84,25 ; FONT HFont():Add( 'Arial',0,-19,400,,,) @ 1032,428 GET oClifone VAR cClifone SIZE 135,25 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-16,400,,,) @ 903,458 SAY oLabel11 CAPTION "Alternativo" SIZE 96,25 ; FONT HFont():Add( 'Arial',0,-19,400,,,) @ 1032,458 GET oClifonecom VAR cClifonecom SIZE 135,25 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-16,400,,,) @ 903,489 SAY oLabel12 CAPTION "Celular" SIZE 67,25 ; FONT HFont():Add( 'Arial',0,-19,400,,,) @ 1032,487 GET oClicelular VAR cClicelular SIZE 135,25 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-16,400,,,) @ 15,490 SAY oLabel13 CAPTION "Limite de Crédito" SIZE 163,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 186,491 GET oLimite VAR nLimite SIZE 131,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 357,491 SAY oLabel14 CAPTION "Média de Atraso" SIZE 157,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 517,491 GET oDiasAtrazo VAR nDiasAtrazo SIZE 90,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 617,491 SAY oLabel15 CAPTION "Última Compra" SIZE 141,30 ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 767,491 GET oCliulco VAR cCliulco SIZE 124,30 ; STYLE WS_DISABLED ; FONT HFont():Add( 'Arial',0,-21,400,,,) @ 6,323 GROUPBOX oGroup2 CAPTION "Informações Adicionais" SIZE 1184,209 ; STYLE BS_LEFT ; COLOR 16711680 ; FONT HFont():Add( 'Arial',0,-13,400,,,) @ 896,409 GROUPBOX oGroup3 CAPTION "Telefones" SIZE 280,113 ; STYLE BS_LEFT ; COLOR 16711680 ; FONT HFont():Add( 'Arial',0,-13,400,,,) @ 6,531 SAY oLabel16 CAPTION "Pesquise por Código, Nome, Sobrenome, Endereço ou Cidade" SIZE 371,19 ; COLOR 16711680 ; FONT HFont():Add( 'Arial',0,-13,400,,,) @ 6,552 GET oBuscaCliente VAR vBuscaCliente SIZE 547,30 ; STYLE ES_UPPERCASE ; FONT HFont():Add( 'Arial',0,-21,400,,,) ; VALID {|| Hwg_BuscaCliente() } @ 561,537 BUTTONEX oButtonex1 CAPTION "Ficha Financeira" SIZE 125,50 ; STYLE BS_MULTILINE+WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-16,400,,,) @ 687,537 BUTTONEX oButtonex2 CAPTION "Bloqueio e Desbloqueio" SIZE 125,50 ; STYLE BS_MULTILINE+WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-16,400,,,); ON CLICK {|| Hwg_Bloqueio() } @ 813,537 BUTTONEX oButtonex3 CAPTION "Novos" SIZE 125,50 ; STYLE BS_MULTILINE+WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-19,400,,,); ON CLICK {|| NovoCliente:= .T., Limpa_Var(), Hwg_CadClientes() } @ 939,537 BUTTONEX oButtonex4 CAPTION "Alterar" SIZE 125,50 ; STYLE BS_MULTILINE+WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-19,400,,,) @ 1065,537 BUTTONEX oButtonex5 CAPTION "Excluir" SIZE 125,50 ; STYLE BS_MULTILINE+WS_TABSTOP ; FONT HFont():Add( 'Arial',0,-19,400,,,) ACTIVATE DIALOG HwgClientes RETURN HwgClientes:lresult *------------------------------------------------------------------------------- Static Func Hwg_CarregaClientes oCliende:Caption := Cliende oCliBair:Caption := Clibair oClicep:Caption := Clicep oCliesta:Caption := Cliesta oClinasc:Caption := Dtoc(Clinasc) oClicgc:Caption := If(CliFj = 'F',Cpf, Clicgc) oCliinsc:Caption := If(CliFj = 'F',R_Geral,Cliinsc) oEmail:Caption := Email oClifone:Caption := Clifone oClifonecom:Caption := Clifonecom oClicelular:Caption := Clicelular oLimite:Caption := Limite oDiasAtrazo:Caption := DiasAtrazo oCliulco:Caption := Dtoc(Cliulco) If Bloqueio = .F. @ 1033,345 SAY xSituacao CAPTION "ATIVO" SIZE 140,25 STYLE SS_CENTER BACKCOLOR 4563464 ; FONT HFont():Add( 'Arial',0,-21,400,,,) Else @ 1033,345 SAY xSituacao CAPTION "BLOQUEADO" SIZE 140,25 STYLE SS_CENTER BACKCOLOR 255 ; FONT HFont():Add( 'Arial',0,-21,400,,,) Endif oCliende:Refresh() oCliBair:Refresh() oClicep:Refresh() oCliesta:Refresh() oClinasc:Refresh() oClicgc:Refresh() oCliinsc:Refresh() oEmail:Refresh() oClifone:Refresh() oClifonecom:Refresh() oClicelular:Refresh() oLimite:Refresh() oDiasAtrazo:Refresh() oCliulco:Refresh() Retu Nil *------------------------------------------------------------------------------- Static Func Hwg_BuscaCliente Sele Clientes DbSetOrder(1) If !DbSeek(Val(vBuscaCliente)) DbSetOrder(2) If !DbSeek(Rtrim(vBuscaCliente)) DbSetOrder(4) If !DbSeek(Rtrim(vBuscaCliente)) DbSetOrder(8) If !DbSeek(Rtrim(vBuscaCliente)) Set Filter to At(Alltrim(vBuscaCliente),CliNome)>0 Endif Endif Endif Endif OBrwClientes:Refresh() Hwg_CarregaClientes() Retu Nil *------------------------------------------------------------------------------- Static Func Hwg_Bloqueio nCodCliente := Clicodi DbSetOrder(1) If DBSeek(nCodCliente) lBloqueio := If(Bloqueio == .F.,.T.,.F.) Clientes->(RLock()) Clientes->Bloqueio := lBloqueio Endif Hwg_CarregaClientes() Retu Nil *------------------------------------------------------------------------------- FUNCTION Hwg_CadClientes() PRIVATE nCliesta := 1, nCliEstaCobr := 1, cCliInscP := '', oFonte := HFont():Add( 'Arial',0,-16,400,255,,) PRIVATE ListaUf := {"AC","AL","AP","AM","BA","CE","DF","GO","ES","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SP","SC","SE","TO"} PRIVATE FrmCadastroClientes, oGroup1, oLabel1, oClidtCad, oLabel2, oClicgc, oLabel3, oCliInsc ; , oLabel4, oClinome, oLabel5, oCliIbge, oLabel6, oCliende, oLabel7, oClicep ; , oLabel8, oClicida, oLabel9, oClibair, oLabel10, oCliesta, oGroup2, oLabel11 ; , oEmail, oLabel12, oSite, oLabel13, oCliInscP, oLabel14, oCliNasc, oGroup3 ; , oLabel15, oClifone, oLabel16, oClifonecom, oLabel17, oClicelular, oGroup4, oLabel18 ; , oClienPg, oLabel19, oCliCidCobr, oLabel20, oCliBaiCobr, oLabel21, oCliCepCobr, oLabel22 ; , oCliEstaCobr, oLabel24, oCliPostal, oGroup5, oRefere1, oRefere2, oRefere3, oGroup6 ; , oVende1, oVende2, oVende3, BtnCancelar, BtnSalvar, oButtonex1 SetColorinFocus( .t. ) INIT DIALOG FrmCadastroClientes TITLE "Cadastro de Clientes" ; AT 152,135 SIZE 874,510 CLIPPER NOEXIT ; STYLE WS_POPUP+WS_CAPTION+WS_SYSMENU+WS_SIZEBOX+DS_CENTER Thisform := FrmCadastroClientes @ 4,0 GROUPBOX oGroup1 CAPTION "Dados Principais" SIZE 862,164 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 4,165 GROUPBOX oGroup2 CAPTION "Dados Complementares" SIZE 611,124 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 4,288 GROUPBOX oGroup4 CAPTION "Informações de Cobrança" SIZE 863,91 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 619,165 GROUPBOX oGroup3 CAPTION "Telefones" SIZE 248,124 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 4,382 GROUPBOX oGroup5 CAPTION "Referencias" SIZE 275,111 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 283,382 GROUPBOX oGroup6 CAPTION "Autorizaçoes" SIZE 272,111 ; STYLE BS_LEFT COLOR 16711680 FONT HFont():Add( 'Arial',0,-13,400,,,) @ 011,021 SAY "Data de Cadastro" SIZE 134,25 FONT oFonte @ 295,021 SAY "Cnpj/Cpf" SIZE 68,25 FONT oFonte @ 578,021 SAY "Incr.Est./Rg" SIZE 86,25 FONT oFonte @ 011,054 SAY "Nome do Cliente" SIZE 123,25 FONT oFonte @ 578,054 SAY "Cod.IBGE" SIZE 75,25 FONT oFonte @ 011,087 SAY "Endereço" SIZE 78,25 FONT oFonte @ 683,087 SAY "Cep" SIZE 35,25 FONT oFonte @ 011,120 SAY "Cidade" SIZE 57,25 FONT oFonte @ 411,120 SAY "Bairro" SIZE 49,25 FONT oFonte @ 729,120 SAY "Estado" SIZE 58,25 FONT oFonte @ 011,185 SAY "Email" SIZE 50,25 FONT oFonte @ 011,217 SAY "Site" SIZE 40,25 FONT oFonte @ 011,249 SAY "Inscrição Produtor" SIZE 137,25 FONT oFonte @ 345,249 SAY "Data de Nascimento" SIZE 147,25 FONT oFonte @ 623,185 SAY "Principal" SIZE 70,25 FONT oFonte @ 623,217 SAY "Alternativo" SIZE 73,25 FONT oFonte @ 623,249 SAY "Celular" SIZE 55,25 FONT oFonte @ 011,308 SAY "Endereço" SIZE 76,25 FONT oFonte @ 567,308 SAY "Cidade" SIZE 60,25 FONT oFonte @ 011,342 SAY "Bairro" SIZE 49,25 FONT oFonte @ 317,342 SAY "Cep" SIZE 35,25 FONT oFonte @ 495,342 SAY "Estado" SIZE 56,25 FONT oFonte @ 631,342 SAY "Ligar no Vencimento?" SIZE 158,25 FONT oFonte @ 146,21 GET DATEPICKER oClidtCad VAR dClidtCad SIZE 109,25 FONT oFonte @ 372,21 GET oClicgc VAR cClicgc SIZE 191,25 ; STYLE ES_UPPERCASE MAXLENGTH 18 FONT oFonte ; VALID {|| MsgInfo('clicgc') } @ 666,21 GET oCliInsc VAR cCliInsc SIZE 191,25 ; STYLE ES_UPPERCASE PICTURE '9999999' MAXLENGTH 7 FONT oFonte ; VALID {|| Msginfo('cliinsc') } @ 146,54 GET oClinome VAR cClinome SIZE 417,25 ; STYLE ES_UPPERCASE MAXLENGTH 49 FONT oFonte ; VALID {|| MsgINFO('clinome') } @ 666,54 GET oCliIbge VAR nCliIbge SIZE 191,25 ; STYLE ES_UPPERCASE FONT oFonte ; VALID {|| MsgINFO('cliibge') } @ 146,87 GET oCliende VAR cCliende SIZE 417,25 ; STYLE ES_UPPERCASE MAXLENGTH 49 FONT oFonte @ 726,87 GET oClicep VAR cClicep SIZE 131,25 ; STYLE ES_UPPERCASE PICTURE '@R 99.999-999' FONT oFonte @ 146,120 GET oClicida VAR cClicida SIZE 223,25 ; STYLE ES_UPPERCASE MAXLENGTH 25 FONT oFonte @ 464,120 GET oClibair VAR cClibair SIZE 223,25 ; STYLE ES_UPPERCASE MAXLENGTH 20 FONT oFonte @ 790,120 GET COMBOBOX oCliesta VAR nCliesta ; ITEMS ListaUf SIZE 67,25 STYLE CBS_UPPERCASE FONT oFonte ; ON CHANGE {|| msginfo('adicionais') } @ 147,185 GET oEmail VAR cEmail SIZE 458,25 ; STYLE ES_UPPERCASE MAXLENGTH 45 FONT oFonte @ 147,217 GET oSite VAR cSite SIZE 458,25 ; STYLE ES_UPPERCASE MAXLENGTH 45 FONT oFonte @ 147,249 GET oCliInscP VAR cCliInscP SIZE 191,25 ; STYLE ES_UPPERCASE MAXLENGTH 18 FONT oFonte @ 497,249 GET DATEPICKER oCliNasc VAR dCliNasc SIZE 109,25 FONT oFonte @ 722,185 GET oClifone VAR cClifone SIZE 135,25 ; STYLE ES_UPPERCASE MAXLENGTH 14 FONT oFonte ; VALID {|| MsgINFO('Clifone1') } @ 722,217 GET oClifonecom VAR cClifonecom SIZE 135,25 ; STYLE ES_UPPERCASE MAXLENGTH 14 FONT oFonte ; VALID {|| MsgINFO('Clifone2') } @ 722,249 GET oClicelular VAR cClicelular SIZE 135,25 ; STYLE ES_UPPERCASE MAXLENGTH 14 FONT oFonte ; VALID {|| MsgINFO('clifone3') } @ 87,308 GET oClienPg VAR cClienPg SIZE 458,25 ; STYLE ES_UPPERCASE MAXLENGTH 49 FONT oFonte @ 636,308 GET oCliCidCobr VAR cCliCidCobr SIZE 223,25 ; STYLE ES_UPPERCASE MAXLENGTH 25 FONT oFonte @ 87,340 GET oCliBaiCobr VAR cCliBaiCobr SIZE 223,25 ; STYLE ES_UPPERCASE MAXLENGTH 20 FONT oFonte @ 358,342 GET oCliCepCobr VAR cCliCepCobr SIZE 131,25 ; STYLE ES_UPPERCASE PICTURE '@r 99.999-999' FONT oFonte @ 558,342 GET COMBOBOX oCliEstaCobr VAR nCliEstaCobr ; ITEMS ListaUf SIZE 67,25 STYLE CBS_UPPERCASE FONT oFonte @ 792,342 GET COMBOBOX oCliPostal VAR cCliPostal ; ITEMS {"Não","Sim"} SIZE 67,25 STYLE CBS_UPPERCASE FONT oFonte @ 11,404 GET oRefere1 VAR cRefere1 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 11,431 GET oRefere2 VAR cRefere2 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 11,458 GET oRefere3 VAR cRefere3 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 288,404 GET oVende1 VAR cVende1 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 288,431 GET oVende2 VAR cVende2 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 288,458 GET oVende3 VAR cVende3 SIZE 260,25 ; STYLE ES_UPPERCASE MAXLENGTH 30 FONT oFonte @ 570,388 BUTTONEX oButtonex1 CAPTION "Informações Adicionais Limites de Crédito" SIZE 137,112 ; STYLE BS_MULTILINE+WS_TABSTOP FONT HFont():Add( 'Arial',0,-19,400,,,) ; ON CLICK {|| msginfo('adicionais') } @ 709,388 BUTTON BtnCancelar CAPTION "Cancelar" SIZE 158,55 ; STYLE BS_CENTER +WS_TABSTOP FONT HFont():Add( 'Arial',0,-21,400,,,) ; ON CLICK {|| msginfo('cancelar') } @ 709,444 BUTTON BtnSalvar CAPTION "Salvar" SIZE 158,55 ; STYLE BS_CENTER +WS_TABSTOP FONT HFont():Add( 'Arial',0,-21,400,,,) ; ON CLICK {|| MsgINFO('salvar') } ACTIVATE DIALOG FrmCadastroClientes RETURN FrmCadastroClientes:lresult