/// <summary> /// 用于详细页面 /// </summary> /// <param name="BuyOrderID"></param> protected void respAjaxforDetail(string BuyOrderID) { List <VBuyOrderDetail> list = new List <VBuyOrderDetail>(); list = Leyp.SQLServerDAL.Buy.Factory.getBuyOrderDetailDAL().getBuyOrderDetailforAjaxString(BuyOrderID); StringBuilder sb = new StringBuilder(); float tatal = float.Parse("0.00"); sb.Append("<table class=\"flexme2\"><thead><tr><th width=\"80\">商品编号</th><th width=\"100\">商品名称</th><th width=\"90\">供应商</th><th width=\"80\">数量 </th><th width=\"80\">采购额</th><th width=\"80\">折扣额 </th><th width=\"80\">税额</th><th width=\"100\">金额 </th></tr>"); sb.Append(" </thead><tbody>"); for (int i = 0; i < list.Count; i++) { VBuyOrderDetail v = new VBuyOrderDetail(); v = list[i]; sb.Append(" <td>" + v.ProductsID + "</td>"); sb.Append(" <td>" + v.ProductsName + "</td>"); sb.Append(" <td>" + v.SupplierName + "</td>"); sb.Append(" <td>" + v.Quantity + "</td>"); sb.Append(" <td>" + v.Price.ToString() + "</td>"); sb.Append(" <td>" + v.DiscountRate.ToString() + "</td>"); sb.Append(" <td>" + v.TaxRate.ToString() + "</td>"); tatal = (v.Quantity * v.Price * (100 + v.TaxRate) / 100) - (v.Quantity * v.Price * v.DiscountRate / 100); sb.Append(" <td>" + tatal.ToString() + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody></table>"); Response.Write(sb.ToString()); Response.End(); }
/// <summary> /// /// </summary> /// <param name="BuyOrderID"></param> protected void respAjax(string BuyOrderID) { List <VBuyOrderDetail> list = new List <VBuyOrderDetail>(); list = Leyp.SQLServerDAL.Buy.Factory.getBuyOrderDetailDAL().getBuyOrderDetailforAjaxString(BuyOrderID); StringBuilder sb = new StringBuilder(); float tatal = float.Parse("0.00"); sb.Append("<table class=\"flexme2\"><thead><tr><th width=\"70\">操作</th><th width=\"80\">商品编号</th><th width=\"100\">商品名称</th><th width=\"90\">供应商</th><th width=\"80\">数量 </th><th width=\"80\">采购额</th><th width=\"80\">折扣额 </th><th width=\"80\">税额</th><th width=\"100\">金额 </th></tr>"); sb.Append(" </thead><tbody>"); for (int i = 0; i < list.Count; i++) { VBuyOrderDetail v = new VBuyOrderDetail(); v = list[i]; sb.Append("<tr><td ><img src=\"../images/tbtn_delete.gif\" onclick=\"javascript:if(!confirm('您确定要删除吗'))return false;deleteDetail(" + v.DetailID + ")\"; /> </td>"); sb.Append(" <td>" + v.ProductsID + "</td>"); sb.Append(" <td>" + v.ProductsName + "</td>"); sb.Append(" <td>" + v.SupplierName + "</td>"); sb.Append(" <td>" + v.Quantity + "</td>"); sb.Append(" <td>" + v.Price.ToString() + "</td>"); sb.Append(" <td>" + v.DiscountRate.ToString() + "</td>"); sb.Append(" <td>" + v.TaxRate.ToString() + "</td>"); tatal = (v.Quantity * v.Price * (100 + v.TaxRate) / 100) - (v.Quantity * v.Price * v.DiscountRate / 100); sb.Append(" <td>" + tatal.ToString() + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody></table>"); Response.Write(sb.ToString()); Response.End(); }
public List <VBuyOrderDetail> getBuyOrderDetailforAjaxString(string BuyOrderID) { string s = ""; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BuyOrderID", SqlDbType.NVarChar) }; parameters[0].Value = BuyOrderID; List <VBuyOrderDetail> list = new List <VBuyOrderDetail>(); SqlDataReader reader = SQLHelper.RunProcedure("p_BuyOrderDetail_getByBuyOrderID", parameters); while (reader.Read()) { VBuyOrderDetail item = new VBuyOrderDetail(); item.DetailID = reader.GetInt32(reader.GetOrdinal("DetailID")); item.Description = reader.GetString(reader.GetOrdinal("Description")); s = reader.GetValue(reader.GetOrdinal("DiscountRate")).ToString(); item.DiscountRate = float.Parse(s); s = reader.GetValue(reader.GetOrdinal("Price")).ToString(); item.Price = float.Parse(s); item.ProductsID = reader.GetInt32(reader.GetOrdinal("ProductsID")); item.ProductsName = reader.GetString(reader.GetOrdinal("ProductsName")); item.Quantity = reader.GetInt32(reader.GetOrdinal("Quantity")); item.SupplierID = reader.GetInt32(reader.GetOrdinal("SupplierID")); item.SupplierName = reader.GetString(reader.GetOrdinal("SupplierName")); s = reader.GetValue(reader.GetOrdinal("TaxRate")).ToString(); item.TaxRate = float.Parse(s); list.Add(item); } reader.Close(); return(list); }