コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptConVen rpt = new RptConVen();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     RptConVen rpt = new RptConVen();
     rpt.Site = this.Site;
     return rpt;
 }
コード例 #3
0
        private void FrmRelGeral_Load(object sender, EventArgs e)
        {
            try
            {
                #region Relatorio Cliente


                if (_princ == "FrmConCli")
                {
                    //Instancio o FormConsulta
                    FrmConCli x            = (FrmConCli)_pdv;
                    RptConCli objRptConPDV = new RptConCli();

                    //Instancio o Relatorio
                    RptConCli objRptConCli = new RptConCli();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();

                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datatable criado no dataset
                    dtAdapter.Fill(oDataset, "RelCliente");

                    objRptConCli.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource     = objRptConCli;
                }
                #endregion

                #region Relatorio Pedido
                if (_princ == "FrmConPDV")
                {
                    ImprimirRelPed();
                }
                #endregion

                #region relatorio vendedor

                if (_princ == "FrmConVen")
                {
                    //Instancio o FormConsulta
                    FrmConVen x = (FrmConVen)_pdv;

                    RptConVen objRptConPDV = new RptConVen();

                    //Instancio o Relatorio
                    RptConVen objRptConVen = new RptConVen();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelVendedor");

                    objRptConVen.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource     = objRptConVen;
                }

                #endregion

                #region relatorio produto

                if (_princ == "FrmConProd")
                {
                    //Instancio o FormConsulta
                    FrmConProd x = (FrmConProd)_pdv;

                    //Instancio o Relatorio
                    RptConProd objRptConProd = new RptConProd();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelProduto");

                    objRptConProd.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource     = objRptConProd;
                }

                #endregion

                #region relatorio Estoque

                if (_princ == "FrmConEstProd")
                {
                    //Instancio o FormConsulta
                    FrmConEstProd x = (FrmConEstProd)_pdv;

                    //Instancio o Relatorio
                    RptConEstoque objRptConEst = new RptConEstoque();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelEstoque");

                    objRptConEst.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource     = objRptConEst;
                }

                #endregion

                if (_princ == "FrmEmiNF")
                {
                    //Instancio o FormConsulta
                    FrmLibPDV x = (FrmLibPDV)_pdv;

                    //Instancio o Relatorio
                    RptConNF objRptConNF = new RptConNF();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();


                    string sql = string.Format("SELECT nf.*, ((nf.icms * itnf.valor)/100)*itnf.Quantidade as valoricms , itnf.*,((itnf.IPI * itnf.valor)/100)*itnf.Quantidade as valorIPI,tra.NOME as DescricaoTransp, " +
                                               " tra.UF as UfTrans, tra.CNPJ as CnpjTrans, tra.ENDERECO as EnderecoTrans, tra.MUNICIPIO as MunicipioTrans, tra.IE as IeTrans, " +
                                               " ( " +
                                               " select SUM(((n.icms * i.valor)/100)*i.Quantidade) " +
                                               " from NOTAFISCAL n inner join ItemNotaFiscal i on n.NrNotaFiscal = i.NrNotaFiscal " +
                                               " where n.NrNotaFiscal = nf.nrNotaFiscal " +
                                               " )total_ICMS, " +
                                               " ( " +
                                               " 	select SUM(((i.IPI * i.valor)/100)*i.Quantidade) "+
                                               " from NOTAFISCAL n inner join ItemNotaFiscal i on n.NrNotaFiscal = i.NrNotaFiscal " +
                                               " where n.NrNotaFiscal = nf.nrNotaFiscal " +
                                               " )total_IPI " +
                                               " FROM NOTAFISCAL nf INNER JOIN ItemNotaFiscal itnf ON nf.NrNotaFiscal = itnf.NrNotaFiscal " +
                                               " 					INNER JOIN TRANSPORTADORA tra ON nf.CodTransportadora = tra.CNPJ WHERE nf.NrPedido = {0}", x.txtbtnPedido.Text);

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(sql, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelNotaFiscal");

                    objRptConNF.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource     = objRptConNF;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        private void FrmRelGeral_Load(object sender, EventArgs e)
        {
            try
            {
                #region Relatorio Cliente

                if (_princ == "FrmConCli")
                {
                    //Instancio o FormConsulta
                    FrmConCli x = (FrmConCli)_pdv;
                    RptConCli objRptConPDV = new RptConCli();

                    //Instancio o Relatorio
                    RptConCli objRptConCli = new RptConCli();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();

                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datatable criado no dataset
                    dtAdapter.Fill(oDataset, "RelCliente");

                    objRptConCli.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConCli;
                }
                #endregion

                #region Relatorio Pedido
                if (_princ == "FrmConPDV")
                {

                    ImprimirRelPed();

                }
                #endregion

                #region relatorio vendedor

                if (_princ == "FrmConVen")
                {
                    //Instancio o FormConsulta
                    FrmConVen x = (FrmConVen)_pdv;

                    RptConVen objRptConPDV = new RptConVen();

                    //Instancio o Relatorio
                    RptConVen objRptConVen = new RptConVen();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelVendedor");

                    objRptConVen.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConVen;
                }

                #endregion

                #region relatorio produto

                if (_princ == "FrmConProd")
                {
                    //Instancio o FormConsulta
                    FrmConProd x = (FrmConProd)_pdv;

                    //Instancio o Relatorio
                    RptConProd objRptConProd = new RptConProd();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelProduto");

                    objRptConProd.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConProd;
                }

                #endregion

                #region relatorio Estoque

                if (_princ == "FrmConEstProd")
                {
                    //Instancio o FormConsulta
                    FrmConEstProd x = (FrmConEstProd)_pdv;

                    //Instancio o Relatorio
                    RptConEstoque objRptConEst = new RptConEstoque();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    //Recebo a String SQL feita na tela de consulta
                    string StringConnection = x.pesquisar();

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelEstoque");

                    objRptConEst.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConEst;
                }

                #endregion

                if (_princ == "FrmEmiNF")
                {
                    //Instancio o FormConsulta
                    FrmLibPDV x = (FrmLibPDV)_pdv;

                    //Instancio o Relatorio
                    RptConNF objRptConNF = new RptConNF();

                    //Instancio o Dataset
                    COMERCIALDataSet oDataset = new COMERCIALDataSet();

                    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
                    //Crio a Conexão
                    SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);

                    //Abro a conexão
                    sqlcon.Open();

                    string sql = string.Format("SELECT nf.*, ((nf.icms * itnf.valor)/100)*itnf.Quantidade as valoricms , itnf.*,((itnf.IPI * itnf.valor)/100)*itnf.Quantidade as valorIPI,tra.NOME as DescricaoTransp, " +
                        " tra.UF as UfTrans, tra.CNPJ as CnpjTrans, tra.ENDERECO as EnderecoTrans, tra.MUNICIPIO as MunicipioTrans, tra.IE as IeTrans, "+
                        " ( "+
                        " select SUM(((n.icms * i.valor)/100)*i.Quantidade) " +
                        " from NOTAFISCAL n inner join ItemNotaFiscal i on n.NrNotaFiscal = i.NrNotaFiscal "+
                        " where n.NrNotaFiscal = nf.nrNotaFiscal "+
                        " )total_ICMS, "+
                        " ( "+
                        " 	select SUM(((i.IPI * i.valor)/100)*i.Quantidade) " +
                        " from NOTAFISCAL n inner join ItemNotaFiscal i on n.NrNotaFiscal = i.NrNotaFiscal "+
                        " where n.NrNotaFiscal = nf.nrNotaFiscal "+
                        " )total_IPI "+
                        " FROM NOTAFISCAL nf INNER JOIN ItemNotaFiscal itnf ON nf.NrNotaFiscal = itnf.NrNotaFiscal " +
                        " 					INNER JOIN TRANSPORTADORA tra ON nf.CodTransportadora = tra.CNPJ WHERE nf.NrPedido = {0}", x.txtbtnPedido.Text);

                    SqlDataAdapter dtAdapter = new SqlDataAdapter(sql, sqlcon);

                    //Localiso o datateble criado no dataset
                    dtAdapter.Fill(oDataset, "RelNotaFiscal");

                    objRptConNF.SetDataSource(oDataset);

                    //atribiu o resultado ao CristalReportView
                    crstlRprtVwrRel.DisplayGroupTree = false;
                    crstlRprtVwrRel.ReportSource = objRptConNF;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }