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
173b0c92
Commit
173b0c92
authored
Aug 24, 2022
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
0b7a5355
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
RestfulStatistic.cs
Src/Transforms/RestfulStatistic.cs
+17
-4
No files found.
Src/Transforms/RestfulStatistic.cs
View file @
173b0c92
...
...
@@ -13,6 +13,7 @@ namespace Kivii.Finances.Transforms
{
public
string
Description
{
get
;
set
;
}
public
decimal
TotalAmount
{
get
;
set
;
}
public
decimal
TotalAmountSplited
{
get
;
set
;
}
public
decimal
TotalAmountInvoice
{
get
;
set
;
}
public
decimal
TotalAmountUsed
{
get
;
set
;
}
public
decimal
TotalAmountPayment
{
get
;
set
;
}
...
...
@@ -20,6 +21,7 @@ namespace Kivii.Finances.Transforms
public
decimal
TotalAmountOffset
{
get
;
set
;
}
public
decimal
TotalQuantity
{
get
;
set
;
}
public
decimal
TotalQuantitySplited
{
get
;
set
;
}
public
decimal
TotalQuantityInvoice
{
get
;
set
;
}
public
decimal
TotalQuantityUsed
{
get
;
set
;
}
public
decimal
TotalQuantityPayment
{
get
;
set
;
}
...
...
@@ -218,6 +220,8 @@ namespace Kivii.Finances.Transforms
public
bool
?
Invoiced
{
get
;
set
;
}
//到账是否开票
public
bool
Limited
{
get
;
set
;
}
=
true
;
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
...
...
@@ -237,9 +241,16 @@ namespace Kivii.Finances.Transforms
request
=
request
.
PopulateWith
(
this
);
var
sqlExpress
=
autoQuery
.
CreateQuery
(
Request
,
conn
,
request
,
dynamicParams
);
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
WeChat
,
PaymentType
.
Cash
,
PaymentType
.
AliPay
,
PaymentType
.
Pos
,
PaymentType
.
Split
,
PaymentType
.
Refund
,
PaymentType
.
UnBiz
));
sqlExpress
.
And
(
o
=>
o
.
OperateTime
>=
BeginTime
&&
o
.
OperateTime
<
EndTime
);
if
(
OwnerKvid
!=
Guid
.
Empty
)
sqlExpress
.
And
(
o
=>
o
.
OwnerKvid
==
OwnerKvid
||
o
.
OwnerKvid
==
Guid
.
Empty
);
sqlExpress
.
Where
(
o
=>
o
.
OperateTime
>=
BeginTime
&&
o
.
OperateTime
<
EndTime
);
if
(
OwnerKvid
==
Guid
.
Empty
)
//没传部门信息就查全部到账的数据
{
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
WeChat
,
PaymentType
.
Cash
,
PaymentType
.
AliPay
,
PaymentType
.
Pos
,
PaymentType
.
Bank
));
}
else
//指定了部门就只查部门认领的到账数据内容
{
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
WeChat
,
PaymentType
.
Cash
,
PaymentType
.
AliPay
,
PaymentType
.
Pos
,
PaymentType
.
Split
,
PaymentType
.
Refund
,
PaymentType
.
UnBiz
));
sqlExpress
.
And
(
o
=>
o
.
OwnerKvid
==
OwnerKvid
);
}
//if (OwnerType == OwnerType.Organization) sqlExpress.And(o => o.OwnerKvid == KiviiContext.CurrentMember.OrganizationKvid || o.OwnerKvid == Guid.Empty);
//if (OwnerType == OwnerType.Department) sqlExpress.And(o => o.OwnerKvid == KiviiContext.CurrentMember.DepartmentKvid || o.OwnerKvid == Guid.Empty);
//if (OwnerType == OwnerType.Member) sqlExpress.And(o => o.OwnerKvid == KiviiContext.CurrentMember.Kvid || o.OwnerKvid == Guid.Empty);
...
...
@@ -262,12 +273,14 @@ namespace Kivii.Finances.Transforms
if
(
Invoiced
.
Value
)
sqlExpress
.
And
(
o
=>
o
.
AmountInvoice
==
o
.
Amount
);
else
sqlExpress
.
And
(
o
=>
o
.
AmountInvoice
<
o
.
Amount
);
}
if
(!
Limited
)
sqlExpress
.
Rows
=
null
;
var
results
=
autoQuery
.
Execute
(
Request
,
conn
,
request
,
sqlExpress
);
var
rtns
=
new
StatisticResponse
<
Payment
>();
rtns
.
PopulateWith
(
results
);
rtns
.
TotalAmount
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
).
Sum
(
o
=>
o
.
Amount
);
rtns
.
TotalQuantity
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
).
Count
();
rtns
.
TotalAmountSplited
=
rtns
.
Results
.
Where
(
o
=>
o
.
AmountSplited
>
0
).
Sum
(
o
=>
o
.
AmountSplited
);
rtns
.
TotalQuantitySplited
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
&&
o
.
AmountSplited
==
o
.
Amount
).
Count
();
rtns
.
TotalAmountInvoice
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
&&
o
.
AmountInvoice
>
0
).
Sum
(
o
=>
o
.
AmountInvoice
);
rtns
.
TotalQuantityInvoice
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
&&
o
.
AmountInvoice
==
o
.
Amount
).
Count
();
rtns
.
TotalAmountUsed
=
rtns
.
Results
.
Where
(
o
=>
o
.
Amount
>=
0
&&
o
.
AmountUsed
>
0
).
Sum
(
o
=>
o
.
AmountUsed
);
...
...
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