예제 #1
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);
            }
        }