Exemple #1
0
        private TempXSDJ_MX GetTempXSDJ_MX(strMingxi MingXi, string Djbh, int Hs)
        {
            TempXSDJ_MX pxsdj_mx = new TempXSDJ_MX();

            for (int i = MingXi.str.Count; i < 13; i++)
            {
                MingXi.str.Add("");
            }
            pxsdj_mx.Hwmc    = MingXi.str[0];
            pxsdj_mx.Jldw    = MingXi.str[1];
            pxsdj_mx.Gg      = MingXi.str[2];
            pxsdj_mx.Sl      = CommonTool.TodoubleNew(MingXi.str[3]);
            pxsdj_mx.Bhsje   = CommonTool.TodoubleNew_x(MingXi.str[4]);
            pxsdj_mx.Slv     = CommonTool.ToSlv(MingXi.str[5]);
            pxsdj_mx.Spsm    = MingXi.str[6];
            pxsdj_mx.Zkje    = new double?(CommonTool.TodoubleNew(MingXi.str[7]));
            pxsdj_mx.Se      = CommonTool.TodoubleNew_x(MingXi.str[8]);
            pxsdj_mx.Zkse    = CommonTool.ToZKSE(MingXi.str[9]);
            pxsdj_mx.Zkl     = CommonTool.ToZKL(MingXi.str[10]);
            pxsdj_mx.Dj      = CommonTool.Todouble(MingXi.str[11]);
            pxsdj_mx.Jgfs    = CommonTool.ToStringBool(MingXi.str[12]);
            pxsdj_mx.DJBH    = Djbh;
            pxsdj_mx.HangShu = Hs;
            return(pxsdj_mx);
        }
Exemple #2
0
        private void CreateZheKouHang(XSDJ xsdjt, int i, int j, double JE, double SE, double ZKL, int ZKHCount)
        {
            TempXSDJ_MX item = new TempXSDJ_MX {
                Hwmc  = CommonTool.GetDisCountMC(ZKL, ZKHCount),
                Zkl   = new double?(ZKL),
                Bhsje = new double?(-1.0 * JE),
                Se    = new double?(-1.0 * SE),
                DJBH  = xsdjt.Dj[i].Djh,
                Slv   = xsdjt.Dj[i].Mingxi[j - 1].Slv,
                Jgfs  = xsdjt.Dj[i].Mingxi[j - 1].Jgfs,
                Spsm  = xsdjt.Dj[i].Mingxi[j - 1].Spsm,
                Fpzl  = xsdjt.Dj[i].Mingxi[j - 1].Fpzl,
                Djhxz = 4,
                Sl    = 0.0,
                Dj    = 0.0
            };

            xsdjt.Dj[i].Mingxi.Insert(j, item);
        }
        protected XSDJ GetXSDJ()
        {
            XSDJ xsdj = new XSDJ {
                Bdbs = "SJJK0101",
                Bdmc = "Excel数据导入",
                Bdfz = "Excel数据导入"
            };
            DataTable table = this.ExcelLoad();

            foreach (DataRow row in table.Rows)
            {
                string   iD       = Convert.ToString(row["DanJuHaoMa"]);
                TempXSDJ tempXSDJ = this.GetTempXSDJ(iD, xsdj);
                if (tempXSDJ == null)
                {
                    tempXSDJ = new TempXSDJ {
                        Djh    = iD,
                        Sphs   = 0,
                        Gfmc   = Convert.ToString(row["GouFangMingCheng"]),
                        Gfsh   = Convert.ToString(row["GouFangShuiHao"]),
                        Gfdzdh = Convert.ToString(row["GouFangDiZhiDianHua"]),
                        Gfyhzh = Convert.ToString(row["GouFangYinHangZhangHao"]),
                        Bz     = Convert.ToString(row["BeiZhu"]),
                        Fhr    = Convert.ToString(row["FuHeRen"]),
                        Skr    = Convert.ToString(row["ShouKuanRen"]),
                        Qdspmc = Convert.ToString(row["QingDanHangShangPinMingCheng"])
                    };
                    DateTime result = new DateTime(0x76c, 1, 1);
                    if (DateTime.TryParse(row["DanJuRiQi"].ToString(), out result))
                    {
                        tempXSDJ.Djrq = result;
                    }
                    else
                    {
                        tempXSDJ.Djrq = DateTime.Now.Date;
                    }
                    tempXSDJ.Xfyhzh = Convert.ToString(row["XiaoFangYinHangZhangHao"]);
                    tempXSDJ.Xfdzdh = Convert.ToString(row["XiaoFangDiZhiDianHua"]);
                    tempXSDJ.SFZJY  = CommonTool.ToStringBool(row["ShenFenZhengJiaoYan"].ToString());
                    string str2 = Convert.ToString(row["HaiYangShiYou"]);
                    tempXSDJ.HYSY = CommonTool.ToBoolString(str2);
                    xsdj.Dj.Add(tempXSDJ);
                }
                TempXSDJ_MX item = new TempXSDJ_MX {
                    Hwmc    = Convert.ToString(row["HuoWuMingCheng"]),
                    Jldw    = Convert.ToString(row["JiLiangDanWei"]),
                    Gg      = Convert.ToString(row["GuiGe"]),
                    Sl      = CommonTool.TodoubleNew(Convert.ToString(row["ShuLiang"])),
                    Bhsje   = CommonTool.TodoubleNew_x(row["BuHanShuiJinE"].ToString()),
                    Slv     = CommonTool.ToSlv(row["ShuiLv"].ToString()),
                    Spsm    = Convert.ToString(row["ShangPinShuiMu"]),
                    Zkje    = new double?(CommonTool.TodoubleNew(row["ZheKouJinE"].ToString())),
                    Se      = CommonTool.TodoubleNew_x(row["ShuiE"].ToString()),
                    Zkse    = CommonTool.ToZKSE(row["ZheKouShuiE"].ToString()),
                    Zkl     = CommonTool.ToZKL(row["ZheKouLv"].ToString()),
                    Dj      = CommonTool.Todouble(row["DanJia"].ToString()),
                    Jgfs    = CommonTool.ToStringBool(row["JiaGeFangShi"].ToString()),
                    HangShu = tempXSDJ.Mingxi.Count + 1,
                    DJBH    = tempXSDJ.Djh
                };
                tempXSDJ.Mingxi.Add(item);
            }
            base.errorResolver.ImportTotal = xsdj.Dj.Count;
            return(xsdj);
        }
