Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Int32 LeaveStock_ID = 0;

            if (Request.Params["LeaveStock_ID"] != null && Request.Params["LeaveStock_ID"].Trim() != "")
            {
                LeaveStock_ID = (Convert.ToInt32(Request.Params["LeaveStock_ID"]));
            }
            Model.LeaveStock ml_ls = new BLL.LeaveStock().GetModel(LeaveStock_ID);
            this.Label1.Text = ml_ls.LeaveStock_ID.ToString();
            this.Label2.Text = (new BLL.Employee().GetModel(ml_ls.Employee_ID)).Name;
            this.Label3.Text = ml_ls.LeaveDate.ToString();
            DataSet ds = new BLL.LeaveStock_Detail().GetTransferDtl(LeaveStock_ID);

            GridView1.DataSource = ds;
            GridView1.DataBind();
            decimal AllTot = 0;

            foreach (GridViewRow gvr in GridView1.Rows)
            {
                decimal price  = Convert.ToDecimal(gvr.Cells[7].Text);
                decimal qty    = Convert.ToDecimal(gvr.Cells[8].Text);
                decimal RowTot = price * qty;
                gvr.Cells[9].Text = RowTot.ToString();
                AllTot           += RowTot;
            }
            this.Label4.Text = AllTot.ToString();
            this.Label5.Text = Maticsoft.Common.Rmb.CmycurD(AllTot);
        }
Ejemplo n.º 2
0
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            DataSet ds = new BLL.LeaveStock().GetList(AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, "");

            GridView1.DataSource     = ds;
            AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]);
            GridView1.DataBind();
        }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataSet ds = new BLL.LeaveStock().GetList(AspNetPager1.PageSize, 1, "");
         GridView1.DataSource     = ds;
         AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]);
         GridView1.DataBind();
     }
 }
Ejemplo n.º 4
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (HiddenField1.Value == "")
     {
         Maticsoft.Common.MessageBox.Show(this, "请添加商品");
         return;
     }
     else
     {
         Model.LeaveStock LeaveStock = new Model.LeaveStock();
         LeaveStock.LeaveDate       = Convert.ToDateTime(txtWriteDate.Text);
         LeaveStock.Dept_ID         = Convert.ToInt32(DropDownList1.SelectedValue);
         LeaveStock.Employee_ID     = Convert.ToInt32(DropDownList4.SelectedValue);
         LeaveStock.StoreHouse_ID   = Convert.ToInt32(DropDownList2.SelectedValue);
         LeaveStock.ToStoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue);
         Int32    LeaveStock_ID = new BLL.LeaveStock().Add(LeaveStock);
         string   Ids           = HiddenField1.Value.Replace(" ", "").Replace("\r\n", "");
         string   Qtys          = HiddenField2.Value.Replace(" ", "").Replace("\r\n", "");
         string   Prices        = HiddenField3.Value.Replace(" ", "").Replace("\r\n", "");
         string[] ArrIds        = Ids.Split(new char[] { '|' });
         string[] ArrQty        = Qtys.Split(new char[] { '|' });
         string[] ArrPri        = Prices.Split(new char[] { '|' });
         for (int i = 0; i < ArrIds.Length - 1; i++)
         {
             Model.LeaveStock_Detail ml_ld = new Model.LeaveStock_Detail();
             BLL.LeaveStock_Detail   bl_ld = new BLL.LeaveStock_Detail();
             ml_ld.LeaveStock_ID = LeaveStock_ID;
             ml_ld.Product_ID    = Convert.ToInt32(ArrIds[i]);
             ml_ld.Quantity      = Convert.ToDecimal(ArrQty[i]);
             ml_ld.Price         = Convert.ToDecimal(ArrPri[i]);
             Model.StockPile ml_sp_out = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList2.SelectedValue));
             Model.StockPile ml_sp_in  = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList3.SelectedValue));
             BLL.StockPile   bl_sp     = new ZhangWei.BLL.StockPile();
             if (ml_sp_out == null)
             {
                 //Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                 ml_sp_out                = new ZhangWei.Model.StockPile();
                 ml_sp_out.Product_ID     = Convert.ToInt32(ArrIds[i]);
                 ml_sp_out.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                 ml_sp_out.FirstEnterDate = DateTime.Now;
                 ml_sp_out.LastLeaveDate  = DateTime.Now;
                 ml_sp_out.Price          = Convert.ToDecimal(ArrPri[i]);
                 ml_sp_out.Quantity       = 0;
                 ml_sp_out.StoreHouse_ID  = Convert.ToInt32(DropDownList2.SelectedValue);
                 ml_sp_out.Quantity      -= Convert.ToDecimal(ArrQty[i]);
                 bl_sp.Add(ml_sp_out);
             }
             else
             {
                 ml_sp_out.Quantity     -= Convert.ToDecimal(ArrQty[i]);
                 ml_sp_out.LastLeaveDate = DateTime.Now;
                 bl_sp.Update(ml_sp_out);
             }
             if (ml_sp_in == null)
             {
                 Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                 ml_sp_in                = new ZhangWei.Model.StockPile();
                 ml_sp_in.Product_ID     = Convert.ToInt32(ArrIds[i]);
                 ml_sp_in.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                 ml_sp_in.FirstEnterDate = DateTime.Now;
                 ml_sp_in.LastLeaveDate  = DateTime.Now;
                 ml_sp_in.Price          = Convert.ToDecimal(ArrPri[i]);
                 ml_sp_in.Quantity       = 0;
                 ml_sp_in.StoreHouse_ID  = Convert.ToInt32(DropDownList3.SelectedValue);
                 ml_sp_in.Quantity      += Convert.ToDecimal(ArrQty[i]);
                 bl_sp.Add(ml_sp_in);
             }
             else
             {
                 ml_sp_in.Quantity     += Convert.ToDecimal(ArrQty[i]);
                 ml_sp_in.LastLeaveDate = DateTime.Now;
                 bl_sp.Update(ml_sp_in);
             }
             bl_ld.Add(ml_ld);
         }
         Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "/warehouse/TransferRecord.aspx");
     }
 }