示例#1
0
        protected void btnAudit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("store_in_order", DTEnums.ActionEnum.Confirm.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.StoreInOrder bll = new BLL.StoreInOrder();
            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.UpdateField("id = " + id + " and Status = 1", "Status=2") > 0)
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "入库单审核成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("入库单审核成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("store_in_order.aspx", "customer_id={0}&status={1}&keyword={2}&beginTime={3}&endTime={4}",
                                                                                           this.customer_id.ToString(), this.status.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime));
        }
示例#2
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();
            }
            if (this.status > -1)
            {
                this.ddlStatus.SelectedValue = this.status.ToString();
            }
            txtKeyWord.Text   = this.keyword;
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text   = this.endTime;
            BLL.StoreInOrder bll = new BLL.StoreInOrder();
            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_in_order.aspx", "customer_id={0}&status={1}&keyword={2}&beginTime={3}&endTime={4}&page={5}",
                                              this.customer_id.ToString(), this.status.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
示例#3
0
 //审核通过
 protected void btnOK_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("storein_storage_order", DTEnums.ActionEnum.Confirm.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.StoreInOrder bll = new BLL.StoreInOrder();
     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.UpdateField("id = " + id + " and Status = 0", "Status=1") > 0)
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "确认入库单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("确认入库单成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("storein_storage_order.aspx", "customer_id={0}&status={1}&keyword={2}&beginTime={3}&endTime={4}",
         this.customer_id.ToString(),this.status.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime));
 }
        private void TreeBind(string strWhere)
        {
            BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
            DataTable        storeInOrderDT  = storeInOrderBLL.GetList(0, "Status = 2 ", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("入库单号", ""));
            foreach (DataRow dr in storeInOrderDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }

            BLL.Goods goodsBLL = new BLL.Goods();
            DataTable goodsDT  = goodsBLL.GetList(0, strWhere, "Id desc").Tables[0];

            this.ddlGoods.Items.Clear();
            this.ddlGoods.Items.Add(new ListItem("货物", ""));
            foreach (DataRow dr in goodsDT.Rows)
            {
                this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString()));
            }

            BLL.Store storeBLL = new BLL.Store();
            DataTable storeDT  = storeBLL.GetAllList().Tables[0];

            storeOptions += "<option value='0'>选择仓库</option>";
            foreach (DataRow dr in storeDT.Rows)
            {
                storeOptions += "<option value='" + dr["Id"] + "'>" + dr["Name"] + "</option>";
            }
        }
示例#5
0
        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();
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("storein_order", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.StoreInOrder bll = new BLL.StoreInOrder();
            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("storein_order_list.aspx", "customer_id={0}&keyword={1}&beginTime={2}&endTime={3}",
                                                                                        this.customer_id.ToString(), this.keyword.ToString(), this.beginTime.ToString(), this.endTime));
        }
示例#7
0
        private string GetAccountNumber(int storeInOrderId)
        {
            Model.StoreInOrder storeInOrder = new BLL.StoreInOrder().GetModel(storeInOrderId);
            if (storeInOrder != null)
            {
                return(storeInOrder.AccountNumber);
            }

            return("");
        }
示例#8
0
        private void TreeBind(string strWhere)
        {
            BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
            DataTable        storeInOrderDT  = storeInOrderBLL.GetList(0, "Status = 2", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("选择入库单", ""));
            foreach (DataRow dr in storeInOrderDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }
        }
        private void StoreInOrderBind(string customerId)
        {
            int _customerId;

            if (int.TryParse(customerId, out _customerId))
            {
                BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
                DataTable        storeInOrderDT  = storeInOrderBLL.GetList(0, " CustomerId = " + _customerId + " and Status = 2 ", "Id desc").Tables[0];

                this.ddlCustomer.Items.Clear();
                this.ddlCustomer.Items.Add(new ListItem("入库单", ""));
                foreach (DataRow dr in storeInOrderDT.Rows)
                {
                    this.ddlCustomer.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
                }
            }
        }
        private void StoreInOrderBind(string customerId)
        {
            int _customerId;

            if (int.TryParse(customerId, out _customerId))
            {
                BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
                DataTable        storeInOrderDT  = storeInOrderBLL.GetList(0, " CustomerId = " + _customerId + " and Status = 2 ", "Id desc").Tables[0];

                this.ddlSotreInOrder.Items.Clear();
                this.ddlSotreInOrder.Items.Add(new ListItem("选择入库单", ""));
                foreach (DataRow dr in storeInOrderDT.Rows)
                {
                    string chargingTime = dr["ChargingTime"].ToString();
                    string itemText     = string.Format("{0}(收费时间:{1})", dr["AccountNumber"].ToString(), chargingTime);
                    this.ddlSotreInOrder.Items.Add(new ListItem(itemText, string.Format("{0}|{1}|{2}", dr["Id"].ToString(), chargingTime, dr["ChargingCount"])));
                }
            }
        }
        private void TreeBind(string strWhere)
        {
            BLL.StoreInOrder customerBLL = new BLL.StoreInOrder();
            DataTable        customerDT  = customerBLL.GetList(0, " Status = 2 ", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("入库单", ""));
            foreach (DataRow dr in customerDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }

            BLL.StoreInGoods goodsBLL = new BLL.StoreInGoods();
            DataTable        goodsDT  = goodsBLL.GetSelectList(0, strWhere, "Id desc").Tables[0];

            this.ddlStoreInGoods.Items.Clear();
            this.ddlStoreInGoods.Items.Add(new ListItem("入库货物", ""));
            foreach (DataRow dr in goodsDT.Rows)
            {
                this.ddlStoreInGoods.Items.Add(new ListItem(dr["GoodsName"].ToString(), dr["Id"].ToString()));
            }
        }
示例#12
0
        private void StoreInOrderBind(string customerId)
        {
            int _customerId;
            if (int.TryParse(customerId, out _customerId))
            {
                BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
                DataTable storeInOrderDT = storeInOrderBLL.GetList(0, " CustomerId = " + _customerId + " and Status = 2 ", "Id desc").Tables[0];

                this.ddlCustomer.Items.Clear();
                this.ddlCustomer.Items.Add(new ListItem("入库单", ""));
                foreach (DataRow dr in storeInOrderDT.Rows)
                {
                    this.ddlCustomer.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
                }
            }
        }
示例#13
0
        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 TreeBind(string strWhere)
        {
            BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
            DataTable storeInOrderDT = storeInOrderBLL.GetList(0, "Status = 2 ", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("入库单号", ""));
            foreach (DataRow dr in storeInOrderDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }

            BLL.Goods goodsBLL = new BLL.Goods();
            DataTable goodsDT = goodsBLL.GetList(0, strWhere, "Id desc").Tables[0];

            this.ddlGoods.Items.Clear();
            this.ddlGoods.Items.Add(new ListItem("货物", ""));
            foreach (DataRow dr in goodsDT.Rows)
            {
                this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString()));
            }

            BLL.Store storeBLL = new BLL.Store();
            DataTable storeDT = storeBLL.GetAllList().Tables[0];
            storeOptions += "<option value='0'>选择仓库</option>";
            foreach (DataRow dr in storeDT.Rows)
            {
                storeOptions += "<option value='" + dr["Id"] + "'>" + dr["Name"] + "</option>";
            }
        }
示例#15
0
        private string GetAccountNumber(int storeInOrderId)
        {
            Model.StoreInOrder storeInOrder = new BLL.StoreInOrder().GetModel(storeInOrderId);
            if (storeInOrder != null)
            {
                return storeInOrder.AccountNumber;
            }

            return "";
        }
