protected void Txtitemid_TextChanged(object sender, EventArgs e)
        {
            try
            {
                GridViewRow currentRow = (GridViewRow)((TextBox)sender).Parent.Parent.Parent.Parent;
                TextBox     Txtitemid  = currentRow.FindControl("Txtitemid") as TextBox;
                inventoryItem = InventoryLogic.GetItemName(Txtitemid.Text);
                string  ItemID      = Txtitemid.Text;
                string  UOM         = PurchasingLogic.GetUOM(ItemID, DdlSli.SelectedValue);
                double  unitPrice   = PurchasingLogic.GetUnitPrice(ItemID, DdlSli.SelectedValue);
                TextBox TxtQuantity = currentRow.FindControl("TxtQuantity") as TextBox;
                int     quantity;

                Label DesLbl = currentRow.FindControl("LblDes") as Label;
                DesLbl.Text = inventoryItem;
                Label UnpLbl = currentRow.FindControl("LblUnp") as Label;
                UnpLbl.Text = PurchasingLogic.GetUnitPrice(ItemID, DdlSli.SelectedValue).ToString("C");
                Label LblUOM = currentRow.FindControl("LblUOM") as Label;
                LblUOM.Text = PurchasingLogic.GetUOM(ItemID, DdlSli.SelectedValue);

                if (int.TryParse(TxtQuantity.Text, out quantity))
                {
                    Label LblPrice = currentRow.FindControl("LblPrice") as Label;
                    LblPrice.Text = (quantity * unitPrice).ToString("c");
                    total        += (quantity * unitPrice);
                }
            }
            catch
            {
                statusMessage.Text    = "Some items entered are not provided by this supplier.";
                statusMessage.Visible = true;
            }
        }
        protected void FindBtn_Click(object sender, EventArgs e)
        {
            string itemcode = TxtItemCode.Text;
            int    bufferstocklevel;

            LblItemCode.Text = itemcode;
            try
            {
                InventoryCatalogue i = InventoryLogic.GetInventoryItem(itemcode);
                bufferstocklevel = PurchasingLogic.GetCurrentBufferStock(itemcode);
                if (bufferstocklevel >= 0)
                {
                    AutomationStatusLbl.Text = "The current buffer stock level is " + bufferstocklevel + ".";
                }
                else
                {
                    AutomationStatusLbl.Text = "The buffer stock level is currently calculated automatically.";
                }
                LblItemDescription.Text    = i.Description;
                MultiView1.ActiveViewIndex = 1;
                statusMessage.Visible      = false;
            }
            catch
            {
                statusMessage.Text      = "Item does not exist.";
                statusMessage.Visible   = true;
                statusMessage.ForeColor = Color.Red;
            }
        }
Ejemplo n.º 3
0
        protected void BindControl()
        {
            DropDownList ddl = DdlCategoryID;

            if (ddl != null)
            {
                ddl.DataSource     = BusinessLogic.InventoryLogic.CategoryID();
                ddl.DataTextField  = "CatalogueName";
                ddl.DataValueField = "CategoryID";
                ddl.DataBind();
            }
            List <SupplierList> sList = PurchasingLogic.ListSuppliers();

            DdlSupplier1.DataSource = sList;
            DdlSupplier1.DataBind();
            DdlSupplier1.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            DdlSupplier1.SelectedIndex = 0;
            DdlSupplier2.DataSource    = sList;
            DdlSupplier2.DataBind();
            DdlSupplier2.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            DdlSupplier2.SelectedIndex = 0;
            DdlSupplier3.DataSource    = sList;
            DdlSupplier3.DataBind();
            DdlSupplier3.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            DdlSupplier3.SelectedIndex = 0;
        }
        private void BindGrid(int pONumber)
        {
            List <PORecordDetail> poDetails = PurchasingLogic.GetListOfPORecorDetails(pONumber);

            GridViewAPO.DataSource = poDetails;
            GridViewAPO.DataBind();
        }
