获取当前表单在流程中的状态:

         /// <summary>
/// 获取当前表单在流程表中的状态
/// </summary>
/// <param name="listid"></param>
/// <returns></returns>
public static String getAuditingSateByCondition(string listid)
{
object obj = SqlComm.GetObjectByCondition("TaskListRecord", " TOP 1 AuditingSate ", " ListID=" + listid + " ORDER BY ListID desc");
if (obj != null)
{
return obj.ToString();
}
else
{
return null;
}
}

判断选中的状态:

 //根据表单单号在流程表中查询历史审批记录绑定信息
this.lbRemarks.Text= SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProPurchase).ToString());
if (SqlComm.getAuditingSateByCondition("listid") == "2")
{
this.cb_Stock.Checked = true;
}

商品采购审核单详细信息查看:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProPurchaseShow.aspx.cs"
Inherits="BioErpWeb.WholeSaleSystem.ProPurchase.ProPurchaseShow" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckDepartMent.js" type="text/javascript"></script>
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/cld.js" type="text/javascript"></script>
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../JS/CustomerName.js" type="text/javascript"></script>
<script src="../../JS/ProNameChoose.js" type="text/javascript"></script>
<script src="../../Scripts/Comm.js" type="text/javascript"></script>
<style type="text/css">
#pricetable
{
border: none;
width: 99%;
}
#pricetable td
{
border: none;
}
#divprobatch
{
width: 99%;
border: none;
}
#divprobatch table
{
width: 100%;
border: none;
}
#divprobatch table td
{
border: none;
padding-right: 2px; }
.grayborder{ border:solid 1px #ccc;}
.bordernone{ border-left:none; border-top:none; border-right:none; border-bottom:none;}
</style> <script type="text/javascript">
var tri = 0;
$(document).ready(function () {
$("#form1").validate();
$(document).find("input[type='text']").each(function () {
$(this).attr("readonly", "true");
}); $(document).find("input[type='checkbox']").each(function () {
$(this).attr("disabled", "disabled");
}) $("#trprotitle").css("background-color", "#eee");
$("#probatchtr").css("background-color", "#eee"); });
function addrows(count) { for (var i = 0; i < count; i++) {
tri++;
var tr = '<tr id="tr' + tri + '"><td><input type="text" name="proName" class="required"
style=" width:294px"/><input type="hidden" name="proID" /></td><td><input type="text" name="proCount" class="{required:true,min:1,digits:true}"
style=" width:150px"/></td><td colspan="2"><input type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style=" width:150px"/>
<input type="hidden" name="purchaseProID"/></td></tr>';
var obj = $("#troption");
$(obj).after(tr); }
} //产品信息赋值
function setValues(proName, proID, proCount, proPrice, purchaseProID) { var proNames = proName.split(',');
var proIDs = proID.split(',');
var proCounts = proCount.split(',');
var proPrices = proPrice.split(',');
var purchaseProIDs=purchaseProID.split(',');
var txtProName = document.getElementsByName("proName");
var txtProID = document.getElementsByName("proID");
var txtProCount = document.getElementsByName("proCount");
var txtproPrice = document.getElementsByName("proPrice");
var txtpurchaseProID = document.getElementsByName("purchaseProID");
for (var i = 0; i <(proIDs.length-1); i++) {
txtProName[i].value = proNames[i];
txtProID[i].value = proIDs[i];
txtProCount[i].value = proCounts[i];
txtproPrice[i].value = proPrices[i];
txtpurchaseProID[i].value = purchaseProIDs[i]; } } function deleterow() {
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove(); } //根据后台传过来的产品批次个数,添加相应行数
function setaddbatchs(count) {
var trbatch = '<tr> <td id="td2"><input id="txtProName0" value="" readonly="readonly" name="txtProName0"
style="width: 294px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value=""/> </td>';
trbatch += '<td><input id="txtProCount0" name="txtProCount0" class="{required:true,min:1,digits:true}"
type="text" size="5" /></td><td><input id="txtProBatch0" name="txtProBatch0" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtProBoxNum0" name="txtProBoxNum0" value="" readonly="readonly" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtMarkDate0" name="txtMarkDate0" onfocus="setday(this)" onclick="setday(this)"
size="11" class="{required:true,dateISO:true}" type="text" readonly="readonly" /></td>';
trbatch += '<td><input id="txtExPirationDate0" onfocus="setday(this)"
onclick="setday(this)" name="txtExPirationDate0" class="{required:true,dateISO:true}" size="11" type="text" readonly="readonly" />';
trbatch += '</td><td><input type="hidden" value="" name="PurchaseProID2"/>';
trbatch += '</td></tr>';
for (var i = 0; i < count; i++) {
$("#probatchtr").after(trbatch);
}
} function setbatchsvalues(proname, proId, txtProCount, txtProBatch, txtProBoxNum, txtMarkDate, txtExPirationDate, PurchaseProID) { var pronames = proname.split(",");
var proIds = proId.split(",");
var ProCouns = txtProCount.split(",");
var ProBatchs = txtProBatch.split(",");
var ProBoxNums = txtProBoxNum.split(",");
var MarkDates = txtMarkDate.split(",");
var ExPirationDates = txtExPirationDate.split(",");
var PurchaseProIDs = PurchaseProID.split(","); var txtProName0s = document.getElementsByName("txtProName0");
var txtproIds = document.getElementsByName("proIds")
var txtProCount0 = document.getElementsByName("txtProCount0");
var txtProBatch0 = document.getElementsByName("txtProBatch0");
var txtProBoxNum0 = document.getElementsByName("txtProBoxNum0");
var txtMarkDate0 = document.getElementsByName("txtMarkDate0");
var txtExPirationDate0 = document.getElementsByName("txtExPirationDate0");
var PurchaseProID2 = document.getElementsByName("PurchaseProID2"); for (var i = 0; i < txtProName0s.length; i++) {
txtProName0s[i].value = pronames[i];
txtproIds[i].value = proIds[i];
txtProCount0[i].value = ProCouns[i];
txtProBatch0[i].value = ProBatchs[i];
txtProBoxNum0[i].value = ProBoxNums[i];
txtMarkDate0[i].value = MarkDates[i];
txtExPirationDate0[i].value = ExPirationDates[i];
PurchaseProID2[i].value = PurchaseProIDs[i]; }
}
</script> </head>
<body>
<form id="form1" runat="server">
<div style=" width:99%; height:750px; overflow:scroll;">
<table class="maintable Inupttable" style="width: 900px;">
<tr>
<td colspan="8" class="titlebar">
商品采购审核单详细信息查看
</td>
</tr>
<tr>
<td>
申请部门
</td>
<td>
<asp:TextBox ID="ddlDepartMent" runat="server"></asp:TextBox>
</td>
<td>
制表人
</td>
<td class="style1">
<asp:Label ID="lbApplayUser" runat="server"></asp:Label>
</td>
<td>
经手人
</td>
<td>
<asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}" runat="server"
Width="78px"></asp:TextBox>
<asp:Label
ID="lbOldRealName" runat="server" Text="Label"></asp:Label>
</td>
<td>
制表时间
</td>
<td>
<asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
发货(订货)单位
</td>
<td>
<asp:TextBox ID="txtSendCom" runat="server" Width="72px" CssClass="{required:true,digits:true, min:1}"></asp:TextBox>
<asp:Label
ID="lbOldSenComName" runat="server" Text="Label"></asp:Label>
</td>
<td>
入库单位
</td>
<td class="style1">
<asp:TextBox ID="ddlOrderCom" runat="server" Width="72px"></asp:TextBox> </td>
<td>
采购方式
</td>
<td>
<asp:TextBox ID="ddlSaleType" runat="server" Width="72px"></asp:TextBox> </td>
<td>
入库方式
</td>
<td>
<asp:TextBox ID="ddlTypes" runat="server" Width="72px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="8" style="border: none;" class="style2">
<div>
<table id="tableprolist" style="width:99%; border: solid 1px; border-collapse: collapse;
line-height: 25px;">
<tr id="trprotitle">
<td>
产品名称及规格
</td>
<td>
数量
</td>
<td colspan="2">
单价
</td> </tr>
<tr id="troption">
<td>
<input type="text" name="proName" class="required" style="width: 294px" /><input
type="hidden" name="proID" />
</td>
<td>
<input type="text" name="proCount" class="{required:true,min:1,digits:true}" style="width: 150px" />
</td>
<td colspan="2">
<input type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style="width: 150px" /> <input type="hidden" name="purchaseProID"/>
</td> </tr>
<tr id="caption">
<td colspan="4" style="text-align: right;"> </td>
</tr>
<tr>
<td colspan="4">
<div id="divprobatch" style="display: none;">
<table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" width="100%" style=" margin:0px auto;">
<tr id="probatchtr">
<td>
订货产品名称及规格(只读)
</td>
<td style="width: 70px;">
数量
</td>
<td style="width: 95px;">
批号
</td>
<td style="width: 95px;">
货号(只读)
</td>
<td style="width: 150px;">
生产日期
</td>
<td style="width: 150px;">
有效期
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<table id="pricetable">
<tr>
<td>
<asp:Label ID="lbTotal" runat="server" Text="产品总额"></asp:Label>
<asp:Label ID="lbTotalInvoicePrice" runat="server" Text=""></asp:Label>
</td>
<td>
<asp:Label ID="lbisPay" Visible="false" runat="server" Text="是否付款:"></asp:Label><asp:CheckBox
ID="isPay" runat="server" Visible="false" />
</td>
<td>
<asp:Label ID="lbBill" runat="server" Text="账单编号:" Visible="false"></asp:Label>
<asp:TextBox ID="txtBillNo" runat="server" Visible="false"></asp:TextBox>
</td>
<td>
<asp:Label ID="lbPayuser" runat="server" Text=" 付款人:" Visible="false"></asp:Label>
<asp:TextBox ID="txtBillUser" runat="server" Visible="false"></asp:TextBox>
<asp:Label ID="lbBillUserName" runat="server"
Text="Label"></asp:Label>
 
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="proAuditing" style=" display:none;">
产品质量审核:<asp:CheckBox ID="cb_Auditing" Text="质量审核合格" runat="server" />
</div>
<div id="stockAuditing" style=" display:none;">
<span>仓库审核:<asp:CheckBox ID="cb_Stock" Text="仓库审核合格" runat="server" /></span> </span>
</div>
</td>
</tr> <tr>
<td>
历史审批意见
</td>
<td colspan="7">
<asp:Label ID="lbRemarks" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td colspan="8" class="bottomtd">
 </td>
