-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBA.cs
More file actions
71 lines (61 loc) · 1.52 KB
/
BA.cs
File metadata and controls
71 lines (61 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
namespace space1;
public class BA
{
private static int ACN = 1;
public string NUM { get; }
public string Ow { get; set; }
private List<Tr> _at = new List<Tr>();
public decimal bal
{
get
{
decimal bal = 0;
foreach (var item in _at)
{
bal += item.Am;
}
return bal;
}
}
public BA(string nm, decimal ib)
{
NUM = ACN.ToString();
ACN++;
this.Ow = nm;
Md(ib, DateTime.Now, "In");
}
public void Md(decimal am, DateTime d, string n)
{
if (am <= 0)
{
throw new ArgumentOutOfRangeException(nameof(am), "Must be positive");
}
var dep = new Tr(am, d, n);
_at.Add(dep);
}
public void Mw(decimal a, DateTime d, string n)
{
if (a <= 0)
{
throw new ArgumentOutOfRangeException(nameof(a), "Must be positive");
}
if (bal - a < 0)
{
throw new InvalidOperationException("ba is insufficient");
}
var wd = new Tr(-a, d, n);
_at.Add(wd);
}
public string Gac()
{
var report = new System.Text.StringBuilder();
decimal bal2 = 0;
report.AppendLine("D\t\tA\tB\tN");
foreach (var i in _at)
{
bal2 += i.Am;
report.AppendLine($"{i.D.ToShortDateString()}\t{i.Am}\t{bal2}\t{i.N}");
}
return report.ToString();
}
}