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 = "
";
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 += "";
}
qdgjstring += "" + r["gjmc"].ToString() + ": " + Convert.ToDouble(r["gjjg"]).ToString() + " | ";
lies = lies + 1;
if (lies == 7)
{
lies = 0;
qdgjstring += "
";
}
}
if (7 - lies > 0 && lies > 0)
{
for (int x = 0; x < 7 - lies; x++)
{
qdgjstring += " | ";
}
qdgjstring += "";
}
}
qdgjxx.InnerHtml = qdgjstring + "
";
//中段工价
qdgjstring = "";
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 += "";
}
qdgjstring += "" + r["gjmc"].ToString() + ": " + Convert.ToDouble(r["gjjg"]).ToString() + " | ";
lies = lies + 1;
if (lies == 7)
{
lies = 0;
qdgjstring += "
";
}
}
if (7 - lies > 0 && lies > 0)
{
for (int x = 0; x < 7 - lies; x++)
{
qdgjstring += " | ";
}
qdgjstring += "";
}
}
zdgjxx.InnerHtml = qdgjstring + "
";
//后段工价
qdgjstring = "";
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 += "";
}
qdgjstring += "" + r["gjmc"].ToString() + ": " + Convert.ToDouble(r["gjjg"]).ToString() + " | ";
lies = lies + 1;
if (lies == 7)
{
lies = 0;
qdgjstring += "
";
}
}
if (7 - lies > 0 && lies > 0)
{
for (int x = 0; x < 7 - lies; x++)
{
qdgjstring += " | ";
}
qdgjstring += "";
}
}
hdgjxx.InnerHtml = qdgjstring + "
";
}
#endregion
#region 加载项目信息
private void getxmxx()
{
//加载前段项目
string qdgjstring = " 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 |
";
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 += "";
}
qdgjstring += "" + r["xmmc"].ToString() + " | " + r["wlmc"].ToString() + " | " + Convert.ToDouble(r["wlyl"]).ToString() + " | ";
lies = lies + 1;
if (lies == 3)
{
lies = 0;
qdgjstring += "
";
}
}
if (3 - lies > 0 && lies > 0)
{
for (int x = 0; x < 3 - lies; x++)
{
qdgjstring += " | | | ";
}
qdgjstring += "";
}
}
qdxmxx.InnerHtml = qdgjstring + "
";
//加载中段项目
qdgjstring = " 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 |
";
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 += "";
}
qdgjstring += "" + r["xmmc"].ToString() + " | " + r["wlmc"].ToString() + " | " + Convert.ToDouble(r["wlyl"]).ToString() + " | ";
lies = lies + 1;
if (lies == 3)
{
lies = 0;
qdgjstring += "
";
}
}
if (3 - lies > 0 && lies > 0)
{
for (int x = 0; x < 3 - lies; x++)
{
qdgjstring += " | | | ";
}
qdgjstring += "";
}
}
zdxmxx.InnerHtml = qdgjstring + "
";
//加载后段项目
qdgjstring = " 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 | 项目名称 | 物料名称 | 用量 |
";
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 += "";
}
qdgjstring += "" + r["xmmc"].ToString() + " | " + r["wlmc"].ToString() + " | " + Convert.ToDouble(r["wlyl"]).ToString() + " | ";
lies = lies + 1;
if (lies == 3)
{
lies = 0;
qdgjstring += "
";
}
}
if (3 - lies > 0 && lies > 0)
{
for (int x = 0; x < 3 - lies; x++)
{
qdgjstring += " | | | ";
}
qdgjstring += "";
}
}
hdxmxx.InnerHtml = qdgjstring + "
";
}
#endregion
#region 加载相关费用信息
private void getxgfyxx()
{
//加载前段工价
string qdgjstring = "";
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 += "";
}
qdgjstring += "" + r["fymc"].ToString() + ": " + Convert.ToDouble(r["fyje"]).ToString() + " | ";
lies = lies + 1;
if (lies == 7)
{
lies = 0;
qdgjstring += "
";
}
}
if (7 - lies > 0 && lies > 0)
{
for (int x = 0; x < 7 - lies; x++)
{
qdgjstring += " | ";
}
qdgjstring += "";
}
}
xgfydiv.InnerHtml = qdgjstring + "
";
}
#endregion
#region 加载水彩信息
private void getscyl()
{
//加载前段工价
string getgjsql = "select * from view_nr_z_ypdj_scyl where ypdid='" + id.Value + "'";
string cltable = "" +
" 水彩用料 | 用量 | 备注 | 水彩用料 | 用量 | 备注 | 水彩用料 | 用量 | 备注 |
";
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 += "";
}
sjint = sjint + 1;
cltable += " " + r["wlmc"].ToString() + " | " + Convert.ToDouble(r["scyl"]).ToString() + " | " + r["beizhu"].ToString() + " | ";
if (sjint == 3)
{
cltable += "
";
}
hcount = hcount + 1;
}
if (3 - sjint > 0)
{
for (int hz = 0; hz < 3 - sjint; hz++)
{
cltable += " | | | ";
}
cltable += "";
}
}
cltable += "
";
scylxxdiv.InnerHtml = cltable;
}
#endregion
}