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 AccountGroup Update(AccountGroup t, int id) { var existing = service.GetById(id); if (existing != null) { existing.AccountGroupName = t.AccountGroupName; return(service.Update(existing, id)); } else { return(null); } }
public SalesDetail Update(SalesDetail salesDetail, int id) { var balance = 0.0m; List <Inventory> existingItem = this.inventory.GetAll((Inventory a) => a.ProductId == salesDetail.ProductId && a.IsActive && a.WarehouseId == salesDetail.WarehouseId && a.SizeId == salesDetail.SizeId && a.BrandId == salesDetail.BrandId && a.APIId == salesDetail.APIId).ToList <Inventory>(); if (existingItem.Count > 0) { foreach (Inventory inv in existingItem) { inv.UpdatedDate = new DateTime?(DateTime.Now); inv.UpdatedBy = ""; Inventory nullable = inv; decimal? salesQty = inv.SalesQty; nullable.SalesQty = new decimal?((salesQty.HasValue ? salesQty.GetValueOrDefault() : salesDetail.Qty)); inv.BalanceQty = inv.BalanceQty - salesDetail.Qty; this.inventory.Update(inv, inv.Id); balance = inv.BalanceQty; } } var invTransaction = new InventoryTransaction() { APIId = salesDetail.APIId, BalanceQty = balance, BrandId = salesDetail.BrandId, CreatedBy = CurrentSession.GetCurrentSession().UserName, CreatedDate = DateTime.Now, GoodsType = "Finished Goods", InventoryGuid = Guid.NewGuid().ToString(), InvoiceNo = "", IsActive = true, ProductId = salesDetail.ProductId, PurchasePrice = salesDetail.Rate, Qty = salesDetail.Qty, SalesPrice = salesDetail.Rate, SizeId = salesDetail.SizeId, SupplierId = salesDetail.SalesMaster.CustomerID, TransactionType = (int)Util.TransactionType.SalesQty, WarehouseId = salesDetail.WarehouseId }; _invTransactionService.Save(invTransaction); return(salesDetailsService.Update(salesDetail, id)); }
public RoleWiseScreenPermission UpdateRoleWisePermission(RoleWiseScreenPermission t, int id) { return(roleService.Update(t, id)); }
public AccountLedger Update(AccountLedger t, int id) { return(service.Update(t, id)); }
public PayHead Update(PayHead t, int id) { service.Update(t, id); return(t); }
public Picture Update(Picture t, int id) { return(service.Update(t, id)); }
public SalesDelivery Update(SalesDelivery t, int id) { service.Update(t, id); return(t); }
public Brand Update(Brand t, int id) { service.Update(t, id); return(t); }
public PaymentDetail Update(PaymentDetail t, int id) { return(_paymentDetails.Update(t, id)); }
public StockIn Update(StockIn t, int id) { return(service.Update(t, id)); }
public LedgerPosting Update(LedgerPosting t, int id) { return(service.Update(t, id)); }
public PaymentMaster Update(PaymentMaster t, int id) { return(_paymentMaster.Update(t, id)); }
public Tax Update(Tax t, int id) { return(service.Update(t, id)); }
public ReceiveMaster Save(ReceiveMaster cus, List <AdditionalCost> additionalCosts, int wareHouseId, int goodsType) { var avgAdditionalCost = cus.AdditionalCost / cus.ReceiveDetails.Select(a => a.Qty).Sum(); var avgCostPrice = 0.0m; 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 balance = 0.0m; var existingItem = _inventoryService.GetAll(a => a.ProductId == item.ProductId && a.IsActive == true && a.WarehouseId == wareHouseId && a.SizeId == item.SizeId && a.BrandId == item.BrandId && a.APIId == item.APIId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { var existingCosting = inv.BalanceQty * inv.Costprice ?? 0; var totalAmount = item.Amount + avgAdditionalCost * item.Qty + existingCosting; avgCostPrice = totalAmount / (item.Qty + inv.BalanceQty); inv.Costprice = avgCostPrice; inv.PurchasePrice = item.Rate; inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = ""; inv.BalanceQty = inv.BalanceQty + item.Qty; inv.ReceiveQty = inv.ReceiveQty ?? 0 + item.Qty; _inventoryService.Update(inv, inv.Id); balance = inv.BalanceQty; } } else { Inventory inv = new Inventory(); inv.IsActive = true; inv.CreatedDate = DateTime.Now; inv.CreatedBy = ""; inv.ProductId = item.ProductId; inv.ReceiveQty = item.Qty; inv.SupplierId = cus.SupplierID; inv.WarehouseId = wareHouseId; inv.BrandId = item.BrandId; inv.SizeId = item.SizeId; inv.APIId = item.APIId; inv.Faulty = 0; inv.OpeningQty = 0; inv.BalanceQty = item.Qty; inv.PurchasePrice = item.Rate; inv.Costprice = avgCostPrice; inv.SalesPrice = 0; inv.GoodsType = goodsType.ToString(); _inventoryService.Save(inv); balance = item.Qty; } var invTransaction = new InventoryTransaction() { APIId = item.APIId, BalanceQty = balance, BrandId = item.BrandId, CreatedBy = CurrentSession.GetCurrentSession().UserName, CreatedDate = DateTime.Now, GoodsType = goodsType.ToString(), InventoryGuid = Guid.NewGuid().ToString(), InvoiceNo = cus.InvoiceNo, IsActive = true, ProductId = item.ProductId, PurchasePrice = item.Rate, CostPrice = avgCostPrice, Qty = item.Qty, SalesPrice = 0, SizeId = item.SizeId, SupplierId = cus.SupplierID, TransactionType = (int)Util.TransactionType.ReceiveQty, WarehouseId = item.WarehouseId ?? 0 }; _invTransactionService.Save(invTransaction); } // Ledger posting debit to purchase account var ledgerObj = new LedgerPosting(); ledgerObj.VoucherTypeId = (int)VoucherTypeEnum.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; ledgerObj.MasterId = result.Id; var save = ledgerService.Save(ledgerObj); //Ledger posting to customer ledger credit var detailsLedger = new LedgerPosting(); detailsLedger.VoucherTypeId = (int)VoucherTypeEnum.PurchaseInvoice; detailsLedger.VoucherNo = result.InvoiceNoPaper; detailsLedger.PostingDate = cus.InvoiceDate; detailsLedger.LedgerId = supplier.LedgerId; detailsLedger.InvoiceNo = cus.InvoiceNo; detailsLedger.Credit = cus.TotalAmount - cus.BillDiscount; detailsLedger.Debit = 0; detailsLedger.MasterId = result.Id; var detailsLedgerResult = ledgerService.Save(detailsLedger); //save addisitonalCost if (additionalCosts != null && additionalCosts.Count > 0) { foreach (var item in additionalCosts) { item.CreatedBy = CurrentSession.GetCurrentSession().UserId; item.CreatedDate = DateTime.Now; item.LedgerId = supplier.LedgerId; item.VoucherNo = cus.InvoiceNo; item.Extra1 = cus.AdditionalCostPurpose; item.VoucherTypeId = (int)VoucherTypeEnum.PurchaseInvoice; var isSaved = _addCostService.Save(item); } // var additionalCost = new LedgerPosting(); additionalCost.VoucherTypeId = (int)VoucherTypeEnum.AdditionalCost; additionalCost.VoucherNo = result.InvoiceNoPaper; additionalCost.PostingDate = cus.InvoiceDate; additionalCost.LedgerId = (int)DefaultLedger.AdditionalCost; additionalCost.InvoiceNo = cus.InvoiceNo; additionalCost.Credit = cus.AdditionalCost; additionalCost.Debit = 0; additionalCost.MasterId = result.Id; var _ = ledgerService.Save(additionalCost); } var party = new PartyBalance(); party.InvoiceNo = result.InvoiceNo; party.LedgerId = supplier.LedgerId ?? 0; party.Credit = cus.TotalAmount - cus.BillDiscount; party.CreditPeriod = 60; party.Debit = 0; party.MasterId = result.Id; party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear; party.PostingDate = cus.InvoiceDate; party.VoucherTypeId = (int)VoucherTypeEnum.PurchaseInvoice; party.VoucherNo = result.InvoiceNo; party.extra1 = "Purchase Invoice: " + cus.InvoiceNo + " Paper Invoice No:" + cus.InvoiceNoPaper; party.extra2 = result.Id.ToString(); partyBalanceService.Save(party); } return(cus); }
public ReceiveMaster Update(ReceiveMaster t, int id) { service.Update(t, id); return(t); }
public Size Update(Size t, int id) { service.Update(t, id); return(t); }
public Customer Update(Customer t, int id) { return(service.Update(t, id)); }
public StockIn Save(StockIn stockIn) { var balance = 0.0m; var existingItem = inventory.GetAll(a => a.ProductId == stockIn.ProductId && a.BrandId == stockIn.BrandId && a.SizeId == stockIn.SizeId && a.APIId == stockIn.APIId && 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.ProductionIn = inv.ProductionIn ?? 0 + stockIn.BaleQty ?? 0; inventory.Update(inv, inv.Id); balance = inv.BalanceQty; } } else { Inventory result = new Inventory(); Inventory FinalResult = new Inventory(); result.ProductId = (int)stockIn.ProductId; result.SupplierId = stockIn.SupplierId ?? 0; result.WarehouseId = (int)stockIn.WarehouseId; result.ProductionIn = stockIn.BaleQty; result.PurchasePrice = stockIn.Rate; result.BrandId = stockIn.BrandId; result.SizeId = stockIn.SizeId; result.BalanceQty = stockIn.BaleQty ?? 0; result.Notes = stockIn.Notes; result.GoodsType = "2"; result.CreatedBy = CurrentSession.GetCurrentSession().UserName; result.CreatedDate = DateTime.Now; result.IsActive = true; FinalResult = inventory.Save(result); balance = result.BalanceQty; } var invTransaction = new InventoryTransaction() { APIId = stockIn.APIId, BalanceQty = balance, BrandId = stockIn.BrandId, CreatedBy = CurrentSession.GetCurrentSession().UserName, CreatedDate = DateTime.Now, GoodsType = "Finished Goods", InventoryGuid = Guid.NewGuid().ToString(), InvoiceNo = "", IsActive = true, ProductId = stockIn.ProductId ?? 0, PurchasePrice = stockIn.Rate, Qty = stockIn.BaleQty, SalesPrice = 0, SizeId = stockIn.SizeId, SupplierId = stockIn.SupplierId ?? 0, TransactionType = (int)Util.TransactionType.ProductionIn, WarehouseId = stockIn.WarehouseId ?? 0 }; _invTransactionService.Save(invTransaction); return(service.Save(stockIn)); }
public BonusDeduction Update(BonusDeduction t, int id) { service.Update(t, id); return(t); }
public Unit Update(Unit t, int id) { return(service.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 bool Save(List <StockOutRequest> stockOuts, string invoiceNo, string Notes) { var balance = 0.0m; var inventoryLists = stockOuts.Select(a => a.InventoryId).ToList(); var existingItem = inventory.GetAll(a => inventoryLists.Contains(a.Id) && a.IsActive == true).ToList(); if (existingItem.Count > 0) { var stocks = new List <StockOut>(); foreach (var inv in existingItem) { var qty = stockOuts.Where(a => a.InventoryId == inv.Id).Sum(a => a.Qty); var stock = new StockOut() { AlreadyProcessed = false, BaleQty = qty, ProductId = inv.ProductId, IsActive = true, InvoiceNo = invoiceNo, Notes = Notes, SupplierId = inv.SupplierId, WarehouseId = inv.WarehouseId, CreatedBy = CurrentSession.GetCurrentSession().UserName, CreatedDate = DateTime.Now, SizeId = inv.SizeId, SizeName = inv.Size.Name, BrandId = inv.BrandId, BrandName = inv.Brand.BrandName, APIId = inv.APIId, InventoryId = inv.Id, Rate = inv.PurchasePrice, StockOutPrice = inv.PurchasePrice * qty, ProductionDate = DateTime.Now }; inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = CurrentSession.GetCurrentSession().UserName; inv.ProductionOut += qty; inv.BalanceQty = inv.BalanceQty - qty; balance = inv.BalanceQty; inventory.Update(inv, inv.Id); stocks.Add(stock); var invTransaction = new InventoryTransaction() { APIId = stock.APIId, BalanceQty = balance, BrandId = stock.BrandId, CreatedBy = CurrentSession.GetCurrentSession().UserName, CreatedDate = DateTime.Now, GoodsType = "Finished Goods", InventoryGuid = Guid.NewGuid().ToString(), InvoiceNo = "", IsActive = true, ProductId = stock.ProductId ?? 0, PurchasePrice = 0, Qty = stock.BaleQty, SalesPrice = 0, SizeId = stock.SizeId, SupplierId = stock.SupplierId ?? 0, TransactionType = (int)Util.TransactionType.ProductionOut, WarehouseId = stock.WarehouseId ?? 0 }; _invTransactionService.Save(invTransaction); } service.Save(stocks); return(true); } else { return(false); } }
public Category Update(Category t, int id) { return(service.Update(t, id)); }
public Department Update(Department t, int id) { return(service.Update(t, id)); }
public StockOut Update(StockOut t, int id) { return(service.Update(t, id)); }
public Company Update(Company t, int id) { service.Update(t, id); return(t); }
public WareHouse Update(WareHouse t, int id) { return(service.Update(t, id)); }
public User Update(User t, int id) { return(service.Update(t, id)); }