public JsonResult SelectSOById(int id) { if (Session["LOGGEDIN"] != null) { try { objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderProperty.idx = id; objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); var Data = JsonConvert.SerializeObject(objSalesOrderBll.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)); } }
// GET: Finance public ActionResult GeneralVoucher(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) { objGV = new LP_GeneralVoucher_Property(); objGVBLL = new LP_GeneralVoucher_BLL(); fourthTier_Property objPropertyChildHead = new fourthTier_Property(); fourthTier_BLL objLastBLL = new fourthTier_BLL(objPropertyChildHead); objGV.AccountLST = Helper.ConvertDataTable <fourthTier_Property>(objLastBLL.ViewAll()); objSalesOrderVM_Property = new SalesOrderVM_Property(); if (id > 0) { LP_SalesOrder_Detail_Property objmSalesOrderdetail; objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderProperty.idx = Convert.ToInt16(id); objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); DataTable dt = objSalesOrderBll.SelectOne(); objSalesOrderVM_Property.idx = Convert.ToInt16(dt.Rows[0]["salesorderIdx"].ToString()); objSalesOrderVM_Property.customerIdx = Convert.ToInt32(dt.Rows[0]["customerIdx"].ToString()); objSalesOrderVM_Property.soNumber = dt.Rows[0]["soNumber"].ToString(); objSalesOrderVM_Property.description = dt.Rows[0]["description"].ToString(); objSalesOrderVM_Property.qsIdx = Convert.ToInt16(dt.Rows[0]["qsIdx"].ToString()); objSalesOrderVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["salesorderdate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objSalesOrderVM_Property.salesorderDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); ViewBag.DetailData = Helper.ConvertDataTable <SalesOrderVM_Property>(dt); //update return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } else { LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "accountMasterGL"; objtrans.Identityfieldname = "idxx"; objtrans.userid = Session["UID"].ToString(); objGV.voucherNo = objGVBLL.GenerateSO(objtrans); objGV.voucherDate = DateTime.Now.ToString("yyyy-MM-dd"); objSalesOrderVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); return(View("GeneralVoucher", objGV)); } } else { if (Session["LoggedIn"] == null) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("NotAuthorized", "Account")); } } }
public ActionResult AddNewSalesOrder(int?id) { if (Session["LOGGEDIN"] != null) { objSalesOrderVM_Property = new SalesOrderVM_Property(); Customers_Property vendor = new Customers_Property(); Product_Property product = new Product_Property(); Customers_BLL objcustomerbll = new Customers_BLL(); Product_BLL objProductbll = new Product_BLL(); LP_Quotation_BLL objQuotationbll = new LP_Quotation_BLL(); WareHouse_BLL objWareHouseBLL = new WareHouse_BLL(); objSalesOrderVM_Property.QSList = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS()); objSalesOrderVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers()); objSalesOrderVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objSalesOrderVM_Property.BankList = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks()); objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll()); objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); Taxes_Property obj = new Taxes_Property(); Taxes_BLL objtaxBLL = new Taxes_BLL(obj); ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox()); //objSalesOrderVM_Property.poNumber = "Po-001"; if (id > 0) { LP_SalesOrder_Detail_Property objmSalesOrderdetail; objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderProperty.idx = Convert.ToInt16(id); objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); DataTable dt = objSalesOrderBll.SelectOne(); objSalesOrderVM_Property.idx = Convert.ToInt16(dt.Rows[0]["salesorderIdx"].ToString()); objSalesOrderVM_Property.customerIdx = Convert.ToInt32(dt.Rows[0]["customerIdx"].ToString()); objSalesOrderVM_Property.soNumber = dt.Rows[0]["soNumber"].ToString(); objSalesOrderVM_Property.description = dt.Rows[0]["description"].ToString(); objSalesOrderVM_Property.qsIdx = Convert.ToInt16(dt.Rows[0]["qsIdx"].ToString()); objSalesOrderVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["salesorderdate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objSalesOrderVM_Property.salesorderDate = 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 <SalesOrderVM_Property>(dt); //update return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } else { //objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objSalesOrderBll = new LP_SalesOrder_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "SalesOrder"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objSalesOrderVM_Property.soNumber = objSalesOrderBll.GenerateSO(objtrans); //objSalesOrderProperty.poNumber = ""; //objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); //objSalesOrderVM_Property.poNumber = objSalesOrderBll.GeneratePO();// "PO-001"; // string po = objSalesOrderBll.GeneratePO(); return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }