Beispiel #1
0
    public void LoadReturn()
    {
        Return e = new Return();

        if (ReturnID == 0)
        {
            imgOrder.ImageUrl = "none";
            btnOk.Enabled     = true;
        }
        else
        {
            e = ReturnBLL.Get(ReturnID);
            imgOrder.ImageUrl = BarcodeBLL.Url4Return(e.ID);
            btnOk.Enabled     = false;
        }

        txtNote.Text = e.Note;

        txtDate.Text = e.Date.ToStringVN_Hour();

        PackOrderList = e.PackOrders.Select(r => r.ID).ToList();

        urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Store/PrintReturn.aspx?ReturnID={0}", e.ID));

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
    void ShowInfo()
    {
        RedBloodDataContext db = new RedBloodDataContext();

        var v = db.Packs.Where(r => PackList.Contains(r.ID))
                .Select(r => new
        {
            r.ID,
            DIN = r.Donation.DIN,
            r.ProductCode,
        }).ToList();

        DataListPack.DataSource = v;
        DataListPack.DataBind();

        GridViewSum.DataSource = v.GroupBy(r => r.ProductCode)
                                 .Select(r => new
        {
            ProductCode = r.Key,
            Sum         = r.Count()
        });
        GridViewSum.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";
    }
Beispiel #3
0
    public void LoadDelete()
    {
        Delete e = new Delete();

        if (DeleteID == 0)
        {
            imgOrder.ImageUrl = "none";
            btnOk.Enabled     = true;
        }
        else
        {
            e = DeleteBLL.Get(DeleteID);
            imgOrder.ImageUrl = BarcodeBLL.Url4Delete(e.ID);
            btnOk.Enabled     = false;
        }

        txtNote.Text = e.Note;

        txtDate.Text = e.Date.ToStringVN_Hour();

        PackList = e.Packs.Select(r => r.ID).ToList();

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Store/PrintDelete.aspx?DeleteID={0}", e.ID));

        GridViewSum.DataBind();
    }
Beispiel #4
0
    void AddPack(string productCode)
    {
        PackOrderBLL.Add(OrderID, CurrentDIN, productCode);

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";
        GridViewSum.DataBind();
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strOrderID = Request["OrderID"];

            if (!string.IsNullOrEmpty(strOrderID))
            {
                order = OrderBLL.Get(strOrderID.ToInt());

                if (order.Type == Order.TypeX.ForOrg)
                {
                    LabelTitle1.Text = "BIÊN BẢN BÀN GIAO";

                    LoadOrder();

                    RedBloodDataContext db = new RedBloodDataContext();


                    var v1 = db.PackOrders.Where(r => r.OrderID.Value == order.ID &&
                                                 !r.ReturnID.HasValue).ToList();

                    var v = v1.GroupBy(r => r.Pack.ProductCode)
                            .Select(r => new
                    {
                        ProductCode      = r.Key,
                        Sum              = r.Count(),
                        BloodGroupSumary = r.GroupBy(r1 => r1.Pack.Donation.BloodGroup).Select(r1 => new
                        {
                            BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                            Total          = r1.Count(),
                            VolumeSumary   = r1.GroupBy(r2 => r2.Pack.Volume).Select(r2 => new
                            {
                                Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                                Total  = r2.Count(),
                                //DINList = string.Join(",", r2.Select(r3 => r3.Pack.DIN).ToArray()),
                                DINList = r2.Select(r3 => new { DIN = r3.Pack.DIN }).OrderBy(r4 => r4.DIN),
                            }).OrderBy(r2 => r2.Volume)
                        }).OrderBy(r1 => r1.BloodGroupDesc),
                    });

                    GridViewSum.DataSource = v;
                    GridViewSum.DataBind();

                    LableCount.Text = v1.Count().ToStringRemoveZero();

                    //var v2 = db.PackOrders.Where(r => r.OrderID.Value == order.ID
                    //    && !r.ReturnID.HasValue).ToList().OrderBy(r => r.Pack.DIN);
                    //GridViewPack.DataSource = v2;
                    //GridViewPack.DataBind();
                }
            }
        }
    }
