Esempio n. 1
0
    public DataSet ListagemDeNotasFiscaisPorEmitente(string codigoEstabelecimento, int codigoRepresentante, int codigoEmitente, DateTime dtInicial, DateTime dtFinal)
    {
        //INICIALIZAÇÃO DO DATASET E DATATABLE
        DataSet   dataSetPrincipal = new DataSet("dataSetPrincipal");
        DataTable tabelaRelatorio  = new DataTable("tabelaRelatorio");

        //MONTANDO AS COLUNAS DA TABELA RELATORIO
        //tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull = true;
        //tabelaRelatorio.Columns.Add("dtemisnota", typeof(DateTime)).AllowDBNull = true;
        //tabelaRelatorio.Columns.Add("nrnotafis", typeof(string)).AllowDBNull = true;
        //tabelaRelatorio.Columns.Add("serie", typeof(string)).AllowDBNull = true;
        //tabelaRelatorio.Columns.Add("vlmerctotfat", typeof(decimal)).AllowDBNull = true;
        //tabelaRelatorio.Columns.Add("vltotnota", typeof(decimal)).AllowDBNull = true;
        tabelaRelatorio.Columns.Add("codestabel");
        tabelaRelatorio.Columns.Add("dtemisnota");
        tabelaRelatorio.Columns.Add("nrnotafis");
        tabelaRelatorio.Columns.Add("serie");
        tabelaRelatorio.Columns.Add("vlmerctotfat");
        tabelaRelatorio.Columns.Add("vltotnota");
        tabelaRelatorio.Columns.Add("nrpedido");


        try
        {
            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemNotasCliente_ttNotasRow[] dadosDoErp;

            ErpService.ListagemNotasCliente(codigoEstabelecimento, codigoRepresentante, codigoEmitente, Convert.ToDateTime(dtInicial), Convert.ToDateTime(dtFinal), out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].codestabel,
                                         Convert.ToDateTime(dadosDoErp[i].dtemisnota.Value).ToShortDateString(),
                                         dadosDoErp[i].nrnotafis,
                                         dadosDoErp[i].serie,
                                         Convert.ToDecimal(dadosDoErp[i].vlmerctotfat.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vltotnota.Value).ToString("0.00")
                                         , dadosDoErp[i].nrpedido
                                         );
            }
        }
        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);
    }
Esempio n. 2
0
    public DataSet CurvaABCRepresentante(int codigoRepresentante, string codigoUnidadeNegocio)
    {
        //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("codemitente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codgrcli", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descricao", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("totalperiodo", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("codemitente");
            tabelaRelatorio.Columns.Add("codgrcli");
            tabelaRelatorio.Columns.Add("descricao");
            tabelaRelatorio.Columns.Add("nomeemit");
            tabelaRelatorio.Columns.Add("totalperiodo");
            tabelaRelatorio.Columns.Add("desunidnegoc");
            tabelaRelatorio.Columns.Add("codunidnegoc");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            CurvaABCRepres_ttCurvaRow[] curvaABC;
            ErpService.CurvaABCRepres(codigoRepresentante, codigoUnidadeNegocio, out curvaABC);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < curvaABC.Length; i++)
            {
                tabelaRelatorio.Rows.Add(curvaABC[i].codemitente,
                                         curvaABC[i].codgrcli,
                                         curvaABC[i].descricao,
                                         curvaABC[i].nomeemit,
                                         Convert.ToDecimal(curvaABC[i].totalperiodo.Value).ToString("0.00").Replace(",", "."),
                                         curvaABC[i].desunidnegoc,
                                         curvaABC[i].codunidnegoc
                                         );
            }
        }

        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);
    }
Esempio n. 3
0
    public DataSet TabelaPrecoAstecEsp(string coditem)
    {
        //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("itcodigo");
            tabelaRelatorio.Columns.Add("itdesc");
            tabelaRelatorio.Columns.Add("aliquotaipi");
            tabelaRelatorio.Columns.Add("nivel");
            tabelaRelatorio.Columns.Add("precovenda1");
            tabelaRelatorio.Columns.Add("precovenda2");
            tabelaRelatorio.Columns.Add("precovenda3");
            tabelaRelatorio.Columns.Add("seq");
            tabelaRelatorio.Columns.Add("localmontag");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            TabPrecoAstecPorItem_ttEstruturaRow[] dadosDoErp;
            ErpService.TabPrecoAstecPorItem(coditem, out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].itcodigo,
                                         dadosDoErp[i].descricao,
                                         dadosDoErp[i].aliquotaipi,
                                         dadosDoErp[i].nivel,
                                         Convert.ToDecimal(dadosDoErp[i].precovenda.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].precovenda2.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].precovenda3.Value).ToString("0.00"),
                                         dadosDoErp[i].seq,
                                         ""   //dadosDoErp[i].localmontag
                                         );
            }
        }

        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);
    }
Esempio n. 4
0
    public DataSet ListagemPedidoAbertoCliente(string unidadeNegocio, string codigoEstabelecimento, int codigoRepresentante, DateTime dtInicial, DateTime dtFinal, int codigoEmitente)
    {
        //INICIALIZAÇÃO DO DATASET E DATATABLE
        DataSet   dataSetPrincipal = new DataSet("dataSetPrincipal");
        DataTable tabelaRelatorio  = new DataTable("tabelaRelatorio");

        //    //MONTANDO AS COLUNAS DA TABELA RELATORIO
        //    tabelaRelatorio.Columns.Add("descitem", typeof(string)).AllowDBNull=true;
        //    tabelaRelatorio.Columns.Add("itcodigo", typeof(string)).AllowDBNull = true;
        //    tabelaRelatorio.Columns.Add("nrpedcli", typeof(string)).AllowDBNull = true;
        //    tabelaRelatorio.Columns.Add("nrsequencia", typeof(int)).AllowDBNull = true;
        //    tabelaRelatorio.Columns.Add("qtsaldo", typeof(decimal)).AllowDBNull = true;
        //    tabelaRelatorio.Columns.Add("vlcarteira", typeof(decimal)).AllowDBNull = true;
        try
        {
            tabelaRelatorio.Columns.Add("descitem");
            tabelaRelatorio.Columns.Add("itcodigo");
            tabelaRelatorio.Columns.Add("nrpedcli");
            tabelaRelatorio.Columns.Add("nrsequencia");
            tabelaRelatorio.Columns.Add("qtsaldo");
            tabelaRelatorio.Columns.Add("vlcarteira");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemPedidosAbertoCliente_ttSaldoCarteiraRow[] dadosDoErp;
            ErpService.ListagemPedidosAbertoCliente(codigoEstabelecimento, codigoRepresentante, codigoEmitente, unidadeNegocio, dtInicial, dtFinal, out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].descitem,
                                         dadosDoErp[i].itcodigo,
                                         dadosDoErp[i].nrpedcli,
                                         dadosDoErp[i].nrsequencia.Value,
                                         Convert.ToDecimal(dadosDoErp[i].qtsaldo.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vlcarteira.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);
    }
Esempio n. 5
0
    public DataSet EstruturaProdutoAstec(string codigoItem, string descricao)
    {
        DataSet   dataSetPrincipal = new DataSet("dataSetPrincipal");
        DataTable tabelaRelatorio  = new DataTable("tabelaRelatorio");

        try
        {
            //MONTANDO AS COLUNAS DA TABELA RELATORIO
            tabelaRelatorio.Columns.Add("seq");
            tabelaRelatorio.Columns.Add("nivel");
            tabelaRelatorio.Columns.Add("itcodigo");
            tabelaRelatorio.Columns.Add("descricao");
            tabelaRelatorio.Columns.Add("itpai");
            tabelaRelatorio.Columns.Add("localmontag");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            BuscaItemVenda_ttEstruturaRow[] Estrutura;
            ErpService.BuscaItemVenda(codigoItem, descricao, out Estrutura);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int y = 0; y < Estrutura.Length; y++)
            {
                tabelaRelatorio.Rows.Add(
                    Estrutura[y].seq,
                    Estrutura[y].nivel,
                    Estrutura[y].itcodigo,
                    Estrutura[y].descricao,
                    Estrutura[y].itpai,
                    Estrutura[y].localmontag
                    );
            }
        }

        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);
    }
Esempio n. 6
0
    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
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal;
            DetalheNotaFiscal_ttEmitenteRow[]   EmitenteNotaFiscal;
            DetalheNotaFiscal_ttFatDuplicRow[]  FaturasNotaFiscal;
            DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal;
            DetalheNotaFiscal_ttTotaisRow[]     TotaisNotaFiscal;
            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);
    }
Esempio n. 7
0
    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
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalheNotaFiscal_ttEmitenteRow[]   EmitenteNotaFiscal;
            DetalheNotaFiscal_ttFatDuplicRow[]  FaturasNotaFiscal;
            DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal;
            DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal;
            DetalheNotaFiscal_ttTotaisRow[]     TotaisNotaFiscal;
            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);
    }
Esempio n. 8
0
    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
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalheNotaFiscal_ttEmitenteRow[]   EmitenteNotaFiscal;
            DetalheNotaFiscal_ttFatDuplicRow[]  FaturasNotaFiscal;
            DetalheNotaFiscal_ttItNotaFiscRow[] ItensNotaFiscal;
            DetalheNotaFiscal_ttNotaFiscalRow[] NotaFiscal;
            DetalheNotaFiscal_ttTotaisRow[]     TotaisNotaFiscal;
            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);
    }
Esempio n. 9
0
    public DataSet ListagemPreco(string codigoEstabelecimento, string Estado, int codigoCategoria, string DescricaoUnidadeNegocio, int codigoGrupoCliente, int codigoCliente)
    {
        //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("descitem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dsfmcodcom", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("fmcodcom", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("itcodigo", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlprecocomipi", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlprecopma", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlprecopmd", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlprecosemipi", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("descitem");
            tabelaRelatorio.Columns.Add("dsfmcodcom");
            tabelaRelatorio.Columns.Add("fmcodcom");
            tabelaRelatorio.Columns.Add("itcodigo");
            tabelaRelatorio.Columns.Add("vlprecocomipi");
            tabelaRelatorio.Columns.Add("vlprecopma");
            tabelaRelatorio.Columns.Add("vlprecopmd");
            tabelaRelatorio.Columns.Add("vlprecosemipi");
            tabelaRelatorio.Columns.Add("laynome");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemTabelasPreco_ttPrecoItemRow[] dadosDoErp;
            ErpService.ListagemTabelasPreco(codigoEstabelecimento, Estado, codigoCategoria, DescricaoUnidadeNegocio, codigoGrupoCliente, codigoCliente, out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].descitem,
                                         dadosDoErp[i].dsfmcodcom,
                                         dadosDoErp[i].fmcodcom,
                                         dadosDoErp[i].itcodigo,
                                         Convert.ToDecimal(dadosDoErp[i].vlprecocomipi.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vlprecopma.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vlprecopmd.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vlprecosemipi.Value).ToString("0.00"),
                                         dadosDoErp[i].laynome
                                         );
            }
        }

        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);
    }
Esempio n. 10
0
    public DataSet ListagemCotasDoRepresentante(string codigoEstabelecimento, string codigoRepresentante, DateTime dtInicial, bool Diretoria, bool Gerente, bool Representante)
    {
        //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("coddiretoria", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codgerente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codrep", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descfmcodcom", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descitem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("fmcodcom", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codigoitem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrev", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomediretoria", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomegerente", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("percrealizado", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtcarteira", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtcota", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtdevolvido", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtfatmenosdev", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtfaturado", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtfaturar", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtsaldovender", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("coddiretoria");
            tabelaRelatorio.Columns.Add("codestabel");
            tabelaRelatorio.Columns.Add("codgerente");
            tabelaRelatorio.Columns.Add("codrep");
            tabelaRelatorio.Columns.Add("descfmcodcom");
            tabelaRelatorio.Columns.Add("descitem");
            tabelaRelatorio.Columns.Add("fmcodcom");
            tabelaRelatorio.Columns.Add("codigoitem");
            tabelaRelatorio.Columns.Add("nomeabrev");
            tabelaRelatorio.Columns.Add("nomediretoria");
            tabelaRelatorio.Columns.Add("nomegerente");
            tabelaRelatorio.Columns.Add("percrealizado");
            tabelaRelatorio.Columns.Add("qtcarteira");
            tabelaRelatorio.Columns.Add("qtcota");
            tabelaRelatorio.Columns.Add("qtdevolvido");
            tabelaRelatorio.Columns.Add("qtfatmenosdev");
            tabelaRelatorio.Columns.Add("qtfaturado");
            tabelaRelatorio.Columns.Add("qtfaturar");
            tabelaRelatorio.Columns.Add("qtsaldovender");
            tabelaRelatorio.Columns.Add("descunidnegoc");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemCotasRepres_ttCotaFinalRow[] dadosDoErp;
            ListagemCotasRepres_ttErroRow[]      ErroErp;

            ErpService.ListagemCotasRepres(codigoEstabelecimento, codigoRepresentante, dtInicial, Diretoria, Gerente, Representante, out dadosDoErp, out ErroErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].coddiretoria,
                                         dadosDoErp[i].codestabel,
                                         dadosDoErp[i].codgerente.Value,
                                         dadosDoErp[i].codrep.Value,
                                         dadosDoErp[i].descfmcodcom,
                                         dadosDoErp[i].descitem,
                                         dadosDoErp[i].fmcodcom,
                                         dadosDoErp[i].itcodigo,
                                         dadosDoErp[i].nomeabrev,
                                         dadosDoErp[i].nomediretoria,
                                         dadosDoErp[i].nomegerente,
                                         Convert.ToDecimal(dadosDoErp[i].percrealizado.Value).ToString("0.00"),
                                         dadosDoErp[i].qtcarteira,
                                         dadosDoErp[i].qtcota.Value,
                                         dadosDoErp[i].qtdevolvido,
                                         Convert.ToDecimal(dadosDoErp[i].qtfatmenosdev.Value).ToString("0.00"),
                                         dadosDoErp[i].qtfaturado,
                                         Convert.ToDecimal(dadosDoErp[i].qtfaturar.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].qtsaldovender.Value).ToString("0.00"),
                                         dadosDoErp[i].descunidnegoc
                                         );
            }
        }
        catch (System.Web.Services.Protocols.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);
    }
