public Inventory InventoryIncrement(Inventory cus) { var inventory = new Inventory(); var existing = service.GetAll(a => a.ProductId == cus.ProductId && a.WarehouseId == cus.WarehouseId).FirstOrDefault(); if (existing != null) { existing.BalanceQty += cus.BalanceQty; existing.ReceiveQty = cus.ReceiveQty; inventory = service.Update(existing, existing.Id); } else { inventory = service.Save(cus); } return(inventory); }
public PartyBalance Update(PartyBalance t, int id) { var res = service.Update(t, id); if (t != null) { service.ExecuteNonQuery("Exec BalanceReconcilation " + t.LedgerId + "," + yearId + ""); } return(res); }
public StockOut Save(StockOut stockOut) { var existingItem = inventory.GetAll(a => a.ProductId == stockOut.ProductId && a.QtyInBale == stockOut.BaleWeight && a.IsActive == true && a.WarehouseId == stockOut.WarehouseId && a.SupplierId == stockOut.SupplierId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = CurrentSession.GetCurrentSession().UserName; inv.ProductionQty = stockOut.BaleQty; inv.BalanceQty = inv.BalanceQty - stockOut.BaleQty ?? 0; inventory.Update(inv, inv.Id); } } return(service.Save(stockOut)); }
public StockIn Save(StockIn stockIn, string Notes) { var goodsType = 1; var product = productService.GetById(stockIn.ProductId); if (product != null) { goodsType = product.ProductTypeId ?? 1; } var existingItem = inventory.GetAll(a => a.ProductId == stockIn.ProductId && a.IsActive == true && a.WarehouseId == stockIn.WarehouseId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = ""; inv.BalanceQty = inv.BalanceQty + stockIn.BaleQty ?? 0; inv.ReceiveQty = inv.ReceiveQty ?? 0 + stockIn.BaleQty ?? 0; inv.GoodsType = goodsType.ToString(); inventory.Update(inv, inv.Id); } } else { Inventory result = new Inventory(); Inventory FinalResult = new Inventory(); result.ProductId = (int)stockIn.ProductId; result.QtyInBale = (int?)stockIn.BaleWeight; result.SupplierId = stockIn.SupplierId ?? 0; result.WarehouseId = (int)stockIn.WarehouseId; result.ReceiveQty = stockIn.BaleQty; result.BalanceQty = stockIn.BaleQty ?? 0; result.Notes = Notes; result.GoodsType = goodsType.ToString(); result.CreatedBy = CurrentSession.GetCurrentSession().UserName; result.CreatedDate = DateTime.Now; result.IsActive = true; FinalResult = inventory.Save(result); } return(service.Save(stockIn)); }
public Unit Update(Unit t, int id) { service.Update(t, id); return(t); }
public Tax Update(Tax t, int id) { return(service.Update(t, id)); }
public AccountGroup Update(AccountGroup t, int id) { return(service.Update(t, id)); }
public RoleWiseScreenPermission UpdateRoleWisePermission(RoleWiseScreenPermission t, int id) { return(roleService.Update(t, id)); }
public Employee Update(Employee t, int id) { return(service.Update(t, id)); }
public Supplier Update(Supplier t, int id) { return(service.Update(t, id)); }
public WareHouse Update(WareHouse t, int id) { return(service.Update(t, id)); }
public Picture Update(Picture t, int id) { return(service.Update(t, id)); }
public Category Update(Category t, int id) { return(service.Update(t, id)); }
public StockIn Update(StockIn t, int id) { return(service.Update(t, id)); }
public Brand Update(Brand t, int id) { service.Update(t, id); return(t); }
public SalesOrder Update(SalesOrder t, int id) { return(serviceSalesOrder.Update(t, id)); }
public AccountLedger Update(AccountLedger t, int id) { return(service.Update(t, id)); }
public TempSalesMaster Update(TempSalesMaster t, int id) { return(serviceTempSalesMaster.Update(t, id)); }
public UserInfo Update(UserInfo t, int id) { return(service.Update(t, id)); }
public Product Update(Product t, int id) { return(service.Update(t, id)); }
public Customer Update(Customer t, int id) { return(service.Update(t, id)); }
public ReceiveMaster Update(ReceiveMaster t, int id) { service.Update(t, id); return(t); }
public LedgerPosting Update(LedgerPosting t, int id) { return(service.Update(t, id)); }
public ReceiveMaster Save(ReceiveMaster cus, int wareHouseId, int goodsType) { var supplier = supplierService.GetById(cus.SupplierID); cus.YearId = financialYearId; var result = service.Save(cus); if (result != null || result.Id > 0) { foreach (var item in cus.ReceiveDetails) { var product = productService.GetById(item.ProductId); if (product != null) { goodsType = product.ProductTypeId ?? 1; } var existingItem = inventory.GetAll(a => a.ProductId == item.ProductId && a.IsActive == true && a.WarehouseId == wareHouseId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = ""; inv.BalanceQty = inv.BalanceQty + item.Qty; inv.ReceiveQty = inv.ReceiveQty ?? 0 + item.Qty; inventory.Update(inv, inv.Id); } } else { Inventory inv = new Inventory(); inv.IsActive = true; inv.ProductId = item.ProductId; inv.ReceiveQty = item.Qty; inv.QtyInBale = 0; inv.SupplierId = cus.SupplierID; inv.WarehouseId = wareHouseId; inv.OpeningQty = 0; inv.BalanceQty = item.Qty; inv.GoodsType = goodsType.ToString(); inventory.Save(inv); } } // Ledger posting debit to purchase account var ledgerObj = new LedgerPosting(); ledgerObj.VoucherTypeId = (int)VoucherType.PurchaseInvoice; ledgerObj.VoucherNo = result.InvoiceNoPaper; ledgerObj.PostingDate = cus.InvoiceDate; ledgerObj.LedgerId = (int)DefaultLedger.PurchaseAccount; ledgerObj.InvoiceNo = cus.InvoiceNo; ledgerObj.Credit = 0; ledgerObj.Debit = cus.GrandTotal; var save = ledgerService.Save(ledgerObj); //Ledger posting to customer ledger credit var detailsLedger = new LedgerPosting(); detailsLedger.VoucherTypeId = (int)VoucherType.PurchaseInvoice; detailsLedger.VoucherNo = result.InvoiceNoPaper; detailsLedger.PostingDate = cus.InvoiceDate; detailsLedger.LedgerId = supplier.LedgerId; detailsLedger.InvoiceNo = cus.InvoiceNo; detailsLedger.Credit = cus.GrandTotal; detailsLedger.Debit = 0; var detailsLedgerResult = ledgerService.Save(detailsLedger); var party = new PartyBalance(); party.InvoiceNo = result.InvoiceNo; party.LedgerId = supplier.LedgerId ?? 0; party.Credit = cus.GrandTotal; party.CreditPeriod = 60; party.Debit = 0; party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear; party.PostingDate = cus.InvoiceDate; party.VoucherTypeId = (int)VoucherType.PurchaseInvoice; party.VoucherNo = result.InvoiceNo; party.extra1 = "Purchase Invoice: " + cus.InvoiceNo + " Coutha:" + cus.InvoiceNoPaper; partyBalanceService.Save(party); } return(cus); }
public StockOut Update(StockOut t, int id) { return(service.Update(t, id)); }
public FinancialYear Update(FinancialYear t, int id) { return(service.Update(t, id)); }