private void showGrid()
 {
     dgList.Rows.Clear();
     foreach (PaymentForm x in PaymentFormDAO.ListAll())
     {
         dgList.Rows.Add(x.Id, x.Name, PaymentFormU.ArrayType[x.Type], Util.moneyFormat_ptBR(x.InitialBalance));
     }
 }
Example #2
0
        private void cmbPaymentForm_Start()
        {
            PaymentForm pf = new PaymentForm();

            cmbPaymentForm.Items.Add(pf);
            foreach (PaymentForm x in PaymentFormDAO.ListAll())
            {
                cmbPaymentForm.Items.Add(x);
            }

            cmbPaymentForm.ValueMember   = "Id";
            cmbPaymentForm.DisplayMember = "Name";
        }
Example #3
0
        private void showGrid()
        {
            DateTime dateIn  = DateTime.Parse(dtDateIn.Text);
            DateTime dateEnd = DateTime.Parse(dtDateEnd.Text);
            Finance  finance;
            double   ganhos, gastos, totalGanhos = 0, totalGastos = 0, saldo;

            dgList.Rows.Clear();
            foreach (PaymentForm p in PaymentFormDAO.ListAll())
            {
                finance = new Finance();
                finance.FinanceCategorySub = new FinanceCategorySub();
                finance.FinanceCategorySub.FinanceCategory      = new FinanceCategory();
                finance.FinanceCategorySub.FinanceCategory.Type = FinanceCategoryU.TYPE_GANHO;
                finance.PaymentForm = p;
                ganhos = 0;
                foreach (Finance f in FinanceDAO.ListByFilter(finance, dateIn, dateEnd))
                {
                    ganhos += f.Value;
                }

                finance.FinanceCategorySub.FinanceCategory.Type = FinanceCategoryU.TYPE_GASTO;
                gastos = 0;
                foreach (Finance f in FinanceDAO.ListByFilter(finance, dateIn, dateEnd))
                {
                    gastos += f.Value;
                }

                dgList.Rows.Add(p.Name, Util.moneyFormat_ptBR(ganhos), Util.moneyFormat_ptBR(gastos), Util.moneyFormat_ptBR(FinanceBO.CalcSaldo(ganhos, gastos)));
                totalGanhos += ganhos;
                totalGastos += gastos;
            }

            txtGanhos.Text   = Util.moneyFormat_ptBR(totalGanhos);
            txtGastos.Text   = Util.moneyFormat_ptBR(totalGastos);
            saldo            = FinanceBO.CalcSaldo(totalGanhos, totalGastos);
            txtMeuSaldo.Text = Util.moneyFormat_ptBR(saldo);
            if (saldo > 0)
            {
                txtMeuSaldo.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                txtMeuSaldo.ForeColor = System.Drawing.Color.Red;
            }
        }