Пример #1
0
 private void TipoList_SelectedIndexChanged(object sender, EventArgs e)
 {
     UnidadeList.Items.Clear();
     SubUnidadeList.Items.Clear();
     if (TipoList.SelectedItem != null)
     {
         if (TipoList.SelectedIndex > 0)
         {
             UnidadeList.Enabled    = true;
             SubUnidadeList.Enabled = true;
             Inscricao.ReadOnly     = true;
             CustomListBoxItem item         = (CustomListBoxItem)TipoList.SelectedItem;
             Imovel_bll        imovel_Class = new Imovel_bll(_connection);
             Condominios = imovel_Class.Lista_Unidade_Condominio(item._value);
             foreach (Condominiounidade Unidade in Condominios)
             {
                 UnidadeList.Items.Add(Unidade.Cd_unidade.ToString("00"));
             }
             if (UnidadeList.Items.Count > 0)
             {
                 UnidadeList.SelectedIndex = 0;
             }
         }
         else
         {
             UnidadeList.Enabled    = false;
             SubUnidadeList.Enabled = false;
             Inscricao.ReadOnly     = false;
             Inscricao.Text         = "";
             Inscricao.Focus();
         }
     }
 }
Пример #2
0
        private void AtualizarUnidade_Click(object sender, EventArgs e)
        {
            int nQtde = 0;

            try {
                nQtde = Int32.Parse(Unidades.Text);
            } catch {
                MessageBox.Show("Quantidade de unidades inválida.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Imovel_bll imovel_Class = new Imovel_bll(_connection);

            if (nQtde > UnidadesListView.Items.Count)
            {
                int QtdeAcrescentar = nQtde - UnidadesListView.Items.Count;
                int Inicio          = UnidadesListView.Items.Count + 1;
                int Final           = Inicio + QtdeAcrescentar;
                for (int i = Inicio; i < Final; i++)
                {
                    ListViewItem lvItem = new ListViewItem(i.ToString("00"));
                    lvItem.SubItems.Add("000");
                    UnidadesListView.Items.Add(lvItem);
                }
                return;
            }
            else
            {
                int distrito = 0, setor = 0, quadra = 0, lote = 0, face = 0, Codigo = 0;
                distrito = Int32.Parse(Distrito.Text);
                setor    = Int32.Parse(Setor.Text);
                quadra   = Int32.Parse(Quadra.Text);
                lote     = Int32.Parse(Lote.Text);
                face     = Int32.Parse(Face.Text);
                bool bFind = false;
                foreach (ListViewItem item in UnidadesListView.Items)
                {
                    Codigo = imovel_Class.Existe_Imovel(distrito, setor, quadra, lote, Convert.ToInt32(item.Text), Convert.ToInt32(item.SubItems[1].Text));
                    if (Codigo > 0)
                    {
                        bFind = true;
                        break;
                    }
                }
                if (bFind)
                {
                    MessageBox.Show("Existem imóveis cadastrados neste condomínio (Ex: " + Codigo.ToString() + "). Exclua-os antes de reduzir a lista de unidades.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    UnidadesListView.Items.Clear();
                    for (int i = 1; i < Int32.Parse(Unidades.Text); i++)
                    {
                        ListViewItem lvItem = new ListViewItem(i.ToString("00"));
                        lvItem.SubItems.Add("000");
                        UnidadesListView.Items.Add(lvItem);
                    }
                }
            }
        }
Пример #3
0
        public JsonResult Lista_Imovel_Historico(string cod)
        {
            Imovel_bll             imovelRepository = new Imovel_bll(_connection);
            List <HistoricoStruct> Lista            = imovelRepository.Lista_Historico(Convert.ToInt32(cod));

            return(new JsonResult {
                Data = Lista, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #4
0
        public ActionResult Checkguid(CertidaoViewModel model, string c)
        {
            Imovel_bll imovelRepository       = new Imovel_bll(_connection);
            Itbi_isencao_main_Struct   _itbi  = imovelRepository.Retorna_Itbi_Isencao_Main(c);
            List <Itbi_isencao_imovel> _Lista = imovelRepository.Retorna_Itbi_Isencao_Imovel(c);

            ReportDocument rd = new ReportDocument();

            rd.Load(System.Web.HttpContext.Current.Server.MapPath("~/Reports/Certidao_Isencao_Itbi_Valida.rpt"));
            TableLogOnInfos            crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo             crtableLogoninfo  = new TableLogOnInfo();
            ConnectionInfo             crConnectionInfo  = new ConnectionInfo();
            Tables                     CrTables;
            string                     myConn    = ConfigurationManager.ConnectionStrings[_connection].ToString();
            SqlConnectionStringBuilder builder   = new SqlConnectionStringBuilder(myConn);
            string                     IPAddress = builder.DataSource;
            string                     _userId   = builder.UserID;
            string                     _pwd      = builder.Password;

            crConnectionInfo.ServerName   = IPAddress;
            crConnectionInfo.DatabaseName = "Tributacao";
            crConnectionInfo.UserID       = _userId;
            crConnectionInfo.Password     = _pwd;
            CrTables = rd.Database.Tables;
            foreach (Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            Sistema_bll   sistemaRepository = new Sistema_bll(_connection);
            Assinatura    assinatura        = sistemaRepository.Retorna_Usuario_Assinatura(_itbi.Fiscal_id);
            usuarioStruct usuario           = sistemaRepository.Retorna_Usuario(_itbi.Fiscal_id);

            rd.SetParameterValue("ANONUMERO", _itbi.Isencao_numero.ToString("00000") + "/" + _itbi.Isencao_ano.ToString("0000"));
            rd.SetParameterValue("NATUREZA", _itbi.Natureza_Nome);
            rd.SetParameterValue("NOMEFISCAL", usuario.Nome_completo);
            rd.SetParameterValue("CARGO", assinatura.Cargo);

            string imovel = "";

            foreach (Itbi_isencao_imovel item in _Lista)
            {
                imovel += item.Descricao + ", ";
            }
            imovel = imovel.Substring(0, imovel.Length - 2);
            rd.SetParameterValue("IMOVEL", imovel);
            try {
                rd.RecordSelectionFormula = "{itbi_isencao_main.guid}='" + c + "'";
                Stream stream = rd.ExportToStream(ExportFormatType.PortableDocFormat);
                return(File(stream, "application/pdf", "Certidao_Isencao_Itbi_Valida.pdf"));
            } catch {
                throw;
            }
        }
Пример #5
0
        public Condominio_Lista()
        {
            InitializeComponent();
            tBar.Renderer = new MySR();
            Imovel_bll empresa_Class = new Imovel_bll(_connection);

            MainList.DataSource    = empresa_Class.Lista_Condominio();
            MainList.DisplayMember = "cd_nomecond";
            MainList.ValueMember   = "cd_codigo";
        }
Пример #6
0
        private void Exibe_Certidao_Debito(Certidao_debito dados)
        {
            lblMsg.Text = "";
            string sEndereco = dados.Logradouro + ", " + dados.Numero.ToString();
            string sTipo     = "";

            if (dados.Ret == 4)
            {
                sTipo = "CERTDÂO POSITIVA";
            }
            else
            {
                if (dados.Ret == 5)
                {
                    sTipo = "CERTIDÃO POSITIVA EFEITO NEGATIVA";
                }
                else
                {
                    sTipo = "CERTIDÃO NEGATIVA";
                }
            }

            Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");
            string     sProc        = dados.Processo;

            ReportDocument crystalReport = new ReportDocument();

            crystalReport.Load(Server.MapPath("~/Report/CertidaoDebitoValida.rpt"));
            crystalReport.SetParameterValue("NUMCERTIDAO", dados.Numero.ToString("00000") + "/" + dados.Ano.ToString("0000"));
            crystalReport.SetParameterValue("DATAEMISSAO", Convert.ToDateTime(dados.Datagravada).ToString("dd/MM/yyyy") + " às " + Convert.ToDateTime(dados.Datagravada).ToString("HH:mm:ss"));
            crystalReport.SetParameterValue("CONTROLE", dados.Numero.ToString("00000") + dados.Ano.ToString("0000") + "/" + dados.Codigo.ToString() + "-CI");
            crystalReport.SetParameterValue("ENDERECO", sEndereco);
            crystalReport.SetParameterValue("CADASTRO", Convert.ToInt32(dados.Codigo).ToString("000000"));
            crystalReport.SetParameterValue("NOME", dados.Nome);
            crystalReport.SetParameterValue("INSCRICAO", string.IsNullOrWhiteSpace(dados.Inscricao)?"N/A":dados.Inscricao);
            crystalReport.SetParameterValue("BAIRRO", dados.Bairro);
            crystalReport.SetParameterValue("TIPO", sTipo);
            crystalReport.SetParameterValue("PROCESSO", sProc);
            crystalReport.SetParameterValue("ATIVIDADE", string.IsNullOrWhiteSpace(dados.Atividade) ? "N/A" : dados.Atividade);
            crystalReport.SetParameterValue("TRIBUTO", string.IsNullOrWhiteSpace(dados.Lancamento) ? "N/A" : dados.Lancamento);

            HttpContext.Current.Response.Buffer = false;
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.ClearHeaders();

            try {
                crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "comp" + dados.Numero.ToString() + dados.Ano.ToString());
            } catch {
            } finally {
                crystalReport.Close();
                crystalReport.Dispose();
            }
        }
        private void Exibe_Certidao_ValorVenal(Certidao_valor_venal dados)
        {
            lblMsg.Text = "";
            string sComplemento = dados.Li_compl;
            string sQuadras     = string.IsNullOrWhiteSpace(dados.Li_quadras) ? "" : " Quadra: " + dados.Li_quadras.ToString().Trim();
            string sLotes       = string.IsNullOrWhiteSpace(dados.Li_lotes) ? "" : " Lote: " + dados.Li_lotes.ToString().Trim();

            sComplemento += sQuadras + sLotes;
            string sEndereco = dados.Logradouro + ", " + dados.Numero.ToString() + sComplemento;

            Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");
            Laseriptu  RegIPTU      = imovel_Class.Dados_IPTU(dados.Codigo, DateTime.Now.Year);

            if (RegIPTU == null)
            {
                lblMsg.Text = "Não foi possível emitir certidão para este código";
                return;
            }
            decimal Vvt          = (decimal)RegIPTU.Vvt;
            decimal Vvp          = (decimal)RegIPTU.Vvc;
            decimal Vvi          = (decimal)RegIPTU.Vvi;
            decimal Areaterreno  = (decimal)RegIPTU.Areaterreno;
            string  _valor_metro = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "R${0:#,###.##}", (Vvt / Areaterreno)) + " R$/m²";


            ReportDocument crystalReport = new ReportDocument();

            crystalReport.Load(Server.MapPath("~/Report/CertidaoValorVenalValida.rpt"));
            crystalReport.SetParameterValue("NUMCERTIDAO", dados.Numero.ToString("00000") + "/" + dados.Ano.ToString("0000"));
            crystalReport.SetParameterValue("DATAEMISSAO", dados.Data.ToString("dd/MM/yyyy") + " às " + dados.Data.ToString("HH:mm:ss"));
            crystalReport.SetParameterValue("CONTROLE", dados.Numero.ToString("00000") + dados.Ano.ToString("0000") + "/" + dados.Codigo.ToString() + "-VV");
            crystalReport.SetParameterValue("ENDERECO", sEndereco);
            crystalReport.SetParameterValue("CADASTRO", dados.Codigo.ToString("000000"));
            crystalReport.SetParameterValue("NOME", dados.Nomecidadao);
            crystalReport.SetParameterValue("INSCRICAO", dados.Inscricao);
            crystalReport.SetParameterValue("BAIRRO", dados.Descbairro);
            crystalReport.SetParameterValue("VVT", string.Format(CultureInfo.GetCultureInfo("pt-BR"), "R${0:#,###.##}", Vvt) + " (" + _valor_metro + ")");
            crystalReport.SetParameterValue("VVP", string.Format(CultureInfo.GetCultureInfo("pt-BR"), "R${0:#,###.##}", Vvp));
            crystalReport.SetParameterValue("VVI", string.Format(CultureInfo.GetCultureInfo("pt-BR"), "R${0:#,###.##}", Vvi));

            HttpContext.Current.Response.Buffer = false;
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.ClearHeaders();

            try {
                crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "comp" + dados.Numero.ToString() + dados.Ano.ToString());
            } catch {
            } finally {
                crystalReport.Close();
                crystalReport.Dispose();
            }
        }
Пример #8
0
        private void Exibe_Certidao_Isencao(Certidao_isencao dados)
        {
            lblMsg.Text = "";
            string sComplemento = dados.Li_compl == null?"":" " + dados.Li_compl;
            string sQuadras     = string.IsNullOrWhiteSpace(dados.Li_quadras) ? "" : " Quadra: " + dados.Li_quadras.ToString().Trim();
            string sLotes       = string.IsNullOrWhiteSpace(dados.Li_lotes) ? "" : " Lote: " + dados.Li_lotes.ToString().Trim();

            sComplemento += sQuadras + sLotes;
            string sEndereco = dados.Logradouro + ", " + dados.Numero.ToString() + sComplemento;

            Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");
            decimal    nPerc        = (decimal)dados.Percisencao;

            if (nPerc == 0)
            {
                nPerc = 100;
            }
            string sProc = "";

            if (dados.Numero > 0)
            {
                List <IsencaoStruct> ListaIsencao = null;
                ListaIsencao = imovel_Class.Lista_Imovel_Isencao(dados.Codigo, DateTime.Now.Year);
                sProc        = ListaIsencao[0].Numprocesso + " de " + Convert.ToDateTime(ListaIsencao[0].dataprocesso).ToString("dd/MM/yyyy");
            }

            ReportDocument crystalReport = new ReportDocument();

            crystalReport.Load(Server.MapPath("~/Report/CertidaoIsencaoValida.rpt"));
            crystalReport.SetParameterValue("NUMCERTIDAO", dados.Numero.ToString("00000") + "/" + dados.Ano.ToString("0000"));
            crystalReport.SetParameterValue("DATAEMISSAO", dados.Data.ToString("dd/MM/yyyy") + " às " + dados.Data.ToString("HH:mm:ss"));
            crystalReport.SetParameterValue("CONTROLE", dados.Numero.ToString("00000") + dados.Ano.ToString("0000") + "/" + dados.Codigo.ToString() + "-CI");
            crystalReport.SetParameterValue("ENDERECO", sEndereco);
            crystalReport.SetParameterValue("CADASTRO", dados.Codigo.ToString("000000"));
            crystalReport.SetParameterValue("NOME", dados.Nomecidadao);
            crystalReport.SetParameterValue("INSCRICAO", dados.Inscricao);
            crystalReport.SetParameterValue("BAIRRO", dados.Descbairro);
            crystalReport.SetParameterValue("PERC", nPerc);
            crystalReport.SetParameterValue("PROCESSO", sProc);

            HttpContext.Current.Response.Buffer = false;
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.ClearHeaders();

            try {
                crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "comp" + dados.Numero.ToString() + dados.Ano.ToString());
            } catch {
            } finally {
                crystalReport.Close();
                crystalReport.Dispose();
            }
        }
Пример #9
0
        private void FillTable(int NumDocumento)
        {
            Imovel_bll                imovel_Class     = new Imovel_bll("GTIconnection");
            Tributario_bll            tributario_Class = new Tributario_bll("GTIconnection");
            int                       Codigo           = tributario_Class.Retorna_Codigo_por_Documento(NumDocumento);
            ImovelStruct              regDados         = imovel_Class.Dados_Imovel(Codigo);
            List <ProprietarioStruct> lstProprietario  = imovel_Class.Lista_Proprietario(Codigo, true);

            IM.Text             = regDados.Codigo.ToString();
            NOME.Text           = lstProprietario[0].Nome;
            ENDERECOIMOVEL.Text = regDados.NomeLogradouro + ", " + regDados.Numero.ToString() + " " + regDados.Complemento.ToString();
            BAIRRO.Text         = regDados.NomeBairro.ToString();
        }
Пример #10
0
 private void CondominioButton_Click(object sender, EventArgs e)
 {
     using (var form = new Condominio_Lista()) {
         var result = form.ShowDialog(this);
         if (result == DialogResult.OK)
         {
             short      val          = form.ReturnValue;
             Imovel_bll imovel_Class = new Imovel_bll(_connection);
             Condominio.Text = imovel_Class.Dados_Condominio(val).Nome;
             Condominio.Tag  = val.ToString();
         }
     }
 }
Пример #11
0
        public ActionResult imovel_data(string cod)
        {
            ImovelDetailsViewModel model            = new ImovelDetailsViewModel();
            Imovel_bll             imovelRepository = new Imovel_bll(_connection);
            string _guid = Guid.NewGuid().ToString("N");

            ViewBag.Codigo = cod;
            ViewBag.Guid   = _guid;
            cod            = Functions.RetornaNumero(cod);
            if (cod == "")
            {
                ViewBag.Result = "Código inválido.";
                return(View(model));
            }
            int  _codigo = Convert.ToInt32(cod);
            bool existe  = imovelRepository.Existe_Imovel(_codigo);

            if (existe)
            {
                model.ImovelStruct       = imovelRepository.Dados_Imovel(_codigo);
                model.Lista_Proprietario = imovelRepository.Lista_Proprietario(_codigo, false);
                model.Lista_Areas        = imovelRepository.Lista_Area(_codigo);
                model.Lista_Testada      = imovelRepository.Lista_Testada(_codigo);
                model.Tipo_Matricula     = model.ImovelStruct.TipoMat == "T" ? "Transcrição" : "Matrícula";
                if (model.ImovelStruct.EE_TipoEndereco != null)
                {
                    short _tipoEE = (short)model.ImovelStruct.EE_TipoEndereco;
                    if (_tipoEE == 0)
                    {
                        model.Endereco_Entrega = imovelRepository.Dados_Endereco(_codigo, TipoEndereco.Local);
                    }
                    else
                    {
                        if (_tipoEE == 1)
                        {
                            model.Endereco_Entrega = imovelRepository.Dados_Endereco(_codigo, TipoEndereco.Proprietario);
                        }
                        else
                        {
                            model.Endereco_Entrega = imovelRepository.Dados_Endereco(_codigo, TipoEndereco.Entrega);
                        }
                    }
                }
            }
            else
            {
                ViewBag.Result = "Imóvel não cadastrado.";
            }

            return(View(model));
        }
        protected void btPrint_Click(object sender, EventArgs e)
        {
            string sCPF = txtCPF.Text, sCNPJ = txtCNPJ.Text;
            int    Codigo = 0;

            if (sCPF == "" && sCNPJ == "")
            {
                lblMsg.Text = "Digite o CPF/CNPJ da empresa.";
            }
            else
            {
                if (CodigoList.Items.Count > 0)
                {
                    Codigo = Convert.ToInt32(CodigoList.Text);
                }
                lblMsg.Text = "";
                if (Codigo > 0)
                {
                    if (txtimgcode.Text != Session["randomStr"].ToString())
                    {
                        lblMsg.Text = "Código da imagem inválido";
                    }
                    else
                    {
                        if (ExtratoCheckBox.Checked && optCNPJ.Checked)
                        {
                            lblMsg.Text = "Resumo de pagamento apenas para pessoas físicas.";
                        }
                        else
                        {
                            Imovel_bll   imovel_Class = new Imovel_bll("GTIconnection");
                            ImovelStruct _imovel      = imovel_Class.Dados_Imovel(Codigo);
                            if (_imovel.Inativo == true)
                            {
                                lblMsg.Text = "O imóvel esta inativo!";
                            }
                            else
                            {
                                PrintReport(Codigo, TipoCadastro.Imovel);
                            }
                        }
                    }
                }
                else
                {
                    lblMsg.Text = "Selecione uma inscrição municipal da lista.";
                }
            }
        }
Пример #13
0
        public HttpResponseMessage GetImovelInscricao(int distrito)
        {
            Imovel_bll imovelRepository = new Imovel_bll(_connection);

            int _cod = imovelRepository.Existe_Imovel(distrito, 1, 1, 6, 0, 0);

            if (_cod == 0)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Imóvel não cadastrado."));
            }
            else
            {
                ImovelStruct _imovel = imovelRepository.Dados_Imovel(_cod);
                return(Request.CreateResponse(HttpStatusCode.OK, _imovel));
            }
        }
Пример #14
0
        public HttpResponseMessage Get(int id)
        {
            Imovel_bll imovelRepository = new Imovel_bll(_connection);

            bool _existe = imovelRepository.Existe_Imovel(id);

            if (!_existe)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Imóvel não cadastrado."));
            }
            else
            {
                ImovelStruct _imovel = imovelRepository.Dados_Imovel(id);
                return(Request.CreateResponse(HttpStatusCode.OK, _imovel));
            }
        }
Пример #15
0
        public HttpResponseMessage GetImovelId(int id)
        {
            Imovel_bll imovelRepository = new Imovel_bll(_connection);

            bool _existe = imovelRepository.Existe_Imovel(id);

            if (!_existe)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Imóvel não cadastrado."));
            }
            else
            {
                Imovel_Full _imovel    = imovelRepository.Dados_Imovel_Full(id);
                string      jsonString = JsonConvert.SerializeObject(_imovel);
                return(Request.CreateResponse(HttpStatusCode.OK, jsonString));
            }
        }
