Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context       = new Team10ADModel();
                string        requisitionid = (string)Session["requisitiondetail"];
                int           reqid         = Convert.ToInt32(requisitionid);
                Requisition   req           = RayBizLogic.GetRequisitionById(requisitionid);

                var qry = from r in context.RequisitionDetails where r.RequisitionID == reqid select new { r.ItemCode, r.Catalogue.Description, r.QuantityRequested, r.QuantityRetrieved };
                dgvRequisitionDetail.DataSource = qry.ToList();
                dgvRequisitionDetail.DataBind();
                dgvRequisitionDetail.AllowPaging = true;

                Model.Employee   emp  = context.Employees.Where(x => x.EmployeeID == req.RequestorID).First();
                Model.Department dept = context.Departments.Where(x => x.DepartmentCode == emp.DepartmentCode).First();
                ReqIDTextBox.Text         = req.RequisitionID.ToString();
                StatusTextBox.Text        = req.Status;
                DeptNameTextBox.Text      = dept.DepartmentName;
                DeptCodeTextBox.Text      = dept.DepartmentCode;
                NameTextBox.Text          = emp.Name;
                EmployeePhoneTextBox.Text = emp.Phone.ToString();
                EmailTextBox.Text         = emp.Email;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context = new Team10ADModel();
                string        id      = (string)Session["AdjustVoucherId"];
                int           adjId   = Convert.ToInt32(id);

                int        storestaffid = (int)Session["clerkid"];
                StoreStaff staff        = RayBizLogic.GetStoreStaffById(storestaffid);

                dgvVoucherDetail.DataSource = RayBizLogic.AdjustmentVoucherDetailList(adjId);
                dgvVoucherDetail.DataBind();

                StockAdjustmentVoucher voucher = context.StockAdjustmentVouchers.Where(v => v.VoucherID == adjId).First();
                VouchderIdBox.Text = voucher.VoucherID.ToString();
                DateTextBox.Text   = voucher.DateIssue.ToString();
                GenByTextBox.Text  = voucher.StoreStaff.Name;

                if (staff.Title == "Supervisor" && voucher.Status == "Pending" && RayBizLogic.AdjustmentVoucherCost(adjId) <= 250)
                {
                    AcknowledgeButton.Visible = true;
                }
                else if (staff.Title == "Manager" && voucher.Status == "Pending" && RayBizLogic.AdjustmentVoucherCost(adjId) > 250)
                {
                    AcknowledgeButton.Visible = true;
                }
            }
        }
        protected void CancelButton_Click(object sender, EventArgs e)
        {
            Team10ADModel context       = new Team10ADModel();
            string        requisitionid = (string)Session["requisitiondetail"];
            int           reqid         = Convert.ToInt32(requisitionid);

            RayBizLogic.CancelRequisition(reqid);
            Response.Redirect("RequisitionDetailsPage.aspx");
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         dgvRetList.DataSource = RayBizLogic.RetrievalListForGV();
         dgvRetList.DataBind();
         dgvRetList.AllowPaging = true;
     }
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         dgvAdjVoucher.DataSource = RayBizLogic.AdjustmentVoucherList();
         dgvAdjVoucher.DataBind();
         dgvAdjVoucher.AllowPaging = true;
     }
 }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dgvCatalogue.DataSource = RayBizLogic.CatalogueList();

                dgvCatalogue.DataBind();
                dgvCatalogue.AllowPaging = true;
            }
        }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int needAdjustment = (int)Session["AdjustVoucherId"];
         //int needAdjustment = 1000002;
         dgvCreateAdj.DataSource = RayBizLogic.AdjustmentVoucherDetailForGV(needAdjustment);
         dgvCreateAdj.DataBind();
         dgvCreateAdj.AllowPaging = true;
     }
 }
Ejemplo n.º 8
0
        protected void dgvCatalogue_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            dgvCatalogue.PageIndex = e.NewPageIndex;

            if (SearchBox.Text == "")
            {
                dgvCatalogue.DataSource = RayBizLogic.CatalogueList();
            }
            else
            {
                dgvCatalogue.DataSource = RayBizLogic.SearchCatalogue(SearchBox.Text);
            }


            dgvCatalogue.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context        = new Team10ADModel();
                string        id             = (string)Session["retrievaldetail"];
                int           retrievalid    = Convert.ToInt32(id);
                Retrieval     ret            = RayBizLogic.GetRetrievalById(retrievalid);
                int           currentClerkId = (int)Session["clerkid"];

                var qry = from r in context.RetrievalDetails where r.RetrievalID == retrievalid select new { r.ItemCode, r.Catalogue.Description, r.RequestedQuantity, r.RetrievedQuantity };
                dgvRetrievalDetail.DataSource = qry.ToList();
                dgvRetrievalDetail.DataBind();

                RetIDTextBox.Text  = ret.RetrievalID.ToString();
                StatusTextBox.Text = ret.Status;
            }
        }
Ejemplo n.º 10
0
        protected void dgvReqStatus_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //To be coded.
            if (e.CommandName == "Details")
            {
                int         index       = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = dgvReqStatus.Rows[index];
                Session["requisitiondetail"] = selectedRow.Cells[0].Text;
                Response.Redirect("RequisitionDetailsPage.aspx");
            }

            if (e.CommandName == "CancelRequisition")
            {
                GridViewRow selectedRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                int         reqid       = Convert.ToInt32(selectedRow.Cells[0].Text);
                RayBizLogic.CancelRequisition(reqid);
                Response.Redirect("RequisitionStatus.aspx");
            }
        }
Ejemplo n.º 11
0
        protected void GenRetListButton_Click(object sender, EventArgs e)
        {
            //For collecting all requisitiondetails into 1 list
            List <RequisitionDetail> rd = new List <RequisitionDetail>();

            //For collecting all the requisition into 1 list
            ArrayList          reqIdList = new ArrayList();
            List <Requisition> reqlist   = new List <Requisition>();

            //For checking that at least 1 record was selected for retrieval list generation
            int checkselection = 0;

            foreach (GridViewRow row in dgvReqList.Rows)
            {
                CheckBox chk = (CheckBox)row.FindControl("selectchk");
                if (chk != null && chk.Checked)
                {
                    int reqid = Convert.ToInt32(row.Cells[1].Text);
                    reqIdList.Add(reqid);
                    reqlist = RayBizLogic.CombineReq(reqIdList);

                    List <RequisitionDetail> templist = RayBizLogic.CombineReqDetail(reqid);
                    foreach (RequisitionDetail r in templist)
                    {
                        rd.Add(r);
                    }
                    checkselection++;
                }
            }

            int clerkid = (int)Session["clerkid"];

            if (checkselection > 0)
            {
                RayBizLogic.GenerateRetrievalList(rd, reqlist, clerkid);
            }

            //Set selected requisition status to "Processing"
            RayBizLogic.ReqStatusProcessing(reqIdList);

            Response.Redirect("RetrievalList.aspx");
        }
        protected void GenDisbursementList_Click(object sender, EventArgs e)
        {
            Team10ADModel          context   = new Team10ADModel();
            List <RetrievalDetail> suggested = (List <RetrievalDetail>)Session["SuggestedRetrievalDetail"];

            int    clerkid     = (int)Session["clerkid"];
            string id          = (string)Session["retrievaldetail"];
            int    retrievalid = Convert.ToInt32(id);
            List <RetrievalDetail> userinput = RayBizLogic.GetRetrievalList(retrievalid);

            foreach (RetrievalDetail r in userinput)
            {
                foreach (GridViewRow row in dgvRetrievalDetail.Rows)
                {
                    TextBox retrieveqtybox = (TextBox)row.FindControl("RetrieveQty");
                    if (r.ItemCode == row.Cells[0].Text)
                    {
                        r.RetrievedQuantity = Convert.ToInt32(retrieveqtybox.Text);
                    }
                }
            }

            //Check for adjustment voucher needs
            int adjustmentVoucherId = RayBizLogic.GenerateAdjustmentVoucherDetails(suggested, userinput, clerkid);

            //Update retrieval and catalogue
            //Generate disbursement lists
            //Update requisition qty
            //Update requisition status
            RayBizLogic.UpdateRetrievalDetailsFull(retrievalid, userinput, clerkid);

            if (adjustmentVoucherId > 0)
            {
                Session["AdjustVoucherId"] = adjustmentVoucherId;
                Response.Redirect("CreateAdjustmentVoucher.aspx");
            }
            else
            {
                Response.Redirect("DisbursementList.aspx");
            }
        }
