예제 #1
0
        public async Task <ActionResult> DownloadExcelReport(eService _Query)
        {
            string Extension = ".xlsx";
            var    dt        = DateTime.ParseExact(_Query.SelectedTxnDateRange, "yyyyMM", CultureInfo.InvariantCulture);

            _Query.Month = Convert.ToInt16(dt.ToString("MM"));
            _Query.Year  = Convert.ToInt16(dt.ToString("yyyy"));
            int colIndex = 1, rowIndex = 4;
            var list       = (await MechSignUpService.GetIFrameMerchGeneralInfoes(_Query.BusnLocation, Convert.ToInt32(_Query.SelectedTxnType), _Query.Month, _Query.Year)).eServices;
            var headerName = string.Format("{0}_{1}", _Query.SelectedTxnType, _Query.SelectedTxnDateRange);

            headerName = headerName.Trim();
            var pkg  = CommonHelpers.PrepareExcelHeader(headerName, new string[] { "Posting Date", "Txn Date", "Card No", "RRN", "Quantity", "Amount", "MDR", "VAT Amount", "Net Amount" });
            var ws   = pkg.Workbook.Worksheets[1];
            var cell = ws.Cells[rowIndex, colIndex];

            foreach (var x in list)
            {
                colIndex   = 1;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.PostingDate;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.TxnDate;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.CardNo;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.RRN;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.Quantity;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.Amount;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.MDR;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.VatAmount;
                colIndex++;
                cell       = ws.Cells[rowIndex, colIndex];
                cell.Value = x.NetAmount;
                rowIndex++;
            }
            string contentType = CommonHelpers.ContentType(Extension);

            Byte[] bin = pkg.GetAsByteArray();
            return(File(bin, contentType, headerName + Extension));
        }
예제 #2
0
        public async Task <JsonResult> iFrameMerchTxnListSelect(jQueryDataTableParamModel Params, eService _Query)
        {
            var dt = DateTime.ParseExact(_Query.SelectedTxnDateRange, "yyyyMM", CultureInfo.InvariantCulture);

            _Query.Month = Convert.ToInt16(dt.ToString("MM"));
            _Query.Year  = Convert.ToInt16(dt.ToString("yyyy"));

            var list     = (await MechSignUpService.GetIFrameMerchGeneralInfoes(_Query.BusnLocation, Convert.ToInt32(_Query.SelectedTxnType), _Query.Month, _Query.Year)).eServices;
            var filtered = list.Skip(Params.iDisplayStart).Take(Params.iDisplayLength);

            return(Json(new
            {
                sEcho = Params.sEcho,
                iTotalRecords = list.Count(),
                iTotalDisplayRecords = list.Count(),
                aaData = filtered.Select(x => new object[] { x.PostingDate, x.TxnDate, x.TxnTime, x.CardNo, x.RRN, x.Quantity, x.Amount, x.MDR, x.VatAmount, x.NetAmount })
            }, JsonRequestBehavior.AllowGet));
        }