Ejemplo n.º 1
0
        public static int GetLastestPrintNumberPart2(string OrderTypeName, int RoomID, SqlHelper helper, out int OrderNumberID, out int OrderNumberCount, Sys_OrderNumber sysOrderNumber = null, PrintRoomFeeHistory history = null)
        {
            OrderNumberCount = 0;
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = OrderTypeNameDefine.chargefee.ToString();
            }
            if (sysOrderNumber == null)
            {
                sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID, helper);
            }
            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(0);
            }
            OrderNumberID = sysOrderNumber.ID;
            if (history == null)
            {
                history = GetLastPrintRoomFeeHistory(OrderNumberID, helper);
            }
            OrderNumberCount = sysOrderNumber.OrderNumberCount <= 0 ? 3 : sysOrderNumber.OrderNumberCount;
            int number = 1;

            if (history != null && !string.IsNullOrEmpty(history.PrintNumber))
            {
                number = GetOrderNumberBySysOrder(history.PrintNumber, sysOrderNumber, out OrderNumberCount);
            }
            //return number.ToString("D" + OrderNumberCount);
            return(number);
        }
Ejemplo n.º 2
0
        public static string GetLastestCustomerServiceNumber(string OrderTypeName, int RoomID, out int OrderNumberID)
        {
            ResetCache();
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = Foresight.DataAccess.OrderTypeNameDefine.customerservice.ToString();
            }
            Sys_OrderNumber sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID);

            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(string.Empty);
            }
            OrderNumberID = sysOrderNumber.ID;
            CustomerService service = CustomerService.GetLastCustomerService(OrderNumberID);
            string          Part1   = string.Empty;

            Part1 += sysOrderNumber.OrderPrefix;
            string time_yyyy = DateTime.Now.ToString("yyyy");
            string time_mm   = DateTime.Now.ToString("MM");
            string time_dd   = DateTime.Now.ToString("dd");

            if (sysOrderNumber.UseYear)
            {
                Part1 += time_yyyy;
            }
            if (sysOrderNumber.UseMonth)
            {
                Part1 += time_mm;
            }
            if (sysOrderNumber.UseDay)
            {
                Part1 += time_dd;
            }
            int OrderNumberCount = sysOrderNumber.OrderNumberCount <= 0 ? 3 : sysOrderNumber.OrderNumberCount;
            int number           = 1;

            if (service != null && !string.IsNullOrEmpty(service.ServiceNumber))
            {
                number = PrintRoomFeeHistory.GetOrderNumberBySysOrder(service.ServiceNumber, sysOrderNumber, out OrderNumberCount);
            }
            return(Part1 + number.ToString("D" + OrderNumberCount));
        }
Ejemplo n.º 3
0
        public static string GetLastestContractNumber(string OrderTypeName, int RoomID, out int OrderNumberID)
        {
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = OrderTypeNameDefine.contractnumber.ToString();
            }
            Sys_OrderNumber sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID);

            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(string.Empty);
            }
            OrderNumberID = sysOrderNumber.ID;
            Contract contract = Contract.GetLastContract(OrderNumberID);
            string   Part1    = string.Empty;

            Part1 += sysOrderNumber.OrderPrefix;
            string time_yyyy = DateTime.Now.ToString("yyyy");
            string time_mm   = DateTime.Now.ToString("MM");
            string time_dd   = DateTime.Now.ToString("dd");

            if (sysOrderNumber.UseYear)
            {
                Part1 += time_yyyy;
            }
            if (sysOrderNumber.UseMonth)
            {
                Part1 += time_mm;
            }
            if (sysOrderNumber.UseDay)
            {
                Part1 += time_dd;
            }
            int OrderNumberCount = sysOrderNumber.OrderNumberCount <= 0 ? 3 : sysOrderNumber.OrderNumberCount;
            int number           = 1;

            if (contract != null && !string.IsNullOrEmpty(contract.ContractNo))
            {
                number = PrintRoomFeeHistory.GetOrderNumberBySysOrder(contract.ContractNo, sysOrderNumber, out OrderNumberCount);
            }
            return(Part1 + number.ToString("D" + OrderNumberCount));
        }
Ejemplo n.º 4
0
        public static string GetLastestRoomFeeOrderNumber(string OrderTypeName, int RoomID, SqlHelper helper, out int OrderNumberID)
        {
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = Foresight.DataAccess.OrderTypeNameDefine.roomfeeorder.ToString();
            }
            Sys_OrderNumber sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID, helper);

            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(string.Empty);
            }
            OrderNumberID = sysOrderNumber.ID;
            RoomFeeOrder history = RoomFeeOrder.GetLastRoomFeeOrder(OrderNumberID, helper);
            string       Part1   = string.Empty;

            Part1 += sysOrderNumber.OrderPrefix;
            string time_yyyy = DateTime.Now.ToString("yyyy");
            string time_mm   = DateTime.Now.ToString("MM");
            string time_dd   = DateTime.Now.ToString("dd");

            if (sysOrderNumber.UseYear)
            {
                Part1 += time_yyyy;
            }
            if (sysOrderNumber.UseMonth)
            {
                Part1 += time_mm;
            }
            if (sysOrderNumber.UseDay)
            {
                Part1 += time_dd;
            }
            int OrderNumberCount = sysOrderNumber.OrderNumberCount <= 0 ? 3 : sysOrderNumber.OrderNumberCount;
            int number           = 1;

            if (history != null && !string.IsNullOrEmpty(history.OrderNumber))
            {
                number = PrintRoomFeeHistory.GetOrderNumberBySysOrder(history.OrderNumber, sysOrderNumber, out OrderNumberCount);
            }
            return(Part1 + number.ToString("D" + OrderNumberCount));
        }
