123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- function validChoose() {
- var d = [];
- $.each($("#dgStockInTMSelectList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- //删除
- function ET06_05_01_StockIn_Delete_ViewGrid() {
- var d = validChoose();
- var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows");
- var i, j;
- var len = roleViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (roleViewList[i].TeachingMaterialPoolID == d[j].TeachingMaterialPoolID) {
- roleViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
- }
- //添加教材
- function ET06_05_01_StockIn_Add_ViewGrid() {
- var schoolyearID = $("#SchoolyearID").combobox('getValue');
- if (schoolyearID == null || schoolyearID == nonSelect) {
- $.messager.alert("系统提示", "请选择学年学期。");
- return;
- }
- var supplierID = $("#SupplierID").combogridX("getValue");
- $.popupTopWindow('添加教材', CMS_SystemConfig.VirtualDirectoryPath + '/StockIn/TeachingMaterial?SchoolyearID=' +
- schoolyearID + '&SupplierID=' + supplierID , 720, 480, StockIn_Add_Confirm);
- }
- //roleList 选中的对象
- function StockIn_Add_Confirm(roleList) {
- if (roleList == undefined)
- return;
- var supplierID = $("#SupplierID").combogridX("getValue");
- var dataList = [{ "Text": "请选择", "Value": -1 }];
- // var discount = 0;
- // $.ajaxSettings.async = false
- // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StockInSet/GetDiscountByID', { supplierID: supplierID }, function (data) {
- // discount = data;
- // });
- // $.ajaxSettings.async = true
- var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows");
- $.each(roleList, function (index, value) {
- if ($.grep(roleViewList, function (row, index) { return value.TeachingMaterialPoolID == roleViewList[index].TeachingMaterialPoolID; }).length == 0) {
- roleViewList.push({
- TeachingMaterialPoolID: value.TeachingMaterialPoolID,
- TeachingMaterialCode: value.TeachingMaterialCode,
- TeachingMaterialName: value.TeachingMaterialName,
- CoursematerialCode: value.CoursematerialCode,
- CoursematerialName: value.CoursematerialName,
- Price: value.Price,
- OrderQty: value.OrderQty,
- Discount: value.Discount,
- DiscountPrice: value.DiscountPrice,
- MaYang: value.MaYang,
- ZongJia: value.ZongJia,
- IsLateName: value.IsLateName,
- });
- }
- });
- $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
- }
- function reload() {
- $("#dgStockInTMSelectList").cmsXDataTable("load", $.getDataGridParams("dgStockInTMSelectList"));
- }
- function QueryPublishDropdownList() {
- reload();
- }
- function PublishChange(){
- var supplierID = $("#SupplierID").combogridX("getValue");
- var discount = 0;
- $.ajaxSettings.async = false
- $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StockInSet/GetDiscountByID', { supplierID: supplierID }, function (data) {
- discount = data;
- });
- $.ajaxSettings.async = true
- var all = $("#dgStockInTMSelectList").cmsXDataTable("getRows");
- var roleViewList = [];
- $.each(all, function (index, value) {
- roleViewList.push({
- TeachingMaterialPoolID: value.TeachingMaterialPoolID,
- TeachingMaterialCode: value.TeachingMaterialCode,
- TeachingMaterialName: value.TeachingMaterialName,
- CoursematerialCode: value.CoursematerialCode,
- CoursematerialName: value.CoursematerialName,
- Price: value.Price,
- OrderQty: value.OrderQty,
- Discount: discount,
- DiscountPrice: (value.Price * (discount*100))/100,
- MaYang: value.MaYang,
- ZongJia: ((value.Price * (discount*100)) * value.OrderQty)/100,
- IsLateName: value.IsLateName,
- });
- });
- $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
-
- }
|