/// <summary> /// 获取收款或付款登记信息 /// </summary> /// <param name="registerId">收款付款登记信息业务实体</param> /// <returns></returns> public virtual EyouSoft.Model.ToolStructure.FundRegisterInfo GetInfo(string registerId) { EyouSoft.Model.ToolStructure.FundRegisterInfo register = null; DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_GetInfo); this._db.AddInParameter(cmd, "RegisterId", DbType.AnsiStringFixedLength, registerId); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, this._db)) { if (rdr.Read()) { register = new EyouSoft.Model.ToolStructure.FundRegisterInfo(); register.BillingAmount = rdr.GetDecimal(rdr.GetOrdinal("BillingAmount")); register.ContactName = rdr["ContactName"].ToString(); register.InvoiceNo = rdr["InvoiceNo"].ToString(); register.IsBilling = rdr.GetString(rdr.GetOrdinal("IsBilling")) == "1" ? true : false; register.IsChecked = rdr.GetString(rdr.GetOrdinal("IsChecked")) == "1" ? true : false; register.IssueTime = rdr.GetDateTime(rdr.GetOrdinal("IssueTime")); register.ItemAmount = rdr.GetDecimal(rdr.GetOrdinal("ItemAmount")); register.ItemId = rdr.GetString(rdr.GetOrdinal("ItemId")); register.ItemTime = rdr.GetDateTime(rdr.GetOrdinal("ItemTime")); register.OperatorId = rdr.GetString(rdr.GetOrdinal("OperatorId")); register.PayType = (EyouSoft.Model.ToolStructure.FundPayType)rdr.GetByte(rdr.GetOrdinal("PayType")); register.RegisterId = rdr.GetString(rdr.GetOrdinal("RegisterId")); register.RegisterType = (EyouSoft.Model.ToolStructure.FundRegisterType) int.Parse(rdr.GetString(rdr.GetOrdinal("RegisterType"))); register.Remark = rdr["Remark"].ToString(); } } return(register); }
/// <summary> /// 删除收款或付款登记 /// </summary> /// <param name="registerId">登记编号</param> /// <returns></returns> public bool Delete(string registerId) { EyouSoft.Model.ToolStructure.FundRegisterInfo register = this.GetInfo(registerId); if (register == null) { return(true); } bool result = true; using (TransactionScope AddTran = new TransactionScope()) { result = dal.Delete(registerId); if (!result) { return(false); } result = this.SetAmount(register.ItemId, register.RegisterType); if (!result) { return(false); } AddTran.Complete(); } return(true); }
/// <summary> /// 添加收款或付款登记 /// </summary> /// <param name="register">收款付款登记信息业务实体</param> /// <returns></returns> public bool Add(EyouSoft.Model.ToolStructure.FundRegisterInfo register) { register.RegisterId = Guid.NewGuid().ToString(); bool result = true; using (TransactionScope AddTran = new TransactionScope()) { result = dal.Add(register); if (!result) { return(false); } result = this.SetAmount(register.ItemId, register.RegisterType); if (!result) { return(false); } AddTran.Complete(); } return(true); }
/// <summary> /// 行绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void EnterPayable_rptReceivables_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemIndex == -1) { return; } DropDownList ddl = (DropDownList)e.Item.FindControl("EnterPayable_ddlEditEnterFS"); LinkButton lkb = (LinkButton)e.Item.FindControl("EnterPayable_btnEditSave"); LinkButton lkbdel = (LinkButton)e.Item.FindControl("EnterPayable_lkbDel"); LinkButton lbkChangeCheck = (LinkButton)e.Item.FindControl("EnterPayable_lkbCheck"); Panel pan = (Panel)e.Item.FindControl("EnterPayable_tdHandle"); Panel panEdit = (Panel)e.Item.FindControl("EnterPayable_panEdit"); if (ddl != null) { EyouSoft.Model.ToolStructure.FundRegisterInfo dr = (EyouSoft.Model.ToolStructure.FundRegisterInfo)e.Item.DataItem; if (ddl.Items.FindByValue(((int)dr.PayType).ToString()) != null) { ddl.Items.FindByValue(((int)dr.PayType).ToString()).Selected = true; } } if (lkb != null) { lkb.Attributes.Add("onclick", "return EnterPayable.getEditValue(" + (e.Item.ItemIndex + 1).ToString() + ",this);"); } if (lkbdel != null) { lkbdel.Attributes.Add("onclick", "return confirm('确定要删除此项吗?');"); } if (!IsHandle) { if (pan != null) { pan.Visible = false; } if (panEdit != null) { panEdit.Visible = false; } } if (!IsCheck) { if (lbkChangeCheck != null) { lbkChangeCheck.Visible = false; } } }
/// <summary> /// 更新收款或付款登记 /// </summary> /// <param name="register">收款付款登记信息业务实体</param> /// <returns></returns> public virtual bool Update(EyouSoft.Model.ToolStructure.FundRegisterInfo register) { DbCommand cmd = this._db.GetSqlStringCommand(SQL_UPDATE_Update); this._db.AddInParameter(cmd, "ItemTime", DbType.DateTime, register.ItemTime); this._db.AddInParameter(cmd, "ContactName", DbType.String, register.ContactName); this._db.AddInParameter(cmd, "ItemAmount", DbType.Decimal, register.ItemAmount); this._db.AddInParameter(cmd, "PayType", DbType.Byte, register.PayType); this._db.AddInParameter(cmd, "IsBilling", DbType.AnsiStringFixedLength, register.IsBilling ? "1" : "0"); this._db.AddInParameter(cmd, "BillingAmount", DbType.Decimal, register.BillingAmount); this._db.AddInParameter(cmd, "InvoiceNo", DbType.String, register.InvoiceNo); this._db.AddInParameter(cmd, "Remark", DbType.String, register.Remark); this._db.AddInParameter(cmd, "IsChecked", DbType.AnsiStringFixedLength, register.IsChecked ? "1" : "0"); this._db.AddInParameter(cmd, "RegisterId", DbType.AnsiStringFixedLength, register.RegisterId); return(DbHelper.ExecuteSql(cmd, this._db) == 1 ? true : false); }
private void InsertFundRegister() { EyouSoft.Model.ToolStructure.FundRegisterInfo register = new EyouSoft.Model.ToolStructure.FundRegisterInfo(); register.BillingAmount = 50; register.ContactName = "汪奇志"; register.InvoiceNo = "201011090001"; register.IsBilling = true; register.IsChecked = true; register.IssueTime = DateTime.Now; register.ItemAmount = 50; register.ItemId = "2c9a9578-e0e2-4e5c-8752-739057913576"; register.ItemTime = DateTime.Now; register.OperatorId = "2c9a9578-e0e2-4e5c-8752-739057913576"; register.PayType = EyouSoft.Model.ToolStructure.FundPayType.签单挂账; register.RegisterId = Guid.NewGuid().ToString(); register.RegisterType = EyouSoft.Model.ToolStructure.FundRegisterType.收款; register.Remark = "备注..."; Response.Write(EyouSoft.BLL.ToolStructure.FundRegister.CreateInstance().Add(register)); }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void EnterPayable_btnSave_Click(object sender, EventArgs e) { string ReceivablesId = Utils.InputText(Request.QueryString["ID"]); if (string.IsNullOrEmpty(ReceivablesId)) { EyouSoft.Common.Function.MessageBox.ResponseScript(this.Page, "alert('参数丢失,请从新打开此窗口!');closeWin();"); return; } ReturnUrl = ReturnUrl + "ID=" + ReceivablesId; DateTime?EnterDate = Utils.GetDateTimeNullable(EnterPayable_txtEnterDate.Text.Trim()); string ContactName = Utils.InputText(EnterPayable_txtEnterPeople.Text.Trim()); decimal ItemAmount = Utils.GetDecimal(EnterPayable_txtPrice.Text.Trim(), 0); int PayType = Utils.GetInt(Request.Form["EnterPayable_ddlEnterFS"].Trim(), -1); bool IsIsBilling = EnterPayable_ckbAddIsBilling.Checked; decimal BillingAmount = Utils.GetDecimal(EnterPayable_txtBillingPrice.Text.Trim(), 0); string InvoiceNo = Utils.InputText(EnterPayable_txtInvoiceNo.Text.Trim()); string Remark = Utils.InputText(EnterPayable_txtRemark.Text.Trim()); bool IsCheck = EnterPayable_ckbAddIsCheck.Checked; System.Text.StringBuilder strErr = new System.Text.StringBuilder(); if (!EnterDate.HasValue) { strErr.Append("付款日期必须填写!\\n"); } if (string.IsNullOrEmpty(ContactName)) { strErr.Append("付款人必须填写!\\n"); } if (ItemAmount <= 0) { strErr.Append("付款金额必须填写!\\n"); } if (PayType < 0) { strErr.Append("请选择付款方式!\\n"); } if (IsIsBilling) { if (BillingAmount <= 0) { strErr.Append("开票金额必须填写!\\n"); } if (string.IsNullOrEmpty(InvoiceNo)) { strErr.Append("发票号必须填写!\\n"); } } if (!string.IsNullOrEmpty(strErr.ToString())) { EyouSoft.Common.Function.MessageBox.ShowAndReturnBack(this, strErr.ToString(), 1); return; } if (CheckMoney(ItemAmount, 0)) { EyouSoft.Common.Function.MessageBox.ShowAndReturnBack(this, "付款金额不能大于未付金额!", 1); return; } EyouSoft.Model.ToolStructure.FundRegisterInfo model = new EyouSoft.Model.ToolStructure.FundRegisterInfo(); model.ContactName = ContactName; model.BillingAmount = BillingAmount; model.InvoiceNo = InvoiceNo; model.IsBilling = IsIsBilling; model.IsChecked = IsCheck; model.IssueTime = DateTime.Now; model.ItemAmount = ItemAmount; model.ItemId = ReceivablesId; model.ItemTime = EnterDate.Value; model.OperatorId = SiteUserInfo.ID; model.PayType = (EyouSoft.Model.ToolStructure.FundPayType)PayType; model.RegisterId = Guid.NewGuid().ToString(); model.RegisterType = EyouSoft.Model.ToolStructure.FundRegisterType.付款; model.Remark = Remark; bool IsResult = EyouSoft.BLL.ToolStructure.FundRegister.CreateInstance().Add(model); EyouSoft.Common.Function.MessageBox.ShowAndRedirect(this.Page, IsResult ? "添加成功!" : "添加失败!", ReturnUrl); model = null; }
/// <summary> /// 修改 /// </summary> /// <param name="RegisterId">登记信息编号</param> /// <returns></returns> private bool EditReceivables(string RegisterId, out System.Text.StringBuilder strErr) { strErr = new System.Text.StringBuilder(); if (string.IsNullOrEmpty(RegisterId)) { strErr.Append("参数丢失!"); return(false); } string pam = EnterPayable_hidEditValue.Value; if (string.IsNullOrEmpty(pam)) { strErr.Append("参数丢失!"); return(false); } string[] Pam = pam.Split('^'); if (Pam == null || Pam.Length <= 0 || Pam.Length != 10) { strErr.Append("参数丢失!"); return(false); } DateTime?EnterDate = Utils.GetDateTimeNullable(Pam[0]); string ContactName = Utils.InputText(Pam[1]); decimal ItemAmount = Utils.GetDecimal(Pam[2], 0); decimal OldItemAmount = Utils.GetDecimal(Pam[3], 0); int PayType = Utils.GetInt(Pam[4], -1); bool IsIsBilling = Pam[5] == "1" ? true : false; decimal BillingAmount = Utils.GetDecimal(Pam[6], 0); string InvoiceNo = Utils.InputText(Pam[7]); string Remark = Utils.InputText(Pam[8]); bool IsCheck = Pam[9] == "1" ? true : false; if (!EnterDate.HasValue) { strErr.Append("付款日期必须填写!\\n"); } if (string.IsNullOrEmpty(ContactName)) { strErr.Append("付款人必须填写!\\n"); } if (ItemAmount <= 0) { strErr.Append("付款金额必须填写!\\n"); } if (PayType < 0) { strErr.Append("请选择付款方式!\\n"); } if (IsIsBilling) { if (BillingAmount <= 0) { strErr.Append("开票金额必须填写!\\n"); } if (string.IsNullOrEmpty(InvoiceNo)) { strErr.Append("发票号必须填写!\\n"); } } if (!string.IsNullOrEmpty(strErr.ToString())) { return(false); } if (CheckMoney(ItemAmount, OldItemAmount)) { strErr.Append("付款金额不能大于未付金额!"); return(false); } EyouSoft.Model.ToolStructure.FundRegisterInfo model = new EyouSoft.Model.ToolStructure.FundRegisterInfo(); model.ContactName = ContactName; model.BillingAmount = BillingAmount; model.InvoiceNo = InvoiceNo; model.IsBilling = IsIsBilling; model.IsChecked = IsCheck; model.IssueTime = DateTime.Now; model.ItemAmount = ItemAmount; model.ItemTime = EnterDate.Value; model.OperatorId = SiteUserInfo.ID; model.PayType = (EyouSoft.Model.ToolStructure.FundPayType)PayType; model.RegisterId = RegisterId; model.Remark = Remark; bool IsResult = EyouSoft.BLL.ToolStructure.FundRegister.CreateInstance().Update(model); if (IsResult) { strErr.Append("修改成功!"); } else { strErr.Append("修改失败!"); } model = null; return(IsResult); }