20230329数据展示页跳转
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
@@ -32,50 +33,30 @@ namespace FineUIPro.Web.DataShow
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"select NEWID() as ID, v.ProjectId,v.ProjectCode,v.ProjectName,v.allcount,v.ccount,isnull(v.allCount,0)-ISNULL(v.cCount,0) as ucCount,
|
||||
(case when isnull(v.allCount,0) > 0 then cast((isnull(v.allCount,0)-ISNULL(v.cCount,0)) *1.0 /isnull(v.allCount,0)*100 as decimal(18, 2))
|
||||
else 0 end) as rateV
|
||||
from (select h.ProjectId,p.ProjectCode,p.ProjectName,COUNT(*) as allCount,
|
||||
isnull((select COUNT(*) from Check_CheckControl as c
|
||||
where c.ProjectId=h.ProjectId and State =7
|
||||
and '1' = @cpara
|
||||
group by c.ProjectId),0) as cCount
|
||||
from Check_CheckControl as h
|
||||
left join Base_Project as p on h.ProjectId=p.ProjectId
|
||||
where p.projectId is not null ";
|
||||
string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
string cpara = string.Empty;
|
||||
if (this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND h.projectId = @projectId"; ///状态为已完成
|
||||
strSql += " AND projectId = @projectId"; ///状态为已完成
|
||||
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
||||
|
||||
cpara += " AND c.projectId ="+ this.drpProject.SelectedValue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
{
|
||||
strSql += " AND h.CheckDate >=@StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
//if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
//{
|
||||
// strSql += " AND h.RegisterDate >=@StartTime";
|
||||
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
|
||||
cpara += " AND c.CheckDate >=" + this.txtStartTime.Text;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
{
|
||||
strSql += " AND h.CheckDate <=@EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
||||
// cpara += " AND c.RegisterDate >=" + this.txtStartTime.Text;
|
||||
//}
|
||||
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
//{
|
||||
// strSql += " AND h.RegisterDate <=@EndTime";
|
||||
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
||||
|
||||
// cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text;
|
||||
//}
|
||||
|
||||
cpara += " AND c.CheckDate <=" + this.txtEndTime.Text;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cpara))
|
||||
{
|
||||
listStr.Add(new SqlParameter("@cpara"," '1' And "+ cpara));
|
||||
}
|
||||
else
|
||||
{
|
||||
listStr.Add(new SqlParameter("@cpara", "'1'"));
|
||||
}
|
||||
strSql += " group by h.ProjectId,p.ProjectCode,p.ProjectName) as v";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
@@ -172,5 +153,104 @@ namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
protected int Count1(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString());
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate <= datetime2);
|
||||
}
|
||||
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected int Count2(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State == "7");
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate <= datetime2);
|
||||
}
|
||||
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected int Count3(object projectId)
|
||||
{
|
||||
int cout1 = 0;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State != "7");
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getT = getT.Where(x => x.CheckDate <= datetime2);
|
||||
}
|
||||
cout1 = getT.Count();
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
protected string Count4(object projectId)
|
||||
{
|
||||
string rate = string.Empty;
|
||||
if (projectId != null)
|
||||
{
|
||||
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
||||
var getALL = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString());
|
||||
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getALL = getALL.Where(x => x.CheckDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getALL = getALL.Where(x => x.CheckDate >= datetime1);
|
||||
}
|
||||
var getT = getALL.Where(x => x.ProjectId == projectId.ToString() && x.State == "7");
|
||||
int coutall = getALL.Count();
|
||||
int cout0 = getT.Count();
|
||||
if (coutall > 0)
|
||||
{
|
||||
rate = Math.Round(cout0 * 1.0 / coutall * 100, 2).ToString();
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user