public void CheckCaixaDate() { CheckCaixa(); var caixa = new Model.Caixa().Query().Where("tipo", "Aberto").Where("usuario", Settings.Default.user_id) .Where("criado", "<", Validation.ConvertDateToSql(DateTime.Now)).WhereFalse("excluir").FirstOrDefault(); if (caixa != null) { Home.idCaixa = caixa.ID; var msg = $"Antes de começar, há um caixa aberto do dia: {Validation.ConvertDateToForm(caixa.CRIADO)}. {Environment.NewLine}Deseja realizar o FECHAMENTO agora?"; var Title = "Atenção!"; var result = AlertOptions.Message(Title, msg, AlertBig.AlertType.warning, AlertBig.AlertBtn.YesNo); if (result) { DetailsCaixa.idCaixa = Home.idCaixa; using (var f = new DetailsCaixa()) { f.ShowDialog(); } } else { AlertOptions.Message("Atenção!", "Os recebimentos gerados a partir de vendas serão lançados no caixa aberto!", AlertBig.AlertType.info, AlertBig.AlertBtn.OK); } } var caixaAberto = new Model.Caixa().Query().Where("tipo", "Aberto") .Where("usuario", Settings.Default.user_id).WhereFalse("excluir").FirstOrDefault(); if (caixaAberto == null) { var result = AlertOptions.Message("Atenção!", $"Você não possui um Caixa aberto.{Environment.NewLine} Deseja abrir agora?", AlertBig.AlertType.info, AlertBig.AlertBtn.YesNo); if (result) { using (var f = new AbrirCaixa()) { f.ShowDialog(); } } } }
private bool CheckCaixa() { if (Home.idCaixa == 0) { Alert.Message("Ação não permitida", "É necessário abrir ou vincular um caixa para continuar", Alert.AlertType.warning); var f = new AbrirCaixa { TopMost = true }; f.ShowDialog(); return(false); } caixaAnterior = Home.idCaixa; if (_mPedido.Id_Caixa > 0) { Home.idCaixa = _mPedido.Id_Caixa; } return(true); }
private void Eventos() { Clientes.Click += (s, e) => { if (UserPermission.SetControl(Clientes, pictureBox1, "fin_clientes")) { return; } Home.pessoaPage = "Clientes"; OpenForm.Show <Clientes>(this); }; Receitas.Click += (s, e) => { if (UserPermission.SetControl(Receitas, pictureBox11, "fin_receitas")) { return; } Home.CategoriaPage = "Receitas"; OpenForm.Show <Categorias>(this); }; Despesas.Click += (s, e) => { if (UserPermission.SetControl(Despesas, pictureBox13, "fin_despesas")) { return; } Home.CategoriaPage = "Despesas"; OpenForm.Show <Categorias>(this); }; fornecedores.Click += (s, e) => { if (UserPermission.SetControl(fornecedores, pictureBox3, "fin_fornecedores")) { return; } Home.pessoaPage = "Fornecedores"; OpenForm.Show <Clientes>(this); }; aReceber.Click += (s, e) => { if (UserPermission.SetControl(aReceber, pictureBox9, "fin_recebimentos")) { return; } Home.financeiroPage = "Receber"; OpenForm.Show <Titulos>(this); }; aPagar.Click += (s, e) => { if (UserPermission.SetControl(aPagar, pictureBox10, "fin_pagamentos")) { return; } Home.financeiroPage = "Pagar"; OpenForm.Show <Titulos>(this); }; novoRecebimento.Click += (s, e) => { if (UserPermission.SetControl(novoRecebimento, pictureBox4, "fin_novorecebimento")) { return; } EditarTitulo.IdTitulo = 0; Home.financeiroPage = "Receber"; OpenForm.Show <EditarTitulo>(this); }; novoPagamento.Click += (s, e) => { if (UserPermission.SetControl(novoPagamento, pictureBox5, "fin_novopag")) { return; } EditarTitulo.IdTitulo = 0; Home.financeiroPage = "Pagar"; OpenForm.Show <EditarTitulo>(this); }; AbrirCaixa.Click += (s, e) => { if (UserPermission.SetControl(AbrirCaixa, pictureBox6, "fin_abrircaixa")) { return; } if (Home.idCaixa == 0) { var f = new AbrirCaixa(); f.ShowDialog(); } else { Alert.Message("Oopps!", "Já existe um caixa aberto.", Alert.AlertType.warning); } }; Caixa.Click += (s, e) => { if (UserPermission.SetControl(Caixa, pictureBox12, "fin_caixa")) { return; } OpenForm.Show <Caixa>(this); }; EntradaSaidaCaixa.Click += (s, e) => { if (UserPermission.SetControl(EntradaSaidaCaixa, pictureBox7, "fin_entradasaidacaixa")) { return; } if (Home.idCaixa == 0) { Alert.Message("Oopps!", "Você não possui um caixa aberto.", Alert.AlertType.warning); return; } AddCaixaMov.idCaixa = Home.idCaixa; AddCaixaMov.idMov = 0; var f = new AddCaixaMov(); f.ShowDialog(); }; FecharCaixa.Click += (s, e) => { if (UserPermission.SetControl(FecharCaixa, pictureBox8, "fin_fecharcaixa")) { return; } if (Home.idCaixa == 0) { Alert.Message("Oopps!", "Você não possui um caixa aberto.", Alert.AlertType.warning); return; } Financeiro.FecharCaixa.idCaixa = Home.idCaixa; var f = new FecharCaixa(); if (f.ShowDialog() == DialogResult.OK) { Alert.Message("Pronto!", "Caixa fechado com sucesso.", Alert.AlertType.success); } }; btnTaxas.Click += (s, e) => { OpenForm.Show <Taxas>(this); }; }