Exemple #4
0
        protected TempXSDJ GetTempXSDJ(strDanju danju)
        {
            int num;

            if (danju.str.Count < 7)
            {
                for (num = danju.str.Count; num < 7; num++)
                {
                    danju.str.Add("");
                }
            }
            TempXSDJ pxsdj = new TempXSDJ {
                Djh = danju.str[0]
            };
            int result = 0;

            if (!int.TryParse(danju.str[1], out result))
            {
                throw new CustomException("传入txt格式不正确");
            }
            pxsdj.Sphs   = result;
            pxsdj.Gfmc   = danju.str[2];
            pxsdj.Gfsh   = danju.str[3];
            pxsdj.Gfdzdh = danju.str[4];
            pxsdj.Gfyhzh = danju.str[5];
            pxsdj.Bz     = danju.str[6];
            if (danju.str.Count > 7)
            {
                pxsdj.Fhr = danju.str[7];
            }
            if (danju.str.Count > 8)
            {
                pxsdj.Skr = danju.str[8];
            }
            if (danju.str.Count > 9)
            {
                pxsdj.Qdspmc = danju.str[9];
            }
            if ((danju.str.Count > 10) && !string.IsNullOrEmpty(danju.str[10]))
            {
                DateTime now = DateTime.Now;
                DateTime.TryParse(danju.str[10], out now);
                pxsdj.Djrq = now.Date;
            }
            if (danju.str.Count > 11)
            {
                pxsdj.Xfyhzh = danju.str[11];
            }
            if (danju.str.Count > 12)
            {
                pxsdj.Xfdzdh = danju.str[12];
            }
            if (danju.str.Count > 13)
            {
                pxsdj.SFZJY = CommonTool.ToStringBool(danju.str[13]);
            }
            if (danju.str.Count > 14)
            {
                pxsdj.HYSY = CommonTool.ToBoolString(danju.str[14]);
            }
            for (num = 0; num < danju.mingxi.Count; num++)
            {
                TempXSDJ_MX item = this.GetTempXSDJ_MX(danju.mingxi[num], pxsdj.Djh, num + 1);
                if (item != null)
                {
                    pxsdj.Mingxi.Add(item);
                }
            }
            return(pxsdj);
        }
