private void sb_ok_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(s_bi001) || bi01 == null) { be_position.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; be_position.ErrorText = "请先选择一个墓位!"; return; } else if (string.IsNullOrEmpty(te_bk003.Text)) { te_bk003.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; te_bk003.ErrorText = "请输入预定人姓名!"; te_bk003.Focus(); return; } else if (string.IsNullOrEmpty(te_bk005.Text)) { te_bk005.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; te_bk005.ErrorText = "请输入联系电话!"; te_bk005.Focus(); return; } else if (DateTime.Compare(Convert.ToDateTime(dateEdit1.EditValue.ToString()), Tools.GetServerDate()) < 0) { dateEdit1.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight; dateEdit1.ErrorText = "预定截至日期必须大于当前日期!"; dateEdit1.Focus(); return; } try { session1.BeginTransaction(); //1.保存 bi01 bi01.STATUS = '3'; //使用情况 1-未使用 2-已使用 3-预定 4-冻结 bi01.Save(); //2.记录预定记录 bk01 = new BK01(session1); bk01.BK001 = MiscAction.GetEntityPK("BK01"); bk01.BK003 = te_bk003.Text; bk01.BK005 = te_bk005.Text; bk01.BI001 = bi01.BI001; //墓位编号 bk01.BK009 = Convert.ToDateTime(dateEdit1.Text); //预留截至日期 bk01.BK100 = Envior.cur_userId; bk01.BK200 = Tools.GetServerDate().Date; bk01.STATUS = '1'; bk01.Save(); session1.CommitTransaction(); Tools.msg(MessageBoxIcon.Information, "提示", "墓位预定成功!"); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ee) { session1.RollbackTransaction(); Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString()); } }
private void sb_ok_Click(object sender, EventArgs e) { bool b_payrecord = false; if (!checkBeforeSave()) { return; } try { s_fa001 = MiscAction.GetEntityPK("FA01"); //1.购墓登记 ac01 = new AC01(unitOfWork1); ac01.AC001 = s_ac001; //购墓登记编号 ac01.AC002 = te_ac002.Text; //购墓人身份证号 ac01.AC003 = te_ac003.Text; //购墓人 ac01.AC004 = te_ac004.Text; //联系电话 ac01.AC005 = te_ac005.Text; //联系地址 ac01.AC012 = bi01.RE001; //排编号 ac01.AC010 = bi01.RG001; //墓区编号 ac01.AC015 = bi01.BI001; //墓位编号 ac01.AC020 = Convert.ToDecimal(bi01.PRICE); //墓位定价 ac01.AC022 = Convert.ToDecimal(te_price.Text); //售价 ac01.AC038 = Convert.ToInt32(te_free_nums.Text); //免费管理年限 ac01.AC049 = Convert.ToDateTime(de_ac049.Text); //购墓日期 //管理费到期日期 if (ac01.AC038 > 0) { ac01.AC040 = ac01.AC049.AddYears(ac01.AC038); b_payrecord = true; } else { int rowHandle = gridView1.LocateByValue("SA003", "管理费"); if (rowHandle >= 0) { ac01.AC040 = ac01.AC049.AddYears(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "NUMS"))); b_payrecord = true; } else { ac01.AC040 = ac01.AC049; } } ac01.AC042 = '1'; //缴费状态 ac01.AC048 = s_fa001; //缴费流水号 ac01.AC100 = Envior.cur_userId; //经办人 ac01.AC200 = Tools.GetServerDate(); //经办日期 ac01.AC250 = te_ac250.Text; //备注 ac01.AC300 = '1'; //登记类型 1-正常登记 0-原始登记 ac01.STATUS = '1'; //当前状态 ac01.Save(); //2.销售项目 foreach (SA01 sa01 in xpCollection_sa01) { sa01.SA008 = '1'; //结算状态 sa01.SA010 = s_fa001; //结算流水号 sa01.SA020 = 'T'; //发票类型 sa01.SA100 = Envior.cur_userId; //经办人 sa01.SA200 = Tools.GetServerDate(); //经办日期 sa01.Save(); if (sa01.SA003 == "管理费" /*如果是管理费*/ && sa01.SA002 == '1') { //插入缴费表 PR01 pr01 = new PR01(unitOfWork1); pr01.PR001 = s_fa001; pr01.AC001 = s_ac001; pr01.PR002 = ac01.AC049; //缴费开始日期 pr01.PR003 = ac01.AC049.AddYears(Convert.ToInt32(sa01.NUMS)); pr01.PRICE = sa01.PRICE; pr01.NUMS = sa01.NUMS; pr01.PR007 = sa01.SA007; pr01.PR008 = '1'; pr01.PR100 = Envior.cur_userId; pr01.PR200 = Tools.GetServerDate(); pr01.STATUS = '1'; pr01.Save(); } } //3.号位信息 bi01.STATUS = '2'; //已使用 bi01.PRICE = Convert.ToDecimal(te_fixprice.Text); //定价 bi01.BI005 = le_mx.EditValue.ToString(); //墓型 bi01.AC001 = s_ac001; //购墓登记编号 bi01.Save(); //4.财务收费信息 dec_total = dec_sales + Convert.ToDecimal(te_price.Text); FA01 fa01 = new FA01(unitOfWork1); fa01.FA001 = s_fa001; //缴费流水号 fa01.AC001 = s_ac001; //购墓流水号 fa01.FA002 = '0'; //收费类型 0-购墓 fa01.FA003 = te_ac003.Text; //缴费人 fa01.FA004 = dec_total; //收费金额 fa01.FA190 = '0'; //开票标志-未开票 fa01.FA100 = Envior.cur_userId; //收费人 fa01.FA180 = MiscAction.GetTombPosition(bi01.BI001); //备注(墓穴位置) fa01.FA200 = Tools.GetServerDate(); //缴费时间 fa01.STATUS = "1"; //状态 fa01.WS001 = Envior.WORKSTATIONID; //工作站标识 fa01.Save(); //如果是预定的记录 if (bk01 != null && s_action == "bookin") { bk01.STATUS = '2'; //已登记 bk01.Save(); } unitOfWork1.CommitTransaction(); ///设置附加信息 BusinessAction.SetExtraInfo(s_ac001); int i_papers = BusinessAction.GetInvoicePapers(s_fa001); if (XtraMessageBox.Show("登记办理成功!\r\n" + "本次结算共需要" + i_papers.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); } } } } ////打印证书 if (XtraMessageBox.Show("现在打印【购墓证书】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.PrintCert(s_ac001); } if (b_payrecord && XtraMessageBox.Show("现在打印【缴费记录】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { PrintAction.PrintPayRecord(s_fa001); } ////打印购墓协议 //if (XtraMessageBox.Show("现在打印【购墓协议】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //{ // PrintAction.PrintProtocol(s_ac001); //} this.Close(); } catch (Exception ee) { unitOfWork1.RollbackTransaction(); Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString()); } }