示例#1
0
        private void menuStripNewPayment_Click(object sender, System.EventArgs e)
        {
            decimal debt = Convert.ToDecimal(tbTotalPrice.Text.Replace('.', ',')) - Convert.ToDecimal(tbFirstPayment.Text.Replace('.', ','));

            foreach (DataGridViewRow row in gridSchedule.Rows)
            {
                debt -= (row.Tag as Schedule).PaymentAmount;
            }

            var form = new SchedulePayment(debt);

            if (form.ShowDialog() != DialogResult.Ignore)
            {
                if (Storage.CreatedSchedulePayment != null)
                {
                    var row = new DataGridViewRow();
                    row.Tag = Storage.CreatedSchedulePayment;
                    for (int j = 0; j < 6; j++)
                    {
                        row.Cells.Add(new DataGridViewTextBoxCell());
                    }
                    row.Cells[0].Value = Storage.CreatedSchedulePayment.DatePayment.ToShortDateString();
                    row.Cells[1].Value = Storage.CreatedSchedulePayment.Rest.ToString("#.00");
                    row.Cells[2].Value = Storage.CreatedSchedulePayment.PaymentAmount.ToString("#.00");
                    row.Cells[3].Value = Storage.CreatedSchedulePayment.SumPercent.ToString("#.00");
                    row.Cells[4].Value = Storage.CreatedSchedulePayment.SumTotal.ToString("#.00");
                    row.Cells[5].Value = Storage.CreatedSchedulePayment.Comment;
                    gridSchedule.Rows.Add(row);
                    RecountLastRow();
                }
            }
        }
示例#2
0
        private void menuStripEditPayment_Click(object sender, System.EventArgs e)
        {
            if (CurrentPayment == null)
            {
                return;
            }

            var form = new SchedulePayment(CurrentPayment);

            if (form.ShowDialog() != DialogResult.Ignore)
            {
                List <Schedule> payments = new List <Schedule>();
                foreach (DataGridViewRow row in gridSchedule.Rows)
                {
                    payments.Add(row.Tag as Schedule);
                }
                gridSchedule.Rows.Clear();
                foreach (var pay in payments)
                {
                    var row = new DataGridViewRow();
                    row.Tag = pay;
                    for (int j = 0; j < 6; j++)
                    {
                        row.Cells.Add(new DataGridViewTextBoxCell());
                    }
                    row.Cells[0].Value = pay.DatePayment.ToShortDateString();
                    row.Cells[1].Value = pay.Rest.ToString("#.00");
                    row.Cells[2].Value = pay.PaymentAmount.ToString("#.00");
                    row.Cells[3].Value = pay.SumPercent.ToString("#.00");
                    row.Cells[4].Value = pay.SumTotal.ToString("#.00");
                    row.Cells[5].Value = pay.Comment;
                    gridSchedule.Rows.Add(row);
                }
                RecountLastRow();
            }
        }