This commit is contained in:
高飞 2023-12-13 10:09:16 +08:00
commit aa944a5ba0
6 changed files with 195 additions and 4 deletions

View File

@ -1,5 +1,6 @@
namespace BLL
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -40,6 +41,10 @@
{
htmlStr = GetSendCardHtml(id);
}
else if (menuId == Const.ProjectCostManageMenuId)
{
htmlStr = GetCostManageHtml(id);
}
if (!string.IsNullOrEmpty(htmlStr))
{
string filename = name + Funs.GetNewFileName();
@ -1769,5 +1774,170 @@
return sb.ToString();
}
#endregion
#region
/// <summary>
/// 导出方法
/// </summary>
/// <param name="grid"></param>
/// <returns></returns>
public static string GetCostManageHtml(string costManageId)
{
StringBuilder sb = new StringBuilder();
var getCostManage = CostManageService.GetCostManageById(costManageId);
if (getCostManage != null)
{
sb.Append("<meta http-equiv=\"content-type\" content=\"application/word; charset=UTF-8\"/>");
sb.Append("<table width=\"100% \" cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;font-size: 10pt;\">");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"6\" style=\"width: 100%; font-size: 12pt; font-weight: bold;border-right: none;border-left: none;border-bottom: none;border-top: none; \">{0}</td> ", "分包HSE费用申请表");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", "项目名称");
sb.AppendFormat("<td align=\"center\" colspan=\"4\" >{0}</td> ", BLL.ProjectService.GetProjectNameByProjectId(getCostManage.ProjectId));
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", "分包单位名称");
sb.AppendFormat("<td align=\"center\" colspan=\"4\" >{0}</td> ", BLL.UnitService.GetUnitNameByUnitId(getCostManage.UnitId));
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", "合同号");
sb.AppendFormat("<td align=\"center\" >{0}</td> ", getCostManage.ContractNum);
sb.AppendFormat("<td align=\"center\" >{0}</td> ", "申请日期");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", string.Format("{0:yyyy-MM-dd}", getCostManage.CostManageDate));
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", "HSE费用总金额(元)");
sb.AppendFormat("<td align=\"center\" >{0}</td> ", ProjectUnitService.GetSumHSECost(getCostManage.ProjectId, getCostManage.UnitId).ToString());
sb.AppendFormat("<td align=\"center\" >{0}</td> ", "已支付的HSE费用(元)");
sb.AppendFormat("<td align=\"center\" colspan=\"2\" >{0}</td> ", CostManageService.GetSumHSECost(getCostManage.ProjectId, getCostManage.UnitId, costManageId).ToString());
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" colspan=\"6\" >{0}</td> ", "本次申请HSE费用明细");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" rowspan=\"2\" style=\"width: 10%; \" >{0}</td> ", "序号");
sb.AppendFormat("<td align=\"center\" colspan=\"3\" >{0}</td> ", "费用分项明细");
sb.AppendFormat("<td align=\"center\" rowspan=\"2\" style=\"width: 20%; \" >{0}</td> ", "费用(元)");
sb.AppendFormat("<td align=\"center\" rowspan=\"2\" >{0}</td> ", "备注");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" style=\"width: 15%; \" >{0}</td> ", "类别名称");
sb.AppendFormat("<td align=\"center\" style=\"width: 20%; \" >{0}</td> ", "分项名称");
sb.AppendFormat("<td align=\"center\" style=\"width: 15%; \" >{0}</td> ", "子项名称");
sb.Append("</tr>");
var getItem = BLL.CostManageItemService.GetCostManageItemByCostManageId(costManageId);
int i = 1;
foreach (var item in getItem)
{
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" >{0}</td> ", i.ToString());
sb.AppendFormat("<td align=\"center\" >{0}</td> ", item.SupCostTypeName);
sb.AppendFormat("<td align=\"center\" >{0}</td> ", item.CostTypeName);
sb.AppendFormat("<td align=\"center\" >{0}</td> ", item.InvestCostProject);
sb.AppendFormat("<td align=\"center\" >{0}</td> ", item.PriceMoney.ToString());
sb.AppendFormat("<td align=\"center\" >{0}</td> ","");
sb.Append("</tr>");
i++;
}
string opinin1 = string.Empty;string date1 = string.Empty;string signatureName1 = string.Empty;
var getFlow1 = Funs.DB.CostGoods_CostManageFlowOperate.FirstOrDefault(x => x.CostManageId == costManageId && x.SortIndex == 1);
if (getFlow1 != null)
{
opinin1 = getFlow1.Opinion;
date1 = string.Format("{0:yyyy-MM-dd}", getFlow1.OperaterTime);
signatureName1 = Person_PersonsService.getSignatureName(getFlow1.OperaterId);
}
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-bottom: none;\" >{0}</td> ", "分包单位项目经理意见:");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-top: none;border-bottom: none;\" >{0}</td> ", "&nbsp; &nbsp;" + opinin1);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"right\" colspan=\"4\" style=\"border-top: none;border-right: none;\">{0}</td> ", "签字:" + signatureName1 + "&nbsp; &nbsp;");
sb.AppendFormat("<td align=\"right\" colspan=\"2\" style=\"border-top: none;border-left: none;\">{0}</td> ", "日期:" + date1 + "&nbsp; &nbsp;");
sb.Append("</tr>");
string opinin2 = string.Empty; string date2 = string.Empty; string signatureName2 = string.Empty;
var getFlow2 = Funs.DB.CostGoods_CostManageFlowOperate.FirstOrDefault(x => x.CostManageId == costManageId && x.SortIndex == 2);
if (getFlow2 != null)
{
opinin2 = getFlow2.Opinion;
date2 = string.Format("{0:yyyy-MM-dd}", getFlow2.OperaterTime);
signatureName2 = Person_PersonsService.getSignatureName(getFlow2.OperaterId);
}
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-bottom: none;\" >{0}</td> ", "总包单位项目HSE经理意见");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-top: none;border-bottom: none;\" >{0}</td> ", "&nbsp; &nbsp;" + opinin2);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"right\" colspan=\"4\" style=\"border-top: none;border-right: none;\">{0}</td> ", "签字:" + signatureName2 + "&nbsp; &nbsp;");
sb.AppendFormat("<td align=\"right\" colspan=\"2\" style=\"border-top: none;border-left: none;\">{0}</td> ", "日期:" + date2 + "&nbsp; &nbsp;");
sb.Append("</tr>");
string opinin3 = string.Empty; string date3 = string.Empty; string signatureName3 = string.Empty;
var getFlow3 = Funs.DB.CostGoods_CostManageFlowOperate.FirstOrDefault(x => x.CostManageId == costManageId && x.SortIndex == 3);
if (getFlow3 != null)
{
opinin3 = getFlow3.Opinion;
date3 = string.Format("{0:yyyy-MM-dd}", getFlow3.OperaterTime);
signatureName3 = Person_PersonsService.getSignatureName(getFlow3.OperaterId);
}
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-bottom: none;\" >{0}</td> ", "总包单位项目控制经理意见:");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-top: none;border-bottom: none;\" >{0}</td> ", "&nbsp; &nbsp;" + opinin3);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"right\" colspan=\"4\" style=\"border-top: none;border-right: none;\">{0}</td> ", "签字:" + signatureName3 + "&nbsp; &nbsp;");
sb.AppendFormat("<td align=\"right\" colspan=\"2\" style=\"border-top: none;border-left: none;\">{0}</td> ", "日期:" + date3 + "&nbsp; &nbsp;");
sb.Append("</tr>");
string opinin4 = string.Empty; string date4 = string.Empty; string signatureName4 = string.Empty;
var getFlow4 = Funs.DB.CostGoods_CostManageFlowOperate.FirstOrDefault(x => x.CostManageId == costManageId && x.SortIndex == 4);
if (getFlow4 != null)
{
opinin4 = getFlow4.Opinion;
date4 = string.Format("{0:yyyy-MM-dd}", getFlow4.OperaterTime);
signatureName4 = Person_PersonsService.getSignatureName(getFlow4.OperaterId);
}
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-bottom: none;\" >{0}</td> ", "总包单位项目经理意见:");
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"left\" colspan=\"6\" style=\"border-top: none;border-bottom: none;\" >{0}</td> ", "&nbsp; &nbsp;" + opinin4);
sb.Append("</tr>");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"right\" colspan=\"4\" style=\"border-top: none;border-right: none;\">{0}</td> ", "签字:" + signatureName4 + "&nbsp; &nbsp;");
sb.AppendFormat("<td align=\"right\" colspan=\"2\" style=\"border-top: none;border-left: none;\">{0}</td> ", "日期:" + date4 + "&nbsp; &nbsp;");
sb.Append("</tr>");
sb.Append("</table>");
}
return sb.ToString();
}
#endregion
}
}

