Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string act       = (string.IsNullOrEmpty(Request["act"])) ? "" : Request["act"];
            string thisYear  = currentTime.ToString("yyyy");
            string thisMonth = currentTime.ToString("MM");
            string thisDay   = currentTime.ToString("dd");

            startYear  = (!string.IsNullOrEmpty(Request["startYear"])) ? Request["startYear"] : thisYear;
            startMonth = (!string.IsNullOrEmpty(Request["startMonth"])) ? Request["startMonth"] : thisMonth;
            startDay   = (!string.IsNullOrEmpty(Request["startDay"])) ? Request["startDay"] : thisDay;
            endYear    = (!string.IsNullOrEmpty(Request["endYear"])) ? Request["endYear"] : thisYear;
            endMonth   = (!string.IsNullOrEmpty(Request["endMonth"])) ? Request["endMonth"] : thisMonth;
            endDay     = (!string.IsNullOrEmpty(Request["endDay"])) ? Request["endDay"] : thisDay;
            string QueryType = (!string.IsNullOrEmpty(Request["QueryType"])) ? Request["QueryType"] : "";

            if (QueryType == "訂單資料查詢" || QueryType == "")
            {
                LoadOrderData();
            }
            else
            {
                LoadReturnOrderData();
            }


            if (act == "GetOrderItem")
            {
                DataTable dt        = Order.GetOrderItemByOrderID(Request["OrderID"]);
                string    OrderItem = Order.GetOrderItemString(dt);
                var       result    = new { result = dt.Rows.Count > 0, data = OrderItem };
                ShowResultOnPage(JsonConvert.SerializeObject(result));
            }


            if (act == "CancelOrders")
            {
                string ErrorMsg = "";
                bool   status   = false;
                if (Auth())
                {
                    string IPaddress = Request.UserHostAddress;
                    string PosNo     = PosNumber.GetPosNumberMapping(IPaddress);
                    status = Order.CancelOrders(Request["OrderID"], PosNo, ck.ID);
                    if (status)
                    {
                        ErrorMsg = "新增成功";
                    }
                    else
                    {
                        ErrorMsg = "新增失敗";
                    }
                }
                else
                {
                    ErrorMsg = "尚未登入";
                }
                var result = new { result = status, ErrorMsg = ErrorMsg };
                ShowResultOnPage(JsonConvert.SerializeObject(result));
            }
        }
Exemplo n.º 2
0
        public void PosNoBiding()
        {
            string IPaddress = Request.UserHostAddress;

            PosNo     = PosNumber.GetPosNumberMapping(IPaddress);
            MachineNo = PosNumber.GetInvoiceMachineNo(IPaddress);
        }
Exemplo n.º 3
0
        public void PosNoBiding()
        {
            string IPaddress = Request.UserHostAddress;

            PosNo = int.Parse(PosNumber.GetPosNumberMapping(IPaddress)).ToString("D3");
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string act = (string.IsNullOrEmpty(Request["act"])) ? "" : Request["act"];
            string thisYear = currentTime.ToString("yyyy");
            string thisMonth = currentTime.ToString("MM");
            string thisDay = currentTime.ToString("dd");
            startYear = (!string.IsNullOrEmpty(Request["startYear"])) ? Request["startYear"] : thisYear;
            startMonth = (!string.IsNullOrEmpty(Request["startMonth"])) ? Request["startMonth"] : thisMonth;
            startDay = (!string.IsNullOrEmpty(Request["startDay"])) ? Request["startDay"] : thisDay;
            endYear = (!string.IsNullOrEmpty(Request["endYear"])) ? Request["endYear"] : thisYear;
            endMonth = (!string.IsNullOrEmpty(Request["endMonth"])) ? Request["endMonth"] : thisMonth;
            endDay = (!string.IsNullOrEmpty(Request["endDay"])) ? Request["endDay"] : thisDay;
            string QueryType = (!string.IsNullOrEmpty(Request["QueryType"])) ? Request["QueryType"] : "";

            if (QueryType == "訂單資料查詢" || QueryType == "")
            {
                LoadOrderData();
            }
            else
            {
                DateFormating();
                DateTime start_date = new DateTime(int.Parse(startYear), int.Parse(startMonth), int.Parse(startDay));
                DateTime end_date = new DateTime(int.Parse(endYear), int.Parse(endMonth), int.Parse(endDay), 23, 59, 59);
                OrderDT = Order.GetReturnOrderByDate(start_date, end_date);
                FailedOrderItemDT = Order.GetReturnItemByDate(start_date, end_date);

                var Orderlist = OrderDT.AsEnumerable().Select(r => new { OrderID = r["OrderID"], Amount = (int)r["Amount"], PayType = (int)r["PayType"], Status = (int)r["Status"] }).Distinct();
                var FailedOrderItemList = FailedOrderItemDT.AsEnumerable().Select(r => new { OrderID = r["OrderID"], Quantity = (int)r["Quantity"] });
                FailedTotalAmount = (from a in Orderlist
                                     where a.OrderID.ToString() != "0"
                                     select a).Sum(x => x.Amount);

                FailedTotalCash = (from a in Orderlist
                                   where a.OrderID.ToString() != "0" && a.PayType == 1
                                   select a).Sum(x => x.Amount);

                FailedTotalCredit = (from a in Orderlist
                                     where a.OrderID.ToString() != "0" && a.PayType == 2
                                     select a).Sum(x => x.Amount);

                FailedNum = (from a in FailedOrderItemList
                             where a.OrderID.ToString() != "0"
                             select a).Sum(x => x.Quantity);

            }


            if (act == "GetOrderItem")
            {
                DataTable dt = Order.GetOrderItemByOrderID(Request["OrderID"]);
                string OrderItem = Order.GetOrderItemString(dt);
                var result = new { result = dt.Rows.Count > 0, data = OrderItem };
                ShowResultOnPage(JsonConvert.SerializeObject(result));
            }

            if (act == "CancelOrders")
            {
                string ErrorMsg = "";
                bool status = false;
                if (Auth())
                {
                    string IPaddress = Request.UserHostAddress;
                    string PosNo = PosNumber.GetPosNumberMapping(IPaddress);
                    status = Order.CancelOrders(Request["OrderID"], PosNo, ck.ID);
                    if (status)
                    { ErrorMsg = "新增成功"; }
                    else
                    { ErrorMsg = "新增失敗"; }
                }
                else
                {
                    ErrorMsg = "尚未登入";
                }
                var result = new { result = status, ErrorMsg = ErrorMsg };
                ShowResultOnPage(JsonConvert.SerializeObject(result));
            }
        }