CeramicProject/newyt/Module_data/Purchase_Form.aspx

379 lines
19 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="Purchase_Form.aspx.cs" Inherits="Purchase_Form" %>
<!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>
<script type="text/javascript"></script>
<link href="../Css/index.css" rel="stylesheet" type="text/css" />
<link href="../Css/edit.css" rel="stylesheet" type="text/css" />
<script src="../Js/Calendar3.js" type="text/javascript"></script>
<script src="../Jquery-ui/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="../Jquery-ui/js/jquery-ui-1.10.4.custom.js" type="text/javascript"></script>
<link href="../Jquery-ui/css/pepper-grinder/jquery-ui-1.10.4.custom.css" rel="stylesheet" type="text/css" />
<script src="../Js/commonality.js" type="text/javascript"></script>
<link rel="stylesheet" href="../Css/gh-buttons.css" type="text/css"/>
<link rel="stylesheet" href="../Css/prettify.css"/>
<script src="../Js/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
var detailcode = "<%=detailcode %>";
$(document).ready(function () {
if (detailcode == "") {
$("#cgxm").find("td:first").next("td").remove();
}
$("#txt_lianxiren").change(function () {
$("#txt_lianxifangshi").val($(this).find("option:selected").attr("tag"));
var checkText = $(this).find("option:selected").text();
$("#lxrvalue").val(checkText);
})
var lxrcode = "<%=fanhuicode %>";
$("#txt_lianxiren").html(lxrcode);
})
//调用添加方法
function setbcbd() {
$("#<%=severbc.ClientID%>").click();
}
//添加行
function adddetail() {
//给每行的id 赋值上一行的id 加1 不会重复的id;
var hcount = parseFloat($("#cgxm tbody").children().eq($("#cgxm tbody").children().length - 1).attr("id")) + 1;
var detail = "<tr id='" + hcount + "' class='trdetail' name='0'><td width='25px'> <img src='../Images_Folder/Button/tjljh.png' onclick='jianhang(this)' width='25px' height='25px' /></td>";
if (detailcode != "") {
detail += " <td><input type='text' id='sgdh" + hcount + "' readonly Class='inpittxt' /></td>";
}
detail += " <td><input type='text' id='wldh" + hcount + "' readonly Class='inpittxt' onclick='selectwl(" + hcount + ")' /></td>";
detail += " <td><input type='text' id='wlmc" + hcount + "' readonly Class='inpittxt_hx' onclick='selectwl(" + hcount + ")' /></td>";
detail += " <td><input type='text' id='guige" + hcount + "' readonly Class='inpittxt_hx' /></td>";
detail += " <td><input type='text' id='wlpp" + hcount + "' readonly Class='inpittxt_hx' /></td>";
detail += " <td><input type='text' id='danwei" + hcount + "' readonly Class='inpittxt_hx' /></td>";
detail += " <td><input type='text' id='sl" + hcount + "' readonly Class='inpittxt' onkeyup='doubleshuru(this," + hcount + ")' /></td>";
detail += " <td><input type='text' id='dj" + hcount + "' readonly Class='inpittxt' onkeyup='doubleshuru(this," + hcount + ")' /></td>";
detail += " <td><input type='text' id='je" + hcount + "' readonly Class='inpittxt' readonly /></td>";
detail += "<td><input id='cgjd" + hcount + "' readonly class='inpittxt_hx' value='采购途中' style='text-align: center'></td>";
detail += " <td><input type='text' id='bz" + hcount + "' Class='inpittxt' /></td></tr>";
$("#cgxm").append(detail)
}
function jsbzq(hcount) {
var scrq = $("#scrq" + hcount).val();
var year = parseInt(scrq.substring(0, 4)) + 1;
var yeri = scrq.substring(4, scrq.length);
var nyr = year + yeri;
$("#bzrq" + hcount).val(nyr);
}
//选择供应商
function selectgys() {
$("#dialoggys").dialog({
resizable: false,
height: 510,
width: 1230,
modal: true,
close: function () {
$(".ui-widget-overlay").css("display", "none");
}
});
//用来弹出层条件框获取焦点
dialogfocus('ifa_gys');
}
//选择申购单
function selectsgd(hang) {
$("#dialogsgd").attr("tag", hang);
$("#dialogsgd").dialog({
resizable: false,
height: 510,
width: 1230,
modal: true,
close: function () {
$(".ui-widget-overlay").css("display", "none");
}
});
//用来弹出层条件框获取焦点
dialogfocus('ifa_sgd');
}
//选择物料
function selectwl(hid) {
$("#dialog-wuliao").attr("tag", hid);
$("#dialog-wuliao").dialog({
resizable: false,
height: 510,
width: 1230,
modal: true,
close: function () {
$(".ui-widget-overlay").css("display", "none");
}
});
//用来弹出层条件框获取焦点
dialogfocus('ifa_wl');
}
function pd() {
var isreturn = true;
if ($("#txt_gyshao").val() == "") {
$("#z_error").html("请选择供应商");
return false;
} else if ($("#txt_jhriqi").val() == "") {
$("#z_error").html("请填写交货日期");
return false;
} else if ($(".trdetail").length==0) {
$("#z_error").html("请填写详细信息");
return false;
} else if ($(".trdetail").length > 0) {
$("#tr_title").find("td")
if (detailcode == "") {
$(".trdetail").each(function () {
if ($(this).find("td").eq(1).children().val() == '') {
$("#z_error").html("请选择" + $(this).index() + "行物料信息");
isreturn = false;
return false;
}
if ($(this).find("td").eq(6).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行生产日期");
isreturn = false;
return false;
} else if ($(this).find("td").eq(7).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行保质期");
isreturn = false;
return false;
} else if ($(this).find("td").eq(8).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行数量");
isreturn = false;
return false;
} else if ($(this).find("td").eq(9).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行单价");
isreturn = false;
return false;
}
})
} else {
$(".trdetail").each(function () {
if ($(this).find("td").eq(2).children().val() == '') {
$("#z_error").html("请选择" + $(this).index() + "行物料信息");
isreturn = false;
return false;
}
if ($(this).find("td").eq(7).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行生产日期");
isreturn = false;
return false;
} else if ($(this).find("td").eq(8).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行保质期");
isreturn = false;
return false;
} else if ($(this).find("td").eq(9).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行数量");
isreturn = false;
return false;
} else if ($(this).find("td").eq(10).children().val() == '') {
$("#z_error").html("请填写第" + $(this).index() + "行单价");
isreturn = false;
return false;
}
})
}
}
if (!isreturn) {
return false;
}
$("#z_error").html("");
var content = "";
var jsonStr2 = "[";
$(".trdetail").each(function () {
var row = $(this).attr("id");
var idval = $(this).attr("name");
var wlid = $("#wldh" + row).attr("tag");
var sl = $("#sl" + row).val();
var dj = $("#dj" + row).val();
var je = $("#je" + row).val();
var cgjd = $("#cgjd" + row).val();
var bz = $("#bz" + row).val();
if (wlid != "") {
jsonStr2 += "{";
if ($("#sgdh1").length > 0) {
jsonStr2 += "\"sgdid\":\"" + $("#sgdh" + row).attr("tag") + "\",";
}
jsonStr2 += "\"id\":\"" + idval + "\",";
jsonStr2 += "\"wlid\":\"" + wlid + "\",";
jsonStr2 += "\"sl\":\"" + sl + "\",";
jsonStr2 += "\"dj\":\"" + dj + "\",";
jsonStr2 += "\"je\":\"" + je + "\",";
jsonStr2 += "\"cgjd\":\"" + cgjd + "\",";
jsonStr2 += "\"beizhu\":\"" + bz + "\"";
jsonStr2 += "},";
}
})
jsonStr2 = jsonStr2.substring(0, jsonStr2.length - 1);
jsonStr2 += "]";
$("#detailcontent").val(jsonStr2);
}
// 限制输入出数字以外的字符
function doubleshuru(txtval, hcount) {
var tval = $(txtval).val();
if (tval.indexOf('.') == 0) {
$(txtval).val('');
}
if (tval.split(".").length - 1 > 1) {
$(txtval).val(tval.split(".")[0] + '.');
}
$(txtval).val($(txtval).val().replace(/[^0-9.]/g, ''));
var djval = $("#dj" + hcount).val();
var slval = $("#sl" + hcount).val()
var dj = parseFloat(djval).toFixed(4);
var sl = parseFloat(slval).toFixed(4);
if (djval == "" || slval == "") {
$("#je" + hcount).val(0);
} else {
$("#je" + hcount).val(parseFloat(dj * sl).toFixed(4));
}
}
//最近单价
function showdj(obj,hid) {
var index = 0;
var wlbh = $("#wldh" + hid).val();
if (wlbh != "") {
index=$(obj).parent().parent().index();
var htmlcode = Purchase_Form.binddanjia("and wlbh='" + wlbh + "'").value;
$("#tbl_list").html(htmlcode);
if (index == 1) {
$("#div_danjia").animate({
top: 300
}, 100, showdiv());
} else {
$("#div_danjia").animate({
top: (300 + ((index - 1) * 30))
}, 100, showdiv());
}
}
}
function hidedj() {
$("#div_danjia").hide();
}
function showdiv() {
$("#div_danjia").show();
}
</script>
<style type="text/css">
.dj
{
border: 1px dashed rgb(221, 215, 215)
}
</style>
</head>
<body>
<form id="form" runat="server">
<div class="rtbjdiv" >
<div class="add-top" >
<div class="add-top-dh" id="div_listdaohang"><h4>采购单表单页 &nbsp&nbsp</h4><a href="Purchase_list.aspx" id="bt_fhlb" runat="server" style=" width:65px" class="button icon pin">回到列表</a></div>
<div class="add-top-cz" >
<a href="#button" id="bt_tj" onclick="setbcbd()" class="button icon log">保存</a>
<a href="#button" id="chongzhi" onclick="form.reset();" style=" width:60px; " class=" button icon reload">重置表单</a>
<a href="#button" id="fanhui" onclick="history.back();" style=" width:60px; " class="button icon arrowleft">返回上级</a>
<asp:label id="z_error" CssClass="error" runat="server"></asp:label>
</div>
</div>
<div class="alert-tip">
<b>温馨提示:</b>
<p>• 信息表单中加*号红色标题框为必填项,为了可以顺利保存信息,请您注意填写红色栏目中的信息</p>
</div>
<div id="dd_kong" style=" overflow:auto;">
<table class="bule"> <tr class="tdlietou"><td><h4>采购基本信息</h4></td></tr></table>
<table class="tablewk">
<tr><td style=" height:20px" colspan="13"></td></tr>
<tr>
<td class="wktblm">采购单号</td><td><asp:TextBox id="txt_cgdhao" runat="server" CssClass="tbinput_hx" ReadOnly Text="自动生成" ForeColor="Gray" Enabled=false AutoCompleteType=none ></asp:TextBox></td>
<td class="wktblm">采购进度</td><td><asp:DropDownList ID="drp_cgjindu" CssClass="tbinput_xl" runat="server"><asp:ListItem>采购中</asp:ListItem><asp:ListItem>已入库</asp:ListItem></asp:DropDownList></td>
<td class="wktblm"><font>*供应商号</font></td><td><input type=text id="txt_gyshao" runat="server" class="tbinput_bt" onclick="selectgys()" readonly/></td>
<td class="wktblm"><font>*供货单位</font></td><td><input type=text id="txt_ghdanwei" runat="server" class="tbinput_bt" onclick="selectgys()" readonly ></td>
<td class="wktblm">联系人</td><td><asp:DropDownList runat=server ID="txt_lianxiren" CssClass="tbinput_xl"></asp:DropDownList></td>
<td class="wktblm">联系方式</td><td><input type=text id="txt_lianxifangshi" runat="server" class="tbinput_hx" readonly value="" /> </td>
<td class="tdjj5">&nbsp </td>
</tr>
<tr>
<td class="wktblm">发送至</td><td><asp:TextBox id="txt_fasongzhi" runat="server" CssClass="tbinput"></asp:TextBox></td>
<td class="wktblm">运输类型</td><td><asp:TextBox id="txt_yunshuleixing" runat="server" CssClass="tbinput"></asp:TextBox></td>
<td class="wktblm">采购员</td><td><asp:TextBox id="txt_caigouyuan" runat="server" CssClass="tbinput_hx" ReadOnly></asp:TextBox></td>
<td class="wktblm">下单日期</td><td><input type=text id="txt_xdriqi" readonly runat="server" class="tbinput_hx"></td>
<td class="wktblm"><font>*交货日期</font></td><td><input type="text" id="txt_jhriqi" readonly runat="server" class="tbinput_bt" onclick='new Calendar().show(this);' /></td>
<td class="wktblm">审核状态</td><td><input type=text id="txt_shzt" readonly runat="server" class="tbinput_hx"></td>
<td class="tdjj5">&nbsp </td>
</tr>
<tr>
<td class="wktblm">备注</td><td colspan="11"><input name='control_date' type='text' id='txt_beizhu' size='10' maxlength='10' runat=server class="tbinput" /></td>
<td class="tdjj5">&nbsp </td>
</tr>
<tr><td style=" height:20px" colspan="13"></td></tr>
</table>
<table class="bule"> <tr class="tdlietou"><td><h4>采购信息</h4></td></tr></table>
<table id="cgxm" class='bule' >
<tr id="tr_title" class='tbtilt' >
<td width="25px" onclick="adddetail()" > <img src='../Images_Folder/Button/tjltj.png' width='25px' height='25px' /></td>
<td><span>申购单号</span></td>
<td><span><font>物料编号</font></span></td>
<td><span>物料名称</span></td>
<td><span>规格</span></td>
<td><span>物料品牌</span></td>
<td><span>单位</span></td>
<td><span><font>*数量</font></span></td>
<td><span><font>*单价</font></span></td>
<td><span>金额</span></td>
<td><span>采购进度</span></td>
<td><span>备注</span></td>
</tr>
<%=detailcode%>
</table>
</div>
</div>
<div id="dialoggys" title="选择供应商" style="overflow:hidden; display:none;" >
<iframe src="../ddselect/Supplier_list.aspx" frameborder="no" border="0" style="height:500px;width:100%;overflow:hidden" scrolling="no" id="ifa_gys" ></iframe>
</div>
<div id="dialogsgd" title="选择申购单" style="overflow:hidden; display:none;" >
<iframe src="../ddselect/shengoudan.aspx" frameborder="no" border="0" style="height:500px;width:100%;overflow:hidden" scrolling="no" id="ifa_sgd"></iframe>
</div>
<div id="dialog-wuliao" title="选择物料" style="overflow:hidden; display:none;">
<iframe src="../ddselect/MaterialItem_list.aspx" frameborder="no" border="0" style="height:500px;width:100%;overflow:hidden" scrolling="no" id="ifa_wl" ></iframe>
</div>
<div style="height:130px;width:400px;position:absolute;display:none;left:71%;border:1px solid #C0BEBE;background-color:White;overflow-x:hidden;overflow-y:auto" id="div_danjia">
<div id="div_title" class="shujutou">
<table id="biaotou" class="tbl_titie" border="0" style="width:100%;">
<tbody>
<tr id="tr_biaotou" style="background:none repeat scroll 0px 0px #106a9e;color:White;">
<td style="width:28%">下单日期</td>
<td style="width:18%">供应商编号</td>
<td style="width:15%">供应商</td>
<td style="width:18%">物料名称</td>
<td style="width:11%">数量</td>
<td style="width:10%">单价</td>
</tr>
</tbody>
</table >
<table border="0" style="width:100%;" id="tbl_list">
</table>
</div>
</div>
<span style=" display:none"> <asp:button id="severbc" runat="server" CssClass="button bluez small" Text="保存" OnClientClick="return pd()" onclick="bt_tj_Click" ></asp:button> </span>
<asp:HiddenField ID="cgdtype" runat="server" Value="" />
<asp:HiddenField ID="id" runat="server" Value="" />
<asp:HiddenField ID="gysid" runat="server" Value="" />
<input type=hidden id="pagename" value="cgd" />
<asp:HiddenField ID="detailcontent" runat="server" Value="" />
<asp:HiddenField ID="lxrvalue" runat="server" Value="" />
<%--关闭弹出层--%>
<input id="btn_gysclose" style="display:none" type=button onclick="$('#dialoggys').dialog('close');"/>
<input id="btn_sgdclose" style="display:none" type=button onclick="$('#dialogsgd').dialog('close');"/>
<input id="btn_wlclose" style="display:none" type=button onclick="$('#dialog-wuliao').dialog('close');"/>
<script src="../Js/messageshow.js" type="text/javascript"></script>
</form>
</body>
</html>