public bool SetValue()
 {
     try
     {
         InvCodeNum invCodeNum = new InvCodeNum();
         if ("0000" != this.GetTaxCardCurrentFpNum(ref invCodeNum))
         {
             return(false);
         }
         _InvoiceType invoiceType = this.GetInvoiceType(this.FaPiaoType);
         this.lab_fpzl.Text       = invoiceType.displayfpzl;
         this.lab_fpdm.Text       = invCodeNum.InvTypeCode.Trim();
         this.lab_fpStartNum.Text = invCodeNum.InvNum.Trim();
         int num2 = this.GetTaxCardFPNum(invCodeNum.InvTypeCode, (int)invoiceType.TaxCardfpzl, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(invCodeNum.InvNum));
         if (num2 == 0)
         {
             return(false);
         }
         this.lab_fpHasNum.Text  = num2.ToString();
         this.txt_zuofeiNum.Text = "1";
     }
     catch (Exception exception)
     {
         this.loger.Error(exception.ToString());
         return(false);
     }
     return(true);
 }
        public string GetTaxCardCurrentFpNum(ref InvCodeNum invCodeNum)
        {
            _InvoiceType invoiceType = this.GetInvoiceType(this.FaPiaoType);

            //逻辑修改 本地测试使用假数据
            if (InternetWare.Config.Constants.IsTest)
            {
                invCodeNum = new InvCodeNum()
                {
                    InvTypeCode = "3100153320", InvNum = "88888888", EndNum = "99999999"
                }
            }
            ;
            else
            {
                invCodeNum = base.TaxCardInstance.GetCurrentInvCode(invoiceType.TaxCardfpzl);
            }
            if ((string.IsNullOrEmpty(invCodeNum.InvNum) || string.IsNullOrEmpty(invCodeNum.InvTypeCode)) || (base.TaxCardInstance.RetCode != 0))
            {
                FormMain.CallUpload();
                MessageManager.ShowMsgBox(base.TaxCardInstance.ErrCode);
                return("0001");
            }
            if (!invCodeNum.InvNum.Equals(new string('0', 8)) && !invCodeNum.InvTypeCode.Equals(new string('0', 10)))
            {
                return("0000");
            }
            MessageManager.ShowMsgBox("FPZF-000005");
            return("0001");
        }
Пример #3
0
        public string[] GetCurrent(FPLX fplx)
        {
            string str = "";

            try
            {
                TaxCard    card           = TaxCardFactory.CreateTaxCard();
                int        num            = int.Parse(Enum.Format(typeof(FPLX), fplx, "d"));
                InvCodeNum currentInvCode = card.GetCurrentInvCode(fplx);
                if ((currentInvCode.InvTypeCode == null) || (currentInvCode.InvNum == null))
                {
                    str = card.get_ErrCode();
                    if (str.StartsWith("TCD_768") || str.StartsWith("TCD_769"))
                    {
                        FormMain.CallUpload();
                    }
                    return(null);
                }
                if (currentInvCode.InvTypeCode.Equals("0000000000"))
                {
                    str = "INP-242104";
                    return(null);
                }
                str = "000000";
                return(new string[] { currentInvCode.InvTypeCode, currentInvCode.InvNum });
            }
            catch (Exception exception)
            {
                this.log.Error("读取当前发票代码号码时异常:" + exception.ToString());
                str = "9999";
                return(null);
            }
        }
Пример #4
0
        internal override BaseResult DoService()
        {
            FaPiaoZuoFei_WeiKai form = new FaPiaoZuoFei_WeiKai();

            form.FaPiaoType = CommonMethods.ParseFplx(_args.FpType);
            InvCodeNum invCodeNum = new InvCodeNum();

            if ("0000" != form.GetTaxCardCurrentFpNum(ref invCodeNum))
            {
                return(new BaseResult(_args, new ErrorBase(true, "查询发票信息失败")));
            }
            _InvoiceType invoiceType = form.GetInvoiceType(CommonMethods.ParseFplx(_args.FpType));
            int          fpHasNum    = form.GetTaxCardFPNum(invCodeNum.InvTypeCode, (int)invoiceType.TaxCardfpzl, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(invCodeNum.InvNum));

            return(new WeiKaiChaXunResult(_args, invoiceType.displayfpzl.Trim(), invCodeNum.InvTypeCode.Trim(), invCodeNum.InvNum.Trim(), fpHasNum));
        }
