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
        /// <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);
                }
            }
        }