private void ShowInfo(int _id) { BLL.StoreInOrder bll = new BLL.StoreInOrder(); Model.StoreInOrder model = bll.GetModel(_id); ddlCustomer.SelectedValue = model.CustomerId.ToString(); txtAccountNumber.Text = model.AccountNumber; txtInspectionNumber.Text = model.InspectionNumber; txtBeginChargingTime.Text = model.BeginChargingTime.ToString("yyyy-MM-dd"); txtChargingCount.Text = model.ChargingCount.ToString(); txtSuttleWeight.Text = model.SuttleWeight.ToString("0.00"); txtAdmin.Text = model.Admin; txtRemark.Text = model.Remark; BLL.StoreInUnitPrice unitpriceBLL = new BLL.StoreInUnitPrice(); DataTable unitpriceDT = unitpriceBLL.GetList(" StoreInOrderId = " + _id + "").Tables[0]; this.rptUnitPriceList.DataSource = unitpriceDT; this.rptUnitPriceList.DataBind(); BLL.StoreInCost costBLL = new BLL.StoreInCost(); DataTable costDT = costBLL.GetList(" StoreInOrderId = " + _id + "").Tables[0]; this.rptCostList.DataSource = costDT; this.rptCostList.DataBind(); BLL.StoreInGoods goodsBLL = new BLL.StoreInGoods(); DataTable goodsDT = goodsBLL.GetList(" and A.StoreInOrderId = " + _id + " ").Tables[0]; this.rptGoodsList.DataSource = goodsDT; this.rptGoodsList.DataBind(); }
private void UnitPriceBind(string storeInOrderId) { int _storeInOrderId; DateTime _chargingTime; decimal _chargingCount; DateTime _receivedEndTime = DateTime.Now; DateTime _receivedBeginTime = DateTime.Now; if (int.TryParse(storeInOrderId, out _storeInOrderId) && DateTime.TryParse(txtStoredOutTime.Text, out _chargingTime) && Decimal.TryParse(txtChargingCount.Text, out _chargingCount)) { Model.StoreInOrder storeInOrder = new BLL.StoreInOrder().GetModel(_storeInOrderId); if (storeInOrder == null) { return; } BLL.StoreInUnitPrice unitPriceBLL = new BLL.StoreInUnitPrice(); DataTable unitPriceDT = unitPriceBLL.GetUnitPriceList(_storeInOrderId, storeInOrder.ChargingTime, _chargingTime).Tables[0]; int rowsCount = unitPriceDT.Rows.Count; StringBuilder unitPriceText = new StringBuilder(); decimal totalPrice = 0.00M; for (int i = 0; i < rowsCount; i++) { DateTime beginTime = Convert.ToDateTime(unitPriceDT.Rows[i]["BeginTime"]); DateTime endTime = Convert.ToDateTime(unitPriceDT.Rows[i]["EndTime"]); decimal totalUnitPrice = 0.00M; if (i == 0) { beginTime = storeInOrder.ChargingTime; _receivedBeginTime = beginTime; } if (i == rowsCount - 1) { DateTime et = _chargingTime.AddDays(1); endTime = new DateTime(et.Year, et.Month, et.Day); _receivedEndTime = endTime; } totalUnitPrice = Convert.ToDecimal(unitPriceDT.Rows[i]["Price"]) * (endTime - beginTime).Days * _chargingCount; unitPriceText.AppendFormat("{0}、时间:{1}-{2},天数:{3},单价:{4},数量:{5},费用:{6}\r\n", i + 1, beginTime, endTime, (endTime - beginTime).Days, Convert.ToDecimal(unitPriceDT.Rows[i]["Price"]), _chargingCount, string.Format("{0:N2}", totalUnitPrice)); totalPrice += totalUnitPrice; } txtTotalMoney.Text = string.Format("{0}", totalPrice); txtInvoiceMoney.Text = string.Format("{0}", totalPrice); hidReceivedBeginTime.Value = _receivedBeginTime.ToString(); hidReceivedEndTime.Value = _receivedEndTime.ToString(); txtUnitPriceDetails.Text = unitPriceText.ToString(); } else { txtUnitPriceDetails.Text = "该入库单下没有单价,无法进行结账。"; } }
private void UnitPriceBind(string storeInOrderValue) { string[] storeInOrderValues = storeInOrderValue.Split('|'); int _storeInOrderId; DateTime _chargingTime; decimal _chargingCount; DateTime _receivedEndTime = DateTime.Now; DateTime _receivedBeginTime = DateTime.Now; if (int.TryParse(storeInOrderValues[0], out _storeInOrderId) && DateTime.TryParse(storeInOrderValues[1], out _chargingTime) && Decimal.TryParse(storeInOrderValues[2], out _chargingCount)) { BLL.StoreInUnitPrice unitPriceBLL = new BLL.StoreInUnitPrice(); DataTable unitPriceDT = unitPriceBLL.GetList(0, "StoreInOrderId = " + _storeInOrderId + "", "BeginTime asc").Tables[0]; int rowsCount = unitPriceDT.Rows.Count; StringBuilder unitPriceText = new StringBuilder(); decimal totalPrice = 0.00M; for (int i = 0; i < rowsCount; i++) { DateTime beginTime = Convert.ToDateTime(unitPriceDT.Rows[i]["BeginTime"]); DateTime endTime = Convert.ToDateTime(unitPriceDT.Rows[i]["EndTime"]); decimal totalUnitPrice = 0.00M; if (i == 0) { beginTime = _chargingTime; _receivedBeginTime = beginTime; } if (i == rowsCount - 1) { DateTime et; if (!DateTime.TryParse(txtReceivedTime.Text, out et)) { et = DateTime.Now; } endTime = new DateTime(et.Year, et.Month, et.Day); _receivedEndTime = endTime; } totalUnitPrice = Convert.ToDecimal(unitPriceDT.Rows[i]["Price"]) * (endTime - beginTime).Days * _chargingCount; unitPriceText.AppendFormat("{0}、时间:{1}-{2},天数:{3},单价:{4},数量:{5},费用:{6}\r\n", i + 1, beginTime, endTime, (endTime - beginTime).Days, Convert.ToDecimal(unitPriceDT.Rows[i]["Price"]), _chargingCount, string.Format("{0:N2}", totalUnitPrice)); totalPrice += totalUnitPrice; } txtChargingCount.Text = _chargingCount.ToString("f2"); txtTotalMoney.Text = totalPrice.ToString("f2"); txtInvoiceMoney.Text = totalPrice.ToString("f2"); hidReceivedBeginTime.Value = _receivedBeginTime.ToString(); hidReceivedEndTime.Value = _receivedEndTime.ToString(); txtUnitPriceDetails.Text = unitPriceText.ToString(); } else { txtUnitPriceDetails.Text = "该入库单下没有单价,无法进行结账。"; } }
private void RptBind(string _strWhere, string _orderby) { BLL.StoreInUnitPrice bll = new BLL.StoreInUnitPrice(); this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby); this.rptList.DataBind(); }