コード例 #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);
                        }
                    }
                }
            }
        }
コード例 #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);
                    }
                }
            }
        }
コード例 #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);
                }
            }
        }
コード例 #4
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;
            }
        }