Exemplo n.º 1
0
        public ActionResult Edit(AssetReceivedModel Data)
        {
            try
            {
                if (Session["_intCurrentID"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }

                try
                {
                    if (bool.Parse(Session["AssetReceivedEditAccess"].ToString()) == false && bool.Parse(Session["AssetReceivedViewAccess"].ToString()) == false)
                    {
                        return(RedirectToAction("List", "AssetReceived"));
                    }
                }
                catch
                {
                    return(RedirectToAction("List", "AssetReceived"));
                }


                MyWSContext ws = new MyWSContext();

                string _strWhereStatement = Session["CurrentID"] + "`````````````````````";
                using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString()))
                {
                    foreach (DataRow DR in _DTRecord.Rows)
                    {
                        Data.cbCurrency      = GetDropDownItem(false, "Currency");
                        Data.cbSupplier      = GetDropDownItem(false, "Supplier");
                        Data.cbWarehouse     = GetDropDownItem(false, "Warehouse");
                        Data.cbTransactionBy = GetDropDownItem(false, "Employees");
                        Data.cbReceviedBy    = GetDropDownItem(false, "Employees");

                        Data.CurrentID            = DR[0].ToString();
                        Data.fldDateEncoded       = DateTime.Parse(DR[1].ToString());
                        Data.fldCode              = DR[2].ToString();
                        Data.fldSupplierCode      = DR[3].ToString();
                        Data.fldPONo              = DR[4].ToString();
                        Data.fldDRNo              = DR[5].ToString();
                        Data.fldDRDate            = DateTime.Parse(DR[6].ToString());
                        Data.fldCurrency          = DR[7].ToString();
                        Data.fldWarehouseCode     = DR[8].ToString();
                        Data.fldRemarks           = DR[9].ToString();
                        Data.fldTransactionByCode = DR[10].ToString();
                        Data.fldReceivedByCode    = DR[11].ToString();

                        Session["fldAuthorizedStatus"] = DR[16].ToString();
                    }
                }


                return(View(Data));
            }
            catch { }

            return(View(Data));
        }
Exemplo n.º 2
0
        public PartialViewResult ViewSuppliersFilter()
        {
            AssetReceivedModel Data = new AssetReceivedModel();

            Data.cbNature     = GetDropDownItem(true, "NATURES");
            Data.cbPageLimit  = GetDropDownPageLimit();
            Data.fldPageLimit = 10;
            ViewBag.PageNo    = 1;
            return(PartialView(Data));
        }
Exemplo n.º 3
0
        public PartialViewResult ViewAssetsSelection(string _strFilter)
        {
            DataTable          dt   = new DataTable();
            AssetReceivedModel Data = new AssetReceivedModel();

            try
            {
                _strFilter = _strFilter.Replace("undefined", "");

                Data.fldPageLimit = 8;
                try
                {
                    Data.fldSearchText = _strFilter.Split('`')[6];
                    Data.fldPageNo     = int.Parse(_strFilter.Split('`')[5]);
                }
                catch
                {
                    Data.fldPageNo = 1;
                }

                MyWSContext ws = new MyWSContext();
                using (DataTable _DTRecord = ws.AMSWebService.LoadSettingAssetWOAsset_Where(_strFilter, Session["CustomerID"].ToString()))
                {
                    ViewBag.RecordCount = _DTRecord.Rows.Count;
                    try
                    {
                        ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit;
                        if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0)
                        {
                            ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1;
                        }

                        _DTRecord.DefaultView.Sort = "fldAssetLevel,fldName";
                        dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable();
                    }
                    catch { }
                    ViewData["AssetWOAssetRecordData"] = dt;
                    Data.cbPageLimit     = GetDropDownPageLimit();
                    Data.cbPurchasingUOM = GetDropDownItem(false, "UOM");
                    Data.cbCostCenter    = GetDropDownItem(true, "CostCenter");
                    ViewBag.fldPageNo    = Data.fldPageNo;
                    Session["fldPageNo"] = Data.fldPageNo;
                }
            }
            catch
            {
                ViewData["AssetWOAssetRecordData"] = dt;
            }

            return(PartialView(Data));
        }
