Example #1
0
        private LIS_PRODUTOOSFECHCollection ProdutoRel(int IDFUNCIONARIO)
        {
            LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl = new LIS_PRODUTOOSFECHCollection();
            LIS_PRODUTOOSFECHProvider   LIS_PRODUTOOSFECHP    = new LIS_PRODUTOOSFECHProvider();

            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDFUNCIONARIO", "System.Int32", "=", IDFUNCIONARIO.ToString()));

            string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
            string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

            RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial));
            RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal));

            if (rdOrcamento.Checked)
            {
                RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
            }
            else if (rdVenda.Checked)
            {
                RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
            }

            if (Convert.ToInt32(cbStatus.SelectedValue) > 0)
            {
                RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", Convert.ToInt32(cbStatus.SelectedValue).ToString()));
            }

            LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

            return(LIS_PRODUTOOSFECHColl);
        }
Example #2
0
        private LIS_PRODUTOOSFECHCollection ProdutoRel(int IDORDEMSERVICO)
        {
            LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl = new LIS_PRODUTOOSFECHCollection();
            LIS_PRODUTOOSFECHProvider   LIS_PRODUTOOSFECHP    = new LIS_PRODUTOOSFECHProvider();

            try
            {
                RowRelatorio.Clear();

                if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDFUNCIONARIO", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString()));
                }

                RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));

                LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

                return(LIS_PRODUTOOSFECHColl);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
                return(LIS_PRODUTOOSFECHColl);
            }
        }
Example #3
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                try
                {
                    RowRelatorio.Clear();
                    string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                    string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial));
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal));

                    if (Convert.ToInt32(cbGrupoCategoria.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("idgrupocategoria", "System.Int32", "=", Convert.ToInt32(cbGrupoCategoria.SelectedValue).ToString()));
                    }

                    if (Convert.ToInt32(cbProduto.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString()));
                    }

                    if (rbOrcamentoPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
                    }

                    if (rbVendasPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
                    }

                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC");

                    LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECH2Coll = new LIS_PRODUTOOSFECHCollection();
                    foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl)
                    {
                        // if (LIS_PRODUTOOSFECH2Coll.Find(delegate(LIS_PRODUTOOSFECHEntity item2) { return (item2.IDPRODUTO == item.IDPRODUTO); }) == null)
                        if (LIS_PRODUTOOSFECH2Coll.Find(delegate(LIS_PRODUTOOSFECHEntity item2) { return(item2.IDGRUPOCATEGORIA == item.IDGRUPOCATEGORIA); }) == null)
                        {
                            LIS_PRODUTOOSFECH2Coll.Add(item);
                        }
                    }

                    LIS_PRODUTOOSFECHColl.Clear();
                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECH2Coll;

                    PreencheGrid();
                }
                catch (Exception EX)
                {
                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }
Example #4
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                CreaterCursor Cr = new CreaterCursor();
                this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

                try
                {
                    RowRelatorio.Clear();
                    string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                    string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial));
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal));

                    if (Convert.ToInt32(cbGrupoCategoria.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("idgrupocategoria", "System.Int32", "=", Convert.ToInt32(cbGrupoCategoria.SelectedValue).ToString()));
                    }

                    if (Convert.ToInt32(cbProduto.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString()));
                    }

                    if (rbOrcamentoPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
                    }

                    if (rbVendasPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
                    }

                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC");

                    PreencheGrid();
                    this.Cursor = Cursors.Default;
                }
                catch (Exception EX)
                {
                    this.Cursor = Cursors.Default;

                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }
Example #5
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                try
                {
                    RowRelatorio.Clear();
                    string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                    string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

                    if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("IDFUNCIONARIO", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString()));
                    }

                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial));
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal));

                    if (rdOrcamento.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
                    }
                    else if (rdVenda.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
                    }

                    if (Convert.ToInt32(cbStatus.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", Convert.ToInt32(cbStatus.SelectedValue).ToString()));
                    }

                    LIS_SERVICOOSFECHColl = LIS_SERVICOOSFECHP.ReadCollectionByParameter(RowRelatorio, "DATAEMISSAO DESC");
                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "DATAEMISSAO DESC");

                    PreencheGrid2();
                    PreencheGrid3();
                }
                catch (Exception EX)
                {
                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }
Example #6
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                try
                {
                    RowRelatorio.Clear();

                    string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                    string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

                    RowRelatorio.Add(new RowsFiltro("dataemissao", "System.DateTime", ">=", DataInicial));
                    RowRelatorio.Add(new RowsFiltro("dataemissao", "System.DateTime", "<=", DataFinal));

                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

                    //Remove ID  repetido
                    LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECH2Coll = new LIS_PRODUTOOSFECHCollection();
                    foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl)
                    {
                        if (LIS_PRODUTOOSFECH2Coll.Find(delegate(LIS_PRODUTOOSFECHEntity item2)
                        {
                            return
                            (item2.IDPRODUTO == item.IDPRODUTO);
                        }) == null)
                        {
                            LIS_PRODUTOOSFECH2Coll.Add(item);
                        }
                    }

                    LIS_PRODUTOOSFECHColl.Clear();
                    LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECH2Coll;

                    PreencheGrid();
                }
                catch (Exception EX)
                {
                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }
Example #7
0
        private void QuantProduto(int IDPRODUTO)
        {
            LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl = new LIS_PRODUTOOSFECHCollection();
            LIS_PRODUTOOSFECHProvider   LIS_PRODUTOOSFECHP    = new LIS_PRODUTOOSFECHProvider();

            string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
            string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("dataemissao", "System.DateTime", ">=", DataInicial));
            RowRelatorio.Add(new RowsFiltro("dataemissao", "System.DateTime", "<=", DataFinal));
            RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", IDPRODUTO.ToString()));

            LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

            foreach (var LIS_PRODUTOSPEDIDOTy in LIS_PRODUTOOSFECHColl)
            {
                QuantTotal += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy.QUANTIDADE);
                ValorTotal += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy.VALORTOTAL);
            }
        }
