Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 public Unit Update(Unit t, int id)
 {
     service.Update(t, id);
     return(t);
 }
Esempio n. 6
0
 public Tax Update(Tax t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 7
0
 public AccountGroup Update(AccountGroup t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 8
0
 public RoleWiseScreenPermission UpdateRoleWisePermission(RoleWiseScreenPermission t, int id)
 {
     return(roleService.Update(t, id));
 }
Esempio n. 9
0
 public Employee Update(Employee t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 10
0
 public Supplier Update(Supplier t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 11
0
 public WareHouse Update(WareHouse t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 12
0
 public Picture Update(Picture t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 13
0
 public Category Update(Category t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 14
0
 public StockIn Update(StockIn t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 15
0
 public Brand Update(Brand t, int id)
 {
     service.Update(t, id);
     return(t);
 }
Esempio n. 16
0
 public SalesOrder Update(SalesOrder t, int id)
 {
     return(serviceSalesOrder.Update(t, id));
 }
Esempio n. 17
0
 public AccountLedger Update(AccountLedger t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 18
0
 public TempSalesMaster Update(TempSalesMaster t, int id)
 {
     return(serviceTempSalesMaster.Update(t, id));
 }
Esempio n. 19
0
 public UserInfo Update(UserInfo t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 20
0
 public Product Update(Product t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 21
0
 public Customer Update(Customer t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 22
0
 public ReceiveMaster Update(ReceiveMaster t, int id)
 {
     service.Update(t, id);
     return(t);
 }
Esempio n. 23
0
 public LedgerPosting Update(LedgerPosting t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 24
0
        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);
        }
Esempio n. 25
0
 public StockOut Update(StockOut t, int id)
 {
     return(service.Update(t, id));
 }
Esempio n. 26
0
 public FinancialYear Update(FinancialYear t, int id)
 {
     return(service.Update(t, id));
 }