Ejemplo n.º 13
0
        protected void dgvRetList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Details")
            {
                int         index       = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = dgvRetList.Rows[index];
                Session["retrievaldetail"] = selectedRow.Cells[0].Text;

                int       id  = Convert.ToInt32(selectedRow.Cells[0].Text);
                Retrieval ret = RayBizLogic.GetRetrievalById(id);

                if (ret.Status == "Retrieved")
                {
                    Response.Redirect("CompletedRetrievalDetailPage.aspx");
                }
                else
                {
                    Response.Redirect("RetrievalDetailPage.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context        = new Team10ADModel();
                string        id             = (string)Session["retrievaldetail"];
                int           retrievalid    = Convert.ToInt32(id);
                Retrieval     ret            = RayBizLogic.GetRetrievalById(retrievalid);
                int           currentClerkId = (int)Session["clerkid"];

                //Safety catch. Incase user click back and click generate again
                if (ret.Status == "Retrieved")
                {
                    GenDisbursementList.Visible = false;
                }

                var qry = from r in context.RetrievalDetails where r.RetrievalID == retrievalid select new { r.ItemCode, r.Catalogue.Description, r.Catalogue.BalanceQuantity, r.RequestedQuantity };
                dgvRetrievalDetail.DataSource = qry.ToList();
                dgvRetrievalDetail.DataBind();

                RetIDTextBox.Text  = ret.RetrievalID.ToString();
                StatusTextBox.Text = ret.Status;

                //Saving the suggested retrieval details before user make any changes
                List <RetrievalDetail> suggested = RayBizLogic.GetRetrievalList(retrievalid);
                foreach (RetrievalDetail r in suggested)
                {
                    foreach (GridViewRow row in dgvRetrievalDetail.Rows)
                    {
                        TextBox retrieveqtybox = (TextBox)row.FindControl("RetrieveQty");
                        if (r.ItemCode == row.Cells[0].Text)
                        {
                            r.RetrievedQuantity = Convert.ToInt32(retrieveqtybox.Text);
                        }
                    }
                }
                Session["SuggestedRetrievalDetail"] = suggested;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Team10ADModel context       = new Team10ADModel();
                string        requisitionid = (string)Session["requisitiondetail"];
                reqid = Convert.ToInt32(requisitionid);
                Requisition req          = RayBizLogic.GetRequisitionById(requisitionid);
                int         currentEmpId = (int)Session["employeeid"];
                //int currentEmpId = 104;
                int approverID = (int)Session["ApproverID"];

                if (currentEmpId == req.RequestorID && req.Status == "Pending")
                {
                    CancelButton.Visible = true;
                }
                else if (currentEmpId == approverID && req.Status == "Pending")
                {
                    btnApprove.Visible     = true;
                    btnReject.Visible      = true;
                    lblRemarks.Visible     = true;
                    txtBoxRemarks.Visible  = true;
                    txtBoxRemarks.ReadOnly = false;
                }
                //if currentEmId = approverId, approve and reject buttons will show

                var qry = from r in context.RequisitionDetails where r.RequisitionID == reqid select new { r.Catalogue.ItemCode, r.Catalogue.Description, r.QuantityRequested, r.Catalogue.UnitOfMeasure };
                dgvRequisitionDetail.DataSource = qry.ToList();
                dgvRequisitionDetail.DataBind();
                dgvRequisitionDetail.AllowPaging = true;

                Model.Employee emp = context.Employees.Where(x => x.EmployeeID == req.RequestorID).First();
                NameTextBox.Text   = emp.Name;
                StatusTextBox.Text = req.Status;
                txtBoxRemarks.Text = req.Remarks;
            }
        }
Ejemplo n.º 16
0
 protected void dgvRetList_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     dgvRetList.PageIndex  = e.NewPageIndex;
     dgvRetList.DataSource = RayBizLogic.RetrievalListForGV();
     dgvRetList.DataBind();
 }
Ejemplo n.º 17
0
 protected void SearchBtn_Click(object sender, EventArgs e)
 {
     dgvCatalogue.DataSource = RayBizLogic.SearchCatalogue(SearchBox.Text);
     dgvCatalogue.DataBind();
     dgvCatalogue.AllowPaging = true;
 }
Ejemplo n.º 18
0
 protected void dgvAdjVoucher_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     dgvAdjVoucher.PageIndex  = e.NewPageIndex;
     dgvAdjVoucher.DataSource = RayBizLogic.AdjustmentVoucherList();
     dgvAdjVoucher.DataBind();
 }