public DataSet TransportadoraDaNotaFiscal(string codigoEstabelecimento, string serieNotaFiscal, string nrNotaFiscal) { //INICIALIZAÇÃO DO DATASET E DATATABLE DataSet dataSetPrincipal = new DataSet("dataSetPrincipal"); DataTable tabelaRelatorio = new DataTable("tabelaRelatorio"); try { //MONTANDO AS COLUNAS DA TABELA RELATORIO //tabelaRelatorio.Columns.Add("bairroTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("cepTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("cgcTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("cidadeTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codtranspTransporte", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("enderecoTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("estadoTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("insestadualTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nomeTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nomeabrevTransporte", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("paisTransporte", typeof(string)).AllowDBNull = true; tabelaRelatorio.Columns.Add("bairroTransporte"); tabelaRelatorio.Columns.Add("cepTransporte"); tabelaRelatorio.Columns.Add("cgcTransporte"); tabelaRelatorio.Columns.Add("cidadeTransporte"); tabelaRelatorio.Columns.Add("codtranspTransporte"); tabelaRelatorio.Columns.Add("enderecoTransporte"); tabelaRelatorio.Columns.Add("estadoTransporte"); tabelaRelatorio.Columns.Add("insestadualTransporte"); tabelaRelatorio.Columns.Add("nomeTransporte"); tabelaRelatorio.Columns.Add("nomeabrevTransporte"); tabelaRelatorio.Columns.Add("paisTransporte"); //CONSUMINDO WEBSERVICES DO ERP PortalB2BEMS.WSIntelbras.relatoriosB2BService ErpService = new PortalB2BEMS.WSIntelbras.relatoriosB2BService(); ErpService.Timeout = 99999999; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttEmitenteRow[] EmitenteNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttFatDuplicRow[] FaturasNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTotaisRow[] TotaisNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTransporteRow[] TransportadoraNotaFiscal; ErpService.DetalheNotaFiscal(codigoEstabelecimento, serieNotaFiscal, nrNotaFiscal, out NotaFiscal, out EmitenteNotaFiscal, out TransportadoraNotaFiscal, out ItensNotaFiscal, out FaturasNotaFiscal, out TotaisNotaFiscal); //LOOP PARA POPULAR OS DADOS NA TABELA for (int i = 0; i < TransportadoraNotaFiscal.Length; i++) { tabelaRelatorio.Rows.Add(TransportadoraNotaFiscal[i].bairro, TransportadoraNotaFiscal[i].cep, TransportadoraNotaFiscal[i].cgc, TransportadoraNotaFiscal[i].cidade, TransportadoraNotaFiscal[i].codtransp, TransportadoraNotaFiscal[i].endereco, TransportadoraNotaFiscal[i].estado, TransportadoraNotaFiscal[i].insestadual, TransportadoraNotaFiscal[i].nome, TransportadoraNotaFiscal[i].nomeabrev, TransportadoraNotaFiscal[i].pais ); } } catch (SoapException ex) { System.Diagnostics.EventLog.WriteEntry("WebServices Report", ex.Detail.InnerText.ToString(), System.Diagnostics.EventLogEntryType.Error, 666); throw new SoapException("An error occurred in the webservices when retrieving the data, see the event viewer for more details.", SoapException.ClientFaultCode); } //ATRIBUINDO DATATABLE AO DATASET dataSetPrincipal.Tables.Add(tabelaRelatorio); //RETORNO DO DATASET return(dataSetPrincipal); }
public DataSet DetalhesDaNotaFiscal(string codigoEstabelecimento, string serieNotaFiscal, string nrNotaFiscal) { //INICIALIZAÇÃO DO DATASET E DATATABLE DataSet dataSetPrincipal = new DataSet("dataSetPrincipal"); DataTable tabelaRelatorio = new DataTable("tabelaRelatorio"); try { //MONTANDO AS COLUNAS DA TABELA RELATORIO #region Colunas da Tabela //tabelaRelatorio.Columns.Add("cgc", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codcondpag", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codemitente", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codnota", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("dtcancel", typeof(DateTime)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("dtconfirma", typeof(DateTime)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("dtemisnota", typeof(DateTime)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("dtsaida", typeof(DateTime)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("insestadual", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("natoperacao", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nometransp", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nrnotafis", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nrpedcli", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nrvolumes", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("observnota", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("pesobrutot", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("pesoliqtot", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("serie", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("vlmercad", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("vltotipi", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("vltotnota", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("cgcEmitente", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codemitenteEmitente", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codgrcliEmitente", typeof(int)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("descricaoEmitente", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("insestadualEmitente", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nomeEmitente", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("telefoneEmitente", typeof(string)).AllowDBNull = true; tabelaRelatorio.Columns.Add("cgc"); tabelaRelatorio.Columns.Add("codcondpag"); tabelaRelatorio.Columns.Add("codemitente"); tabelaRelatorio.Columns.Add("codestabel"); tabelaRelatorio.Columns.Add("codnota"); tabelaRelatorio.Columns.Add("dtcancel"); tabelaRelatorio.Columns.Add("dtconfirma"); tabelaRelatorio.Columns.Add("dtemisnota"); tabelaRelatorio.Columns.Add("dtsaida"); tabelaRelatorio.Columns.Add("insestadual"); tabelaRelatorio.Columns.Add("natoperacao"); tabelaRelatorio.Columns.Add("nometransp"); tabelaRelatorio.Columns.Add("nrnotafis"); tabelaRelatorio.Columns.Add("nrpedcli"); tabelaRelatorio.Columns.Add("nrvolumes"); tabelaRelatorio.Columns.Add("observnota"); tabelaRelatorio.Columns.Add("pesobrutot"); tabelaRelatorio.Columns.Add("pesoliqtot"); tabelaRelatorio.Columns.Add("serie"); tabelaRelatorio.Columns.Add("vlmercad"); tabelaRelatorio.Columns.Add("vltotipi"); tabelaRelatorio.Columns.Add("vltotnota"); tabelaRelatorio.Columns.Add("codrep"); tabelaRelatorio.Columns.Add("cgcEmitente"); tabelaRelatorio.Columns.Add("codemitenteEmitente"); tabelaRelatorio.Columns.Add("codgrcliEmitente"); tabelaRelatorio.Columns.Add("descricaoEmitente"); tabelaRelatorio.Columns.Add("insestadualEmitente"); tabelaRelatorio.Columns.Add("nomeEmitente"); tabelaRelatorio.Columns.Add("telefoneEmitente"); #endregion //CONSUMINDO WEBSERVICES DO ERP PortalB2BEMS.WSIntelbras.relatoriosB2BService ErpService = new PortalB2BEMS.WSIntelbras.relatoriosB2BService(); ErpService.Timeout = 99999999; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttEmitenteRow[] EmitenteNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttFatDuplicRow[] FaturasNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTotaisRow[] TotaisNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTransporteRow[] TransportadoraNotaFiscal; ErpService.DetalheNotaFiscal(codigoEstabelecimento, serieNotaFiscal, nrNotaFiscal, out NotaFiscal, out EmitenteNotaFiscal, out TransportadoraNotaFiscal, out ItensNotaFiscal, out FaturasNotaFiscal, out TotaisNotaFiscal); //LOOP PARA POPULAR OS DADOS NA TABELA for (int i = 0; i < NotaFiscal.Length; i++) { for (int y = 0; y < EmitenteNotaFiscal.Length; y++) { if (NotaFiscal[i].codemitente.Value == EmitenteNotaFiscal[y].codemitente.Value) { #region Adcionando Valores na Tabela tabelaRelatorio.Rows.Add(NotaFiscal[i].cgc, NotaFiscal[i].codcondpag.GetValueOrDefault(0), NotaFiscal[i].codemitente.GetValueOrDefault(0), NotaFiscal[i].codestabel, NotaFiscal[i].codnota, Convert.ToDateTime(NotaFiscal[i].dtcancel.GetValueOrDefault()).ToShortDateString(), Convert.ToDateTime(NotaFiscal[i].dtconfirma.GetValueOrDefault()).ToShortDateString(), Convert.ToDateTime(NotaFiscal[i].dtemisnota.GetValueOrDefault()).ToShortDateString(), Convert.ToDateTime(NotaFiscal[i].dtsaida.GetValueOrDefault()).ToShortDateString(), NotaFiscal[i].insestadual, NotaFiscal[i].natoperacao, NotaFiscal[i].nometransp, NotaFiscal[i].nrnotafis, NotaFiscal[i].nrpedcli, NotaFiscal[i].nrvolumes, NotaFiscal[i].observnota, Convert.ToDecimal(NotaFiscal[i].pesobrutot.GetValueOrDefault(0)).ToString("0.00"), Convert.ToDecimal(NotaFiscal[i].pesoliqtot.GetValueOrDefault(0)).ToString("0.00"), NotaFiscal[i].serie, Convert.ToDecimal(NotaFiscal[i].vlmercad.GetValueOrDefault(0)).ToString("0.00"), Convert.ToDecimal(NotaFiscal[i].vltotipi.GetValueOrDefault(0)).ToString("0.00"), Convert.ToDecimal(NotaFiscal[i].vltotnota.GetValueOrDefault(0)).ToString("0.00"), //22 NotaFiscal[i].codrep.GetValueOrDefault(0), EmitenteNotaFiscal[y].cgc, EmitenteNotaFiscal[y].codemitente.GetValueOrDefault(0), EmitenteNotaFiscal[y].codgrcli.GetValueOrDefault(0), EmitenteNotaFiscal[y].descricao, EmitenteNotaFiscal[y].insestadual, EmitenteNotaFiscal[y].nomeemit, EmitenteNotaFiscal[y].telefone //7 ); #endregion } } } } catch (SoapException ex) { System.Diagnostics.EventLog.WriteEntry("WebServices Report", ex.Detail.InnerText.ToString(), System.Diagnostics.EventLogEntryType.Error, 666); throw new SoapException("An error occurred in the webservices when retrieving the data, see the event viewer for more details.", SoapException.ClientFaultCode); } //ATRIBUINDO DATATABLE AO DATASET dataSetPrincipal.Tables.Add(tabelaRelatorio); //RETORNO DO DATASET return(dataSetPrincipal); }
public DataSet TotaisDaNotaFiscal(string codigoEstabelecimento, string serieNotaFiscal, string nrNotaFiscal) { //INICIALIZAÇÃO DO DATASET E DATATABLE DataSet dataSetPrincipal = new DataSet("dataSetPrincipal"); DataTable tabelaRelatorio = new DataTable("tabelaRelatorio"); try { //MONTANDO AS COLUNAS DA TABELA RELATORIO //tabelaRelatorio.Columns.Add("baseicmsTotais", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("baseicmssubTotais", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("codestabelTotais", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("nrnotafisTotais", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("serieTotais", typeof(string)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("vlicmsTotais", typeof(decimal)).AllowDBNull = true; //tabelaRelatorio.Columns.Add("vlicmssubTotais", typeof(decimal)).AllowDBNull = true; tabelaRelatorio.Columns.Add("baseicmsTotais"); tabelaRelatorio.Columns.Add("baseicmssubTotais"); tabelaRelatorio.Columns.Add("codestabelTotais"); tabelaRelatorio.Columns.Add("nrnotafisTotais"); tabelaRelatorio.Columns.Add("serieTotais"); tabelaRelatorio.Columns.Add("vlicmsTotais"); tabelaRelatorio.Columns.Add("vlicmssubTotais"); //CONSUMINDO WEBSERVICES DO ERP PortalB2BEMS.WSIntelbras.relatoriosB2BService ErpService = new PortalB2BEMS.WSIntelbras.relatoriosB2BService(); ErpService.Timeout = 99999999; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttEmitenteRow[] EmitenteNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttFatDuplicRow[] FaturasNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTotaisRow[] TotaisNotaFiscal; PortalB2BEMS.WSIntelbras.DetalheNotaFiscal_ttTransporteRow[] TransportadoraNotaFiscal; ErpService.DetalheNotaFiscal(codigoEstabelecimento, serieNotaFiscal, nrNotaFiscal, out NotaFiscal, out EmitenteNotaFiscal, out TransportadoraNotaFiscal, out ItensNotaFiscal, out FaturasNotaFiscal, out TotaisNotaFiscal); //LOOP PARA POPULAR OS DADOS NA TABELA for (int i = 0; i < TotaisNotaFiscal.Length; i++) { tabelaRelatorio.Rows.Add(Convert.ToDecimal(TotaisNotaFiscal[i].baseicms.Value).ToString("0.00"), Convert.ToDecimal(TotaisNotaFiscal[i].baseicmssub.Value).ToString("0.00"), TotaisNotaFiscal[i].codestabel, TotaisNotaFiscal[i].nrnotafis, TotaisNotaFiscal[i].serie, Convert.ToDecimal(TotaisNotaFiscal[i].vlicms.Value).ToString("0.00"), Convert.ToDecimal(TotaisNotaFiscal[i].vlicmssub.Value).ToString("0.00") ); } } catch (SoapException ex) { System.Diagnostics.EventLog.WriteEntry("WebServices Report", ex.Detail.InnerText.ToString(), System.Diagnostics.EventLogEntryType.Error, 666); throw new SoapException("An error occurred in the webservices when retrieving the data, see the event viewer for more details.", SoapException.ClientFaultCode); } //ATRIBUINDO DATATABLE AO DATASET dataSetPrincipal.Tables.Add(tabelaRelatorio); //RETORNO DO DATASET return(dataSetPrincipal); }