Beispiel #1
0
    protected void GetQuoteData()
    {
        int AltQtyReq = 0;

        // get the matching quote data.
        ds = SqlHelper.ExecuteDataset(connectionString, "pSOEGetQuotes",
                                      new SqlParameter("@Organization", ""),
                                      new SqlParameter("@QuoteFilterField", ItemNoTextBox.Text),
                                      new SqlParameter("@QuoteFilterValue", QuoteFilterValueHidden.Value),
                                      new SqlParameter("@FreshQOH", QOHCommandHidden.Value));
        if (ds.Tables.Count <= 1)
        {
            // We only go one table back, something is wrong
            lblErrorMessage.Text = "Quote Recall Quote Lines problem " + QuoteNumber.Value;
            MessageUpdatePanel.Update();
            return;
        }
        dt = ds.Tables[1];
        if (dt.Rows.Count > 0)
        {
            SellStkQty.Value = dt.Rows[0]["SellStkUMQty"].ToString();
            SellStkUOM.Value = dt.Rows[0]["SellStkUM"].ToString();
            object sumObjectRemote;
            sumObjectRemote = dt.Compute("Sum(RemoteQty)", "1 = 1");
            // if there is more than one line for the same item, override the requested qtys
            if (int.Parse(sumObjectRemote.ToString()) > int.Parse(ReqQtyHidden.Value))
            {
                ReqQtyHidden.Value = string.Format("{0:#########0}", sumObjectRemote);
                AltQtyReq          = int.Parse(dt.Rows[0]["SellStkUMQty"].ToString());
                AltQtyReq          = AltQtyReq * int.Parse(sumObjectRemote.ToString());
                AltQtyHidden.Value = AltQtyReq.ToString();
                ReqQtyLabel.Text   = ReqQtyHidden.Value;
                AltQtyLabel.Text   = AltQtyHidden.Value;
            }
            AltQtyHidden.Value = String.Format(Num0Format, int.Parse(ReqQtyHidden.Value) * int.Parse(SellStkQty.Value));
            AltQtyLabel.Text   = AltQtyHidden.Value;
            object sumObjectAvail;
            sumObjectAvail       = dt.Compute("Sum(QOH)", "1 = 1");
            ReqAvailHidden.Value = string.Format("{0:#########0}", sumObjectAvail);
            ReqAvailLabel.Text   = ReqAvailHidden.Value;
            AltAvailLabel.Text   = String.Format(Num0Format, int.Parse(ReqAvailHidden.Value) * int.Parse(SellStkQty.Value));
        }
        else
        {
            //lblErrorMessage.Text = "Error " + ItemNoTextBox.Text + ":" + QuoteFilterValueHidden.Value + ":" + QOHCommandHidden.Value;
            lblErrorMessage.Text = "No Availability at any Branch";
            MessageUpdatePanel.Update();
        }
        BranchQOHGrid.DataSource = ds.Tables[1];
        BranchQOHGrid.DataBind();
        BranchUpdatePanel.Update();
    }
