From 0879713a184c48a0306a771a1e151387d5a9cf4c Mon Sep 17 00:00:00 2001 From: LR-20210131IOQH\Administrator <jackcold@163.com> Date: 星期一, 28 六月 2021 12:40:37 +0800 Subject: [PATCH] 电话费用录入修改 --- zhengcaioa/Services/SimService.cs | 131 +++++++-- zhengcaioa/zhengcaioa/Views/SimCost/SimYear.cshtml | 142 ++++++++++ 用户表更新.sql | 2 zhengcaioa/IServices/ISimService.cs | 4 zhengcaioa/zhengcaioa/Views/SimCost/Index.cshtml | 152 +++++------ zhengcaioa/Services/HrSalaryService.cs | 7 zhengcaioa/Model/Sim.cs | 88 ++++++ zhengcaioa/zhengcaioa/Controllers/admin/SimCostController.cs | 101 +++++-- zhengcaioa/zhengcaioa/Views/SimCost/Edit.cshtml | 95 ++----- zhengcaioa/Model/zhengcaioaContext.cs | 2 10 files changed, 509 insertions(+), 215 deletions(-) diff --git a/zhengcaioa/IServices/ISimService.cs b/zhengcaioa/IServices/ISimService.cs index 6496f5e..6d1a716 100644 --- a/zhengcaioa/IServices/ISimService.cs +++ b/zhengcaioa/IServices/ISimService.cs @@ -22,8 +22,10 @@ SimCost GetSimCost(int id); - ResultDataEntity<SimCostView> SearchSimCostByPage(SimCostDTOSearch searchEntity); + List<SimCostView> SearchSimCostByPage(string sim, int year); SimCostView GetSimCost(string userid , int bill_year, int bill_month); + + ResultDataEntity<SimCostYearView> SearchSimCostYearByPage(SimCostDTOSearch searchEntity); } } diff --git a/zhengcaioa/Model/Sim.cs b/zhengcaioa/Model/Sim.cs index 7b98670..1528968 100644 --- a/zhengcaioa/Model/Sim.cs +++ b/zhengcaioa/Model/Sim.cs @@ -147,8 +147,94 @@ { get { - return status=="0"?"姝e父":"鍏宠处"; + return status=="0"?"鏈牳鍑�":"宸叉牳鍑�"; } } } + + [Table("v_sim_costyear")] + public class SimCostYearView + { + /// <summary> + /// 鍗″彿 + /// </summary> + [Key] + public string sim_id { get; set; } + + /// <summary> + /// 骞� + /// </summary> + public int bill_year { get; set; } + + /// <summary> + /// 1鏈� + /// </summary> + public decimal Jan { get; set; } + + /// <summary> + /// 2鏈� + /// </summary> + public decimal Feb { get; set; } + + /// <summary> + /// 3鏈� + /// </summary> + public decimal Mar { get; set; } + + /// <summary> + /// 4鏈� + /// </summary> + public decimal Apr { get; set; } + + /// <summary> + /// 5鏈� + /// </summary> + public decimal May { get; set; } + + /// <summary> + /// 6鏈� + /// </summary> + public decimal Jun { get; set; } + + /// <summary> + /// 7鏈� + /// </summary> + public decimal Jul { get; set; } + + /// <summary> + /// 8鏈� + /// </summary> + public decimal Aug { get; set; } + + /// <summary> + /// 9鏈� + /// </summary> + public decimal Sept { get; set; } + + /// <summary> + /// 10鏈� + /// </summary> + public decimal Oct { get; set; } + + /// <summary> + /// 11鏈� + /// </summary> + public decimal Nov { get; set; } + + /// <summary> + /// 12鏈� + /// </summary> + public decimal Dece { get; set; } + + /// <summary> + /// 鍗″彿 + /// </summary> + public string sim { get; set; } + + /// <summary> + /// 妫�鏌ョ紪杈戞湀 + /// </summary> + [NotMapped] + public int month { get; set; } + } } diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index d12c6ec..e283224 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -22,6 +22,8 @@ public virtual DbSet<SimCost> SimCost { get; set; } public virtual DbSet<SimCostView> SimCostView { get; set; } public virtual DbSet<HrSalaryAppeal> HrSalaryAppeal { get; set; } + public virtual DbSet<SimCostYearView> SimCostYearView { get; set; } + public virtual DbSet<AdmAskLeave> AdmAskLeaves { get; set; } public virtual DbSet<AdmAskLeaveOff> AdmAskLeaveOffs { get; set; } diff --git a/zhengcaioa/Services/HrSalaryService.cs b/zhengcaioa/Services/HrSalaryService.cs index 700adc6..b2a8ea3 100644 --- a/zhengcaioa/Services/HrSalaryService.cs +++ b/zhengcaioa/Services/HrSalaryService.cs @@ -101,6 +101,13 @@ var updatepltRole = _context.HrSalaries.Where(c=>c.Id==dto.Id).SingleOrDefault(); if(updatepltRole!=null) { + //鏇存柊鐢佃瘽璐圭敤鐘舵�� + var sim = _context.SimCost.Where(c => c.bill_year == dto.Year && c.bill_month <= dto.Month && c.user_id == dto.Userid && c.status == "0").ToList(); + foreach(var item in sim) + { + item.status = "1"; + } + var user = _context.PltUsers.Where(c => c.Id == updatepltRole.Userid).SingleOrDefault(); updatepltRole.Jiangjin = dto.Jiangjin; diff --git a/zhengcaioa/Services/SimService.cs b/zhengcaioa/Services/SimService.cs index 07fdc0e..674535e 100644 --- a/zhengcaioa/Services/SimService.cs +++ b/zhengcaioa/Services/SimService.cs @@ -209,13 +209,13 @@ ResultEntity resultEntity = new ResultEntity(); try { - var temp = _context.SimCost.Where(e => e.id == md.id).SingleOrDefault(); + var temp = _context.SimCost.Where(e => e.sim_id == md.sim_id && e.bill_year==md.bill_year && e.bill_month==md.bill_month).SingleOrDefault(); var tempBind = _context.SimBindView.Where(e => e.Id == md.sim_id).SingleOrDefault(); if (temp != null && temp.status=="0") { temp.bill_amount = md.bill_amount; - temp.bill_month = md.accounted_time.Month; - temp.bill_year = md.accounted_time.Year; + //temp.bill_month =md.m; + //temp.bill_year = md.accounted_time.Year; temp.sub_userid = md.sub_userid; temp.up_time = DateTime.Now; if(tempBind!=null) @@ -227,22 +227,22 @@ } else { - md.bill_month = md.accounted_time.Month; - md.bill_year = md.accounted_time.Year; + //md.bill_month = md.accounted_time.Month; + //md.bill_year = md.accounted_time.Year; //褰撴湀閲嶅鍒ゆ柇 - var monthck = _context.SimCost.Where(c => c.sim_id == md.sim_id && c.bill_year == md.bill_year && c.bill_month == md.bill_month).Count(); - if(monthck>0) - { - resultEntity.Result = false; - resultEntity.Message = string.Format("姝ょ數璇濆崱鍦╗{0}-{1}]鏈堝凡瀛樺湪璁板綍锛屼笉鑳介噸澶嶆坊鍔狅紱",md.bill_year,md.bill_month); - return resultEntity; - } - else + //var monthck = _context.SimCost.Where(c => c.sim_id == md.sim_id && c.bill_year == md.bill_year && c.bill_month == md.bill_month).Count(); + //if(monthck>0) + //{ + // resultEntity.Result = false; + // resultEntity.Message = string.Format("姝ょ數璇濆崱鍦╗{0}-{1}]鏈堝凡瀛樺湪璁板綍锛屼笉鑳介噸澶嶆坊鍔狅紱",md.bill_year,md.bill_month); + // return resultEntity; + //} + //else { md.up_time = DateTime.Now; md.status = "0"; - + md.accounted_time = DateTime.Now; if (tempBind != null) { md.allow_amount = decimal.Parse(tempBind.cardpro); @@ -284,9 +284,9 @@ /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> - public ResultDataEntity<SimCostView> SearchSimCostByPage(SimCostDTOSearch searchEntity) + public List<SimCostView> SearchSimCostByPage(string sim ,int year) { - ResultDataEntity<SimCostView> data = new ResultDataEntity<SimCostView>(); + List<SimCostView> data = new List<SimCostView>(); try { //var codedata = (from e in _context.SysCodes @@ -298,26 +298,29 @@ // && e.CodeField == "cardpro" // select c).OrderBy(x => x.Sort).ToList(); - var dt = _context.SimCostView.OrderByDescending(c => c.accounted_time).ToList(); - if (!string.IsNullOrEmpty(searchEntity.searchtime)) - { - var times = searchEntity.searchtime.Split('|'); - if(times.Length==2) - { - DateTime d1 = DateTime.Parse(times[0]); - DateTime d2 = DateTime.Parse(times[1]); - dt = dt.Where(c => c.accounted_time > d1 && c.accounted_time < d2).ToList(); - } - } - if (!string.IsNullOrEmpty(searchEntity.searchsim)) - { - dt = dt.Where(c => !string.IsNullOrEmpty(c.simcard) && c.simcard.Contains(searchEntity.searchsim)).ToList(); - } + data = _context.SimCostView.Where(c => c.bill_year==year && c.sim_id==sim).OrderBy(c=>c.bill_month).ToList(); + //if (!string.IsNullOrEmpty(searchEntity.searchtime)) + //{ + // var times = searchEntity.searchtime.Split('|'); + // if(times.Length==2) + // { + // DateTime d1 = DateTime.Parse(times[0]); + // DateTime d2 = DateTime.Parse(times[1]); + // dt = dt.Where(c => c.accounted_time > d1 && c.accounted_time < d2).ToList(); + // } + //} + //if (!string.IsNullOrEmpty(searchEntity.searchsim)) + //{ + // dt = dt.Where(c => !string.IsNullOrEmpty(c.simcard) && c.simcard.Contains(searchEntity.searchsim)).ToList(); + //} + //SimCostDTOSearch searchEntity = new SimCostDTOSearch(); + //searchEntity.rows = 20; + //searchEntity.page = 1; - if (searchEntity.totalrows == 0) - searchEntity.totalrows = dt.Count(); + //if (searchEntity.totalrows == 0) + // searchEntity.totalrows = dt.Count(); - var signinList = dt.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + //var signinList = dt.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); //signinList = signinList.Select(a => new SimBindView() //{ @@ -329,7 +332,7 @@ // username = a.username //}).ToList(); - data.LoadData(searchEntity, signinList); + //data.LoadData(searchEntity, signinList); } catch (Exception ex) { @@ -338,7 +341,13 @@ return data; } - + /// <summary> + /// 鏌ヨ璐圭敤璁板綍 + /// </summary> + /// <param name="userid"></param> + /// <param name="bill_year"></param> + /// <param name="bill_month"></param> + /// <returns></returns> public SimCostView GetSimCost(string userid, int bill_year, int bill_month) { @@ -349,6 +358,56 @@ return entity; } + /// <summary> + /// 鏌ヨ鍐呭 + /// </summary> + /// <param name="searchEntity"></param> + /// <returns></returns> + public ResultDataEntity<SimCostYearView> SearchSimCostYearByPage(SimCostDTOSearch searchEntity) + { + ResultDataEntity<SimCostYearView> data = new ResultDataEntity<SimCostYearView>(); + try + { + int year=DateTime.Now.Year; + if (!string.IsNullOrEmpty(searchEntity.searchtime)) + { + year = int.Parse(searchEntity.searchtime); + } + + var dt = (from c in _context.SimCostYearView where c.bill_year==year orderby c.sim select c).ToList(); + + if (!string.IsNullOrEmpty(searchEntity.searchsim)) + { + dt = dt.Where(c => c.sim==searchEntity.searchsim).ToList(); + } + + if (searchEntity.totalrows == 0) + searchEntity.totalrows = dt.Count(); + + var signinList = dt.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + if(signinList.Count>0) + { + var month = DateTime.Now.Month-1; + var ck = (from c in _context.SimCost where c.status == "1" && c.bill_year == year orderby c.bill_month descending select c).FirstOrDefault(); + if(ck!=null) + { + month= ck.bill_month; + } + foreach (var item in signinList) + { + item.month = month; + } + } + + data.LoadData(searchEntity, signinList); + } + catch (Exception ex) + { + throw; + } + return data; + } + #endregion } } diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/SimCostController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/SimCostController.cs index 507c37a..fad240b 100644 --- a/zhengcaioa/zhengcaioa/Controllers/admin/SimCostController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/admin/SimCostController.cs @@ -34,24 +34,24 @@ /// 鍒楄〃椤� /// </summary> /// <returns></returns> - public IActionResult Index() + public IActionResult Index(int year,string sim) { - List<ActionEntity> actionlist = new List<ActionEntity>(); - ActionEntity actionEntity = new ActionEntity(); - actionEntity.OpenType = 0; - actionEntity.ActionUrl = ""; - actionEntity.ActionFun = "Search"; - actionEntity.PageIco = "fa fa-search"; - actionEntity.ActionName = "鏌ヨ"; - actionlist.Add(actionEntity); + //List<ActionEntity> actionlist = new List<ActionEntity>(); + //ActionEntity actionEntity = new ActionEntity(); + //actionEntity.OpenType = 0; + //actionEntity.ActionUrl = ""; + //actionEntity.ActionFun = "Search"; + //actionEntity.PageIco = "fa fa-search"; + //actionEntity.ActionName = "鏌ヨ"; + //actionlist.Add(actionEntity); - ActionEntity actionEntity1 = new ActionEntity(); - actionEntity1.OpenType = 0; - actionEntity1.ActionUrl = ""; - actionEntity1.ActionFun = "Add"; - actionEntity1.PageIco = "fa fa-plus"; - actionEntity1.ActionName = "鏂板"; - actionlist.Add(actionEntity1); + //ActionEntity actionEntity1 = new ActionEntity(); + //actionEntity1.OpenType = 0; + //actionEntity1.ActionUrl = ""; + //actionEntity1.ActionFun = "Add"; + //actionEntity1.PageIco = "fa fa-plus"; + //actionEntity1.ActionName = "鏂板"; + //actionlist.Add(actionEntity1); //ActionEntity actionEntity4 = new ActionEntity(); @@ -62,7 +62,10 @@ //actionEntity4.ActionName = "鎵归噺鍒犻櫎"; //actionlist.Add(actionEntity4); - ViewData["ActionInfo"] = actionlist; + //ViewData["ActionInfo"] = actionlist; + ViewBag.Year = year; + ViewBag.Sim = sim; + //var js= _simService.SearchSimCostByPage(sim, year) return View(); } @@ -71,9 +74,17 @@ /// </summary> /// <param name="search"></param> /// <returns></returns> - public IActionResult GetList(SimCostDTOSearch search) + public IActionResult GetList(int year, string sim) { - return new JsonResult(_simService.SearchSimCostByPage(search)); + var list = _simService.SearchSimCostByPage(sim, year); + //var result = new + //{ + // total:"1", + // page: 1, + // records: list.Count, + // rows: list + //}; + return Json(list); } /// <summary> @@ -81,15 +92,18 @@ /// </summary> /// <param name="id"></param> /// <returns></returns> - public IActionResult Edit(string id=null) - { - ViewBag.SimCard = _simService.GetBindSim(); + public IActionResult Edit(string id,decimal money,int year, int month,string sim) + { SimCost dto = new SimCost(); - dto.accounted_time = DateTime.Now; - if (!string.IsNullOrEmpty(id)) - { - dto = _simService.GetSimCost(int.Parse(id)); - } + dto.bill_month = month; + dto.bill_amount = money; + dto.sim_id = id; + dto.sub_userid = sim; + dto.bill_year = year; + //if (!string.IsNullOrEmpty(id)) + //{ + // dto = _simService.GetSimCost(int.Parse(id)); + //} ViewData.Model = dto; return View(); } @@ -113,6 +127,39 @@ return new JsonResult(resultEntity); } + /// <summary> + /// 鍒楄〃椤� + /// </summary> + /// <returns></returns> + public IActionResult SimYear() + { + return View(); + } + + /// <summary> + /// 鍒楄〃鍐呭 + /// </summary> + /// <param name="search"></param> + /// <returns></returns> + public IActionResult GetSimYearList(SimCostDTOSearch search) + { + return new JsonResult(_simService.SearchSimCostYearByPage(search)); + } + + [HttpPost] + public IActionResult SaveSimYearCost(object data) + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ResultEntity resultEntity = new ResultEntity(); + //using (TransactionScope scope = new TransactionScope()) + //{ + // data.sub_userid = curentuser.Id; + // resultEntity = _simService.SaveCost(data); + // scope.Complete(); + //} + return new JsonResult(resultEntity); + } + ///// <summary> ///// 瑙g粦 ///// </summary> diff --git a/zhengcaioa/zhengcaioa/Views/SimCost/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/SimCost/Edit.cshtml index d419797..d9487c1 100644 --- a/zhengcaioa/zhengcaioa/Views/SimCost/Edit.cshtml +++ b/zhengcaioa/zhengcaioa/Views/SimCost/Edit.cshtml @@ -3,7 +3,6 @@ @using zhengcaioa.Models; @{ Layout = null; - List<SimBindView> Card = ViewData["SimCard"] as List<SimBindView>; } <!DOCTYPE html> @@ -58,40 +57,23 @@ <div id="div_content" class="ibox-content" style="background-color:white;"> <div class="row"> <div class="clearfix layer-area" style="padding-bottom:15px;"> - <label class="text-right col-sm-1 col-md-1 control-label">鐢佃瘽鍗″彿<i class="red">*</i></label> + <label class="text-right col-sm-1 col-md-1 control-label">鐢佃瘽鍙风爜<i class="red">*</i></label> <div class="col-sm-2 col-md-2"> - <select id="cbbCard" class="data form-control" name="sim_id" data-placeholder="閫夋嫨 搴忓垪 ..."> - <option value="" hassubinfo="true">璇烽�夋嫨</option> - @foreach (var item in Card) - { - @if (!item.Id.Equals(Model.sim_id)) - { - <option value="@item.Id" hassubinfo="true"> - @item.simcard - </option> - } - else - { - <option value="@item.Id" hassubinfo="true" selected="selected"> - @item.simcard - </option> - } - } - </select> - <input type="hidden" name="id" value="@Model.id" /> + <input type="text" value="@Model.sub_userid" class="form-control" readonly="readonly" /> + <input type="hidden" name="sim_id" value="@Model.sim_id" /> + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label class="text-right col-sm-1 col-md-1 control-label">璐圭敤鏈堜唤<i class="red">*</i></label> + <div class="col-sm-2 col-md-2"> + <input type="text" name="bill_month" class="form-control" value="@Model.bill_month" readonly="readonly" /> + <input type="hidden" name="bill_year" value="@Model.bill_year" /> </div> </div> <div class="clearfix layer-area" style="padding-bottom:15px;"> <label class="text-right col-sm-1 col-md-1 control-label">瀹為檯鐢佃瘽璐圭敤<i class="red">*</i></label> <div class="col-sm-2 col-md-2"> - <input id="billamount" class="form-control" label="钖祫寰呴亣" name="bill_amount" labtype="txt" addvisible="true" maxlength="500" editvisible="true" reg="" ismust="true" type="text" value="@Model.bill_amount" oninput="if(value.length>4)value=value.slice(0,10)" onkeyup="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"> - </div> - </div> - <div class="clearfix layer-area" style="padding-bottom:15px;"> - - <label class="text-right col-sm-1 col-md-1 control-label">璐圭敤璁拌处鏃ユ湡<i class="red">*</i></label> - <div class="col-sm-2 col-md-2"> - <input id="acTime" class="form-control" name="accounted_time" labtype="txt" addvisible="true" editvisible="true" reg="" ismust="true" type="text" value="@Model.accounted_time.ToString("yyyy/MM/dd")" > + <input id="billamount" class="form-control" name="bill_amount" labtype="txt" addvisible="true" maxlength="500" editvisible="true" reg="" ismust="true" type="text" value="@Model.bill_amount" oninput="if(value.length>4)value=value.slice(0,10)" onkeyup="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)"> </div> </div> </div> @@ -114,49 +96,32 @@ </form> <script type="text/javascript"> - $(function () { - - $("#cbbCard").chosen(); - - laydate({ elem: "#acTime", format: 'YYYY/MM/DD', istime: false, event: "focus" }); - - }); - - var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95; - $("#div_content").height(hh); - - toastr.options = { - "closeButton": true, - "debug": false, - "progressBar": true, - "positionClass": "toast-bottom-right", - "onclick": null, - "showDuration": "300", - "hideDuration": "600", - "timeOut": "4500", - "extendedTimeOut": "600", - "showEasing": "swing", - "hideEasing": "linear", - "showMethod": "fadeIn", - "hideMethod": "fadeOut" - }; - + + toastr.options = { + "closeButton": true, + "debug": false, + "progressBar": true, + "positionClass": "toast-bottom-right", + "onclick": null, + "showDuration": "300", + "hideDuration": "600", + "timeOut": "4500", + "extendedTimeOut": "600", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" + }; + // 淇濆瓨 function saveSimCost() { - if ($("#cbbCard").val() == '') { - toastr.warning("鐢佃瘽鍗″彿涓嶈兘涓虹┖"); - return; - } + if ($("#billamount").val() == '') { toastr.warning("瀹為檯鐢佃瘽璐圭敤涓嶈兘涓虹┖"); return; } - if ($("#acTime").val() == '') { - toastr.warning("璐圭敤璁拌处鏃ユ湡涓嶈兘涓虹┖"); - return; - } - + $.ajax({ type: "POST", url: "/SimCost/SaveSimCost", diff --git a/zhengcaioa/zhengcaioa/Views/SimCost/Index.cshtml b/zhengcaioa/zhengcaioa/Views/SimCost/Index.cshtml index 72d4b9a..2e65b55 100644 --- a/zhengcaioa/zhengcaioa/Views/SimCost/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/SimCost/Index.cshtml @@ -1,24 +1,77 @@ 锘緻{ - ViewBag.Title = "鐢佃瘽璐瑰綍鍏�"; - Layout = "~/Views/Shared/_Layout_Search.cshtml"; + ViewBag.Title = "鐢佃瘽璐�"; + Layout = null;// "~/Views/Shared/_Layout_Search.cshtml"; } -<link href="~/css/jquery-confirm.css" rel="stylesheet"> -<script src="~/js/jquery-confirm.js" type="text/javascript"></script> +<html> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> + <meta name="description" content=""> + <meta name="author" content="ThemeBucket"> + <title></title> + <link href="~/css/bootstrap.min.css" rel="stylesheet"> + <link href="~/css/plugins/jqgrid/ui.jqgrid.css?v=111111111" rel="stylesheet"> + <link href="~/css/animate.min.css" rel="stylesheet"> + <link href="~/css/style.min.css" rel="stylesheet"> + <script src="~/js/jquery.min.js"></script> + <script src="~/js/plugins/jqgrid/i18n/grid.locale-cn.js"></script> + <script src="~/js/plugins/jqgrid/jquery.jqGrid.min.js"></script> +</head> +<body style="width:100%;padding:10px"> + <table id="list2"></table> + @*<div id="pager2"></div>*@ -@section headerStyle{ +<script type="text/javascript"> - <script type="text/javascript"> + $(function () { + var year =@ViewBag.Year; + var sim ='@ViewBag.Sim'; + var urlstr = "/SimCost/GetList?year=" + year + "&sim=" + sim; - gridConfig = { multiselect: false, selectcol: "id" }; + jQuery("#list2").jqGrid( + { + url: urlstr, + datatype: "json", + colModel: [ + { + label: '鏃ユ湡', name : 'bill_year', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return rowObject.bill_year + "-" + rowObject.bill_month; + } + }, + { + label: '鐢佃瘽鍗″彿', name : 'simcard', labtype: 'txt', hidden: false, width: 150, + }, + { label: '浣跨敤浜哄憳', name : 'username', labtype: 'txt', hidden: false, width: 150 }, + { label: '鐢佃瘽鍗曢噾棰�', name : 'bill_amount', labtype: 'txt', hidden: false, width: 150 }, + { label: '鐢佃瘽琛ヨ创閲戦', name : 'allow_amount', labtype: 'txt', hidden: false, width: 150 }, + { label: '宸紓閲戦', name : 'amount', labtype: 'txt', hidden: false, width: 100 }, + { label: '鐘舵��', name : 'statusChs', labtype: 'txt', hidden: false, width: 100 }, + { label: '鏇存柊鏃ユ湡', name: 'up_time', labtype: 'txt', hidden: false, width: 200}, + ], + shrinkToFit: true, + //rowNum: 10, + //rowList: [10, 20, 30], + //pager: '#pager2', + //sortname: 'id', + mtype: "post", + viewrecords: true, + }); + }); + + + + @*gridConfig = { multiselect: false, selectcol: "id" }; dataCol = [ { label: '搴忓彿', name: 'id', labtype: 'txt', hidden: false, width: 50 }, - { label: '璐﹀崟鏃ユ湡', name: 'accountMonth', labtype: 'txt', hidden: false, width: 150 }, + { + label: '鏃ユ湡', name: 'bill_year', labtype: 'txt', hidden: false, width: 150, + formatter: function (cellvalue, options, rowObject) { + return rowObject.bill_year + "-" + rowObject.bill_month; + }}, { label: '鐢佃瘽鍗″彿', name: 'simcard', labtype: 'txt', hidden: false, width: 150, - formatter: function (cellvalue, options, rowObject) { - return "<a onclick=\"OpenWindow('缂栬緫鐢佃瘽璐圭敤','98%','90%', '/SimCost/Edit?id=" + rowObject.id + "')\" >" + cellvalue + "</a>"; - } }, { label: '浣跨敤浜哄憳', name: 'username', labtype: 'txt', hidden: false, width: 150 }, { label: '鐢佃瘽鍗曢噾棰�', name: 'bill_amount', labtype: 'txt', hidden: false, width: 100 }, @@ -27,80 +80,11 @@ { label: '鐘舵��', name: 'statusChs', labtype: 'txt', hidden: false, width: 100 }, { label: '鏇存柊鏃ユ湡', name: 'up_time', labtype: 'txt', hidden: false }, ]; - dataUrl = "/SimCost/GetList"; - searchCol = [ - { label: '鏃堕棿', name: 'searchtime', labtype: 'datearea', hidden: false }, - { label: '鐢佃瘽鍗″彿', name: 'searchsim', labtype: 'txt', hidden: false, cwidth: '5%', cccwidth: '8%' } - ]; + dataUrl = "/SimCost/GetList?year=" +@ViewBag.Year+"&sim="+@ViewBag.Sim;*@ - var _pageAdd = function () { - OpenWindow("鏂板鐢佃瘽璐圭敤", "98%", "90%", "/SimCost/Edit/"); - } +</script> - var _pageUnBind = function () { - var db = jQuery('#jqGrid').jqGrid('getGridParam', 'selarrrow'); - if (db.length > 0) { - $.confirm({ - title: '瑙i櫎缁戝畾鎿嶄綔纭', - content: '姝ゆ搷浣滃皢瑙i櫎鎵�閫夊畾鐢佃瘽鍗″拰浜哄憳缁戝畾鍏崇郴锛岀‘璁よ缁х画鍚�?', - type: 'green', - icon: 'glyphicon glyphicon-question-sign', - buttons: { - ok: { - text: '纭', - btnClass: 'btn-primary', - action: function () { - $.ajax({ - type: "POST", - url: "/Sim/UnBindSim?id="+db, - dataType: "json", - global: false, - success: function (data) { +</body> +</html> - if (data.Result) { - jQuery('#jqGrid').jqGrid().trigger('reloadGrid'); - - parent.layer.msg('璁剧疆鎴愬姛', { icon: 6 }); - } - else { - parent.layer.msg(data.Message, { icon: 5 }); - } - }, - error: function () { - parent.layer.msg('澶辫触', { icon: 5 }); - } - }); - } - }, - cancel: { - text: '鍙栨秷', - btnClass: 'btn-primary' - } - } - }); - } - else { - $.alert("璇峰厛閫夋嫨闇�瑕佽В缁戠殑鐢佃瘽鍗★紒"); - } - } - - var _afterSave = function (result) { - if (result) { - toastr.success("淇濆瓨鎴愬姛"); - } else { - toastr.error("淇濆瓨澶辫触"); - } - } - - var _afterDel = function (result) { - if (result) { - toastr.success("鍒犻櫎鎴愬姛"); - } else { - /**/ - toastr.error("鍒犻櫎鎴愬姛"); - /**/ - } - } - </script> -} diff --git a/zhengcaioa/zhengcaioa/Views/SimCost/SimYear.cshtml b/zhengcaioa/zhengcaioa/Views/SimCost/SimYear.cshtml new file mode 100644 index 0000000..6e52dcf --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/SimCost/SimYear.cshtml @@ -0,0 +1,142 @@ +锘緻{ + ViewBag.Title = "鐢佃瘽璐圭粺璁″綍鍏�"; + Layout = "~/Views/Shared/_Layout_Search.cshtml"; +} + +<link href="~/css/jquery-confirm.css" rel="stylesheet"> +<link href="~/js/plugins/layer/laydate/theme/default/laydate.css" rel="stylesheet"> +<script src="~/js/jquery-confirm.js" type="text/javascript"></script> +<script src="~/js/plugins/layer/laydate/laydate5.js" type="text/javascript"></script> + +<style> + /* .laydate_table { + display: none; + }*/ + + .col-base { + line-height: 35px; + } + /* + #laydate_hms { + display: none !important; + }*/ +</style> + +@section headerStyle{ + + <table style="line-height:35px;margin-top:15px"> + <tr> + <td width="100"></td> + <td>鏌ヨ骞翠唤锛�</td> + <td width="180"> + <input id="acTime" style="width:150px" class="layui-input" placeholder="yyyy" type="text" /> + </td> + <td>鐢佃瘽鍗″彿锛�</td> + <td width="180"> + <input id="acSim" class="form-control" labtype="txt" addvisible="true" type="text"> + </td> + <td> + <a class="btn btn-default btn-outline" href="#" onclick="doSearch()" style="margin-left:20px"> + <i class="fa fa-search"></i> <span class="bold">鏌ヨ</span> + </a> + </td> + <td></td> + </tr> + </table> + + <script type="text/javascript"> + + gridConfig = { multiselect: false, selectcol: "sim_id" }; + shrinkToFit = true; + footerrow = true; + + dataCol = [ + { label: '搴忓彿', name: 'sim_id', labtype: 'txt', hidden: true }, + { label: '骞翠唤', name: 'bill_year', labtype: 'txt', hidden: false, width: 100 }, + { + label: '鐢佃瘽鍗″彿', name: 'sim', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + var simcode = rowObject.sim_id; + var url = "/SimCost/Index?year=" + rowObject.bill_year + "&sim=" + simcode; + return "<a onclick=\"OpenWindow('鐢佃瘽璐�','70%','50%','"+url+"' )\" >" + cellvalue + "</a>"; + } + }, + + { + label: '1鏈�', name: 'Jan', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter + }, + { label: '2鏈�', name: 'Feb', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter }, + { label: '3鏈�', name: 'Mar', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '4鏈�', name: 'Apr', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '5鏈�', name: 'May', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '6鏈�', name: 'Jun', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '7鏈�', name: 'Jul', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '8鏈�', name: 'Aug', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '9鏈�', name: 'Sept', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '10鏈�', name: 'Oct', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter}, + { label: '11鏈�', name: 'Nov', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter }, + { label: '12鏈�', name: 'Dece', labtype: 'txt', hidden: false, align: 'right', width: 100, formatter: currencyFmatter } + ]; + dataUrl = "/SimCost/GetSimYearList"; + searchCol = []; + + var lastsel; + + $(function () { + + laydate.render({ + elem: '#acTime' + , type: 'year' + , value: getNowFormatDate() + }); + + //$("#jqGridPager").hide();//闅愯棌div + + //$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ 'overflow-x': 'scroll' }); + + //jQuery("#jqGrid").jqGrid('setGridHeight', 150); + + }); + + + function getNowFormatDate() { + var date = new Date(); + var year = date.getFullYear(); + return year; + } + + function currencyFmatter(cellvalue, options, rowObject) { + var id = rowObject.sim_id; + var sim = rowObject.sim; + var m = options.pos - 3; + + if (m > rowObject.month) { + var y = rowObject.bill_year; + var url = "/SimCost/Edit?id=" + id + "&money=" + cellvalue + "&year=" + y + "&month=" + m + "&sim=" + sim; + + return "<a onclick=\"OpenWindow('鐢佃瘽璐圭敤褰曞叆','30%','50%','" + url + "')\">" + cellvalue + "</a>"; + } + else { + return cellvalue; + } + } + + function doSearch() { + + + // $("#jqGrid").trigger('reloadGrid'); + $("#jqGrid").jqGrid('setGridParam', { + url: "/SimCost/GetSimYearList", + postData: { + searchtime: $('#acTime').val(), + searchsim: $('#acSim').val(), + } + + }).trigger("reloadGrid"); + + } + + + </script> + +} \ No newline at end of file diff --git "a/\347\224\250\346\210\267\350\241\250\346\233\264\346\226\260.sql" "b/\347\224\250\346\210\267\350\241\250\346\233\264\346\226\260.sql" index c194601..02c585d 100644 --- "a/\347\224\250\346\210\267\350\241\250\346\233\264\346\226\260.sql" +++ "b/\347\224\250\346\210\267\350\241\250\346\233\264\346\226\260.sql" @@ -103,7 +103,7 @@ --电话卡分配菜单 insert into [plt_page] values('a3479c03-d554-4e02-b201-487e8e1dfb55','1','电话卡分配','',3,'/Sim/Index/','01','M','967b0bdd-cd5d-4660-8c72-7f744c07751b','',0,'A','e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate(),'e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate()) --电话费记录明细 -insert into [plt_page] values('5E973843-7EB4-41A6-B49B-192208647B2C','1','电话费用记录','',4,'/SimCost/Index/','01','M','967b0bdd-cd5d-4660-8c72-7f744c07751b','',0,'A','e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate(),'e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate()) +insert into [plt_page] values('5E973843-7EB4-41A6-B49B-192208647B2C','1','电话费用记录','',4,'/SimCost/SimYear/','01','M','967b0bdd-cd5d-4660-8c72-7f744c07751b','',0,'A','e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate(),'e4c93811-b9b1-4998-89f5-c416ebab0c07',getdate()) USE [zhengcaioa] GO -- Gitblit v1.9.1