Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Biz.Finances.V2.0
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Kivii.Biz.Finances.V2.0
Commits
2393bf86
Commit
2393bf86
authored
Jan 12, 2024
by
陶然
Browse files
Options
Browse Files
Download
Plain Diff
合并
parents
7dda27c9
c571c933
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
2 deletions
+86
-2
Payment.cs
Src/Entities/Payment.cs
+6
-0
InvoiceApplyExtension.cs
Src/Extensions/InvoiceApplyExtension.cs
+29
-0
PaymentExtension.cs
Src/Extensions/PaymentExtension.cs
+29
-0
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
RestfulInvoice.Debit.cs
Src/Transforms/RestfulInvoice.Debit.cs
+10
-0
RestfulInvoice.Offset.Deficit.cs
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
+10
-0
No files found.
Src/Entities/Payment.cs
View file @
2393bf86
...
...
@@ -181,6 +181,12 @@ namespace Kivii.Finances.Entities
[
Required
]
public
DateTime
OperateTime
{
get
;
set
;
}
[
ApiMember
(
Description
=
"开票日期,多张发票时取最大日期"
)]
public
DateTime
?
InvoiceTime
{
get
;
set
;
}
[
ApiMember
(
Description
=
"审核日期,从到账日期和开票日期中取最大值"
)]
public
DateTime
?
AuditTime
{
get
;
set
;
}
[
IgnoreUpdate
]
[
DefaultEmptyGuid
]
public
Guid
OperatorKvid
{
get
;
set
;
}
...
...
Src/Extensions/InvoiceApplyExtension.cs
View file @
2393bf86
...
...
@@ -85,6 +85,35 @@ namespace Kivii.Finances
#
endregion
payment
.
AmountInvoice
+=
amount
;
if
(
payment
.
InvoiceTime
==
null
)
{
payment
.
InvoiceTime
=
invoice
.
OperateTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
else
{
if
(
payment
.
InvoiceTime
.
Value
<
invoice
.
OperateTime
)
{
payment
.
InvoiceTime
=
invoice
.
OperateTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
}
}
if
(
payment
.
InvoiceTime
!=
null
)
{
if
(
payment
.
AuditTime
==
null
)
{
payment
.
AuditTime
=
payment
.
InvoiceTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
AuditTime
);
}
else
{
if
(
payment
.
AuditTime
.
Value
<
payment
.
InvoiceTime
.
Value
)
{
payment
.
AuditTime
=
payment
.
InvoiceTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
AuditTime
);
}
}
}
payment
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
}
...
...
Src/Extensions/PaymentExtension.cs
View file @
2393bf86
...
...
@@ -325,6 +325,7 @@ namespace Kivii.Finances
if
(
conn
==
null
)
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
amountInvoiced
=
conn
.
Scalar
<
Payment
,
decimal
>(
o
=>
Sql
.
Sum
(
o
.
AmountInvoice
),
p
=>
Sql
.
In
(
p
.
Type
,
PaymentType
.
Assign
,
PaymentType
.
Split
)
&&
p
.
ParentKvid
==
payment
.
Kvid
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
var
invoiceTime
=
conn
.
Scalar
<
Payment
,
DateTime
?>(
o
=>
Sql
.
Max
(
o
.
InvoiceTime
),
p
=>
Sql
.
In
(
p
.
Type
,
PaymentType
.
Assign
,
PaymentType
.
Split
)
&&
p
.
ParentKvid
==
payment
.
Kvid
&&
p
.
OffsetKvid
==
Guid
.
Empty
);
Payment
parentPayment
=
null
;
if
(
payment
.
ParentKvid
!=
Guid
.
Empty
)
parentPayment
=
conn
.
SingleById
<
Payment
>(
payment
.
ParentKvid
);
...
...
@@ -334,6 +335,24 @@ namespace Kivii.Finances
{
payment
.
AmountInvoice
=
amountInvoiced
;
payment
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
if
(
invoiceTime
!=
null
)
{
payment
.
InvoiceTime
=
invoiceTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
if
(
payment
.
AuditTime
==
null
)
{
payment
.
AuditTime
=
invoiceTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
AuditTime
);
}
else
{
if
(
payment
.
AuditTime
.
Value
<
invoiceTime
.
Value
)
{
payment
.
AuditTime
=
invoiceTime
;
payment
.
AddOnlyProperties
(
o
=>
o
.
AuditTime
);
}
}
}
conn
.
UpdateOnly
(
payment
);
if
(
parentPayment
!=
null
)
parentPayment
.
RecalculateAmountInvoice
(
conn
);
trans
?.
Commit
();
...
...
@@ -697,10 +716,15 @@ namespace Kivii.Finances
splitPayment
.
Category
=
category
;
//金额设置
splitPayment
.
AuditorName
=
splitPayment
.
OperateTime
.
Year
.
ToString
();
splitPayment
.
AuditTime
=
payment
.
OperateTime
;
splitPayment
.
Amount
=
amountSplit
;
splitPayment
.
AmountSplited
=
0
;
splitPayment
.
AmountUsed
=
0
;
splitPayment
.
AmountInvoice
=
amountInvoice
;
// payment.AmountInvoice > amountSplit ? amountSplit : payment.AmountInvoice;
if
(
amountInvoice
<=
0
)
{
splitPayment
.
InvoiceTime
=
null
;
}
//splitPayment.Summary = string.Empty;
if
(!
remark
.
IsNullOrEmpty
())
splitPayment
.
Remark
+=
$"[认领备注:
{
remark
}
]"
;
splitPayment
.
OperateTime
=
payment
.
OperateTime
;
...
...
@@ -777,10 +801,15 @@ namespace Kivii.Finances
splitPayment
.
Type
=
paymentType
;
//金额设置
splitPayment
.
AuditorName
=
splitPayment
.
OperateTime
.
Year
.
ToString
();
splitPayment
.
AuditTime
=
payment
.
OperateTime
;
splitPayment
.
Amount
=
amountSplit
;
splitPayment
.
AmountSplited
=
0
;
splitPayment
.
AmountUsed
=
0
;
splitPayment
.
AmountInvoice
=
amountInvoice
;
if
(
amountInvoice
<=
0
)
{
splitPayment
.
InvoiceTime
=
null
;
}
splitPayment
.
Summary
=
string
.
Empty
;
splitPayment
.
Remark
=
remark
;
splitPayment
.
OperateTime
=
payment
.
OperateTime
;
...
...
Src/Properties/AssemblyInfo.cs
View file @
2393bf86
...
...
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.202
3.1229
0")]
[assembly: AssemblyFileVersion("5.4.202
3.1229
0")]
[assembly: AssemblyVersion("5.4.202
4.106
0")]
[assembly: AssemblyFileVersion("5.4.202
4.106
0")]
Src/Transforms/RestfulInvoice.Debit.cs
View file @
2393bf86
...
...
@@ -167,6 +167,11 @@ namespace Kivii.Finances.Transforms
item
.
AmountInvoice
-=
relations
.
Sum
(
o
=>
o
.
Amount
);
if
(
item
.
AmountInvoice
<
0
)
item
.
AmountInvoice
=
0
;
item
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
if
(
item
.
AmountInvoice
<=
0
)
{
item
.
InvoiceTime
=
null
;
item
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
}
if
(!
splitPayments
.
IsNullOrEmpty
())
//要是所选Payment存在拆分项,满足条件就要更新AmountInvoice
{
...
...
@@ -177,6 +182,11 @@ namespace Kivii.Finances.Transforms
if
(
amountInvoice
<=
0
)
split
.
AmountInvoice
=
0
;
else
split
.
AmountInvoice
=
split
.
Amount
>=
amountInvoice
?
amountInvoice
:
split
.
Amount
;
split
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
if
(
split
.
AmountInvoice
<=
0
)
{
split
.
InvoiceTime
=
null
;
split
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
amountInvoice
-=
split
.
AmountInvoice
;
}
}
...
...
Src/Transforms/RestfulInvoice.Offset.Deficit.cs
View file @
2393bf86
...
...
@@ -48,6 +48,11 @@ namespace Kivii.Finances.Transforms
item
.
AmountInvoice
-=
relations
.
Sum
(
o
=>
o
.
Amount
);
if
(
item
.
AmountInvoice
<
0
)
item
.
AmountInvoice
=
0
;
item
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
if
(
item
.
AmountInvoice
<=
0
)
{
item
.
InvoiceTime
=
null
;
item
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
}
if
(!
splitPayments
.
IsNullOrEmpty
())
//要是所选Payment存在拆分项,满足条件就要更新AmountInvoice
{
...
...
@@ -58,6 +63,11 @@ namespace Kivii.Finances.Transforms
if
(
amountInvoice
<=
0
)
split
.
AmountInvoice
=
0
;
else
split
.
AmountInvoice
=
split
.
Amount
>=
amountInvoice
?
amountInvoice
:
split
.
Amount
;
split
.
AddOnlyProperties
(
o
=>
o
.
AmountInvoice
);
if
(
split
.
AmountInvoice
<=
0
)
{
split
.
InvoiceTime
=
null
;
split
.
AddOnlyProperties
(
o
=>
o
.
InvoiceTime
);
}
amountInvoice
-=
split
.
AmountInvoice
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment