public JsonResult SelectPOById(int id) { if (Session["LOGGEDIN"] != null) { try { LP_GRN_Master_Property objPurchaseProperty = new LP_GRN_Master_Property(); objPurchaseProperty.ID = id; objGRNBLL = new LP_GRN_BLL(objPurchaseProperty); LP_Purchase_Master_Property objpurchase = new LP_Purchase_Master_Property(); objpurchase.idx = id; objPurchaseBLL = new LP_Purchase_BLL(objpurchase); var Data = JsonConvert.SerializeObject(objPurchaseBLL.SelectOne()); //var Data = JsonConvert.SerializeObject(objGRNBLL.SelectOne()); return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public JsonResult AddUpdate(PurchaseVM_Property objpurchase) { try { bool flag = false; int mrnIdx; int.TryParse(objpurchase.MRNIdx.ToString(), out mrnIdx); objPurchaseProperty = new LP_Purchase_Master_Property(); objPurchaseProperty.poNumber = objpurchase.poNumber; objPurchaseProperty.vendorIdx = objpurchase.vendorIdx; objPurchaseProperty.purchaseTypeIdx = objpurchase.purchaseTypeIdx; objPurchaseProperty.purchaseDate = objpurchase.purchaseDate; objPurchaseProperty.description = objpurchase.description; objPurchaseProperty.totalAmount = objpurchase.totalAmount; objPurchaseProperty.netAmount = objpurchase.netAmount; objPurchaseProperty.paidAmount = objpurchase.paidAmount; objPurchaseProperty.balanceAmount = objpurchase.balanceAmount; objPurchaseProperty.MRNIdx = mrnIdx; objPurchaseProperty.DepartmentID = objpurchase.DepartmentID; // objPurchaseProperty.paidDate = ;// objpurchase.paidDate; objPurchaseProperty.DetailData = Helper.ToDataTable <PurchaseDetails_Property>(objpurchase.PurchaseDetailLST); if (objpurchase.idx > 0) { objPurchaseProperty.idx = objpurchase.idx; objPurchaseProperty.creationDate = DateTime.Now; objPurchaseProperty.visible = 1; objPurchaseProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objPurchaseProperty.visible = 1; objPurchaseProperty.status = "0"; objPurchaseProperty.TableName = "purchaseDetails"; objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); flag = objpurchaseBll.Insert(); //update } else { //add objPurchaseProperty.creationDate = DateTime.Now; objPurchaseProperty.visible = 1; objPurchaseProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objPurchaseProperty.visible = 1; objPurchaseProperty.status = "0"; objPurchaseProperty.TableName = "purchaseDetails"; objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); flag = objpurchaseBll.Insert(); } return(GenerateReport(objPurchaseProperty.idx, 4, "PO_Report")); //return Json(new { data = "", success = flag,msg=flag==true?"Successfull":"Failed" ,statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetAllPurchase() { try { objPurchaseVM_Property = new PurchaseVM_Property(); objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); var Data = JsonConvert.SerializeObject(objpurchaseBll.SelectAll()); return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddNewGRN(int?id) { if (Session["LOGGEDIN"] != null) { objGRNVM_Property = new LP_GRN_ViewModel(); objpurchaseBll = new LP_Purchase_BLL(); objGRNBll = new LP_GRN_BLL(); objGRNVM_Property.POList = Helper.ConvertDataTable <LP_Purchase_Master_Property>(objpurchaseBll.SelectAll()); //objGRNVM_Property.Doc_No = "GRN-001"; if (id > 0) { //update LP_GRN_Detail_Property objdetail; objGRNProperty = new LP_GRN_Master_Property(); objGRNProperty.ID = Convert.ToInt16(id); objGRNBll = new LP_GRN_BLL(objGRNProperty); DataTable dt = objGRNBll.SelectOne(); objGRNVM_Property.ID = Convert.ToInt16(dt.Rows[0]["ID"].ToString()); //objGRNVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString()); objGRNVM_Property.Doc_No = dt.Rows[0]["Doc_No"].ToString(); objGRNVM_Property.Narration = dt.Rows[0]["Narration"].ToString(); objGRNVM_Property.Parent_DocID = Convert.ToInt16(dt.Rows[0]["Parent_DocID"].ToString()); objGRNVM_Property.Total_Amount = Convert.ToDecimal(dt.Rows[0]["Total_Amount"].ToString()); //objPurchaseVM_Property.purchaseDate = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //foreach(DataRow dr in dt.Rows) //{ // objmrndetail //} ViewBag.DetailData = Helper.ConvertDataTable <LP_GRN_ViewModel>(dt); //update return(View("_AddNewGRN", objGRNVM_Property)); } else { LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "GRN_Master"; objtrans.Identityfieldname = "ID"; objtrans.userid = Session["UID"].ToString(); objGRNVM_Property.Doc_No = objGRNBll.GenerateMRNNo(objtrans); return(View("_AddNewGRN", objGRNVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult AddNewGRN(int?id) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); string pagename = @"/" + controllerName + @"/" + actionName; var page = (List <LP_Pages_Property>)Session["PageList"]; if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true) { objGRNVM_Property = new LP_GRN_ViewModel(); objpurchaseBll = new LP_Purchase_BLL(); objGRNBll = new LP_GRN_BLL(); objGRNVM_Property.POList = Helper.ConvertDataTable <LP_Purchase_Master_Property>(objpurchaseBll.SelectAll()); //objGRNVM_Property.Doc_No = "GRN-001"; if (id > 0) { //update LP_GRN_Detail_Property objdetail; objGRNProperty = new LP_GRN_Master_Property(); objGRNProperty.ID = Convert.ToInt16(id); objGRNBll = new LP_GRN_BLL(objGRNProperty); DataTable dt = objGRNBll.SelectOne(); objGRNVM_Property.ID = Convert.ToInt16(dt.Rows[0]["ID"].ToString()); //objGRNVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString()); objGRNVM_Property.Doc_No = dt.Rows[0]["Doc_No"].ToString(); objGRNVM_Property.Narration = dt.Rows[0]["Narration"].ToString(); objGRNVM_Property.Parent_DocID = Convert.ToInt16(dt.Rows[0]["Parent_DocID"].ToString()); objGRNVM_Property.Total_Amount = Convert.ToDecimal(dt.Rows[0]["Total_Amount"].ToString()); //objPurchaseVM_Property.purchaseDate = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //foreach(DataRow dr in dt.Rows) //{ // objmrndetail //} ViewBag.DetailData = Helper.ConvertDataTable <LP_GRN_ViewModel>(dt); //update return(View("_AddNewGRN", objGRNVM_Property)); } else { LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "GRN_Master"; objtrans.Identityfieldname = "ID"; objtrans.userid = Session["UID"].ToString(); objGRNVM_Property.Doc_No = objGRNBll.GenerateMRNNo(objtrans); return(View("_AddNewGRN", objGRNVM_Property)); } } else { if (Session["LoggedIn"] == null) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("NotAuthorized", "Account")); } } }
public ActionResult AddNewPI(int?id) { if (Session["LOGGEDIN"] != null) { objPInvoiceVM = new LP_PI_ViewModel(); objPIBLL = new LP_PInvoice_BLL(); objPurchaseBLL = new LP_Purchase_BLL(); objPInvoiceVM.POLIST = Helper.ConvertDataTable <LP_Purchase_Master_Property>(objPurchaseBLL.SelectAll()); objPInvoiceVM.TaxesList = Helper.ConvertDataTable <Taxes_Property>(GetAllTaxes()); objPInvoiceVM.VendorList = Helper.ConvertDataTable <Vendors_Property>(GetAllVendors()); objPInvoiceVM.ProductList = Helper.ConvertDataTable <Product_Property>(ViewAllProducts()); objPInvoiceVM.BankList = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks()); //objGRNVM_Property.Doc_No = "GRN-001"; if (id > 0) { //update objPIProperty = new LP_P_Invoice_Property(); objPIProperty.idx = Convert.ToInt16(id); objPIBLL = new LP_PInvoice_BLL(objPIProperty); DataSet DS = objPIBLL.SelectByID(); objPInvoiceVM.InvoiceProperty = Helper.ConvertDataTable <LP_P_Invoice_Property>(DS.Tables[0]); objPInvoiceVM.InvoiceDetails = Helper.ConvertDataTable <LP_P_Invoice_Details>(DS.Tables[1]); objPInvoiceVM.PITAXLIST = Helper.ConvertDataTable <LP_PI_Taxes_Property>(DS.Tables[2]); // objPInvoiceVM.ParentDocID = objPInvoiceVM.InvoiceProperty[0].ParentDocID; objPInvoiceVM.InvoiceNo = objPInvoiceVM.InvoiceProperty[0].InvoiceNo; objPInvoiceVM.VendorID = objPInvoiceVM.InvoiceProperty[0].VendorID; objPInvoiceVM.CreatedDate = objPInvoiceVM.InvoiceProperty[0].CreatedDate; objPInvoiceVM.Reference = objPInvoiceVM.InvoiceProperty[0].Reference; objPInvoiceVM.Description = objPInvoiceVM.InvoiceProperty[0].Description; objPInvoiceVM.NetAmount = objPInvoiceVM.InvoiceProperty[0].NetAmount; objPInvoiceVM.TotalAmount = objPInvoiceVM.InvoiceProperty[0].TotalAmount; objPInvoiceVM.TaxAmount = objPInvoiceVM.InvoiceProperty[0].TaxAmount; objPInvoiceVM.BalanceAmount = objPInvoiceVM.InvoiceProperty[0].BalanceAmount; objPInvoiceVM.PaidAmount = objPInvoiceVM.InvoiceProperty[0].PaidAmount; objPInvoiceVM.PaymentType = objPInvoiceVM.InvoiceProperty[0].PaymentType; objPInvoiceVM.bankIdx = objPInvoiceVM.InvoiceProperty[0].BankId; objPInvoiceVM.accorChequeNumber = objPInvoiceVM.InvoiceProperty[0].AccountChequeNo; ViewBag.update = true; return(PartialView("_AddNewPI", objPInvoiceVM)); } else { objPInvoiceVM.InvoiceProperty = Helper.ConvertDataTable <LP_P_Invoice_Property>(new DataTable()); objPInvoiceVM.InvoiceDetails = Helper.ConvertDataTable <LP_P_Invoice_Details>(new DataTable()); objPInvoiceVM.PITAXLIST = Helper.ConvertDataTable <LP_PI_Taxes_Property>(new DataTable()); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "P_Invoice"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objPInvoiceVM.InvoiceNo = objPIBLL.GeneratePINo(objtrans); //objPInvoiceVM.CreatedDate =DateTime.Parse(DateTime.Now.ToString("MM/dd/yyyy")); return(PartialView("_AddNewPI", objPInvoiceVM)); } } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult AddNewPurchase(int?id) { if (Session["LOGGEDIN"] != null) { objPurchaseVM_Property = new PurchaseVM_Property(); Vendors_Property vendor = new Vendors_Property(); Product_Property product = new Product_Property(); Vendors_BLL objvendorbll = new Vendors_BLL(); Product_BLL objProductbll = new Product_BLL(); LP_MRN_BLL objMRNbll = new LP_MRN_BLL(); objPurchaseVM_Property.MRList = Helper.ConvertDataTable <LP_MRN_Master_Property>(objMRNbll.SelectMRN()); objPurchaseVM_Property.VendorLST = Helper.ConvertDataTable <Vendors_Property>(objvendorbll.ViewAll()); objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable <Departments_property>(GetAllDepartments()); objPurchaseVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objPurchaseVM_Property.purchaseDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //objPurchaseVM_Property.poNumber = "Po-001"; if (id > 0) { LP_Purchase_Detail_Property objmpurchasedetail; objPurchaseProperty = new LP_Purchase_Master_Property(); objPurchaseProperty.idx = Convert.ToInt16(id); objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); DataTable dt = objpurchaseBll.SelectOne(); objPurchaseVM_Property.idx = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString()); objPurchaseVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString()); objPurchaseVM_Property.poNumber = dt.Rows[0]["poNumber"].ToString(); objPurchaseVM_Property.description = dt.Rows[0]["description"].ToString(); objPurchaseVM_Property.MRNIdx = Convert.ToInt16(dt.Rows[0]["MRNIdx"].ToString()); objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString()); objPurchaseVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //foreach(DataRow dr in dt.Rows) //{ // objmrndetail //} ViewBag.DetailData = Helper.ConvertDataTable <PurchaseVM_Property>(dt); //update return(View("AddNewPurchase", objPurchaseVM_Property)); } else { //objPurchaseProperty = new LP_Purchase_Master_Property(); objPurchaseVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objpurchaseBll = new LP_Purchase_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "purchase"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO(objtrans); //objPurchaseProperty.poNumber = ""; //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001"; // string po = objpurchaseBll.GeneratePO(); return(View("AddNewPurchase", objPurchaseVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }