Esempio n. 1
0
        /// <summary>
        /// 利润分析表
        /// </summary>
        /// <param name="carrierid">承运商ID</param>
        /// <param name="storageid">仓库ID</param>
        /// <param name="customerid">客户ID</param>
        /// <param name="receivername">收货方</param>
        /// <param name="ordertype">订单类型</param>
        /// <param name="orderno">订单编号</param>
        /// <param name="begindate">订单开始时间</param>
        /// <param name="enddate">订单结束时间</param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult ProfitReport(int carrierid    = 0, int storageid   = 0, int customerid    = 0, string receivername = "",
                                         string ordertype = "", string orderno = "", string begindate = "", string enddate     = "", int p = 1)
        {
            // 默认当月
            if (string.IsNullOrEmpty(begindate) || string.IsNullOrEmpty(enddate))
            {
                DateTime dt = DateTime.Now;
                begindate = dt.Year + "-" + dt.Month + "-" + "01";
                enddate   = DateTime.Now.ToString("yyyy-MM-dd");
            }

            List <OrderEntity> mList   = null;
            OrderFeeInfo       feeinfo = ReportService.GetOrderCount("", carrierid, storageid, customerid, -1, -1, -1, ordertype, orderno, begindate, enddate, -1);
            int       count            = feeinfo.count;
            PagerInfo pager            = new PagerInfo();

            pager.PageIndex = p;
            pager.PageSize  = PAGESIZE;
            pager.SumCount  = count;
            pager.URL       = "ProfitReport";

            mList = ReportService.GetOrderInfoByRule(pager, "", carrierid, storageid, customerid, -1, -1, -1, ordertype, orderno, begindate, enddate, -1);

            //默认承运商
            ViewBag.Carrier = CarrierService.GetCarrierByRule("", 1);    //只显示使用中的数据
            //默认仓库
            ViewBag.Storage = StorageService.GetStorageByRule("", 1);    //只显示使用中的数据
            //客户信息
            ViewBag.Customer = CustomerService.GetCustomerByRule("", 1); //只显示使用中的数据
            //订单类型
            List <BaseDataEntity> orderTypeList = BaseDataService.GetBaseDataAll().Where(t => t.PCode == "OrderTypeList").ToList();

            ReEntity report = ReportService.CreateReportList(mList);

            report.TotalAllPayAmount     = feeinfo.TotalAllPayAmount;
            report.TotalllReceiverAmount = feeinfo.TotalllReceiverAmount;
            ViewBag.Report = report;



            ViewBag.GUID          = System.Guid.NewGuid().ToString();
            ViewBag.carrierid     = carrierid;
            ViewBag.storageid     = storageid;
            ViewBag.customerid    = customerid;
            ViewBag.OrderType     = ordertype;
            ViewBag.BeginDate     = begindate;
            ViewBag.EndDate       = enddate;
            ViewBag.orderTypeList = orderTypeList;
            ViewBag.ReceiverName  = receivername;
            //存入缓存
            Cache.Add(ViewBag.GUID, report.reportList);
            ViewBag.Pager = pager;
            return(View());
        }
