public frmVisualizaNfs(tcLoteRps objLoteRps) { InitializeComponent(); listErros.ListBox.MouseDoubleClick += new MouseEventHandler(listErros_MouseDoubleClick); this.objLoteRps = objLoteRps; CriaObjAlter(); bsNotas.DataSource = this.objLoteRpsAlter.Rps; ValidaNotas(); PopulaForm(); VerificaCampos(); }
private void CriaObjAlter() { try { tcLoteRps obj = new tcLoteRps(); obj.Rps = new List <TcRps>(); obj.NumeroLote = this.objLoteRps.NumeroLote; obj.Cnpj = this.objLoteRps.Cnpj; obj.InscricaoMunicipal = this.objLoteRps.InscricaoMunicipal; obj.QuantidadeRps = this.objLoteRps.QuantidadeRps; for (int i = 0; i < this.objLoteRps.Rps.Count; i++) { TcRps objTcTcRps = new TcRps(); #region Identificacao objTcTcRps.InfRps = new TcInfRps(); objTcTcRps.InfRps.DataEmissao = this.objLoteRps.Rps[i].InfRps.DataEmissao; objTcTcRps.InfRps.NaturezaOperacao = this.objLoteRps.Rps[i].InfRps.NaturezaOperacao; objTcTcRps.InfRps.RegimeEspecialTributacao = this.objLoteRps.Rps[i].InfRps.RegimeEspecialTributacao; objTcTcRps.InfRps.OptanteSimplesNacional = this.objLoteRps.Rps[i].InfRps.OptanteSimplesNacional; objTcTcRps.InfRps.IncentivadorCultural = this.objLoteRps.Rps[i].InfRps.IncentivadorCultural; objTcTcRps.InfRps.Status = this.objLoteRps.Rps[i].InfRps.Status; objTcTcRps.InfRps.IdentificacaoRps = new tcIdentificacaoRps(); objTcTcRps.InfRps.IdentificacaoRps.Numero = this.objLoteRps.Rps[i].InfRps.IdentificacaoRps.Numero; objTcTcRps.InfRps.IdentificacaoRps.Serie = this.objLoteRps.Rps[i].InfRps.IdentificacaoRps.Serie; objTcTcRps.InfRps.IdentificacaoRps.Tipo = this.objLoteRps.Rps[i].InfRps.IdentificacaoRps.Tipo; objTcTcRps.InfRps.IdentificacaoRps.Nfseq = this.objLoteRps.Rps[i].InfRps.IdentificacaoRps.Nfseq; if (this.objLoteRps.Rps[i].InfRps.RpsSubstituido != null) { objTcTcRps.InfRps.RpsSubstituido = new tcIdentificacaoRps(); objTcTcRps.InfRps.RpsSubstituido.Numero = this.objLoteRps.Rps[i].InfRps.RpsSubstituido.Numero; objTcTcRps.InfRps.RpsSubstituido.Serie = this.objLoteRps.Rps[i].InfRps.RpsSubstituido.Serie; objTcTcRps.InfRps.RpsSubstituido.Tipo = this.objLoteRps.Rps[i].InfRps.RpsSubstituido.Tipo; } #endregion #region Serviço objTcTcRps.InfRps.Servico = new TcDadosServico(); objTcTcRps.InfRps.Servico.Valores = new TcValores(); objTcTcRps.InfRps.Servico.Valores.ValorServicos = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorServicos; objTcTcRps.InfRps.Servico.Valores.ValorDeducoes = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorDeducoes; objTcTcRps.InfRps.Servico.Valores.ValorCsll = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorCsll; objTcTcRps.InfRps.Servico.Valores.ValorPis = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorPis; objTcTcRps.InfRps.Servico.Valores.ValorCofins = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorCofins; objTcTcRps.InfRps.Servico.Valores.IssRetido = this.objLoteRps.Rps[i].InfRps.Servico.Valores.IssRetido; objTcTcRps.InfRps.Servico.Valores.ValorInss = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorInss; objTcTcRps.InfRps.Servico.Valores.ValorIr = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorIr; objTcTcRps.InfRps.Servico.Valores.ValorIss = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorIss; objTcTcRps.InfRps.Servico.Valores.OutrasRetencoes = this.objLoteRps.Rps[i].InfRps.Servico.Valores.OutrasRetencoes; objTcTcRps.InfRps.Servico.Valores.BaseCalculo = this.objLoteRps.Rps[i].InfRps.Servico.Valores.BaseCalculo; objTcTcRps.InfRps.Servico.Valores.Aliquota = this.objLoteRps.Rps[i].InfRps.Servico.Valores.Aliquota; objTcTcRps.InfRps.Servico.Valores.ValorLiquidoNfse = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorLiquidoNfse; objTcTcRps.InfRps.Servico.Valores.ValorIssRetido = this.objLoteRps.Rps[i].InfRps.Servico.Valores.ValorIssRetido; objTcTcRps.InfRps.Servico.Valores.DescontoCondicionado = this.objLoteRps.Rps[i].InfRps.Servico.Valores.DescontoCondicionado; objTcTcRps.InfRps.Servico.Valores.DescontoIncondicionado = this.objLoteRps.Rps[i].InfRps.Servico.Valores.DescontoIncondicionado; objTcTcRps.InfRps.Servico.ItemListaServico = this.objLoteRps.Rps[i].InfRps.Servico.ItemListaServico; objTcTcRps.InfRps.Servico.CodigoTributacaoMunicipio = this.objLoteRps.Rps[i].InfRps.Servico.CodigoTributacaoMunicipio; objTcTcRps.InfRps.Servico.CodigoCnae = this.objLoteRps.Rps[i].InfRps.Servico.CodigoCnae; objTcTcRps.InfRps.Servico.CodigoMunicipio = this.objLoteRps.Rps[i].InfRps.Servico.CodigoMunicipio; objTcTcRps.InfRps.Servico.Discriminacao = this.objLoteRps.Rps[i].InfRps.Servico.Discriminacao; #endregion #region Dados Adicionais objTcTcRps.InfRps.Prestador = new tcIdentificacaoPrestador(); objTcTcRps.InfRps.Prestador.Cnpj = this.objLoteRps.Rps[i].InfRps.Prestador.Cnpj; objTcTcRps.InfRps.Prestador.InscricaoMunicipal = this.objLoteRps.Rps[i].InfRps.Prestador.InscricaoMunicipal; objTcTcRps.InfRps.Tomador = new tcDadosTomador(); objTcTcRps.InfRps.Tomador.IdentificacaoTomador = new tcIdentificacaoTomador(); if (this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.CpfCnpj != null) { if (this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cnpj != "") { objTcTcRps.InfRps.Tomador.IdentificacaoTomador.CpfCnpj = new TcCpfCnpj(); objTcTcRps.InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cnpj = this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cnpj; } else if (this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cpf != "") { objTcTcRps.InfRps.Tomador.IdentificacaoTomador.CpfCnpj = new TcCpfCnpj(); objTcTcRps.InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cpf = this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.CpfCnpj.Cpf; } } objTcTcRps.InfRps.Tomador.IdentificacaoTomador.InscricaoMunicipal = this.objLoteRps.Rps[i].InfRps.Tomador.IdentificacaoTomador.InscricaoMunicipal; objTcTcRps.InfRps.Tomador.RazaoSocial = this.objLoteRps.Rps[i].InfRps.Tomador.RazaoSocial; if (this.objLoteRps.Rps[i].InfRps.Tomador.Endereco != null) { objTcTcRps.InfRps.Tomador.Endereco = new TcEndereco(); objTcTcRps.InfRps.Tomador.Endereco.Endereco = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Endereco; objTcTcRps.InfRps.Tomador.Endereco.Numero = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Numero; objTcTcRps.InfRps.Tomador.Endereco.Complemento = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Complemento; objTcTcRps.InfRps.Tomador.Endereco.Bairro = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Bairro; objTcTcRps.InfRps.Tomador.Endereco.Uf = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Uf; objTcTcRps.InfRps.Tomador.Endereco.CodigoMunicipio = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.CodigoMunicipio; objTcTcRps.InfRps.Tomador.Endereco.Cep = this.objLoteRps.Rps[i].InfRps.Tomador.Endereco.Cep; } if (this.objLoteRps.Rps[i].InfRps.Tomador.Contato != null) { objTcTcRps.InfRps.Tomador.Contato = new TcContato(); objTcTcRps.InfRps.Tomador.Contato.Telefone = this.objLoteRps.Rps[i].InfRps.Tomador.Contato.Telefone; objTcTcRps.InfRps.Tomador.Contato.Email = this.objLoteRps.Rps[i].InfRps.Tomador.Contato.Email; } if (this.objLoteRps.Rps[i].InfRps.IntermediarioServico != null) { objTcTcRps.InfRps.IntermediarioServico = new TcIdentificacaoIntermediarioServico(); objTcTcRps.InfRps.IntermediarioServico.RazaoSocial = this.objLoteRps.Rps[i].InfRps.IntermediarioServico.RazaoSocial; objTcTcRps.InfRps.IntermediarioServico.InscricaoMunicipal = this.objLoteRps.Rps[i].InfRps.IntermediarioServico.InscricaoMunicipal; if (this.objLoteRps.Rps[i].InfRps.IntermediarioServico.CpfCnpj != null) { if (this.objLoteRps.Rps[i].InfRps.IntermediarioServico.CpfCnpj.Cnpj != "") { objTcTcRps.InfRps.IntermediarioServico.CpfCnpj = new TcCpfCnpj(); objTcTcRps.InfRps.IntermediarioServico.CpfCnpj.Cnpj = this.objLoteRps.Rps[i].InfRps.IntermediarioServico.CpfCnpj.Cnpj; } else if (this.objLoteRps.Rps[i].InfRps.IntermediarioServico.CpfCnpj.Cpf != "") { objTcTcRps.InfRps.IntermediarioServico.CpfCnpj = new TcCpfCnpj(); objTcTcRps.InfRps.IntermediarioServico.CpfCnpj.Cpf = this.objLoteRps.Rps[i].InfRps.IntermediarioServico.CpfCnpj.Cpf; } } } if (this.objLoteRps.Rps[i].InfRps.ConstrucaoCivil != null) { objTcTcRps.InfRps.ConstrucaoCivil = new tcDadosConstrucaoCivil(); objTcTcRps.InfRps.ConstrucaoCivil.Art = this.objLoteRps.Rps[i].InfRps.ConstrucaoCivil.Art; objTcTcRps.InfRps.ConstrucaoCivil.CodigoObra = this.objLoteRps.Rps[i].InfRps.ConstrucaoCivil.CodigoObra; } #endregion obj.Rps.Add(objTcTcRps); } this.objLoteRpsAlter = obj; } catch (Exception ex) { throw ex; } }