2023-10-24
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
@@ -69,7 +70,15 @@ namespace BLL
|
||||
return Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackProgressId == ContractTrackProgressId);
|
||||
}
|
||||
|
||||
public static PHTGL_ContractTrackProgress GetPHTGL_ContractTrackProgressByTrackIdAndDate(string ContractTrackId,string date)
|
||||
{
|
||||
return Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackId == ContractTrackId && x.Date==date);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据合同价格信息主键创建进度日期数据
|
||||
/// </summary>
|
||||
/// <param name="ContractTrackId"></param>
|
||||
public static void CreateTemplateByContractTrackId(string ContractTrackId)
|
||||
{
|
||||
var model = PhtglContractTrackService.GetPHTGL_ContractTrackById(ContractTrackId);
|
||||
@@ -80,7 +89,7 @@ namespace BLL
|
||||
{
|
||||
var startDate = (DateTime)contractmode.ContractStartDate;
|
||||
var endDate = (DateTime)contractmode.ContractEndDate;
|
||||
List<DateTime> months = GetMonthsBetween(startDate, endDate);
|
||||
List<DateTime> months = GetMonthsBetween(startDate, endDate);//获取合同起止日期
|
||||
|
||||
foreach (DateTime month in months)
|
||||
{
|
||||
@@ -101,6 +110,7 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DateTime> GetMonthsBetween(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
List<DateTime> months = new List<DateTime>();
|
||||
@@ -135,9 +145,8 @@ namespace BLL
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdatePHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
|
||||
{
|
||||
{
|
||||
var table = Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackProgressId == newtable.ContractTrackProgressId);
|
||||
if (table != null)
|
||||
@@ -154,6 +163,71 @@ namespace BLL
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 重新校验计算进度数据
|
||||
/// </summary>
|
||||
/// <param name="contractTrackId"></param>
|
||||
public static void CheckProgressByContractTrackId(string contractTrackId)
|
||||
{
|
||||
var modeContractTrack = PhtglContractTrackService.GetPHTGL_ContractTrackById(contractTrackId);
|
||||
if (modeContractTrack!=null)
|
||||
{
|
||||
var totalCostFixedComprehensiveUnitPrice = Funs.GetNewDecimalOrZero(modeContractTrack.TotalCostFixedComprehensiveUnitPrice); //全费用综合单价
|
||||
var settledAmount = modeContractTrack.SettledAmount??0;//预算金额
|
||||
var contractWeight= Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight)==0?0: Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight)/100;//合同权重
|
||||
var quserytable = new Model.PHTGL_ContractTrackProgress();
|
||||
quserytable.ContractTrackId = contractTrackId;
|
||||
var list= GetPHTGL_ContractTrackProgressByModle(quserytable);
|
||||
foreach (var item in list)
|
||||
{
|
||||
//产值=计划工程量*全费用综合单价(来源于“费用对比统计”),
|
||||
// 百分比 =(产值 / 预算金额)*合同权重
|
||||
item.ACWP_OutputValue = (item.ACWP_Quantity??0)* totalCostFixedComprehensiveUnitPrice;
|
||||
if (settledAmount == 0)
|
||||
{
|
||||
item.ACWP_Percentage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.ACWP_Percentage = Math.Round(((item.ACWP_Quantity ?? 0) / settledAmount) * contractWeight * 100, 2);
|
||||
}
|
||||
|
||||
item.BCWS_OutputValue = (item.BCWS_Quantity ?? 0) * totalCostFixedComprehensiveUnitPrice;
|
||||
if (settledAmount == 0)
|
||||
{
|
||||
item.BCWS_Percentage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BCWS_Percentage = Math.Round(((item.BCWS_Quantity ?? 0) / settledAmount) * contractWeight * 100, 2) ;
|
||||
}
|
||||
UpdatePHTGL_ContractTrackProgress(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取累计进程情况
|
||||
/// </summary>
|
||||
/// <param name="ContractTrackProgressId"></param>
|
||||
/// <param name="date"></param>
|
||||
public static PHTGL_ContractTrackProgress GetSumProgress(string contractTrackProgressId)
|
||||
{
|
||||
var result=new PHTGL_ContractTrackProgress();
|
||||
var model = GetPHTGL_ContractTrackProgressById(contractTrackProgressId);
|
||||
var q = (from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
where x.ContractTrackId == model.ContractTrackId && string.Compare(x.Date,model.Date)<=0
|
||||
select x).ToList();
|
||||
result.ACWP_Quantity = q.Sum(x => x.ACWP_Quantity ??0);
|
||||
result.ACWP_OutputValue = q.Sum(x => x.ACWP_OutputValue ?? 0);
|
||||
result.ACWP_Percentage = q.Sum(x => x.ACWP_Percentage ?? 0);
|
||||
|
||||
result.BCWS_Quantity = q.Sum(x => x.BCWS_Quantity ?? 0);
|
||||
result.BCWS_OutputValue = q.Sum(x => x.BCWS_OutputValue ?? 0);
|
||||
result.BCWS_Percentage = q.Sum(x => x.BCWS_Percentage ?? 0);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteModleById(string ContractTrackProgressId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user