GetGkvSum Detail optional
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BS.Shared;
|
||||
using BeWo.Data.Entities;
|
||||
using BS.Shared;
|
||||
using DevExpress.XtraPrinting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -41,5 +42,17 @@ namespace BeWo.Data.Access
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
public IEnumerable<long> GetGkvSumByDateRange2(DateTime? start, DateTime? end)
|
||||
{
|
||||
var sql = LoadSQLStatement("GetGkvSumByDateRange2.sql");
|
||||
|
||||
var rtn = Session.CreateSQLQuery(sql)
|
||||
.SetParameter(0, start ?? DateTime.MinValue)
|
||||
.SetParameter(1, end ?? DateTime.MaxValue)
|
||||
.List<long>();
|
||||
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
Data/Access/Scripts/GetGkvSumByDateRange2.sql
Normal file
18
Data/Access/Scripts/GetGkvSumByDateRange2.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
SELECT t1.Oid
|
||||
FROM gkvtransferprotokoll AS t1
|
||||
JOIN gkvabrechnung a1
|
||||
ON a1.Oid = t1.GkvAbrechnungOid
|
||||
WHERE DATE(t1.ErstelltAm) >= ?
|
||||
AND DATE(t1.ErstelltAm) <= ?
|
||||
AND t1.Oid = (
|
||||
SELECT MIN(Oid)
|
||||
FROM gkvtransferprotokoll AS t2
|
||||
WHERE t1.GkvAbrechnungOid = t2.GkvAbrechnungOid
|
||||
GROUP BY t2.GkvAbrechnungOid
|
||||
)
|
||||
AND
|
||||
(
|
||||
(a1.Verfahrensstufe = 1 AND t1.EmpfangerBezeichnung NOT LIKE 'knappschaft')
|
||||
OR
|
||||
a1.Verfahrensstufe = 2
|
||||
)
|
||||
@@ -1812,7 +1812,7 @@ WHERE sc.Billable = 1 and sr.StartDate >= '{0:yyyy-MM-dd}' and sr.StartDate < '{
|
||||
return lCriteria.List<GkvTransferProtokoll>();
|
||||
}
|
||||
|
||||
public IEnumerable<InvoiceBase> GetInvoiceBases(DateTime? startDate, DateTime? endDate, long costBearerOid, String invoiceId)
|
||||
public IEnumerable<InvoiceBase> GetInvoiceBases(DateTime? startDate, DateTime? endDate, long costBearerOid, String invoiceId)
|
||||
{
|
||||
var lCriteria = CreateCriteriaIsActive<InvoiceBase>();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BeWo.Service.ServiceContracts
|
||||
string Echo(string echo);
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke(UriTemplate = "/GetGkvSum?f={flag}", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
|
||||
[WebInvoke(UriTemplate = "/GetGkvSum?detail={flag}", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
|
||||
object GetGkvAbrechnungSumme(AdminServiceSumReqDC request, string flag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Data.Entities.Light;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceContracts;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts.AdminService;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.Pdf.Native.BouncyCastle.Ocsp;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -26,7 +30,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
return echo;
|
||||
}
|
||||
|
||||
public object GetGkvAbrechnungSumme(AdminServiceSumReqDC request, string flag)
|
||||
public object GetGkvAbrechnungSumme(AdminServiceSumReqDC request, string detail)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
@@ -45,9 +49,57 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
var sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(start, end);
|
||||
|
||||
var json = JsonUtils.ToSimpleJson("sum", sum);
|
||||
if (detail != "true")
|
||||
{
|
||||
var json = JsonUtils.ToSimpleJson("sum", sum);
|
||||
|
||||
return json;
|
||||
return json;
|
||||
}
|
||||
|
||||
string detail_res;
|
||||
|
||||
var protokolle_oids = DAOFactory.ScriptDAO.GetGkvSumByDateRange2(start, end);
|
||||
if (protokolle_oids.HasContent())
|
||||
{
|
||||
var protokolle = DAOFactory.GenericDAO.LoadByIDs<GkvTransferProtokollLight>(protokolle_oids);
|
||||
var abrechnung_oids = protokolle.Select(x => x.GkvAbrechnungOid).Distinct();
|
||||
var abrechnung = DAOFactory.GenericDAO.LoadByIDs<GkvAbrechnungLight>(abrechnung_oids);
|
||||
|
||||
var objs = abrechnung.Select(x =>
|
||||
{
|
||||
var t = x.TransferProtokolle.First();
|
||||
return new
|
||||
{
|
||||
oid = x.Oid,
|
||||
toid = t.Oid,
|
||||
created = x.ErstelltAm,
|
||||
rec = t.BezDatenannahmestelle,
|
||||
str = x.AbrechnungsZeitraumStart,
|
||||
end = x.AbrechnungsZeitraumEnde,
|
||||
ver = x.Verfahrensstufe.ToString(),
|
||||
sta = x.GetState().ToString(),
|
||||
urg = x.UrbelegeGesendet,
|
||||
bez = x.Bezahlt,
|
||||
sum = x.Betrag.ToString("0.00€")
|
||||
};
|
||||
});
|
||||
|
||||
detail_res = JsonUtils.ConvertToJson(objs);
|
||||
}
|
||||
else
|
||||
{
|
||||
detail_res = "no records found";
|
||||
}
|
||||
|
||||
var rtn = new
|
||||
{
|
||||
sum = sum?.ToString("0.00") ?? "0.00",
|
||||
predicate = detail_res,
|
||||
};
|
||||
|
||||
var json2 = JsonUtils.ConvertToJson(rtn);
|
||||
|
||||
return json2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,18 @@ namespace BS.Shared.Core
|
||||
return JsonConvert.SerializeObject(dict);
|
||||
}
|
||||
|
||||
public static string ToJson(Dictionary<string, object> dict)
|
||||
public static string ConvertToJson(Dictionary<string, object> dict)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(dict);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static string ConvertToJson(dynamic payload, Formatting formatting = Formatting.None)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject((object)payload, formatting);
|
||||
|
||||
return json;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace BS.Shared.Extensions
|
||||
{
|
||||
public static class IEnumerableTExtensions
|
||||
{
|
||||
public static bool HasNoContent<T>(this IEnumerable<T> values)
|
||||
=> !HasContent(values);
|
||||
|
||||
public static bool HasContent<T>(this IEnumerable<T> values)
|
||||
=> values is IEnumerable<T> && values.Any();
|
||||
|
||||
public static bool ContainsSameItemsAs<T>(this IEnumerable<T> p1, IEnumerable<T> pList)
|
||||
{
|
||||
if ((p1 == null || p1.Count() == 0) && (pList == null || pList.Count() == 0))
|
||||
|
||||
Reference in New Issue
Block a user