</tr>
</table>
</div>
</form>
</body>
</html>

后台代码:

 public partial class ProPurchaseShow: BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ getdata(); getprobatchDetail();
} }
/// <summary>
/// 批号信息加载
/// </summary>
public void getprobatchDetail()
{
BioPurchaseBLL pbll = new BioPurchaseBLL();
string id = Request.QueryString["taskid"];
//string id = "10"; DataTable dt = pbll.getProBatchDetailByPurchaseID(id);
#region 加载产品批号信息
if (dt.Rows.Count > 0)
{
int count = dt.Rows.Count;
//2011年12月2日19:27:17
//显示添加批号的前端方法修改为:showobj
ClientScript.RegisterStartupScript(this.GetType(), "showobj", "showobj('divprobatch');setaddbatchs(" + count + ");", true);
string proname = "";
string proId = "";
string txtProCount = "";
string txtProBatch = "";
string txtProBoxNum = "";
string txtMarkDate = "";
string txtExPirationDate = "";
string PurchaseProID = ""; for (int i = 0; i < dt.Rows.Count; i++)
{
proname += dt.Rows[i]["proName"].ToString() + ",";
proId += dt.Rows[i]["proID"].ToString() + ",";
txtProCount += dt.Rows[i]["proCount"].ToString() + ",";
txtProBatch += dt.Rows[i]["batchNum"].ToString() + ",";
txtProBoxNum += dt.Rows[i]["boxNum"].ToString() + ",";
txtMarkDate += Convert.ToDateTime(dt.Rows[i]["makeDate"].ToString()).ToString("yyyy-MM-dd") + ",";
txtExPirationDate += Convert.ToDateTime(dt.Rows[i]["expirationDate"].ToString()).ToString("yyyy-MM-dd") + ",";
PurchaseProID += dt.Rows[i]["purchaseProID"].ToString() + ","; } ClientScript.RegisterStartupScript(this.GetType(), "setbatchsvalues", "setbatchsvalues('" + proname + "','"
+ proId + "','" + txtProCount + "','" + txtProBatch + "','" + txtProBoxNum + "','" + txtMarkDate + "','"
+ txtExPirationDate + "','" + PurchaseProID + "');", true);
#endregion //判断是否存在此产品的批号信息
if (dt.Rows.Count>0)
{
//当前登录用户是否有产品质量审核权限 值50
if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",50,"))
{ ClientScript.RegisterStartupScript(this.GetType(), "test", "showobj('proAuditing');", true);
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0)
{
this.cb_Auditing.Checked = true;
}
}
else
{
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "showobj('proAuditing');", true);
this.cb_Auditing.Checked = true;
this.cb_Auditing.Enabled = false;
} } //如果产品批号已经审核 并且 当前登录用户是仓库管理员 则显示相应控件
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0 && SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",25,"))
{
ClientScript.RegisterStartupScript(this.GetType(), "test1", "showobj('stockAuditing');", true);
}
}
}
} protected void getdata()
{
////如果获取阐述不存在直接跳转。
if (Request.QueryString["taskid"] == null || Request.QueryString["listid"] == null)
{
Response.Write("<script>window.history.go(-1);this.close()</script>");
}
string taskid = Request.QueryString["taskid"].ToString();
string listid = Request.QueryString["listid"].ToString();
//string taskid = "10";
//string listid = "50"; string rights= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()); BioPurchaseBLL purchasebll=new BioPurchaseBLL();
ViewBioPurchaseAppInfo viewpurchase = purchasebll.getViewBioPurchaseAppInfo(taskid);
ddlDepartMent.Text=viewpurchase.DepartMent.ToString();
this.lbApplayUser.Text = viewpurchase.AppUserName.ToString();
this.lbOldRealName.Text = viewpurchase.RealUserName;
this.txtRealUserID.Text = viewpurchase.RealUserID.ToString();
this.lbTime.Text = Convert.ToDateTime(viewpurchase.OrderTime).ToString("yyyy-MM-dd");
this.lbOldSenComName.Text = viewpurchase.CopanyName;
this.txtSendCom.Text = viewpurchase.sendComID.ToString();
this.ddlOrderCom.Text = viewpurchase.OrderCom.ToString();
this.ddlSaleType.Text = viewpurchase.WholeType;
this.ddlTypes.Text = viewpurchase.sendType; //判断是否数据库中已经添加了财务审核的记录
if (viewpurchase.BillNo != "" && viewpurchase.BillNo != null)
{
this.lbBill.Visible = true;
this.lbisPay.Visible = true;
this.isPay.Visible = true;
this.txtBillNo.Visible = true;
this.lbPayuser.Visible = true;
this.txtBillUser.Visible = true;
this.txtBillUser.Text = viewpurchase.BillUserID.ToString();
this.txtBillNo.Text = viewpurchase.BillNo.ToString();
this.lbBillUserName.Text = viewpurchase.BillUserName.ToString();
int paycount = int.Parse(SqlComm.GetObjectByCondition("dbo.BioPurchasePro", "count(isPay)", " PurchaseID="+taskid).ToString());
if (paycount > 0)
{
this.isPay.Checked = true;
} }
else
{
if (rights.Contains(",48,"))
{
this.lbBill.Visible = true;
this.lbisPay.Visible = true;
this.isPay.Visible = true;
this.txtBillNo.Visible = true;
this.lbPayuser.Visible = true;
this.txtBillUser.Visible = true;
this.txtBillUser.Text = Session["Userid"].ToString();
this.txtBillNo.Text = DateTime.Now.ToString("yyyyMMdd") + taskid; }
}
//根据表单单号在流程表中查询历史审批记录绑定信息
this.lbRemarks.Text= SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProPurchase).ToString());
if (SqlComm.getAuditingSateByCondition("listid") == "2")
{
this.cb_Stock.Checked = true;
} //根据表单编号查询产品基本信息并绑定
DataTable dt = SqlComm.GetDataByCondition("View_BioPurchaseProInfo",
"ProID,ProName,ProCount,ProPrice,InvoicePrice,purchaseProID", "PurchaseID=" + taskid).Tables[0];
int count = dt.Rows.Count;
ClientScript.RegisterStartupScript(this.GetType(), "addrows", "addrows(" + (count-1) + ");", true); string proNames = "";
string proIDs = "";
string proCounts = "";
string proPrices = "";
decimal totalInvoicePrice = 0;
string purchaseProIDs = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
proIDs+= dt.Rows[i]["ProID"].ToString()+",";
proNames+=dt.Rows[i]["ProName"].ToString()+",";
proCounts+= dt.Rows[i]["ProCount"].ToString()+",";
proPrices+= decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.0")+",";
totalInvoicePrice += decimal.Parse(dt.Rows[i]["InvoicePrice"].ToString());
purchaseProIDs += dt.Rows[i]["purchaseProID"].ToString() + ",";
}
ClientScript.RegisterStartupScript(this.GetType(), "setValues",
"setValues('" + proNames + "','" + proIDs + "','" + proCounts + "','" + proPrices + "','" + purchaseProIDs + "');", true);
this.lbTotalInvoicePrice.Text = totalInvoicePrice.ToString("0.0");
}
}

