Exemple #1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("store_out_order", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.StoreOutOrder bll = new BLL.StoreOutOrder();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除待出库成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("store_out_order.aspx", "customer_id={0}&keyword={1}&beginTime={2}&endTime={3}",
         this.customer_id.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime));
 }
Exemple #2
0
        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();
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("store_out_order", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.StoreOutOrder bll = new BLL.StoreOutOrder();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除待出库成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("store_out_order.aspx", "customer_id={0}&keyword={1}&beginTime={2}&endTime={3}",
                                                                                        this.customer_id.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime));
        }
Exemple #4
0
        private void RptBind(string _strWhere, string _goodsby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.customer_id > 0)
            {
                this.ddlCustomer.SelectedValue = this.customer_id.ToString();
            }
            txtKeyWord.Text   = this.keyword;
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text   = this.endTime;
            BLL.StoreOutOrder bll = new BLL.StoreOutOrder();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _goodsby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("storeout_order_list.aspx", "customer_id={0}&keyword={1}&beginTime={2}&endTime={3}&page={4}",
                                              this.customer_id.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        private void RptBind(string _strWhere, string _goodsby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.customer_id > 0)
            {
                this.ddlCustomer.SelectedValue = this.customer_id.ToString();
            }
            txtKeyWord.Text = this.keyword;
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text = this.endTime;
            BLL.StoreOutOrder bll = new BLL.StoreOutOrder();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _goodsby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("store_out_order.aspx", "customer_id={0}&keyword={1}&beginTime={2}&endTime={3}&page={4}",
                this.customer_id.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        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;
        }