Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Gst,Sgst,Cgst,Igst,Comment,Name")] TblGst tblGst)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblGst);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblGst));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,DisplayName,Icon,Type,Ordinal,Path,ParentId,IsEnable")] TblMenu tblMenu)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblMenu);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblMenu));
        }
        public async Task <IActionResult> Create([Bind("ItemTypeId,ItemType")] TblItemType tblItemType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblItemType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblItemType));
        }
        public async Task <IActionResult> Create([Bind("Id,TableName,PreFix,RecordCount")] TblSequence tblSequence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblSequence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblSequence));
        }
        public async Task <IActionResult> Create([Bind("Id,Mode,Type,IsVisible")] TblPaymentMode tblPaymentMode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblPaymentMode);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblPaymentMode));
        }
        public async Task <IActionResult> Create([Bind("MeasurintUnitId,MeasuringUnits")] TblItemUnits tblItemUnits)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblItemUnits);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tblItemUnits));
        }
        public async Task <IActionResult> Create([Bind("AutoId,Id,PaymentDate,PartyName,Amount,PaymentMode,Remark,CreatedDatetime")] TblPayment tblPayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblPayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PartyName"] = new SelectList(_context.TblVendor, "Id", "Id", tblPayment.PartyName);
            return(View(tblPayment));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("AutoId,Id,StockType,PurchaseId,SaleId,InvoiceNo,ItemId,Qty,PricePerUnit,ItemwiseDiscount,PricePerUnitAfterDiscount,TotalPriceBeforeTax,Sgst,Cgst,Igst,Gst,TotalPriceAfterTax,Mrp,ManufactureDate,Expirydate,BatchNo,CreatedDatetime")] TblItemStock tblItemStock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblItemStock);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ItemId"]     = new SelectList(_context.TblItems, "Id", "Id", tblItemStock.ItemId);
            ViewData["PurchaseId"] = new SelectList(_context.TblPurchase, "Id", "Id", tblItemStock.PurchaseId);
            ViewData["SaleId"]     = new SelectList(_context.TblSale, "SaleId", "SaleId", tblItemStock.SaleId);
            return(View(tblItemStock));
        }
        public async Task <IActionResult> Create([Bind("AutoId,Id,VendorId,PurchaseId,SalesId,EntryId,EntryDate,EntryType,Amount,Status,CreatedDatetime,TransactionType,TransactionRef,PaymentId")] TblTransaction tblTransaction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblTransaction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PaymentId"]  = new SelectList(_context.TblPayment, "Id", "Id", tblTransaction.PaymentId);
            ViewData["PurchaseId"] = new SelectList(_context.TblPurchase, "Id", "Id", tblTransaction.PurchaseId);
            ViewData["SalesId"]    = new SelectList(_context.TblSale, "SaleId", "SaleId", tblTransaction.SalesId);
            ViewData["VendorId"]   = new SelectList(_context.TblVendor, "Id", "Id", tblTransaction.VendorId);
            return(View(tblTransaction));
        }
Example #10
0
        public async Task <IActionResult> Create(
            [Bind(
                 "AutoId,SaleId,InvoiceId,InvoiceDate,CustomerId,DiscountAfterTax,OtherChargeAfterTax,SubTotal,Tax,TotalValueafterTax,RoundOff,GrandTotal,CreatedDatetime,ReverseCharge,Remark")]
            TblSale tblSale)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblSale);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["CustomerId"] = new SelectList(_context.TblVendor, "Id", "Name", tblSale.CustomerId);
            return(View(tblSale));
        }
        public async Task <IActionResult> Create(
            [Bind(
                 "Id,PartyInvoiceDate,PurchaseDate,PartyInvoiceNo,PartyName,PaymentDueAfter,ReverseCharge,Remark,DiscountAmount,OtherCharge,TotalAmountBeforeTax,TaxAmount,TotalAmountAfterTax,RoundOff,GrandTotal,PurchaseBook,PaymentMode,ScanCopy,CreatedDatetime,Amount")]
            TblPurchase tblPurchase)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tblPurchase);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["PartyName"]   = new SelectList(_context.TblVendor, "Id", "Name", tblPurchase.PartyName);
            ViewData["PaymentMode"] = new SelectList(_context.TblPaymentMode, "Id", "Mode", tblPurchase.PaymentMode);
            return(View(tblPurchase));
        }
Example #12
0
        public async Task <IActionResult> Create([Bind("AutoId,Id,Name,ContactPerson,ContactNo,PhoneNo,VendorType,Type,Place,Dob,Gstno,Tinno,Panno,Cinno,AdhaarNo,OpeningBalance,OpeningBalanceType,OpeningBalanceDate,CreditLimit,CreditPeriod,CreditInterestRate,DebitInterestRate,CreatedDatetime,Photo,Remark,SuretyPerson,SuretyPersonContactNo,SuretyPersonAddress")] TblVendor tblVendor)
        {
            if (ModelState.IsValid)
            {
                var saved = false;
                using (var transaction = _context.Database.BeginTransaction())
                {
                    try
                    {
                        _context.Add(tblVendor);
                        if (tblVendor.VendorType == "Customer")
                        {
                            _context.UpdateNextSequence(SequenceTable.tbl_Customer);
                        }
                        else if (tblVendor.VendorType == "Supplier")
                        {
                            _context.UpdateNextSequence(SequenceTable.tbl_Supplier);
                        }
                        else
                        {
                            _context.UpdateNextSequence(SequenceTable.tbl_vendor);
                        }

                        await _context.SaveChangesAsync();

                        saved = true;
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(e.Message);
                    }
                    finally
                    {
                        if (saved)
                        {
                            transaction.Commit();
                        }
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Type"] = new SelectList(_context.TblVendorType, "Id", "Id", tblVendor.Type);

            return(View(tblVendor));
        }
Example #13
0
        public async Task <IActionResult> Create(
            [Bind(
                 "Id,Name,HsnSacNo,Type,MeasuringUnit,Manufacture,BarCode,ItemUniqueDescription,Supplier,Photo,UseBatchNo,UseMfgDate,UseExpiryDate,CreatedDatetime,Gst")]
            TblItems items, [Bind("OpeningStock")] int?openingStock)
        {
            if (ModelState.IsValid)
            {
                var saved = false;
                using (var transaction = _context.Database.BeginTransaction())
                {
                    try
                    {
                        _context.Add(items);
                        //await _context.SaveChangesAsync();


                        _context.UpdateNextSequence(SequenceTable.tbl_Items);
                        //TblSequence NewSequenceValue = Helper.GenericHelper.GetNextUpdatedData("tbl_Items");
                        //_context.Entry(NewSequenceValue).State = EntityState.Modified;
                        //await _context.SaveChangesAsync();

                        if (openingStock > 0)
                        {
                            TblItemStock tbl_ItemStock = new TblItemStock()
                            {
                                Id              = items.Id + "-" + Helper.GenericHelper.GetMaxValue("tbl_ItemStock") + "-1",
                                StockType       = "IN",
                                InvoiceNo       = "Opening Stock",
                                ItemId          = items.Id,
                                Qty             = openingStock,
                                CreatedDatetime = items.CreatedDatetime.ToString() ??
                                                  DateTime.Now.Date.ToString(CultureInfo.InvariantCulture)
                            };
                            _context.TblItemStock.Add(tbl_ItemStock);
                            //await _context.SaveChangesAsync();
                            _context.UpdateNextSequence(SequenceTable.tbl_ItemStock);
                        }


                        await _context.SaveChangesAsync();

                        saved = true;
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(e.Message);
                    }
                    finally
                    {
                        if (saved)
                        {
                            transaction.Commit();
                        }
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["Gst"]           = new SelectList(_context.TblGst, "Id", "Name", items.Gst);
            ViewData["MeasuringUnit"] = new SelectList(_context.TblItemUnits, "MeasurintUnitId", "MeasuringUnits",
                                                       items.MeasuringUnit);
            ViewData["Supplier"] = new SelectList(_context.TblVendor, "Id", "Name", items.Supplier);
            ViewData["Type"]     = new SelectList(_context.TblItemType, "ItemTypeId", "ItemType", items.Type);
            return(View(items));
        }