コード例 #1
0
        public ActionResult TablePPMPotentialByCost(FormCollection fc, string dateRangeFrom, string dateRangeEnd, string hid, string inventory, string rental, string others, string PartNumber, string PartDescription, string Model, string PrefixSN, string download = "0")
        {
            var searchSerialNo = Convert.ToBoolean(fc["columns[0][searchable]"]);
            var searchModel    = Convert.ToBoolean(fc["columns[1][searchable]"]);
            var searchProductProblemDescription = Convert.ToBoolean(fc["columns[2][searchable]"]);
            var searchComment      = Convert.ToBoolean(fc["columns[3][searchable]"]);
            var searchServiceOrder = Convert.ToBoolean(fc["columns[4][searchable]"]);
            var searchServiceMeter = Convert.ToBoolean(fc["columns[5][searchable]"]);
            var searchUnitMes      = Convert.ToBoolean(fc["columns[6][searchable]"]);
            var searchSalesOffice  = Convert.ToBoolean(fc["columns[7][searchable]"]);
            var searchPartNo       = Convert.ToBoolean(fc["columns[8][searchable]"]);
            var searchPartDesc     = Convert.ToBoolean(fc["columns[9][searchable]"]);
            var searchRepairDate   = Convert.ToBoolean(fc["columns[10][searchable]"]);
            var searchCurrency     = Convert.ToBoolean(fc["columns[11][searchable]"]);
            var searchTotalCostSO  = Convert.ToBoolean(fc["columns[12][searchable]"]);

            var splitPartNumber      = new string[] { };
            var splitPartDescription = new string[] { };
            var splitModel           = new string[] { };
            var splitPrefixSN        = new string[] { };


            if (!string.IsNullOrWhiteSpace(PartNumber))
            {
                splitPartNumber = PartNumber.Split(',');
            }

            if (!string.IsNullOrWhiteSpace(PartDescription))
            {
                splitPartDescription = PartDescription.Split(',');
            }

            if (!string.IsNullOrWhiteSpace(Model))
            {
                splitModel = Model.Split(',');
            }

            if (!string.IsNullOrWhiteSpace(PrefixSN))
            {
                splitPrefixSN = PrefixSN.Split(',');
            }
            var listData    = new List <TablePPMPotentialByCostModel.Data>();
            var getListData = PartResponBS.GetDataForTablePPMByCost(dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, fc["search[value]"], Convert.ToInt32(fc["order[0][column]"]), fc["order[0][dir]"], hid, rental, inventory, others);

            if (download == "0")
            {
                Session["searchValuePPMPotentialByCost"] = fc["search[value]"];
                Session["ColumnTable"] = Convert.ToInt32(fc["order[0][column]"]);
                Session["Order"]       = fc["order[0][dir]"];
                foreach (var item in getListData.Skip(Convert.ToInt32(fc["start"])).Take(Convert.ToInt32(fc["length"])))
                {
                    var id = new TablePPMPotentialByCostModel.Id();
                    id.Row = item.Row;
                    var prodProbDesc = new TablePPMPotentialByCostModel.ValueData();
                    prodProbDesc.Value = item.ProductProblemDescription;
                    prodProbDesc.Style = "";
                    var partNo = new TablePPMPotentialByCostModel.ValueData();
                    partNo.Value = item.PartNo;
                    partNo.Style = "";
                    var partDesc = new TablePPMPotentialByCostModel.ValueData();
                    partDesc.Value = item.PartDescription;
                    partDesc.Style = "";
                    var groupNo = new TablePPMPotentialByCostModel.ValueData();
                    groupNo.Value = item.GroupNo.ToString();
                    groupNo.Style = "";
                    var groupDesc = new TablePPMPotentialByCostModel.ValueData();
                    groupDesc.Value = item.GroupDesc;
                    groupDesc.Style = "";
                    //decimal getTotalSo = GetTotalSoCost(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, fc["search[value]"], Convert.ToInt32(fc["order[0][column]"]), fc["order[0][dir]"], hid, rental, inventory, others);
                    decimal getTotalClaim   = GetTotalSoClaim(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, fc["search[value]"], Convert.ToInt32(fc["order[0][column]"]), fc["order[0][dir]"], hid, rental, inventory, others);
                    decimal getTotalSettled = GetTotalSoSettled(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, fc["search[value]"], Convert.ToInt32(fc["order[0][column]"]), fc["order[0][dir]"], hid, rental, inventory, others);
                    var     totalSoCost     = new TablePPMPotentialByCostModel.ValueData();
                    totalSoCost.Value = item.TotalSoCost.ToString("C");
                    totalSoCost.Style = "";
                    var soClaim = new TablePPMPotentialByCostModel.ValueData();
                    soClaim.Value = getTotalClaim.ToString("C");
                    soClaim.Style = "";
                    var soSettled = new TablePPMPotentialByCostModel.ValueData();
                    soSettled.Value = getTotalSettled.ToString("C");
                    soSettled.Style = "";
                    var currency = new TablePPMPotentialByCostModel.ValueData();
                    currency.Value = item.Currency;
                    currency.Style = "";
                    var itemData = new TablePPMPotentialByCostModel.Data();
                    itemData.Id        = id;
                    itemData.PartNo    = partNo;
                    itemData.PartDesc  = partDesc;
                    itemData.GroupNo   = groupNo;
                    itemData.GroupDesc = groupDesc;
                    itemData.ProbDesc  = prodProbDesc;
                    itemData.SoCost    = totalSoCost;
                    itemData.SoClaim   = soClaim;
                    itemData.SoSettled = soSettled;
                    itemData.Currency  = currency;
                    listData.Add(itemData);
                }
            }

            if (download == "1")
            {
                var getSearchValue = Session["searchValuePPMPotentialByCost"].ToString();
                var getColumn      = Convert.ToInt32(Session["ColumnTable"]);
                var order          = Session["Order"].ToString();
                getListData = PartResponBS.GetDataForTablePPMByCost(dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, getSearchValue, getColumn, order, hid, rental, inventory, others);
                foreach (var item in getListData)
                {
                    var id = new TablePPMPotentialByCostModel.Id();
                    id.Row = item.Row;
                    var prodProbDesc = new TablePPMPotentialByCostModel.ValueData();
                    prodProbDesc.Value = item.ProductProblemDescription;
                    prodProbDesc.Style = "";
                    var partNo = new TablePPMPotentialByCostModel.ValueData();
                    partNo.Value = item.PartNo;
                    partNo.Style = "";
                    var partDesc = new TablePPMPotentialByCostModel.ValueData();
                    partDesc.Value = item.PartDescription;
                    partDesc.Style = "";
                    var groupNo = new TablePPMPotentialByCostModel.ValueData();
                    groupNo.Value = item.GroupNo.ToString();
                    groupNo.Style = "";
                    var groupDesc = new TablePPMPotentialByCostModel.ValueData();
                    groupDesc.Value = item.GroupDesc;
                    groupDesc.Style = "";
                    //decimal getTotalSo = GetTotalSoCost(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, getSearchValue, getColumn, order, hid, rental, inventory, others);
                    decimal getTotalClaim   = GetTotalSoClaim(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, getSearchValue, getColumn, order, hid, rental, inventory, others);
                    decimal getTotalSettled = GetTotalSoSettled(item.PartNo, dateRangeFrom, dateRangeEnd, splitPartNumber, splitPartDescription, splitModel, splitPrefixSN, searchSerialNo, searchModel, searchProductProblemDescription, searchComment, searchServiceOrder, searchServiceMeter, searchUnitMes, searchSalesOffice, searchPartNo, searchPartDesc, searchRepairDate, searchCurrency, searchTotalCostSO, getSearchValue, getColumn, order, hid, rental, inventory, others);
                    var     totalSoCost     = new TablePPMPotentialByCostModel.ValueData();
                    totalSoCost.Value = item.TotalSoCost.ToString("C");
                    totalSoCost.Style = "";
                    var soClaim = new TablePPMPotentialByCostModel.ValueData();
                    soClaim.Value = getTotalClaim.ToString("C");
                    soClaim.Style = "";
                    var soSettled = new TablePPMPotentialByCostModel.ValueData();
                    soSettled.Value = getTotalSettled.ToString("C");
                    soSettled.Style = "";
                    var currency = new TablePPMPotentialByCostModel.ValueData();
                    currency.Value = item.Currency;
                    currency.Style = "";
                    var itemData = new TablePPMPotentialByCostModel.Data();
                    itemData.Id        = id;
                    itemData.PartNo    = partNo;
                    itemData.PartDesc  = partDesc;
                    itemData.GroupNo   = groupNo;
                    itemData.GroupDesc = groupDesc;
                    itemData.ProbDesc  = prodProbDesc;
                    itemData.SoCost    = totalSoCost;
                    itemData.SoClaim   = soClaim;
                    itemData.SoSettled = soSettled;
                    itemData.Currency  = currency;
                    listData.Add(itemData);
                }
            }

            var Draw = (fc["draw"] != null) ? Convert.ToInt32(fc["draw"]) : 1;

            var status = new TablePPMPotentialByCostModel.Status();

            status.Code    = 200;
            status.Message = "Sukses";

            var responseJson = new TablePPMPotentialByCostModel.ResponseJson();

            responseJson.Draw          = Draw;
            responseJson.RecordsFilter = getListData.Count();
            responseJson.RecordTotal   = getListData.Count();
            responseJson.Status        = status;
            responseJson.Data          = listData;

            Response.ContentType = "application/json";
            Response.Write(JsonConvert.SerializeObject(responseJson));
            return(new EmptyResult());
        }
