产品添加批号后相应修改产品库存表中对应批次产品的数量:
 /// <summary>
/// 产品添加批号后相应修改产品库存表中对应批次产品的数量
/// </summary>
/// <param name="stockproid">库存表主键编号</param>
/// <param name="procount">发货的数量</param>
/// <returns>int</returns>
public static int BioProStockUpdateCount(int stockproid, int procount)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@ID",stockproid),
new SqlParameter("@ProCout",procount)
}; return DataBaseHelper.ExcuteSqlReturnInt("BioProStockUpdateCount", CommandType.StoredProcedure, pars); }

视图实现按发货单查询产品批次信息,将查询结果进行数据绑定:

CREATE VIEW [dbo].[ViewSendProBaths]
AS
SELECT a.ProBatchID, a.SendProID, a.batchNum,a.boxNum,a.proCount,a.ProStockID,CONVERT(NVARCHAR(10),a.stockDate,121)
AS stockDate,a.stockID,CONVERT(NVARCHAR(10),a.expirationDate,121) AS expirationDate,
CONVERT(NVARCHAR(10),a.makeDate,121)AS makeDate,a.isprinted ,b.SendID,b.ProID,b.ProCount AS procounttotal
FROM dbo.BioSendProBatch AS a INNER JOIN dbo.BioSendGoodsPro
AS b ON b.SendProID = a.SendProID

当前产品批次的数量和库存表中的数量进行比较:(Ajax代码)

     //判断产品数量是否满足需求
function isProBathCountFull(obj) {
//库存表编号(主键)
var prostockid = $($(obj).parent().parent().find("input[name='stockproid']")[0]).val();
var procount=$(obj).val();
if (prostockid != '' && prostockid !=undefined) {
if (procount != '' && procount !=undefined && procount != '0') {
$.ajax({
type: "POST", //设置提交方式
url: "getProBatchCount.aspx",
data: "prostockid=" + prostockid + "&procount=" + procount, //提交数据
success: function (msg) {
if (msg == "OK") {
} else {
alert(msg);
$(obj).attr("value", "");
}
}
});
}
} else {
alert("请先选择产品");
$(obj).attr("value", ""); }
}

后台代码:

protected void Page_Load(object sender, EventArgs e)
{
string returnResult = "";//定义返回状态
this.Response.Clear();
string prostockid = Request.Form["prostockid"].ToString();
string procount = Request.Form["procount"].ToString();
returnResult = prostockid + " " + procount; object obj = SqlComm.GetObjectByCondition("dbo.BioProStock", "isnull(ProCout,0)", " ID=" + prostockid);
if (obj != null)
{
if (int.Parse(obj.ToString()) < int.Parse(procount))
{
returnResult = "此产品此批次库存不足,最多发货数据" + obj.ToString();
}
else
{
returnResult = "OK";
} }
this.Response.Write(returnResult); this.Response.End();
}