Example #8
0
        private void FrmRelatPedidoVendas_Load(object sender, EventArgs e)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            EMPRESAProvider   EMPRESAP    = new EMPRESAProvider();
            EMPRESACollection EMPRESAColl = new EMPRESACollection();

            EMPRESAColl = EMPRESAP.ReadCollectionByParameter(null);

            //Logomarca
            CONFISISTEMAProvider CONFISISTEMAP  = new CONFISISTEMAProvider();
            CONFISISTEMAEntity   CONFISISTEMAty = CONFISISTEMAP.Read(1);

            if (CONFISISTEMAty.FLAGLOGORELATORIO == "S")
            {
                if (CONFISISTEMAty.IDARQUIVOBINARIO1 != null)
                {
                    ARQUIVOBINARIOProvider   ARQUIVOBINARIOP    = new ARQUIVOBINARIOProvider();
                    ARQUIVOBINARIOCollection ARQUIVOBINARIOColl = new ARQUIVOBINARIOCollection();
                    RowRelatorio.Clear();
                    RowRelatorio.Add(new RowsFiltro("IDARQUIVOBINARIO", "System.Int32", "=", CONFISISTEMAty.IDARQUIVOBINARIO1.ToString()));
                    ARQUIVOBINARIOColl = ARQUIVOBINARIOP.ReadCollectionByParameter(RowRelatorio);
                    this.ARQUIVOBINARIOCollectionBindingSource.DataSource = ARQUIVOBINARIOColl;
                }
            }

            //Dados do Cliente
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDCLIENTE", "System.Int32", "=", idcliente.ToString()));
            LIS_CLIENTEProvider LIS_CLIENTEP = new LIS_CLIENTEProvider();

            LIS_CLIENTEColl = LIS_CLIENTEP.ReadCollectionByParameter(RowRelatorio);
            string cpfcnpjPar = (LIS_CLIENTEColl[0].CNPJ == "  .   .   /    -" || LIS_CLIENTEColl[0].CNPJ == string.Empty) ? LIS_CLIENTEColl[0].CPF : LIS_CLIENTEColl[0].CNPJ;

            //Dados do Pedido
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));
            LIS_ORDEMSERVICOSFECHProvider LIS_ORDEMSERVICOSFECHP = new LIS_ORDEMSERVICOSFECHProvider();

            LIS_ORDEMSERVICOSFECHColl = LIS_ORDEMSERVICOSFECHP.ReadCollectionByParameter(RowRelatorio);

            //Dados do Produto
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));
            LIS_PRODUTOOSFECHProvider LIS_PRODUTOOSFECHP = new LIS_PRODUTOOSFECHProvider();

            LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

            //Dados do Produto MTQ
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));
            LIS_PRODUTOSPEDIDOMTQOSProvider LIS_PRODUTOSPEDIDOMTQOSP = new LIS_PRODUTOSPEDIDOMTQOSProvider();

            LIS_PRODUTOSPEDIDOMTQOSColl = LIS_PRODUTOSPEDIDOMTQOSP.ReadCollectionByParameter(RowRelatorio);

            //Dados Servicos
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));
            LIS_SERVICOOSFECHProvider LIS_SERVICOOSFECHP = new LIS_SERVICOOSFECHProvider();

            LIS_SERVICOOSFECHColl = LIS_SERVICOOSFECHP.ReadCollectionByParameter(RowRelatorio);

            //Dados Equipamento
            RowRelatorio.Clear();
            RowRelatorio.Add(new RowsFiltro("IDORDEMSERVICO", "System.Int32", "=", IDORDEMSERVICO.ToString()));
            LIS_EQUIPAMENTOOSFECHProvider   LIS_EQUIPAMENTOOSFECHP    = new LIS_EQUIPAMENTOOSFECHProvider();
            LIS_EQUIPAMENTOOSFECHCollection LIS_EQUIPAMENTOOSFECHColl = new LIS_EQUIPAMENTOOSFECHCollection();

            LIS_EQUIPAMENTOOSFECHColl = LIS_EQUIPAMENTOOSFECHP.ReadCollectionByParameter(RowRelatorio);

            if (LIS_SERVICOOSFECHColl.Count > 0)
            {
                listaservicoSelec = "true";
            }

            string titulo = "Nº O.S " + IDORDEMSERVICO.ToString().PadLeft(6, '0');

            if (LIS_ORDEMSERVICOSFECHColl[0].FLAGORCAMENTO.TrimEnd() == "S")
            {
                titulo = "Nº ORÇAMENTO " + IDORDEMSERVICO.ToString().PadLeft(6, '0');
            }

            decimal totalproduto = 0;

            foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl)
            {
                totalproduto      += Convert.ToDecimal(item.VALORTOTAL);
                listaproduto1Selec = "true";
            }

            foreach (LIS_PRODUTOSPEDIDOMTQOSEntity item in LIS_PRODUTOSPEDIDOMTQOSColl)
            {
                totalproduto      += Convert.ToDecimal(item.VALORTOTAL);
                listaproduto2Selec = "true";
            }

            if (LIS_EQUIPAMENTOOSFECHColl.Count > 0)
            {
                ListaEquipamento = "true";
            }

            //setando os parametro
            Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[6];
            p[0] = new Microsoft.Reporting.WinForms.ReportParameter("CPFCNPJ", cpfcnpjPar);
            p[1] = new Microsoft.Reporting.WinForms.ReportParameter("titulo", titulo.ToString().PadLeft(6, '0'));
            p[2] = new Microsoft.Reporting.WinForms.ReportParameter("totalproduto", totalproduto.ToString("N2"));
            p[3] = new Microsoft.Reporting.WinForms.ReportParameter("listaproduto1", listaproduto1Selec);
            p[4] = new Microsoft.Reporting.WinForms.ReportParameter("listaproduto2", listaproduto2Selec);
            p[5] = new Microsoft.Reporting.WinForms.ReportParameter("listaservico", listaservicoSelec);

            reportViewer1.LocalReport.SetParameters(p);

            this.LIS_CLIENTECollectionBindingSource.DataSource             = LIS_CLIENTEColl;
            this.EMPRESACollectionBindingSource.DataSource                 = EMPRESAColl;
            this.LIS_ORDEMSERVICOSFECHCollectionBindingSource.DataSource   = LIS_ORDEMSERVICOSFECHColl;
            this.LIS_PRODUTOOSFECHCollectionBindingSource.DataSource       = LIS_PRODUTOOSFECHColl;
            this.LIS_PRODUTOSPEDIDOMTQOSCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDOMTQOSColl;
            this.LIS_SERVICOOSFECHCollectionBindingSource.DataSource       = LIS_SERVICOOSFECHColl;
            LIS_EQUIPAMENTOOSFECHCollectionBindingSource.DataSource        = LIS_EQUIPAMENTOOSFECHColl;

            this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
            this.reportViewer1.ZoomMode = ZoomMode.Percent;
            this.reportViewer1.RefreshReport();

            this.Cursor = Cursors.Default;
        }
