TeachingMaterial.cshtml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. @using Bowin.Web.Controls.Mvc;
  2. @using EMIS.Web.Controls;
  3. @{
  4. ViewBag.Title = "TMPoolListSelector";
  5. var supplierID = ViewBag.SupplierID;
  6. var dbdiscount = ViewBag.Discount;
  7. ComboGridOptions TMCode = new ComboGridOptions
  8. {
  9. TextField = "TeachingMaterialCode",
  10. ValueField = "TeachingMaterialPoolID",
  11. ID = "TeachingMaterialCodeDropdown",
  12. Name = "TeachingMaterialCodeDropdown",
  13. OnSelect = "QueryTeachingMaterialDropdownList",
  14. GridOptions = new DataGridOptions
  15. {
  16. Columns = new List<DataGridColumn>()
  17. {
  18. //new BoundFieldColumn { FieldName="TeachingMaterialName",HeaderText="教材名称", Align=AlignStyle.Center, Width=0.3 },
  19. new BoundFieldColumn { FieldName="TeachingMaterialCode",HeaderText="教材编号", Align=AlignStyle.Center, Width=0.1 }
  20. },
  21. IsCheckOnSelect = true,
  22. DataSourceUrl = Url.Content("~/TeachingMaterialPool/List"),
  23. IsPagination = true,
  24. IsShowRowNumbers = true,
  25. IsSingleSelect = false
  26. }
  27. };
  28. ComboGridOptions TMName = new ComboGridOptions
  29. {
  30. TextField = "TeachingMaterialName",
  31. ValueField = "TeachingMaterialPoolID",
  32. ID = "TeachingMaterialDropdown",
  33. Name = "TeachingMaterialDropdown",
  34. OnSelect = "QueryTeachingMaterialDropdownList",
  35. GridOptions = new DataGridOptions
  36. {
  37. Columns = new List<DataGridColumn>()
  38. {
  39. new BoundFieldColumn { FieldName="TeachingMaterialName",HeaderText="教材名称", Align=AlignStyle.Center, Width=0.3 }
  40. // new BoundFieldColumn { FieldName="TeachingMaterialCode",HeaderText="教材编号", Align=AlignStyle.Center, Width=0.1 }
  41. },
  42. IsCheckOnSelect = true,
  43. DataSourceUrl = Url.Content("~/TeachingMaterialPool/List"),
  44. IsPagination = true,
  45. IsShowRowNumbers = true,
  46. IsSingleSelect = false
  47. }
  48. };
  49. }
  50. @section scripts{
  51. <script src="~/Scripts/Business/TeachingMaterial/TeachingMaterialSelector.js"></script>
  52. <script type="text/javascript">
  53. $(function () {
  54. $("#SetDiscount").val(@ViewBag.Discount);
  55. })
  56. //获取选中的数据
  57. function validChooseTM() {
  58. var d = [];
  59. $.each($("#dgTMPoolList").cmsXDataTable("getSelections"), function (index) {
  60. d.push(this);
  61. });
  62. return d;
  63. }
  64. function SetTeachingMaterial() {
  65. var zkl = /^(?:0(?:\.(?!00)[0-9]{1,2})?|1)$/;
  66. var reg = /^\d+$/;
  67. var qty = $("#SerQty").val();
  68. var discount = $("#SetDiscount").val();
  69. var listData = validChooseTM();
  70. if (listData.length < 1) {
  71. $.messager.alert("系统提示", "请选择需要设置的教材。");
  72. return;
  73. }
  74. if (qty != "" && !reg.test(qty)) {
  75. $.messager.alert("系统提示", "入库数量数据格式不正确,请检查!");
  76. return;
  77. }
  78. if (discount != "" && !zkl.test(discount)) {
  79. $.messager.alert("系统提示", "折扣率格式不正确,请检查!");
  80. return;
  81. }
  82. var tabletr = $('#dgTMPoolList').find("tr");//获取去列表所有行
  83. for(var j=0;j<listData.length;j++){
  84. for (var i = 0; i < tabletr.length; i++) {
  85. var rowindex = tabletr[i].rowIndex
  86. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "OrderQty", newValue: qty });
  87. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "Discount", newValue: discount });
  88. var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
  89. var tableID=$(tableRow.find("td")[0]).children().val();
  90. if(listData[j].TeachingMaterialPoolID==tableID){
  91. $(tableRow.find("td")[4]).children().val(qty);//设置数量
  92. $(tableRow.find("td")[5]).children().val(discount);//设置折扣率
  93. }
  94. }
  95. }
  96. }
  97. function TMSelect_Confirm() {
  98. var listData = validChooseTM();
  99. if (listData.length < 1) {
  100. $.messager.alert("系统提示", "请选择需要添加的教材。");
  101. return;
  102. }
  103. var zkl = /^(?:0(?:\.(?!00)[0-9]{1,2})?|1)$/;
  104. var reg = /^\d+$/;
  105. var meny = /^\d+([.]?[0-9]{0,2})$/;
  106. var regDiscount = /^[1-9]([.]{1}[1-9])?$/;
  107. var regDiscountPrice = /^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
  108. for (var i = 0; i < listData.length; i++) {
  109. if (!reg.test(listData[i].OrderQty)) {
  110. $.messager.alert("系统提示", "选中信息,存在入库数量数据格式不正确,请检查!");
  111. return;
  112. }
  113. if (!zkl.test(listData[i].Discount)) {
  114. $.messager.alert("系统提示", "选中信息,存在折扣率格式不正确,请检查!");
  115. return;
  116. }
  117. if (!meny.test(listData[i].DiscountPrice)) {
  118. $.messager.alert("系统提示", "选中信息,存在折合价格式不正确,请检查!");
  119. return;
  120. }
  121. }
  122. top.$("#@(Request["WindowID"])").data("resultData", listData);
  123. top.$("#@(Request["WindowID"])").dialog("close");
  124. }
  125. function checkInventoryQty(rowindex, rowdata) {
  126. var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
  127. var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
  128. var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
  129. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "MaYang", newValue: MaYang });
  130. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "ZongJia", newValue: ZongJia });
  131. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "DiscountPrice", newValue: DiscountPrice });
  132. var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
  133. $(tableRow.find("td")[7]).children().val(MaYang);//设置码洋值
  134. $(tableRow.find("td")[6]).children().val(DiscountPrice);//设置折合价
  135. $(tableRow.find("td")[8]).children().val(ZongJia);//设置码总价
  136. }
  137. function checkInventoryDiscount(rowindex, rowdata) {
  138. var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
  139. var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
  140. var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
  141. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "MaYang", newValue: MaYang });
  142. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "ZongJia", newValue: ZongJia });
  143. $("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", { rowIndex: rowindex, columnName: "DiscountPrice", newValue: DiscountPrice });
  144. //$("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", rowindex, "MaYang", MaYang);
  145. //$("#dgTMPoolList").cmsXDataTable("setDataValueByIndex", rowindex, "ZongJia", ZongJia);
  146. var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
  147. $(tableRow.find("td")[7]).children().val(MaYang);//设置码洋值
  148. $(tableRow.find("td")[6]).children().val(DiscountPrice);//设置码洋值
  149. $(tableRow.find("td")[8]).children().val(ZongJia);//设置码洋值
  150. }
  151. ////,OnChangedFunc="checkInventoryQty"
  152. //function checkInventoryQty(rowindex, rowdata) {
  153. // var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
  154. // var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
  155. // var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
  156. // var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
  157. // //$(tableRow.find("td")[7]).children().attr("disabled", "disabled");
  158. // $(tableRow.find("td")[9]).children().val(MaYang);//设置码洋值
  159. // $(tableRow.find("td")[8]).children().val(DiscountPrice);//设置码洋值
  160. // $(tableRow.find("td")[10]).children().val(ZongJia);//设置码洋值
  161. //}
  162. //function checkInventoryDiscount(rowindex, rowdata) {
  163. // var MaYang = (Number(rowdata.Price * rowdata.OrderQty)).toFixed(2)
  164. // var DiscountPrice = (Number(rowdata.Price * rowdata.Discount)).toFixed(2)
  165. // var ZongJia = (Number(DiscountPrice * rowdata.OrderQty)).toFixed(2)
  166. // var tableRow = $('#dgTMPoolList').find("tr.row[xRowIndex=" + rowindex + "]");
  167. // //$(tableRow.find("td")[7]).children().attr("disabled", "disabled");
  168. // $(tableRow.find("td")[9]).children().val(MaYang);//设置码洋值
  169. // $(tableRow.find("td")[8]).children().val(DiscountPrice);//设置码洋值
  170. // $(tableRow.find("td")[10]).children().val(ZongJia);//设置码洋值
  171. //}
  172. </script>
  173. }
  174. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  175. <div class="search_keyword">
  176. <div class="search_input">
  177. @Html.Hidden("SchoolyearID", Request["SchoolyearID"], new Dictionary<string, object> { { "data-condition", "dgTMPoolList" }, { "id", "SchoolyearID" } })
  178. @Html.Hidden("SupplierID", Request["SupplierID"], new Dictionary<string, object> { { "data-condition", "dgTMPoolList" }, { "id", "SupplierID" } })
  179. <ul>
  180. @*<li class="sn" style="padding-left: 5px;">
  181. 教材编号:
  182. </li>
  183. <li class="sv">
  184. @Html.ComboGrid(TMCode, new Dictionary<string, string> { { "data-condition", "dgTMPoolList" } })
  185. </li>
  186. <li class="sn" style="padding-left: 5px;">
  187. 教材名称:
  188. </li>
  189. <li class="sv">
  190. @Html.ComboGrid(TMName, new Dictionary<string, string> { { "data-condition", "dgTMPoolList" } })
  191. </li>*@
  192. <li class="sv" style="float:right">
  193. <div class="current_navbar toolbar">
  194. <div class="func_info">
  195. <a class="easyui-linkbutton" href="javascript:TMSelect_Confirm()" data-options="iconCls:'icon-ok',plain:'true'"
  196. onfocus="this.blur()">选中</a>
  197. </div>
  198. </div>
  199. </li>
  200. @Html.PositionCondition("TeachingMaterial",null)
  201. </ul>
  202. <ul>
  203. <li class="sn" style="padding-left: 5px;">设置折扣:</li>
  204. <li class="sv">
  205. @Html.TextBox("SetDiscount")
  206. </li>
  207. <li class="sn" style="padding-left: 5px;">设置数量:</li>
  208. <li class="sv">
  209. @Html.TextBox("SerQty")
  210. </li>
  211. <li class="sn" style="padding-left: 5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
  212. <li class="sv">
  213. <a class="easyui-linkbutton" href="javascript:SetTeachingMaterial()" data-options="iconCls:'icon-ok',plain:'true'"
  214. onfocus="this.blur()">设置</a>
  215. </li>
  216. </ul>
  217. </div>
  218. <div class="search_list">
  219. @Html.DataGrid(new DataGridOptions
  220. {
  221. Columns = new List<DataGridColumn>()
  222. {
  223. new CheckBoxFieldColumn{ HeaderText="", FieldName="TeachingMaterialPoolID" },
  224. new BoundFieldColumn { FieldName="TeachingMaterialCode", HeaderText="教材编号", Align=AlignStyle.Center, Width=0.04 },
  225. new BoundFieldColumn { FieldName="TeachingMaterialName", HeaderText="教材名称", Align=AlignStyle.Center, Width=0.1 },
  226. //new BoundFieldColumn { FieldName="CoursematerialCode", HeaderText="课程编号", Align=AlignStyle.Center, Width=0.06 },
  227. //new BoundFieldColumn { FieldName="CoursematerialName", HeaderText="课程名称", Align=AlignStyle.Center, Width=0.1},
  228. //new BoundFieldColumn { FieldName="ISBN", HeaderText="ISBN", Align=AlignStyle.Center, Width=0.04 },
  229. //new BoundFieldColumn { FieldName="PublishTime", HeaderText="版本时间", Align=AlignStyle.Center, Width=0.04 },
  230. //new BoundFieldColumn { FieldName="PublishName", HeaderText="出版单位", Align=AlignStyle.Center, Width=0.04 },
  231. //new BoundFieldColumn { FieldName="Author", HeaderText="作者", Align=AlignStyle.Center, Width=0.04 },
  232. new BoundFieldColumn { FieldName="Price", HeaderText="单价", Align=AlignStyle.Center, Width=0.02 },
  233. new TextBoxColumn { FieldName="OrderQty", HeaderText="数量", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyNumberValidator(), Width=0.02 ,OnChangedFunc="checkInventoryQty" },
  234. new TextBoxColumn { FieldName="Discount", HeaderText="折扣率", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyDiscountValidator(), Width=0.03 ,OnChangedFunc="checkInventoryDiscount" },
  235. new TextBoxColumn { FieldName="DiscountPrice", HeaderText="折合价", Align=AlignStyle.Center, IsRequired=true, Validator=new OnlyDiscountValidator(), Width=0.03 ,EnableFieldName="IsEnable" },
  236. new TextBoxColumn { FieldName="MaYang", HeaderText="码洋", Align=AlignStyle.Center, IsRequired=true, Width=0.03 ,EnableFieldName="IsEnable" },
  237. new TextBoxColumn { FieldName="ZongJia", HeaderText="总价", Align=AlignStyle.Center, IsRequired=true, Width=0.03 ,EnableFieldName="IsEnable" },
  238. new BoundFieldColumn { FieldName="IsLateName", HeaderText="是否过期", Align=AlignStyle.Center, Width=0.04 }
  239. },
  240. PageSize = 30,
  241. IsCheckOnSelect = true,
  242. DataSourceUrl = Url.Content("~/StockIn/GetStockInByTMList"),
  243. ID = "dgTMPoolList",
  244. IsPagination = true,
  245. IsShowRowNumbers = true,
  246. IsSingleSelect = false,
  247. IsPostBack = true
  248. })
  249. </div>
  250. </div>