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; } }
private void faturamentoDoPedidoToolStripMenuItem_Click(object sender, EventArgs e) { int x = 0, y = 0; // Localiza o formulario foreach (Form form in this.MdiChildren) { if (form is FrmLibPDV) { form.WindowState = FormWindowState.Maximized; form.Activate(); x++; } y++; } // Para criar o formulario if (x == 0 && y == 0) { FrmLibPDV filho = new FrmLibPDV(this); filho.Show(); tlStrpProcesso.Visible = true; tlStrpBtnLibPed.Visible = true; bindingNavigator1.Visible = false; tlStrpBtnPesquisar.Visible = true; tsbhomeProcesso.Visible = true; tsbCancelarPedido.Visible = true; tsbCancelarPedido.Text = "Cancelar Pedido"; // Util.Interface.ResetControls(filho); //Util.Interface.ChangeControlStatus(filho, false); filho.WindowState = FormWindowState.Maximized; } }