Ejemplo n.º 5
0
        protected void BindGrid()
        {
            List <PORecord> poRecordList = PurchasingLogic.GetListOfPurchaseOrder("Pending");

            GridViewLPO.DataSource = poRecordList;
            GridViewLPO.DataBind();
        }
Ejemplo n.º 6
0
        protected void DdlShow_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <PORecord> poRecordList = DdlShow.SelectedValue == "All" ? PurchasingLogic.GetListOfPurchaseOrder() : PurchasingLogic.GetListOfPurchaseOrder(DdlShow.SelectedValue);

            GridViewLPO.DataSource = poRecordList;
            GridViewLPO.DataBind();
        }
 protected void BtnAddItem_Click(object sender, EventArgs e)
 {
     try
     {
         List <PORecordDetail> poRecordDetailsList = new List <PORecordDetail>();
         foreach (GridViewRow r in GridViewPO.Rows)
         {
             PORecordDetail poRecordDetails = new PORecordDetail();
             poRecordDetails.ItemID    = (r.FindControl("Txtitemid") as TextBox).Text;
             poRecordDetails.UOM       = PurchasingLogic.GetUOM(poRecordDetails.ItemID, DdlSli.SelectedValue);
             poRecordDetails.Quantity  = int.Parse((r.FindControl("Txtquantity") as TextBox).Text);
             poRecordDetails.UnitPrice = PurchasingLogic.GetUnitPrice(poRecordDetails.ItemID, DdlSli.SelectedValue);
             poRecordDetailsList.Add(poRecordDetails);
         }
         PORecordDetail poRecordDetailsNew = new PORecordDetail();
         poRecordDetailsList.Add(poRecordDetailsNew);
         GridViewPO.DataSource = poRecordDetailsList;
         GridViewPO.DataBind();
     }
     //In the event when a wrong Supplier was selected or Invalid Item ID is entered.
     catch (Exception)
     {
         statusMessage.Text      = "Error! Please check that the correct Supplier and ItemID has been selected.";
         statusMessage.ForeColor = System.Drawing.Color.Red;
         statusMessage.Visible   = true;
     }
 }
        protected void BtnRetrieveGR_Click(object sender, EventArgs e)
        {
            statusMessage.Text = string.Empty;
            PurchasingLogic          pl           = new PurchasingLogic();
            int                      grNumber     = Utility.Utility.GetValidPrimaryKeyInt(TxtGRNumber.Text);
            GoodReceipt              goodReceipt  = pl.GetGoodsReceipt(grNumber);
            List <GoodReceiptDetail> grDetailList = pl.GetGoodsReceiptDetails(grNumber);

            if (grDetailList.Count == 0 || grNumber == -1)
            {
                ClearAllControls();
                statusMessage.Text      = "No such Goods Receipt number exist.";
                statusMessage.ForeColor = Color.Red;
                DisplayEmptyGrid();
            }
            else
            {
                LblDoNumber.Text      = goodReceipt.DONumber;
                LblPoNumber.Text      = goodReceipt.PONumber.ToString();
                LblClerkName.Text     = goodReceipt.ReceivedBy;
                LblGRDate.Text        = ((DateTime)goodReceipt.DateProcessed).ToString("d");
                GridViewGR.DataSource = grDetailList;
                GridViewGR.DataBind();
            }
        }
        protected void BtnAddSupplier_Click(object sender, EventArgs e)
        {
            statusMessage.Visible = false;
            List <SupplierList> sList = PurchasingLogic.ListSuppliers();
            string supplierID         = DdlSupplier.SelectedValue;

            if (supplierID == "All")
            {
                BindGrid(sList);
            }
            else
            {
                sList = (List <SupplierList>)Session["SupplierList"];
                SupplierList selectItem = PurchasingLogic.ListSuppliers().Where(x => x.SupplierID == supplierID).FirstOrDefault();
                if (!CheckIfSupplierNotExist(sList, selectItem))
                {
                    statusMessage.Text      = "Supplier Already Added to List";
                    statusMessage.ForeColor = System.Drawing.Color.Red;
                    statusMessage.Visible   = true;
                    return;
                }
                sList.Add(selectItem);
                Session["SupplierList"] = sList;
                BindGrid(sList);
            }
        }