Пример #16
0
        public Imovel_Novo()
        {
            m_aeroEnabled = false;
            this.Refresh();
            InitializeComponent();
            tBar.Renderer = new MySR();
            Imovel_bll imovel_Class = new Imovel_bll(_connection);

            lista_condominios = imovel_Class.Lista_Condominio();
            TipoList.Items.Add(new CustomListBoxItem("(Imóvel normal)", 0));
            List <CustomListBoxItem> myItems = new List <CustomListBoxItem>();

            foreach (GTI_Models.Models.Condominio item in lista_condominios)
            {
                TipoList.Items.Add(new CustomListBoxItem(item.Cd_nomecond, item.Cd_codigo));
            }
            TipoList.SelectedIndex = 0;
        }
Пример #17
0
 protected void btPrint_Click(object sender, EventArgs e)
 {
     if (txtIM.Text == "")
     {
         lblMsg.Text = "Digite o código do imóvel.";
     }
     else
     {
         lblMsg.Text = "";
         int        Codigo       = Convert.ToInt32(txtIM.Text);
         Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");
         bool       ExisteImovel = imovel_Class.Existe_Imovel(Codigo);
         if (!ExisteImovel)
         {
             lblMsg.Text = "Imóvel não cadastrado.";
         }
         else
         {
             ImovelStruct _dadosImovel = imovel_Class.Dados_Imovel(Codigo);
             if (_dadosImovel.ResideImovel == false)
             {
                 lblMsg.Text = "Isenção válida apenas proprietários residentes no imóvel.";
             }
             else
             {
                 if (txtimgcode.Text != Session["randomStr"].ToString())
                 {
                     lblMsg.Text = "Código da imagem inválido";
                 }
                 else
                 {
                     if (_dadosImovel.Inativo == true)
                     {
                         lblMsg.Text = "O imóvel esta inativo!";
                     }
                     else
                     {
                         PrintReport(Codigo);
                     }
                 }
             }
         }
     }
 }
Пример #18
0
        public Foto_Imovel(int Codigo)
        {
            InitializeComponent();
            HeaderToolStrip.Renderer = new MySR();
            Imovel_bll         imovelRepository = new Imovel_bll(_connection);
            List <Foto_imovel> Lista            = imovelRepository.Lista_Foto_Imovel(Codigo);

            foreach (GTI_Models.Models.Foto_imovel item in Lista)
            {
                string _foto = _path + "09\\" + item.Pasta.ToString("00") + "\\" + item.Arquivo;
                Lista_Fotos.Add(_foto);
            }
            _pos = 0; _total = Lista_Fotos.Count;

            AnteriorButton.Enabled = false;
            if (_total == 1)
            {
                ProximoButton.Enabled = false;
            }
            Carrega_Foto(_pos);
        }
Пример #19
0
        private void Carrega_Lista()
        {
            Imovel_bll clsImovel = new Imovel_bll(_connection);

            CategoriaList.DataSource    = clsImovel.Lista_Categoria_Propriedade();
            CategoriaList.DisplayMember = "Desccategprop";
            CategoriaList.ValueMember   = "Codcategprop";

            TopografiaList.DataSource    = clsImovel.Lista_Topografia();
            TopografiaList.DisplayMember = "Desctopografia";
            TopografiaList.ValueMember   = "Codtopografia";

            SituacaoList.DataSource    = clsImovel.Lista_Situacao();
            SituacaoList.DisplayMember = "Descsituacao";
            SituacaoList.ValueMember   = "Codsituacao";

            BenfeitoriaList.DataSource    = clsImovel.Lista_Benfeitoria();
            BenfeitoriaList.DisplayMember = "Descbenfeitoria";
            BenfeitoriaList.ValueMember   = "Codbenfeitoria";

            PedologiaList.DataSource    = clsImovel.Lista_Pedologia();
            PedologiaList.DisplayMember = "Descpedologia";
            PedologiaList.ValueMember   = "Codpedologia";

            UsoList.DataSource    = clsImovel.Lista_uso_terreno();
            UsoList.DisplayMember = "Descusoterreno";
            UsoList.ValueMember   = "Codusoterreno";

            UsoConstrucaoList.DataSource    = clsImovel.Lista_Uso_Construcao();
            UsoConstrucaoList.DisplayMember = "Descusoconstr";
            UsoConstrucaoList.ValueMember   = "Codusoconstr";

            CategoriaConstrucaoList.DataSource    = clsImovel.Lista_Categoria_Construcao();
            CategoriaConstrucaoList.DisplayMember = "Desccategconstr";
            CategoriaConstrucaoList.ValueMember   = "Codcategconstr";

            TipoConstrucaoList.DataSource    = clsImovel.Lista_Tipo_Construcao();
            TipoConstrucaoList.DisplayMember = "Desctipoconstr";
            TipoConstrucaoList.ValueMember   = "Codtipoconstr";
        }