Пример #5
0
 private void GenerateFP_Load(object sender, EventArgs e)
 {
     try
     {
         InvCodeNum currentInvCode = this.taxCard.GetCurrentInvCode(this.FPType_Card);
         if (this.taxCard.get_RetCode() > 0)
         {
             if ((this.taxCard.get_RetCode() == 0x2bd) || (this.taxCard.get_RetCode() == 0x30d))
             {
                 MessageManager.ShowMsgBox("INP-242102");
             }
             else if (this.taxCard.get_RetCode() == 0x2be)
             {
                 MessageManager.ShowMsgBox("INP-242101");
             }
             else if ((this.taxCard.get_RetCode() == 0x300) || (this.taxCard.get_RetCode() == 0x301))
             {
                 FormMain.CallUpload();
                 MessageManager.ShowMsgBox(this.taxCard.get_ErrCode());
             }
             else
             {
                 MessageManager.ShowMsgBox(this.taxCard.get_ErrCode());
             }
             base.Close();
         }
         else if (this.FPleftnum == 0)
         {
             MessageManager.ShowMsgBox("INP-242103");
             base.Close();
         }
         else
         {
             this.lableFPDM.Text = currentInvCode.InvTypeCode;
             this.lableFPSH.Text = currentInvCode.InvNum;
             this.labelSYZS.Text = this.taxCard.GetInvNumber(this.FPType_Card).ToString();
         }
     }
     catch (Exception exception)
     {
         HandleException.HandleError(exception);
     }
 }
 public void ZuoFeiMainFunction(int ZuoFeiNum)
 {
     try
     {
         UpLoadCheckState.SetFpxfState(true);
         int num  = 0;
         int num2 = 0;
         int num3 = 0x1770;
         this.FpList.Clear();
         InvCodeNum invCodeNum = new InvCodeNum();
         if (this.progressBar == null)
         {
             this.progressBar = new FPProgressBar();
         }
         this.progressBar.SetTip("正在作废未开发票", "请等待任务完成", "未开发票作废过程");
         this.progressBar.Visible = true;
         this.progressBar.Refresh();
         this.progressBar.Show();
         this.progressBar.Refresh();
         this.ProcessStartThread(this.step);
         this.progressBar.Refresh();
         for (int i = 0; i < ZuoFeiNum; i++)
         {
             if (this.GetTaxCardCurrentFpNum(ref invCodeNum) != "0000")
             {
                 MessageManager.ShowMsgBox("FPZF-000012");
                 this.progressBar.Visible = false;
                 this.progressBar.Refresh();
                 return;
             }
             string dbfpzl = this.GetInvoiceType(this.FaPiaoType).dbfpzl;
             string str3   = this.lab_fpdm.Text.Trim();
             string str4   = ShareMethods.FPHMTo8Wei(invCodeNum.InvNum);
             string str5   = this.IsEmpty_DengYu(base.TaxCardInstance.Address) + " " + base.TaxCardInstance.Telephone;
             string str6   = this.IsEmpty_DengYu(base.TaxCardInstance.BankAccount);
             string title  = "正在作废发票代码:" + str3 + "发票号码:" + str4;
             this.progressBar.SetTip(title, "请等待任务完成", "未开发票作废过程");
             this.ProcessStartThread(num3 / ZuoFeiNum);
             this.progressBar.Refresh();
             object[] param = new object[] { dbfpzl, str3, str4, DingYiZhiFuChuan1._UserMsg.MC, str5, str6 };
             Fpxx     item  = this.BlankWasteTaxCardZuoFei(param);
             if ((item == null) || !(item.retCode == "0000"))
             {
                 break;
             }
             this.FpList.Add(item);
             num++;
         }
         this.xxfpChaXunBll.SaveXxfp(this.FpList);
         this.progressBar.SetTip("正在将作废发票写入数据库", "请等待任务完成", "未开发票作废过程");
         this.ProcessStartThread(this.step);
         this.progressBar.Refresh();
         this.progressBar.Visible = false;
         num2 = ZuoFeiNum - num;
         MessageManager.ShowMsgBox("FPZF-000010", new string[] { ZuoFeiNum.ToString(), num.ToString(), num2.ToString() });
     }
     catch (Exception exception)
     {
         this.loger.Error("[ZuoFeiMainFunction函数异常]" + exception.ToString());
     }
     finally
     {
         if (this.progressBar != null)
         {
             this.progressBar.Visible = false;
             this.progressBar.Close();
             this.progressBar.Dispose();
             this.progressBar = null;
             GC.Collect();
         }
         UpLoadCheckState.SetFpxfState(false);
     }
 }
