Example #1
1
 public frmTermoNovo(Usuario user, String terId)
 {
     InitializeComponent();
     ter = new Termo();
     util = new Utils();
     this.user = user;
     lblUserOn.Text = user.Login;
     alu = new Aluno();
     if (terId != "") //atualizar
     {
         lblUltimaAlter.Visible = true;
         lblUltimaAlter1.Visible = true;
         ter.TerId = terId;
         ter = ter.getTermoById();
         userTermo = new Usuario();
         userTermo.Id = Convert.ToInt32(ter.TerQuemCadastrou);
         userTermo = userTermo.getUserById();
         lblUltimaAlter.Text = userTermo.Login;
         btnSelecionar.Visible = false;
         alu.TerId = terId;
         ttbAluno.Text = alu.getAlunoByTermo();
         pictureBox1.ImageLocation = fotoPath + "" + ter.TerId + ".jpg";
     }
     else
     {
         lblUltimaAlter.Visible = false;
         lblUltimaAlter1.Visible = false;
     }
 }
Example #2
0
        private void atualizaInfo()
        {
            entradas = Convert.ToDecimal(mov.getTotalEntradas());
            lblEntradas.Text = util.moneyFormata("" + entradas);
            saidas = Convert.ToDecimal(mov.getTotalSaidas());
            lblSaídas.Text = util.moneyFormata("" + saidas);
            Decimal movimento = entradas - saidas;
            lblMovimento.Text = util.moneyFormata("" + movimento);
            Decimal valorInicial;
            Decimal.TryParse(cai.CaiValorIni, out valorInicial);
            Decimal saldo = movimento + valorInicial;
            lblSaldo.Text = util.moneyFormata("" + saldo);

            lblAbertura.Text = cai.CaiAbert;
            lblValorAbertura.Text = util.moneyFormata("" + cai.CaiValorIni);

            Usuario userAux;
            userAux = new Usuario();
            if (cai.UserAbriu != "")
            {
                userAux.Id = Convert.ToInt32(cai.UserAbriu);
                userAux = userAux.getUserById();
                lblQuemRealizouAbertura.Text = userAux.Login;
            }
            else
                lblQuemRealizouAbertura.Text = "---";

            if (cai.isFechado())
            {
                lblHoraFechamento.Text = cai.CaiFech;
                ttbValorFechamento.Text = cai.CaiValorFin;
                if (cai.UserFechou != "")
                {
                    userAux.Id = Convert.ToInt32(cai.UserFechou);
                    userAux = userAux.getUserById();
                    lblQuemRealizouFechamento.Text = userAux.Login;
                    valorFinal = Convert.ToDecimal(cai.CaiValorIni) + entradas - saidas;
                    Decimal sobraFalta = Convert.ToDecimal(ttbValorFechamento.Text) - valorFinal;
                    lblSobraCaixa.Text = "---";
                    lblFaltaCaixa.Text = "---";
                    if (sobraFalta > 0)
                        lblSobraCaixa.Text = util.moneyFormata(""+sobraFalta);
                    else
                        lblFaltaCaixa.Text = util.moneyFormata(""+Math.Abs(sobraFalta));
                }

            }
            else
            {
                lblHoraFechamento.Text = "---";
                lblQuemRealizouFechamento.Text = "---";
                lblSobraCaixa.Text = "---";
                lblFaltaCaixa.Text = "---";
                ttbValorFechamento.Text = "";
            }
        }
Example #3
0
 public frmVendaNova(Usuario user, String venCod)
 {
     InitializeComponent();
     Caixa cai = new Caixa();
     cai.CaiData = DateTime.Today.ToShortDateString();
     cai = cai.getCaixaByData();
     if (cai.CaiAbert == "")
     {
         MessageBox.Show("Caixa não foi aberto!", "Venda não permitida!", MessageBoxButtons.OK,
             MessageBoxIcon.Exclamation);
         this.Close();
     }
     inicializaItensVenda();
     this.user = user;
     lblUserOn.Text = user.Login;
     if (venCod != "")
     {
         ven = new Venda();
         ven.Cod = venCod;
         ven = ven.getById();
         btnConfirmar.Visible = false;
         gpbProduto.Visible = false;
         Usuario userAux = new Usuario();
         userAux.Id = Convert.ToInt32(ven.AcessId);
         userAux = userAux.getUserById();
         lblQuemRealizou.Text = userAux.Login;
         lblDataVenda.Text = Convert.ToDateTime(ven.Data).ToShortDateString();
         btnAluAdd.Visible = false;
         btnClear.Visible = false;
         btnConfirmar.Visible = false;
         btnRemoveItem.Visible = false;
         cbbFormaPgmto.Enabled = false;
         foreach (ItensVenda p in ven.getItens())
         {
             DataRow linha = dttItensVenda.NewRow();
             linha["prod_id"] = p.ProdId;
             Produto prod = new Produto();
             prod.Id = p.ProdId;
             prod = prod.getById();
             linha["nome"] = prod.Desc;
             linha["qtde"] = p.Qtde;
             linha["valor"] = p.Valor;
             linha["preco_unit"] = Convert.ToDecimal(p.Valor) / Convert.ToInt32(p.Qtde);
             qtdeTotal += Convert.ToInt32(p.Qtde);
             dttItensVenda.Rows.Add(linha);
         }
         if (ven.AluId != "")
         {
             Aluno aluAux = new Aluno();
             aluAux.Id = Convert.ToInt32(ven.AluId);
             aluAux = aluAux.getAlunoById();
             ttbAluNome.Text = aluAux.Nome;
         }
         else
             ttbAluNome.Text = "---";
         lblQtdeItens.Text = "" + qtdeTotal;
         lblValorTotal.Text = ven.Valor;
         cbbFormaPgmto.Text = ven.FormaPgmto;
     }
     else
     {
         ttbQtde.Enabled = false;
         lblDataVenda.Text = DateTime.Today.ToShortDateString();
         lblQuemRealizou.Text = user.Login;
         valor = 0;
         qtde = 1;
         valorTotal = 0;
         qtdeTotal = 0;
         lblValorTotal.Text = "R$" + valorTotal;
         lblQtdeItens.Text = "" + qtdeTotal;
         lblSubTotal.Text = "R$" + qtde * valor;
         btnClear.Enabled = false;
         btnRemoveItem.Enabled = false;
         cbbFormaPgmto.Text = "À vista";
         cbbFormaPgmto.Enabled = false;
     }
 }