Example #1
0
        /// <summary>
        /// 补开发票
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem23_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int    rowHandle = gridView1.FocusedRowHandle;
            string s_fa001   = string.Empty;
            string s_fa003   = string.Empty;

            if (rowHandle >= 0)
            {
                if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString() == "1")
                {
                    Tools.msg(MessageBoxIcon.Exclamation, "提示", "该收费记录已经开具发票!");
                    return;
                }
                else if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString() == "3" /*原财政发票*/)
                {
                    Tools.msg(MessageBoxIcon.Exclamation, "提示", "不能补开以前财政发票收费!");
                    return;
                }
                s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();

                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }


                //获取税务客户信息
                s_fa003 = gridView1.GetRowCellValue(rowHandle, "FA003").ToString();

                Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_fa003);
                if (frm_taxClient.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "' and FLAG='2'");
                XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                foreach (FP01 fp01 in xpCollection_fp01)
                {
                    if (TaxInvoice.GetNextInvoiceNo() > 0)
                    {
                        if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            TaxInvoice.Invoice(fp01.FP001, clientInfo);
                        }
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// 补开税务退费发票
        /// </summary>
        /// <param name="fa001"></param>
        private void ReInvoiceTaxRefund(string fa001)
        {
            string s_cuname = SqlAssist.ExecuteScalar("select fa003 from fa01 where fa001='" + fa001 + "'").ToString();
            //获取税务客户信息
            Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_cuname);

            if (frm_taxClient.ShowDialog() == DialogResult.OK)
            {
                TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;
                if (TaxInvoice.GetNextInvoiceNo() > 0)
                {
                    if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        TaxInvoice.Invoice(fa001, clientInfo);
                    }
                }
            }
        }
