File manager - Edit - G:/PleskVhosts/indiaminerals.in/tlt.INFOFIXDEVELOPERS.COM/admin/StockList.aspx.cs
Back
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebApp.LIBS; using Business; namespace WebApp.admin { public partial class StockList : BasePageClass { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int CompnayId = SiteSession.CompnayId; Common.BindControl(ItemId, Global.Context.Items.AsEnumerable().Where(p=> p.CompnayId== CompnayId).ToList(), "ItemName", "ItemId", "Select"); //var Sale = Global.Context.StockQty(SiteSession.CompnayId).ToList(); //Common.BindControl(gvcompnay, Sale.ToList()); } } protected void Button1_Click(object sender, EventArgs e) { try { string str = " and CompnayId="+SiteSession.CompnayId+""; str = ItemId.SelectedValue.ConvertInt() > 0 ? (str.Length > 0 ? str + " and ItemId=" + ItemId.SelectedValue.ToString() : " ItemId=" + ItemId.SelectedValue.ToString()) : str; str = BrandId.SelectedValue.ConvertInt() > 0 ? (str.Length > 0 ? str + " and BrandId=" + BrandId.SelectedValue.ToString() : " BrandId=" + BrandId.SelectedValue.ToString()) : str; str = WeightId.SelectedValue.ConvertInt() > 0 ? (str.Length > 0 ? str + " and WeightId=" + WeightId.SelectedValue.ToString() : " WeightId=" + WeightId.SelectedValue.ToString()) : str; string DBODATE = str; string ReorderLevel = ""; int check = 0; if (fromDate.Text.Length > 0 && ToDate.Text.Length > 0) { var fdate = Common.DateConvertMultimatch(fromDate.Text); var tdate = Common.DateConvertMultimatch(ToDate.Text); str = (str.Length > 0 ? str + " and [Date] between '"+ fdate.ToString("dd-MMM-yyyy")+"' and '"+ tdate.ToString("dd-MMM-yyyy")+"'" : " [Date] between '" + fdate.ToString("dd/MM/yyyy") + "' and '" + tdate.ToString("dd/MM/yyyy")+"'"); DBODATE = (DBODATE.Length > 0 ? DBODATE + " and [Date] between '01-Mar-2021' and '" + fdate.AddDays(-1).ToString("dd-MMM-yyyy") + "'" : " [Date] between '01-Mar-2021' and '" + fdate.AddDays(-1).ToString("dd-MMM-yyyy") + "'"); check = 1; } if (ReorderLevelQty.Text.ConvertInt() > 0) { ReorderLevel = " where ((isnull(OpeningBalance,0)+isnull(PurchaseQuantity,0))-isnull(SaleQuantity,0))<=" + ReorderLevelQty.Text + ""; } var Datastr = "select xy.*,((isnull(OpeningBalance,0)+isnull(PurchaseQuantity,0))-isnull(SaleQuantity,0)) as InStock, ItemName,BrandName,WeightName from ( select ISNULL(x.ItemId,y.ItemId) as ItemId," + (check == 1 ? "isnull(OpeningBalance,0)" : "0.00") + " as OpeningBalance,ISNULL(x.BrandId,y.BrandId) as BrandId,ISNULL(x.WeightId,y.WeightId) as WeightId ,isnull(PurchaseQuantity,0) as PurchaseQuantity, isnull(SaleQuantity,0) as SaleQuantity from (select ISNULL(x.ItemId,y.ItemId) as ItemId,ISNULL(x.BrandId,y.BrandId) as BrandId,ISNULL(x.WeightId,y.WeightId) as WeightId ,isnull(PurchaseQuantity,0) as PurchaseQuantity, isnull(SaleQuantity,0) as SaleQuantity from (select ItemId,BrandId,WeightId, SUM(Quantity) as SaleQuantity from (select ItemId,BrandId,WeightId, isnull(Quantity,0) as Quantity from SaleItem,Sale where SaleItem.SaleId=Sale.SaleId " + str + " union all select ItemId,BrandId,WeightId, isnull(Quantity,0) as Quantity from SaleRateItem,SaleRate where SaleRateItem.SaleRateId=SaleRate.SaleRateId "+ str + " ) as m group by ItemId,BrandId,WeightId ) as x full join (select ItemId, BrandId, WeightId, SUM(Quantity) as PurchaseQuantity from PurchaseItem, Purchase where PurchaseItem.PurchaseId = Purchase.PurchaseId " + str + " group by ItemId, BrandId, WeightId) as y on x.ItemId = y.ItemId and x.BrandId = y.BrandId and x.WeightId = y.WeightId ) as x full join (select ISNULL(x.ItemId, y.ItemId) as ItemId, ISNULL(x.BrandId, y.BrandId) as BrandId, ISNULL(x.WeightId, y.WeightId) as WeightId, (isnull(PurchaseQuantity, 0) - isnull(SaleQuantity, 0)) as OpeningBalance from(select ItemId, BrandId, WeightId, SUM(Quantity) as SaleQuantity from(select ItemId, BrandId, WeightId, isnull(Quantity, 0) as Quantity from SaleItem, Sale where SaleItem.SaleId = Sale.SaleId " + DBODATE + " union all select ItemId, BrandId, WeightId, isnull(Quantity, 0) as Quantity from SaleRateItem, SaleRate where SaleRateItem.SaleRateId = SaleRate.SaleRateId "+ DBODATE + " ) as m group by ItemId,BrandId,WeightId ) as x full join ( select ItemId,BrandId,WeightId, SUM(Quantity) as PurchaseQuantity from PurchaseItem,Purchase where PurchaseItem.PurchaseId=Purchase.PurchaseId " + DBODATE + " group by ItemId,BrandId,WeightId) as y on x.ItemId=y.ItemId and x.BrandId=y.BrandId and x.WeightId=y.WeightId ) as y on x.ItemId=y.ItemId and x.BrandId=y.BrandId and x.WeightId=y.WeightId ) as xy left join Item on xy.ItemId=Item.ItemId left join Brand on xy.BrandId=Brand.BrandId left join [Weight] on xy.WeightId=[Weight].WeightId "+ ReorderLevel + ""; //string Datastr = "select xy.*,((isnull(OpeningBalance,0)+isnull(PurchaseQuantity,0))-isnull(SaleQuantity,0)) as InStock, ItemName,BrandName,WeightName from ( select ISNULL(x.ItemId,y.ItemId) as ItemId,ISNULL(x.BrandId,y.BrandId) as BrandId,ISNULL(x.WeightId,y.WeightId) as WeightId , dbo.GetOpeningStock(ISNULL(x.ItemId,y.ItemId) ,ISNULL(x.BrandId,y.BrandId),ISNULL(x.WeightId,y.WeightId),'" + DBODATE + "'," + SiteSession.CompnayId + ") as OpeningBalance,isnull(PurchaseQuantity,0) as PurchaseQuantity, isnull(SaleQuantity,0) as SaleQuantity from (select ItemId,BrandId,WeightId, SUM(Quantity) as SaleQuantity from (select ItemId,BrandId,WeightId, isnull(Quantity,0) as Quantity from SaleItem,Sale where SaleItem.SaleId=Sale.SaleId " + str + " union all select ItemId,BrandId,WeightId, isnull(Quantity,0) as Quantity from SaleRateItem,SaleRate where SaleRateItem.SaleRateId=SaleRate.SaleRateId " + str + " ) as m group by ItemId,BrandId,WeightId) as x full join ( select ItemId,BrandId,WeightId, SUM(Quantity) as PurchaseQuantity from PurchaseItem,Purchase where PurchaseItem.PurchaseId=Purchase.PurchaseId " + str + " group by ItemId,BrandId,WeightId) as y on x.ItemId=y.ItemId and x.BrandId=y.BrandId and x.WeightId=y.WeightId ) as xy left join Item on xy.ItemId=Item.ItemId left join Brand on xy.BrandId=Brand.BrandId left join [Weight] on xy.WeightId=[Weight].WeightId " + ReorderLevel + ""; var objdata = Global.Context.ExecuteStoreQuery<ItemStock>(Datastr).Where(p=> p.InStock!=0).OrderBy(p=> p.ItemName).ThenBy(p=> p.BrandName).ThenBy(p=> p.WeightName).ToList(); Common.BindControl(gvcompnay, objdata.ToList()); gvcompnay.FooterRow.Cells[4].Text = objdata.Sum(p=> p.OpeningBalance).ToString(); gvcompnay.FooterRow.Cells[5].Text = objdata.Sum(p => p.PurchaseQuantity).ToString(); gvcompnay.FooterRow.Cells[6].Text = objdata.Sum(p => p.SaleQuantity).ToString(); gvcompnay.FooterRow.Cells[7].Text = objdata.Sum(p => p.InStock).ToString(); } catch { } } protected void BrandId_SelectedIndexChanged(object sender, EventArgs e) { if (BrandId.SelectedValue != "Select") { int CompnayId = SiteSession.CompnayId; int Id = BrandId.SelectedValue.ConvertInt(); Common.BindControl(WeightId, Global.Context.Weights.AsEnumerable().Where(p => p.BrandId == Id && p.CompnayId==CompnayId).ToList(), "WeightName", "WeightId", "Select"); } else { WeightId.Items.Clear(); } } protected void ItemId_SelectedIndexChanged(object sender, EventArgs e) { if (ItemId.SelectedValue != "Select") { int CompnayId = SiteSession.CompnayId; int Id = ItemId.SelectedValue.ConvertInt(); Common.BindControl(BrandId, Global.Context.Brands.AsEnumerable().Where(p=> p.ItemId== Id && p.CompnayId== CompnayId).ToList(), "BrandName", "BrandId", "Select"); } else { BrandId.Items.Clear(); WeightId.Items.Clear(); } } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Printdoc/WebForm1.aspx?fromdate=" + fromDate.Text + "&&todate=" + ToDate.Text + "", false); } } } public class ItemStock { public int? ItemId { get; set; } public int? BrandId { get; set; } public int? WeightId { get; set; } public string ItemName { get; set; } public string BrandName { get; set; } public string WeightName { get; set; } public decimal PurchaseQuantity { get; set; } public decimal OpeningBalance { get; set; } public decimal SaleQuantity { get; set; } public decimal InStock { get; set; } }
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0.08 |
proxy
|
phpinfo
|
Settings