コード例 #1
0
ファイル: add.aspx.cs プロジェクト: hqrush/XZDHospital2BMS
        protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");

                int   intContractId = Convert.ToInt32(ViewState["ContractId"]);
                Label lblGoodsId    = (Label)e.Row.FindControl("lblGoodsId");
                int   intGoodsId    = Convert.ToInt32(lblGoodsId.Text);
                if (BllInventoryRecord.isRecordAdded(intContractId, intGoodsId))
                {
                    Button btnAddGoods = (Button)e.Row.FindControl("btnAddGoods");
                    btnAddGoods.Text    = "已添加";
                    btnAddGoods.Enabled = false;
                    return;
                }
                HyperLink hlProductName = (HyperLink)e.Row.FindControl("hlProductName");
                hlProductName.NavigateUrl = "/BackManager/sales_goods/show.aspx?id=" + intGoodsId;
                // 显示入库量、计算库存、实时库存要用到的Label控件
                Label lblAmountIn   = (Label)e.Row.FindControl("lblAmountIn");
                Label lblAmountReal = (Label)e.Row.FindControl("lblAmountReal");
                // 得到入库的货品总量
                decimal intIn = Convert.ToDecimal(lblAmountIn.Text);
                // 得到实际出库的货品总量
                decimal intOut = BllCheckoutRecord.getAmountByGoodsId(intGoodsId);
                // 显示计算库存量
                lblAmountReal.Text = (intIn - intOut).ToString("N");
            }
        }
コード例 #2
0
        public void LoadData()
        {
            int       intContractId = Convert.ToInt32(ViewState["ContractId"]);
            DataTable objDT         = BllCheckoutRecord.getAll(intContractId);

            gvShow.DataSource = objDT;
            gvShow.DataBind();
            // 设置其他控件值,以货币形式显示 2.5.ToString("C")
            lblPriceTotal.Text = BllCheckoutRecord.getPriceTotal(intContractId).ToString("C");
        }
コード例 #3
0
        // 添加出库货品记录,并更新货品的库存量
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            if (context.Request.Params["CheckoutContractId"] == null ||
                !HelperUtility.isDecimal(context.Request.Params["CheckoutContractId"].ToString()))
            {
                context.Response.Write(HelperUtility.setReturnJson("500", "需要指明出库单ID!", ""));
                return;
            }
            if (context.Request.Params["GoodsId"] == null ||
                !HelperUtility.isDecimal(context.Request.Params["GoodsId"].ToString()))
            {
                context.Response.Write(HelperUtility.setReturnJson("500", "需要指明出库单ID!", ""));
                return;
            }
            if (context.Request.Params["Amount"] == null ||
                !HelperUtility.isDecimal(context.Request.Params["Amount"].ToString()))
            {
                context.Response.Write(HelperUtility.setReturnJson("500", "需要指明数量!", ""));
                return;
            }

            int     intCheckoutContractId = Convert.ToInt32(context.Request.Params["CheckoutContractId"]);
            int     intGoodsId            = Convert.ToInt32(context.Request.Params["GoodsId"]);
            decimal dcmAmount             = Convert.ToDecimal(context.Request.Params["Amount"]);

            if (!(intCheckoutContractId > 0 && intGoodsId > 0 && dcmAmount > 0))
            {
                context.Response.Write(HelperUtility.setReturnJson("500", "数字不对!", ""));
                return;
            }
            ModelCheckoutRecord model = new ModelCheckoutRecord();

            model.id_contract = intCheckoutContractId;
            model.id_goods    = intGoodsId;
            model.amount      = dcmAmount;
            int intId = BllCheckoutRecord.add(model);

            if (intId > 0)
            {
                // 出库货品表里添加完了一条记录后,更新此货品的库存量
                BllSalesGoods.updateAmountStockByCheckOut(dcmAmount, intGoodsId);
                context.Response.Write(HelperUtility.setReturnJson("200", "", intId.ToString()));
                return;
            }
            else
            {
                context.Response.Write(HelperUtility.setReturnJson("500", "添加失败,请联系管理员!", ""));
                return;
            }
        }