View File

@ -14379,7 +14379,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:2325/</IISUrl>
<IISUrl>http://localhost:8733/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>

View File

@ -103,6 +103,9 @@
<f:MenuButton ID="btnView" EnablePostBack="true" runat="server"
Text="查看" Icon="Find" OnClick="btnView_Click">
</f:MenuButton>
<f:MenuButton ID="btnPrinter" runat="server" EnableAjax="false" DisableControlBeforePostBack="false"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server"
Text="删除">

View File

@ -318,5 +318,16 @@ namespace FineUIPro.Web.HSSE.CostGoods
// 绑定表格
this.BindGrid();
}
protected void btnPrinter_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PrinterDocService.PrinterDocMethod(Const.ProjectCostManageMenuId, Grid1.SelectedRowID, "HSSE费用管理");
}
}
}

View File

@ -185,6 +185,15 @@ namespace FineUIPro.Web.HSSE.CostGoods
/// </remarks>
protected global::FineUIPro.MenuButton btnView;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>

View File

@ -17,11 +17,9 @@
<f:FormRow>
<Items>
<f:DropDownList ID="drpSupCostType" runat="server" Label="类别名称" Required="true" ShowRedStar="true"
EnableEdit="true"
AutoPostBack="true" OnSelectedIndexChanged="drpSupCostType_SelectedIndexChanged">
</f:DropDownList>
<f:DropDownList ID="drpCostType" runat="server" Label="分项名称" Required="true" ShowRedStar="true"
EnableEdit="true">
<f:DropDownList ID="drpCostType" runat="server" Label="分项名称" Required="true" ShowRedStar="true">
</f:DropDownList>
</Items>
</f:FormRow>