123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- @using Bowin.Web.Controls.Mvc;
- @using EMIS.Web.Controls;
- @{
- ViewBag.Title = "TMPoolListSelector";
- var supplierID = ViewBag.SupplierID;
- var dbdiscount = ViewBag.Discount;
- ComboGridOptions TMCode = new ComboGridOptions
- {
- TextField = "TeachingMaterialCode",
- ValueField = "TeachingMaterialPoolID",
- ID = "TeachingMaterialCodeDropdown",
- Name = "TeachingMaterialCodeDropdown",
- OnSelect = "QueryTeachingMaterialDropdownList",
- GridOptions = new DataGridOptions
- {
- Columns = new List<DataGridColumn>()
- {
- //new BoundFieldColumn { FieldName="TeachingMaterialName",HeaderText="教材名称", Align=AlignStyle.Center, Width=0.3 },
- new BoundFieldColumn { FieldName="TeachingMaterialCode",HeaderText="教材编号", Align=AlignStyle.Center, Width=0.1 }
- },
- IsCheckOnSelect = true,
- DataSourceUrl = Url.Content("~/TeachingMaterialPool/List"),
- IsPagination = true,
- IsShowRowNumbers = true,
- IsSingleSelect = false
- }
- };
-
- ComboGridOptions TMName = new ComboGridOptions
- {
- TextField = "TeachingMaterialName",
- ValueField = "TeachingMaterialPoolID",
- ID = "TeachingMaterialDropdown",
- Name = "TeachingMaterialDropdown",
- OnSelect = "QueryTeachingMaterialDropdownList",
- GridOptions = new DataGridOptions
- {
- Columns = new List<DataGridColumn>()
- {
- new BoundFieldColumn { FieldName="TeachingMaterialName",HeaderText="教材名称", Align=AlignStyle.Center, Width=0.3 }
- // new BoundFieldColumn { FieldName="TeachingMaterialCode",HeaderText="教材编号", Align=AlignStyle.Center, Width=0.1 }
- },
- IsCheckOnSelect = true,
- DataSourceUrl = Url.Content("~/TeachingMaterialPool/List"),
- IsPagination = true,
- IsShowRowNumbers = true,
- IsSingleSelect = false
- }
- };
- }
- @section scripts{
- <script src="~/Scripts/Business/TeachingMaterial/TeachingMaterialSelector.js"></script>
- <script type="text/javascript">
- $(function () {
- $("#SetDiscount").val(@ViewBag.Discount);
- })
- //获取选中的数据
- function validChooseTM() {
- var d = [];
- $.each($("#dgTMPoolList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- function SetTeachingMaterial() {
- var zkl = /^(?:0(?:\.(?!00)[0-9]{1,2})?|1)$/;
- var reg = /^\d+$/;
- var qty = $("#SerQty").val();
- var discount = $("#SetDiscount").val();
- var listData = validChooseTM();
- if (listData.length < 1) {
- $.messager.alert("系统提示", "请选择需要设置的教材。");
- return;
- }
- if (qty != "" && !reg.test(qty)) {
- $.messager.alert("系统提示", "入库数量数据格式不正确,请检查!");
- return;
- }
- if (discount != "" && !zkl.test(discount)) {
- $.messager.alert("系统提示", "折扣率格式不正确,请检查!");
- return;
- }
-
- var tabletr = $('#dgTMPoolList').find("tr");//获取去列表所有行
- for(var j=0;j<listData.length;j++){
- for (var i = 0; i < tabletr.length; i++) {
-
- var rowindex = tabletr[i].rowIndex
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "OrderQty", newValue: qty });
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "Discount", newValue: discount });
- var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
- var tableID=$(tableRow.find("td")[0]).children().val();
- if(listData[j].TeachingMaterialPoolID==tableID){
- $(tableRow.find("td")[4]).children().val(qty);//设置数量
- $(tableRow.find("td")[5]).children().val(discount);//设置折扣率
- }
- }
- }
- }
- function TMSelect_Confirm() {
- var listData = validChooseTM();
- if (listData.length < 1) {
- $.messager.alert("系统提示", "请选择需要添加的教材。");
- return;
- }
- var zkl = /^(?:0(?:\.(?!00)[0-9]{1,2})?|1)$/;
- var reg = /^\d+$/;
- var meny = /^\d+([.]?[0-9]{0,2})$/;
- var regDiscount = /^[1-9]([.]{1}[1-9])?$/;
- var regDiscountPrice = /^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
- for (var i = 0; i < listData.length; i++) {
- if (!reg.test(listData[i].OrderQty)) {
- $.messager.alert("系统提示", "选中信息,存在入库数量数据格式不正确,请检查!");
- return;
- }
- if (!zkl.test(listData[i].Discount)) {
- $.messager.alert("系统提示", "选中信息,存在折扣率格式不正确,请检查!");
- return;
- }
- if (!meny.test(listData[i].DiscountPrice)) {
- $.messager.alert("系统提示", "选中信息,存在折合价格式不正确,请检查!");
- return;
- }
- }
- top.$("#@(Request["WindowID"])").data("resultData", listData);
- top.$("#@(Request["WindowID"])").dialog("close");
- }
- function checkInventoryQty(rowindex, rowdata) {
- var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
- var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
- var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "MaYang", newValue: MaYang });
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "ZongJia", newValue: ZongJia });
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "DiscountPrice", newValue: DiscountPrice });
- var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
- $(tableRow.find("td")[7]).children().val(MaYang);//设置码洋值
- $(tableRow.find("td")[6]).children().val(DiscountPrice);//设置折合价
- $(tableRow.find("td")[8]).children().val(ZongJia);//设置码总价
- }
- function checkInventoryDiscount(rowindex, rowdata) {
- var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
- var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
- var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "MaYang", newValue: MaYang });
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "ZongJia", newValue: ZongJia });
- $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "DiscountPrice", newValue: DiscountPrice });
- //$("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", rowindex, "MaYang", MaYang);
- //$("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", rowindex, "ZongJia", ZongJia);
- var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
- $(tableRow.find("td")[7]).children().val(MaYang);//设置码洋值
- $(tableRow.find("td")[6]).children().val(DiscountPrice);//设置码洋值
- $(tableRow.find("td")[8]).children().val(ZongJia);//设置码洋值
- }
- ////,OnChangedFunc="checkInventoryQty"
- //function checkInventoryQty(rowindex, rowdata) {
- // var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
- // var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
- // var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
- // var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
- // //$(tableRow.find("td")[7]).children().attr("disabled", "disabled");
- // $(tableRow.find("td")[9]).children().val(MaYang);//设置码洋值
- // $(tableRow.find("td")[8]).children().val(DiscountPrice);//设置码洋值
- // $(tableRow.find("td")[10]).children().val(ZongJia);//设置码洋值
- //}
- //function checkInventoryDiscount(rowindex, rowdata) {
- // var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
- // var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
- // var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
- // var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
- // //$(tableRow.find("td")[7]).children().attr("disabled", "disabled");
- // $(tableRow.find("td")[9]).children().val(MaYang);//设置码洋值
- // $(tableRow.find("td")[8]).children().val(DiscountPrice);//设置码洋值
- // $(tableRow.find("td")[10]).children().val(ZongJia);//设置码洋值
- //}
- </script>
- }
- <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
- <div class="search_keyword">
- <div class="search_input">
- @Html.Hidden("SchoolyearID", Request["SchoolyearID"], new Dictionary<string, object> { { "data-condition", "dgTMPoolList" }, { "id", "SchoolyearID" } })
- @Html.Hidden("SupplierID", Request["SupplierID"], new Dictionary<string, object> { { "data-condition", "dgTMPoolList" }, { "id", "SupplierID" } })
- <ul>
- @*<li class="sn" style="padding-left: 5px;">
- 教材编号:
- </li>
- <li class="sv">
- @Html.ComboGrid(TMCode, new Dictionary<string, string> { { "data-condition", "dgTMPoolList" } })
- </li>
- <li class="sn" style="padding-left: 5px;">
- 教材名称:
- </li>
- <li class="sv">
- @Html.ComboGrid(TMName, new Dictionary<string, string> { { "data-condition", "dgTMPoolList" } })
- </li>*@
- <li class="sv" style="float:right">
- <div class="current_navbar toolbar">
- <div class="func_info">
- <a class="easyui-linkbutton" href="javascript:TMSelect_Confirm()" data-options="iconCls:'icon-ok',plain:'true'"
- onfocus="this.blur()">选中</a>
- </div>
- </div>
- </li>
- @Html.PositionCondition("TeachingMaterial",null)
- </ul>
- <ul>
- <li class="sn" style="padding-left: 5px;">设置折扣:</li>
- <li class="sv">
- @Html.TextBox("SetDiscount")
- </li>
- <li class="sn" style="padding-left: 5px;">设置数量:</li>
- <li class="sv">
- @Html.TextBox("SerQty")
- </li>
- <li class="sn" style="padding-left: 5px;"> </li>
- <li class="sv">
- <a class="easyui-linkbutton" href="javascript:SetTeachingMaterial()" data-options="iconCls:'icon-ok',plain:'true'"
- onfocus="this.blur()">设置</a>
- </li>
- </ul>
- </div>
- <div class="search_list">
- @Html.DataGrid(new DataGridOptions
- {
- Columns = new List<DataGridColumn>()
- {
- new CheckBoxFieldColumn{ HeaderText="", FieldName="TeachingMaterialPoolID" },
- new BoundFieldColumn { FieldName="TeachingMaterialCode", HeaderText="教材编号", Align=AlignStyle.Center, Width=0.04 },
- new BoundFieldColumn { FieldName="TeachingMaterialName", HeaderText="教材名称", Align=AlignStyle.Center, Width=0.1 },
- //new BoundFieldColumn { FieldName="CoursematerialCode", HeaderText="课程编号", Align=AlignStyle.Center, Width=0.06 },
- //new BoundFieldColumn { FieldName="CoursematerialName", HeaderText="课程名称", Align=AlignStyle.Center, Width=0.1},
- //new BoundFieldColumn { FieldName="ISBN", HeaderText="ISBN", Align=AlignStyle.Center, Width=0.04 },
- //new BoundFieldColumn { FieldName="PublishTime", HeaderText="版本时间", Align=AlignStyle.Center, Width=0.04 },
- //new BoundFieldColumn { FieldName="PublishName", HeaderText="出版单位", Align=AlignStyle.Center, Width=0.04 },
- //new BoundFieldColumn { FieldName="Author", HeaderText="作者", Align=AlignStyle.Center, Width=0.04 },
- new BoundFieldColumn { FieldName="Price", HeaderText="单价", Align=AlignStyle.Center, Width=0.02 },
- new TextBoxColumn { FieldName="OrderQty", HeaderText="数量", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyNumberValidator(), Width=0.02 ,OnChangedFunc="checkInventoryQty" },
- new TextBoxColumn { FieldName="Discount", HeaderText="折扣率", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyDiscountValidator(), Width=0.03 ,OnChangedFunc="checkInventoryDiscount" },
- new TextBoxColumn { FieldName="DiscountPrice", HeaderText="折合价", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyDiscountValidator(), Width=0.03 ,EnableFieldName="IsEnable" },
- new TextBoxColumn { FieldName="MaYang", HeaderText="码洋", Align=AlignStyle.Center, IsRequired=true, Width=0.03 ,EnableFieldName="IsEnable" },
- new TextBoxColumn { FieldName="ZongJia", HeaderText="总价", Align=AlignStyle.Center, IsRequired=true, Width=0.03 ,EnableFieldName="IsEnable" },
- new BoundFieldColumn { FieldName="IsLateName", HeaderText="是否过期", Align=AlignStyle.Center, Width=0.04 }
- },
- PageSize = 30,
- IsCheckOnSelect = true,
- DataSourceUrl = Url.Content("~/StockIn/GetStockInByTMList"),
- ID = "dgTMPoolList",
- IsPagination = true,
- IsShowRowNumbers = true,
- IsSingleSelect = false,
- IsPostBack = true
- })
- </div>
- </div>
|