提交代码
This commit is contained in:
@@ -18,6 +18,8 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();
|
||||
btnNew.OnClientClick = Window1.GetShowReference("QuantityCompletionEdit.aspx") + "return false;";
|
||||
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
@@ -39,6 +41,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
this.btnMenuModify.Hidden = false;
|
||||
this.btnMenuDel.Hidden = false;
|
||||
}
|
||||
@@ -46,6 +49,18 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Grid双击事件
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
btnMenuModify_Click(null, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnMenuModify_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
@@ -90,11 +105,35 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
private void BindGrid()
|
||||
{
|
||||
//GetQuantityCompletion();
|
||||
string strSql = @"select *
|
||||
from dbo.View_JDGL_QuantityCompletion qc
|
||||
where qc.ProjectId=@ProjectId order by qc.SortIndex, qc.Name";
|
||||
string strSql = @"select qc.*,ql.DesignNum,ql.Name,ql.Unit,ql.SortIndex,
|
||||
CONVERT(FLOAT, (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) as TotalPlanNum,
|
||||
CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) as TotalRealNum,
|
||||
CONVERT(NVARCHAR(10), ((CAST(CASE ISNULL(qc.PlanNum, 0) WHEN 0 THEN 0
|
||||
|
||||
ELSE 100 * ISNULL(qc.RealNum, 0) / (1.0 * qc.PlanNum) END AS DECIMAL(9, 2))))) + '%'
|
||||
|
||||
AS Rate,
|
||||
CONVERT(NVARCHAR(10), ((CAST(CASE(select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) WHEN 0 THEN 0
|
||||
|
||||
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) / (1.0 * (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) END AS DECIMAL(9, 2)))))+'%'
|
||||
|
||||
AS TotalRate,
|
||||
CONVERT(NVARCHAR(10), ((CAST(CASE ISNULL(ql.DesignNum, 0) WHEN 0 THEN 0
|
||||
|
||||
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) / (1.0 * ql.DesignNum) END AS DECIMAL(9, 2)))))+'%'
|
||||
|
||||
AS SumRate,
|
||||
CONVERT(FLOAT, (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months < qc.Months)) as LastTotalPlanNum,
|
||||
CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months < qc.Months)) as LastTotalRealNum
|
||||
from[dbo].JDGL_QuantityList ql
|
||||
left join dbo.[JDGL_QuantityCompletion] qc on ql.QuantityListId=qc.QuantityListId
|
||||
where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_QuantityCompletion] q where q.QuantityListId=qc.QuantityListId and q.EndDate<=@month order by q.EndDate desc) and qc.ProjectId=@ProjectId order by ql.SortIndex, ql.Name";
|
||||
//string strSql = @"select *
|
||||
// from dbo.View_JDGL_QuantityCompletion qc
|
||||
// where qc.ProjectId=@ProjectId order by qc.SortIndex, qc.Name";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
listStr.Add(new SqlParameter("@month", string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01").AddMonths(1))));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
@@ -163,8 +202,8 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][1].ToString();
|
||||
BLL.QuantityCompletionService.DeleteQuantityCompletionById(rowID);
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.QuantityCompletionService.DeleteQuantityCompletionByQuantityCompletionId(rowID);
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
|
||||
Reference in New Issue
Block a user