Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string Begin = TextBox1.Text;
            string End   = TextBox2.Text;

            if (this.DropDownList1.SelectedValue == "1")
            {
                DataSet ds = new BLL.EnterStock().EnterStockGather(Begin, End);
                this.GridView1.Visible    = true;
                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();
                this.GridView2.Visible = false;
                this.Label2.Visible    = false;
            }
            else
            {
                DataSet ds = new BLL.EnterStock().GetGatherByList(Begin, End);
                this.GridView2.Visible    = true;
                this.Label2.Visible       = true;
                this.GridView2.DataSource = ds;
                this.GridView2.DataBind();
                decimal AllTot = 0;
                foreach (GridViewRow row in GridView2.Rows)
                {
                    AllTot += Convert.ToDecimal(row.Cells[3].Text);
                }
                this.Label2.Text       = "合计:" + AllTot;
                this.GridView1.Visible = false;
            }
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string  Begin = TextBox1.Text;
            string  End   = TextBox2.Text;
            DataSet ds    = new BLL.EnterStock().EnterStockDefinite(Begin, End);

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
        }
Ejemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.BuyOrder   bl_bo = new BLL.BuyOrder();
            Model.BuyOrder ml_bo = bl_bo.GetModel(BuyOrder_ID);
            if (!ml_bo.Produced)//字段值为false,表示已经入过库
            {
                Maticsoft.Common.MessageBox.Show(this, "该单号已经入库,不能重复操作!");
                return;
            }
            if (DropDownList4.SelectedValue == "0")
            {
                Maticsoft.Common.MessageBox.Show(this, "请选择仓库!");
                return;
            }
            Model.EnterStock ET = new Model.EnterStock();
            ET.Dept_ID       = Convert.ToInt32(DropDownList1.SelectedValue);
            ET.Employee_ID   = Convert.ToInt32(DropDownList3.SelectedValue);
            ET.StoreHouse_ID = Convert.ToInt32(DropDownList4.SelectedValue);
            ET.EnterDate     = DateTime.Now;
            Int32 ETId = new BLL.EnterStock().Add(ET);

            foreach (RepeaterItem item in Repeater1.Items)
            {
                Label   LB1                 = (Label)item.FindControl("Label5"); //单价
                Label   LB2                 = (Label)item.FindControl("Label6"); //数量
                Label   LB3                 = (Label)item.FindControl("Label7"); //合计
                Label   LB4                 = (Label)item.FindControl("Label1"); //商品编号
                Int32   pro_id              = Convert.ToInt32(LB4.Text);
                decimal pro_qty             = Convert.ToDecimal(LB2.Text);
                Model.EnterStock_Detail esd = new Model.EnterStock_Detail();
                esd.EnterStock_ID = ETId;
                esd.Product_ID    = pro_id;
                esd.Quantity      = pro_qty;
                esd.Price         = Convert.ToDecimal(LB1.Text);
                esd.HaveInvoice   = false;
                esd.InvoiceNum    = "0000";
                BLL.EnterStock_Detail bll_esd = new BLL.EnterStock_Detail();
                bll_esd.Add(esd);
                //Model.StockPile sp = new Model.StockPile();
                BLL.StockPile   bll_sp = new BLL.StockPile();
                Model.StockPile sp     = bll_sp.GetModelByProId(pro_id, Convert.ToInt32(DropDownList4.SelectedValue));
                if (sp == null)
                {
                    sp                = new Model.StockPile();
                    sp.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                    sp.StoreHouse_ID  = Convert.ToInt32(DropDownList4.SelectedValue);
                    sp.Product_ID     = pro_id;
                    sp.FirstEnterDate = DateTime.Now;
                    sp.LastLeaveDate  = DateTime.Now;
                    sp.Quantity       = pro_qty;
                    sp.Price          = Convert.ToDecimal(LB1.Text);
                    bll_sp.Add(sp);
                }
                else
                {
                    sp.Quantity += pro_qty;
                    bll_sp.Update(sp);
                }
                ml_bo.Produced = false;
                bl_bo.Update(ml_bo);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "入库已完成!", "/warehouse/BuyOrder/List.aspx");
            }
        }