public ActionResult BalanceSheet_HTML(LedgerListViewRequest request) { var response = new VoucherReportViewResponse(); var headerHtml = ""; var reportHeaderHtml = ""; var firstSection = ""; var table = ""; try { var list = _dalLedger.ReportBalanceSheet(request).Where(x => x.VoucherType == 1).ToList(); if (list.Any()) { reportHeaderHtml = " <div align='center' class='ReportBorderL' >" + "<div style='position:absolute;'>" + "<img src='/UploadFiles/" + list.FirstOrDefault().LogoLocation + "' width='60' border='0' />" + " </div>" + "<table style='width: 100%'>" + "<tr>" + "<td class='Company'>" + list.FirstOrDefault().CompanyName + "</td>" + "</tr>" + "<tr>" + "<td class='Address1'>" + list.FirstOrDefault().CompanyAddress + "</td>" + "</tr>" + " <tr>" + " <td class='Address2'>" + list.FirstOrDefault().CompanyEmail + ", " + list.FirstOrDefault().CompanyContact + "</td>" + "</tr>" + // "<tr>" + // "<td class='Address3'>" + list.FirstOrDefault().CompanyContact + "</td>" + //" </tr>" + "<tr>" + "<td style='text-align: center'>" + "<div align='center'>" + "<div class='ReportTitle'>Balance Sheet" + "</div>" + "</div>" + "</td>" + "</tr>" + "</table>" + "<div runat='server' id='reportContent'></div>" + "<br />"; firstSection = firstSection + "<div align='left'><table style='font-size:13px; background-color:#d2c8c8; width: 50%'>"; firstSection = firstSection + " <tr>"; firstSection = firstSection + "<td style='width: 180px'><b> Transaction Date</b></td>"; firstSection = firstSection + " <td style='width: 4px'><b>:</b></td>"; firstSection = firstSection + " <td style='width: 400px;'>" + list.FirstOrDefault().SearchDate + "</td>"; firstSection = firstSection + "</tr></table></div>"; table = "<br /><table class='tableApproval' cellspacing='0' style='font-size:12px; width: 100%; '><tr>" + "<td style='text-align: center; font-weight:bold'>Chart of Account</td>" + "<td style='text-align: center; font-weight:bold'>Debit</td>" + "<td style='text-align: center; font-weight:bold'>Credit</td>" + "</tr>"; var assetsList = list.Where(y => y.GroupId == 1); //headerHtml = headerHtml + "</br><div><b>Income</b></div>"; table = table + "<tr><td style='font-weight:bold' colspan='3'>Assets</td></tr>"; int i = 0; foreach (var item in assetsList) { i++; //foreach (var lastItem in item) //{ table = table + "<tr><td style='text-align: center;'>" + item.ChartOfAccount + "</td>" + "<td style='text-align: center;'>" + item.Debit + "</td>" + "<td style='text-align: center;'>" + item.Credit + "</td></tr>"; //} if (assetsList.Count() == i) { table = table + "<tr><td colspan='1' style='font-weight:bold'>Total Assets</td>" + "<td style='text-align: center; font-weight:bold'>" + assetsList.Sum(y => y.Debit) + "</td>" + "<td style='text-align: center; font-weight:bold'>" + assetsList.Sum(x => x.Credit) + "</td></tr>" + "<tr><td colspan='3'></td></tr></br>"; } } var equityList = list.Where(x => x.GroupId == 4); //headerHtml = headerHtml + "</br><div><b>Expense</b></div>"; table = table + "<tr><td style='font-weight:bold' colspan='3'>Liabilities & Equity</td></tr>"; int j = 0; foreach (var item1 in equityList) { j++; //foreach (var expenseItem in item1) //{ table = table + "<tr><td style='text-align: center;'>" + item1.ChartOfAccount + "</td>" + "<td style='text-align: center;'>" + item1.Debit + "</td>" + "<td style='text-align: center;'>" + item1.Credit + "</td></tr>"; //} if (equityList.Count() == j) { table = table + "<tr><td colspan='1' style='font-weight:bold'>Total Liabilities & Equity</td>" + "<td style='text-align: center; font-weight:bold'>" + equityList.Sum(x => x.Debit) + "</td>" + "<td style='text-align: center; font-weight:bold'>" + equityList.Sum(x => x.Credit) + "</td></tr></br>"; } } table = table + "</table>"; headerHtml = headerHtml + table; response.StatusCode = "200"; response.StatusMessage = "Successfully Get Data"; response.Report = reportHeaderHtml + firstSection + headerHtml + "</div>"; } else { response.StatusCode = "404"; response.StatusMessage = "No Data Found"; response.Report = ""; } } catch (Exception ex) { response.StatusCode = "500"; response.StatusMessage = ex.Message.ToString(); } var camelCaseFormatter = new JsonSerializerSettings(); camelCaseFormatter.ContractResolver = new CamelCasePropertyNamesContractResolver(); var returnJson = Json(JsonConvert.SerializeObject(response, camelCaseFormatter), JsonRequestBehavior.AllowGet); returnJson.MaxJsonLength = Int32.MaxValue; return(returnJson); }
public ActionResult VoucherReport_HTML(VoucherReportViewRequest request) { var response = new VoucherReportViewResponse(); var headerHtml = ""; var reportHeaderHtml = ""; var firstSection = ""; var table = ""; try { var list = _dalLedger.VoucherListByType(request).ToList(); if (list.Any()) { reportHeaderHtml = " <div align='left' class='ReportBorderL' >" + "<div style='position:absolute;'>" + "<img src='/UploadFiles/" + list.FirstOrDefault().LogoLocation + "' width='60' border='0' />" + " </div>" + "<table style='width: 100%'>" + "<tr>" + "<td class='Company'>" + list.FirstOrDefault().CompanyName + "</td>" + "</tr>" + "<tr>" + "<td class='Address1'>" + list.FirstOrDefault().CompanyAddress + "</td>" + "</tr>" + " <tr>" + " <td class='Address2'>" + list.FirstOrDefault().CompanyEmail + ", " + list.FirstOrDefault().CompanyContact + "</td>" + "</tr>" + // "<tr>" + // "<td class='Address3'>" + list.FirstOrDefault().CompanyContact + "</td>" + //" </tr>" + "<tr>" + "<td style='text-align: center'>" + "<div align='center'>" + " <div class='ReportTitle'> " + list.FirstOrDefault().Voucher + "" + "</div>" + "</div>" + "</td>" + "</tr>" + "</table>" + "<div runat='server' id='reportContent'></div>" + "<br />"; firstSection = firstSection + "</br></br> <table style='font-size:13px; background-color:#d2c8c8; width: 100%'>"; firstSection = firstSection + " <tr>"; firstSection = firstSection + "<td style='width: 102px'><b> Transaction Date</b></td>"; firstSection = firstSection + " <td style='width: 4px'><b>:</b></td>"; firstSection = firstSection + " <td style='width: 240px;'>" + list.FirstOrDefault().TransactionDate + "</td>"; firstSection = firstSection + "</tr>"; firstSection = firstSection + " <td style='width: 102px'><b>Reference</b></td>"; firstSection = firstSection + "<td style='width: 4px'><b>:</b></td>"; firstSection = firstSection + " <td style='width: 240px;'>" + list.FirstOrDefault().Reference + "</td>"; //firstSection = firstSection + " <td style='width: 102px'><b>To Line</b></td>"; //firstSection = firstSection + "<td style='width: 4px'><b>:</b></td>"; //firstSection = firstSection + " <td style='width: 240px;'>" + list.FirstOrDefault().Search_ToLine + "</td>"; firstSection = firstSection + "</tr></table>"; table = "<table class='tableApproval' cellspacing='0' style='font-size:12px; width: 100%; '><tr>" + "<td style='font-weight:bold'>Voucher</td>" + "<td style='font-weight:bold'>Chart of Account</td>" + "<td style='font-weight:bold'>Description</td>" + "<td style='font-weight:bold'>Narration</td>" + "<td style='font-weight:bold'>Debit</td>" + "<td style='font-weight:bold'>Credit</td>" + "</tr>"; var itemList = list.GroupBy(x => x.LedgerId).Select(x => x.ToList()); int i = 0; foreach (var item in itemList) { i++; foreach (var lastItem in item) { table = table + "<tr><td>" + lastItem.Voucher + "</td>" + "<td>" + lastItem.ChartOfAccount + "</td>" + "<td>" + lastItem.Description + "</td>" + "<td>" + lastItem.Narration + "</td>" + "<td>" + lastItem.Debit + "</td>" + "<td>" + lastItem.Credit + "</td></tr>"; } if (itemList.Count() == i) { table = table + "<tr><td colspan='4' style='font-weight:bold'>Total</td>" + "<td style='font-weight:bold'>" + list.Sum(x => x.Debit) + "</td>" + "<td style='font-weight:bold'>" + list.Sum(x => x.Credit) + "</td></tr></br>"; } } table = table + "</table>"; headerHtml = headerHtml + table; response.StatusCode = "200"; response.StatusMessage = "Successfully Get Data"; response.Report = reportHeaderHtml + firstSection + headerHtml + "</div>"; } else { response.StatusCode = "404"; response.StatusMessage = "No Data Found"; response.Report = ""; } } catch (Exception ex) { response.StatusCode = "500"; response.StatusMessage = ex.Message.ToString(); } var camelCaseFormatter = new JsonSerializerSettings(); camelCaseFormatter.ContractResolver = new CamelCasePropertyNamesContractResolver(); var returnJson = Json(JsonConvert.SerializeObject(response, camelCaseFormatter), JsonRequestBehavior.AllowGet); returnJson.MaxJsonLength = Int32.MaxValue; return(returnJson); }