private void LocalizarProdutoPedido(int IDPRODUTO) { try { RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", IDPRODUTO.ToString())); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", _IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_2 = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOColl_2 = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); if (LIS_PRODUTOSPEDIDOColl_2.Count > 0) { PRODUTOSPEDIDOP.Delete(Convert.ToInt32(LIS_PRODUTOSPEDIDOColl_2[0].IDPRODPEDIDO)); ListaProdutoPedido(_IDPEDIDO); Beep(1000, 300); cbProduto.Focus(); } else { Util.ExibirMSg("Produto não localizado!", "Red"); } } catch (Exception ex) { MessageBox.Show("Erro " + ex.Message); } }
private void QuantProduto(int IDPRODUTO) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text); string DataFinal = Util.ConverStringDateSearch(msktDataFinal.Text); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal)); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", IDPRODUTO.ToString())); if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (rdOrcamento.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rdVenda.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); foreach (var LIS_PRODUTOSPEDIDOTy in LIS_PRODUTOSPEDIDOColl) { QuantTotal += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy.QUANTIDADE); ValorTotal += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy.VALORTOTAL); } }
private decimal TotalQuantProdutoAgrupado(int IDPRODUTO, int COD_MUN_IBGE) { decimal result = 0; LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowRelatorio.Clear(); string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text); string DataFinal = Util.ConverStringDateSearch(msktDataFinal.Text); RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", COD_MUN_IBGE.ToString())); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", IDPRODUTO.ToString())); if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDVENDEDOR", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString())); } if (Convert.ToInt32(cbProduto.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString())); } RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal)); if (Convert.ToInt32(cbStatus.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", Convert.ToInt32(cbStatus.SelectedValue).ToString())); } if (txtCidade1.Text.Trim() != string.Empty) { RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", _COD_MUN_IBGE.ToString())); } if (rbOrcamentoPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rbVendasPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO, IDPEDIDO"); foreach (var item in LIS_PRODUTOSPEDIDOColl) { result += Convert.ToDecimal(item.QUANTIDADE); } return(result); }
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("DTEMISSAO", "System.DateTime", ">=", DataInicial + " 00:00")); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal + " 23:59")); if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (rdOrcamento.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rdVenda.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); //Remove ID repetido LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDO2Coll = new LIS_PRODUTOSPEDIDOCollection(); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { if (LIS_PRODUTOSPEDIDO2Coll.Find(delegate(LIS_PRODUTOSPEDIDOEntity item2) { return (item2.IDPRODUTO == item.IDPRODUTO); }) == null) { LIS_PRODUTOSPEDIDO2Coll.Add(item); } } LIS_PRODUTOSPEDIDOColl.Clear(); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDO2Coll; PreencheGrid(); } catch (Exception EX) { MessageBox.Show("Erro na pesquisa!"); MessageBox.Show("Erro técnico: " + EX.Message); } } }
private LIS_PRODUTOSPEDIDOCollection ProdutoRel(int IDPEDIDO) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColL = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOColL = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); return(LIS_PRODUTOSPEDIDOColL); }
private void ListaProdutosPD(string NOTAFISCAL) { try { LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); RowsFiltroCollection RowRelatorio = new RowsFiltroCollection(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.String", "=", NOTAFISCAL.ToString())); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); DGDadosProduto.Rows.Clear(); foreach (var item in LIS_PRODUTOSPEDIDOColl) { DataGridViewRow rowTop = new DataGridViewRow(); rowTop.CreateCells(DGDadosProduto, item.NOMEPRODUTO, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORUNITARIO).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2")); rowTop.DefaultCellStyle.Font = new Font("Arial", 8); DGDadosProduto.Rows.Add(rowTop); } //Produto MT2 Linear LIS_PRODUTOSPEDIDOMTQCollection LIS_PRODUTOSPEDIDOMTQColl = new LIS_PRODUTOSPEDIDOMTQCollection(); LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); foreach (var item in LIS_PRODUTOSPEDIDOMTQColl) { DataGridViewRow rowTop = new DataGridViewRow(); rowTop.CreateCells(DGDadosProduto, item.NOMEPRODUTO, Convert.ToDecimal(item.QUANTIDADE).ToString("n2"), Convert.ToDecimal(item.VALORUNITARIO).ToString("n2"), Convert.ToDecimal(item.VALORTOTAL).ToString("n2")); rowTop.DefaultCellStyle.Font = new Font("Arial", 8); DGDadosProduto.Rows.Add(rowTop); } lblQuantProdutos.Text = "Quantidade de Produtos: " + (LIS_PRODUTOSPEDIDOMTQColl.Count + LIS_PRODUTOSPEDIDOColl.Count).ToString(); } catch (Exception) { MessageBox.Show(ConfigMessage.Default.MsgErroPesquisa, ConfigSistema1.Default.NomeEmpresa, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void ListaProdutoPedido(int IDPEDIDO) { try { RowsFiltroCollection RowpProdPedido = new RowsFiltroCollection(); RowpProdPedido.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowpProdPedido); DGDadosProduto.AutoGenerateColumns = false; DGDadosProduto.DataSource = LIS_PRODUTOSPEDIDOColl; lblNumProdutos.Text = "Nº de Produtos: " + LIS_PRODUTOSPEDIDOColl.Count.ToString(); SumTotalProdutosPedido(); } catch (Exception ex) { MessageBox.Show("Erro técnico: " + ex.Message); } }
private void ListaProdutosPD(string NOTAFISCAL) { try { LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowsFiltroCollection RowRelatorio = new RowsFiltroCollection(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.String", "=", NOTAFISCAL.ToString())); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); //Produto MT2 Linear LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); } catch (Exception ex) { MessageBox.Show("Erro técnico: " + ex.Message); } }
private void FrmRelatTicket_Load(object sender, EventArgs e) { EMPRESAProvider EMPRESAP = new EMPRESAProvider(); EMPRESACollection EMPRESAColl = new EMPRESACollection(); EMPRESAColl = EMPRESAP.ReadCollectionByParameter(null); //Dados do Pedido RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PEDIDOColl = LIS_PEDIDOP.ReadCollectionByParameter(RowRelatorio); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); msg1ticket = BmsSoftware.ConfigSistema1.Default.msg1ticket; msg2ticket = BmsSoftware.ConfigSistema1.Default.msg2ticket; msg3ticket = BmsSoftware.ConfigSistema1.Default.msg3ticket; msg4ticket = BmsSoftware.ConfigSistema1.Default.msg4ticket; //setando os parametro Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[6]; p[0] = new Microsoft.Reporting.WinForms.ReportParameter("NomeEmpresa", EMPRESAColl[0].NOMEFANTASIA); p[1] = new Microsoft.Reporting.WinForms.ReportParameter("CNPJ", EMPRESAColl[0].CNPJCPF); p[2] = new Microsoft.Reporting.WinForms.ReportParameter("msg1ticket", msg1ticket); p[3] = new Microsoft.Reporting.WinForms.ReportParameter("msg2ticket", msg2ticket); p[4] = new Microsoft.Reporting.WinForms.ReportParameter("msg3ticket", msg3ticket); p[5] = new Microsoft.Reporting.WinForms.ReportParameter("msg4ticket", msg4ticket); this.reportViewer1.LocalReport.SetParameters(p); this.LIS_PEDIDOCollectionBindingSource.DataSource = LIS_PEDIDOColl; this.EMPRESAEntityBindingSource.DataSource = EMPRESAColl; this.LIS_PRODUTOSPEDIDOCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDOColl; this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.RefreshReport(); }
private static LIS_PRODUTOSPEDIDOCollection ExecuteReader(ref LIS_PRODUTOSPEDIDOCollection collection, ref FbDataReader dataReader, FbCommand dbCommand) { using (dataReader = dbCommand.ExecuteReader()) { collection = new LIS_PRODUTOSPEDIDOCollection(); if (dataReader.HasRows) { while (dataReader.Read()) { collection.Add(FillEntityObject(ref dataReader)); } } if (!(dataReader.IsClosed)) { dataReader.Close(); } dataReader.Dispose(); } return(collection); }
private void FrmPedidoSimples_Load(object sender, EventArgs e) { 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; } } nomeempresa = EMPRESAColl[0].NOMEFANTASIA; //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("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PEDIDOProvider LIS_PEDIDOP = new LIS_PEDIDOProvider(); LIS_PEDIDOColl = LIS_PEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); string titulo = "VENDA: " + IDPEDIDO.ToString().PadLeft(6, '0'); if (LIS_PEDIDOColl[0].FLAGORCAMENTO.TrimEnd() == "S") { titulo = "ALUGUEL: " + IDPEDIDO.ToString().PadLeft(6, '0'); } decimal totalproduto = 0; foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); } //Adiciona Dados de Medidas int Contador = 0; foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { if (item.QUADRIL > 0 || item.BUSTO > 0 || item.CINTURA > 0) { LIS_PRODUTOSPEDIDOColl[Contador].NOMEPRODUTO = LIS_PRODUTOSPEDIDOColl[Contador].NOMEPRODUTO + " Busto/Torax: " + Convert.ToDecimal(item.BUSTO).ToString("n2") + " Cintura: " + item.CINTURA + " Quadril: " + item.QUADRIL; } if (item.COLARINHO > 0 || item.MANGA > 0 || item.ALTURA > 0 || item.BARRA > 0) { LIS_PRODUTOSPEDIDOColl[Contador].NOMEPRODUTO += " Colarinho: " + Convert.ToDecimal(item.COLARINHO).ToString("n2") + " Manga: " + Convert.ToDecimal(item.MANGA).ToString("n2") + " Comprimento: " + Convert.ToDecimal(item.ALTURA).ToString("n2") + " Barra: " + Convert.ToDecimal(item.ALTURA).ToString("n2"); } Contador++; } //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("dataretirada", dataretiradaSelec); p[4] = new Microsoft.Reporting.WinForms.ReportParameter("obsanexo", obsanexo); p[5] = new Microsoft.Reporting.WinForms.ReportParameter("nomeempresa", nomeempresa); reportViewer1.LocalReport.SetParameters(p); this.LIS_CLIENTECollectionBindingSource.DataSource = LIS_CLIENTEColl; this.EMPRESACollectionBindingSource.DataSource = EMPRESAColl; this.LIS_PEDIDOCollectionBindingSource.DataSource = LIS_PEDIDOColl; this.LIS_PRODUTOSPEDIDOCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDOColl; this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.RefreshReport(); }
private void PreencheGrid2() { TotalGeral = 0; TotalQuantidade = 0; SubTotal = 0; CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); DataGriewDados.Rows.Clear(); //Remove as Cidades Repetidas LIS_PEDIDO3Collection LIS_PEDIDO3Coll_2 = new LIS_PEDIDO3Collection(); foreach (LIS_PEDIDO3Entity item in LIS_PEDIDO3Coll) { if (LIS_PEDIDO3Coll_2.Find(delegate(LIS_PEDIDO3Entity item2) { return(item2.COD_MUN_IBGE == item.COD_MUN_IBGE); }) == null) { LIS_PEDIDO3Coll_2.Add(item); } } //Cabeçalho Nome Cidade DataGridViewRow row1_2 = new DataGridViewRow(); row1_2.CreateCells(DataGriewDados, "CIDADE/UF", "", "", "", ""); row1_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1_2); foreach (var LIS_PEDIDO3ty in LIS_PEDIDO3Coll_2) { //Busca Dados do produto por cidade LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_3 = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOColl_3 = BuscaProdutoPedidoPelaCidade(Convert.ToInt32(LIS_PEDIDO3ty.COD_MUN_IBGE)); if (LIS_PRODUTOSPEDIDOColl_3.Count > 0) { TotalQuantidade = 0; SubTotal = 0; LIS_MUNICIPIOSCollection LIS_MUNICIPIOSColl = new LIS_MUNICIPIOSCollection(); LIS_MUNICIPIOSProvider LIS_MUNICIPIOSP = new LIS_MUNICIPIOSProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", LIS_PEDIDO3ty.COD_MUN_IBGE.ToString())); LIS_MUNICIPIOSColl = LIS_MUNICIPIOSP.ReadCollectionByParameter(RowRelatorio); DataGridViewRow row1_3 = new DataGridViewRow(); row1_3.CreateCells(DataGriewDados, LIS_MUNICIPIOSColl[0].MUNIUF, "", "", "", ""); row1_3.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1_3); DataGridViewRow row1_4 = new DataGridViewRow(); row1_4.CreateCells(DataGriewDados, "PRODUTO", "QUANT.", "DATA", "PEDIDO", "TOTAL"); row1_4.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1_4); } foreach (var LIS_PRODUTOSPEDIDOTy_3 in LIS_PRODUTOSPEDIDOColl_3) { CLIENTEEntity CLIENTEtY = new CLIENTEEntity(); CLIENTEProvider CLIENTEP = new CLIENTEProvider(); CLIENTEtY = CLIENTEP.Read(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy_3.IDCLIENTE)); string DataEmissao = Convert.ToDateTime(LIS_PRODUTOSPEDIDOTy_3.DTEMISSAO).ToString("dd/MM/yyyy"); if (chkAgruparProduto.Checked) { DataEmissao = string.Empty; } string NomeProduto = LIS_PRODUTOSPEDIDOTy_3.NOMEPRODUTO; string QuantProduto = LIS_PRODUTOSPEDIDOTy_3.QUANTIDADE.ToString(); if (chkAgruparProduto.Checked) { QuantProduto = TotalQuantProdutoAgrupado(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy_3.IDPRODUTO), Convert.ToInt32(LIS_PRODUTOSPEDIDOTy_3.COD_MUN_IBGE)).ToString(); TotalQuantidade += Convert.ToDecimal(QuantProduto); } else { TotalQuantidade += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_3.QUANTIDADE); } string NUMPEDIDO = LIS_PRODUTOSPEDIDOTy_3.IDPEDIDO.ToString().PadLeft(6, '0'); if (chkAgruparProduto.Checked) { NUMPEDIDO = string.Empty; } string TotalProduto = Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_3.VALORTOTAL).ToString("n2"); if (chkAgruparProduto.Checked) { TotalProduto = TotalValorProdutoAgrupado(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy_3.IDPRODUTO), Convert.ToInt32(LIS_PRODUTOSPEDIDOTy_3.COD_MUN_IBGE)).ToString("n2"); SubTotal += Convert.ToDecimal(TotalProduto); TotalGeral += Convert.ToDecimal(TotalProduto); } else { SubTotal += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_3.VALORTOTAL); TotalGeral += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_3.VALORTOTAL); } string TELEFONE1 = CLIENTEtY.TELEFONE1; DataGridViewRow row2 = new DataGridViewRow(); row2.CreateCells(DataGriewDados, NomeProduto, QuantProduto, DataEmissao, NUMPEDIDO, TotalProduto); row2.DefaultCellStyle.Font = new Font("Arial", 8); DataGriewDados.Rows.Add(row2); } if (LIS_PRODUTOSPEDIDOColl_3.Count > 0) { DataGridViewRow row1_5 = new DataGridViewRow(); row1_5.CreateCells(DataGriewDados, "-------------------------------------------------------", TotalQuantidade.ToString(), "---------", "Sub-Total", SubTotal.ToString("n2")); row1_5.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1_5); } } DataGridViewRow rowLinha = new DataGridViewRow(); rowLinha.CreateCells(DataGriewDados, "-------------------------------------------------------", "---------", "---------", "Total geral:", TotalGeral.ToString("n2")); rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowLinha); this.Cursor = Cursors.Default; }
private LIS_PRODUTOSPEDIDOCollection BuscaProdutoPedidoPelaCidade(int COD_MUN_IBGE) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_3 = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowRelatorio.Clear(); string DataInicial = Util.ConverStringDateSearch(msktDataInicial.Text); string DataFinal = Util.ConverStringDateSearch(msktDataFinal.Text); RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", COD_MUN_IBGE.ToString())); if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDVENDEDOR", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString())); } if (Convert.ToInt32(cbProduto.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString())); } RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal)); if (Convert.ToInt32(cbStatus.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", Convert.ToInt32(cbStatus.SelectedValue).ToString())); } if (txtCidade1.Text.Trim() != string.Empty) { RowRelatorio.Add(new RowsFiltro("COD_MUN_IBGE", "System.Int32", "=", _COD_MUN_IBGE.ToString())); } if (rbOrcamentoPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rbVendasPesquisa.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } LIS_PRODUTOSPEDIDOColl_3 = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO, IDPEDIDO"); LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_2 = new LIS_PRODUTOSPEDIDOCollection(); if (chkAgruparProduto.Checked) { //Remove os produtos Repetidos foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl_3) { if (LIS_PRODUTOSPEDIDOColl_2.Find(delegate(LIS_PRODUTOSPEDIDOEntity item2) { return(item2.IDPRODUTO == item.IDPRODUTO); }) == null) { LIS_PRODUTOSPEDIDOColl_2.Add(item); } } LIS_PRODUTOSPEDIDOColl_3 = LIS_PRODUTOSPEDIDOColl_2; } return(LIS_PRODUTOSPEDIDOColl_3); }
private void PreencheGrid2() { TOTALGERALQUANTIDADE = 0; TOTALGERALPESO = 0; TOTALVENDA = 0; TOTALGERALVENDA = 0; CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); try { DataGriewDados.Rows.Clear(); //Remove as Cidades Repetidas LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_2 = new LIS_PRODUTOSPEDIDOCollection(); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { if (LIS_PRODUTOSPEDIDOColl_2.Find(delegate(LIS_PRODUTOSPEDIDOEntity item2) { return(item2.IDPRODUTO == item.IDPRODUTO); }) == null) { LIS_PRODUTOSPEDIDOColl_2.Add(item); } } DataGridViewRow row1_2 = new DataGridViewRow(); foreach (var LIS_PRODUTOSPEDIDOTy in LIS_PRODUTOSPEDIDOColl_2) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_5 = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOColl_5 = BuscaPedidoPeloProduto(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy.IDPRODUTO)); PRODUTOSEntity PRODUTOSTy = new PRODUTOSEntity(); PRODUTOSTy = PRODUTOSP.Read(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy.IDPRODUTO)); string NomeMarca = string.Empty; if (LIS_PRODUTOSPEDIDOTy.IDMARCA != null && LIS_PRODUTOSPEDIDOTy.IDMARCA > 0) { NomeMarca = MARCAP.Read(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy.IDMARCA)).NOME; } decimal QUANTIDADE = 0; decimal PESO = 0; TOTALVENDA = 0; foreach (var LIS_PRODUTOSPEDIDOTy_2 in LIS_PRODUTOSPEDIDOColl_5) { QUANTIDADE += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_2.QUANTIDADE); //PESO += Convert.ToDecimal(PRODUTOSP.Read(Convert.ToInt32(LIS_PRODUTOSPEDIDOTy.IDPRODUTO)).PESO) * QUANTIDADE; TOTALVENDA += Convert.ToDecimal(LIS_PRODUTOSPEDIDOTy_2.VALORTOTAL); } TOTALGERALVENDA += TOTALVENDA; TOTALGERALQUANTIDADE += QUANTIDADE; TOTALGERALPESO += PESO; string Codigo = LIS_PRODUTOSPEDIDOTy.IDPRODUTO.ToString(); string Cod_Referencia = PRODUTOSTy.CODPRODUTOFORNECEDOR; string Cod_Barra = PRODUTOSTy.CODBARRA; string NOMEPRODUTO = LIS_PRODUTOSPEDIDOTy.NOMEPRODUTO; string VLUNITARIOMEDIO = Convert.ToDecimal(TOTALVENDA / QUANTIDADE).ToString("n2"); DataGridViewRow row2 = new DataGridViewRow(); row2.CreateCells(DataGriewDados, Codigo, Cod_Referencia, Cod_Barra, LIS_PRODUTOSPEDIDOTy.NOMEPRODUTO, NomeMarca, VLUNITARIOMEDIO, QUANTIDADE.ToString("n2"), TOTALVENDA.ToString("n2"), PESO.ToString("n2")); row2.DefaultCellStyle.Font = new Font("Arial", 8); DataGriewDados.Rows.Add(row2); } DataGridViewRow rowLinha = new DataGridViewRow(); rowLinha.CreateCells(DataGriewDados, "", "", "", "", "", "TOTAL GERAL", TOTALGERALQUANTIDADE.ToString("n2"), TOTALGERALVENDA.ToString("n2"), TOTALGERALPESO.ToString("n2")); rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowLinha); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } }
private decimal RetornaQuantSaida(int Idproduto) { decimal result = 0; if (chkNFe.Checked) { LIS_PRODUTONFECollection LIS_PRODUTONFEColl2 = new LIS_PRODUTONFECollection(); RowRelatorio.Clear(); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); RowRelatorio.Add(new RowsFiltro("FLAGENVIADA", "System.String", "=", "S")); RowRelatorio.Add(new RowsFiltro("FLAGCANCELADA", "System.String", "=", "N")); LIS_PRODUTONFEColl2 = LIS_PRODUTONFEP.ReadCollectionByParameter(RowRelatorio, "IDNOTAFISCALE DESC"); NOTAFISCALEProvider NOTAFISCALEP = new NOTAFISCALEProvider(); foreach (LIS_PRODUTONFEEntity item in LIS_PRODUTONFEColl2) { if (NOTAFISCALEP.Read(Convert.ToInt32(item.IDNOTAFISCALE)).FLAGCANCELADA.TrimEnd() == "N" && NOTAFISCALEP.Read(Convert.ToInt32(item.IDNOTAFISCALE)).FLAGENVIADA.TrimEnd() == "S")//Desconsidera nota fiscal cancelada { result += Convert.ToDecimal(item.QUANTIDADE); } } } //Saida pelo Pedido de Venda if (chkSaidaPedido.Checked) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); PEDIDOProvider PEDIDOP = new PEDIDOProvider(); foreach (LIS_PRODUTOSPEDIDOEntity item2 in LIS_PRODUTOSPEDIDOColl) { if (PEDIDOP.Read(Convert.ToInt32(item2.IDPEDIDO)).FLAGORCAMENTO.TrimEnd() == "N") { result += Convert.ToDecimal(item2.QUANTIDADE); } } } //Saida Pedido2 LIS_PRODUTOSPEDIDOMTQCollection LIS_PRODUTOSPEDIDOMTQColl = new LIS_PRODUTOSPEDIDOMTQCollection(); LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Idproduto.ToString())); if (msktDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(msktDataInicial.Text))); } if (msktDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(msktDataFinal.Text))); } LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); foreach (LIS_PRODUTOSPEDIDOMTQEntity item2 in LIS_PRODUTOSPEDIDOMTQColl) { if (item2.FLAGORCAMENTO.TrimEnd() == "N") { result += Convert.ToDecimal(item2.MT2) * Convert.ToDecimal(item2.QUANTIDADE); } } ////Estoque Digisat CONFISISTEMAProvider CONFISISTEMAP = new CONFISISTEMAProvider(); if (CONFISISTEMAP.Read(1).FLAGCPDIGISAT.TrimEnd() == "S") { ITEVENDAS_ECFCollection ITEVENDAS_ECFColl = new ITEVENDAS_ECFCollection(); ITEVENDAS_ECFProvider ITEVENDAS_ECFP = new ITEVENDAS_ECFProvider(); RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("CANCELADO", "System.Int32", "=", "0")); RowRelatorio.Add(new RowsFiltro("CODIGO", "System.Int32", "=", Idproduto.ToString())); ITEVENDAS_ECFColl = ITEVENDAS_ECFP.ReadCollectionByParameter(RowRelatorio, "CUPOM DESC"); foreach (ITEVENDAS_ECFEntity item in ITEVENDAS_ECFColl) { result += Convert.ToDecimal(item.QTD); } } return(result); }
private void PreencheGrid() { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); DataGridViewRow rowTop = new DataGridViewRow(); rowTop.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________"); rowTop.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowTop); foreach (var LIS_PEDIDOFECHTy in LIS_PEDIDOColl) { string DataEmissao = string.Empty; if (LIS_PEDIDOFECHTy.IDPEDIDO != null) { DataEmissao = Convert.ToDateTime(LIS_PEDIDOFECHTy.DTEMISSAO).ToString("dd/MM/yyyy"); } string TotalOS = Convert.ToDecimal(LIS_PEDIDOFECHTy.TOTALPEDIDO).ToString("n2"); //Cabeçalho principal if (LIS_PEDIDOFECHTy.IDPEDIDO != null) { DataGridViewRow row1 = new DataGridViewRow(); row1.CreateCells(DataGriewDados, "PEDIDO", "EMISSÃO", "CLIENTE", "STATUS", "FUNCIONÁRIO", "TOTAL "); row1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1); } DataGridViewRow row2 = new DataGridViewRow(); row2.CreateCells(DataGriewDados, LIS_PEDIDOFECHTy.IDPEDIDO.ToString().PadLeft(6, '0'), DataEmissao, LIS_PEDIDOFECHTy.NOMECLIENTE, LIS_PEDIDOFECHTy.NOMESTATUS, LIS_PEDIDOFECHTy.NOMEVENDEDOR, TotalOS); row2.DefaultCellStyle.Font = new Font("Arial", 8); DataGriewDados.Rows.Add(row2); if (LIS_PEDIDOFECHTy.IDPEDIDO != null) { //Dados do produto LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOPrintColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOPrintColl = ProdutoRel(Convert.ToInt32(LIS_PEDIDOFECHTy.IDPEDIDO)); if (LIS_PRODUTOSPEDIDOPrintColl.Count > 0) { 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); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOPrintColl) { 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); } } } DataGridViewRow rowLinha = new DataGridViewRow(); rowLinha.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________"); rowLinha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowLinha); this.Cursor = Cursors.Default; } DataGridViewRow UltimaLInha = new DataGridViewRow(); UltimaLInha.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", " Total Geral:", TotalGeral().ToString("n2")); UltimaLInha.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(UltimaLInha); }
private void btnPesquisa_Click(object sender, EventArgs e) { if (ValidacoesItensServicos()) { try { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); RowRelatorio.Clear(); if (Convert.ToInt32(cbProduto.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("idproduto", "System.Int32", "=", cbProduto.SelectedValue.ToString())); } if (Convert.ToInt32(cbGrupoCategoria.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDGRUPOCATEGORIA", "System.Int32", "=", cbGrupoCategoria.SelectedValue.ToString())); } if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (Convert.ToInt32(cbCliente.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDCLIENTE", "System.Int32", "=", cbCliente.SelectedValue.ToString())); } if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDVENDEDOR", "System.Int32", "=", cbFuncionario.SelectedValue.ToString())); } RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(mkdDataInicial.Text) + " " + mkdHoraInicial.Text)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(mkdDataFinal.Text) + " " + mkdHoraFinal.Text)); if (rdOrcamento.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rdVenda.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } //Dados produto MT linear /////////////////////////////////////////////////////////////////////////////////////////// LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO"); //Colocando somatorio no final da lista LIS_PRODUTOSPEDIDOEntity LIS_PRODUTOSPEDIDOTy = new LIS_PRODUTOSPEDIDOEntity(); LIS_PRODUTOSPEDIDOTy.VALORTOTAL = SumTotalPesquisa("VALORTOTAL"); LIS_PRODUTOSPEDIDOTy.QUANTIDADE = SumTotalPesquisa("QUANTIDADE"); LIS_PRODUTOSPEDIDOTy.TOTALMT = SumTotalPesquisa("TOTALMT"); LIS_PRODUTOSPEDIDOColl.Add(LIS_PRODUTOSPEDIDOTy); DGDadosServicos.AutoGenerateColumns = false; DGDadosServicos.DataSource = LIS_PRODUTOSPEDIDOColl; lbltTotalMtLinear.Text = (LIS_PRODUTOSPEDIDOColl.Count - 1).ToString(); /////////////////////////////////////////////////////////////////////////////////////////// //Dados produto MT2 /////////////////////////////////////////////////////////////////////////////////////////// LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO"); //Colocando somatorio no final da lista LIS_PRODUTOSPEDIDOMTQEntity LIS_PRODUTOSPEDIDOMTQTy = new LIS_PRODUTOSPEDIDOMTQEntity(); LIS_PRODUTOSPEDIDOMTQTy.VALORTOTAL = SumTotalPesquisa2("VALORTOTAL"); LIS_PRODUTOSPEDIDOMTQTy.QUANTIDADE = SumTotalPesquisa2("QUANTIDADE"); LIS_PRODUTOSPEDIDOMTQTy.MT2 = SumTotalPesquisa2("MT2"); LIS_PRODUTOSPEDIDOMTQColl.Add(LIS_PRODUTOSPEDIDOMTQTy); dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = LIS_PRODUTOSPEDIDOMTQColl; lblTotalPesquisa.Text = (LIS_PRODUTOSPEDIDOMTQColl.Count - 1).ToString(); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } } }
private void FrmPedidoSimples_Load(object sender, EventArgs e) { 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("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PEDIDOProvider LIS_PEDIDOP = new LIS_PEDIDOProvider(); LIS_PEDIDOColl = LIS_PEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); string titulo = "Nº PEDIDO " + IDPEDIDO.ToString().PadLeft(6, '0'); if (LIS_PEDIDOColl[0].FLAGORCAMENTO.TrimEnd() == "S") { titulo = "Nº ORÇAMENTO " + IDPEDIDO.ToString().PadLeft(6, '0'); } decimal totalproduto = 0; foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); } //Remover produtos que não vao ser exibido LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl2 = new LIS_PRODUTOSPEDIDOCollection(); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { if (item.FLAGEXIBIR.TrimEnd().TrimStart() == "S") { LIS_PRODUTOSPEDIDOColl2.Add(item); } } //setando os parametro Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[4]; if (cpfcnpjPar == string.Empty) { cpfcnpjPar = " "; } 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("codreferencia", codreferencia); reportViewer1.LocalReport.SetParameters(p); this.LIS_CLIENTECollectionBindingSource.DataSource = LIS_CLIENTEColl; this.EMPRESACollectionBindingSource.DataSource = EMPRESAColl; this.LIS_PEDIDOCollectionBindingSource.DataSource = LIS_PEDIDOColl; this.LIS_PRODUTOSPEDIDOCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDOColl2; this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.RefreshReport(); }
private LIS_PRODUTOSPEDIDOCollection BuscaPedidoPeloProduto(int IDPRODUTO) { LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl_4 = new LIS_PRODUTOSPEDIDOCollection(); 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("IDVENDEDOR", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString())); } if (Convert.ToInt32(cbTransportador.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDTRANSPORTES", "System.Int32", "=", Convert.ToInt32(cbTransportador.SelectedValue).ToString())); } RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", IDPRODUTO.ToString())); if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (rbDataEmissao.Checked) { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal)); } else { RowRelatorio.Add(new RowsFiltro("DATAENTREGA", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DATAENTREGA", "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(cbFuncionario.SelectedValue) > 0) { LIS_PRODUTOSPEDIDOColl_4 = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "IDTRANSPORTES, IDPEDIDO"); } else { LIS_PRODUTOSPEDIDOColl_4 = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); } return(LIS_PRODUTOSPEDIDOColl_4); } catch (Exception ex) { return(LIS_PRODUTOSPEDIDOColl_4); MessageBox.Show("Erro técnico: " + ex.Message); } }
private void btnPesquisa_Click(object sender, EventArgs e) { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); 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("IDVENDEDOR", "System.Int32", "=", Convert.ToInt32(cbFuncionario.SelectedValue).ToString())); } if (Convert.ToInt32(cbTransportador.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDTRANSPORTES", "System.Int32", "=", Convert.ToInt32(cbTransportador.SelectedValue).ToString())); } if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (rdOrcamento.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rdVenda.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } if (rbDataEmissao.Checked) { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", DataFinal)); } else { RowRelatorio.Add(new RowsFiltro("DATAENTREGA", "System.DateTime", ">=", DataInicial)); RowRelatorio.Add(new RowsFiltro("DATAENTREGA", "System.DateTime", "<=", DataFinal)); } if (rbOrdenarProduto.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO"); } else if (rbOrdenarCodigo.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "IDPRODUTO"); } PreencheGrid2(); this.Cursor = Cursors.Default; } catch (Exception EX) { this.Cursor = Cursors.Default; MessageBox.Show("Erro na pesquisa!"); MessageBox.Show("Erro técnico: " + EX.Message); } } }
private void FrmRelatPedidoVenda3_Load(object sender, EventArgs e) { EMPRESAProvider EMPRESAP = new EMPRESAProvider(); EMPRESACollection EMPRESAColl = new EMPRESACollection(); EMPRESAColl = EMPRESAP.ReadCollectionByParameter(null); NomeEmpresa = EMPRESAColl[0].NOMEFANTASIA; //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("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PEDIDOProvider LIS_PEDIDOP = new LIS_PEDIDOProvider(); LIS_PEDIDOColl = LIS_PEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto MTQ RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); string titulo = "Nº PEDIDO " + IDPEDIDO.ToString().PadLeft(6, '0'); if (LIS_PEDIDOColl[0].FLAGORCAMENTO.TrimEnd() == "S") { titulo = "Nº ORÇAMENTO " + IDPEDIDO.ToString().PadLeft(6, '0'); } decimal totalproduto = 0; int contadoritem = 0; foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); if (NaoExibirValores == "true") { LIS_PRODUTOSPEDIDOColl[contadoritem].VALORUNITARIO = 0; LIS_PRODUTOSPEDIDOColl[contadoritem].VALORTOTAL = 0; } } //Exibi preço do MT no pedido PEDIDOEntity PEDIDOTy = new PEDIDOEntity(); PEDIDOProvider PEDIDOP = new PEDIDOProvider(); PEDIDOTy = PEDIDOP.Read(Convert.ToInt32(LIS_PEDIDOColl[0].IDPEDIDO)); contadoritem = 0; foreach (LIS_PRODUTOSPEDIDOMTQEntity item in LIS_PRODUTOSPEDIDOMTQColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); if (PEDIDOTy.FLAGVLMETRO.TrimEnd() == "S") { LIS_PRODUTOSPEDIDOMTQColl[contadoritem].VALORUNITARIO = item.VALORMETRO; } if (NaoExibirImagemProduto == "true") { LIS_PRODUTOSPEDIDOMTQColl[contadoritem].FOTO = null; } if (NaoExibirValores == "true") { LIS_PRODUTOSPEDIDOMTQColl[contadoritem].VALORUNITARIO = 0; LIS_PRODUTOSPEDIDOMTQColl[contadoritem].VALORTOTAL = 0; } contadoritem++; } if (LIS_PRODUTOSPEDIDOMTQColl.Count > 0) { VisualizaProduto1 = "true"; } if (LIS_PRODUTOSPEDIDOColl.Count > 0) { VisualizaProduto2 = "true"; } if (NaoExibirValores == "true") { totalproduto = 0; LIS_PEDIDOColl[0].TOTALPEDIDO = 0; LIS_PEDIDOColl[0].VALORDEVEDOR = 0; LIS_PEDIDOColl[0].VALORDESCONTO = 0; LIS_PEDIDOColl[0].VALORPAGO = 0; } //setando os parametro Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[8]; 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("nomeempresa", NomeEmpresa); p[4] = new Microsoft.Reporting.WinForms.ReportParameter("VisualizaProduto1", VisualizaProduto1); p[5] = new Microsoft.Reporting.WinForms.ReportParameter("VisualizaProduto2", VisualizaProduto2); p[6] = new Microsoft.Reporting.WinForms.ReportParameter("NaoExibirValores", NaoExibirValores); p[7] = new Microsoft.Reporting.WinForms.ReportParameter("NaoExibirTotalMT2", NaoExibirTotalMT2); reportViewer1.LocalReport.SetParameters(p); //Remover produtos que não vao ser exibido LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDO2 = new LIS_PRODUTOSPEDIDOCollection(); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { if (item.FLAGEXIBIR.TrimEnd().TrimStart() == "S") { LIS_PRODUTOSPEDIDO2.Add(item); } } //Remover produtos que não vao ser exibido LIS_PRODUTOSPEDIDOMTQCollection LIS_PRODUTOSPEDIDOMTQ2 = new LIS_PRODUTOSPEDIDOMTQCollection(); foreach (LIS_PRODUTOSPEDIDOMTQEntity item in LIS_PRODUTOSPEDIDOMTQColl) { if (item.FLAGEXIBIR.TrimEnd().TrimStart() == "S") { LIS_PRODUTOSPEDIDOMTQ2.Add(item); } } this.LIS_CLIENTECollectionBindingSource.DataSource = LIS_CLIENTEColl; this.EMPRESACollectionBindingSource.DataSource = EMPRESAColl; this.LIS_PEDIDOCollectionBindingSource.DataSource = LIS_PEDIDOColl; this.LIS_PRODUTOSPEDIDOCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDO2; this.LIS_PRODUTOSPEDIDOMTQCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDOMTQ2; this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.RefreshReport(); }
private void btnPesquisa_Click(object sender, EventArgs e) { if (ValidacoesItensServicos()) { try { CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0); RowsFiltroCollection RowRelatorio = new RowsFiltroCollection(); if (Convert.ToInt32(cbProduto.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("idproduto", "System.Int32", "=", cbProduto.SelectedValue.ToString())); } if (Convert.ToInt32(cbGrupoCategoria.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDGRUPOCATEGORIA", "System.Int32", "=", cbGrupoCategoria.SelectedValue.ToString())); } if (Convert.ToInt32(cbMarca.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", cbMarca.SelectedValue.ToString())); } if (Convert.ToInt32(cbCliente.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDCLIENTE", "System.Int32", "=", cbCliente.SelectedValue.ToString())); } if (Convert.ToInt32(cbFuncionario.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDVENDEDOR", "System.Int32", "=", cbFuncionario.SelectedValue.ToString())); } if (Convert.ToInt32(cbSupervisor.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDSUPERVISOR", "System.Int32", "=", cbSupervisor.SelectedValue.ToString())); } if (Convert.ToInt32(cbStatus.SelectedValue) > 0) { RowRelatorio.Add(new RowsFiltro("IDSTATUS", "System.Int32", "=", cbStatus.SelectedValue.ToString())); } if (mkdDataInicial.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", ">=", Util.ConverStringDateSearch(mkdDataInicial.Text))); } if (mkdDataFinal.Text != " / /") { RowRelatorio.Add(new RowsFiltro("DTEMISSAO", "System.DateTime", "<=", Util.ConverStringDateSearch(mkdDataFinal.Text))); } if (rdOrcamento.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "S")); } else if (rdVenda.Checked) { RowRelatorio.Add(new RowsFiltro("FLAGORCAMENTO", "System.String", "=", "N")); } /////////////////////////////////////////////////////////////////////////////////////////// if (rbOrdenarPedido.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "IDPEDIDO desc"); } else if (rbOrdenarProduto.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO"); } else if (rbDataEmissao.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "DTEMISSAO"); } else if (rbDtVecto.Checked) { LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio, "DATAVECTO"); } LIS_PRODUTOSPEDIDOEntity LIS_PRODUTOSPEDIDOTy = new LIS_PRODUTOSPEDIDOEntity(); LIS_PRODUTOSPEDIDOTy.VALORTOTAL = SumTotalPesquisa("VALORTOTAL"); LIS_PRODUTOSPEDIDOTy.QUANTIDADE = SumTotalPesquisa("QUANTIDADE"); LIS_PRODUTOSPEDIDOColl.Add(LIS_PRODUTOSPEDIDOTy); DGDadosServicos.AutoGenerateColumns = false; DGDadosServicos.DataSource = LIS_PRODUTOSPEDIDOColl; lbltTotalMtLinear.Text = (LIS_PRODUTOSPEDIDOColl.Count - 1).ToString(); this.Cursor = Cursors.Default; } catch (Exception ex) { this.Cursor = Cursors.Default; MessageBox.Show("Erro técnico: " + ex.Message); } } }
private void PreencheGrid() { TotalGeralPedido = 0; TotalGeralComissao = 0; CreaterCursor Cr = new CreaterCursor(); this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 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, "PEDIDO", "EMISSÃO", "CLIENTE", "STATUS", "FUNCIONÁRIO", "TOTAL PEDIDO", "COMISSÃO"); row1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row1); foreach (var LIS_PEDIDOTy in LIS_PEDIDOColl) { string DataEmissao = string.Empty; if (LIS_PEDIDOTy.IDPEDIDO != null) { DataEmissao = Convert.ToDateTime(LIS_PEDIDOTy.DTEMISSAO).ToString("dd/MM/yyyy"); } string TotalPedido = Convert.ToDecimal(LIS_PEDIDOTy.TOTALPEDIDO).ToString("n2"); string TotalComissao = Convert.ToDecimal(LIS_PEDIDOTy.VALORCOMISSAO).ToString("n2"); DataGridViewRow row2 = new DataGridViewRow(); row2.CreateCells(DataGriewDados, LIS_PEDIDOTy.IDPEDIDO, DataEmissao, LIS_PEDIDOTy.NOMECLIENTE, LIS_PEDIDOTy.NOMESTATUS, LIS_PEDIDOTy.NOMEVENDEDOR, TotalPedido, TotalComissao); row2.DefaultCellStyle.Font = new Font("Arial", 8); DataGriewDados.Rows.Add(row2); TotalGeralPedido += Convert.ToDecimal(TotalPedido); TotalGeralComissao += Convert.ToDecimal(TotalComissao); if (chkExibirProdutos.Checked) { //Produtos DataGridViewRow row3 = new DataGridViewRow(); row3.CreateCells(DataGriewDados, "PROD./LINEAR"); 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_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOColl = new LIS_PRODUTOSPEDIDOCollection(); LIS_PRODUTOSPEDIDOColl = ProdutoRel(Convert.ToInt32(LIS_PEDIDOTy.IDPEDIDO)); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { 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); } //Produto MT2 DataGridViewRow row3_2 = new DataGridViewRow(); row3_2.CreateCells(DataGriewDados, "PROD. MT2"); 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", "Produto"); row4_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(row4_2); LIS_PRODUTOSPEDIDOMTQCollection LIS_PRODUTOSPEDIDOMTQColl = new LIS_PRODUTOSPEDIDOMTQCollection(); LIS_PRODUTOSPEDIDOMTQColl = ProdutoRel2(Convert.ToInt32(LIS_PEDIDOTy.IDPEDIDO)); foreach (LIS_PRODUTOSPEDIDOMTQEntity item in LIS_PRODUTOSPEDIDOMTQColl) { 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); } DataGridViewRow rowLinha_2 = new DataGridViewRow(); rowLinha_2.CreateCells(DataGriewDados, "_________", "__________", "____________________________________________", "____________________________", "____________________________", "__________", "__________"); rowLinha_2.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold); DataGriewDados.Rows.Add(rowLinha_2); } } 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; }
public LIS_PRODUTOSPEDIDOCollection ReadCollectionByParameter(List <RowsFiltro> RowsFiltro, string FieldOrder) { FbDataReader dataReader = null; string strSqlCommand = String.Empty; LIS_PRODUTOSPEDIDOCollection collection = null; try { if (RowsFiltro != null) { if (RowsFiltro.Count > 0) { strSqlCommand = "SELECT * FROM LIS_PRODUTOSPEDIDO WHERE ("; ArrayList _rowsFiltro = new ArrayList(); RowsFiltro.ForEach(delegate(RowsFiltro i) { string[] item = { i.Condicao.ToString(), i.Campo.ToString(), i.Tipo.ToString(), i.Operador.ToString(), i.Valor.ToString() }; _rowsFiltro.Add(item); }); int _count = 1; foreach (string[] item in _rowsFiltro) { strSqlCommand += "(" + item[1] + " " + item[3]; switch (item[2]) { case ("System.String"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " '" + item[4] + "')"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Int16"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Int32"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Int64"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Double"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Decimal"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Float"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " " + item[4] + ")"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Byte"): strSqlCommand += " " + item[4] + ")"; break; case ("System.SByte"): strSqlCommand += " " + item[4] + ")"; break; case ("System.Char"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " '" + item[4] + "')"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.DateTime"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " '" + item[4] + "')"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Guid"): if (item[3].ToUpper() != "LIKE") { strSqlCommand += " '" + item[4] + "')"; } else { strSqlCommand += " '%" + item[4] + "%')"; } break; case ("System.Boolean"): strSqlCommand += " " + item[4] + ")"; break; } if (_rowsFiltro.Count > 1) { if (_count < _rowsFiltro.Count) { strSqlCommand += " " + item[0] + " "; } _count++; } } strSqlCommand += ") order by " + FieldOrder; } else { strSqlCommand = "SELECT * FROM LIS_PRODUTOSPEDIDO order by " + FieldOrder; } } else { strSqlCommand = "SELECT * FROM LIS_PRODUTOSPEDIDO order by " + FieldOrder; } //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand(strSqlCommand, dbCnn); dbCommand.CommandType = CommandType.Text; dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = new FbConnection(connectionString); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand(strSqlCommand, dbCnn); dbCommand.CommandType = CommandType.Text; dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } collection = ExecuteReader(ref collection, ref dataReader, dbCommand); if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); } if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } return(collection); } catch (Exception ex) { // Deleta reader if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); } if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } }
public LIS_PRODUTOSPEDIDOCollection ReadCollection() { FbDataReader dataReader = null; try { LIS_PRODUTOSPEDIDOCollection collection = null; //Verificando a existência de um transação aberta if (dbTransaction != null) { if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SELECT * FROM LIS_PRODUTOSPEDIDO", dbCnn); dbCommand.Transaction = ((FbTransaction)(dbTransaction)); } else { if (dbCnn == null) { dbCnn = ((FbConnection)GetConnectionDB()); } if (dbCnn.State == ConnectionState.Closed) { dbCnn.Open(); } dbCommand = new FbCommand("SELECT * FROM LIS_PRODUTOSPEDIDO", dbCnn); dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted); } // Tipo do comando de banco Procedure ou SQL dbCommand.CommandType = CommandType.Text; collection = ExecuteReader(ref collection, ref dataReader, dbCommand); if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); } if (dbTransaction == null) { dbCommand.Transaction.Commit(); dbCnn.Close(); } return(collection); } catch (Exception ex) { // Deleta reader if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); } if (dbTransaction != null) { this.RollbackTransaction(); } else { if (dbCommand.Transaction != null) { dbCommand.Transaction.Rollback(); } if (dbCnn.State == ConnectionState.Open) { dbCnn.Close(); } } throw ex; } }
private void FrmRelatPedidoVendas_Load(object sender, EventArgs e) { 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("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PEDIDOProvider LIS_PEDIDOP = new LIS_PEDIDOProvider(); LIS_PEDIDOColl = LIS_PEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOProvider LIS_PRODUTOSPEDIDOP = new LIS_PRODUTOSPEDIDOProvider(); LIS_PRODUTOSPEDIDOColl = LIS_PRODUTOSPEDIDOP.ReadCollectionByParameter(RowRelatorio); //Dados do Produto MTQ RowRelatorio.Clear(); RowRelatorio.Add(new RowsFiltro("IDPEDIDO", "System.Int32", "=", IDPEDIDO.ToString())); LIS_PRODUTOSPEDIDOMTQProvider LIS_PRODUTOSPEDIDOMTQP = new LIS_PRODUTOSPEDIDOMTQProvider(); LIS_PRODUTOSPEDIDOMTQColl = LIS_PRODUTOSPEDIDOMTQP.ReadCollectionByParameter(RowRelatorio); LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDOPrint = new LIS_PRODUTOSPEDIDOCollection(); string titulo = "Nº PEDIDO " + IDPEDIDO.ToString().PadLeft(6, '0'); if (LIS_PEDIDOColl[0].FLAGORCAMENTO.TrimEnd() == "S") { titulo = "Nº ORÇAMENTO " + IDPEDIDO.ToString().PadLeft(6, '0'); } decimal totalproduto = 0; foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); LIS_PRODUTOSPEDIDOPrint.Add(item); } //Exibi preço do MT no pedido PEDIDOEntity PEDIDOTy = new PEDIDOEntity(); PEDIDOProvider PEDIDOP = new PEDIDOProvider(); PEDIDOTy = PEDIDOP.Read(Convert.ToInt32(LIS_PEDIDOColl[0].IDPEDIDO)); int contadoritem = 0; foreach (LIS_PRODUTOSPEDIDOMTQEntity item in LIS_PRODUTOSPEDIDOMTQColl) { totalproduto += Convert.ToDecimal(item.VALORTOTAL); LIS_PRODUTOSPEDIDOEntity LIS_PRODUTOSPEDIDOTy = new LIS_PRODUTOSPEDIDOEntity(); LIS_PRODUTOSPEDIDOTy.IDPRODUTO = item.IDPRODUTO; LIS_PRODUTOSPEDIDOTy.NOMEPRODUTO = item.NOMEPRODUTO; LIS_PRODUTOSPEDIDOTy.DADOSADICIONAIS = item.DADOADICIONAIS; LIS_PRODUTOSPEDIDOTy.QUANTIDADE = item.QUANTIDADE; if (PEDIDOTy.FLAGVLMETRO.TrimEnd() == "S") { LIS_PRODUTOSPEDIDOTy.VALORUNITARIO = item.VALORMETRO; } else { LIS_PRODUTOSPEDIDOTy.VALORUNITARIO = item.VALORUNITARIO; } LIS_PRODUTOSPEDIDOTy.NOMECOR = item.NOMECOR; LIS_PRODUTOSPEDIDOTy.IDAMBIENTE = item.IDAMBIENTE; LIS_PRODUTOSPEDIDOTy.NOMEAMBIENTE = item.NOMEAMBIENTE; LIS_PRODUTOSPEDIDOTy.ALTURA = item.ALTURA; LIS_PRODUTOSPEDIDOTy.LARGURA = item.LARGURA; LIS_PRODUTOSPEDIDOTy.TOTALMT = item.MT2; if (!ExibirApenasVlUnitario) { LIS_PRODUTOSPEDIDOTy.VALORTOTAL = 0; } else { LIS_PRODUTOSPEDIDOTy.VALORTOTAL = item.VALORTOTAL; } LIS_PRODUTOSPEDIDOTy.FLAGEXIBIR = item.FLAGEXIBIR; LIS_PRODUTOSPEDIDOPrint.Add(LIS_PRODUTOSPEDIDOTy); contadoritem++; } //setando os parametro Microsoft.Reporting.WinForms.ReportParameter[] p = new Microsoft.Reporting.WinForms.ReportParameter[4]; 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("NaoExibirValores", NaoExibirValores); reportViewer1.LocalReport.SetParameters(p); //Remover produtos que não vao ser exibido LIS_PRODUTOSPEDIDOCollection LIS_PRODUTOSPEDIDO2 = new LIS_PRODUTOSPEDIDOCollection(); foreach (LIS_PRODUTOSPEDIDOEntity item in LIS_PRODUTOSPEDIDOPrint) { if (item.FLAGEXIBIR.TrimEnd().TrimStart() == "S") { LIS_PRODUTOSPEDIDO2.Add(item); } } this.LIS_CLIENTECollectionBindingSource.DataSource = LIS_CLIENTEColl; this.EMPRESACollectionBindingSource.DataSource = EMPRESAColl; this.LIS_PEDIDOCollectionBindingSource.DataSource = LIS_PEDIDOColl; this.LIS_PRODUTOSPEDIDOCollectionBindingSource.DataSource = LIS_PRODUTOSPEDIDO2; this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.RefreshReport(); }