Compare commits

...

2 Commits

Author SHA1 Message Date
b513237b6e 1 2025-09-15 19:26:47 +08:00
4a48ef6fd0 12 2025-09-15 17:25:41 +08:00

View File

@@ -17,6 +17,9 @@ namespace Pilot.Report.Exploitation.SBUYingShouBiao
[Description("应收款情况表(SBU)报表插件"), HotUpdate]
public class SBUYingShouBiaoReport : SysReportBaseService
{
public DateTime? beginTime = null;
public DateTime? endTime = null;
//初始化方法
public override void Initialize()
{
@@ -37,7 +40,7 @@ namespace Pilot.Report.Exploitation.SBUYingShouBiao
DynamicObject customFilter = filter.FilterParameter.CustomFilter;
if (customFilter != null)
{
////获取组织名称
//获取组织名称
//string multiOrgnNameValues = this.GetMultiOrgnNameValues(customFilter["F_YKQC_OrgId_uky"] as DynamicObject);
////获取起始日期
//string startValue = (customFilter["F_YKQC_Date_qtr"] == null) ? string.Empty :
@@ -100,7 +103,7 @@ namespace Pilot.Report.Exploitation.SBUYingShouBiao
//创建表头对象
ReportHeader header = new ReportHeader();
header.AddChild("SBU", new LocaleValue("SBU", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar);
//header.AddChild("本年度发货及验收额", new LocaleValue("已到期应收账款(含子公司)", this.Context.UserLocale.LCID), SqlStorageType.SqlMoney);
header.AddChild("明细区域", new LocaleValue("明细区域", this.Context.UserLocale.LCID), SqlStorageType.Sqlvarchar);
header.AddChild("仪表发货金额", new LocaleValue("仪表发货金额", this.Context.UserLocale.LCID), SqlStorageType.SqlMoney);
header.AddChild("系统验收金额", new LocaleValue("系统验收金额", this.Context.UserLocale.LCID), SqlStorageType.SqlMoney);
header.AddChild("已到期应收账款", new LocaleValue("已到期应收账款(含子公司)", this.Context.UserLocale.LCID), SqlStorageType.SqlMoney);
@@ -135,6 +138,11 @@ namespace Pilot.Report.Exploitation.SBUYingShouBiao
string end = now.ToString();
//获取过滤条件
string Filter = GetFilterWhere(filter);
if (beginTime.HasValue)
begin = beginTime.Value.ToString("yyyy-MM-dd");
if (endTime.HasValue)
end = endTime.Value.ToString("yyyy-MM-dd");
/*
取数SQL
SQL查询字符串提取所需数据并将结果存入临时表
@@ -146,7 +154,7 @@ ELSE 0 END
,[预发货回款率]=CASE WHEN [预发货到期应收账款] >0 THEN [预发货回款额]/[预发货到期应收账款] ELSE 0 end
into {tableName}
FROM (
SELECT ISNULL(SBU,'其他') AS SBU
SELECT ISNULL(SBU,'其他') AS SBU,a.明细区域 as [明细区域]
,SUM([1-6个月]*A.汇率) [A6],SUM([7-12个月]*A.汇率) [A12],SUM([1-2年]*A.汇率)[A2Y],SUM([2-3年]*A.汇率) [A3Y],SUM([4-5年]*A.汇率) [A5Y],SUM([5年以上]*A.汇率) [A5YY]
,[本年回款额]=ISNULL((SELECT SUM(aa.[BenCiHeXiao]*aa.[FExchangeRate]) FROM [ZZZ_HeXiaoBook] aa
@@ -199,7 +207,7 @@ FROM T_SAL_ORDERFIN aa
,[系统验收金额]=sum([系统验收金额])
FROM ZRP_YingShouMingXi_yuyubo a
{Filter}
GROUP BY a.SBU) a
GROUP BY a.SBU,a.明细区域 ) a
");
//执行SQL并动态创建报表
@@ -223,20 +231,22 @@ FROM T_SAL_ORDERFIN aa
strwhere.AppendLine(org);
}
////日期
//string startValue = (customFilter["F_YKQC_Date_qtr"] == null) ? string.Empty :
// Convert.ToDateTime(customFilter["F_YKQC_Date_qtr"]).ToString("yyyy-MM-dd");
//string endValue = (customFilter["F_YKQC_Date_83g"] == null) ? string.Empty :
// Convert.ToDateTime(customFilter["F_YKQC_Date_83g"]).ToString("yyyy-MM-dd");
////添加日期过滤条件
//if (!String.IsNullOrWhiteSpace(startValue))
//{
// strwhere.AppendLine(string.Format(@"AND A.FDate >= '{0}'", startValue));
//}
//if (!String.IsNullOrWhiteSpace(endValue))
//{
// strwhere.AppendLine(string.Format(@"AND A.FDate <= '{0}'", endValue));
//}
//日期
string startValue = (customFilter["F_YKQC_Date_qtr"] == null) ? string.Empty :
Convert.ToDateTime(customFilter["F_YKQC_Date_qtr"]).ToString("yyyy-MM-dd");
string endValue = (customFilter["F_YKQC_Date_83g"] == null) ? string.Empty :
Convert.ToDateTime(customFilter["F_YKQC_Date_83g"]).ToString("yyyy-MM-dd");
//添加日期过滤条件
if (!String.IsNullOrWhiteSpace(startValue))
{
//strwhere.AppendLine(string.Format(@"AND A.FDate >= '{0}'", startValue));
beginTime = Convert.ToDateTime(startValue).Date;
}
if (!String.IsNullOrWhiteSpace(endValue))
{
endTime= Convert.ToDateTime(endValue).AddDays(1).Date;
//strwhere.AppendLine(string.Format(@"AND A.FDate <= '{0}'", endValue));
}
return strwhere.ToString();
}