Ejemplo n.º 5
0
        public static string GetLastestPrintNumberPart1(string OrderTypeName, int RoomID, SqlHelper helper, out int OrderNumberID, Sys_OrderNumber sysOrderNumber = null, PrintRoomFeeHistory history = null)
        {
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = OrderTypeNameDefine.chargefee.ToString();
            }
            if (sysOrderNumber == null)
            {
                sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID, helper);
            }
            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(string.Empty);
            }
            OrderNumberID = sysOrderNumber.ID;
            if (history == null)
            {
                history = GetLastPrintRoomFeeHistory(OrderNumberID, helper);
            }
            string Part1 = string.Empty;

            Part1 += sysOrderNumber.OrderPrefix;
            string time_yyyy = DateTime.Now.ToString("yyyy");
            string time_mm   = DateTime.Now.ToString("MM");
            string time_dd   = DateTime.Now.ToString("dd");

            if (sysOrderNumber.UseYear)
            {
                Part1 += time_yyyy;
            }
            if (sysOrderNumber.UseMonth)
            {
                Part1 += time_mm;
            }
            if (sysOrderNumber.UseDay)
            {
                Part1 += time_dd;
            }
            return(Part1);
        }
Ejemplo n.º 6
0
        public static string GetLastestPrintNumber(string OrderTypeName, int RoomID, SqlHelper helper, out int OrderNumberID)
        {
            if (string.IsNullOrEmpty(OrderTypeName))
            {
                OrderTypeName = Foresight.DataAccess.OrderTypeNameDefine.chargefee.ToString();
            }
            Sys_OrderNumber sysOrderNumber = Sys_OrderNumber.GetSys_OrderNumberByRoomID(OrderTypeName, RoomID, helper);

            if (sysOrderNumber == null)
            {
                OrderNumberID = 0;
                return(string.Empty);
            }
            OrderNumberID = sysOrderNumber.ID;
            PrintRoomFeeHistory history = GetLastPrintRoomFeeHistory(OrderNumberID, helper);
            string part1Str             = GetLastestPrintNumberPart1(OrderTypeName, RoomID, helper, out OrderNumberID, sysOrderNumber: sysOrderNumber, history: history);
            int    OrderNumberCount     = 0;
            int    part2Num             = GetLastestPrintNumberPart2(OrderTypeName, RoomID, helper, out OrderNumberID, out OrderNumberCount, sysOrderNumber: sysOrderNumber, history: history);

            return(part1Str + part2Num.ToString("D" + OrderNumberCount));
        }
Ejemplo n.º 7
0
        public static int GetOrderNumberBySysOrder(string history_printnumber, Sys_OrderNumber sysOrderNumber, out int OrderNumberCount)
        {
            int    number    = 1;
            string time_yyyy = DateTime.Now.ToString("yyyy");
            string time_mm   = DateTime.Now.ToString("MM");
            string time_dd   = DateTime.Now.ToString("dd");

            OrderNumberCount = sysOrderNumber.OrderNumberCount <= 0 ? 3 : sysOrderNumber.OrderNumberCount;
            int use_count_dd = 0;
            int use_count_mm = 0;
            int use_count_yy = 0;

            if (sysOrderNumber.UseDay)
            {
                use_count_dd = 2;
            }
            if (sysOrderNumber.UseMonth)
            {
                use_count_mm = 2 + use_count_dd;
            }
            if (sysOrderNumber.UseYear)
            {
                use_count_yy = 4 + use_count_mm;
            }
            if (history_printnumber.Length >= OrderNumberCount + use_count_yy)
            {
                string printNumber  = history_printnumber.Substring((history_printnumber.Length - OrderNumberCount), OrderNumberCount);
                int    _printnumber = 0;
                int.TryParse(printNumber, out _printnumber);
                int new_number = _printnumber + 1;
                if (new_number.ToString().Length > OrderNumberCount)
                {
                    new_number = 1;
                }
                if (sysOrderNumber.IsDayReset && sysOrderNumber.UseDay)
                {
                    string printnumber_dd = history_printnumber.Substring((history_printnumber.Length - OrderNumberCount - use_count_dd), 2);
                    if (printnumber_dd == time_dd)
                    {
                        number = new_number;
                    }
                }
                else if (sysOrderNumber.IsMonthReset && sysOrderNumber.UseMonth)
                {
                    string printnumber_mm = history_printnumber.Substring((history_printnumber.Length - OrderNumberCount - use_count_mm), 2);
                    if (printnumber_mm == time_mm)
                    {
                        number = new_number;
                    }
                }
                else if (sysOrderNumber.IsYearReset && sysOrderNumber.UseYear)
                {
                    string printnumber_year = history_printnumber.Substring((history_printnumber.Length - OrderNumberCount - use_count_yy), 4);
                    if (printnumber_year == time_yyyy)
                    {
                        number = new_number;
                    }
                }
                else
                {
                    number = new_number;
                }
            }
            return(number);
        }