Beispiel #2
0
 protected void GetVirtualData(string ItemNo, string Loc)
 {
     try
     {
         // get the data.
         ds = SqlHelper.ExecuteDataset(RBConnectionString, "pGetVirtualQtys",
                                       new SqlParameter("@Loc", Loc),
                                       new SqlParameter("@Item", ItemNo));
         if (ds.Tables.Count == 1)
         {
             dt = ds.Tables[0];
             if (dt.Rows.Count > 0)
             {
                 BranchQOHGrid.Width = Unit.Pixel(250);
                 dt.Columns.Add("Location", typeof(string));
                 dt.Columns.Add("LocName", typeof(string));
                 dt.Columns.Add("RemoteQty", typeof(string));
                 dt.Columns.Add("StdCost", typeof(string));
                 dt.Columns.Add("AvgCost", typeof(string));
                 dt.Columns.Add("ReplCost", typeof(string));
                 dt.Columns.Add("QuoteNumber", typeof(string));
                 BranchQOHGrid.Columns[2].Visible  = false;
                 BranchQOHGrid.Columns[4].Visible  = false;
                 BranchQOHGrid.Columns[5].Visible  = false;
                 BranchQOHGrid.Columns[6].Visible  = false;
                 BranchQOHGrid.Columns[7].Visible  = false;
                 BranchQOHGrid.Columns[8].Visible  = false;
                 BranchQOHGrid.Columns[9].Visible  = false;
                 BranchQOHGrid.Columns[10].Visible = false;
                 BranchQOHGrid.Columns[11].Visible = false;
                 BranchQOHGrid.Columns[12].Visible = false;
                 BranchQOHGrid.Columns[13].Visible = false;
                 BranchQOHGrid.DataSource          = dt;
                 foreach (DataRow dr in dt.Rows)
                 {
                     ds = SqlHelper.ExecuteDataset(connectionString, "pSOEGetLocMaster",
                                                   new SqlParameter("@LocNo", dr["VirtualBinZone"].ToString()));
                     if (ds.Tables.Count > 1)
                     {
                         if (ds.Tables[1].Rows.Count > 0)
                         {
                             dr["Location"] = ds.Tables[1].Rows[0]["LocID"];
                             dr["LocName"]  = ds.Tables[1].Rows[0]["LocName"];
                         }
                     }
                 }
                 BranchQOHGrid.DataBind();
                 BranchUpdatePanel.Update();
             }
             else
             {
                 //lblErrorMessage.Text = "Error " + ItemNoTextBox.Text + ":" + QuoteFilterValueHidden.Value + ":" + QOHCommandHidden.Value;
                 lblErrorMessage.Text = "No Availabililty in Virtual Branch " + Loc;
                 MessageUpdatePanel.Update();
             }
         }
     }
     catch (Exception e3)
     {
         lblErrorMessage.Text = "pGetVirtualQtys Error " + e3.Message + ", " + e3.ToString();
         MessageUpdatePanel.Update();
     }
 }