Exemple #5
0
        private bool FanSuanZheKou(TempXSDJ_MX mx)
        {
            double zKJE   = Convert.ToDouble(mx.Zkje);
            double num2   = Convert.ToDouble(mx.Zkl);
            double result = 0.0;
            double num4   = Convert.ToDouble(mx.Bhsje);
            double num5   = Convert.ToDouble(mx.Se);
            double num8   = Convert.ToDouble(mx.Slv);

            if (mx.Zkse == "ImportNull")
            {
                result     = 0.0;
                this.bZKSE = false;
            }
            else
            {
                if (mx.Zkse == "ImportError")
                {
                    this.ErrorAdd("折扣税额有错误", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                this.bZKSE = true;
                double.TryParse(mx.Zkse, out result);
            }
            if (((zKJE == 0.0) && (num2 == 0.0)) && (result == 0.0))
            {
                mx.Djhxz = 0;
                return(true);
            }
            if ((zKJE != 0.0) && (num2 != 0.0))
            {
                if (this.JesmTemp)
                {
                    if ((zKJE * (num4 + num5)) > 0.0)
                    {
                        if (SaleBillCtrl.GetRound(Math.Abs((double)(((num4 + num5) * num2) - zKJE)), 2) > this.FSoftTaxPre)
                        {
                            this.ErrorAdd("折扣率有错误", mx.DJBH, mx.HangShu, false);
                            return(false);
                        }
                    }
                    else if (SaleBillCtrl.GetRound(Math.Abs((double)(((num4 + num5) * num2) + zKJE)), 2) > this.FSoftTaxPre)
                    {
                        this.ErrorAdd("折扣率有错误", mx.DJBH, mx.HangShu, false);
                        return(false);
                    }
                }
                else if ((zKJE * num4) > 0.0)
                {
                    if (SaleBillCtrl.GetRound(Math.Abs((double)((num4 * num2) - zKJE)), 2) > this.FSoftTaxPre)
                    {
                        this.ErrorAdd("折扣率有错误", mx.DJBH, mx.HangShu, false);
                        return(false);
                    }
                }
                else if (SaleBillCtrl.GetRound(Math.Abs((double)((num4 * num2) + zKJE)), 2) > this.FSoftTaxPre)
                {
                    this.ErrorAdd("折扣率有错误", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
            }
            if ((zKJE * result) < 0.0)
            {
                this.ErrorAdd("折扣金额和折扣税额不同号", mx.DJBH, mx.HangShu, false);
                return(false);
            }
            if (zKJE != 0.0)
            {
                if (!this.CalcZKJE_ZKSE(mx, zKJE, result))
                {
                    this.ErrorAdd("折扣税额错误", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                zKJE = Convert.ToDouble(mx.Zkje);
                double.TryParse(mx.Zkse, out result);
                if (num4 == 0.0)
                {
                    num2 = 0.0;
                }
                else
                {
                    double round;
                    if (this.JesmTemp)
                    {
                        round = SaleBillCtrl.GetRound((double)((zKJE + result) / (num4 + num5)), 5);
                    }
                    else
                    {
                        round = SaleBillCtrl.GetRound((double)(zKJE / num4), 5);
                    }
                    round = Math.Abs(round);
                    if (num2 == 0.0)
                    {
                        num2 = round;
                    }
                    if (num2 > 100.0000001)
                    {
                        this.ErrorAdd("折扣率错误", mx.DJBH, mx.HangShu, false);
                        return(false);
                    }
                    if (Math.Abs((double)(SaleBillCtrl.GetRound(num2, 5) - round)) > base.DataPrecision)
                    {
                        double num6;
                        if (this.JesmTemp)
                        {
                            num6 = Math.Abs((double)(Math.Abs((double)(zKJE + result)) - Math.Abs(SaleBillCtrl.GetRound((double)(num2 * (num4 + num5)), 2))));
                        }
                        else
                        {
                            num6 = Math.Abs((double)(Math.Abs(zKJE) - Math.Abs(SaleBillCtrl.GetRound((double)(num2 * num4), 2))));
                        }
                        if (num6 > base.DataPrecision)
                        {
                            this.ErrorAdd("折扣率错误", mx.DJBH, mx.HangShu, false);
                            return(false);
                        }
                    }
                }
            }
            else if (num2 != 0.0)
            {
                if (result != 0.0)
                {
                    if (num2 < 0.0)
                    {
                        this.ErrorAdd("折扣率错误", mx.DJBH, mx.HangShu, false);
                        return(false);
                    }
                    if (SaleBillCtrl.GetRound((double)((num5 * num2) - Math.Abs(result)), 2) > this.FSoftTaxPre)
                    {
                        this.ErrorAdd("折扣税额错误", mx.DJBH, mx.HangShu, false);
                        return(false);
                    }
                }
                this.CalcZKJE_ZKSE_x(mx, zKJE, result);
                zKJE = Convert.ToDouble(mx.Zkje);
                double.TryParse(mx.Zkse, out result);
            }
            else if (result != 0.0)
            {
                if ((result * num5) > 0.0)
                {
                    num2 = SaleBillCtrl.GetRound((double)(result / num5), 5);
                }
                else if (num5 == 0.0)
                {
                    num2 = 0.0;
                }
                else
                {
                    num2 = -SaleBillCtrl.GetRound((double)(result / num5), 5);
                }
                if (num4 >= 0.0)
                {
                    zKJE = SaleBillCtrl.GetRound((double)(num2 * num4), 2);
                }
                else
                {
                    zKJE = -SaleBillCtrl.GetRound((double)(num2 * num4), 2);
                }
            }
            zKJE   = Math.Abs(zKJE);
            result = Math.Abs(result);
            if (num4 >= 0.0)
            {
                if (zKJE > num4)
                {
                    this.ErrorAdd("折扣金额大于金额", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
            }
            else
            {
                if ((result != 0.0) && (zKJE == 0.0))
                {
                    zKJE = SaleBillCtrl.GetRound((double)(result / num8), 2);
                }
                if (zKJE > -num4)
                {
                    this.ErrorAdd("折扣金额大于金额", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
            }
            if (SaleBillCtrl.GetRound((double)((zKJE * num8) - result), 2) > this.FSoftTaxPre)
            {
                this.ErrorAdd("折扣税额错误", mx.DJBH, mx.HangShu, false);
                return(false);
            }
            mx.Zkje  = new double?(zKJE);
            mx.Zkl   = new double?(num2);
            mx.Zkse  = Convert.ToString(result);
            mx.Djhxz = (num2 == 0.0) ? ((short)0) : ((short)3);
            return(true);
        }
Exemple #6
0
        private bool FanSuanJeSeSlvn(TempXSDJ_MX mx)
        {
            double round;
            double num2;
            double num3;
            double num6     = 0.0;
            bool   flag     = true;
            bool   flag2    = true;
            bool   flag3    = true;
            bool   jesmTemp = this.JesmTemp;
            Dictionary <string, double> dictionary = new Dictionary <string, double>();

            if (!mx.Bhsje.HasValue)
            {
                flag  = false;
                round = 0.0;
            }
            else
            {
                round = Convert.ToDouble(mx.Bhsje);
            }
            if (!mx.Slv.HasValue)
            {
                flag2 = false;
                num2  = 0.0;
            }
            else
            {
                num2 = Convert.ToDouble(mx.Slv);
            }
            if (!mx.Se.HasValue)
            {
                flag3 = false;
                num3  = 0.0;
            }
            else
            {
                num3 = Convert.ToDouble(mx.Se);
            }
            if (flag)
            {
                dictionary.Add("JE", round);
            }
            if (flag3)
            {
                dictionary.Add("SE", num3);
            }
            if (flag2)
            {
                dictionary.Add("SLV", num2);
            }
            if (dictionary.Count == 0)
            {
                if ((flag && flag2) && flag3)
                {
                    this.ErrorAdd("金额、税率和税额均为0", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                if (flag2 && flag3)
                {
                    this.ErrorAdd("没有金额、且税率和税额均为0", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                if (flag && flag2)
                {
                    this.ErrorAdd("没有税额、且税率和金额均为0", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                if (flag && flag3)
                {
                    this.ErrorAdd("没有税率、且税额和金额均为0", mx.DJBH, mx.HangShu, false);
                    return(false);
                }
                this.ErrorAdd("没有金额、税率和税额", mx.DJBH, mx.HangShu, false);
                return(false);
            }
            if (dictionary.Count < 2)
            {
                if (dictionary.ContainsKey("JE"))
                {
                    this.ErrorAdd("只有金额", mx.DJBH, mx.HangShu, false);
                }
                else if (dictionary.ContainsKey("SE"))
                {
                    if (!(flag2 || flag))
                    {
                        this.ErrorAdd("只有税额", mx.DJBH, mx.HangShu, false);
                    }
                    else if (!(!flag2 || flag))
                    {
                        this.ErrorAdd("没有金额且税率为0", mx.DJBH, mx.HangShu, false);
                    }
                }
                else if (dictionary.ContainsKey("SLV"))
                {
                    this.ErrorAdd("只有税率", mx.DJBH, mx.HangShu, false);
                }
                return(false);
            }
            if ((round * num3) < 0.0)
            {
                this.ErrorAdd("金额和税额不同号", mx.DJBH, mx.HangShu, false);
                return(false);
            }
            if (dictionary.Count != 2)
            {
                if (dictionary.Count == 3)
                {
                    if (this.JesmTemp)
                    {
                        if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                        {
                            round = SaleBillCtrl.GetRound((double)(round - num3), 2);
                            if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(round * 0.05), 2) - num3)), 2) <= this.FSoftTaxPre)
                            {
                                num3 = SaleBillCtrl.GetRound(num3, 2);
                            }
                            else
                            {
                                this.ErrorAdd("税额有错误", mx.DJBH, mx.HangShu, true);
                            }
                        }
                        else if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((round - num3) * num2), 2) - num3)), 2) > this.FSoftTaxPre)
                        {
                            if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(round * num2), 2) - num3)), 2) > this.FSoftTaxPre)
                            {
                                this.DJZT = "N";
                                this.ErrorAdd("税额有错误", mx.DJBH, mx.HangShu, true);
                                round        -= num3;
                                this.JesmTemp = jesmTemp;
                            }
                            else
                            {
                                this.JesmTemp = false;
                                mx.Jgfs       = "0";
                            }
                        }
                        else
                        {
                            round -= num3;
                        }
                    }
                    else if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                    {
                        if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((round + num3) * 0.05), 2) - num3)), 2) <= this.FSoftTaxPre)
                        {
                            num3 = SaleBillCtrl.GetRound(num3, 2);
                        }
                        else
                        {
                            this.ErrorAdd("税额有错误", mx.DJBH, mx.HangShu, true);
                        }
                    }
                    else if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(round * num2), 2) - num3)), 2) > this.FSoftTaxPre)
                    {
                        if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((round - num3) * num2), 2) - num3)), 2) > this.FSoftTaxPre)
                        {
                            this.DJZT = "N";
                            this.ErrorAdd("税额有错误", mx.DJBH, mx.HangShu, true);
                            this.JesmTemp = jesmTemp;
                        }
                        else
                        {
                            round        -= num3;
                            this.JesmTemp = true;
                            mx.Jgfs       = "1";
                        }
                    }
                }
            }
            else
            {
                num2 = SaleBillCtrl.GetRound(num2, 2);
                if (this.JesmTemp)
                {
                    if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                    {
                        if (!dictionary.ContainsKey("JE"))
                        {
                            round = SaleBillCtrl.GetRound((double)(19.0 * num3), 2);
                        }
                        else
                        {
                            num3  = SaleBillCtrl.GetRound((double)(round * 0.05), 2);
                            round = SaleBillCtrl.GetRound((double)(round - num3), 2);
                        }
                    }
                    else if (!dictionary.ContainsKey("JE"))
                    {
                        round = SaleBillCtrl.GetRound((double)(num3 / num2), 2);
                    }
                    else if (!dictionary.ContainsKey("SLV"))
                    {
                        round = SaleBillCtrl.GetRound((double)(round - num3), 2);
                    }
                    else if (!dictionary.ContainsKey("SE"))
                    {
                        num3  = SaleBillCtrl.GetRound((double)((round * num2) / (1.0 + num2)), 2);
                        round = SaleBillCtrl.GetRound((double)(round - num3), 2);
                    }
                }
                else if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                {
                    if (!dictionary.ContainsKey("JE"))
                    {
                        round = SaleBillCtrl.GetRound((double)(19.0 * num3), 2);
                    }
                    else
                    {
                        num3 = SaleBillCtrl.GetRound((double)(round / 19.0), 2);
                    }
                }
                else if (!dictionary.ContainsKey("JE"))
                {
                    round = SaleBillCtrl.GetRound((double)(num3 / num2), 2);
                }
                else if (dictionary.ContainsKey("SLV"))
                {
                    if (!dictionary.ContainsKey("SE"))
                    {
                        num3 = SaleBillCtrl.GetRound((double)(round * num2), 2);
                    }
                }
                else
                {
                    List <double> list = new List <double>(this.slvArray);
                    list.Remove(0.05);
                    if (list.Count > 0)
                    {
                        int num7 = 0;
                        for (int i = 0; i < list.Count; i++)
                        {
                            num6 = Convert.ToDouble(list[i]);
                            if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(round * num6), 2) - num3)), 2) <= this.FSoftTaxPre)
                            {
                                this.JesmTemp = false;
                                num7++;
                                break;
                            }
                            if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((round - num3) * num6), 2) - num3)), 2) <= this.FSoftTaxPre)
                            {
                                this.JesmTemp = true;
                                num7++;
                                break;
                            }
                        }
                        if (num7 == 1)
                        {
                            num2 = num6;
                        }
                        else
                        {
                            this.JesmTemp = jesmTemp;
                            this.ErrorAdd("税率有错误", mx.DJBH, mx.HangShu, true);
                        }
                    }
                }
            }
            if (this.Fplx == InvType.Special)
            {
                if (!base.slvList.Contains(Convert.ToDouble(num2)))
                {
                    this.ErrorAdd("税率有错误", mx.DJBH, mx.HangShu, true);
                }
                else if (!((num2 != 0.05) || this.hysy_x))
                {
                    this.ErrorAdd("税率有错误", mx.DJBH, mx.HangShu, true);
                }
            }
            else
            {
                int num10;
                int num9 = Convert.ToInt16((double)(num2 * 100.0));
                if (TaxCardValue.taxCard.get_ECardType() == 0)
                {
                    num10 = 0x1f;
                }
                else
                {
                    num10 = 0x19;
                }
                if (num9 > num10)
                {
                    this.ErrorAdd("税率有错误", mx.DJBH, mx.HangShu, true);
                }
            }
            mx.Bhsje      = new double?(SaleBillCtrl.GetRound(round, 2));
            mx.Se         = new double?(SaleBillCtrl.GetRound(num3, 2));
            mx.Slv        = new double?(num2);
            this.JesmTemp = jesmTemp;
            return(true);
        }