コード例 #4
0
ファイル: add.aspx.cs プロジェクト: hqrush/XZDHospital2BMS
 protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'");
         e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
         Label     lblGoodsId    = (Label)e.Row.FindControl("lblGoodsId");
         int       intGoodsId    = Convert.ToInt32(lblGoodsId.Text);
         HyperLink hlProductName = (HyperLink)e.Row.FindControl("hlProductName");
         hlProductName.NavigateUrl = "show.aspx?id=" + intGoodsId;
         // 记录进货总量的Label控件
         Label lblAmountIn = (Label)e.Row.FindControl("lblAmountIn");
         // 记录实时库存总量的Label控件
         Label lblInventory = (Label)e.Row.FindControl("lblInventory");
         // 记录盘后库存总量的Label控件
         Label lblAmountStock = (Label)e.Row.FindControl("lblAmountStock");
         // 得到某个货品的出库总量
         decimal dcmOut = BllCheckoutRecord.getAmountByGoodsId(intGoodsId);
         // 得到入库的货品总量
         if ("".Equals(lblAmountIn.Text))
         {
             lblAmountIn.Text = "0";
         }
         decimal dcmIn = Convert.ToDecimal(lblAmountIn.Text);
         // 计算实时库存量
         decimal dcmInventory = dcmIn - dcmOut;
         lblInventory.Text = dcmInventory.ToString("N");
         // 根据出库单id,货品id,出库数量添加一条出库货品记录
         // 先得到输入出库数量的textbox控件id
         TextBox tbCheckoutAmount = (TextBox)e.Row.FindControl("tbCheckoutAmount");
         // 得到添加到出库单的按钮控件
         HtmlInputButton btnAddToList          = (HtmlInputButton)e.Row.FindControl("btnAddToList");
         int             intCheckoutContractId = Convert.ToInt32(ViewState["ContractId"]);
         if ("".Equals(tbCheckoutAmount.Text))
         {
             tbCheckoutAmount.Text = "0";
         }
         string strClickHandler = "addGoods(" +
                                  intCheckoutContractId + "," +
                                  intGoodsId + ",\"" +
                                  lblInventory.ClientID + "\",\"" +
                                  lblAmountStock.ClientID + "\",\"" +
                                  tbCheckoutAmount.ClientID + "\")";
         // 将上述值绑定到按钮事件上
         btnAddToList.Attributes.Add("onclick", strClickHandler);
     }
 }
コード例 #5
0
ファイル: list.aspx.cs プロジェクト: hqrush/XZDHospital2BMS
 protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'");
         e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
         // 设置标志
         Label lblFlag = (Label)e.Row.FindControl("lblFlag");
         if (lblFlag != null)
         {
             if (lblFlag.Text == "True")
             {
                 lblFlag.Text = "<span class='red'>*</span>";
             }
             else
             {
                 lblFlag.Text = "";
             }
         }
         // 设置申请单位,有两个单位,所以要做下显示处理
         Label         lblUnitName  = (Label)e.Row.FindControl("lblUnitName");
         List <string> listUnitName = lblUnitName.Text.Split(',').ToList();
         lblUnitName.Text = "";
         if (!"".Equals(listUnitName[0]) && "".Equals(listUnitName[1]))
         {
             lblUnitName.Text = listUnitName[0];
         }
         if (!"".Equals(listUnitName[0]) && !"".Equals(listUnitName[1]))
         {
             lblUnitName.Text = listUnitName[0] + "<br />" + listUnitName[1];
         }
         if ("".Equals(listUnitName[0]) && !"".Equals(listUnitName[1]))
         {
             lblUnitName.Text = listUnitName[1];
         }
         // 根据管理员Id显示管理员姓名
         Label lblAdminId = (Label)e.Row.FindControl("lblAdminId");
         int   intAdminId = Convert.ToInt32(lblAdminId.Text);
         lblAdminId.Text = BllAdmin.getRealNameById(intAdminId);
         // 根据出库单id显示此出库单下所有货品总数
         Label lblId         = (Label)e.Row.FindControl("lblId");
         Label lblAmount     = (Label)e.Row.FindControl("lblAmount");
         int   intContractId = Convert.ToInt32(lblId.Text);
         lblAmount.Text = BllCheckoutRecord.getRecordsAmount(intContractId).ToString();
     }
 }
コード例 #6
0
        public void OP_Command(object sender, CommandEventArgs e)
        {
            int    intId      = Convert.ToInt32(e.CommandArgument);
            string strUrlBack = "?cid=" + ViewState["ContractId"] + "&cpage=" + ViewState["ContractPage"];

            if (e.CommandName == "del")
            {
                if (HelperUtility.hasPurviewOP("CheckoutRecord_del"))
                {
                    BllCheckoutRecord.deleteById(intId);
                }
                else
                {
                    HelperUtility.showAlert("没有操作权限", "list.aspx" + strUrlBack);
                }
            }
            LoadData();
        }
コード例 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int intAdminId = HelperUtility.hasPurviewPage("CheckoutRecord_show");
         ViewState["AdminId"] = intAdminId;
         // 本页只能从出库单表list.aspx的编辑页转过来
         // 因此要得到要显示哪个出库单的cid值和页面的cpage值用于返回
         int intContractId = HelperUtility.getQueryInt("cid");
         if (intContractId == 0)
         {
             HelperUtility.showAlert("", "/BackManager/login.aspx");
         }
         ViewState["ContractId"]   = intContractId;
         ViewState["ContractPage"] = HelperUtility.getQueryInt("cpage");
         LoadData();
         // 设置其他控件值,以货币形式显示 2.5.ToString("C")
         lblPriceTotal.Text         = BllCheckoutRecord.getPriceTotal(intContractId).ToString("C");
         hlBackContract.NavigateUrl = "../checkout_contract/list.aspx?page=" + ViewState["ContractPage"];
         hlAddNew.NavigateUrl       = "add.aspx?cid=" + intContractId;
     }
 }