Exemplo n.º 1
0
        public static void PrintReportAndGenerateSpool(int IdrptImage)
        {
            try
            {
                /*
                 * Forma de geração do relatório.
                 *
                 * 1 = Gera e visualiza sem gravar no spool,
                 * 2 = Gera e visualiza gravando no spool,
                 * 3 = Gera somente em spool.
                 */
                var param = ParametroManager.FindParamByTypeParametro(Framework.Enumeradores.TypeParametro.report_engine);

                if (param.ValorParametro == "2")
                {
                    new ReportSpoolDaoManager().PrintReportSpool(IdrptImage);
                }
                else if (param.ValorParametro == "3")
                {
                    new ReportSpoolDaoManager().PrintReportSpool(IdrptImage, false);
                }
                else
                {
                    //usar esse pq no azure nao tenho espaco pro spool por enquanto
                    PrintReport(IdrptImage, false);
                }
                //nao podemos impedir a rotina de funcionar
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionJustMessage(ex, "Falha ao gerar o relatório.");
            }
        }
Exemplo n.º 2
0
        internal void NovaProposta(Usuario user)
        {
            //verificar se existe local de estoque antes de vender
            if (ParametroDaoManager.GetCentroCustoVenda() == null)
            {
                Console.WriteLine("Centro de custo nao encontrado");
                XMessageIts.Mensagem("Para iniciar uma venda é necessário o cadastrar um centro de custo!");
            }

            if (!ParametroDaoManager.CheckLocalEstoque())
            {
                var op = XMessageIts.Confirmacao("Não existe um local de estoque cadastrado.\n\n" +
                                                 "Desejar cadastrar local de estoque ?",
                                                 "Atenção");

                if (op == System.Windows.Forms.DialogResult.Yes)
                {
                    new XFrmLocalEstoqueView().ShowDialog();
                }
            }
            else
            {
                XFrmVenda xFrmVenda;
                //venda com login
                if (ParametroManager.GetStatusParamByCodigo(TypeParametro.exigir_login_venda.ToString()))
                {
                    var login = new UnitWork();

                    var userLogin = login.Login();

                    if (userLogin != null)
                    {
                        xFrmVenda = new XFrmVenda(userLogin);
                        //invoke o form em dialogo
                        xFrmVenda.ShowDialog();
                    }
                }
                //sem login na venda
                else
                {
                    xFrmVenda = new XFrmVenda(user);

                    //invoke o form em dialogo
                    xFrmVenda.ShowDialog();
                }
            }
        }
Exemplo n.º 3
0
        public static void PrintReportWithParams(ReportImage rptImage)
        {
            try
            {
                /*
                 * Forma de geração do relatório.
                 *
                 * 1 = Gera e visualiza sem gravar no spool,
                 * 2 = Gera e visualiza gravando no spool,
                 * 3 = Gera somente em spool.
                 */
                var param = ParametroManager.GetValorParamByCodigo("report_eng");

                if (param == "1")
                {
                    //new ReportSpoolDaoManager().PrintReportSpool(rptSelected.IdReport);
                    //usar esse aqui no azure pq nao tenho espaco pro spool por enquanto
                    //acho q faz mais sentido salvar a ref do relatorio gerado
                    //do q os bytes do relatorio uma vez que o relatorio ja existe
                    //entao so a pk dele ja seria o suficiente
                    ReportUtil.PrintReport(rptImage);
                }
                else if (param == "2")
                {
                    new ReportSpoolDaoManager().PrintReportSpool(rptImage.IdReport);
                }
                else if (param == "3")
                {
                    new ReportSpoolDaoManager().PrintReportSpool(rptImage.IdReport, false);
                }

                else
                {
                    LoggerUtilIts.GenerateLogs(new Exception("Paramentro report_eng não existe."));
                }

                //nao acontece nada
                //nao podemos impedir a rotina de funcionar
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionJustMessage(ex, "Falha ao gerar o relatório.");
            }
        }
