public JsonResult GetAllConsigment() { try { objPurchaseVM_Property = new LP_PerformaInvoice_ViewModel(); objpurchaseBll = new LP_PI_BLL(); var Data = JsonConvert.SerializeObject(objpurchaseBll.SelectAllCIPO()); 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 AddNewConsigment(int?id) { if (Session["LOGGEDIN"] != null) { objConsigmentVm = new LP_Consigment_ViewModel(); Vendors_Property vendor = new Vendors_Property(); Product_Property product = new Product_Property(); Vendors_BLL objvendorbll = new Vendors_BLL(); Product_BLL objProductbll = new Product_BLL(); objpurchaseBll = new LP_PI_BLL(); // objPurchaseVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll()); // objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable<Departments_property>(GetAllDepartments()); // objPurchaseVM_Property.PurchaseType_List = Helper.ConvertDataTable<LP_Purchase_Type>(GetAllPurchaseType()); objConsigmentVm.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objConsigmentVm.CIPO = Helper.ConvertDataTable <LP_CI_PurchaseOrder_Property>(objpurchaseBll.SelectAllCIPO()); objConsigmentVm.Invoicedate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //objPurchaseVM_Property.poNumber = "Po-001"; if (id > 0) { //LP_Purchase_Detail_Property objmpurchasedetail; //objPurchaseProperty = new LP_Performa_Invoice_Property(); //objPurchaseProperty.idx = Convert.ToInt16(id); //objpurchaseBll = new LP_PI_BLL(); //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.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("AddNewConsigment", objConsigmentVm)); } else { //objPurchaseProperty = new LP_Purchase_Master_Property(); objConsigmentVm.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objpurchaseBll = new LP_PI_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "consigment"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objConsigmentVm.InvoiceNo = objpurchaseBll.GenerateCINo(objtrans); //objCIPOVm.CDPercntage = 20; //objCIPOVm.RDPercentage = 20; //objCIPOVm.ACDPercentage = 20; //objCIPOVm.STPercentage = 20; //objCIPOVm.ITPercentage = 20; //objCIPOVm.TDTax = 0.00m; //objCIPOVm.CleaningPrice = 0.00m; //objCIPOVm.TotalPrice = 0.00m; //objCIPOVm.ASTPercentage = 20; //objCIPOVm.CleaningPrice = 20; //objPurchaseProperty.poNumber = ""; //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001"; // string po = objpurchaseBll.GeneratePO(); return(View("AddNewConsigment", objConsigmentVm)); } } else { return(RedirectToAction("Login", "Account")); } }