private void adicionarProduto() { if (_LanPedido_Item != null && qtdProduto.Value > 0) { _LanPedido_Item.Quantidade = qtdProduto.Value; object precoVenda = new TCD_CadProduto().BuscarPrecoVenda(CdEmpresa, _LanPedido_Item.Cd_produto, TbPreco); if (precoVenda == null || string.IsNullOrEmpty(precoVenda.ToString()) || decimal.Parse(precoVenda.ToString()) <= 0) { closeWithMessage("O produto de código: " + _LanPedido_Item.Cd_produto + " \n" + "Descrição: " + _LanPedido_Item.Ds_produto + " \n" + "Não possui preço de venda pré-cadastrado. \n" + "Empresa: " + _LanPedido_Item.Cd_Empresa + " \n" + "Tab. Preço: " + TbPreco, false); return; } _LanPedido_Item.Vl_unitario = decimal.Parse(precoVenda.ToString()); _LanPedido_Item.Vl_subtotal = _LanPedido_Item.Vl_unitario * _LanPedido_Item.Quantidade; if (!validarExistencia(_LanPedido_Item)) { bsProdutos.Add(_LanPedido_Item); } bsProdutos.ResetBindings(true); limparCampos(); } else if (string.IsNullOrEmpty(qtdProduto.Value.ToString()) || qtdProduto.Value <= 0) { MessageBox.Show("É permitido adicionar apenas produtos com quantidade maior que zero.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CD_PRODUTO_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(CD_PRODUTO.Text.SoNumero().Trim())) { TpBusca[] filtro = new TpBusca[2]; filtro[0].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[0].vOperador = "<>"; filtro[0].vVL_Busca = "'C'"; filtro[1].vNM_Campo = string.Empty; filtro[1].vOperador = string.Empty; filtro[1].vVL_Busca = "(a.cd_produto like '%" + CD_PRODUTO.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (CD_PRODUTO.TextOld != null ? CD_PRODUTO.TextOld.ToString() : ds_produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + CD_PRODUTO.Text.Trim() + "'))"; System.Collections.Hashtable hs = new System.Collections.Hashtable(2); hs.Add("@CD_EMPRESA", pCd_empresa); hs.Add("@CD_TABELAPRECO", pCd_tabelapreco); TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 1, string.Empty, string.Empty, string.Empty, hs); if (lProd.Count > 0) { rProd = lProd[0]; CD_PRODUTO.Text = lProd[0].CD_Produto; ds_produto.Text = lProd[0].DS_Produto; afterficha(); } else { MessageBox.Show("Produto não encontrado pelo código informado.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static string Gravar(TRegistro_CadProduto val, TObjetoBanco banco) { bool st_transacao = false; TCD_CadProduto qtb_produto = new TCD_CadProduto(); try { if (banco == null) { st_transacao = qtb_produto.CriarBanco_Dados(true); } else { qtb_produto.Banco_Dados = banco; } TList_CFG cfg = TCN_CFG.Buscar(string.Empty, qtb_produto.Banco_Dados); val.CD_Produto = CamadaDados.TDataQuery.getPubVariavel(qtb_produto.Grava(val), "@P_CD_PRODUTO"); //monta objeto CamadaDados.Estoque.TRegistro_LanPrecoItem preco = new CamadaDados.Estoque.TRegistro_LanPrecoItem(); preco.CD_Empresa = cfg[0].cd_empresa; preco.CD_TabelaPreco = cfg[0].cd_tabelapreco; preco.CD_Produto = val.CD_Produto; preco.VL_PrecoVenda = val.Vl_precovenda; CamadaDados.Estoque.TList_LanPrecoItem lista = new CamadaDados.Estoque.TList_LanPrecoItem(); lista.Add(preco); TCN_LanPrecoItem.Grava_LanPrecoItem(lista, qtb_produto.Banco_Dados); if (st_transacao) { qtb_produto.Banco_Dados.Commit_Tran(); } return(val.CD_Produto); } catch (Exception ex) { if (st_transacao) { qtb_produto.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro gravar produto: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_produto.deletarBanco_Dados(); } } }
private void BuscarProduto() { TpBusca[] filtro = new TpBusca[1]; filtro[0].vNM_Campo = "isnull(e.ST_Servico, 'N')"; filtro[0].vOperador = pSt_servico ? "=" : "<>"; filtro[0].vVL_Busca = "'S'"; if (St_consumoInterno) { Array.Resize(ref filtro, filtro.Length + 1); filtro[filtro.Length - 1].vNM_Campo = "isnull(e.ST_consumointerno, 'N')"; filtro[filtro.Length - 1].vOperador = "="; filtro[filtro.Length - 1].vVL_Busca = "'S'"; } TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(CD_Produto.Text)) { rProd = UtilPesquisa.BuscarProduto(string.Empty, CD_Empresa, Nm_empresa, CD_TabelaPreco, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { rProd = UtilPesquisa.BuscarProduto(CD_Produto.Text, CD_Empresa, Nm_empresa, CD_TabelaPreco, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, filtro); } else { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 2].vOperador = "<>"; filtro[filtro.Length - 2].vVL_Busca = "'C'"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (CD_Produto.TextOld != null ? CD_Produto.TextOld.ToString() : CD_Produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + CD_Produto.Text.Trim() + "'))"; TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count > 0) { rProd = lProd[0]; } } if (rProd != null) { CD_Produto.Text = rProd.CD_Produto; DS_Produto.Text = rProd.DS_Produto; sigla_unidade.Text = rProd.Sigla_unidade; DS_Observacao.Text = rProd.DS_Tecnica; st_kit.Checked = rProd.St_composto; if ((!st_servico.Checked)) { //Buscar local armazenagem object obj = new TCD_CadLocalArm().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_est_empresa_x_localarm x " + "where x.cd_local = a.cd_local " + "and x.cd_empresa = '" + CD_Empresa.Trim() + "')" }, new TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_est_localarm_x_produto x " + "where x.cd_local = a.cd_local " + "and x.cd_produto = '" + CD_Produto.Text.Trim() + "')" } }, "a.cd_local"); if (obj != null) { CD_Local.Text = obj.ToString(); CD_Local_Leave(this, new EventArgs()); Quantidade.Focus(); } else { if (string.IsNullOrEmpty(CD_Local.Text)) { CD_Local.Focus(); } else { Quantidade.Focus(); } } } if (st_kit.Checked) { Height = 900; Quantidade.Value = 1; try { (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS = TCN_LanServicoPecas.MontarFichaTecOS(CD_Produto.Text, CD_Empresa, Quantidade.Value, null); BS_Pecas.ResetCurrentItem(); } catch (Exception ex) { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { Height = 456; (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.Clear(); BS_Pecas.ResetCurrentItem(); } } ConsultaPreco(); }
private void TFPneu_Load(object sender, EventArgs e) { this.Icon = ResourcesUtils.TecnoAliance_ICO; if (rpneu != null) { bsPneu.DataSource = new TList_LanPneu() { rpneu }; cbEmpresa.Enabled = false; Nr_serie.Enabled = false; cd_produto.Enabled = false; bb_produto.Enabled = false; } else { bsPneu.AddNew(); } //Buscar Empresa cbEmpresa.DataSource = new TCD_CadEmpresa().Select( new TpBusca[] { new TpBusca() { vNM_Campo = string.Empty, vOperador = "exists", vVL_Busca = "(select 1 from tb_div_usuario_x_empresa x " + "where x.cd_empresa = a.cd_empresa " + "and ((x.login = '******') or " + "(exists(select 1 from tb_div_usuario_x_grupos y " + " where y.logingrp = x.login and y.loginusr = '******'))))" } }, 0, string.Empty); cbEmpresa.DisplayMember = "NM_Empresa"; cbEmpresa.ValueMember = "CD_Empresa"; //Buscar Produto Pneu TList_CadProduto lProduto = new TCD_CadProduto().Select( new TpBusca[] { new TpBusca() { vNM_Campo = "isnull(a.st_registro, 'A')", vOperador = "=", vVL_Busca = "'A'" }, new TpBusca() { vNM_Campo = "isnull(e.ST_Pneu, 'N')", vOperador = "=", vVL_Busca = "'S'" } }, 0, string.Empty, string.Empty, string.Empty); if (lProduto.Count.Equals(1)) { cd_produto.Text = lProduto[0].CD_Produto; ds_produto.Text = lProduto[0].DS_Produto; } else if (lProduto.Count.Equals(0)) { MessageBox.Show("Não existe nenhum produto cadastrado com o Tipo de Produto Pneu!\r\n" + "Por favor verifique o tipo de produto, e atualize o cadastro de produto. ", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.Cancel; } }
private void BuscarProduto() { if (!string.IsNullOrEmpty(cd_empresa.Text)) { //Prencher variavel codigo de barra codigoBarra = cd_produto.Text; TpBusca[] filtro = new TpBusca[0]; if (string.IsNullOrEmpty(cd_produto.Text)) { rProd = UtilPesquisa.BuscarProduto(string.Empty, cd_empresa.Text, nm_empresa.Text, cd_tabelapreco.Text, new Componentes.EditDefault[] { cd_produto, DS_Produto }, null); } else if (cd_produto.Text.SoNumero().Trim().Length != cd_produto.Text.Trim().Length) { rProd = UtilPesquisa.BuscarProduto(cd_produto.Text, cd_empresa.Text, nm_empresa.Text, cd_tabelapreco.Text, new Componentes.EditDefault[] { cd_produto, DS_Produto }, null); } else { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 2].vOperador = "<>"; filtro[filtro.Length - 2].vVL_Busca = "'C'"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + cd_produto.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (!string.IsNullOrWhiteSpace(cd_produto.TextOld) ? cd_produto.TextOld : cd_produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + cd_produto.Text.Trim() + "'))"; TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count > 0) { rProd = lProd[0]; } } if (rProd != null) { cd_produto.Text = rProd.CD_Produto; DS_Produto.Text = rProd.DS_Produto; cd_local.Enabled = !rProd.St_composto; bb_local.Enabled = !rProd.St_composto; qtd_entrada.Enabled = !rProd.St_composto; vl_entrada.Enabled = !rProd.St_composto; codBarra.Text = BuscarCodBarra(); //Buscar Preço Venda if (!string.IsNullOrEmpty(cd_produto.Text) && !string.IsNullOrEmpty(cd_tabelapreco.Text)) { vl_precovenda.Value = TCN_LanPrecoItem.Busca_ConsultaPreco(cd_empresa.Text, cd_produto.Text, cd_tabelapreco.Text, null); } if (!rProd.St_composto) { //Buscar Preço Custo if (!string.IsNullOrEmpty(cd_produto.Text) && !string.IsNullOrEmpty(cd_local.Text)) { vl_custo.Value = TCN_LanEstoque.Vl_MedioLocal(cd_empresa.Text, cd_produto.Text, cd_local.Text, null); vl_entrada.Value = vl_custo.Value; } //Buscar Saldo quantidade.Value = BuscarSaldoLocal(); //Total Custo Estoque if (quantidade.Value > 0 && vl_custo.Value > 0) { vl_subtotal.Value = quantidade.Value * vl_custo.Value; } } } else { cd_produto.Clear(); cd_produto.Focus(); //se o produto nao existir com o codigo add ao campo para cadastrar if (!string.IsNullOrEmpty(codigoBarra)) { codBarra.Text = codigoBarra; if (InputBox("Pergunta", "Produto não encontrado com o código de barras!\r\n" + "Deseja incluir código ao novo produto ou relacionar ao existente?") == DialogResult.Yes) { bb_novoProd_Click(this, new EventArgs()); } else { BuscarProduto(); } } } if (!string.IsNullOrEmpty(cd_local.Text)) { qtd_entrada.Focus(); } } else { MessageBox.Show("Obrigatório selecionar empresa para Buscar o Produto!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); cd_empresa.Focus(); } }
private void BuscarProduto() { TpBusca[] filtro = new TpBusca[0]; if (string.IsNullOrEmpty(CD_Produto.Text)) { if (UtilPesquisa.BuscarProduto(string.Empty, string.Empty, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, null) == null) { MessageBox.Show("Produto não encontrado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); CD_Produto.Clear(); CD_Produto.Focus(); return; } } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { if (UtilPesquisa.BuscarProduto(CD_Produto.Text, string.Empty, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, DS_Produto }, null) == null) { MessageBox.Show("Produto não encontrado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); CD_Produto.Clear(); CD_Produto.Focus(); return; } } else { Array.Resize(ref filtro, filtro.Length + 2); filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')"; filtro[filtro.Length - 2].vOperador = "<>"; filtro[filtro.Length - 2].vVL_Busca = "'C'"; filtro[filtro.Length - 1].vNM_Campo = string.Empty; filtro[filtro.Length - 1].vOperador = string.Empty; filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (CD_Produto.TextOld != null ? CD_Produto.TextOld.ToString() : CD_Produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + CD_Produto.Text.Trim() + "'))"; TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count > 0) { CD_Produto.Text = lProd[0].CD_Produto; DS_Produto.Text = lProd[0].DS_Produto; } } if (!string.IsNullOrEmpty(CD_Produto.Text)) { if (!string.IsNullOrEmpty(CD_Local.Text)) { Quantidade.Focus(); } else { CD_Local.Focus(); } } }
private void buscarProduto() { TpBusca[] tps = new TpBusca[0]; Estruturas.CriarParametro(ref tps, "", "(select 1 " + "from TB_EST_CodBarra xxx " + "where xxx.CD_Produto = a.cd_produto " + "and xxx.CD_CodBarra = '" + codBarras.Text.Trim() + "')", "exists"); TList_CadProduto lProd = new TCD_CadProduto().Select(tps, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count.Equals(0)) { MessageBox.Show("Nenhum produto foi encontrado pelo código de barras: " + codBarras.Text.Trim() + " informado. " + "Verifique o valor e acione ENTER novamente.", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { _LanPedido_Item = new TRegistro_LanPedido_Item(); //Buscar local de armazenagem do produto TList_CadLocalArm_X_Produto List_Local_x_Produto = new TList_CadLocalArm_X_Produto(); if (!string.IsNullOrEmpty(lProd[0].CD_Produto)) { List_Local_x_Produto = TCN_CadLocalArm_X_Produto.Busca(string.Empty, lProd[0].CD_Produto); } Componentes.EditDefault CD_Local = new Componentes.EditDefault(); Componentes.EditDefault DS_Local = new Componentes.EditDefault(); if (List_Local_x_Produto.Count.Equals(1)) { CD_Local.Text = List_Local_x_Produto[0].CD_Local; DS_Local.Text = List_Local_x_Produto[0].DS_Local; } else if (List_Local_x_Produto.Count > 1) { string vParam = "isnull(a.st_registro, 'A')|<>|'C';" + "a.cd_produto|=|" + lProd[0].CD_Produto; UtilPesquisa.BTN_BUSCA("c.DS_Local|Local|300", new Componentes.EditDefault[] { CD_Local, DS_Local }, new TCD_CadLocalArm_X_Produto(), vParam); } else { TList_CadLocalArm_X_Empresa _CadLocalArm_X_Empresas = TCN_CadLocalArm_X_Empresa.Busca(string.Empty, CdEmpresa, "A", string.Empty, null); if (_CadLocalArm_X_Empresas.Count.Equals(0)) { closeWithMessage("Não existe pré-cadastrado no sistema local de armazenagem para a empresa informada. " + "Não será possível finalizar a operação.", false); return; } else if (_CadLocalArm_X_Empresas.Count > 1) { string vParam = "isnull(a.st_registro, 'A')|<>|'C';" + "a.cd_empresa|=|" + CdEmpresa; UtilPesquisa.BTN_BUSCA("c.DS_Local|Local|300", new Componentes.EditDefault[] { CD_Local, DS_Local }, new TCD_CadLocalArm_X_Empresa(), vParam); } else { CD_Local.Text = _CadLocalArm_X_Empresas[0].CD_Local; DS_Local.Text = _CadLocalArm_X_Empresas[0].DS_Local; } } if (string.IsNullOrEmpty(CD_Local.Text.Trim())) { closeWithMessage("É obrigatório informar local de armazenagem.", false); return; } _LanPedido_Item.Cd_produto = lProd[0].CD_Produto; _LanPedido_Item.Ds_produto = lProd[0].DS_Produto; _LanPedido_Item.Cd_local = CD_Local.Text.Trim(); _LanPedido_Item.Ds_local = DS_Local.Text.Trim(); _LanPedido_Item.Cd_unidade_valor = lProd[0].CD_Unidade; _LanPedido_Item.Ds_unidade_valor = lProd[0].DS_Unidade.Trim(); _LanPedido_Item.Sg_unidade_valor = lProd[0].Sigla_unidade.Trim(); _LanPedido_Item.St_registro = "A"; adicionarProduto(); } }
private void BuscarProduto() { pId_caracteristica = string.Empty; Referencia = string.Empty; TRegistro_CadProduto rProd = null; if (string.IsNullOrEmpty(CD_Produto.Text)) { rProd = UtilPesquisa.BuscarProduto(string.Empty, string.Empty, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, ds_produto }, null); } else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length) { rProd = UtilPesquisa.BuscarProduto(CD_Produto.Text, string.Empty, string.Empty, string.Empty, new Componentes.EditDefault[] { CD_Produto, ds_produto }, null); } else { TList_CadProduto lProd = new TCD_CadProduto().Select( new TpBusca[] { new TpBusca() { vNM_Campo = "isnull(a.st_registro, 'A')", vOperador = "<>", vVL_Busca = "'C'" }, new TpBusca() { vNM_Campo = string.Empty, vOperador = string.Empty, vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "') or " + "(a.Codigo_Alternativo = '" + (!string.IsNullOrWhiteSpace(CD_Produto.TextOld) ? CD_Produto.TextOld : CD_Produto.Text.Trim()) + "') or " + "(exists(select 1 from tb_est_codbarra x " + " where x.cd_produto = a.cd_produto " + " and x.cd_codbarra = '" + CD_Produto.Text.Trim() + "'))" } }, 0, string.Empty, string.Empty, string.Empty); if (lProd.Count > 0) { rProd = lProd[0]; } } if (rProd != null) { CD_Produto.Text = rProd.CD_Produto; ds_produto.Text = rProd.DS_Produto; Referencia = rProd.Codigo_alternativo; pId_caracteristica = rProd.Id_caracteristicaHstr; Quantidade.Focus(); } }
private void TFFichaTec_Load(object sender, EventArgs e) { if (projetista) { panelDados2.Visible = false; } pDados.set_FormatZero(); if (vSt_Proj && rficha == null) { bsFichaTec.AddNew(); editDefault1.Text = vId_atividade; editDefault2.Text = vDs_atividade; editDefault1.Focus(); } else if (rficha == null) { bsFichaTec.AddNew(); if (!string.IsNullOrEmpty(CD_PRODUTO.Text)) { quantidade.Focus(); } else { ds_produto.Focus(); } editDefault1.Text = vId_atividade; editDefault2.Text = vDs_atividade; panelDados3.Enabled = false; } else { panelDados3.Enabled = false; TList_FichaItens lprod = new TList_FichaItens(); bsFichaTec.DataSource = new TList_FichaTec() { rficha }; ds_produto.Text = rficha.Ds_produto; vl_unitario.Value = rficha.Vl_unitario; if (rficha.lfichaItens.Count > 0) { rficha.lfichaItens.ForEach(p => { TRegistro_FichaItens prod = new TRegistro_FichaItens(); prod.Cd_itemstr = p.Cd_itemstr.ToString(); prod.quantidade = p.quantidade; prod.vl_unitario = p.vl_unitario; prod.vl_subtotal = p.vl_unitario * p.quantidade; object a = new TCD_CadProduto().BuscarEscalar(new TpBusca[] { new Utils.TpBusca() { vNM_Campo = "a.cd_produto", vOperador = "=", vVL_Busca = p.Cd_itemstr.ToString() } }, "a.ds_produto"); prod.ds_item = a.ToString(); lprod.Add(prod); }); bsItens.DataSource = lprod; } //cd_produto_Leave(this, new EventArgs()); quantidade.Focus(); TList_FichaTecProduto lFichaptd = new TList_FichaTecProduto(); //busca itens produto if (!string.IsNullOrEmpty(CD_PRODUTO.Text)) { lFichaptd = CamadaNegocio.Estoque.Cadastros.TCN_FichaTecProduto.Buscar(CD_PRODUTO.Text, string.Empty, null); if (lFichaptd.Count > 0 && bsItens.Count <= 0) { bsItens.Clear(); lFichaptd.ForEach(p => { TRegistro_FichaItens pro = new TRegistro_FichaItens(); pro.Cd_itemstr = p.Cd_item; pro.ds_item = p.Ds_item; pro.quantidade = p.Quantidade; pro.vl_unitario = p.Vl_custoservico; bsItens.Add(p); }); bsItens.ResetCurrentItem(); } } } if (bsItens.Count > 0) { Height = 593; ficha = true; } else { Height = 190; ficha = false; } calculatotal(); }