Esempio n. 1
0
        /// <summary>
        /// 根据月份,年份获得预算过程编号
        /// </summary>
        /// <param name="year">年</param>
        /// <param name="month">月</param>
        /// <returns>过程年编号,季度编号,月编号</returns>
        public string GetYsgcCode(DateTime dt)
        {
            string year  = dt.Year.ToString();
            int    month = dt.Month;
            //判断是否有财务年度的设置,如果有则先转换
            string strcn = new ConfigBLL().GetValueByKey("CYLX");

            if (!string.IsNullOrEmpty(strcn) && strcn == "Y")
            {
                //1.根据申请日期转换成财年日期
                string strsql    = " select year_moth from bill_Cnpz where beg_time<= '" + dt.ToString("yyyy-MM-dd") + "' and end_time>= '" + dt.ToString("yyyy-MM-dd") + "'";
                string yearmonth = new sqlHelper.sqlHelper().GetCellValue(strsql);
                if (!string.IsNullOrEmpty(yearmonth))
                {
                    year  = yearmonth.Substring(0, 4);
                    month = int.Parse(yearmonth.Substring(5, 2));
                }
                //else
                //{
                //    return "-1";
                //}
            }
            string[] ret    = new string[3];
            string   temp   = ""; //月度编号
            string   tempjd = ""; //季度编号

            switch (month)
            {
            case 1:
                temp   = "0006";
                tempjd = "0002";
                break;

            case 2:
                temp   = "0007";
                tempjd = "0002";
                break;

            case 3:
                temp   = "0008";
                tempjd = "0002";
                break;

            case 4:
                temp   = "0009";
                tempjd = "0003";
                break;

            case 5:
                temp   = "0010";
                tempjd = "0003";
                break;

            case 6:
                temp   = "0011";
                tempjd = "0003";
                break;

            case 7:
                temp   = "0012";
                tempjd = "0004";
                break;

            case 8:
                temp   = "0013";
                tempjd = "0004";
                break;

            case 9:
                temp   = "0014";
                tempjd = "0004";
                break;

            case 10:
                temp   = "0015";
                tempjd = "0005";
                break;

            case 11:
                temp   = "0016";
                tempjd = "0005";
                break;

            case 12:
                temp   = "0017";
                tempjd = "0005";
                break;
            }
            ret[0] = year + "0001";
            ret[1] = year + tempjd;
            ret[2] = year + temp;
            //根据预算到的时间点返回对应的过程编号
            string config = (new SysManager()).GetsysConfigBynd(year)["MonthOrQuarter"];

            switch (config)
            {
            case "0": return(ret[0]);   //0表示预算到年

            case "1": return(ret[1]);   //1表示预算到季度

            case "2": return(ret[2]);   //2表示预算到月度

            default: return(ret[2]);
            }
        }