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.

789 lines
30 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Supplier.aspx.cs" Inherits="TradeManage.SysManage.Supplier" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>供应商</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.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/jquery.url.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 src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<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 type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var SupplierId = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid();
$("#txtReDays,#txtGrade").MaskedTextBox();
ReadData();
$("#" + datagrid1.TableID + " [CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
if (model.LinkUrl != null && model.LinkUrl != "")
window.open(model.LinkUrl);
});
$("#" + datagrid1.TableID + " [CommandName='cmdEdit']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
SupplierId = model.SupplierId;
Clear();
$("#txtSupplierName").val(model.SupplierName);
$("#txtAddress").val(model.Address);
$("#txtPerson").val(model.Person);
$("#txtMobile").val(model.Mobile);
$("#txtPhone").val(model.Phone);
$("#txtBankName").val(model.BankName);
$("#txtBankCode").val(model.BankCode);
$("#txtFax").val(model.Fax);
$("#txtQQ").val(model.QQ);
$("#txtEmail").val(model.Email);
$("#txtGrade").val(model.Grade);
$("#txtReDays").val(model.ReDays);
$("#txtLinkUrl").val(model.LinkUrl);
$("#txtRemark").val(model.Remark);
fopen();
});
$("#" + datagrid1.TableID + " [CommandName='cmdHW']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
SupplierId = model.SupplierId;
fopen2();
ReadSupplierList();
ReadSupplierGoods();
ReadSupplierGoods2();
});
$("#btn_add").bind("click", function () {
Clear();
SupplierId = 0;
fopen();
});
$("#btn_sch").bind("click", function () {
ReadData();
});
SetSelect();
$("#Select_Supplier").bind("change", function () {
ReadSupplierGoods2();
});
$("#btnFind").bind("click", function () {
ReadSupplierGoods2();
});
});
function Clear()
{
$("#txtSupplierName").val("");
$("#txtAddress").val("");
$("#txtPerson").val("");
$("#txtMobile").val("");
$("#txtPhone").val("");
$("#txtBankName").val("");
$("#txtBankCode").val("");
$("#txtFax").val("");
$("#txtQQ").val("");
$("#txtEmail").val("");
$("#txtGrade").val("");
$("#txtReDays").val("");
$("#txtLinkUrl").val("");
$("#txtRemark").val("");
}
function SetSelect()
{
$("#a_alldel").click(function () {
var options = $("#select_TeasIn").find("option");
if (options.length == 0) { alert("没有可以移除的货物"); return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var GoodsId = $(this).val();
html.append("<option value='" + GoodsId + "'>" + $(this).text() + "</option>");
});
$('#select_Teas').append(html.toString());
options.remove();
});
$("#a_allselect").click(function () {
var options = $("#select_Teas").find("option");
if (options.length == 0) { alert("没有可以添加的货物"); return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var model = new Object();
model.GoodsId = $(this).val();
model.GoodsName = $(this).text();
// Array.add(RightPerson, model);
html.append("<option value='" + model.GoodsId + "'>" + model.GoodsName + "</option>");
});
$('#select_TeasIn').append(html.toString());
options.remove();
});
$("#a_del").click(function () {
var options = $("#select_TeasIn").find("option:selected");
if (options.length == 0) { alert("请选择要移除的货物"); return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var GoodsId = $(this).val();
html.append("<option value='" + GoodsId + "'>" + $(this).text() + "</option>");
});
$('#select_Teas').append(html.toString());
options.remove();
});
$("#a_select").click(function () {
var options = $("#select_Teas").find("option:selected");
if (options.length == 0) { alert("请选择要添加的货物"); return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var model = new Object();
model.GoodsId = $(this).val();
model.GoodsName = $(this).text();
// Array.add(RightPerson, model);
html.append("<option value='" + model.GoodsId + "'>" + model.GoodsName + "</option>");
});
$('#select_TeasIn').append(html.toString());
options.remove();
});
$("#select_Teas").dblclick(function () {
var options = $(this).find("option:selected");
if (options.length == 0) { return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var model = new Object();
model.GoodsId = $(this).val();
model.GoodsName = $(this).text();;
// Array.add(RightPerson, model);
html.append("<option value='" + model.GoodsId + "'>" + model.GoodsName + "</option>");
});
$('#select_TeasIn').append(html.toString());
options.remove();
});
$("#select_TeasIn").dblclick(function () {
var options = $("#select_TeasIn").find("option:selected");
if (options.length == 0) { return; }
var html = new Sys.StringBuilder();
$(options).each(function () {
var GoodsId = $(this).val();
html.append("<option value='" + GoodsId + "'>" + $(this).text() + "</option>");
});
$('#select_Teas').append(html.toString());
options.remove();
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
function AddTr() {
$("#" + datagrid1.TableID + " tr").each(function (i) {
if (i > 0) {
var shtmls = "<tr><td colspan='11'>";
var index = $(this).attr("index");
var md = datagrid1.Get_Model(index);
if (md.GoodsList != null) {
$(md.GoodsList).each(function () {
shtmls += "<table width='100%' style='border:solid #add9c0; border-width:2px 0px 0px 2px;'><tr><td width='50px' style='border:solid #add9c0; border-width:0px 2px 2px 0px;'></td><td style='border:solid #add9c0; border-width:0px 2px 2px 0px;'><font color='blue'>购买商品:</font><span>" + this.GoodsName + " &nbsp; &nbsp;<font color='blue'>商品SKU</font>" + this.SKU1 + "</span> &nbsp; &nbsp;<font color='blue'>购买数量:</font><span>" + this.GoodsNum + "</span> &nbsp; &nbsp;<font color='blue'>到货数量:</font>" + this.InGoodsNum + "</td></tr></table>";
});
}
shtmls += "</td><tr>";
$(this).after(shtmls);
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
function fopen2() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test1',
'onComplete': function () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商名称";
col.CellTemplate = "<a CommandName='cmdEdit' class='linka'>{Bind SupplierName}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "手机/电话/传真";
col.CellTemplate = "<a>{Bind Mobile}/{Bind Phone}/{Bind Fax}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "QQ";
col.CellTemplate = "<span>{Bind QQ}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "到货周期(天)";
col.CellTemplate = "<a>{Bind ReDays}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商等级";
col.CellTemplate = "<span>{Bind Grade}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "供应商货物";
col.CellTemplate = "<input CommandName='cmdHW' class='btnClass dgbtnEdit' type='button' value='选择货物'></input>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "180px";
col.CellTemplate = "<input CommandName='cmdEdit' class='btnClass dgbtnEdit' type='button' value='编辑'></input>&nbsp;<input onclick='DelCol(this)' class='btnClass dgbtnDel' type='button' value='删除'></input>";
Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(30);
datagrid1.SetPageIndex(1);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
function ReadSupplierList() {
$("#Select_Supplier").empty();
$("#Select_Supplier").append("<option value='0'>未设置供应商的货物</option>");
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetSupplierList",
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
WindowLoadModel.Hide();
$(data.d).each(function () {
$("#Select_Supplier").append("<option value='" + this.SupplierId + "'>" + this.SupplierName + "</option>");
});
}
});
}
function ReadSupplierGoods() {
$("#select_TeasIn").empty();
var param = new Object();
param.SupplierId = SupplierId;
param.GoodsName = "";
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetSupplierGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async:false,
success: function (data) {
WindowLoadModel.Hide();
if (data.d != null) {
$(data.d).each(function () {
$("#select_TeasIn").append("<option value=" + this.GoodsId + ">[" + this.GoodsCode + "]" + this.GoodsName + "</option>");
});
}
}
});
}
function ReadSupplierGoods2() {
$("#select_Teas").empty();
var param = new Object();
if ($("#Select_Supplier").find("option").length = 0)
param.SupplierId = 0;
else
param.SupplierId = $("#Select_Supplier").val();
param.GoodsName = $("#txt_GoodsName").val();
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetSupplierGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
var options = $("#select_TeasIn").find("option");
if (data.d != null) {
$(data.d).each(function () {
var Gid = this.GoodsId;
var flag = false;
$(options).each(function () {
if (Gid == $(this).val()) {
flag = true;
}
});
if (flag == false)
$("#select_Teas").append("<option value=" + this.GoodsId + ">["+this.GoodsCode+"]" + this.GoodsName + "</option>");
});
}
}
});
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.Name = $("#txt_sname").val();
param.Goods = $("#txt_goods").val();
param.Phone = $("#txt_phone").val();
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "SysManageService.asmx/GetListJC_Supplier",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
}
});
}
//#endregion
//#region 删除
function DelCol(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.SupplierId = model.SupplierId;
$.ajax({
url: "SysManageService.asmx/DeleteSupplier",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
function save() {
if ($("#txtSupplierName").val() == "") {
alert("请填写供应商名称");
return;
}
var param = new Object();
var model = new Object();
model.SupplierId = SupplierId;
model.SupplierName = $("#txtSupplierName").val();
model.Address = $("#txtAddress").val();
model.Person = $("#txtPerson").val();
model.Mobile = $("#txtMobile").val();
model.Phone = $("#txtPhone").val();
model.BankName = $("#txtBankName").val();
model.BankCode = $("#txtBankCode").val();
model.Fax = $("#txtFax").val();
model.QQ = $("#txtQQ").val();
model.Email = $("#txtEmail").val();
model.Grade = $("#txtGrade").val();
model.ReDays = $("#txtReDays").val();
model.LinkUrl = $("#txtLinkUrl").val();
model.Comment = $("#txtComment").val();
model.Remark = $("#txtRemark").val();
param.Model = model;
$.ajax({
url: "SysManageService.asmx/SaveSupplier",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
alert("保存成功");
ReadData();
$.fancybox.close();
// window.location.href = "CG_Chase.aspx";
}
});
}
function saveGoods() {
var list = new Array();
var param = new Object();
var options = $("#select_TeasIn").find("option");
$(options).each(function () {
var model = new Object();
model.GoodsId = $(this).val();
model.SupplierId = SupplierId;
Array.add(list, model);
});
param.SupplierId =SupplierId;
param.list = list;
$.ajax({
url: "SysManageService.asmx/SaveSupplierGoods",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
alert("保存成功");
$.fancybox.close();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div style="display: none">
<div id="test" title="供应商" style="width:680px; height:350px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 110px;" class="f1">
<font color="red" style="font-weight: bolder">*</font>供应商名称:
</td>
<td>
<input id="txtSupplierName" class="editTextbox" style="width:95%;" type="text" />
</td>
<td style="width: 110px;" class="f1">
联系人:
</td>
<td>
<input id="txtPerson" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
电话:
</td>
<td>
<input id="txtPhone" class="editTextbox" style="width:95%;" type="text" />
</td>
<td style="width: 110px;" class="f1">
手机:
</td>
<td>
<input id="txtMobile" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
传真:
</td>
<td>
<input id="txtFax" class="editTextbox" style="width:95%;" type="text" />
</td>
<td style="width: 110px;" class="f1">
QQ
</td>
<td>
<input id="txtQQ" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
信用等级:
</td>
<td>
<input id="txtGrade" min='0' max='10000000' precision='0' class="editTextbox" style="width:95%;" type="text" />
</td>
<td style="width: 110px;" class="f1">
平均到货周期(天):
</td>
<td>
<input id="txtReDays" min='0' max='10000000' precision='0' class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
开户行:
</td>
<td>
<input id="txtBankName" class="editTextbox" style="width:95%;" type="text" />
</td>
<td style="width: 110px;" class="f1">
银行账号:
</td>
<td>
<input id="txtBankCode" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
地址:
</td>
<td colspan="3">
<input id="txtAddress" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
店铺或网站链接:
</td>
<td colspan="3">
<input id="txtLinkUrl" class="editTextbox" style="width:95%;" type="text" />
</td>
</tr>
<tr>
<td style="width: 110px;" class="f1">
备注说明:
</td>
<td colspan="3">
<textarea id="txtRemark" cols="30" rows="4" style="width:95%;"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<input id="btn_Save" type="button" class="btnClass btnClassSave" value="保 存" onclick="save();"/>&nbsp;&nbsp;&nbsp;&nbsp;<input
id="btn_Cancel" type="button" class="btnClass btnClassClose" value="关 闭" />
</td>
</tr>
</table>
</div>
<div id="test1" title="供应商货物" style="width: 600px; height: 380px;">
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
<tr>
<td style="width: 80px;" align="center">
<span id="span_select">供应商/货物:</span>
</td>
<td align="left">
<select id="Select_Supplier" name="D4" style="width:200px;">
</select><input id="txt_GoodsName" type="text" style="width:120px;"/> <input id="btnFind" class="btnClass btnClassFind" type="button" value="查询" />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<table width="100%" border="1" ellspacing="0">
<tr>
<td>
货物
</td>
<td>
操作
</td>
<td>
已选货物
</td>
</tr>
<tr>
<td>
<select id="select_Teas" multiple="multiple" name="D3" style='width: 250px; height: 200px;'>
</select>
</td>
<td align="center">
<a id="a_allselect" style="color: #333; cursor: pointer;">
全选-->></a><br />
<br />
<a id="a_select" style="color: #333; cursor: pointer; ">选中--></a><br />
<br />
<a id="a_del" style="color: #333; cursor: pointer;"><--删除</a><br />
<br />
<a id="a_alldel" style="color: #333; cursor: pointer; "><<--全删</a><br />
<br />
</td>
<td>
<select id="select_TeasIn" multiple="multiple" name="D3" style='width: 250px; height: 200px;'>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input id="btnSure" class="btnClass btnClassSave" type="button" value="确 定" onclick="saveGoods();" />&nbsp;&nbsp;&nbsp;&nbsp;<input
id="btnCancel" class="btnClass btnClassClose" type="button" value="取 消" />
</td>
</tr>
</table>
</div>
</div>
<div class="title_ico">
供应商
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="f1" width="13%">供应商:</td>
<td width="15%">
<input id="txt_sname" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" width="13%">联系方式:</td>
<td width="15%">
<input id="txt_phone" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%;">货物:</td>
<td width="15%">
<input id="txt_goods" class="editTextbox" style="width: 120px;" type="text" /></td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr>
<td colspan="7" class="auto-style1">
<input id="btn_add" class="btnClass btnClassAdd" type="button" value="新增供应商" />
</td>
</tr>
<tr>
<td valign="top" colspan="7">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</body>
</html>