예제 #1
0
        /// <summary>
        /// Get slip no
        /// </summary>
        /// <param name="target">Code</param>
        /// <returns>Slip no</returns>
        public static string GetSlipNo(string target)
        {
            // Local variable declaration
            MNumber       mNumber    = null;
            MNumberCom    mNumberCom = null;
            StringBuilder prefix     = null;
            var           result     = string.Empty;
            var           year       = string.Empty;
            var           month      = string.Empty;
            var           slipNo     = decimal.Zero;
            var           digits     = SLIP_NO_DIGITS;

            // Variable initialize
            mNumberCom = new MNumberCom();
            prefix     = new StringBuilder();

            // Get system date
            var currentDate = DateTime.Now;

            // Get year & month
            year  = Convert.ToString(currentDate.Year).Substring(2);
            month = DataHelper.ToStringWithZero(currentDate.Month);

            // Get info
            slipNo  = mNumberCom.GetMaxSlipNo(target, year, month);
            mNumber = mNumberCom.GetSingle(target, year, month, slipNo);

            // Check mNumber
            if (mNumber != null)
            {
                digits = mNumber.Digits.Value;
            }

            // Get prefix
            prefix.Append(target).Append(year).Append(month);

            // Gen slip no
            result = GenSlipNo(slipNo + decimal.One, prefix.ToString(), digits);

            // Return value
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Get slip no
        /// </summary>
        /// <param name="target">Code</param>
        /// <returns>Slip no</returns>
        public static string GetSlipNo(string target)
        {
            // Local variable declaration
            MNumber mNumber = null;
            MNumberCom mNumberCom = null;
            StringBuilder prefix = null;
            var result = string.Empty;
            var year = string.Empty;
            var month = string.Empty;
            var slipNo = decimal.Zero;
            var digits = SLIP_NO_DIGITS;

            // Variable initialize
            mNumberCom = new MNumberCom();
            prefix = new StringBuilder();

            // Get system date
            var currentDate = DateTime.Now;

            // Get year & month
            year = Convert.ToString(currentDate.Year).Substring(2);
            month = DataHelper.ToStringWithZero(currentDate.Month);

            // Get info
            slipNo = mNumberCom.GetMaxSlipNo(target, year, month);
            mNumber = mNumberCom.GetSingle(target, year, month, slipNo);

            // Check mNumber
            if (mNumber != null) digits = mNumber.Digits.Value;

            // Get prefix
            prefix.Append(target).Append(year).Append(month);

            // Gen slip no
            result = GenSlipNo(slipNo + decimal.One, prefix.ToString(), digits);

            // Return value
            return result;
        }