debt calc
This commit is contained in:
1 parent
ecfe62cc05
commit
71dd5be182
3 files changed
+11
-10
No files matched your search
@@ -33,6 +33,7 @@ namespace PaymentLogs
|
||||
dataGridView1.Columns.Add("course_price", "Цена");
|
||||
dataGridView1.Columns.Add("paid", "Оплачено");
|
||||
dataGridView1.Columns.Add("debt", "Долг");
|
||||
dataGridView1.Columns["debt"].ReadOnly = true;
|
||||
foreach (Payment payment in Program.PaymentRepository.All())
|
||||
{
|
||||
if(payment.CourseId != _course.Id)
|
||||
@@ -40,7 +41,7 @@ namespace PaymentLogs
|
||||
continue;
|
||||
}
|
||||
dataGridView1.Rows.Add(payment.Id.ToString(), payment.FCs.ToString(), Program.CourseRepository.Get(payment.CourseId).Name,
|
||||
payment.CoursePrice.ToString(), payment.Paid.ToString(), payment.Debt.ToString());
|
||||
payment.CoursePrice.ToString(), payment.Paid.ToString(), (payment.CoursePrice - payment.Paid).ToString() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +59,7 @@ namespace PaymentLogs
|
||||
|
||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.ActiveControl = null;
|
||||
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||
{
|
||||
try
|
||||
@@ -70,8 +72,7 @@ namespace PaymentLogs
|
||||
FCs = row.Cells["fcs"].Value.ToString(),
|
||||
CourseId = Program.CourseRepository.ByName(row.Cells["course"].Value.ToString()).Id,
|
||||
CoursePrice = Convert.ToInt32(row.Cells["course_price"].Value),
|
||||
Paid = Convert.ToInt32(row.Cells["paid"].Value),
|
||||
Debt = Convert.ToInt32(row.Cells["debt"].Value)
|
||||
Paid = Convert.ToInt32(row.Cells["paid"].Value)
|
||||
};
|
||||
Program.PaymentRepository.Update(payment.Id, payment);
|
||||
}
|
||||
@@ -109,7 +110,9 @@ namespace PaymentLogs
|
||||
List<string> list = new List<string>
|
||||
{ row.Cells["id"].Value.ToString(), row.Cells["fcs"].Value.ToString(),
|
||||
row.Cells["course"].Value.ToString(), row.Cells["course_price"].Value.ToString(),
|
||||
row.Cells["paid"].Value.ToString(), row.Cells["debt"].Value.ToString() };
|
||||
row.Cells["paid"].Value.ToString(),
|
||||
(Convert.ToInt32(row.Cells["course_price"].Value.ToString()) - (Convert.ToInt32(row.Cells["paid"])))
|
||||
.ToString() };
|
||||
|
||||
filtredList.Add(list);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user