public bool insertSalesDetailFrist(string SalesOrderID, string SalesOutID) { try { List <VSalesDetail> list = new List <VSalesDetail>(); SalesOutDetailDAL ldal = new SalesOutDetailDAL(); list = new SalesDetailDAL().getBySalesOrderID(SalesOrderID); for (int i = 0; i < list.Count; i++) { SalesOutDetail b = new SalesOutDetail(); VSalesDetail detail2 = list[i]; b.ProductsID = detail2.ProductsID; b.Quantity = detail2.Quantity; b.SalesOutID = SalesOutID; b.DiscountRate = detail2.DiscountRate; b.Description = detail2.Description; b.Price = detail2.Price; ldal.insertNewEitity(b); } return(true); } catch { return(false); } }
public List <VSalesDetail> getBySalesOrderID(string SalesOrderID) { string s = ""; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@SalesOrderID", SqlDbType.NVarChar) }; parameters[0].Value = SalesOrderID; List <VSalesDetail> list = new List <VSalesDetail>(); SqlDataReader reader = SQLHelper.RunProcedure("p_SalesDetail_getBySalesOrderID", parameters); while (reader.Read()) { VSalesDetail item = new VSalesDetail(); 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")); list.Add(item); } reader.Close(); return(list); }
/// <summary> /// 加载全部 /// </summary> /// <param name="ReceiptOrderID"></param> protected void loadinit0(string SalesOrderID) { List <VSalesDetail> list = new List <VSalesDetail>(); list = Leyp.SQLServerDAL.Sales.Factory.getSalesDetailDAL().getBySalesOrderID(SalesOrderID); float tatal = float.Parse("0.00"); StringBuilder sb = new StringBuilder(); sb.Append("<TABLE id=MyDataGrid class=\"MyDataGrid\"borderColor=black cellSpacing=0 cellPadding=0 rules=all align=center border=1><TBODY><TR style=\"FONT-WEIGHT: bold; BACKGROUND-COLOR: #b9c6ff\" align=middle><TD>操作</TD><TD>商品编号</TD><TD align=middle>商品名称</TD><TD align=middle> 数量</TD><TD align=middle>价格</TD><TD align=middle>折扣率</TD><TD align=middle>金额小计</TD></TR>"); //sb.Append(" </thead><tbody>"); for (int i = 0; i < list.Count; i++) { VSalesDetail v = new VSalesDetail(); v = list[i]; sb.Append("<TR onMouseOver=\"this.className='onmouseover'\" onmouseout=\"this.className=''\"><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.Quantity + "</td>"); sb.Append(" <td>" + v.Price.ToString() + "</td>"); sb.Append(" <td>" + v.DiscountRate.ToString() + "</td>"); tatal = v.Quantity * v.Price - (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> /// 明细单加载detail全部 /// </summary> /// <param name="ReceiptOrderID"></param> protected void loadinit1(string SalesOrderID) { List <VSalesDetail> list = new List <VSalesDetail>(); list = Leyp.SQLServerDAL.Sales.Factory.getSalesDetailDAL().getBySalesOrderID(SalesOrderID); float tatal = float.Parse("0.00"); StringBuilder sb = new StringBuilder(); sb.Append("<TABLE id=MyDataGrid class=\"MyDataGrid\"borderColor=black cellSpacing=0 cellPadding=0 rules=all align=center border=1><TBODY><TR style=\"FONT-WEIGHT: bold; BACKGROUND-COLOR: #b9c6ff\" align=middle><TD>商品编号</TD><TD align=middle>商品名称</TD><TD align=middle> 数量</TD><TD align=middle>价格</TD><TD align=middle>折扣率</TD><TD align=middle>金额小计</TD></TR>"); //sb.Append(" </thead><tbody>"); for (int i = 0; i < list.Count; i++) { VSalesDetail v = new VSalesDetail(); v = list[i]; sb.Append("<TR>"); sb.Append(" <td>" + v.ProductsID + "</td>"); sb.Append(" <td>" + v.ProductsName + "</td>"); sb.Append(" <td>" + v.Quantity + "</td>"); sb.Append(" <td>" + v.Price.ToString() + "</td>"); sb.Append(" <td>" + v.DiscountRate.ToString() + "</td>"); tatal = v.Quantity * v.Price - (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="ReceiptOrderID"></param> protected void loadinit(string SalesOrderID) { List <VSalesDetail> list = new List <VSalesDetail>(); list = Leyp.SQLServerDAL.Sales.Factory.getSalesDetailDAL().getBySalesOrderID(SalesOrderID); float tatal = float.Parse("0.00"); StringBuilder sb = new StringBuilder(); sb.Append("<table class=\"flexme2\"><thead><tr><th width=\"80\">商品编号</th><th width=\"100\">商品名称</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++) { VSalesDetail v = new VSalesDetail(); v = list[i]; sb.Append("<tr>"); sb.Append(" <td>" + v.ProductsID + "</td>"); sb.Append(" <td>" + v.ProductsName + "</td>"); sb.Append(" <td>" + v.Quantity + "</td>"); sb.Append(" <td>" + v.Price.ToString() + "</td>"); sb.Append(" <td>" + v.DiscountRate.ToString() + "</td>"); tatal = v.Quantity * v.Price - (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 float getInitTotal(string SalesOrderID) { float num = float.Parse("0.00"); List <VSalesDetail> list = this.getBySalesOrderID(SalesOrderID); for (int i = 0; i < list.Count; i++) { VSalesDetail detail = list[i]; num += (detail.Quantity * detail.Price) * (1f - (detail.DiscountRate / 100f)); } return(num); }
/// <summary> /// /// </summary> /// <param name="SalesOrderID"></param> private void getQuantity(string SalesOrderID) { int num = 0; List <VSalesDetail> list = Leyp.SQLServerDAL.Sales.Factory.getSalesDetailDAL().getBySalesOrderID(SalesOrderID); for (int i = 0; i < list.Count; i++) { VSalesDetail v = list[i]; num = num + v.Quantity; } Response.Write(num.ToString()); Response.End(); }
//得到订单总价 private void getTotalPrice(string SalesOrderID) { float price = float.Parse("0.00"); float tatal = float.Parse("0.00"); List <VSalesDetail> list = Leyp.SQLServerDAL.Sales.Factory.getSalesDetailDAL().getBySalesOrderID(SalesOrderID); for (int i = 0; i < list.Count; i++) { VSalesDetail v = list[i]; price = v.Quantity * v.Price - (v.Quantity * v.Price * v.DiscountRate / 100); tatal = tatal + price; } Response.Write(tatal.ToString()); Response.End(); }