private void TFDadosPreVenda_Load(object sender, EventArgs e) { pDados.set_FormatZero(); bsPreVenda.AddNew(); //Buscar vendedor Padrao object obj = new CamadaDados.Financeiro.Cadastros.TCD_CadClifor().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "isnull(a.st_vendedor, 'N')", vOperador = "=", vVL_Busca = "'S'" }, new TpBusca() { vNM_Campo = "isnull(a.st_registro, 'A')", vOperador = "<>", vVL_Busca = "'C'" }, new TpBusca() { vNM_Campo = "isnull(a.st_funcativo, 'N')", vOperador = "=", vVL_Busca = "'S'" }, new TpBusca() { vNM_Campo = "a.loginvendedor", vOperador = "=", vVL_Busca = "'" + Utils.Parametros.pubLogin.Trim() + "'" } }, "a.cd_clifor"); if (obj != null) { CD_CompVend.Text = obj.ToString(); } //Buscar empresa padrao usuario obj = new CamadaDados.Diversos.TCD_CadUsuario_Empresa().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "a.login", vOperador = "=", vVL_Busca = "'" + Utils.Parametros.pubLogin.Trim() + "'" } }, "a.cd_empresa"); if (obj != null) { CD_Empresa.Text = obj.ToString(); CD_Empresa_Leave(this, new EventArgs()); } }
private void afterNovo() { pDados.Enabled = true; cd_produto.Enabled = true; cd_empresa.Enabled = true; bb_empresa.Enabled = true; cd_local.Enabled = true; bb_local.Enabled = true; cd_tabelapreco.Enabled = true; bb_tabpreco.Enabled = true; vl_precovenda.Enabled = true; codBarra.Enabled = true; qtd_entrada.Enabled = true; vl_entrada.Enabled = true; BB_Novo.Visible = false; BB_Gravar.Visible = true; BB_Cancelar.Visible = true; LimparCampos(); //Buscar empresa do usuario object obj_emp = new CamadaDados.Diversos.TCD_CadUsuario_Empresa().BuscarEscalar( new TpBusca[] { new TpBusca() { vNM_Campo = "a.login", vOperador = "=", vVL_Busca = "'" + Parametros.pubLogin.Trim() + "'" } }, "a.cd_empresa"); Cd_empdefault = obj_emp != null?obj_emp.ToString() : string.Empty; //Buscar Config Cupom lCfg = CamadaNegocio.Faturamento.Cadastros.TCN_CFGCupomFiscal.Buscar((Cd_empdefault), null); //Preencher CD.Empresa if (lCfg.Count > 0) { cd_empresa.Text = lCfg[0].Cd_empresa.Trim(); } else { cd_empresa.Text = Cd_empdefault; } cd_empresa_Leave(this, new EventArgs()); //Tabela Preco cd_tabelapreco.Text = "01"; cd_tabelapreco_Leave(this, new EventArgs()); //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.Text.Trim() + "')" } }, "a.cd_local"); if (obj != null) { cd_local.Text = obj.ToString(); cd_local_Leave(this, new EventArgs()); } cd_produto.Focus(); }