/// <summary> /// 作废收费记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int rowHandle = gridView1.FocusedRowHandle; if (rowHandle >= 0) { if (XtraMessageBox.Show("确认要作废吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } string s_reason = string.Empty; string s_rc001 = gridView1.GetRowCellValue(rowHandle, "AC001").ToString(); string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString(); Frm_FinRemoveReason frm_reason = new Frm_FinRemoveReason(); if (frm_reason.ShowDialog() == DialogResult.OK) { s_reason = frm_reason.swapdata["reason"].ToString(); } frm_reason.Dispose(); if (gridView1.GetRowCellValue(rowHandle, "FA002").ToString() == "2") //寄存业务 { decimal count = (decimal)SqlHelper.ExecuteScalar("select count(*) from v_rc04 where rc001='" + s_rc001 + "'"); if (count <= 1) { if (XtraMessageBox.Show("此记录是唯一一次交费记录,作废此记录将删除寄存登记信息,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } if (MiscAction.FinanceRemove(s_fa001, s_reason, Envior.cur_user.UC001) > 0) { XtraMessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); gridView1.DeleteRow(rowHandle); } } }
/// <summary> /// 收款作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bBi_remove_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (tabPane1.SelectedPageIndex == 0) //按笔数显示 { int rowHandle = gridView1.FocusedRowHandle; if (rowHandle >= 0) { string s_handler = gridView1.GetRowCellValue(rowHandle, "FA100").ToString(); if (!AppAction.CheckRight("收费作废", s_handler)) { return; } string s_reason = string.Empty; string s_rc001 = gridView1.GetRowCellValue(rowHandle, "AC001").ToString(); string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString(); string s_fa190 = gridView1.GetRowCellValue(rowHandle, "FA190").ToString(); if (XtraMessageBox.Show("确认要作废吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } //检查与开票所在工作站是否一致!!! if (MiscAction.CheckWorkStationCompare(s_fa001, Envior.WORKSTATIONID) == "0") { XtraMessageBox.Show("此笔收费发票不是在当前工作站开具,不能继续!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } Frm_RemoveFinReason frm_reason = new Frm_RemoveFinReason(); if (frm_reason.ShowDialog() == DialogResult.OK) { s_reason = frm_reason.swapdata["reason"].ToString(); } frm_reason.Dispose(); if (gridView1.GetRowCellValue(rowHandle, "FA002").ToString() == "2") //寄存业务 { decimal count = (decimal)SqlAssist.ExecuteScalar("select count(*) from v_rc04 where rc001='" + s_rc001 + "'", null); if (count <= 1) { if (XtraMessageBox.Show("此记录是唯一一次交费记录,作废此记录将删除寄存登记信息,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } int re = MiscAction.FinanceRemove(s_fa001, s_reason, Envior.cur_userId); ///作废成功,开始作废发票 if (re > 0) { this.RefreshData(); XtraMessageBox.Show("收费作废成功!如果本次收费已开具发票,点击【确定】开始作废已开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); ///作废财政发票 if (s_fa190.Substring(0, 1) == "1") { string s_pjlx = string.Empty; string s_pjh = string.Empty; string s_zch = string.Empty; //using (OracleDataReader reader_fin = SqlAssist.ExecuteReader("select * from fin_log where settleId='" + s_fa001 + "'")) //{ // reader_fin.Read(); // s_pjlx = reader_fin["INVOICEKIND"].ToString(); // s_pjh = reader_fin["INVOICENO"].ToString(); // s_zch = reader_fin["INVOICEZCH"].ToString(); // if (string.IsNullOrEmpty(s_zch)) // { // Frm_Zch_input frm_zch = new Frm_Zch_input(); // if (frm_zch.ShowDialog() == DialogResult.OK) // { // s_zch = frm_zch.swapdata["zch"].ToString(); // } // } // if (!string.IsNullOrEmpty(s_zch) && !string.IsNullOrEmpty(s_pjlx) && !string.IsNullOrEmpty(s_pjh)) // { // if (FinInvoice.Remove(s_zch, s_pjlx, s_pjh) > 0) // { //修改发票作废日志 // MiscAction.FinRemove_log(s_fa001, Envior.cur_userName, s_reason); // } // } //} }///作废税务发票 if (s_fa190.Substring(1, 1) == "1") { if (TaxInvoice.Remove(s_fa001, Envior.cur_userName) > 0) //发票作废成功 { //修改发票作废日志 MiscAction.TaxRemove_log(s_fa001, Envior.cur_userName, s_reason); } else { XtraMessageBox.Show("未能作废税务发票,请在【税神通】中作废指定票据!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } else //发票作废 !!!! { int rowHandle = gridView1.FocusedRowHandle; string s_fa001 = gridView3.GetRowCellValue(rowHandle, "FA001").ToString(); string s_billType = gridView3.GetRowCellValue(rowHandle, "BILLTYPE").ToString(); if (s_billType == "F") //财政发票作废 { } else if (s_billType == "T") { } } } catch (Exception ee) { XtraMessageBox.Show(ee.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 收款作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bBi_remove_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (tabPane1.SelectedPageIndex == 0) //按笔数显示 { int rowHandle = gridView1.FocusedRowHandle; if (rowHandle >= 0) { string s_handler = gridView1.GetRowCellValue(rowHandle, "FA100").ToString(); if (!AppAction.CheckRight("收费作废", s_handler)) { return; } string s_reason = string.Empty; string s_rc001 = gridView1.GetRowCellValue(rowHandle, "AC001").ToString(); string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString(); string s_fa190 = gridView1.GetRowCellValue(rowHandle, "FA190").ToString(); if (XtraMessageBox.Show("确认要作废吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } Frm_RemoveFinReason frm_reason = new Frm_RemoveFinReason(); if (frm_reason.ShowDialog() == DialogResult.OK) { s_reason = frm_reason.swapdata["reason"].ToString(); } frm_reason.Dispose(); if (gridView1.GetRowCellValue(rowHandle, "FA002").ToString() == "2") //寄存业务 { decimal count = (decimal)SqlAssist.ExecuteScalar("select count(*) from v_rc04 where rc001='" + s_rc001 + "'", null); if (count <= 1) { if (XtraMessageBox.Show("此记录是唯一一次交费记录,作废此记录将删除寄存登记信息,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } int re = MiscAction.FinanceRemove(s_fa001, s_reason, Envior.cur_userId); ///作废成功,开始作废发票 if (re > 0) { this.RefreshData(); XtraMessageBox.Show("收费作废成功!如果本次收费已开具发票,点击【确定】开始作废已开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); ///作废财政发票 if (s_fa190.Substring(0, 1) == "1") { //如果不在新接口上线前,则可以作废发票 if (!MiscAction.FinRefundBeforeOnline(s_fa001)) { if (FinInvoice.InvoiceRemoved(s_fa001) > 0) { MiscAction.FinRemove_log(s_fa001, Envior.cur_userName, s_reason); } } else { XtraMessageBox.Show("此笔收费为新财政发票接口上线前开具,发票需要在系统外进行作废!详情请与管理员联系!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } ///作废税务发票 if (s_fa190.Substring(1, 1) == "1") { if (TaxInvoice.Remove(s_fa001, Envior.cur_userName) > 0) //发票作废成功 { //修改发票作废日志 MiscAction.TaxRemove_log(s_fa001, Envior.cur_userName, s_reason); } else { XtraMessageBox.Show("未能作废税务发票,请在【税神通】中作废指定票据!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } else //发票作废 !!!! { int rowHandle = gridView1.FocusedRowHandle; string s_fa001 = gridView3.GetRowCellValue(rowHandle, "FA001").ToString(); string s_billType = gridView3.GetRowCellValue(rowHandle, "BILLTYPE").ToString(); if (s_billType == "F") //财政发票作废 { } else if (s_billType == "T") { } } } catch (Exception ee) { XtraMessageBox.Show(ee.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 收款作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BarButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int rowHandle = gridView1.FocusedRowHandle; DateTime dt_fa200; //收费日期 if (rowHandle >= 0) { //只能作废当日收费记录 DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); dtFormat.ShortDatePattern = "yyyy-MM-dd"; dt_fa200 = Convert.ToDateTime(gridView1.GetRowCellValue(rowHandle, "FA200").ToString(), dtFormat); if (String.Compare(dt_fa200.ToString("yyyy-MM-dd"), MiscAction.GetServerDateString()) < 0 && Envior.cur_userId != AppInfo.ROOTID) { MessageBox.Show("只能作废当天的收费记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show("确认要作废吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } string s_rc001 = gridView1.GetRowCellValue(rowHandle, "AC001").ToString(); if (Convert.ToDecimal(gridView1.GetRowCellValue(rowHandle, "FA004")) < 0) { MessageBox.Show("退费业务不能作废!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (gridView1.GetRowCellValue(rowHandle, "FA002").ToString() == "2") //寄存业务 { decimal count = (decimal)SqlAssist.ExecuteScalar("select count(*) from v_rc04 where rc001='" + s_rc001 + "'", null); if (count <= 1) { if (MessageBox.Show("此记录是唯一一次交费记录,作废此记录将删除寄存登记信息,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } } string s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString(); string s_fa005 = gridView1.GetRowCellValue(rowHandle, "FA005").ToString(); //电子发票号 string s_retCode = string.Empty; int re = MiscAction.FinanceRemove(s_fa001, Envior.cur_userId); if (re > 0) { ////////// 发票作废 /////////////////////////////////////////////////// if (!string.IsNullOrEmpty(s_fa005)) { if (!Envior.TAX_READY) { MessageBox.Show("金税卡没有打开!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { s_retCode = PrtServAction.InvoiceRemoved(s_fa001, Envior.mform.Handle.ToInt32()); } } /////////////////////////////////////////////////////////////////////// if (!string.IsNullOrEmpty(s_fa005) && s_retCode == "6011") { MessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!string.IsNullOrEmpty(s_fa005) && s_retCode != "6011") { MessageBox.Show("作废成功但未作废发票!" + s_retCode, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } //MessageBox.Show("作废成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); dt_finance.Rows.RemoveAt(gridView1.GetDataSourceRowIndex(rowHandle)); if (gridView1.RowCount == 0) { dt_detail.Rows.Clear(); } else { this.RetrieveDetail(gridView1.FocusedRowHandle); } return; } } }