Exemple #7
0
        private void FanSuanDjJeSln(TempXSDJ_MX mx)
        {
            double num  = Convert.ToDouble(mx.Sl);
            double num2 = Convert.ToDouble(mx.Dj);
            double num3 = Convert.ToDouble(mx.Bhsje);
            bool   flag = true;

            if (mx.Jgfs == "0")
            {
                flag = false;
            }
            Dictionary <string, double> dictionary = new Dictionary <string, double>();

            if (mx.Bhsje != 0.0)
            {
                dictionary.Add("JE", num3);
            }
            if (!(mx.Dj == 0.0))
            {
                dictionary.Add("DJ", num2);
            }
            if (!(mx.Sl == 0.0))
            {
                dictionary.Add("SL", num);
            }
            if (dictionary.Count < 2)
            {
                if (!(!(this.Importtype == "Excel") || dictionary.ContainsKey("JE")))
                {
                    this.ErrorAdd("单价、数量和金额三者关系不符", mx.DJBH, 0, true);
                }
            }
            else
            {
                double round;
                if (((mx.Slv == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                {
                    if (!dictionary.ContainsKey("DJ"))
                    {
                        num2 = (num3 + Convert.ToDouble(mx.Se)) / num;
                    }
                    else if (flag)
                    {
                        if (mx.Jgfs == "1")
                        {
                            round = SaleBillCtrl.GetRound((double)(((num2 * num) - num3) - Convert.ToDouble(mx.Se)), 8);
                        }
                        else
                        {
                            round = SaleBillCtrl.GetRound((double)((num2 * num) - num3), 8);
                            num2  = SaleBillCtrl.GetRound((double)(num2 / 0.95), 8);
                        }
                        if (Math.Abs(round) > this.FSoftTaxPre)
                        {
                            this.DJZT      = "N";
                            mx.DanJiaError = true;
                            this.ErrorAdd("单价、数量和金额三者关系不符", mx.DJBH, mx.HangShu, true);
                        }
                    }
                    else if (Math.Abs(SaleBillCtrl.GetRound((double)((num2 * num) - num3), 8)) <= this.FSoftTaxPre)
                    {
                        num2 = SaleBillCtrl.GetRound((double)(num2 / 0.95), 8);
                    }
                    else if (Math.Abs(SaleBillCtrl.GetRound((double)(((num2 * num) - num3) - Convert.ToDouble(mx.Se)), 8)) <= this.FSoftTaxPre)
                    {
                        mx.Jgfs = "1";
                    }
                    else
                    {
                        mx.Jgfs        = CommonTool.ToStringBool(this.JesmTemp);
                        this.DJZT      = "N";
                        mx.DanJiaError = true;
                        this.ErrorAdd("单价、数量和金额三者关系不符", mx.DJBH, mx.HangShu, true);
                    }
                    mx.Jgfs = "1";
                }
                else if (!dictionary.ContainsKey("DJ"))
                {
                    if (flag)
                    {
                        if (mx.Jgfs == "1")
                        {
                            num2 = (num3 + Convert.ToDouble(mx.Se)) / num;
                        }
                        else
                        {
                            num2 = num3 / num;
                        }
                    }
                    else
                    {
                        if (this.JesmTemp)
                        {
                            num2 = (num3 + Convert.ToDouble(mx.Se)) / num;
                        }
                        else
                        {
                            num2 = num3 / num;
                        }
                        mx.Jgfs = CommonTool.ToStringBool(this.JesmTemp);
                    }
                }
                else if (flag)
                {
                    if (mx.Jgfs == "1")
                    {
                        round = SaleBillCtrl.GetRound((double)(((num2 * num) - num3) - Convert.ToDouble(mx.Se)), 8);
                    }
                    else
                    {
                        round = SaleBillCtrl.GetRound((double)((num2 * num) - num3), 8);
                    }
                    if (Math.Abs(round) > this.FSoftTaxPre)
                    {
                        this.DJZT      = "N";
                        mx.DanJiaError = true;
                        this.ErrorAdd("单价、数量和金额三者关系不符", mx.DJBH, mx.HangShu, true);
                    }
                }
                else if (Math.Abs(SaleBillCtrl.GetRound((double)((num2 * num) - num3), 8)) <= this.FSoftTaxPre)
                {
                    mx.Jgfs = "0";
                }
                else if (Math.Abs(SaleBillCtrl.GetRound((double)(((num2 * num) - num3) - Convert.ToDouble(mx.Se)), 8)) <= this.FSoftTaxPre)
                {
                    mx.Jgfs = "1";
                }
                else
                {
                    mx.Jgfs        = CommonTool.ToStringBool(this.JesmTemp);
                    this.DJZT      = "N";
                    mx.DanJiaError = true;
                    this.ErrorAdd("单价、数量和金额三者关系不符", mx.DJBH, mx.HangShu, true);
                }
                mx.Dj = num2;
            }
        }
Exemple #8
0
        private bool CalcZKJE_ZKSE(TempXSDJ_MX mx, double ZKJE, double ZKSE)
        {
            double num3 = Convert.ToDouble(mx.Slv);
            double num  = Math.Abs(ZKJE);

            if (this.JesmTemp)
            {
                if (((num3 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                {
                    if (!this.bZKSE)
                    {
                        ZKJE    = SaleBillCtrl.GetRound((double)(num * 0.95), 2);
                        ZKSE    = SaleBillCtrl.GetRound((double)(num - ZKJE), 2);
                        mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                        mx.Zkse = Convert.ToString(ZKSE);
                        return(true);
                    }
                    if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(num * 0.05), 2) - ZKSE)), 2) <= this.FSoftTaxPre)
                    {
                        ZKJE    = SaleBillCtrl.GetRound((double)(num - ZKSE), 2);
                        ZKSE    = SaleBillCtrl.GetRound(ZKSE, 2);
                        mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                        mx.Zkse = Convert.ToString(ZKSE);
                        return(true);
                    }
                    mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                    mx.Zkse = Convert.ToString(ZKSE);
                    return(false);
                }
                if (this.bZKSE)
                {
                    if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((num - ZKSE) * num3), 2) - ZKSE)), 2) > this.FSoftTaxPre)
                    {
                        if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(num * num3), 2) - ZKSE)), 2) > this.FSoftTaxPre)
                        {
                            ZKJE    = SaleBillCtrl.GetRound((double)(num - ZKSE), 2);
                            mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                            mx.Zkse = Convert.ToString(ZKSE);
                            return(false);
                        }
                        this.JesmTemp = false;
                        ZKJE          = SaleBillCtrl.GetRound(num, 2);
                    }
                    else
                    {
                        ZKJE = SaleBillCtrl.GetRound((double)(num - ZKSE), 2);
                    }
                }
                else
                {
                    ZKJE = SaleBillCtrl.GetRound((double)(num / (1.0 + num3)), 2);
                    ZKSE = SaleBillCtrl.GetRound((double)(num - ZKJE), 2);
                }
            }
            else
            {
                if (((num3 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                {
                    if (!this.bZKSE)
                    {
                        ZKJE    = SaleBillCtrl.GetRound(num, 2);
                        ZKSE    = SaleBillCtrl.GetRound((double)(num / 19.0), 2);
                        mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                        mx.Zkse = Convert.ToString(ZKSE);
                        return(true);
                    }
                    if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(num / 19.0), 2) - ZKSE)), 2) <= this.FSoftTaxPre)
                    {
                        ZKJE    = SaleBillCtrl.GetRound(num, 2);
                        ZKSE    = SaleBillCtrl.GetRound(ZKSE, 2);
                        mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                        mx.Zkse = Convert.ToString(ZKSE);
                        return(true);
                    }
                    mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                    mx.Zkse = Convert.ToString(ZKSE);
                    return(false);
                }
                if (!this.bZKSE)
                {
                    ZKSE = SaleBillCtrl.GetRound((double)(ZKJE * num3), 2);
                }
                else if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)(ZKJE * num3), 2) - ZKSE)), 2) > this.FSoftTaxPre)
                {
                    if (SaleBillCtrl.GetRound(Math.Abs((double)(SaleBillCtrl.GetRound((double)((num - ZKSE) * num3), 2) - ZKSE)), 2) > this.FSoftTaxPre)
                    {
                        mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                        mx.Zkse = Convert.ToString(ZKSE);
                        return(false);
                    }
                    this.JesmTemp = true;
                    ZKJE          = SaleBillCtrl.GetRound((double)(num - ZKSE), 2);
                }
            }
            ZKJE    = SaleBillCtrl.GetRound(ZKJE, 2);
            ZKSE    = SaleBillCtrl.GetRound(ZKSE, 2);
            mx.Zkje = new double?(Convert.ToDouble(ZKJE));
            mx.Zkse = Convert.ToString(ZKSE);
            return(true);
        }