Example #3
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            if (!gridView1.PostEditor())
            {
                return;
            }
            if (!gridView1.UpdateCurrentRow())
            {
                return;
            }
            if (!SaveCheck())
            {
                return;                            //数据合法性校验!!!
            }
            if (source == "1")
            {
                ac001 = Tools.GetEntityPK("RC01");                                    //逝者编号
            }
            string s_fa001 = source == "0"? string.Empty : Tools.GetEntityPK("FA01"); //结算流水号
            string s_rc109 = RegisterAction.GenRegisterNo("0");                       //正常登记寄存证号
            string s_rc002 = rg_rc002.EditValue.ToString();                           //性别
            string s_rc202 = rg_rc202.EditValue.ToString();                           //性别2
            string s_rc003 = txtEdit_rc003.Text;                                      //逝者姓名
            string s_rc303 = txtEdit_rc303.Text;                                      //逝者姓名2
            int    rc004   = int.Parse(txtEdit_rc004.Text);                           //年龄
            int    rc404;

            if (!string.IsNullOrEmpty(txtEdit_rc404.Text))
            {
                rc404 = int.Parse(txtEdit_rc404.Text);
            }
            else
            {
                rc404 = 0;
            }

            string   s_rc014     = txtedit_rc014.Text;                        //身份证号
            string   s_rc050     = txtEdit_rc050.Text;                        //联系人
            string   s_rc051     = txtEdit_rc051.Text;                        //联系电话
            string   s_rc052     = lookUp_rc052.EditValue.ToString();         //与逝者关系
            string   s_rc055     = txtEdit_ac055.Text;                        //联系地址
            string   s_rc099     = mem_rc099.Text;                            //备注
            DateTime d_rc140     = DateTime.Now;                              //寄存日期
            decimal  nums        = decimal.Parse(comboBox1.Text);             //缴费年限
            decimal  dec_tax_sum = new decimal(0);

            //输入交款人信息
            string s_cuname = s_rc003;

            List <string>  itemId_List    = new List <string>();
            List <decimal> itemPrice_List = new List <decimal>();
            List <int>     itemNums_List  = new List <int>();

            if (fpfee > 0)
            {
                foreach (DataRow r in register_ds.Sa01.Rows)
                {
                    itemId_List.Add(r["SA004"].ToString());
                    itemPrice_List.Add(Convert.ToDecimal(r["PRICE"]));
                    itemNums_List.Add(Convert.ToInt32(r["NUMS"]));
                    //计算税票项目金额
                    if (MiscAction.GetItemInvoiceType(r["SA004"].ToString()) == "T")
                    {
                        dec_tax_sum += Convert.ToDecimal(r["SA007"]);
                    }
                }
            }
            string s_tip = string.Empty;

            if (dec_tax_sum > 0)
            {
                s_tip = "本次结算共需要一张财政发票和一张税务发票,是否继续?";
            }
            else
            {
                s_tip = "本次结算共需要一张财政发票,是否继续?";
            }


            if (source == "1")             //外来寄存
            {
                if (XtraMessageBox.Show(s_tip, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                if (dec_tax_sum > 0 && !TaxInvoice.ClientIsOnline())
                {
                    if (XtraMessageBox.Show("【税神通】客户端不在线!是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            int re = 0;

            if (fpfee > 0)
            {
                re = RegisterAction.RegisterEnroll(ac001,
                                                   s_rc109,
                                                   s_fa001,
                                                   s_rc002,
                                                   s_rc202,
                                                   s_rc003,
                                                   s_rc303,
                                                   rc004,
                                                   rc404,
                                                   s_rc014,
                                                   s_rc050,
                                                   s_rc051,
                                                   s_rc052,
                                                   s_rc055,
                                                   s_rc099,
                                                   bitId,
                                                   bitPrice,
                                                   d_rc140,
                                                   d_rc140,
                                                   nums,
                                                   regfee,
                                                   source,
                                                   itemId_List.ToArray(),
                                                   itemPrice_List.ToArray(),
                                                   itemNums_List.ToArray(),
                                                   Envior.cur_userId
                                                   );
            }
            else
            {
                re = RegisterAction.RegisterEnroll(ac001,
                                                   s_rc109,
                                                   s_fa001,
                                                   s_rc002,
                                                   s_rc202,
                                                   s_rc003,
                                                   s_rc303,
                                                   rc004,
                                                   rc404,
                                                   s_rc014,
                                                   s_rc050,
                                                   s_rc051,
                                                   s_rc052,
                                                   s_rc055,
                                                   s_rc099,
                                                   bitId,
                                                   bitPrice,
                                                   d_rc140,
                                                   d_rc140,
                                                   nums,
                                                   regfee,
                                                   source,
                                                   Envior.cur_userId
                                                   );
            }

            if (IDC_FLAG)
            {
                ic01.ac001 = ac001;
                ic01_dao.Insert(ic01);

                ///更新身份证照片
                FileStream file    = new FileStream("zp.bmp", FileMode.Open, FileAccess.Read);
                Byte[]     imgByte = new Byte[file.Length];           //把图片转成 Byte型 二进制流
                file.Read(imgByte, 0, imgByte.Length);                //把二进制流读入缓冲区
                file.Close();
                MiscAction.Update_IDC_Photo(ic01.ic001, imgByte);
            }

            if (re > 0 && source == "0")
            {
                XtraMessageBox.Show("寄存办理成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else if (re > 0 && source == "1" /* 外来寄存 */)
            {
                if (XtraMessageBox.Show("现在打印【骨灰寄存证】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    PrtServAction.PrtRegisterCert(ac001, s_fa001, Envior.mform.Handle.ToInt32());
                }
                //if (XtraMessageBox.Show("现在打印【寄存标签】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                //{
                //	PrtServAction.PrtRegisterLabel(ac001,this.Handle.ToInt32());
                //}

                txtEdit_rc001.EditValue = ac001;
                txtEdit_rc109.EditValue = s_rc109;
                XtraMessageBox.Show("寄存登记成功!现在开始开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                ///开财政票
                if (FinInvoice.GetCurrentPh() > 0)
                {
                    if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        FinInvoice.Invoice(s_fa001);
                    }
                }

                //// 开税票
                if (dec_tax_sum > 0)
                {
                    //获取税务客户信息
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_rc003);
                    if (frm_taxClient.ShowDialog() == DialogResult.OK)
                    {
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;
                        if (TaxInvoice.GetNextInvoiceNo(s_fa001) > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(s_fa001, clientInfo);
                            }
                        }
                    }
                }


                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Example #4
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            bool b_payrecord = false;

            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");
                //1.购墓登记
                ac01       = new AC01(unitOfWork1);
                ac01.AC001 = s_ac001;                            //购墓登记编号
                ac01.AC002 = te_ac002.Text;                      //购墓人身份证号
                ac01.AC003 = te_ac003.Text;                      //购墓人
                ac01.AC004 = te_ac004.Text;                      //联系电话
                ac01.AC005 = te_ac005.Text;                      //联系地址
                ac01.AC012 = bi01.RE001;                         //排编号
                ac01.AC010 = bi01.RG001;                         //墓区编号
                ac01.AC015 = bi01.BI001;                         //墓位编号
                ac01.AC020 = Convert.ToDecimal(bi01.PRICE);      //墓位定价
                ac01.AC022 = Convert.ToDecimal(te_price.Text);   //售价
                ac01.AC038 = Convert.ToInt32(te_free_nums.Text); //免费管理年限
                ac01.AC049 = Convert.ToDateTime(de_ac049.Text);  //购墓日期

                //管理费到期日期
                if (ac01.AC038 > 0)
                {
                    ac01.AC040  = ac01.AC049.AddYears(ac01.AC038);
                    b_payrecord = true;
                }
                else
                {
                    int rowHandle = gridView1.LocateByValue("SA003", "管理费");
                    if (rowHandle >= 0)
                    {
                        ac01.AC040  = ac01.AC049.AddYears(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "NUMS")));
                        b_payrecord = true;
                    }
                    else
                    {
                        ac01.AC040 = ac01.AC049;
                    }
                }

                ac01.AC042  = '1';                      //缴费状态
                ac01.AC048  = s_fa001;                  //缴费流水号
                ac01.AC100  = Envior.cur_userId;        //经办人
                ac01.AC200  = Tools.GetServerDate();    //经办日期
                ac01.AC250  = te_ac250.Text;            //备注
                ac01.AC300  = '1';                      //登记类型 1-正常登记 0-原始登记
                ac01.STATUS = '1';                      //当前状态
                ac01.Save();

                //2.销售项目
                foreach (SA01 sa01 in xpCollection_sa01)
                {
                    sa01.SA008 = '1';                   //结算状态
                    sa01.SA010 = s_fa001;               //结算流水号
                    sa01.SA020 = 'T';                   //发票类型
                    sa01.SA100 = Envior.cur_userId;     //经办人
                    sa01.SA200 = Tools.GetServerDate(); //经办日期
                    sa01.Save();
                    if (sa01.SA003 == "管理费" /*如果是管理费*/ && sa01.SA002 == '1')
                    {
                        //插入缴费表
                        PR01 pr01 = new PR01(unitOfWork1);
                        pr01.PR001  = s_fa001;
                        pr01.AC001  = s_ac001;
                        pr01.PR002  = ac01.AC049;  //缴费开始日期
                        pr01.PR003  = ac01.AC049.AddYears(Convert.ToInt32(sa01.NUMS));
                        pr01.PRICE  = sa01.PRICE;
                        pr01.NUMS   = sa01.NUMS;
                        pr01.PR007  = sa01.SA007;
                        pr01.PR008  = '1';
                        pr01.PR100  = Envior.cur_userId;
                        pr01.PR200  = Tools.GetServerDate();
                        pr01.STATUS = '1';
                        pr01.Save();
                    }
                }


                //3.号位信息
                bi01.STATUS = '2';                                  //已使用
                bi01.PRICE  = Convert.ToDecimal(te_fixprice.Text);  //定价
                bi01.BI005  = le_mx.EditValue.ToString();           //墓型
                bi01.AC001  = s_ac001;                              //购墓登记编号
                bi01.Save();

                //4.财务收费信息
                dec_total = dec_sales + Convert.ToDecimal(te_price.Text);
                FA01 fa01 = new FA01(unitOfWork1);
                fa01.FA001 = s_fa001;                                 //缴费流水号
                fa01.AC001 = s_ac001;                                 //购墓流水号
                fa01.FA002 = '0';                                     //收费类型 0-购墓
                fa01.FA003 = te_ac003.Text;                           //缴费人
                fa01.FA004 = dec_total;                               //收费金额
                fa01.FA190 = '0';                                     //开票标志-未开票
                fa01.FA100 = Envior.cur_userId;                       //收费人

                fa01.FA180  = MiscAction.GetTombPosition(bi01.BI001); //备注(墓穴位置)
                fa01.FA200  = Tools.GetServerDate();                  //缴费时间
                fa01.STATUS = "1";                                    //状态
                fa01.WS001  = Envior.WORKSTATIONID;                   //工作站标识
                fa01.Save();

                //如果是预定的记录
                if (bk01 != null && s_action == "bookin")
                {
                    bk01.STATUS = '2';   //已登记
                    bk01.Save();
                }

                unitOfWork1.CommitTransaction();
                ///设置附加信息
                BusinessAction.SetExtraInfo(s_ac001);

                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("登记办理成功!\r\n" + "本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sb_ok.Enabled = false;
                    //获取税务客户信息
                    string            s_ac003       = te_ac003.Text;
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fp01.FP001, clientInfo);
                            }
                        }
                    }
                }
                ////打印证书
                if (XtraMessageBox.Show("现在打印【购墓证书】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintAction.PrintCert(s_ac001);
                }
                if (b_payrecord && XtraMessageBox.Show("现在打印【缴费记录】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintAction.PrintPayRecord(s_fa001);
                }
                ////打印购墓协议
                //if (XtraMessageBox.Show("现在打印【购墓协议】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                //{
                //    PrintAction.PrintProtocol(s_ac001);
                //}


                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sb_ok_Click(object sender, EventArgs e)
        {
            string s_fa001 = string.Empty;
            FA01   fa01    = null;
            SA01   sa01    = null;
            BI01   bi01    = null;
            AC01   ac01_m  = null;
            REFUND refund  = null;
            int    i_invoice_num;

            if (XtraMessageBox.Show("确认要进行退墓操作,本操作将不可撤销,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            if (decimal.TryParse(te_refund.Text, out dec_tomb))
            {
                if (dec_tomb <= 0 || dec_tomb > ac01.AC022)
                {
                    te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                    te_refund.ErrorText = "退费金额错误!";
                    return;
                }
            }
            else
            {
                te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_refund.ErrorText = "请输入退购墓费!";
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");

                //2.保存销售记录
                sa01        = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");              //销售流水号
                sa01.AC001  = ac01.AC001;                                  //购墓流水号
                sa01.SA002  = '0';                                         //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                sa01.SA003  = "购墓费";
                sa01.SA004  = ac01.AC015;                                  //墓位编号
                sa01.SA005  = '0';                                         //业务类型 0-购墓 1-临时销售
                sa01.PRICE  = dec_tomb;                                    //单价
                sa01.NUMS   = -1;                                          //数量
                sa01.SA007  = 0 - dec_tomb;                                //金额
                sa01.SA006  = sa01.SA007;                                  //原始单价
                sa01.SA008  = '1';                                         //结算状态 1-已结算 0-未结算
                sa01.SA010  = s_fa001;                                     //结算流水号
                sa01.SA020  = 'T';                                         //发票类型
                sa01.SA025  = MiscAction.GetSysParaValue1("tomb_taxrate"); //税率
                sa01.SA100  = Envior.cur_userId;                           //经办人
                sa01.SA200  = Tools.GetServerDate();                       //经办日期
                sa01.STATUS = '1';                                         //状态 1-正常 0-删除
                sa01.Save();

                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    if (!gridView1.IsRowSelected(i))
                    {
                        continue;
                    }
                    sa01        = new SA01(unitOfWork1);
                    sa01.SA001  = MiscAction.GetEntityPK("SA01");                                      //销售流水号
                    sa01.AC001  = ac01.AC001;                                                          //购墓流水号
                    sa01.SA002  = '1';                                                                 //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                    sa01.SA003  = gridView1.GetRowCellValue(i, "SA003").ToString();                    //项目名称
                    sa01.SA004  = gridView1.GetRowCellValue(i, "SA004").ToString();                    //项目编号
                    sa01.SA005  = '0';                                                                 //业务类型 0-购墓 1-临时销售
                    sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));            //单价
                    sa01.NUMS   = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS"));         //数量
                    sa01.SA007  = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007"));        //金额
                    sa01.SA006  = sa01.SA007;                                                          //原始单价
                    sa01.SA008  = '1';                                                                 //结算状态 1-已结算 0-未结算
                    sa01.SA010  = s_fa001;                                                             //结算流水号
                    sa01.SA020  = 'T';                                                                 //发票类型
                    sa01.SA025  = BusinessAction.GetTaxRate(sa01.SA004);                               //税率
                    sa01.SA100  = Envior.cur_userId;                                                   //经办人
                    sa01.SA200  = Tools.GetServerDate();                                               //经办日期
                    sa01.STATUS = '1';                                                                 //状态 1-正常 0-删除
                    sa01.Save();
                }

                //3.保存退费日志
                refund       = new REFUND(unitOfWork1);
                refund.RF001 = s_fa001;
                refund.RF003 = te_reason.Text;
                refund.RF004 = 0 - (dec_tomb + dec_sales);
                refund.RF100 = Envior.cur_userId;
                refund.RF200 = Tools.GetServerDate();
                refund.RF300 = ac01.AC048;                               //原结算流水号
                refund.Save();

                ///4.保存缴费记录
                fa01        = new FA01(unitOfWork1);
                fa01.FA001  = s_fa001;                    //结算流水号
                fa01.FA002  = '0';                        //结算类型 0-购墓 1-服务祭品 2-管理费
                fa01.FA003  = ac01.AC003;                 //购墓人
                fa01.FA004  = 0 - (dec_tomb + dec_sales); //金额
                fa01.FA190  = '0';                        //开票标志 0-未开票
                fa01.FA100  = Envior.cur_userId;          //经办人
                fa01.FA200  = Tools.GetServerDate();      //经办日期
                fa01.STATUS = "1";                        //状态
                fa01.AC001  = ac01.AC001;
                fa01.WS001  = Envior.WORKSTATIONID;       //工作站
                fa01.Save();

                //5.修改ac01
                ac01_m        = unitOfWork1.GetObjectByKey <AC01>(ac01.AC001, true);
                ac01_m.STATUS = '2';                                     //状态-退墓
                ac01_m.Save();

                //6.修改号位状态
                bi01 = unitOfWork1.GetObjectByKey <BI01>(ac01.AC015, true);
                if (bi01 != null)
                {
                    bi01.AC001  = "";
                    bi01.STATUS = '1';
                    bi01.Save();
                }
                unitOfWork1.CommitTransaction();

                i_invoice_num = BusinessAction.GetInvoicePapers(s_fa001);
                if (i_invoice_num == 0)
                {
                    Tools.msg(MessageBoxIcon.Information, "提示", "退墓成功!");
                }
                else
                {
                    if (XtraMessageBox.Show("退墓办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        string            s_ac003       = te_ac003.Text;
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Example #6
0
        /// <summary>
        /// 补开发票
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!AppAction.CheckRight("补开发票"))
            {
                return;
            }

            int rowHandle = gridView1.FocusedRowHandle;

            if (rowHandle < 0)
            {
                return;
            }

            if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString() == gridView1.GetRowCellValue(rowHandle, "FA195").ToString())
            {
                XtraMessageBox.Show("此笔收费记录已经开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();

            //如果办理过退费,不能再开具发票了
            if (MiscAction.HaveRefund(s_fa001))
            {
                XtraMessageBox.Show("此笔收费记录办理过退费,不能再开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //如果收费不是本工作站,提示
            if (!string.IsNullOrEmpty(gridView1.GetRowCellValue(rowHandle, "WS001").ToString()))
            {
                if (!Envior.WORKSTATIONID.Equals(gridView1.GetRowCellValue(rowHandle, "WS001").ToString()))
                {
                    if (XtraMessageBox.Show("此收费记录结算并非当前工作站,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
            }

            //TODO 负数发票补开
            if (Convert.ToDecimal(gridView1.GetRowCellValue(rowHandle, "FA004")) < 0)
            {
                //需要补开财政发票
                if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(0, 1) == "0" && gridView1.GetRowCellValue(rowHandle, "FA195").ToString().Substring(0, 1) == "1")
                {
                    XtraMessageBox.Show("现在开始补开【财政发票】!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ReInvoiceFinRefund(s_fa001);
                }
                //需要补开税务发票
                if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(1, 1) == "0" && gridView1.GetRowCellValue(rowHandle, "FA195").ToString().Substring(1, 1) == "1")
                {
                    XtraMessageBox.Show("现在开始补开【税务发票】!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ReInvoiceTaxRefund(s_fa001);
                }
                return;
            }



            //需要开具财政发票
            if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(0, 1) == "0" &&
                gridView1.GetRowCellValue(rowHandle, "FA195").ToString().Substring(0, 1) == "1")
            {
                XtraMessageBox.Show("现在准备开具财政发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (FinInvoice.GetCurrentPh() > 0)
                {
                    if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        FinInvoice.Invoice(s_fa001);
                    }
                }
            }

            ///开税票
            if (gridView1.GetRowCellValue(rowHandle, "FA190").ToString().Substring(1, 1) == "0" &&
                gridView1.GetRowCellValue(rowHandle, "FA195").ToString().Substring(1, 1) == "1")
            {
                XtraMessageBox.Show("现在准备开具税务发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //获取税务客户信息
                Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo();
                if (frm_taxClient.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                if (TaxInvoice.GetNextInvoiceNo() < 0)
                {
                    return;                                                     //获取票据号失败,则退出!!!
                }
                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    TaxInvoice.Invoice(s_fa001, clientInfo);
                }
            }
        }
Example #7
0
        /// <summary>
        /// 结算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem18_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SaveCheck())
            {
                return;
            }
            string s_tip = string.Empty;

            if (dec_fin > 0 && dec_tax > 0)
            {
                s_tip = "本次结算共需要一张财政发票和一张税务发票,是否继续?";
            }
            else if (dec_fin > 0)
            {
                s_tip = "本次结算共需要一张财政发票,是否继续?";
            }
            else if (dec_tax > 0)
            {
                s_tip = "本次结算共需要一张税务发票,是否继续?";
            }
            else
            {
                return;
            }

            if (XtraMessageBox.Show(s_tip, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            if (dec_tax > 0 && !TaxInvoice.ClientIsOnline())
            {
                if (XtraMessageBox.Show("【税神通】客户端不在线!是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }



            string        s_cuname = be_cuname.EditValue.ToString();        //交款人(或单位)
            StringBuilder sb_memo  = new StringBuilder(50);

            List <string>  itemId_List   = new List <string>();
            List <string>  itemType_List = new List <string>();
            List <decimal> prict_List    = new List <decimal>();
            List <decimal> nums_List     = new List <decimal>();

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                itemId_List.Add(gridView1.GetRowCellValue(i, "SA004").ToString());
                itemType_List.Add(gridView1.GetRowCellValue(i, "SA002").ToString());
                prict_List.Add(decimal.Parse(gridView1.GetRowCellValue(i, "PRICE").ToString()));
                nums_List.Add(decimal.Parse(gridView1.GetRowCellValue(i, "NUMS").ToString()));
            }
            string s_fa001 = Tools.GetEntityPK("FA01");
            int    re      = FireAction.TempSalesSettle(
                s_cuname, s_fa001, itemId_List.ToArray(), itemType_List.ToArray(), prict_List.ToArray(), nums_List.ToArray(), Envior.cur_userId, sb_memo.ToString());

            //如果保存失败,则退出处理
            if (re < 0)
            {
                return;
            }

            //清理数据
            business_ds.Sa01.Rows.Clear();
            be_cuname.Text  = "";
            te_fin_sum.Text = "";
            te_tax_sum.Text = "";


            XtraMessageBox.Show("结算成功!现在开始开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

            ////开财政票!
            if (dec_fin > 0)
            {
                if (FinInvoice.GetCurrentPh() > 0)
                {
                    if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        FinInvoice.Invoice(s_fa001);
                    }
                }
            }

            //// 开税票
            if (dec_tax > 0)
            {
                //获取税务客户信息
                Frm_TaxClientInfo frm_taxClient = null;
                if (tu01 == null)
                {
                    frm_taxClient = new Frm_TaxClientInfo(s_cuname);
                }
                else
                {
                    frm_taxClient = new Frm_TaxClientInfo(tu01);
                }

                if (frm_taxClient.ShowDialog() != DialogResult.OK)
                {
                    tu01 = null;
                    return;
                }

                TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                if (TaxInvoice.GetNextInvoiceNo(s_fa001) < 0)
                {
                    tu01 = null;
                    return;                      //获取票据号失败,则退出!!!
                }

                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    TaxInvoice.Invoice(s_fa001, clientInfo);
                }

                //////////// 保存客户信息 ///////////////
                Tu01_dao tu01_dao = new Tu01_dao();
                if (tu01 != null)
                {
                    tu01.tu003 = clientInfo.InfoClientName;
                    tu01.tu005 = clientInfo.InfoClientTaxCode;
                    tu01.tu006 = clientInfo.infoclientaddressphone;
                    tu01.tu007 = clientInfo.infoclientbankaccount;
                    tu01_dao.Update(tu01);
                }
                else if (clientInfo.InfoClientName.Length >= 5)
                {
                    tu01       = new Tu01();
                    tu01.tu001 = Tools.GetEntityPK("TU01");
                    tu01.tu003 = clientInfo.InfoClientName;
                    tu01.tu005 = clientInfo.InfoClientTaxCode;
                    tu01.tu006 = clientInfo.infoclientaddressphone;
                    tu01.tu007 = clientInfo.infoclientbankaccount;
                    tu01_dao.Insert(tu01);
                }
                tu01 = null;
            }
        }
Example #8
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!gridView1.PostEditor())
            {
                return;
            }
            if (!gridView1.UpdateCurrentRow())
            {
                return;
            }

            List <string>  itemIdList   = new List <string>();
            List <decimal> numsList     = new List <decimal>();
            List <decimal> priceList    = new List <decimal>();
            List <string>  itemTypeList = new List <string>();

            decimal dec_refund_fee = decimal.Zero;
            decimal dec_tax_sum    = decimal.Zero;

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (decimal.TryParse(gridView1.GetRowCellValue(i, "RFEE").ToString(), out dec_refund_fee))
                {
                    if (dec_refund_fee <= 0)
                    {
                        continue;
                    }
                    itemIdList.Add(gridView1.GetRowCellValue(i, "SA004").ToString());
                    priceList.Add(Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")));
                    numsList.Add(0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "REFUNDNUM")));
                    itemTypeList.Add(gridView1.GetRowCellValue(i, "SA002").ToString());
                    dec_tax_sum += Convert.ToDecimal(gridView1.GetRowCellValue(i, "RFEE"));
                }
            }
            if (numsList.Count <= 0)
            {
                XtraMessageBox.Show("还未选择退费的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string s_fa001 = Tools.GetEntityPK("FA01");
            string s_memo  = te_memo.Text;

            try
            {
                int re = MiscAction.TaxRefundSettle(s_fa001, itemIdList.ToArray(), itemTypeList.ToArray(), priceList.ToArray(), numsList.ToArray(), Envior.cur_userId, s_memo, s_sa010);

                if (re > 0)
                {
                    XtraMessageBox.Show("退费结算完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    string s_cuname = SqlAssist.ExecuteScalar("select fa003 from fa01 where fa001='" + s_sa010 + "'").ToString();
                    //获取税务客户信息
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_cuname);
                    if (frm_taxClient.ShowDialog() == DialogResult.OK)
                    {
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(s_fa001, clientInfo);
                            }
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                XtraMessageBox.Show(ee.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
        /// <summary>
        /// 缴费 过程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void b_ok_Click(object sender, EventArgs e)
        {
            decimal nums;
            decimal dec_tax_sum = decimal.Zero;

            if (!decimal.TryParse(comboBox1.Text, out nums))
            {
                XtraMessageBox.Show("请输入正确的缴费期限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!(bitprice > 0))
            {
                XtraMessageBox.Show("参数传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string cuname = txtEdit_rc003.Text;
            string fa001  = Tools.GetEntityPK("FA01");
            int    re     = 0;


            List <string>  itemId_List    = new List <string>();
            List <decimal> itemPrice_List = new List <decimal>();
            List <int>     itemNums_List  = new List <int>();

            if (fpfee > 0)
            {
                foreach (DataRow r in dt_sa01.Rows)
                {
                    itemId_List.Add(r["SA004"].ToString());
                    itemPrice_List.Add(Convert.ToDecimal(r["PRICE"]));
                    itemNums_List.Add(Convert.ToInt32(r["NUMS"]));
                    //计算税票项目金额
                    if (MiscAction.GetItemInvoiceType(r["SA004"].ToString()) == "T")
                    {
                        dec_tax_sum += Convert.ToDecimal(r["SA007"]);
                    }
                }
            }

            if (dec_tax_sum > 0 && !TaxInvoice.ClientIsOnline())
            {
                if (XtraMessageBox.Show("【税神通】客户端不在线!是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }


            if (fpfee > 0)
            {
                re = RegisterAction.RegisterPay(rc001, fa001, bitprice, nums, new_regfee + old_regfee,
                                                itemId_List.ToArray(), itemPrice_List.ToArray(), itemNums_List.ToArray(), Envior.cur_userId);
            }
            else
            {
                re = RegisterAction.RegisterPay(rc001, fa001, bitprice, nums, new_regfee + old_regfee, Envior.cur_userId);
            }


            //if (!checkEdit1.Checked)
            //	re = RegisterAction.RegisterPay(rc001, fa001, bitprice, nums, new_regfee + old_regfee,Envior.cur_userId);
            //else
            //	re = RegisterAction.RegisterPay(rc001, fa001, oldprice, bitprice, oldnums, newnums, old_regfee, new_regfee, Envior.cur_userId);

            if (re > 0)
            {
                dt_rc04.Rows.Clear();
                rc04Adapter.Fill(dt_rc04);

                if (XtraMessageBox.Show("缴费成功!现在打印财政【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    if (FinInvoice.GetCurrentPh() > 0)
                    {
                        if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            FinInvoice.Invoice(fa001);
                        }
                    }
                }

                //// 开税票
                if (dec_tax_sum > 0)
                {
                    //获取税务客户信息
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(txtEdit_rc003.Text);
                    if (frm_taxClient.ShowDialog() == DialogResult.OK)
                    {
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;
                        if (TaxInvoice.GetNextInvoiceNo(fa001) > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fa001, clientInfo);
                            }
                        }
                    }
                }


                if (XtraMessageBox.Show("现在打印缴费记录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    //打印缴费记录
                    PrtServAction.PrtRegisterPayRecord(fa001, this.Handle.ToInt32());
                }
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Example #10
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            decimal dec_fin = new decimal(0);
            decimal dec_tax = new decimal(0);
            string  s_tip   = string.Empty;

            foreach (DataRow dr in dt_source.Rows)
            {
                if (dr["SA020"].ToString() == "F")
                {
                    dec_fin += Convert.ToDecimal(dr["SA007"]);
                }
                else if (dr["SA020"].ToString() == "T")
                {
                    dec_tax += Convert.ToDecimal(dr["SA007"]);
                }
            }

            if (dec_fin > 0 && dec_tax > 0)
            {
                s_tip = "本次结算共需要一张财政发票和一张税务发票,是否继续?";
            }
            else if (dec_fin > 0)
            {
                s_tip = "本次结算共需要一张财政发票,是否继续?";
            }
            else if (dec_tax > 0)
            {
                s_tip = "本次结算共需要一张税务发票,是否继续?";
            }
            else
            {
                return;
            }

            if (XtraMessageBox.Show(s_tip, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            string        s_fa001    = Tools.GetEntityPK("FA01");
            string        s_cuname   = FireAction.GetGuyNameById(AC001);
            List <string> sa001_list = new List <string>();

            foreach (DataRow r in dt_source.Rows)
            {
                sa001_list.Add(r["SA001"].ToString());
            }

            int result = FireAction.FireBusinessSettle(s_fa001,
                                                       AC001,
                                                       s_cuname,
                                                       sa001_list.ToArray(),
                                                       Envior.cur_userId
                                                       );

            if (result > 0)
            {
                b_ok.Enabled = false;

                int fire_row = gridView1.LocateByValue("SA002", "06");
                //如果有火化,打印火化证明
                if (fire_row >= 0)
                {   //打印火化证明
                    if (XtraMessageBox.Show("现在打印火化证明?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        PrtServAction.Print_HHZM(AC001, 0);
                    }
                }

                XtraMessageBox.Show("结算成功!现在开始打印发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ////开财政票!
                if (dec_fin > 0)
                {
                    //string s_pjh = string.Empty;
                    //string s_zch = string.Empty;
                    if (FinInvoice.GetCurrentPh() > 0)
                    {
                        if (XtraMessageBox.Show("下一张财政发票号码:" + Envior.FIN_NEXT_BILL_NO + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            FinInvoice.Invoice(s_fa001);
                        }
                    }
                }

                //// 开税票
                if (dec_tax > 0)
                {
                    //获取税务客户信息
                    string            s_ac003       = SqlAssist.ExecuteScalar("select ac003 from ac01 where ac001='" + AC001 + "'").ToString();
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    if (TaxInvoice.GetNextInvoiceNo() > 0)
                    {
                        if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            TaxInvoice.Invoice(s_fa001, clientInfo);
                        }
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Example #11
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            decimal dec_total   = decimal.Zero;
            string  s_new_fa001 = string.Empty;
            SA01    sa01        = null;
            FA01    fa01_new    = null;

            if (gridView1.GetSelectedRows().Length == 0)
            {
                Tools.msg(MessageBoxIcon.Exclamation, "提示", "请先选择要退费的项目!");
                return;
            }

            try
            {
                dec_total   = Convert.ToDecimal(te_total.EditValue);
                s_new_fa001 = MiscAction.GetEntityPK("FA01");

                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    if (!gridView1.IsRowSelected(i))
                    {
                        continue;
                    }
                    sa01        = new SA01(unitOfWork1);
                    sa01.SA001  = MiscAction.GetEntityPK("SA01");                                      //销售流水号
                    sa01.AC001  = fa01.AC001;                                                          //购墓流水号
                    sa01.SA002  = fa01.FA002 == '2' ? '2':'1';                                         //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                    sa01.SA003  = gridView1.GetRowCellValue(i, "SA003").ToString();                    //项目名称
                    sa01.SA004  = gridView1.GetRowCellValue(i, "SA004").ToString();                    //项目编号
                    sa01.SA005  = fa01.FA002;                                                          //业务类型 0-购墓 1-临时销售
                    sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));            //单价
                    sa01.NUMS   = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS"));         //数量
                    sa01.SA007  = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007"));        //金额
                    sa01.SA006  = sa01.SA007;                                                          //原始单价
                    sa01.SA008  = '1';                                                                 //结算状态 1-已结算 0-未结算
                    sa01.SA010  = s_new_fa001;                                                         //结算流水号
                    sa01.SA020  = 'T';                                                                 //发票类型
                    sa01.SA025  = BusinessAction.GetTaxRate(sa01.SA004);                               //税率
                    sa01.SA100  = Envior.cur_userId;                                                   //经办人
                    sa01.SA200  = Tools.GetServerDate();                                               //经办日期
                    sa01.STATUS = '1';                                                                 //状态 1-正常 0-删除
                    sa01.Save();
                }

                //2.保存退费日志
                refund       = new REFUND(unitOfWork1);
                refund.RF001 = s_new_fa001;
                refund.RF003 = te_reason.Text;
                refund.RF004 = 0 - dec_total;
                refund.RF100 = Envior.cur_userId;
                refund.RF200 = Tools.GetServerDate();
                refund.RF300 = s_fa001;                              //原结算流水号
                refund.Save();

                ///3.保存缴费记录
                fa01_new        = new FA01(unitOfWork1);
                fa01_new.FA001  = s_new_fa001;              //结算流水号
                fa01_new.FA002  = fa01.FA002;               //结算类型 0-购墓 1-服务祭品 2-管理费
                fa01_new.FA003  = fa01.FA003;               //缴款人
                fa01_new.FA004  = 0 - dec_total;            //金额
                fa01_new.FA190  = '0';                      //开票标志 0-未开票
                fa01_new.FA100  = Envior.cur_userId;        //经办人
                fa01_new.FA200  = Tools.GetServerDate();    //经办日期
                fa01_new.STATUS = "1";                      //状态
                fa01_new.AC001  = fa01.AC001;
                fa01_new.WS001  = Envior.WORKSTATIONID;     //工作站
                fa01_new.Save();

                unitOfWork1.CommitTransaction();

                int i_invoice_num = BusinessAction.GetInvoicePapers(s_new_fa001);
                if (i_invoice_num == 0)
                {
                    Tools.msg(MessageBoxIcon.Information, "提示", "退费办理成功!");
                }
                else
                {
                    if (XtraMessageBox.Show("退费办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        string            s_fa003       = fa01.FA003;
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_fa003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Example #12
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");

                //保存销售记录
                foreach (SA01 sa01 in xpCollection_sa01)
                {
                    sa01.SA008 = '1';                   //结算状态
                    sa01.SA010 = s_fa001;               //结算流水号
                    sa01.SA020 = 'T';                   //发票类型
                    sa01.SA100 = Envior.cur_userId;     //经办人
                    sa01.SA200 = Tools.GetServerDate(); //经办日期
                    dec_sum   += sa01.SA007;
                }
                //财务收费信息
                FA01 fa01 = new FA01(unitOfWork1);
                fa01.FA001  = s_fa001;                              //缴费流水号
                fa01.FA002  = '1';                                  //收费类型 0-购墓 1-服务祭品 2-管理费
                fa01.FA003  = te_cuname.Text;                       //缴费人
                fa01.FA004  = dec_sum;                              //收费金额
                fa01.FA190  = '0';                                  //开票标志 0-未开票
                fa01.FA100  = Envior.cur_userId;                    //收费人
                fa01.FA180  = "";                                   //备注
                fa01.FA200  = Tools.GetServerDate();                //缴费时间
                fa01.STATUS = "1";                                  //状态
                fa01.WS001  = Envior.WORKSTATIONID;                 //工作站标识
                fa01.Save();

                unitOfWork1.CommitTransaction();

                //////////保存完成 //////////
                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("办理成功!\r\n" + "本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sb_ok.Enabled = false;
                    //获取税务客户信息
                    string            s_ac003       = te_cuname.Text;
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fp01.FP001, clientInfo);
                            }
                        }
                    }
                }

                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Example #13
0
        /// <summary>
        /// 负数发票开具
        /// </summary>
        /// <returns></returns>
        public static int InvoiceRefund(string fp001, TaxClientInfo taxClient)
        {
            //组装业务数据
            Dictionary <string, object> bdata = new Dictionary <string, object>();

            int             i_order    = 0;
            List <C_detail> detaildata = new List <C_detail>();

            decimal dec_rate        = new decimal();
            decimal dec_price       = new decimal();               //含税价格
            decimal dec_price_notax = new decimal();               //不含税价格
            decimal dec_je_notax    = new decimal();               //不含税金额
            decimal dec_tax         = new decimal();               //税额

            decimal dec_sum_notax = new decimal(0);                //合计金额(不含税)
            decimal dec_sum_tax   = new decimal(0);                //合计税额
            decimal dec_sum_sum   = new decimal(0);                //价税合计
            decimal dec_nums      = new decimal(0);

            string s_ggxh  = string.Empty;                         //规格型号
            string s_jldw  = string.Empty;                         //计量单位
            string s_spmc  = string.Empty;                         //商品名称
            string s_spbm  = string.Empty;                         //商品编码
            string s_yfpdm = string.Empty;                         //原发票代码
            string s_yfphm = string.Empty;                         //原发票号码

            //发票明细数量
            int itemCount = Convert.ToInt32(SqlAssist.ExecuteScalar("select count(*) from v_invoice_detail where fp001 ='" + fp001 + "'"));
            //退费总金额
            decimal dec_sum = Convert.ToDecimal(SqlAssist.ExecuteScalar("select sum(fp022) from v_invoice_detail where fp001='" + fp001 + "'"));
            string  s_memo  = SqlAssist.ExecuteScalar("select fa180 from fa01 f,v_fp01_nopen p where f.fa001 = p.fa001 and fp001='" + fp001 + "'").ToString();

            bdata.Add("fplxdm", Envior.TAX_INVOICE_TYPE);                         //发票类型代码
            bdata.Add("kplx", "1");                                               //开票类型 0-正数发票 1-负数
            bdata.Add("tspz", "00");                                              //特殊票种 00-不是 01-农产品销售 02-农产品收购
            bdata.Add("xhdwdzdh", Envior.TAX_ADDR_TELE);                          //销货单位地址电话
            bdata.Add("xhdwyhzh", Envior.TAX_BANK_ACCOUNT);                       //销货单位银行账号
            bdata.Add("ghdwsbh", taxClient.InfoClientTaxCode);                    //购货单位纳税识别号
            bdata.Add("ghdwmc", taxClient.InfoClientName);                        //购货单位名称
            bdata.Add("ghdwdzdh", taxClient.infoclientaddressphone);              //购货单位地址电话
            bdata.Add("ghdwyhzh", taxClient.infoclientbankaccount);               //购货单位银行账号

            OracleParameter op_fp001 = new OracleParameter("fp001", OracleDbType.Varchar2, 10);

            op_fp001.Direction = ParameterDirection.Input;
            op_fp001.Value     = fp001;
            OracleDataReader reader_sa01 = SqlAssist.ExecuteReader("select * from v_invoice_detail where fp001 = :fp001", new OracleParameter[] { op_fp001 });

            bool b_split = false;                                  //项目是否分割

            if (itemCount > AppInfo.TAXITEMCOUNT)                  //超出清单阈值
            {
                while (reader_sa01.Read())
                {
                    i_order++;

                    if (Convert.ToDecimal(reader_sa01["SA007"]) != Convert.ToDecimal(reader_sa01["FP022"]))
                    {
                        b_split = true;
                    }
                    else
                    {
                        b_split = false;
                    }

                    dec_rate  = Convert.ToDecimal(reader_sa01["SA025"]);                                                     //获取税率
                    dec_price = b_split ? Convert.ToDecimal(reader_sa01["FP022"]) : Convert.ToDecimal(reader_sa01["PRICE"]); //含税价格
                    dec_nums  = b_split ? 1 : Convert.ToDecimal(reader_sa01["NUMS"].ToString());

                    dec_price_notax = Math.Round(dec_price / (1 + dec_rate), 2);                                        //不含税价格
                    dec_je_notax   += Math.Round((dec_price / (1 + dec_rate)) * dec_nums, 2);                           //不含税金额
                    dec_tax        += Math.Round((dec_price / (1 + dec_rate)) * dec_rate * dec_nums, 2);                //税额

                    if (i_order == 1)
                    {
                        s_ggxh = BusinessAction.GetItemGGXH(reader_sa01["SA004"].ToString());                                                                       //规格型号
                    }
                    if (i_order == 1)
                    {
                        s_jldw = BusinessAction.GetItemDW(reader_sa01["SA004"].ToString());                                                                         //计量单位
                    }
                    if (i_order == 1)
                    {
                        s_spmc = reader_sa01["SA003"].ToString();                                                                                                                                                                       //商品名称
                    }
                    if (i_order == 1)
                    {
                        s_spbm = BusinessAction.GetItemInvoiceCode("", reader_sa01["SA004"].ToString());                                                            //商品编码
                    }
                }
                reader_sa01.Dispose();

                C_detail c_detail = new C_detail();
                c_detail.xh    = "1";                      //序号
                c_detail.fphxz = "0";                      //发票行性质	0 正常行1 折扣行2 被折扣行
                c_detail.ggxh  = s_ggxh;                   //规格型号

                c_detail.dw     = s_jldw;                  //计量单位
                c_detail.spmc   = "详见对应正数发票及清单";           //商品名称 s_spmc;
                c_detail.spsl   = "";                      //数量
                c_detail.dj     = "";                      //单价(不含税)
                c_detail.je     = dec_je_notax.ToString(); //金额(不含税)
                c_detail.sl     = "";                      //税率
                c_detail.se     = dec_tax.ToString();      //税额
                c_detail.hsbz   = "0";                     //含税标志 0 不含税1 含税
                c_detail.spbm   = "";                      //s_spbm;											 //商品编码(税务发票编码)
                c_detail.zxbm   = "";                      //自行编码
                c_detail.yhzcbs = "0";                     //优惠政策标识
                c_detail.slbs   = "";

                c_detail.zzstsgl = "";                                                                   //增值税特殊管理
                detaildata.Add(c_detail);

                dec_sum_notax = dec_je_notax;                              //合计金额(不含税)
                dec_sum_tax   = dec_tax;                                   //合计税额
                dec_sum_sum   = dec_je_notax + dec_tax;                    //价税合计

                bdata.Add("mx", detaildata);

                bdata.Add("zhsl", "99.01");                                      //综合税率 固定传 99.01
                bdata.Add("hjje", dec_sum_notax.ToString());                     //合计金额(不含税)
                bdata.Add("hjse", dec_sum_tax.ToString());                       //合计税额
                bdata.Add("jshj", dec_sum_sum.ToString());                       //价税合计
                bdata.Add("bz", s_memo);                                         //备注
                bdata.Add("skr", Envior.TAX_CASHIER);                            //收款人
                bdata.Add("fhr", Envior.TAX_CHECKER);                            //复核人
                bdata.Add("kpr", Envior.cur_userName);                           //开票人
                bdata.Add("tzdbh", "");                                          //通知单编号 专票红字必填
            }
            else
            {
                while (reader_sa01.Read())
                {
                    if (reader_sa01["SA020"].ToString() != "T")
                    {
                        continue;                                                               //不是税务项目 忽略
                    }
                    i_order++;

                    if (Convert.ToDecimal(reader_sa01["SA007"]) != Convert.ToDecimal(reader_sa01["FP022"]))
                    {
                        b_split = true;
                    }
                    else
                    {
                        b_split = false;
                    }

                    C_detail c_detail = new C_detail();
                    dec_rate  = Convert.ToDecimal(reader_sa01["SA025"]);                                                                                        //获取税率
                    dec_price = b_split ? Convert.ToDecimal(reader_sa01["FP022"]) : Convert.ToDecimal(reader_sa01["PRICE"]);                                    //含税价格
                    dec_nums  = b_split ? 1 : Convert.ToDecimal(reader_sa01["NUMS"].ToString());

                    dec_price_notax = Math.Round(dec_price / (1 + dec_rate), 2);                                 //不含税价格
                    dec_je_notax    = Math.Round((dec_price / (1 + dec_rate)) * dec_nums, 2);                    //不含税金额
                    dec_tax         = Math.Round((dec_price / (1 + dec_rate)) * dec_rate * dec_nums, 2);         //税额

                    c_detail.xh     = i_order.ToString();                                                        //序号
                    c_detail.fphxz  = "0";                                                                       //发票行性质	0 正常行1 折扣行2 被折扣行
                    c_detail.ggxh   = BusinessAction.GetItemGGXH(reader_sa01["SA004"].ToString());               //规格型号
                    c_detail.dw     = BusinessAction.GetItemDW(reader_sa01["SA004"].ToString());                 //计量单位
                    c_detail.spmc   = reader_sa01["SA003"].ToString();                                           //商品名称
                    c_detail.spsl   = dec_nums.ToString();;                                                      //数量
                    c_detail.dj     = dec_price_notax.ToString();                                                //单价(不含税)
                    c_detail.je     = dec_je_notax.ToString();                                                   //金额(不含税)
                    c_detail.sl     = dec_rate.ToString("#0.00");                                                //税率
                    c_detail.se     = dec_tax.ToString();                                                        //税额
                    c_detail.hsbz   = "0";                                                                       //含税标志 0 不含税1 含税
                    c_detail.spbm   = BusinessAction.GetItemInvoiceCode("", reader_sa01["SA004"].ToString());    //商品编码(税务发票编码)
                    c_detail.zxbm   = "";                                                                        //自行编码
                    c_detail.yhzcbs = "0";                                                                       //优惠政策标识

                    c_detail.slbs = dec_rate == 0 ? "1" : "";                                                    //税率标识: 空,是正常税率  1-免税 2-不征税 3-普通零税率

                    c_detail.zzstsgl = "";                                                                       //增值税特殊管理
                    detaildata.Add(c_detail);

                    dec_sum_notax += dec_je_notax;                                  //合计金额(不含税)
                    dec_sum_tax   += dec_tax;                                       //合计税额
                    dec_sum_sum   += dec_je_notax + dec_tax;                        //价税合计
                }

                bdata.Add("mx", detaildata);
                bdata.Add("hjje", dec_sum_notax.ToString());                     //合计金额(不含税)
                bdata.Add("hjse", dec_sum_tax.ToString());                       //合计税额
                bdata.Add("jshj", dec_sum_sum.ToString());                       //价税合计
                bdata.Add("bz", "");                                             //备注
                bdata.Add("skr", Envior.TAX_CASHIER);                            //收款人
                bdata.Add("fhr", Envior.TAX_CHECKER);                            //复核人
                bdata.Add("kpr", Envior.cur_userName);                           //开票人
                bdata.Add("tzdbh", "");                                          //通知单编号 专票红字必填
            }

            ///检索原发票代码、号码
            string s_log_sql = String.Format(@"select * from tax_log where settleId = 
												 (select rf300 from refund where rf001 = '"                                                 + fp001 + "')");

            using (OracleDataReader reader_log = SqlAssist.ExecuteReader(s_log_sql))
            {
                if (reader_log.Read())
                {
                    s_yfpdm = reader_log["INVOICECODE"].ToString();                       //原发票代码
                    s_yfphm = reader_log["INVOICENUM"].ToString();                        //原发票号码
                }
                else
                {
                    Tools.msg(MessageBoxIcon.Error, "错误", "读取原发票信息错误!");
                    return(-1);
                }
            }

            bdata.Add("yfphm", s_yfphm);                                 //原发票号码 负数发票必填
            bdata.Add("yfpdm", s_yfpdm);                                 //原发票代码 负数发票必填
            bdata.Add("gmf_dzyx", "");                                   //购买方电子邮箱 推送使用,电子发票,购买方电子邮箱和手机号码微信id三个必填一
            bdata.Add("gmf_sjhm", "1");                                  //购买方手机号码
            bdata.Add("gmf_openid", "");                                 //购买方微信id

            //将业务数据转换为Json字符串
            string s_json = Tools.ConvertObjectToJson(bdata);

            string s_req_sid = string.Empty;
            string s_retstr  = string.Empty;

            s_req_sid = MiscAction.GetEntityPK("TAXREQ");             //报文请求ID
            LogUtils.Debug("报文请求Id:" + s_req_sid);

            s_retstr = WrapData("FPKJ", s_req_sid, s_json);

            //分析返回结果
            Object obj = JsonConvert.DeserializeObject(s_retstr);

            Newtonsoft.Json.Linq.JObject js = obj as Newtonsoft.Json.Linq.JObject;

            if (js["code"].ToString() == "00000")               //成功
            {
                string data = js["data"].ToString();
                //解密 返回数据
                string resultText = Tools.AesDecrypt(data, Envior.TAX_PRIVATE_KEY);

                //解析真正的业务数据
                Object obj2 = JsonConvert.DeserializeObject(resultText);
                Newtonsoft.Json.Linq.JObject js2 = obj2 as Newtonsoft.Json.Linq.JObject;

                string  s_fpdm = js2["fpdm"].ToString();                    //发票代码
                string  s_fphm = js2["fphm"].ToString();                    //发票号码
                string  s_mw   = js2["mw"].ToString();                      //密文
                string  s_jym  = js2["jym"].ToString();                     //校验码
                decimal d_hjje = Convert.ToDecimal(js2["hjje"].ToString()); //合计金额
                decimal d_jshj = Convert.ToDecimal(js2["jshj"].ToString()); //价税合计

                //记录发票日志
                int result = InvoiceLog(fp001, Envior.TAX_INVOICE_TYPE, Envior.cur_userId, Envior.cur_userName, Envior.cur_userName,
                                        taxClient.InfoClientName, taxClient.InfoClientTaxCode, taxClient.infoclientbankaccount, taxClient.infoclientaddressphone,
                                        s_fpdm, s_fphm, s_mw, s_jym, d_hjje, d_jshj);

                if (result > 0)
                {
                    XtraMessageBox.Show("发票开具成功!\r\n" + "发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    XtraMessageBox.Show("发票开具成功!但记录开票日志失败!\r\n" + "发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                ////////// 打印发票和清单 //////////
                if (XtraMessageBox.Show("现在打印【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintInvoice(s_fpdm, s_fphm, "0");
                }
                if (i_order > AppInfo.TAXITEMCOUNT && XtraMessageBox.Show("现在打印【发票清单】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintInvoice(s_fpdm, s_fphm, "1");
                }
                return(1);
            }
            else
            {
                Tools.msg(MessageBoxIcon.Error, "错误", "发票开具失败!\r\n" + js["msg"].ToString());
                return(-1);
            }
        }
Example #14
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            decimal dec_price = decimal.Zero;
            decimal dec_nums  = decimal.Zero;
            string  s_fa001   = string.Empty;

            if (string.IsNullOrEmpty(te_price.Text))
            {
                te_price.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_price.ErrorText = "管理费单价必须输入!";
                return;
            }
            else if (string.IsNullOrEmpty(te_nums.Text))
            {
                te_nums.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_nums.ErrorText = "管理费缴费年限必须输入!";
                return;
            }

            dec_price = Convert.ToDecimal(te_price.Text);
            dec_nums  = Convert.ToDecimal(te_nums.Text);
            if (dec_price < 0)
            {
                Tools.msg(MessageBoxIcon.Warning, "提示", "管理费单价必须大于0!");
                te_price.Focus();
                return;
            }
            if (dec_nums <= 0)
            {
                Tools.msg(MessageBoxIcon.Warning, "提示", "缴费年限必须大于0!");
                te_nums.Focus();
                return;
            }
            s_fa001 = MiscAction.GetEntityPK("FA01");
            try
            {
                if (BusinessAction.ManageFee(s_fa001, ac01.AC001, dec_price, dec_nums, Envior.cur_userId, Envior.WORKSTATIONID) > 0)
                {
                    if (XtraMessageBox.Show("缴费成功!\r\n" + "是否现在开具发票?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(ac01.AC003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, session1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                    //打印缴费记录
                    Tools.msg(MessageBoxIcon.Information, "提示", "现在打印缴费记录!");
                    PrintAction.PrintPayRecord(s_fa001);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ee)
            {
                Tools.msg(MessageBoxIcon.Error, "错误", "缴费错误!\r\n" + ee.ToString());
            }
        }