ERP产品销售发货--发货管理(四十一)
发货详细信息的业务实体视图:
CREATE VIEW [dbo].[View_BioSendAppInfo] AS SELECT SendId, BillNo, Subject, DepartMentID, Departname=dbo.FN_GetDepartMentByID(DepartMentID), AppUserId, AppUserName=dbo.getUserNameByUserID(AppUserId), RealUserID, RealUser=dbo.getUserNameByUserID(RealUserID), OurCom, ReceiveComID, ReceiveComName=dbo.getCustomerByID(ReceiveComID), BillUserID, BillUser=dbo.getUserNameByUserID(BillUserID), Stockuserid, Stockuser=dbo.getUserNameByUserID(Stockuserid), isOutStockCheck, receiveAddress, Receiver, telephone, mobile, sendType, sendDate, receiveDate, postWay, postUnit, postPhone, postRemak, isSend, QualityUserid, isQualityCheck, clientArea, addBatchDate, addBathUserid, addBathUserNamae=dbo.getUserNameByUserID(addBathUserid), submitTime, DeleteSate FROM BioSendAppInfo
发货信息增加的存储过程:
CREATE PROCEDURE [dbo].[BioSendAppInfo_ADD] @SendId INT OUTPUT, @Subject NVARCHAR(100), @DepartMentID INT, @AppUserId INT, @RealUserID INT, @OurCom NVARCHAR(50), @ReceiveComID INT, --@receiveAddress nvarchar(100), @Receiver NVARCHAR(100), @telephone NVARCHAR(20), @mobile NVARCHAR(20), @sendType NVARCHAR(50) --@clientArea nvarchar(50) AS INSERT INTO [BioSendAppInfo]( [Subject],[DepartMentID],[AppUserId],[RealUserID],[OurCom],[ReceiveComID],[receiveAddress],[Receiver],[telephone],[mobile],[sendType],[clientArea] )VALUES( @Subject,@DepartMentID,@AppUserId,@RealUserID,@OurCom,@ReceiveComID,dbo.FN_getAddressByCustomerID(@ReceiveComID),@Receiver,@telephone,@mobile,
@sendType,dbo.FN_getCustomerAreaByCustomerID(@ReceiveComID) ) SET @SendId = @@IDENTITY
产品发货申请的存储过程:
CREATE PROCEDURE [dbo].[BioSendGoodsPro_ADD] @SendID INT, @ProID INT, @ProCount INT, @ProPrice MONEY, @invoiceProPice MONEY AS INSERT INTO [BioSendGoodsPro]( [SendID],[ProID],[ProCount],[ProPrice],[invoiceProPice] )VALUES( @SendID,@ProID,@ProCount,@ProPrice,@invoiceProPice )
发货产品批号的保存:
CREATE PROCEDURE [dbo].[BioSendProBatch_ADD] @SendProID INT, @batchNum NVARCHAR(50), @boxNum NVARCHAR(20), @proCount INT, @ProStockID INT, @stockDate DATETIME, @stockID INT, @expirationDate DATETIME, @makeDate DATETIME AS INSERT INTO [BioSendProBatch]( [SendProID],[batchNum],[boxNum],[proCount],ProStockID,stockDate,stockID,[expirationDate],[makeDate] )VALUES( @SendProID,@batchNum,@boxNum,@proCount,@ProStockID,@stockDate,@stockID,@expirationDate,@makeDate )
产品发货的视图:
CREATE VIEW [dbo].[BioSendGoodsProView] AS SELECT *,'ProName'=dbo.FN_getProNameByProID(proid) FROM dbo.BioSendGoodsPro
BLL层的代码:
public class BioSendGoodsBLL
{
/// <summary>
/// 执行产品销售发货申请
/// </summary>
/// <param name="appinfo">申请对象</param>
/// <returns>返回销售单编号</returns>
public int BioSendAppInfo_ADD(BioSendAppInfo appinfo)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@SendId",SqlDbType.Int),
new SqlParameter("@Subject",appinfo.Subject),
new SqlParameter("@DepartMentID",appinfo.DepartMentID),
new SqlParameter("@AppUserId",appinfo.AppUserId),
new SqlParameter("@RealUserID",appinfo.RealUserID),
new SqlParameter("@OurCom",appinfo.OurCom),
new SqlParameter("@ReceiveComID",appinfo.ReceiveComID),
new SqlParameter("@receiveAddress",appinfo.receiveAddress),
new SqlParameter("@Receiver",appinfo.Receiver),
new SqlParameter("@telephone",appinfo.telephone),
new SqlParameter("@mobile",appinfo.mobile),
new SqlParameter("@sendType",appinfo.sendType),
new SqlParameter("@clientArea",appinfo.clientArea)
};
pars[0].Direction = ParameterDirection.Output;
int count= DataBaseHelper.ExcuteSqlReturnInt("BioSendAppInfo_ADD", CommandType.StoredProcedure, pars);
if (count != 0)
{
if (pars[0].Value != null)
{
return int.Parse(pars[0].Value.ToString());
}
else
{
return 0;
}
}
else
{
return 0;
}
}
/// <summary>
/// 增加一条发货产品数据
/// </summary>
public int BioSendGoodsProADD(BioSendGoodsPro model)
{
SqlParameter[] parameters = {
new SqlParameter("@SendID", SqlDbType.Int,4),
new SqlParameter("@ProID", SqlDbType.Int,4),
new SqlParameter("@ProCount", SqlDbType.Int,4),
new SqlParameter("@ProPrice", SqlDbType.Money,8),
new SqlParameter("@invoiceProPice", SqlDbType.Money,8),
};
parameters[0].Value = model.SendID;
parameters[1].Value = model.ProID;
parameters[2].Value = model.ProCount;
parameters[3].Value = model.ProPrice;
parameters[4].Value = model.invoiceProPice;
int count=DataBaseHelper.ExcuteSqlReturnInt("BioSendGoodsPro_ADD",CommandType.StoredProcedure,parameters);
return count;
}
/// <summary>
/// 增加发货产品批号信息
/// </summary>
public int BioSendProBatchADD(BioSendProBatch model)
{
SqlParameter[] parameters = {
new SqlParameter("@SendProID", SqlDbType.Int,4),
new SqlParameter("@batchNum", SqlDbType.NVarChar,50),
new SqlParameter("@boxNum", SqlDbType.NVarChar,20),
new SqlParameter("@proCount", SqlDbType.Int,4),
new SqlParameter("@ProStockID", SqlDbType.Int,4),
new SqlParameter("@stockDate", SqlDbType.DateTime),
new SqlParameter("@stockID", SqlDbType.Int,4),
new SqlParameter("@expirationDate", SqlDbType.DateTime),
new SqlParameter("@makeDate", SqlDbType.DateTime),
};
parameters[0].Value = model.SendProID;
parameters[1].Value = model.batchNum;
parameters[2].Value = model.boxNum;
parameters[3].Value = model.proCount;
parameters[4].Value = model.ProStockID;
parameters[5].Value = model.stockDate;
parameters[6].Value = model.stockID;
parameters[7].Value = model.expirationDate;
parameters[8].Value = model.makeDate;
return DataBaseHelper.ExcuteSqlReturnInt("BioSendProBatch_ADD", CommandType.StoredProcedure,parameters);
}
/// <summary>
/// 获取一个发货申请基本信息实体对象
/// </summary>
public ViewBioSendAppInfo GetModel(int SendId)
{
SqlParameter[] parameters = {
new SqlParameter("@SendId", SqlDbType.Int,4)
};
parameters[0].Value = SendId;
DataSet ds= SqlComm.GetDataByCondition("View_BioSendAppInfo_GetModel", "*", " SendId=" + SendId);
ViewBioSendAppInfo model = new ViewBioSendAppInfo();
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["SendId"].ToString() != "")
{
model.SendId = int.Parse(ds.Tables[0].Rows[0]["SendId"].ToString());
}
model.BillNo = ds.Tables[0].Rows[0]["BillNo"].ToString();
model.Subject = ds.Tables[0].Rows[0]["Subject"].ToString();
if (ds.Tables[0].Rows[0]["DepartMentID"].ToString() != "")
{
model.DepartMentID = int.Parse(ds.Tables[0].Rows[0]["DepartMentID"].ToString());
}
model.Departname = ds.Tables[0].Rows[0]["Departname"].ToString();
if (ds.Tables[0].Rows[0]["AppUserId"].ToString() != "")
{
model.AppUserId = int.Parse(ds.Tables[0].Rows[0]["AppUserId"].ToString());
}
model.AppUserName = ds.Tables[0].Rows[0]["AppUserName"].ToString();
if (ds.Tables[0].Rows[0]["RealUserID"].ToString() != "")
{
model.RealUserID = int.Parse(ds.Tables[0].Rows[0]["RealUserID"].ToString());
}
model.RealUser = ds.Tables[0].Rows[0]["RealUser"].ToString();
model.OurCom = ds.Tables[0].Rows[0]["OurCom"].ToString();
if (ds.Tables[0].Rows[0]["ReceiveComID"].ToString() != "")
{
model.ReceiveComID = int.Parse(ds.Tables[0].Rows[0]["ReceiveComID"].ToString());
}
model.ReceiveComName = ds.Tables[0].Rows[0]["ReceiveComName"].ToString();
if (ds.Tables[0].Rows[0]["BillUserID"].ToString() != "")
{
model.BillUserID = int.Parse(ds.Tables[0].Rows[0]["BillUserID"].ToString());
}
model.BillUser = ds.Tables[0].Rows[0]["BillUser"].ToString();
if (ds.Tables[0].Rows[0]["StockID"].ToString() != "")
{
model.StockID = int.Parse(ds.Tables[0].Rows[0]["StockID"].ToString());
}
model.StockName = ds.Tables[0].Rows[0]["StockName"].ToString();
if (ds.Tables[0].Rows[0]["Stockuserid"].ToString() != "")
{
model.Stockuserid = int.Parse(ds.Tables[0].Rows[0]["Stockuserid"].ToString());
}
model.Stockuser = ds.Tables[0].Rows[0]["Stockuser"].ToString();
if (ds.Tables[0].Rows[0]["isOutStockCheck"].ToString() != "")
{
if ((ds.Tables[0].Rows[0]["isOutStockCheck"].ToString() == "1") || (ds.Tables[0].Rows[0]["isOutStockCheck"].ToString().ToLower() == "true"))
{
model.isOutStockCheck = true;
}
else
{
model.isOutStockCheck = false;
}
}
model.receiveAddress = ds.Tables[0].Rows[0]["receiveAddress"].ToString();
model.Receiver = ds.Tables[0].Rows[0]["Receiver"].ToString();
model.telephone = ds.Tables[0].Rows[0]["telephone"].ToString();
model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
model.sendType = ds.Tables[0].Rows[0]["sendType"].ToString();
if (ds.Tables[0].Rows[0]["sendDate"].ToString() != "")
{
model.sendDate = DateTime.Parse(ds.Tables[0].Rows[0]["sendDate"].ToString());
}
if (ds.Tables[0].Rows[0]["receiveDate"].ToString() != "")
{
model.receiveDate = DateTime.Parse(ds.Tables[0].Rows[0]["receiveDate"].ToString());
}
model.postWay = ds.Tables[0].Rows[0]["postWay"].ToString();
model.postUnit = ds.Tables[0].Rows[0]["postUnit"].ToString();
model.postPhone = ds.Tables[0].Rows[0]["postPhone"].ToString();
model.postRemak = ds.Tables[0].Rows[0]["postRemak"].ToString();
if (ds.Tables[0].Rows[0]["isSend"].ToString() != "")
{
if ((ds.Tables[0].Rows[0]["isSend"].ToString() == "1") || (ds.Tables[0].Rows[0]["isSend"].ToString().ToLower() == "true"))
{
model.isSend = true;
}
else
{
model.isSend = false;
}
}
if (ds.Tables[0].Rows[0]["QualityUserid"].ToString() != "")
{
model.QualityUserid = int.Parse(ds.Tables[0].Rows[0]["QualityUserid"].ToString());
}
if (ds.Tables[0].Rows[0]["isQualityCheck"].ToString() != "")
{
if ((ds.Tables[0].Rows[0]["isQualityCheck"].ToString() == "1") || (ds.Tables[0].Rows[0]["isQualityCheck"].ToString().ToLower() == "true"))
{
model.isQualityCheck = true;
}
else
{
model.isQualityCheck = false;
}
}
model.clientArea = ds.Tables[0].Rows[0]["clientArea"].ToString();
if (ds.Tables[0].Rows[0]["addBatchDate"].ToString() != "")
{
model.addBatchDate = DateTime.Parse(ds.Tables[0].Rows[0]["addBatchDate"].ToString());
}
if (ds.Tables[0].Rows[0]["addBathUserid"].ToString() != "")
{
model.addBathUserid = int.Parse(ds.Tables[0].Rows[0]["addBathUserid"].ToString());
}
model.addBathUserNamae = ds.Tables[0].Rows[0]["addBathUserNamae"].ToString();
if (ds.Tables[0].Rows[0]["submitTime"].ToString() != "")
{
model.submitTime = DateTime.Parse(ds.Tables[0].Rows[0]["submitTime"].ToString());
}
if (ds.Tables[0].Rows[0]["DeleteSate"].ToString() != "")
{
if ((ds.Tables[0].Rows[0]["DeleteSate"].ToString() == "1") || (ds.Tables[0].Rows[0]["DeleteSate"].ToString().ToLower() == "true"))
{
model.DeleteSate = true;
}
else
{
model.DeleteSate = false;
}
}
return model;
}
else
{
return null;
}
}
}
公用的js:
function setvalue(obj) {
var tr = obj.parentNode.parentNode;
var cons = tr.getElementsByTagName('input');
cons[5].value = obj.value;
}
商品销售发货申请前端:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsNew.aspx.cs" Transaction="Required" Inherits="BioErpWeb.SendGoods.SendGoodsNew" %>
<!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>
<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();
});
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() {
var obj = window.event.srcElement;
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove();
}
</script>
<style type="text/css">
.trbar{ background-color:#eeeeee;}
.w80{ width:80px;}
.w100{ width:100px;}
.w150{ width:150px;}
</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="w150">
<asp:DropDownList ID="ddlDepartMent" runat="server">
</asp:DropDownList>
</td>
<td class="w80" colspan="2">
制表人
<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>
<input id="btnUser" type="button" value="选择" class="btnchoose" onclick="showDialog3()" /></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" runat="server" Text="选择" UseSubmitBehavior="false" class="btnchoose"
OnClientClick="showCustomerDialog3()"/>
<asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label>
</td><td style=" width:126px;">
发货单位</td>
<td>
<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>发货类型</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>
手机号码</td>
<td>
<asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
</td>
<td>工作电话</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>
<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 type="text" name="proPrice" onkeyup="setvalue(this)" onchange="setvalue(this)"
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="添加一行" style="font-size: 11px;" onclick="addrow()" class="btnchoose" />
</td>
</tr>
</table>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td>备注:</td>
<td colspan="5">
<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:Button ID="btnSubmit0" runat="server" Text="暂存"
onclick="btnSubmit0_Click" />
<asp:Button ID="btnSubmit" runat="server" Text="保存"
onclick="btnSubmit_Click" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
public partial class SendGoodsNew: BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.lbApplayUser.Text = Web.UserLogin.user.UserName;
this.lbApplayUser.ToolTip = Web.UserLogin.user.UserId.ToString();
this.hf_applayUserid.Value = Web.UserLogin.user.UserId.ToString();
DepartMentBand();
this.lbTime.Text = DateTime.Now.ToString();
}
}
/// <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
{
BioSendAppInfo sendapp = new BioSendAppInfo();
sendapp.Subject = DateTime.Now.ToString("yyyyMMddhhmmss") + this.lbApplayUser.Text + "的销售发货申请";
sendapp.DepartMentID = int.Parse(this.ddlDepartMent.SelectedValue.ToString());
sendapp.AppUserId = int.Parse(Session["Userid"].ToString());
sendapp.RealUserID = int.Parse(this.txtRealUserID.Text);
sendapp.OurCom = this.ddlOuserCom.SelectedItem.Text;
sendapp.ReceiveComID = int.Parse(this.txtSendCom.Text);
sendapp.Receiver = this.txtLinkman.Text;
sendapp.telephone = this.txtTelphone.Text;
sendapp.mobile = this.txtMobile.Text;
sendapp.sendType = this.ddlTypes.SelectedItem.Text;
BioSendGoodsBLL sendbll = new BioSendGoodsBLL();
int sendid = sendbll.BioSendAppInfo_ADD(sendapp);
if (sendid != 0)
{
string proid = Request["proID"];
string proCount = Request["proCount"];
string ProPrice = Request["ProPrice"];
string invoiceProPice = Request["invoiceProPice"];
string[] proids = proid.Split(',');
string[] proCounts = proCount.Split(',');
string[] ProPrices = ProPrice.Split(',');
string[] invoiceProPices = invoiceProPice.Split(',');
BioSendGoodsPro pro = new BioSendGoodsPro();
pro.SendID = sendid;
if (proids.Length > 0)
{
for (int i = 0; i < proids.Length; i++)
{
pro.ProID = int.Parse(proids[i].ToString());
pro.ProCount = int.Parse(proCounts[i].ToString());
pro.ProPrice = decimal.Parse(ProPrices[i]);
pro.invoiceProPice = decimal.Parse(invoiceProPices[i]);
sendbll.BioSendGoodsProADD(pro);
}
}
}
TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = sendapp.Subject,
Accepter = int.Parse(txtNetUserId.Text),
AuditingSate = 0,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(txtNetUserId.Text),
FirstSumitTime = DateTime.Now,
FirstTransmitter = int.Parse(Session["Userid"].ToString()),
Mind = this.txtRemark.Text,
Pass = 1,
SumitTime = DateTime.Now,
TaskID = sendid,
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
};
SqlComm.TaskListRecordAdd(tasklistRecord);
ContextUtil.SetComplete();//提交事务
}
catch (Exception ex)
{
ContextUtil.SetAbort();//回滚事务
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('提交数据失败,数据回滚')", true);
}
//Response.Redirect("~/Web/Desk.aspx");
}
static DataSet ds;
protected void txtSendCom_TextChanged(object sender, EventArgs e)
{
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 btnSubmit0_Click(object sender, EventArgs e)
{
try
{
BioSendAppInfo sendapp = new BioSendAppInfo();
sendapp.Subject = DateTime.Now.ToString("yyyyMMddhhmmss") + this.lbApplayUser.Text + "的销售发货申请";
sendapp.DepartMentID = int.Parse(this.ddlDepartMent.SelectedValue.ToString());
sendapp.AppUserId = int.Parse(Session["Userid"].ToString());
sendapp.RealUserID = int.Parse(this.txtRealUserID.Text);
sendapp.OurCom = this.ddlOuserCom.SelectedItem.Text;
sendapp.ReceiveComID = int.Parse(this.txtSendCom.Text);
sendapp.Receiver = this.txtLinkman.Text;
sendapp.telephone = this.txtTelphone.Text;
sendapp.mobile = this.txtMobile.Text;
sendapp.sendType = this.ddlTypes.SelectedItem.Text;
BioSendGoodsBLL sendbll = new BioSendGoodsBLL();
int sendid = sendbll.BioSendAppInfo_ADD(sendapp);
if (sendid != 0)
{
string proid = Request["proID"];
string proCount = Request["proCount"];
string ProPrice = Request["ProPrice"];
string invoiceProPice = Request["invoiceProPice"];
string[] proids = proid.Split(',');
string[] proCounts = proCount.Split(',');
string[] ProPrices = ProPrice.Split(',');
string[] invoiceProPices = invoiceProPice.Split(',');
BioSendGoodsPro pro = new BioSendGoodsPro();
pro.SendID = sendid;
if (proids.Length > 0)
{
for (int i = 0; i < proids.Length; i++)
{
pro.ProID = int.Parse(proids[i].ToString());
pro.ProCount = int.Parse(proCounts[i].ToString());
pro.ProPrice = decimal.Parse(ProPrices[i]);
pro.invoiceProPice = decimal.Parse(invoiceProPices[i]);
sendbll.BioSendGoodsProADD(pro);
}
}
}
//Pass:0暂存 1:提交下次审批
TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = sendapp.Subject,
Accepter = int.Parse(txtNetUserId.Text),
AuditingSate = 0,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(txtNetUserId.Text),
FirstSumitTime = DateTime.Now,
FirstTransmitter = int.Parse(Session["Userid"].ToString()),
Mind = this.txtRemark.Text,
Pass = 0,
SumitTime = DateTime.Now,
TaskID = sendid,
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
};
SqlComm.TaskListRecordAdd(tasklistRecord);
ContextUtil.SetComplete();//提交事务
}
catch (Exception ex)
{
ContextUtil.SetAbort();//回滚事务
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('提交数据失败,数据回滚')", true);
}
}
}
暂存数据的页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="addproinfo.aspx.cs" Inherits="BioErpWeb.SendGoods.addproinfo" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="maintable Inupttable" style="width: 900px;">
<tr class="trbar">
<td>
产品名称及规格
</td>
<td>
数量
</td>
<td>
单价
</td>
<td class="style3">
开票价格
</td>
<td>
操作
</td>
</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 type="text" name="proPrice" onkeyup="setvalue(this)" onchange="setvalue(this)"
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>
<input type="button" value="添加一行" style="font-size: 11px;" onclick="addrow()" class="btnchoose" />
</td>
</tr>
</tr>
</table>
</div>
</form>
</body>
</html>
商品销售发货审核修改暂存页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendGoodsPause.aspx.cs" Transaction="Required" Inherits="BioErpWeb.SendGoods.SendGoodsPause" %>
<!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>
<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();
});
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() {
var obj = window.event.srcElement;
if ($("input[name='proName']").length > 1) {
var parenttr = obj.parentNode.parentNode;
$(parenttr).remove();
} else {
alert("至少要有一行数据");
}
}
</script>
<style type="text/css">
.trbar{ background-color:#eeeeee;}
.w80{ width:80px;}
.w100{ width:100px;}
.w150{ width:150px;}
.money{ color:Red;}
</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="w150">
<asp:DropDownList ID="ddlDepartMent" runat="server">
</asp:DropDownList>
</td>
<td class="w80" colspan="2">
制表人
<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>
<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" runat="server" Text="选择" UseSubmitBehavior="false" class="btnchoose"
OnClientClick="showCustomerDialog3()"/>
<asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label>
</td><td style=" width:126px;">
发货单位</td>
<td>
<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>发货类型</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>
手机号码</td>
<td>
<asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
</td>
<td>工作电话</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="button" value="添加一行" style="font-size: 11px;" onclick="addrow()" class="btnchoose" />
<input type="button" value="删除行" onclick="deleterow()" class="btnchoose"/>
</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>
<%
}
%>
</table>
<table class="maintable Inupttable" style=" width:900px;">
<tr>
<td>备注:</td>
<td colspan="5">
<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:Button ID="btnSubmit0" runat="server" Text="暂存"
onclick="btnSubmit0_Click" />
<asp:Button ID="btnSubmit" runat="server" Text="申请审核"
onclick="btnSubmit_Click" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
public partial class SendGoodsPause: BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DepartMentBand();
pageinfobind();
}
}
public DataTable dt;
string taskid = "13";
string listid = "73";
protected void pageinfobind()
{
//string taskid = "8";
//string listid = "72";
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;
dt=SqlComm.GetDataByCondition("dbo.BioSendGoodsPro", "*,ProName=dbo.FN_getProNameByProID(ProID)", " SendID=" + taskid).Tables[0];
}
/// <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
{
BioSendAppInfo sendapp = new BioSendAppInfo();
sendapp.Subject = DateTime.Now.ToString("yyyyMMddhhmmss") + this.lbApplayUser.Text + "的销售发货申请";
sendapp.DepartMentID = int.Parse(this.ddlDepartMent.SelectedValue.ToString());
sendapp.AppUserId = int.Parse(Session["Userid"].ToString());
sendapp.RealUserID = int.Parse(this.txtRealUserID.Text);
sendapp.OurCom = this.ddlOuserCom.SelectedItem.Text;
sendapp.ReceiveComID = int.Parse(this.txtSendCom.Text);
sendapp.Receiver = this.txtLinkman.Text;
sendapp.telephone = this.txtTelphone.Text;
sendapp.mobile = this.txtMobile.Text;
sendapp.sendType = this.ddlTypes.SelectedItem.Text;
BioSendGoodsBLL sendbll = new BioSendGoodsBLL();
int sendid = sendbll.BioSendAppInfo_ADD(sendapp);
if (sendid != 0)
{
string proid = Request["proID"];
string proCount = Request["proCount"];
string ProPrice = Request["ProPrice"];
string invoiceProPice = Request["invoiceProPice"];
string[] proids = proid.Split(',');
string[] proCounts = proCount.Split(',');
string[] ProPrices = ProPrice.Split(',');
string[] invoiceProPices = invoiceProPice.Split(',');
BioSendGoodsPro pro = new BioSendGoodsPro();
pro.SendID = sendid;
if (proids.Length > 0)
{
for (int i = 0; i < proids.Length; i++)
{
pro.ProID = int.Parse(proids[i].ToString());
pro.ProCount = int.Parse(proCounts[i].ToString());
pro.ProPrice = decimal.Parse(ProPrices[i]);
pro.invoiceProPice = decimal.Parse(invoiceProPices[i]);
sendbll.BioSendGoodsProADD(pro);
}
}
}
TaskListRecord tasklistRecord = new TaskListRecord()
{
Subject = sendapp.Subject,
Accepter = int.Parse(txtNetUserId.Text),
AuditingSate = 0,
DepartMentId = int.Parse(this.ddlDepartMent.SelectedValue.ToString()),
FirstAccepter = int.Parse(txtNetUserId.Text),
FirstSumitTime = DateTime.Now,
FirstTransmitter = int.Parse(Session["Userid"].ToString()),
Mind = this.txtRemark.Text,
Pass = 1,
SumitTime = DateTime.Now,
TaskID = sendid,
TaskTableID = (int)TaskNavigateEmun.ProSend,
Transmitter = int.Parse(Session["Userid"].ToString())
};
SqlComm.TaskListRecordAdd(tasklistRecord);
ContextUtil.SetComplete();//提交事务
}
catch (Exception ex)
{
ContextUtil.SetAbort();//回滚事务
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('提交数据失败,数据回滚')", true);
}
//Response.Redirect("~/Web/Desk.aspx");
}
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 btnSubmit0_Click(object sender, EventArgs e)
{
try
{
BioSendAppInfo sendapp = new BioSendAppInfo();
sendapp.Subject = DateTime.Now.ToString("yyyyMMddhhmmss") + this.lbApplayUser.Text + "的销售发货申请";
sendapp.DepartMentID = int.Parse(this.ddlDepartMent.SelectedValue.ToString());
sendapp.AppUserId = int.Parse(Session["Userid"].ToString());
sendapp.RealUserID = int.Parse(this.txtRealUserID.Text);
sendapp.OurCom = this.ddlOuserCom.SelectedItem.Text;
sendapp.ReceiveComID = int.Parse(this.txtSendCom.Text);
sendapp.Receiver = this.txtLinkman.Text;
sendapp.telephone = this.txtTelphone.Text;
sendapp.mobile = this.txtMobile.Text;
sendapp.sendType = this.ddlTypes.SelectedItem.Text;
BioSendGoodsBLL sendbll = new BioSendGoodsBLL();
bool isupdate= SqlComm.UpdateTableByCondition("dbo.BioSendAppInfo", "Subject='" + sendapp.Subject + "',DepartMentID=" + sendapp.DepartMentID + ",AppUserId=" + sendapp.AppUserId + ",RealUserID=" + sendapp.RealUserID + ",OurCom='" + sendapp.OurCom + "',ReceiveComID=" + sendapp.ReceiveComID + ",Receiver='" + sendapp.Receiver + "',telephone='" + sendapp.telephone + "',mobile='" + sendapp.mobile + "',sendType='" + sendapp.sendType + "'", " SendId=" + taskid);
//发货产品,先删除,后添加
SqlComm.DeleteTableByCondition("BioSendGoodsPro", " where SendID=" + taskid);
if (isupdate)
{
string proid = Request["proID"];
string proCount = Request["proCount"];
string ProPrice = Request["ProPrice"];
string invoiceProPice = Request["invoiceProPice"];
string[] proids = proid.Split(',');
string[] proCounts = proCount.Split(',');
string[] ProPrices = ProPrice.Split(',');
string[] invoiceProPices = invoiceProPice.Split(',');
BioSendGoodsPro pro = new BioSendGoodsPro();
pro.SendID =int.Parse(taskid);
if (proids.Length > 0)
{
for (int i = 0; i < proids.Length; i++)
{
pro.ProID = int.Parse(proids[i].ToString());
pro.ProCount = int.Parse(proCounts[i].ToString());
pro.ProPrice = decimal.Parse(ProPrices[i]);
pro.invoiceProPice = decimal.Parse(invoiceProPices[i]);
sendbll.BioSendGoodsProADD(pro);
}
}
}
//Pass:0暂存 1:提交下次审批
SqlComm.UpdateTableByCondition("dbo.TaskListRecord", "Subject ='" + sendapp.Subject + "',Transmitter = '" + int.Parse(Session["Userid"].ToString()) + "',Accepter ='" + int.Parse(txtNetUserId.Text) + "',Mind ='" + this.txtRemark.Text + "',FirstSumitTime ='" + DateTime.Now + "',FirstTransmitter = " + int.Parse(Session["Userid"].ToString()) + ",FirstAccepter = " + int.Parse(txtNetUserId.Text) + ",DepartMentId = " + int.Parse(this.ddlDepartMent.SelectedValue.ToString()) + ",SumitTime = '" + DateTime.Now + "'", " ListID=" + listid);
ContextUtil.SetComplete();//提交事务
}
catch (Exception ex)
{
ContextUtil.SetAbort();//回滚事务
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('提交数据失败,数据回滚')", true);
}
}
}
商品销售发货审核页面:
<%@ 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" "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>
<script src="../Scripts/JqueryDatePicker_ZW.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 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();
});
}
});
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;
$("#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)) {
$(this).parent().parent().find("input[name='txtProCount0']").attr("value", "0");
alert("产品总数已经达到,不能为此产品添加批号");
event.stopPropagation();
}
}
})
//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: 294px" type="text" class="input" size="50" /><input type="hidden" name="proIds" value="' + inputs[1].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="' + boxnum + '" 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="'+inputs[5].value+'" name="PurchaseProID2"/><input type="button" class="btn2" value="删除" onclick="deleterow1()"/><input id="Hidden2" name="proID0" type="hidden" /><input id="Hidden3" name="tb1RowIndex" type="hidden" />';
trbatch += '</td></tr>';
$("#probatchtr").after(trbatch);
}
</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;
}
.style5
{
width: 143px;
}
.style11
{
width: 231px;
}
.style14
{
width: 91px;
}
</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>
<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" runat="server" Text="选择" UseSubmitBehavior="false" class="btnchoose"
OnClientClick="showCustomerDialog3()"/>
<asp:Label ID="lbCustomer" runat="server" Text=""></asp:Label>
</td><td class="style5">
发货单位</td>
<td class="style11">
<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="style14">发货类型</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="style5">
手机号码</td>
<td class="style11">
<asp:TextBox ID="txtMobile" runat="server"></asp:TextBox>
</td>
<td class="style14">工作电话</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 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: 340px;">
订货产品名称及规格(只读)
</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>
<td style="width: 65px;">
</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>
</ContentTemplate>
</asp:UpdatePanel>
</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="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;
string taskid = "8";
string listid = "75";
/// <summary>
/// 是否具备财务权限,默认为Fasle
/// </summary>
public static string isfinance = "false";
public static string isquality = "false";
public static string isprobatch = "false";
/// <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";
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 (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];
//加载历史审批记录
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(Web.UserLogin.user.RoleId==3 &&Web.UserLogin.user.DepartmentId==int.Parse(this.ddlDepartMent.SelectedValue.ToString()))
//{
TaskListInsert();
//}
ContextUtil.SetComplete();
}
catch (Exception ex)
{
ContextUtil.SetAbort();
ClientScript.RegisterStartupScript(this.GetType(),"test","alert('提交失败,数据回滚')",true);
}
}
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);
}
}
}
生成财务账单编号的存储过程:
CREATE PROCEDURE [dbo].[SP_GetBillNo]
@BillNO NVARCHAR(100) OUTPUT,
@ID NVARCHAR(10)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @yyyy NVARCHAR(10)
DECLARE @Month NVARCHAR(10)
DECLARE @Day NVARCHAR(10)
DECLARE @BillNOStr NVARCHAR(100)
SET @yyyy =DATENAME(yyyy,GETDATE())
SET @Month =DATENAME(mm,GETDATE())
SET @Day =DATENAME(dd,GETDATE())
SET @BillNOStr=@yyyy+@Month+@Day+@ID
SELECT @BillNO= @BillNOStr
END
使用输出参数返回生成的流水编号:
/// <summary>
/// 使用输出参数返回生成的流水编号
/// </summary>
/// <param name="ID"></param>
/// <param name="BillNo"></param>
public static string SPGetBillNo(string ID)
{
SqlParameter [] pars=new SqlParameter[]{
new SqlParameter("@BillNO",SqlDbType.NVarChar,50),
new SqlParameter("@ID",ID)
};
pars[0].Direction=ParameterDirection.Output;
DataBaseHelper.SelectSQLReturnObject("SP_GetBillNo", CommandType.StoredProcedure, pars);
return pars[0].Value.ToString();
}
商品销售发货审核

浙公网安备 33010602011771号