private void B_ok_Click(object sender, EventArgs e) { string settleId = Tools.GetEntityPK("FA01"); List <string> sa001_list = new List <string>(); foreach (DataRow r in dt_source.Rows) { sa001_list.Add(r["SA001"].ToString()); } int result = FireAction.FireBusinessSettle(settleId, AC001, sa001_list.ToArray(), Envior.cur_userId ); if (result > 0) { b_ok.Enabled = false; MessageBox.Show("结算办理成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); int fire_row = gridView1.LocateByValue("SA002", "06"); //如果有火化,打印火化证明 if (fire_row >= 0) { //打印火化证明 if (MessageBox.Show("现在打印火化证明!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { PrtServAction.Print_HHZM(AC001, this.Handle.ToInt32()); } } if (MessageBox.Show("现在打印【发票】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (!Envior.canInvoice) { MessageBox.Show("当前用户没有打印发票权限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (!Envior.TAX_READY) { MessageBox.Show("金税卡没有打开!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Frm_taxClientInfo frm_client = new Frm_taxClientInfo(); frm_client.swapdata["parent"] = this; frm_client.swapdata["title"] = FireAction.Get_PassbyName(AC001); if (frm_client.ShowDialog(this) == DialogResult.OK) { InvoiceInfo invClient = this.swapdata["clientinfo"] as InvoiceInfo; //打印发票 //PrtServAction.Print_Fireinvoice(settleId, invClient, this.Handle.ToInt32() ); PrtServAction.Print_Invoice(settleId, invClient); } frm_client.Dispose(); } } //打印付货单 int jp_row = gridView1.LocateByValue("SA002", "12"); // //如果有祭品 则打印付货单 if (jp_row >= 0) { if (MessageBox.Show("现在打印【付货单】吗?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrtServAction.Print_FHD(settleId, this.Handle.ToInt32()); } } DialogResult = DialogResult.OK; this.Dispose(); } }
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(); } }