产品的执行状态页面(完成页面):

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProPurchaseRun.aspx.cs"
Inherits="BioErpWeb.WholeSaleSystem.ProPurchase.ProPurchaseRun" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckDepartMent.js" type="text/javascript"></script>
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/cld.js" type="text/javascript"></script>
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../JS/CustomerName.js" type="text/javascript"></script>
<script src="../../JS/ProNameChoose.js" type="text/javascript"></script>
<script src="../../Scripts/Comm.js" type="text/javascript"></script>
<style type="text/css">
#pricetable
{
border: none;
width: 99%;
}
#pricetable td
{
border: none;
}
#divprobatch
{
width: 99%;
border: none;
}
#divprobatch table
{
width: 100%;
border: none;
}
#divprobatch table td
{
border: none;
padding-right: 2px; }
.grayborder{ border:solid 1px #ccc;}
.bordernone{ border-left:none; border-top:none; border-right:none; border-bottom:none;}
</style> <script type="text/javascript">
var tri = 0;
$(document).ready(function () {
$("#form1").validate();
$(document).find("input[type='text']").each(function () {
$(this).attr("readonly", "true");
}); $(document).find("input[type='checkbox']").each(function () {
$(this).attr("disabled", "disabled");
}) $("#trprotitle").css("background-color", "#eee");
$("#probatchtr").css("background-color", "#eee"); });
function addrows(count) { for (var i = 0; i < count; i++) {
tri++;
var tr = '<tr id="tr' + tri + '"><td><input type="text" name="proName"
class="required" style=" width:294px"/><input type="hidden" name="proID" />
</td><td><input type="text" name="proCount" class="{required:true,min:1,digits:true}" style=" width:150px"/></td>
<td colspan="2"><input type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style=" width:150px"/>
<input type="hidden" name="purchaseProID"/></td></tr>';
var obj = $("#troption");
$(obj).after(tr); }
} //产品信息赋值
function setValues(proName, proID, proCount, proPrice, purchaseProID) { var proNames = proName.split(',');
var proIDs = proID.split(',');
var proCounts = proCount.split(',');
var proPrices = proPrice.split(',');
var purchaseProIDs=purchaseProID.split(',');
var txtProName = document.getElementsByName("proName");
var txtProID = document.getElementsByName("proID");
var txtProCount = document.getElementsByName("proCount");
var txtproPrice = document.getElementsByName("proPrice");
var txtpurchaseProID = document.getElementsByName("purchaseProID");
for (var i = 0; i <(proIDs.length-1); i++) {
txtProName[i].value = proNames[i];
txtProID[i].value = proIDs[i];
txtProCount[i].value = proCounts[i];
txtproPrice[i].value = proPrices[i];
txtpurchaseProID[i].value = purchaseProIDs[i]; } } function deleterow() {
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove(); } //根据后台传过来的产品批次个数,添加相应行数
function setaddbatchs(count) {
var trbatch = '<tr> <td id="td2"><input id="txtProName0" value="" readonly="readonly" name="txtProName0"
style="width: 294px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value=""/> </td>';
trbatch += '<td><input id="txtProCount0" name="txtProCount0" class="{required:true,min:1,digits:true}"
type="text" size="5" /></td><td><input id="txtProBatch0" name="txtProBatch0" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtProBoxNum0" name="txtProBoxNum0" value="" readonly="readonly" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtMarkDate0" name="txtMarkDate0" onfocus="setday(this)" onclick="setday(this)"
size="11" class="{required:true,dateISO:true}" type="text" readonly="readonly" /></td>';
trbatch += '<td><input id="txtExPirationDate0" onfocus="setday(this)"
onclick="setday(this)" name="txtExPirationDate0" class="{required:true,dateISO:true}" size="11" type="text" readonly="readonly" />';
trbatch += '</td><td><input type="hidden" value="" name="PurchaseProID2"/>';
trbatch += '</td></tr>';
for (var i = 0; i < count; i++) {
$("#probatchtr").after(trbatch);
}
} function setbatchsvalues(proname, proId, txtProCount, txtProBatch, txtProBoxNum, txtMarkDate, txtExPirationDate, PurchaseProID) { var pronames = proname.split(",");
var proIds = proId.split(",");
var ProCouns = txtProCount.split(",");
var ProBatchs = txtProBatch.split(",");
var ProBoxNums = txtProBoxNum.split(",");
var MarkDates = txtMarkDate.split(",");
var ExPirationDates = txtExPirationDate.split(",");
var PurchaseProIDs = PurchaseProID.split(","); var txtProName0s = document.getElementsByName("txtProName0");
var txtproIds = document.getElementsByName("proIds")
var txtProCount0 = document.getElementsByName("txtProCount0");
var txtProBatch0 = document.getElementsByName("txtProBatch0");
var txtProBoxNum0 = document.getElementsByName("txtProBoxNum0");
var txtMarkDate0 = document.getElementsByName("txtMarkDate0");
var txtExPirationDate0 = document.getElementsByName("txtExPirationDate0");
var PurchaseProID2 = document.getElementsByName("PurchaseProID2"); for (var i = 0; i < txtProName0s.length; i++) {
txtProName0s[i].value = pronames[i];
txtproIds[i].value = proIds[i];
txtProCount0[i].value = ProCouns[i];
txtProBatch0[i].value = ProBatchs[i];
txtProBoxNum0[i].value = ProBoxNums[i];
txtMarkDate0[i].value = MarkDates[i];
txtExPirationDate0[i].value = ExPirationDates[i];
PurchaseProID2[i].value = PurchaseProIDs[i]; } } </script> </head>
<body>
<form id="form1" runat="server">
<div style=" width:99%; height:750px; overflow:scroll;">
<table class="maintable Inupttable" style="width: 900px;">
<tr>
<td colspan="8" class="titlebar">
商品采购审核单 流程结束
</td>
</tr>
<tr>
<td>
申请部门
</td>
<td>
<asp:TextBox ID="ddlDepartMent" runat="server"></asp:TextBox>
</td>
<td>
制表人
</td>
<td class="style1">
<asp:Label ID="lbApplayUser" runat="server"></asp:Label>
</td>
<td>
经手人
</td>
<td>
<asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}" runat="server"
Width="78px"></asp:TextBox>
<asp:Label
ID="lbOldRealName" runat="server" Text="Label"></asp:Label>
</td>
<td>
制表时间
</td>
<td>
<asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
发货(订货)单位
</td>
<td>
<asp:TextBox ID="txtSendCom" runat="server" Width="72px" CssClass="{required:true,digits:true, min:1}"></asp:TextBox>
<asp:Label
ID="lbOldSenComName" runat="server" Text="Label"></asp:Label>
</td>
<td>
入库单位
</td>
<td class="style1">
<asp:TextBox ID="ddlOrderCom" runat="server" Width="72px"></asp:TextBox> </td>
<td>
采购方式
</td>
<td>
<asp:TextBox ID="ddlSaleType" runat="server" Width="72px"></asp:TextBox> </td>
<td>
入库方式
</td>
<td>
<asp:TextBox ID="ddlTypes" runat="server" Width="72px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="8" style="border: none;" class="style2">
<div>
<table id="tableprolist" style="width:99%; border: solid 1px; border-collapse: collapse;
line-height: 25px;">
<tr id="trprotitle">
<td>
产品名称及规格
</td>
<td>
数量
</td>
<td colspan="2">
单价
</td> </tr>
<tr id="troption">
<td>
<input type="text" name="proName" class="required" style="width: 294px" /><input
type="hidden" name="proID" />
</td>
<td>
<input type="text" name="proCount" class="{required:true,min:1,digits:true}" style="width: 150px" />
</td>
<td colspan="2">
<input type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style="width: 150px" />
<!--2011年11月29日22:37:47 添加 <input type="hidden" name="purchaseProID"/>-->
<input type="hidden" name="purchaseProID"/>
</td> </tr>
<tr id="caption">
<td colspan="4" style="text-align: right;"> </td>
</tr>
<tr>
<td colspan="4">
<div id="divprobatch" style="display: none;">
<table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" width="100%" style=" margin:0px auto;">
<tr id="probatchtr">
<td>
订货产品名称及规格(只读)
</td>
<td style="width: 70px;">
数量
</td>
<td style="width: 95px;">
批号
</td>
<td style="width: 95px;">
货号(只读)
</td>
<td style="width: 150px;">
生产日期
</td>
<td style="width: 150px;">
有效期
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<table id="pricetable">
<tr>
<td>
<asp:Label ID="lbTotal" runat="server" Text="产品总额"></asp:Label>
<asp:Label ID="lbTotalInvoicePrice" runat="server" Text=""></asp:Label>
</td>
<td>
<asp:Label ID="lbisPay" Visible="false" runat="server" Text="是否付款:"></asp:Label><asp:CheckBox
ID="isPay" runat="server" Visible="false" />
</td>
<td>
<asp:Label ID="lbBill" runat="server" Text="账单编号:" Visible="false"></asp:Label>
<asp:TextBox ID="txtBillNo" runat="server" Visible="false"></asp:TextBox>
</td>
<td>
<asp:Label ID="lbPayuser" runat="server" Text=" 付款人:" Visible="false"></asp:Label>
<asp:TextBox ID="txtBillUser" runat="server" Visible="false"></asp:TextBox>
<asp:Label ID="lbBillUserName" runat="server"
Text="Label"></asp:Label>
 
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="proAuditing" style=" display:none;">
产品质量审核:<asp:CheckBox ID="cb_Auditing" Text="质量审核合格" runat="server" />
</div>
<div id="stockAuditing" style=" display:none;">
<span>仓库审核:<asp:CheckBox ID="cb_Stock" Text="仓库审核合格" runat="server" /></span> </span>
</div>
</td>
</tr> <tr>
<td>
历史审批意见
</td>
<td colspan="7">
<asp:Label ID="lbRemarks" runat="server" Text=""></asp:Label>
</td>
</tr> <tr>
<td>
备注</td>
<td colspan="7">
<asp:TextBox ID="txtRemark" Width="547px" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="8" class="bottomtd">
<asp:Button ID="Button1" runat="server" CssClass="btnorange" Text="结束流程"
onclick="Button1_Click" />
</td>
</tr>
</table> <asp:HiddenField ID="hf_applayDepartMent" runat="server" />
<asp:HiddenField ID="hf_subject" runat="server" />
<asp:HiddenField ID="hf_FirstAccepter" runat="server" />
<asp:HiddenField ID="hf_FirstTransmitter" runat="server" /> </div>
</form>
</body>
</html>

