Exemple #1
0
        /// <summary>
        /// 营业单据列表页面,导出Excel
        /// </summary>
        /// <param name="fc">form表单</param>
        public void ExportSalerExcel(FormCollection fc)
        {
            SalerSearchParamModel pm = new SalerSearchParamModel();

            SomeUtils.SetFieldValueToModel(fc, pm);

            BillSv bill = (BillSv) new BillUtils().GetBillSvInstance(pm.billType);

            Wlog("营业员导出Excel:" + JsonConvert.SerializeObject(pm));

            bill.ExportSalerExcle(pm, currentUser.userId);
        }
Exemple #2
0
        public override List <object> GetBillList(SalerSearchParamModel pm, int userId)
        {
            bool canCheckAll = new UA(userId).CanCheckAllBill();

            DateTime fd, td;

            if (!DateTime.TryParse(pm.fromDate, out fd))
            {
                fd = DateTime.Parse("2021-01-01");
            }
            if (!DateTime.TryParse(pm.toDate, out td))
            {
                td = DateTime.Parse("2049-09-09");
            }
            td = td.AddDays(1);

            var result = from e in db.Sale_BL
                         join a in db.Apply on e.sys_no equals a.sys_no into X
                         from Y in X.DefaultIfEmpty()
                         where (canCheckAll || e.applier_id == userId) &&
                         e.bill_date >= fd &&
                         e.bill_date < td &&
                         (pm.auditResult == 10 || (pm.auditResult == 0 && (Y == null || (Y != null && Y.success == null))) || (pm.auditResult == 1 && Y != null && Y.success == true) || pm.auditResult == -1 && Y != null && Y.success == false)
                         select new BLListModel()
            {
                billId       = e.id,
                auditStatus  = (Y == null ? "未开始申请" : Y.success == true ? "申请成功" : Y.success == false ? "申请失败" : "审批之中"),
                billDate     = e.bill_date.ToShortDateString(),
                customerName = e.customer_name,
                productModel = e.product_model,
                qty          = e.bl_qty,
                productName  = e.product_name,
                sysNo        = e.sys_no
            };

            if (!string.IsNullOrWhiteSpace(pm.searchValue))
            {
                result = result.Where(r => r.sysNo.Contains(pm.searchValue));
            }

            if (!string.IsNullOrWhiteSpace(pm.itemModel))
            {
                result = result.Where(r => r.productModel.Contains(pm.itemModel));
            }

            if (!string.IsNullOrWhiteSpace(pm.customerName))
            {
                result = result.Where(r => r.customerName.Contains(pm.customerName));
            }

            return(result.OrderByDescending(r => r.billId).Take(200).ToList <object>());
        }
Exemple #3
0
        /// <summary>
        /// 营业员导出excel
        /// </summary>
        /// <param name="pm">查询参数模型</param>
        /// <param name="userId">用户id</param>
        public override void ExportSalerExcle(SalerSearchParamModel pm, int userId)
        {
            bool canCheckAll = new UA(userId).CanCheckAllBill();

            DateTime fd, td;

            if (!DateTime.TryParse(pm.fromDate, out fd))
            {
                fd = DateTime.Parse("2017-01-01");
            }
            if (!DateTime.TryParse(pm.toDate, out td))
            {
                td = DateTime.Parse("2049-09-09");
            }
            td = td.AddDays(1);

            var result = from h in db.Sale_eo_bill
                         join e in db.Sale_eo_bill_detail on h.id equals e.eo_id
                         join a in db.Apply on h.sys_no equals a.sys_no into X
                         from Y in X.DefaultIfEmpty()
                         where (canCheckAll || h.applier_id == userId) &&
                         h.apply_time >= fd &&
                         h.apply_time < td &&
                         (pm.auditResult == 10 || (pm.auditResult == 0 && (Y == null || (Y != null && Y.success == null))) || (pm.auditResult == 1 && Y != null && Y.success == true) || pm.auditResult == -1 && Y != null && Y.success == false)
                         select new ExcelData()
            {
                h           = h,
                e           = e,
                auditStatus = (Y == null ? "未开始申请" : Y.success == true ? "申请成功" : Y.success == false ? "申请失败" : "审批之中")
            };

            if (!string.IsNullOrWhiteSpace(pm.searchValue))
            {
                result = result.Where(r => r.h.sys_no.Contains(pm.searchValue));
            }

            if (!string.IsNullOrWhiteSpace(pm.itemModel))
            {
                result = result.Where(r => r.e.product_model.Contains(pm.itemModel));
            }

            if (!string.IsNullOrWhiteSpace(pm.customerName))
            {
                result = result.Where(r => r.h.customer_name.Contains(pm.customerName));
            }

            ExportExcel(result.OrderByDescending(r => r.h.id).Take(200).ToList());
        }