Пример #20
0
        private void Carrega_Inscricao()
        {
            CustomListBoxItem item         = (CustomListBoxItem)TipoList.SelectedItem;
            Imovel_bll        imovel_Class = new Imovel_bll(_connection);

            for (int i = 0; i < lista_condominios.Count; i++)
            {
                if (lista_condominios[i].Cd_codigo == item._value)
                {
                    StringBuilder sInscricao = new StringBuilder();
                    sInscricao.Append(lista_condominios[i].Cd_distrito.ToString() + ".");
                    sInscricao.Append(lista_condominios[i].Cd_setor.ToString("00") + ".");
                    sInscricao.Append(lista_condominios[i].Cd_quadra.ToString("0000") + ".");
                    sInscricao.Append(lista_condominios[i].Cd_lote.ToString("00000") + ".");
                    sInscricao.Append(lista_condominios[i].Cd_seq.ToString("00") + ".");
                    sInscricao.Append(UnidadeList.Text + ".");
                    sInscricao.Append(SubUnidadeList.Text);
                    Inscricao.Text = sInscricao.ToString();
                    break;
                }
            }
        }
Пример #21
0
        private void Gera_Matriz(int _codigo_ini, int _codigo_fim, DateTime _data_vencto)
        {
            int      _total = 0, _pos = 1, _numero_documento = 20018535; //20.003.042 até 20.030.000
            DateTime _data_vencimento = Convert.ToDateTime("30/09/2022");
            decimal  _valor_honorario = 0;

            Exception ex = null;
            List <SpExtrato_carta> Lista_Resumo = new List <SpExtrato_carta>();
            List <SpExtrato_carta> Lista_Final  = new List <SpExtrato_carta>();

            //Exclui a remessa se já existir
            Tributario_bll tributario_Class = new Tributario_bll(_connection);
            Sistema_bll    sistema_Class    = new Sistema_bll(_connection);
            Imovel_bll     imovel_Class     = new Imovel_bll(_connection);
            Empresa_bll    empresa_Class    = new Empresa_bll(_connection);
            Cidadao_bll    cidadao_Class    = new Cidadao_bll(_connection);

            decimal    _valor_AR      = tributario_Class.Retorna_Valor_Tributo(DateTime.Now.Year, 667);
            List <int> _lista_codigos = tributario_Class.Lista_Codigo_Carta(_codigo_ini, _codigo_fim, _data_vencto);

            PBar.Value = 0;
            //ex = tributario_Class.Excluir_Carta_Cobranca(_remessa);
            //if (ex != null) {
            //    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
            //    eBox.ShowDialog();
            //}
            _total = _lista_codigos.Count;
            _lista_codigos.Sort();
            foreach (int _codigo_atual in _lista_codigos)
            {
                if (_stop)
                {
                    break;
                }
                if (_pos % 2 == 0)
                {
                    PBar.Value = _pos * 100 / _total;
                    PBar.Update();
                    Refresh();
                    Application.DoEvents();
                }

                if (_codigo_atual > 100000 && _codigo_atual < 300000)
                {
                    if (empresa_Class.EmpresaSuspensa(_codigo_atual))
                    {
                        goto Proximo;
                    }
                }

                List <SpExtrato_carta> Lista_Extrato_Tributo = tributario_Class.Lista_Extrato_Tributo_Carta(Codigo: _codigo_atual, Data_Atualizacao: _data_vencimento);
                if (Lista_Extrato_Tributo.Count == 0)
                {
                    goto Proximo;
                }

                List <SpExtrato_carta> Lista_Extrato_Parcela = tributario_Class.Lista_Extrato_Parcela_Carta(Lista_Extrato_Tributo);
                Lista_Resumo.Clear();
                List <string> _lista_lancamento     = new List <string>();
                string        _descricao_lancamento = "";
                bool          _find = false;
                foreach (SpExtrato_carta item in Lista_Extrato_Parcela)
                {
                    //if ( item.Codlancamento!=5 && item.Codlancamento!=11 && item.Datavencimento <= _data_vencto) {
                    if (item.Codlancamento != 11 && item.Datavencimento <= _data_vencto)
                    {
                        Lista_Resumo.Add(item);
                        _find = false;
                        foreach (string lanc in _lista_lancamento)
                        {
                            if (lanc == item.Desclancamento)
                            {
                                _find = true;
                                break;
                            }
                        }
                        if (!_find)
                        {
                            _descricao_lancamento += item.Desclancamento + ", ";
                            _lista_lancamento.Add(item.Desclancamento);
                        }
                    }
                }
                _descricao_lancamento = _descricao_lancamento.Length == 0?"": _descricao_lancamento.Substring(0, _descricao_lancamento.Length - 2);

                if (Lista_Resumo.Count == 0)
                {
                    goto Proximo;
                }

                Lista_Final.Clear();
//                int nPercDesconto = 1;

                foreach (SpExtrato_carta item in Lista_Resumo)
                {
                    _find = false;
                    int _index = 0;
                    foreach (SpExtrato_carta item2 in Lista_Final)
                    {
                        if (item.Anoexercicio == item2.Anoexercicio)
                        {
                            _find = true;
                            break;
                        }
                        _index++;
                    }
                    decimal _valor_juros = 0;
                    decimal _valor_multa = 0;

                    //decimal _valor_juros = item.Valorjuros * nPercDesconto;
                    //decimal _valor_multa = item.Valormulta * nPercDesconto;
                    if (_find)
                    {
                        Lista_Final[_index].Valortributo  += item.Valortributo;
                        Lista_Final[_index].Valorjuros    += _valor_juros;
                        Lista_Final[_index].Valormulta    += _valor_multa;
                        Lista_Final[_index].Valorcorrecao += item.Valorcorrecao;
                        Lista_Final[_index].Valortotal    += item.Valortributo + _valor_juros + _valor_multa + item.Valorcorrecao;
                    }
                    else
                    {
                        SpExtrato_carta reg = new SpExtrato_carta();
                        reg.Codreduzido   = item.Codreduzido;
                        reg.Anoexercicio  = item.Anoexercicio;
                        reg.Valortributo  = item.Valortributo;
                        reg.Valorjuros    = _valor_juros;
                        reg.Valormulta    = _valor_multa;
                        reg.Valorcorrecao = item.Valorcorrecao;
                        reg.Valortotal    = item.Valortributo + _valor_juros + _valor_multa + item.Valorcorrecao;
                        reg.Dataajuiza    = item.Dataajuiza;
                        Lista_Final.Add(reg);
                    }
                }
                if (Lista_Final.Count == 0)
                {
                    goto Proximo;
                }

                //Soma o boleto
                decimal _valor_boleto = 0;
                foreach (SpExtrato_carta item in Lista_Final)
                {
                    _valor_boleto += Math.Round(item.Valortributo, 2, MidpointRounding.AwayFromZero) + item.Valormulta + item.Valorjuros + Math.Round(item.Valorcorrecao, 2, MidpointRounding.AwayFromZero);
                }

                //Honorários
                _valor_honorario = 0;
                foreach (SpExtrato_carta item in Lista_Resumo)
                {
                    if (item.Dataajuiza != null)
                    {
                        _valor_honorario += ((item.Valortributo + item.Valorcorrecao) * 10) / 100;
                    }
                }

                //AR
                _valor_AR = 0;
                //foreach (SpExtrato_carta item in Lista_Extrato_Parcela) {
                //    if (item.Anoexercicio == 2019 && item.Codlancamento == 78) {
                //        _valor_AR += item.Valortributo;
                //        Parceladocumento RegParcAR = new Parceladocumento {
                //            Codreduzido = _codigo_atual,
                //            Anoexercicio = item.Anoexercicio,
                //            Codlancamento = 78,
                //            Seqlancamento = item.Seqlancamento,
                //            Numparcela = (byte)item.Numparcela,
                //            Codcomplemento = item.Codcomplemento,
                //            Numdocumento = _numero_documento,
                //            Plano = 39
                //        };
                //        ex = tributario_Class.Insert_Parcela_Documento(RegParcAR);
                //    }
                //}

                //Carta_cobranca_detalhe RegDetAR = new Carta_cobranca_detalhe {
                //    Codigo = _codigo_atual,
                //    Remessa = _remessa,
                //    Ano = 2,
                //    Parcela = 1,
                //    Principal = _valor_AR,
                //    Juros = 0,
                //    Multa = 0,
                //    Correcao = 0,
                //    Total = _valor_AR,
                //    Ordem = 3
                //};
                //if (_valor_AR > 0)
                //    ex = tributario_Class.Insert_Carta_Cobranca_Detalhe(RegDetAR);

                _valor_boleto = Convert.ToDecimal(Math.Round(_valor_boleto, 2) + Math.Round(_valor_honorario, 2, mode: MidpointRounding.AwayFromZero) + _valor_AR);

                //Dados contribuinte
                string _nome = "", _cpfcnpj = "", _endereco = "", _bairro = "", _cidade = "", _cep = "", _inscricao = "", _lote = "", _quadra = "", _atividade = "";
                string _convenio = "2873532", _complemento = "", _complemento_entrega = "", _endereco_entrega = "", _bairro_entrega = "", _cidade_entrega = "", _cep_entrega = "";

                Contribuinte_Header_Struct dados = sistema_Class.Contribuinte_Header(_codigo_atual);
                if (dados == null)
                {
                    goto Proximo;
                }
                TipoCadastro _tipo = dados.Tipo;
                _nome        = dados.Nome;
                _cpfcnpj     = dados.Cpf_cnpj;
                _inscricao   = dados.Inscricao;
                _complemento = dados.Complemento == "" ? "" : " " + dados.Complemento;
                _endereco    = dados.Endereco + ", " + dados.Numero.ToString() + _complemento;
                _bairro      = dados.Nome_bairro;
                _cidade      = dados.Nome_cidade + "/" + dados.Nome_uf;
                _cep         = dados.Cep;
                _lote        = dados.Lote_original;
                _quadra      = dados.Quadra_original;
                _atividade   = dados.Atividade;
                if (_tipo == TipoCadastro.Empresa && !dados.Ativo)
                {
                    goto Proximo;
                }

                //Endereço de Entrega
                if (_tipo == TipoCadastro.Imovel)
                {
                    EnderecoStruct endImovel = imovel_Class.Dados_Endereco(_codigo_atual, dados.TipoEndereco);
                    _complemento_entrega = endImovel.Complemento == "" ? "" : " " + endImovel.Complemento;
                    _endereco_entrega    = endImovel.Endereco + ", " + endImovel.Numero.ToString() + _complemento_entrega;
                    _bairro_entrega      = endImovel.NomeBairro;
                    _cidade_entrega      = endImovel.NomeCidade + "/" + endImovel.UF;
                    _cep_entrega         = endImovel.Cep;
                }
                else
                {
                    if (_tipo == TipoCadastro.Empresa)
                    {
                        EmpresaStruct endEmpresa = empresa_Class.Retorna_Empresa(_codigo_atual);
                        //mobiliarioendentrega endEmpresa = empresa_Class.Empresa_Endereco_entrega(_codigo_atual);
                        _complemento_entrega = endEmpresa.Complemento == "" ? "" : " " + endEmpresa.Complemento;
                        _endereco_entrega    = endEmpresa.Nome_logradouro + ", " + endEmpresa.Numero.ToString() + _complemento;
                        _bairro_entrega      = endEmpresa.Bairro_nome;
                        _cidade_entrega      = endEmpresa.Cidade_nome + "/" + endEmpresa.UF;
                        _cep_entrega         = endEmpresa.Cep;
                        if (String.IsNullOrWhiteSpace(endEmpresa.Nome_logradouro))
                        {
                            _endereco_entrega = _endereco;
                            _bairro_entrega   = _bairro;
                            _cidade_entrega   = _cidade;
                            _cep_entrega      = _cep;
                        }
                    }
                    else
                    {
                        if (_tipo == TipoCadastro.Cidadao)
                        {
                            CidadaoStruct endCidadao = cidadao_Class.LoadReg(_codigo_atual);
                            if (endCidadao.EtiquetaR == "S" || endCidadao.EtiquetaR == null)
                            {
                                _complemento_entrega = endCidadao.ComplementoR == "" ? "" : " " + endCidadao.ComplementoR;
                                _endereco_entrega    = endCidadao.EnderecoR + ", " + endCidadao.NumeroR.ToString() + _complemento_entrega;
                                _bairro_entrega      = endCidadao.NomeBairroR;
                                _cidade_entrega      = endCidadao.NomeCidadeR + "/" + endCidadao.UfR;
                                _cep_entrega         = endCidadao.CepR.ToString();
                            }
                            else
                            {
                                _complemento_entrega = endCidadao.ComplementoC == "" ? "" : " " + endCidadao.ComplementoC;
                                _endereco_entrega    = endCidadao.EnderecoC + ", " + endCidadao.NumeroC.ToString() + _complemento_entrega;
                                _bairro_entrega      = endCidadao.NomeBairroC;
                                _cidade_entrega      = endCidadao.NomeCidadeC + "/" + endCidadao.UfC;
                                _cep_entrega         = endCidadao.CepR.ToString();
                            }
                            _endereco = _endereco_entrega;
                            _bairro   = _bairro_entrega;
                            _cidade   = _cidade_entrega;
                            _cep      = _cep_entrega;
                        }
                    }
                }

                string _cep_str    = gtiCore.RetornaNumero(_cep_entrega);
                int    _cep_numero = Convert.ToInt32(_cep_str);
                _cep_entrega = _cep_numero.ToString("00000-000");

                //Se não tiver CEP ou CPF grava exclusão e passa para o próximo
                if (string.IsNullOrWhiteSpace(_cpfcnpj) || string.IsNullOrWhiteSpace(_cep_entrega) || _cep_entrega == "00000-000" || _cep_entrega == "14870-000" || string.IsNullOrWhiteSpace(_endereco_entrega))
                {
                    Carta_cobranca_exclusao regE = new Carta_cobranca_exclusao();
                    regE.Remessa = _remessa;
                    regE.Codigo  = _codigo_atual;
                    ex           = tributario_Class.Insert_Carta_Cobranca_Exclusao(regE);
                    if (ex != null)
                    {
                        ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                        eBox.ShowDialog();
                    }
                    goto Proximo;
                }

                //***** GERA CÓDIGO DE BARRAS BOLETO REGISTRADO*****
                DateTime _data_base        = Convert.ToDateTime("07/10/1997");
                TimeSpan ts                = _data_vencimento - _data_base;
                int      _fator_vencto     = ts.Days;
                string   _quinto_grupo     = String.Format("{0:D4}", _fator_vencto);
                string   _valor_boleto_str = string.Format("{0:0.00}", _valor_boleto);
                _quinto_grupo += string.Format("{0:D10}", Convert.ToInt64(gtiCore.RetornaNumero(_valor_boleto_str)));
                string _barra = "0019" + _quinto_grupo + String.Format("{0:D13}", Convert.ToInt32(_convenio));
                _barra += String.Format("{0:D10}", _numero_documento) + "17";
                string _campo1    = "0019" + _barra.Substring(19, 5);
                string _digitavel = _campo1 + gtiCore.Calculo_DV10(_campo1).ToString();
                string _campo2    = _barra.Substring(23, 10);
                _digitavel += _campo2 + gtiCore.Calculo_DV10(_campo2).ToString();
                string _campo3 = _barra.Substring(33, 10);
                _digitavel += _campo3 + gtiCore.Calculo_DV10(_campo3).ToString();
                string _campo5 = _quinto_grupo;
                string _campo4 = gtiCore.Calculo_DV11(_barra).ToString();
                _digitavel += _campo4 + _campo5;
                _barra      = _barra.Substring(0, 4) + _campo4 + _barra.Substring(4, _barra.Length - 4);
                //**Resultado final**
                string _linha_digitavel = _digitavel.Substring(0, 5) + "." + _digitavel.Substring(5, 5) + " " + _digitavel.Substring(10, 5) + "." + _digitavel.Substring(15, 6) + " ";
                _linha_digitavel += _digitavel.Substring(21, 5) + "." + _digitavel.Substring(26, 6) + " " + _digitavel.Substring(32, 1) + " " + gtiCore.StringRight(_digitavel, 14);
                string _codigo_barra = gtiCore.Gera2of5Str(_barra);
                //**************************************************
                //_descricao_lancamento += ", AR-DIGITAL";
                //if (_valor_honorario > 0)
                //    _descricao_lancamento += ", DESPESAS JUDICIAIS";

                //****** GRAVA DOCUMENTO ****************
                Numdocumento RegDoc = new Numdocumento {
                    numdocumento  = _numero_documento,
                    Datadocumento = DateTime.Now,
                    Valorguia     = _valor_boleto,
                    Emissor       = "GTI/CCob",
                    Registrado    = true,
                    Percisencao   = 100,
                    Userid        = 508
                };
                ex = tributario_Class.Insert_Documento_Existente(RegDoc);

                //****** GRAVA HEADER **************
                Carta_cobranca Reg = new Carta_cobranca();
                Reg.Remessa          = _remessa;
                Reg.Codigo           = _codigo_atual;
                Reg.Parcela          = 1;
                Reg.Total_Parcela    = 1;
                Reg.Parcela_Label    = Reg.Parcela.ToString("00") + "/" + Reg.Total_Parcela.ToString("00");
                Reg.Nome             = _nome.Length > 50 ? _nome.Substring(0, 50) : _nome;
                Reg.Cpf_cnpj         = _cpfcnpj;
                Reg.Endereco         = _endereco;
                Reg.Bairro           = _bairro ?? "";
                Reg.Cidade           = _cidade ?? "";
                Reg.Cep              = _cep ?? "";
                Reg.Endereco_Entrega = _endereco_entrega;
                Reg.Bairro_Entrega   = _bairro_entrega ?? "";
                Reg.Cidade_Entrega   = _cidade_entrega ?? "";
                Reg.Cep_Entrega      = _cep_entrega;
                Reg.Data_Vencimento  = _data_vencimento;
                Reg.Data_Documento   = DateTime.Now;
                Reg.Inscricao        = _inscricao;
                Reg.Lote             = _lote.Length > 15 ? _lote.Substring(0, 15) : _lote;
                Reg.Quadra           = _quadra.Length > 15 ? _quadra.Substring(0, 15) : _quadra;
                Reg.Atividade        = _atividade.Length > 50 ? _atividade.Substring(0, 50) : _atividade;
                Reg.Numero_Documento = _numero_documento;
                Reg.Nosso_Numero     = _convenio + _numero_documento.ToString("0000000000");
                Reg.Valor_Boleto     = _valor_boleto;
                Reg.Digitavel        = _linha_digitavel;
                Reg.Codbarra         = _codigo_barra;
                Reg.Cep_entrega_cod  = _cep_numero;
                Reg.Lancamento       = _descricao_lancamento;

                ex = tributario_Class.Insert_Carta_Cobranca(Reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                }

                //****** GRAVA DETALHE**************

                foreach (SpExtrato_carta item in Lista_Final)
                {
                    Carta_cobranca_detalhe RegDet2 = new Carta_cobranca_detalhe {
                        Codigo    = _codigo_atual,
                        Remessa   = _remessa,
                        Ano       = item.Anoexercicio,
                        Parcela   = 1,
                        Principal = item.Valortributo,
                        Juros     = item.Valorjuros,
                        Multa     = item.Valormulta,
                        Correcao  = item.Valorcorrecao,
                        Total     = item.Valortotal,
                        Ordem     = 1
                    };
                    ex = tributario_Class.Insert_Carta_Cobranca_Detalhe(RegDet2);
                    if (ex != null)
                    {
                        ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                        eBox.ShowDialog();
                    }
                }

                //****** GRAVA PARCELA x DOCUMENTO*******

                foreach (SpExtrato_carta item in Lista_Resumo)
                {
                    Parceladocumento RegParc = new Parceladocumento {
                        Codreduzido    = item.Codreduzido,
                        Anoexercicio   = item.Anoexercicio,
                        Codlancamento  = item.Codlancamento,
                        Seqlancamento  = item.Seqlancamento,
                        Numparcela     = Convert.ToByte(item.Numparcela),
                        Codcomplemento = item.Codcomplemento,
                        Numdocumento   = _numero_documento,
                        Plano          = 39
                    };

                    ex = tributario_Class.Insert_Parcela_Documento(RegParc);
                    if (ex != null)
                    {
                        ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                        eBox.ShowDialog();
                    }
                }

                //********* GRAVA A.R. ***********
                //short _maxSeqAR = tributario_Class.Retorna_Ultima_Seq_AR(_codigo_atual, DateTime.Now.Year);
                //_maxSeqAR++;

                //Debitoparcela regParcelaAR = new Debitoparcela {
                //    Codreduzido = _codigo_atual,
                //    Anoexercicio = Convert.ToInt16(DateTime.Now.Year),
                //    Codlancamento = 78,
                //    Seqlancamento = _maxSeqAR,
                //    Numparcela = 1,
                //    Codcomplemento = 0,
                //    Statuslanc = 3,
                //    Datadebase = DateTime.Now,
                //    Datavencimento = _data_vencimento,
                //    Userid = 508
                //};
                //ex = tributario_Class.Insert_Debito_Parcela(regParcelaAR);

                //Debitotributo regTributoAR = new Debitotributo {
                //    Codreduzido = _codigo_atual,
                //    Anoexercicio = Convert.ToInt16(DateTime.Now.Year),
                //    Codlancamento = 78,
                //    Seqlancamento = _maxSeqAR,
                //    Numparcela = 1,
                //    Codcomplemento = 0,
                //    Codtributo = 667,
                //    Valortributo = _valor_AR
                //};
                //ex = tributario_Class.Insert_Debito_Tributo(regTributoAR);


                //*************************************


                //********* GRAVA HONORÁRIO ***********
                if (_valor_honorario > 0)
                {
                    short _maxSeq = tributario_Class.Retorna_Ultima_Seq_Honorario(_codigo_atual, DateTime.Now.Year);
                    _maxSeq++;

                    Debitoparcela regParcela = new Debitoparcela {
                        Codreduzido    = _codigo_atual,
                        Anoexercicio   = Convert.ToInt16(DateTime.Now.Year),
                        Codlancamento  = 41,
                        Seqlancamento  = _maxSeq,
                        Numparcela     = 1,
                        Codcomplemento = 0,
                        Statuslanc     = 3,
                        Datadebase     = DateTime.Now,
                        Datavencimento = _data_vencimento,
                        Userid         = 236
                    };
                    ex = tributario_Class.Insert_Debito_Parcela(regParcela);

                    Debitotributo regTributo = new Debitotributo {
                        Codreduzido    = _codigo_atual,
                        Anoexercicio   = Convert.ToInt16(DateTime.Now.Year),
                        Codlancamento  = 41,
                        Seqlancamento  = _maxSeq,
                        Numparcela     = 1,
                        Codcomplemento = 0,
                        Codtributo     = 90,
                        Valortributo   = _valor_honorario
                    };
                    ex = tributario_Class.Insert_Debito_Tributo(regTributo);

                    Parceladocumento RegParc = new Parceladocumento {
                        Codreduzido    = _codigo_atual,
                        Anoexercicio   = Convert.ToInt16(DateTime.Now.Year),
                        Codlancamento  = 41,
                        Seqlancamento  = _maxSeq,
                        Numparcela     = 1,
                        Codcomplemento = 0,
                        Numdocumento   = _numero_documento,
                        Plano          = 39
                    };
                    ex = tributario_Class.Insert_Parcela_Documento(RegParc);
                }
                //*************************************
                Carta_cobranca_detalhe RegDet = new Carta_cobranca_detalhe {
                    Codigo    = _codigo_atual,
                    Remessa   = _remessa,
                    Ano       = 1,
                    Parcela   = 1,
                    Principal = _valor_honorario,
                    Juros     = 0,
                    Multa     = 0,
                    Correcao  = 0,
                    Total     = _valor_honorario,
                    Ordem     = 2
                };
                if (_valor_honorario > 0)
                {
                    ex = tributario_Class.Insert_Carta_Cobranca_Detalhe(RegDet);
                }
                _numero_documento++;
                Proximo :;
                _pos++;
            }



            PBar.Value = 100;
            return;
        }
        private void PrintReport(int Codigo)
        {
            Imovel_bll   imovel_Class = new Imovel_bll("GTIconnection");
            ImovelStruct Reg          = imovel_Class.Dados_Imovel(Codigo);
            string       sComplemento = string.IsNullOrWhiteSpace(Reg.Complemento) ? "" : " " + Reg.Complemento.ToString().Trim();
            string       sQuadras     = string.IsNullOrWhiteSpace(Reg.QuadraOriginal) ? "" : " Quadra: " + Reg.QuadraOriginal.ToString().Trim();
            string       sLotes       = string.IsNullOrWhiteSpace(Reg.LoteOriginal) ? "" : " Lote: " + Reg.LoteOriginal.ToString().Trim();

            sComplemento += sQuadras + sLotes;
            string sEndereco  = Reg.NomeLogradouro + ", " + Reg.Numero.ToString() + sComplemento;
            string sBairro    = Reg.NomeBairro;
            string sInscricao = Reg.Distrito.ToString() + "." + Reg.Setor.ToString("00") + "." + Reg.Quadra.ToString("0000") + "." + Reg.Lote.ToString("00000") + "." +
                                Reg.Seq.ToString("00") + "." + Reg.Unidade.ToString("00") + "." + Reg.SubUnidade.ToString("000");
            List <ProprietarioStruct> Lista = imovel_Class.Lista_Proprietario(Codigo, true);
            string sNome = Lista[0].Nome;

            ReportDocument crystalReport = new ReportDocument();

            crystalReport.Load(Server.MapPath("~/Report/CertidaoEndereco.rpt"));

            Tributario_bll tributario_Class = new Tributario_bll("GTIconnection");
            int            _numero_certidao = tributario_Class.Retorna_Codigo_Certidao(modelCore.TipoCertidao.Endereco);
            int            _ano_certidao    = DateTime.Now.Year;

            Certidao_endereco cert = new Certidao_endereco();

            cert.Codigo      = Codigo;
            cert.Ano         = _ano_certidao;
            cert.Numero      = _numero_certidao;
            cert.Data        = DateTime.Now;
            cert.Inscricao   = sInscricao;
            cert.Nomecidadao = sNome;
            cert.Logradouro  = Reg.NomeLogradouro;
            cert.Li_num      = Convert.ToInt32(Reg.Numero);
            cert.Li_compl    = Reg.Complemento;
            cert.descbairro  = sBairro;
            cert.Li_quadras  = Reg.QuadraOriginal;
            cert.Li_lotes    = Reg.LoteOriginal;
            Exception ex = tributario_Class.Insert_Certidao_Endereco(cert);

            if (ex != null)
            {
                throw ex;
            }
            else
            {
                crystalReport.SetParameterValue("NUMCERTIDAO", _numero_certidao.ToString("00000") + "/" + _ano_certidao.ToString("0000"));
                crystalReport.SetParameterValue("DATAEMISSAO", DateTime.Now.ToString("dd/MM/yyyy") + " às " + DateTime.Now.ToString("HH:mm:ss"));
                crystalReport.SetParameterValue("CONTROLE", _numero_certidao.ToString("00000") + _ano_certidao.ToString("0000") + "/" + Codigo.ToString() + "-EA");
                crystalReport.SetParameterValue("ENDERECO", sEndereco);
                crystalReport.SetParameterValue("CADASTRO", Codigo.ToString("000000"));
                crystalReport.SetParameterValue("NOME", sNome);
                crystalReport.SetParameterValue("INSCRICAO", sInscricao);
                crystalReport.SetParameterValue("BAIRRO", sBairro);

                HttpContext.Current.Response.Buffer = false;
                HttpContext.Current.Response.ClearContent();
                HttpContext.Current.Response.ClearHeaders();

                try {
                    crystalReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "certidao" + _numero_certidao.ToString() + _ano_certidao.ToString());
                } catch {
                } finally {
                    crystalReport.Close();
                    crystalReport.Dispose();
                }
            }
        }
