public JsonResult GetAllWarehouse() { if (Session["LOGGEDIN"] != null) { try { objwarehousebll = new WareHouse_BLL(); var Data = JsonConvert.SerializeObject(objwarehousebll.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)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
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")); } }
public ActionResult ReturnSales(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.idx = Convert.ToInt32(id); 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()); //objPInvoiceVM = new LP_PI_ViewModel(); //objPIProperty = new LP_P_Invoice_Property(); //objPIProperty.idx = Convert.ToInt32(id); //objPIBLL = new LP_PInvoice_BLL(objPIProperty); //objPInvoiceVM.TaxesList = Helper.ConvertDataTable<Taxes_Property>(GetAllTaxes()); //objPInvoiceVM.ProductList = Helper.ConvertDataTable<Product_Property>(ViewAllProducts()); //objPInvoiceVM.BankList = Helper.ConvertDataTable<Company_Bank_Property>(GetAllCompanyBanks()); DataSet DS = objSalesOrderBll.SelectSIWithDetailData(objSalesOrderVM_Property.idx); //DataSet DS = objPIBLL.SelectPIWithDetailData(objPIProperty.idx); if (DS.Tables.Count > 0) { ViewBag.isReturn = 1; objSalesOrderVM_Property.SalesOrderDetailLST = Helper.ConvertDataTable <SalesOrdersDetails_Property>(DS.Tables[0]); if (DS.Tables[1].Rows.Count > 0) { objSalesOrderVM_Property.salesTaxesLST = Helper.ConvertDataTable <LP_salesTaxes_Property>(DS.Tables[1]); } } return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } else { return(RedirectToAction("Login", "Account")); } }