后台的代码:

 public partial class ProPurchaseRun: BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getdata();
getprobatchDetail();
} }
/// <summary>
/// 批号信息加载
/// </summary>
public void getprobatchDetail()
{
BioPurchaseBLL pbll = new BioPurchaseBLL();
string id = Request.QueryString["taskid"];
//string id = "10"; DataTable dt = pbll.getProBatchDetailByPurchaseID(id);
#region 加载产品批号信息
if (dt.Rows.Count > 0)
{
int count = dt.Rows.Count;
//2011年12月2日19:27:17
//显示添加批号的前端方法修改为:showobj
ClientScript.RegisterStartupScript(this.GetType(), "showobj", "showobj('divprobatch');setaddbatchs(" + count + ");", true);
string proname = "";
string proId = "";
string txtProCount = "";
string txtProBatch = "";
string txtProBoxNum = "";
string txtMarkDate = "";
string txtExPirationDate = "";
string PurchaseProID = ""; for (int i = 0; i < dt.Rows.Count; i++)
{
proname += dt.Rows[i]["proName"].ToString() + ",";
proId += dt.Rows[i]["proID"].ToString() + ",";
txtProCount += dt.Rows[i]["proCount"].ToString() + ",";
txtProBatch += dt.Rows[i]["batchNum"].ToString() + ",";
txtProBoxNum += dt.Rows[i]["boxNum"].ToString() + ",";
txtMarkDate += Convert.ToDateTime(dt.Rows[i]["makeDate"].ToString()).ToString("yyyy-MM-dd") + ",";
txtExPirationDate += Convert.ToDateTime(dt.Rows[i]["expirationDate"].ToString()).ToString("yyyy-MM-dd") + ",";
PurchaseProID += dt.Rows[i]["purchaseProID"].ToString() + ","; } ClientScript.RegisterStartupScript(this.GetType(), "setbatchsvalues", "setbatchsvalues('" + proname + "','" + proId + "','" +
txtProCount + "','" + txtProBatch + "','" + txtProBoxNum + "','" + txtMarkDate + "','" + txtExPirationDate + "','" + PurchaseProID + "');", true);
#endregion //判断是否存在此产品的批号信息
if (dt.Rows.Count>0)
{
//当前登录用户是否有产品质量审核权限 值50
if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",50,"))
{ ClientScript.RegisterStartupScript(this.GetType(), "test", "showobj('proAuditing');", true);
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0)
{
this.cb_Auditing.Checked = true;
}
}
else
{
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "showobj('proAuditing');", true);
this.cb_Auditing.Checked = true;
this.cb_Auditing.Enabled = false;
} } //如果产品批号已经审核 并且 当前登录用户是仓库管理员 则显示相应控件
if (pbll.getauditingProBatchCountByPurchaseID(id) != 0 && SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",25,"))
{
ClientScript.RegisterStartupScript(this.GetType(), "test1", "showobj('stockAuditing');", true);
} }
}
}
protected void getdata()
{
////如果获取阐述不存在直接跳转。
if (Request.QueryString["taskid"] == null || Request.QueryString["listid"] == null)
{
Response.Write("<script>window.history.go(-1);this.close()</script>");
}
string taskid = Request.QueryString["taskid"].ToString();
string listid = Request.QueryString["listid"].ToString();
//string taskid = "10";
//string listid = "50"; string rights= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()); BioPurchaseBLL purchasebll=new BioPurchaseBLL();
ViewBioPurchaseAppInfo viewpurchase = purchasebll.getViewBioPurchaseAppInfo(taskid);
ddlDepartMent.Text=viewpurchase.DepartMent.ToString();
this.hf_applayDepartMent.Value = viewpurchase.DepartMentID.ToString();
this.lbApplayUser.Text = viewpurchase.AppUserName.ToString();
this.lbOldRealName.Text = viewpurchase.RealUserName;
this.txtRealUserID.Text = viewpurchase.RealUserID.ToString();
this.lbTime.Text = Convert.ToDateTime(viewpurchase.OrderTime).ToString("yyyy-MM-dd");
this.lbOldSenComName.Text = viewpurchase.CopanyName;
this.txtSendCom.Text = viewpurchase.sendComID.ToString();
this.ddlOrderCom.Text = viewpurchase.OrderCom.ToString();
this.ddlSaleType.Text = viewpurchase.WholeType;
this.ddlTypes.Text = viewpurchase.sendType; //判断是否数据库中已经添加了财务审核的记录
if (viewpurchase.BillNo != "" && viewpurchase.BillNo != null)
{
this.lbBill.Visible = true;
this.lbisPay.Visible = true;
this.isPay.Visible = true;
this.txtBillNo.Visible = true;
this.lbPayuser.Visible = true;
this.txtBillUser.Visible = true;
this.txtBillUser.Text = viewpurchase.BillUserID.ToString();
this.txtBillNo.Text = viewpurchase.BillNo.ToString();
this.lbBillUserName.Text = viewpurchase.BillUserName.ToString();
int paycount = int.Parse(SqlComm.GetObjectByCondition("dbo.BioPurchasePro", "count(isPay)", " PurchaseID="+taskid).ToString());
if (paycount > 0)
{
this.isPay.Checked = true;
} }
else
{
if (rights.Contains(",48,"))
{
this.lbBill.Visible = true;
this.lbisPay.Visible = true;
this.isPay.Visible = true;
this.txtBillNo.Visible = true;
this.lbPayuser.Visible = true;
this.txtBillUser.Visible = true;
this.txtBillUser.Text = Session["Userid"].ToString();
this.txtBillNo.Text = DateTime.Now.ToString("yyyyMMdd") + taskid; }
}
//根据表单单号在流程表中查询历史审批记录绑定信息
this.lbRemarks.Text= SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProPurchase).ToString());
if (SqlComm.getAuditingSateByCondition("listid") == "2")
{
this.cb_Stock.Checked = true;
} this.hf_subject.Value = SqlComm.getTaskListSubjectByCondition(listid);
this.hf_FirstTransmitter.Value = SqlComm.getFirstTransmitterByCondition(listid);
this.hf_FirstAccepter.Value = SqlComm.getFirstAccpterByCondition(listid); //根据表单编号查询产品基本信息并绑定
DataTable dt = SqlComm.GetDataByCondition("View_BioPurchaseProInfo", "ProID,ProName,ProCount,ProPrice,
InvoicePrice,purchaseProID", "PurchaseID=" + taskid).Tables[0];
int count = dt.Rows.Count;
ClientScript.RegisterStartupScript(this.GetType(), "addrows", "addrows(" + (count-1) + ");", true); string proNames = "";
string proIDs = "";
strin g proCounts = "";
string proPrices = "";
decimal totalInvoicePrice = 0;
string purchaseProIDs = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
proIDs+= dt.Rows[i]["ProID"].ToString()+",";
proNames+=dt.Rows[i]["ProName"].ToString()+",";
proCounts+= dt.Rows[i]["ProCount"].ToString()+",";
proPrices+= decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.0")+",";
totalInvoicePrice += decimal.Parse(dt.Rows[i]["InvoicePrice"].ToString());
purchaseProIDs += dt.Rows[i]["purchaseProID"].ToString() + ",";
}
ClientScript.RegisterStartupScript(this.GetType(), "setValues", "setValues('" + proNames + "','" + proIDs +
"','" + proCounts + "','" + proPrices + "','" + purchaseProIDs + "');", true);
this.lbTotalInvoicePrice.Text = totalInvoicePrice.ToString("0.0");
} protected void Button1_Click(object sender, EventArgs e)
{
TaskListRecord record = new TaskListRecord();
record.Accepter = int.Parse(this.hf_FirstTransmitter.Value);
record.AuditingSate = 3;
record.DepartMentId = int.Parse(this.hf_applayDepartMent.Value);
record.FirstAccepter = int.Parse(this.hf_FirstAccepter.Value);
record.FirstSumitTime = Convert.ToDateTime(this.lbTime.Text);
record.FirstTransmitter = int.Parse(this.hf_FirstTransmitter.Value);
record.Mind = this.txtRemark.Text;
record.Pass = 1;
record.Subject = hf_subject.Value;
record.SumitTime = DateTime.Now;
record.TaskID = int.Parse(Request.QueryString["taskid"].ToString());
record.TaskTableID = (int)TaskNavigateEmun.ProPurchase;
record.Transmitter = int.Parse(Session["Userid"].ToString()); if (SqlComm.TaskListRecordAdd(record) != 0)
{
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + Request.QueryString["listid"].ToString()); }
}
}

