示例#1
0
        public ActionResult GetTrxSchProvisionalChallanListData(string startDate, string endDate)
        {
            List <SchProvisionalChallan> objSchProvisionalChallanList = new List <SchProvisionalChallan>();

            try
            {
                // Int16 CircleId = Convert.ToInt16(GlobalSettings.oUserData.CircleID);
                Int16     AccadYear = Convert.ToInt16(GlobalSettings.oUserData.AcademicYearId);
                DataTable dt        = objDbTrx.GetSchProvisionalChallanView(Convert.ToDateTime(startDate + " 00:00:00.000"), Convert.ToDateTime(endDate + " 23:59:59.999"), AccadYear);
                if (dt.Rows.Count > 0)
                {
                    for (int iCnt = 0; iCnt < dt.Rows.Count; iCnt++)
                    {
                        SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();
                        objSchProvisionalChallan.ChallanId     = Convert.ToInt32(dt.Rows[iCnt]["ID"].ToString());
                        objSchProvisionalChallan.ChallanNo     = Convert.ToString(dt.Rows[iCnt]["CHALLAN_NUMBER"].ToString());
                        objSchProvisionalChallan.ChallanDate   = Convert.ToDateTime(dt.Rows[iCnt]["CHALLAN_DATE"].ToString()).ToString("dd-MMM-yyyy");
                        objSchProvisionalChallan.DistrictName  = dt.Rows[iCnt]["DISTRICT"].ToString();
                        objSchProvisionalChallan.CircleName    = dt.Rows[iCnt]["CIRCLE_NAME"].ToString();
                        objSchProvisionalChallan.SaveStatus    = Convert.ToInt16(dt.Rows[iCnt]["STATUS"].ToString());
                        objSchProvisionalChallan.LanguageName  = Convert.ToString(dt.Rows[iCnt]["LANGUAGE"].ToString());
                        objSchProvisionalChallan.LastUpdatedBy = Convert.ToString(dt.Rows[iCnt]["UPDATED_BY"].ToString());
                        objSchProvisionalChallan.LastUpdatedOn = Convert.ToDateTime(dt.Rows[iCnt]["UPDATED_TS"].ToString()).ToString("dd-MMM-yyyy");
                        objSchProvisionalChallanList.Add(objSchProvisionalChallan);
                    }
                }
            }
            catch (Exception ex)
            {
                objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
            }
            return(Json(objSchProvisionalChallanList, JsonRequestBehavior.AllowGet));
            //  return View();
        }
示例#2
0
        public JsonResult UpdateSchConfirmChallan(string TransporterID, string ConsigneeNo, string VehicleNo, Int32 ChallanId)
        {
            SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();

            try
            {
                objSchProvisionalChallan.UserId        = GlobalSettings.oUserData.UserId;
                objSchProvisionalChallan.TransporterID = TransporterID;
                objSchProvisionalChallan.ConsigneeNo   = ConsigneeNo;
                objSchProvisionalChallan.VehicleNo     = VehicleNo;
                objSchProvisionalChallan.ChallanId     = ChallanId;
                bool isUpdated = objDbTrx.UpdateSchConfirmChallan(objSchProvisionalChallan);
                if (isUpdated == true)
                {
                    objSchProvisionalChallan.UpdateCode    = "SUCCESS";
                    objSchProvisionalChallan.UpdateMessage = "Challan information saved successfully";
                }
            }
            catch (Exception ex)
            {
                objSchProvisionalChallan.UpdateCode    = "ERROR";
                objSchProvisionalChallan.UpdateMessage = "Some Error occured. please contact system administrator.";

                objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
            }
            return(Json(objSchProvisionalChallan, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult SchChallanPrint(Int64 ChallanId)
        {
            SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();

            if (ChallanId > 0)
            {
                try
                {
                    DataTable dtRequisition = objDbTrx.GetSchProbChallanByChallanId(Convert.ToInt64(ChallanId));
                    if (dtRequisition.Rows.Count > 0)
                    {
                        objSchProvisionalChallan.ChallanId   = Convert.ToInt32(dtRequisition.Rows[0]["ID"].ToString());
                        objSchProvisionalChallan.ChallanDate = Convert.ToDateTime(dtRequisition.Rows[0]["CHALLAN_DATE"]).ToString("dd-MMM-yyyy");
                        objSchProvisionalChallan.ChallanNo   = dtRequisition.Rows[0]["CHALLAN_NUMBER"].ToString();
                        objSchProvisionalChallan.LanguageID  = Convert.ToInt16(dtRequisition.Rows[0]["LANGUAGE_ID"].ToString());
                        objSchProvisionalChallan.CircleId    = Convert.ToInt32(dtRequisition.Rows[0]["CIRCLE_ID"].ToString());
                        objSchProvisionalChallan.DistrictId  = Convert.ToInt16(dtRequisition.Rows[0]["DISTRICT_ID"].ToString());
                        objSchProvisionalChallan.ConsigneeNo = dtRequisition.Rows[0]["CONSIGNEE_NO"].ToString();
                        objSchProvisionalChallan.VehicleNo   = dtRequisition.Rows[0]["VEHICLE_NO"].ToString();
                        objSchProvisionalChallan.SaveStatus  = Convert.ToInt32(dtRequisition.Rows[0]["STATUS"].ToString());
                        if (dtRequisition.Rows[0]["TRANSPORTER_ID"].ToString() != "")
                        {
                            objSchProvisionalChallan.TransporterID = dtRequisition.Rows[0]["TRANSPORTER_ID"].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    TempData["AppMessage"] = "Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.";
                    objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
                }
            }
            return(View(objSchProvisionalChallan));
        }
示例#4
0
 public ActionResult TrxSchProvisionalChallanUpdate(SchProvisionalChallan objSchProvisionalChallan)
 {
     try
     {
         string reqGenCode = "";
         objSchProvisionalChallan.AcademicYearID = GlobalSettings.oUserData.AcademicYearId;
         objSchProvisionalChallan.UserId         = GlobalSettings.oUserData.UserId;
         if (objSchProvisionalChallan.ChallanId <= 0)
         {
             objSchProvisionalChallan.SaveStatus = 0;
             objDbTrx.InsertInSchProvisionalChallan(objSchProvisionalChallan, out reqGenCode);
             TempData["AppMessage"] = "Challan created successfully and the Challan code is " + reqGenCode;
         }
         else if (objSchProvisionalChallan.ChallanId > 0)
         {
             reqGenCode = objSchProvisionalChallan.ChallanNo;
             objSchProvisionalChallan.SaveStatus = 0;
             // objDbTrx.UpdateInSchRequisition(objSchProvisionalChallan);
             TempData["AppMessage"] = "Challan updated successfully for the Challan code is " + reqGenCode;
         }
     }
     catch (Exception ex)
     {
         TempData["AppMessage"] = "Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.";
         objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
     }
     return(RedirectToAction("Index", "TrxSchProvisionalChallanView"));
 }
示例#5
0
        public ActionResult Index(Int64?ChallanId)
        {
            ViewBag.Active = "TrxSchProvisionalChallan";
            SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();

            if (ChallanId == null || ChallanId <= 0)
            {
                objSchProvisionalChallan.ChallanDate = DateTime.Now.ToString("dd-MMM-yyyy").ToUpper();
                objSchProvisionalChallan.ChallanNo   = "TBC" + (DateTime.Now.Month >= 4 ? DateTime.Now.Year.ToString().Substring(2) + "-" + (Convert.ToInt32(DateTime.Now.Year.ToString().Substring(2)) + 1) + "-XXXXXXX" : (Convert.ToInt32(DateTime.Now.Year.ToString().Substring(2)) - 1) + "-" + DateTime.Now.Year.ToString().Substring(2) + "-XXXXXXX").ToString();
                objSchProvisionalChallan.ChallanId   = -1;
            }
            else if (ChallanId > 0)
            {
                try
                {
                    DataTable dtRequisition = objDbTrx.GetSchProbChallanByChallanId(Convert.ToInt64(ChallanId));
                    if (dtRequisition.Rows.Count > 0)
                    {
                        objSchProvisionalChallan.ChallanId   = Convert.ToInt32(dtRequisition.Rows[0]["ID"].ToString());
                        objSchProvisionalChallan.ChallanDate = Convert.ToDateTime(dtRequisition.Rows[0]["CHALLAN_DATE"]).ToString("dd-MMM-yyyy");
                        objSchProvisionalChallan.ChallanNo   = dtRequisition.Rows[0]["CHALLAN_NUMBER"].ToString();
                        objSchProvisionalChallan.LanguageID  = Convert.ToInt16(dtRequisition.Rows[0]["LANGUAGE_ID"].ToString());
                        objSchProvisionalChallan.CircleId    = Convert.ToInt32(dtRequisition.Rows[0]["CIRCLE_ID"].ToString());
                        objSchProvisionalChallan.DistrictId  = Convert.ToInt16(dtRequisition.Rows[0]["DISTRICT_ID"].ToString());
                        objSchProvisionalChallan.SaveStatus  = Convert.ToInt32(dtRequisition.Rows[0]["STATUS"].ToString());
                    }
                }
                catch (Exception ex)
                {
                    TempData["AppMessage"] = "Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.";
                    objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
                }
            }
            return(View(objSchProvisionalChallan));
        }
示例#6
0
        public ActionResult Index()
        {
            ViewBag.Active = "TrxSchProvisionalChallanView";
            SchProvisionalChallan objSchProvisionalChallanView = new SchProvisionalChallan();

            objSchProvisionalChallanView.StartDate = Convert.ToDateTime(DateTime.Now).ToString("dd-MMM-yyyy");
            objSchProvisionalChallanView.EndDate   = Convert.ToDateTime(DateTime.Now).ToString("dd-MMM-yyyy");
            return(View(objSchProvisionalChallanView));
        }
示例#7
0
        public JsonResult ConfirmRequisition(string griddata)
        {
            string[] ChallanIds   = griddata.TrimEnd(',').Split(',');
            string   ErrorMessage = "";

            try
            {
                SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();
                objSchProvisionalChallan.UserId     = GlobalSettings.oUserData.UserId;
                objSchProvisionalChallan.SaveStatus = 1;
                objDbTrx.SchRequisitionProbChallanConfirm(objSchProvisionalChallan, griddata.TrimEnd(','));
                ErrorMessage = ChallanIds.Count() + " Challan confirmed successfully.";
            }
            catch (Exception ex)
            {
                ErrorMessage = "Some Error occured while confirming Requisition. Please confirm system administrator";
                objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
            }
            return(Json(ErrorMessage));
        }
示例#8
0
        public JsonResult GetBinderAllotMentCodeDtl(string BinderAllotMentCode, Int32 ChallanId)
        {
            bool IsError = false;
            SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();

            //List<BookRequisitionCalculatedDtl> objLstBookRequisitionCalculatedDtl = new List<BookRequisitionCalculatedDtl>();
            //BookRequisitionCalculatedDtl objBookRequisitionCalculatedDtl = new BookRequisitionCalculatedDtl();
            try
            {
                if (BinderAllotMentCode.Length > 0)
                {
                    DataSet dtBinderinfo = objDbTrx.GetBinderAllotmentDtlByCode(BinderAllotMentCode, ChallanId);
                    if (dtBinderinfo.Tables[0].Rows.Count > 0)
                    {
                        objSchProvisionalChallan.IssuedQty = Convert.ToInt32(dtBinderinfo.Tables[0].Rows[0]["QTY_ISSUED"].ToString());
                        objSchProvisionalChallan.Lot       = Convert.ToInt32(dtBinderinfo.Tables[0].Rows[0]["Lot"].ToString());
                        // objBookRequisitionCalculatedDtl.BookCode = dtBinderinfo.Tables[0].Rows[0]["BOOK_CODE"].ToString();
                        // objBookRequisitionCalculatedDtl.BookCode = dtBinderinfo.Tables[0].Rows[0]["BOOK_CODE"].ToString();
                    }
                    if (dtBinderinfo.Tables[1].Rows.Count > 0)
                    {
                        objSchProvisionalChallan.AllotedQty = Convert.ToInt32(dtBinderinfo.Tables[1].Rows[0]["AllotedQty"].ToString());
                        objSchProvisionalChallan.IssuedQty  = Convert.ToInt32(dtBinderinfo.Tables[1].Rows[0]["IssuedQty"].ToString());
                    }
                    if (dtBinderinfo.Tables[0].Rows.Count == 0 || dtBinderinfo.Tables[0] == null)
                    {
                        objSchProvisionalChallan.UpdateCode    = "ERROR";
                        objSchProvisionalChallan.UpdateMessage = "Allotment code " + BinderAllotMentCode + " is Invalid. Please try with some other Allotment Code";
                        IsError = true;
                    }
                }
            }
            catch (Exception ex)
            {
                objSchProvisionalChallan.UpdateCode    = "ERROR";
                objSchProvisionalChallan.UpdateMessage = "Some Error occured. please contact system administrator.";

                objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
            }
            return(Json(objSchProvisionalChallan, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        public JsonResult UpdateSchChallan(string BinderAllotMentCode, Int32 ChallanId)
        {
            SchProvisionalChallan objSchProvisionalChallan = new SchProvisionalChallan();
            DataTable             dt = new DataTable();
            List <BookRequisitionCalculatedDtl> ObjlstBookRequisitionCalculatedDtl = new List <BookRequisitionCalculatedDtl>();
            Int32  RequiredQty    = 0;
            Int32  IssuedQty      = 0;
            Double RequiredWeight = 0;
            Double IssuedWeight   = 0;
            bool   IsError        = false;

            try
            {
                if (BinderAllotMentCode.Length > 0)
                {
                    DataSet dtBinderinfo = objDbTrx.GetBinderAllotmentDtlByCode(BinderAllotMentCode, ChallanId);
                    if (dtBinderinfo.Tables[1].Rows.Count > 0)
                    {
                        Int32 Qty           = Convert.ToInt32(dtBinderinfo.Tables[1].Rows[0]["QTY"].ToString());
                        Int32 QtyToBeIssued = Convert.ToInt32(dtBinderinfo.Tables[1].Rows[0]["AllotedQty"].ToString()) + Convert.ToInt32(dtBinderinfo.Tables[1].Rows[0]["LOT"].ToString());;
                        if (QtyToBeIssued > Qty)
                        {
                            objSchProvisionalChallan.UpdateCode    = "ERROR";
                            objSchProvisionalChallan.UpdateMessage = "Quantity to be issued will be " + QtyToBeIssued + " and it can not be more than the requisiont qty" + Qty + " for Book " + dtBinderinfo.Tables[1].Rows[0]["BOOK_CODE"].ToString() + " - " + dtBinderinfo.Tables[1].Rows[0]["BOOK_NAME"].ToString();
                            IsError = true;
                        }
                    }
                    if (dtBinderinfo.Tables[0].Rows.Count == 0 || dtBinderinfo.Tables[0] == null)
                    {
                        objSchProvisionalChallan.UpdateCode    = "ERROR";
                        objSchProvisionalChallan.UpdateMessage = "Allotment code " + BinderAllotMentCode + " is Invalid. Please try with some other Allotment Code";
                        IsError = true;
                    }
                    if (dtBinderinfo.Tables[0].Rows.Count > 0 && IsError == false)
                    {
                        objSchProvisionalChallan.ChallanId           = ChallanId;
                        objSchProvisionalChallan.BinderAllotMentCode = BinderAllotMentCode;
                        objSchProvisionalChallan.AcademicYearID      = GlobalSettings.oUserData.AcademicYearId;
                        objSchProvisionalChallan.UserId            = GlobalSettings.oUserData.UserId;
                        objSchProvisionalChallan.BinderAllotMentId = Convert.ToInt32(dtBinderinfo.Tables[0].Rows[0]["ID"].ToString());
                        objSchProvisionalChallan.ChallanQty        = 1;

                        dt = objDbTrx.IsValidBinderAllotmentBookDtl(objSchProvisionalChallan.ChallanId, objSchProvisionalChallan.BinderAllotMentId);
                        if (dt == null || dt.Rows.Count == 0)
                        {
                            objSchProvisionalChallan.UpdateCode    = "ERROR";
                            objSchProvisionalChallan.UpdateMessage = "Invalid Binder book details. The Book details is not available for this challan.";
                            //  return Json(objSchProvisionalChallan, JsonRequestBehavior.AllowGet);
                        }
                        else
                        {
                            Int32 ReqQty    = Convert.ToInt32(dtBinderinfo.Tables[0].Rows[0]["REQ_QTY"].ToString());
                            Int32 QtyIssued = Convert.ToInt32(dtBinderinfo.Tables[0].Rows[0]["QTY_ISSUED"].ToString());
                            if (QtyIssued < ReqQty)
                            {
                                bool isUpdated = objDbTrx.UpdateSchChallan(objSchProvisionalChallan);
                                if (isUpdated == true)
                                {
                                    objSchProvisionalChallan.UpdateCode    = "SUCCESS";
                                    objSchProvisionalChallan.UpdateMessage = "Lot Quantity updated successfully";
                                }
                                else
                                {
                                    objSchProvisionalChallan.UpdateCode    = "ERROR";
                                    objSchProvisionalChallan.UpdateMessage = "Lot Quantity updated unsccessfull";
                                }
                            }
                            else
                            {
                                objSchProvisionalChallan.UpdateCode    = "ERROR";
                                objSchProvisionalChallan.UpdateMessage = "Allotment Quantity is not valid.All the lot  for allotment code " + BinderAllotMentCode + " is complited.";
                            }
                        }
                    }
                }

                dt = objDbTrx.GetProbChallanBookDetailsById(ChallanId);
                DataTable dtBookAllotedQty = objDbTrx.GetBookAllotedQtyByChallaId(ChallanId);
                if (dt.Rows.Count > 0)
                {
                    for (int iCnt = 0; iCnt < dt.Rows.Count; iCnt++)
                    {
                        BookRequisitionCalculatedDtl objBookRequisitionCalculatedDtl = new BookRequisitionCalculatedDtl();
                        objBookRequisitionCalculatedDtl.Class      = dt.Rows[iCnt]["CLASS"].ToString();
                        objBookRequisitionCalculatedDtl.BookCode   = dt.Rows[iCnt]["BOOK_CODE"].ToString();
                        objBookRequisitionCalculatedDtl.BookName   = dt.Rows[iCnt]["BOOK_NAME"].ToString();
                        objBookRequisitionCalculatedDtl.Qty        = Convert.ToInt32(dt.Rows[iCnt]["Qty"].ToString());
                        objBookRequisitionCalculatedDtl.TotWeight  = Convert.ToDouble(dt.Rows[iCnt]["TotWeight"].ToString());
                        objBookRequisitionCalculatedDtl.ChallanQty = 0;
                        RequiredQty    = RequiredQty + objBookRequisitionCalculatedDtl.Qty;
                        RequiredWeight = RequiredWeight + objBookRequisitionCalculatedDtl.TotWeight;

                        for (int jCnt = 0; jCnt < dtBookAllotedQty.Rows.Count; jCnt++)
                        {
                            if (dt.Rows[iCnt]["BOOK_CODE"].ToString() == dtBookAllotedQty.Rows[jCnt]["BOOK_CODE"].ToString())
                            {
                                objBookRequisitionCalculatedDtl.ChallanQty = Convert.ToInt32(dtBookAllotedQty.Rows[jCnt]["AllotedQty"].ToString());
                                IssuedQty    = IssuedQty + objBookRequisitionCalculatedDtl.ChallanQty;
                                IssuedWeight = IssuedWeight + Convert.ToDouble(dtBookAllotedQty.Rows[jCnt]["TotWeight"].ToString());
                                break;
                            }
                        }
                        ObjlstBookRequisitionCalculatedDtl.Add(objBookRequisitionCalculatedDtl);
                    }
                }

                objSchProvisionalChallan.BookRequisitionCalculatedDtlCollection = ObjlstBookRequisitionCalculatedDtl;
                objSchProvisionalChallan.RequiredQty = RequiredQty;
                objSchProvisionalChallan.IssuedQty   = IssuedQty;
                objSchProvisionalChallan.RemainigQty = RequiredQty - IssuedQty;

                objSchProvisionalChallan.RequiredWeight = RequiredWeight;
                objSchProvisionalChallan.IssuedWeight   = IssuedWeight;
                objSchProvisionalChallan.RemainigWeight = RequiredWeight - IssuedWeight;
            }
            catch (Exception ex)
            {
                objSchProvisionalChallan.UpdateCode    = "ERROR";
                objSchProvisionalChallan.UpdateMessage = "Some Error occured. please contact system administrator.";

                objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress);
            }
            return(Json(objSchProvisionalChallan, JsonRequestBehavior.AllowGet));
        }