Example #9
0
        private void PreencheGrid3()
        {
            //Remove Vendedor Repetido
            LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl2 = new LIS_PRODUTOOSFECHCollection();

            foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl)
            {
                if (LIS_PRODUTOOSFECHColl2.Find(delegate(LIS_PRODUTOOSFECHEntity item2) { return(item2.IDFUNCIONARIO == item.IDFUNCIONARIO && item.IDFUNCIONARIO != null && item.IDFUNCIONARIO > 0); }) == null)
                {
                    LIS_PRODUTOOSFECHColl2.Add(item);
                }
            }

            LIS_PRODUTOOSFECHColl.Clear();
            LIS_PRODUTOOSFECHColl = LIS_PRODUTOOSFECHColl2;

            TotalGeralPedido = 0;


            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            dataGridView1.Rows.Clear();
            //LIS_PRODUTOOSFECHColl2.Clear();
            foreach (var LIS_PEDIDOTy in LIS_PRODUTOOSFECHColl)
            {
                if (LIS_PEDIDOTy.IDFUNCIONARIO != null && LIS_PEDIDOTy.IDFUNCIONARIO > 0)
                {
                    //Cabeçalho - Nome do Vendedor
                    DataGridViewRow rowCabec = new DataGridViewRow();
                    rowCabec.CreateCells(dataGridView1, LIS_PEDIDOTy.NOMEFUNCIONARIO);
                    rowCabec.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    dataGridView1.Rows.Add(rowCabec);


                    DataGridViewRow row4_2 = new DataGridViewRow();
                    row4_2.CreateCells(dataGridView1, "Produto", "Quant.", "Total");
                    row4_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    dataGridView1.Rows.Add(row4_2);

                    LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl3 = new LIS_PRODUTOOSFECHCollection();
                    LIS_PRODUTOOSFECHColl3 = ProdutoRel(Convert.ToInt32(LIS_PEDIDOTy.IDFUNCIONARIO));

                    foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl3)
                    {
                        DataGridViewRow row5 = new DataGridViewRow();
                        row5.CreateCells(dataGridView1, item.NOMEPRODUTO, Convert.ToDecimal(item.QUANTIDADE).ToString(), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"));
                        row5.DefaultCellStyle.Font = new Font("Arial", 8);
                        dataGridView1.Rows.Add(row5);

                        SubGeralPedido += Convert.ToDecimal(item.VALORTOTAL);
                    }

                    TotalGeralPedido += Convert.ToDecimal(SubGeralPedido);

                    DataGridViewRow rowLinhaSubTotal = new DataGridViewRow();
                    rowLinhaSubTotal.CreateCells(dataGridView1, "", "Sub-Total", SubGeralPedido.ToString("n2"));
                    rowLinhaSubTotal.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    dataGridView1.Rows.Add(rowLinhaSubTotal);

                    DataGridViewRow rowLinha1 = new DataGridViewRow();
                    rowLinha1.CreateCells(dataGridView1, "______________________________________", "_________", "_________");
                    rowLinha1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    dataGridView1.Rows.Add(rowLinha1);
                }
            }

            //Total Geral
            DataGridViewRow rowTotalGeral = new DataGridViewRow();

            rowTotalGeral.CreateCells(dataGridView1, "______________________________________", "_________", TotalGeralPedido.ToString("n2"));
            rowTotalGeral.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
            dataGridView1.Rows.Add(rowTotalGeral);


            this.Cursor = Cursors.Default;
        }
