Beispiel #1
0
        public ActionResult DrillDown(DateTime?from, DateTime?to, int itemId)
        {
            ClosingStockRepository repo = new ClosingStockRepository();

            from = from ?? FYStartdate;
            to   = to ?? DateTime.Today;
            return(View(repo.GetItemWiseDetails(from, to, itemId)));
        }
Beispiel #2
0
        public ActionResult DrillDownIndex(int itemId)
        {
            ClosingStockRepository repo = new ClosingStockRepository();

            ViewBag.itemId = itemId;
            //ViewBag.ItemName = ItemName;
            ViewBag.startdate = FYStartdate;
            return(View());
        }
Beispiel #3
0
        //public ActionResult Details(int id)
        //{
        //    string str = ViewData["mode"].ToString();
        //    return View(new StockCreationRepository().GetStockCreation(id));
        //}

        public ActionResult GetStockQuantity(string date, int id = 0, int stockpoint = 0)
        {
            try
            {
                if (id == 0 || stockpoint == 0 || date == null)
                {
                    throw new InvalidOperationException();
                }
                ClosingStock stock = new ClosingStockRepository().GetClosingStockData(Convert.ToDateTime(date), stockpoint, 0, id, OrganizationId).First();
                return(Json(new { Quantity = stock.Quantity, UnitName = stock.UnitName }, JsonRequestBehavior.AllowGet));
            }
            catch (InvalidOperationException)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #4
0
        public ActionResult Print(DateTime?date, string Spname = "", int Spid = 0, int ItmCatid = 0, string ItmCatname = "", string Itmid = "", string PartNo = "")
        {
            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "ClosingStockReport.rpt"));

            DataSet ds = new DataSet();

            ds.Tables.Add("Head");
            ds.Tables.Add("Items");

            //    //-------HEAD
            ds.Tables["Head"].Columns.Add("Stkpoint");
            ds.Tables["Head"].Columns.Add("ItemCat");
            ds.Tables["Head"].Columns.Add("Item");
            ds.Tables["Head"].Columns.Add("OrganizationName");
            ds.Tables["Head"].Columns.Add("Image1");
            ds.Tables["Head"].Columns.Add("PartNum");

            //-------DT

            ds.Tables["Items"].Columns.Add("Item");
            ds.Tables["Items"].Columns.Add("RefNo");
            ds.Tables["Items"].Columns.Add("PartNo");
            ds.Tables["Items"].Columns.Add("ClosingStk");
            ds.Tables["Items"].Columns.Add("Unit");


            OrganizationRepository repo = new OrganizationRepository();
            var Head = repo.GetOrganization(OrganizationId);

            DataRow dr = ds.Tables["Head"].NewRow();

            dr["Stkpoint"]         = Spname;
            dr["ItemCat"]          = ItmCatname;
            dr["Item"]             = Itmid;
            dr["PartNum"]          = PartNo;
            dr["OrganizationName"] = Head.OrganizationName;
            dr["Image1"]           = Server.MapPath("~/App_images/") + Head.Image1;
            ds.Tables["Head"].Rows.Add(dr);


            ClosingStockRepository repo1 = new ClosingStockRepository();
            //var Items = repo1.GetSOVarianceDataDTPrint(from, to, itmid, itmName, SupId, SupName);
            var Items = repo1.GetClosingStockDataDTPrint(stockPointId: Spid, itemCategoryId: ItmCatid, itemId: Itmid, OrganizationId: OrganizationId, partno: PartNo);

            foreach (var item in Items)
            {
                var SupplyOrderRegItem = new OpeningStockReport
                {
                    ItemName = item.ItemName,
                    PartNo   = item.PartNo,
                    Quantity = item.Quantity,
                    UnitName = item.UnitName,
                };

                DataRow dri = ds.Tables["Items"].NewRow();
                dri["Item"]       = SupplyOrderRegItem.ItemName;
                dri["RefNo"]      = SupplyOrderRegItem.ItemName;
                dri["PartNo"]     = SupplyOrderRegItem.PartNo;
                dri["ClosingStk"] = SupplyOrderRegItem.Quantity;
                dri["Unit"]       = SupplyOrderRegItem.UnitName;
                ds.Tables["Items"].Rows.Add(dri);
            }

            ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "ClosingStockReport.xml"), XmlWriteMode.WriteSchema);

            rd.SetDataSource(ds);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return(File(stream, "application/pdf", String.Format("ClosingStockReport.pdf")));
            }
            catch (Exception ex)
            {
                throw;
            }
        }