From: Thadeu Lima de Souza Cascardo Date: Sun, 3 May 2015 22:23:20 +0000 (+0000) Subject: Permite definir outros dados do contribuinte. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fdeclara.git;a=commitdiff_plain;h=035788600f86579f570cf68782725eaa40e1f743 Permite definir outros dados do contribuinte. A maior parte dos dados é relacionada ao endereço. No momento, não há suporte para pessoas vivendo fora do Brasil. --- diff --git a/Makefile.am b/Makefile.am index 93997f5..1d671b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,4 +6,5 @@ declara_SOURCES = declara.c declaracao.c declaracao.h \ base.c base.h \ list.c list.h \ util.c util.h \ + contribuinte.c contribuinte.h \ rendimento.c rendimento.h diff --git a/contribuinte.c b/contribuinte.c new file mode 100644 index 0000000..10899ef --- /dev/null +++ b/contribuinte.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2015 Thadeu Lima de Souza Cascardo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "cmd.h" +#include "declaracao.h" +#include "contribuinte.h" +#include "util.h" + +#define SET_INT_CONTRIBUINTE(attr) \ + SET_INT_(attr, attr, contribuinte.attr) + +#define SET_STRING_CONTRIBUINTE(attr) \ + SET_STRING_(attr, attr, contribuinte.attr) + +SET_STRING_CONTRIBUINTE(uf); +SET_INT_CONTRIBUINTE(cd_municipio); +SET_STRING_CONTRIBUINTE(municipio); +SET_STRING_CONTRIBUINTE(cep); +SET_STRING_CONTRIBUINTE(bairro); +SET_STRING_CONTRIBUINTE(tipo_logradouro); +SET_STRING_CONTRIBUINTE(logradouro); +SET_STRING_CONTRIBUINTE(numero); +SET_STRING_CONTRIBUINTE(complemento); +SET_STRING_CONTRIBUINTE(titulo_eleitor); +SET_STRING_CONTRIBUINTE(dn); +SET_STRING_CONTRIBUINTE(ddd); +SET_STRING_CONTRIBUINTE(telefone); +SET_INT_CONTRIBUINTE(natureza_ocupacao); +SET_INT_CONTRIBUINTE(ocupacao_principal); + +void contribuinte_dump(struct declaracao *dec) +{ +} + +int contribuinte_cmd_init(void) +{ + cmd_add(&cmd_uf); + cmd_add(&cmd_cd_municipio); + cmd_add(&cmd_municipio); + cmd_add(&cmd_cep); + cmd_add(&cmd_bairro); + cmd_add(&cmd_tipo_logradouro); + cmd_add(&cmd_logradouro); + cmd_add(&cmd_numero); + cmd_add(&cmd_complemento); + cmd_add(&cmd_titulo_eleitor); + cmd_add(&cmd_dn); + cmd_add(&cmd_ddd); + cmd_add(&cmd_telefone); + cmd_add(&cmd_natureza_ocupacao); + cmd_add(&cmd_ocupacao_principal); + return 0; +} diff --git a/contribuinte.h b/contribuinte.h new file mode 100644 index 0000000..b276b6c --- /dev/null +++ b/contribuinte.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 Thadeu Lima de Souza Cascardo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef _CONTRIBUINTE_H +#define _CONTRIBUINTE_H + +struct declaracao; + +struct contribuinte { + char *uf; + int cd_municipio; + char *municipio; + char *cep; + char *bairro; + char *tipo_logradouro; + char *logradouro; + char *numero; + char *complemento; + char *titulo_eleitor; + char *dn; + char *ddd; + char *telefone; + int natureza_ocupacao; + int ocupacao_principal; +}; + +void contribuinte_dump(struct declaracao *dec); + +int contribuinte_cmd_init(void); + +#endif diff --git a/declara.c b/declara.c index b134079..bbb6ad8 100644 --- a/declara.c +++ b/declara.c @@ -26,6 +26,7 @@ #include "declaracao.h" #include "cmd.h" #include "base.h" +#include "contribuinte.h" #include "rendimento.h" #include "calcula.h" @@ -86,6 +87,7 @@ int main(int argc, char **argv) cmd_init(); base_cmd_init(); + contribuinte_cmd_init(); rendimento_cmd_init(); calcula_cmd_init(); diff --git a/declaracao.h b/declaracao.h index ac16397..24d0b25 100644 --- a/declaracao.h +++ b/declaracao.h @@ -20,6 +20,7 @@ #define _DECLARACAO_H #include "list.h" +#include "contribuinte.h" enum { SIMPLES, @@ -31,6 +32,7 @@ struct declaracao { char *cpf; char *nome; struct list *rendimento; + struct contribuinte contribuinte; long long totalrendimento; long long pago; long long devido;