提交代码
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<f:Grid ID="Grid1" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="工程量清单设置" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" DataKeyNames="QuantityCompletionId,QuantityListId" AllowCellEditing="true" ForceFit="true"
|
||||
ClicksToEdit="1" DataIDField="QuantityCompletionId" AllowSorting="true" SortField="SortIndex,Name"
|
||||
SortDirection="ASC" EnableColumnLines="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
|
||||
SortDirection="ASC" EnableColumnLines="true"
|
||||
AllowPaging="true" IsDatabasePaging="true" PageSize="1000"
|
||||
AllowFilters="true" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
@@ -33,6 +33,9 @@
|
||||
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
|
||||
Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnModify" ToolTip="修改" Icon="Pencil" OnClick="btnModify_Click" runat="server"
|
||||
Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" runat="server"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
@@ -124,13 +127,10 @@
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="导入" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="false"
|
||||
CloseAction="HidePostBack" Width="1200px" Height="600px">
|
||||
CloseAction="HidePostBack" Width="1200px" Height="700px">
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<Items>
|
||||
<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Hidden="true" Text="修改" Icon="Pencil"
|
||||
OnClick="btnMenuModify_Click">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Hidden="true" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
|
||||
OnClick="btnMenuDel_Click">
|
||||
</f:MenuButton>
|
||||
|
||||
@@ -42,33 +42,16 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
this.btnMenuModify.Hidden = false;
|
||||
this.btnModify.Hidden = false;
|
||||
this.btnMenuDel.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Grid双击事件
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
protected void btnModify_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnMenuModify_Click(null, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnMenuModify_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuantityCompletionEdit.aspx?QuantityCompletionId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuantityCompletionEdit.aspx?Months={0}", this.txtMonths.Text, "编辑 - ")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,35 +88,37 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
private void BindGrid()
|
||||
{
|
||||
//GetQuantityCompletion();
|
||||
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,
|
||||
string strSql = @"select qc.QuantityCompletionId,(select PlanNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as PlanNum,
|
||||
(select RealNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as RealNum,
|
||||
(select NextNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as NextNum,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 Months <= @month)) as TotalPlanNum,
|
||||
CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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
|
||||
CONVERT(NVARCHAR(10), ((CAST(CASE(select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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)))))+'%'
|
||||
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @month) / (1.0 * (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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)))))+'%'
|
||||
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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";
|
||||
where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_QuantityCompletion] q where q.QuantityListId=qc.QuantityListId and q.Months<=@month order by q.Months 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))));
|
||||
listStr.Add(new SqlParameter("@month", string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01"))));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
|
||||
@@ -84,6 +84,15 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnModify 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnModify;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -120,15 +129,6 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -4,21 +4,103 @@
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title></title>
|
||||
<title></title>
|
||||
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" runat="server" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
<f:Panel ID="Panel17" IsFluid="true" Title="工程量完成情况" runat="server" EnableCollapse="false"
|
||||
ShowHeader="true">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar5" Position="top" ToolbarAlign="Right" runat="server" CssClass="Toolbar2">
|
||||
<Items>
|
||||
<f:DatePicker ID="txtMonth" runat="server" ShowRedStar="true" Required="true" Label="月份" LabelAlign="Right" LabelWidth="80px"
|
||||
EnableEdit="true" DateFormatString="yyyy-MM" AutoPostBack="true" DisplayType="Month" OnTextChanged="txtMonths_TextChanged">
|
||||
</f:DatePicker>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Items>
|
||||
<f:Form ID="Form15" runat="server" ShowBorder="true" BodyPadding="5px" ShowHeader="false" Title="工程量完成情况">
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" IsFluid="true" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" runat="server" EnableCollapse="false" OnRowCommand="Grid1_RowCommand"
|
||||
DataKeyNames="QuantityListId" DataIDField="QuantityListId" EnableColumnLines="true" ForceFit="true" AllowCellEditing="true" ClicksToEdit="1">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar3" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:Button ID="btnNew" ToolTip="新增" Text="" Icon="Add" EnablePostBack="true"
|
||||
runat="server" OnClick="btnNew_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="120px" ColumnID="Name" DataField="Name"
|
||||
FieldType="String" HeaderText="类型" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>'>
|
||||
</f:TextBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="Unit" DataField="Unit"
|
||||
FieldType="String" HeaderText="单位" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:TextBox ID="txtUnit" runat="server" Text='<%# Bind("Unit") %>'>
|
||||
</f:TextBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="DesignNum" DataField="DesignNum"
|
||||
FieldType="Float" HeaderText="设计数量" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:NumberBox runat="server" ID="txtDesignNum" NoDecimal="false" NoNegative="true" Text='<%# Bind("DesignNum") %>'></f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="PlanNum" DataField="PlanNum"
|
||||
FieldType="Float" HeaderText="计划完成" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:NumberBox runat="server" ID="txtPlanNum" NoDecimal="false" NoNegative="true" Text='<%# Bind("PlanNum") %>'></f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="RealNum" DataField="RealNum"
|
||||
FieldType="Float" HeaderText="实际完成" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:NumberBox runat="server" ID="txtRealNum" NoDecimal="false" NoNegative="true" Text='<%# Bind("RealNum") %>'></f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="NextNum" DataField="NextNum"
|
||||
FieldType="Float" HeaderText="下月计划" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<Editor>
|
||||
<f:NumberBox runat="server" ID="txtNextNum" NoDecimal="false" NoNegative="true" Text='<%# Bind("NextNum") %>'></f:NumberBox>
|
||||
</Editor>
|
||||
</f:RenderField>
|
||||
<f:LinkButtonField Width="30px" TextAlign="Center" HeaderText="删除" ToolTip="删除" CommandName="del"
|
||||
Icon="Delete" />
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<%--<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:DatePicker ID="txtStartDate" runat="server" ShowRedStar="true" Required="true" Label="开始日期" LabelAlign="Right" LabelWidth="150px"
|
||||
EnableEdit="true" >
|
||||
</f:DatePicker>
|
||||
<f:DatePicker ID="txtEndDate" runat="server" ShowRedStar="true" Required="true" Label="结束日期" LabelAlign="Right"
|
||||
<f:DatePicker ID="txtMonth" runat="server" ShowRedStar="true" Required="true" Label="月份" LabelAlign="Right" LabelWidth="150px"
|
||||
EnableEdit="true" >
|
||||
</f:DatePicker>
|
||||
</Items>
|
||||
@@ -67,7 +149,7 @@
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
</f:Form>
|
||||
</f:Form>--%>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -10,20 +11,6 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
{
|
||||
public partial class QuantityCompletionEdit : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public string QuantityCompletionId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["QuantityCompletionId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["QuantityCompletionId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// </summary>
|
||||
@@ -42,110 +29,171 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
QuantityCompletionId = Request.Params["QuantityCompletionId"];
|
||||
if (!string.IsNullOrEmpty(QuantityCompletionId))
|
||||
DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01");
|
||||
if (!string.IsNullOrEmpty(Request.Params["Months"]))
|
||||
{
|
||||
|
||||
Model.JDGL_QuantityCompletion QuantityCompletion = BLL.QuantityCompletionService.GetQuantityCompletionById(QuantityCompletionId);
|
||||
if (QuantityCompletion != null)
|
||||
{
|
||||
this.ProjectId = QuantityCompletion.ProjectId;
|
||||
if (QuantityCompletion.StartDate != null)
|
||||
{
|
||||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", QuantityCompletion.StartDate);
|
||||
}
|
||||
if (QuantityCompletion.EndDate != null)
|
||||
{
|
||||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", QuantityCompletion.EndDate);
|
||||
}
|
||||
Model.JDGL_QuantityList list = BLL.QuantityListService.GetQuantityListById(QuantityCompletion.QuantityListId);
|
||||
if (list != null)
|
||||
{
|
||||
this.txtName.Text = list.Name;
|
||||
this.txtUnit.Text = list.Unit;
|
||||
if (list.DesignNum != null)
|
||||
{
|
||||
this.txtDesignNum.Text = list.DesignNum.ToString();
|
||||
}
|
||||
}
|
||||
if (QuantityCompletion.PlanNum != null)
|
||||
{
|
||||
this.txtPlanNum.Text = QuantityCompletion.PlanNum.ToString();
|
||||
}
|
||||
if (QuantityCompletion.RealNum != null)
|
||||
{
|
||||
this.txtRealNum.Text = QuantityCompletion.RealNum.ToString();
|
||||
}
|
||||
if (QuantityCompletion.NextNum != null)
|
||||
{
|
||||
this.txtNextNum.Text = QuantityCompletion.NextNum.ToString();
|
||||
}
|
||||
}
|
||||
months = Convert.ToDateTime(Request.Params["Months"] + "-01");
|
||||
}
|
||||
this.txtMonth.Text = string.Format("{0:yyyy-MM}", months);
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载Grid
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
DateTime months = Convert.ToDateTime(this.txtMonth.Text + "-01");
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Grid1.DataSource = from x in db.JDGL_QuantityList
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
orderby x.SortIndex, x.Name
|
||||
select new
|
||||
{
|
||||
x.QuantityListId,
|
||||
x.Name,
|
||||
x.Unit,
|
||||
x.DesignNum,
|
||||
PlanNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.PlanNum).First(),
|
||||
RealNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.RealNum).First(),
|
||||
NextNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.NextNum).First(),
|
||||
};
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
#region 月份选择事件
|
||||
/// <summary>
|
||||
/// 月份选择事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtMonths_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtMonth.Text))
|
||||
{
|
||||
ShowNotify("请选择月份!", MessageBoxIcon.Warning);
|
||||
}
|
||||
SaveData(true);
|
||||
}
|
||||
|
||||
private void SaveData(bool bl)
|
||||
{
|
||||
string QuantityCompletionId = Request.Params["QuantityCompletionId"];
|
||||
string quantityListId = string.Empty;
|
||||
var oldQuantityList = Funs.DB.JDGL_QuantityList.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.Name == this.txtName.Text.Trim());
|
||||
if (oldQuantityList == null)
|
||||
DateTime months = Convert.ToDateTime(this.txtMonth.Text + "-01");
|
||||
var list = GetDetails();
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
foreach (var item in list)
|
||||
{
|
||||
Model.JDGL_QuantityList newQuantityList = new Model.JDGL_QuantityList();
|
||||
quantityListId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityList));
|
||||
newQuantityList.QuantityListId = quantityListId;
|
||||
newQuantityList.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newQuantityList.Name = this.txtName.Text.Trim();
|
||||
newQuantityList.Unit = this.txtUnit.Text.Trim();
|
||||
newQuantityList.DesignNum = Convert.ToDecimal(this.txtDesignNum.Text.Trim());
|
||||
BLL.QuantityListService.AddQuantityList(newQuantityList);
|
||||
}
|
||||
else
|
||||
{
|
||||
quantityListId = oldQuantityList.QuantityListId;
|
||||
oldQuantityList.Unit = this.txtUnit.Text.Trim();
|
||||
oldQuantityList.DesignNum = Convert.ToDecimal(this.txtDesignNum.Text.Trim());
|
||||
BLL.QuantityListService.UpdateQuantityList(oldQuantityList);
|
||||
}
|
||||
Model.JDGL_QuantityCompletion QuantityCompletion = new Model.JDGL_QuantityCompletion();
|
||||
if (!string.IsNullOrEmpty(this.txtPlanNum.Text.Trim()))
|
||||
{
|
||||
QuantityCompletion.PlanNum = Convert.ToDecimal(this.txtPlanNum.Text.Trim());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtRealNum.Text.Trim()))
|
||||
{
|
||||
QuantityCompletion.RealNum = Convert.ToDecimal(this.txtRealNum.Text.Trim());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtNextNum.Text.Trim()))
|
||||
{
|
||||
QuantityCompletion.NextNum = Convert.ToDecimal(this.txtNextNum.Text.Trim());
|
||||
}
|
||||
QuantityCompletion.QuantityListId = quantityListId;
|
||||
QuantityCompletion.CompileMan = this.CurrUser.UserId;
|
||||
QuantityCompletion.CompileDate = DateTime.Now;
|
||||
QuantityCompletion.StartDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||||
QuantityCompletion.EndDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||
if (!string.IsNullOrEmpty(QuantityCompletionId))
|
||||
{
|
||||
QuantityCompletion.QuantityCompletionId = QuantityCompletionId;
|
||||
BLL.QuantityCompletionService.UpdateQuantityCompletion(QuantityCompletion);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion));
|
||||
QuantityCompletion.ProjectId = this.CurrUser.LoginProjectId;
|
||||
BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion);
|
||||
string quantityListId = string.Empty;
|
||||
var oldQuantityList = db.JDGL_QuantityList.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.Name == item.Name);
|
||||
if (oldQuantityList == null)
|
||||
{
|
||||
Model.JDGL_QuantityList newQuantityList = new Model.JDGL_QuantityList();
|
||||
quantityListId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityList));
|
||||
newQuantityList.QuantityListId = quantityListId;
|
||||
newQuantityList.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newQuantityList.Name = item.Name;
|
||||
newQuantityList.Unit = item.Unit;
|
||||
newQuantityList.DesignNum = item.DesignNum;
|
||||
BLL.QuantityListService.AddQuantityList(newQuantityList);
|
||||
}
|
||||
else
|
||||
{
|
||||
quantityListId = oldQuantityList.QuantityListId;
|
||||
oldQuantityList.Unit = item.Unit;
|
||||
oldQuantityList.DesignNum = item.DesignNum;
|
||||
BLL.QuantityListService.UpdateQuantityList(oldQuantityList);
|
||||
}
|
||||
var oldQuantityCompletion = db.JDGL_QuantityCompletion.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.QuantityListId == quantityListId && x.Months == months);
|
||||
if (oldQuantityCompletion==null)
|
||||
{
|
||||
Model.JDGL_QuantityCompletion QuantityCompletion = new Model.JDGL_QuantityCompletion();
|
||||
QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion));
|
||||
QuantityCompletion.PlanNum = item.PlanNum;
|
||||
QuantityCompletion.RealNum = item.RealNum;
|
||||
QuantityCompletion.NextNum = item.NextNum;
|
||||
QuantityCompletion.Months = months;
|
||||
QuantityCompletion.QuantityListId = quantityListId;
|
||||
QuantityCompletion.CompileMan = this.CurrUser.UserId;
|
||||
QuantityCompletion.CompileDate = DateTime.Now;
|
||||
QuantityCompletion.ProjectId = this.CurrUser.LoginProjectId;
|
||||
BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldQuantityCompletion.PlanNum = item.PlanNum;
|
||||
oldQuantityCompletion.RealNum = item.RealNum;
|
||||
oldQuantityCompletion.NextNum = item.NextNum;
|
||||
BLL.QuantityCompletionService.UpdateQuantityCompletion(oldQuantityCompletion);
|
||||
}
|
||||
}
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
#region 增加按钮事件
|
||||
/// <summary>
|
||||
/// 增加按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
var list = GetDetails();
|
||||
Model.View_JDGL_QuantityCompletion ql = new Model.View_JDGL_QuantityCompletion();
|
||||
ql.QuantityListId = SQLHelper.GetNewID();
|
||||
list.Add(ql);
|
||||
Grid1.DataSource = list;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
private List<Model.View_JDGL_QuantityCompletion> GetDetails()
|
||||
{
|
||||
List<Model.View_JDGL_QuantityCompletion> list = new List<Model.View_JDGL_QuantityCompletion>();
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int i = mergedRow.Value<int>("index");
|
||||
Model.View_JDGL_QuantityCompletion ql = new Model.View_JDGL_QuantityCompletion();
|
||||
ql.QuantityListId = Grid1.Rows[i].RowID;
|
||||
ql.Name = values.Value<string>("Name");
|
||||
ql.Unit = values.Value<string>("Unit");
|
||||
ql.DesignNum = Funs.GetNewDecimal(values.Value<string>("DesignNum"));
|
||||
ql.PlanNum = Funs.GetNewDecimal(values.Value<string>("PlanNum"));
|
||||
ql.RealNum = Funs.GetNewDecimal(values.Value<string>("RealNum"));
|
||||
ql.NextNum = Funs.GetNewDecimal(values.Value<string>("NextNum"));
|
||||
list.Add(ql);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 行点击事件
|
||||
/// <summary>
|
||||
/// Grid行点击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
string quantityListId = Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
var list = GetDetails();
|
||||
if (e.CommandName == "del")//删除
|
||||
{
|
||||
var Report = list.FirstOrDefault(x => x.QuantityListId == quantityListId);
|
||||
if (Report != null)
|
||||
{
|
||||
list.Remove(Report);
|
||||
}
|
||||
this.Grid1.DataSource = list;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -31,31 +31,85 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// Panel17 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
protected global::FineUIPro.Panel Panel17;
|
||||
|
||||
/// <summary>
|
||||
/// txtStartDate 控件。
|
||||
/// Toolbar5 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtStartDate;
|
||||
protected global::FineUIPro.Toolbar Toolbar5;
|
||||
|
||||
/// <summary>
|
||||
/// txtEndDate 控件。
|
||||
/// txtMonth 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtEndDate;
|
||||
protected global::FineUIPro.DatePicker txtMonth;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// Form15 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form Form15;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar3;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// txtName 控件。
|
||||
@@ -110,41 +164,5 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtNextNum;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// hdCheckerId 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdCheckerId;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// btnClose 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnClose;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:DatePicker ID="txtStartDate" runat="server" ShowRedStar="true" Required="true" Label="开始日期" LabelAlign="Right"
|
||||
EnableEdit="true" >
|
||||
</f:DatePicker>
|
||||
<f:DatePicker ID="txtEndDate" runat="server" ShowRedStar="true" Required="true" Label="结束日期" LabelAlign="Right"
|
||||
<f:DatePicker ID="txtMonth" runat="server" ShowRedStar="true" Required="true" Label="月份" LabelAlign="Right"
|
||||
EnableEdit="true" >
|
||||
</f:DatePicker>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
|
||||
@@ -436,9 +436,9 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
/// <param name="e"></param>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.txtStartDate.Text.Trim()) || string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
|
||||
if (string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
|
||||
{
|
||||
ShowNotify("请选择开始、结束日期!", MessageBoxIcon.Warning);
|
||||
ShowNotify("请选择月份!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(errorInfos))
|
||||
@@ -447,8 +447,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
var quantityCompletionLists = from x in Funs.DB.JDGL_QuantityCompletion where x.ProjectId == this.ProjectId select x;
|
||||
string quantityListId = string.Empty;
|
||||
int a = quantityCompletions.Count();
|
||||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||||
DateTime month = Convert.ToDateTime(this.txtMonth.Text.Trim());
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
var oldQuantityList = quantityLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.Name == quantityCompletions[i].Name);
|
||||
@@ -470,7 +469,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
oldQuantityList.DesignNum = quantityCompletions[i].DesignNum;
|
||||
BLL.QuantityListService.UpdateQuantityList(oldQuantityList);
|
||||
}
|
||||
var oldQuantityCompletion = quantityCompletionLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.QuantityListId == quantityListId && x.StartDate == startDate && x.EndDate == endDate);
|
||||
var oldQuantityCompletion = quantityCompletionLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.QuantityListId == quantityListId && x.Months == month);
|
||||
if (oldQuantityCompletion == null)
|
||||
{
|
||||
Model.JDGL_QuantityCompletion newQuantityCompletion = new Model.JDGL_QuantityCompletion();
|
||||
@@ -482,8 +481,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||
newQuantityCompletion.NextNum = quantityCompletions[i].NextNum;
|
||||
newQuantityCompletion.CompileMan = this.CurrUser.UserId;
|
||||
newQuantityCompletion.CompileDate = DateTime.Now;
|
||||
newQuantityCompletion.StartDate = startDate;
|
||||
newQuantityCompletion.EndDate = endDate;
|
||||
newQuantityCompletion.Months = month;
|
||||
BLL.QuantityCompletionService.AddQuantityCompletion(newQuantityCompletion);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -49,22 +49,13 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// txtStartDate 控件。
|
||||
/// txtMonth 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtStartDate;
|
||||
|
||||
/// <summary>
|
||||
/// txtEndDate 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtEndDate;
|
||||
protected global::FineUIPro.DatePicker txtMonth;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
|
||||
Reference in New Issue
Block a user