You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1034 lines
39 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_BuyOut.aspx.cs" Inherits="TradeManage.HuoWu.HW_BuyOut" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title>出库单</title>
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<link rel="stylesheet" type="text/css" href="../themes/uploadify.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/DateBox.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/uploadify/jquery.uploadify.js"></script>
<script src="../Scripts/ajaxfileupload.js" type="text/javascript"></script>
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/jquery.cookies.min.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox2.1/source/jquery.fancybox.css?v=2.1.5"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox2.1/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox2.1/source/jquery.fancybox.js?v=2.1.5"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
var name = "<%=Session["Name"]%>";
var OutId = 0;
var GoodsId = 0;
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
OutId = $.url.param("OutId");
if (OutId == undefined) {
OutId = 0;
}
if (getCookie("yy_storeid") != null)
$('#select_ck').val(getCookie("yy_storeid"));
if (OutId == 0)
GetOutCode();
GetCKYY();
$("#txtInName").val(name);
CreateDataGrid();
CreateDataGrid2();
if (OutId > 0) {
$("#cmdPrint,#cmdSave2").show();
$("#cmdSave").hide();
$("#div1").show();
$("#test").hide();
ReadGoodsDetail2();
GetOutModel();
}
$("#btn_add").bind("click", function () {
closeOpen2();
});
$("#btn_Save").bind("click", function () {
AddCKOut();
});
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdBack").bind("click", function () {
window.location.href = "HW_BuyOutList.aspx";
});
// ReadGoods();
$("#select_ck").bind("change", function () {
ReadGoodsDetail();
});
$("input[sid]").live("keyup", function () {
var sid = $(this).attr("sid");
var pid = $(this).attr("pid");
GetPrice(sid,pid);
});
$("input[sid2]").live("keyup", function () {
var sid= $(this).attr("sid2");
var pid = $(this).attr("pid2");
GetPrice(sid,pid);
});
$("#" + datagrid2.TableID + " [CommandName='cmdAdd']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid2.Get_Model(RowIndex);
AddCart(model);
});
$("#" + datagrid2.TableID + " [CommandName='cmdDel']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid2.Get_Model(RowIndex);
DelCart(model);
});
});
var outmd = null;
function GetOutModel() {
var param = new Object();
param.OutId = OutId;
$.ajax({
url: "../HuoWuServiceNew.asmx/GetOutCKModelBuy",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
outmd = data.d;
$("#txtOutCode").html(data.d.OutCode);
$("#txtOutReason").val(data.d.OutReason);
$("#txtRemark").val(data.d.Remark);
$("#txtInName").val(data.d.InName);
$("#txtName").val(data.d.BuyName);
$("#txtPhone").val(data.d.BuyPhone);
if (data.d.IsDelete == 2) {
$("#cmdSave2").hide();
$("#cmdSave").hide();
$("input[sc='del']").hide();
}
}
}
});
}
function ReadGoodsDetail2() {
var param = new Object();
param.OutId = OutId;
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/GetOutCKDetailListBuy",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
datagrid1.DataBind(data.d);
}
});
}
function setCookie(c_name, c_value) {
var Days = 30; //此 cookie 将被保存 30 天
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = c_name + "=" + escape(c_value) + ";expires=" + exp.toGMTString();
//alert(document.cookie);
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
var c_start = document.cookie.indexOf(c_name + "=")
if (c_start != -1) {
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length//
//document.write(document.cookie.substring(c_start,c_end)+"<br>");
return unescape(document.cookie.substring(c_start, c_end))
}
}
else return null;
}
function delCookie(name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = getCookie(name);
if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
var zje = 0;
function GetPrice(sid, pid) {
var dj = $("input[sid="+ sid+"][pid="+pid+"]").attr("sjg");
var sl = $("input[sid=" + sid + "][pid=" + pid + "]").val();
var zk = $("input[sid2=" + sid + "][pid2=" + pid + "]").val();
if (dj != "" && sl != "" && zk != "") {
if (parseFloat(zk)>= 0&&parseFloat(dj)>=0) {
dj = dj * (100 - zk) * 0.01;
}
if (parseInt(sl) >= 0) {
$("span[sid3=" + sid + "][pid3=" + pid + "]").html((parseInt(sl) * dj).toFixed(1));
}
}
var hj = 0;
$("span[sid3]").each(function () {
if ($(this).html() != "" && parseFloat($(this).html())>0) {
hj += parseFloat($(this).html());
}
});
zje = hj;
$("#f_hj").html("Total"+(hj).toFixed(1)+"$");
}
function GetCKYY() {
$("#txtOutReason").append("<option value='线下销售'>线下销售</option>");
return;
var param = new Object();
param.CompanyID = 0;
param.KeyName = "ckyy";
$.ajax({
url: "../UserService.asmx/GetListBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
$("#txtOutReason").append("<option value='" + this.Name + "'>" + this.Name + "</option>");
});
}
}
});
}
function GetChaseModel() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetPurchaseModel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
$("#a_cgdh").html(data.d.ChaseCode);
$("#txtBuyCode").val(data.d.BuyCode);
$("#txt_yfhj").val(data.d.PostFee);
$("#txt_bzxx").val(data.d.Remark);
if (data.d.BuyDate!=null)
$("#txt_cgrq").val(data.d.BuyDate.localeFormat("yyyy-MM-dd"));
if (data.d.DoneDate != null)
$("#txt_yjdhrq").val(data.d.DoneDate.localeFormat("yyyy-MM-dd"));
$("#txt_gys").val(data.d.Supplier);
$("#txt_lxfs").val(data.d.SupplierPhone);
$("#txtInName").val(data.d.InName);
$("#txt_gmzh").val(data.d.Account);
$("#a_hjsl").html(data.d.GoodsNum);
$("#a_hjje").html(data.d.GoodsMoney);
}
}
});
}
function GetOutCode() {
$.ajax({
url: "HuoWuService.asmx/GetOutCode",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#txtOutCode").html(data.d)
}
}
});
}
var GoodsList=null;
function ReadGoods() {
// var param = new Object();
$.ajax({
url: "CaiGouService.asmx/GetSNGoods",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
GoodsList = data.d;
$(data.d).each(function () {
$("#select_hwlx").append("<option value=" + this.GoodsId + ">" + this.GoodsCode +"["+this.GoodsName+"]</option>");
});
}
}
});
}
function ClearGoods() {
if (window.confirm('Are you sure you want to empty the shopping cart') == false) return;
CKOutlist = new Array();
$("img[cart_no=1]").hide();
$("img[cart=1]").show();
$("#sp_num").html(CKOutlist.length);
}
function AddGoods() {
if ($("#txt_hwbhmc").val() == "")
{
alert("请输入要查询的条件");
return;
}
ReadGoodsDetail();
}
var CKOutlist = new Array();
function AddCart(cmd)
{
var did = cmd.DetailId;
var flag = false;
var sid = cmd.StoreId;
var pid = cmd.PostionId;
$(CKOutlist).each(function () {
var rdid = this.DetailId;
var rsid = this.StoreId;
var rpid = this.PostionId;
if (did == rdid && sid == rsid && pid == rpid) {
flag = true;
}
});
if (flag == false) {
cmd.OutNum = 1;
Array.add(CKOutlist, cmd);
}
if (CKOutlist != null && CKOutlist.length>0) {
$(CKOutlist).each(function () {
var rdid = this.DetailId;
var rpid = this.PostionId;
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart_no=1]").show();
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart=1]").hide();
});
}
$("#sp_num").html(CKOutlist.length);
}
function DelCart(cmd)
{
var did = cmd.DetailId;
var flag = false;
var sid = cmd.StoreId;
var pid = cmd.PostionId;
$(CKOutlist).each(function (i) {
var rdid = this.DetailId;
var rsid = this.StoreId;
var rpid = this.PostionId;
if (did == rdid && pid == rpid) {
Array.removeAt(CKOutlist, i);
}
});
$("img[cart_no=1]").hide();
$("img[cart=1]").show();
if (CKOutlist != null && CKOutlist.length>0) {
$(CKOutlist).each(function () {
var rdid = this.DetailId;
var rpid = this.PostionId;
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart_no=1]").show();
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart=1]").hide();
});
}
$("#sp_num").html(CKOutlist.length);
}
function AddCKOut()
{
//var slist=datagrid2.GetSelectListModel();
//if (slist == null || slist.length == 0)
//{
// alert("Please select at least one item");
// return;
//}
//datagrid1.UpdateDataSource();
//$(slist).each(function () {
// var did = this.DetailId;
// var flag = false;
// var sid = this.StoreId;
// var pid = this.PostionId;
// $(CKOutlist).each(function () {
// var rdid = this.DetailId;
// var rsid = this.StoreId;
// var rpid = this.PostionId;
// if (did == rdid && sid == rsid && pid == rpid) {
// flag = true;
// }
// });
// if (flag == false) {
// Array.add(CKOutlist, this);
// }
//});
if (CKOutlist == null || CKOutlist.length == 0) {
alert("Please select at least one item");
return;
}
datagrid1.DataBind(CKOutlist);
$("input[precision]").MaskedTextBox();
$("#div1").show();
$("#test").hide();
}
function GetGoodsOutCK(DetailId,obj) {
var param = new Object();
param.DetailId = DetailId;
$.ajax({
url: "HuoWuService.asmx/GetGoodsOutCK",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
obj.GoodsOutCKList=data.d;
Array.add(CKOutlist, obj);
BindDg1();
}
});
}
function GetCkHtml()
{
$(CKOutlist).each(function () {
if (this.GoodsOutCKList != null && this.GoodsOutCKList.length > 0) {
var shtml = "<table width='95%'>";
$(this.GoodsOutCKList).each(function () {
var store = this.StoreName;
if (this.PostionDesc!= null)
store = this.StoreName + " " + this.PostionDesc;
shtml += "<tr><td>" + store + " 允许出库数:" + this.GoodsNum + " 出库:<input type='text' min='0' max='" + this.GoodsNum + "' precision='0' style='width:50px;' class='editTextbox' did='" + this.DetailId + "' sid='" + this.StoreId + "' pid='" + this.PostionId + "' value='" + this.OutNum + "'/></td></tr>";
});
shtml += "</table>";
$("div[did='" + this.DetailId + "']").html(shtml);
}
});
//<table width='95%'><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr><tr><td>仓库--mt1 库存10 出库:<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/></td></tr></table>
}
function BindDg1()
{
datagrid1.DataBind(CKOutlist);
GetCkHtml();
$("input[precision]").MaskedTextBox();
}
function ReadGoodsDetail() {
var param = new Object();
param.GoodsCode = $("#txt_hwbhmc").val();
param.StoreId = $("#select_ck").val();
setCookie('yy_storeid', $("#select_ck").val());
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/GetGoodsOutDetailNew",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d == null)
{
alert("Insufficient inventory of goodsPlease modify the selling quantity");
}
datagrid2.DataBind(data.d);
if (CKOutlist != null) {
$(CKOutlist).each(function () {
var rdid = this.DetailId;
var rpid = this.PostionId;
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart_no]").show();
$("img[rdid=" + rdid + "][rpid=" + rpid + "][cart]").hide();
});
}
}
});
}
var Urllist = new Array();
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
$("#txt_hwbhmc").val("");
}
});
}
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Image";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Name";
col.CellTemplate = "<span>{Bind GoodsName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Code";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid1.Columns, col);
//col = new nblf.ui.DataGridColumn();
//col.HeaderText = "编号(老)";
//col.CellTemplate = "<span>{Bind GoodsOldCode}</span>";
//Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<span>{Bind SKU1}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products describe";
col.CellTemplate = "<span>{Bind TypeDesc}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Storage Location";
col.CellTemplate = "<span>{Bind StoreName}【{Bind PostionDesc}】</span>";
Array.add(datagrid1.Columns, col);
if (OutId == 0) {
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Inventory";
col.CellTemplate = "<span>{Bind GoodsNum}</span>";
Array.add(datagrid1.Columns, col);
}
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Unit Price";
col.CellTemplate = "<span>{Bind Price}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Selling Quantity";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='10000' sid='{Bind DetailId}' pid='{Bind PostionId}' sjg='{Bind Price}' precision='0' style='width:50px;' class='editTextbox' ColName='OutNum' value='{Bind OutNum}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Discount";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='100' sid2='{Bind DetailId}' pid2='{Bind PostionId}' precision='0' style='width:50px;' class='editTextbox' ColName='OffPrice' value='{Bind OffPrice}'/>% Off";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Total price";
col.CellTemplate = "<span sid3='{Bind DetailId}' pid3='{Bind PostionId}'>{Bind FinalPrice}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Operation";
col.Width = "150px";
col.CellTemplate = "<input onclick='DelGoods(this)' sc='del' class='btnClass dgbtnDel' type='button' value='Delete'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
}
function DelGoods(obj) {
if (window.confirm('Are you sure you want to delete') == false) return;
datagrid1.UpdateDataSource();
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.Id = model.Id;
//if (model.Id > 0) {
// $.ajax({
// url: "CaiGouService.asmx/DeletePurchaseGoods",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
// dataType: "json",
// success: function (data) {
// }
// });
//}
alert("delete success");
datagrid1.Del_Row(rowindex);
// heji();
//hesl();
}
var cartlist;
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Image";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind FirstImgUrl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Name";
col.CellTemplate = "<span>{Bind GoodsName}</span>";
Array.add(datagrid2.Columns, col);
//col = new nblf.ui.DataGridColumn();
//col.HeaderText = "Products Code";
//col.CellTemplate = "<span>{Bind GoodsOldCode}</span>";
//Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products Code";
col.CellTemplate = "<span>{Bind GoodsCode}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<span>{Bind SKU1}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Products describe";
col.CellTemplate = "<span>{Bind TypeDesc}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Storage Location";
col.CellTemplate = "<span>{Bind StoreName}【{Bind PostionDesc}】</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Inventory";
col.CellTemplate = "<span>{Bind GoodsNum}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "selling Unit Price";
col.CellTemplate = "<span>{Bind Price}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "Operation";
col.Width = "100px";
col.CellTemplate = "<img CommandName='cmdAdd' src='../image/cart.png' rdid='{Bind DetailId}' rpid='{Bind PostionId}' cart='1' width='50px' height='50px' title='Add Cart' /> <img CommandName='cmdDel' src='../image/cart_no.png' rdid='{Bind DetailId}' rpid='{Bind PostionId}' cart_no='1' width='50px' height='50px' title='Delete Cart' style='display:none'/>";
Array.add(datagrid2.Columns, col);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid2.SelectMode = nblf.ui.SelectMode.None;
datagrid2.Init();
var rdid = this.DetailId;
}
function DelPost(obj) {
if (window.confirm('Are you sure you want to delete') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid3.Get_Model(rowindex);
param.Id = model.Id;
if (model.Id > 0) {
$.ajax({
url: "CaiGouService.asmx/DeletechasePost",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
}
});
}
alert("删除成功");
datagrid3.Del_Row(rowindex);
}
function heji() {
var je = 0;
$("input[ColName='BuyMoney']").each(function () {
if ($(this).val() != "") {
je += parseFloat($(this).val());
}
});
$("#a_hjje").html(je.toFixed(2));
}
function hesl() {
var sl = 0;
$("input[ColName='BuyNum']").each(function () {
if ($(this).val() != "") {
sl += parseInt($(this).val());
}
});
$("#a_hjsl").html(sl);
}
function save(state) {
//if ($("#txtInDate").val() == "") {
// alert("请填写出库日期");
// return;
//}
datagrid1.UpdateDataSource();
if (datagrid1.DataSource.length == 0) {
alert("Please select at least one item");
return;
}
var mess = "";
$(datagrid1.DataSource).each(function () {
if (this.OutNum == null) {
mess="Out Quantity cannot be empty";
}
});
if (mess != "") {
alert(mess);
return;
}
$("#cmdSave").attr("disabled", "disabled");
var List = new Array();
var param = new Object();
var model = new Object();
if (outmd != null)
model = outmd;
model.OutCode = $("#txtOutCode").html();
model.OutReason = $("#txtOutReason").val();
model.BuyName = $("#txtName").val();
model.BuyPhone = $("#txtPhone").val();
model.Remark = $("#txtRemark").val();
model.InName = $("#txtInName").val();
model.Price = zje;
param.model = model;
param.state = state;
param.CKList = datagrid1.DataSource;
$.ajax({
url: "../HuoWuServiceNew.asmx/SaveGoodsOutBuy",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
$("#cmdSave").removeAttr("disabled");
if (data.d.OutReason != null && data.d.OutReason != "") {
alert("Error:" + data.d.OutReason);
}
else {
alert("Submitted successfully,After the goods are delivered,Please click Confirm Delivery");
ClearGoods();
window.location.href = "HW_BuyOut.aspx?OutId=" + data.d.OutId;
}
}
});
}
function ExportData() {
var param = new Object();
param.outid = OutId;
var fname =$("#txtOutCode").html()+".xls";
$.ajax({
url: "../HuoWuServiceNew.asmx/GetListBuyOutExcel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
params = { FilePath: data.d, FileName: fname };
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
}
});
}
function closeOpen()
{
$("#div1").show();
$("#test").hide();
}
function closeOpen2()
{
$("#div1").hide();
$("#test").show();
}
</script>
</head>
<body class="headbody">
<div>
<div id="test" title="出库货物" style="width:99%;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 110px;" class="f1">
Products Code/SKU
</td>
<td align="left" >
<input id="txt_hwbhmc" class="editTextbox" style="width:120px;" type="text" />
</td>
<td style="width: 110px;" class="f1">
Warehouse:
</td>
<td align="left" >
<select id="select_ck" class="selectClass" style="width: 140px" name="D1">
<option value="6">RANCHO(West)</option>
<option value="9">JD</option>
<option value="11">E仓East)</option>
</select>
</td>
<td><input id="Button1" type="button" value="Query" class="btnClass btnClassFind" onclick="AddGoods();"/> <input id="Button2" type="button" value="Clear Cart" class="btnClass btnClassDel" onclick="ClearGoods();"/></td>
</tr>
<tr>
<td colspan="5" style="font-size:15pt;color:red">
Cart<span id="sp_num">0</span></td>
</tr>
<tr>
<td align="left" colspan="5">
<div id="DataGrid2" style="height:500px;overflow:auto"></div>
</td>
</tr>
<tr>
<td align="center" colspan="5">
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="Confirm Selection" /> <input id="btn_Close" type="button" class="btnClass btnClassDel" value="Close" onclick="closeOpen()" />
</td>
</tr>
</table>
</div>
</div>
<div id="div1" style="display:none">
<div class="title_ico">
sales slip</div>
<table border="1" cellpadding="0" cellspacing="0" style="width:99%;" align="center" class="tableAll">
<tr>
<td colspan="4" align="center" style="font-size:18pt;font-weight:bolder">
Sales Slip</td>
</tr>
<tr>
<td style="width:120px" class="f1">
<font color="red" style="font-weight:bolder">*</font> Order Code
</td>
<td>
<a id="txtOutCode"></a>
</td> <td style="width:120px" class="f1">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="width:120px" class="f1">
Purchaser Name:</td>
<td>
<input id="txtName" type="text" style="width:200px;" class="editTextbox"/></td> <td style="width:120px" class="f1">
Purchaser Phone:</td>
<td> <input id="txtPhone" type="text" style="width:200px;" class="editTextbox" /></td>
</tr>
<tr>
<td style="width:120px" class="f1">
Reason for delivery</td>
<td>
<select id="txtOutReason" class="selectClass" style="width:200px;"></select></td> <td style="width:120px" class="f1">
Operator
</td>
<td> <input id="txtInName" type="text" style="width:200px;" class="editTextbox" disabled="disabled"/>
</td>
</tr>
<tr>
<td style="width:120px" class="f1">
Remark</td>
<td colspan="3">
<textarea id="txtRemark" cols="100" rows="4" style="width:90%"></textarea>
</td>
</tr>
<tr>
<td style="width:120px" class="f1">
Commodity list</td>
<td colspan="3"> <a id="btn_add"
style="cursor: pointer; text-decoration: underline; color: blue;">
<img alt="" src="../images/add.ico" />Select Add Item</a>&nbsp;&nbsp;&nbsp;&nbsp;<font style="font-size:15pt" color="red" id="f_hj"></font>&nbsp;&nbsp;&nbsp;<br />
<div id="DataGrid1" class="DataGridStyle"></div></td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" type="button" value="Save" class="btnClass btnClassSave" onclick="save(0);" />&nbsp;&nbsp;
<input id="cmdPrint" type="button" value="Export List" class="btnClass btnClassEdit" onclick="ExportData();" style="display:none" /> <input id="cmdSave2" type="button" value="Confirm Delivery" class="btnClass btnClassEdit" onclick="save(2);" style="display:none"/>&nbsp;
<input id="cmdBack" type="button" value="Return" class="btnClass btnClassBack" />&nbsp;
</td>
</tr>
</table>
</div>
</body>
</html>