protected void brnUpdateStyles_Click(object sender, EventArgs e) { List<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); foreach (GridViewRow row in gvBoxContainerDetails.Rows) { Image imgItems = (Image)row.FindControl("imgItem"); CheckBox chkItems = (CheckBox)row.FindControl("chkItem"); if (chkItems.Checked) { PullOutLetterDetail pld = new PullOutLetterDetail { ContainerNumber= int.Parse(row.Cells[3].Text), ContainerType = row.Cells[2].Text, IsLostTag = bool.Parse(imgItems.AlternateText), PullOutLetterCode = hfPullOutCode.Value, Quantity = int.Parse(row.Cells[6].Text), RecordNumber = int.Parse(imgItems.ToolTip), SRP = decimal.Parse(row.Cells[7].Text), StyleDescription = row.Cells[5].Text, StyleNumber = row.Cells[4].Text, TtlAmount = decimal.Parse(row.Cells[8].Text) }; selectedItems.Add(pld); } } if (selectedItems.Count> 0) { gvSelectedItems.DataSource = selectedItems; gvSelectedItems.DataBind(); hfUpdateStyleModalHandler_ModalPopupExtender.Show(); } }
protected void bntDeleteYes_Click(object sender, EventArgs e) { List<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); foreach (GridViewRow row in gvBoxContainerDetails.Rows) { Image imgItems = (Image)row.FindControl("imgItem"); CheckBox chkItems = (CheckBox)row.FindControl("chkItem"); if (chkItems.Checked) { PullOutLetterDetail pld = new PullOutLetterDetail { ContainerNumber = int.Parse(row.Cells[3].Text), ContainerType = row.Cells[2].Text, IsLostTag = bool.Parse(imgItems.AlternateText), PullOutLetterCode = hfPullOutCode.Value, Quantity = int.Parse(row.Cells[6].Text), RecordNumber = int.Parse(imgItems.ToolTip), SRP = decimal.Parse(row.Cells[7].Text), StyleDescription = row.Cells[5].Text, StyleNumber = row.Cells[4].Text, TtlAmount = decimal.Parse(row.Cells[8].Text) }; selectedItems.Add(pld); } } POLDetailManager.Delete(selectedItems); PullOutLetter pullOutLetter = POLManager.FetchById(int.Parse(Request.QueryString["PullOutId"])); pullOutLetter.TotalQuantity -= (int)selectedItems.Sum(s => s.Quantity); POLManager.Save(pullOutLetter); ReloadDetailsView(); }
protected void btnSaveRequest_Click(object sender, EventArgs e) { int HDRID = SaveRequest(); foreach (TableRow Row in gvPODetailList.Rows) { PullOutLetterDetail PD = new PullOutLetterDetail(); // PD.PullOutLetterCode = HDRID; PD.ContainerNumber = Convert.ToInt32(Row.Cells[3].Text); PD.StyleNumber = Row.Cells[4].Text; PD.StyleDescription = Row.Cells[5].Text; PD.Quantity = Convert.ToInt32(Row.Cells[6].Text); PD.SRP = Convert.ToDecimal(Row.Cells[7].Text.Replace("Php", "")); PD.TtlAmount = Convert.ToDecimal(Row.Cells[8].Text.Replace("Php", "")); PODetailManager.SaveItems(PD); } Redirector.Redirect("~/Marketing/RequestPanel.aspx"); }
protected void gvContainers_SelectedIndexChanged(object sender, EventArgs e) { string containterType = gvContainers.SelectedValue.ToString().Split('#')[0]; int containerNumber = int.Parse(gvContainers.SelectedValue.ToString().Split('#')[1]); List<PullOutLetterDetail> containerDetails = POLDetailManager.FetchAll().Where(s => s.PullOutLetterCode == hfPullOutCode.Value && s.ContainerType == containterType && s.ContainerNumber == containerNumber) .ToList(); long totalQty = 0; decimal totalAmt = 0; int totalStyles = containerDetails.Count; foreach (var item in containerDetails) { totalQty += item.Quantity; totalAmt += item.TtlAmount; } PullOutLetterDetail pullOutSummary = new PullOutLetterDetail { ContainerType = "TOTAL " + containterType + "#" + containerNumber.ToString(), Quantity = totalQty, StyleNumber=totalStyles.ToString(), TtlAmount = totalAmt, SRP = decimal.Parse("0"), }; containerDetails.Add(pullOutSummary); gvBoxContainerDetails.DataSource = containerDetails; gvBoxContainerDetails.DataBind(); int rows = gvContainers.Rows.Count-1; int selected_row =gvContainers.SelectedRow.RowIndex; if (rows ==selected_row) { pnlSummary.Visible = true; } else { pnlSummary.Visible = false; } }
private IList<PullOutLetterDetail> getSelectedStylesForSacks() { IList<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); foreach (GridViewRow row in this.gvSelectedStylesForSacks.Rows) { CheckBox chkItem = (CheckBox)row.FindControl("chkItems"); CheckBox chkIsLostTag = (CheckBox)row.FindControl("chkIsLostTag"); if (!chkItem.Checked) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(row.Cells[8].Text), StyleDescription = row.Cells[3].Text, Quantity = int.Parse(row.Cells[4].Text), SRP = decimal.Parse(row.Cells[5].Text), StyleNumber = row.Cells[2].Text, TtlAmount = decimal.Parse(row.Cells[6].Text), IsLostTag = chkIsLostTag.Checked, ContainerType = "SACK", PullOutLetterCode = hfPullOutLetterCode.Value }; selectedItems.Add(pd); } } return selectedItems; }
protected void btnAddSelected_Click(object sender, EventArgs e) { try { IList<PullOutLetterDetail> BoxItems = getSelectedStylesForBoxes(); IList<ITEM> BoxesStyles = new List<ITEM>(); List<StylePrice> BOX_PRICES = new List<StylePrice>(); IList<PullOutLetterDetail> SackItems = getSelectedStylesForSacks(); IList<ITEM> SacksStyles = new List<ITEM>(); List<StylePrice> SACK_PRICES = new List<StylePrice>(); List<Container> boxContainers = boxesContainer(); List<Container> sackContainers = sacksContainer(); long totalQty = long.Parse(txtTotalQTY.Text); long totalBoxContainersQty = BoxItems.Sum(b => b.Quantity); long totalSackContainersQty = SackItems.Sum(s => s.Quantity); long totalContainersQty = (totalBoxContainersQty + totalSackContainersQty); #region populate for boxes foreach (GridViewRow row in gvStyles.Rows) { CheckBox chkItem = (CheckBox)row.FindControl("chkItems"); TextBox txtQuantity = (TextBox)row.FindControl("txtQty"); CheckBox chkIsLostTag = (CheckBox)row.FindControl("chkIsLostTag"); if (chkItem.Checked) { int qty; if (string.IsNullOrEmpty(txtQuantity.Text) || int.TryParse(txtQuantity.Text, out qty) == false) { txtQuantity.Text = "1"; } //for boxes if (chkBoxList.Items.Count > 0) { for (int i = 0; i < chkBoxList.Items.Count; i++) { if (chkBoxList.Items[i].Selected) { ITEM style = new ITEM { APType = chkIsLostTag.Checked.ToString(), Brand = hfFromBrand.Value, CostPrice = decimal.Parse(txtQuantity.Text), //as quantity Description = row.Cells[4].Text, StyleNumber = row.Cells[2].Text, Box = int.Parse(chkBoxList.Items[i].Value) }; if (!isAlreadySelected(BoxItems, style.StyleNumber, int.Parse(chkBoxList.Items[i].Value))) { BoxesStyles.Add(style); } } } } //for sacks if (chkSackList.Items.Count > 0) { for (int i = 0; i < this.chkSackList.Items.Count; i++) { if (chkSackList.Items[i].Selected) { ITEM style = new ITEM { APType = chkIsLostTag.Checked.ToString(), Brand =hfFromBrand.Value, CostPrice = decimal.Parse(txtQuantity.Text), //as quantity Description = row.Cells[4].Text, StyleNumber = row.Cells[2].Text, Box = int.Parse(chkSackList.Items[i].Value) }; if (!isAlreadySelected(SackItems, style.StyleNumber, int.Parse(chkSackList.Items[i].Value))) { SacksStyles.Add(style); } } } } } } if (totalQty > totalContainersQty) { this.lblErrorMessage.Text = ""; this.hfErrorModalHandLer_ModalPopupExtender.Show(); return; } //for boxes if (chkBoxList.Items.Count > 0) { foreach (ITEM item_ in BoxesStyles) { StylePrice price_ = new StylePrice(); price_ = PricePointManager.GetStyleCurrentPrice(item_.StyleNumber, int.Parse(hfPGMDNo.Value), int.Parse(hfAreaGroupNo.Value), int.Parse(hfSubAreaGroupNo.Value), int.Parse(hfCustomerNumber.Value)); if (price_ != null) { price_.PriceType = "MARKDOWN"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = getSRP(item_, price_).Price; price_.GenMemoID = (int)item_.CostPrice; // as quantity BOX_PRICES.Add(price_); } else { price_ = getSRP(item_, price_); BOX_PRICES.Add(price_); } } foreach (StylePrice price_ in BOX_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType) , ContainerType = "BOX", PullOutLetterCode = hfPullOutLetterCode.Value }; BoxItems.Add(pd); } gvSelectedStyles.DataSource = BoxItems.OrderBy(s => s.ContainerNumber).ThenBy(s => s.StyleNumber); gvSelectedStyles.DataBind(); } //for sacks if (chkSackList.Items.Count > 0) { foreach (ITEM item_ in SacksStyles) { StylePrice price_ = new StylePrice(); price_ = PricePointManager.GetStyleCurrentPrice(item_.StyleNumber, int.Parse(hfPGMDNo.Value), int.Parse(hfAreaGroupNo.Value), int.Parse(hfSubAreaGroupNo.Value), int.Parse(hfCustomerNumber.Value)); if (price_ != null) { price_.PriceType = "MARKDOWN"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = getSRP(item_, price_).Price; price_.GenMemoID = (int)item_.CostPrice; // as quantity SACK_PRICES.Add(price_); } else { price_ = getSRP(item_, price_); SACK_PRICES.Add(price_); } } foreach (StylePrice price_ in SACK_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType), ContainerType = "SACK", PullOutLetterCode = hfPullOutLetterCode.Value }; SackItems.Add(pd); } this.gvSelectedStylesForSacks.DataSource = SackItems.OrderBy(s => s.ContainerNumber).ThenBy(s => s.StyleNumber); gvSelectedStylesForSacks.DataBind(); } uncheckSelectedStyles(); #endregion } catch (Exception ex) { lblErrorMessage.Text = ex.Message; hfErrorModalHandLer_ModalPopupExtender.Show(); //throw; } }
protected void btnSaveUpdate_Click(object sender, EventArgs e) { List<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); foreach (GridViewRow row in gvSelectedItems.Rows) { Image imgItems = (Image)row.FindControl("imgStyle"); TextBox txtSelectedItemQty = (TextBox)row.FindControl("txtSelectedItemQty"); PullOutLetterDetail pld = new PullOutLetterDetail { ContainerNumber = int.Parse(row.Cells[2].Text), ContainerType = row.Cells[1].Text, IsLostTag = false, PullOutLetterCode = hfPullOutCode.Value, Quantity = int.Parse(txtSelectedItemQty.Text), RecordNumber = int.Parse(imgItems.AlternateText), SRP = decimal.Parse(row.Cells[6].Text), StyleDescription = row.Cells[4].Text, StyleNumber = row.Cells[3].Text, TtlAmount = int.Parse(txtSelectedItemQty.Text) * decimal.Parse(row.Cells[6].Text) }; selectedItems.Add(pld); } POLDetailManager.Save(selectedItems); PullOutLetter pullOutLetter = POLManager.FetchById(int.Parse(Request.QueryString["PullOutId"])); pullOutLetter.TotalQuantity = (int)POLDetailManager.FetchAll().Where(s => s.PullOutLetterCode == hfPullOutCode.Value).Sum(s => s.Quantity); POLManager.Save(pullOutLetter); ReloadDetailsView(); }
protected void btnSaveSelectedStyles_Click(object sender, EventArgs e) { List<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); IList<ITEM> ContainerStyles = new List<ITEM>(); List<StylePrice> STYLE_PRICES = new List<StylePrice>(); int containerNumber = 0; string containerType = string.Empty; if (pnlContainerOptions.Visible) { containerType = rdioContainers.SelectedValue.ToString().Split('#')[0]; containerNumber = int.Parse(rdioContainers.SelectedValue.ToString().Split('#')[1]); } else { containerType= gvContainers.SelectedValue.ToString().Split('#')[0]; containerNumber =int.Parse(gvContainers.SelectedValue.ToString().Split('#')[1]); } #region populate for boxes foreach (GridViewRow row in gvStyles.Rows) { CheckBox chkItem = (CheckBox)row.FindControl("chkStyles"); TextBox txtQuantity = (TextBox)row.FindControl("txtQty"); if (chkItem.Checked) { int qty; if (string.IsNullOrEmpty(txtQuantity.Text) || int.TryParse(txtQuantity.Text, out qty) == false) { txtQuantity.Text = "1"; } if (rdioContainers.Items.Count > 0) { ITEM style = new ITEM { APType = "False", Brand = txtBrand.Text, CostPrice = decimal.Parse(txtQuantity.Text), //as quantity Description = row.Cells[4].Text, StyleNumber = row.Cells[2].Text, Box = containerNumber }; ContainerStyles.Add(style); } } } if (rdioContainers.Items.Count > 0) { foreach (ITEM item_ in ContainerStyles) { StylePrice price_ = new StylePrice(); price_ = PricePointManager.GetStyleCurrentPrice(item_.StyleNumber, int.Parse(hfPGMDNo.Value), int.Parse(hfAreaGroupNo.Value), int.Parse(hfSubAreaGroupNo.Value), int.Parse(hfCustomerNumber.Value)); if (price_ != null) { price_.PriceType = "MARKDOWN"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = getSRP(item_, price_).Price; price_.GenMemoID = (int)item_.CostPrice; // as quantity STYLE_PRICES.Add(price_); } else { price_ = getSRP(item_, price_); STYLE_PRICES.Add(price_); } } foreach (StylePrice price_ in STYLE_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType), ContainerType =containerType, PullOutLetterCode = hfPullOutCode.Value }; selectedItems.Add(pd); } POLDetailManager.Save(selectedItems); PullOutLetter pullOutLetter = POLManager.FetchById(int.Parse(Request.QueryString["PullOutId"])); pullOutLetter.TotalQuantity += (int)selectedItems.Sum(s => s.Quantity); POLManager.Save(pullOutLetter); ReloadDetailsView(); } #endregion }
protected void btnSaveLostTag_Click(object sender, EventArgs e) { int containerNumber = 0; string containerType = string.Empty; if (pnlrdioLostTagContainers.Visible) { containerType = rdioLostTagContainers.SelectedValue.ToString().Split('#')[0]; containerNumber = int.Parse(rdioLostTagContainers.SelectedValue.ToString().Split('#')[1]); } else { containerType = gvContainers.SelectedValue.ToString().Split('#')[0]; containerNumber = int.Parse(gvContainers.SelectedValue.ToString().Split('#')[1]); } PullOutLetterDetail newLostTag = new PullOutLetterDetail { ContainerNumber= containerNumber, ContainerType = containerType, IsLostTag = true, PullOutLetterCode = hfPullOutCode.Value, Quantity = int.Parse(txtLostTagQty.Text), SRP = 00, StyleDescription ="N/A", StyleNumber = "LOST TAG", TtlAmount =00 }; POLDetailManager.Save(newLostTag); PullOutLetter pullOutLetter = POLManager.FetchById(int.Parse(Request.QueryString["PullOutId"])); pullOutLetter.TotalQuantity += (int)newLostTag.Quantity; POLManager.Save(pullOutLetter); ReloadDetailsView(); }
protected void btnAddToDetails_Click(object sender, EventArgs e) { IList<PullOutLetterDetail> BoxItems = getSelectedStylesForBoxes(); int containerNumber = int.Parse(gvPOLSummaries.SelectedValue.ToString()); string containerType = gvPOLSummaries.SelectedDataKey[1].ToString(); long totalQty =long.Parse(gvPOLSummaries.SelectedDataKey[2].ToString()); long totalQtyPerContainer = BoxItems.Where(i => i.ContainerType == containerType && i.ContainerNumber == containerNumber).Sum(i => i.Quantity); int totalSelectedStyleTobeAdded = 0; try { IList<ITEM> ContainerStyles = new List<ITEM>(); List<StylePrice> CONTAINER_PRICES = new List<StylePrice>(); #region populate for boxes foreach (GridViewRow row in gvStyles.Rows) { CheckBox chkItem = (CheckBox)row.FindControl("chkItems"); TextBox txtQuantity = (TextBox)row.FindControl("txtQty"); CheckBox chkIsLostTag = (CheckBox)row.FindControl("chkIsLostTag"); if (chkItem.Checked) { int qty; if (string.IsNullOrEmpty(txtQuantity.Text) || int.TryParse(txtQuantity.Text, out qty) == false) { txtQuantity.Text = "1"; } ITEM style = new ITEM { APType = chkIsLostTag.Checked.ToString(), Brand = hfFromBrand.Value, CostPrice = decimal.Parse(txtQuantity.Text), //as quantity Description = row.Cells[4].Text, StyleNumber = row.Cells[2].Text, Box = containerNumber }; if (!isAlreadySelected(BoxItems, style.StyleNumber, containerNumber)) { totalSelectedStyleTobeAdded+=(int)style.CostPrice; ContainerStyles.Add(style); } } } if ((totalQtyPerContainer + totalSelectedStyleTobeAdded) > totalQty) { lblErrorMessage.Text = "Container " + containerType + ":" + containerNumber + " is greater than " + totalQty.ToString() + " Styles!"; hfErrorModalHandLer_ModalPopupExtender.Show(); return; } //for boxes foreach (ITEM item_ in ContainerStyles) { StylePrice price_ = new StylePrice(); price_ = PricePointManager.GetStyleCurrentPrice(item_.StyleNumber, int.Parse(hfPGMDNo.Value), int.Parse(hfAreaGroupNo.Value), int.Parse(hfSubAreaGroupNo.Value), int.Parse(hfCustomerNumber.Value)); if (price_ != null) { price_.PriceType = "MARKDOWN"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = getSRP(item_, price_).Price; price_.GenMemoID = (int)item_.CostPrice; // as quantity CONTAINER_PRICES.Add(price_); } else { price_ = getSRP(item_, price_); CONTAINER_PRICES.Add(price_); } } foreach (StylePrice price_ in CONTAINER_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType) , ContainerType = containerType, PullOutLetterCode = hfPullOutLetterCode.Value }; BoxItems.Add(pd); } lblTotalSelected.Text = "Total Styles:" + BoxItems.Count.ToString("###,##0"); lblTotalAmount.Text = "Total Amt:" + BoxItems.Sum(i => i.TtlAmount).ToString("###,##0.00"); gvSelectedStyles.DataSource = BoxItems.OrderBy(s => s.ContainerNumber).ThenBy(s => s.StyleNumber); gvSelectedStyles.DataBind(); #endregion } catch (Exception ex) { lblErrorMessage.Text = ex.Message; hfErrorModalHandLer_ModalPopupExtender.Show(); // throw; } btnSaveTransfer.Enabled = true; }
private IList<PullOutLetterDetail> getSelectedStylesForBoxes() { IList<PullOutLetterDetail> selectedItems = new List<PullOutLetterDetail>(); string containerType = gvPOLSummaries.SelectedDataKey[1].ToString(); foreach (GridViewRow row in this.gvSelectedStyles.Rows) { CheckBox chkItem = (CheckBox)row.FindControl("chkItems"); //CheckBox chkIsLostTag = (CheckBox)row.FindControl("chkIsLostTag"); if (!chkItem.Checked) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(row.Cells[7].Text), StyleDescription = row.Cells[3].Text, Quantity = int.Parse(row.Cells[4].Text), SRP = decimal.Parse(row.Cells[5].Text), StyleNumber = row.Cells[2].Text, TtlAmount = decimal.Parse(row.Cells[6].Text), IsLostTag = false, ContainerType = containerType, PullOutLetterCode = hfPullOutLetterCode.Value }; selectedItems.Add(pd); } } return selectedItems; }
protected void btnUpdateRequest_Click(object sender, EventArgs e) { conn.Open(); cmd.Connection = conn; cmd.CommandTimeout = 300; cmd.CommandText = "delete from pullout_detail where pullout_id = '" + Session["ID"] + "'"; cmd.ExecuteNonQuery(); conn.Close(); foreach (TableRow Row in gvPODetailList.Rows) { PullOutLetterDetail PD = new PullOutLetterDetail(); PD.PullOutLetterCode = (txtRecordNo.Text); PD.ContainerNumber = Convert.ToInt32(Row.Cells[3].Text); PD.StyleNumber = Row.Cells[4].Text; PD.StyleDescription = Row.Cells[5].Text; PD.Quantity = Convert.ToInt32(Row.Cells[6].Text); PD.SRP = Convert.ToDecimal(Row.Cells[7].Text.Replace("Php", "")); PD.TtlAmount = Convert.ToDecimal(Row.Cells[8].Text.Replace("Php", "")); PODetailManager.SaveItems(PD); } Redirector.Redirect("~/Marketing/RequestPanel.aspx"); }
protected void SaveItems() { if (txtCustomer.Text == string.Empty) { pnlError.Visible = true; lblError.Text = "PLEASE INSERT CUSTOMER!!!"; } else if (txtPulloutDate.Text == string.Empty) { pnlError.Visible = true; lblError.Text = "PLEASE INSERT CUSTOMER!!!"; } else if (txtStyleno.Text == string.Empty && chkLostTag.Checked == false) { pnlError.Visible = true; lblError.Text = "PLEASE INSERT STYLENO!!!"; } else if (txtQuantity.Text == string.Empty) { pnlError.Visible = true; lblError.Text = "PLEASE INSERT QUANTITY!!!"; } else if (txtSRP.Text == string.Empty && chkLostTag.Checked == false) { pnlError.Visible = true; lblError.Text = "PLEASE INSERT SRP!!!"; } else { foreach (TableRow rows in gvPODetailList.Rows) { PullOutLetterDetail PD = new PullOutLetterDetail(); PD.ContainerNumber = Convert.ToInt32(rows.Cells[3].Text); PD.StyleNumber = rows.Cells[4].Text; PD.StyleDescription = rows.Cells[5].Text; PD.Quantity = Convert.ToInt32(rows.Cells[6].Text); PD.SRP = Convert.ToDecimal(rows.Cells[7].Text.Replace("Php", "")); PD.TtlAmount = Convert.ToDecimal(rows.Cells[8].Text.Replace("Php", "")); LPD.Add(PD); } PullOutLetterDetail PullOut_detail = new PullOutLetterDetail(); PullOut_detail.ContainerNumber = Convert.ToInt32(txtBoxNo.Text); PullOut_detail.Quantity = Convert.ToInt32(txtQuantity.Text); if (chkLostTag.Checked == true) { PullOut_detail.StyleNumber = "Lost Tag"; PullOut_detail.StyleDescription = "" + txtBrandCode.Text + " - " + rblDescription.SelectedItem.Text + ""; PullOut_detail.SRP = decimal.Parse(txtSRP.Text); PullOut_detail.TtlAmount = decimal.Parse(txtQuantity.Text) * decimal.Parse(txtSRP.Text); } else { PullOut_detail.StyleNumber = txtStyleno.Text; PullOut_detail.StyleDescription = txtDescription.Text; PullOut_detail.SRP = Convert.ToDecimal(txtSRP.Text); PullOut_detail.TtlAmount = Convert.ToInt32(txtQuantity.Text) * Convert.ToDecimal(txtSRP.Text); } LPD.Add(PullOut_detail); gvPODetailList.DataSource = LPD; gvPODetailList.DataBind(); txtStyleno.Text = string.Empty; txtDescription.Text = string.Empty; txtQuantity.Text = string.Empty; txtSRP.Text = "0.00"; pnlError.Visible = false; } }
protected void gvPODetailList_RowDeleting(object sender, GridViewDeleteEventArgs e) { //if (txtRecordNo.Text != string.Empty) //{ // e.RowIndex = gvPODetailList.Rows. // PODetailManager.DeleteItems(PODetailManager.GetPODetailByID(e.RowIndex)); //} //else //{ foreach (GridViewRow rows in gvPODetailList.Rows) { PullOutLetterDetail PODtl = new PullOutLetterDetail(); PODtl.ContainerNumber = Convert.ToInt32(rows.Cells[3].Text); PODtl.StyleNumber = rows.Cells[4].Text; PODtl.StyleDescription = rows.Cells[5].Text; PODtl.Quantity = Convert.ToInt32(rows.Cells[6].Text); PODtl.SRP = Convert.ToDecimal(rows.Cells[7].Text.Replace("Php", "")); PODtl.TtlAmount = Convert.ToDecimal(rows.Cells[8].Text.Replace("Php", "")); LPD.Add(PODtl); } LPD.RemoveAt(e.RowIndex); gvPODetailList.DataSource = LPD; //} gvPODetailList.DataBind(); }
protected void btnSaveLostTag_Click(object sender, EventArgs e) { try { IList<PullOutLetterDetail> BoxItems = getSelectedStylesForBoxes(); IList<ITEM> BoxesStyles = new List<ITEM>(); List<StylePrice> BOX_PRICES = new List<StylePrice>(); IList<PullOutLetterDetail> SackItems = getSelectedStylesForSacks(); IList<ITEM> SacksStyles = new List<ITEM>(); List<StylePrice> SACK_PRICES = new List<StylePrice>(); List<Container> boxContainers = boxesContainer(); List<Container> sackContainers = sacksContainer(); #region populate for boxes //for boxes if (!string.IsNullOrEmpty(chkBoxList.SelectedValue)) { ITEM style = new ITEM { APType = "True", Brand = txtBrand.Text, CostPrice = decimal.Parse(txtLostTagQty.Text), //as quantity Description = "N/A", StyleNumber ="LOST TAG", Box = int.Parse(chkBoxList.SelectedValue) }; BoxesStyles.Add(style); } //for sacks if (!string.IsNullOrEmpty(chkSackList.SelectedValue)) { ITEM style = new ITEM { APType = "True", Brand = txtBrand.Text, CostPrice = decimal.Parse(txtLostTagQty.Text), //as quantity Description = "N/A", StyleNumber ="LOST TAG", Box = int.Parse(chkSackList.SelectedValue) }; SacksStyles.Add(style); } //for boxes if (!string.IsNullOrEmpty(chkBoxList.SelectedValue)) { foreach (ITEM item_ in BoxesStyles) { StylePrice price_ = new StylePrice(); price_.PriceType = "N/A"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = 00; price_.GenMemoID = (int)item_.CostPrice; // as quantity BOX_PRICES.Add(price_); } foreach (StylePrice price_ in BOX_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType) , ContainerType = "BOX", PullOutLetterCode = hfPullOutLetterCode.Value }; BoxItems.Add(pd); } gvSelectedStyles.DataSource = BoxItems.OrderBy(s => s.ContainerNumber).ThenBy(s => s.StyleNumber); gvSelectedStyles.DataBind(); } //for sacks if (!string.IsNullOrEmpty(chkSackList.SelectedValue)) { foreach (ITEM item_ in SacksStyles) { StylePrice price_ = new StylePrice(); price_.PriceType = "N/A"; price_.PGNo = item_.Box.ToString();//as boxNumber price_.GrpNo = item_.Description; //as Description price_.APType = item_.APType; price_.StyleNo = item_.StyleNumber; price_.SRP = 00; price_.GenMemoID = (int)item_.CostPrice; // as quantity SACK_PRICES.Add(price_); } foreach (StylePrice price_ in SACK_PRICES) { PullOutLetterDetail pd = new PullOutLetterDetail { ContainerNumber = int.Parse(price_.PGNo), StyleDescription = price_.GrpNo, Quantity = price_.GenMemoID, SRP = price_.Price, StyleNumber = price_.StyleNo, TtlAmount = (price_.GenMemoID * price_.Price), IsLostTag = bool.Parse(price_.APType), ContainerType = "SACK", PullOutLetterCode = hfPullOutLetterCode.Value }; SackItems.Add(pd); } this.gvSelectedStylesForSacks.DataSource = SackItems.OrderBy(s => s.ContainerNumber).ThenBy(s => s.StyleNumber); gvSelectedStylesForSacks.DataBind(); } uncheckSelectedStyles(); #endregion } catch (Exception ex) { lblErrorMessage.Text = ex.Message; hfErrorModalHandLer_ModalPopupExtender.Show(); throw; } }
private void initializeContainers() { List<Container> boxContainers = new List<Container>(); List<Container> sackContainers = new List<Container>(); List<Container> containers = new List<Container>(); List<PullOutLetterDetail> containerDetails = POLDetailManager.FetchAll().Where(s => s.PullOutLetterCode == hfPullOutCode.Value) .ToList(); List<PullOutLetterDetail> boxDetails = new List<PullOutLetterDetail>(); List<PullOutLetterDetail> sackDetails = new List<PullOutLetterDetail>(); int totalStyles = containerDetails.Select(a => a.StyleNumber).Distinct().ToList().Count; long totalQty = 0; decimal totalAmt = 0; foreach (var item in containerDetails) { if (item.ContainerType == "BOX") { boxDetails.Add(item); Container container = new Container { BoxNumber = "BOX#" + item.ContainerNumber , ImageUrl = "~/Resources/Box.png", }; containers.Add(container); } else { sackDetails.Add(item); Container container = new Container { BoxNumber = "SACK#" + item.ContainerNumber , ImageUrl = "~/Resources/Sack32.png" }; containers.Add(container); } totalQty += item.Quantity; totalAmt += item.TtlAmount; } //PullOutLetterDetail pullOutSummary = new PullOutLetterDetail //{ // ContainerType = "GRAND TOTAL:", // Quantity = totalQty, // StyleNumber = totalStyles.ToString(), // TtlAmount = totalAmt, // SRP = decimal.Parse("0"), //}; //containerDetails.Add(pullOutSummary); var Con = (from con in containers select new { BoxNumber = con.BoxNumber, ImageUrl = con.ImageUrl, qty = con.ItemsQuantity }).Distinct(); this.lblTotalQty.Text = totalQty.ToString(); this.lblTotalPrice.Text =totalAmt.ToString("###,###.00"); lblTotalNumberOfContainer.Text =Con.ToList().Count.ToString(); gvContainers.DataSource = Con; gvContainers.DataBind(); List<PullOutLetterDetail> detailsSummaries = new List<PullOutLetterDetail>(); foreach (var item in Con.ToList()) { PullOutLetterDetail pdSum = new PullOutLetterDetail(); foreach (var cd in containerDetails) { if (item.BoxNumber.Split('#')[0]==cd.ContainerType && int.Parse(item.BoxNumber.Split('#')[1])==cd.ContainerNumber) { pdSum.ContainerNumber = cd.ContainerNumber; pdSum.ContainerType = cd.ContainerType; pdSum.IsLostTag = cd.IsLostTag; pdSum.Quantity += cd.Quantity; pdSum.TtlAmount += cd.TtlAmount; pdSum.ContainerType = "TOTAL " + cd.ContainerType + "#" + cd.ContainerNumber; pdSum.StyleDescription = ""; cd.ContainerType = ""; cd.StyleDescription = "pc."; detailsSummaries.Add(cd); } } detailsSummaries.Add(pdSum); } gvDetails.DataSource = containerDetails; gvDetails.DataBind(); // detailsSummaries.Add(pullOutSummary); gvBoxContainerDetails.DataSource = detailsSummaries; gvBoxContainerDetails.DataBind(); lblBranch.Text = Request.QueryString["Branch"]; lblCustomer.Text = Request.QueryString["Customer"]; lblseries.Text = Request.QueryString["Series"]; }