예제 #1
0
        private void btnFindConta_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                ctx.LazyLoading(false);


                var paramsFind = new ParamsFindEntity()
                {
                    Context        = ctx,
                    Columns        = new string[] { "Matriz.CodigoMatriz", "CodigoContaContabil", "DescricaoContaContabil", "TipoContaSped", "Natureza" },
                    Order          = "CodigoContaContabil",
                    WhereCondition = "IndAnaliticaSintetica = \"Analitica\"",
                    Title          = "Localizar conta contábil:",
                    DynamicObject  = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <ContaContabil>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id   = selected.GetType().GetProperty("CodigoContaContabil").GetValue(selected, null);
                    var nome = selected.GetType().GetProperty("DescricaoContaContabil").GetValue(selected, null);

                    //seta os dados e indexa a filial
                    FindSetContaContabil(id.ToString());
                }
            }
        }
예제 #2
0
        private void btnFindFilial_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                var paramsFind = new ParamsFindEntity()
                {
                    Context = ctx,
                    Columns = new string[] { "Matriz.CodigoMatriz", "CodigoFilial", "RazaoSocial", "Uf" },
                    Title   = "Localizar filial:",
                    Layout  = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                       "ITE.Components.Resources.layout_matriz.xml"),
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <EmpresaFilial>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id = selected.GetType().GetProperty("CodigoFilial").GetValue(selected, null);
                    //var nome = selected.GetType().GetProperty("RazaoSocial").GetValue(selected, null);

                    //seta os dados e indexa a filial
                    FindSetFilial(id.ToString());
                }
            }
        }
예제 #3
0
        private void btnFindFilial_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                ctx.LazyLoading(false);

                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Columns       = new string[] { "CodigoCfop", "DescricaoCfop" },
                    Order         = "CodigoCfop",
                    Title         = "Localizar CFOP:",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <Cfops>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id   = selected.GetType().GetProperty("CodigoCfop").GetValue(selected, null);
                    var nome = selected.GetType().GetProperty("DescricaoCfop").GetValue(selected, null);

                    //seta os dados e indexa a filial
                    FindSetCfop(id.ToString());
                }
            }
        }
예제 #4
0
        private void btnFindContaBancaria_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Columns       = new string[] { "CodigoContaBancaria", "Agencia", "NumeroConta", "DescricaoContaBancaria" },
                    Order         = "CodigoContaBancaria",
                    Title         = "Localizar conta bancária:",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <ContaBancaria>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id = selected.GetType().GetProperty("CodigoContaBancaria").GetValue(selected, null);

                    //seta os dados e indexa a filial
                    FindSetContaBancaria(id.ToString());
                }
            }
        }
예제 #5
0
        private void gridViewParam_DoubleClick(object sender, EventArgs e)
        {
            var row = gridViewParam.GetFocusedRow <Parametro>();

            if (row != null && row.CodigoParametro.Equals("centro_custo_venda"))
            {
                var ctx        = new BalcaoContext();
                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Columns       = new string[] { "Matriz.CodigoMatriz", "CodigoCentroCusto", "NomeCentroCusto" },
                    Order         = "CodigoCentroCusto",
                    Title         = "Localizar centro de custo:",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <CentroCusto>(paramsFind);

                var param = ctx.ParametroDao.Find("centro_custo_venda");

                if (selected != null)
                {
                    param.ValorParametro = "" + selected.IdCentroCusto;
                    ctx.ParametroDao.Update(param);
                }
            }
        }
예제 #6
0
        private void btnNcm_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                ctx.LazyLoading(false);

                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Columns       = new string[] { "CodigoNcm", "DescricaoNcm" },
                    Title         = "Localizar NCM:",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <Ncms>(paramsFind);

                try
                {
                    if (selected != null)
                    {
                        var codNcm = selected.GetType().GetProperty("CodigoNcm").GetValue(selected, null);
                        this.btnNcm.Text = codNcm;
                    }
                }
                catch
                {
                    //da nada nao
                }
            }
        }