Ejemplo n.º 10
0
        protected void BindGrid()
        {
            List <SupplierList> sList = PurchasingLogic.ListSuppliers();

            GridViewSupplier.DataSource = sList;
            GridViewSupplier.DataBind();
            Session["SupplierList"] = sList;
        }
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            int newbufferstocklevel;
            int proportional;

            if (AbsoluteRbtn.Checked)
            {
                if (Int32.TryParse(TxtAbsolute.Text, out newbufferstocklevel))
                {
                    PurchasingLogic.UpdateBufferStockLevel(TxtItemCode.Text, newbufferstocklevel);
                    AutomationStatusLbl.Text = "The current buffer stock level is " + newbufferstocklevel.ToString() + ".";
                    statusMessage.Text       = "The buffer stock level has been changed to " + newbufferstocklevel + ".";
                    statusMessage.Visible    = true;
                    statusMessage.ForeColor  = Color.Green;
                }
                else
                {
                    statusMessage.Text      = "Please enter a positive integer or 0.";
                    statusMessage.Visible   = true;
                    statusMessage.ForeColor = Color.Red;
                }
            }
            else if (ProportionalRbtn.Checked)
            {
                if (Int32.TryParse(TxtProportional.Text, out proportional))
                {
                    // From Khair with love ~
                    PurchasingLogic.SetProportionalBFS(TxtItemCode.Text, proportional);
                    AutomationStatusLbl.Text = "The current buffer stock level is " + PurchasingLogic.GetCurrentBufferStock(TxtItemCode.Text) + ".";
                    statusMessage.Text       = "The buffer stock level has been changed to be " + proportional + "% of the item's forecasted value.";
                    statusMessage.Visible    = true;
                    statusMessage.ForeColor  = Color.Green;
                }
                else
                {
                    statusMessage.Text      = "Please enter a positive integer or 0.";
                    statusMessage.Visible   = true;
                    statusMessage.ForeColor = Color.Red;
                }
            }
            else if (AutomationRbtn.Checked)
            {
                // From Khair with love ~
                AutomationLogic.SetAutomatedlBFS(TxtItemCode.Text);
                AutomationStatusLbl.Text = "The current buffer stock level is " + PurchasingLogic.GetCurrentBufferStock(TxtItemCode.Text) + ".";
                statusMessage.Text       = "The buffer stock level has been changed to be 10% of the item's forecasted value.";
                statusMessage.Visible    = true;
                statusMessage.ForeColor  = Color.Green;
            }
            else
            {
                statusMessage.Text      = "Please choose an option.";
                statusMessage.Visible   = true;
                statusMessage.ForeColor = Color.Red;
            }
            TxtAbsolute.Text     = "";
            TxtProportional.Text = "";
        }
        protected void BindGird(int poNo)
        {
            PORecord poRecord = PurchasingLogic.GetPurchaseOrderRecord(poNo);
            List <PORecordDetail> poRecordDetaillist = PurchasingLogic.GetListOfPORecorDetails(poNo);

            RequestOrProcessedView(poRecord);
            GridViewVPO.DataSource = poRecordDetaillist;
            GridViewVPO.DataBind();
        }
Ejemplo n.º 13
0
        public void TestGetCurrentOrderLeadTime()
        {
            //This is ALPHA Office Supplies
            string supplierID = "ALPA";
            //This should show the current order lead time of ALPHA Office Supplies - 3
            string orderLeadTime = PurchasingLogic.GetCurrentOrderLeadTime(supplierID).ToString();

            Console.WriteLine(orderLeadTime);
        }