Beispiel #6
0
    //public void Clear()
    //{
    //    OrderID = 0;

    //    imgOrder.ImageUrl = "none";

    //    txtDate.Text = "";
    //    txtNote.Text = "";
    //    txtDept.Text = "";
    //    txtRoom.Text = "";
    //    txtBed.Text = "";
    //    txtDiagnosis.Text = "";
    //    txtPatientCode.Text = "";
    //    txtTransfusionNote.Text = "";
    //    People1.PeopleID = Guid.Empty;

    //    GridViewPack.DataBind();

    //    CurrentDIN = "";
    //    imgCurrentDIN.ImageUrl = "none";
    //}

    public void LoadOrder()
    {
        Order e = new Order();

        if (OrderID == 0)
        {
            imgOrder.ImageUrl = "none";
            People1.PeopleID  = Guid.Empty;
        }
        else
        {
            e = OrderBLL.Get(OrderID);

            if (e.Type == Order.TypeX.ForOrg)
            {
                Response.Redirect(RedBloodSystem.Url4Order4Org + "key=" + e.ID.ToString());
            }
            else if (e.Type == Order.TypeX.ForCR)
            {
                imgOrder.ImageUrl = BarcodeBLL.Url4Order(e.ID);
                People1.PeopleID  = e.People != null?e.PeopleID.GetValueOrDefault() : Guid.Empty;
            }
        }

        txtNote.Text = e.Note;

        if (e.Date != null)
        {
            txtDate.Text = e.Date.ToStringVN_Hour();
        }
        else
        {
            txtDate.Text = "";
        }

        txtDept.Text            = e.FullDepartment;
        txtRoom.Text            = e.Room;
        txtBed.Text             = e.Bed;
        txtDiagnosis.Text       = e.Diagnosis;
        txtPatientCode.Text     = e.PatientCode;
        txtTransfusionNote.Text = e.TransfusionNote;

        GridViewPack.DataBind();

        btnUpdate.Enabled = e.Status == Order.StatusX.Init;

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strParamID = Request["ReturnID"];

            if (!string.IsNullOrEmpty(strParamID))
            {
                returnObj = ReturnBLL.Get(strParamID.ToInt());

                if (returnObj != null)
                {
                    LabelTitle1.Text = "BIÊN BẢN THU HỒI";

                    LoadReturn();

                    RedBloodDataContext db = new RedBloodDataContext();

                    var v1 = db.PackOrders.Where(r => r.ReturnID.Value == returnObj.ID)
                             .Select(r => r.Pack)
                             .ToList();

                    var v = v1.GroupBy(r => r.ProductCode)
                            .Select(r => new
                    {
                        ProductCode      = r.Key,
                        Sum              = r.Count(),
                        BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
                        {
                            BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                            Total          = r1.Count(),
                            VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                            {
                                Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                                Total   = r2.Count(),
                                DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                            }).OrderBy(r2 => r2.Volume)
                        }).OrderBy(r1 => r1.BloodGroupDesc),
                    });

                    GridViewSum.DataSource = v;
                    GridViewSum.DataBind();

                    LableCount.Text = v1.Count().ToStringRemoveZero();
                }
            }
        }
    }