修改的前台代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsEdit.aspx.cs"  Transaction="Required"   Inherits="BioErpWeb.SendGoods.SendGoodsEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  charset="UTF-8"  "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>
<link href="../Styles/SharpRound.css" rel="stylesheet" type="text/css" />
<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> <script src="../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<link href="../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" /> <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> <script type="text/javascript">
$(document).ready(function () {
$("#form1").validate(); var loginuserid=<%=Session["Userid"]%>;
//判断当前登录用户是否是表单制表人本人
if(loginuserid!=$("#hf_applayUserid").val())
{
$(document).find("input[type='text']").each(function(){
if($(this).attr("id")!="txtRemark")
{
$(this).attr("readonly","true");
}
}); $(document).find(".btnchoose").each(function(){
$(this).hide();
}); $(document).find("span[name='lbShow']").each(function(){
$(this).append("暂无操作");
}); } //下次审核人员需要设置可用
$("#btnUser0").show(); //是否具备财务审核权限
var isisfinance= <%=isfinance %>;
if(isisfinance==true)
{
$("#trfinance").show();
}
//是否具备质量审核权限
var isisquality= <%=isquality %>;
if(isisquality==true)
{
$("#spanquality").show();
}
//是否具备仓库审核条件
var isstock1=<%=isstock %>
if(isstock1==true)
{
$("#spanstock").show();
}else
{
$("#spanstock").hide();
} //是否具备产品批号添加权限
var isprobatch= <%=isprobatch %>;
//判断当前用户是否具备产品批号添加权限,并且财务已经审核,并且产品质量已经审核
//显示相应操作按钮
if(isprobatch==true&&$("#cbisfinance").attr("checked")==true&&$("#cbquality").attr("checked")==true)
{
//显示添加批号的按钮
$(document).find("input[name='btnaddbatch']").each(function(){
$(this).show();
}) //隐藏添加行的按钮
$(document).find("input[name='btnaddrow']").each(function(){
$(this).hide();
});
//隐藏删除当前行的按按钮
$(document).find("input[name='btndeleterow']").each(function(){
$(this).hide();
}); }else
{ //隐藏添加批号的按钮
$(document).find("input[name='btnaddbatch']").each(function(){
$(this).hide();
})
//显示添加行的按钮
$(document).find("input[name='btnaddrow']").each(function(){
$(this).show();
});
//显示删除当前行的按按钮
$(document).find("input[name='btndeleterow']").each(function(){
$(this).show();
});
} //如果已经添加产品批号,则此表单不能在进行添加产品数据,删除原来数据
var count=<%=probaths %> if(count>0)
{ //显示添加行的按钮
$(document).find("input[name='btnaddrow']").each(function(){ $(this).hide();
});
//显示删除当前行的按按钮
$(document).find("input[name='btndeleterow']").each(function(){
$(this).hide();
});
} //如果库存审核已经通过,则所有选择按钮不可用
if($("#cbISstock").attr("checked")==true)
{
$(".btnchoose").each(function(){
$(this).hide();
});
$("#trpostinfo").show(); $(document).find("input[type='text']").each(function(){
$(this).attr("readonly","true");
});
$(document).find("span[name='lbShow']").each(function(){
$(this).append("暂无操作");
}); } }); function addrow() {
var tr = '<tr><td><input type="text" name="proName" class="required" style=" width:200px"/><input type="hidden" name="proID" /><input value="选择" type="button" onclick="showProName()" class="btnchoose"/></td><td><input type="text" name="proCount" class="{required:true,min:1,digits:true}" style=" width:100px"/></td><td><input onkeyup="setvalue(this)" onchange="setvalue(this)" type="text" name="proPrice" class="{required:true,min:0.1,number:true}" style=" width:100px"/></td><td><input type="text" name="invoiceProPice" class="{required:true,min:0.1,number:true}" style=" width:100px"/></td><td style="width:150px;"><input type="button" value="添加行" onclick="addrow()" class="btnchoose"/> <input type="button" value="删除行" onclick="deleterow()" class="btnchoose"/></td></tr>';
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).after(tr);
} function deleterow() {
if ($("input[name='proname']").length > 1) {
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove();
}else{
alert("至少要有一行数据");
} } function deleterow1() {
if ($("input[name='proname0']").length > 1) {
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove();
}else{
alert("至少要有一行数据");
} } function setbatch() {
var procount = 0;
var boxnum = 1; var isprocount=false;
$("#trprobatch").show();
var obj = window.event.srcElement;
var tr = obj.parentNode.parentNode;
var inputs = tr.getElementsByTagName("input");
$("#divprobatch").find("input[name='proIds']").each(function () {
if (inputs[1].value == $(this).val()) {
boxnum++;
procount += parseInt($(this).parent().parent().find("input[name='txtProCount0']").val());
if (procount > parseInt(inputs[3].value)) { isprocount=true;
if(isprocount)
{
$(this).parent().parent().find("input[name='txtProCount0']").attr("value", "0");
alert("产品总数已经达到,不能为此产品添加批号");
}
// event.stopPropagation(); }
}
}) if(!isprocount)
{
//2011年11月29日22:28:00
//新添加一个控件<input type="hidden" name="PurchaseProID2"/>
//去掉所有复合验证中的";"号
var trbatch = '<tr> <td id="td2"><input id="txtProName0" name="proname0" value="' + inputs[0].value + '" readonly="readonly" name="txtProName0" style="width: 200px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value="' + inputs[1].value + '"/> </td>';
trbatch += '<td><input id="txtProCount0" name="txtProCount0" onkeyup="isProBathCountFull(this)" class="{required:true,min:1,digits:true}" type="text" size="5" /><input type="hidden" name="oldprobatchcount" value="0"/></td><td><input id="txtProBatch0" readonly="readonly" name="txtProBatch0" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtProBoxNum0" name="txtProBoxNum0" value="' + boxnum + '" readonly="readonly" type="text" size="11" /> </td>';
trbatch += '<td><input id="txtMarkDate0" name="txtMarkDate0" size="11" class="{required:true,dateISO:true}" type="text" readonly="readonly" /></td>';
trbatch += '<td><input id="txtExPirationDate0" name="txtExPirationDate0" class="{required:true,dateISO:true}" size="11" type="text" readonly="readonly" />'; trbatch += '</td> <td><input id="txtStockDate0" name="txtStockDate0" class="{required:true,dateISO:true}" size="11" type="text" readonly="readonly" /></td><td><input type="hidden" value="'+inputs[6].value+'" name="SendProID2"/><input type="button" class="btnchoose2" value="选择" onclick="showProstock(this)" /><span> </span> <input type="button" class="btnchoose2" value="删除" onclick="deleterow1()"/><input id="Hidden2" name="stockproid" type="hidden" /><input id="Hidden2" name="stockid" type="hidden" /><input name="ProBatchID" value="0" type="hidden" />';
trbatch += '</td></tr>'; $("#probatchtr").after(trbatch);
} $(document).find("input[name='txtMarkDate0']").each(function(){
$(this).datepicker({dateFormat:'yy-mm-dd'});
});
$(document).find("input[name='txtExPirationDate0']").each(function(){
$(this).datepicker({dateFormat:'yy-mm-dd'});
});
} function showProstock(obj)
{
var proid= $($($($(obj).parent()).parent()).find("input[name='proIds']")[0]).val();
var url='SendGoodsSelectProStock.aspx?proID='+proid;
var winFeatures="dialogHeight:500px;dialogwidth:800px;depended=no;scroll:auto;center:yes;";
var re= window.showModalDialog(url,null, winFeatures); if(re!=undefined)
{
var stockproid=$($($(obj).parent()).parent()).find("input[name='stockproid']");
stockproid[0].value=re[0];
var txtProBatch0=$($($(obj).parent()).parent()).find("input[name='txtProBatch0']");
txtProBatch0[0].value=re[1];
var txtProCount=$($($(obj).parent()).parent()).find("input[name='txtProCount0']");
txtProCount[0].value=re[2];
var txtExPirationDate=$($($(obj).parent()).parent()).find("input[name='txtExPirationDate0']");
txtExPirationDate[0].value=re[3];
var txtStockDate=$($($(obj).parent()).parent()).find("input[name='txtStockDate0']");
txtStockDate[0].value=re[4];
var txtMarkDate=$($($(obj).parent()).parent()).find("input[name='txtMarkDate0']");
txtMarkDate[0].value=re[5];
var stockid=$($($(obj).parent()).parent()).find("input[name='stockid']");
stockid[0].value=re[6];
}
} //判断产品数量是否满足需求
function isProBathCountFull(obj) {
//库存表编号(主键)
var prostockid = $($(obj).parent().parent().find("input[name='stockproid']")[0]).val();
var procount=$(obj).val();
if (prostockid != '' && prostockid !=undefined) {
if (procount != '' && procount !=undefined && procount != '0') {
$.ajax({
type: "POST", //设置提交方式
url: "getProBatchCount.aspx",
data: "prostockid=" + prostockid + "&procount=" + procount, //提交数据
success: function (msg) {
if (msg == "OK") {
} else {
alert(msg);
$(obj).attr("value", "");
}
}
});
}
} else {
alert("请先选择产品");
$(obj).attr("value", ""); }
}
</script> <style type="text/css">
.trbar{ background-color:#eeeeee;}
.w80{ width:80px;}
.w100{ width:100px;}
.w150{ width:150px;}
.style1
{
width: 150px;
}
.style2
{
width: 85px;
}
.style3
{
width: 128px;
}
.style15
{
width: 235px;
}
.style20
{
width: 157px;
}
.style24
{
width: 304px;
}
.style29
{
width: 90px;
} #trpostinfo{}
#trpostinfo span{ margin:0px 20px;} </style> </head>
<body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> <div> <table class="maintable Inupttable" style=" width:900px;">
<tr>
<td colspan="8" class="titlebar">商品销售发货审核</td>
</tr>
<tr>
<td class="w80">申请部门</td>
<td class="style1">
<asp:DropDownList ID="ddlDepartMent" runat="server">
</asp:DropDownList>
</td>
<td class="style2" colspan="2">
制表人
<asp:Label ID="lbApplayUser" runat="server" ></asp:Label>
</td>
<td>经手人</td><td class="style15">
<asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}"
runat="server" Width="78px"></asp:TextBox>
<input id="btnUser" type="button" value="选择" class="btnchoose" onclick="showDialog3()" /><asp:Label
ID="lbRealUserName" runat="server" Text=""></asp:Label></td>
<td>制表时间</td><td>
<asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate> <table class="maintable Inupttable" style=" width:900px;">
<tr>
<td class="w80">订货客户</td>
<td class="w150">
<asp:TextBox ID="txtSendCom" runat="server" Width="59px"
CssClass="{required:true,digits:true, min:1}"
ontextchanged="txtSendCom_TextChanged"></asp:TextBox><asp:Button ID="Button1" Text="选择" runat="server" UseSubmitBehavior="false" class="btnchoose"
OnClientClick="showCustomerDialog3()"/>
<asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label>
</td><td class="style20">
发货单位</td>
<td class="style24">
<asp:DropDownList ID="ddlOuserCom" runat="server">
<asp:ListItem>上海某某公司</asp:ListItem>
<asp:ListItem>成都某某公司</asp:ListItem>
<asp:ListItem>北京某某公司</asp:ListItem>
<asp:ListItem>雅安某某公司</asp:ListItem>
</asp:DropDownList>
</td> <td class="style29">发货类型</td><td>
<asp:DropDownList ID="ddlTypes" runat="server">
<asp:ListItem>调拨</asp:ListItem>
<asp:ListItem>医院</asp:ListItem>
<asp:ListItem>OTC</asp:ListItem>
<asp:ListItem>其它</asp:ListItem>
</asp:DropDownList>
</td>
</tr> <tr>
<td>客户联系人</td>
<td>
<asp:DropDownList ID="ddlLinkMan" runat="server" AutoPostBack="True" Width="80px"
onselectedindexchanged="ddlLinkMan_SelectedIndexChanged">
<asp:ListItem Value="0">--请选择--</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtLinkman" Width="60px" runat="server"></asp:TextBox>
</td><td class="style20">
手机号码</td>
<td class="style24">
<asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
</td> <td class="style29">工作电话</td><td>
<asp:TextBox ID="txtTelphone" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table class="maintable Inupttable" style="width: 900px;">
<tr class="trbar">
<td>
产品名称及规格
</td>
<td>
数量
</td>
<td>
单价
</td>
<td class="style3">
开票价格
</td>
<td style="width:150px;">
操作
</td>
</tr>
<%
if (!IsPostBack)
{
int count = this.dt.Rows.Count;
if (count == 0)
{
return;
}
decimal totalprice = 0;
decimal totalinvoiceprice = 0;
for (int i = 0; i < count; i++)
{
totalprice += (decimal.Parse(dt.Rows[i]["ProPrice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));
totalinvoiceprice += (decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));
%>
<tr>
<td>
<input type="text" name="proName" class="required" value="<%=dt.Rows[i]["ProName"] %>" style="width: 200px" /><input
type="hidden" name="proID" value="<%=dt.Rows[i]["ProID"] %>" /><input value="选择" type="button" onclick="showProName()"
class="btnchoose" />
</td>
<td>
<input type="text" name="proCount" value="<%=dt.Rows[i]["ProCount"] %>" class="{required:true,min:1,digits:true}" style="width: 100px" />
</td>
<td>
<input type="text" name="proPrice" onkeyup="setvalue(this)" value="<%=decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.00") %>" onchange="setvalue(this)"
class="{required:true,min:0.1,number:true}" style="width: 100px" />
</td>
<td>
<input type="text" name="invoiceProPice" value="<%=decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()).ToString("0.00") %>" class="{required:true,min:0.1,number:true}"
style="width: 100px" />
</td>
<td style="width:150px;">
<input type="hidden" name="SendproID" value="<%=dt.Rows[i]["SendProID"] %>" />
<input name="btnaddrow" type="button" value="添加一行" style="font-size: 11px;" onclick="addrow()" class="btnchoose" />
<input name="btndeleterow" type="button" value="删除行" onclick="deleterow()" class="btnchoose"/>
<input name="btnaddbatch" type="button" value="添加批号" onclick="setbatch()" style=" display:none;" class="btnchoose"/>
<asp:Label name="lbShow" runat="server" Text=""></asp:Label>
</td>
</tr> <%
} %>
<tr>
<td colspan="5" class="bottomtd"><span>总金额:</span><span class="money"><%=totalprice.ToString("0.00")%></span> <span>总开票金额:</span><span class="money"><%=totalinvoiceprice.ToString("0.00")%></span></td>
</tr>
<%
}
%> <tr id="trprobatch" style="display:none;">
<td colspan="5">
<div id="divprobatch">
<table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" style=" width=99%;">
<tr id="probatchtr" class="trbar">
<td style="width: 200px;">
订货产品名称及规格(只读)
</td>
<td style="width: 70px;">
数量
</td>
<td style="width: 95px;">
批号(只读)
</td>
<td style="width: 95px;">
货号(只读)
</td>
<td style="width: 120px;">
生产日期(只读)
</td>
<td style="width: 120px;">
有效期(只读)
</td>
<td style="width: 120px;">
入库日期(只读)
</td>
<td style="width: 150px;">
操作
</td>
</tr>
<% if (!IsPostBack)
{
int probathscount = this.probathsdt.Rows.Count;
if (probathscount > 0)
{
for (int i = 0; i < probathscount; i++)
{
%>
<tr>
<td id="td2">
<input name="proname0" value='<%=this.probathsdt.Rows[i]["ProName"] %>' readonly="readonly" style="width: 200px" type="text" class="input" size="50" />
<input type="hidden" name="proIds" value='<%=this.probathsdt.Rows[i]["ProID"] %>' />
</td>
<td>
<input name="txtProCount0" class="{required:true,min:1,digits:true}" onkeyup="isProBathCountFull(this)" type="text" size="5" value='<%=this.probathsdt.Rows[i]["proCount"] %>' />
<input type="hidden" name="oldprobatchcount" value='<%=this.probathsdt.Rows[i]["proCount"] %>' />
</td>
<td>
<input name="txtProBatch0" type="text" readonly="readonly" value='<%=this.probathsdt.Rows[i]["batchNum"] %>' size="11" />
</td>
<td>
<input name="txtProBoxNum0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["boxNum"] %>'
type="text" size="11" />
</td>
<td>
<input name="txtMarkDate0" size="11" readonly="readonly" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["makeDate"] %>'
type="text" />
</td>
<td>
<input name="txtExPirationDate0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["expirationDate"] %>' class="{required:true,dateISO:true}"
size="11" type="text" />
</td>
<td>
<input name="txtStockDate0" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["stockDate"] %>'
size="11" type="text" readonly="readonly" />
</td>
<td>
暂无操作
<input type="hidden" value='<%=this.probathsdt.Rows[i]["SendProID"] %>' name="SendProID2" /><span> </span>
<input name="stockproid" value='<%=this.probathsdt.Rows[i]["ProStockID"] %>' type="hidden" />
<input name="stockid" value='<%=this.probathsdt.Rows[i]["stockID"] %>' type="hidden" />
<input name="ProBatchID" value='<%=this.probathsdt.Rows[i]["ProBatchID"] %>' type="hidden" />
</td>
</tr> <%
}
}
}
%> </table>
</div>
</td>
</tr>
<tr id="trfinance" style="display:none;">
<td colspan="5">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<span>财务审核:</span><span><asp:CheckBox ID="cbisfinance" runat="server" Text="已付款"
AutoPostBack="True" oncheckedchanged="cbisfinance_CheckedChanged"/>    <asp:Label
ID="Label1" runat="server" Text="账单编号:"></asp:Label><asp:Label ID="lbBillNo" runat="server" Text="未生成"></asp:Label></span> <span id="spanquality" style=" margin-left:100px; display:none;">质量审核:<span><asp:CheckBox ID="cbquality" runat="server" Text="审核通过"/></span></span>
<span id="spanstock" style=" margin-left:100px;">仓库审核:<span><input type="checkbox" id="cbISstock" runat="server" onchange="{if(this.checked){$('#trpostinfo').show();}else{$('#trpostinfo').hide();}}" value="可以出库"/></span></span>
</ContentTemplate>
</asp:UpdatePanel> </td> </tr> <tr id="trpostinfo" style="display:none;">
<td colspan="5">
<span>物流单位:<asp:TextBox ID="txtPostUnit" runat="server"></asp:TextBox></span>
<span>联系方式(电话):<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></span>
<span>物流方式:<asp:DropDownList ID="ddlPostWay" runat="server" Height="17px">
<asp:ListItem>邮政EMS</asp:ListItem>
<asp:ListItem>申通快递</asp:ListItem>
<asp:ListItem Selected="True">自定义</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtPostWay" runat="server"></asp:TextBox>
</span>
<span>备注:<asp:TextBox ID="txtpostRemark" runat="server"></asp:TextBox></span> </td> </tr>
</table>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td>历史审批意见:</td>
<td colspan="3">
<asp:Label ID="lbHistory" runat="server" Text=""></asp:Label></td>
</tr> <tr>
<td>备注:</td>
<td>
<asp:TextBox ID="txtRemark" runat="server" Width="523px"></asp:TextBox>
</td> <td>下次审批人</td>
<td> <asp:TextBox ID="txtNetUserId" CssClass="{required:true,digits:true, min:1}"
runat="server" Width="70px"></asp:TextBox>
<input id="btnUser0" type="button" value="选择" class="btnchoose"
onclick="showDialog3()" /></td>
</tr>
<tr>
<td colspan="8" class="bottomtd">
<asp:HiddenField ID="hf_applayUserid" runat="server" />
<asp:HiddenField ID="hf_subject" runat="server" /> <asp:HiddenField ID="hf_FirstAccepter" runat="server" />
<asp:HiddenField ID="hf_FirstTransmitter" runat="server" /> <asp:Button ID="btnReject" runat="server" CssClass="btnorange" Text="拒绝审核"
onclick="btnReject_Click" />
 <asp:Button ID="btnRun" runat="server" OnClientClick="{if(!$('#cbISstock').attr('checked')){alert('请先选择出库审核并填写相关数据后才能点击此按钮');return false;}}" UseSubmitBehavior="false" CssClass="btnorange"
Text="执行发货" onclick="btnRun_Click"
/>
 <asp:Button ID="btnSubmit" runat="server" CssClass="btngreen" Text="提交审核"
onclick="btnSubmit_Click" /> </td>
</tr> </table> </div>
</form>
</body>
</html>

后台代码:

 public partial class SendGoodsEdit: BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ DepartMentBand();
pageinfobind(); } } public DataTable dt;
public DataTable probathsdt;
string taskid = "8";
string listid = "75";
/// <summary>
/// 是否具备财务权限,默认为Fasle
/// </summary>
public static string isfinance = "false";
public static string isquality = "false";
public static string isprobatch = "false";
public static string isstock = "false";
public static int probaths = 0;
/// <summary>
/// 页面信息加载
/// </summary>
protected void pageinfobind()
{
//是否具有财务权限
isfinance = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.finance).ToString() + ",") ? "true" : "false";
//是否具备质量审核权限
isquality = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.quality).ToString() + ",")?"true":"false"; //是否具备添加产品批号的权限 isprobatch= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.probatch).ToString() + ",") ? "true" : "false";
//是否具备仓库审核权限
isstock = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.stock).ToString() + ",") ? "true" : "false"; BioSendGoodsBLL sendgoodsview = new BioSendGoodsBLL();
ViewBioSendAppInfo viewsendinfo= sendgoodsview.GetModel(int.Parse(taskid));
ddlDepartMent.SelectedValue= viewsendinfo.DepartMentID.ToString();
this.lbApplayUser.Text = viewsendinfo.AppUserName;
this.hf_applayUserid.Value = viewsendinfo.AppUserId.ToString();
this.txtRealUserID.Text = viewsendinfo.RealUserID.ToString();
this.lbRealUserName.Text = viewsendinfo.RealUser;
this.lbTime.Text = Convert.ToDateTime(viewsendinfo.submitTime).ToString("yyyy-MM-dd");
this.txtSendCom.Text = viewsendinfo.ReceiveComID.ToString();
getLinkMan(); this.ddlOuserCom.SelectedItem.Text = viewsendinfo.OurCom;
this.ddlTypes.SelectedItem.Text = viewsendinfo.sendType;
this.ddlLinkMan.SelectedValue = viewsendinfo.Receiver;
this.txtTelphone.Text = viewsendinfo.telephone;
this.txtMobile.Text = viewsendinfo.mobile;
if (viewsendinfo.BillNo != null && viewsendinfo.BillNo != "")
{
this.lbBillNo.Text = viewsendinfo.BillNo;
this.cbisfinance.Checked = true;
if (bool.Parse(isfinance))
{
this.cbisfinance.Enabled = false;
}
} if (viewsendinfo.QualityUserid != null && viewsendinfo.QualityUserid != 0 && viewsendinfo.isQualityCheck != false)
{
this.cbquality.Checked = true;
this.cbquality.Enabled = false;
} //是否仓库审核
if (viewsendinfo.isOutStockCheck == true)
{
this.cbISstock.Checked = true;
this.cbISstock.Disabled = true;
this.txtPostUnit.Text = viewsendinfo.postUnit.ToString();
this.txtPhone.Text = viewsendinfo.postPhone.ToString();
this.txtPostWay.Text = viewsendinfo.postWay;
this.ddlPostWay.SelectedValue = viewsendinfo.postWay;
this.txtpostRemark.Text = viewsendinfo.postRemak; //ScriptManager.RegisterStartupScript(this,this.GetType(), "trpostinfoshow", "$('#trpostinfo').show()", true);
} //if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch))
//{
// ClientScript.RegisterStartupScript(this.GetType(), "test", "showobjbyName('btnaddbatch')", true);
//} dt=SqlComm.GetDataByCondition("dbo.BioSendGoodsPro", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];
probathsdt= SqlComm.GetDataByCondition("dbo.ViewSendProBaths", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];
probaths = probathsdt.Rows.Count;
if (probathsdt.Rows.Count > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "showprobatchs", "$('#trprobatch').show()", true);
} //加载历史审批记录
this.lbHistory.Text= SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProSend).ToString());
this.hf_subject.Value = SqlComm.getTaskListSubjectByCondition(listid);
this.hf_FirstTransmitter.Value = SqlComm.getFirstTransmitterByCondition(listid);
this.hf_FirstAccepter.Value = SqlComm.getFirstAccpterByCondition(listid);
//string rights= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()); //判断是否具有财务权限和部门经理角色,如果是,则显示“拒绝审核按钮”,否则不显示
if ((Web.UserLogin.user.RoleId == 3 && Web.UserLogin.user.DepartmentId == int.Parse(this.ddlDepartMent.SelectedValue.ToString())) || bool.Parse(isfinance))
{
this.btnReject.Visible = true;
}
else
{
this.btnReject.Visible = false;
}
} /// <summary>
/// 绑定部门信息
/// </summary>
private void DepartMentBand()
{
ddlDepartMent.DataSource = SqlComm.getDepartMent();
ddlDepartMent.DataTextField = "DepartmentName";
ddlDepartMent.DataValueField = "DepartmentId";
ddlDepartMent.DataBind();
//ddlDepartMent.Items.Add(new ListItem("--请选择部门--", "0"));
//ddlDepartMent.SelectedValue = "0";
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
//部门经理角色 并且当前用户所属部门为表单所选部门 try
{
//判断是否具备财务权限 并且当前财务审核通过
if (bool.Parse(isfinance) && this.cbisfinance.Checked == true)
{
SqlComm.UpdateTableByCondition("dbo.BioSendAppInfo", "BillNo='" + this.lbBillNo.Text + "',BillUserID='" + Session["Userid"] + "'", " SendId=" + taskid);
} //判断是否具备质量申请权限,并且当前的财务审核通过之后才能提交质量审核
if (bool.Parse(isquality) && this.cbisfinance.Checked == true && this.cbquality.Checked == true)
{
SqlComm.UpdateTableByCondition("dbo.BioSendAppInfo", "QualityUserid='" + Session["Userid"].ToString() + "',isQualityCheck=" + 1, " SendId=" + taskid);
} if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch)==true)
{
string proname = Request["proname0"].ToString();
string proId = Request["proIds"].ToString();
string txtProCount = Request["txtProCount0"].ToString();
string txtProBatch=Request["txtProBatch0"].ToString();
string txtProBoxNum = Request["txtProBoxNum0"].ToString();
string txtMarkDate = Request["txtMarkDate0"].ToString();
string txtExPirationDate = Request["txtExPirationDate0"].ToString();
string SendProID = Request["SendProID2"].ToString(); string stockproid = Request["stockproid"].ToString();
string stockDate = Request["txtStockDate0"].ToString();
string stockid = Request["stockid"].ToString();
//默认产品批次,如果为新添加产品批次则初始值为0,如果是修改数据则为数据库中绑定的产品批次数据
string oldprobatchcount = Request["oldprobatchcount"].ToString();
string ProBatchID=Request["ProBatchID"].ToString();
//string[] pronamess = proname.Split(',');
//string[] proIdss = proId.Split(',');
string[] txtProCounts = txtProCount.Split(',');
string[] txtProBatchs=txtProBatch.Split(',');
string[] txtProBoxNums = txtProBoxNum.Split(',');
string[] txtMarkDates = txtMarkDate.Split(',');
string[] txtExPirationDates = txtExPirationDate.Split(',');
string[] SendProIDs = SendProID.Split(',');
string[] stockproids = stockproid.Split(',');
string[] stockDates = stockDate.Split(',');
string[] stockids = stockid.Split(',');
string[] oldprobatchcounts = oldprobatchcount.Split(',');
string []ProBatchIDs=ProBatchID.Split(',');
BioSendProBatch probacth = new BioSendProBatch();
BioSendGoodsBLL sendbll = new BioSendGoodsBLL();
for (int i = 0; i < SendProIDs.Length; i++)
{
//probacth.ProStockID
probacth.SendProID = int.Parse(SendProIDs[i]);
//1:old 10 new 8 2:old 10 new 12
probacth.proCount = int.Parse(txtProCounts[i]);
probacth.ProStockID = int.Parse(stockproids[i]);
probacth.stockDate = DateTime.Parse(stockDates[i]);
probacth.stockID = int.Parse(stockids[i]);
probacth.batchNum = txtProBatchs[i];
probacth.boxNum = txtProBoxNums[i];
probacth.makeDate = DateTime.Parse(txtMarkDates[i]);
probacth.expirationDate = DateTime.Parse(txtExPirationDates[i]); if (oldprobatchcounts[i] == "0")
{ //添加产品批次
sendbll.BioSendProBatchADD(probacth);
//修改产品库存数据(出库)
SqlComm.BioProStockUpdateCount(int.Parse(probacth.ProStockID.ToString()), int.Parse(probacth.proCount.ToString()));
}
else
{
if (oldprobatchcounts[i] != txtProCounts[i])
{
//修改当前批次表中相应产品数据
SqlComm.UpdateTableByCondition("dbo.BioSendProBatch", "proCount=" + int.Parse(txtProCounts[i]), "ProBatchID=" + ProBatchIDs[i]);
int batchcount = int.Parse(txtProCounts[i]) - int.Parse(oldprobatchcounts[i]);
//修改产品库存表中对应批次的数据
SqlComm.UpdateTableByCondition("dbo.BioProStock", "ProCout=(ProCout-(" + batchcount + "))", "ID=" + stockproids[i]);
}
} } }
TaskListInsert();
ContextUtil.SetComplete();
}
catch (Exception ex)
{
ContextUtil.SetAbort();
ClientScript.RegisterStartupScript(this.GetType(),"test","alert('提交失败,数据回滚')",true); } } /// <summary>
/// 添加新的流行表数据并修改之前的数据
/// </summary>
private void TaskListInsert()
{
TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = this.hf_subject.Value,
Accepter = int.Parse(txtNetUserId.Text),
AuditingSate = 0,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(hf_FirstAccepter.Value),
FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),
FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),
Mind = this.txtRemark.Text,
Pass = 1,
SumitTime = DateTime.Now,
TaskID = int.Parse(taskid),
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
}; SqlComm.TaskListRecordAdd(tasklistRecord);
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);
}
static DataSet ds;
protected void txtSendCom_TextChanged(object sender, EventArgs e)
{
getLinkMan(); } private void getLinkMan()
{
ds = null;
this.txtTelphone.Text = "";
this.txtMobile.Text = "";
this.txtLinkman.Text = ""; if (this.txtSendCom.Text.Trim() != "" && this.txtSendCom.Text.Trim() != "请选择")
{
ds = SqlComm.GetDataByCondition("BioCrmLinkmanInfo", "LinkmanID,LinkmanName,WorkPhone,Mobile", " CustomerID=" + this.txtSendCom.Text);
this.ddlLinkMan.DataSource = ds.Tables[0];
this.ddlLinkMan.DataTextField = "LinkmanName";
this.ddlLinkMan.DataValueField = "LinkmanID";
this.ddlLinkMan.DataBind();
if (ds.Tables[0].Rows.Count == 0)
{ this.ddlLinkMan.Visible = false;
}
else
{
this.ddlLinkMan.Visible = true; DataTable dt = ds.Tables[0];
DataRow[] dr = dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());
this.txtTelphone.Text = dr[0]["WorkPhone"].ToString();
this.txtMobile.Text = dr[0]["Mobile"].ToString();
this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString(); }
}
} protected void ddlLinkMan_SelectedIndexChanged(object sender, EventArgs e)
{
if (ds.Tables[0].Rows.Count > 0)
{
DataTable dt = ds.Tables[0];
DataRow[] dr=dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());
this.txtTelphone.Text= dr[0]["WorkPhone"].ToString();
this.txtMobile.Text = dr[0]["Mobile"].ToString();
this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();
}
} /// <summary>
/// 拒绝审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReject_Click(object sender, EventArgs e)
{
TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = this.hf_subject.Value,
Accepter = int.Parse(this.hf_FirstTransmitter.Value),
AuditingSate = 0,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(hf_FirstAccepter.Value),
FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),
FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),
Mind = this.txtRemark.Text,
Pass = 1,
SumitTime = DateTime.Now,
TaskID = int.Parse(taskid),
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
}; SqlComm.TaskListRecordAdd(tasklistRecord);
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);
} protected void cbisfinance_CheckedChanged(object sender, EventArgs e)
{
if (this.cbisfinance.Checked)
{
this.lbBillNo.Text = SqlComm.SPGetBillNo(taskid);
}
else
{
this.lbBillNo.Text = "未生成";
}
if(bool.Parse(isquality))
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "$('#spanquality').show();", true);
} } protected void btnRun_Click(object sender, EventArgs e)
{
try
{
if (this.cbISstock.Checked == false)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('如果没有选择出库审核,则不能发货执行')", true);
return;
}
string postway = "";
if (this.ddlPostWay.SelectedItem.Text == "自定义")
{
postway = this.txtPostWay.Text; }
else
{
postway = this.ddlPostWay.SelectedItem.Text;
} bool isok= SqlComm.UpdateTableByCondition("BioSendAppInfo", "Stockuserid='" + Session["Userid"] + "',isOutStockCheck=1,postUnit='" + this.txtPostUnit.Text + "',postPhone='" + this.txtPhone.Text + "',postWay='" + postway + "',postRemak='" + this.txtpostRemark.Text + "',isSend=1", "SendId=" + taskid); TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = this.hf_subject.Value,
Accepter = int.Parse(hf_FirstTransmitter.Value),
AuditingSate = 2,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(hf_FirstAccepter.Value),
FirstSumitTime = Convert.ToDateTime(this.lbTime.Text),
FirstTransmitter = int.Parse(hf_FirstTransmitter.Value),
Mind = this.txtRemark.Text,
Pass = 1,
SumitTime = DateTime.Now,
TaskID = int.Parse(taskid),
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
}; if (isok)
{
SqlComm.TaskListRecordAdd(tasklistRecord);
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", " AuditingSate=1", " ListID=" + listid);
}
else
{
//提示错误信息
} ContextUtil.SetComplete();//提交事务
}
catch (Exception ex)
{
ContextUtil.SetAbort();//撤销事务
} } }