Beispiel #3
0
    protected void GetAvailableData(string ItemNo, string Loc)
    {
        try
        {
            PriQtyAvaliable = 0;
            // set the z-item on the location
            CheckZItemBranch(Loc);
            // parse the input for possible UOM strings
            string QtyEntered = ReqQtyHidden.Value.Replace(",", "").Trim().ToUpper();
            char[] QtyArray   = QtyEntered.ToCharArray();
            string UOMText    = "";
            string Qtytext    = "";
            foreach (char c in QtyArray)
            {
                if (c.Equals('-'))
                {
                    Qtytext += c;
                }
                if (char.IsDigit(c))
                {
                    Qtytext += c;
                }
                if (c.Equals('.'))
                {
                    Qtytext += c;
                }
                if (char.IsLetter(c))
                {
                    UOMText += c;
                }
            }
            // get the data.
            ds = SqlHelper.ExecuteDataset(connectionString, "pSOEGetBrAvail",
                                          new SqlParameter("@SearchItemNo", ItemNo),
                                          new SqlParameter("@QtyRequested", Qtytext),
                                          new SqlParameter("@QtyUOM", UOMText),
                                          new SqlParameter("@PrimaryBranch", Loc));
            if (ds.Tables.Count >= 1)
            {
                if (ds.Tables.Count == 1)
                {
                    // We only go one table back, something is wrong
                    dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        lblErrorMessage.Text = "Branch Availability problem " + ItemNo.ToString() + Loc.ToString();
                        MessageUpdatePanel.Update();
                        SubmitButt.Visible = false;
                    }
                }
                else
                {
                    dt = ds.Tables[1];
                    if (dt.Rows.Count == 0)
                    {
                        lblErrorMessage.Text = "There is no Availability for " + ItemNo.ToString();
                        MessageUpdatePanel.Update();
                        SubmitButt.Visible = false;
                    }
                    else
                    {
                        dt.Columns.Add("RemoteQty", typeof(int));
                        dt.Columns.Add("RemotePieces", typeof(int), "RemoteQty * SellStkUMQty");
                        dt.Columns.Add("QuoteNumber", typeof(string));
                        // work the qty. first see if there is enough in the shipping branch
                        DataView dv = new DataView(dt, "", "Location", DataViewRowState.CurrentRows);
                        int      PrimaryRowIndex = dv.Find(Loc);
                        if (PrimaryRowIndex != -1)
                        {
                            // we found something
                            PriQtyAvaliable = int.Parse(dv[PrimaryRowIndex]["QOH"].ToString());
                            //if (PriQtyAvaliable > 0)
                            //{
                            //    dv[PrimaryRowIndex]["RemoteQty"] = PriQtyAvaliable;
                            //}
                            ReqAvailLabel.Text   = PriQtyAvaliable.ToString();
                            ReqAvailHidden.Value = PriQtyAvaliable.ToString();
                        }
                        else
                        {
                            PriQtyAvaliable    = 0;
                            ReqAvailLabel.Text = "0";
                        }
                        dv.Sort = "SortKey";
                        BranchQOHGrid.DataSource = dv;
                        BranchQOHGrid.DataBind();
                        if (dt.Rows.Count > 0)
                        {
                            SellStkQty.Value = dt.Rows[0]["SellStkUMQty"].ToString();
                            SellStkUOM.Value = dt.Rows[0]["SellStkUM"].ToString();
                        }

                        // Convert the substitute item pieces qty to req qty item piece qty
                        if (AltQtyHidden.Value != "" && AltQtyHidden.Value != "0")
                        {
                            int custReqQty = Convert.ToInt32(AltQtyHidden.Value.Replace(",", ""));
                            int qtyPerBox  = Convert.ToInt32(SellStkQty.Value);
                            int newReqQty  = 1;
                            if (custReqQty > qtyPerBox)
                            {
                                newReqQty = custReqQty / qtyPerBox;
                            }

                            ReqQtyHidden.Value = newReqQty.ToString();
                            AltQtyHidden.Value = String.Format("{0:###,###}", newReqQty * qtyPerBox); // Total pcs requested
                            ReqQtyLabel.Text   = ReqQtyHidden.Value;
                            AltQtyLabel.Text   = AltQtyHidden.Value;
                        }
                        else
                        {
                            ReqQtyHidden.Value = ds.Tables[2].Rows[0]["QtyToSell"].ToString();
                        }

                        //FilledQtyLabel.Text = ReqAvailHidden.Value;
                        //FilledQtyHidden.Value = ReqAvailHidden.Value;
                        //FilledPcsLabel.Text = String.Format(Num0Format, int.Parse(ReqAvailHidden.Value.Replace(",", "")) * int.Parse(SellStkQty.Value.Replace(",", "")));
                        //FilledPcsHidden.Value = String.Format(Num0Format, int.Parse(ReqAvailHidden.Value.Replace(",", "")) * int.Parse(SellStkQty.Value.Replace(",", "")));
                        AltAvailLabel.Text = String.Format(Num0Format, int.Parse(ReqAvailHidden.Value.Replace(",", "")) * int.Parse(SellStkQty.Value.Replace(",", "")));
                        AltQtyHidden.Value = String.Format(Num0Format, int.Parse(ReqQtyHidden.Value.Replace(",", "")) * int.Parse(SellStkQty.Value.Replace(",", "")));
                        AltQtyLabel.Text   = AltQtyHidden.Value;
                        SubmitButt.Visible = true;
                    }
                    BranchUpdatePanel.Update();
                }
            }
        }
        catch (Exception e3)
        {
            lblErrorMessage.Text = "GetAvailableData Error " + e3.Message + ", " + e3.ToString();
            MessageUpdatePanel.Update();
        }
    }