/// <summary> /// 获取前端税收自定义项,生成序列化json /// </summary> /// <returns></returns> private string tax_total_disp() { QuoteTemplateAddDto.Tax_Total_Disp ttd = new DTO.QuoteTemplateAddDto.Tax_Total_Disp(); //Response.Write(this.SemiAnnualTotal.Text.Trim().ToString()); ttd.Semi_Annual_Total = this.SemiAnnualTotal.Text.Trim().ToString(); ttd.Including_Optional_Quote_Items = this.IncludingOptionalQuoteItems.Text.Trim().ToString(); ttd.Item_Total = this.ItemTotal.Text.Trim().ToString(); ttd.Subtotal = this.Subtotal.Text.Trim().ToString(); ttd.Total = this.Total.Text.Trim().ToString(); ttd.Total_Taxes = this.TotalTaxes.Text.Trim().ToString(); ttd.Yearly_Subtotal = this.YearlySubtotal.Text.Trim().ToString(); ttd.Yearly_Total = this.YearlyTotal.Text.Trim().ToString(); ttd.Shipping_Total = this.ShippingTotal.Text.Trim().ToString(); ttd.Shipping_Subtotal = this.ShippingSubtotal.Text.Trim().ToString(); ttd.Semi_Annual_Subtotal = this.SemiAnnualSubtotal.Text.Trim().ToString(); ttd.Quarterly_Total = this.QuarterlyTotal.Text.Trim().ToString(); ttd.Quarterly_Subtotal = this.QuarterlySubtotal.Text.Trim().ToString(); ttd.Monthly_Subtotal = this.MonthlySubtotal.Text.Trim().ToString(); ttd.Optional_Subtotal = this.OptionalSubtotal.Text.Trim().ToString(); ttd.Optional_Total = this.OptionalTotal.Text.Trim().ToString(); ttd.Monthly_Subtotal = this.MonthlySubtotal.Text.Trim().ToString(); ttd.Monthly_Total = this.MonthlyTotal.Text.Trim().ToString(); ttd.One_Time_Total = this.OneTimeTotal.Text.Trim().ToString(); ttd.One_Time_Subtotal = this.OneTimeSubtotal.Text.Trim().ToString(); ttd.One_Time_Discount_Total = this.OneTimeDiscountTotal.Text.Trim().ToString(); ttd.One_Time_Discount_Subtotal = this.OneTimeDiscountSubtotal.Text.Trim().ToString(); string jsonString = new EMT.Tools.Serialize().SerializeJson(ttd); // string jsonString = JsonConvert.SerializeObject(ttd); return(jsonString); // Response.Write(jsonString); }
protected void Save_Click(object sender, EventArgs e) { string t = Request.Form["data"].ToString(); t = t.Replace("[,", "[").Replace(",]", "]"); var kkk = new EMT.Tools.Serialize().DeserializeJson <DataPermissionDto.Resource_Permission>(t); foreach (var ii in resourcelist) { foreach (var i in kkk.permission) { if (ii.id == Convert.ToInt64(i.id.Replace("id", string.Empty))) { if (i.edit_protected_data == "yes") { ii.edit_protected_data = 1; } else { ii.edit_protected_data = 0; } if (i.view_protected_data == "yes") { ii.view_protected_data = 1; } else { ii.view_protected_data = 0; } if (i.edit_unprotected_data == "yes") { ii.edit_unprotected_data = 1; } else { ii.edit_unprotected_data = 0; } if (i.view_unprotected_data == "yes") { ii.view_unprotected_data = 1; } else { ii.view_unprotected_data = 0; } new UserResourceBLL().UpdatePermission(ii, GetLoginUserId()); continue; } } } Response.Write("<script>alert('保存成功!');</script>"); }
protected void Save(object sender, EventArgs e) { string tt = Request.Form["data"].Trim().ToString().Replace("\"", "'"); tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent; tempinfo.bottom = tt; string t = Convert.ToString(Request.Form["bottom"].ToString()).Replace(" ", "");; t = t.Replace("[,", "[").Replace(",]", "]"); if (tempinfo.Invoice_text != null) { bottomttt = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text); } var kk = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext2>(t).item; bottomttt.Bottom_Item = kk; tempinfo.Invoice_text = new EMT.Tools.Serialize().SerializeJson(bottomttt); if (this.tax_sup.Checked) { tempinfo.tax_sup = 1; } else { tempinfo.tax_sup = 0; } if (this.tax_cate.Checked) { tempinfo.tax_cat = 1; } else { tempinfo.tax_cat = 0; } if (this.tax_group.Checked) { tempinfo.tax_group = 1; } else { tempinfo.tax_group = 0; } Session["tempinfo"] = tempinfo; Session["cancel"] = 1; Response.Redirect("InvoiceTempEdit.aspx?id=" + id + "&op=edit"); }
protected void Page_Load(object sender, EventArgs e) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); id = Convert.ToInt64(Request.QueryString["id"]); if (!IsPostBack) { Bind(); if (id > 0) //修改 { var data = new QuoteTemplateBLL().GetQuoteTemplate(id); if (data == null) { Response.Write("<script>alert('获取相关数据失败,返回上一个页面');window.close();self.opener.location.reload();</script>"); } else { this.Name.Text = data.name; this.Description.Text = data.description; if (data.is_active == 1) { this.Active.Checked = true; } if (data.show_each_tax_in_tax_group == 1) { this.show_each_tax_in_tax_group.Checked = true; } if (data.show_each_tax_in_tax_period == 1) { this.show_each_tax_in_tax_period.Checked = true; } if (data.show_tax_cate == 1) { this.show_tax_cate.Checked = true; } if (data.show_tax_cate_superscript == 1) { this.show_tax_cate_superscript.Checked = true; } var data_tax = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.Tax_Total_Disp>(data.tax_total_disp); this.SemiAnnualTotal.Text = data_tax.Semi_Annual_Total; this.IncludingOptionalQuoteItems.Text = data_tax.Including_Optional_Quote_Items; this.ItemTotal.Text = data_tax.Item_Total; this.Subtotal.Text = data_tax.Subtotal; this.Total.Text = data_tax.Total; this.TotalTaxes.Text = data_tax.Total_Taxes; this.YearlySubtotal.Text = data_tax.Yearly_Subtotal; this.YearlyTotal.Text = data_tax.Yearly_Total; this.ShippingTotal.Text = data_tax.Shipping_Total; this.ShippingSubtotal.Text = data_tax.Shipping_Subtotal; this.SemiAnnualSubtotal.Text = data_tax.Semi_Annual_Subtotal; this.QuarterlySubtotal.Text = data_tax.Quarterly_Subtotal; this.QuarterlyTotal.Text = data_tax.Quarterly_Total; this.MonthlySubtotal.Text = data_tax.Monthly_Subtotal; this.OptionalSubtotal.Text = data_tax.Optional_Subtotal; this.OptionalTotal.Text = data_tax.Optional_Total; this.MonthlyTotal.Text = data_tax.Monthly_Total; this.OneTimeDiscountSubtotal.Text = data_tax.One_Time_Discount_Subtotal; this.OneTimeDiscountTotal.Text = data_tax.One_Time_Discount_Total; this.OneTimeSubtotal.Text = data_tax.One_Time_Subtotal; this.OneTimeTotal.Text = data_tax.One_Time_Total; switch (data.page_number_location_id) { case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break; } switch (data.paper_size_id) { case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break; case (int)PAGE_SIZE.A4: this.A4.Checked = true; break; } } } } }
/// <summary> /// 获取页面参数 /// </summary> protected TicketManageDto GetParam() { // 为方便页面处理 owner_resource_id 存储的是 sys_resource_department 的id ,存储时需要转换 long?owner_resource_id = null; long?role_id = null; var priResString = Request.Form["owner_resource_id"]; if (!string.IsNullOrEmpty(priResString)) { var resDep = new sys_resource_department_dal().FindById(long.Parse(priResString)); if (resDep != null) { owner_resource_id = resDep.resource_id; role_id = resDep.role_id; } } TicketManageDto param = new TicketManageDto(); var pageTicket = AssembleModel <sdk_task>(); pageTicket.owner_resource_id = owner_resource_id; pageTicket.role_id = role_id; var dueDate = Request.Form["DueDate"]; var dueTime = Request.Form["DueTime"]; if (!string.IsNullOrEmpty(dueTime) && !string.IsNullOrEmpty(dueDate)) { var dueDateTime = dueDate + " " + dueTime; // 获取到截止时间 var dueD = DateTime.Parse(dueDateTime); pageTicket.estimated_end_time = Tools.Date.DateHelper.ToUniversalTimeStamp(dueD); } else { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('未获取到相关截止时间,请重新填写!');</script>"); return(null); } #region 如果sla设置自动计算截止时间 ,保存时计算出工单的结束时间 if (pageTicket.sla_id != null) { var thisSla = new d_sla_dal().FindNoDeleteById((long)pageTicket.sla_id); if (thisSla != null && thisSla.set_ticket_due_date == 1) { if (pageTicket.sla_start_time == null) { pageTicket.sla_start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); } var slaValue = new sdk_task_dal().GetSlaTime(pageTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue) && slaTimeValue.Substring(0, 1) == "{") { var slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); if (slaDic != null && slaDic.Count > 0) { var duteDateDic = slaDic.FirstOrDefault(_ => _.Key == "截止时间"); if (!default(KeyValuePair <string, object>).Equals(duteDateDic)) { var duteDate = DateTime.Parse(duteDateDic.Value.ToString()); pageTicket.estimated_end_time = Tools.Date.DateHelper.ToUniversalTimeStamp(duteDate); } var firstResponseDateDic = slaDic.FirstOrDefault(_ => _.Key == "响应时间"); if (!default(KeyValuePair <string, object>).Equals(firstResponseDateDic)) { pageTicket.first_response_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(firstResponseDateDic.Value.ToString())); } var resoluTatgetDic = slaDic.FirstOrDefault(_ => _.Key == "解决时间"); if (!default(KeyValuePair <string, object>).Equals(resoluTatgetDic)) { pageTicket.resolution_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(resoluTatgetDic.Value.ToString())); } var resoluPlanTatgetDic = slaDic.FirstOrDefault(_ => _.Key == "解决方案提供时间"); if (!default(KeyValuePair <string, object>).Equals(firstResponseDateDic)) { pageTicket.resolution_plan_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(resoluPlanTatgetDic.Value.ToString())); } } } } } #endregion if (isAdd) { pageTicket.type_id = (int)DTO.DicEnum.TASK_TYPE.SERVICE_DESK_TICKET; param.ticket = pageTicket; } else { #region 获取页面相关值 thisTicket.account_id = pageTicket.account_id; thisTicket.contract_id = pageTicket.contract_id; thisTicket.contact_id = pageTicket.contact_id; thisTicket.status_id = pageTicket.status_id; thisTicket.priority = pageTicket.priority; thisTicket.issue_type_id = pageTicket.issue_type_id; thisTicket.sub_issue_type_id = pageTicket.sub_issue_type_id; thisTicket.source_type_id = pageTicket.source_type_id; thisTicket.estimated_end_time = pageTicket.estimated_end_time; thisTicket.estimated_hours = pageTicket.estimated_hours; thisTicket.sla_id = pageTicket.sla_id; thisTicket.department_id = pageTicket.department_id; thisTicket.owner_resource_id = pageTicket.owner_resource_id; thisTicket.role_id = pageTicket.role_id; thisTicket.installed_product_id = pageTicket.installed_product_id; thisTicket.service_id = pageTicket.service_id; thisTicket.cost_code_id = pageTicket.cost_code_id; thisTicket.purchase_order_no = pageTicket.purchase_order_no; thisTicket.cate_id = pageTicket.cate_id; thisTicket.ticket_type_id = pageTicket.ticket_type_id; thisTicket.title = pageTicket.title; thisTicket.description = pageTicket.description; thisTicket.resolution = pageTicket.resolution; thisTicket.sla_start_time = pageTicket.sla_start_time; thisTicket.estimated_end_time = pageTicket.estimated_end_time; thisTicket.first_response_target_time = pageTicket.first_response_target_time; thisTicket.resolution_target_time = pageTicket.resolution_target_time; thisTicket.resolution_plan_target_time = pageTicket.resolution_plan_target_time; #endregion param.ticket = thisTicket; } param.resDepIds = Request.Form["OtherResId"]; var AddSoule = Request.Form["AddSoule"]; if (AddSoule == "on") { param.isAppSlo = true; } param.completeReason = Request.Form["reason"]; param.repeatReason = Request.Form["RepeatReason"]; #region 检查单相关 var CheckListIds = Request.Form["CheckListIds"]; // 检查单Id if (!string.IsNullOrEmpty(CheckListIds)) { List <CheckListDto> ckList = new List <CheckListDto>(); var checkIdArr = CheckListIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var checkId in checkIdArr) { if (string.IsNullOrEmpty(Request.Form[checkId + "_item_name"])) // 条目名称为空 不添加 { continue; } var is_complete = Request.Form[checkId + "_is_complete"]; var is_import = Request.Form[checkId + "_is_import"]; var sortOrder = Request.Form[checkId + "_sort_order"]; decimal?sort = null; if (!string.IsNullOrEmpty(sortOrder)) { sort = decimal.Parse(sortOrder); } var thisCheck = new CheckListDto() { ckId = long.Parse(checkId), isComplete = is_complete == "on", itemName = Request.Form[checkId + "_item_name"], isImport = is_import == "on", sortOrder = sort, }; ckList.Add(thisCheck); } param.ckList = ckList; } #endregion #region 工单自定义字段,页面暂无自定义 if (tickUdfList != null && tickUdfList.Count > 0) { var list = new List <UserDefinedFieldValue>(); foreach (var udf in tickUdfList) // 循环添加 { var new_udf = new UserDefinedFieldValue() { id = udf.id, value = string.IsNullOrEmpty(Request.Form[udf.id.ToString()]) ? null : Request.Form[udf.id.ToString()], }; list.Add(new_udf); } if (isAdd) { param.udfList = list; } else { param.udfList = ticketUdfValueList; } } #endregion return(param); }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request.QueryString["id"]); // id = 1475; if (!IsPostBack) { if (Session["cancel"] != null && (int)Session["cancel"] != 1) { Session.Remove("tempinfo"); } Session["cancel"] = 0; QuoteTemplateBLL qtb = new QuoteTemplateBLL(); if (Request.QueryString["op"] == null || string.IsNullOrEmpty(Request.QueryString["op"].ToString())) { if (qtb.invoice_used(id) == DTO.ERROR_CODE.ERROR)//判断报价模板是否被引用 { Response.Write("<script>if(confirm('模板被发票引用,如果修改会影响到这些发票。你如果你不想影响这些发票,可以复制一个新的模板,然后对新模板进行修改。是否继续?')==true){}else{window.close();}</script>"); } } //填充数据 var data = qtb.GetQuoteTemplate(id); if (data == null) { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>"); } else { var tempppp = Session["tempinfo"] as InvioceTempDto.TempContent; if (tempppp == null || tempppp.id != id) { tempinfo.id = data.id; tempinfo.name = data.name; //五大部分 tempinfo.head = data.page_header_html; //页眉 tempinfo.top = data.quote_header_html; //头部 tempinfo.body = data.body_html; //主体 tempinfo.bottom = data.quote_footer_html; //底部 tempinfo.foot = data.page_footer_html; //页脚 //bottom税相关 tempinfo.tax_cat = data.show_tax_cate; tempinfo.tax_group = data.show_each_tax_in_tax_group; tempinfo.tax_sup = data.show_tax_cate_superscript; //body分组 tempinfo.body_group_by = data.body_group_by_id == null ? 0 : (int)data.body_group_by_id; tempinfo.body_itemize_id = data.body_itemize_id == null ? 0 : (int)data.body_itemize_id; tempinfo.body_order_by = data.body_order_by_id == null ? 0 : (int)data.body_order_by_id; tempinfo.show_labels_when_grouped = data.show_labels_when_grouped == null ? 0 : (int)data.show_labels_when_grouped; //bottom 合计 if (data.tax_total_disp != null || !string.IsNullOrEmpty(data.tax_total_disp)) { tempinfo.Invoice_text = data.tax_total_disp.Replace("'", "\"");//正文主体 } //底部备注 tempinfo.foot_note = data.quote_footer_notes; Session["tempinfo"] = tempinfo; } else { tempinfo = tempppp; } //页眉 if (!string.IsNullOrEmpty(tempinfo.head)) { this.head.Text = HttpUtility.HtmlDecode(tempinfo.head).Replace("\"", "'"); } //头部 if (!string.IsNullOrEmpty(tempinfo.top)) { this.top.Text = HttpUtility.HtmlDecode(tempinfo.top).Replace("\"", "'"); } //正文body if (string.IsNullOrEmpty(tempinfo.body)) { //填充默认 StringBuilder sb = new StringBuilder(); sb.Append("<table class='ReadOnlyGrid_Table'>"); sb.Append("<tr>"); sb.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left;' width='40px;'>序列号</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>条目创建日期</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Left;'>类型</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>员工姓名</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>计费时间</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>数量</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>费率/成本</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>税率</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>税</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>计费总额</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>小时费率</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>角色</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>工作类型</td>"); sb.Append("</tr>"); for (int i = 0; i < 8; i++) { sb.Append("<tr><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td><td style='text-align:Left;'>占位</td></tr>"); } sb.Append("</table>"); this.body.Text = sb.ToString(); sb.Clear(); } else { var Invoice_Body = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_Body>(tempinfo.body.Replace("'", "\"")); //正文主体 int i = 0; //统计显示的列数 StringBuilder table = new StringBuilder(); table.Append("<table class='ReadOnlyGrid_Table'>"); table.Append("<tr>"); foreach (var coulmn in Invoice_Body.GRID_COLUMN)//获取需要显示的列名 { if (coulmn.Display == "yes") { table.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left; '>" + coulmn.Column_label + "</td>"); i++; } } table.Append("</tr>"); for (int j = 0; j < 8; j++) { table.Append("<tr>"); foreach (var coulmn in Invoice_Body.GRID_COLUMN)//获取需要显示的列名 { if (coulmn.Display == "yes" && coulmn.Column_Content != "条目描述") { table.Append("<td style='text-align: Left;' class='bord'>" + coulmn.Column_Content + "</td>"); } if (coulmn.Display == "yes" && coulmn.Column_Content == "条目描述") { table.Append("<td style='text-align: Left;'class='bord'>" + Invoice_Body.CUSTOMIZE_THE_ITEM_COLUMN[j].Display_Format + "</td>"); } if (Invoice_Body.GRID_OPTIONS[0].Show_vertical_lines == "yes") { Response.Write("<style>.bord{border-left: 1px solid #eaeaea;border-right: 1px solid #eaeaea;}</style>"); } } table.Append("</tr>"); } table.Append("</table>"); this.body.Text = table.ToString(); table.Clear(); } //底部 if (!string.IsNullOrEmpty(tempinfo.bottom)) { this.bottom.Text = HttpUtility.HtmlDecode(tempinfo.bottom.ToString()).Replace("\"", "'"); } //页脚 if (!string.IsNullOrEmpty(tempinfo.foot)) { this.foot.Text = HttpUtility.HtmlDecode(tempinfo.foot.ToString()).Replace("\"", "'"); } } } }
//处理数据 #region 处理需要保存的数据 private bool save_deal() { if (id > 0) { product = pbll.GetProduct(id); } //需要进行唯一性校验 product.name = this.Product_Name.Text.ToString(); string cate, code; //物料 if (!string.IsNullOrEmpty(Request.Form["kkCallBackHidden"].ToString())) { code = Convert.ToString(Request.Form["kkCallBackHidden"]); code = code.TrimEnd(','); product.cost_code_id = Convert.ToInt32(code); } //产品种类 if (Request.Form["accCallBackHidden"] != null && !string.IsNullOrEmpty(Request.Form["accCallBackHidden"].ToString())) { cate = Convert.ToString(Request.Form["accCallBackHidden"]); cate = cate.TrimEnd(','); product.cate_id = Convert.ToInt32(cate); } product.description = this.Product_Description.Text.ToString(); if (!string.IsNullOrEmpty(this.Unit_Cost.Text.ToString())) { product.unit_cost = Convert.ToDecimal(this.Unit_Cost.Text.ToString()); } if (!string.IsNullOrEmpty(this.Unit_Price.Text.ToString())) { product.unit_price = Convert.ToDecimal(this.Unit_Price.Text.ToString()); } if (!string.IsNullOrEmpty(this.MSRP.Text.ToString())) { product.msrp = Convert.ToDecimal(this.MSRP.Text.ToString()); } product.internal_id = this.Internal_Product_ID.Text.ToString(); product.external_id = this.External_Product_ID.Text.ToString(); product.link = this.Product_Link.Text.ToString(); if (this.Item_Type.SelectedValue.ToString() != "0") { product.installed_product_cate_id = Convert.ToInt32(this.Item_Type.SelectedValue.ToString()); } if (this.Period_Type.SelectedValue.ToString() != "0") { product.period_type_id = Convert.ToInt32(this.Period_Type.SelectedValue.ToString()); } if (this.Active.Checked) { product.is_active = 1; } if (this.Serialized.Checked) { product.is_serialized = 1; } if (this.does_not_require_procurement.Checked) { product.does_not_require_procurement = 1; } product.manu_name = this.Manufacturer.Text.ToString(); product.manu_product_no = this.Manufacturer_Product_Number.Text.ToString(); product.sku = this.Product_SKU.Text.ToString(); string t = Request.Form["vendor_data"].ToString(); t = t.Replace("[,", "[").Replace(",]", "]"); var tt = new EMT.Tools.Serialize().DeserializeJson <VendorData>(t); if (product_udfList != null && product_udfList.Count > 0) // 首先判断是否有自定义信息 { udfv_list = new List <UserDefinedFieldValue>(); foreach (var udf in product_udfList) // 循环添加 { var new_udf = new UserDefinedFieldValue() { id = udf.id, value = Request.Form[udf.id.ToString()] == null ? "" : Request.Form[udf.id.ToString()], }; udfv_list.Add(new_udf); } } #endregion //更新 if (id > 0) { var result = pbll.UpdateProductAndVendor(product, tt, udfv_list, GetLoginUserId()); switch (result) { case ERROR_CODE.EXIST: Response.Write("<script>alert(\"已经存在该名称的产品,请修改后保存!\");</script>"); break; //存在相同名称产品 case ERROR_CODE.ERROR: Response.Write("<script>alert(\"保存失败!\");</script>"); break; //操作失败 case ERROR_CODE.USER_NOT_FIND: Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx");; break; //获取操作者信息失败 case ERROR_CODE.SUCCESS: Response.Write("<script>alert(\"产品修改成功!\");</script>"); return(true); //成功 default: Response.Write("<script>alert('异常错误,返回上一级!');window.close();self.opener.location.reload();</script>");; break; //失败 } } //新增 else { var result = pbll.InsertProductAndVendor(product, tt, udfv_list, GetLoginUserId()); switch (result) { case ERROR_CODE.EXIST: Response.Write("<script>alert(\"已经存在该名称的产品,请修改后保存!\");</script>"); break; //存在相同名称产品 case ERROR_CODE.ERROR: Response.Write("<script>alert(\"保存失败!\");</script>"); break; //操作失败 case ERROR_CODE.USER_NOT_FIND: Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx");; break; //获取操作者信息失败 case ERROR_CODE.SUCCESS: Response.Write("<script>alert(\"产品新增成功!\");</script>"); return(true); //成功 default: Response.Write("<script>alert('异常错误,返回上一级!');window.close();self.opener.location.reload();</script>");; break; //失败 } } return(false); }
protected InvioceTempDto.Invoice_ext addset = new InvioceTempDto.Invoice_ext();//扩展字段类型 protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request.QueryString["id"]); if (!IsPostBack) { Bind(); tempinfo = Session["tempinfo"] as InvioceTempDto.TempContent; if (tempinfo != null && tempinfo.id == id) { this.GroupBy.SelectedValue = tempinfo.body_group_by.ToString(); this.SortBy.SelectedValue = tempinfo.body_order_by.ToString(); this.Itemize.SelectedValue = tempinfo.body_itemize_id.ToString(); if (tempinfo.show_labels_when_grouped == 1) { this.ShowLabelsWhenGrouped.Checked = true; } if (!string.IsNullOrEmpty(tempinfo.Invoice_text)) { addset = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_ext>(tempinfo.Invoice_text); } if (!string.IsNullOrEmpty(tempinfo.body)) { tempinfo.body = HttpUtility.HtmlDecode(tempinfo.body); var invoice_body = new EMT.Tools.Serialize().DeserializeJson <InvioceTempDto.Invoice_Body>(tempinfo.body.Replace("'", "\"")); if (invoice_body != null) { StringBuilder html = new StringBuilder(); int i = 0; html.Append(" <script>"); html.Append(" $(document).ready(function () { "); foreach (var column in invoice_body.GRID_COLUMN) { html.Append("$(\".Order\").eq(" + i + ").text(\"" + column.Order + "\");"); html.Append("$(\".Column_Content\").eq(" + i + ").html(\"" + column.Column_Content + "\");"); html.Append("$(\".Column_label\").eq(" + i + ").html(\"" + column.Column_label + "\");"); if (column.Display == "yes") { html.Append("$(\".Display\").eq(" + i + ").addClass(\"CM\");"); } i++; } foreach (var OPTIONS in invoice_body.GRID_OPTIONS) { if (OPTIONS.Show_grid_header != "yes") { html.Append("$(\"#ShowGridHeader\").removeAttr(\"checked\");"); } if (OPTIONS.Show_vertical_lines == "yes") { html.Append("$(\"#ShowVerticalGridlines\").attr(\"checked\",'true');"); } } i = 0; foreach (var ITEM_COLUMN in invoice_body.ADD_THE_ITEM_COLUMN) { html.Append("$(\".add_invoice_type_id\").eq(" + i + ").value=\"" + ITEM_COLUMN.Type_of_Invoice_Item_ID + "\";"); html.Append("$(\".add_Order\").eq(" + i + ").text(\"" + ITEM_COLUMN.Order + "\");"); html.Append("$(\".add_invoice_type_name\").eq(" + i + ").html(\"" + ITEM_COLUMN.Type_of_Invoice_Item + "\");"); html.Append("$(\".add_Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Display_Format + "\");"); if (ITEM_COLUMN.Checked != "yes") { html.Append("$(\".add_Display\").eq(" + i + ").removeClass(\"checked\");"); } else { html.Append("$(\".add_Display\").eq(" + i + ").addClass(\"CM\");"); } i++; } i = 0; foreach (var ITEM_COLUMN in invoice_body.CUSTOMIZE_THE_ITEM_COLUMN) { html.Append("$(\".invoice_type_id\").eq(" + i + ").val(" + ITEM_COLUMN.Type_of_Invoice_Item_ID + ");"); html.Append("$(\".SortOrder\").eq(" + i + ").text(\"" + ITEM_COLUMN.Order + "\");"); html.Append("$(\".invoice_type_name\").eq(" + i + ").html(\"" + ITEM_COLUMN.Type_of_Invoice_Item + "\");"); html.Append("$(\".Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Display_Format + "\");"); html.Append("$(\".Add_Display_Format\").eq(" + i + ").html(\"" + ITEM_COLUMN.Add_Display_Format + "\");"); i++; } html.Append("});</script>"); this.datalist.Text = html.ToString(); //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", html.ToString(), true); html.Clear(); } } else { this.datalist.Text = "<script> $(document).ready(function () {$(\".Display\").children().addClass(\"CM\");});</script>"; } } else { //string myScript = @"$('.Display').children().addClass('CM')"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true); this.datalist.Text = "<script> $(document).ready(function () {$(\".Display\").children().addClass(\"CM\");});</script>"; } } }
protected void Save_Close_Click(object sender, EventArgs e) { long group_udf_id = 0; if (id > 0) {//修改数据 configtype = configtypebll.GetSingleGeneral(id); if (configtype.ext1 != null && !string.IsNullOrEmpty(configtype.ext1.ToString())) { group_udf_id = Convert.ToInt64(configtype.ext1.ToString()); GetGroupudf = ctbll.GetUdfGroup(group_udf_id); } } configtype.name = this.Config_name.Text.ToString(); if (this.Active.Checked) { configtype.is_active = 1; } else { configtype.is_active = 0; } string t = Request.Form["UDFdata"].ToString(); t = t.Replace("[,", "[").Replace(",]", "]"); var tt = new EMT.Tools.Serialize().DeserializeJson <RootDefinedField>(t); if (id > 0) { //修改 var result = ctbll.UpdateConfigType(configtype, tt.UDFGROUP, GetLoginUserId()); if (result == DTO.ERROR_CODE.SUCCESS) { Response.Write("<script>alert('配置类型修改成功!');window.close();self.opener.location.reload();</script>"); } else if (result == DTO.ERROR_CODE.USER_NOT_FIND) { Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx"); } else if (result == DTO.ERROR_CODE.EXIST) { Response.Write("<script>alert('已经存在相同名称,请修改!');</script>"); } else { } } else { var result = ctbll.InsertConfigType(configtype, tt.UDFGROUP, GetLoginUserId()); if (result == DTO.ERROR_CODE.SUCCESS) { Response.Write("<script>alert('配置类型添加成功!');window.close();self.opener.location.reload();</script>"); } else if (result == DTO.ERROR_CODE.USER_NOT_FIND) { Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx"); } else if (result == DTO.ERROR_CODE.EXIST) { Response.Write("<script>alert('已经存在相同名称,请修改!');</script>"); } else { } } }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request.QueryString["id"]); if (!IsPostBack) { if (Session["cancel"] != null && (int)Session["cancel"] != 1) { Cancel1(); } Session["cancel"] = 0; QuoteTemplateBLL qtb = new QuoteTemplateBLL(); if (Request.QueryString["op"] == null || string.IsNullOrEmpty(Request.QueryString["op"].ToString())) { if (qtb.is_quote(id) == DTO.ERROR_CODE.ERROR)//判断报价模板是否被引用 { Response.Write("<script>if(confirm('模板被报价引用,如果修改会影响到这些报价。你如果你不想影响这些报价,可以复制一个新的模板,然后对新模板进行修改。是否继续?')==true){}else{window.close();}</script>"); } } //填充数据 var data = qtb.GetQuoteTemplate(id); if (data == null) { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('获取数据错误!');history.go(-1);</script>"); } else { tempname = data.name; //页眉 if (Session["page_head"] != null && !string.IsNullOrEmpty(Session["page_head"].ToString())) { this.head.Text = HttpUtility.HtmlDecode(Session["page_head"].ToString()).Replace("\"", "'"); } else { if (string.IsNullOrEmpty(data.page_header_html)) { Session["page_head"] = this.head.Text = " "; } else { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { } else { Session["page_head"] = this.head.Text = HttpUtility.HtmlDecode(data.page_header_html).Replace("\"", "'"); } } } //头部 if (Session["quote_head"] != null) { this.top.Text = HttpUtility.HtmlDecode(Session["quote_head"].ToString()).Replace("\"", "'"); } else { if (string.IsNullOrEmpty(data.quote_header_html)) { Session["quote_head"] = this.top.Text = " "; } else { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { } else { Session["quote_head"] = this.top.Text = HttpUtility.HtmlDecode(data.quote_header_html).Replace("\"", "'"); } } } //正文body //正在进行中 string body_json = string.Empty; if (Session["quote_body"] == null || string.IsNullOrEmpty(Session["quote_body"].ToString())) { if (string.IsNullOrEmpty(data.body_html)) { //Session["quote_body"] = "; //填充默认 StringBuilder sb = new StringBuilder(); sb.Append("<table class='ReadOnlyGrid_Table'>"); sb.Append("<tr>"); sb.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left;' width='40px;'>序列号</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>数量</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Left;'>报价项名称</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>单价</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>单元折扣t</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>折后价</td><td class='ReadOnlyGrid_TableHeader' style='text-align: Right;'>总价</td>"); sb.Append("</tr>"); for (int i = 0; i < 8; i++) { sb.Append("<tr><td style='text - align: Left; '>[Quote Item:Number]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Quantity]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Name]<br/>[Quote Item:Item Description]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Unit Price]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Unit Discount]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Adjusted Unit Price]</td><td class='ReadOnlyGrid_TableHeader' style='text - align: Left; '>[Quote Item:Extended Price]</td></tr>"); } sb.Append("</table>"); this.body.Text = sb.ToString(); sb.Clear(); } else { Session["quote_body"] = HttpUtility.HtmlDecode(data.body_html).Replace("\"", "'"); body_json = Session["quote_body"].ToString(); } } else { body_json = Session["quote_body"].ToString(); } if (!string.IsNullOrEmpty(body_json)) { var quote_body = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.BODY>(body_json.Replace("'", "\"")); //正文主体 int i = 0; //统计显示的列数 StringBuilder table = new StringBuilder(); table.Append("<table class='ReadOnlyGrid_Table'>"); table.Append("<tr>"); foreach (var coulmn in quote_body.GRID_COLUMN)//获取需要显示的列名 { if (coulmn.Display == "yes") { table.Append("<td class='ReadOnlyGrid_TableHeader' style='text-align: Left; '>" + coulmn.Column_label + "</td>"); i++; } } table.Append("</tr>"); for (int j = 0; j < 8; j++) { table.Append("<tr>"); foreach (var coulmn in quote_body.GRID_COLUMN)//获取需要显示的列名 { if (coulmn.Display == "yes" && coulmn.Column_Content != "报价项名称") { table.Append("<td style='text-align: Left;' class='bord'>" + coulmn.Column_Content + "</td>"); } if (coulmn.Display == "yes" && coulmn.Column_Content == "报价项名称") { table.Append("<td style='text-align: Left;'class='bord'>" + quote_body.CUSTOMIZE_THE_ITEM_COLUMN[j].Display_Format + "</td>"); } if (quote_body.GRID_OPTIONS[0].Show_vertical_lines == "yes") { Response.Write("<style>.bord{border-left: 1px solid #eaeaea;border-right: 1px solid #eaeaea;}</style>"); } } table.Append("</tr>"); } table.Append("</table>"); this.body.Text = table.ToString(); table.Clear(); } //底部 if (Session["quote_foot"] != null) { this.bottom.Text = HttpUtility.HtmlDecode(Session["quote_foot"].ToString()).Replace("\"", "'"); } else { if (string.IsNullOrEmpty(data.quote_footer_html)) { Session["quote_foot"] = this.bottom.Text = " "; } else { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { } else { Session["quote_foot"] = this.bottom.Text = HttpUtility.HtmlDecode(data.quote_footer_html).Replace("\"", "'"); } } } //页脚 if (Session["page_foot"] != null) { this.foot.Text = HttpUtility.HtmlDecode(Session["page_foot"].ToString()).Replace("\"", "'"); } else { if (string.IsNullOrEmpty(data.page_footer_html)) { Session["page_foot"] = this.foot.Text = " "; } else { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { } else { Session["page_foot"] = this.foot.Text = HttpUtility.HtmlDecode(data.page_footer_html).Replace("\"", "'"); } } } if (Session["page_appendix"] == null || string.IsNullOrEmpty(Session["page_appendix"].ToString())) { if (string.IsNullOrEmpty(data.quote_footer_notes)) { Session["page_appendix"] = " "; } else { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { } else { Session["page_appendix"] = HttpUtility.HtmlDecode(data.quote_footer_notes).Replace("\"", "'"); } } } } } }
/// <summary> /// 绑定数据 /// </summary> public void Bind() { #region 拉框赋值 var dic = new QuoteTemplateBLL().GetField(); // 日期格式 this.DateFormat.DataTextField = "show"; this.DateFormat.DataValueField = "val"; this.DateFormat.DataSource = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value; this.DateFormat.SelectedValue = data.date_display_format_id.ToString(); this.DateFormat.DataBind(); //数字格式 this.NumberFormat.DataTextField = "show"; this.NumberFormat.DataValueField = "val"; this.NumberFormat.DataSource = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value; this.NumberFormat.SelectedValue = data.number_display_format_id.ToString(); this.NumberFormat.DataBind(); //货币格式(正数) this.CurrencyPositivePattern.DataTextField = "show"; this.CurrencyPositivePattern.DataValueField = "val"; this.CurrencyPositivePattern.DataSource = dic.FirstOrDefault(_ => _.Key == "CurrencyPositivePattern").Value; this.CurrencyPositivePattern.SelectedValue = data.currency_positive_format_id.ToString(); this.CurrencyPositivePattern.DataBind(); //货币格式(负数) this.CurrencyNegativePattern.DataTextField = "show"; this.CurrencyNegativePattern.DataValueField = "val"; this.CurrencyNegativePattern.DataSource = dic.FirstOrDefault(_ => _.Key == "CurrencyNegativePattern").Value; this.CurrencyNegativePattern.SelectedValue = data.currency_negative_format_id.ToString(); this.CurrencyNegativePattern.DataBind(); this.Name.Text = data.name; this.Description.Text = data.description; if (data.is_active != 1) { this.Active.Checked = false; } if (data.show_each_tax_in_tax_group == 1) { this.show_each_tax_in_tax_group.Checked = true; } if (data.show_each_tax_in_tax_period == 1) { this.show_each_tax_in_tax_period.Checked = true; k = 1; } if (data.show_tax_cate == 1) { this.show_tax_cate.Checked = true; } if (data.show_tax_cate_superscript == 1) { this.show_tax_cate_superscript.Checked = true; } var data_tax = new EMT.Tools.Serialize().DeserializeJson <QuoteTemplateAddDto.Tax_Total_Disp>(data.tax_total_disp); this.SemiAnnualTotal.Text = data_tax.Semi_Annual_Total; this.IncludingOptionalQuoteItems.Text = data_tax.Including_Optional_Quote_Items; this.ItemTotal.Text = data_tax.Item_Total; this.Subtotal.Text = data_tax.Subtotal; this.Total.Text = data_tax.Total; this.TotalTaxes.Text = data_tax.Total_Taxes; this.YearlySubtotal.Text = data_tax.Yearly_Subtotal; this.YearlyTotal.Text = data_tax.Yearly_Total; this.ShippingTotal.Text = data_tax.Shipping_Total; this.ShippingSubtotal.Text = data_tax.Shipping_Subtotal; this.SemiAnnualSubtotal.Text = data_tax.Semi_Annual_Subtotal; this.QuarterlySubtotal.Text = data_tax.Quarterly_Subtotal; this.QuarterlyTotal.Text = data_tax.Quarterly_Total; this.MonthlySubtotal.Text = data_tax.Monthly_Subtotal; this.OptionalSubtotal.Text = data_tax.Optional_Subtotal; this.OptionalTotal.Text = data_tax.Optional_Total; this.MonthlyTotal.Text = data_tax.Monthly_Total; this.OneTimeDiscountSubtotal.Text = data_tax.One_Time_Discount_Subtotal; this.OneTimeDiscountTotal.Text = data_tax.One_Time_Discount_Total; this.OneTimeSubtotal.Text = data_tax.One_Time_Subtotal; this.OneTimeTotal.Text = data_tax.One_Time_Total; switch (data.page_number_location_id) { case (int)PAGE_NUMBER_LOCATION.NO: this.showNO.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMLEFT: this.showLeft.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMCENTER: this.showCenter.Checked = true; break; case (int)PAGE_NUMBER_LOCATION.BOTTOMRIGHT: this.showRight.Checked = true; break; } switch (data.paper_size_id) { case (int)PAGE_SIZE.LETTER: this.Letter.Checked = true; break; case (int)PAGE_SIZE.A4: this.A4.Checked = true; break; } #endregion }