Exemple #4
0
        /// <summary>
        /// 获得单据列表
        /// </summary>
        /// <param name="pm">查询条件模型</param>
        /// <param name="userId">用户id</param>
        /// <returns></returns>
        public override List <object> GetBillList(SalerSearchParamModel pm, int userId)
        {
            bool canCheckAll = new UA(userId).CanCheckAllBill();

            pm.searchValue  = pm.searchValue ?? "";
            pm.customerName = pm.customerName ?? "";

            DateTime fd, td;

            if (!DateTime.TryParse(pm.fromDate, out fd))
            {
                fd = DateTime.Parse("2017-01-01");
            }
            if (!DateTime.TryParse(pm.toDate, out td))
            {
                td = DateTime.Parse("2049-09-09");
            }
            td = td.AddDays(1);

            var result = (from o in db.Order
                          from d in o.OrderDetail
                          join a in db.Apply on o.sys_no equals a.sys_no into X
                          from Y in X.DefaultIfEmpty()
                          where (canCheckAll || o.original_id == userId) &&
                          o.order_date >= fd &&
                          o.order_date <= td &&
                          (o.sys_no.Contains(pm.searchValue) || d.item_model.Contains(pm.searchValue)) &&
                          o.customer_name.Contains(pm.customerName) &&
                          (pm.productType == null || o.product_type_name.Contains(pm.productType)) &&
                          (pm.saleRange == null || (pm.saleRange == "内销" && o.currency_no == "RMB") || (pm.saleRange == "外销" && o.currency_no != "RMB")) &&
                          (pm.auditResult == 10 || (pm.auditResult == 0 && (Y == null || (Y != null && Y.success == null))) || (pm.auditResult == 1 && Y != null && Y.success == true) || pm.auditResult == -1 && Y != null && Y.success == false)
                          orderby o.order_date descending
                          select new SOListModel()
            {
                orderId = o.id,
                orderDate = DateTime.Parse(o.order_date.ToString()).ToString("yyyy-MM-dd"),
                qty = d.qty.ToString(),
                dealPrice = d.deal_price.ToString(),
                sysNo = o.sys_no,
                customerName = o.customer_name,
                productModel = d.item_model,
                productName = d.item_name,
                auditStatus = (Y == null ? "未开始申请" : Y.success == true ? "申请成功" : Y.success == false ? "申请失败" : "审批之中")
            }).Take(200).ToList <object>();

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 营业员导出excel
        /// </summary>
        /// <param name="pm">查询参数模型</param>
        /// <param name="userId">用户id</param>
        public override void ExportSalerExcle(SalerSearchParamModel pm, int userId)
        {
            //首先从K3同步一下订单号
            //db.updateAllK3OrderNo();

            pm.searchValue  = pm.searchValue ?? "";
            pm.customerName = pm.customerName ?? "";
            DateTime fd, td;

            if (!DateTime.TryParse(pm.fromDate, out fd))
            {
                fd = DateTime.Parse("2017-01-01");
            }
            if (!DateTime.TryParse(pm.toDate, out td))
            {
                td = DateTime.Parse("2049-09-09");
            }
            td = td.AddDays(1);

            var result = (from o in db.Order
                          from d in o.OrderDetail
                          join a in db.Apply on o.sys_no equals a.sys_no into X
                          from Y in X.DefaultIfEmpty()
                          where o.original_id == userId &&
                          o.order_date >= fd &&
                          o.order_date <= td &&
                          (o.sys_no.Contains(pm.searchValue) || d.item_model.Contains(pm.searchValue)) &&
                          o.customer_name.Contains(pm.customerName) &&
                          (pm.productType == null || o.product_type_name.Contains(pm.productType)) &&
                          (pm.saleRange == null || (pm.saleRange == "内销" && o.currency_no == "RMB") || (pm.saleRange == "外销" && o.currency_no != "RMB")) &&
                          (pm.auditResult == 10 || (pm.auditResult == 0 && (Y == null || (Y != null && Y.success == null))) || (pm.auditResult == 1 && Y != null && Y.success == true) || pm.auditResult == -1 && Y != null && Y.success == false)
                          orderby o.order_date descending
                          select new ExcelData()
            {
                h = o,
                e = d,
                auditStatus = (Y == null ? "未开始申请" : Y.success == true ? "申请成功" : Y.success == false ? "申请失败" : "审批之中")
            }).Take(200).ToList();

            ExportExcel(result);
        }
Exemple #6
0
        /// <summary>
        /// 营业员导出excel
        /// </summary>
        /// <param name="pm">查询参数模型</param>
        /// <param name="userId">用户id</param>
        public override void ExportSalerExcle(SalerSearchParamModel pm, int userId)
        {
            bool canCheckAll = new UA(userId).CanCheckAllBill();

            pm.searchValue  = pm.searchValue ?? "";
            pm.customerName = pm.customerName ?? "";
            DateTime fd, td;

            if (!DateTime.TryParse(pm.fromDate, out fd))
            {
                fd = DateTime.Parse("2017-01-01");
            }
            if (!DateTime.TryParse(pm.toDate, out td))
            {
                td = DateTime.Parse("2049-09-09");
            }
            td = td.AddDays(1);

            //先检查出货组权限
            List <string> ptypes = GetCHTypes(userId);

            var result = (from o in db.ChBill
                          from d in o.ChBillDetail
                          join a in db.Apply on o.sys_no equals a.sys_no into X
                          from Y in X.DefaultIfEmpty()
                          where (canCheckAll || o.user_id == userId || ptypes.Contains(o.product_type)) &&
                          o.bill_date >= fd &&
                          o.bill_date <= td &&
                          (o.sys_no.Contains(pm.searchValue) || d.item_model.Contains(pm.searchValue)) &&
                          (o.customer_name.Contains(pm.customerName) || o.customer_no.Contains(pm.customerName)) &&
                          (pm.auditResult == 10 || (pm.auditResult == 0 && (Y == null || (Y != null && Y.success == null))) || (pm.auditResult == 1 && Y != null && Y.success == true) || pm.auditResult == -1 && Y != null && Y.success == false)
                          orderby o.bill_date descending
                          select new ExcelData()
            {
                h = o,
                e = d,
                auditStatus = (Y == null ? "未开始申请" : Y.success == true ? "申请成功" : Y.success == false ? "申请失败" : "审批之中")
            }).Take(200).ToList();

            ExportExcel(result);
        }
        public JsonResult GetBillList(FormCollection fc)
        {
            SalerSearchParamModel pm = new SalerSearchParamModel();

            SomeUtils.SetFieldValueToModel(fc, pm);

            var queryData = Request.Cookies["ele_sa_" + pm.billType + "_qd"];

            if (queryData == null)
            {
                queryData = new HttpCookie("ele_sa_" + pm.billType + "_qd");
            }
            queryData.Expires = DateTime.Now.AddDays(20);
            queryData.Value   = SomeUtils.EncodeToUTF8(JsonConvert.SerializeObject(pm));
            Response.AppendCookie(queryData);

            Wlog("获取列表数据:" + JsonConvert.SerializeObject(pm));

            SetBillByType(pm.billType);
            return(Json(bill.GetBillList(pm, currentUser.userId), "text/html"));
        }
        public ActionResult CheckBillList(string billType)
        {
            Wlog("打开单据列表视图,billType:" + billType);

            SalerSearchParamModel pm;
            var queryData = Request.Cookies["ele_sa_" + billType + "_qd"];

            if (queryData != null)
            {
                pm = JsonConvert.DeserializeObject <SalerSearchParamModel>(SomeUtils.DecodeToUTF8(queryData.Value));
            }
            else
            {
                pm             = new SalerSearchParamModel();
                pm.auditResult = 0;
                pm.billType    = billType;
            }
            ViewData["queryParams"] = pm;

            SetBillByType(billType);
            return(View(bill.CheckListViewName));
        }
Exemple #9
0
 /// <summary>
 /// 取得单据列表
 /// </summary>
 /// <param name="fc">查询表单值</param>
 /// <param name="userId">用户ID</param>
 /// <returns></returns>
 public abstract List <object> GetBillList(SalerSearchParamModel pm, int userId);
Exemple #10
0
 /// <summary>
 /// 营业员导出Excel
 /// </summary>
 /// <param name="pm">搜索参数模型</param>
 public abstract void ExportSalerExcle(SalerSearchParamModel pm, int userId);