public ActionResult printPurchaseInvoice(int id)
        {
            int      total = 0;
            Purchase pa    = db.Purchases.SingleOrDefault(x => x.purchaseId == id);

            ViewBag.purchase = db.PurchaseDetails.Where(x => x.purchaseDetailsId == id).ToList();
            total            = (int)db.PurchaseDetails.Where(r => r.purchaseDetailsId == id).Sum(c => c.amount);
            convertToNumeral convert = new convertToNumeral();

            ViewBag.total = convert.convertNumber(total);
            return(new ViewAsPdf(pa));
        }
        public ActionResult printSaleInvoice(int?id)
        {
            int  total = 0;
            Sale sa    = db.Sales.SingleOrDefault(x => x.saleId == id);

            ViewBag.sale = db.SaleDetails.Where(x => x.saleDetailsId == id).ToList();
            total        = (int)db.SaleDetails.Where(r => r.saleDetailsId == id).Sum(c => c.amount);
            convertToNumeral convert = new convertToNumeral();

            ViewBag.total = convert.convertNumber(total);
            return(new ViewAsPdf(sa));
        }
Example #3
0
        public ActionResult printExpInvoice(int?id)
        {
            int total           = 0;
            voucherViewModel va = new voucherViewModel();

            va.voucher       = new Voucher();
            va.voucherDetail = new VoucherBody();
            va.voucher       = db.Vouchers.SingleOrDefault(x => x.voucherNo == id);
            ViewBag.vouchers = db.VoucherBodies.Where(x => x.voucherNo == id).ToList();
            total            = (int)db.VoucherBodies.Where(r => r.voucherNo == id).Sum(c => c.debit);
            ViewBag.total    = total;
            convertToNumeral convert = new convertToNumeral();

            ViewBag.totalInWord = convert.convertNumber(total);
            return(new ViewAsPdf(va));
        }