/// <summary> /// 新增合同时添加服务包 /// </summary> /// <param name="context"></param> /// <param name="id"></param> public void AddServiceBundle(HttpContext context, long id) { var serBun = new ivt_service_bundle_dal().FindById(id); string txt = ""; decimal pricePerPeriod = 0; int monthsPerPeriod = 1; List <object> result = new List <object>(); if (serBun == null) { result.Add(txt); result.Add(pricePerPeriod); context.Response.Write(new Tools.Serialize().SerializeJson(result)); return; } // 获取供应商名称 string vendorName = ""; if (serBun.vendor_account_id != null) { var vendorDal = new ivt_product_vendor_dal(); var accountDal = new crm_account_dal(); var vendor = vendorDal.FindById((long)serBun.vendor_account_id); if (vendor.vendor_account_id != null) { vendorName = accountDal.FindById((long)vendor.vendor_account_id).name; } } // 周期 string period = ""; if (serBun.period_type_id != null) { period = new GeneralBLL().GetGeneralName((int)serBun.period_type_id); if (serBun.unit_price == null) { pricePerPeriod = 0; } else { pricePerPeriod = (decimal)serBun.unit_price; } if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.QUARTER) { monthsPerPeriod = 3; } if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.HALFYEAR) { monthsPerPeriod = 6; } if (serBun.period_type_id == (int)DicEnum.QUOTE_ITEM_PERIOD_TYPE.YEAR) { monthsPerPeriod = 12; } } string unitCost = ""; if (serBun.unit_cost != null) { unitCost = "¥" + serBun.unit_cost.ToString(); } txt += $"<tr id='service{serBun.id}'>"; txt += $"<td style='white - space:nowrap; '><img src = '../Images/delete.png' onclick='RemoveServiceBundle({serBun.id})' alt = '' /></ td > "; txt += $"<td><span>{serBun.name}</span></td>"; txt += $"<td nowrap>{vendorName}</td>"; txt += $"<td nowrap><span>{period}</span><input type='hidden' id='period{serBun.id}' value='{monthsPerPeriod}' ></td>"; txt += $"<td nowrap align='right'><span>{unitCost}</span></td>"; txt += $"<td nowrap align='right'>" + $"<input type='text' onblur='CalcService()' id='price{serBun.id}' name='price{serBun.id}' value = '{pricePerPeriod}' >" + "</ td > "; txt += $"<td nowrap align='right'>" + $"<input type='text' onblur='CalcService()' id='num{serBun.id}' name='num{serBun.id}' value = '1' >" + "</ td > "; txt += $"<td nowrap align='right'>¥" + $"<input type='text' id='pricenum{serBun.id}' value = '{pricePerPeriod}' disabled >" + "</ td > "; txt += "</tr>"; result.Add(txt); result.Add(pricePerPeriod); result.Add(serBun.id); result.Add(monthsPerPeriod); context.Response.Write(new Tools.Serialize().SerializeJson(result)); }