Ejemplo n.º 14
0
        public void TestGetCurrentBufferStockLevel()
        {
            //This is Clips item
            string itemID = "C001";
            //This should show the current buffer stock level of Clips item -
            int bufferStockLevel = PurchasingLogic.GetCurrentBufferStock(itemID);

            Console.WriteLine(bufferStockLevel);
        }
Ejemplo n.º 15
0
        // Populating the details (2nd GridView) below
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Button btn      = (Button)sender;
            string tempText = btn.CommandArgument.ToString();

            string[] tempArray = tempText.Split(',');

            PurchasingLogic.RemoveReorderRecord(tempArray[0], tempArray[1]);
            PopulateGridView();
        }
 protected void RequestOrProcessedView(PORecord poRecord)
 {
     LblRst.Text      = poRecord.CreatedBy;
     LblStatus.Text   = poRecord.Status;
     LblDeliver.Text  = poRecord.CreatedBy;
     LblAddress.Text  = poRecord.DeliveryAddress;
     LblSupplier.Text = PurchasingLogic.ListSuppliers().Where(x => x.SupplierID == poRecord.SupplierID).Select(x => x.SupplierName).FirstOrDefault();
     LblSupply.Text   = ((DateTime)poRecord.ExpectedDelivery).ToString("d");
     LblNumber.Text   = poRecord.PONumber.ToString();
 }
        void BindControls()
        {
            List <SupplierList> sList     = PurchasingLogic.ListSuppliers();
            SupplierList        selectAll = new SupplierList();

            selectAll.SupplierID   = "All";
            selectAll.SupplierName = "All";
            sList.Add(selectAll);
            DdlSupplier.DataSource = sList;
            DdlSupplier.DataBind();
            DdlSupplier.SelectedIndex = sList.Count() - 1;
        }
        void DisplayLabel()
        {
            LblPODate.Text  = DateTime.Now.Date.ToString("d");
            LblRequest.Text = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString();
            List <SupplierList> sList = PurchasingLogic.ListSuppliers();

            DdlSli.DataSource = sList;
            DdlSli.DataBind();
            DdlSli.SelectedIndex = 0;
            TxtDlt.Text          = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString();
            TxtAds.Text          = "21 Lower Kent Ridge Rd, Singapore 119077";
            LblTotal.Text        = total.ToString("c");
        }
Ejemplo n.º 19
0
        protected void PopulateGridView()
        {
            tempList = PurchasingLogic.PopulateReorderTable();

            if (tempList == null)
            {
                BtnSubmitAll.Visible = false;
            }

            // Populating the gridview
            GridViewReorderList.DataSource = tempList;
            GridViewReorderList.DataBind();
        }
Ejemplo n.º 20
0
        protected int GetReorders(String status)
        {
            List <ReorderRecord> list = PurchasingLogic.PopulateReorderTable();

            if (list == null)
            {
                return(0);
            }
            else
            {
                return(list.Count);
            }
        }
        protected void btncancel_Click(object sender, EventArgs e)
        {
            int    poNumber = int.Parse(LblNumbeer.Text);
            string status   = "Rejected";

            LblStatus.Text = "Rejected";
            DateTime dateProcessed = DateTime.Now.Date;
            string   handledBy     = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString();

            PurchasingLogic.UpdatePurchaseOrderStatus(poNumber, status, dateProcessed, handledBy);
            statusMessage.Text      = "Rejected successfully";
            statusMessage.ForeColor = System.Drawing.Color.Green;
            btnapr.Visible          = false;
            btncancel.Visible       = false;
        }
        void DisplayLabels(int pONumber)
        {
            PORecord poR = PurchasingLogic.ListPORecords().Where(x => x.PONumber == pONumber).FirstOrDefault();

            LblNumbeer.Text = pONumber.ToString();
            LblDate.Text    = ((DateTime)poR.DateRequested).ToString("d");
            LblStatus.Text  = poR.Status;
            LblDeliver.Text = poR.RecipientName;
            LblAddress.Text = poR.DeliveryAddress;
            LblRequest.Text = poR.CreatedBy;
            LblCode.Text    = PurchasingLogic.ListSuppliers().Where(x => x.SupplierID == poR.SupplierID).Select(x => x.SupplierName).FirstOrDefault();
            if (poR.Status != "Pending")
            {
                btnapr.Visible    = false;
                btncancel.Visible = false;
            }
        }
