コード例 #1
0
        private void judgeHyJdc()
        {
            TaxStateInfo       info        = base.TaxCardInstance.get_StateInfo();
            List <InvTypeInfo> invTypeInfo = info.InvTypeInfo;

            this.BSPRepInfo_ZP = info.TBRepInfo;
            foreach (InvTypeInfo info2 in invTypeInfo)
            {
                if (info2.InvType == 11)
                {
                    this.typeHY        = info2;
                    this.BSPRepInfo_HY = info2.ICRepInfo;
                }
                if ((info2.InvType == 11) && this.checkBox2.Checked)
                {
                    this.typeHY = info2;
                    string   str   = info2.LastRepDate.Split(new char[] { ' ' })[0];
                    DateTime time  = base.TaxCardInstance.get_TaxClock();
                    int      year  = -1;
                    int      month = -1;
                    int      day   = -1;
                    if ((str.Length > 0) && str.Contains("-"))
                    {
                        year  = int.Parse(str.Split(new char[] { '-' })[0]);
                        month = int.Parse(str.Split(new char[] { '-' })[1]);
                        day   = int.Parse(str.Split(new char[] { '-' })[2]);
                        DateTime time2 = new DateTime(year, month, day);
                        DateTime time3 = new DateTime(time.Year, time.Month, time.Day);
                        if ((DateTime.Compare(time2, time3) == 0) && (info2.JSPRepInfo == 0))
                        {
                            MessageManager.ShowMsgBox("TCD_9210_", new List <KeyValuePair <string, string> >(), new string[] { "货物运输业增值税专用发票" + Environment.NewLine }, new string[] { "" });
                            this.hasRepHY = true;
                        }
                    }
                }
                if (info2.InvType == 12)
                {
                    this.typeJDC        = info2;
                    this.BSPRepInfo_JDC = info2.ICRepInfo;
                }
                if ((info2.InvType == 12) && this.checkBox3.Checked)
                {
                    this.typeJDC = info2;
                    string   str2  = info2.LastRepDate.Split(new char[] { ' ' })[0];
                    DateTime time4 = base.TaxCardInstance.get_TaxClock();
                    int      num4  = -1;
                    int      num5  = -1;
                    int      num6  = -1;
                    if ((str2.Length > 0) && str2.Contains("-"))
                    {
                        num4 = int.Parse(str2.Split(new char[] { '-' })[0]);
                        num5 = int.Parse(str2.Split(new char[] { '-' })[1]);
                        num6 = int.Parse(str2.Split(new char[] { '-' })[2]);
                        DateTime time5 = new DateTime(num4, num5, num6);
                        DateTime time6 = new DateTime(time4.Year, time4.Month, time4.Day);
                        if ((DateTime.Compare(time5, time6) == 0) && (info2.JSPRepInfo == 0))
                        {
                            MessageManager.ShowMsgBox("TCD_9210_", new List <KeyValuePair <string, string> >(), new string[] { "机动车销售统一发票" + Environment.NewLine }, new string[] { "" });
                            this.hasRepJDC = true;
                        }
                    }
                }
                if ((info2.InvType == 0x33) && (base.TaxCardInstance.get_InvEleKindCode() == 0x33))
                {
                    this.typePTDZ        = info2;
                    this.BSPRepInfo_PTDZ = info2.ICRepInfo;
                }
                if (((info2.InvType == 0x33) && (base.TaxCardInstance.get_InvEleKindCode() == 0x33)) && this.checkBox3.Checked)
                {
                    this.typePTDZ = info2;
                    List <string> cSDate = base.TaxCardInstance.GetCSDate(0x33);
                    DateTime      time7  = base.TaxCardInstance.get_TaxClock();
                    string        str3   = cSDate[0];
                    int           num7   = -1;
                    int           num8   = -1;
                    int           num9   = -1;
                    if ((str3.Length > 0) && str3.Contains("-"))
                    {
                        string[] strArray = str3.Split(new char[] { '-' });
                        num7 = int.Parse(strArray[0]);
                        num8 = int.Parse(strArray[1]);
                        num9 = int.Parse(strArray[2].Substring(0, 2));
                    }
                    DateTime time8 = new DateTime(num7, num8, num9);
                    DateTime time9 = new DateTime(time7.Year, time7.Month, time7.Day);
                    if ((DateTime.Compare(time8, time9) == 0) && (info2.JSPRepInfo == 0))
                    {
                        MessageManager.ShowMsgBox("TCD_9210_", new List <KeyValuePair <string, string> >(), new string[] { "电子增值税普通发票" + Environment.NewLine }, new string[] { "" });
                        this.hasRepPTDZ = true;
                    }
                }
                if (info2.InvType == 0x29)
                {
                    this.typeJSFP        = info2;
                    this.BSPRepInfo_JSFP = info2.ICRepInfo;
                }
                if ((info2.InvType == 0x29) && this.checkBox3.Checked)
                {
                    this.typeJSFP = info2;
                    List <string> list3  = base.TaxCardInstance.GetCSDate(0x29);
                    DateTime      time10 = base.TaxCardInstance.get_TaxClock();
                    string        str4   = list3[0];
                    int           num10  = -1;
                    int           num11  = -1;
                    int           num12  = -1;
                    if ((str4.Length > 0) && str4.Contains("-"))
                    {
                        string[] strArray2 = str4.Split(new char[] { '-' });
                        num10 = int.Parse(strArray2[0]);
                        num11 = int.Parse(strArray2[1]);
                        num12 = int.Parse(strArray2[2].Substring(0, 2));
                    }
                    DateTime time11 = new DateTime(num10, num11, num12);
                    DateTime time12 = new DateTime(time10.Year, time10.Month, time10.Day);
                    if ((DateTime.Compare(time11, time12) == 0) && (info2.JSPRepInfo == 0))
                    {
                        MessageManager.ShowMsgBox("TCD_9210_", new List <KeyValuePair <string, string> >(), new string[] { "增值税普通发票(卷票)" + Environment.NewLine }, new string[] { "" });
                        this.hasRepJSFP = true;
                    }
                }
            }
        }
