Пример #1
0
        /// <summary>
        /// 退费操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bBi_refund_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int rowHandle;

            string s_billType = string.Empty;
            string s_fa001    = string.Empty;

            if (tabPane1.SelectedPageIndex == 0)
            {
                return;
            }
            else if (tabPane1.SelectedPageIndex == 1)
            {
                rowHandle  = gridView3.FocusedRowHandle;
                s_billType = gridView3.GetRowCellValue(rowHandle, "BILLTYPE").ToString();
                s_fa001    = gridView3.GetRowCellValue(rowHandle, "FA001").ToString();
                string s_fa002 = SqlAssist.ExecuteScalar("select fa002 from fa01 where fa001='" + s_fa001 + "'").ToString();

                //检查与开票所在工作站是否一致!!!
                if (MiscAction.CheckWorkStationCompare(s_fa001, Envior.WORKSTATIONID, s_billType) == "0")
                {
                    XtraMessageBox.Show("此笔收费发票不是在当前工作站开具,不能继续!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                //if(s_fa002 == "2")
                //{
                //	XtraMessageBox.Show("此收费记录不能退费!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //	return;
                //}
                if (MiscAction.HaveRefund(s_fa001))
                {
                    XtraMessageBox.Show("此收费记录已经有退费记录,不能再次退费!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            BaseDialog frm_1 = null;

            if (s_billType == "F")
            {
                frm_1 = new Frm_refund_select();
            }
            else
            {
                frm_1 = new Frm_refund_select2();
            }

            frm_1.swapdata["SA010"] = s_fa001;                  //结算流水号
            frm_1.swapdata["SA020"] = s_billType;               //票别
            if (frm_1.ShowDialog() == DialogResult.OK)
            {
                this.RefreshData();
            }
            frm_1.Dispose();
        }
Пример #2
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);
                }
            }
        }