382 lines
14 KiB
C#
382 lines
14 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
public partial class SamplePrint : System.Web.UI.Page
|
|||
|
{
|
|||
|
//创建一个共用的订单bll层
|
|||
|
Maticsoft.BLL.nr_z_dd ddbll = new Maticsoft.BLL.nr_z_dd();
|
|||
|
//创建一个共用的订单模板
|
|||
|
Maticsoft.Model.nr_z_dd dd = new Maticsoft.Model.nr_z_dd();
|
|||
|
//创建一个共用的客户bll层
|
|||
|
Maticsoft.BLL.nr_z_kehu kehubll = new Maticsoft.BLL.nr_z_kehu();
|
|||
|
//创建一个操作记录模板
|
|||
|
Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi();
|
|||
|
//创建一个操作记录bll
|
|||
|
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
|
|||
|
public string userinfo = "";
|
|||
|
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
if (Session["user"] == null)
|
|||
|
{
|
|||
|
Response.Redirect("../index.aspx");
|
|||
|
}
|
|||
|
DataTable dtuserinfo = DBHlper.Execute("select mingcheng,logourl from nr_sysuserinfo").Tables[0];
|
|||
|
if (dtuserinfo.Rows.Count > 0)
|
|||
|
{
|
|||
|
userinfo = dtuserinfo.Rows[0]["mingcheng"].ToString();
|
|||
|
img_logo.Src = "../UseFile/" + dtuserinfo.Rows[0]["logourl"].ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
img_logo.Visible = false;
|
|||
|
}
|
|||
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
|||
|
if (Request.QueryString["uid"] != null && Request.QueryString["uid"] != "")
|
|||
|
{
|
|||
|
string uid = Request.QueryString["uid"].ToString();
|
|||
|
id.Value = uid;
|
|||
|
initdata(Convert.ToInt32(uid));
|
|||
|
}
|
|||
|
getqdgj();
|
|||
|
getxmxx();
|
|||
|
getxgfyxx();
|
|||
|
getscyl();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region 修改时获取真正数据值
|
|||
|
private void initdata(int did)
|
|||
|
{
|
|||
|
DataTable dt = DBHlper.Execute("select * from nr_z_ypdj where id=" + did).Tables[0];
|
|||
|
|
|||
|
if (dt.Rows.Count > 0)
|
|||
|
{
|
|||
|
kfh.Text = dt.Rows[0]["kfh"].ToString();
|
|||
|
huohao.Text = dt.Rows[0]["huohao"].ToString();
|
|||
|
xlh.Text = dt.Rows[0]["xiliehao"].ToString();
|
|||
|
cpmc.Text = dt.Rows[0]["cpmc"].ToString();
|
|||
|
zdysj.Text = Convert.ToDateTime(dt.Rows[0]["zdysj"]).ToString("yyyy-MM-dd");
|
|||
|
xgsj.Text = Convert.ToDateTime(dt.Rows[0]["xgsj"]).ToString("yyyy-MM-dd");
|
|||
|
ypcc.Text = dt.Rows[0]["ypcc"].ToString();
|
|||
|
zhongliang.Text = Convert.ToDouble(dt.Rows[0]["zhongl"]).ToString();
|
|||
|
rongliang.Text = Convert.ToDouble(dt.Rows[0]["rongl"]).ToString();
|
|||
|
banci.Text = dt.Rows[0]["banci"].ToString();
|
|||
|
zhuangtai.Text = dt.Rows[0]["zt"].ToString();
|
|||
|
qdqz.Text = dt.Rows[0]["qdqz"].ToString();
|
|||
|
zdqz.Text = dt.Rows[0]["zdqz"].ToString();
|
|||
|
hdqz.Text = dt.Rows[0]["hdqz"].ToString();
|
|||
|
shr.Text = dt.Rows[0]["shr"].ToString();
|
|||
|
tp.Src = "../Client_Folder/" + dt.Rows[0]["tupian"].ToString() + "";
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region 加载工价信息
|
|||
|
private void getqdgj()
|
|||
|
{
|
|||
|
//加载前段工价
|
|||
|
string qdgjstring = "<table id='qdgjtb' class='bule'>";
|
|||
|
string getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id.Value + "' and jieduan='前段工价'";
|
|||
|
DataSet ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
int lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["gjmc"].ToString() + ":</span> <span>" + Convert.ToDouble(r["gjjg"]).ToString() + " </span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 7)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (7 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 7 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td> ";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
qdgjxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//中段工价
|
|||
|
qdgjstring = "<table id='zdgjtb' class='bule'>";
|
|||
|
getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id.Value + "' and jieduan='中段工价'";
|
|||
|
ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["gjmc"].ToString() + ":</span> <span>" + Convert.ToDouble(r["gjjg"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 7)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (7 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 7 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td> ";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
zdgjxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
|
|||
|
|
|||
|
//后段工价
|
|||
|
qdgjstring = "<table id='hdgjtb' class='bule'>";
|
|||
|
getgjsql = "select * from nr_z_ypdj_gj where ypdid='" + id.Value + "' and jieduan='后段工价'";
|
|||
|
ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["gjmc"].ToString() + ":</span> <span>" + Convert.ToDouble(r["gjjg"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 7)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (7 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 7 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td> ";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
hdgjxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region 加载项目信息
|
|||
|
private void getxmxx()
|
|||
|
{
|
|||
|
//加载前段项目
|
|||
|
string qdgjstring = "<table id='qdxmtb' class='bule'> <tr class='tbtilt'><td><span>项目名称</span></td><td><span>物料名称</span></td><td><span>用量</span></td><td><span>项目名称</span></td><td><span>物料名称</span></td><td><span>用量</span></td><td><span>项目名称</span></td><td><span>物料名称</span></td><td><span>用量</span></td></tr>";
|
|||
|
string getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id.Value + "' and jieduan='前段项目'";
|
|||
|
DataSet ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
int lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td><span>" + r["xmmc"].ToString() + "</span></td> <td><span>" + r["wlmc"].ToString() + "</span></td><td><span>" + Convert.ToDouble(r["wlyl"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 3)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (3 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 3 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td><td ></td><td ></td>";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
qdxmxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
|
|||
|
//加载中段项目
|
|||
|
qdgjstring = "<table id='zdxmtb' class='bule'> <tr class='tbtilt'><td ><span>项目名称</span></td><td ><span>物料名称</span></td><td><span>用量</span></td><td><span>项目名称</span></td><td ><span>物料名称</span></td><td ><span>用量</span></td><td><span>项目名称</span></td><td ><span>物料名称</span></td><td ><span>用量</span></td></tr>";
|
|||
|
getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id.Value + "' and jieduan='中段项目'";
|
|||
|
ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["xmmc"].ToString() + "</span></td> <td ><span>" + r["wlmc"].ToString() + "</span></td><td ><span> " + Convert.ToDouble(r["wlyl"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 3)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (3 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 3 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td class='head3'></td><td class='content'></td><td class='content'></td>";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
zdxmxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
|
|||
|
//加载后段项目
|
|||
|
qdgjstring = "<table id='hdxmtb' class='bule'> <tr class='tbtilt'><td ><span>项目名称</span></td><td ><span>物料名称</span></td><td ><span>用量</span></td><td ><span>项目名称</span></td><td ><span>物料名称</span></td><td ><span>用量</span></td><td ><span>项目名称</span></td><td><span>物料名称</span></td><td><span>用量</span></td></tr>";
|
|||
|
getgjsql = "select * from view_nr_z_ypdj_xmxx where ypdid='" + id.Value + "' and jieduan='后段项目'";
|
|||
|
ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["xmmc"].ToString() + "</span></td> <td ><span>" + r["wlmc"].ToString() + "</span></td><td><span> " + Convert.ToDouble(r["wlyl"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 3)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (3 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 3 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td><td ></td><td ></td>";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
hdxmxx.InnerHtml = qdgjstring + "</table>";
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region 加载相关费用信息
|
|||
|
private void getxgfyxx()
|
|||
|
{
|
|||
|
//加载前段工价
|
|||
|
string qdgjstring = "<table id='ypxgfytd' class='bule'>";
|
|||
|
string getgjsql = "select * from nr_z_ypdj_xgfy where ypdid='" + id.Value + "'";
|
|||
|
DataSet ds = DBHlper.Execute(getgjsql);
|
|||
|
//判断拼接列值,根据值更改前台样式
|
|||
|
int lies = 0;
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (lies == 0)
|
|||
|
{
|
|||
|
qdgjstring += "<tr>";
|
|||
|
}
|
|||
|
qdgjstring += "<td ><span>" + r["fymc"].ToString() + ":</span><span> " + Convert.ToDouble(r["fyje"]).ToString() + "</span></td>";
|
|||
|
lies = lies + 1;
|
|||
|
if (lies == 7)
|
|||
|
{
|
|||
|
lies = 0;
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
if (7 - lies > 0 && lies > 0)
|
|||
|
{
|
|||
|
for (int x = 0; x < 7 - lies; x++)
|
|||
|
{
|
|||
|
qdgjstring += "<td ></td> ";
|
|||
|
}
|
|||
|
qdgjstring += "</tr>";
|
|||
|
}
|
|||
|
}
|
|||
|
xgfydiv.InnerHtml = qdgjstring + "</table>";
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#region 加载水彩信息
|
|||
|
private void getscyl()
|
|||
|
{
|
|||
|
//加载前段工价
|
|||
|
string getgjsql = "select * from view_nr_z_ypdj_scyl where ypdid='" + id.Value + "'";
|
|||
|
string cltable = "<table id='scylxxtb' class='bule'>" +
|
|||
|
"<tr id='0' class='tbtilt'> <td ><span>水彩用料</span></td><td><span>用量</span></td><td><span>备注</span></td><td><span>水彩用料</span></td><td><span>用量</span></td><td><span>备注</span></td><td><span>水彩用料</span></td><td><span>用量</span></td><td><span>备注</span></td></tr>";
|
|||
|
DataSet ds = DBHlper.Execute(getgjsql);
|
|||
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|||
|
{
|
|||
|
int sjint = 0;
|
|||
|
int hcount = 1;
|
|||
|
foreach (DataRow r in ds.Tables[0].Rows)
|
|||
|
{
|
|||
|
if (sjint == 0)
|
|||
|
{
|
|||
|
cltable += "<tr>";
|
|||
|
}
|
|||
|
sjint = sjint + 1;
|
|||
|
cltable += " <td ><span>" + r["wlmc"].ToString() + "</span></td><td><span>" + Convert.ToDouble(r["scyl"]).ToString() + "</span></td><td><span>" + r["beizhu"].ToString() + "</span></td>";
|
|||
|
if (sjint == 3)
|
|||
|
{
|
|||
|
cltable += "</tr>";
|
|||
|
}
|
|||
|
hcount = hcount + 1;
|
|||
|
}
|
|||
|
if (3 - sjint > 0)
|
|||
|
{
|
|||
|
for (int hz = 0; hz < 3 - sjint; hz++)
|
|||
|
{
|
|||
|
cltable += " <td > </td><td > </td><td > </td>";
|
|||
|
}
|
|||
|
cltable += "</tr>";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
cltable += "</table>";
|
|||
|
scylxxdiv.InnerHtml = cltable;
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|