protected void AddEmptyDetail() { SaveGrid(); ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>; for (int i = 0; i < 5; i++) { ViewState["MaxID"] = (int)ViewState["MaxID"] + 1; FNA_FeeWriteOffDetail item; item = new FNA_FeeWriteOffDetail(); item.AccountTitle = 1; item.ApplyCost = 0; item.WriteOffCost = 0; item.ID = (int)ViewState["MaxID"]; #region 获取当前会计月的开始及截止日期 int month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-7)); AC_AccountMonth m = new AC_AccountMonthBLL(month).Model; item.BeginMonth = m.ID; item.EndMonth = m.ID; item.BeginDate = m.BeginDate; item.EndDate = m.EndDate; #endregion item.Remark = ""; _details.Add(item); //新增科目 } BindGrid(); }
protected void bt_Save_Click(object sender, EventArgs e) { FNA_FeeWriteOffBLL _bll = new FNA_FeeWriteOffBLL((int)ViewState["ID"]); FNA_FeeWriteOffDetail m = new FNA_FeeWriteOffDetail(); if ((int)ViewState["DetailID"] > 0) { m = _bll.GetDetailModel((int)ViewState["DetailID"]); m.ApplyCost = decimal.Parse(tbx_Taxes.Text.Trim()); m.WriteOffCost = m.ApplyCost; m.Remark = tbx_Remark.Text.Trim(); _bll.UpdateDetail(m); } else { m.ID = 0; m.ApplyDetailID = 0; m.Client = _bll.Model.InsteadPayClient; m.BeginMonth = _bll.Model.AccountMonth; m.EndMonth = _bll.Model.AccountMonth; m.AccountTitle = 129; m.ApplyCost = decimal.Parse(tbx_Taxes.Text.Trim()); m.WriteOffCost = m.ApplyCost; m.Remark = tbx_Remark.Text.Trim(); _bll.AddDetail(m); } Session["SuccessFlag"] = true; MessageBox.ShowAndClose(this, "税金调整成功。"); }
private void UpdateDetail(FNA_FeeWriteOffBLL bll, int AccountTitle, Decimal Cost, int flag, DateTime minbegindate, DateTime maxenddate) { if (Cost == 0) { return; } FNA_FeeWriteOffDetail d = bll.Items.FirstOrDefault(p => p.AccountTitle == AccountTitle); if (d != null) { if (flag == 1) { d.WriteOffCost += Cost; if (d.BeginDate > minbegindate) { d.BeginDate = minbegindate; } if (d.EndDate < maxenddate) { d.EndDate = maxenddate; } } else { d.WriteOffCost -= Cost; } if (d.WriteOffCost == 0) { bll.DeleteDetail(d.ID); } else { bll.UpdateDetail(d); } } else { if (flag == 1) { d = new FNA_FeeWriteOffDetail(); d.AccountTitle = AccountTitle; d.ApplyCost = 0; d.WriteOffCost = Cost; d.BeginDate = minbegindate; d.EndDate = maxenddate; d.BeginMonth = bll.Model.AccountMonth; d.EndMonth = bll.Model.AccountMonth; bll.Items.Add(d); bll.AddDetail(d); } } }
private void AddWriteOffDetail(FNA_FeeWriteOffBLL bll, int AccountTitle, Decimal Cost, DateTime minbegindate, DateTime maxenddate) { if (Cost == 0) { return; } FNA_FeeWriteOffDetail d = new FNA_FeeWriteOffDetail(); d.AccountTitle = AccountTitle; d.ApplyCost = 0; d.WriteOffCost = Cost; d.BeginDate = minbegindate; d.EndDate = maxenddate; d.BeginMonth = bll.Model.AccountMonth; d.EndMonth = bll.Model.AccountMonth; bll.Items.Add(d); }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)gv_List.DataKeys[e.Row.RowIndex]["ID"]; int applydetailid = (int)gv_List.DataKeys[e.Row.RowIndex]["ApplyDetailID"]; ListTable <FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable <FNA_FeeWriteOffDetail>; FNA_FeeWriteOffDetail m = _details[id.ToString()]; string sheetcode = ""; FNA_FeeApplyDetail applydetail = new FNA_FeeApplyDetail(); if (applydetailid > 0) { applydetail = new FNA_FeeApplyBLL().GetDetailModel(applydetailid); sheetcode = FNA_FeeApplyBLL.GetSheetCodeByDetailID(applydetailid); } HyperLink hy_ApplySheetCode = (HyperLink)e.Row.FindControl("hy_ApplySheetCode"); hy_ApplySheetCode.Text = sheetcode; hy_ApplySheetCode.NavigateUrl = "~/SubModule/FNA/FeeApply/FeeApplyDetail3.aspx?ID=" + applydetail.ApplyID; if (applydetail.Client > 0) { HyperLink hy_Client = (HyperLink)e.Row.FindControl("hy_Client"); hy_Client.Text = new CM_ClientBLL(applydetail.Client).Model.FullName; hy_Client.NavigateUrl = "~/SubModule/CM/RT/RetailerDetail.aspx?ClientID=" + m.Client; } DropDownList ddl_BalanceMode = (DropDownList)e.Row.FindControl("ddl_BalanceMode"); if (ddl_BalanceMode != null) { ddl_BalanceMode.Enabled = m.WriteOffCost < m.ApplyCost; if (m.BalanceMode > 0) { ddl_BalanceMode.SelectedValue = m.BalanceMode.ToString(); } } } }
protected void tbx_WriteOffCost_TextChanged(object sender, EventArgs e) { ListTable <FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable <FNA_FeeWriteOffDetail>; TextBox tb_WriteOffCost = (TextBox)sender; int id = (int)gv_List.DataKeys[((GridViewRow)tb_WriteOffCost.Parent.Parent).RowIndex]["ID"]; FNA_FeeWriteOffDetail m = _details[id.ToString()]; decimal writeoffcost = 0; if (decimal.TryParse(tb_WriteOffCost.Text, out writeoffcost)) { int overpercent = 0; int.TryParse(new AC_AccountTitleBLL(m.AccountTitle).Model["OverPercent"], out overpercent); if (writeoffcost > (m.ApplyCost * (100 + overpercent) / 100)) { tb_WriteOffCost.Text = m.ApplyCost.ToString("0.###"); MessageBox.Show(this, "超可报销金额,本科目最多可超申请金额的 " + overpercent + "% 报销,最大报销金额为 " + (m.ApplyCost * (100 + overpercent) / 100).ToString() + "元"); return; } lb_TotalCost.Text = (decimal.Parse(lb_TotalCost.Text) - m.WriteOffCost).ToString("0.###"); m.WriteOffCost = writeoffcost; _details.Update(m); lb_TotalCost.Text = (decimal.Parse(lb_TotalCost.Text) + m.WriteOffCost).ToString("0.###"); //DropDownList ddl_BalanceMode = (DropDownList)(((GridViewRow)tb_WriteOffCost.Parent.Parent).FindControl("ddl_BalanceMode")); //ddl_BalanceMode.Enabled = writeoffcost < m.ApplyCost; } else { tb_WriteOffCost.Text = m.ApplyCost.ToString("0.###"); MessageBox.Show(this, "填写格式必需为数值型!"); } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)gv_List.DataKeys[e.Row.RowIndex]["ID"]; ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>; FNA_FeeWriteOffDetail item = _details.GetListItem().FirstOrDefault(p => p.ID == id); if (item != null && item.AccountTitle > 1) { if (!string.IsNullOrEmpty(item["TeleFeeRelateTelephone"]) || !string.IsNullOrEmpty(item["MobileFeeRelateStaff"])) { if (e.Row.FindControl("ddl_AccountTitle") != null) { ((DropDownList)e.Row.FindControl("ddl_AccountTitle")).Enabled = false; } if (e.Row.FindControl("ddl_BeginMonth") != null) { ((DropDownList)e.Row.FindControl("ddl_BeginMonth")).Enabled = false; } if (e.Row.FindControl("tbx_WriteOffCost") != null) { ((TextBox)e.Row.FindControl("tbx_WriteOffCost")).Enabled = false; } if (e.Row.FindControl("tbx_Remark") != null) { ((TextBox)e.Row.FindControl("tbx_Remark")).Enabled = false; } } } } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { Label lb_SheetCode = (Label)e.Item.FindControl("lb_SheetCode"); lb_SheetCode.Text = string.Format("核销单号:{0}---费用明细 第{1}页,共{2}页", ViewState["SheetCode"], e.Item.ItemIndex + 1, ViewState["TotalPage"]); Literal _c = (Literal)e.Item.FindControl("lb_RepeaterNextPage"); if (_c != null && e.Item.ItemIndex % 2 == 0) { _c.Text = "<br/><div class='PageNext'></div><br/>"; } UC_GridView gv_List = (UC_GridView)e.Item.FindControl("gv_List"); if (gv_List != null) { IList <FNA_FeeWriteOffDetail> list = ((IList <FNA_FeeWriteOffDetail>)ViewState["Details"]).OrderBy(p => p.Client).ThenBy(p => p.AccountTitle).ThenBy(p => p.BeginMonth).ToList(); IList <FNA_FeeWriteOffDetail> l = new List <FNA_FeeWriteOffDetail>(); decimal subtotal = 0; if (ht_pageitem.Contains(e.Item.ItemIndex.ToString()) && (int)ht_pageitem[e.Item.ItemIndex.ToString()] > 0) { for (int i = 0; i < (int)ht_pageitem[e.Item.ItemIndex.ToString()]; i++) { if (list.Count > 0) { FNA_FeeWriteOffDetail m = list[0]; list.Remove(m); l.Add(m); subtotal += m.WriteOffCost + m.AdjustCost; } } for (int j = 0; j < PRINTPAGESIZE - (int)ht_pageitem[e.Item.ItemIndex.ToString()]; j++) { l.Add(new FNA_FeeWriteOffDetail()); } } gv_List.BindGrid(l); ViewState["Details"] = list; if ((int)ViewState["State"] == 3) { //核销完成,可见调整金额及原因 gv_List.Columns[gv_List.Columns.Count - 1].Visible = true; //扣减原因 gv_List.Columns[gv_List.Columns.Count - 2].Visible = true; //扣减方式 gv_List.Columns[gv_List.Columns.Count - 3].Visible = true; //扣减金额 gv_List.Columns[gv_List.Columns.Count - 4].Visible = true; //批复金额 gv_List.Columns[gv_List.Columns.Count - 5].Visible = true; //扣减原因 gv_List.Columns[gv_List.Columns.Count - 6].Visible = true; //扣减方式 gv_List.Columns[gv_List.Columns.Count - 7].Visible = true; //扣减金额 } if (ViewState["HasFeeApply"].ToString() == "N") { //当费用为无申请费用时,下列字段隐藏 gv_List.Columns[0].Visible = false; //发生客户 gv_List.Columns[1].Visible = false; //客户渠道 gv_List.Columns[6].Visible = false; //申请单备案号 } if (ViewState["IsEvectionWriteOff"].ToString() == "Y") { //当核销单关联至差旅行程报销时,下列字段隐藏 gv_List.Columns[5].Visible = false; //备注 } Label lb_SubTotalCostCN = (Label)e.Item.FindControl("lb_SubTotalCostCN"); if (lb_SubTotalCostCN != null) { lb_SubTotalCostCN.Text = MCSFramework.Common.Rmb.CmycurD(subtotal); } Label lb_SubTotalCost = (Label)e.Item.FindControl("lb_SubTotalCost"); if (lb_SubTotalCost != null) { lb_SubTotalCost.Text = subtotal.ToString("0.##"); } } }
private bool SaveGrid() { ListTable <FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable <FNA_FeeWriteOffDetail>; foreach (GridViewRow row in gv_List.Rows) { int id = (int)gv_List.DataKeys[row.RowIndex]["ID"]; int applydetailid = (int)gv_List.DataKeys[row.RowIndex]["ApplyDetailID"]; FNA_FeeWriteOffDetail m = _details[id.ToString()]; #region 保存核销开始日期 TextBox tbx_BeginDate = (TextBox)row.FindControl("tbx_BeginDate"); if (tbx_BeginDate != null && tbx_BeginDate.Text != "") { DateTime begin = new DateTime(1900, 1, 1); if (DateTime.TryParse(tbx_BeginDate.Text, out begin)) { FNA_FeeApplyDetail apply = new FNA_FeeApplyBLL().GetDetailModel(applydetailid); if (begin >= apply.BeginDate && begin <= apply.EndDate && begin <= m.EndDate) { m.BeginDate = begin; m.BeginMonth = AC_AccountMonthBLL.GetMonthByDate(begin); _details.Update(m); } else { tbx_BeginDate.Text = m.BeginDate.ToString("yyyy-MM-dd"); MessageBox.Show(this, "第" + (row.RowIndex + 1).ToString() + "行,报销开始日期必须在该费用申请时指定的日期范围之内!" + apply.BeginDate.ToString("yyyy-MM-dd") + " — " + apply.EndDate.ToString("yyyy-MM-dd")); return(false); } } else { tbx_BeginDate.Text = m.BeginDate.ToString("yyyy-MM-dd"); MessageBox.Show(this, "开始日期填写格式必需为日期型!"); return(false); } } #endregion #region 保存核销截止日期 TextBox tbx_EndDate = (TextBox)row.FindControl("tbx_EndDate"); if (tbx_EndDate != null && tbx_EndDate.Text != "") { DateTime end = new DateTime(1900, 1, 1); if (DateTime.TryParse(tbx_EndDate.Text, out end)) { FNA_FeeApplyDetail apply = new FNA_FeeApplyBLL().GetDetailModel(applydetailid); if (end >= apply.BeginDate && end <= apply.EndDate && end >= m.BeginDate) { m.EndDate = end; m.EndMonth = AC_AccountMonthBLL.GetMonthByDate(end); _details.Update(m); } else { tbx_EndDate.Text = m.EndDate.ToString("yyyy-MM-dd"); MessageBox.Show(this, "第" + (row.RowIndex + 1).ToString() + "行,报销截止日期必须在该费用申请时指定的日期范围之内!" + apply.BeginDate.ToString("yyyy-MM-dd") + " — " + apply.EndDate.ToString("yyyy-MM-dd")); return(false); } } else { tbx_EndDate.Text = m.BeginDate.ToString("yyyy-MM-dd"); MessageBox.Show(this, "截止日期填写格式必需为日期型!"); return(false); } } #endregion m["DiscountRate"] = "0"; m["RebateRate"] = "0"; //m["VATInvoiceNO"] = ""; m["AcceptanceNO"] = ""; m["InvoiceDate"] = ""; m["DeductReason"] = ""; #region 结余方式 //if (m.WriteOffCost < m.ApplyCost) //{ // DropDownList ddl_BalanceMode = (DropDownList)row.FindControl("ddl_BalanceMode"); // m.BalanceMode = int.Parse(ddl_BalanceMode.SelectedValue); //} //else m.BalanceMode = 2;//不允许多次核销 #endregion #region 保存备注 TextBox tbx_Remark = (TextBox)row.FindControl("tbx_Remark"); m.Remark = tbx_Remark.Text; _details.Update(m); #endregion } return(true); }
protected void bt_AddToWriteOffList_Click(object sender, EventArgs e) { ListTable <FNA_FeeWriteOffDetail> _details = Session["FeeWriteOffDetails"] as ListTable <FNA_FeeWriteOffDetail>; int maxid = 0; if (_details != null) { if (_details.GetListItem().Count > 0) { maxid = _details.GetListItem().Max(p => p.ID); } } maxid++; foreach (GridViewRow row in gv_FeeAplyList.Rows) { CheckBox cb_Selected = (CheckBox)row.FindControl("cb_Selected"); if (cb_Selected.Checked) { int applyid = (int)gv_FeeAplyList.DataKeys[row.RowIndex][0]; int applydetialid = (int)gv_FeeAplyList.DataKeys[row.RowIndex][1]; FNA_FeeApplyBLL applyBLL = new FNA_FeeApplyBLL(applyid); FNA_FeeApply apply = applyBLL.Model; FNA_FeeApplyDetail applydetail = applyBLL.GetDetailModel(applydetialid); #region 陈列、返利费用判断协议是否关联合同 IList <CM_Contract> contractList; contractList = CM_ContractBLL.GetModelList(@"ContractCode!='' AND ContractCode=MCS_SYS.dbo.UF_Spilt('" + applydetail.Remark + "',':',2)"); if (applydetail.RelateContractDetail != 0) { int ID = 0; CM_ContractDetail detail = new CM_ContractBLL().GetDetailModel(applydetail.RelateContractDetail); if (detail != null) { ID = detail.ContractID; } contractList = CM_ContractBLL.GetModelList("ID=" + ID.ToString()); } if (contractList.Count > 0 && contractList[0].Classify < 3 && ATMT_AttachmentBLL.GetModelList("RelateType=35 AND RelateID=" + contractList[0].ID.ToString()).Count == 0) { MessageBox.Show(this, "陈列、返利费用操作费用核销申请时,门店协议必须上传附件,请上传后再核销!"); return; } #endregion FNA_FeeWriteOffDetail m = new FNA_FeeWriteOffDetail(); m.ID = maxid++; m.ApplyDetailID = applydetialid; m.Client = applydetail.Client; m.AccountTitle = applydetail.AccountTitle; m.ProductBrand = apply.ProductBrand; m.ApplyCost = applydetail.AvailCost; m.BeginMonth = applydetail.BeginMonth; m.EndMonth = applydetail.EndMonth; m.BeginDate = applydetail.BeginDate; m.EndDate = applydetail.EndDate; m.WriteOffCost = applydetail.AvailCost; m.Remark = applydetail.Remark; if (applydetail["BankVoucherNo"] != "") { m.Remark += ",凭证:" + applydetail["BankVoucherNo"]; } if (applydetail.Remark.IndexOf("是否CA") > 0) { m.Remark = applydetail.Remark.Substring(applydetail.Remark.IndexOf("是否CA") - 1); } if (_details == null) { _details = new ListTable <FNA_FeeWriteOffDetail>(new List <FNA_FeeWriteOffDetail>(), "ID"); } _details.Add(m); } } BindGrid(); gv_FeeAplyList.PageIndex = 0; BindFeeApplyNoWriteOff(); }
protected void bt_AddMobileFee_Click(object sender, EventArgs e) { int staffid = 0; int.TryParse(select_MobileStaff.SelectValue, out staffid); if (staffid == 0) { return; } Org_Staff staff = new Org_StaffBLL(staffid).Model; if (staff == null) { return; } if (string.IsNullOrEmpty(staff["ManageInfo11"])) { staff["ManageInfo11"] = "0"; } decimal applycost = 0; decimal.TryParse(staff["ManageInfo11"], out applycost); if (applycost <= 0) { return; } decimal writeoffcost = decimal.Parse(tbx_MobileCost.Text); if (writeoffcost > applycost) { MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_MobileApplyCost.Text + "!"); tbx_MobileCost.Text = lb_MobileApplyCost.Text; return; } SaveGrid(); ViewState["MaxID"] = (int)ViewState["MaxID"] + 1; #region 组织手机费核销明细 FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail(); item.ID = (int)ViewState["MaxID"]; item.AccountTitle = ConfigHelper.GetConfigInt("MobileCostACTitle"); item.ApplyCost = applycost; item.WriteOffCost = writeoffcost; item["MobileFeeRelateStaff"] = staff.ID.ToString(); #region 获取当前会计月的开始及截止日期 int month = int.Parse(ddl_MobileCostMonth.SelectedValue); AC_AccountMonth m = new AC_AccountMonthBLL(month).Model; item.BeginMonth = m.ID; item.EndMonth = m.ID; item.BeginDate = m.BeginDate; item.EndDate = m.EndDate; #endregion item.Remark = "员工:" + staff.RealName + ";"; item.Remark += "手机号码:" + staff["Mobile"] + ";月份:" + ddl_MobileCostMonth.SelectedItem.Text + ";限额:" + lb_MobileApplyCost.Text + ";"; if (tbx_MobileRemark.Text != "") { item.Remark += "说明:" + tbx_MobileRemark.Text; } #endregion if (FNA_FeeWriteOffBLL.CheckMobileFeeHasWriteOff(item.AccountTitle, item.BeginMonth, staffid)) { MessageBox.Show(this, "该员工指定月的手机费,已在其他报销单中报销,请勿重复报销!"); } else { ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>; if (_details.GetListItem().FirstOrDefault(p => p.AccountTitle == item.AccountTitle && p.BeginMonth == item.BeginMonth && p["MobileFeeRelateStaff"] == item["MobileFeeRelateStaff"]) == null) { _details.Add(item); //新增科目 } else { MessageBox.Show(this, "该员工指定月的手机费,已在本报销单中,请勿重复报销!"); } } BindGrid(); AddEmptyDetail(); }
protected void bt_AddTeleFee_Click(object sender, EventArgs e) { if (ddl_Tele.SelectedValue == "0") { return; } int teleid = int.Parse(ddl_Tele.SelectedValue); CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model; decimal writeoffcost = decimal.Parse(tbx_TeleCost.Text); decimal applycost = tele.TeleCost + tele.NetCost; if (writeoffcost > applycost) { MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_TeleApplyCost.Text + "!"); tbx_TeleCost.Text = lb_TeleApplyCost.Text; return; } SaveGrid(); ViewState["MaxID"] = (int)ViewState["MaxID"] + 1; #region 组织电话费核销明细 FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail(); item.ID = (int)ViewState["MaxID"]; item.AccountTitle = ConfigHelper.GetConfigInt("TeleCostACTitle"); item.ApplyCost = applycost; item.WriteOffCost = writeoffcost; item["TeleFeeRelateTelephone"] = tele.ID.ToString(); item.Client = tele.Client; #region 获取当前会计月的开始及截止日期 int month = int.Parse(ddl_TeleCostMonth.SelectedValue); AC_AccountMonth m = new AC_AccountMonthBLL(month).Model; item.BeginMonth = m.ID; item.EndMonth = m.ID; item.BeginDate = m.BeginDate; item.EndDate = m.EndDate; #endregion if (tele.Client > 0) { CM_Client client = new CM_ClientBLL(tele.Client).Model; if (client != null) { item.Remark = "物业:" + client.FullName + ";"; } } item.Remark += "电话号码:" + ddl_Tele.SelectedItem.Text + ";月份:" + ddl_TeleCostMonth.SelectedItem.Text + ";限额:" + lb_TeleApplyInfo.Text + ";"; if (tbx_TeleRemark.Text != "") { item.Remark += "说明:" + tbx_TeleRemark.Text; } #endregion if (FNA_FeeWriteOffBLL.CheckTeleFeeHasWriteOff(item.AccountTitle, item.BeginMonth, tele.ID)) { MessageBox.Show(this, "该电话指定月的费用,已在其他报销单中报销,请勿重复报销!"); } else { ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>; if (_details.GetListItem().FirstOrDefault(p => p.AccountTitle == item.AccountTitle && p.BeginMonth == item.BeginMonth && p["TeleFeeRelateTelephone"] == item["TeleFeeRelateTelephone"]) == null) { _details.Add(item); //新增科目 } else { MessageBox.Show(this, "该电话指定月的费用,已在本报销单中,请勿重复报销!"); } } BindGrid(); AddEmptyDetail(); }
private bool SaveGrid() { ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>; foreach (GridViewRow gr in gv_List.Rows) { int id = (int)gv_List.DataKeys[gr.RowIndex]["ID"]; FNA_FeeWriteOffDetail item = _details.GetListItem().FirstOrDefault(p => p.ID == id); if (item == null) { item = new FNA_FeeWriteOffDetail(); item.ID = id; } item.AccountTitle = int.Parse(((DropDownList)gr.FindControl("ddl_AccountTitle")).SelectedValue); //忽略手工直填的电话费及手机费,必须通过专用面板加入报销信息 if (item.AccountTitle == ConfigHelper.GetConfigInt("TeleCostACTitle") || item.AccountTitle == ConfigHelper.GetConfigInt("MobileCostACTitle")) { if (((TextBox)gr.FindControl("tbx_WriteOffCost")).Enabled) { _details.Remove(item); } continue; } if (((TextBox)gr.FindControl("tbx_WriteOffCost")).Text.Trim() != "") { item.WriteOffCost = decimal.Parse(((TextBox)gr.FindControl("tbx_WriteOffCost")).Text.Trim()); } if (item.AccountTitle > 1 && item.WriteOffCost != 0) { #region 获取选择的会计月 if (gr.FindControl("ddl_BeginMonth") != null && item.BeginMonth.ToString() != ((DropDownList)gr.FindControl("ddl_BeginMonth")).SelectedValue) { item.BeginMonth = int.Parse(((DropDownList)gr.FindControl("ddl_BeginMonth")).SelectedValue); item.EndMonth = item.BeginMonth; AC_AccountMonth month = new AC_AccountMonthBLL(item.BeginMonth).Model; item.BeginDate = month.BeginDate; item.EndDate = month.EndDate; } #endregion item.Remark = ((TextBox)gr.FindControl("tbx_Remark")).Text; if (item.Remark == "") { MessageBox.Show(this, "备注必填"); return(false); } _details.Update(item); } else { _details.Remove(item); } } return(true); }