public ActionResult RptPsrWiseSkuWiseDeliveryFilter(int[] rsMid, int[] asMid, int[] cEid, int[] id, DateTime startDate, DateTime endDate)
        {
            HashSet <int> dbids = sp.Alldbids(rsMid, asMid, cEid, id);

            ReportViewer reportViewer = new ReportViewer
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Pixel(600)
            };


            List <RPT_Delivery_PSRWiseSKUWiseDelivery_Result> psrskudelivery = Db.RPT_Delivery_PSRWiseSKUWiseDelivery(startDate, endDate).Where(x => dbids.Contains(x.DB_Id)).ToList();

            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\Delivery\RPT_PsrWiseSkuWiseDelivery.rdlc";

            ReportDataSource rdc = new ReportDataSource("PSRSKUDELIVERY", psrskudelivery);

            ReportParameter rp1 = new ReportParameter("DateParameter", startDate.ToString("dd-MMM-yyy") + " TO" + endDate.ToString("dd-MMM-yyy"));
            ReportParameter rp2 = new ReportParameter("ReportNameParameter", "PSR SKU Wise Delivery [202]");

            reportViewer.LocalReport.SetParameters(new[] { rp1, rp2 });

            reportViewer.LocalReport.DataSources.Add(rdc);

            reportViewer.LocalReport.Refresh();
            reportViewer.Visible = true;

            ViewBag.ReportViewer = reportViewer;
            return(PartialView("PsrWiseSkuWiseDelivery/RptPsrWiseSkuWiseDeliveryFilter"));
        }
        public ActionResult RptOrderPsrWiseSkuWiseOrderFilter(int[] rsMid, int[] asMid, int[] cEid, int[] id, int[] skuIds, DateTime startDate, DateTime endDate, int reportType)
        {
            HashSet <int> dbids   = sp.Alldbids(rsMid, asMid, cEid, id);
            ArrayList     skulist = new ArrayList();

            if (skuIds != null)
            {
                skulist = new ArrayList(skuIds);
            }
            ReportViewer reportViewer = new ReportViewer
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Pixel(600)
            };
            ReportDataSource rdc = null;
            ReportParameter  rp2 = null;

            if (reportType == 1)  //Summery
            {
                List <RPT_Order_PSRWiseSKUWiseOrder_Result> psrskuorder = Db.RPT_Order_PSRWiseSKUWiseOrder(startDate, endDate).Where(x => dbids.Contains(x.DB_Id) && skulist.Contains(x.SKUId)).ToList();

                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Order\RPT_Order_PsrWiseSkuWiseOrderSummary.rdlc");

                rdc = new ReportDataSource("PSRSKUORDER", psrskuorder);

                rp2 = new ReportParameter("ReportNameParameter", "PSR SKU Wise Order [102] Summary");
            }
            else if (reportType == 2) //Details
            {
                List <RPT_Order_PSRWiseSKUWiseOrder_Result> psrskuorder = Db.RPT_Order_PSRWiseSKUWiseOrder(startDate, endDate).Where(x => dbids.Contains(x.DB_Id) && skulist.Contains(x.SKUId)).ToList();

                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Order\RPT_Order_PsrWiseSkuWiseOrderDetails.rdlc");

                rdc = new ReportDataSource("PSRSKUORDER", psrskuorder);


                rp2 = new ReportParameter("ReportNameParameter", "PSR SKU Wise Order [102] Details");
            }

            ReportParameter rp1 = new ReportParameter("DateParameter", startDate.ToString("dd-MMM-yyy") + " TO" + endDate.ToString("dd-MMM-yyy"));


            reportViewer.LocalReport.SetParameters(new[] { rp1, rp2 });

            reportViewer.LocalReport.DataSources.Add(rdc);

            reportViewer.LocalReport.Refresh();
            reportViewer.Visible = true;

            ViewBag.ReportViewer = reportViewer;
            return(PartialView("PsrWiseSkuWiseOrder/RptPsrWiseSkuWiseOrderFilter"));
        }
        public ActionResult CurrentRouteplanFilter(int[] rsMid, int[] asMid, int[] cEid, int[] id)
        {
            HashSet <int> dbids = sp.Alldbids(rsMid, asMid, cEid, id);
            var           data  = (from a in Db.tbld_Route_Plan_Mapping
                                   join b in Db.tbld_db_zone_view on a.db_id equals b.DB_Id
                                   join c in Db.tbld_distribution_employee on a.db_emp_id equals c.id
                                   join d in Db.tbld_distributor_Route on a.route_id equals d.RouteID
                                   where dbids.Contains(a.db_id)

                                   select new CurrentRouteplanVm
            {
                Region = b.REGION_Name,
                Area = b.AREA_Name,
                CeArea = b.CEAREA_Name,
                DbHouse = b.DB_Name,
                PsrName = c.Name,
                SubRouteCode = d.RouteCode,
                SubRouteName = d.RouteName,
                NumberOfOutlet = Db.tbld_Outlet.Count(x => x.parentid == d.RouteID),
                Saturday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Saturday" && x.route_id == a.route_id) ==
                           1
                                ? d.RouteName
                                : "X",
                Sunday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Sunday" && x.route_id == a.route_id) == 1
                                ? d.RouteName
                                : "X",
                Monday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Monday" && x.route_id == a.route_id) == 1
                                ? d.RouteName
                                : "X",
                Tuesday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Tuesday" && x.route_id == a.route_id) == 1
                                ? d.RouteName
                                : "X",
                Wednesday =
                    Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Wednesday" && x.route_id == a.route_id) == 1
                                    ? d.RouteName
                                    : "X",
                Thursday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Thursday" && x.route_id == a.route_id) ==
                           1
                                ? d.RouteName
                                : "X",
                Friday = Db.tbld_Route_Plan_Mapping.Count(x => x.day == "Friday" && x.route_id == a.route_id) == 1
                                ? d.RouteName
                                : "X",
            }
                                   ).Distinct();



            return(PartialView("CurrentRouteplan/CurrentRouteplanFilter", data.ToList()));
        }
        public ActionResult ShowAllbydbid(int[] rsMid, int[] asMid, int[] cEid, int[] id)
        {
            Supporting sp = new Supporting();

            HashSet <int> dbids = sp.Alldbids(rsMid, asMid, cEid, id);


            var data = from a in Db.tbld_distributor_Route
                       join b in Db.status on a.IsActive equals b.status_Id
                       join c in Db.tbld_distributor_Route on a.ParentID equals c.RouteID into routeparent
                       from parent in routeparent.DefaultIfEmpty()
                       join d in Db.tbld_distribution_house on a.DistributorID equals d.DB_Id
                       join e in Db.tbld_distributor_RouteType on a.RouteType equals e.RouteType
                       where dbids.Contains(a.DistributorID)
                       orderby a.IsActive
                       select new DBhouseRouteiVm
            {
                RouteId     = a.RouteID,
                RouteCode   = a.RouteCode,
                RouteName   = a.RouteName,
                RouteType   = e.RouteTypeCode,
                IsActive    = b.status_code,
                Distributor = d.DBName,
                Parent      = parent.RouteName
            };

            return(PartialView(data.ToList()));
        }
        public ActionResult ShowAllbydbid(int[] rsMid, int[] asMid, int[] cEid, int[] id)
        {
            Supporting sp = new Supporting();

            HashSet <int> dbids = sp.Alldbids(rsMid, asMid, cEid, id);


            var data = from a in Db.tbld_distribution_employee
                       join b in Db.tbld_distribution_employee_Type on a.Emp_Type equals b.EmpTypeid
                       join c in Db.tbld_distribution_house on a.DistributionId equals c.DB_Id
                       join d in Db.status on a.active equals d.status_Id
                       where dbids.Contains(c.DB_Id)
                       select new DBhouseemployeeiVm
            {
                Id           = a.id,
                EmpCode      = a.Emp_code,
                Name         = a.Name,
                Distribution = c.DBName,
                EmpType      = b.EmpType,
                LoginUserId  = a.login_user_id,
                Active       = d.status_code
            };

            return(PartialView(data.ToList()));
        }
