/// <summary> /// 应用套餐 /// </summary> /// <param name="serviceType"></param> private void ApplyCombo(string serviceType) { DataTable dt_cb02 = new DataTable(); OracleDataAdapter cb02Adapter = new OracleDataAdapter("select * from cb02 where cb001=(select cb001 from cb01 where cb002 = '0' and cb005 = :service)", SqlHelper.conn); OracleParameter op_service = new OracleParameter("service", OracleDbType.Varchar2, 3); op_service.Direction = ParameterDirection.Input; cb02Adapter.SelectCommand.Parameters.Add(op_service); op_service.Value = serviceType; cb02Adapter.Fill(dt_cb02); /////循环处理套餐明细 foreach (DataRow dr in dt_cb02.Rows) { ///如果套餐明细项目不存在! if (!FireAction.ItemIsExisted(ac01.AC001, dr["CB022"].ToString(), dr["CB021"].ToString())) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = dr["CB022"].ToString(); //类型 sa01.SA003 = FireAction.GetItemName(dr["CB021"].ToString()); sa01.SA004 = dr["CB021"].ToString(); sa01.SA005 = "0"; sa01.PRICE = FireAction.GetItemPrice(dr["CB021"].ToString()); sa01.NUMS = Convert.ToInt32(dr["CB030"]); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; } } }
private void Frm_Register_Load(object sender, EventArgs e) { ///初始化 st01Adapter.Fill(dt_st01); dv_relation = new DataView(dt_st01); dv_relation.RowFilter = "ST002='RELATION'"; lookUp_rc052.Properties.DataSource = dv_relation; lookUp_rc052.Properties.ValueMember = "ST003"; lookUp_rc052.Properties.DisplayMember = "ST003"; itemAdapter.Fill(dt_allItem); rep_lookup_sa004.DataSource = dt_allItem; rep_lookup_sa004.DisplayMember = "ITEM_TEXT"; rep_lookup_sa004.ValueMember = "ITEM_ID"; comboAdapter.Fill(dt_reg_combo); //寄存所属套餐 foreach (DataRow r in dt_reg_combo.Rows) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA004 = r["CB021"].ToString(); //商品或服务编号 sa01.PRICE = FireAction.GetItemPrice(r["CB021"].ToString()); sa01.NUMS = Convert.ToInt32(r["CB030"]); sa01.SA006 = sa01.PRICE; sa01.SA007 = sa01.PRICE * sa01.NUMS; fpfee += sa01.SA007; xpCollection_sa01.Add(sa01); } this.CalcHJ(); s_source = this.swapdata["source"].ToString(); if (s_source == "0" /* 本馆火化 */ || s_source == "8" /*待缴费*/) { s_rc001 = this.swapdata["rc001"].ToString(); AC01 ac01 = unitOfWork1.GetObjectByKey <AC01>(s_rc001); if (ac01 != null) { txtEdit_rc003.EditValue = ac01.AC003; //逝者姓名 rg_rc002.EditValue = ac01.AC002; //性别 txtEdit_rc004.EditValue = ac01.AC004; //年龄 txtedit_rc014.EditValue = ac01.AC014; //身份证号 txtEdit_rc050.EditValue = ac01.AC050; //联系人 lookUp_rc052.EditValue = ac01.AC052; //与逝者关系 txtEdit_rc051.EditValue = ac01.AC051; //联系电话 txtEdit_ac055.EditValue = ac01.AC055; //联系地址 txtEdit_rc001.Text = ac01.AC001; //逝者编号 sb_clear.Enabled = false; } else { XtraMessageBox.Show("数据参数错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); sb_ok.Enabled = false; return; } } }
/// <summary> /// 修改项目 /// </summary> /// <param name="rowHandle"></param> private void Modify(int rowHandle) { if (rowHandle >= 0) { SA01 sa01 = xpCollection1[gridView1.GetDataSourceRowIndex(rowHandle)] as SA01; Frm_BusinessEdit frm_1 = new Frm_BusinessEdit(); frm_1.swapdata["sa01"] = sa01; if (frm_1.ShowDialog() == DialogResult.OK) { } frm_1.Dispose(); } }
private void Frm_BusinessEdit_Load(object sender, EventArgs e) { sa01 = this.swapdata["sa01"] as SA01; if (sa01 == null) { sb_ok.Enabled = false; XtraMessageBox.Show("参数传递错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txtedit_sa003.Text = sa01.SA003; txtedit_price.EditValue = sa01.PRICE; txtedit_nums.EditValue = sa01.NUMS; RightSetup(); //权限设置 }
/// <summary> /// 编辑项目 /// </summary> /// <param name="rowHandle"></param> private void Modify(int rowHandle) { if (rowHandle >= 0) { if (gridView1.GetRowCellValue(rowHandle, "SA008").ToString() == "1") { XtraMessageBox.Show("该项目已经结算,不能修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SA01 sa01 = xpCollection1[gridView1.GetDataSourceRowIndex(rowHandle)] as SA01; Frm_BusinessEdit frm_1 = new Frm_BusinessEdit(); frm_1.swapdata["sa01"] = sa01; if (frm_1.ShowDialog() == DialogResult.OK) { sa01.Reload(); this.SetActivePanel(); } frm_1.Dispose(); } }
/// <summary> /// 购墓时必选项目 /// </summary> private void AutoAdd() { using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from v_all_validitem where autochoose = '1' ")) { SA01 sa01 = null; if (reader.HasRows) { while (reader.Read()) { sa01 = new SA01(unitOfWork1); sa01.SA004 = reader["ITEM_ID"].ToString(); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = '1'; //销售项目类型 1 - 商品或服务 sa01.SA003 = reader["ITEM_NAME"].ToString(); //项目名称 sa01.STATUS = '1'; sa01.AC001 = s_ac001; //购墓流水号 sa01.SA005 = '0'; //销售类型 0-购墓 sa01.SA008 = '0'; //结算标志 0-未结算 sa01.SA100 = Envior.cur_userId; //经办人 sa01.SA200 = Tools.GetServerDate(); //经办日期 sa01.SA025 = Convert.ToDecimal(reader["TAXRATE"]); if (sa01.SA003 == "管理费") { sa01.NUMS = MiscAction.GetSysParaValue1("MANAGEFEE_NUMS"); } else { sa01.NUMS = 1; } sa01.PRICE = Convert.ToDecimal(reader["PRICE"]);//单价 sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; xpCollection_sa01.Add(sa01); } } } }
private void sb_ok_Click(object sender, EventArgs e) { if (!gridView1.PostEditor()) { return; } if (!gridView1.UpdateCurrentRow()) { return; } if (!gridView4.PostEditor()) { return; } if (!gridView4.UpdateCurrentRow()) { return; } int[] service_sel = gridView1.GetSelectedRows(); int[] gl_sel = gridView2.GetSelectedRows(); int[] zl_sel = gridView3.GetSelectedRows(); int[] jp_sel = gridView4.GetSelectedRows(); if (service_sel.Length + gl_sel.Length + zl_sel.Length + jp_sel.Length <= 0) { XtraMessageBox.Show("请先选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //延申服务处理 foreach (int i in service_sel) { if (FireAction.ItemIsExisted(s_ac001, "05", gridView1.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = s_ac001; sa01.SA002 = "05"; //殡仪服务 sa01.SA003 = gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView1.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView1.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; } //谷类处理 foreach (int i in gl_sel) { if (FireAction.ItemIsExisted(s_ac001, "10", gridView2.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = s_ac001; sa01.SA002 = "10"; //谷类 sa01.SA003 = gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView2.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView2.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; } //纸类处理 foreach (int i in zl_sel) { if (FireAction.ItemIsExisted(s_ac001, "10", gridView3.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = s_ac001; sa01.SA002 = "11"; //纸类 sa01.SA003 = gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView3.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(gridView3.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView3.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; } //祭品处理 foreach (int i in jp_sel) { if (FireAction.ItemIsExisted(s_ac001, "12", gridView4.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = s_ac001; sa01.SA002 = "12"; //祭品 sa01.SA003 = gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView4.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(gridView4.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView4.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; } try { unitOfWork1.CommitChanges(); XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); LogUtils.Error(ee.Message); XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sb_ok_Click(object sender, EventArgs e) { string s_fa001 = string.Empty; FA01 fa01 = null; SA01 sa01 = null; BI01 bi01 = null; AC01 ac01_m = null; REFUND refund = null; int i_invoice_num; if (XtraMessageBox.Show("确认要进行退墓操作,本操作将不可撤销,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (decimal.TryParse(te_refund.Text, out dec_tomb)) { if (dec_tomb <= 0 || dec_tomb > ac01.AC022) { te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; te_refund.ErrorText = "退费金额错误!"; return; } } else { te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; te_refund.ErrorText = "请输入退购墓费!"; return; } try { s_fa001 = MiscAction.GetEntityPK("FA01"); //2.保存销售记录 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); //销售流水号 sa01.AC001 = ac01.AC001; //购墓流水号 sa01.SA002 = '0'; //服务或商品类别 0-购墓费 1-商品或服务 2-管理费 sa01.SA003 = "购墓费"; sa01.SA004 = ac01.AC015; //墓位编号 sa01.SA005 = '0'; //业务类型 0-购墓 1-临时销售 sa01.PRICE = dec_tomb; //单价 sa01.NUMS = -1; //数量 sa01.SA007 = 0 - dec_tomb; //金额 sa01.SA006 = sa01.SA007; //原始单价 sa01.SA008 = '1'; //结算状态 1-已结算 0-未结算 sa01.SA010 = s_fa001; //结算流水号 sa01.SA020 = 'T'; //发票类型 sa01.SA025 = MiscAction.GetSysParaValue1("tomb_taxrate"); //税率 sa01.SA100 = Envior.cur_userId; //经办人 sa01.SA200 = Tools.GetServerDate(); //经办日期 sa01.STATUS = '1'; //状态 1-正常 0-删除 sa01.Save(); for (int i = 0; i < gridView1.RowCount; i++) { if (!gridView1.IsRowSelected(i)) { continue; } sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); //销售流水号 sa01.AC001 = ac01.AC001; //购墓流水号 sa01.SA002 = '1'; //服务或商品类别 0-购墓费 1-商品或服务 2-管理费 sa01.SA003 = gridView1.GetRowCellValue(i, "SA003").ToString(); //项目名称 sa01.SA004 = gridView1.GetRowCellValue(i, "SA004").ToString(); //项目编号 sa01.SA005 = '0'; //业务类型 0-购墓 1-临时销售 sa01.PRICE = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")); //单价 sa01.NUMS = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS")); //数量 sa01.SA007 = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007")); //金额 sa01.SA006 = sa01.SA007; //原始单价 sa01.SA008 = '1'; //结算状态 1-已结算 0-未结算 sa01.SA010 = s_fa001; //结算流水号 sa01.SA020 = 'T'; //发票类型 sa01.SA025 = BusinessAction.GetTaxRate(sa01.SA004); //税率 sa01.SA100 = Envior.cur_userId; //经办人 sa01.SA200 = Tools.GetServerDate(); //经办日期 sa01.STATUS = '1'; //状态 1-正常 0-删除 sa01.Save(); } //3.保存退费日志 refund = new REFUND(unitOfWork1); refund.RF001 = s_fa001; refund.RF003 = te_reason.Text; refund.RF004 = 0 - (dec_tomb + dec_sales); refund.RF100 = Envior.cur_userId; refund.RF200 = Tools.GetServerDate(); refund.RF300 = ac01.AC048; //原结算流水号 refund.Save(); ///4.保存缴费记录 fa01 = new FA01(unitOfWork1); fa01.FA001 = s_fa001; //结算流水号 fa01.FA002 = '0'; //结算类型 0-购墓 1-服务祭品 2-管理费 fa01.FA003 = ac01.AC003; //购墓人 fa01.FA004 = 0 - (dec_tomb + dec_sales); //金额 fa01.FA190 = '0'; //开票标志 0-未开票 fa01.FA100 = Envior.cur_userId; //经办人 fa01.FA200 = Tools.GetServerDate(); //经办日期 fa01.STATUS = "1"; //状态 fa01.AC001 = ac01.AC001; fa01.WS001 = Envior.WORKSTATIONID; //工作站 fa01.Save(); //5.修改ac01 ac01_m = unitOfWork1.GetObjectByKey <AC01>(ac01.AC001, true); ac01_m.STATUS = '2'; //状态-退墓 ac01_m.Save(); //6.修改号位状态 bi01 = unitOfWork1.GetObjectByKey <BI01>(ac01.AC015, true); if (bi01 != null) { bi01.AC001 = ""; bi01.STATUS = '1'; bi01.Save(); } unitOfWork1.CommitTransaction(); i_invoice_num = BusinessAction.GetInvoicePapers(s_fa001); if (i_invoice_num == 0) { Tools.msg(MessageBoxIcon.Information, "提示", "退墓成功!"); } else { if (XtraMessageBox.Show("退墓办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sb_ok.Enabled = false; //获取税务客户信息 string s_ac003 = te_ac003.Text; Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003); if (frm_taxClient.ShowDialog() != DialogResult.OK) { return; } TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo; CriteriaOperator criteria = CriteriaOperator.Parse("FA001='" + s_fa001 + "'"); 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); } } } } } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString()); } }
/// <summary> /// 结算 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.RowCount <= 0) { XtraMessageBox.Show("请先选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(be_cuname.Text)) { be_cuname.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; be_cuname.ErrorText = "交款人或单位必须输入!"; return; } //if (string.IsNullOrEmpty(te_billno.Text)) //{ // XtraMessageBox.Show("尚未输入单据号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; //} //1.检查是否有单价为0的项目 for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "PRICE") != null && Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")) <= 0) { gridView1.FocusedRowHandle = i; XtraMessageBox.Show("项目单价尚未设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } SA01 sa01 = null; string s_fa001 = MiscAction.GetEntityPK("FA01"); string s_cuname = be_cuname.Text; string s_billno = te_billno.Text; decimal dec_sum = decimal.Zero; for (int i = 0; i < gridView1.RowCount; i++) { sa01 = xpCollection1[gridView1.GetDataSourceRowIndex(i)] as SA01; sa01.SA010 = s_fa001; sa01.SA008 = "1"; dec_sum += sa01.SA007; } FA01 fa01 = new FA01(unitOfWork1); fa01.FA001 = s_fa001; fa01.FA002 = "1"; //交费类型 1-临时性销售 fa01.FA003 = s_cuname; //交款人 fa01.FA004 = dec_sum; fa01.FA100 = Envior.cur_user.UC001; fa01.FA200 = MiscAction.GetServerTime(); fa01.WS001 = Envior.workstationId; fa01.FA099 = s_billno; fa01.STATUS = "1"; try { unitOfWork1.CommitChanges(); XtraMessageBox.Show("办理成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); if (XtraMessageBox.Show("现在打印【收据】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.Print_Skpz0(s_fa001); } be_cuname.Text = ""; te_billno.Text = ""; CriteriaOperator criteria = CriteriaOperator.Parse("1<0"); xpCollection1.Criteria = criteria; xpCollection1.Criteria = null; be_cuname.Focus(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); LogUtils.Error(ee.Message); XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void sb_ok_Click(object sender, EventArgs e) { decimal dec_total = decimal.Zero; string s_new_fa001 = string.Empty; SA01 sa01 = null; FA01 fa01_new = null; if (gridView1.GetSelectedRows().Length == 0) { Tools.msg(MessageBoxIcon.Exclamation, "提示", "请先选择要退费的项目!"); return; } try { dec_total = Convert.ToDecimal(te_total.EditValue); s_new_fa001 = MiscAction.GetEntityPK("FA01"); for (int i = 0; i < gridView1.RowCount; i++) { if (!gridView1.IsRowSelected(i)) { continue; } sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); //销售流水号 sa01.AC001 = fa01.AC001; //购墓流水号 sa01.SA002 = fa01.FA002 == '2' ? '2':'1'; //服务或商品类别 0-购墓费 1-商品或服务 2-管理费 sa01.SA003 = gridView1.GetRowCellValue(i, "SA003").ToString(); //项目名称 sa01.SA004 = gridView1.GetRowCellValue(i, "SA004").ToString(); //项目编号 sa01.SA005 = fa01.FA002; //业务类型 0-购墓 1-临时销售 sa01.PRICE = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")); //单价 sa01.NUMS = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS")); //数量 sa01.SA007 = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007")); //金额 sa01.SA006 = sa01.SA007; //原始单价 sa01.SA008 = '1'; //结算状态 1-已结算 0-未结算 sa01.SA010 = s_new_fa001; //结算流水号 sa01.SA020 = 'T'; //发票类型 sa01.SA025 = BusinessAction.GetTaxRate(sa01.SA004); //税率 sa01.SA100 = Envior.cur_userId; //经办人 sa01.SA200 = Tools.GetServerDate(); //经办日期 sa01.STATUS = '1'; //状态 1-正常 0-删除 sa01.Save(); } //2.保存退费日志 refund = new REFUND(unitOfWork1); refund.RF001 = s_new_fa001; refund.RF003 = te_reason.Text; refund.RF004 = 0 - dec_total; refund.RF100 = Envior.cur_userId; refund.RF200 = Tools.GetServerDate(); refund.RF300 = s_fa001; //原结算流水号 refund.Save(); ///3.保存缴费记录 fa01_new = new FA01(unitOfWork1); fa01_new.FA001 = s_new_fa001; //结算流水号 fa01_new.FA002 = fa01.FA002; //结算类型 0-购墓 1-服务祭品 2-管理费 fa01_new.FA003 = fa01.FA003; //缴款人 fa01_new.FA004 = 0 - dec_total; //金额 fa01_new.FA190 = '0'; //开票标志 0-未开票 fa01_new.FA100 = Envior.cur_userId; //经办人 fa01_new.FA200 = Tools.GetServerDate(); //经办日期 fa01_new.STATUS = "1"; //状态 fa01_new.AC001 = fa01.AC001; fa01_new.WS001 = Envior.WORKSTATIONID; //工作站 fa01_new.Save(); unitOfWork1.CommitTransaction(); int i_invoice_num = BusinessAction.GetInvoicePapers(s_new_fa001); if (i_invoice_num == 0) { Tools.msg(MessageBoxIcon.Information, "提示", "退费办理成功!"); } else { if (XtraMessageBox.Show("退费办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sb_ok.Enabled = false; //获取税务客户信息 string s_fa003 = fa01.FA003; 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 + "'"); 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); } } } } } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString()); } }
private void sb_ok_Click(object sender, EventArgs e) { if (!gridView1.PostEditor()) { return; } if (!gridView1.UpdateCurrentRow()) { return; } if (!SaveCheck()) { return; //数据合法性校验!!! } string s_billno = string.Empty; //0.再次判断寄存号位 是否占用 if (RegAction.GetBitStatus(regionId, i_bi005, bitDesc) != "9") { XtraMessageBox.Show("当前号位无效或已被占用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //1.生成寄存记录 int i_months = Convert.ToInt32(comboBox1.Text); rc01 = new RC01(unitOfWork1); if (s_source == "1" /*外来寄存*/) { rc01.RC001 = MiscAction.GetEntityPK("RC01"); } else if (s_source == "0" || s_source == "8") { rc01.RC001 = txtEdit_rc001.Text; } rc01.RC002 = rg_rc002.EditValue.ToString(); //逝者性别 rc01.RC202 = rg_rc202.EditValue.ToString(); //逝者性别2 rc01.RC003 = txtEdit_rc003.Text; //逝者姓名 rc01.RC303 = txtEdit_rc303.Text; //逝者姓名2 rc01.RC004 = Convert.ToInt32(txtEdit_rc004.EditValue); //逝者年龄 rc01.RC404 = txtEdit_rc404.EditValue == null ? 0 : Convert.ToInt32(txtEdit_rc404.EditValue); rc01.RC014 = txtedit_rc014.Text; //身份证号 rc01.RC050 = txtEdit_rc050.Text; //联系人 rc01.RC051 = txtEdit_rc051.Text; //联系电话 rc01.RC052 = lookUp_rc052.EditValue.ToString(); //与逝者关系 rc01.RC055 = txtEdit_ac055.Text; //联系地址 rc01.RC099 = mem_rc099.Text; //备注 rc01.RC109 = RegAction.GenRegisterNo(s_source == "2" ? "1" : "0"); if (s_source == "0" || s_source == "8") { rc01.SOURCE = "0"; //本馆火化 } else if (s_source == "1") { rc01.SOURCE = "1"; } //状态 if (s_source == "8") { rc01.STATUS = "8"; } else { rc01.STATUS = "1"; } rc01.RC110 = RegAction.GetRoomIdByBitId(bitId); //寄存室编号 rc01.RC120 = regionId; //寄存架号 rc01.RC130 = bitId; //寄存号位 rc01.RC140 = MiscAction.GetServerTime(); //寄存日期 rc01.RC150 = rc01.RC140.AddMonths(i_months); //寄存到期日期 rc01.RC100 = Envior.cur_user.UC001; //经办人 rc01.RC200 = MiscAction.GetServerTime(); ///2.寄存费缴费记录表 string s_fa001 = MiscAction.GetEntityPK("FA01"); if (s_source == "0" || s_source == "1") //本馆火化 或外来寄存 { RC04 rc04 = new RC04(unitOfWork1); rc04.RC001 = rc01.RC001; rc04.RC010 = s_fa001; //结算流水号 rc04.RC020 = MiscAction.GetServerTime(); //缴费开始时间 rc04.RC022 = rc01.RC150; //缴费截至时间 rc04.PRICE = bitPrice; //单价 rc04.NUMS = Convert.ToInt32(comboBox1.Text); //缴费期限 rc04.RC030 = rc04.PRICE * rc04.NUMS; //寄存费金额 rc04.RC031 = "1"; //0-原始登记 1-正常交费 rc04.RC100 = Envior.cur_user.UC001; //经办人 rc04.RC200 = MiscAction.GetServerTime(); rc04.STATUS = "1"; } ///3.插入销售表 SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = "08"; //项目类别 08-寄存费 sa01.AC001 = rc01.RC001; //逝者编号 sa01.SA003 = "寄存费"; sa01.SA004 = bitId; sa01.SA005 = "2"; //销售业务类型 2-骨灰寄存 sa01.PRICE = bitPrice; sa01.NUMS = Convert.ToInt32(comboBox1.Text); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = bitPrice; sa01.SA008 = s_source == "8" ? "0" : "1"; sa01.SA010 = s_source == "8" ? "" : s_fa001; sa01.SA100 = Envior.cur_user.UC001; //经办人 sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ///4.处理附件销售. foreach (SA01 s in xpCollection_sa01) { s.SA001 = MiscAction.GetEntityPK("SA01"); s.SA002 = "13"; s.AC001 = rc01.RC001; s.SA003 = FireAction.Mapper_Item(s.SA004); s.SA005 = "2"; // 销售类别 0 - 火化业务 1 - 临时性销售 2骨灰寄存 s.SA008 = s_source == "8" ? "0" : "1"; s.SA010 = s_source == "8" ? "" : s_fa001; s.SA100 = Envior.cur_user.UC001; //经办人 s.SA200 = MiscAction.GetServerTime(); s.STATUS = "1"; } ////5. 处理财务结算表 if (s_source == "0" || s_source == "1") { FA01 fa01 = new FA01(unitOfWork1); fa01.FA001 = s_fa001; fa01.FA002 = "2"; //收费业务类型 2-寄存 fa01.FA003 = rc01.RC003; fa01.FA004 = regfee + fpfee; fa01.FA100 = Envior.cur_user.UC001; fa01.FA200 = MiscAction.GetServerTime(); fa01.FA099 = s_billno; fa01.WS001 = Envior.workstationId; fa01.AC001 = rc01.RC001; fa01.STATUS = "1"; } ////6. 处理号位表 BI01 bi01 = unitOfWork1.GetObjectByKey <BI01>(bitId); bi01.BI010 = rc01.RC001; if (s_source == "0" || s_source == "1") { bi01.STATUS = "1"; } else if (s_source == "8") { bi01.STATUS = "8"; } try { unitOfWork1.CommitChanges(); string s_tip = string.Empty; if (s_source == "0" || s_source == "1") { s_tip = "办理成功,现在打印【收据】"; } else { s_tip = "办理成功!"; } XtraMessageBox.Show(s_tip, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); ////打印收据 if (s_source == "0" || s_source == "1") { //Frm_InputBill frm_bill = new Frm_InputBill(); //if (frm_bill.ShowDialog() == DialogResult.OK) //{ // s_billno = frm_bill.swapdata["billno"].ToString(); //} //frm_bill.Dispose(); //if (!string.IsNullOrEmpty(s_billno)) //{ PrintAction.Print_Skpz1(s_fa001); //MiscAction.SetFinanceBill(s_fa001, s_billno); //} } ////todo 2.打印寄存证 if (s_source == "0" || s_source == "1" || s_source == "2") { XtraMessageBox.Show("现在准备打印【寄存证】!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); PrintAction.Print_RegCardBase(rc01.RC001); } if (XtraMessageBox.Show("现在打印【骨灰安放卡】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.Print_RegSettle(rc01.RC001); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); LogUtils.Error(ee.Message); XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void sb_ok_Click(object sender, EventArgs e) { string s_sa001 = string.Empty; SA01 sa01 = null; FA01 fa01 = null; string s_fa099 = string.Empty; decimal dec_sum = decimal.Zero; //if (string.IsNullOrEmpty(te_fa099.Text)) //{ // te_fa099.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; // te_fa099.ErrorText = "请输入收费单据号!"; // te_fa099.Focus(); // return; //} try { string s_fa001 = MiscAction.GetEntityPK("FA01"); for (int i = 0; i < gridView1.RowCount; i++) { sa01 = xpCollection1[gridView1.GetDataSourceRowIndex(i)] as SA01; if (FireAction.SalesItemIsSettled(sa01.SA001)) { throw new Exception("第" + (i + 1).ToString() + "行数据已经结算,请重新选择结算数据!"); } sa01.SA008 = "1"; //结算标志 sa01.SA010 = s_fa001; //结算流水号 dec_sum += sa01.SA007; } fa01 = new FA01(session); fa01.FA001 = s_fa001; //结算流水号 fa01.FA002 = "0"; //收费类型 0-火化业务 fa01.FA003 = ac01.AC003; //交款人 fa01.AC001 = ac01.AC001; //逝者编号 fa01.FA004 = dec_sum; //交费金额 fa01.FA099 = te_fa099.Text; //单据流水号 fa01.FA100 = Envior.cur_user.UC001; //经办人 fa01.FA200 = MiscAction.GetServerTime(); //经办日期 fa01.WS001 = Envior.workstationId; //工作站ID fa01.STATUS = "1"; ///检查是否有寄存办理 int i_find = gridView1.LocateByValue("SA002", "08"); if (i_find >= 0) { string s_bi001 = gridView1.GetRowCellValue(i_find, "SA004").ToString(); BI01 bi01 = session.GetObjectByKey <BI01>(s_bi001); if (bi01 == null) { throw new Exception("找不到寄存号位!"); } bi01.STATUS = "1"; RC01 rc01 = session.GetObjectByKey <RC01>(gridView1.GetRowCellValue(i_find, "AC001").ToString()); if (rc01 == null) { throw new Exception("找不到寄存登记记录!"); } rc01.STATUS = "1"; ////增加寄存费缴纳记录 RC04 rc04 = new RC04(session); rc04.RC001 = rc01.RC001; rc04.RC010 = s_fa001; rc04.RC020 = rc01.RC140; //寄存日期 rc04.RC022 = rc01.RC150; //寄存截至日期 rc04.PRICE = Convert.ToDecimal(gridView1.GetRowCellValue(i_find, "PRICE")); rc04.NUMS = Convert.ToInt32(gridView1.GetRowCellValue(i_find, "NUMS")); rc04.RC030 = Convert.ToDecimal(gridView1.GetRowCellValue(i_find, "SA007")); rc04.RC031 = "1"; //寄存费缴纳类型 1-正常缴费 rc04.RC100 = Envior.cur_user.UC001; rc04.RC200 = MiscAction.GetServerTime(); rc04.STATUS = "1"; } session.CommitChanges(); XtraMessageBox.Show("结算办理成功!现在开始打印单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); PrintAction.Print_Skpz0(s_fa001); if (gridView1.LocateByValue("SA002", "06") >= 0) { if (XtraMessageBox.Show("现在打印【火化证明】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.Print_HHZM(ac01.AC001); } } if (gridView1.LocateByValue("SA002", "08") >= 0) { if (XtraMessageBox.Show("现在打印【寄存证】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.Print_RegCardBase(ac01.AC001); } if (XtraMessageBox.Show("现在打印【骨灰安放卡】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.Print_RegSettle(ac01.AC001); } } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { session.RollbackTransaction(); LogUtils.Error(ee.Message); XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sb_ok_Click(object sender, EventArgs e) { bool b_done = false; if (FireAction.FireIsSettled(ac01.AC001)) { XtraMessageBox.Show("该逝者已经办理火化并且结算,不能再办理业务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } ///判断 守灵 冷藏 是否同时选择 if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0 && !string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0) { if (XtraMessageBox.Show("确认要同时选择【守灵】和【冷藏】业务吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0) { if (FireAction.ItemIsExisted(ac01.AC001, "01", "")) { if (XtraMessageBox.Show("【守灵】已经办理,是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } } if (!string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0) { if (FireAction.ItemIsExisted(ac01.AC001, "02", "")) { if (XtraMessageBox.Show("【冷藏】已经办理,是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } } if (!string.IsNullOrEmpty(glookup_gbt.EditValue.ToString()) && de_gbsj.EditValue != null) { if (FireAction.ItemIsExisted(ac01.AC001, "04", "")) { XtraMessageBox.Show("【告别】已经办理!", "确认", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } if (!string.IsNullOrEmpty(glookup_lc.EditValue.ToString())) { if (FireAction.ItemIsExisted(ac01.AC001, "07", "")) { XtraMessageBox.Show("【灵车】已经办理!", "确认", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } //////////////////////// 业务办理 /////////////////////// /// 01 如果守灵厅 if (!string.IsNullOrEmpty(glookup_slt.EditValue.ToString()) && Convert.ToDecimal(te_slt_nums.Text) > 0) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = "01"; //守灵厅 GridView view = glookup_slt.Properties.View; sa01.SA003 = "守灵厅" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】"; sa01.SA004 = glookup_slt.EditValue.ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE")); sa01.NUMS = Convert.ToDecimal(te_slt_nums.Text); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("01"); b_done = true; //sa01.Save(); } /// 02 如果冷藏柜 if (!string.IsNullOrEmpty(glookup_lcg.EditValue.ToString()) && Convert.ToDecimal(sp_lcg_nums.Text) > 0) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = "02"; //冷藏柜 GridView view = glookup_lcg.Properties.View; sa01.SA003 = "冷藏" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】"; sa01.SA004 = glookup_lcg.EditValue.ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE")); sa01.NUMS = Convert.ToDecimal(te_slt_nums.Text); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("02"); b_done = true; //sa01.Save(); } ///03 休息室 foreach (int i in gridView2.GetSelectedRows()) { if (FireAction.ItemIsExisted(ac01.AC001, "03", gridView2.GetRowCellValue(i, "SI001").ToString())) { throw new Exception("【" + gridView2.GetRowCellValue(i, "SI003").ToString() + "】" + "已经存在!"); } SA01 sa01 = new SA01(unitOfWork1); sa01.AC001 = ac01.AC001; sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = "03"; //休息室 sa01.SA003 = "休息室" + "【" + gridView2.GetRowCellValue(i, "SI003") + "】"; sa01.SA004 = gridView2.GetRowCellValue(i, "SI001").ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE")); sa01.NUMS = 1; sa01.SA007 = sa01.PRICE; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("03"); b_done = true; //sa01.Save(); } ///04 告别厅 if (!string.IsNullOrEmpty(glookup_gbt.EditValue.ToString()) && de_gbsj.EditValue != null) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = "04"; //告别厅 GridView view = glookup_gbt.Properties.View; sa01.SA003 = "告别厅" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】"; sa01.SA004 = glookup_gbt.EditValue.ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE")); sa01.NUMS = 1; sa01.SA007 = sa01.PRICE; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("04"); ac01.AC018 = Convert.ToDateTime(de_gbsj.EditValue); //告别时间 b_done = true; } ///07 灵车 if (!string.IsNullOrEmpty(glookup_lc.EditValue.ToString())) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = "07"; //灵车 GridView view = glookup_lc.Properties.View; sa01.SA003 = "灵车" + "【" + view.GetRowCellDisplayText(view.FocusedRowHandle, "SI003") + "】"; sa01.SA004 = glookup_lc.EditValue.ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE")); sa01.NUMS = 1; sa01.SA007 = sa01.PRICE; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("07"); b_done = true; //sa01.Save(); } ///06 火化 if (!string.IsNullOrEmpty(glookup_hh.EditValue.ToString()) && de_hhsj.EditValue != null) { SA01 sa01 = new SA01(unitOfWork1); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.AC001 = ac01.AC001; sa01.SA002 = "06"; //火化 GridView view = glookup_hh.Properties.View; sa01.SA003 = "火化" + "【" + view.GetRowCellValue(view.FocusedRowHandle, "SI003") + "】"; sa01.SA004 = glookup_hh.EditValue.ToString(); sa01.SA005 = "0"; sa01.PRICE = Convert.ToDecimal(view.GetRowCellValue(view.FocusedRowHandle, "PRICE")); sa01.NUMS = 1; sa01.SA007 = sa01.PRICE; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; ApplyCombo("06"); ac01.AC015 = Convert.ToDateTime(de_hhsj.EditValue); //火化时间 b_done = true; } if (!b_done) { XtraMessageBox.Show("还未选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { unitOfWork1.CommitChanges(); XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); LogUtils.Error(ee.Message); XtraMessageBox.Show(ee.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.DialogResult = DialogResult.OK; this.Close(); }
private void sb_ok_Click(object sender, EventArgs e) { if (!gridView1.PostEditor()) { return; } if (!gridView1.UpdateCurrentRow()) { return; } if (!gridView4.PostEditor()) { return; } if (!gridView4.UpdateCurrentRow()) { return; } int[] service_sel = gridView1.GetSelectedRows(); int[] gl_sel = gridView2.GetSelectedRows(); int[] zl_sel = gridView3.GetSelectedRows(); int[] jp_sel = gridView4.GetSelectedRows(); if (service_sel.Length + gl_sel.Length + zl_sel.Length + jp_sel.Length <= 0) { XtraMessageBox.Show("请先选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //延申服务处理 foreach (int i in service_sel) { if (ElementExisted(gridView1.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(collection.Session); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = "05"; //殡仪服务 sa01.SA003 = gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView1.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "1"; //销售类型 - 临时性销售 sa01.PRICE = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView1.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; collection.Add(sa01); } //谷类处理 foreach (int i in gl_sel) { if (ElementExisted(gridView2.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(collection.Session); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = "10"; //谷类 sa01.SA003 = gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView2.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "1"; //销售类型 - 临时性销售 sa01.PRICE = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView2.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; collection.Add(sa01); } //纸类处理 foreach (int i in zl_sel) { if (ElementExisted(gridView3.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(collection.Session); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = "11"; //纸类 sa01.SA003 = gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView3.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "1"; sa01.PRICE = Convert.ToDecimal(gridView3.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView3.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; collection.Add(sa01); } //祭品处理 foreach (int i in jp_sel) { if (ElementExisted(gridView4.GetRowCellValue(i, "ITEM_ID").ToString())) { if (XtraMessageBox.Show("【" + gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } SA01 sa01 = new SA01(collection.Session); sa01.SA001 = MiscAction.GetEntityPK("SA01"); sa01.SA002 = gridView4.GetRowCellValue(i, "ITEM_TYPE").ToString(); sa01.SA003 = gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString(); sa01.SA004 = gridView4.GetRowCellValue(i, "ITEM_ID").ToString(); sa01.SA005 = "1"; sa01.PRICE = Convert.ToDecimal(gridView4.GetRowCellValue(i, "PRICE")); sa01.NUMS = Convert.ToInt32(gridView4.GetRowCellValue(i, "NUMS")); sa01.SA007 = sa01.PRICE * sa01.NUMS; sa01.SA006 = sa01.PRICE; sa01.SA008 = "0"; sa01.SA100 = Envior.cur_user.UC001; sa01.SA200 = MiscAction.GetServerTime(); sa01.STATUS = "1"; collection.Add(sa01); } this.Close(); }