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.

425 lines
17 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseTable.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseTable" %>
<!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/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var WindowLoadModel = new WindowLoad();
var checkstate = -1;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
checkstate = $.url.param("checkstate");
if (checkstate == undefined) {
checkstate = -1;
}
CreateDataGrid();
if (checkstate == 0)
$("#select_state").val("0");
else
if (checkstate == 4) {
$("#select_state").val("2");
$("#select_hwstate").val("3");
}
ReadData();
$("#" + datagrid1.TableID + " [CommandName='cmdLook']").live("click", function () {
var RowIndex = $(this).parentsUntil("tr").parent().attr("index");
var model = datagrid1.Get_Model(RowIndex);
//window.location.href = "CG_ChaseLook.aspx?ChaseId=" + model.ChaseId;
window.parent.addTab("采购单", "CaiGou/CG_ChaseLook.aspx?Title=采购单&ChaseId=" + model.ChaseId, true);
});
$("#cmdAdd").bind("click", function () {
var SelectListModels = datagrid1.GetSelectListModel();
if (SelectListModels == null || $(SelectListModels).length == 0) {
alert("请选择要开启或者关闭的评价");
return;
}
});
//$("#div_img img").live("click", function () {
// $("#img_1").attr("src", $(this).attr("src"));
//});
$("#btn_sch,#chk_mx").bind("click", function () {
ReadData();
});
$("#btn_add").bind("click", function () {
// window.location.href = "CG_ChaseAdd.aspx?ChaseId=0";
window.parent.addTab("新增采购", "CaiGou/CG_ChaseAdd.aspx?Title=采购单&ChaseId=0", true);
});
});
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 + "[" + this.TypeDesc + "]</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 () {
}
});
}
//#endregion
//#region 初始化DataGrid
function CreateDataGrid() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购单号";
col.CellTemplate = "<a CommandName='cmdLook' class='linka'>{Bind ChaseCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "购买订单号";
col.CellTemplate = "<a>{Bind BuyCode}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购日期";
col.CreateFieldSpan("BuyDate", "yyyy-MM-dd");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "预计到货日期";
col.CreateFieldSpan("DoneDate", "yyyy-MM-dd");
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购总数量";
col.CellTemplate = "<span>{Bind GoodsNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购总金额";
col.CellTemplate = "<span>{Bind GoodsMoney}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "采购人";
col.CellTemplate = "<span>{Bind InName}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "审批状态";
col.CellTemplate = "<a no='check'>{Bind CheckState}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "收货状态";
col.CellTemplate = "<span>{Bind ReveState}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "异常备注";
col.Align = "left";
col.Width = "150px";
col.CellTemplate = "<a title='{Bind ErrorInfo}'>{Bind SimpErrorInfo}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "200px";
col.CellTemplate = "<input CommandName='cmdLook' class='btnClass dgbtnView' type='button' value='查看'></input>&nbsp;<input onclick='EditCol(this)' 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(); });
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
param.ChaseCodeType = $("#select_tj").val();
param.ChaseCode = $("#txt_cgdh").val();
param.NameType = $("#select_tj1").val();
param.Name = $("#txt_name").val();
param.NameType = $("#select_tj1").val();
param.DateType = $("#select_tj2").val();
param.SDate = null;
if($("#txt_SDate").val()!="")
param.SDate = $("#txt_SDate").val();
param.State = $("#select_state").val();
param.DHState = $("#select_hwstate").val();
param.EDate = null;
if($("#txt_EDate").val()!="")
param.EDate = $("#txt_EDate").val();
param.SNum = -1;
if ($("#txt_snum").val() != "")
param.SNum = $("#txt_snum").val();
param.ENum = -1;
if ($("#txt_enum").val() != "")
param.ENum = $("#txt_enum").val();
param.SPrice = -1;
if ($("#txt_sprice").val() != "")
param.SPrice = $("#txt_sprice").val();
param.EPrice = -1;
if ($("#txt_eprice").val() != "")
param.EPrice = $("#txt_eprice").val();
param.IsDetail = 0;
if ($("#chk_mx").is(':checked') == true)
param.IsDetail = 1;
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/GetListCG_Purchase",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
if (param.IsDetail == 1)
AddTr();
$("a[no='check']").each(function () {
if ($(this).html() == "未审批") {
$(this).css("color", "Red");
}
});
}
});
}
function EditCol(obj) {
var rowindex = $(obj).parent().parent().attr("index");
var model = datagrid1.Get_Model(rowindex);
var ChaseId = model.ChaseId;
if (model.State==3) {
alert("该采购单已经结束,不能编辑");
return;
}
else
if (model.GoodsState > 1) {
alert("该采购单已经有货物到货,不能编辑");
return;
}
else if (model.State == 1&&model.CheckUid>0) {
//window.location = "CG_ChaseLook.aspx?IsCheck=Edit&ChaseId=" + ChaseId;
window.parent.addTab("采购单", "CaiGou/CG_ChaseLook.aspx?IsCheck=Edit&Title=采购单&ChaseId=" + ChaseId, true);
}
else
{
//window.location = "CG_ChaseAdd.aspx?ChaseId=" + ChaseId;
window.parent.addTab("新增采购", "CaiGou/CG_ChaseAdd.aspx?Title=采购单&ChaseId=" + ChaseId, true);
}
}
//#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);
if (model.State == 1&&model.GoodsState>0) {
alert("该采购单已经有货物入库了,不能删除");
return;
}
else if (model.State == 3) {
alert("该采购单已经结束,不能删除");
return;
}
param.ChaseId = model.ChaseId;
$.ajax({
url: "CaiGouService.asmx/DeletePurchase",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<form id="form1" runat="server">
<div class="title_ico">
采购订单
</div>
<table id="tb1" class="tableAll" style="width: 100%;">
<tr>
<td class="f1" width="13%"><select id="select_tj" class="selectClass" style="width:90px" name="D3">
<option value="1">采购单号:</option>
<option value="2">购买单号:</option>
</select></td>
<td width="15%">
<input id="txt_cgdh" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" width="13%"><select id="select_tj1" class="selectClass" style="width:100px" name="D4">
<option value="1">采购人:</option>
<option value="2">供应商:</option>
<option value="3">采购物品编码:</option>
<option value="4">采购物品SKU</option>
<option value="5">采购物品描述:</option>
<option value="6">快递单号:</option>
</select></td>
<td width="15%">
<input id="txt_name" class="editTextbox" style="width: 120px;" type="text" /></td>
<td class="f1" style="width: 10%;">采购物品数量:</td>
<td width="15%">
<input id="txt_snum" class="editTextbox" max="1000000" min="0" precision="0" style="width: 50px;" type="text" />--<input id="txt_enum" class="editTextbox" max="1000000" min="1" precision="0" style="width: 50px;" type="text" />
</td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr>
<td class="f1" width="13%">到货状态:</td>
<td> <select id="select_hwstate" class="selectClass" style="width: 120px" name="D2">
<option value="-1">全部</option>
<option value="0">未到货</option>
<option value="1">部分到货</option>
<option value="2">已到货</option>
<option value="3">到货异常</option>
</select>
</td>
<td class="f1" style="width: 10%; height: 15px;">采购单状态:</td>
<td>
<select id="select_state" class="selectClass" style="width: 120px" name="D1">
<option value="-1">全部</option>
<option value="0">未审批</option>
<option value="2">已审批</option>
<option value="3">已结束</option>
</select></td>
<td class="f1">采购金额:</td>
<td>
<input id="txt_sprice" class="editTextbox" max="1000000" min="0" precision="2" style="width: 50px;" type="text" />--<input id="txt_eprice" class="editTextbox" max="1000000" min="1" precision="2" style="width: 50px;" type="text" /></td>
<td></td>
</tr>
<tr>
<td class="f1" width="13%"><select id="select_tj2" class="selectClass" style="width:90px" name="D5">
<option value="1">采购日期:</option>
<option value="2">预计到货日期:</option>
</select></td>
<td colspan="6">
<input id="txt_SDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" />-
<input id="txt_EDate" class="editTextbox" onfocus="WdatePicker()" style="width: 120px;" type="text" /><input id="chk_mx" type="checkbox" /><label for="chk_mx">列出采购货物明细</label></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>
</form>
</body>
</html>