Esempio n. 11
0
    public DataSet FaturamentoPorRepresentante(string codigoEstabelecimento, int codigoRepresentante, string codigoUnidadeNegocio, DateTime dtInicial, DateTime dtFinal)
    {
        //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("codgrcli", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descricao", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codemitente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codgrcli_representante", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlcarteira", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vldevolvido", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlfaturado", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("codgrcli");
            tabelaRelatorio.Columns.Add("descricao");
            tabelaRelatorio.Columns.Add("codemitente");
            tabelaRelatorio.Columns.Add("codgrcli_representante");
            tabelaRelatorio.Columns.Add("nomeemit");
            tabelaRelatorio.Columns.Add("vlcarteira");
            tabelaRelatorio.Columns.Add("vldevolvido");
            tabelaRelatorio.Columns.Add("vlfaturado");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            FaturamentoRepresentante_ttGrCliRow[]             FaturamentoGrupoDeCliente;
            FaturamentoRepresentante_ttFaturamentoRepresRow[] FaturamentoRepresentante;
            ErpService.FaturamentoRepresentante(codigoEstabelecimento, codigoRepresentante, codigoUnidadeNegocio, dtInicial, dtFinal, out FaturamentoGrupoDeCliente, out FaturamentoRepresentante);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < FaturamentoGrupoDeCliente.Length; i++)
            {
                for (int y = 0; y < FaturamentoRepresentante.Length; y++)
                {
                    if (FaturamentoGrupoDeCliente[i].codgrcli.Value == FaturamentoRepresentante[y].codgrcli.Value)
                    {
                        tabelaRelatorio.Rows.Add(FaturamentoGrupoDeCliente[i].codgrcli.Value,
                                                 FaturamentoGrupoDeCliente[i].descricao,
                                                 FaturamentoRepresentante[y].codemitente.Value,
                                                 FaturamentoRepresentante[y].codgrcli.Value,
                                                 FaturamentoRepresentante[y].nomeemit,
                                                 Convert.ToDecimal(FaturamentoRepresentante[y].vlcarteira.Value).ToString("0.00"),
                                                 Convert.ToDecimal(FaturamentoRepresentante[y].vldevolvido.Value).ToString("0.00"), //VERIFICAR
                                                 Convert.ToDecimal(FaturamentoRepresentante[y].vlfaturado.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);
    }
Esempio n. 12
0
    public DataSet DetalheCliente(int codigoEmitente, string codigoEstabelecimento)
    {
        //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("bairro", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("bairrocob", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("bonificacao", typeof(decimal)).AllowDBNull  = true;
            tabelaRelatorio.Columns.Add("categoria", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("cep", typeof(string)).AllowDBNull           = true;
            tabelaRelatorio.Columns.Add("cepcob", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("cgc", typeof(string)).AllowDBNull           = true;
            tabelaRelatorio.Columns.Add("cidade", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("cidadecob", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("codemitente", typeof(int)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull    = true;
            tabelaRelatorio.Columns.Add("codsuframa", typeof(string)).AllowDBNull    = true;
            tabelaRelatorio.Columns.Add("consumidorfinal", typeof(bool)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("contratovendor", typeof(bool)).AllowDBNull  = true;
            tabelaRelatorio.Columns.Add("descpontual", typeof(string)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("dsgrcli", typeof(string)).AllowDBNull       = true;
            tabelaRelatorio.Columns.Add("dtlimcred", typeof(DateTime)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("endereco", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("enderecocob", typeof(string)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("estado", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("estadocob", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("indcredcli", typeof(int)).AllowDBNull       = true;
            tabelaRelatorio.Columns.Add("indice", typeof(int)).AllowDBNull           = true;
            tabelaRelatorio.Columns.Add("insestadual", typeof(string)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("limcredito", typeof(decimal)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("observacoes", typeof(string)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("telefone", typeof(string)).AllowDBNull      = true;

            tabelaRelatorio.Columns.Add("codemitEmitente", typeof(int)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("emailEmitente", typeof(string)).AllowDBNull    = true;
            tabelaRelatorio.Columns.Add("nomeEmitente", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("ramalEmitente", typeof(string)).AllowDBNull    = true;
            tabelaRelatorio.Columns.Add("telefoneEmitente", typeof(string)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("valLimSuperCard", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("valLimIntel", typeof(decimal)).AllowDBNull     = true;


            #endregion

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalheCliente_ttContEmitRow[] ContatosEmitente;
            DetalheCliente_ttEmitenteRow[] Emitente;
            ErpService.DetalheCliente(codigoEmitente, codigoEstabelecimento, out Emitente, out ContatosEmitente);

            DataRow newCustomersRow = tabelaRelatorio.NewRow();

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < Emitente.Length; i++)
            {
                newCustomersRow["bairro"]          = Emitente[i].bairro;
                newCustomersRow["bairrocob"]       = Emitente[i].bairrocob;
                newCustomersRow["bonificacao"]     = Emitente[i].bonificacao;
                newCustomersRow["categoria"]       = Emitente[i].categoria;
                newCustomersRow["cep"]             = Emitente[i].cep;
                newCustomersRow["cepcob"]          = Emitente[i].cepcob;
                newCustomersRow["cgc"]             = Emitente[i].cgc;
                newCustomersRow["cidade"]          = Emitente[i].cidade;
                newCustomersRow["cidadecob"]       = Emitente[i].cidadecob;
                newCustomersRow["codemitente"]     = Emitente[i].codemitente;
                newCustomersRow["codestabel"]      = Emitente[i].codestabel;
                newCustomersRow["codsuframa"]      = Emitente[i].codsuframa;
                newCustomersRow["consumidorfinal"] = Emitente[i].consumidorfinal;
                newCustomersRow["contratovendor"]  = Emitente[i].contratovendor;
                newCustomersRow["dsgrcli"]         = Emitente[i].dsgrcli;
                newCustomersRow["dtlimcred"]       = Emitente[i].dtlimcred;
                newCustomersRow["endereco"]        = Emitente[i].endereco;
                newCustomersRow["enderecocob"]     = Emitente[i].enderecocob;
                newCustomersRow["estado"]          = Emitente[i].estado;
                newCustomersRow["estadocob"]       = Emitente[i].estadocob;
                newCustomersRow["indcredcli"]      = Emitente[i].indcredcli;
                newCustomersRow["indice"]          = Emitente[i].indice;
                newCustomersRow["insestadual"]     = Emitente[i].insestadual;
                newCustomersRow["limcredito"]      = Emitente[i].limcredito;
                newCustomersRow["nomeemit"]        = Emitente[i].nomeemit;
                newCustomersRow["observacoes"]     = Emitente[i].observacoes;
                newCustomersRow["telefone"]        = Emitente[i].telefone;
                newCustomersRow["valLimSuperCard"] = Emitente[i].vallimitesupcard;
                newCustomersRow["valLimIntel"]     = Emitente[i].vallimiteintelbras;
                if (ContatosEmitente.Length == 0)
                {
                    tabelaRelatorio.Rows.Add(newCustomersRow);
                }
                else
                {
                    for (int y = 0; y < ContatosEmitente.Length; y++)
                    {
                        if (Emitente[i].codemitente.Value == ContatosEmitente[y].codemit.Value)
                        {
                            newCustomersRow["codemitEmitente"]  = ContatosEmitente[i].codemit;
                            newCustomersRow["emailEmitente"]    = ContatosEmitente[i].email;
                            newCustomersRow["nomeEmitente"]     = ContatosEmitente[i].nome;
                            newCustomersRow["ramalEmitente"]    = ContatosEmitente[i].ramal;
                            newCustomersRow["telefoneEmitente"] = ContatosEmitente[i].telefone;
                        }
                    }
                    tabelaRelatorio.Rows.Add(newCustomersRow);
                }
            }
        }

        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);
    }
Esempio n. 13
0
    public DataSet DetalhePedido(string codigoEstabelecimento, int codigoEmitente, string numeroDoPedidoDoCliente)
    {
        //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("bairro", typeof(string)).AllowDBNull          = true;
            tabelaRelatorio.Columns.Add("cep", typeof(string)).AllowDBNull             = true;
            tabelaRelatorio.Columns.Add("cidade", typeof(string)).AllowDBNull          = true;
            tabelaRelatorio.Columns.Add("codemitente", typeof(int)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("codrep", typeof(int)).AllowDBNull             = true;
            tabelaRelatorio.Columns.Add("condespec", typeof(string)).AllowDBNull       = true;
            tabelaRelatorio.Columns.Add("descbloqcr", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("desccondpagto", typeof(string)).AllowDBNull   = true;
            tabelaRelatorio.Columns.Add("dtemissao", typeof(DateTime)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("dtentrega", typeof(DateTime)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("endereco", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("estado", typeof(string)).AllowDBNull          = true;
            tabelaRelatorio.Columns.Add("noabreppri", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("nomeabrev", typeof(string)).AllowDBNull       = true;
            tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("nometransp", typeof(string)).AllowDBNull      = true;
            tabelaRelatorio.Columns.Add("nrpedcli", typeof(string)).AllowDBNull        = true;
            tabelaRelatorio.Columns.Add("observacoes", typeof(string)).AllowDBNull     = true;
            tabelaRelatorio.Columns.Add("tipofrete", typeof(string)).AllowDBNull       = true;
            tabelaRelatorio.Columns.Add("vendor", typeof(bool)).AllowDBNull            = true;
            tabelaRelatorio.Columns.Add("vendordiascarencia", typeof(int)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("vendortaxa", typeof(decimal)).AllowDBNull     = true;

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalhePedidos_ttNotaFiscalRow[] NotaFiscalDoPedido;
            DetalhePedidos_ttPedItemRow[]    ItemDoPedido;
            DetalhePedidos_ttPedVendaRow[]   DetalheDoPedido;
            ErpService.DetalhePedidos(codigoEstabelecimento, codigoEmitente, numeroDoPedidoDoCliente, out DetalheDoPedido, out ItemDoPedido, out NotaFiscalDoPedido);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < DetalheDoPedido.Length; i++)
            {
                tabelaRelatorio.Rows.Add(DetalheDoPedido[i].bairro,
                                         DetalheDoPedido[i].cep,
                                         DetalheDoPedido[i].cidade,
                                         DetalheDoPedido[i].codemitente,
                                         DetalheDoPedido[i].codestabel,
                                         DetalheDoPedido[i].codrep,
                                         DetalheDoPedido[i].condespec,
                                         DetalheDoPedido[i].descbloqcr,
                                         DetalheDoPedido[i].desccondpagto,
                                         DetalheDoPedido[i].dtemissao,
                                         DetalheDoPedido[i].dtentrega,
                                         DetalheDoPedido[i].endereco,
                                         DetalheDoPedido[i].estado,
                                         DetalheDoPedido[i].noabreppri,
                                         DetalheDoPedido[i].nomeabrev,
                                         DetalheDoPedido[i].nomeemit,
                                         DetalheDoPedido[i].nometransp,
                                         DetalheDoPedido[i].nrpedcli,
                                         DetalheDoPedido[i].observacoes,
                                         DetalheDoPedido[i].tipofrete,
                                         DetalheDoPedido[i].vendor,
                                         DetalheDoPedido[i].vendordiascarencia,
                                         DetalheDoPedido[i].vendortaxa           //22
                                         );
            }
        }
        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);
    }
Esempio n. 14
0
    public DataSet ListagemPedidoCliente(string codigoRepresentante, int codigoEmitente, DateTime dtInicial, DateTime dtFinal, string numeroDoPedidoDoCliente, int codigoSituacaoDoPedido, bool EmiteDuplic, string codigoEstabelecimento)
    {
        //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("codemitente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codsitaval", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codsitped", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("desccancela", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("desccondpagto", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dtemissao", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dtentrega", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("noabreppri", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrpedcli", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlliqped", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vltotped", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("codemitente");
            tabelaRelatorio.Columns.Add("codestabel");
            tabelaRelatorio.Columns.Add("codsitaval");
            tabelaRelatorio.Columns.Add("codsitped");
            tabelaRelatorio.Columns.Add("desccancela");
            tabelaRelatorio.Columns.Add("desccondpagto");
            tabelaRelatorio.Columns.Add("dtemissao");
            tabelaRelatorio.Columns.Add("dtentrega");
            tabelaRelatorio.Columns.Add("noabreppri");
            tabelaRelatorio.Columns.Add("nomeemit");
            tabelaRelatorio.Columns.Add("nrpedcli");
            tabelaRelatorio.Columns.Add("vlliqped");
            tabelaRelatorio.Columns.Add("vltotped");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemPedidosCliente_ttPedVendaRow[] dadosDoErp;
            ErpService.ListagemPedidosCliente(codigoRepresentante, codigoEmitente, dtInicial, dtFinal, numeroDoPedidoDoCliente, codigoSituacaoDoPedido, EmiteDuplic, codigoEstabelecimento, out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].codemitente,
                                         dadosDoErp[i].codestabel,
                                         dadosDoErp[i].codsitaval,
                                         dadosDoErp[i].codsitped,
                                         dadosDoErp[i].desccancela,
                                         dadosDoErp[i].desccondpagto,
                                         dadosDoErp[i].dtemissao,
                                         dadosDoErp[i].dtentrega,
                                         dadosDoErp[i].noabreppri,
                                         dadosDoErp[i].nomeemit,
                                         dadosDoErp[i].nrpedcli,
                                         Convert.ToDecimal(dadosDoErp[i].vlliqped.Value).ToString("0.00"),
                                         Convert.ToDecimal(dadosDoErp[i].vltotped.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);
    }
Esempio n. 15
0
    public DataSet NotasFiscaisDoPedido(string codigoEstabelecimento, int codigoEmitente, string numeroDoPedidoDoCliente)
    {
        //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("canceladaNota", typeof(bool)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codestabelNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("desccondpagtoNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dtemisnota", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrevNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nometranspNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrnotafisNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrpedcliNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("serieNota", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vltotnota", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("canceladaNota");
            tabelaRelatorio.Columns.Add("codestabelNota");
            tabelaRelatorio.Columns.Add("desccondpagtoNota");
            tabelaRelatorio.Columns.Add("dtemisnota");
            tabelaRelatorio.Columns.Add("nomeabrevNota");
            tabelaRelatorio.Columns.Add("nometranspNota");
            tabelaRelatorio.Columns.Add("nrnotafisNota");
            tabelaRelatorio.Columns.Add("nrpedcliNota");
            tabelaRelatorio.Columns.Add("serieNota");
            tabelaRelatorio.Columns.Add("vltotnota");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalhePedidos_ttNotaFiscalRow[] NotaFiscalDoPedido;
            DetalhePedidos_ttPedItemRow[]    ItemDoPedido;
            DetalhePedidos_ttPedVendaRow[]   DetalheDoPedido;
            ErpService.DetalhePedidos(codigoEstabelecimento, codigoEmitente, numeroDoPedidoDoCliente, out DetalheDoPedido, out ItemDoPedido, out NotaFiscalDoPedido);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int z = 0; z < NotaFiscalDoPedido.Length; z++)
            {
                tabelaRelatorio.Rows.Add(
                    NotaFiscalDoPedido[z].cancelada,
                    NotaFiscalDoPedido[z].codestabel,
                    NotaFiscalDoPedido[z].desccondpagto,
                    NotaFiscalDoPedido[z].dtemisnota,
                    NotaFiscalDoPedido[z].nomeabrev,
                    NotaFiscalDoPedido[z].nometransp,
                    NotaFiscalDoPedido[z].nrnotafis,
                    NotaFiscalDoPedido[z].nrpedcli,
                    NotaFiscalDoPedido[z].serie,
                    Convert.ToDecimal(NotaFiscalDoPedido[z].vltotnota.Value).ToString("0.00")
                    );                        //10
            }
        }
        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);
    }
Esempio n. 16
0
    public DataSet ItensDoPedido(string codigoEstabelecimento, int codigoEmitente, string numeroDoPedidoDoCliente)
    {
        //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("aliqipiItem", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descitemItem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("itcodigoItem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrevItem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrpedcliItem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtpedidaItem", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("saldoitem", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlpreuniItem", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("aliqipiItem");
            tabelaRelatorio.Columns.Add("descitemItem");
            tabelaRelatorio.Columns.Add("itcodigoItem");
            tabelaRelatorio.Columns.Add("nomeabrevItem");
            tabelaRelatorio.Columns.Add("nrpedcliItem");
            tabelaRelatorio.Columns.Add("qtpedidaItem");
            tabelaRelatorio.Columns.Add("saldoitem");
            tabelaRelatorio.Columns.Add("vlpreuniItem");
            tabelaRelatorio.Columns.Add("situacao");
            tabelaRelatorio.Columns.Add("vlsubstribItem");
            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            DetalhePedidos_ttNotaFiscalRow[] NotaFiscalDoPedido;
            DetalhePedidos_ttPedItemRow[]    ItemDoPedido;
            DetalhePedidos_ttPedVendaRow[]   DetalheDoPedido;
            ErpService.DetalhePedidos(codigoEstabelecimento, codigoEmitente, numeroDoPedidoDoCliente, out DetalheDoPedido, out ItemDoPedido, out NotaFiscalDoPedido);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < ItemDoPedido.Length; i++)
            {
                tabelaRelatorio.Rows.Add(Convert.ToDecimal(ItemDoPedido[i].aliqipi.Value).ToString("0.00"),    //VERIFICAR
                                         ItemDoPedido[i].descitem,
                                         ItemDoPedido[i].itcodigo,
                                         ItemDoPedido[i].nomeabrev,
                                         ItemDoPedido[i].nrpedcli,
                                         Convert.ToDecimal(ItemDoPedido[i].qtpedida.Value).ToString("0.00"),
                                         Convert.ToDecimal(ItemDoPedido[i].saldoitem.Value).ToString("0.00"),
                                         Convert.ToDecimal(ItemDoPedido[i].vlpreuni.Value).ToString("0.00"),
                                         ItemDoPedido[i].situacao,
                                         Convert.ToDecimal(ItemDoPedido[i].vlsubstrib.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);
    }
Esempio n. 17
0
    public DataSet DevolucaoCliente(string codigoEstabelecimento, int codigoRepresentante, string codigoUnidadeNegocio, DateTime dtInicial, DateTime dtFinal)
    {
        //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("codemitente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codrep", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("descitem", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dtdevol", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("itcodigo", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrev", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrnotafis", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("precototal", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("qtdevolvida", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("sequencia", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("serie", typeof(string)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("codemitente");
            tabelaRelatorio.Columns.Add("codrep");
            tabelaRelatorio.Columns.Add("descitem");
            tabelaRelatorio.Columns.Add("dtdevol");
            tabelaRelatorio.Columns.Add("itcodigo");
            tabelaRelatorio.Columns.Add("nomeabrev");
            tabelaRelatorio.Columns.Add("nomeemit");
            tabelaRelatorio.Columns.Add("nrnotafis");
            tabelaRelatorio.Columns.Add("precototal");
            tabelaRelatorio.Columns.Add("qtdevolvida");
            tabelaRelatorio.Columns.Add("sequencia");
            tabelaRelatorio.Columns.Add("serie");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemDevolClientes_ttDevolucaoRow[] dadosDoErp;
            ErpService.ListagemDevolClientes(codigoEstabelecimento, codigoRepresentante, codigoUnidadeNegocio, dtInicial, dtFinal, out dadosDoErp);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < dadosDoErp.Length; i++)
            {
                tabelaRelatorio.Rows.Add(dadosDoErp[i].codemitente,
                                         dadosDoErp[i].codrep,
                                         dadosDoErp[i].descitem,
                                         dadosDoErp[i].dtdevol,
                                         dadosDoErp[i].itcodigo,
                                         dadosDoErp[i].nomeabrev,
                                         dadosDoErp[i].nomeemit,
                                         dadosDoErp[i].nrnotafis,
                                         Convert.ToDecimal(dadosDoErp[i].precototal.Value).ToString("0.00"),
                                         dadosDoErp[i].qtdevolvida,
                                         dadosDoErp[i].sequencia,
                                         dadosDoErp[i].serie);
            }
        }

        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);
    }
Esempio n. 18
0
    public DataSet RankingEstabelecimento(string codigoEstabelecimento, string periodo)
    {
        string AnoPeriodo = periodo.Substring(3, 4);
        string MesPeriodo = periodo.Substring(0, 2);

        periodo = AnoPeriodo + MesPeriodo;

        //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("cod_unid_negoc", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codestabel", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codrep", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("des_unid_negoc", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrev", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("perc", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlcota", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vldevolvido", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlfaturado", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("cod_unid_negoc");
            tabelaRelatorio.Columns.Add("codestabel");
            tabelaRelatorio.Columns.Add("codrep");
            tabelaRelatorio.Columns.Add("des_unid_negoc");
            tabelaRelatorio.Columns.Add("nomeabrev");
            tabelaRelatorio.Columns.Add("perc");
            tabelaRelatorio.Columns.Add("vlcota");
            tabelaRelatorio.Columns.Add("vldevolvido");
            tabelaRelatorio.Columns.Add("vlfaturado");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            RankingEstabelecimento_ttRankingRow[] Ranking;
            //PortalB2BEMS.WSIntelbras.RankingEstabelecimento_ttUnidNegRow[] UnidadeNegocio;
            ErpService.RankingEstabelecimento(codigoEstabelecimento, periodo, out Ranking);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int y = 0; y < Ranking.Length; y++)
            {
                tabelaRelatorio.Rows.Add(Ranking[y].cod_unid_negoc,
                                         Ranking[y].codestabel,
                                         Ranking[y].codrep,
                                         Ranking[y].des_unid_negoc,
                                         Ranking[y].nomeabrev,
                                         Convert.ToDecimal(Ranking[y].perc.Value).ToString("0.00"),
                                         Convert.ToDecimal(Ranking[y].vlcota.Value).ToString("0.00"),
                                         Convert.ToDecimal(Ranking[y].vldevolvido.Value).ToString("0.00"),
                                         Convert.ToDecimal(Ranking[y].vlfaturado.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);
    }
Esempio n. 19
0
    public DataSet ListagemTitulosClienteDoRepresentante(int codigoRepresentante, int codigoCliente, string codigoEstabelecimento, string statusTitulo, DateTime dtInicial, DateTime dtFinal)
    {
        //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("cidade", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codemitente", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("dtlimcred", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("estado", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("limcredito", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrevrepres", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeemit", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("totalgeral", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("totavencer", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("totvencido", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("cidade");
            tabelaRelatorio.Columns.Add("codemitente");
            tabelaRelatorio.Columns.Add("dtlimcred");
            tabelaRelatorio.Columns.Add("estado");
            tabelaRelatorio.Columns.Add("limcredito");
            tabelaRelatorio.Columns.Add("nomeabrevrepres");
            tabelaRelatorio.Columns.Add("nomeemit");
            tabelaRelatorio.Columns.Add("totalgeral");
            tabelaRelatorio.Columns.Add("totavencer");
            tabelaRelatorio.Columns.Add("totvencido");
            #endregion

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemTitulosClientesRepres_ttDevolucaoRow[] listaDeTitulos;
            ErpService.ListagemTitulosClientesRepres(codigoRepresentante, codigoCliente, codigoEstabelecimento, statusTitulo, dtInicial, dtFinal, out listaDeTitulos);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < listaDeTitulos.Length; i++)
            {
                #region Adcionando Valores na Tabela
                tabelaRelatorio.Rows.Add(listaDeTitulos[i].cidade,
                                         listaDeTitulos[i].codemitente,
                                         listaDeTitulos[i].dtlimcred,
                                         listaDeTitulos[i].estado,
                                         listaDeTitulos[i].limcredito,
                                         listaDeTitulos[i].nomeabrevrepres,
                                         listaDeTitulos[i].nomeemit,
                                         Convert.ToDecimal(listaDeTitulos[i].totalgeral.Value).ToString("0.00"),
                                         Convert.ToDecimal(listaDeTitulos[i].totavencer.Value).ToString("0.00"),
                                         Convert.ToDecimal(listaDeTitulos[i].totvencido.Value).ToString("0.00")
                                         );
                #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);
    }
Esempio n. 20
0
    public DataSet CurvaDetalheCliente(int codigoRepresentante, string codigoUnidadeNegocio, int codigoEmitente)
    {
        DataSet   dataSetPrincipal = new DataSet("dataSetPrincipal");
        DataTable tabelaRelatorio  = new DataTable("tabelaRelatorio");

        try
        {
            #region colunasDaTabela

            tabelaRelatorio.Columns.Add("familia");
            tabelaRelatorio.Columns.Add("produto");
            tabelaRelatorio.Columns.Add("descfamilia");
            tabelaRelatorio.Columns.Add("descproduto");
            tabelaRelatorio.Columns.Add("unidneg");
            tabelaRelatorio.Columns.Add("periodo1");
            tabelaRelatorio.Columns.Add("periodo2");
            tabelaRelatorio.Columns.Add("periodo3");
            tabelaRelatorio.Columns.Add("periodo4");
            tabelaRelatorio.Columns.Add("periodo5");
            tabelaRelatorio.Columns.Add("periodo6");
            tabelaRelatorio.Columns.Add("quantidade1");
            tabelaRelatorio.Columns.Add("quantidade2");
            tabelaRelatorio.Columns.Add("quantidade3");
            tabelaRelatorio.Columns.Add("quantidade4");
            tabelaRelatorio.Columns.Add("quantidade5");
            tabelaRelatorio.Columns.Add("quantidade6");
            tabelaRelatorio.Columns.Add("valor1");
            tabelaRelatorio.Columns.Add("valor2");
            tabelaRelatorio.Columns.Add("valor3");
            tabelaRelatorio.Columns.Add("valor4");
            tabelaRelatorio.Columns.Add("valor5");
            tabelaRelatorio.Columns.Add("valor6");
            tabelaRelatorio.Columns.Add("valortotal1");
            tabelaRelatorio.Columns.Add("valortotal2");
            tabelaRelatorio.Columns.Add("valortotal3");
            tabelaRelatorio.Columns.Add("valortotal4");
            tabelaRelatorio.Columns.Add("valortotal5");
            tabelaRelatorio.Columns.Add("valortotal6");
            tabelaRelatorio.Columns.Add("registros1");
            tabelaRelatorio.Columns.Add("registros2");
            tabelaRelatorio.Columns.Add("registros3");
            tabelaRelatorio.Columns.Add("registros4");
            tabelaRelatorio.Columns.Add("registros5");
            tabelaRelatorio.Columns.Add("registros6");
            tabelaRelatorio.Columns.Add("carteiraqtde");
            tabelaRelatorio.Columns.Add("carteiravalor");
            tabelaRelatorio.Columns.Add("carteiravalortotal");
            tabelaRelatorio.Columns.Add("carteiraregs");
            tabelaRelatorio.Columns.Add("faturadoqtde");
            tabelaRelatorio.Columns.Add("faturadovalor");
            tabelaRelatorio.Columns.Add("faturadovalortotal");
            tabelaRelatorio.Columns.Add("faturadoregs");

            #endregion

            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            CurvaDetalhadoCliente_ttDetalheRow[] ttDetalhe;
            ErpService.CurvaDetalhadoCliente(codigoRepresentante, codigoUnidadeNegocio, codigoEmitente, out ttDetalhe);

            //for (int j = 0; j < ttDetalhe[0].periodo.Length; j++)
            //{
            for (int i = 0; i < ttDetalhe.Length; i++)
            {
                #region variaveis



                var periodo1 = ttDetalhe[i].periodo[0];
                var periodo2 = ttDetalhe[i].periodo[1];
                var periodo3 = ttDetalhe[i].periodo[2];
                var periodo4 = ttDetalhe[i].periodo[3];
                var periodo5 = ttDetalhe[i].periodo[4];
                var periodo6 = ttDetalhe[i].periodo[5];

                var quantidade1 = ttDetalhe[i].quantidade[0].Value;
                var quantidade2 = ttDetalhe[i].quantidade[1].Value;
                var quantidade3 = ttDetalhe[i].quantidade[2].Value;
                var quantidade4 = ttDetalhe[i].quantidade[3].Value;
                var quantidade5 = ttDetalhe[i].quantidade[4].Value;
                var quantidade6 = ttDetalhe[i].quantidade[5].Value;

                var valor1 = Convert.ToDecimal(ttDetalhe[i].valor[0].Value).ToString("0.00");
                var valor2 = Convert.ToDecimal(ttDetalhe[i].valor[1].Value).ToString("0.00");
                var valor3 = Convert.ToDecimal(ttDetalhe[i].valor[2].Value).ToString("0.00");
                var valor4 = Convert.ToDecimal(ttDetalhe[i].valor[3].Value).ToString("0.00");
                var valor5 = Convert.ToDecimal(ttDetalhe[i].valor[4].Value).ToString("0.00");
                var valor6 = Convert.ToDecimal(ttDetalhe[i].valor[5].Value).ToString("0.00");

                var valortotal1 = Convert.ToDecimal(ttDetalhe[i].valortotal[0].Value).ToString("0.00");
                var valortotal2 = Convert.ToDecimal(ttDetalhe[i].valortotal[1].Value).ToString("0.00");
                var valortotal3 = Convert.ToDecimal(ttDetalhe[i].valortotal[2].Value).ToString("0.00");
                var valortotal4 = Convert.ToDecimal(ttDetalhe[i].valortotal[3].Value).ToString("0.00");
                var valortotal5 = Convert.ToDecimal(ttDetalhe[i].valortotal[4].Value).ToString("0.00");
                var valortotal6 = Convert.ToDecimal(ttDetalhe[i].valortotal[5].Value).ToString("0.00");

                var registros1 = ttDetalhe[i].registros[0].Value;
                var registros2 = ttDetalhe[i].registros[1].Value;
                var registros3 = ttDetalhe[i].registros[2].Value;
                var registros4 = ttDetalhe[i].registros[3].Value;
                var registros5 = ttDetalhe[i].registros[4].Value;
                var registros6 = ttDetalhe[i].registros[5].Value;

                #endregion

                #region adicionandoLinhas
                tabelaRelatorio.Rows.Add(
                    ttDetalhe[i].familia,
                    ttDetalhe[i].produto,
                    ttDetalhe[i].descfamilia,
                    ttDetalhe[i].descproduto,
                    ttDetalhe[i].unidneg,
                    periodo1,
                    periodo2,
                    periodo3,
                    periodo4,
                    periodo5,
                    periodo6,
                    quantidade1,
                    quantidade2,
                    quantidade3,
                    quantidade4,
                    quantidade5,
                    quantidade6,
                    valor1,
                    valor2,
                    valor3,
                    valor4,
                    valor5,
                    valor6,
                    valortotal1,
                    valortotal2,
                    valortotal3,
                    valortotal4,
                    valortotal5,
                    valortotal6,
                    registros1,
                    registros2,
                    registros3,
                    registros4,
                    registros5,
                    registros6,
                    ttDetalhe[i].carteiraqtde,
                    Convert.ToDecimal(ttDetalhe[i].carteiravalor).ToString("0.00"),
                    Convert.ToDecimal(ttDetalhe[i].carteiravalortotal).ToString("0.00"),
                    ttDetalhe[i].carteiraregs,
                    ttDetalhe[i].faturadoqtde,
                    Convert.ToDecimal(ttDetalhe[i].faturadovalor).ToString("0.00"),
                    Convert.ToDecimal(ttDetalhe[i].faturadovalortotal).ToString("0.00"),
                    ttDetalhe[i].faturadoregs
                    );
                #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);
        }

        dataSetPrincipal.Tables.Add(tabelaRelatorio);

        return(dataSetPrincipal);
    }
Esempio n. 21
0
    public DataSet ListagemTitulosCliente(int codigoCliente, string statusTitulo, string codigoEstabelecimento, DateTime dtInicial, DateTime dtFinal)
    {
        //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("codparcela", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codtitacr", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codtitacrbco", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("datvecto", typeof(DateTime)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("desespecdocto", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("diasatraso", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeportador", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nrnotafis", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("sernotafis", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("titstatus", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("valcartorio", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("valsaldo", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("codparcela");
            tabelaRelatorio.Columns.Add("codtitacr");
            tabelaRelatorio.Columns.Add("codtitacrbco");
            tabelaRelatorio.Columns.Add("datvecto");
            tabelaRelatorio.Columns.Add("desespecdocto");
            tabelaRelatorio.Columns.Add("diasatraso");
            tabelaRelatorio.Columns.Add("nomeportador");
            tabelaRelatorio.Columns.Add("nrnotafis");
            tabelaRelatorio.Columns.Add("sernotafis");
            tabelaRelatorio.Columns.Add("titstatus");
            tabelaRelatorio.Columns.Add("valcartorio");
            tabelaRelatorio.Columns.Add("valsaldo");
            #endregion

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;
            ListagemTitulosCliente_ttTitAcrRow[] listaDeTitulos;
            ErpService.ListagemTitulosCliente(codigoCliente, codigoEstabelecimento, statusTitulo, dtInicial, dtFinal, out listaDeTitulos);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int i = 0; i < listaDeTitulos.Length; i++)
            {
                #region Adcionando Valores na Tabela
                tabelaRelatorio.Rows.Add(listaDeTitulos[i].codparcela,
                                         listaDeTitulos[i].codtitacr,
                                         listaDeTitulos[i].codtitacrbco,
                                         listaDeTitulos[i].datvecto,
                                         listaDeTitulos[i].desespecdocto,
                                         listaDeTitulos[i].diasatraso,
                                         listaDeTitulos[i].nomeportador,
                                         listaDeTitulos[i].nrnotafis,
                                         listaDeTitulos[i].sernotafis,
                                         listaDeTitulos[i].titstatus,
                                         Convert.ToDecimal(listaDeTitulos[i].valcartorio.Value).ToString("0.00"),
                                         Convert.ToDecimal(listaDeTitulos[i].valsaldo.Value).ToString("0.00")
                                         );
                #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);
    }
Esempio n. 22
0
    public DataSet FaturamentoPorEstabelecimento(string codigoEstabelecimento, string codigoRepresentante, string codigoUnidadeNegocio, DateTime dtInicial, DateTime dtFinal)
    {
        //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("cod_unid_negoc_faturamento", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codestabel_faturamento", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codgerente_faturamento", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("codrep_faturamento", typeof(int)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("des_unid_negoc", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomeabrev_faturamento", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("nomegerente", typeof(string)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("pccota_faturamento", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlcarteira_faturamento", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlcota_faturamento", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vldevolvido_faturamento", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlfaturado_faturamento", typeof(decimal)).AllowDBNull = true;
            //tabelaRelatorio.Columns.Add("vlorcamento_faturamento", typeof(decimal)).AllowDBNull = true;
            tabelaRelatorio.Columns.Add("cod_unid_negoc_faturamento");
            tabelaRelatorio.Columns.Add("codestabel_faturamento");
            tabelaRelatorio.Columns.Add("codgerente_faturamento");
            tabelaRelatorio.Columns.Add("codrep_faturamento");
            tabelaRelatorio.Columns.Add("des_unid_negoc");
            tabelaRelatorio.Columns.Add("nomeabrev_faturamento");
            tabelaRelatorio.Columns.Add("nomegerente");
            tabelaRelatorio.Columns.Add("pccota_faturamento");
            tabelaRelatorio.Columns.Add("vlcarteira_faturamento");
            tabelaRelatorio.Columns.Add("vlcota_faturamento");
            tabelaRelatorio.Columns.Add("vldevolvido_faturamento");
            tabelaRelatorio.Columns.Add("vlfaturado_faturamento");
            tabelaRelatorio.Columns.Add("vlorcamento_faturamento");

            //CONSUMINDO WEBSERVICES DO ERP
            relatoriosB2BObjClient ErpService = new relatoriosB2BObjClient();
            //ErpService.Timeout = 99999999;

            FaturamentoPorEstabelec_ttFaturamentoRow[] Faturamento;
            ErpService.FaturamentoPorEstabelec(codigoEstabelecimento, codigoRepresentante, codigoUnidadeNegocio, Convert.ToDateTime(dtInicial.ToString("yyyy/MM/dd")), Convert.ToDateTime(dtFinal.ToString("yyyy/MM/dd")), out Faturamento);

            //LOOP PARA POPULAR OS DADOS NA TABELA
            for (int z = 0; z < Faturamento.Length; z++)
            {
                tabelaRelatorio.Rows.Add(Faturamento[z].cod_unid_negoc,
                                         Faturamento[z].codestabel,
                                         Faturamento[z].codgerente.Value,
                                         Faturamento[z].codrep.Value,
                                         Faturamento[z].des_unid_negoc,
                                         Faturamento[z].nomeabrev,
                                         Faturamento[z].nomegerente,
                                         Convert.ToDecimal(Faturamento[z].pccota.Value).ToString("0.00"),
                                         Convert.ToDecimal(Faturamento[z].vlcarteira.Value).ToString("0.00"),
                                         Convert.ToDecimal(Faturamento[z].vlcota.Value).ToString("0.00"),
                                         Convert.ToDecimal(Faturamento[z].vldevolvido.Value).ToString("0.00"),
                                         Convert.ToDecimal(Faturamento[z].vlfaturado.Value).ToString("0.00"),
                                         Convert.ToDecimal(Faturamento[z].vlorcamento.Value).ToString("0.00"));

                //EventLog.WriteEntry("Report Faturamento", Faturamento[z].cod_unid_negoc + "\n" +
                //                            Faturamento[z].codestabel + "\n" +
                //                            Faturamento[z].codgerente.Value + "\n" +
                //                            Faturamento[z].codrep.Value + "\n" +
                //                            Faturamento[z].des_unid_negoc + "\n" +
                //                            Faturamento[z].nomeabrev + "\n" +
                //                            Faturamento[z].nomegerente + "\n" +
                //                            Faturamento[z].pccota.Value + "\n" +
                //                            Faturamento[z].vlcarteira.Value + "\n" +
                //                            Faturamento[z].vlcota.Value + "\n" +
                //                            Faturamento[z].vldevolvido.Value + "\n" +
                //                            Faturamento[z].vlfaturado.Value + "\n" +
                //                            Faturamento[z].vlorcamento.Value);
            }
        }
        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);
    }