示例#16
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();
            }
            if (this.status > -1)
            {
                this.ddlStatus.SelectedValue = this.status.ToString();
            }
            txtKeyWord.Text = this.keyword;
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text = this.endTime;
            BLL.StoreInOrder bll = new BLL.StoreInOrder();
            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("storein_storage_order.aspx", "customer_id={0}&status={1}&keyword={2}&beginTime={3}&endTime={4}&page={5}",
                this.customer_id.ToString(), this.status.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.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 bool DoEdit(int _id)
        {
            bool result = false;
            if (string.IsNullOrWhiteSpace(txtBeginChargingTime.Text))
            {
                JscriptMsg("实际入库时间不能为空!", "");
                return false;
            }
            BLL.StoreInOrder bll = new BLL.StoreInOrder();
            Model.StoreInOrder model = bll.GetModel(_id);

            model.CustomerId = int.Parse(ddlCustomer.SelectedValue);
            model.BeginChargingTime = DateTime.Parse(txtBeginChargingTime.Text);
            model.ChargingTime = new DateTime(model.BeginChargingTime.Year, model.BeginChargingTime.Month, model.BeginChargingTime.Day + 1);
            model.AccountNumber = txtAccountNumber.Text;
            model.InspectionNumber = txtInspectionNumber.Text;
            model.ChargingCount = decimal.Parse(txtChargingCount.Text);
            model.SuttleWeight = decimal.Parse(txtSuttleWeight.Text);
            model.Admin = txtAdmin.Text;
            model.Remark = txtRemark.Text;
            //model.Status = 1;
            //model.CreateTime = DateTime.Now;

            #region 单价
            string[] unitpriceBeginTime = Request.Form.GetValues("UnitpriceBeginTime");
            string[] unitpriceEndTime = Request.Form.GetValues("UnitpriceEndTime");
            string[] unitprice = Request.Form.GetValues("Unitprice");
            string[] unitpriceRemark = Request.Form.GetValues("UnitpriceRemark");

            if (unitpriceBeginTime != null && unitpriceEndTime != null && unitprice != null && unitpriceRemark != null
                && unitpriceBeginTime.Length > 0 && unitpriceEndTime.Length > 0 && unitprice.Length > 0 && unitpriceRemark.Length > 0)
            {
                for (int i = 0; i < unitpriceBeginTime.Length; i++)
                {
                    decimal price;
                    DateTime begintime, endtime;
                    if (string.IsNullOrWhiteSpace(unitpriceBeginTime[i]))
                    {
                        unitpriceBeginTime[i] = DTDateTime.MinDateTime.ToString();
                    }
                    if (string.IsNullOrWhiteSpace(unitpriceEndTime[i]))
                    {
                        unitpriceEndTime[i] = DTDateTime.MaxDateTime.ToString();
                    }
                    if (DateTime.TryParse(unitpriceBeginTime[i], out begintime) && DateTime.TryParse(unitpriceEndTime[i], out endtime)
                        && decimal.TryParse(unitprice[i], out price))
                    {
                        model.AddUnitPrice(new StoreInUnitPrice(begintime, endtime, price, unitpriceRemark[i]));
                    }
                }
            }
            #endregion

            #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.AddStoreInCost(new StoreInCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], ""));
                    }
                }
            }
            #endregion

            #region 入库货物
            string[] storeWaitingGoodsIds = Request.Form.GetValues("StoreWaitingGoodsId");
            string[] customerIds = Request.Form.GetValues("CustomerId");
            string[] goodsIds = Request.Form.GetValues("GoodsId");
            string[] storeIds = Request.Form.GetValues("StoreId");
            string[] storeInCounts = Request.Form.GetValues("Count");
            string[] storeInGoodsRemark = Request.Form.GetValues("StoreInGoodsRemark");
            if (storeWaitingGoodsIds != null && customerIds != null && storeIds != null && storeInCounts != null && storeInGoodsRemark != null
                && storeWaitingGoodsIds.Length > 0 && customerIds.Length > 0 && storeIds.Length > 0 && storeInCounts.Length > 0 && storeInGoodsRemark.Length > 0)
            {
                for (int i = 0; i < storeWaitingGoodsIds.Length; i++)
                {
                    int storeWaitingGoodsId, customerId, storeId, goodsId;
                    decimal storeInCount;
                    if (int.TryParse(storeWaitingGoodsIds[i], out storeWaitingGoodsId) && int.TryParse(customerIds[i], out customerId)
                        && int.TryParse(storeIds[i], out storeId) && decimal.TryParse(storeInCounts[i], out storeInCount)
                        && int.TryParse(goodsIds[i], out goodsId))
                    {
                        model.AddStoreInGoods(new StoreInGoods(storeId, storeWaitingGoodsId, customerId, goodsId, storeInCount, storeInGoodsRemark[i]));
                    }
                }
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改入库单信息:" + model.AccountNumber); //记录日志
                result = true;
            }

            return result;
        }
示例#19
0
        private void TreeBind(string strWhere)
        {
            BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
            DataTable storeInOrderDT = storeInOrderBLL.GetList(0, "Status > 1", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("选择入库单", ""));
            foreach (DataRow dr in storeInOrderDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }
        }
示例#20
0
        private void TreeBind(string strWhere)
        {
            BLL.StoreInOrder storeinOrderBLL = new BLL.StoreInOrder();
            DataTable customerDT = storeinOrderBLL.GetList(0, " Status = 2 ", "Id desc").Tables[0];

            this.ddlStoreInOrder.Items.Clear();
            this.ddlStoreInOrder.Items.Add(new ListItem("所属入库单", ""));
            foreach (DataRow dr in customerDT.Rows)
            {
                this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString()));
            }

            BLL.Goods goodsBLL = new BLL.Goods();
            DataTable goodsDT = goodsBLL.GetList(0, strWhere, "Id desc").Tables[0];

            this.ddlGoods.Items.Clear();
            this.ddlGoods.Items.Add(new ListItem("货物", ""));
            foreach (DataRow dr in goodsDT.Rows)
            {
                this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString()));
            }
        }