コード例 #2
0
        public bool CanInvoice(FPLX fplx, out string code)
        {
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;

            try
            {
                TaxStateInfo info = TaxCardFactory.CreateTaxCard().get_StateInfo();
                if ((fplx == null) || (fplx == 2))
                {
                    flag  = info.IsLockReached == 1;
                    flag2 = info.IsRepReached == 1;
                    flag3 = info.IsInvEmpty == 1;
                }
                else
                {
                    InvTypeInfo        info2       = new InvTypeInfo();
                    List <InvTypeInfo> invTypeInfo = info.InvTypeInfo;
                    if (fplx == 11)
                    {
                        foreach (InvTypeInfo info3 in invTypeInfo)
                        {
                            if (info3.InvType == 11)
                            {
                                info2 = info3;
                                break;
                            }
                        }
                    }
                    else if (fplx == 12)
                    {
                        foreach (InvTypeInfo info3 in invTypeInfo)
                        {
                            if (info3.InvType == 12)
                            {
                                info2 = info3;
                                break;
                            }
                        }
                    }
                    else if (fplx == 0x33)
                    {
                        foreach (InvTypeInfo info3 in invTypeInfo)
                        {
                            if (info3.InvType == 0x33)
                            {
                                info2 = info3;
                                break;
                            }
                        }
                    }
                    else if (fplx == 0x29)
                    {
                        foreach (InvTypeInfo info3 in invTypeInfo)
                        {
                            if (info3.InvType == 0x29)
                            {
                                info2 = info3;
                                break;
                            }
                        }
                    }
                    flag  = info2.IsLockTime == 1;
                    flag2 = info2.IsRepTime == 1;
                    flag3 = info.IsInvEmpty == 1;
                }
                if (flag)
                {
                    code = "INP-242101";
                    return(false);
                }
                if (flag2)
                {
                    code = "INP-242102";
                    return(false);
                }
                if (flag3)
                {
                    code = "INP-242103";
                    return(false);
                }
                code = "000000";
                return(true);
            }
            catch (Exception exception)
            {
                this.log.Error("单据管理开票前读取金税卡状态时异常:" + exception.ToString());
                code = "9999";
                return(false);
            }
        }