Пример #23
0
        private void SaveReg()
        {
            GTI_Models.Models.Condominio reg = new GTI_Models.Models.Condominio();
            reg.Cd_areaterreno   = Convert.ToDecimal(AreaTerreno.Text);
            reg.Cd_areatotconstr = Convert.ToDecimal(AreaPredial.Text);
            reg.Cd_cep           = CEP.Text;
            reg.Cd_codbairro     = Convert.ToInt16(Bairro.Tag.ToString());
            reg.Cd_codbenf       = (short)BenfeitoriaList.SelectedValue;
            reg.Cd_codcategprop  = (short)CategoriaList.SelectedValue;
            reg.Cd_codcidade     = 413;
            reg.Cd_codpedol      = (short)PedologiaList.SelectedValue;
            reg.Cd_codsituacao   = (short)SituacaoList.SelectedValue;
            reg.Cd_codtopog      = (short)TopografiaList.SelectedValue;
            reg.Cd_codusoterreno = (short)UsoList.SelectedValue;
            reg.Cd_compl         = Complemento.Text;
            reg.Cd_distrito      = Convert.ToInt16(Distrito.Text);
            reg.Cd_lote          = Convert.ToInt32(Lote.Text);
            reg.Cd_lotes         = Lote_Original.Text;
            reg.Cd_nomecond      = Nome.Text;
            reg.Cd_num           = Convert.ToInt16(Numero.Text);
            reg.Cd_numunid       = Convert.ToInt16(Unidades.Text);
            reg.Cd_prop          = Convert.ToInt32(ProprietarioCodigo.Text);
            reg.Cd_quadra        = Convert.ToInt16(Quadra.Text);
            reg.Cd_quadras       = Quadra_Original.Text;
            reg.Cd_seq           = Convert.ToInt16(Face.Text);
            reg.Cd_setor         = Convert.ToInt16(Setor.Text);
            reg.Cd_uf            = "SP";

            Imovel_bll imovel_Class = new Imovel_bll(_connection);
            Exception  ex;

            if (bAddNew)
            {
                reg.Cd_codigo = imovel_Class.Retorna_Codigo_Condominio_Disponivel();
                ex            = imovel_Class.Incluir_Condominio(reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                    goto Final;
                }
                else
                {
                    CodigoCondominio.Text = reg.Cd_codigo.ToString("000000");
                }
            }
            else
            {
                reg.Cd_codigo = Convert.ToInt32(CodigoCondominio.Text);
                ex            = imovel_Class.Alterar_Condominio(reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                    goto Final;
                }
            }
            int nCodReduzido = reg.Cd_codigo;

            //grava testada
            List <Testadacondominio> ListaTestada = new List <Testadacondominio>();

            foreach (ListViewItem item in TestadaListView.Items)
            {
                Testadacondominio regT = new Testadacondominio();
                regT.Codcond     = nCodReduzido;
                regT.Numface     = Convert.ToInt16(item.Text.ToString());
                regT.Areatestada = Convert.ToDecimal(item.SubItems[1].Text.ToString());
                ListaTestada.Add(regT);
            }
            if (ListaTestada.Count > 0)
            {
                ex = imovel_Class.Incluir_Testada_Condominio(ListaTestada);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                    goto Final;
                }
            }

            //grava area
            List <Condominioarea> ListaArea = new List <Condominioarea>();

            foreach (ListViewItem item in AreaListView.Items)
            {
                Condominioarea regA = new Condominioarea();
                regA.Codcondominio = nCodReduzido;
                regA.Seqarea       = Convert.ToInt16(item.Text.ToString());
                regA.Areaconstr    = Convert.ToDecimal(item.SubItems[1].Text.ToString());
                regA.Usoconstr     = Convert.ToInt16(item.SubItems[2].Tag.ToString());
                regA.Tipoconstr    = Convert.ToInt16(item.SubItems[3].Tag.ToString());
                regA.Catconstr     = Convert.ToInt16(item.SubItems[4].Tag.ToString());
                regA.Tipoarea      = "";
                regA.Qtdepav       = Convert.ToInt16(item.SubItems[5].Text);
                regA.Dataaprova    = Convert.ToDateTime(item.SubItems[6].Text);
                regA.Numprocesso   = item.SubItems[7].Text;
                ListaArea.Add(regA);
            }
            if (ListaArea.Count > 0)
            {
                ex = imovel_Class.Incluir_Area_Condominio(ListaArea);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                    goto Final;
                }
            }

            //grava unidades
            List <Condominiounidade> ListaUnidade = new List <Condominiounidade>();

            foreach (ListViewItem item in UnidadesListView.Items)
            {
                Condominiounidade regT = new Condominiounidade();
                regT.Cd_codigo      = nCodReduzido;
                regT.Cd_unidade     = Convert.ToInt16(item.Text.ToString());
                regT.Cd_subunidades = Convert.ToInt16(item.SubItems[1].Text.ToString());
                ListaUnidade.Add(regT);
            }
            if (ListaUnidade.Count > 0)
            {
                ex = imovel_Class.Incluir_Unidade_Condominio(ListaUnidade);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex);
                    eBox.ShowDialog();
                    goto Final;
                }
            }


            Final :;
            ControlBehaviour(true);
        }