コード例 #2
0
        public ActionResult getDataPotentialByCostOverview(FormCollection fc, int type, string Area, string SalesOffice, string Customer, string Family, string Industry, string Model, string SerialNumber, string SmuRangeFrom, string SmuRangeTo, string PurchaseDateFrom, string PurchaseDateEnd, string DeliveryDateFrom, string DeliveryDateEnd, string RepairDateFrom, string RepairDateEnd, string Plant, string Product, string Hid, string Rental, string Others, string paramsModel = null, string paramsSerialNumber = null, bool btnPOST = false, int download = 0, string[] columns = null)
        {
            var orderByColumn = "so_cost";
            var orderByDir    = "desc";

            string[] SplitArea         = new string[] { };
            string[] SplitCustomer     = new string[] { };
            string[] SplitFamily       = new string[] { };
            string[] SplitSalesOffice  = new string[] { };
            string[] SplitModel        = new string[] { };
            string[] SplitSerialNumber = new string[] { };
            string[] SplitProduct      = new string[] { };
            string[] SplitPlant        = new string[] { };
            string[] SplitIndustry     = new string[] { };
            if (!string.IsNullOrWhiteSpace(Area))
            {
                SplitArea = Area.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Customer))
            {
                SplitCustomer = Customer.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Model))
            {
                SplitModel = Model.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SerialNumber))
            {
                SplitSerialNumber = SerialNumber.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Family))
            {
                SplitFamily = Family.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Industry))
            {
                SplitIndustry = Industry.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Plant))
            {
                SplitPlant = Plant.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(Product))
            {
                SplitProduct = Product.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(SalesOffice))
            {
                SplitSalesOffice = SalesOffice.Split(',');
            }
            _partResponsibleCostAnalysisBs.CheckIfDecimalTypeisNull();
            var RentalVal = Rental.Replace("?model=1", "");

            string[] dataFiltered = getListSerialNumberFiltered(type, SplitArea, SplitSalesOffice, SplitCustomer, SplitFamily, SplitIndustry, SplitModel, SplitSerialNumber, RepairDateFrom, RepairDateEnd, PurchaseDateFrom, PurchaseDateEnd, DeliveryDateFrom, DeliveryDateEnd, SmuRangeFrom, SmuRangeTo, SplitProduct, SplitPlant, Hid, RentalVal, Others, paramsModel, paramsSerialNumber, btnPOST);
            var      getData      = _partResponsibleCostAnalysisBs.GetDataForTablePPMByCostOverview(dataFiltered, orderByDir, orderByColumn, download, columns);
            var      listData     = new List <TablePPMPotentialByCostModel.Data>();

            foreach (var item in getData.Item1)
            {
                var id = new TablePPMPotentialByCostModel.Id();
                id.Row = item.Row;
                var prodProbDesc = new TablePPMPotentialByCostModel.ValueData();
                prodProbDesc.Value = item.ProductProblemDescription;
                prodProbDesc.Style = "";
                var partNo = new TablePPMPotentialByCostModel.ValueData();
                partNo.Value = item.PartNo;
                partNo.Style = "";
                var partDesc = new TablePPMPotentialByCostModel.ValueData();
                partDesc.Value = item.PartDescription;
                partDesc.Style = "";
                var groupNo = new TablePPMPotentialByCostModel.ValueData();
                groupNo.Value = item.GroupNo.ToString();
                groupNo.Style = "";
                var groupDesc = new TablePPMPotentialByCostModel.ValueData();
                groupDesc.Value = item.GroupDesc;
                groupDesc.Style = "";
                var totalSoCost = new TablePPMPotentialByCostModel.ValueData();
                totalSoCost.Value = item.TotalSoCost.ToString("C");
                totalSoCost.Style = "";
                var soClaim = new TablePPMPotentialByCostModel.ValueData();
                soClaim.Value = item.SoClaim.ToString("C");
                soClaim.Style = "";
                var soSettled = new TablePPMPotentialByCostModel.ValueData();
                soSettled.Value = item.SOSettled.ToString("C");
                soSettled.Style = "";
                var currency = new TablePPMPotentialByCostModel.ValueData();
                currency.Value = item.Currency;
                currency.Style = "";
                var itemData = new TablePPMPotentialByCostModel.Data();
                itemData.Id        = id;
                itemData.PartNo    = partNo;
                itemData.PartDesc  = partDesc;
                itemData.GroupNo   = groupNo;
                itemData.GroupDesc = groupDesc;
                itemData.ProbDesc  = prodProbDesc;
                itemData.SoCost    = totalSoCost;
                itemData.SoClaim   = soClaim;
                itemData.SoSettled = soSettled;
                itemData.Currency  = currency;
                listData.Add(itemData);
            }
            var status = new TablePPMPotentialByCostModel.Status();

            status.Code    = 200;
            status.Message = "Sukses";
            var Draw         = (fc["draw"] != null) ? Convert.ToInt32(fc["draw"]) : 1;
            var responseJson = new TablePPMPotentialByCostModel.ResponseJson();

            responseJson.Draw          = Draw;
            responseJson.RecordsFilter = getData.Item2;
            responseJson.RecordTotal   = getData.Item2;
            responseJson.Status        = status;
            responseJson.Data          = listData;

            Response.ContentType = "application/json";
            Response.Write(JsonConvert.SerializeObject(responseJson));
            return(new EmptyResult());
        }