产品购进系统购进单列表查询视图:

根据产品购进单查询产品对应总额:

CREATE FUNCTION [dbo].[getPurchaseTotalMonenyByPurchaseID]
(
@PurchaseID INT
)
RETURNS MONEY
AS
BEGIN
DECLARE @totalMoney MONEY
SELECT @totalMoney=SUM(ProPrice*ProCount) FROM dbo.BioPurchasePro
WHERE PurchaseID=@PurchaseID
RETURN @totalMoney
END

购进单列表需要显示的信息:
主题,表单状态,订货公司,发货公司,订货申请人,订货部门,订货时间,订货总金额,入库时间,下次接收人(当前接收人)

需要的视图:

CREATE VIEW [dbo].[View_PurchaseAppInfoShowList]
AS SELECT
PurchaseID,
Subject,
DepartMentID,
DepartMentName=dbo.FN_GetDepartMentByID(DepartMentID),
AppUserId,
AppUserName=dbo.getUserNameByUserID(AppUserId),
RealUserID,
RealUserName=dbo.getUserNameByUserID(RealUserID),
OrderCom,
SendComID,
SendComName=dbo.getCustomerByID(SendComID),
ArrivedTime,
OrderTime,
sendType,
WholeType,
AcceptUserid,
PurchaseTotal=dbo.getPurchaseTotalMonenyByPurchaseID(PurchaseID),
BillUserID,
DeleteSate,
Transmitter=ISNULL(dbo.FN_CurrentTransmitter(2,PurchaseID),'数据错误'),
Listid= ISNULL(dbo.FN_GetDynamicId(2,PurchaseID),0),
AuditingSate=ISNULL(dbo.FN_CurrentAuditingSate(2,PurchaseID),0)
FROM
dbo.BioPurchaseAppInfo