Ejemplo n.º 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     statusMessage = this.Master.FindControl("LblStatus") as Label;
     if (!IsPostBack)
     {
         statusMessage.Visible       = false;
         SuppliersDdl.DataSource     = PurchasingLogic.ListSuppliers();
         SuppliersDdl.DataTextField  = "SupplierName";
         SuppliersDdl.DataValueField = "SupplierID";
         SuppliersDdl.DataBind();
         LblCurrentOrderLeadTime.Text = PurchasingLogic.GetCurrentOrderLeadTime(SuppliersDdl.SelectedValue).ToString();
     }
     else
     {
         ChangedLbl.Visible = true;
     }
 }
Ejemplo n.º 24
0
        protected void GridViewSupplier_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = GridViewSupplier.Rows[e.RowIndex];

            string SupplierID        = Convert.ToString(GridViewSupplier.DataKeys[e.RowIndex].Values[0]);
            string SupplierName      = Convert.ToString((row.FindControl("TxtSupplierName") as TextBox).Text);
            string GSTRegistrationNo = Convert.ToString((row.FindControl("TxtGSTRegistrationNo") as TextBox).Text);
            string ContactName       = Convert.ToString((row.FindControl("TxtContactName") as TextBox).Text);

            int    PhoneNo       = Convert.ToInt32((row.FindControl("TxtPhoneNo") as TextBox).Text);
            int    FaxNo         = Convert.ToInt32((row.FindControl("TxtFaxNo") as TextBox).Text);
            string Address       = Convert.ToString((row.FindControl("TxtAddress") as TextBox).Text);
            int    OrderLeadTime = Convert.ToInt32((row.FindControl("TxtOrderLeadTime") as TextBox).Text);
            string Discontinued  = Convert.ToString((row.FindControl("DdlDiscontinued") as DropDownList).Text);

            PurchasingLogic.UpdateSupplier(SupplierID, SupplierName, GSTRegistrationNo, ContactName, PhoneNo, FaxNo, Address, OrderLeadTime, Discontinued);
            GridViewSupplier.EditIndex = -1;
            BindGrid();
        }
        protected void BtnPostGR_Click(object sender, EventArgs e)
        {
            if (!ValidQty())
            {
                return;
            }

            DateTime        date      = DateTime.ParseExact(Request.Form["datepicker"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
            string          clerkName = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString();
            string          doNumber  = TxtDoNumber.Text;
            int             poNumber  = int.Parse(HiddenFieldPONumber.Value.ToString());
            PurchasingLogic pl        = new PurchasingLogic();
            InventoryLogic  il        = new InventoryLogic();
            PORecord        pr        = pl.GetPORecords(poNumber);

            if (!Utility.Validator.IsDateRangeValid(date, DateTime.Now.Date, true))
            {
                statusMessage.Text      = "Error! You cannot make a future date Goods Receipt!";
                statusMessage.ForeColor = Color.Red;
                statusMessage.Visible   = true;
                return;
            }
            int grNumber = pl.CreateGoodsReceipt(date, poNumber, clerkName, doNumber);

            foreach (GridViewRow r in GridViewGR.Rows)
            {
                string itemID   = (r.FindControl("LblItemCode") as Label).Text;
                int    quantity = int.Parse((r.FindControl("TxtQty") as TextBox).Text);
                string uom      = (r.FindControl("LblUom") as Label).Text;
                string remarks  = (r.FindControl("TxtRemarks") as TextBox).Text;

                pl.CreateGoodsReceiptDetails(grNumber, itemID, quantity, uom, remarks);

                string stockCardDesc = "Goods Receipt - GR" + grNumber.ToString("0000") + " Supplier " + pr.SupplierID;
                il.UpdateStockCard(stockCardDesc, itemID, date, "Add", quantity, uom);
            }
            //Here will check if the PO is already completed
            pl.GetPurchaseOrdersForGR(poNumber);
            poNumber            = -1;
            LblQtyValid.Visible = false;
            DisplaySuccessMessage(grNumber);
            DisplayEmptyGrid();
        }
        protected void BtnRetrievePO_Click(object sender, EventArgs e)
        {
            PurchasingLogic       pl           = new PurchasingLogic();
            List <PORecordDetail> poDetailList = pl.GetPurchaseOrdersForGR(int.Parse(TxtPONumber.Text.ToString()));

            if (poDetailList.Count == 0)
            {
                statusMessage.Text      = "No such Purchase Order exist.";
                statusMessage.ForeColor = Color.Red;
                DisplayEmptyGrid();
            }
            else
            {
                GridViewGR.DataSource = poDetailList;
                GridViewGR.DataBind();
                BtnPostGR.Visible = true;
            }
            HiddenFieldPONumber.Value = TxtPONumber.Text;
            statusMessage.Visible     = false;
        }
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Label LblSn = GridViewPO.Rows[e.RowIndex].Cells[0].FindControl("LblSn") as Label;
            int   sN    = int.Parse(LblSn.Text);

            List <PORecordDetail> poRecordDetailList = new List <PORecordDetail>();

            foreach (GridViewRow r in GridViewPO.Rows)
            {
                PORecordDetail poRecordDetails = new PORecordDetail();
                poRecordDetails.ItemID    = (r.FindControl("Txtitemid") as TextBox).Text;
                poRecordDetails.Quantity  = Convert.ToInt32((r.FindControl("Txtquantity") as TextBox).Text.ToString());
                poRecordDetails.UOM       = PurchasingLogic.GetUOM(poRecordDetails.ItemID, DdlSli.SelectedValue);
                poRecordDetails.UnitPrice = (double)(PurchasingLogic.GetUnitPrice(poRecordDetails.ItemID, DdlSli.SelectedValue));
                poRecordDetailList.Add(poRecordDetails);
            }
            poRecordDetailList.RemoveAt(sN - 1);
            GridViewPO.DataSource = poRecordDetailList;
            GridViewPO.DataBind();
        }
Ejemplo n.º 28
0
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            int a;

            if (Int32.TryParse(OrderLeadTimeTxt.Text, out a) && a >= 0)
            {
                int    orderLeadTime = a;
                string supplier      = SuppliersDdl.SelectedValue;
                PurchasingLogic.UpdateOrderLeadTime(orderLeadTime, supplier);
                statusMessage.Text           = "The Order Lead Time Of Supplier " + SuppliersDdl.SelectedItem + " has been changed to " + orderLeadTime.ToString() + " day(s).";
                statusMessage.Visible        = true;
                statusMessage.ForeColor      = Color.Green;
                LblCurrentOrderLeadTime.Text = PurchasingLogic.GetCurrentOrderLeadTime(SuppliersDdl.SelectedValue).ToString();
            }
            else
            {
                statusMessage.Text      = "Please enter a positive integer or 0.";
                statusMessage.Visible   = true;
                statusMessage.ForeColor = Color.Red;
            }
        }