Exemplo n.º 4
0
        ////

        //Warehouse
        public PartialViewResult ViewWarehouseSearch(string _strFilter)
        {
            DataTable          dt   = new DataTable();
            AssetReceivedModel Data = new AssetReceivedModel();

            try
            {
                _strFilter = _strFilter.Replace("undefined", "");

                Data.fldPageLimit = 10;
                try
                {
                    Data.fldSearchTextWarehouse = _strFilter.Split('`')[1];
                    Data.fldPageNo = int.Parse(_strFilter.Split('`')[0]);
                }
                catch
                {
                    Data.fldPageNo = 1;
                }

                MyWSContext ws = new MyWSContext();
                string      _strWhereStatement = "```" + Data.fldSearchTextWarehouse + "`";
                using (DataTable _DTRecord = ws.AMSWebService.LoadSettingWarehouse_Where(_strWhereStatement, Session["CustomerID"].ToString()))
                {
                    ViewBag.RecordCount = _DTRecord.Rows.Count;
                    try
                    {
                        ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit;
                        if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0)
                        {
                            ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1;
                        }

                        _DTRecord.DefaultView.Sort = "fldName";
                        dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable();
                    }
                    catch { }
                    ViewData["AssetWarehouseRecordData"] = dt;
                    Data.cbPageLimit     = GetDropDownPageLimit();
                    ViewBag.PageNo       = Data.fldPageNo;
                    Session["fldPageNo"] = Data.fldPageNo;
                }
            }
            catch
            {
                ViewData["AssetWarehouseRecordData"] = dt;
            }
            return(PartialView(Data));
        }
Exemplo n.º 5
0
        public PartialViewResult ViewAssetsFilter(string _strSearchtext)
        {
            AssetReceivedModel Data = new AssetReceivedModel();

            Data.cbClassification = GetDropDownItem(true, "Classification");
            Data.cbCategory       = GetDropDownItem(true, "Category");
            Data.cbType           = GetDropDownItem(true, "Type");
            Data.cbBrand          = GetDropDownItem(true, "Brand");
            Data.cbModel          = GetDropDownItem(true, "Model");
            Data.cbPageLimit      = GetDropDownPageLimit();
            Data.fldPageLimit     = 10;
            ViewBag.PageNo        = 1;

            Data.fldSearchText = _strSearchtext;

            return(PartialView(Data));
        }
Exemplo n.º 6
0
        public ActionResult Add()
        {
            if (Session["_intCurrentID"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            try
            {
                if (bool.Parse(Session["AssetReceivedCreateAccess"].ToString()) != true)
                {
                    return(RedirectToAction("List", "AssetReceived"));
                }
            }
            catch
            {
                return(RedirectToAction("List", "AssetReceived"));
            }

            AssetReceivedModel Data = new AssetReceivedModel();


            try
            {
                Data.fldCode                   = "AR" + DateTime.Now.ToString().Remove(DateTime.Now.ToString().Length - 2).Replace("/", "").Replace(" ", "").Replace(":", "");
                Data.fldDateEncoded            = DateTime.Now;
                Data.cbCurrency                = GetDropDownItem(false, "Currency");
                Data.cbSupplier                = GetDropDownItem(false, "Supplier");
                Data.cbWarehouse               = GetDropDownItem(false, "Warehouse");
                Data.cbTransactionBy           = GetDropDownItem(false, "Employees");
                Data.cbReceviedBy              = GetDropDownItem(false, "Employees");
                Data.fldTransactionByCode      = Session["_strCurrentUserCode"].ToString();
                Session["fldAuthorizedStatus"] = "";
            }
            catch
            {
            }

            //List_Asset(Data.fldCode);

            return(View(Data));
        }
Exemplo n.º 7
0
 public JsonResult Update(AssetReceivedModel Data)
 {
     try
     {
         MyWSContext ws         = new MyWSContext();
         string      _strInput  = Data.CurrentID + "`" + String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Now) + "`" + Data.fldCode + "`" + Data.fldSupplierCode + "`" + Data.fldPONo + "`" + Data.fldDRNo + "`" + Data.fldDRDate + "`" + Data.fldCurrency + "`" + Data.fldWarehouseCode + "`" + Data.fldRemarks + "`" + Data.fldTransactionByCode + "`" + Data.fldReceivedByCode + "`" + String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Now) + "`" + Data.fldAuthorizedByCode + "`" + Data.fldAuthorizedDateTime + "`" + Data.fldAuthorizedComment + "`" + Data.fldAuthorizedStatus;
         string[]    _strOutput = ws.AMSWebService.SettingReceivingfromSupplier_SaveRecord(true, "", _strInput, Session["CustomerID"].ToString()).Split('`');
         if (_strOutput[0] == "true")
         {
             ModelState.AddModelError("", _strOutput[1]);
             return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             ModelState.AddModelError("", _strOutput[1]);
             return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); }
 }
Exemplo n.º 8
0
        public JsonResult CheckCode(AssetReceivedModel Data)
        {
            try
            {
                MyWSContext ws         = new MyWSContext();
                string      _strInput  = Data.fldCode;
                string[]    _strOutput = ws.AMSWebService.ReceivingfromSupplier_CheckCode(false, "", _strInput, Session["CustomerID"].ToString()).Split('`');

                if (_strOutput[0] == "true")
                {
                    ModelState.AddModelError("", _strOutput[1]);
                    return(Json(new { Success = true, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ModelState.AddModelError("", _strOutput[1]);
                    return(Json(new { Success = false, msg = _strOutput[1] }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex) { return(Json(new { Success = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); }
        }
Exemplo n.º 9
0
        public JsonResult Delete(AssetReceivedModel Data)
        {
            try
            {
                MyWSContext ws = new MyWSContext();

                string[] _strOutput = ws.AMSWebService.DeleteRecord_RecordID(Data.CurrentID, "ASSETRECEIVEDS", Session["CustomerID"].ToString()).Split('`');

                if (_strOutput[0] == "true")
                {
                    ViewBag.SystemError   = "";
                    ViewBag.SystemSuccess = _strOutput[1];
                    return(Json(new { Success = true, msg = ViewBag.SystemSuccess }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ViewBag.SystemError   = _strOutput[1];
                    ViewBag.SystemSuccess = "";
                }
            }
            catch { }
            return(Json(new { Success = false, msg = "" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        public ActionResult List()
        {
            if (!__isLogIn())
            {
                return(RedirectToAction("Login", "Account"));
            }

            try
            {
                if (bool.Parse(Session["AssetReceived"].ToString()) == false)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch {
                return(RedirectToAction("Index", "Home"));
            }

            Session["CurrentMenu"] = "InventoryManagement";
            AssetReceivedModel Data = new AssetReceivedModel();

            if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0)
            {
                Data.fldPageLimit = 10;
            }
            else
            {
                Data.fldPageLimit = int.Parse(Session["fldPageLimit"].ToString());
            }

            ViewBag.From             = Session["_strFromDate"];
            ViewBag.To               = Session["_strToDate"];
            ViewBag.Search           = Session["fldSearchText"];
            ViewBag.fldSupplierCode  = Session["fldSupplierCode"];
            ViewBag.fldWarehouseCode = Session["fldWarehouseCode"];


            Data.fldFromDate      = ViewBag.From == "" | ViewBag.From == null? null:String.Format("{0:yyyy-MM-dd}", DateTime.Parse(ViewBag.From));
            Data.fldToDate        = ViewBag.To == "" | ViewBag.To == null ? null : String.Format("{0:yyyy-MM-dd}", DateTime.Parse(ViewBag.To));
            Data.fldSearchText    = ViewBag.Search;
            Data.fldSupplierCode  = ViewBag.fldSupplierCode;
            Data.fldWarehouseCode = ViewBag.fldWarehouseCode;

            try
            {
                MyWSContext ws = new MyWSContext();


                string _strWhereStatement = "`" + ViewBag.From + "`" + ViewBag.To + "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`" + Data.fldSupplierCode + "`" + Data.fldWarehouseCode;
                using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString()))
                {
                    ViewBag.SystemError   = "";
                    ViewBag.SystemSuccess = "";
                    ViewBag.RecordCount   = _DTRecord.Rows.Count;
                    DataTable dt = new DataTable();
                    try
                    {
                        ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit;
                        if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0)
                        {
                            ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1;
                        }

                        if (Session["fldPageNo"] == null || int.Parse(Session["fldPageNo"].ToString()) == 0 || ViewBag.Pagging == 1)
                        {
                            Session["fldPageNo"] = 1;
                            Data.fldPageNo       = 1;
                        }
                        else
                        {
                            Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString());
                        }



                        _DTRecord.DefaultView.Sort = "fldDRDate desc";
                        dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable();
                    }
                    catch { }
                    ViewData["RecordData"] = dt;

                    ViewBag.PageNo       = Data.fldPageNo;
                    Session["fldPageNo"] = Data.fldPageNo;
                }

                Data.cbPageLimit = GetDropDownPageLimit();

                Data.cbSupplier  = GetDropDownItem(true, "Supplier");
                Data.cbWarehouse = GetDropDownItem(true, "Warehouse");


                if (Session["fldSupplierCode"] != null)
                {
                    if (Session["fldSupplierCode"].ToString() != "")
                    {
                        Data.fldSupplierCode = Session["fldSupplierCode"].ToString();
                    }
                }
                if (Session["fldWarehouseCode"] != null)
                {
                    if (Session["fldWarehouseCode"].ToString() != "")
                    {
                        Data.fldWarehouseCode = Session["fldWarehouseCode"].ToString();
                    }
                }
            }
            catch { }

            return(View(Data));
        }
Exemplo n.º 11
0
 public JsonResult GetEditRecord(AssetReceivedModel Data)
 {
     Session["CurrentID"] = Data.CurrentID;
     return(Json(new { Success = true, msg = "" }, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 12
0
        public ActionResult List(AssetReceivedModel Data)
        {
            try
            {
                if (Session["_intCurrentID"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                if (Session["fldPageLimit"] == null || Data.fldPageLimit == 0)
                {
                    Data.fldPageLimit = 10;
                }
                MyWSContext ws                 = new MyWSContext();
                string      _strFromDate       = Data.fldFromDate == null ? "" : String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Parse(Data.fldFromDate.ToString()));
                string      _strToDate         = Data.fldToDate == null ? "" : String.Format("{0:MM/dd/yyyy HH:mm}", DateTime.Parse(Data.fldToDate.ToString()));
                string      _strWhereStatement = "`" + _strFromDate + "`" + _strToDate + "`" + (Data.fldSearchText == null ? "" : Data.fldSearchText) + "`" + Data.fldSupplierCode + "`" + Data.fldWarehouseCode;

                using (DataTable _DTRecord = ws.AMSWebService.LoadSettingReceivingfromSupplier_Where(_strWhereStatement, Session["CustomerID"].ToString()))
                {
                    Session["_strFromDate"]  = _strFromDate;
                    Session["_strToDate"]    = _strToDate;
                    Session["fldSearchText"] = Data.fldSearchText;
                    Session["fldPageLimit"]  = Data.fldPageLimit;


                    Session["fldSupplierCode"]  = Data.fldSupplierCode;
                    Session["fldWarehouseCode"] = Data.fldWarehouseCode;

                    ViewBag.RecordCount = _DTRecord.Rows.Count;

                    DataTable dt = new DataTable();
                    try
                    {
                        ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit;
                        if ((_DTRecord.Rows.Count > (Data.fldPageLimit * ViewBag.Pagging)) && ViewBag.Pagging > 0)
                        {
                            ViewBag.Pagging = _DTRecord.Rows.Count / Data.fldPageLimit + 1;
                        }

                        if (Data.fldPageCommand != null)
                        {
                            if (Session["fldPageNo"] == null)
                            {
                                Session["fldPageNo"] = 1;
                            }
                            else
                            {
                                Data.fldPageNo = int.Parse(Session["fldPageNo"].ToString());
                            }


                            if (Data.fldPageCommand.Contains(">>"))
                            {
                                if (ViewBag.Pagging > Data.fldPageNo)
                                {
                                    Data.fldPageNo++;
                                }
                            }
                            else
                            {
                                Data.fldPageNo--;
                            }

                            if (Data.fldPageNo < 1)
                            {
                                Data.fldPageNo = 1;
                            }
                        }
                        else
                        {
                            Data.fldPageNo = 1;
                        }

                        _DTRecord.DefaultView.Sort = "fldDRDate desc";
                        dt = _DTRecord.Select().Skip((Data.fldPageLimit * Data.fldPageNo) - Data.fldPageLimit).Take(Data.fldPageLimit).CopyToDataTable();
                    }
                    catch { }
                    ViewData["RecordData"] = dt;

                    ViewBag.PageNo       = Data.fldPageNo;
                    Session["fldPageNo"] = Data.fldPageNo;
                }

                Data.cbPageLimit = GetDropDownPageLimit();

                Data.cbSupplier  = GetDropDownItem(true, "Supplier");
                Data.cbWarehouse = GetDropDownItem(true, "Warehouse");


                if (Session["fldSupplierCode"] != null)
                {
                    if (Session["fldSupplierCode"].ToString() != "")
                    {
                        Data.fldSupplierCode = Session["fldSupplierCode"].ToString();
                    }
                }
                if (Session["fldWarehouseCode"] != null)
                {
                    if (Session["fldWarehouseCode"].ToString() != "")
                    {
                        Data.fldWarehouseCode = Session["fldWarehouseCode"].ToString();
                    }
                }
            }
            catch { }

            return(View("List", Data));
        }