产品采购审核列表查询页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProPurchaseListShow.aspx.cs" 
Inherits="BioErpWeb.WholeSaleSystem.ProPurchase.ProPurchaseListShow" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <%@ Register src="../../UserControl/CRMChannelMenuBar.ascx" tagname="CRMChannelMenuBar" tagprefix="uc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/AspNetPagerStyle.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<link href="../../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<link href="../../Styles/TopMenu2.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/InputStyle1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$().ready(function () {
$("#txtNoteTime").datepicker({ dateFormat: 'yy-mm-dd' });
});
</script> </head>
<body>
<form id="form1" runat="server"> <div> </div>
<div>
<table class="maintable" style=" width:900px;">
<tr>
<td colspan="5" class="titlebar">
<span>产品采购审核列表查询</span>
</td>
</tr>
<tr>
<td class="tdsearch">
<asp:Label ID="Label1" runat="server" Text="主题:"></asp:Label>
<asp:TextBox ID="txtName" runat="server" Width="100px"></asp:TextBox>
</td>
<td class="tdsearch">
<asp:Label ID="Label2" runat="server" Text="购进申请人:"></asp:Label>
<asp:TextBox ID="txtUserName" runat="server" Width="100px"></asp:TextBox>
</td>
<td class="tdsearch">
<asp:Label ID="Label11" runat="server" Text="提交时间"></asp:Label>
<asp:TextBox ID="txtOrderTime" runat="server" Width="100px"></asp:TextBox>
</td>
<td class="tdsearch">
<asp:Label ID="Label3" runat="server" Text="是否删除"></asp:Label>
<asp:DropDownList ID="ddlState" runat="server">
<asp:ListItem Value="0">否</asp:ListItem>
<asp:ListItem Value="1">是</asp:ListItem>
</asp:DropDownList>
</td> <td class="tdsearch">
<asp:ImageButton ID="imgbutnSearch" Width="60" Height="22" runat="server"
ImageUrl="~/Web/images/Btnsearch.gif" onclick="imgbutnSearch_Click" /> 
</td>
</tr>
<tr>
<td colspan="6" class="bottomtd">
<asp:GridView ID="GridView1" Width="100%" runat="server" AutoGenerateColumns="False" DataKeyNames="PurchaseID">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="PurchaseID,Listid" DataNavigateUrlFormatString="ToOtherAspx.aspx?id={0}&listid={1}"
DataTextField="Subject" Target="MainFrame" HeaderText="主题">
<ItemStyle Width="150px" HorizontalAlign="Center" />
<HeaderStyle Width="150px" HorizontalAlign="Center"/>
</asp:HyperLinkField> <asp:BoundField DataField="AuditingSate" HeaderText="状态" HeaderStyle-HorizontalAlign="Center"/> <asp:TemplateField HeaderText="订货公司" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("OrderCom") %>'></asp:Label>
</ItemTemplate> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="发货公司" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("SendComName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> <asp:TemplateField HeaderText="订货申请人" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#Eval("AppUserName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> <asp:TemplateField HeaderText="订货部门" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Eval("DepartMentName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="订货时间" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lbortime" runat="server" Text='<%# Convert.ToDateTime(Eval("OrderTime")).ToString("yyyy-MM-dd") %>'>
</asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="订货总额" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lbtotal" runat="server" Text='<%# Eval("PurchaseTotal") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="下次接收人" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%#Eval("Transmitter").ToString()%>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> <asp:TemplateField HeaderText="" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<a href="ProPurchaseShow.aspx?taskid=<%#Eval("PurchaseID") %>&listid=<%#Eval("Listid")%>">查看详细</a>
</ItemTemplate> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> </Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="5">
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" CssClass="paginator" CurrentPageButtonClass="cpb"
onpagechanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
</td>
</tr>
<tr><td colspan="5">
<asp:Button ID="Button1" runat="server" Text="导出全部" CssClass="btngreen"
onclick="Button1_Click"/></td></tr> </table> </div>
</form>
</body>
</html>

后台代码:

public partial class ProPurchaseListShow: BasePage
{ public static int pageindex = 0;
public static int pagesize = 10;
public static string condition = ""; protected void Page_Load(object sender, EventArgs e)
{
//Session["Userid"] = "29";
if (Session["Userid"] == null)
{
Response.Redirect("../../web/UserLogin.aspx");
} if (!IsPostBack)
{ getallBioCRMContractList();
}
} /// <summary>
/// 查询所有员工信息
/// </summary>
private void getallBioCRMContractList()
{
//如果有商品采购系统权限(特许权限)的人员可以查看所有表单
if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",47,"))
{
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.View_PurchaseAppInfoShowList", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.View_PurchaseAppInfoShowList", "*",
"PurchaseID", condition, pageindex, pagesize);
this.GridView1.DataBind();
}
else if (Web.UserLogin.user.RoleId == ((int)RoseEmun.DepartMentManager))
{
condition = condition + " and DepartMentID=" + Web.UserLogin.user.DepartmentId;
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.View_PurchaseAppInfoShowList", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.View_PurchaseAppInfoShowList", "*",
"PurchaseID", condition, pageindex, pagesize);
this.GridView1.DataBind();
}
else //员工只能看自己的购进单
{
condition = condition + " and AppUserId=" + Session["Userid"].ToString();
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("dbo.View_PurchaseAppInfoShowList", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("dbo.View_PurchaseAppInfoShowList", "*",
"PurchaseID", condition, pageindex, pagesize);
this.GridView1.DataBind();
} for (int i = 0; i < GridView1.Rows.Count; i++)
{
switch (GridView1.Rows[i].Cells[1].Text)
{
case "0":
GridView1.Rows[i].Cells[1].Text = "待审核";
GridView1.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Green;
break;
case "2":
GridView1.Rows[i].Cells[1].Text = "执行中";
GridView1.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Orange;
break;
case "3":
GridView1.Rows[i].Cells[1].Text = "已完成";
GridView1.Rows[i].Cells[1].ForeColor = System.Drawing.Color.Green;
break;
default:
GridView1.Rows[i].Cells[1].Text = "出现错误";
break;
} }
} protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pageindex = this.AspNetPager1.CurrentPageIndex - 1;
getallBioCRMContractList();
} protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e)
{
pageindex = 0;
condition = "";
if (txtName.Text.Trim() != null && this.txtName.Text.Trim().Length != 0)
{
condition = condition + " and Subject like '" + txtName.Text + "%'";
} if (this.txtUserName.Text.Trim() != null && this.txtUserName.Text.Trim().Length != 0)
{
condition = condition + " and AppUserName like '" + txtUserName.Text + "%'";
} if (this.ddlState.SelectedValue == "1")
{
condition = condition + " and DeleteSate ='True'";
}
else
{
condition = condition + " and DeleteSate ='False'";
} if (this.txtOrderTime.Text.Trim() != null && this.txtOrderTime.Text.Trim().Length != 0)
{
condition = condition + " and (OrderTime>= '" + Convert.ToDateTime(this.txtOrderTime.Text) +
"' and OrderTime<'" + Convert.ToDateTime(this.txtOrderTime.Text).AddDays(1) + "')";
} getallBioCRMContractList(); } protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("ToExcel.aspx?name='产品购进单信息'");
}
}

