Esempio n. 1
0
        private List <string> ValidateEntry(string requestType, DynamicObjectCollection entrys, string billStatus)
        {
            List <string> list = new List <string>();

            using (IEnumerator <DynamicObject> enumerator = entrys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Func <DynamicObject, bool> predicate = null;
                    DynamicObject entry = enumerator.Current;
                    if (predicate == null)
                    {
                        predicate = p => Convert.ToInt64(p["SosurceRowID"]) == Convert.ToInt64(entry["SosurceRowID"]);
                    }
                    List <DynamicObject> source = entrys.Where <DynamicObject>(predicate).ToList <DynamicObject>();
                    bool flag  = source.Any <DynamicObject>(p => !string.IsNullOrWhiteSpace(Convert.ToString(p["SourceBillNo"])));
                    bool flag2 = Convert.ToBoolean(entry["IsFromBorrow"]);
                    if (!flag || !flag2)
                    {
                        return(list);
                    }
                    //源单可冲销金额
                    decimal num = source.Sum <DynamicObject>((Func <DynamicObject, decimal>)(p => Convert.ToDecimal(p["SrcBorrowAmount"])));
                    Convert.ToDecimal(entry["ExpSubmitAmount"]); //核定报销金额
                    Convert.ToDecimal(entry["ReqSubmitAmount"]); //核定付退款金额
                    decimal num2 = source.Sum <DynamicObject>((Func <DynamicObject, decimal>)(p => Convert.ToDecimal(p["ExpSubmitAmount"])));
                    decimal num3 = source.Sum <DynamicObject>((Func <DynamicObject, decimal>)(p => Convert.ToDecimal(p["ReqSubmitAmount"])));
                    source.Sum <DynamicObject>((Func <DynamicObject, decimal>)(p => Convert.ToDecimal(p["SrcOffsetAmount"])));
                    decimal num4 = source.Sum <DynamicObject>((Func <DynamicObject, decimal>)(p => Convert.ToDecimal(p["FSRCPAYEDAMOUNT"])));//源单已付款金额
                    string  str  = requestType;
                    if (str == null)
                    {
                        goto Label_034C;
                    }
                    if (!(str == "1"))
                    {
                        if (str == "2")
                        {
                            goto Label_0269;
                        }
                        goto Label_034C;
                    }
                    if (num > num2)
                    {
                        if (billStatus.Equals("B"))
                        {
                            list.Add(string.Format(ResManager.LoadKDString("申请付款时,核定报销金额不能小于源单可冲销金额:{0}", "003831000013828", SubSystemType.FIN, new object[0]), num));
                        }
                        else
                        {
                            list.Add(string.Format(ResManager.LoadKDString("申请付款时,申请报销金额不能小于源单可冲销金额:{0}", "003831000012434", SubSystemType.FIN, new object[0]), num));
                        }
                    }
                    if (num > (num2 - num3 - num4))
                    {
                        if (billStatus.Equals("B"))
                        {
                            list.Add(string.Format(ResManager.LoadKDString("申请付款时,核定报销金额 - 核定付款金额 - 源单已付款金额不能小于源单可冲销金额:{0}", "003831000013829", SubSystemType.FIN, new object[0]), num));
                        }
                        else
                        {
                            list.Add(string.Format(ResManager.LoadKDString("申请付款时,申请报销金额 - 付款申请金额 - 源单已付款金额不能小于源单可冲销金额:{0}", "003831000012435", SubSystemType.FIN, new object[0]), num));
                        }
                    }
                    continue;
Label_0269:
                    if (num < num2)
                    {
                        if (billStatus.Equals("B"))
                        {
                            list.Add(string.Format(ResManager.LoadKDString("退款申请时,核定报销金额不能大于源单未下推金额:{0}", "003831000013830", SubSystemType.FIN, new object[0]), num));
                        }
                        else
                        {
                            list.Add(string.Format(ResManager.LoadKDString("退款申请时,申请报销金额不能大于源单未下推金额:{0}", "003831000012436", SubSystemType.FIN, new object[0]), num));
                        }
                    }
                    if (num < (num2 + num3 + num4))
                    {
                        if (billStatus.Equals("B"))
                        {
                            list.Add(string.Format(ResManager.LoadKDString("退款申请时,核定报销金额 + 核定退款金额  + 源单已付款金额不能大于源单可冲销金额:{0}", "003831000013831", SubSystemType.FIN, new object[0]), num));
                        }
                        else
                        {
                            list.Add(string.Format(ResManager.LoadKDString("退款申请时,申请报销金额 + 退款申请金额+ 源单已付款金额不能大于源单可冲销金额:{0}", "003831000012437", SubSystemType.FIN, new object[0]), num));
                        }
                    }
                    continue;
Label_034C:
                    if (num < num2)
                    {
                        if (billStatus.Equals("B"))
                        {
                            list.Add(string.Format(ResManager.LoadKDString("不退不付时, 核定报销金额不能大于源单可冲销金额:{0}", "003831000013832", SubSystemType.FIN, new object[0]), num));
                            continue;
                        }
                        list.Add(string.Format(ResManager.LoadKDString("不退不付时, 申请报销金额不能大于源单可冲销金额:{0}", "003831000012438", SubSystemType.FIN, new object[0]), num));
                    }
                }
            }
            return(list);
        }