Example #10
0
        private void PreencheGrid()
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                TotalGeralPedido            = 0;
                TotalGeralComissao          = 0;
                SubTotalComissaoFuncionario = 0;

                DataGriewDados.Rows.Clear();

                DataGridViewRow rowTop = new DataGridViewRow();
                rowTop.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________", "__________");
                rowTop.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(rowTop);

                DataGridViewRow row1 = new DataGridViewRow();
                row1.CreateCells(DataGriewDados, "O.S", "EMISSÃO", "CLIENTE", "STATUS", "FUNCIONÁRIO", "TOTAL O.S", "COMISSÃO");
                row1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(row1);

                FUNCIONARIOProvider FUNCIONARIOP = new FUNCIONARIOProvider();

                string ComissaoporOS = "0";

                foreach (var LIS_PEDIDOTy in LIS_ORDEMSERVICOSFECHColl)
                {
                    decimal?ComissaoFuncionario = 0;

                    string DataEmissao = string.Empty;
                    if (LIS_PEDIDOTy.IDORDEMSERVICO != null)
                    {
                        DataEmissao = Convert.ToDateTime(LIS_PEDIDOTy.DATAEMISSAO).ToString("dd/MM/yyyy");
                    }

                    string TotalPedido   = Convert.ToDecimal(LIS_PEDIDOTy.TOTALFECHOS).ToString("n2");
                    string TotalComissao = "0"; //Convert.ToDecimal(LIS_PEDIDOTy.VLCOMISSAO).ToString("n2");

                    if (!chkExibirProdutos.Checked)
                    {
                        ComissaoFuncionario = 0;
                        FUNCIONARIOEntity FUNCIONARIOTy = new FUNCIONARIOEntity();
                        FUNCIONARIOTy = FUNCIONARIOP.Read(Convert.ToInt32(LIS_PEDIDOTy.IDFUNCIONARIO));
                        if (FUNCIONARIOTy != null)
                        {
                            ComissaoFuncionario = FUNCIONARIOTy.COMISSAO;
                        }

                        ComissaoporOS = (Convert.ToDecimal(LIS_PEDIDOTy.TOTALFECHOS * Convert.ToDecimal(ComissaoFuncionario)) / 100).ToString("n2");
                        SubTotalComissaoFuncionario += Convert.ToDecimal(ComissaoporOS);
                    }

                    DataGridViewRow row2 = new DataGridViewRow();
                    row2.CreateCells(DataGriewDados, LIS_PEDIDOTy.IDORDEMSERVICO, DataEmissao, LIS_PEDIDOTy.NOMECLIENTE, LIS_PEDIDOTy.NOMESTATUS, LIS_PEDIDOTy.NOMEFUNCIONARIO, TotalPedido, ComissaoporOS);
                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    DataGriewDados.Rows.Add(row2);

                    TotalGeralPedido += Convert.ToDecimal(TotalPedido);

                    if (chkExibirProdutos.Checked)
                    {
                        //Produtos
                        DataGridViewRow row3 = new DataGridViewRow();
                        row3.CreateCells(DataGriewDados, "PRODUTOS");
                        row3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(row3);

                        //Cabeçalho do produto
                        DataGridViewRow row4 = new DataGridViewRow();
                        row4.CreateCells(DataGriewDados, "Quant.", "Total", "Produtos");
                        row4.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(row4);

                        LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl = new LIS_PRODUTOOSFECHCollection();
                        LIS_PRODUTOOSFECHColl = ProdutoRel(Convert.ToInt32(LIS_PEDIDOTy.IDORDEMSERVICO));
                        foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHColl)
                        {
                            ComissaoFuncionario = 0;
                            FUNCIONARIOEntity FUNCIONARIOTy = new FUNCIONARIOEntity();
                            FUNCIONARIOTy = FUNCIONARIOP.Read(Convert.ToInt32(item.IDFUNCIONARIO));
                            if (FUNCIONARIOTy != null)
                            {
                                ComissaoFuncionario = FUNCIONARIOTy.COMISSAO;
                            }

                            SubTotalComissaoFuncionario = Convert.ToDecimal(item.VALORTOTAL * ComissaoFuncionario) / 100;

                            DataGridViewRow row5 = new DataGridViewRow();
                            row5.CreateCells(DataGriewDados, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"), item.NOMEPRODUTO, " ", item.NOMEFUNCIONARIO, " ", SubTotalComissaoFuncionario);
                            row5.DefaultCellStyle.Font = new Font("Arial", 8);
                            DataGriewDados.Rows.Add(row5);

                            TotalGeralComissao += Convert.ToDecimal(SubTotalComissaoFuncionario);
                        }

                        //Produto MT2
                        LIS_PRODUTOSPEDIDOMTQOSCollection LIS_PRODUTOSPEDIDOMTQOSColl = new LIS_PRODUTOSPEDIDOMTQOSCollection();
                        LIS_PRODUTOSPEDIDOMTQOSColl = ProdutoRelMTQ(Convert.ToInt32(LIS_PEDIDOTy.IDORDEMSERVICO));
                        foreach (LIS_PRODUTOSPEDIDOMTQOSEntity item in LIS_PRODUTOSPEDIDOMTQOSColl)
                        {
                            ComissaoFuncionario = 0;
                            FUNCIONARIOEntity FUNCIONARIOTy = new FUNCIONARIOEntity();
                            FUNCIONARIOTy = FUNCIONARIOP.Read(Convert.ToInt32(item.IDFUNCIONARIO));
                            if (FUNCIONARIOTy != null)
                            {
                                ComissaoFuncionario = FUNCIONARIOTy.COMISSAO;
                            }

                            SubTotalComissaoFuncionario = Convert.ToDecimal(item.VALORTOTAL * ComissaoFuncionario) / 100;
                            decimal QuantMTQ = Convert.ToDecimal(item.QUANTIDADE * item.MT2);

                            DataGridViewRow row5 = new DataGridViewRow();
                            row5.CreateCells(DataGriewDados, QuantMTQ.ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"), item.NOMEPRODUTO, " ", item.NOMEFUNCIONARIO, " ", SubTotalComissaoFuncionario);
                            row5.DefaultCellStyle.Font = new Font("Arial", 8);
                            DataGriewDados.Rows.Add(row5);

                            TotalGeralComissao += Convert.ToDecimal(SubTotalComissaoFuncionario);
                        }

                        //Servicos
                        DataGridViewRow row3_2 = new DataGridViewRow();
                        row3_2.CreateCells(DataGriewDados, "SERVIÇOS");
                        row3_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(row3_2);

                        ///Produto MT2
                        DataGridViewRow row4_2 = new DataGridViewRow();
                        row4_2.CreateCells(DataGriewDados, "Quant.", "Total", "Serviço");
                        row4_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(row4_2);

                        LIS_SERVICOOSFECHCollection LIS_SERVICOOSFECHColl = new LIS_SERVICOOSFECHCollection();
                        LIS_SERVICOOSFECHColl = ServicoRel(Convert.ToInt32(LIS_PEDIDOTy.IDORDEMSERVICO));
                        foreach (LIS_SERVICOOSFECHEntity item in LIS_SERVICOOSFECHColl)
                        {
                            ComissaoFuncionario = 0;
                            FUNCIONARIOEntity FUNCIONARIOTy = new FUNCIONARIOEntity();
                            FUNCIONARIOTy = FUNCIONARIOP.Read(Convert.ToInt32(item.IDFUNCIONARIO));
                            if (FUNCIONARIOTy != null)
                            {
                                ComissaoFuncionario = FUNCIONARIOTy.COMISSAO;
                            }

                            SubTotalComissaoFuncionario = Convert.ToDecimal(item.VALORTOTAL * ComissaoFuncionario) / 100;

                            DataGridViewRow row5 = new DataGridViewRow();
                            row5.CreateCells(DataGriewDados, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"), item.NOMESERVICO, " ", item.NOMEFUNCIONARIO, " ", SubTotalComissaoFuncionario);
                            row5.DefaultCellStyle.Font = new Font("Arial", 8);
                            DataGriewDados.Rows.Add(row5);

                            TotalGeralComissao += Convert.ToDecimal(SubTotalComissaoFuncionario);
                        }

                        DataGridViewRow rowLinha_2 = new DataGridViewRow();
                        rowLinha_2.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________", "__________");
                        rowLinha_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(rowLinha_2);
                    }
                }

                if (!chkExibirProdutos.Checked)
                {
                    TotalGeralComissao = Convert.ToDecimal(SubTotalComissaoFuncionario);
                }

                DataGridViewRow rowLinha = new DataGridViewRow();
                rowLinha.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "TOTAL GERAL:", TotalGeralPedido, TotalGeralComissao);
                rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(rowLinha);

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
                this.Cursor = Cursors.Default;
            }
        }