예제 #7
0
        public void ShowFindProduto()
        {
            //var ctx = ITEGenericContext<Produto>.Instance;
            using (var ctx = new BalcaoContext())
            {
                var paramsEntity = new ParamsFindEntity()
                {
                    Columns = new string[] { "IdProduto", "DescricaoProduto", "PrecoVenda",
                                             "QuantidadeProduto", "StatusProduto", "TipoItemProduto", "CategoriaProduto" },
                    Layout = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                      "ITE.Components.Resources.produto_basico.xml"),
                    Context = ctx,
                    Title   = "Localizar produto:",
                    Order   = "IdProduto"
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <Produto>(paramsEntity);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id = selected.GetType().GetProperty("IdProduto").GetValue(selected, null);
                    //var nome = selected.GetType().GetProperty("DescricaoProduto").GetValue(selected, null);
                    FindSetProduto(ParseUtil.ToInt(id.ToString()));
                }
            }
        }
예제 #8
0
        private void btnFindCliFor_Click(object sender, EventArgs e)
        {
            var paramsFind = new ParamsFindEntity()
            {
                Context = new BalcaoContext(),
                Columns = new string[] { "IdCliFor", "RazaoSocial", "TipoCliente", "CpfCnpj" },
                Layout  = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                   "ITE.Components.Resources.cliente_basico.xml"),
                Title = "Localizar Cliente / Fornecedor: "
            };

            var selected = XFrmFindEntity.ShowDialogFindEntity <CliFor>(paramsFind);

            if (selected != null)
            {
                //recuperando os valores do objeto dinamico
                //pego o tipo, dps a propriedade que quero, em seguida o valor
                var id   = selected.GetType().GetProperty("IdCliFor").GetValue(selected, null);
                var nome = selected.GetType().GetProperty("RazaoSocial").GetValue(selected, null);

                if (nome == "CONSUMIDOR")
                {
                    XMessageIts.Mensagem("Cliente \"CONSUMIDOR\" é utilizado somente em vendas onde o \"Cliente\" não precisa ser informado.",
                                         "Cliente não permitido");
                }
                else
                {
                    //seta os dados e indexa a filial
                    FindSetCliFor(id.ToString());
                }
            }
        }
예제 #9
0
        private void btnAddEvento_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                ctx.LazyLoading(false);

                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Title         = "Localizar evento:",
                    Columns       = new string[] { "CodigoEvento", "DescricaoEvento", "TipoEvento", "CodigoCalculo" },
                    Order         = "CodigoEvento",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <Evento>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var codEvento = selected.GetType().GetProperty("CodigoEvento").GetValue(selected, null);
                    var nome      = selected.GetType().GetProperty("DescricaoEvento").GetValue(selected, null);

                    selected = ctx.EventoDao.Where(ev => ev.CodigoEvento == codEvento).FirstOrDefault() as Evento;

                    if (selected != null)
                    {
                        //procura o evento selecionado na lista dos eventos do grupo, se nao encontrar nada, adicione
                        if (this.eventosGrupo.Where(fe => fe.IdEvento == selected.IdEvento).Count() == 0)
                        {
                            //se esta editando ja existe o grupo
                            if (grpEventoAnt != null)
                            {
                                this.eventosGrupo.Add(new EventosGrupo()
                                {
                                    Evento = selected, IdEvento = selected.IdEvento, IdGrupoEvento = grpEventoAnt.IdGrupoEvento
                                });
                            }
                            else //senao so add o evento no grupo que esta sendo criado
                            {
                                this.eventosGrupo.Add(new EventosGrupo()
                                {
                                    Evento = selected, IdEvento = selected.IdEvento
                                });
                            }
                        }
                        else
                        {
                            //senao o evento ja existe para o funcionario, então ignore.
                            XMessageIts.Advertencia("Evento já existente para o grupo.");
                        }
                    }
                    //atualize o grid.
                    setDataGridEventos();
                }
            }
        }
예제 #10
0
        private void btnFindTpMov_Click(object sender, EventArgs e)
        {
            using (var ctx = new BalcaoContext())
            {
                ctx.LazyLoading(false);

                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Title         = "Localizar tipo de movimento:",
                    Columns       = new string[] { "CodigoTipoMovimento", "DescricaoTipoMovimento", "CategoriaTipoMovimento", "Direcao", "Numeracao", "MovimentarEstoque", "GeraMovimentoFiscal", "GerarFaturamento" },
                    Order         = "",
                    DynamicObject = null,
                    Layout        = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                             "ITE.Components.Resources.layout_tipoMovimento.xml")
                };

                //montagem da condicao

                if (TypeFiltroMovimento == TypeFiltroMovimento.Entradas)
                {
                    paramsFind.WhereCondition = "CodigoTipoMovimento.StartsWith(\"1\")";
                }
                else if (TypeFiltroMovimento == TypeFiltroMovimento.Saidas)
                {
                    paramsFind.WhereCondition = "CodigoTipoMovimento.StartsWith(\"2\")";
                }
                else
                {
                    paramsFind.WhereCondition = "CodigoTipoMovimento.StartsWith(\"3\")";
                }

                var selected = XFrmFindEntity.ShowDialogFindEntity <TipoMovimento>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor
                    var id   = selected.GetType().GetProperty("CodigoTipoMovimento").GetValue(selected, null);
                    var nome = selected.GetType().GetProperty("DescricaoTipoMovimento").GetValue(selected, null);

                    //seta os dados e indexa a filial
                    FindSetTpMov(id.ToString());
                }
            }
        }
