-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCashTemplate.cs
128 lines (102 loc) · 3.06 KB
/
CashTemplate.cs
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* Copyright (C) 2020-2024 b1f6c1c4
*
* This file is part of ProfessionalAccounting.
*
* ProfessionalAccounting is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3.
*
* ProfessionalAccounting is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
* for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ProfessionalAccounting. If not, see
* <https://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace AccountingServer.Shell.Plugins.CashFlow;
[Serializable]
[XmlRoot("Templates")]
public class CashTemplates
{
[XmlElement("Account")] public List<CashAccount> Accounts;
}
[Serializable]
public class CashAccount
{
[XmlArray("Items")]
[XmlArrayItem("OnceItem", typeof(OnceItem))]
[XmlArrayItem("OnceQueryItem", typeof(OnceQueryItem))]
[XmlArrayItem("MonthlyItem", typeof(MonthlyItem))]
[XmlArrayItem("SimpleCreditCard", typeof(SimpleCreditCard))]
[XmlArrayItem("ComplexCreditCard", typeof(ComplexCreditCard))]
public List<CashFlowItem> Items;
[XmlAttribute("user")]
public string User { get; set; }
[XmlAttribute("currency")]
public string Currency { get; set; }
[XmlElement]
public string QuickAsset { get; set; }
[XmlElement]
public string Reimburse { get; set; }
}
[Serializable]
public abstract class CashFlowItem { }
[Serializable]
public class OnceItem : CashFlowItem
{
[XmlAttribute("date")]
public DateTime Date { get; set; }
[XmlAttribute("fund")]
public double Fund { get; set; }
}
[Serializable]
public class OnceQueryItem : CashFlowItem
{
[XmlAttribute("date")]
public DateTime Date { get; set; }
[XmlText]
public string Query { get; set; }
}
[Serializable]
public class MonthlyItem : CashFlowItem
{
[XmlAttribute("day")]
public int Day { get; set; }
[XmlAttribute("since")]
public DateTime Since { get; set; }
[XmlAttribute("till")]
public DateTime Till { get; set; }
[XmlAttribute("fund")]
public double Fund { get; set; }
}
[Serializable]
public class SimpleCreditCard : CashFlowItem
{
[XmlAttribute("bill")]
public int BillDay { get; set; }
[XmlAttribute("repay")]
public int RepaymentDay { get; set; }
[XmlText]
public string Query { get; set; }
[XmlAttribute("monthly")]
public double MonthlyFee { get; set; }
}
[Serializable]
public class ComplexCreditCard : CashFlowItem
{
[XmlAttribute("bill")]
public int BillDay { get; set; }
[XmlAttribute("repay")]
public int RepaymentDay { get; set; }
[XmlAttribute("utility")]
public int MaximumUtility { get; set; } = -1;
[XmlText]
public string Query { get; set; }
[XmlAttribute("monthly")]
public double MonthlyFee { get; set; }
}