Example #11
0
        private void PreencheGrid()
        {
            TotalGeralPedido = 0;

            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            DataGriewDados.Rows.Clear();

            foreach (var LIS_PRODUTOOSFECH2Ty in LIS_PRODUTOOSFECHColl)
            {
                LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHColl2 = new LIS_PRODUTOOSFECHCollection();

                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("idgrupocategoria", "System.Int32", "=", LIS_PRODUTOOSFECH2Ty.IDGRUPOCATEGORIA.ToString()));
                if (rbOrcamentoPesquisa.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S"));
                }
                if (rbVendasPesquisa.Checked)
                {
                    RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N"));
                }

                LIS_PRODUTOOSFECHColl2 = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");

                //Cabeçalho
                DataGridViewRow        row2_2          = new DataGridViewRow();
                GRUPOCATEGORIAProvider GRUPOCATEGORIAP = new GRUPOCATEGORIAProvider();
                string NomeGrupoCategoria = string.Empty;
                if (LIS_PRODUTOOSFECH2Ty.IDGRUPOCATEGORIA != null && LIS_PRODUTOOSFECH2Ty.IDGRUPOCATEGORIA > 0)
                {
                    NomeGrupoCategoria = GRUPOCATEGORIAP.Read(Convert.ToInt32(LIS_PRODUTOOSFECH2Ty.IDGRUPOCATEGORIA)).NOME;
                }

                row2_2.CreateCells(DataGriewDados, NomeGrupoCategoria);
                row2_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(row2_2);

                foreach (var LIS_PRODUTOOSFECHTy in LIS_PRODUTOOSFECHColl2)
                {
                    string DataEmissao  = Convert.ToDateTime(LIS_PRODUTOOSFECHTy.DATAEMISSAO).ToString("dd/MM/yyyy");
                    string TotalProduto = Convert.ToDecimal(LIS_PRODUTOOSFECHTy.VALORTOTAL).ToString("n2");

                    DataGridViewRow row2         = new DataGridViewRow();
                    string          Quantidade   = Convert.ToDecimal(LIS_PRODUTOOSFECHTy.QUANTIDADE).ToString("n2");
                    string          ORDEMServico = LIS_PRODUTOOSFECHTy.IDORDEMSERVICO.ToString().PadLeft(6, '0');
                    row2.CreateCells(DataGriewDados, LIS_PRODUTOOSFECHTy.NOMEPRODUTO, ORDEMServico, DataEmissao, Quantidade, TotalProduto);
                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    DataGriewDados.Rows.Add(row2);

                    TotalGeralPedido += Convert.ToDecimal(TotalProduto);
                }
            }

            DataGridViewRow row2_3 = new DataGridViewRow();

            row2_3.CreateCells(DataGriewDados, string.Empty, string.Empty, string.Empty, "Total: ", TotalGeralPedido.ToString("n2"));
            row2_3.DefaultCellStyle.Font = new Font("Arial", 8);
            DataGriewDados.Rows.Add(row2_3);

            this.Cursor = Cursors.Default;
        }