예제 #11
0
        //Adicionar uma consulta ao datasource do relatorio que esta sendo criado/editado
        private void btnAddConsulta_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (var ctx = new ReportContext())
            {
                ctx.LazyLoading(false);
                var paramsFind = new ParamsFindEntity()
                {
                    Context       = ctx,
                    Columns       = new string[] { "CodigoQuery", "NomeQuery" },
                    Title         = "Localizar consulta SQL:",
                    DynamicObject = null
                };

                var selected = XFrmFindEntity.ShowDialogFindEntity <SqlQueryIts>(paramsFind);

                if (selected != null)
                {
                    //recuperando os valores do objeto dinamico
                    //pego o tipo, dps a propriedade que quero, em seguida o valor

                    var codigo = selected.GetType().GetProperty("CodigoQuery").GetValue(selected, null);
                    var nome   = selected.GetType().GetProperty("NomeQuery").GetValue(selected, null);
                    //acima, os dados da query

                    var query = ctx.SqlQueryItsDao.Where(c => c.CodigoQuery == codigo).FirstOrDefault();

                    ReportDataSource rptSource = new ReportDataSource()
                    {
                        IdDataSource = Guid.NewGuid().ToString(),
                        Consulta     = query,
                        IdQuery      = query.IdQuery,
                        IdReport     = reportImageAnt.IdReport
                    };

                    sourceReport.Add(rptSource);

                    gridControl1.DataSource = sourceReport;
                    gridControl1.Update();
                    gridView1.RefreshData();
                }
            }
        }
예제 #12
0
        //REVISADO EM 31/07/2017 - Gercy Campos, task 140
        /// <summary>
        /// Chama a tela de pesquisa de objetos. Montar os parametros através da classe ParamsFindEntity
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static dynamic ShowDialogFindEntity <T>(ParamsFindEntity parameters) where T : class
        {
            XFrmFindEntity xFrmFindEntity = initListaDinamica <T>(
                context: parameters.Context,
                columnsView: parameters.Columns,
                orderBy: parameters.Order,
                whereConditions: parameters.WhereCondition,
                title: parameters.Title,
                tipo: parameters.DynamicObject);

            if (parameters.Layout != null)
            {
                xFrmFindEntity.gridViewResults.RestoreLayoutFromStream(parameters.Layout, OptionsLayoutBase.FullLayout);
            }


            xFrmFindEntity.ShowDialog();

            return(xFrmFindEntity.TEntity);
        }
예제 #13
0
        private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                using (var ctx = new BalcaoContext())
                {
                    var paramsEntity = new ParamsFindEntity()
                    {
                        Columns = new string[] { "IdProduto", "DescricaoProduto", "PrecoVenda",
                                                 "QuantidadeProduto", "StatusProduto", "TipoItemProduto", "CategoriaProduto" },
                        Layout = GridViewUtil.GetLayoutStreamFromResource(Assembly.GetExecutingAssembly(),
                                                                          "ITE.Components.Resources.produto_basico.xml"),
                        Context = ctx,
                        Title   = "Localizar produto:",
                        Order   = "IdProduto"
                    };

                    var selected = XFrmFindEntity.ShowDialogFindEntity <Produto>(paramsEntity);

                    if (selected != null)
                    {
                        var id    = selected.GetType().GetProperty("IdProduto").GetValue(selected, null);
                        var quant = Convert.ToDecimal(selected.GetType().GetProperty("QuantidadeProduto").GetValue(selected, null));
                        selected.GetType().GetProperty("QuantidadeProduto").SetValue(selected, 0M, null);
                        produtos.Add(selected);

                        gridControlItens.DataSource = produtos;
                    }
                    gridControlItens.RefreshDataSource();
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionMessageDetails(ex, ex.Message);
            }
        }