public JsonResult GetReqViewData(string SchoolId, string startDate, string endDate) { List <SchoolChallan> objReq = new List <SchoolChallan>(); try { string CircleId = "-1"; try { CircleId = GlobalSettings.oUserData.CircleID; } catch { CircleId = "-1"; } DataTable dtReqView = objDbTrx.GetSchoolChallanViewBySchooldId(Convert.ToInt64(SchoolId), Convert.ToInt64(CircleId), startDate, endDate); if (dtReqView.Rows.Count > 0) { for (int iCnt = 0; iCnt < dtReqView.Rows.Count; iCnt++) { SchoolChallan rq = new SchoolChallan(); rq.SchoolChallanUniqueId = Convert.ToInt64(dtReqView.Rows[iCnt]["ID"].ToString()); rq.RequisitionId = Convert.ToInt64(dtReqView.Rows[iCnt]["REQUISITION_ID"].ToString()); rq.SchoolChallanCode = Convert.ToString(dtReqView.Rows[iCnt]["SCH_CHALLAN_CODE"].ToString()); rq.SchoolChallanDate = Convert.ToDateTime(dtReqView.Rows[iCnt]["SCH_CHALLAN_DATE"].ToString()).ToString("dd-MMM-yyyy").ToUpper(); rq.ReqCode = Convert.ToString(dtReqView.Rows[iCnt]["REQ_CODE"].ToString()); rq.RequisitionDate = Convert.ToDateTime(dtReqView.Rows[iCnt]["REQUISITION_DATE"].ToString()).ToString("dd-MMM-yyyy").ToUpper(); rq.ChallanUpdatedBy = Convert.ToString(dtReqView.Rows[iCnt]["UPDATED_BY"].ToString()); rq.ChallanUpdatedTs = Convert.ToDateTime(dtReqView.Rows[iCnt]["UPDATED_TS"].ToString()).ToString("dd-MMM-yyyy hh:mm tt").ToUpper(); rq.SchoolCode = Convert.ToString(dtReqView.Rows[iCnt]["SCHOOL_CODE"].ToString()); rq.SchoolName = Convert.ToString(dtReqView.Rows[iCnt]["SCHOOL_NAME"].ToString()); objReq.Add(rq); } } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(Json(objReq)); }
public JsonResult GetReqViewData(string SchoolId, string startDate, string endDate) { List <SchoolChallan> objReq = new List <SchoolChallan>(); try { string CircleId = "-1"; try { CircleId = GlobalSettings.oUserData.CircleID; } catch { CircleId = "-1"; } DataTable dtReqView = objDbTrx.GetRequisitionBySchoolId(Convert.ToInt64(SchoolId), (startDate + " 00:00:00.000"), (endDate + " 23:59:59.999")); if (dtReqView.Rows.Count > 0) { for (int iCnt = 0; iCnt < dtReqView.Rows.Count; iCnt++) { SchoolChallan rq = new SchoolChallan(); rq.RequisitionId = Convert.ToInt64(dtReqView.Rows[iCnt]["REQUISITION_ID"].ToString()); rq.RequisitionDate = Convert.ToDateTime(dtReqView.Rows[iCnt]["REQUISITION_DATE"].ToString()).ToString("dd-MMM-yyyy hh:mm tt").ToUpper(); rq.ReqCode = Convert.ToString(dtReqView.Rows[iCnt]["REQ_CODE"].ToString()); rq.SchoolName = Convert.ToString(dtReqView.Rows[iCnt]["SCHOOL_NAME"].ToString()); rq.SchoolCode = Convert.ToString(dtReqView.Rows[iCnt]["SCHOOL_CODE"].ToString()); rq.Language = Convert.ToString(dtReqView.Rows[iCnt]["LANGUAGE"].ToString()); rq.Category = Convert.ToString(dtReqView.Rows[iCnt]["BOOK_CATEGORY"].ToString()); objReq.Add(rq); } } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(Json(objReq)); }
public ActionResult CreateChallan() { SchoolChallan ObjReq = new SchoolChallan(); try { Int64 ReqId = Convert.ToInt64(TempData["ID"].ToString()); Int64 challanId = Convert.ToInt64(TempData["SchChallanId"].ToString()); ObjReq.SchoolChallanUniqueId = challanId; DataTable dtReqView = objDbTrx.GetRequisitionDtlByReqId(ReqId, challanId); if (dtReqView.Rows.Count > 0) { ObjReq.SchoolChallanDate = DateTime.Now.ToString("dd-MMM-yyyy"); //ObjReq.SchoolChallanCode = "SCH" + (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(); ObjReq.SchoolChallanCode = string.Format("{0}{1}", GlobalSettings.oAcademicYear.PFX_SCHCHALLAN, new String('X', GlobalSettings.oAcademicYear.FormatNumberPaddingCount)); ObjReq.RequisitionId = Convert.ToInt64(dtReqView.Rows[0]["REQUISITION_ID"].ToString()); ObjReq.RequisitionDate = Convert.ToDateTime(dtReqView.Rows[0]["REQUISITION_DATE"].ToString()).ToString("dd-MMM-yyyy hh:mm tt").ToUpper(); ObjReq.ReqCode = Convert.ToString(dtReqView.Rows[0]["REQ_CODE"].ToString()); ObjReq.SchoolName = Convert.ToString(dtReqView.Rows[0]["SCHOOL_NAME"].ToString()); ObjReq.SchoolCode = Convert.ToString(dtReqView.Rows[0]["SCHOOL_CODE"].ToString()); ObjReq.SchoolAddress = Convert.ToString(dtReqView.Rows[0]["SCHOOL_ADDRESS"].ToString()); ObjReq.SchoolContactNo = Convert.ToString(dtReqView.Rows[0]["SCHOOL_PHONE_NO"].ToString()); ObjReq.Language = Convert.ToString(dtReqView.Rows[0]["LANGUAGE"].ToString()); ObjReq.Category = Convert.ToString(dtReqView.Rows[0]["BOOK_CATEGORY"].ToString()); if (dtReqView.Rows[0]["SCH_CHALLAN_CODE"].ToString() != "") { ObjReq.SchoolChallanCode = Convert.ToString(dtReqView.Rows[0]["SCH_CHALLAN_CODE"].ToString()); ObjReq.SchoolChallanDate = Convert.ToDateTime(dtReqView.Rows[0]["SCH_CHALLAN_DATE"].ToString()).ToString("dd-MMM-yyyy"); } List <SchoolChallanBookReqDtl> ObjlstChallan = new List <SchoolChallanBookReqDtl>(); for (int iCnt = 0; iCnt < dtReqView.Rows.Count; iCnt++) { // Remaining = 0; SchoolChallanBookReqDtl objChDtl = new SchoolChallanBookReqDtl(); objChDtl.ReqDtlId = Convert.ToInt64(dtReqView.Rows[iCnt]["REQUISITION_DTL_ID"].ToString()); objChDtl.BookID = Convert.ToInt64(dtReqView.Rows[iCnt]["BOOK_ID"].ToString()); objChDtl.BookCode = dtReqView.Rows[iCnt]["BOOK_CODE"].ToString(); objChDtl.BookName = dtReqView.Rows[iCnt]["BOOK_NAME"].ToString(); objChDtl.Class = dtReqView.Rows[iCnt]["CLASS"].ToString(); objChDtl.RequisitionQuantity = Convert.ToInt64(dtReqView.Rows[iCnt]["REQ_QTY"].ToString()); //06-12-2018 -- Changeed by Anik Sen objChDtl.AvailableStockQuantity = (Convert.ToInt64(dtReqView.Rows[iCnt]["QTY_RECEIVED"].ToString()) + Convert.ToInt64(dtReqView.Rows[iCnt]["STOCK_QTY"].ToString())) - Convert.ToInt64(dtReqView.Rows[iCnt]["ALREADY_SHIPPED"].ToString()); objChDtl.AvailableStockQuantity = objChDtl.AvailableStockQuantity > default(long) ? objChDtl.AvailableStockQuantity : default(long); objChDtl.AlreadyShippedQuantity = Convert.ToInt64(dtReqView.Rows[iCnt]["ALREADY_SHIPPED"].ToString()); objChDtl.QuantityForShipping = Convert.ToInt64(dtReqView.Rows[iCnt]["QTY_FOR_SHIPPING"].ToString()); objChDtl.QtyReceived = Convert.ToInt64(dtReqView.Rows[iCnt]["QTY_RECEIVED"].ToString()); objChDtl.StockQty = Convert.ToInt64(dtReqView.Rows[iCnt]["STOCK_QTY"].ToString()); ObjlstChallan.Add(objChDtl); } ObjReq.trxSchoolChallanBookReqDtl = ObjlstChallan; } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(View(ObjReq)); }
public ActionResult CreateChallan(SchoolChallan objSchoolChallan) { bool cc = default(bool); try { if (objSchoolChallan != null && objSchoolChallan.trxSchoolChallanBookReqDtl != null && objSchoolChallan.trxSchoolChallanBookReqDtl.Count() > default(int)) { foreach (var tx in objSchoolChallan.trxSchoolChallanBookReqDtl) { var minresult = (tx.AvailableStockQuantity - tx.AlreadyShippedQuantity); //if (tx.QuantityForShipping > minresult) // modified on 04.01.19 //{ if (tx.QuantityForShipping > tx.AvailableStockQuantity) { cc = true; break; } } } if (cc) { throw new Exception("Quantity for shipping is greater than available stock. Please check your entries before submit."); } string ChallanNo = ""; //objSchoolChallan.UserId = GlobalSettings.oUserData.UserId; objSchoolChallan.UserId = GlobalSettings.oUserData.UserId; objSchoolChallan.AY_ID = GlobalSettings.oUserData.AcademicYearId; if (objSchoolChallan.SchoolChallanUniqueId == 0) { var inresult = objDbTrx.InsertInSchoolChallan(objSchoolChallan, GlobalSettings.oAcademicYear.PFX_SCHCHALLAN, GlobalSettings.oAcademicYear.FormatNumberPaddingCount, out ChallanNo); if (inresult) { objDbTrx.AutoMapBookCodeForSchReq(); } } else if (objSchoolChallan.SchoolChallanUniqueId > 0) { objDbTrx.UpdateInSchoolChallan(objSchoolChallan); } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } if (cc) { TempData["strStockErrorMessage"] = "Quantity for shipping is greater than available stock. Please check your entries before submit."; return(RedirectToAction("Index", "SchoolChallan")); } else { return(RedirectToAction("Index", "SchoolChallanView")); } }
public Models.SchoolChallan getData(string SchChallanId) { SchoolChallan ObjReq = new SchoolChallan(); try { Int64 challanId = Convert.ToInt64(SchChallanId); ObjReq.SchoolChallanUniqueId = challanId; DataTable dtReqView = objDbTrx.GetSchoolChallanPrintDtl(challanId); if (dtReqView.Rows.Count > 0) { ObjReq.SchoolChallanCode = Convert.ToString(dtReqView.Rows[0]["SCH_CHALLAN_CODE"].ToString()); ObjReq.SchoolChallanDate = Convert.ToDateTime(dtReqView.Rows[0]["SCH_CHALLAN_DATE"].ToString()).ToString("dd-MMM-yyyy"); ObjReq.ChallanYear = (Convert.ToDateTime(ObjReq.SchoolChallanDate).Month >= 4 ? (Convert.ToInt32(Convert.ToDateTime(ObjReq.SchoolChallanDate).Year.ToString()) + 1).ToString() : (Convert.ToDateTime(ObjReq.SchoolChallanDate).Year.ToString()).ToString()); ObjReq.SchoolName = Convert.ToString(dtReqView.Rows[0]["SCHOOL_NAME"].ToString()); ObjReq.SchoolCode = Convert.ToString(dtReqView.Rows[0]["SCHOOL_CODE"].ToString()); ObjReq.SchoolAddress = Convert.ToString(dtReqView.Rows[0]["SCHOOL_ADDRESS"].ToString()); ObjReq.SchoolContactNo = Convert.ToString(dtReqView.Rows[0]["SCHOOL_PHONE_NO"].ToString()); ObjReq.SchoolEmailId = Convert.ToString(dtReqView.Rows[0]["SCHOOL_EMAIL_ID"].ToString()); ObjReq.Language = Convert.ToString(dtReqView.Rows[0]["LANGUAGE"].ToString()); ObjReq.Category = Convert.ToString(dtReqView.Rows[0]["BOOK_CATEGORY"].ToString()); ObjReq.CIRCLE_OFFICER_NAME = Convert.ToString(dtReqView.Rows[0]["CIRCLE_OFFICER_NAME"].ToString()); ObjReq.CIRCLE_NAME = Convert.ToString(dtReqView.Rows[0]["CIRCLE_NAME"].ToString()); ObjReq.CIRCLE_ADDRESS = Convert.ToString(dtReqView.Rows[0]["CIRCLE_ADDRESS"].ToString()); ObjReq.CIRCLE_PINCODE = Convert.ToString(dtReqView.Rows[0]["CIRCLE_PINCODE"].ToString()); ObjReq.DISTRICT = Convert.ToString(dtReqView.Rows[0]["DISTRICT"].ToString()); ObjReq.MOBILE_NO = Convert.ToString(dtReqView.Rows[0]["MOBILE_NO"].ToString()); ObjReq.ALTERNATE_MOBILE_NO = Convert.ToString(dtReqView.Rows[0]["ALTERNATE_MOBILE_NO"].ToString()); ObjReq.EMAIL_ID = Convert.ToString(dtReqView.Rows[0]["EMAIL_ID"].ToString()); ObjReq.BookRwCnt = dtReqView.Rows.Count; if (ObjReq.BookRwCnt > 12) { ObjReq.BookRwCnt = ((ObjReq.BookRwCnt) / 12); if (ObjReq.BookRwCnt > 0) { ObjReq.BookRwCnt++; } } else { ObjReq.BookRwCnt = 1; } List <SchoolChallanBookReqDtl> ObjlstChallan = new List <SchoolChallanBookReqDtl>(); for (int iCnt = 0; iCnt < dtReqView.Rows.Count; iCnt++) { SchoolChallanBookReqDtl objChDtl = new SchoolChallanBookReqDtl(); objChDtl.BookCode = dtReqView.Rows[iCnt]["BOOK_CODE"].ToString(); objChDtl.BookName = dtReqView.Rows[iCnt]["BOOK_NAME"].ToString(); objChDtl.Class = dtReqView.Rows[iCnt]["CLASS"].ToString(); objChDtl.QuantityForShipping = Convert.ToInt16(dtReqView.Rows[iCnt]["SHIPPING_QTY"].ToString()); ObjlstChallan.Add(objChDtl); } ObjReq.trxSchoolChallanBookReqDtl = ObjlstChallan; } } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(ObjReq); }