Esempio n. 1
0
        /// <summary>
        /// Created By: Ashwajit bansod
        /// Created Date : 03-Oct-2018
        /// Created For: to edit PO as per POId
        /// </summary>
        /// <param name="POId"></param>
        /// <param name="LocationId"></param>
        /// <returns></returns>
        public ActionResult EditPOByPOId(string POId, long LocationId)
        {
            eTracLoginModel ObjLoginModel  = null;
            long            Id             = 0;
            var             objPOTypeModel = new POTypeDataModel();

            try
            {
                if (Session["eTrac"] != null)
                {
                    ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                }
                if (!string.IsNullOrEmpty(POId))
                {
                    ViewBag.UpdateMode = true;
                    POId = Cryptography.GetDecryptedData(POId, true);
                    long.TryParse(POId, out Id);
                }
                if (Id > 0)
                {
                    var DataPO = _IPOTypeDetails.GetPODetailsById(Id);
                    ViewBag.Vendor       = DataPO.Vendor;
                    ViewBag.POTypeDate   = DataPO.POType;
                    ViewBag.PONumberData = DataPO.PONumber;
                    ViewBag.POType       = _IPOTypeDetails.POTypeList();
                    ViewBag.VendorList   = _IPOTypeDetails.GetCompany_VendorList(LocationId, false);
                    return(View("Index", DataPO));
                }
                else
                {
                    ViewBag.AlertMessageClass = new AlertMessageClass().Danger;
                    ViewBag.Message           = Result.DoesNotExist;
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message           = ex.Message;
                ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
            }
            return(View("Index"));
        }
Esempio n. 2
0
        /// <summary>
        /// Created By : Ashwajit Bansod
        /// Created Date : 17-April-2019
        /// Created For : To get PO Details ad facility list by PO id
        /// </summary>
        /// <param name="POId"></param>
        /// <param name="_search"></param>
        /// <param name="UserId"></param>
        /// <param name="rows"></param>
        /// <param name="page"></param>
        /// <param name="TotalRecords"></param>
        /// <param name="sord"></param>
        /// <param name="txtSearch"></param>
        /// <param name="sidx"></param>
        /// <param name="UserType"></param>
        /// <returns></returns>
        public JsonResult GetAllPODetailByPOId(long POId, string _search, long?UserId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            var             getResult     = new POTypeDataModel();
            var             resultPayment = new BillPayment();

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
            }
            try
            {
                var obj = new PaymentModel();
                obj.BillNo = POId;
                var getPOByBillNo = _IPaymentManager.GetPODetails(null, obj);
                getResult = _IPOTypeDetails.GetPODetailsById(getPOByBillNo.POId);
                if (getResult != null)
                {
                    getResult.IssueDateDisplay    = getResult.IssueDate.ToString();
                    getResult.DeliveryDateDisplay = getResult.DeliveryDate.ToString();
                    JQGridResults    result     = new JQGridResults();
                    List <JQGridRow> rowss      = new List <JQGridRow>();
                    decimal?         grandTotal = 0;
                    sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
                    sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
                    txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
                    getResult.NewPOTypeDetails = _IPOTypeDetails.GetAllPOFacilityByPOIdList(ObjLoginModel.UserId, getPOByBillNo.POId, rows, TotalRecords, sidx, sord);

                    foreach (var poFacilityList in getResult.NewPOTypeDetails.rows)
                    {
                        grandTotal += poFacilityList.UnitPrice * poFacilityList.Quantity;
                        poFacilityList.TotalPrice = grandTotal;
                        //poFacilityList.TotalPrice = poFacilityList.UnitPrice * poFacilityList.Quantity;
                        poFacilityList.Total = poFacilityList.UnitPrice * poFacilityList.Quantity;
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(poFacilityList.COM_FacilityId), true);
                        row.cell    = new string[10];
                        row.cell[0] = poFacilityList.COM_FacilityId.ToString();
                        row.cell[1] = poFacilityList.CostCode.ToString();
                        row.cell[2] = poFacilityList.FacilityType.ToString();
                        row.cell[3] = poFacilityList.COM_Facility_Desc.ToString();
                        row.cell[4] = poFacilityList.UnitPrice.ToString();
                        row.cell[5] = poFacilityList.Tax.ToString();
                        row.cell[6] = poFacilityList.Quantity.ToString();
                        row.cell[7] = poFacilityList.Total.ToString();
                        row.cell[8] = poFacilityList.TotalPrice.ToString();
                        row.cell[9] = poFacilityList.CostCodeName.ToString();
                        rowss.Add(row);
                    }
                    result.rows    = rowss.ToArray();
                    result.page    = Convert.ToInt32(page);
                    result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                    result.records = Convert.ToInt32(TotalRecords.Value);
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.Message, JsonRequestBehavior.AllowGet));
            }
            return(Json(getResult, JsonRequestBehavior.AllowGet));
        }