Exemple #9
0
        private bool CalcZKJE_ZKSE_x(TempXSDJ_MX mx, double ZKJE, double ZKSE)
        {
            double round;
            double num2 = Convert.ToDouble(mx.Slv);
            double num3 = Convert.ToDouble(mx.Bhsje);
            double num4 = Convert.ToDouble(mx.Zkl);
            double num6 = Convert.ToDouble(mx.Se);
            double num  = Math.Abs(ZKJE);

            if (this.JesmTemp)
            {
                if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
                {
                    round = SaleBillCtrl.GetRound((double)(num3 * num4), 2);
                    ZKJE  = SaleBillCtrl.GetRound((double)(round * 0.95), 2);
                    if (SaleBillCtrl.GetRound(ZKSE, 8) == 0.0)
                    {
                        ZKSE = SaleBillCtrl.GetRound((double)(round - ZKJE), 2);
                    }
                    ZKJE    = SaleBillCtrl.GetRound(ZKJE, 2);
                    ZKSE    = SaleBillCtrl.GetRound(ZKSE, 2);
                    mx.Zkje = new double?(Convert.ToDouble(ZKJE));
                    mx.Zkse = Convert.ToString(ZKSE);
                    return(true);
                }
                if (num3 == 0.0)
                {
                    ZKJE = SaleBillCtrl.GetRound((double)((num6 / num2) * num4), 2);
                    if (SaleBillCtrl.GetRound(ZKSE, 8) == 0.0)
                    {
                        ZKSE = SaleBillCtrl.GetRound((double)(num6 * num4), 2);
                    }
                }
                else
                {
                    round = SaleBillCtrl.GetRound((double)(num3 * num4), 2);
                    ZKJE  = SaleBillCtrl.GetRound((double)(round / (1.0 + num2)), 2);
                    if (SaleBillCtrl.GetRound(ZKSE, 8) == 0.0)
                    {
                        ZKSE = SaleBillCtrl.GetRound((double)(round - ZKJE), 2);
                    }
                }
            }
            else if (((num2 == 0.05) && this.hysy_x) && (this.Fplx == InvType.Special))
            {
                round = SaleBillCtrl.GetRound((double)(num3 * num4), 2);
                if (SaleBillCtrl.GetRound(ZKSE, 8) == 0.0)
                {
                    ZKSE = SaleBillCtrl.GetRound((double)(round / 19.0), 2);
                }
                ZKJE = SaleBillCtrl.GetRound(ZKJE, 2);
                ZKSE = SaleBillCtrl.GetRound(ZKSE, 2);
            }
            else
            {
                ZKJE = SaleBillCtrl.GetRound((double)(num3 * num4), 2);
                if (SaleBillCtrl.GetRound(ZKSE, 8) == 0.0)
                {
                    ZKSE = SaleBillCtrl.GetRound((double)(num6 * num4), 2);
                }
            }
            ZKJE    = SaleBillCtrl.GetRound(ZKJE, 2);
            ZKSE    = SaleBillCtrl.GetRound(ZKSE, 2);
            mx.Zkje = new double?(Convert.ToDouble(ZKJE));
            mx.Zkse = Convert.ToString(ZKSE);
            return(true);
        }