Пример #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                int num = int.Parse(this.labelSYZS.Text);
                if (int.Parse(this.labelXZDJ.Text) > 0)
                {
                    List <FPGenerateResult> listGeneratePreview = this.generBL.GenerateInvForPreview(this.selectDJ.ListBH);
                    if (this.fpType == InvType.vehiclesales)
                    {
                        if (this.IsNewJDC)
                        {
                            foreach (FPGenerateResult result in listGeneratePreview)
                            {
                                result.ISNEWJDC = true;
                            }
                        }
                        else
                        {
                            foreach (FPGenerateResult result in listGeneratePreview)
                            {
                                result.ISNEWJDC = false;
                            }
                        }
                    }
                    if (this.fpType == InvType.Common)
                    {
                        if (this.NPCType == 1)
                        {
                            foreach (FPGenerateResult result in listGeneratePreview)
                            {
                                result.TYDH = "1";
                            }
                        }
                        else if (this.NPCType == 2)
                        {
                            foreach (FPGenerateResult result in listGeneratePreview)
                            {
                                XSDJ_MXModel model;
                                result.TYDH = "2";
                                int num3 = 0;
                                while (num3 < result.ListXSDJ_MX.Count)
                                {
                                    model = result.ListXSDJ_MX[num3];
                                    if (Math.Abs(model.SLV) > 1E-06)
                                    {
                                        result.KKPX = "不能开票";
                                        result.SXYY = "收购发票只能开具零税率发票";
                                        break;
                                    }
                                    if (Math.Abs(model.KCE) > 1E-06)
                                    {
                                        result.KKPX = "不能开票";
                                        result.SXYY = "收购发票不能开具差额税发票";
                                        break;
                                    }
                                    num3++;
                                }
                                if (CommonTool.isSPBMVersion())
                                {
                                    for (num3 = 0; num3 < result.ListXSDJ_MX.Count; num3++)
                                    {
                                        model        = result.ListXSDJ_MX[num3];
                                        model.LSLVBS = "3";
                                        if (((model.XSYHSM == "免税") || (model.XSYHSM == "不征税")) || (model.XSYHSM == "出口零税"))
                                        {
                                            model.XSYH   = false;
                                            model.XSYHSM = "";
                                        }
                                        else if (this.yhzc_contain_slv(model.XSYHSM, model.SLV.ToString(), false, false))
                                        {
                                            model.XSYH = true;
                                        }
                                        else
                                        {
                                            model.XSYH = false;
                                        }
                                        if (!model.XSYH)
                                        {
                                            model.XSYHSM = "";
                                        }
                                        if (model.XSYHSM == "")
                                        {
                                            model.XSYH = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    ConfirmDJKPZT mdjkpzt = new ConfirmDJKPZT(listGeneratePreview);
                    switch (mdjkpzt.ShowDialog())
                    {
                    case DialogResult.OK:
                    {
                        InvCodeNum currentInvCode = this.taxCard.GetCurrentInvCode(this.FPType_Card);
                        this.lableFPDM.Text = currentInvCode.InvTypeCode;
                        this.lableFPSH.Text = currentInvCode.InvNum;
                        this.labelSYZS.Text = this.taxCard.GetInvNumber(this.FPType_Card).ToString();
                        this.labelXZDJ.Text = "0";
                        this.selectDJ.ListBH.Clear();
                        base.Close();
                        break;
                    }

                    case DialogResult.Cancel:
                        base.Close();
                        break;
                    }
                }
                else if (this.fpType == InvType.Common)
                {
                    MessageManager.ShowMsgBox("INP-273203");
                }
                else if (this.fpType == InvType.Special)
                {
                    MessageManager.ShowMsgBox("INP-273203");
                }
                else if (this.fpType == InvType.transportation)
                {
                    MessageManager.ShowMsgBox("INP-273203");
                }
                else if (this.fpType == InvType.vehiclesales)
                {
                    MessageManager.ShowMsgBox("INP-273203");
                }
            }
            catch (Exception exception)
            {
                if (exception.ToString().Contains("超时"))
                {
                    this.log.Error(exception.ToString());
                }
                else
                {
                    HandleException.HandleError(exception);
                }
            }
        }