Ejemplo n.º 1
0
        public ActionResult UpdateGIRawMaterial(string id, string successmsg)
        {
            if (successmsg == null)
            {
                successmsg = "";
            }
            if (successmsg != "")
            {
                if (successmsg == "updatesuccess")
                {
                    @ViewBag.HideClass = "alert alert-success";
                    @ViewBag.Message   = "Goods Inward Updated Successfully!";
                }
                else
                {
                    @ViewBag.HideClass = "alert alert-success";
                    @ViewBag.Message   = "Goods Inward Created Successfully!";
                }
            }
            ssmtbl_GoodsInwardModel objModel = new ssmtbl_GoodsInwardModel();

            if (id != null)
            {
                //objModel = objGIData.getGoodsInwardByID(GoodsInwardType.RawMaterial, id);
                objModel = objGIData.getGoodsInwardByGinNo(GoodsInwardType.RawMaterial, id);
                objModel.ssmtbl_GoodsInward_DetailsModel     = objGIData.getGoodsInwardDetailByID(objModel.gin_number);
                objModel.ssmtbl_GoodsInward_DocReceivedModel = objGFunc.GetGIDocSeletedReceivedList(objModel.gin_number);
                @ViewBag.RatePer       = objDrop.GetRatePerList();
                @ViewBag.CostCenterDet = objDrop.GetCostCenter();
                return(View(objModel));
            }
            return(RedirectToAction("GIRawMaterial"));
        }
Ejemplo n.º 2
0
        public ActionResult GIRepair(string gidata, string gidetailsdata, string gidocreceived)
        {
            ssmtbl_GoodsInwardModel objModel = new ssmtbl_GoodsInwardModel();
            string result = "";

            try
            {
                var serializeData         = JsonConvert.DeserializeObject <List <ssmtbl_GoodsInward_DetailsModel> >(gidetailsdata);
                var giserializeData       = JsonConvert.DeserializeObject <ssmtbl_GoodsInwardModel>(gidata);
                var giserializeDocRecData = JsonConvert.DeserializeObject <List <ssmtbl_GoodsInward_DocReceivedModel> >(gidocreceived);

                objModel = giserializeData;
                objModel.ssmtbl_GoodsInward_DetailsModel     = serializeData;
                objModel.ssmtbl_GoodsInward_DocReceivedModel = giserializeDocRecData;
                objModel.inward_type = GoodsInwardType.Repair;

                var valid = TryUpdateModel(objModel);


                if (ModelState.IsValid)
                {
                    result = objGIData.InsertGoodsInward(objModel);
                    var sdata = new
                    {
                        result,
                        objModel.gin_number
                    };
                    return(Json(sdata, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    result = "Enter Mandatory Fields!";
                    var sdata = new
                    {
                        result,
                        objModel.gin_number
                    };
                    return(Json(sdata, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
                result = "Error while inserting data!";
                var sdata = new
                {
                    result,
                    objModel.gin_number
                };
                return(Json(sdata, JsonRequestBehavior.AllowGet));
            }
            @ViewBag.RatePer       = objDrop.GetRatePerList();
            @ViewBag.CostCenterDet = objDrop.GetCostCenter();
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult GIRawMaterial()
        {
            ssmtbl_GoodsInwardModel objModel = new ssmtbl_GoodsInwardModel();

            objModel               = objGIData.GetMaxGINNo();
            @ViewBag.RatePer       = objDrop.GetRatePerList();
            @ViewBag.CostCenterDet = objDrop.GetCostCenter();
            objModel.inward_type   = GoodsInwardType.RawMaterial;
            objModel.ssmtbl_GoodsInward_DocReceivedModel = objGFunc.GetGIDocReceivedList();
            return(View(objModel));
        }
Ejemplo n.º 4
0
        private string CheckGIConsumables(ssmtbl_GoodsInwardModel objModel)
        {
            string result = "";

            if (objModel.if_no_specify == null)
            {
                objModel.if_no_specify = "";
            }
            if (objModel.if_no_specify == "")
            {
                result = "Check Document Received!";
            }

            if (result != "")
            {
                foreach (var itemchk in objModel.ssmtbl_GoodsInward_DocReceivedModel)
                {
                    if (itemchk.ischecked == true)
                    {
                        result = "";
                    }
                }
            }


            foreach (var data in objModel.ssmtbl_GoodsInward_DetailsModel)
            {
                if (data.accepted_qty > data.challan_qty)
                {
                    result = "Accepted Qty cannot be greater than Challan Qty!";
                    return(result);
                }
                else if (data.shortfall > 0)
                {
                    if (data.reason == null || data.reason == "")
                    {
                        result = "Put reason for shortfall!";
                        return(result);
                    }
                }
            }

            return(result);
        }