Esempio n. 2
0
        public OrderFeeInfo GetOrderCount(string name, int carrierid, int storageid, int customerid, int status, int uploadstatus,
                                          int orderstatus, string ordertype, string orderno, string begindate, string enddate, int operatorid, string ordersource,
                                          string subOrderType, string OrderOutStatus, string deliveryStatus, string sqlwhere, string receiverids)
        {
            OrderFeeInfo  feeInfo = new OrderFeeInfo();
            StringBuilder builder = new StringBuilder();

            builder.Append(OrderStatement.GetCount);
            if (carrierid > 0)
            {
                builder.Append(" AND Carrierid=@Carrierid");
            }
            if (storageid > 0)
            {
                builder.Append(" AND StorageID=@StorageID");
            }
            if (customerid > 0)
            {
                builder.Append(" AND CustomerID=@CustomerID");
            }
            if (!string.IsNullOrEmpty(receiverids))
            {
                builder.Append(" AND ReceiverID in(" + receiverids.Trim(',') + ")");
            }
            if (status > -1)
            {
                builder.Append(" AND Status=@Status");
            }
            if (uploadstatus > -1)
            {
                builder.Append(" AND UploadStatus=@UploadStatus");
            }
            if (orderstatus > -1)
            {
                builder.Append(" AND orderstatus=@orderstatus");
            }
            if (!string.IsNullOrEmpty(ordertype))
            {
                builder.Append(" AND ordertype=@ordertype");
            }
            if (!string.IsNullOrEmpty(orderno))
            {
                //builder.Append(" AND orderno=@orderno ");
                builder.Append(" AND (orderno='" + orderno + "' or ReceiverID in(select ReceiverID from wms_ReceiverInfo where ReceiverName like '%" + orderno + "%') or ReceiverStorageID in (select StorageID from wms_StorageInfo where StorageName like '%" + orderno + "%' )) ");
                //builder.Append(" AND (orderno='" + orderno + "' ) ");
            }
            if (!string.IsNullOrEmpty(begindate) && !string.IsNullOrEmpty(enddate))
            {
                builder.Append(" AND OrderDate BETWEEN @begindate AND @enddate ");
            }
            if (operatorid > -1)
            {
                builder.Append(" AND OperatorID=@OperatorID ");
            }
            if (!string.IsNullOrEmpty(ordersource))
            {
                builder.Append(" AND OrderSource=@OrderSource");
            }
            if (!string.IsNullOrEmpty(subOrderType))
            {
                builder.Append(" AND SubOrderType=@SubOrderType");
            }

            if (!string.IsNullOrEmpty(OrderOutStatus))
            {
                builder.Append(" AND OrderOutStatus=@OrderOutStatus");
            }
            if (!string.IsNullOrEmpty(deliveryStatus))
            {
                builder.Append(" AND DeliveryStatus=@DeliveryStatus");
            }
            if (!string.IsNullOrEmpty(sqlwhere))
            {
                builder.Append(sqlwhere);
            }

            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(builder.ToString(), "Text"));

            if (carrierid > 0)
            {
                command.AddInputParameter("@Carrierid", DbType.Int32, carrierid);
            }
            if (storageid > 0)
            {
                command.AddInputParameter("@StorageID", DbType.Int32, storageid);
            }
            if (customerid > 0)
            {
                command.AddInputParameter("@CustomerID", DbType.Int32, customerid);
            }
            if (status > -1)
            {
                command.AddInputParameter("@Status", DbType.Int32, status);
            }
            if (uploadstatus > -1)
            {
                command.AddInputParameter("@UploadStatus", DbType.Int32, uploadstatus);
            }
            //if (!string.IsNullOrEmpty(receiverids))
            //{
            //    command.AddInputParameter("@ReceiverIDs", DbType.String, receiverids.Trim(','));
            //}
            if (orderstatus > -1)
            {
                command.AddInputParameter("@OrderStatus", DbType.Int32, orderstatus);
            }
            if (!string.IsNullOrEmpty(ordertype))
            {
                command.AddInputParameter("@ordertype", DbType.String, ordertype);
            }
            //if (!string.IsNullOrEmpty(orderno))
            //{
            //    command.AddInputParameter("@orderno", DbType.String, orderno);
            //}
            if (!string.IsNullOrEmpty(begindate) && !string.IsNullOrEmpty(enddate))
            {
                command.AddInputParameter("@begindate", DbType.String, begindate);
                command.AddInputParameter("@enddate", DbType.String, enddate);
            }
            if (operatorid > -1)
            {
                command.AddInputParameter("@OperatorID", DbType.Int32, operatorid);
            }
            if (!string.IsNullOrEmpty(ordersource))
            {
                command.AddInputParameter("@OrderSource", DbType.String, ordersource);
            }
            if (!string.IsNullOrEmpty(subOrderType))
            {
                command.AddInputParameter("@SubOrderType", DbType.String, subOrderType);
            }

            if (!string.IsNullOrEmpty(OrderOutStatus))
            {
                command.AddInputParameter("@OrderOutStatus", DbType.String, OrderOutStatus);
            }
            if (!string.IsNullOrEmpty(deliveryStatus))
            {
                command.AddInputParameter("@DeliveryStatus", DbType.String, deliveryStatus);
            }
            feeInfo = command.ExecuteEntity <OrderFeeInfo>();
            return(feeInfo);
            //var o = command.ExecuteScalar<object>();
            //return Convert.ToInt32(o);
        }