详细页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsShow.aspx.cs"  Transaction="Required"   Inherits="BioErpWeb.SendGoods.SendGoodsShow" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  charset="UTF-8"  "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>
<link href="../Styles/InputStyle1.css" rel="stylesheet" type="text/css" /> <script type="text/javascript">
$(document).ready(function () {
$("#form1").validate(); }); </script> <style type="text/css">
.trbar{ background-color:#eeeeee;}
.w80{ width:80px;}
.w100{ width:100px;}
.w150{ width:150px;}
.style1
{
width: 150px;
}
.style2
{
width: 85px;
}
.style3
{
width: 128px;
}
.style15
{
width: 235px;
}
.style20
{
width: 157px;
}
.style24
{
width: 304px;
}
.style29
{
width: 90px;
} #trpostinfo{}
#trpostinfo span{ margin:0px 20px;} .style30
{
width: 283px;
}
.style31
{
width: 285px;
} </style> </head>
<body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> <div> <table class="maintable Inupttable" style=" width:900px;">
<tr>
<td colspan="8" class="titlebar">商品销售发货审核</td>
</tr>
<tr>
<td class="w80">申请部门</td>
<td class="style1">
<asp:Label ID="ddlDepartMent" runat="server" Text=""></asp:Label> </td>
<td class="style2" colspan="2">
制表人
<asp:Label ID="lbApplayUser" runat="server" ></asp:Label>
</td>
<td>经手人</td><td class="style15">
<asp:TextBox ID="txtRealUserID" CssClass="{required:true,digits:true, min:1}"
runat="server" Width="78px"></asp:TextBox>
<asp:Label
ID="lbRealUserName" runat="server" Text=""></asp:Label></td>
<td>制表时间</td><td>
<asp:Label ID="lbTime" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate> <table class="maintable Inupttable" style=" width:900px;">
<tr>
<td class="w80">订货客户</td>
<td class="w150">
<asp:TextBox ID="txtSendCom" runat="server" Width="59px"
CssClass="{required:true,digits:true, min:1}"
ontextchanged="txtSendCom_TextChanged"></asp:TextBox>
<asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label>
</td><td class="style20">
发货单位</td>
<td class="style24">
<asp:DropDownList ID="ddlOuserCom" runat="server">
<asp:ListItem>上海某某公司</asp:ListItem>
<asp:ListItem>成都某某公司</asp:ListItem>
<asp:ListItem>北京某某公司</asp:ListItem>
<asp:ListItem>雅安某某公司</asp:ListItem>
</asp:DropDownList>
</td> <td class="style29">发货类型</td><td>
<asp:DropDownList ID="ddlTypes" runat="server">
<asp:ListItem>调拨</asp:ListItem>
<asp:ListItem>医院</asp:ListItem>
<asp:ListItem>OTC</asp:ListItem>
<asp:ListItem>其它</asp:ListItem>
</asp:DropDownList>
</td>
</tr> <tr>
<td>客户联系人</td>
<td>
<asp:DropDownList ID="ddlLinkMan" runat="server" AutoPostBack="True" Width="80px"
onselectedindexchanged="ddlLinkMan_SelectedIndexChanged">
<asp:ListItem Value="0">--请选择--</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtLinkman" Width="60px" runat="server"></asp:TextBox>
</td><td class="style20">
手机号码</td>
<td class="style24">
<asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
</td> <td class="style29">工作电话</td><td>
<asp:TextBox ID="txtTelphone" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table class="maintable Inupttable" style="width: 900px;">
<tr class="trbar">
<td class="style31">
产品名称及规格
</td>
<td>
数量
</td>
<td>
单价
</td>
<td class="style3">
开票价格
</td> </tr>
<%
if (!IsPostBack)
{
int count = this.dt.Rows.Count;
if (count == 0)
{
return;
}
decimal totalprice = 0;
decimal totalinvoiceprice = 0;
for (int i = 0; i < count; i++)
{
totalprice += (decimal.Parse(dt.Rows[i]["ProPrice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));
totalinvoiceprice += (decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()) * int.Parse(dt.Rows[i]["ProCount"].ToString()));
%>
<tr>
<td class="style31">
<input type="text" name="proName" class="required" value="<%=dt.Rows[i]["ProName"] %>" style="width: 200px" /><input
type="hidden" name="proID" value="<%=dt.Rows[i]["ProID"] %>" />
</td>
<td>
<input type="text" name="proCount" value="<%=dt.Rows[i]["ProCount"] %>" class="{required:true,min:1,digits:true}" style="width: 100px" />
</td>
<td>
<input type="text" name="proPrice" onkeyup="setvalue(this)" value="<%=decimal.Parse(dt.Rows[i]["ProPrice"].ToString()).ToString("0.00") %>" onchange="setvalue(this)"
class="{required:true,min:0.1,number:true}" style="width: 100px" />
</td>
<td>
<input type="text" name="invoiceProPice" value="<%=decimal.Parse(dt.Rows[i]["invoiceProPice"].ToString()).ToString("0.00") %>" class="{required:true,min:0.1,number:true}"
style="width: 100px" />
</td> </tr> <%
} %>
<tr>
<td colspan="5" class="bottomtd"><span>总金额:</span><span class="money"><%=totalprice.ToString("0.00")%></span> <span>总开票金额:</span><span class="money"><%=totalinvoiceprice.ToString("0.00")%></span></td>
</tr>
<%
}
%> <tr id="trprobatch" style="display:none;">
<td colspan="5">
<div id="divprobatch">
<table id="tb2" align="left" cellpadding="0" border="0" cellspacing="0" style=" width=99%;">
<tr id="probatchtr" class="trbar">
<td style="width: 300px;">
订货产品名称及规格(只读)
</td>
<td style="width: 70px;">
数量
</td>
<td style="width: 95px;">
批号(只读)
</td>
<td style="width: 95px;">
货号(只读)
</td>
<td style="width: 120px;">
生产日期(只读)
</td>
<td style="width: 120px;">
有效期(只读)
</td>
<td style="width: 120px;">
入库日期(只读)
</td> </tr>
<% if (!IsPostBack)
{
int probathscount = this.probathsdt.Rows.Count;
if (probathscount > 0)
{
for (int i = 0; i < probathscount; i++)
{
%>
<tr>
<td id="td2">
<input name="proname0" value='<%=this.probathsdt.Rows[i]["ProName"] %>' readonly="readonly" style="width: 200px" type="text" class="input" size="50" />
<input type="hidden" name="proIds" value='<%=this.probathsdt.Rows[i]["ProID"] %>' />
</td>
<td>
<input name="txtProCount0" class="{required:true,min:1,digits:true}" onkeyup="isProBathCountFull(this)" type="text" size="5" value='<%=this.probathsdt.Rows[i]["proCount"] %>' />
<input type="hidden" name="oldprobatchcount" value='<%=this.probathsdt.Rows[i]["proCount"] %>' />
</td>
<td>
<input name="txtProBatch0" type="text" readonly="readonly" value='<%=this.probathsdt.Rows[i]["batchNum"] %>' size="11" />
</td>
<td>
<input name="txtProBoxNum0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["boxNum"] %>'
type="text" size="11" />
</td>
<td>
<input name="txtMarkDate0" size="11" readonly="readonly" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["makeDate"] %>'
type="text" />
</td>
<td>
<input name="txtExPirationDate0" readonly="readonly" value='<%=this.probathsdt.Rows[i]["expirationDate"] %>' class="{required:true,dateISO:true}"
size="11" type="text" />
</td>
<td>
<input name="txtStockDate0" class="{required:true,dateISO:true}" value='<%=this.probathsdt.Rows[i]["stockDate"] %>'
size="11" type="text" readonly="readonly" />
</td> </tr> <%
}
}
}
%> </table>
</div>
</td>
</tr>
<tr id="trfinance" style="display:none;">
<td colspan="5">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<span>财务审核:</span><span><asp:CheckBox ID="cbisfinance" runat="server" Text="已付款"
AutoPostBack="True" oncheckedchanged="cbisfinance_CheckedChanged"/>    <asp:Label
ID="Label1" runat="server" Text="账单编号:"></asp:Label><asp:Label ID="lbBillNo" runat="server" Text="未生成"></asp:Label></span> <span id="spanquality" style=" margin-left:100px; display:none;">质量审核:<span><asp:CheckBox ID="cbquality" runat="server" Text="审核通过"/></span></span>
<span id="spanstock" style=" margin-left:100px;">仓库审核:<span><input type="checkbox" id="cbISstock" runat="server" onchange="{if(this.checked){$('#trpostinfo').show();}else{$('#trpostinfo').hide();}}" value="可以出库"/></span></span>
</ContentTemplate>
</asp:UpdatePanel> </td> </tr> <tr id="trpostinfo" style="display:none;">
<td colspan="5">
<span>物流单位:<asp:TextBox ID="txtPostUnit" runat="server"></asp:TextBox></span>
<span>联系方式(电话):<asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></span>
<span>物流方式:<asp:DropDownList ID="ddlPostWay" runat="server" Height="17px">
<asp:ListItem>邮政EMS</asp:ListItem>
<asp:ListItem>申通快递</asp:ListItem>
<asp:ListItem Selected="True">自定义</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtPostWay" runat="server"></asp:TextBox>
</span>
<span>备注:<asp:TextBox ID="txtpostRemark" runat="server"></asp:TextBox></span> </td> </tr>
</table>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td class="style30">历史审批意见:</td>
<td>
<asp:Label ID="lbHistory" runat="server" Text=""></asp:Label></td>
</tr> </table> </div>
</form>
</body>
</html>

后台代码:

public partial class SendGoodsShow : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ pageinfobind(); } } public DataTable dt;
public DataTable probathsdt;
string taskid = "8";
string listid = "75";
/// <summary>
/// 是否具备财务权限,默认为Fasle
/// </summary>
public static string isfinance = "false";
public static string isquality = "false";
public static string isprobatch = "false";
public static string isstock = "false";
public static int probaths = 0;
/// <summary>
/// 页面信息加载
/// </summary>
protected void pageinfobind()
{
//是否具有财务权限
isfinance = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.finance).ToString() + ",") ? "true" : "false";
//是否具备质量审核权限
isquality = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.quality).ToString() + ",")?"true":"false"; //是否具备添加产品批号的权限 isprobatch= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.probatch).ToString() + ",") ? "true" : "false";
//是否具备仓库审核权限
isstock = SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains("," + ((int)RightEmun.stock).ToString() + ",") ? "true" : "false"; BioSendGoodsBLL sendgoodsview = new BioSendGoodsBLL();
ViewBioSendAppInfo viewsendinfo= sendgoodsview.GetModel(int.Parse(taskid));
ddlDepartMent.Text= viewsendinfo.Departname.ToString();
this.lbApplayUser.Text = viewsendinfo.AppUserName; this.txtRealUserID.Text = viewsendinfo.RealUserID.ToString();
this.lbRealUserName.Text = viewsendinfo.RealUser;
this.lbTime.Text = Convert.ToDateTime(viewsendinfo.submitTime).ToString("yyyy-MM-dd");
this.txtSendCom.Text = viewsendinfo.ReceiveComID.ToString();
getLinkMan(); this.ddlOuserCom.SelectedItem.Text = viewsendinfo.OurCom;
this.ddlTypes.SelectedItem.Text = viewsendinfo.sendType;
this.ddlLinkMan.SelectedValue = viewsendinfo.Receiver;
this.txtTelphone.Text = viewsendinfo.telephone;
this.txtMobile.Text = viewsendinfo.mobile;
if (viewsendinfo.BillNo != null && viewsendinfo.BillNo != "")
{
this.lbBillNo.Text = viewsendinfo.BillNo;
this.cbisfinance.Checked = true;
if (bool.Parse(isfinance))
{
this.cbisfinance.Enabled = false;
}
} if (viewsendinfo.QualityUserid != null && viewsendinfo.QualityUserid != 0 && viewsendinfo.isQualityCheck != false)
{
this.cbquality.Checked = true;
this.cbquality.Enabled = false;
} //if (this.cbisfinance.Checked == true && this.cbquality.Checked == true && bool.Parse(isprobatch))
//{
// ClientScript.RegisterStartupScript(this.GetType(), "test", "showobjbyName('btnaddbatch')", true);
//} dt=SqlComm.GetDataByCondition("dbo.BioSendGoodsPro", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];
probathsdt= SqlComm.GetDataByCondition("dbo.ViewSendProBaths", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];
probaths = probathsdt.Rows.Count;
if (probathsdt.Rows.Count > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "showprobatchs", "$('#trprobatch').show()", true);
} //加载历史审批记录
this.lbHistory.Text= SqlComm.getTaskListRecordsMindsByCondition(taskid, ((int)TaskNavigateEmun.ProSend).ToString()); //string rights= SqlComm.getUserRightsByUserId(Session["Userid"].ToString()); } static DataSet ds;
protected void txtSendCom_TextChanged(object sender, EventArgs e)
{
getLinkMan(); } private void getLinkMan()
{
ds = null;
this.txtTelphone.Text = "";
this.txtMobile.Text = "";
this.txtLinkman.Text = ""; if (this.txtSendCom.Text.Trim() != "" && this.txtSendCom.Text.Trim() != "请选择")
{
ds = SqlComm.GetDataByCondition("BioCrmLinkmanInfo", "LinkmanID,LinkmanName,WorkPhone,Mobile", " CustomerID=" + this.txtSendCom.Text);
this.ddlLinkMan.DataSource = ds.Tables[0];
this.ddlLinkMan.DataTextField = "LinkmanName";
this.ddlLinkMan.DataValueField = "LinkmanID";
this.ddlLinkMan.DataBind();
if (ds.Tables[0].Rows.Count == 0)
{ this.ddlLinkMan.Visible = false;
}
else
{
this.ddlLinkMan.Visible = true; DataTable dt = ds.Tables[0];
DataRow[] dr = dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());
this.txtTelphone.Text = dr[0]["WorkPhone"].ToString();
this.txtMobile.Text = dr[0]["Mobile"].ToString();
this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString(); }
}
} protected void ddlLinkMan_SelectedIndexChanged(object sender, EventArgs e)
{
if (ds.Tables[0].Rows.Count > 0)
{
DataTable dt = ds.Tables[0];
DataRow[] dr=dt.Select("LinkmanID=" + this.ddlLinkMan.SelectedValue.ToString());
this.txtTelphone.Text= dr[0]["WorkPhone"].ToString();
this.txtMobile.Text = dr[0]["Mobile"].ToString();
this.txtLinkman.Text = this.ddlLinkMan.SelectedValue.ToString();
}
} protected void cbisfinance_CheckedChanged(object sender, EventArgs e)
{
if (this.cbisfinance.Checked)
{
this.lbBillNo.Text = SqlComm.SPGetBillNo(taskid);
}
else
{
this.lbBillNo.Text = "未生成";
}
if(bool.Parse(isquality))
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "$('#spanquality').show();", true);
} } }
}