导出的公用方法:

   /// <summary>
/// 根据指定文件名称和文件类型导出数据
/// </summary>
/// <param name="FileName">文件名</param>
/// <param name="FileType">文件类型(Execl:application/vnd.ms-excel Word:application/msword)</param>
public static void ExportFile(System.Web.UI.Page p, string FileName, string FileType)
{
p.Response.Clear();
p.Response.ContentEncoding = System.Text.Encoding.Default;
p.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
p.Response.ContentType = FileType;
}
}

导出的前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ToExcel.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.ProPurchase.ToExcel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
td{ text-align:center;}
body{ background-color:transparent;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div> <asp:GridView ID="GridView1" Width="100%" runat="server" AutoGenerateColumns="False" DataKeyNames="PurchaseID">
<Columns>
<asp:TemplateField HeaderText="序号">
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Subject" HeaderText="主题" HeaderStyle-HorizontalAlign="Center"/> <asp:TemplateField HeaderText="订货公司" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("OrderCom") %>'></asp:Label>
</ItemTemplate> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="发货公司" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("SendComName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> <asp:TemplateField HeaderText="订货申请人" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#Eval("AppUserName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> <asp:TemplateField HeaderText="订货部门" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Eval("DepartMentName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="订货时间" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lbortime" runat="server" Text='<%# Convert.ToDateTime(Eval("OrderTime")).ToString("yyyy-MM-dd") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="订货总额" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lbtotal" runat="server" Text='<%# Eval("PurchaseTotal") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField> </Columns>
</asp:GridView> </div>
</form>
</body>
</html>

后台代码:

  public partial class ToExcel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string filename = "";
if (Request.QueryString["name"] != null)
{
filename = DateTime.Now.ToString("yyyyMMdd")+Request.QueryString["name"].ToString()+".xls";
}
else
{
filename = DateTime.Now.ToString("yyyyMMdd.xls");
} Comm.ExportFile(this, filename, "application/ms-excel");
gridviewbind(); } /// <summary>
/// 绑定gridview
/// </summary>
protected void gridviewbind()
{
this.GridView1.DataSource = SqlComm.GetDataByCondition("dbo.View_PurchaseAppInfoShowList", "*",null);
this.GridView1.DataBind();
}
}

  

ERP采购申请管理(三十九)的更多相关文章

  1. bp(net core)+easyui+efcore实现仓储管理系统——入库管理之三存储过程(三十九)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  2. NeHe OpenGL教程 第三十九课:物理模拟

    转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...

  3. Java进阶(三十九)Java集合类的排序,查找,替换操作

    Java进阶(三十九)Java集合类的排序,查找,替换操作 前言 在Java方向校招过程中,经常会遇到将输入转换为数组的情况,而我们通常使用ArrayList来表示动态数组.获取到ArrayList对 ...

  4. Gradle 1.12用户指南翻译——第三十九章. IDEA 插件

    本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...

  5. SQL注入之Sqli-labs系列第三十八关、第三十九关,第四十关(堆叠注入)

    0x1 堆叠注入讲解 (1)前言 国内有的称为堆查询注入,也有称之为堆叠注入.个人认为称之为堆叠注入更为准确.堆叠注入为攻击者提供了很多的攻击手段,通过添加一个新 的查询或者终止查询,可以达到修改数据 ...

  6. 第三百三十九节,Python分布式爬虫打造搜索引擎Scrapy精讲—Scrapy启动文件的配置—xpath表达式

    第三百三十九节,Python分布式爬虫打造搜索引擎Scrapy精讲—Scrapy启动文件的配置—xpath表达式 我们自定义一个main.py来作为启动文件 main.py #!/usr/bin/en ...

  7. centos shell编程5 LANMP一键安装脚本 lamp sed lnmp 变量和字符串比较不能用-eq cat > /usr/local/apache2/htdocs/index.php <<EOF重定向 shell的变量和函数命名不能有横杠 平台可以用arch命令,获取是i686还是x86_64 curl 下载 第三十九节课

    centos shell编程5  LANMP一键安装脚本 lamp  sed  lnmp  变量和字符串比较不能用-eq  cat > /usr/local/apache2/htdocs/ind ...

  8. “全栈2019”Java第三十九章:构造函数、构造方法、构造器

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  9. WPF,Silverlight与XAML读书笔记第三十九 - 可视化效果之3D图形

    原文:WPF,Silverlight与XAML读书笔记第三十九 - 可视化效果之3D图形 说明:本系列基本上是<WPF揭秘>的读书笔记.在结构安排与文章内容上参照<WPF揭秘> ...

随机推荐

  1. js中闭包的概念和用法

    闭包:主要的作用是 封装变量,收敛权限.防止变量被污染.比如Jquery框架就运用了大量的闭包.为什么呢? 问个问题?框架是如何来避免你声明的变量和它自带的变量不发生的冲突的?????很明显,需要闭包 ...

  2. js的this到底是什么意思

    首先确定一点,this在声明时确定不了,在执行时才知道指向的谁!!! call() , apply(),bind()  方法的用法 比如下面一个例子: function fn(name,age){ a ...

  3. gitlab与pycharm结合

    一切都在图中 点开pycharm里的菜单选项 设置git代码仓库的地址 修改了代码之后,如何推送到git服务器上 通过pycharm下载代码仓库 pycharm中如何设置分支 pycharm新建了分支 ...

  4. JavaScript之创建动态脚本

    //option= {type,src,text,isCreateScriptBySrc} function createDynamicScript(option){ var script = doc ...

  5. JavaScript之关闭轮询定时器(setTimeout/clearTimeout|setInterval/clearInterval)小结

    已知: 1.1 开启Timeout程序: scope.setTimeout("functionName()" | functionHandle, timeValue) 返回值:ti ...

  6. POJ3436 ACM Computer Factory【EK算法】

    题意: 每个电脑需要P个组成部分,现有N的机器,每个机器都可以对电脑进行加工,不过加工的前提是某些部分已经存在,加工后会增加某些部分.且在单位时间内,每个机器的加工都有一个最大加工容量,求能得到的最大 ...

  7. 初识java和C的不同

     学习java语言,发现C语言的语法尽管很类似,但是java的代码编写与C语言却大不相同. 一,java的类,首先接触到的是类这个思想,类中可以定义属性,可以用方法来对属性进行相应的操作: 二,jav ...

  8. prim算法,克鲁斯卡尔算法---最小生成树

    最小生成树的一个作用,就是求最小花费.要在n个城市之间铺设光缆,主要目标是要使这 n 个城市的任意两个之间都可以通信,但铺设光缆的费用很高,且各个城市之间铺设光缆的费用不同,因此另一个目标是要使铺设光 ...

  9. JS获取今天和上个月的今天

    function getLastMonth(){ var now=new Date(); var year = now.getFullYear();//getYear()+1900=getFullYe ...

  10. CentOS 6.8 部署django项目二

    CentOS 6.8 部署django项目一 1.项目部署后发现部分页面的样式丢失,是因为在nginx中配置的static路径中未包含. 解决:在settinfs.py中添加: STATIC_ROOT ...