public JsonResult ThemPhieuXuat(Order order, List <OrderDetail> orderdetails) { var tblorder = new tbl_PurchaseOrder { SysHotelID = CommService.GetHotelId(), CreatorID = CommService.GetUserId(), DateCreated = DateTime.Now, Status = 1, SupplierID = 0, OrderCode = order.SoPhieu, SupplierCode = order.SoChungTu, InputDate = Share.Todate(order.NgayNhapHD), DatePayment = Share.Todate(order.NgayChungTu), TypeOrder = 2 }; List <tbl_PurchaseOrderDetail> listDetail = new List <tbl_PurchaseOrderDetail>(); foreach (var item in orderdetails) { listDetail.Add(new tbl_PurchaseOrderDetail { SysHotelID = CommService.GetHotelId(), item = item.ProductName, catalogitemid = item.CateId, catalogitem = item.CateName, DateCreated = DateTime.Now, CreatorID = CommService.GetUserId(), quantity = item.Quantity, itemid = item.ProductId, StoreID = order.StoreId, Price = item.Price, ManufactureDate = Share.Todate(item.NgaySanXuat), ExpirationDate = Share.Todate(item.HanSuDung), }); } var msg = ""; var rs = service.Xuatkho(tblorder, listDetail, ref msg); if (string.IsNullOrEmpty(msg)) { msg = "Tạo phiếu lỗi"; } return(Json(new { ResponseCode = (rs ? "01" : "00"), Message = (rs ? "Tạo phiếu thành công" : msg) }, JsonRequestBehavior.AllowGet)); return(null); }
public JsonResult ThemPhieuBuDinhMuc(int storeid, List <BukhoModel> products) { { var tblorder = new tbl_TransferOrder { SysHotelID = CommService.GetHotelId(), CreatorID = CommService.GetUserId(), DateCreated = DateTime.Now, Status = 1, SupplierID = 0, OrderCode = service.GetTransferCode(), // SupplierCode = order.SoChungTu, InputDate = DateTime.Today, }; List <tbl_TransferOrderDetail> listDetail = new List <tbl_TransferOrderDetail>(); var product = service.GetallProducts(); var cate = service.GetAllCategories(); foreach (var item in products) { var p1 = product.FirstOrDefault(p => p.Id == item.ProductId); var c = cate.FirstOrDefault(p => p.Id == p1?.ProductCateID); listDetail.Add(new tbl_TransferOrderDetail { SysHotelID = CommService.GetHotelId(), item = p1 != null ? p1.Name : "", catalogitemid = p1?.ProductCateID, catalogitem = c != null ? c.Name : "", DateCreated = DateTime.Now, CreatorID = CommService.GetUserId(), quantity = item.Quantity, itemid = item.ProductId, StoreID = item.StoreId, FromStoreId = storeid, Price = Convert.ToInt32(p1?.PriceOrder), }); } var msg = ""; var rs = service.StoreTransfer(tblorder, listDetail); if (string.IsNullOrEmpty(msg)) { msg = "Tạo phiếu lỗi"; } return(Json(new { ResponseCode = (rs ? "01" : "00"), Message = (rs ? "Tạo phiếu thành công" : msg) }, JsonRequestBehavior.AllowGet)); } }
public JsonResult Add(Order order, List <OrderDetail> orderdetails) { var tblorder = new tbl_TransferOrder { SysHotelID = CommService.GetHotelId(), CreatorID = CommService.GetUserId(), DateCreated = DateTime.Now, Status = 1, SupplierID = 0, OrderCode = order.SoPhieu, // SupplierCode = order.SoChungTu, InputDate = Share.Todate(order.NgayNhapHD), // DatePayment = DateTime.ParseExact(order.NgayChungTu, "dd/MM/yyyy", CultureInfo.InvariantCulture) }; List <tbl_TransferOrderDetail> listDetail = new List <tbl_TransferOrderDetail>(); foreach (var item in orderdetails) { listDetail.Add(new tbl_TransferOrderDetail { SysHotelID = CommService.GetHotelId(), item = item.ProductName, catalogitemid = item.CateId, catalogitem = item.CateName, DateCreated = DateTime.Now, CreatorID = CommService.GetUserId(), quantity = item.Quantity, itemid = item.ProductId, StoreID = order.StoreId, FromStoreId = order.SrcStoreId, Price = item.Price, }); } var msg = ""; var rs = service.StoreTransfer(tblorder, listDetail, ref msg); if (string.IsNullOrEmpty(msg)) { msg = "Tạo phiếu lỗi"; } return(Json(new { ResponseCode = (rs ? "01" : "00"), Message = (rs ? "Tạo phiếu thành công" : msg) }, JsonRequestBehavior.AllowGet)); }