コード例 #1
0
ファイル: Inicial.cs プロジェクト: njmube/openposbr
        /// <summary>
        /// Abre o formulário de Movimento do caixa
        /// </summary>
        /// <param name="sender">Objeto que disparou o evento</param>
        /// <param name="e">Argumento do evento gerado</param>
        private void tbtnMovimentar_Click(object sender, EventArgs e)
        {
            frmLogin frmLogin = new frmLogin();
            frmLogin.ShowDialog();

            frmMovimentacaoCaixa frmMovimentacaoCaixa = new frmMovimentacaoCaixa();
            frmMovimentacaoCaixa.Show();
        }
コード例 #2
0
ファイル: frmInicial.cs プロジェクト: njmube/openposbr
        public frmInicial()
        {
            InitializeComponent();
            this.ResizeRedraw = true;

            #if !IsPAF
            this.mnuPrincipal.Items.Remove(mnuMenuFiscal);
            #endif

            //if(isPDV)
            //{
            //    tbtnDAV.Visible = false;
            //    mnuLancamentoDAV.Visible = false;
            //    mnuLancamentoPreVenda.Visible = false;
            //    mnuLancamentoDAVOs.Visible = false;
            //    tbtnVendas.Location = new Point(444, 384);
            //    tbtnCaixa.Location = new Point(235, 384);
            //}
            //else
            //{
            //    mnuMenuFiscal.Visible = false;
            //    tbtnCaixa.Visible = false;
            //    mnuLancamentoVendaCupom.Visible = false;
            //    optBarOutros.Controls.Remove(optBarOutros.tBtnECF);
            //    optBarOutros.Controls.Remove(optBarOutros.touchBtnTEF);
            //    optBarOutros.Location = new Point(848, 237);

            //}

            #if !IsPAF
            mnuPrincipal.Location = new Point(580, 84);
            #else
            mnuPrincipal.Location = new Point(445, 84);
            #endif
            //  ResizeRedraw = true;

            this.LayoutMdi(MdiLayout.ArrangeIcons);

            #region Aplicação dos níveis de acesso

            // Aplica níveis de acesso aos botões
            foreach(Control control in this.Controls)
                this.AplicaNiveisDeAcessoBotoes(control.Controls);

            // Aplica níveis de acesso aos menus
            var nodeConstructor = new NodeConstructor();
            var menuItens = nodeConstructor.BuildListFromMenuStrip(this.mnuPrincipal);
            this.AplicaNiveisDeAcessoMenus(menuItens);

            #endregion

            #region opções caixa
            optbCaixa.tbtnFechar.Click += new System.EventHandler((object o, EventArgs e) =>
            {
                FechamentoCaixa frmFechamento = new FechamentoCaixa();
                frmFechamento.ShowDialog(this);

                labelStatus.Text = frmFechamento.StatusCaixa;
            });

            optbCaixa.tbtnAbrir.Click += new EventHandler((object o, EventArgs e) =>
            {
                frmLogin frmLogin = new frmLogin();

                frmLogin.OnLoginOk += new ComponentModel.LoginHandler((Desktop.ComponentModel.LoginEventArgs args) =>
                {
                    frmAberturaCaixa frmAbertura = new frmAberturaCaixa();
                    frmAbertura.ShowDialog();

                    labelStatus.Text = frmAbertura.StatusCaixa;
                });

                frmLogin.OnLoginCancel += new ComponentModel.LoginHandler((Desktop.ComponentModel.LoginEventArgs args) =>
                {
                    frmLogin.Close();
                });

                frmLogin.ShowDialog();
            });
            #endregion

            #region opções de venda
            optbCaixa.tBtnVenda.Click += new EventHandler((object s, EventArgs e) =>
            {
                IAbreCaixa caixa = null;
                try
                {
                    caixa = new AbreCaixa().PermiteAbrir(Settings.MachineName, DateTime.Now);
                }
                catch(PDVObrigatorio)
                {
                    if(!PDV.Create(true, false).IsNullOrEmpty())
                        caixa = new AbreCaixa().PermiteAbrir(Settings.MachineName, DateTime.Now);
                    else
                    {
                        MessageBox.Show("Não foi possível criar um PDV para esta estação.", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }

                //tem que existir um caixa aberto para este operador.
                if(caixa == null)
                {
                    MessageBox.Show("Não foi permitido abrir o caixa para este PDV.", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                IImpressora impressora = null;

                try
                {
                    impressora = OpenPOS.ECF.ECF.Create(caixa.Caixa.PDV);
                }
                catch(Exception ex)
                {
                    MessageBox.ShowError(ex, false);
                    return;
                }

                frmLoginVendaCF f = new frmLoginVendaCF();
                f.Show(this);
            });

            optBarVenda.tBtnVendaNFe.Click += new EventHandler((object o, EventArgs e) =>
            {
                new frmVendaNFe().Show(this);
            });

            optBarVenda.tBtnVendaManual.Click += new EventHandler((object o, EventArgs e) =>
            {
                new frmVendaNFManual().Show(this);
            });
            #endregion

            #region opções dav
            optBarDAV.tBtnOrcamento.Click += new EventHandler((object o, EventArgs e) =>
            {
                new frmDAV().Show(this);
            });
            optBarDAV.tBtnOrdemServico.Click += new EventHandler((object sender, EventArgs e) =>
            {
                new frmDAVOS().Show(this);
            });
            optBarDAV.tBtnPreVenda.Click += new EventHandler((object sender, EventArgs e) =>
            {
                new frmPreVenda().Show(this);
            });
            #endregion

            #region opções Outros
            optBarOutros.tBtnECF.Click += new EventHandler((object o, EventArgs e) =>
            {
                frmECF f = new frmECF();

                if(!f.IsDisposed)
                    f.ShowDialog(this);
            });

            optBarOutros.touchBtnTEF.Click += new EventHandler((object o, EventArgs e) =>
            {
                frmTEF f = new frmTEF();
                if(!f.IsDisposed)
                    f.ShowDialog(this);
            });
            #endregion

            #region menu relatórios
            IList<Model.Reports.IRelatorio> rels = new Relatorio().Find<Model.Reports.IRelatorio>();

            foreach(var rel in rels)
            {
                ToolStripMenuItem parent = GetMenuItemParent(rel.Grupo.Nome);
                ToolStripMenuItem item = new ToolStripMenuItem
                {
                    Text = rel.Nome,
                    Tag = rel
                };

                item.Click += (sender, e) =>
                {
                    try
                    {
                        RdlManager.OpenViewer(((ToolStripMenuItem)sender).Tag as Model.Reports.IRelatorio);
                    }
                    catch(Exception ex)
                    {
                        MessageBox.ShowError(ex);
                    }
                };

                parent.DropDownItems.Add(item);
                mnuRelatorio.DropDownItems.Add(parent);
            }
            #endregion
        }
コード例 #3
0
ファイル: Inicial.cs プロジェクト: njmube/openposbr
        /// <summary>
        /// Abre o formulário Abertura do caixa
        /// </summary>
        /// <param name="sender">Objeto que disparou o evento</param>
        /// <param name="e">Argumento do evento gerado</param>
        private void tbtnAbrir_Click(object sender, EventArgs e)
        {
            frmLogin frmLogin = new frmLogin();
            frmLogin.ShowDialog();

            frmAberturaCaixa frmAbertura = new frmAberturaCaixa();
            frmAbertura.Show();
        }