private void ShowInfo(int _id) { BLL.StoreOutOrder bll = new BLL.StoreOutOrder(); Model.StoreOutOrder model = bll.GetModel(_id); ddlStoreInOrder.SelectedValue = model.StoreInOrderId.ToString(); hidReceivedBeginTime.Value = model.BeginChargingTime.ToString(); hidReceivedEndTime.Value = model.EndChargingTime.ToString(); txtUnitPriceDetails.Text = model.UnitPriceDetails; hidCustomerId.Value = model.CustomerId.ToString(); labCustomerName.Text = GetCustomerName(model.CustomerId); txtChargingCount.Text = model.Count.ToString("0.00"); txtTotalMoney.Text = model.TotalMoney.ToString("0.00"); txtInvoiceMoney.Text = model.InvoiceMoney.ToString("0.00"); txtStoredOutTime.Text = model.StoredOutTime.HasValue ? model.StoredOutTime.Value.ToString("yyyy-MM-dd") : ""; txtAdmin.Text = model.Admin; txtRemark.Text = model.Remark; BLL.StoreOutCost costBLL = new BLL.StoreOutCost(); DataTable costDT = costBLL.GetList(" StoreOutOrderId = " + _id + "").Tables[0]; this.rptCostList.DataSource = costDT; this.rptCostList.DataBind(); BLL.StoreOutGoods goodsBLL = new BLL.StoreOutGoods(); DataTable goodsDT = goodsBLL.GetList(" and A.StoreOutOrderId = " + _id + " ").Tables[0]; this.rptGoodsList.DataSource = goodsDT; this.rptGoodsList.DataBind(); }
private bool DoEdit(int _id) { bool result = false; if (string.IsNullOrWhiteSpace(txtStoredOutTime.Text)) { JscriptMsg("出库时间不能为空!", ""); return(false); } BLL.StoreOutOrder bll = new BLL.StoreOutOrder(); Model.StoreOutOrder model = bll.GetModel(_id); model.CustomerId = int.Parse(hidCustomerId.Value); model.StoreInOrderId = int.Parse(ddlStoreInOrder.SelectedValue); model.StoredOutTime = DateTime.Parse(txtStoredOutTime.Text); model.Count = decimal.Parse(txtChargingCount.Text); model.TotalMoney = decimal.Parse(txtTotalMoney.Text); model.InvoiceMoney = decimal.Parse(txtInvoiceMoney.Text); model.BeginChargingTime = DateTime.Parse(hidReceivedBeginTime.Value); model.EndChargingTime = DateTime.Parse(hidReceivedEndTime.Value); model.UnitPriceDetails = txtUnitPriceDetails.Text; model.HasBeenInvoiced = false; model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddStoreOutCost(new StoreOutCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion #region 出库货物 string[] storeOutWaitingGoodsIds = Request.Form.GetValues("StoreOutWaitingGoodsId"); string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId"); string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId"); string[] storeOutCounts = Request.Form.GetValues("StoreOutCount"); string[] storeOutGoodsRemark = Request.Form.GetValues("StoreOutGoodsRemark"); if (storeOutWaitingGoodsIds != null && storeInOrderIds != null && storeOutCounts != null && storeOutGoodsRemark != null && storeOutWaitingGoodsIds.Length > 0 && storeInOrderIds.Length > 0 && storeOutCounts.Length > 0 && storeOutGoodsRemark.Length > 0) { for (int i = 0; i < storeOutWaitingGoodsIds.Length; i++) { int storeOutWaitingGoodsId, storeInOrderId, storeInGoodsId; decimal storeOutCount; if (int.TryParse(storeOutWaitingGoodsIds[i], out storeOutWaitingGoodsId) && int.TryParse(storeInOrderIds[i], out storeInOrderId) && int.TryParse(storeInGoodsIds[i], out storeInGoodsId) && decimal.TryParse(storeOutCounts[i], out storeOutCount)) { model.AddStoreOutGoods(new StoreOutGoods(storeInOrderId, storeInGoodsId, storeOutWaitingGoodsId, storeOutCount, storeOutGoodsRemark[i])); } } } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改出库单信息:" + model.Id); //记录日志 result = true; } return(result); }
private bool DoEdit(int _id) { bool result = false; if (string.IsNullOrWhiteSpace(txtStoredOutTime.Text)) { JscriptMsg("出库时间不能为空!", ""); return false; } BLL.StoreOutOrder bll = new BLL.StoreOutOrder(); Model.StoreOutOrder model = bll.GetModel(_id); model.CustomerId = int.Parse(hidCustomerId.Value); model.StoreInOrderId = int.Parse(ddlStoreInOrder.SelectedValue); model.StoredOutTime = DateTime.Parse(txtStoredOutTime.Text); model.Count = decimal.Parse(txtChargingCount.Text); model.TotalMoney = decimal.Parse(txtTotalMoney.Text); model.InvoiceMoney = decimal.Parse(txtInvoiceMoney.Text); model.BeginChargingTime = DateTime.Parse(hidReceivedBeginTime.Value); model.EndChargingTime = DateTime.Parse(hidReceivedEndTime.Value); model.UnitPriceDetails = txtUnitPriceDetails.Text; model.HasBeenInvoiced = false; model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddStoreOutCost(new StoreOutCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion #region 出库货物 string[] storeOutWaitingGoodsIds = Request.Form.GetValues("StoreOutWaitingGoodsId"); string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId"); string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId"); string[] storeOutCounts = Request.Form.GetValues("StoreOutCount"); string[] storeOutGoodsRemark = Request.Form.GetValues("StoreOutGoodsRemark"); if (storeOutWaitingGoodsIds != null && storeInOrderIds != null && storeOutCounts != null && storeOutGoodsRemark != null && storeOutWaitingGoodsIds.Length > 0 && storeInOrderIds.Length > 0 && storeOutCounts.Length > 0 && storeOutGoodsRemark.Length > 0) { for (int i = 0; i < storeOutWaitingGoodsIds.Length; i++) { int storeOutWaitingGoodsId, storeInOrderId, storeInGoodsId; decimal storeOutCount; if (int.TryParse(storeOutWaitingGoodsIds[i], out storeOutWaitingGoodsId) && int.TryParse(storeInOrderIds[i], out storeInOrderId) && int.TryParse(storeInGoodsIds[i], out storeInGoodsId) && decimal.TryParse(storeOutCounts[i], out storeOutCount)) { model.AddStoreOutGoods(new StoreOutGoods(storeInOrderId, storeInGoodsId, storeOutWaitingGoodsId, storeOutCount, storeOutGoodsRemark[i])); } } } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改出库单信息:" + model.Id); //记录日志 result = true; } return result; }