Ejemplo n.º 29
0
        protected void BindControl(string itemID)
        {
            List <SupplierList> sList = PurchasingLogic.ListSuppliers();

            DdlSupplier1.DataSource = sList;
            DdlSupplier1.DataBind();
            DdlSupplier1.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            DdlSupplier1.SelectedValue = InventoryLogic.GetFirstPrioritySupplierByItemID(itemID);
            DdlSupplier2.DataSource    = sList;
            DdlSupplier2.DataBind();
            DdlSupplier2.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            if (InventoryLogic.GetSecondPrioritySupplierByItemID(itemID) != null)
            {
                DdlSupplier2.SelectedValue = InventoryLogic.GetSecondPrioritySupplierByItemID(itemID);
            }
            else
            {
                DdlSupplier2.SelectedIndex = 0;
            }
            DdlSupplier3.DataSource = sList;
            DdlSupplier3.DataBind();
            DdlSupplier3.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            if (InventoryLogic.GetThirdPrioritySupplierByItemID(itemID) != null)
            {
                DdlSupplier3.SelectedValue = InventoryLogic.GetThirdPrioritySupplierByItemID(itemID);
            }
            else
            {
                DdlSupplier3.SelectedIndex = 0;
            }
            TxtPriceS1.Text         = InventoryLogic.GetFirstPrioritySupplierPriceByItemID(itemID);
            TxtPriceS2.Text         = InventoryLogic.GetSecondPrioritySupplierPriceByItemID(itemID);
            TxtPriceS3.Text         = InventoryLogic.GetThirdPrioritySupplierPriceByItemID(itemID);
            TxtItemID.Text          = itemID;
            TxtItemID.ReadOnly      = true;
            TxtDescription.Text     = InventoryLogic.GetItemDescription(itemID);
            TxtDescription.ReadOnly = true;
            TxtCategory.Text        = InventoryLogic.GetCatalogueName(InventoryLogic.GetInventoryItem(itemID).CategoryID);
            TxtCategory.ReadOnly    = true;
        }
        protected void BtnSfa_Click(object sender, EventArgs e)
        {
            try
            {
                PurchasingLogic pl         = new PurchasingLogic();
                string          clerkName  = HttpContext.Current.Profile.GetPropertyValue("fullname").ToString();
                string          Deliverto  = TxtDlt.Text;
                string          SupplierID = DdlSli.Text;
                string          Address    = TxtAds.Text;
                //Get Date from Http Input Textbox
                DateTime ExpectedBy = DateTime.ParseExact(Request.Form["datepicker"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                //Remember to rename AddText method.
                int poNumber = BusinessLogic.PurchasingLogic.AddText(Deliverto, Address, SupplierID, DateTime.Now.Date, clerkName, ExpectedBy);

                foreach (GridViewRow r in GridViewPO.Rows)
                {
                    string itemID    = (r.FindControl("Txtitemid") as TextBox).Text;
                    int    quantity  = int.Parse((r.FindControl("Txtquantity") as TextBox).Text);
                    string uom       = PurchasingLogic.GetUOM(itemID, DdlSli.SelectedValue);
                    double unitPrice = (double)PurchasingLogic.GetUnitPrice(itemID, DdlSli.SelectedValue);
                    pl.CreatePurchaseOrderDetails(poNumber, itemID, quantity, uom, unitPrice);
                }

                string statusMsg = poNumber.ToString("0000") + " Created Successfully.";
                Session["PONumber"]    = poNumber;
                Session["POstatusMsg"] = statusMsg;
                Response.Redirect("~/StoreClerk/ViewPurchaseOrder.aspx");
            }
            catch
            {
                statusMessage.Text    = "Some items entered are not provided by this supplier.";
                statusMessage.Visible = true;
            }
            // pl.Submitforapproval(poNo, clerkName);

            //Session["PONumber"] = poNo;
            // Server.Transfer("ViewPurchaseOrder.aspx", true);
            // statusMessage.ForeColor = System.Drawing.Color.Green;
            // statusMessage.Text = "PO" + poNo.ToString() + "submitted successfully";
        }