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
93020b66
Commit
93020b66
authored
Dec 15, 2022
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
83a477b1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
289 additions
and
143 deletions
+289
-143
Analysis.cs
Src/Entities/Analysis.cs
+7
-1
Kivii.Biz.Finances.V2.0.csproj
Src/Kivii.Biz.Finances.V2.0.csproj
+14
-8
Kivii.Biz.Finances.V2.0.csproj.user
Src/Kivii.Biz.Finances.V2.0.csproj.user
+6
-0
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
RestfulPayment.Split.cs
Src/Transforms/RestfulPayment.Split.cs
+97
-0
RestfulSettlement.cs
Src/Transforms/RestfulSettlement.cs
+12
-12
RestfulPayment.Statistic.cs
Src/Transforms/Statistics/RestfulPayment.Statistic.cs
+93
-0
RestfulSettlement.Statistic.cs
Src/Transforms/Statistics/RestfulSettlement.Statistic.cs
+54
-117
packages.config
Src/packages.config
+4
-3
No files found.
Src/Entities/Analysis.cs
View file @
93020b66
...
@@ -21,6 +21,7 @@ namespace Kivii.Finances.Entities
...
@@ -21,6 +21,7 @@ namespace Kivii.Finances.Entities
public
decimal
AmountPayment
{
get
;
set
;
}
public
decimal
AmountPayment
{
get
;
set
;
}
public
decimal
AmountNotSplit
{
get
;
set
;
}
public
decimal
AmountSplit
{
get
;
set
;
}
public
decimal
AmountSplit
{
get
;
set
;
}
public
decimal
AmountRefund
{
get
;
set
;
}
public
decimal
AmountRefund
{
get
;
set
;
}
...
@@ -46,6 +47,7 @@ namespace Kivii.Finances.Entities
...
@@ -46,6 +47,7 @@ namespace Kivii.Finances.Entities
public
int
QuantityPayment
{
get
;
set
;
}
public
int
QuantityPayment
{
get
;
set
;
}
public
int
QuantityNotSplit
{
get
;
set
;
}
public
int
QuantitySplit
{
get
;
set
;
}
public
int
QuantitySplit
{
get
;
set
;
}
public
int
QuantityRefund
{
get
;
set
;
}
public
int
QuantityRefund
{
get
;
set
;
}
...
@@ -59,13 +61,17 @@ namespace Kivii.Finances.Entities
...
@@ -59,13 +61,17 @@ namespace Kivii.Finances.Entities
public
int
QuantityOffset
{
get
;
set
;
}
public
int
QuantityOffset
{
get
;
set
;
}
public
AnalysisType
Type
{
get
;
set
;
}
public
AnalysisType
Analysis
Type
{
get
;
set
;
}
public
DateTime
BeginTime
{
get
;
set
;
}
public
DateTime
BeginTime
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
public
string
Summary
{
get
;
set
;
}
public
string
Summary
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
}
}
/// <summary>
/// <summary>
...
...
Src/Kivii.Biz.Finances.V2.0.csproj
View file @
93020b66
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<DebugSymbols>
true
</DebugSymbols>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug
\
</OutputPath>
<OutputPath>
..\..\..\..\njzj.k5\appextend
\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
...
@@ -31,14 +31,17 @@
...
@@ -31,14 +31,17 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"Kivii.Common.V4.5, Version=5.6.2022.7200, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Common.V4.5, Version=5.6.2022.10000, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\packages\Kivii.Common.5.6.2022.7200\lib\net45\Kivii.Common.V4.5.dll
</HintPath>
<HintPath>
..\..\..\..\njzj.k5\packages\Kivii.Common.5.6.2022.10000\lib\net45\Kivii.Common.V4.5.dll
</HintPath>
<Private>
False
</Private>
</Reference>
</Reference>
<Reference
Include=
"Kivii.Core.V4.5, Version=5.6.2022.7200, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Core.V4.5, Version=5.6.2022.10250, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\packages\Kivii.Core.5.6.2022.7200\lib\net45\Kivii.Core.V4.5.dll
</HintPath>
<HintPath>
..\..\..\..\njzj.k5\packages\Kivii.Core.5.6.2022.10250\lib\net45\Kivii.Core.V4.5.dll
</HintPath>
<Private>
False
</Private>
</Reference>
</Reference>
<Reference
Include=
"Kivii.Linq.V4.5, Version=5.6.2022.7000, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Linq.V4.5, Version=5.6.2022.12000, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\packages\Kivii.Linq.5.6.2022.7000\lib\net45\Kivii.Linq.V4.5.dll
</HintPath>
<HintPath>
..\..\..\..\njzj.k5\packages\Kivii.Linq.5.6.2022.12000\lib\net45\Kivii.Linq.V4.5.dll
</HintPath>
<Private>
False
</Private>
</Reference>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Core"
/>
...
@@ -249,7 +252,6 @@
...
@@ -249,7 +252,6 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Content\Kivii.Biz.Finances.lnk"
/>
<EmbeddedResource
Include=
"Content\Kivii.Biz.Finances.lnk"
/>
<None
Include=
"packages.config"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Content\codes\Classic.Control.Kivii.Finances.Account.Pay.List.js"
/>
<EmbeddedResource
Include=
"Content\codes\Classic.Control.Kivii.Finances.Account.Pay.List.js"
/>
...
@@ -270,5 +272,8 @@
...
@@ -270,5 +272,8 @@
<EmbeddedResource
Include=
"Content\Scripts\element-ui.js"
/>
<EmbeddedResource
Include=
"Content\Scripts\element-ui.js"
/>
<EmbeddedResource
Include=
"Content\Scripts\vue_2_6_14.js"
/>
<EmbeddedResource
Include=
"Content\Scripts\vue_2_6_14.js"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<None
Include=
"packages.config"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
</Project>
\ No newline at end of file
Src/Kivii.Biz.Finances.V2.0.csproj.user
View file @
93020b66
...
@@ -3,4 +3,9 @@
...
@@ -3,4 +3,9 @@
<PropertyGroup>
<PropertyGroup>
<ProjectView>
ProjectFiles
</ProjectView>
<ProjectView>
ProjectFiles
</ProjectView>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"
>
<StartAction>
Program
</StartAction>
<StartProgram>
D:\njzj.k5\Startup.exe
</StartProgram>
<StartArguments>
-debug
</StartArguments>
</PropertyGroup>
</Project>
</Project>
\ No newline at end of file
Src/Properties/AssemblyInfo.cs
View file @
93020b66
...
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
...
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.202
1.1228
0")]
[assembly: AssemblyVersion("5.4.202
2.1207
0")]
[assembly: AssemblyFileVersion("5.4.202
1.1228
0")]
[assembly: AssemblyFileVersion("5.4.202
2.1207
0")]
Src/Transforms/RestfulPayment.Split.cs
View file @
93020b66
...
@@ -393,4 +393,101 @@ namespace Kivii.Finances.Transforms
...
@@ -393,4 +393,101 @@ namespace Kivii.Finances.Transforms
return
rtns
;
return
rtns
;
}
}
}
}
[
Api
(
Description
=
"到账所属"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentSetOwner
:
RestfulExecution
<
Payment
>
{
public
OwnerType
OwnerType
{
get
;
set
;
}
=
OwnerType
.
Department
;
public
Guid
OwnerKvid
{
get
;
set
;
}
public
string
OwnerName
{
get
;
set
;
}
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
if
(
Kvids
.
IsNullOrEmpty
())
throw
new
Exception
(
"请选择要标记所属部门的收款!"
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
payments
=
conn
.
SelectByIds
<
Payment
>(
Kvids
);
if
(
payments
==
null
)
throw
new
Exception
(
"收款不存在!"
);
if
(
payments
.
Exists
(
o
=>
o
.
Type
!=
PaymentType
.
Bank
))
throw
new
Exception
(
"非银行到账不可继续操作!"
);
if
(
payments
.
Exists
(
o
=>
o
.
OffsetKvid
!=
Guid
.
Empty
))
throw
new
Exception
(
"已作废收款不可继续操作!"
);
var
paymentKvids
=
payments
.
ConvertAll
(
o
=>
o
.
Kvid
);
if
(
OwnerKvid
==
Guid
.
Empty
)
{
switch
(
OwnerType
)
{
case
OwnerType
.
Department
:
{
OwnerKvid
=
KiviiContext
.
CurrentMember
.
DepartmentKvid
;
OwnerName
=
KiviiContext
.
CurrentMember
.
DepartmentName
;
break
;
}
case
OwnerType
.
Organization
:
{
OwnerKvid
=
KiviiContext
.
CurrentMember
.
OrganizationKvid
;
OwnerName
=
KiviiContext
.
CurrentMember
.
OrganizationName
;
break
;
}
case
OwnerType
.
Member
:
{
OwnerKvid
=
KiviiContext
.
CurrentMember
.
Kvid
;
OwnerName
=
KiviiContext
.
CurrentMember
.
FullName
;
break
;
}
}
}
var
rtns
=
new
RestfulExecutionResponse
<
Payment
>();
rtns
.
Results
=
new
List
<
Payment
>();
var
updateLamda
=
conn
.
From
<
Payment
>();
updateLamda
=
updateLamda
.
Update
(
o
=>
new
{
o
.
OwnerKvid
,
o
.
OwnerName
,
o
.
BizId
});
updateLamda
=
updateLamda
.
Where
(
o
=>
Sql
.
In
(
o
.
Kvid
,
paymentKvids
));
conn
.
UpdateOnly
(
new
Payment
{
OwnerKvid
=
OwnerKvid
,
OwnerName
=
OwnerName
,
BizId
=
Remark
},
updateLamda
);
foreach
(
var
item
in
payments
)
{
item
.
OwnerName
=
OwnerName
;
item
.
OwnerKvid
=
OwnerKvid
;
item
.
BizId
=
Remark
;
}
rtns
.
Results
.
AddRange
(
payments
);
return
rtns
;
}
}
[
Api
(
Description
=
"清除到账所属"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentCleanOwner
:
RestfulExecution
<
Payment
>
{
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
if
(
Kvids
.
IsNullOrEmpty
())
throw
new
Exception
(
"请选择要标记所属部门的收款!"
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
payments
=
conn
.
SelectByIds
<
Payment
>(
Kvids
);
if
(
payments
==
null
)
throw
new
Exception
(
"收款不存在!"
);
if
(
payments
.
Exists
(
o
=>
o
.
Type
!=
PaymentType
.
Bank
))
throw
new
Exception
(
"非银行到账不可继续操作!"
);
if
(
payments
.
Exists
(
o
=>
o
.
OffsetKvid
!=
Guid
.
Empty
))
throw
new
Exception
(
"已作废收款不可继续操作!"
);
var
paymentKvids
=
payments
.
ConvertAll
(
o
=>
o
.
Kvid
);
var
rtns
=
new
RestfulExecutionResponse
<
Payment
>();
rtns
.
Results
=
new
List
<
Payment
>();
var
updateLamda
=
conn
.
From
<
Payment
>();
updateLamda
=
updateLamda
.
Update
(
o
=>
new
{
o
.
OwnerKvid
,
o
.
OwnerName
});
updateLamda
=
updateLamda
.
Where
(
o
=>
Sql
.
In
(
o
.
Kvid
,
paymentKvids
));
conn
.
UpdateOnly
(
new
Payment
{
OwnerKvid
=
Guid
.
Empty
,
OwnerName
=
string
.
Empty
},
updateLamda
);
foreach
(
var
item
in
payments
)
{
item
.
OwnerName
=
string
.
Empty
;
item
.
OwnerKvid
=
Guid
.
Empty
;
}
rtns
.
Results
.
AddRange
(
payments
);
return
rtns
;
}
}
}
}
Src/Transforms/RestfulSettlement.cs
View file @
93020b66
...
@@ -27,19 +27,19 @@ namespace Kivii.Finances.Transforms
...
@@ -27,19 +27,19 @@ namespace Kivii.Finances.Transforms
Items
.
Exists
(
o
=>
o
.
PayerName
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"付款单位不能为空!"
);
Items
.
Exists
(
o
=>
o
.
PayerName
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"付款单位不能为空!"
);
Items
.
Exists
(
o
=>
o
.
Currency
==
CurrencyUnit
.
Unsupported
).
ThrowIfTrue
(
"不支持的货币单位!"
);
Items
.
Exists
(
o
=>
o
.
Currency
==
CurrencyUnit
.
Unsupported
).
ThrowIfTrue
(
"不支持的货币单位!"
);
Items
.
Exists
(
o
=>
o
.
Details
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"结算明细不能为空!"
);
Items
.
Exists
(
o
=>
o
.
Details
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"结算明细不能为空!"
);
//
var bizKvids = Items.ConvertAll(p => p.BizKvid);
var
bizKvids
=
Items
.
ConvertAll
(
p
=>
p
.
BizKvid
);
//
bizKvids.RemoveAll(o => o == Guid.Empty);
bizKvids
.
RemoveAll
(
o
=>
o
==
Guid
.
Empty
);
var
bizids
=
Items
.
ConvertAll
(
p
=>
p
.
BizId
);
var
bizids
=
Items
.
ConvertAll
(
p
=>
p
.
BizId
)
.
Distinct
().
ToList
()
;
bizids
.
RemoveAll
(
o
=>
o
.
IsNullOrEmpty
());
bizids
.
RemoveAll
(
o
=>
o
.
IsNullOrEmpty
());
var
connF
=
KiviiContext
.
GetOpenedDbConnection
<
Settlement
>();
var
connF
=
KiviiContext
.
GetOpenedDbConnection
<
Settlement
>();
foreach
(
var
bizId
in
bizids
)
//
foreach (var bizId in bizids)
{
//
{
if
(
connF
.
Exists
<
Settlement
>(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
o
.
BizId
==
bizId
))
throw
new
Exception
(
$"
{
bizId
}
重复结算的对象!"
);
//
if (connF.Exists<Settlement>(o => o.OffsetKvid == Guid.Empty && o.BizId == bizId)) throw new Exception($"{bizId}重复结算的对象!");
}
//
}
//
if (connF.Exists<Settlement>(o => o.OffsetKvid == Guid.Empty && (Sql.In(o.BizKvid, bizKvids) || Sql.In(o.BizId, bizids)))) throw new Exception("存在重复结算的对象!");
if
(
connF
.
Exists
<
Settlement
>(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
(
Sql
.
In
(
o
.
BizKvid
,
bizKvids
)
||
Sql
.
In
(
o
.
BizId
,
bizids
))))
throw
new
Exception
(
"存在重复结算的对象!"
);
var
connE
=
KiviiContext
.
GetOpenedDbConnection
<
G
>();
var
connE
=
KiviiContext
.
GetOpenedDbConnection
<
G
>();
//
//
如果泛型类型不是Settlement本身就需要判断
//如果泛型类型不是Settlement本身就需要判断
//
if (typeof(G) != typeof(Settlement)) connE.Exists<EntitySettlement<G>>(o => o.OffsetKvid == Guid.Empty && Sql.In(o.BizId, bizids)).ThrowIfTrue("存在重复结算的对象!");
if
(
typeof
(
G
)
!=
typeof
(
Settlement
))
connE
.
Exists
<
EntitySettlement
<
G
>>(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
BizId
,
bizids
)).
ThrowIfTrue
(
"存在重复结算的对象!"
);
//var allDetails = new List<SettlementDetail>();
//var allDetails = new List<SettlementDetail>();
//Items.ForEach(o => allDetails.AddRange(o.Details));
//Items.ForEach(o => allDetails.AddRange(o.Details));
//var detailBizKvids = allDetails.ConvertAll(p => p.BizKvid);
//var detailBizKvids = allDetails.ConvertAll(p => p.BizKvid);
...
@@ -371,8 +371,8 @@ namespace Kivii.Finances.Transforms
...
@@ -371,8 +371,8 @@ namespace Kivii.Finances.Transforms
var
sqlExpress
=
autoQuery
.
CreateQuery
(
Request
,
conn
,
request
,
dynamicParams
);
var
sqlExpress
=
autoQuery
.
CreateQuery
(
Request
,
conn
,
request
,
dynamicParams
);
if
(
IsPayed
!=
null
)
if
(
IsPayed
!=
null
)
{
{
if
(
IsPayed
.
Value
)
sqlExpress
.
And
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
if
(
IsPayed
.
Value
)
sqlExpress
.
And
(
o
=>
o
.
AmountPayment
==
o
.
Amount
||
o
.
Amount
==
0
);
else
sqlExpress
.
And
(
o
=>
o
.
Amount
Payment
<
o
.
Amount
||
o
.
AmountPayment
<=
0
);
else
sqlExpress
.
And
(
o
=>
o
.
Amount
!=
0
&&
(
o
.
AmountPayment
<
o
.
Amount
||
o
.
AmountPayment
<=
0
)
);
}
}
if
(
IsBilled
!=
null
)
if
(
IsBilled
!=
null
)
{
{
...
...
Src/Transforms/Statistics/RestfulPayment.Statistic.cs
View file @
93020b66
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
Kivii.Linq
;
using
Kivii.Linq
;
using
Kivii.Web
;
using
Kivii.Web
;
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -202,4 +203,96 @@ namespace Kivii.Finances.Transforms
...
@@ -202,4 +203,96 @@ namespace Kivii.Finances.Transforms
return
rtns
;
return
rtns
;
}
}
}
}
[
Api
(
Description
=
"部门流水划拨分析"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentOwneSplitedAnalysis
:
RestfulExecution
<
Payment
>
{
public
Guid
OwnerKvid
{
get
;
set
;
}
public
List
<
Guid
>
OwnerKvids
{
get
;
set
;
}
public
DateTime
BeginTime
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
public
bool
IsDetail
{
get
;
set
;
}
//如果是查询明细,就按照部门把划拨到各个部门的流水列出来,如果不是查明细就查当前部门流水的划拨情况,划拨了多少,待划拨多少
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
//(OwnerKvid == Guid.Empty).ThrowIfTrue("请传入部门信息以统计划拨统计");
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
if
(
BeginTime
==
DateTime
.
MinValue
)
BeginTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
1
);
if
(
EndTime
==
DateTime
.
MinValue
)
EndTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
monthDay
);
var
beginTime
=
DateTime
.
Parse
(
BeginTime
.
ToString
(
"yyyy-MM-dd"
));
var
endTime
=
DateTime
.
Parse
(
EndTime
.
ToString
(
"yyyy-MM-dd"
));
if
(
endTime
<
beginTime
)
throw
new
Exception
(
"查询结束日期不可小于开始日期!"
);
if
(
endTime
==
beginTime
)
endTime
=
endTime
.
AddDays
(
1
);
var
rtns
=
new
StatisticResponse
<
Analysis
>();
rtns
.
BeginTime
=
BeginTime
;
rtns
.
EndTime
=
EndTime
;
if
(
OwnerKvids
.
IsNullOrEmpty
())
OwnerKvids
=
new
List
<
Guid
>();
if
(
OwnerKvid
!=
Guid
.
Empty
)
OwnerKvids
.
Add
(
OwnerKvid
);
if
(
OwnerKvids
.
IsNullOrEmpty
())
OwnerKvids
.
AddRange
(
KiviiContext
.
CurrentMember
.
DepartmentKvids
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
queryAccount
=
conn
.
From
<
Account
>();
queryAccount
.
Where
(
o
=>
o
.
OrganizationKvid
==
KiviiContext
.
CurrentMember
.
OrganizationKvid
&&
Sql
.
In
(
o
.
Type
,
AccountType
.
Balance
,
AccountType
.
Cash
,
AccountType
.
Pos
));
queryAccount
.
Select
(
o
=>
o
.
Kvid
);
var
queryRoot
=
conn
.
From
<
Payment
>();
queryRoot
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
o
.
Type
==
PaymentType
.
Bank
&&
Sql
.
In
(
o
.
OwnerKvid
,
OwnerKvids
)
&&
Sql
.
In
(
o
.
PayerAccountKvid
,
queryAccount
)
&&
o
.
OperateTime
>=
beginTime
&&
o
.
OperateTime
<
endTime
);
//如果是查询明细,就按照部门把划拨到各个部门的流水列出来,如果不是查明细就查当前部门流水的划拨情况,划拨了多少,待划拨多少
if
(
IsDetail
)
{
queryRoot
.
Select
(
o
=>
o
.
Kvid
);
var
query
=
conn
.
From
<
Payment
>();
query
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
Refund
,
PaymentType
.
UnBiz
,
PaymentType
.
Split
)
&&
Sql
.
In
(
o
.
ParentKvid
,
queryRoot
));
query
.
GroupBy
(
o
=>
new
{
o
.
OwnerName
,
o
.
Type
});
query
.
Select
(
o
=>
new
{
Summary
=
o
.
OwnerName
,
Type
=
o
.
Type
,
Quantity
=
Sql
.
Count
(
o
.
Kvid
),
Amount
=
Sql
.
Sum
(
o
.
Amount
),
AmountInvoice
=
Sql
.
Sum
(
o
.
AmountInvoice
),
QuantityInvoice
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountInvoice
?
1
:
0
),
AmountNotInvoice
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountInvoice
),
QuantityNotInvoice
=
Sql
.
Sum
(
o
.
AmountInvoice
<
o
.
Amount
?
1
:
0
),
AmountUsed
=
Sql
.
Sum
(
o
.
AmountUsed
),
QuantityUsed
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountUsed
?
1
:
0
),
AmountNotUsed
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountUsed
),
QuantityNotUsed
=
Sql
.
Sum
(
o
.
AmountUsed
<
o
.
Amount
?
1
:
0
)
});
rtns
.
Results
=
conn
.
Select
<
Analysis
>(
query
);
}
else
{
queryRoot
.
GroupBy
(
o
=>
o
.
OwnerName
);
queryRoot
.
Select
(
o
=>
new
{
Summary
=
o
.
OwnerName
,
Quantity
=
Sql
.
Count
(
o
.
Kvid
),
Amount
=
Sql
.
Sum
(
o
.
Amount
),
AmountSplit
=
Sql
.
Sum
(
o
.
AmountSplited
),
QuantitySplit
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountSplited
?
1
:
0
),
AmountNotSplit
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountSplited
),
QuantityNotSplit
=
Sql
.
Sum
(
o
.
AmountSplited
<
o
.
Amount
?
1
:
0
),
AmountInvoice
=
Sql
.
Sum
(
o
.
AmountInvoice
),
QuantityInvoice
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountInvoice
?
1
:
0
),
AmountNotInvoice
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountInvoice
),
QuantityNotInvoice
=
Sql
.
Sum
(
o
.
AmountInvoice
<
o
.
Amount
?
1
:
0
),
AmountUsed
=
Sql
.
Sum
(
o
.
AmountUsed
),
QuantityUsed
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountUsed
?
1
:
0
),
AmountNotUsed
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountUsed
),
QuantityNotUsed
=
Sql
.
Sum
(
o
.
AmountUsed
<
o
.
Amount
?
1
:
0
)
});
rtns
.
Results
=
conn
.
Select
<
Analysis
>(
queryRoot
);
}
rtns
.
Total
=
rtns
.
Results
.
Count
();
return
rtns
;
}
}
}
}
Src/Transforms/Statistics/RestfulSettlement.Statistic.cs
View file @
93020b66
...
@@ -21,9 +21,11 @@ namespace Kivii.Finances.Transforms
...
@@ -21,9 +21,11 @@ namespace Kivii.Finances.Transforms
public
DateTime
BeginTime
{
get
;
set
;
}
public
DateTime
BeginTime
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
public
List
<
string
>
Types
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
{
var
rtns
=
new
StatisticResponse
<
Analysis
>();
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
if
(
BeginTime
==
DateTime
.
MinValue
)
BeginTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
1
);
if
(
BeginTime
==
DateTime
.
MinValue
)
BeginTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
1
);
if
(
EndTime
==
DateTime
.
MinValue
)
EndTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
monthDay
);
if
(
EndTime
==
DateTime
.
MinValue
)
EndTime
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
monthDay
);
...
@@ -38,137 +40,72 @@ namespace Kivii.Finances.Transforms
...
@@ -38,137 +40,72 @@ namespace Kivii.Finances.Transforms
var
sqlExpress
=
conn
.
From
<
Settlement
>();
var
sqlExpress
=
conn
.
From
<
Settlement
>();
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
);
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
);
sqlExpress
.
And
(
o
=>
o
.
CreateTime
>=
beginTime
&&
o
.
CreateTime
<
endTime
);
sqlExpress
.
And
(
o
=>
o
.
CreateTime
>=
beginTime
&&
o
.
CreateTime
<
endTime
);
//sqlExpress.And(o => o.AmountPayment < o.Amount || o.AmountPayment == 0);
if
(!
OwnerKvids
.
IsNullOrEmpty
())
sqlExpress
.
And
(
o
=>
Sql
.
In
(
o
.
OwnerKvid
,
OwnerKvids
));
if
(!
OwnerKvids
.
IsNullOrEmpty
())
sqlExpress
.
And
(
o
=>
Sql
.
In
(
o
.
OwnerKvid
,
OwnerKvids
));
//if (OwnerKvid != Guid.Empty) sqlExpress.And(o => o.OwnerKvid == OwnerKvid);
sqlExpress
.
Select
(
o
=>
new
{
o
.
OwnerName
,
o
.
OwnerKvid
,
o
.
Type
,
o
.
AmountPayment
,
o
.
Amount
});
var
results
=
conn
.
Select
(
sqlExpress
);
if
(!
GroupByOwner
)
#
region
如果是
GroupByOwner
的处理情况
if
(
GroupByOwner
)
{
{
sqlExpress
.
GroupBy
(
o
=>
o
.
OwnerName
);
var
rtns
=
new
StatisticResponse
<
Analysis
>();
sqlExpress
.
Select
(
o
=>
new
{
Summary
=
o
.
OwnerName
,
Quantity
=
Sql
.
Count
(
o
.
Kvid
),
Amount
=
Sql
.
Sum
(
o
.
Amount
),
AmountPayment
=
Sql
.
Sum
(
o
.
AmountPayment
),
QuantityPayment
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountPayment
?
1
:
0
),
AmountUnpaid
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountPayment
),
QuantityUnpaid
=
Sql
.
Sum
(
o
.
AmountPayment
<
o
.
Amount
?
1
:
0
)
});
rtns
.
Results
=
conn
.
Select
<
Analysis
>(
sqlExpress
);
rtns
.
BeginTime
=
BeginTime
;
rtns
.
BeginTime
=
BeginTime
;
rtns
.
EndTime
=
EndTime
;
rtns
.
EndTime
=
EndTime
;
rtns
.
Results
=
new
List
<
Analysis
>();
if
(
rtns
.
Results
.
IsNullOrEmpty
())
return
rtns
;
if
(
results
.
IsNullOrEmpty
())
return
rtns
;
rtns
.
Total
=
rtns
.
Results
.
Sum
(
o
=>
o
.
Quantity
);
rtns
.
Total
=
results
.
Count
();
rtns
.
TotalAmount
=
rtns
.
Results
.
Sum
(
o
=>
o
.
Amount
);
rtns
.
TotalAmount
=
results
.
Sum
(
o
=>
o
.
Amount
);
rtns
.
TotalAmountPayment
=
rtns
.
Results
.
Sum
(
o
=>
o
.
AmountPayment
);
rtns
.
TotalAmountPayment
=
results
.
Sum
(
o
=>
o
.
AmountPayment
);
rtns
.
TotalQuantityPayment
=
rtns
.
Results
.
Sum
(
o
=>
o
.
QuantityPayment
);
rtns
.
TotalQuantityPayment
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtns
.
TotalAmountUnpaid
=
rtns
.
Results
.
Sum
(
o
=>
o
.
AmountUnpaid
);
rtns
.
TotalAmountUnpaid
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtns
.
TotalQuantityUnpaid
=
rtns
.
Results
.
Sum
(
o
=>
o
.
QuantityUnpaid
);
rtns
.
TotalQuantityUnpaid
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
//待收费报告
var
rtnReports
=
new
Analysis
();
rtnReports
.
Summary
=
"待收费报告"
;
rtnReports
.
BeginTime
=
BeginTime
;
rtnReports
.
EndTime
=
EndTime
;
rtnReports
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Count
();
rtnReports
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Sum
(
o
=>
o
.
Amount
);
rtnReports
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Sum
(
o
=>
o
.
AmountPayment
);
rtnReports
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtnReports
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnReports
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Report"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtns
.
Results
.
Add
(
rtnReports
);
//待收费政府任务
var
rtnSupervisions
=
new
Analysis
();
rtnSupervisions
.
Summary
=
"待收费政府任务"
;
rtnSupervisions
.
BeginTime
=
BeginTime
;
rtnSupervisions
.
EndTime
=
EndTime
;
rtnSupervisions
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Count
();
rtnSupervisions
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Sum
(
o
=>
o
.
Amount
);
rtnSupervisions
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Sum
(
o
=>
o
.
AmountPayment
);
rtnSupervisions
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtnSupervisions
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnSupervisions
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Supervision"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtns
.
Results
.
Add
(
rtnSupervisions
);
//待收费合同
return
rtns
;
var
rtnServices
=
new
Analysis
();
}
rtnServices
.
Summary
=
"待收费合同"
;
#
endregion
rtnServices
.
BeginTime
=
BeginTime
;
//以下是非GroupByOwner的情况
rtnServices
.
EndTime
=
EndTime
;
sqlExpress
.
GroupBy
(
o
=>
o
.
Type
);
rtnServices
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Count
();
sqlExpress
.
Select
(
o
=>
new
rtnServices
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Sum
(
o
=>
o
.
Amount
);
{
rtnServices
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Sum
(
o
=>
o
.
AmountPayment
);
Summary
=
o
.
Type
,
rtnServices
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
Quantity
=
Sql
.
Count
(
o
.
Kvid
),
rtnServices
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
Amount
=
Sql
.
Sum
(
o
.
Amount
),
rtnServices
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Service"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
AmountPayment
=
Sql
.
Sum
(
o
.
AmountPayment
),
rtns
.
Results
.
Add
(
rtnServices
);
QuantityPayment
=
Sql
.
Sum
(
o
.
Amount
==
o
.
AmountPayment
?
1
:
0
),
AmountUnpaid
=
Sql
.
Sum
(
o
.
Amount
-
o
.
AmountPayment
),
//待收费证书
QuantityUnpaid
=
Sql
.
Sum
(
o
.
AmountPayment
<
o
.
Amount
?
1
:
0
)
var
rtnCertificates
=
new
Analysis
();
});
rtnCertificates
.
Summary
=
"待收费证书"
;
var
results
=
conn
.
Select
<
Analysis
>(
sqlExpress
);
rtnCertificates
.
BeginTime
=
BeginTime
;
rtns
.
Results
=
new
List
<
Analysis
>();
rtnCertificates
.
EndTime
=
EndTime
;
if
(
results
.
IsNullOrEmpty
())
return
rtns
;
rtnCertificates
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Count
();
if
(!
Types
.
IsNullOrEmpty
())
rtnCertificates
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Sum
(
o
=>
o
.
Amount
);
{
rtnCertificates
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Sum
(
o
=>
o
.
AmountPayment
);
rtns
.
Results
.
AddRange
(
results
.
Where
(
o
=>
Types
.
Contains
(
o
.
Summary
)));
rtnCertificates
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
results
.
RemoveAll
(
o
=>
Types
.
Contains
(
o
.
Summary
));
rtnCertificates
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnCertificates
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Certificate"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtns
.
Results
.
Add
(
rtnCertificates
);
//待收费挂签
var
rtnTags
=
new
Analysis
();
rtnTags
.
Summary
=
"待收费挂签"
;
rtnTags
.
BeginTime
=
BeginTime
;
rtnTags
.
EndTime
=
EndTime
;
rtnTags
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Count
();
rtnTags
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Sum
(
o
=>
o
.
Amount
);
rtnTags
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Sum
(
o
=>
o
.
AmountPayment
);
rtnTags
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtnTags
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnTags
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
==
"Tag"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtns
.
Results
.
Add
(
rtnTags
);
//待收费其他
//待收费其他
var
rtnOthers
=
new
Analysis
();
var
rtnOthers
=
new
Analysis
();
rtnOthers
.
Summary
=
"
待收费其他
"
;
rtnOthers
.
Summary
=
"
Other
"
;
rtnOthers
.
BeginTime
=
BeginTime
;
rtnOthers
.
BeginTime
=
BeginTime
;
rtnOthers
.
EndTime
=
EndTime
;
rtnOthers
.
EndTime
=
EndTime
;
rtnOthers
.
Quantity
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Count
();
rtnOthers
.
Quantity
=
results
.
Count
();
rtnOthers
.
Amount
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Sum
(
o
=>
o
.
Amount
);
rtnOthers
.
Amount
=
results
.
Sum
(
o
=>
o
.
Amount
);
rtnOthers
.
AmountPayment
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Sum
(
o
=>
o
.
AmountPayment
);
rtnOthers
.
AmountPayment
=
results
.
Sum
(
o
=>
o
.
AmountPayment
);
rtnOthers
.
QuantityPayment
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtnOthers
.
QuantityPayment
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtnOthers
.
AmountUnpaid
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnOthers
.
AmountUnpaid
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtnOthers
.
QuantityUnpaid
=
results
.
Where
(
o
=>
o
.
Type
!=
"Report"
&&
o
.
Type
!=
"Supervision"
&&
o
.
Type
!=
"Service"
&&
o
.
Type
!=
"Certificate"
&&
o
.
Type
!=
"Tag"
).
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtnOthers
.
QuantityUnpaid
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
rtns
.
Results
.
Add
(
rtnOthers
);
rtns
.
Results
.
Add
(
rtnOthers
);
return
rtns
;
}
}
else
else
rtns
.
Results
.
AddRange
(
results
);
{
var
rtns
=
new
StatisticResponse
<
Analysis
>();
rtns
.
Results
=
new
List
<
Analysis
>();
rtns
.
BeginTime
=
BeginTime
;
rtns
.
EndTime
=
EndTime
;
if
(
results
.
IsNullOrEmpty
())
return
rtns
;
rtns
.
Total
=
results
.
Count
();
rtns
.
TotalAmount
=
results
.
Sum
(
o
=>
o
.
Amount
);
rtns
.
TotalAmountPayment
=
results
.
Sum
(
o
=>
o
.
AmountPayment
);
rtns
.
TotalQuantityPayment
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
o
.
Amount
);
rtns
.
TotalAmountUnpaid
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountPayment
);
rtns
.
TotalQuantityUnpaid
=
results
.
Count
(
o
=>
o
.
AmountPayment
==
0
||
o
.
AmountPayment
<
o
.
Amount
);
var
group
=
results
.
GroupBy
(
o
=>
o
.
OwnerName
);
return
rtns
;
foreach
(
var
kv
in
group
)
{
var
rtn
=
new
Analysis
();
rtn
.
Summary
=
kv
.
Key
;
rtn
.
Amount
=
kv
.
Sum
(
o
=>
o
.
Amount
);
rtn
.
Quantity
=
kv
.
Count
();
rtn
.
AmountPayment
=
kv
.
Sum
(
o
=>
o
.
AmountPayment
);
rtn
.
QuantityPayment
=
kv
.
Where
(
o
=>
o
.
AmountPayment
==
o
.
Amount
).
Count
();
rtn
.
AmountUnpaid
=
rtn
.
Amount
-
rtn
.
AmountPayment
;
rtn
.
QuantityUnpaid
=
rtn
.
Quantity
-
rtn
.
QuantityPayment
;
rtns
.
Results
.
Add
(
rtn
);
}
return
rtns
;
}
}
}
}
}
}
}
Src/packages.config
View file @
93020b66
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"Kivii.Common"
version
=
"5.6.2022.
72
00"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Common"
version
=
"5.6.2022.
100
00"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Core"
version
=
"5.6.2022.
720
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Core"
version
=
"5.6.2022.
1025
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Linq"
version
=
"5.6.2022.
7
000"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Linq"
version
=
"5.6.2022.
12
000"
targetFramework
=
"net45"
/>
</
packages
>
</
packages
>
\ No newline at end of file
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