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.

1262 lines
43 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseAdd.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseAdd" %>
<!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/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></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 datagrid3 = new nblf.ui.DataGrid("DataGrid3");
var IsNeed = 0;
var ChaseId = 0;
var GoodsId = 0;
var SupplierId = 0;
var Title = "采购参考";
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
$("#btn_add").bind("click", function () {
fopen();
});
IsNeed = $.url.param("IsNeed");
if (IsNeed == undefined) {
IsNeed = 0;
}
ChaseId = $.url.param("ChaseId");
if (ChaseId == undefined) {
ChaseId = 0;
}
SupplierId = $.url.param("SupplierId");
if (SupplierId == undefined) {
SupplierId = 0;
}
Title = $.url.param("Title");
if (Title == undefined) {
Title = "采购参考";
}
ReadBuyUser();
GoodsId = $.url.param("GoodsId");
if (GoodsId == undefined) {
GoodsId = 0;
}
if (ChaseId == 0)
GetCGCode();
GetBasePost();
//$("#txtInName").val(name);
CreateDataGrid();
CreateDataGrid2();
CreateDataGrid3();
GetCheck();
var dd = new Date();
$("#txt_cgrq").val(dd.getFullYear() + "-" + (dd.getMonth() + 1) + "-" + dd.getDate());
$("#chk_yccg").bind("click", function () {
if ($(this).is(":checked") == true)
SelectNoGoods();
else
SelectYesGoods();
});
$("#btn_Save").bind("click", function () {
AddBuy();
});
$("#btn_Cancel").bind("click", $.fancybox.close);
$("#cmdSavekddh").bind("click", function () {
AddPostCode();
});
// ReadGoods();
$("input[ColName='BuyNum']").live("keyup", function () {
hesl();
heji();
});
$("input[ColName='BuyMoney']").live("keyup", function () {
hesl();
heji();
});
if (SupplierId > 0)
{
GetSupplierModel();
GetBuyGoodsDetailForSupp();
}
else if (GoodsId > 0)
GetBuyGoodsDetail();
if (ChaseId > 0) {
GetChaseModel();
GetChaseGoodsDetail();
GetPost();
}
$("#cmdBack").bind("click", function () {
//window.history.go(-1);
window.parent.CloseTab("新增采购", Title);
});
$("#chk_xycg").bind("click", function () {
ReadGoodsDetail();
});
$("#txt_yfhj").MaskedTextBox();
//KeyEvent();
$('#kw').bind("input propertychange", function () {
getContent(this);
});
});
function GetSupplierModel() {
var param = new Object();
param.SupplierId=SupplierId;
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetSupplierModel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$("#txt_gys").val(data.d.SupplierName);
if (data.d.LinkUrl != null && data.d.LinkUrl != "")
{
if (data.d.LinkUrl.indexOf("http") >= 0 || data.d.LinkUrl.indexOf("HTTP") >= 0)
$("#a_shop").attr("href", data.d.LinkUrl);
else
$("#a_shop").attr("href","http://"+data.d.LinkUrl);
$("#a_shop").show();
}
}
}
});
}
function KeyEvent() {
$(document).keydown(function (e) {
e = e || window.event;
var keycode = e.which ? e.which : e.keyCode;
if (keycode == 38) {
if (jQuery.trim($("#append").html()) == "") {
return;
}
movePrev();
} else if (keycode == 40) {
if (jQuery.trim($("#append").html()) == "") {
return;
}
$("#kw").blur();
if ($(".item").hasClass("addbg")) {
moveNext();
} else {
$(".item").removeClass('addbg').eq(0).addClass('addbg');
}
} else if (keycode == 13) {
dojob();
}
});
var movePrev = function () {
$("#kw").blur();
var index = $(".addbg").prevAll().length;
if (index == 0) {
$(".item").removeClass('addbg').eq($(".item").length - 1).addClass('addbg');
} else {
$(".item").removeClass('addbg').eq(index - 1).addClass('addbg');
}
}
var moveNext = function () {
var index = $(".addbg").prevAll().length;
if (index == $(".item").length - 1) {
$(".item").removeClass('addbg').eq(0).addClass('addbg');
} else {
$(".item").removeClass('addbg').eq(index + 1).addClass('addbg');
}
}
var dojob = function () {
$("#kw").blur();
var value = $(".addbg").text();
$("#kw").val(value);
$("#append").hide().html("");
}
}
var Skulist = new Array();
function GetGoodsSelect() {
if (jQuery.trim($("#kw").val()) == "")
return;
var param = new Object();
param.Type = $("#select_type").val();
param.SKU = $("#kw").val();
WindowLoadModel.Show();
$.ajax({
url: "../DingDan/DD_OrderService.asmx/GetGoodsModelFromType",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
Skulist = data.d;
}
}
});
}
function getContent(obj) {
var kw = jQuery.trim($(obj).val());
if (kw == "") {
$("#append").hide().html("");
return false;
}
var html = "";
GetGoodsSelect();
if (Skulist != null && Skulist.length > 0) {
$(Skulist).each(function () {
if (this.GoodsName.toUpperCase().indexOf(kw) >= 0 || this.GoodsName.toLowerCase().indexOf(kw) >= 0) {
html = html + "<div class='item' onmouseenter='getFocus(this)' onClick='getCon(this);' dname='" + this.GoodsName + "' >" + this.GoodsName + "</div>"
}
});
}
if (html != "") {
$("#append").show().html(html);
} else {
$("#append").hide().html("");
}
}
function getFocus(obj) {
$(".item").removeClass("addbg");
$(obj).addClass("addbg");
}
function getCon(obj) {
var value = $(obj).text();
$("#kw").val(value);
$("#append").hide().html("");
if ($("#kw").val() != "")
ReadGoodsDetail();
}
//#region 读取
function ReadBuyUser() {
$("#select_gmzh").append("<option value='0'>选择</option>");
var param = new Object();
param.CompanyID = 0;
param.KeyName = "cgzh";
$.ajax({
url: "../UserService.asmx/GetListBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
$("#select_gmzh").append("<option value='" + this.Name + "'>" + this.Name + "</option>");
});
}
}
});
}
var Nobuylist = new Array();
function SelectNoGoods() {
datagrid1.UpdateDataSource();
$(buylist).each(function () {
if (this.BuyNum != "" && this.BuyNum <= 0) {
Array.add(Nobuylist, this);
Array.remove(buylist, this);
}
});
BindDg1();
}
function SelectYesGoods() {
if (Nobuylist == null || Nobuylist.length == 0) {
return;
}
$(Nobuylist).each(function () {
var did = this.DetailId;
var flag = false;
$(buylist).each(function () {
var rdid = this.DetailId;
if (did == rdid) {
flag = true;
}
});
if (flag == false) {
Array.add(buylist, this);
Array.remove(Nobuylist, this);
}
});
BindDg1();
}
function GetBasePost() {
var param = new Object();
param.CompanyID = 0;
param.KeyName = "gnkd";
WindowLoadModel.Show();
$.ajax({
url: "../UserService.asmx/GetListBaseCode",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function () {
$("#select_post").append("<option value='" + this.ID + "'>" + 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);
}
}
});
}
var PostCodeList = new Array();
function AddPostCode() {
if ($("#txt_kddh").val() == "") {
alert("请输入快递单号");
return;
}
var md = new Object();
md.Id = 0;
md.PostCode = $("#txt_kddh").val();
md.PostName = $("#select_post option:selected").text();
md.PostId = $("#select_post").val();
Array.add(PostCodeList, md);
datagrid3.DataBind(PostCodeList);
$("#txt_kddh").val("");
}
function GetCheck() {
var param = new Object();
param.StepNo = 1;
$.ajax({
url: "CaiGouService.asmx/GetCheckConfig",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#a_check").html("下一步审批人:");
$(data.d).each(function () {
$("#select_Check").append("<option value=" + this.UserId + ">" + this.Name + "</option>");
});
}
else {
$("#a_check").html("您公司还未设置采购审批功能,采购单无需审批");
$("#select_Check").hide();
}
}
});
}
function GetCGCode() {
$.ajax({
url: "CaiGouService.asmx/GetCGGCode",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#a_cgdh").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 AddGoods() {
$("#append").hide().html("");
if ($("#chk_xycg").is(":checked") == false && $("#kw").val() == "") {
alert("请输入要查询的条件或者选择列出当前需缺货的商品");
return;
}
ReadGoodsDetail();
}
var buylist = new Array();
function AddBuy() {
var slist = datagrid2.GetSelectListModel();
if (slist == null || slist.length == 0) {
alert("请选择要购买的物品");
return;
}
datagrid1.UpdateDataSource();
$(slist).each(function () {
var did = this.DetailId;
var flag = false;
$(buylist).each(function () {
var rdid = this.DetailId;
if (did == rdid) {
flag = true;
}
});
if (flag == false)
Array.add(buylist, this);
});
BindDg1();
$.fancybox.close();
}
function BindDg1() {
datagrid1.DataBind(buylist);
heji();
hesl();
$("input[ColName='BuyNum']").MaskedTextBox();
$("input[ColName='BuyMoney']").MaskedTextBox();
}
function ReadGoodsDetail() {
var param = new Object();
param.Type = $("#select_type").val();
param.IsLeft = 0;
if ($("#chk_xycg").is(":checked") == true)
param.IsLeft = 1;
param.GoodsCode = $("#kw").val();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetGoodsSPDetailFromType",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
WindowLoadModel.Hide();
datagrid2.DataBind(data.d);
}
});
}
function GetBuyGoodsDetail() {
var param = new Object();
param.GoodsId = GoodsId;
$.ajax({
url: "CaiGouService.asmx/GetGoodsSPDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
buylist = data.d;
BindDg1();
if (IsNeed == 1) {
$("#chk_yccg").attr("checked", "checked")
SelectNoGoods();
}
}
}
});
}
function GetBuyGoodsDetailForSupp() {
var param = new Object();
param.SupplierId = SupplierId;
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetGoodsForSupplier",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
buylist = data.d;
BindDg1();
if (IsNeed == 1) {
$("#chk_yccg").attr("checked", "checked")
SelectNoGoods();
}
WindowLoadModel.Hide();
}
}
});
}
function GetChaseGoodsDetail() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetPurchaseGoodsList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
buylist = data.d;
BindDg1();
}
}
});
}
function GetPost() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetchasePostList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
PostCodeList = data.d;
datagrid3.DataBind(PostCodeList);
}
}
});
}
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 = "货物编号";
col.CellTemplate = "<a>{Bind GoodsCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<a>{Bind GoodsName}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "型号";
col.CellTemplate = "<a>{Bind TypeCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "SKU";
col.CellTemplate = "<a>{Bind SKU1}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "描述";
col.CreateFieldSpan("TypeDesc", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "库存数量";
col.CreateFieldSpan("GoodsNum", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买在途";
// col.Width = "100px";
col.CreateFieldSpan("GoodsInNum", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "订单需求";
// col.Width = "100px";
col.CreateFieldSpan("GoodsPlanNum", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "剩余参考";
// col.Width = "100px";
col.CreateFieldSpan("GoodsLeftNum", "");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购单价";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='10000000' precision='2' style='width:50px;' class='editTextbox' ColName='BuyMoney' value='{Bind BuyMoney}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购数量";
// col.Width = "100px";
col.CellTemplate = "<input type='text' min='0' max='10000000' precision='0' style='width:50px;' class='editTextbox' ColName='BuyNum' value='{Bind BuyNum}'/>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "150px";
col.CellTemplate = "<input onclick='DelGoods(this)' class='btnClass dgbtnDel' type='button' value='删除'></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('确定要删除吗?') == 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("删除成功");
datagrid1.Del_Row(rowindex);
heji();
hesl();
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "货物名称";
col.CellTemplate = "<span>{Bind GoodsName}<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 = "型号描述";
col.CellTemplate = "<span>{Bind TypeDesc}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "当前库存";
col.CellTemplate = "<span>{Bind GoodsNum}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买途中";
col.CellTemplate = "<span>{Bind GoodsInNum}<span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "订单需求";
// col.Width = "100px";
col.CreateFieldSpan("GoodsPlanNum", "");
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "剩余参考数";
col.CellTemplate = "<span>{Bind GoodsLeftNum}<span>";
Array.add(datagrid2.Columns, col);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid2.SelectMode = nblf.ui.SelectMode.CheckBox;
datagrid2.Init();
}
function CreateDataGrid3() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "快递公司";
col.CellTemplate = "<span>{Bind PostName}<span>";
Array.add(datagrid3.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "快递单号";
col.CellTemplate = "<span>{Bind PostCode}<span>";
Array.add(datagrid3.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "100px";
col.CellTemplate = "<input onclick='DelPost(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid3.Columns, col);
datagrid3.IsFixHeader = false;
datagrid3.ShowIndexColumn = false;
datagrid3.AllowPaging = false;
//datagrid1.Height = "260px";
datagrid3.SelectMode = nblf.ui.SelectMode.None;
datagrid3.Init();
}
function DelPost(obj) {
if (window.confirm('确定要删除吗?') == 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) {
if (window.confirm('确定要删除吗?') == false) return;
}
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);
}
var Imgs = new Array();
function uploadimg() {
$('#fuContainer').uploadify({
langFile: "../Scripts/uploadify/uploadify-lang-zh_CN.js",
swf: '../Scripts/uploadify/uploadify.swf',
uploader: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=attached/images',
checkExisting: '../GlobalAshx/UploadifyCheck.ashx',
cancelImage: '../themes/default/images/tabs_close.gif',
buttonText: '选择图片',
method: 'post',
requeueErrors: true,
auto: true,
multi: true, //是否允许多文件上传
sizeLimit: 0, //控制上传文件的大小单位byte
fileTypeDesc: '*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.ico;',
fileTypeExts: '*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.ico;',
height: 20, //浏览按钮高
uploadLimit: 999, //同时上传多小个文件
queueSizeLimit: 999, //队列允许的文件总数
successTimeout: 999,
removeCompleted: true, //当上传成功后是否将该Item删除
// 'scriptData': {'name':'ssd','id':'123'},
// 'folder':'1',
onUploadSuccess: function (event, response, status) {
if (response == "") return;
var DataModel = Sys.Serialization.JavaScriptSerializer.deserialize(response);
//var FileId = DataModel.Id;
var Url = "../attached/images/" + DataModel.FileName;
//var model = new Object();
//model.FileId = FileId;
//var FactName = DataModel.FactName.substring(0, DataModel.FactName.length - 4);
//model.PhotoName = FactName;
//model.AlbumId = 0;
//model.PhotoDesc = "";
//Array.add(Imgs, model);
$("#div_img").append("<a><img alt='' src='" + Url + "' width='50px' height='50px' /></a>");
}
});
}
function heji() {
var je = 0;
$("input[ColName='BuyMoney']").each(function () {
var obj2 = $(this).parent().parent().find("input[ColName='BuyNum']");
if ($(this).val() != "" && obj2 != null && $(obj2).val() != "") {
je += parseFloat($(this).val()) * parseFloat($(obj2).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() {
if ($("#txt_cgrq").val() == "") {
alert("请填写采购日期");
return;
}
datagrid1.UpdateDataSource();
if (datagrid1.DataSource == null || datagrid1.DataSource.length <= 0) {
alert("请添加采购货物");
return;
}
var error = "";
$("input[ColName='BuyMoney']").each(function (i) {
if ($(this).val() == "") {
error += "第" + (i + 1) + "行采购单价未填写;";
}
});
$("input[ColName='BuyNum']").each(function (i) {
if ($(this).val() == "" || $(this).val()=="0") {
error += "第" + (i + 1) + "行采购数量未填写;";
}
});
if (error != "") {
alert(error);
return;
}
if ($("#txt_yfhj").val() == "") {
alert("请填写运费");
return;
}
var param = new Object();
var model = new Object();
model.ChaseId = ChaseId;
model.ChaseCode = $("#a_cgdh").html();
model.GoodsState = 0;
model.Remark = $("#txt_bzxx").val();
model.BuyDate = $("#txt_cgrq").val();
model.DoneDate = $("#txt_yjdhrq").val();
model.Supplier = $("#txt_gys").val();
model.SupplierPhone = $("#txt_lxfs").val();
model.PostFee = $("#txt_yfhj").val();
model.GoodsNum = $("#a_hjsl").html();
model.GoodsMoney = $("#a_hjje").html();
if ($("#txt_gmzh").val() == "0")
model.Account = "";
else
model.Account = $("#txt_gmzh").val();
model.BuyCode = $("#txtBuyCode").val();
// model.InName = $("#txtInName").val();
model.IsDelete = 0;
if ($("#select_Check").val() != null && $("#select_Check").val() != "") {
model.CheckUid = $("#select_Check").val();
model.State = 0;
}
else {
model.CheckUid = 0;
model.State = 1;
}
param.model = model;
param.Goodslist = datagrid1.DataSource;
param.Postlist = PostCodeList;
$.ajax({
url: "CaiGouService.asmx/SaveChase",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (model.State == 0)
alert("提交成功,等待审批");
else
alert("提交成功");
// window.location.href = "CG_Chase.aspx";
}
});
window.parent.CloseTab("新增采购", Title);
}
</script>
<style type="text/css">
#container {
position: absolute;
left: 23%;
top: 0%;
}
#content {
float: left;
position: relative;
right: 20%;
background: #BBFFEE;
}
.schinput {
border: 0;
width: 200px;
height: 34px;
font-size: 16px;
padding: 0 5px;
line-height: 30px;
}
.item {
padding: 3px 5px;
cursor: pointer;
}
.addbg {
background: #9999FF;
}
.first {
border: solid #CCDDFF 2px;
width: 210px;
}
#append {
border: solid #CCDDFF 2px;
border-top: 0;
display: none;
}
</style>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="采购货物" style="width: 700px; height: 350px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr style="height: 38px">
<td style="width: 110px;" class="f1">
<select id="select_type" class="selectClass" style="width: 100px;">
<option value="1">货物SKU</option>
<option value="2">货物编号:</option>
<option value="3">货物名称:</option>
</select>
</td>
<td colspan="2" width="250px">
<div id="container">
<div id="content">
<div class="first">
<input id="kw" class="schinput" /></div>
<div id="append"></div>
</div>
</div>
</td>
<td align="left">
<input id="txt_hwbhmc" class="editTextbox" style="width: 120px; display: none" type="text" />
<input id="chk_xycg" type="checkbox" />列出当前需缺货的商品
</td>
<td>
<input id="Button1" type="button" value="查询" class="btnClass btnClassFind" onclick="AddGoods();" /></td>
</tr>
<tr>
<td align="left" colspan="5">
<div style="height: 280px; overflow: auto">
<div id="DataGrid2"></div>
</div>
</td>
</tr>
<tr>
<td align="center" colspan="5">
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="添 加" />&nbsp;&nbsp;&nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
采购单
</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">采购单</td>
</tr>
<tr>
<td style="width: 120px" class="f1">
<font color="red" style="font-weight: bolder">*</font>
采购单号:
</td>
<td>
<a id="a_cgdh"></a>
</td>
<td style="width: 120px" class="f1">
<font color="red" style="font-weight: bolder">*</font>
采购日期:
</td>
<td>
<input id="txt_cgrq" class="editTextbox" onfocus="WdatePicker()" style="width: 200px;" type="text" />
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">预计到货日期:</td>
<td>
<input id="txt_yjdhrq" type="text" style="width: 200px;" onfocus="WdatePicker()" class="editTextbox" /></td>
<td style="width: 120px" class="f1">购买账号:
</td>
<td>
<select id="select_gmzh" class="selectClass" style="width: 200px;">
</select>
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">供应商:</td>
<td>
<input id="txt_gys" type="text" style="width: 200px;" class="editTextbox" /><a id="a_shop" target="_blank" style="color:blue;text-decoration:underline;display:none" href="">访问供应商店铺</a>&nbsp; </td>
<td style="width: 120px" class="f1">联系方式:</td>
<td>
<input id="txt_lxfs" type="text" style="width: 200px;" class="editTextbox" /></td>
</tr>
<tr>
<td style="width: 120px" class="f1">网上购买单号:</td>
<td>
<input id="txtBuyCode" type="text" style="width: 200px;" class="editTextbox" /></td>
<td style="width: 120px" class="f1">
<font color="red" style="font-weight: bolder">*</font>
运费合计:</td>
<td>
<input id="txt_yfhj" type="text" min='0' max='10000000' precision='2' style="width: 200px;" class="editTextbox" /></td>
</tr>
<tr>
<td style="width: 120px" class="f1">备注信息:</td>
<td colspan="3">
<textarea id="txt_bzxx" cols="100" rows="2" style="width: 90%"></textarea>
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">采购货物:</td>
<td colspan="3"><a id="btn_add"
style="cursor: pointer; text-decoration: underline; color: blue;">
<img alt="" src="../images/add.ico" />添加采购货物</a>&nbsp;&nbsp;<input id="chk_yccg" type="checkbox" /><font color="red">隐藏同货物编采购参考为0的物品</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">
&nbsp;</td>
<td>
&nbsp;</td>
<td colspan="2">数量合计:<a id="a_hjsl" style="font-size: x-large; color: Red"></a> &nbsp; &nbsp; &nbsp;价格合计:<a id="a_hjje" style="font-size: x-large; color: Red"></a>元</td>
</tr>
<tr>
<td style="width: 120px" class="f1">快递信息:</td>
<td colspan="3" align="left">
<select id="select_post" class="selectClass" style="width: 120px">
</select>
<input id="txt_kddh" type="text" style="width: 150px;" class="editTextbox" /><input id="cmdSavekddh" type="button" value="添加" class="btnClass btnClassAdd" /><br />
<div id="DataGrid3" class="DataGridStyle" style="width: 450px; margin-left: 0px"></div>
</td>
</tr>
<tr>
<td style="width: 120px" class="f1">采购审批:</td>
<td colspan="3">
<a id="a_check"></a>
<select id="select_Check" name="D1">
</select></td>
</tr>
<tr>
<td colspan="4" align="center">
<input id="cmdSave" type="button" value="提 交" class="btnClass btnClassSave" onclick="save();" />
<input id="cmdBack" type="button" value="返 回" class="btnClass btnClassBack" />&nbsp;
</td>
</tr>
</table>
</body>
</html>