ERP发货系统的修改(四十三)的更多相关文章

  1. 我是如何一步步编码完成万仓网ERP系统的(四)登录的具体实现

    https://www.cnblogs.com/smh188/p/11533668.html(我是如何一步步编码完成万仓网ERP系统的(一)系统架构) https://www.cnblogs.com/ ...

  2. Java进阶(四十三)线程与进程的区别

    Java进阶(四十三)线程与进程的区别 1.线程的基本概念   概念:线程是进程中执行运算的最小单位,是进程中的一个实体,是被系统独立调度和分派的基本单位,线程自己不拥有系统资源,只拥有一点在运行中必 ...

  3. Gradle 1.12用户指南翻译——第四十三章. 构建公告插件

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

  4. NeHe OpenGL教程 第四十三课:FreeType库

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

  5. 在Android系统中修改Android.mk使其同时编译rgb2565和rgb2888(向out/host/linux-x86/bin/下新增加一个工具命令)【转】

    本文转载自:http://blog.csdn.net/mu0206mu/article/details/7514559 在Android系统中修改android.mk使其同时编译rgb2565和rgb ...

  6. 第四十三个知识点:为AES描述一些基础的(可能无效)的对抗侧信道攻击的防御

    第四十三个知识点:为AES描述一些基础的(可能无效)的对抗侧信道攻击的防御 原文地址:http://bristolcrypto.blogspot.com/2015/07/52-things-numbe ...

  7. linux系统下修改文件夹目录权限

    linux系统下修改文件夹目录权限 文件夹权限问题 Linux.Fedora.Ubuntu修改文件.文件夹权限的方法差不多.很多人开始接触Linux时都很头痛Linux的文件权限问题.这里告诉大家如何 ...

  8. Linux系统下修改环境变量PATH路径的三种方法

    这里介绍Linux的知识,比如把/etc/apache/bin目录添加到PATH中有三种方法,看完之后你将学会Linux系统下如何修改环境变量PATH路径,需要的朋友可以参考下 电脑中必不可少的就是操 ...

  9. MySQL在windows系统中修改datadir路径后无法启动问题,报错1067

    windows server2008下如何更改MySQL数据库的目录的帖子已经很多了,这里简单介绍一个步骤,如果不成功请先查看其它帖子. 更改默认的mysql数据库目录 将 C:\Documents ...