Example #12
0
        private void PreencheGrid()
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                DataGriewDados.Rows.Clear();
                DataGridViewRow rowTop = new DataGridViewRow();
                rowTop.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________");
                rowTop.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(rowTop);

                decimal TotalGeralOS      = 0;
                Decimal TotalGeralServico = 0;
                Decimal TotalGeralProduto = 0;

                foreach (var LIS_ORDEMSERVICOSFECHTy in LIS_ORDEMSERVICOSFECHColl)
                {
                    string DataEmissao = string.Empty;
                    if (LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO != null)
                    {
                        DataEmissao = Convert.ToDateTime(LIS_ORDEMSERVICOSFECHTy.DATAEMISSAO).ToString("dd/MM/yyyy");
                    }

                    string TotalOS = Convert.ToDecimal(LIS_ORDEMSERVICOSFECHTy.TOTALFECHOS).ToString("n2");
                    TotalGeralOS += Convert.ToDecimal(LIS_ORDEMSERVICOSFECHTy.TOTALFECHOS);

                    //Cabeçalho principal
                    if (LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO != null)
                    {
                        DataGridViewRow row1 = new DataGridViewRow();
                        row1.CreateCells(DataGriewDados, "O.SERVIÇO", "EMISSÃO", "CLIENTE", "STATUS", "FUNCIONÁRIO", "TOTAL O.S");
                        row1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                        DataGriewDados.Rows.Add(row1);
                    }

                    DataGridViewRow row2 = new DataGridViewRow();
                    row2.CreateCells(DataGriewDados, LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO.ToString().PadLeft(6, '0'), DataEmissao, LIS_ORDEMSERVICOSFECHTy.NOMECLIENTE, LIS_ORDEMSERVICOSFECHTy.NOMESTATUS, LIS_ORDEMSERVICOSFECHTy.NOMEFUNCIONARIO, TotalOS);
                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    DataGriewDados.Rows.Add(row2);


                    if (LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO != null)
                    {
                        //Dados do produto
                        LIS_PRODUTOOSFECHCollection LIS_PRODUTOOSFECHPrintColl = new LIS_PRODUTOOSFECHCollection();


                        LIS_PRODUTOOSFECHPrintColl = ProdutoRel(Convert.ToInt32(LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO));
                        if (LIS_PRODUTOOSFECHPrintColl.Count > 0 && chkExibirProdutos.Checked)
                        {
                            DataGridViewRow row3 = new DataGridViewRow();
                            row3.CreateCells(DataGriewDados, "PRODUTOS");
                            row3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row3);

                            //Cabeçalho do produto
                            DataGridViewRow row4 = new DataGridViewRow();
                            row4.CreateCells(DataGriewDados, "Quant.", "Total", "Produtos");
                            row4.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row4);

                            Decimal TotalProduto = 0;

                            foreach (LIS_PRODUTOOSFECHEntity item in LIS_PRODUTOOSFECHPrintColl)
                            {
                                DataGridViewRow row5 = new DataGridViewRow();
                                row5.CreateCells(DataGriewDados, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"), item.NOMEPRODUTO);
                                row5.DefaultCellStyle.Font = new Font("Arial", 8);
                                DataGriewDados.Rows.Add(row5);
                                TotalProduto += Convert.ToDecimal(item.VALORTOTAL);
                            }

                            TotalGeralProduto += TotalProduto;

                            //Total de Produto
                            DataGridViewRow row5_2 = new DataGridViewRow();
                            row5_2.CreateCells(DataGriewDados, "Total: ", TotalProduto.ToString("n2"), string.Empty);
                            row5_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row5_2);
                        }


                        //Dados do Serviço
                        LIS_SERVICOOSFECHCollection LIS_SERVICOOSFECHPrintColl = new LIS_SERVICOOSFECHCollection();
                        LIS_SERVICOOSFECHPrintColl = ServicoRel(Convert.ToInt32(LIS_ORDEMSERVICOSFECHTy.IDORDEMSERVICO));

                        if (LIS_SERVICOOSFECHPrintColl.Count > 0 && chkExibirServico.Checked)
                        {
                            DataGridViewRow row6 = new DataGridViewRow();
                            row6.CreateCells(DataGriewDados, "SERVIÇOS");
                            row6.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row6);
                            Decimal TotalServico = 0;

                            //Cabeçalho do Serviço
                            DataGridViewRow row7 = new DataGridViewRow();
                            row7.CreateCells(DataGriewDados, "Quant.", "Total", "Serviço");
                            row7.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row7);

                            foreach (LIS_SERVICOOSFECHEntity item in LIS_SERVICOOSFECHPrintColl)
                            {
                                DataGridViewRow row8 = new DataGridViewRow();
                                row8.CreateCells(DataGriewDados, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2"), item.NOMESERVICO);
                                row8.DefaultCellStyle.Font = new Font("Arial", 8);
                                DataGriewDados.Rows.Add(row8);
                                TotalServico += Convert.ToDecimal(item.VALORTOTAL);
                            }

                            TotalGeralServico += TotalServico;
                            //Total de Serviço
                            DataGridViewRow row8_2 = new DataGridViewRow();
                            row8_2.CreateCells(DataGriewDados, "Total: ", TotalServico.ToString("n2"), string.Empty);
                            row8_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                            DataGriewDados.Rows.Add(row8_2);
                        }
                    }


                    DataGridViewRow rowLinha = new DataGridViewRow();
                    rowLinha.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________");
                    rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    DataGriewDados.Rows.Add(rowLinha);

                    this.Cursor = Cursors.Default;
                }

                if (chkExibirServico.Checked)
                {
                    //Total Geral de Servico
                    DataGridViewRow rowTotalGeralServico = new DataGridViewRow();
                    rowTotalGeralServico.CreateCells(DataGriewDados, "", "", "Total Geral de Serviço: " + TotalGeralServico.ToString("n2"));
                    rowTotalGeralServico.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    DataGriewDados.Rows.Add(rowTotalGeralServico);
                }

                if (chkExibirProdutos.Checked)
                {
                    //Total Geral de Produto
                    DataGridViewRow rowTotalGeralProduto = new DataGridViewRow();
                    rowTotalGeralProduto.CreateCells(DataGriewDados, "", "", "Total Geral de Produtos: " + TotalGeralProduto.ToString("n2"));
                    rowTotalGeralProduto.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    DataGriewDados.Rows.Add(rowTotalGeralProduto);
                }

                //Total Geral de OS
                DataGridViewRow rowTotalOS = new DataGridViewRow();
                rowTotalOS.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "Total Geral da O.S...:", TotalGeralOS.ToString("n2"));
                rowTotalOS.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(rowTotalOS);

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Example #13
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                CreaterCursor Cr = new CreaterCursor();
                this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

                try
                {
                    RowRelatorio.Clear();
                    string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text);
                    string DataFinal   = Util.ConverStringDateSearch(msktDataFinal.Text);

                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", ">=", DataInicial, "and"));
                    RowRelatorio.Add(new RowsFiltro("DATAEMISSAO", "System.DateTime", "<=", DataFinal, "and"));

                    if (rbOrcamentoPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S", "and"));
                    }

                    if (rbVendasPesquisa.Checked)
                    {
                        RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N", "and"));
                    }

                    RowRelatorio.Add(new RowsFiltro("IDFUNCIONARIO", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString(), "and"));

                    DataGriewDados.Rows.Clear();
                    TotalGeral         = 0;
                    TotalGeralComissao = 0;

                    LIS_PRODUTOOSFECHColl.Clear();
                    LIS_SERVICOOSFECHColl.Clear();
                    if (chkProduto.Checked)
                    {
                        LIS_PRODUTOOSFECHColl  = LIS_PRODUTOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC");
                        lblTotalRegistros.Text = "Total de Registros: " + LIS_PRODUTOOSFECHColl.Count.ToString();
                        PreencheGridProduto();
                    }

                    if (ChkServiço.Checked)
                    {
                        LIS_SERVICOOSFECHColl  = LIS_SERVICOOSFECHP.ReadCollectionByParameter(RowRelatorio, "IDORDEMSERVICO DESC");
                        lblTotalRegistros.Text = "Total de Registros: " + (LIS_SERVICOOSFECHColl.Count + LIS_PRODUTOOSFECHColl.Count).ToString();
                        PreencheGridServico();
                    }

                    DataGriewDados.Sort(DataGriewDados.Columns["ordemservico"], ListSortDirection.Descending);

                    DataGridViewRow row3 = new DataGridViewRow();
                    row3.CreateCells(DataGriewDados, "", "", "Total Geral:", TotalGeral.ToString("n2"), TotalGeralComissao.ToString("n2"));
                    row3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                    DataGriewDados.Rows.Add(row3);

                    this.Cursor = Cursors.Default;
                }
                catch (Exception EX)
                {
                    this.Cursor = Cursors.Default;
                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }