示例#1
0
 public List <Product> GetAll(int type)
 {
     if (type == 0)
     {
         return(service.GetAll(a => a.IsActive == true).ToList());
     }
     //return service.GetAll();
     return(service.GetAll(a => a.IsActive == true && a.ProductTypeId == type).ToList());
 }
        public List <PartyBalance> GetAll(DateTime fromDate, DateTime todate)
        {
            var supplierLedgerIds = supplierService.GetAll(c => c.SupplierType == "Rice Supplier").Select(b => b.LedgerId).ToList();
            var list = service.GetAll(a => a.VoucherTypeId == (int)VoucherType.PurchaseInvoice && supplierLedgerIds.Contains(a.LedgerId) && a.FinancialYearId == yearId).ToList();

            //foreach (var item in list)
            //{
            //    var alreadyPaid = service.GetAll(a => a.AgainstInvoiceNo== item.InvoiceNo && a.LedgerId==item.LedgerId).Select(a=>a.Debit).Sum();
            //    item.Debit = alreadyPaid;
            //}
            return(list);
        }
示例#3
0
 public List <TempSalesMaster> GetUnAurhorizedSales()
 {
     try
     {
         return(serviceTempSalesMaster.GetAll(a => a.IsActive == true).ToList());
     }
     catch (Exception)
     {
         return(new List <TempSalesMaster>());
     }
 }
示例#4
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));
        }
        public AdditionalCost AddCostSave(AdditionalCost addCost)
        {
            var isExists = addCostService.GetAll().Where(a => a.VoucherNo == addCost.VoucherNo && a.LedgerId == addCost.LedgerId).FirstOrDefault();
            var max      = addCostService.LastRow().OrderByDescending(a => a.Id).FirstOrDefault();

            if (max == null)
            {
                addCost.Id = 1;
            }
            else
            {
                addCost.Id = max.Id + 1;
            }
            var result = addCostService.Save(addCost);

            return(result);
        }
示例#6
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));
        }
示例#7
0
 public List <Employee> GetAll()
 {
     return(service.GetAll(a => a.IsActive == true).ToList());
 }
 public List <AccountLedger> GetAll()
 {
     return(service.GetAll().ToList());
 }
示例#9
0
 public List <Brand> GetAll()
 {
     return(service.GetAll());
 }
示例#10
0
 public List <Unit> GetAll()
 {
     return(service.GetAll());
 }
示例#11
0
 public List <Tax> GetAll()
 {
     return(service.GetAll());
 }
示例#12
0
 public List <Inventory> GetAllForSale()
 {
     return(service.GetAll(a => a.GoodsType == "2").ToList());
 }
示例#13
0
 public List <Category> GetAll()
 {
     return(service.GetAll(a => a.IsActive == true).ToList());
 }
示例#14
0
 public List <Customer> GetAll()
 {
     //return service.GetAll();
     return(service.GetAll(a => a.IsActive == true).ToList());
 }
示例#15
0
 public List <SalesMaster> GetAll()
 {
     return(serviceSalesMaster.GetAll(a => a.IsActive == true).ToList());
 }
 public List <JournalMaster> GetAll()
 {
     return(journalMaster.GetAll().ToList());
 }
示例#17
0
 public List <WareHouse> GetAll()
 {
     //return service.GetAll();
     return(service.GetAll(a => a.IsActive == true).ToList());
 }
示例#18
0
 public List <Picture> GetAll()
 {
     return(service.GetAll());
 }
示例#19
0
 public List <UserInfo> GetAll()
 {
     return(service.GetAll());
 }
示例#20
0
 public List <RoleWiseScreenPermission> GetRoleWiseService()
 {
     return(roleService.GetAll());
 }
示例#21
0
 public List <StockOut> GetAll()
 {
     return(service.GetAll());
 }
示例#22
0
 public List <AccountGroup> GetAll()
 {
     return(service.GetAll().ToList());
 }
示例#23
0
        public int Delete(ReceiveMaster master)
        {
            try
            {
                var salesdetails = serviceDetails.GetAll(a => a.ReceiveMasterId == master.Id).ToList();
                foreach (var item in salesdetails)
                {
                    try
                    {
                        var isdetails = new DBService <ReceiveDetail>().Delete(item.Id);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                var isDeleted = service.Delete(master.Id);
                foreach (var item in master.ReceiveDetails)
                {
                    var existingItem = inventory.GetAll(a => a.ProductId == item.ProductId && a.IsActive == true && a.WarehouseId == item.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);
                        }
                    }
                }
                var supplier = supplierService.GetById(master.SupplierID);

                // Ledger Saves credit
                var ledgerObj = new LedgerPosting();
                ledgerObj.VoucherTypeId = (int)VoucherType.PurchaseInvoice;
                ledgerObj.VoucherNo     = master.InvoiceNoPaper;
                ledgerObj.PostingDate   = master.InvoiceDate;
                ledgerObj.LedgerId      = (int)DefaultLedger.PurchaseAccount;
                ledgerObj.InvoiceNo     = master.InvoiceNo;
                ledgerObj.Debit         = 0;
                ledgerObj.Credit        = master.GrandTotal;
                ledgerObj.Extra1        = "Purchase Invoice Deleted: " + master.InvoiceNo;

                var save = ledgerService.Save(ledgerObj);

                //Ledger posting to customer ledger credit
                var detailsLedger = new LedgerPosting();
                detailsLedger.VoucherTypeId = (int)VoucherType.PurchaseInvoice;
                detailsLedger.VoucherNo     = master.InvoiceNoPaper;
                detailsLedger.PostingDate   = master.InvoiceDate;
                detailsLedger.LedgerId      = supplier.LedgerId;
                detailsLedger.InvoiceNo     = master.InvoiceNo;
                detailsLedger.Debit         = master.GrandTotal;
                detailsLedger.Credit        = 0;
                detailsLedger.Extra1        = "Purchase Invoice Deleted: " + master.InvoiceNo;
                var detailsLedgerResult = ledgerService.Save(detailsLedger);

                var party = new PartyBalance();
                party.InvoiceNo       = master.InvoiceNo;
                party.LedgerId        = supplier.LedgerId ?? 0;
                party.Debit           = master.GrandTotal;
                party.CreditPeriod    = 60;
                party.Credit          = 0;
                party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear;
                party.PostingDate     = master.InvoiceDate;
                party.VoucherTypeId   = (int)VoucherType.PurchaseInvoice;
                party.extra1          = "Purchase Invoice Deleted: " + master.InvoiceNo;
                partyBalanceService.Save(party);

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
 public List <LedgerPosting> GetAll()
 {
     return(service.GetAll().ToList());
 }
示例#25
0
 public List <ReceiveMaster> GetAll()
 {
     return(service.GetAll());
 }
示例#26
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);
        }
示例#27
0
 public List <FinancialYear> GetAll()
 {
     return(service.GetAll().ToList());
 }