Beispiel #8
0
    public void Clear()
    {
        OrderID = 0;

        imgOrder.ImageUrl = "none";

        txtDate.Text = "";
        txtNote.Text = "";

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
Beispiel #9
0
    public void LoadOrder()
    {
        Order e = new Order();

        if (OrderID == 0)
        {
            imgOrder.ImageUrl = "none";
            txtOrg.Text       = "";
            //People1.PeopleID = Guid.Empty;
        }
        else
        {
            e = OrderBLL.Get(OrderID);

            if (e.Type == Order.TypeX.ForOrg)
            {
                imgOrder.ImageUrl = BarcodeBLL.Url4Order(e.ID);
                txtOrg.Text       = e.Org != null ? e.Org.Name : "";
            }
            else if (e.Type == Order.TypeX.ForCR)
            {
                Response.Redirect(RedBloodSystem.Url4Order4CR + "key=" + e.ID.ToString());
            }
        }

        txtNote.Text = e.Note;

        if (e.Date != null)
        {
            txtDate.Text = e.Date.ToStringVN_Hour();
        }

        txtTransfusionNote.Text = e.TransfusionNote;

        GridViewPack.DataBind();

        btnUpdate.Enabled = e.Status == Order.StatusX.Init;

        urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Store/PrintOrder.aspx?OrderID={0}", e.ID));

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
Beispiel #10
0
    void AddPackOrder(string productCode)
    {
        PackOrder po = PackOrderBLL.Get4Return(CurrentDIN, productCode);

        if (PackOrderList.Contains(po.ID))
        {
            throw new Exception("Đã nhập túi máu này.");
        }

        PackOrderList.Add(po.ID);

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";

        GridViewSum.DataBind();
    }
Beispiel #11
0
    protected void btnRemove_Click(object sender, EventArgs e)
    {
        if (ReturnID != 0)
        {
            return;
        }

        LinkButton btn = sender as LinkButton;

        if (btn != null)
        {
            if (PackOrderList.Remove(btn.CommandArgument.ToInt()))
            {
                GridViewPack.DataBind();
                GridViewSum.DataBind();
            }
        }
    }
Beispiel #12
0
    void LoadData()
    {
        DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
        DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

        if (dtFrom.HasValue)
        {
            DateTime hourFrom;
            if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
            {
                dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
            }
        }

        if (dtTo.HasValue)
        {
            DateTime hourTo;
            if (DateTime.TryParse(txtHourTo.Text, out hourTo))
            {
                dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
            }
        }

        RedBloodDataContext db = new RedBloodDataContext();

        //var packs = db.Packs.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo
        //   && r.Donation.OrgPackID != r.ID).OrderBy(r => r.Date);

        var v = db.Deletes.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo)
                .OrderBy(r => r.Date)
                .ToList()
                .Select(r => new
        {
            r.ID,
            Date = r.Date.ToStringVN_Hour(),
            r.Note,
            r.Actor,
            r.Packs
        });



        GridView1.DataSource = v;
        GridView1.DataBind();

        var s = v.SelectMany(r => r.Packs).ToList();

        var v1 = s.ToList().GroupBy(r => r.ProductCode)
                 .Select(r => new
        {
            ProductCode      = r.Key,
            ProductDesc      = ProductBLL.GetDesc(r.Key),
            Sum              = r.Count(),
            BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                Total          = r1.Count(),
                VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                {
                    Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                    Total   = r2.Count(),
                    DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                }).OrderBy(r2 => r2.Volume)
            }).OrderBy(r1 => r1.BloodGroupDesc),
        });

        GridViewSum.DataSource = v1;
        GridViewSum.DataBind();
    }
    void LoadData()
    {
        DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
        DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

        if (dtFrom.HasValue)
        {
            DateTime hourFrom;
            if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
            {
                dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
            }
        }

        if (dtTo.HasValue)
        {
            DateTime hourTo;
            if (DateTime.TryParse(txtHourTo.Text, out hourTo))
            {
                dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
            }
        }

        RedBloodDataContext db = new RedBloodDataContext();

        var packs = db.Packs.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo &&
                                   r.Donation.OrgPackID != r.ID).OrderBy(r => r.ProductCode).ThenBy(r => r.Date);

        var v = packs.ToList().GroupBy(r => r.ProductCode)
                .Select(r => new
        {
            ProductCode      = r.Key,
            ProductDesc      = ProductBLL.GetDesc(r.Key),
            Sum              = r.Count(),
            PrintUrl         = "~/Production/FinalLabelPrint.aspx?PackList=" + string.Join(",", r.Where(r1 => r1.Donation.TestResultStatus == Donation.TestResultStatusX.Negative).Select(r1 => r1.ID.ToString())),
            PrintCount       = r.Where(r1 => r1.Donation.TestResultStatus == Donation.TestResultStatusX.Negative).Count(),
            BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                Total          = r1.Count(),
                VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                {
                    Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                    Total   = r2.Count(),
                    DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                }).OrderBy(r2 => r2.Volume)
            }).OrderBy(r1 => r1.BloodGroupDesc),
        });

        GridViewSum.DataSource = v;
        GridViewSum.DataBind();

        GridView1.DataSource = packs.ToList().Select(r => new
        {
            r.ID,
            Date = r.Date.ToStringVN_Hour(),
            r.DIN,
            r.ProductCode,
            Description = ProductBLL.GetDesc(r.ProductCode),
            r.Note,
        });
        GridView1.DataBind();

        btnSelectedPack.Visible = packs.Count() > 0;
    }