示例#21
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.StoreInOrder   bll   = new BLL.StoreInOrder();
            Model.StoreInOrder model = bll.GetModel(_id);

            model.CustomerId        = int.Parse(ddlCustomer.SelectedValue);
            model.BeginChargingTime = DateTime.Parse(txtBeginChargingTime.Text);
            model.ChargingTime      = new DateTime(model.BeginChargingTime.Year, model.BeginChargingTime.Month, model.BeginChargingTime.Day + 1);
            model.AccountNumber     = txtAccountNumber.Text;
            model.InspectionNumber  = txtInspectionNumber.Text;
            model.ChargingCount     = decimal.Parse(txtChargingCount.Text);
            model.SuttleWeight      = decimal.Parse(txtSuttleWeight.Text);
            model.Admin             = txtAdmin.Text;
            model.Remark            = txtRemark.Text;
            model.Status            = 0;
            model.CreateTime        = DateTime.Now;

            #region 单价
            string[] unitpriceBeginTime = Request.Form.GetValues("UnitpriceBeginTime");
            string[] unitpriceEndTime   = Request.Form.GetValues("UnitpriceEndTime");
            string[] unitprice          = Request.Form.GetValues("Unitprice");
            string[] unitpriceRemark    = Request.Form.GetValues("UnitpriceRemark");

            if (unitpriceBeginTime != null && unitpriceEndTime != null && unitprice != null && unitpriceRemark != null &&
                unitpriceBeginTime.Length > 0 && unitpriceEndTime.Length > 0 && unitprice.Length > 0 && unitpriceRemark.Length > 0)
            {
                for (int i = 0; i < unitpriceBeginTime.Length; i++)
                {
                    decimal  price;
                    DateTime begintime, endtime;
                    if (string.IsNullOrWhiteSpace(unitpriceBeginTime[i]))
                    {
                        unitpriceBeginTime[i] = DTDateTime.MinDateTime.ToString();
                    }
                    if (string.IsNullOrWhiteSpace(unitpriceEndTime[i]))
                    {
                        unitpriceEndTime[i] = DTDateTime.MaxDateTime.ToString();
                    }
                    if (DateTime.TryParse(unitpriceBeginTime[i], out begintime) && DateTime.TryParse(unitpriceEndTime[i], out endtime) &&
                        decimal.TryParse(unitprice[i], out price))
                    {
                        model.AddUnitPrice(new StoreInUnitPrice(begintime, endtime, price, unitpriceRemark[i]));
                    }
                }
            }
            #endregion

            #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.AddStoreInCost(new StoreInCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], ""));
                    }
                }
            }
            #endregion

            #region 入库货物
            string[] storeWaitingGoodsIds = Request.Form.GetValues("StoreWaitingGoodsId");
            string[] customerIds          = Request.Form.GetValues("CustomerId");
            string[] goodsIds             = Request.Form.GetValues("GoodsId");
            string[] storeIds             = Request.Form.GetValues("StoreId");
            string[] storeInCounts        = Request.Form.GetValues("Count");
            string[] storeInGoodsRemark   = Request.Form.GetValues("StoreInGoodsRemark");
            if (storeWaitingGoodsIds != null && customerIds != null && storeIds != null && storeInCounts != null && storeInGoodsRemark != null &&
                storeWaitingGoodsIds.Length > 0 && customerIds.Length > 0 && storeIds.Length > 0 && storeInCounts.Length > 0 && storeInGoodsRemark.Length > 0)
            {
                for (int i = 0; i < storeWaitingGoodsIds.Length; i++)
                {
                    int     storeWaitingGoodsId, customerId, storeId, goodsId;
                    decimal storeInCount;
                    if (int.TryParse(storeWaitingGoodsIds[i], out storeWaitingGoodsId) && int.TryParse(customerIds[i], out customerId) &&
                        int.TryParse(storeIds[i], out storeId) && decimal.TryParse(storeInCounts[i], out storeInCount) &&
                        int.TryParse(goodsIds[i], out goodsId))
                    {
                        model.AddStoreInGoods(new StoreInGoods(storeId, storeWaitingGoodsId, customerId, goodsId, storeInCount, storeInGoodsRemark[i]));
                    }
                }
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改入库单信息:" + model.AccountNumber); //记录日志
                result = true;
            }

            return(result);
        }
示例#22
0
        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 = "该入库单下没有单价,无法进行结账。";
            }
        }
示例#23
0
        private void StoreInOrderBind(string customerId)
        {
            int _customerId;
            if (int.TryParse(customerId, out _customerId))
            {
                BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder();
                DataTable storeInOrderDT = storeInOrderBLL.GetList(0, " CustomerId = " + _customerId + " and Status = 2 ", "Id desc").Tables[0];

                this.ddlSotreInOrder.Items.Clear();
                this.ddlSotreInOrder.Items.Add(new ListItem("选择入库单", ""));
                foreach (DataRow dr in storeInOrderDT.Rows)
                {
                    string chargingTime = dr["ChargingTime"].ToString();
                    string itemText = string.Format("{0}(收费时间:{1})", dr["AccountNumber"].ToString(), chargingTime);
                    this.ddlSotreInOrder.Items.Add(new ListItem(itemText, string.Format("{0}|{1}|{2}", dr["Id"].ToString(), chargingTime, dr["ChargingCount"])));
                }
            }
        }