随机推荐

  1. jQuery基础 (一)——样式篇(jQuery选择器)

    一.选择器类型 id选择器 class选择器 元素选择器 层级选择器 全选择器(*选择器) 二.有几种方式可以隐藏一个元素: CSS display的值是none. type="hidden ...

  2. android measure的时候报空指针

    1.使用listview的时候,在代码中动态设置其高度,在android低版本中,这个低版本是以4.4为界,会报measure的空指针,原因是低版本relativelayout有个bug,使用list ...

  3. Kettle基本概念学习

    一,理解开发环境与生产环境. 比如,在windows或mac下设计好流程之后,把该设计文件上传到linux集群的机器上执行.那么,在windows下进行的工作即为开发环境,任务具体在linxu机器上执 ...

  4. C# redis简单的使用

    1.项目一:用于在Redis中添加数据 using System; using System.Collections.Generic; using System.Linq; using System. ...

  5. C# 简单线程实例

    1.简单线程实例 以及委托(同步委托.异步委托) using System; using System.Collections.Generic; using System.Linq; using Sy ...

  6. JavaScript学习 - 基础(二) - 基础类型/类型转换

    基础类型 - 数字类型(Number) 1.最基本的数据类型 2.不区分整型数值和浮点型数值 3.所有数字采用64位浮点格式存储,相当于Java和C语言中double格式 4.能表示的最大值 +- 1 ...

  7. android 服务解析

    https://blog.csdn.net/luoyanglizi/article/details/51586437 2.service和Thread的区别 定义上: thread是程序运行的最小单元 ...

  8. GNU/Linux的GNU是什么意思

    这个组织中黑客云集,而且多是掌握核心技术的真正高手,他们的作品多是编译器.词法/语法分析器.底层函数库等大作.更重要的不是他们的技术,而是他们的哲学!他们的哲学就是技术上的“共产主义”——人人为我,我 ...

  9. kdevelop 添加对 C++11的支持

    工程--打开配置--显示高级--显示高级变量(打钩) CMAKE_CXX_FLAGS   项添加   -std=c++0x

  10. Three.js基础探寻二——正交投影照相机

    本篇主要介绍照相机中的正交投影照相机. 第一篇传送门:Three.js基础探寻一 1.照相机 图形学中的照相机定义了三维空间到二维屏幕的投影方式. 针对投影方式照相机分为正交投影照相机和透视投影照相机 ...