Exemplo n.º 4
0
        private void init(EmpresaFilial filial)
        {
            try
            {
                lookUpFilial1.FindSetFilial(filial);

                if (reprocessamento)
                {
                    welcomeWizardPageRHFinanc.Text             = "Geração de lançamentos financeiros";
                    welcomeWizardPageRHFinanc.IntroductionText = "Este assistente irá guia-lo até a geração completa dos lançamentos financeiros da competência escolhida.";
                    chkGerarFinanceiro.Visible = false;
                }

                int idCentroCustoRH = ParseUtil.ToInt(ParametroManager
                                                      .FindParamByTypeParametro(TypeParametro.centro_custo_folha)
                                                      .ValorParametro);

                lookUpCentroCusto1.FindSetCentroCusto(idCentroCustoRH.ToString());

                int idCliForRH = ParseUtil.ToInt(ParametroManager
                                                 .FindParamByTypeParametro(TypeParametro.clifor_folha)
                                                 .ValorParametro);

                lookUpCliFor1.FindSetCliFor(idCliForRH.ToString());

                if (lookUpCliFor1.CliFor == null && lookUpCentroCusto1.CentroCusto == null)
                {
                    lookUpCentroCusto1.Enabled = true;
                    lookUpCliFor1.Enabled      = true;
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionMessage(ex);
            }
        }
Exemplo n.º 5
0
        //carraga as preferencias do arquivo de preferencias

        public void SetPreferences(BalcaoContext ctx = null)
        {
            if (ctx == null)
            {
                ctx = new BalcaoContext();
            }

            using (ctx)
            {
                try
                {
                    var dataPreferences = FileManagerIts.GetDataFile(UnitWork.PREFERENCIAS);

                    //sempre passa aqui
                    if (dataPreferences.Count >= 2)
                    {
                        this.IsInvoke = false;

                        string codMatriz = ASCIIEncodingIts.Decoded(dataPreferences[0]);
                        string codFilial = ASCIIEncodingIts.Decoded(dataPreferences[1]);

                        this.lookUpMatrizFilial1.FindSetMatriz(codMatriz);

                        this.lookUpMatrizFilial1.FindSetFilial(codFilial);

                        UnitWork.Filial = this.Filial;

                        //se salvou eh true;
                        this.chBoxMemorizarFilial.Checked = true;


                        if (!this.lookUpMatrizFilial1.IsMatrizFilial)
                        {
                            this.IsInvoke = true;
                            return;
                        }

                        //tenha certeza q os argumentos setados existem
                        if (dataPreferences.Count == 4 && UnitWork.Filial != null)
                        {
                            try
                            {
                                //se o tem o index 3 entao eh true
                                this.chBoxLoginAuto.Checked = true;
                                //nao chame essa tela
                                this.IsInvoke = false;

                                int idUser = ParseUtil.ToInt(ASCIIEncodingIts.Decoded(dataPreferences[3]));

                                UnitWork.Usuario = ctx.UsuarioDao.Find(idUser);
                            }
                            catch
                            {
                                UnitWork.Usuario = null;
                            }


                            //se estou selecionando e o flag verdade
                            //passe direto
                            //se o flag nao for selecionar abri o form para alterar os argumentos
                            //que ja existem setados
                            if (_action == FormTypeAction.Selecionar && this.chBoxLoginAuto.Checked)
                            {
                                btnOk_ItemClick(null, null);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LoggerUtilIts.ShowExceptionLogs(ex);
                    DeletePreferences();
                }

                var param = ParametroManager.FindParamByTypeParametro(TypeParametro.dir_digitalizacoes);
                PrinterUtilIts.DirDefault = param.ValorParametro;
            }
        }
Exemplo n.º 6
0
        private void loadPreferences()
        {
            //nao use o using aqui
            var ctx = new BalcaoContext();

            this.Invoke(new MethodInvoker(delegate
            {
                try
                {
                    //centro de custo
                    int idCentroCusto = ParseUtil.ToInt(ParametroManager
                                                        .FindParamByTypeParametro(TypeParametro.centro_custo_venda)
                                                        .ValorParametro);
                    var centro = ctx.CentroCustoDao.Find(idCentroCusto);
                    lookUpCentroCustoDefault.FindSetCentroCusto(centro.CodigoCentroCusto);

                    //conta bancaria
                    int idContaBancaria = ParseUtil.ToInt(ParametroManager
                                                          .FindParamByTypeParametro(TypeParametro.conta_bancaria)
                                                          .ValorParametro);
                    var conta = ctx.ContaBancariaDao.Find(idContaBancaria);
                    lookUpContaBancariaDefault.FindSetContaBancaria(conta.CodigoContaBancaria);

                    bool statusLoginVParam = ParametroManager.FindParamByTypeParametro(TypeParametro.exigir_login_venda)
                                             .StatusParametro;

                    //venda
                    chkLoginVenda.Checked  = statusLoginVParam;
                    var statusVendaQuitada = ParametroManager.FindParamByTypeParametro(TypeParametro.venda_quitada_avista)
                                             .StatusParametro;
                    chkVendaQuitadaVista.Checked = statusVendaQuitada;


                    //report
                    int reportEngine = ParseUtil.ToInt(ParametroManager.FindParamByTypeParametro(TypeParametro.report_engine)
                                                       .ValorParametro) - 1;
                    cbEngReport.SelectedIndex = reportEngine;

                    //locais
                    string dirDigitalizacao = ParametroManager.FindParamByTypeParametro(TypeParametro.dir_digitalizacoes)
                                              .ValorParametro;

                    string dirBackup = ParametroManager.FindParamByTypeParametro(TypeParametro.dir_backup)
                                       .ValorParametro;

                    txtDirDigitalizacao.Text = dirDigitalizacao;
                    txtDirBackup.Text        = dirBackup;

                    //rh
                    int idCentroCustoRH = ParseUtil.ToInt(ParametroManager
                                                          .FindParamByTypeParametro(TypeParametro.centro_custo_folha)
                                                          .ValorParametro);
                    var centroRH = ctx.CentroCustoDao.Find(idCentroCustoRH);
                    lookUpCentroCustoRH.FindSetCentroCusto(centroRH.CodigoCentroCusto);

                    int idCliForRH = ParseUtil.ToInt(ParametroManager
                                                     .FindParamByTypeParametro(TypeParametro.clifor_folha)
                                                     .ValorParametro);
                    var cliForRH = ctx.CliForDao.Find(idCliForRH);
                    lookUpCliForRH.FindSetCliFor(cliForRH.IdCliFor.ToString());

                    ctx.Dispose();
                }
                catch (Exception ex)
                {
                    XMessageIts.Mensagem("Existem argumentos não parametrizados.");
                    LoggerUtilIts.GenerateLogs(ex);
                }
            }));
        }