示例#6
0
        public ActionResult RptOutletWiseDeliveryFilter(int[] rsMid, int[] asMid, int[] cEid, int[] id, int[] skuIds, DateTime startDate, DateTime endDate, int reportType)
        {
            HashSet <int> dbids   = sp.Alldbids(rsMid, asMid, cEid, id);
            ArrayList     skulist = new ArrayList();

            if (skuIds != null)
            {
                skulist = new ArrayList(skuIds);
            }
            ReportViewer reportViewer = new ReportViewer
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Pixel(600)
            };

            List <RPT_Delivery_OutletWiseSKUWiseDelivery_Result> outletDelivery = Db
                                                                                  .RPT_Delivery_OutletWiseSKUWiseDelivery(startDate, endDate).Where(x => x.DB_Id != null && (dbids.Contains((int)x.DB_Id) && skulist.Contains(x.SKUId))
                                                                                                                                                    )
                                                                                  .ToList();
            ReportParameter rp2 = null;

            if (reportType == 1)  //Summery
            {
                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Delivery\RPT_Delivery_OutletWiseDeliverySymmary.rdlc");
                rp2 = new ReportParameter("ReportNameParameter", "Outlet Wise Delivery [102] Summary");
            }
            else if (reportType == 2) //Details
            {
                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Delivery\RPT_Delivery_OutletWiseDeliveryDetails.rdlc");
                rp2 = new ReportParameter("ReportNameParameter", "Outlet SKU Wise Delivery [102]");
            }
            ReportParameter  rp1 = new ReportParameter("DateParameter", startDate.ToString("dd-MMM-yyy") + " TO " + endDate.ToString("dd-MMM-yyy"));
            ReportDataSource rdc = new ReportDataSource("OutletDelivery", outletDelivery);

            reportViewer.LocalReport.DataSources.Add(rdc);
            reportViewer.LocalReport.Refresh();
            reportViewer.Visible = true;

            ViewBag.ReportViewer = reportViewer;

            return(PartialView("OutletWiseDelivery/RptOutletWiseDeliveryFilter"));
        }