Пример #24
0
        protected void btConsultar_Click(object sender, ImageClickEventArgs e)
        {
            bool     isNum          = false;
            int      Num            = 0;
            decimal  nSomaPrincipal = 0;
            decimal  nSomaJuros     = 0;
            decimal  nSomaMulta     = 0;
            decimal  nSomaCorrecao  = 0;
            decimal  nSomaTotal     = 0;
            string   num_cpf_cnpj   = "";
            DateTime DataDAM;

            bGerado = false;
            String sTextoImagem = txtimgcode.Text;

            txtimgcode.Text = "";

            lblmsg.Text      = "";
            lblMsg2.Text     = "";
            lblNome.Text     = "";
            lblDoc.Text      = "";
            lblEndereco.Text = "";
            lblValidate.Text = "";


            if (optCPF.Checked && gtiCore.RetornaNumero(txtCPF.Text).Length < 11)
            {
                lblmsg.Text = "CPF inválido!";
                ShowResult(false);
                return;
            }
            if (optCNPJ.Checked && gtiCore.RetornaNumero(txtCNPJ.Text).Length < 14)
            {
                lblmsg.Text = "CNPJ inválido!";
                ShowResult(false);
                return;
            }

            if (optCPF.Checked)
            {
                num_cpf_cnpj = gtiCore.RetornaNumero(txtCPF.Text);
                if (!gtiCore.ValidaCpf(num_cpf_cnpj))
                {
                    lblmsg.Text = "CPF inválido!";
                    ShowResult(false);
                    return;
                }
            }
            else
            {
                num_cpf_cnpj = gtiCore.RetornaNumero(txtCNPJ.Text);
                if (!gtiCore.ValidaCNPJ(num_cpf_cnpj))
                {
                    lblmsg.Text = "CNPJ inválido!";
                    ShowResult(false);
                    return;
                }
            }


            if (optList.Items[0].Selected == true)
            {
                isNum = int.TryParse(txtCod.Text, out Num);
                if (!isNum)
                {
                    lblmsg.Text = "Código do imóvel inválido!";
                    ShowResult(false);
                    return;
                }
                else
                {
                    Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");
                    bool       bFind        = imovel_Class.Existe_Imovel(Num);
                    if (bFind)
                    {
                        ImovelStruct reg = imovel_Class.Dados_Imovel(Num);
                        List <ProprietarioStruct> regProp = imovel_Class.Lista_Proprietario(Num, true);

                        lblEndereco.Text = reg.NomeLogradouro + ", " + reg.Numero + " " + reg.Complemento;
                        lblDoc.Text      = reg.NomeBairro;
                        lblNome.Text     = regProp[0].Nome;
                        if (optCPF.Checked)
                        {
                            if (Convert.ToInt64(gtiCore.RetornaNumero(regProp[0].CPF)).ToString("00000000000") != num_cpf_cnpj)
                            {
                                lblmsg.Text = "CPF não pertence ao proprietário deste imóvel!";
                                ShowResult(false);
                                return;
                            }
                        }
                        else
                        {
                            if (Convert.ToInt64(gtiCore.RetornaNumero(regProp[0].CPF)).ToString("00000000000000") != num_cpf_cnpj)
                            {
                                lblmsg.Text = "CNPJ não pertence ao proprietário deste imóvel!";
                                ShowResult(false);
                                return;
                            }
                        }
                    }
                    else
                    {
                        lblmsg.Text = "Código do imóvel não cadastrado!";
                        ShowResult(false);
                        return;
                    }
                }
            }
            else
            {
                if (optList.Items[1].Selected == true)
                {
                    isNum = int.TryParse(txtCod.Text, out Num);
                    if (!isNum)
                    {
                        lblmsg.Text = "Código da empresa inválido!";
                        ShowResult(false);
                        return;
                    }
                    else
                    {
                        Empresa_bll empresa_Class = new Empresa_bll("GTIconnection");
                        bool        bFind         = empresa_Class.Existe_Empresa(Num);
                        if (bFind)
                        {
                            EmpresaStruct reg = empresa_Class.Retorna_Empresa(Num);
                            lblEndereco.Text = reg.Endereco_nome + ", " + reg.Numero + " " + reg.Complemento;
                            lblDoc.Text      = reg.Bairro_nome;
                            lblNome.Text     = reg.Razao_social;

                            if (optCPF.Checked)
                            {
                                if (Convert.ToInt64(gtiCore.RetornaNumero(reg.Cpf_cnpj)).ToString("00000000000") != num_cpf_cnpj)
                                {
                                    lblmsg.Text = "CPF não pertence ao proprietário deste imóvel!";
                                    ShowResult(false);
                                    return;
                                }
                            }
                            else
                            {
                                if (Convert.ToInt64(gtiCore.RetornaNumero(reg.Cpf_cnpj)).ToString("00000000000000") != num_cpf_cnpj)
                                {
                                    lblmsg.Text = "CNPJ não pertence ao proprietário deste imóvel!";
                                    ShowResult(false);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            lblmsg.Text = "Inscrição Municipal não cadastrada!";
                            ShowResult(false);
                            return;
                        }
                    }
                }
                else
                {
                    if (optList.Items[2].Selected == true)
                    {
                        isNum = Int32.TryParse(txtCod.Text, out Num);
                        if (!isNum)
                        {
                            lblmsg.Text = "Código de contribuinte inválido!";
                            ShowResult(false);
                            return;
                        }
                        else
                        {
                            if (Num < 500000 || Num > 700000)
                            {
                                lblmsg.Text = "Código de contribuinte inválido!";
                                ShowResult(false);
                                return;
                            }
                            else
                            {
                                Cidadao_bll cidadao_Class = new Cidadao_bll("GTIconnection");
                                bool        bFind         = cidadao_Class.ExisteCidadao(Num);
                                if (bFind)
                                {
                                    CidadaoStruct reg = cidadao_Class.LoadReg(Num);
                                    if (reg.EtiquetaR != null && reg.EtiquetaR == "S")
                                    {
                                        lblEndereco.Text = reg.EnderecoR + ", " + reg.NumeroR + " " + reg.ComplementoR;
                                        lblDoc.Text      = reg.NomeBairroR;
                                    }
                                    else
                                    {
                                        lblEndereco.Text = reg.EnderecoC + ", " + reg.NumeroC + " " + reg.ComplementoC;
                                        lblDoc.Text      = reg.NomeBairroC;
                                    }
                                    lblNome.Text = reg.Nome;

                                    if (optCPF.Checked)
                                    {
                                        if (Convert.ToInt64(gtiCore.RetornaNumero(reg.Cpf)).ToString("00000000000") != num_cpf_cnpj)
                                        {
                                            lblmsg.Text = "CPF não pertence ao proprietário deste imóvel!";
                                            ShowResult(false);
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        if (Convert.ToInt64(gtiCore.RetornaNumero(reg.Cnpj)).ToString("00000000000000") != num_cpf_cnpj)
                                        {
                                            lblmsg.Text = "CNPJ não pertence ao proprietário deste imóvel!";
                                            ShowResult(false);
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    lblmsg.Text = "Contribuinte não cadastrado!";
                                    ShowResult(false);
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            if (!DateTime.TryParse(lblVenctoDam.Text, out DataDAM))
            {
                lblmsg.Text = "Data de vencimento inválida.";
                ShowResult(false);
                return;
            }
            else
            {
                String sDataVencto = lblVenctoDam.Text;
                String sDataNow    = DateTime.Now.ToString("dd/MM/yyyy");
                if (DateTime.ParseExact(sDataVencto, "dd/MM/yyyy", null) < DateTime.ParseExact(sDataNow, "dd/MM/yyyy", null))
                {
                    lblmsg.Text = "Vencimento menor que a data atual.";
                    ShowResult(false);
                    return;
                }
                else
                {
                    Int32 DifDias = ((TimeSpan)(DataDAM - DateTime.Now)).Days;
                    if (DifDias > 30)
                    {
                        lblmsg.Text = "Vencimento máximo de 30 dias.";
                        ShowResult(false);
                        return;
                    }
                }
            }

            if (txtimgcode.Text == Session["randomStr"].ToString())
            {
                lblmsg.Text = "Código da imagem inválido.";
                ShowResult(false);
                return;
            }
            else
            {
                ShowResult(true);
                lblmsg.Text  = "";
                lblMsg2.Text = "";
            }

            this.txtimgcode.Text = "";

            String         sDataDAM         = DataDAM.ToString("dd/MM/yyyy");
            Tributario_bll tributario_Class = new Tributario_bll("GTIconnection");

            bRefis = tributario_Class.IsRefis();
            List <SpExtrato>       ListaTributo = tributario_Class.Lista_Extrato_Tributo(Num, 1980, 2050, 0, 99, 0, 99, 0, 999, 0, 99, 0, 99, DateTime.ParseExact(sDataDAM, "dd/MM/yyyy", null), "Web");
            List <SpExtrato>       ListaParcela = tributario_Class.Lista_Extrato_Parcela(ListaTributo);
            List <DebitoStructure> debitos2     = new List <DebitoStructure>();

            Decimal nPerc = 0;

            int nIndex = 0;

            if (bRefis)
            {
                foreach (var item in ListaParcela)
                {
                    if (Convert.ToDateTime(item.Datavencimento) <= Convert.ToDateTime("30/06/2019"))
                    {
                        Int16 CodLanc = item.Codlancamento;
                        if (CodLanc != 48 || CodLanc != 69 || CodLanc != 78)
                        {
                            if (Convert.ToDateTime(sDataDAM) <= Convert.ToDateTime("18/10/2019"))
                            {
                                nPerc  = 1M;
                                nPlano = 33;
                            }
                            else if (Convert.ToDateTime(sDataDAM) > Convert.ToDateTime("18/10/2019") && Convert.ToDateTime(sDataDAM) <= Convert.ToDateTime("29/11/2019"))
                            {
                                nPerc  = 0.9M;
                                nPlano = 34;
                            }
                            else if (Convert.ToDateTime(sDataDAM) > Convert.ToDateTime("29/11/2019") && Convert.ToDateTime(sDataDAM) <= Convert.ToDateTime("20/12/2019"))
                            {
                                nPerc  = 0.8M;
                                nPlano = 35;
                            }
                            if (nPlano > 0)
                            {
                                item.Valorjuros = Convert.ToDecimal(item.Valorjuros) - (Convert.ToDecimal(item.Valorjuros) * nPerc);
                                item.Valormulta = Convert.ToDecimal(item.Valormulta) - (Convert.ToDecimal(item.Valormulta) * nPerc);
                                item.Valortotal = item.Valortributo + item.Valorjuros + item.Valormulta + item.Valorcorrecao;
                            }
                            ListaParcela[nIndex].Valorjuros = item.Valorjuros;
                            ListaParcela[nIndex].Valormulta = item.Valormulta;
                            ListaParcela[nIndex].Valortotal = item.Valortotal;
                        }
                    }
                    nIndex++;
                }
            }

            PlanoLabel.Text = nPlano.ToString();
            foreach (var item in ListaParcela)
            {
                if (item.Statuslanc == 3 || item.Statuslanc == 19 || item.Statuslanc == 38 || item.Statuslanc == 39 || item.Statuslanc == 42 || item.Statuslanc == 43)
                {
                    //if (item.Codlancamento != 16 && item.Codlancamento != 38) {
                    DebitoStructure reg = new DebitoStructure();
                    reg.Codigo_Reduzido      = item.Codreduzido;
                    reg.Ano_Exercicio        = item.Anoexercicio;
                    reg.Codigo_Lancamento    = Convert.ToInt16(item.Codlancamento);
                    reg.Descricao_Lancamento = item.Desclancamento;
                    reg.Sequencia_Lancamento = Convert.ToInt16(item.Seqlancamento);
                    reg.Numero_Parcela       = Convert.ToInt16(item.Numparcela);
                    reg.Complemento          = item.Codcomplemento;
                    reg.Data_Vencimento      = Convert.ToDateTime(item.Datavencimento);
                    reg.Codigo_Situacao      = Convert.ToInt16(item.Statuslanc);
                    reg.Soma_Principal       = item.Valortributo;
                    reg.Soma_Juros           = item.Valorjuros;
                    reg.Soma_Multa           = item.Valormulta;
                    reg.Soma_Correcao        = item.Valorcorrecao;
                    reg.Soma_Total           = item.Valortotal;
                    reg.Data_Ajuizamento     = item.Dataajuiza;
                    debitos2.Add(reg);
                    //  }
                }
            }

            if (debitos2.Count == 0)
            {
                lblDoc.Text = "";
                lblmsg.Text = "Não existem débitos.";
                ShowResult(false);
                return;
            }

            DataTable dt = new DataTable();

            dt.Columns.AddRange(new DataColumn[14] {
                new DataColumn("Exercicio"), new DataColumn("Lancamento"), new DataColumn("Sequencia"),
                new DataColumn("Parcela"), new DataColumn("Complemento"), new DataColumn("DtVencimento"), new DataColumn("VlPrincipal"),
                new DataColumn("VlJuros"), new DataColumn("VlMulta"), new DataColumn("VlCorrecao"), new DataColumn("VlTotal"), new DataColumn("DtAjuiza"),
                new DataColumn("Protesto"), new DataColumn("EnvProt")
            });

            foreach (var item in debitos2)
            {
                dt.Rows.Add(item.Ano_Exercicio.ToString(), item.Codigo_Lancamento.ToString("000") + "-" + item.Descricao_Lancamento.ToString(), item.Sequencia_Lancamento.ToString(),
                            item.Numero_Parcela.ToString(), item.Complemento.ToString(), Convert.ToDateTime(item.Data_Vencimento).ToString("dd/MM/yyyy"),
                            item.Soma_Principal.ToString("#0.00"), item.Soma_Juros.ToString("#0.00"), item.Soma_Multa.ToString("#0.00"),
                            item.Soma_Correcao.ToString("#0.00"), item.Soma_Total.ToString("#0.00"), item.Data_Ajuizamento == DateTime.MinValue || item.Data_Ajuizamento == null? "NÃO" : "SIM",
                            item.Codigo_Situacao == 38 ? "SIM" : "NÃO", item.Codigo_Situacao == 39 ? "SIM" : "NÃO");
                nSomaPrincipal += item.Soma_Principal;
                nSomaJuros     += item.Soma_Juros;
                nSomaMulta     += item.Soma_Multa;
                nSomaCorrecao  += item.Soma_Correcao;
                nSomaTotal     += item.Soma_Total;
            }

            grdMain.DataSource = dt;
            grdMain.DataBind();

            TableTotal.Rows[1].Cells[2].Text = nSomaPrincipal.ToString("#0.00");
            TableTotal.Rows[1].Cells[3].Text = nSomaMulta.ToString("#0.00");
            TableTotal.Rows[1].Cells[4].Text = nSomaJuros.ToString("#0.00");
            TableTotal.Rows[1].Cells[5].Text = nSomaCorrecao.ToString("#0.00");
            TableTotal.Rows[1].Cells[6].Text = nSomaTotal.ToString("#0.00");

            TableTotal.Rows[2].Cells[2].Text  = "0,00";
            TableTotal.Rows[2].Cells[3].Text  = "0,00";
            TableTotal.Rows[2].Cells[4].Text  = "0,00";
            TableTotal.Rows[2].Cells[5].Text  = "0,00";
            TableTotal.Rows[2].Cells[6].Text  = "0,00";
            TableResumo.Rows[0].Cells[1].Text = "0,00";
            TableResumo.Rows[1].Cells[1].Text = lblVenctoDam.Text;
        }
Пример #25
0
        private bool ValidateReg()
        {
            int distrito = 0, setor = 0, quadra = 0, lote = 0, face = 0;

            try {
                distrito = Int32.Parse(Distrito.Text);
            } catch {
                MessageBox.Show("Distrito inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            try {
                setor = Int32.Parse(Setor.Text);
            } catch {
                MessageBox.Show("Setor inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            try {
                quadra = Int32.Parse(Quadra.Text);
            } catch {
                MessageBox.Show("Quadra inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            try {
                lote = Int32.Parse(Lote.Text);
            } catch {
                MessageBox.Show("Lote inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            try {
                face = Int32.Parse(Face.Text);
            } catch {
                MessageBox.Show("Face inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (lote > 10000)
            {
                MessageBox.Show("Nº de lote inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (bAddNew)
            {
                Imovel_bll imovel_Class = new Imovel_bll(_connection);
                int        nCodigo      = imovel_Class.Existe_Imovel(distrito, setor, quadra, lote, 0, 0);
                if (nCodigo > 0)
                {
                    MessageBox.Show("Já existe um imóvel com esta inscrição cadastral (" + nCodigo.ToString("000000") + ")", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else
                {
                    bool ExisteFace = imovel_Class.Existe_Face_Quadra(distrito, setor, quadra, face);
                    if (!ExisteFace)
                    {
                        MessageBox.Show("Face de quadra não cadastrada.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                }
            }

            if (AreaListView.Items.Count == 0)
            {
                MessageBox.Show("Digite as áreas do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (TestadaListView.Items.Count == 0)
            {
                MessageBox.Show("Digite as testadas do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (Convert.ToInt32(ProprietarioCodigo.Text) == 0)
            {
                MessageBox.Show("Cadastre o proprietário do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (CEP.Text == "")
            {
                MessageBox.Show("Digite o CEP do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (AreaTerreno.Text == "")
            {
                AreaTerreno.Text = "0";
            }
            if (Convert.ToDecimal(AreaTerreno.Text) == 0)
            {
                MessageBox.Show("Digite a área do terreno.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (AreaPredial.Text == "")
            {
                AreaPredial.Text = "0";
            }
            if (Convert.ToDecimal(AreaPredial.Text) == 0)
            {
                MessageBox.Show("Digite a área da construção.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }


            bool bFind = false;

            foreach (ListViewItem item in TestadaListView.Items)
            {
                if (Convert.ToInt32(item.Text) == Convert.ToInt32(Face.Text))
                {
                    bFind = true;
                    break;
                }
            }
            if (!bFind)
            {
                MessageBox.Show("Digite a testada correspondente a face do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (Logradouro.Text == "")
            {
                MessageBox.Show("Digite o endereço do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (Bairro.Text == "")
            {
                MessageBox.Show("Digite o bairro do condomínio.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (BenfeitoriaList.SelectedIndex == -1 || CategoriaList.SelectedIndex == -1 || PedologiaList.SelectedIndex == -1 || SituacaoList.SelectedIndex == -1 || TopografiaList.SelectedIndex == -1 || UsoList.SelectedIndex == -1)
            {
                MessageBox.Show("Selecione todas as opções dos dados do terreno.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
Пример #26
0
        private void CarregaDados(int Codigo)
        {
            ClearReg();
            Imovel_bll       imovel_Class = new Imovel_bll(_connection);
            CondominioStruct reg          = imovel_Class.Dados_Condominio(Codigo);

            CodigoCondominio.Text   = Codigo.ToString("000000");
            Nome.Text               = reg.Nome;
            ProprietarioCodigo.Text = Convert.ToInt32(reg.Codigo_Proprietario).ToString("000000");
            Distrito.Text           = reg.Distrito.ToString();
            Setor.Text              = reg.Setor.ToString("00");
            Quadra.Text             = reg.Quadra.ToString("0000");
            Lote.Text               = reg.Lote.ToString("00000");
            Face.Text               = reg.Seq.ToString("00");
            Logradouro.Text         = reg.Nome_Logradouro;
            Logradouro.Tag          = reg.Codigo_Logradouro.ToString();
            Numero.Text             = reg.Numero.ToString();
            Complemento.Text        = reg.Complemento;
            CEP.Text                      = reg.Cep;
            Bairro.Text                   = reg.Nome_Bairro;
            Bairro.Tag                    = reg.Codigo_Bairro.ToString();
            Lote_Original.Text            = reg.Lote_Original;
            Quadra_Original.Text          = reg.Quadra_Original;
            Benfeitoria.Text              = reg.Benfeitoria_Nome;
            BenfeitoriaList.SelectedValue = reg.Benfeitoria;
            Topografia.Text               = reg.Topografia_Nome;
            TopografiaList.SelectedValue  = reg.Topografia;
            Pedologia.Text                = reg.Pedologia_Nome;
            PedologiaList.SelectedValue   = reg.Pedologia;
            Situacao.Text                 = reg.Situacao_Nome;
            SituacaoList.SelectedValue    = reg.Situacao;
            Categoria.Text                = reg.Categoria_Nome;
            CategoriaList.SelectedValue   = reg.Categoria;
            Uso.Text                      = reg.Uso_terreno_Nome;
            UsoList.SelectedValue         = reg.Uso_terreno;
            AreaPredial.Text              = Convert.ToDecimal(reg.Area_Construida).ToString("#0.00");
            AreaTerreno.Text              = Convert.ToDecimal(reg.Area_Terreno).ToString("#0.00");
            Unidades.Text                 = reg.Qtde_Unidade.ToString();

            List <Testadacondominio> ListaTestada = imovel_Class.Lista_Testada_Condominio(Codigo);

            foreach (Testadacondominio Testada in ListaTestada)
            {
                ListViewItem lvItem = new ListViewItem(Testada.Numface.ToString("00"));
                lvItem.SubItems.Add(Testada.Areatestada.ToString("#0.00"));
                TestadaListView.Items.Add(lvItem);
            }

            List <Condominiounidade> ListaUnidade = imovel_Class.Lista_Unidade_Condominio(Codigo);

            foreach (Condominiounidade Unidade in ListaUnidade)
            {
                ListViewItem lvItem = new ListViewItem(Unidade.Cd_unidade.ToString("00"));
                lvItem.SubItems.Add(Unidade.Cd_subunidades.ToString("000"));
                UnidadesListView.Items.Add(lvItem);
            }

            short             n         = 1;
            List <AreaStruct> ListaArea = imovel_Class.Lista_Area_Condominio(Codigo);

            foreach (AreaStruct regA in ListaArea)
            {
                ListViewItem lvItem = new ListViewItem(n.ToString("00"));
                lvItem.SubItems.Add(string.Format("{0:0.00}", (decimal)regA.Area));
                lvItem.SubItems.Add(regA.Uso_Nome);
                lvItem.SubItems.Add(regA.Tipo_Nome);
                lvItem.SubItems.Add(regA.Categoria_Nome);
                lvItem.SubItems.Add(regA.Pavimentos.ToString());
                if (regA.Data_Aprovacao != null)
                {
                    lvItem.SubItems.Add(Convert.ToDateTime(regA.Data_Aprovacao).ToString("dd/MM/yyyy"));
                }
                else
                {
                    lvItem.SubItems.Add("");
                }
                if (string.IsNullOrWhiteSpace(regA.Numero_Processo))
                {
                    lvItem.SubItems.Add("");
                }
                else
                {
                    if (regA.Numero_Processo.Contains("-"))//se já tiver DV não precisa inserir novamente
                    {
                        lvItem.SubItems.Add(regA.Numero_Processo);
                    }
                    else
                    {
                        Processo_bll processo_Class = new Processo_bll(_connection);
                        lvItem.SubItems.Add(processo_Class.Retorna_Processo_com_DV(regA.Numero_Processo));//corrige o DV
                    }
                }
                lvItem.Tag             = regA.Seq.ToString();
                lvItem.SubItems[2].Tag = regA.Uso_Codigo.ToString();
                lvItem.SubItems[3].Tag = regA.Tipo_Codigo.ToString();
                lvItem.SubItems[4].Tag = regA.Categoria_Codigo.ToString();
                AreaListView.Items.Add(lvItem);
                n++;
            }
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int nCodigo = 0;

            if (!IsPostBack)
            {
                if (Session["sid"] != null && Session["sid"].ToString() != "")
                {
                    Tributario_bll tributario_Class = new Tributario_bll("GTIconnection");
                    List <Boleto>  ListaBoleto      = tributario_Class.Lista_Boleto_DAM(Convert.ToInt32(Session["sid"]));
                    txtDtVenc.Text = Convert.ToDateTime(ListaBoleto[0].Datadam).ToString("dd/MM/yyyy");
                    txtValor.Text  = Convert.ToDouble(ListaBoleto[0].Valordam).ToString("#0.00");

                    txtcpfCnpj.Text = ListaBoleto[0].Cpf;
                    txtrefTran.Text = "287353200" + ListaBoleto[0].Numdoc2.Substring(0, 8);

                    nCodigo = Convert.ToInt32(ListaBoleto[0].Codreduzido);
                    if (nCodigo < 100000)
                    {
                        //Imóvel
                        Imovel_bll imovel_Class = new Imovel_bll("GTIconnection");

                        int nTipoEndereco = (int)imovel_Class.Dados_Imovel(nCodigo).EE_TipoEndereco;
                        nTipoEndereco = 0;
                        EnderecoStruct reg = imovel_Class.Dados_Endereco(nCodigo, nTipoEndereco == 0?TipoEndereco.Local:nTipoEndereco == 1?TipoEndereco.Entrega:TipoEndereco.Proprietario);
                        txtNome.Text     = imovel_Class.Lista_Proprietario(nCodigo, true)[0].Nome;
                        txtEndereco.Text = reg.Endereco + ", " + reg.Numero.ToString() + " " + reg.Complemento + " " + reg.NomeBairro;
                        txtCidade.Text   = reg.NomeCidade;
                        txtCep.Text      = reg.Cep;
                        txtUF.Text       = reg.UF;
                    }
                    else
                    {
                        if (nCodigo >= 100000 && nCodigo < 500000)
                        {
                            //Empresa
                            Empresa_bll   empresa_Class = new Empresa_bll("GTIconnection");
                            EmpresaStruct reg           = empresa_Class.Retorna_Empresa(nCodigo);
                            txtNome.Text     = reg.Razao_social;
                            txtEndereco.Text = reg.Endereco_nome + ", " + reg.Numero.ToString() + " " + reg.Complemento + " " + reg.Bairro_nome;
                            txtCidade.Text   = reg.Cidade_nome;
                            txtcpfCnpj.Text  = reg.Cpf_cnpj;
                            txtCep.Text      = reg.Cep;
                            txtUF.Text       = reg.UF;
                        }
                        else
                        {
                            //Cidadão
                            Cidadao_bll   cidadao_Class = new Cidadao_bll("GTIconnection");
                            CidadaoStruct reg           = cidadao_Class.LoadReg(nCodigo);
                            txtcpfCnpj.Text  = string.IsNullOrWhiteSpace(reg.Cpf)?reg.Cnpj:reg.Cpf;
                            txtNome.Text     = reg.Nome;
                            txtEndereco.Text = reg.EnderecoR + ", " + reg.NumeroR.ToString() + " " + reg.ComplementoR + " " + reg.NomeBairroR;
                            txtCidade.Text   = reg.NomeCidadeR;
                            txtCep.Text      = reg.CepR.ToString();
                            txtUF.Text       = reg.UfR;
                        }
                    }
                    //UpdateDatabase();
                }
                else
                {
                    Response.Redirect("~/Pages/gtiMenu.aspx");
                }
            }
            else
            {
                Response.Redirect("~/Pages/gtiMenu.aspx");
            }
        }
Пример #28
0
        private void FindButton_Click(object sender, EventArgs e)
        {
            MainListView.BeginUpdate();
            MainListView.VirtualListSize = 0;
            MainListView.EndUpdate();

            gtiCore.Ocupado(this);
            Imovel_bll   imovel_Class = new Imovel_bll(_connection);
            ImovelStruct Reg          = new ImovelStruct {
                Codigo = string.IsNullOrEmpty(Codigo.Text) ? 0 : Convert.ToInt32(Codigo.Text),
                Proprietario_Principal = PrincipalCheckBox.Checked
            };

            if (Proprietario.Tag == null || Proprietario.Tag.ToString() == "")
            {
                Proprietario.Tag = "0";
            }
            Reg.Proprietario_Codigo = Convert.ToInt32(Proprietario.Tag.ToString());
            Reg.Distrito            = Inscricao.Text.Substring(0, 1).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(0, 1).Trim());
            Reg.Setor            = Inscricao.Text.Substring(2, 2).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(2, 2).Trim());
            Reg.Quadra           = Inscricao.Text.Substring(5, 4).Trim() == "" ? (short)0 : Convert.ToInt16(Inscricao.Text.Substring(5, 4).Trim());
            Reg.Lote             = Inscricao.Text.Substring(10, 5).Trim() == "" ? 0 : Convert.ToInt32(Inscricao.Text.Substring(10, 5).Trim());
            Condominio.Tag       = Condominio.Tag ?? "";
            Reg.CodigoCondominio = string.IsNullOrWhiteSpace(Condominio.Tag.ToString()) ? 0 : Convert.ToInt32(Condominio.Tag.ToString());
            Logradouro.Tag       = Logradouro.Tag ?? "";
            Reg.CodigoLogradouro = string.IsNullOrWhiteSpace(Logradouro.Tag.ToString()) ? 0 : Convert.ToInt32(Logradouro.Tag.ToString());
            Bairro.Tag           = Bairro.Tag ?? "";
            Reg.CodigoBairro     = string.IsNullOrWhiteSpace(Bairro.Tag.ToString()) ? (short)0 : Convert.ToInt16(Bairro.Tag.ToString());
            Reg.Numero           = Numero.Text.Trim() == "" ? (short)0 : Convert.ToInt16(Numero.Text);

            if (Reg.Codigo == 0 && Reg.Proprietario_Codigo == 0 && Reg.Distrito == 0 && Reg.Setor == 0 & Reg.Quadra == 0 & Reg.Lote == 0 && Reg.CodigoCondominio == 0 &&
                Reg.CodigoLogradouro == 0 && Reg.Numero == 0 && Reg.CodigoBairro == 0)
            {
                gtiCore.Liberado(this);
//                MessageBox.Show("Selecione ao menos um critério para filtrar.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MainListView.ListViewItemSorter = null;
            ImovelStruct _orderby = new ImovelStruct();

            if (OrdemList.SelectedIndex == 0)
            {
                _orderby.Codigo = 1;
            }
            else if (OrdemList.SelectedIndex == 1)
            {
                _orderby.Inscricao = "X";
            }
            else if (OrdemList.SelectedIndex == 2)
            {
                _orderby.Proprietario_Nome = "X";
            }
            else if (OrdemList.SelectedIndex == 3)
            {
                _orderby.NomeLogradouro = "X";
            }
            else if (OrdemList.SelectedIndex == 4)
            {
                _orderby.NomeBairro = "X";
            }
            else if (OrdemList.SelectedIndex == 5)
            {
                _orderby.NomeCondominio = "X";
            }
            List <ImovelStruct> Lista = imovel_Class.Lista_Imovel(Reg, _orderby);

            int _pos = 0, _total = Lista.Count;

            if (aDatResult == null)
            {
                aDatResult = new List <ArrayList>();
            }
            aDatResult.Clear();
            foreach (var item in Lista)
            {
                ArrayList itemlv = new ArrayList(8)
                {
                    item.Codigo.ToString("000000"),
                    item.Inscricao.ToString(),
                    item.Proprietario_Nome.ToString(),
                    item.NomeLogradouro.ToString(),
                    item.Numero.ToString(),
                    item.Complemento == null ? "" : item.Complemento.ToString(),
                    item.NomeBairro.ToString(),
                    item.CodigoCondominio == 999 ? "" : item.NomeCondominio.ToString()
                };
                aDatResult.Add(itemlv);
                _pos++;
            }
            MainListView.BeginUpdate();
            MainListView.VirtualListSize = aDatResult.Count;
            MainListView.EndUpdate();

            TotalImovel.Text = _total.ToString();
            gtiCore.Liberado(this);
            if (MainListView.Items.Count == 0)
            {
                MessageBox.Show("Nenhum imóvel coincide com os critérios especificados", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #29
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            int    distrito = 0, setor = 0, quadra = 0, lote = 0, face = 0, unidade = 0, subunidade = 0;
            string s = Inscricao.Text;

            try {
                distrito = Int32.Parse(s.Substring(0, 1));
            } catch {
                MessageBox.Show("Distrito inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                setor = Int32.Parse(s.Substring(2, 2));
            } catch {
                MessageBox.Show("Setor inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                quadra = Int32.Parse(s.Substring(5, 4));
            } catch {
                MessageBox.Show("Quadra inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                lote = Int32.Parse(s.Substring(10, 5));
            } catch {
                MessageBox.Show("Lote inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                face = Int32.Parse(s.Substring(16, 2));
            } catch {
                MessageBox.Show("Face inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                unidade = Int32.Parse(s.Substring(19, 2));
            } catch {
                MessageBox.Show("Unidade inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try {
                subunidade = Int32.Parse(s.Substring(22, 3));
            } catch {
                MessageBox.Show("SubUnidade inválida", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (lote > 10000)
            {
                MessageBox.Show("Nº de lote inválido", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TipoList.SelectedIndex == 0 && (unidade > 0 || subunidade > 0))
            {
                MessageBox.Show("Imóvel normal não pode ter número de unidade ou subunidade", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Imovel_bll imovel_Class = new Imovel_bll(_connection);
            int        nCodigo      = imovel_Class.Existe_Imovel(distrito, setor, quadra, lote, unidade, subunidade);

            if (nCodigo > 0)
            {
                MessageBox.Show("Já existe um imóvel com esta inscrição cadastral (" + nCodigo.ToString("000000") + ")", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                bool ExisteFace = imovel_Class.Existe_Face_Quadra(distrito, setor, quadra, face);
                if (!ExisteFace)
                {
                    MessageBox.Show("Face de quadra não cadastrada.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    CustomListBoxItem _condominio = (CustomListBoxItem)TipoList.SelectedItem;
                    DialogResult    = DialogResult.OK;
                    ReturnInscricao = Inscricao.Text;
                    if (TipoList.SelectedIndex == 0)
                    {
                        ReturnCondominio       = "[NÃO CADASTRADO]";
                        ReturnCondominioCodigo = 0;
                    }
                    else
                    {
                        ReturnCondominio       = _condominio._name;
                        ReturnCondominioCodigo = _condominio._value;
                    }

                    Close();
                }
            }
        }
Пример #30
0
        private void ImprimirButton_Click(object sender, EventArgs e)
        {
            if (Nome.Text == "")
            {
                MessageBox.Show("Carregue os dados de um contribuinte para poder imprimir a certidão.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Tributario_bll tributario_Class = new Tributario_bll(_connection);
            int            _userId = gtiCore.UserId;
            int            _ano_certidao = DateTime.Now.Year, _numero_certidao = 0, _codigo = Convert.ToInt32(Codigo.Text), _ano_isencao = DateTime.Now.Year;
            decimal        _percisencao = 0, SomaArea = 0;
            DateTime?      _data_processo_isencao = null;
            Report_Data    _dados = null;
            string         _nomeReport = "", _controle = "", _numero_processo = "";

            if (_tipo_certidao == TipoCertidao.Endereco)
            {
                _nomeReport      = "CertidaoEndereco";
                _numero_certidao = tributario_Class.Retorna_Codigo_Certidao(modelCore.TipoCertidao.Endereco);
                _controle        = _numero_certidao.ToString("00000") + _ano_certidao.ToString("0000") + "/" + _codigo.ToString() + "-EA";
                Certidao_endereco cert = new Certidao_endereco {
                    Codigo      = Convert.ToInt32(_codigo),
                    Ano         = _ano_certidao,
                    Numero      = _numero_certidao,
                    Data        = DateTime.Now,
                    Inscricao   = Inscricao.Text,
                    Nomecidadao = Nome.Text,
                    Logradouro  = Endereco.Text,
                    descbairro  = Bairro.Text,
                    Li_quadras  = Quadra.Text,
                    Li_lotes    = Lote.Text
                };
                Exception ex = tributario_Class.Insert_Certidao_Endereco(cert);
                if (ex != null)
                {
                    throw ex;
                }
            }
            else
            {
                if (_tipo_certidao == TipoCertidao.Isencao)
                {
                    Imovel_bll imovel_Class = new Imovel_bll(_connection);
                    bool       bImune       = imovel_Class.Verifica_Imunidade(_codigo);
                    _numero_certidao = tributario_Class.Retorna_Codigo_Certidao(modelCore.TipoCertidao.Isencao);
                    _controle        = _numero_certidao.ToString("00000") + _ano_certidao.ToString("0000") + "/" + _codigo.ToString() + "-CI";

                    if (bImune)
                    {
                        _percisencao = 100;
                        _nomeReport  = "CertidaoImunidade";
                    }
                    else
                    {
                        bool bIsentoProcesso = false;
                        List <IsencaoStruct> ListaIsencao = null;
                        ListaIsencao = imovel_Class.Lista_Imovel_Isencao(_codigo, DateTime.Now.Year);
                        if (ListaIsencao.Count > 0)
                        {
                            bIsentoProcesso = true;
                        }
                        if (bIsentoProcesso)
                        {
                            _nomeReport            = "CertidaoIsencaoProcesso";
                            _percisencao           = (decimal)ListaIsencao[0].Percisencao;
                            _numero_processo       = ListaIsencao[0].Numprocesso;
                            _data_processo_isencao = Convert.ToDateTime(ListaIsencao[0].dataprocesso);
                        }
                        else
                        {
                            SomaArea = imovel_Class.Soma_Area(_codigo);
                            if (SomaArea < 65)
                            {
                                //Se tiver área < 65m² mas tiver mais de 1 imóvel, perde a isenção.
                                int nQtdeImovel = imovel_Class.Qtde_Imovel_Cidadao(_codigo);
                                if (nQtdeImovel > 1)
                                {
                                    MessageBox.Show("Este imóvel não esta isento da cobrança de IPTU no ano atual.", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }
                                _nomeReport = "CertidaoIsencao65";
                            }
                        }
                    }

                    Certidao_isencao cert = new Certidao_isencao {
                        Codigo       = _codigo,
                        Ano          = _ano_certidao,
                        Numero       = _numero_certidao,
                        Data         = DateTime.Now,
                        Inscricao    = Inscricao.Text,
                        Nomecidadao  = Nome.Text,
                        Logradouro   = Endereco.Text,
                        Descbairro   = Bairro.Text,
                        Li_quadras   = Quadra.Text,
                        Li_lotes     = Lote.Text,
                        Area         = SomaArea,
                        Percisencao  = _percisencao,
                        Numprocesso  = _numero_processo,
                        Dataprocesso = _data_processo_isencao
                    };
                    Exception ex = tributario_Class.Insert_Certidao_Isencao(cert);
                    if (ex != null)
                    {
                        throw ex;
                    }
                }
                else
                {
                    if (_tipo_certidao == TipoCertidao.ValorVenal)
                    {
                        _nomeReport      = "CertidaoValorVenal";
                        _numero_certidao = tributario_Class.Retorna_Codigo_Certidao(modelCore.TipoCertidao.ValorVenal);
                        _controle        = _numero_certidao.ToString("00000") + _ano_certidao.ToString("0000") + "/" + _codigo.ToString() + "-VV";
                        Certidao_valor_venal cert = new Certidao_valor_venal {
                            Codigo      = Convert.ToInt32(_codigo),
                            Ano         = _ano_certidao,
                            Numero      = _numero_certidao,
                            Data        = DateTime.Now,
                            Inscricao   = Inscricao.Text,
                            Nomecidadao = Nome.Text,
                            Logradouro  = Endereco.Text,
                            Descbairro  = Bairro.Text,
                            Li_quadras  = Quadra.Text,
                            Li_lotes    = Lote.Text
                        };
                        Exception ex = tributario_Class.Insert_Certidao_ValorVenal(cert);
                        if (ex != null)
                        {
                            throw ex;
                        }
                    }
                    else
                    {
                        if (_tipo_certidao == TipoCertidao.Debito)
                        {
                            //***Verifica débito
                            Certidao_debito_detalhe dadosCertidao = tributario_Class.Certidao_Debito(_codigo);
                            if (dadosCertidao.Tipo_Retorno == RetornoCertidaoDebito.Negativa)
                            {
                                sTipoCertidao = "NEGATIVA";
                                sNao          = "não ";
                                nRet          = 3;
                                sSufixo       = "CN";
                                if (_tipo_cadastro == TipoCadastro.Imovel)
                                {
                                    _nomeReport = "CertidaoDebitoImovel";
                                }
                                else
                                {
                                    if (_tipo_cadastro == TipoCadastro.Empresa)
                                    {
                                        _nomeReport = "CertidaoDebitoEmpresa";
                                    }
                                }
                            }
                            else
                            {
                                if (dadosCertidao.Tipo_Retorno == RetornoCertidaoDebito.Positiva)
                                {
                                    sTipoCertidao = "POSITIVA";
                                    nRet          = 4;
                                    sSufixo       = "CP";
                                    if (_tipo_cadastro == TipoCadastro.Imovel)
                                    {
                                        _nomeReport = "CertidaoDebitoImovel";
                                    }
                                    else
                                    {
                                        if (_tipo_cadastro == TipoCadastro.Empresa)
                                        {
                                            _nomeReport = "CertidaoDebitoEmpresa";
                                        }
                                    }
                                }
                                else
                                {
                                    if (dadosCertidao.Tipo_Retorno == RetornoCertidaoDebito.NegativaPositiva)
                                    {
                                        sTipoCertidao = "POSITIVA COM EFEITO NEGATIVA";
                                        nRet          = 5;
                                        sSufixo       = "PN";
                                        if (_tipo_cadastro == TipoCadastro.Imovel)
                                        {
                                            _nomeReport = "CertidaoDebitoImovelPN";
                                        }
                                        else
                                        {
                                            if (_tipo_cadastro == TipoCadastro.Empresa)
                                            {
                                                _nomeReport = "CertidaoDebitoEmpresaPN";
                                            }
                                        }
                                    }
                                }
                            }
                            sTributo = dadosCertidao.Descricao_Lancamentos;

                            _numero_certidao = tributario_Class.Retorna_Codigo_Certidao(modelCore.TipoCertidao.Debito);
                            _controle        = _numero_certidao.ToString("00000") + _ano_certidao.ToString("0000") + "/" + _codigo.ToString() + "-" + sSufixo;
                            Certidao_debito cert = new Certidao_debito {
                                Codigo       = Convert.ToInt32(_codigo),
                                Ano          = (short)_ano_certidao,
                                Ret          = nRet,
                                Numero       = _numero_certidao,
                                Datagravada  = DateTime.Now,
                                Inscricao    = Inscricao.Text,
                                Nome         = Nome.Text,
                                Logradouro   = Endereco.Text,
                                Bairro       = Bairro.Text,
                                Cidade       = Cidade.Text,
                                Processo     = Processo.Text,
                                Dataprocesso = _data_processo,
                                Atendente    = gtiCore.LastUser,
                                Cpf          = sCPF,
                                Cnpj         = sCNPJ,
                                Atividade    = Atividade.Text,
                                Lancamento   = dadosCertidao.Descricao_Lancamentos
                            };
                            Exception ex = tributario_Class.Insert_Certidao_Debito(cert);
                            if (ex != null)
                            {
                                throw ex;
                            }
                        }
                    }
                }

                if (_numero_certidao > 0)
                {
                    _dados = new Report_Data()
                    {
                        Codigo                = Convert.ToInt32(Codigo.Text),
                        Inscricao             = Inscricao.Text,
                        Nome                  = Nome.Text,
                        Cpf_cnpj              = Doc.Text,
                        Endereco              = Endereco.Text,
                        Nome_bairro           = Bairro.Text,
                        Quadra_original       = Quadra.Text,
                        Lote_original         = Lote.Text,
                        Nome_cidade           = Cidade.Text,
                        Cep                   = Cep.Text,
                        Numero_Certidao       = _numero_certidao.ToString("000000") + "/" + _ano_certidao.ToString(),
                        Controle              = _controle,
                        Assinatura_Hide       = Assinatura.Checked,
                        Processo              = Processo.Text,
                        Data_Processo         = _data_processo,
                        UserId                = _userId,
                        Perc_Isencao          = _percisencao,
                        Data_Processo_Isencao = _data_processo_isencao,
                        Processo_Isencao      = _numero_processo,
                        AnoIsencao            = _ano_isencao,
                        Area                  = SomaArea,
                        Nao                   = sNao,
                        TipoCertidao          = sTipoCertidao,
                        Tributos              = sTributo,
                        Atividade             = sAtividade
                    };
                    //ReportCR fRpt = new ReportCR(_nomeReport, _dados,null);
                    //fRpt.ShowDialog();
                    ClearFields();
                }
            }
        }