public ViewStockReceivingDetailsUI(string pInventoryHeaderId)
 {
     InitializeComponent();
     loInventoryHeader  = new InventoryHeader();
     loInventoryDetail  = new InventoryDetail();
     lInventoryHeaderId = pInventoryHeaderId;
 }
Example #2
0
 public StockInventoryUI()
 {
     InitializeComponent();
     loStockInventoryRpt = new StockInventoryRpt();
     loInventoryDetail   = new InventoryDetail();
     loLocation          = new Location();
 }
Example #3
0
        public void PostFromSales(Payment payment)
        {
            DataAccess.Inventory orderInventory = new DataAccess.Inventory();
            orderInventory.LocationId    = 1;
            orderInventory.Direction     = "O";
            orderInventory.RefNo         = payment.PaymentNo;
            orderInventory.InventoryDate = DateTime.Today;
            orderInventory.InventoryType = "F";
            orderInventory.MutationType  = "SALES";
            orderInventory.PostedWhen    = DateTime.Now;
            orderInventory.PostedBy      = CurrentUserName;
            Order order = payment.Order;

            foreach (OrderDetail detail in order.OrderDetails)
            {
                InventoryDetail orderInventoryDetail = new InventoryDetail();
                orderInventoryDetail.ProductId = detail.ProductId;
                orderInventoryDetail.Qty       = detail.Qty;
                orderInventoryDetail.UomId     = 1;
                orderInventoryDetail.NotesDtl  = $"Payment {payment.PaymentNo}, Posting for Order {order.OrderNo}, OrderDetailId={detail.Uid}";

                orderInventory.InventoryDetails.Add(orderInventoryDetail);
            }
            AssignInventoryOutNumbering(orderInventory);
            SetAuditFields(orderInventory, "SYSTEM");
            DataContext.Inventories.Add(orderInventory);
            //DataContext.SaveChanges();
        }
        public async Task <int> Handle(CreateInventoryCommand request, CancellationToken cancellationToken)
        {
            var entity = new Inventory()
            {
                InventoryDate = request.InventoryDate,
                IsDraft       = request.IsDraft,
                PlaceId       = request.PlaceId
            };

            foreach (var inventoryDetail in request.InventoryDetails)
            {
                var inventoryDetailEntity = new InventoryDetail()
                {
                    CurrentPrice = inventoryDetail.CurrentPrice,
                    ManualCount  = inventoryDetail.ManualCount,
                    ProductId    = inventoryDetail.ProductId,
                    TotalSale    = inventoryDetail.TotalSale
                };

                entity.InventoryDetails.Add(inventoryDetailEntity);
            }

            _context.Inventories.Add(entity);

            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }
Example #5
0
        public void UnPostFromSales(Payment payment)
        {
            DataAccess.Inventory unpostSalesInventory = new DataAccess.Inventory();
            unpostSalesInventory.LocationId    = 1;
            unpostSalesInventory.Direction     = "I";
            unpostSalesInventory.RefNo         = payment.Order.OrderNo;
            unpostSalesInventory.InventoryDate = DateTime.Today;
            unpostSalesInventory.InventoryType = "F";
            unpostSalesInventory.MutationType  = "ADJUSTMENT";
            unpostSalesInventory.PostedWhen    = DateTime.Now;
            unpostSalesInventory.PostedBy      = CurrentUserName;
            Order order = payment.Order;

            foreach (OrderDetail detail in order.OrderDetails)
            {
                InventoryDetail unpostSalesInventoryDetail = new InventoryDetail();
                unpostSalesInventoryDetail.ProductId = detail.ProductId;
                unpostSalesInventoryDetail.Qty       = detail.Qty;
                unpostSalesInventoryDetail.UomId     = 1;
                unpostSalesInventoryDetail.NotesDtl  = $"Payment {payment.PaymentNo}, Void Payment for Order {order.OrderNo}, OrderDetailId={detail.Uid}";

                unpostSalesInventory.InventoryDetails.Add(unpostSalesInventoryDetail);
            }
            inventoryInProvider.AssignInventoryInNumbering(unpostSalesInventory);
            SetAuditFields(unpostSalesInventory, "SYSTEM");
            DataContext.Inventories.Add(unpostSalesInventory);
            //DataContext.SaveChanges();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            InventoryDetail inventoryDetail = db.InventoryDetails.Find(id);

            db.InventoryDetails.Remove(inventoryDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public CustomerTransactionsUI()
        {
            InitializeComponent();
            loCustomer        = new Customer();
            loInventoryDetail = new InventoryDetail();

            ldtCustomer = new DataTable();
            ldtReports  = new DataTable();
            loCustomerTransactionsRpt = new CustomerTransactionsRpt();
            loReportViewer            = new ReportViewerUI();
        }
Example #8
0
 public StockTransferOutUI()
 {
     InitializeComponent();
     loInventory                 = new Inventory();
     loInventoryDetail           = new InventoryDetail();
     loCommon                    = new Common();
     ldtInventory                = new System.Data.DataTable();
     loStockTransferOutRpt       = new StockTransferOutRpt();
     loStockTransferOutDetailRpt = new StockTransferOutDetailRpt();
     loReportViewer              = new ReportViewerUI();
 }
Example #9
0
 public StockWithdrawalUI()
 {
     InitializeComponent();
     loInventory                = new Inventory();
     loInventoryDetail          = new InventoryDetail();
     loCommon                   = new Common();
     ldtInventory               = new System.Data.DataTable();
     loStockWithdrawalRpt       = new StockWithdrawalRpt();
     loStockWithdrawalDetailRpt = new StockWithdrawalDetailRpt();
     loReportViewer             = new ReportViewerUI();
 }
        public ActionResult Create([Bind(Include = "sku, lot, batch, expdate, qty, inputdate, companyid, locationid, capacity")] Inventory inventory)
        {
            try
            {
                ViewBag.CompanyIDs     = unitOfWork.CompanyRepository.Get().Where(c => c.billto == true && c.deleted != true).OrderBy(c => c.name);
                ViewBag.SKUs           = unitOfWork.ItemRepository.Get().Where(i => i.deleted != true).OrderBy(i => i.sku);
                ViewData["locationid"] = EZDropDown.Locations(unitOfWork);
                ViewData["boxqty"]     = EZDropDown.Qunatity(100, null);
                ViewData["itembox"]    = EZDropDown.Qunatity(100, null);
                ViewBag.Barcode        = Request["barcode"].ToString();
                if (Request["hdnInventory"] == null)
                {
                    ModelState.AddModelError("InventoryDetails", "Please provide Carton Q'ty, Items/Carton, Total Item Q'ty, Location and Use");
                }

                if (ModelState.IsValid)
                {
                    //TODO: Iterate the hdnInventory Values
                    //TODO: Update the capacity within a loop
                    string   tmp   = Request["hdnInventory"].ToString();
                    string[] aInvs = tmp.Split(',');
                    foreach (string inv in aInvs)
                    {
                        string[] aInv = inv.Split(':');
                        //locationid:boxqty:itembox:qty:newCapacity
                        InventoryDetail id = new InventoryDetail();
                        id.locationid = aInv[0];
                        id.lot        = aInv[1];
                        id.boxqty     = int.Parse(aInv[2]);
                        id.itemperbox = int.Parse(aInv[3]);
                        id.itemqty    = int.Parse(aInv[4]);
                        id.capacity   = int.Parse(aInv[5]);
                        inventory.InventoryDetails.Add(id);


                        //////Location l = unitOfWork.LocationRepository.GetByID(aInv[0]);
                        //////l.capacity = int.Parse(aInv[4]);
                        //////unitOfWork.LocationRepository.Update(l);
                        //////unitOfWork.Save();
                    }

                    db.Inventories.Add(inventory);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.)
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
            }
            //ViewData["sku"] = EZDropDown.Products(unitOfWork);
            return(View(inventory));
        }
Example #11
0
 public StockCardUI()
 {
     InitializeComponent();
     loStock           = new Stock();
     loInventoryDetail = new InventoryDetail();
     loLocation        = new Location();
     ldtStock          = new DataTable();
     ldtList           = new DataTable();
     loStockCardRpt    = new StockCardRpt();
     loReportViewer    = new ReportViewerUI();
 }
Example #12
0
 public ReturnedItemDetailUI()
 {
     InitializeComponent();
     loStock           = new Stock();
     loReturnedItem    = new ReturnedItem();
     loInventory       = new Inventory();
     loInventoryDetail = new InventoryDetail();
     loSecurity        = new SecurityUI();
     lStockId          = "";
     lFromSave         = false;
 }
        public JsonResult SaveDetail(InfoInventoryViewModel model)
        {
            Response response;

            try
            {
                using (var db = new KiaGalleryContext())
                {
                    var date   = DateUtility.GetDateTime(model.date);
                    var userId = GetAuthenticatedUserId();
                    model.dailyInventoryDetailViewModelList.ForEach(x =>
                    {
                        if (db.InventoryDetail.Where(y => y.CategoryInventoryReportMemberId == x.categoryInventoryReportMemberId && y.Date == date).Count() > 0)
                        {
                            var entity          = db.InventoryDetail.Where(y => y.CategoryInventoryReportMemberId == x.categoryInventoryReportMemberId && y.Date == date).Single();
                            entity.Count        = x.count;
                            entity.Weight       = x.weight;
                            entity.Title        = x.title;
                            entity.ModifyUserId = userId;
                            entity.ModifyDate   = DateTime.Now;
                        }
                        else
                        {
                            var item = new InventoryDetail()
                            {
                                Count = x.count,
                                CategoryInventoryReportMemberId = x.categoryInventoryReportMemberId,
                                Weight       = x.weight,
                                Title        = x.title,
                                Date         = date,
                                CreateUserId = userId,
                                ModifyUserId = userId,
                                CreateDate   = DateTime.Now,
                                ModifyDate   = DateTime.Now,
                                Ip           = Request.UserHostAddress,
                            };
                            db.InventoryDetail.Add(item);
                        }
                    });
                    db.SaveChanges();
                }
                response = new Response()
                {
                    status  = 200,
                    message = "عنوان جدید ثبت شد",
                };
            }
            catch (Exception ex)
            {
                response = Core.GetExceptionResponse(ex);
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Example #14
0
 public StockWithdrawalDetailUI()
 {
     InitializeComponent();
     loInventoryHeader         = new InventoryHeader();
     loInventoryDetail         = new InventoryDetail();
     loCustomer                = new Customer();
     loStock                   = new Stock();
     lOperation                = GlobalVariables.Operation.Add;
     loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer            = new ReportViewerUI();
     lInventoryId              = "";
 }
 public StockTransferInDetailUI(string pInventoryId)
 {
     InitializeComponent();
     loInventory       = new Inventory();
     loInventoryDetail = new InventoryDetail();
     loLocation        = new Location();
     loCommon          = new Common();
     lOperation        = GlobalVariables.Operation.Edit;
     //loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer = new ReportViewerUI();
     lInventoryId   = pInventoryId;
 }
 public StockReceivingDetailUI(string pInventoryId)
 {
     InitializeComponent();
     lOperation                = GlobalVariables.Operation.Edit;
     loInventoryHeader         = new InventoryHeader();
     loInventoryDetail         = new InventoryDetail();
     loSupplier                = new Supplier();
     loStock                   = new Stock();
     loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer            = new ReportViewerUI();
     lInventoryId              = pInventoryId;
 }
 public ActionResult Edit([Bind(Include = "LineId,InventoryId,ProductId,Description,Stock,Count1,Count2,Count3,Adjustment,KardexId")] InventoryDetail inventoryDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventoryDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.InventoryId = new SelectList(db.Inventories, "InventoryId", "InventoryId", inventoryDetail.InventoryId);
     ViewBag.ProductId   = new SelectList(db.Products, "ProductId", "Description", inventoryDetail.ProductId);
     return(View(inventoryDetail));
 }
 public StockAdjustmentUI()
 {
     InitializeComponent();
     loInventory                = new Inventory();
     loInventoryDetail          = new InventoryDetail();
     loInventoryType            = new InventoryType();
     loCommon                   = new Common();
     ldtInventory               = new System.Data.DataTable();
     loStockAdjustmentRpt       = new StockAdjustmentRpt();
     loStockAdjustmentDetailRpt = new StockAdjustmentDetailRpt();
     loReportViewer             = new ReportViewerUI();
 }
Example #19
0
 public StockReceivingUI()
 {
     InitializeComponent();
     loInventory           = new Inventory();
     loInventoryDetail     = new InventoryDetail();
     loPurchaseOrder       = new PurchaseOrder();
     loPurchaseOrderDetail = new PurchaseOrderDetail();
     loCommon                  = new Common();
     ldtInventory              = new System.Data.DataTable();
     loStockReceivingRpt       = new StockReceivingRpt();
     loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer            = new ReportViewerUI();
 }
Example #20
0
 public StockInventoryUI()
 {
     InitializeComponent();
     loStockInventoryRpt                  = new StockInventoryRpt();
     loStockInventoryByGroupRpt           = new StockInventoryByGroupRpt();
     loStockInventoryByLocationRpt        = new StockInventoryByLocationRpt();
     loStockInventoryByLocationByGroupRpt = new StockInventoryByLocationByGroupRpt();
     loInventoryDetail   = new InventoryDetail();
     loLocation          = new Location();
     loReportViewer      = new ReportViewerUI();
     ldtAllStocks        = new DataTable();
     ldtStocksByLocation = new DataTable();
 }
 public StockWithdrawalDetailUI(string pInventoryId)
 {
     InitializeComponent();
     lOperation                = GlobalVariables.Operation.Edit;
     loInventoryHeader         = new InventoryHeader();
     loInventoryDetail         = new InventoryDetail();
     loCustomer                = new Customer();
     loSalesIncharge           = new SalesIncharge();
     loStock                   = new Stock();
     loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer            = new ReportViewerUI();
     lInventoryId              = pInventoryId;
 }
 public StockReceivingDetailUI(string pInventoryId)
 {
     InitializeComponent();
     lOperation        = GlobalVariables.Operation.Edit;
     loInventory       = new Inventory();
     loInventoryDetail = new InventoryDetail();
     loSupplier        = new Supplier();
     loStock           = new Stock();
     loCommon          = new Common();
     //loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer   = new ReportViewerUI();
     lInventoryId     = pInventoryId;
     lPurchaseOrderId = "";
 }
        // GET: InventoryDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InventoryDetail inventoryDetail = db.InventoryDetails.Find(id);

            if (inventoryDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(inventoryDetail));
        }
Example #24
0
 public StockAdjustmentDetailUI(string pInventoryId)
 {
     InitializeComponent();
     lOperation        = GlobalVariables.Operation.Edit;
     loInventory       = new Inventory();
     loInventoryDetail = new InventoryDetail();
     loInventoryType   = new InventoryType();
     loSupplier        = new Supplier();
     loCustomer        = new Customer();
     loStock           = new Stock();
     loCommon          = new Common();
     //loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer = new ReportViewerUI();
     lInventoryId   = pInventoryId;
 }
 public StockTransferOutDetailUI()
 {
     InitializeComponent();
     loInventory       = new Inventory();
     loInventoryDetail = new InventoryDetail();
     loLocation        = new Location();
     loCommon          = new Common();
     //loInventoryType = new InventoryType();
     //loSupplier = new Supplier();
     //loCustomer = new Customer();
     //loStock = new Stock();
     lOperation = GlobalVariables.Operation.Add;
     //loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer = new ReportViewerUI();
     lInventoryId   = "";
 }
Example #26
0
 public StockWithdrawalDetailUI(string pInventoryId)
 {
     InitializeComponent();
     lOperation         = GlobalVariables.Operation.Edit;
     loInventory        = new Inventory();
     loInventoryDetail  = new InventoryDetail();
     loCustomer         = new Customer();
     loStock            = new Stock();
     loSalesOrder       = new SalesOrder();
     loSalesOrderDetail = new SalesOrderDetail();
     loCommon           = new Common();
     //loStockReceivingDetailRpt = new StockReceivingDetailRpt();
     loReportViewer = new ReportViewerUI();
     lInventoryId   = pInventoryId;
     lSalesOrderId  = "";
 }
Example #27
0
        public RenderUI()
        {
            InitializeComponent();
            loPOSTransaction       = new POSTransaction();
            loPOSTransactionDetail = new POSTransactionDetail();
            loCustomer             = new Customer();
            loInventory            = new Inventory();
            loInventoryDetail      = new InventoryDetail();
            loSystemConfiguration  = new SystemConfiguration();
            lFromClose             = false;

            //loORPrePrintedRpt = new ORPrePrintedRpt();
            //loORReceiptPrinter80mmRpt = new ORReceiptPrinter80mmRpt();
            loOrderSlipRpt = new OrderSlipRpt();
            loReportViewer = new ReportViewerUI();
        }
        // GET: InventoryDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InventoryDetail inventoryDetail = db.InventoryDetails.Find(id);

            if (inventoryDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.InventoryId = new SelectList(db.Inventories, "InventoryId", "InventoryId", inventoryDetail.InventoryId);
            ViewBag.ProductId   = new SelectList(db.Products, "ProductId", "Description", inventoryDetail.ProductId);
            return(View(inventoryDetail));
        }
Example #29
0
        public void PostOutInventory(long[] arrayInventoryId)
        {
            IEnumerable <DataAccess.Inventory> inventories = DataContext.Inventories.Where(inv => inv.Direction == "O" && arrayInventoryId.Contains(inv.Id));

            foreach (DataAccess.Inventory inventory in inventories)
            {
                inventory.PostedWhen = DateTime.Now;
                inventory.PostedBy   = CurrentUserName;

                if (inventory.InventoryType == "S")
                {
                    if (inventory.MutationType == "PROCESS")
                    {
                        IList <InventoryDetail> details = inventory.InventoryDetails.ToList();

                        DataAccess.Inventory yieldInventory = new DataAccess.Inventory();
                        yieldInventory.LocationId    = 1;
                        yieldInventory.Direction     = "I";
                        yieldInventory.RefNo         = inventory.InventoryNo;
                        yieldInventory.InventoryDate = DateTime.Today;
                        yieldInventory.InventoryType = "F";
                        yieldInventory.MutationType  = "PROCESS";
                        yieldInventory.PostedWhen    = DateTime.Now;
                        yieldInventory.PostedBy      = CurrentUserName;
                        foreach (InventoryDetail detail in details)
                        {
                            Product yieldProduct = DataContext.Products.SingleOrDefault(p => p.Id == detail.ProductId);
                            if (yieldProduct != null)
                            {
                                InventoryDetail yieldInventoryDetail = new InventoryDetail();
                                yieldInventoryDetail.ProductId = yieldProduct.YieldProductId.GetValueOrDefault(999);
                                yieldInventoryDetail.Qty       = detail.Qty;
                                yieldInventoryDetail.UomId     = 1;
                                yieldInventoryDetail.NotesDtl  = $"Yield From {inventory.InventoryNo}, InventoryDetailId={detail.Id}";

                                yieldInventory.InventoryDetails.Add(yieldInventoryDetail);
                            }
                        }
                        inventoryInProvider.AssignInventoryInNumbering(yieldInventory);

                        SetAuditFields(yieldInventory, "SYSTEM");
                        DataContext.Inventories.Add(yieldInventory);
                    }
                }
            }
            DataContext.SaveChanges();
        }
Example #30
0
        private InventoryControlModel SetValues()
        {
            if (gvInventoryDetail.Rows.Count <= 0)
            {
                Messages1.SetMessage("You must add atleast one inventory details to save the approval!", Messages.MessageType.Error);
                return(null);
            }

            InventoryControlModel icm = new InventoryControlModel();

            InventoryDetail invdetail;
            string          status = "";

            foreach (GridViewRow gr in gvInventoryDetail.Rows)
            {
                status    = ((RadioButtonList)gr.FindControl("chkApproval")).SelectedValue;
                invdetail = new InventoryDetail();
                if (status == "Approve")
                {
                    invdetail.Status = (int)InventoryDetailStatus.Approved;
                }
                else if (status == "Reject")
                {
                    invdetail.Status = (int)InventoryDetailStatus.Rejected;
                }
                else
                {
                    continue;
                }
                invdetail.ID                    = new Guid(((Label)gr.FindControl("lblID")).Text);
                invdetail.InventoryID           = new Guid(((Label)gr.FindControl("lblInventoryID")).Text);
                invdetail.StackID               = new Guid(((Label)gr.FindControl("lblStackID")).Text);
                invdetail.LastModifiedBy        = UserBLL.CurrentUser.UserId;
                invdetail.LastModifiedTimestamp = DateTime.Now;
                invdetail.ApprovalDate          = DateTime.Now;
                invdetail.ApprovedByID          = UserBLL.CurrentUser.UserId;
                icm.addInventoryDetail(invdetail);
            }
            if (icm.inventoryDetailList != null && icm.inventoryDetailList.Count > 0)
            {
                icm.ID = icm.inventoryDetailList[0].InventoryID;
            }
            return(icm);
        }