示例#7
0
        public ActionResult RptOutletWiseOrderFilter(int[] rsMid, int[] asMid, int[] cEid, int[] id, int[] skuIds, DateTime startDate, DateTime endDate, int reportType)
        {
            HashSet <int> dbids   = sp.Alldbids(rsMid, asMid, cEid, id);
            ArrayList     skulist = new ArrayList();

            if (skuIds != null)
            {
                skulist = new ArrayList(skuIds);
            }
            ReportViewer reportViewer = new ReportViewer
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(100),
                Height = Unit.Pixel(600)
            };

            List <RPT_Order_OutletWiseSKUWiseOrder_Result> outletOrder = Db
                                                                         .RPT_Order_OutletWiseSKUWiseOrder(startDate, endDate).Where(x => x.DB_Id != null && dbids.Contains((int)x.DB_Id) && skulist.Contains(x.SKUId))
                                                                         .ToList();

            if (reportType == 1)  //Summery
            {
                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Order\RPT_OutletWiseOrder_Symmary.rdlc");
            }
            else if (reportType == 2) //Details
            {
                reportViewer.LocalReport.ReportPath = Server.MapPath(@"~\Reports\Order\RPT_OutletWiseOrder_Details.rdlc");
            }

            ReportDataSource rdc = new ReportDataSource("OutletOrder", outletOrder);

            reportViewer.LocalReport.DataSources.Add(rdc);
            reportViewer.LocalReport.Refresh();
            reportViewer.Visible = true;

            ViewBag.ReportViewer = reportViewer;

            return(PartialView("OutletWiseOrder/RptOutletWiseOrderFilter"));
        }
        public ActionResult ApproveOutletShowAllbydbid(int[] rsMid, int[] asMid, int[] cEid, int[] id)
        {
            Supporting sp = new Supporting();

            HashSet <int> dbids = sp.Alldbids(rsMid, asMid, cEid, id);

            var data = from a in Db.tbld_Outlet_new
                       join b in Db.tbld_distribution_house on a.Distributorid equals b.DB_Id into dbHouse
                       from dBhouse in dbHouse.DefaultIfEmpty()
                       join c in Db.tbld_distributor_Route on a.parentid equals c.RouteID into dbRoute
                       from route in dbRoute.DefaultIfEmpty()
                       join e in Db.tbld_Outlet_category on a.outlet_category_id equals e.id into dboutletCategory
                       from outletCategory in dboutletCategory.DefaultIfEmpty()
                       join f in Db.tbld_Outlet_grade on a.grading equals f.id into outletGrading
                       from grading in outletGrading.DefaultIfEmpty()
                       join g in Db.tbld_Outlet_channel on a.channel equals g.id into outletChannel
                       from channel in outletChannel.DefaultIfEmpty()
                       where dbids.Contains(a.Distributorid) && a.verify_status == 0
                       orderby a.Id, a.parentid
                select new DBhouseoutletiVm
            {
                OutletId       = a.Id,
                OutletCode     = a.OutletCode,
                OutletName     = a.OutletName,
                OutletNameB    = a.OutletName_b,
                Location       = a.Location,
                Address        = a.Address,
                GpsLocation    = a.GpsLocation,
                OwnerName      = a.OwnerName,
                ContactNo      = a.ContactNo,
                Distributor    = dBhouse.DBName,
                HaveVisicooler = a.HaveVisicooler == 1 ? "YES" : "NO",
                Parentid       = route.RouteName,
                Category       = outletCategory.outlet_category_name,
                Grading        = grading.name,
                Channel        = channel.name,
                Latitude       = a.Latitude,
                Longitude      = a.Longitude,
                Picture        = a.picture,
                IsActive       = a.IsActive == 1 ? "Active" : "Inactive",
                Createdate     = a.createdate
            };


            return(PartialView(data.ToList()));
        }
        public ActionResult SaveTradePromotation(TradePromotionCreateVm tradePromotionCreateVm)
        {
            tblt_TradePromotion tbltTradePromotion = new tblt_TradePromotion
            {
                name                  = sp.Remove_Special_Characters(tradePromotionCreateVm.Name),
                code                  = tradePromotionCreateVm.Code,
                description           = sp.Remove_Special_Characters(tradePromotionCreateVm.Description),
                TP_type               = 1,
                TPOffer_type          = 1,
                promotion_unit_id     = 1,
                promotion_sub_unit_id = 1,
                start_date            = tradePromotionCreateVm.StartDate,
                end_date              = tradePromotionCreateVm.EndDate,
                expiry_date           = tradePromotionCreateVm.EndDate,
                create_date           = DateTime.Now,
                is_active             = 1
            };

            Db.tblt_TradePromotion.Add(tbltTradePromotion);
            Db.SaveChanges();

            int tpId = tbltTradePromotion.id;


            if (tradePromotionCreateVm.OfferType == 1)
            {
                foreach (var orderskulistitem in tradePromotionCreateVm.Orderskulist)
                {
                    tblt_TradePromotionDefinition tbltTradePromotionOrderDefinition = new tblt_TradePromotionDefinition
                    {
                        promo_id                = tpId,
                        rule_type               = tradePromotionCreateVm.RuleType,
                        promo_line_type         = 1,
                        condition_type          = tradePromotionCreateVm.ConditionType,
                        offer_type              = tradePromotionCreateVm.OfferType,
                        condition_sku_id        = orderskulistitem.SkuId,
                        condition_sku_Batch     = orderskulistitem.BetchId,
                        condition_sku_pack_size = orderskulistitem.PackSize,
                        condition_sku_amount    = orderskulistitem.Qty,
                        offer_sku_id            = 0,
                        offer_sku_pack_size     = 0,
                        offer_sku_Batch         = 0,
                        offer_sku_amount        = 0,
                        condition_bundle_qty_CS = orderskulistitem.SlabCsQty,
                        condition_sku_group     = 1
                    };
                    Db.tblt_TradePromotionDefinition.Add(tbltTradePromotionOrderDefinition);
                }
                foreach (var freeskulistitem in tradePromotionCreateVm.Freeskulist)
                {
                    tblt_TradePromotionDefinition tbltTradePromotionfreeDefinition = new tblt_TradePromotionDefinition
                    {
                        promo_id                = tpId,
                        rule_type               = 1,
                        promo_line_type         = 2,
                        condition_type          = 1,
                        offer_type              = tradePromotionCreateVm.OfferType,
                        condition_sku_id        = 0,
                        condition_sku_Batch     = 0,
                        condition_sku_pack_size = 0,
                        condition_sku_amount    = 0,
                        offer_sku_id            = freeskulistitem.SkuId,
                        offer_sku_pack_size     = freeskulistitem.PackSize,
                        offer_sku_Batch         = freeskulistitem.BetchId,
                        offer_sku_amount        = freeskulistitem.Qty,
                        condition_bundle_qty_CS = freeskulistitem.SlabCsQty,
                        condition_sku_group     = 1
                    };
                    Db.tblt_TradePromotionDefinition.Add(tbltTradePromotionfreeDefinition);
                }
            }
            else
            {
                foreach (var orderskulistitem in tradePromotionCreateVm.Orderskulist)
                {
                    tblt_TradePromotionDefinition tbltTradePromotionOrderDefinition = new tblt_TradePromotionDefinition
                    {
                        promo_id                = tpId,
                        rule_type               = 1,
                        promo_line_type         = 3,
                        condition_type          = 1,
                        offer_type              = 2,
                        condition_sku_id        = orderskulistitem.SkuId,
                        condition_sku_Batch     = orderskulistitem.BetchId,
                        condition_sku_pack_size = orderskulistitem.PackSize,
                        condition_sku_amount    = orderskulistitem.Qty,
                        offer_sku_id            = 0,
                        offer_sku_pack_size     = 0,
                        offer_sku_Batch         = 0,
                        offer_sku_amount        = tradePromotionCreateVm.ValueDiscount,
                        condition_bundle_qty_CS = 0,
                        condition_sku_group     = 1
                    };
                    Db.tblt_TradePromotionDefinition.Add(tbltTradePromotionOrderDefinition);
                }
            }

            HashSet <int> dbids = sp.Alldbids(tradePromotionCreateVm.RsmId, tradePromotionCreateVm.AsmId,
                                              tradePromotionCreateVm.CeId, tradePromotionCreateVm.DbId);

            var dbidList = Db.tbld_distribution_house.Where(
                x => dbids.Contains(x.DB_Id) && tradePromotionCreateVm.ClusterList.Contains(x.Cluster_id));


            foreach (var dbid in dbidList)
            {
                tblt_TradePromotionDBhouseMapping tbltTradePromotionDBhouseMapping =
                    new tblt_TradePromotionDBhouseMapping
                {
                    promo_id = tpId,
                    db_id    = dbid.DB_Id,
                    status   = 1
                };
                Db.tblt_TradePromotionDBhouseMapping.Add(tbltTradePromotionDBhouseMapping);
            }
            Db.SaveChanges();



            return(Json("Success", JsonRequestBehavior.AllowGet));
        }