|
|
@ -12,8 +12,10 @@ using Repository.MobileV2; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Web; |
|
|
@ -314,7 +316,97 @@ namespace Business.Mobile |
|
|
|
|
|
|
|
public JsonRxResponse DownLoadStatement(DateFilterParams search, string userId) |
|
|
|
{ |
|
|
|
//TranHistoryResponse trn = new TranHistoryResponse();
|
|
|
|
var r= _requestServicesv2.TransactionPrintPdf(search, userId); |
|
|
|
//r = TranHistoryResponse;
|
|
|
|
//var jsonResult = _requestServicesv2.GetReceiverInformationV2(search, customerId, countryId);
|
|
|
|
StringBuilder htmlContent = new StringBuilder(); |
|
|
|
var imageUrl = "data:image/png;base64," + Convert.ToBase64String(System.IO.File.ReadAllBytes("wwwroot/images/logo.png")); |
|
|
|
var svgContent = System.IO.File.ReadAllText("wwwroot/images/imelondon.svg"); |
|
|
|
var imageUrl1 = $"data:image/svg+xml;base64,{Convert.ToBase64String(Encoding.UTF8.GetBytes(svgContent))}"; |
|
|
|
htmlContent.AppendLine("<html><head><style> .header {overflow: auto;}" + |
|
|
|
".img1 {float: left; width: 350px; height: 60px; }" + |
|
|
|
".img {float: right; width: 150px; height: 60px;-webkit-filter: grayscale(100%); filter: grayscale(100%);}" + |
|
|
|
" .parag {text-align: justify;} " + |
|
|
|
"</style></head> <body> " + |
|
|
|
" <div class='header'>" + |
|
|
|
$"<img class='img' src='{imageUrl}' />" + |
|
|
|
$"<img class='img1' src='{imageUrl1}' />" + |
|
|
|
"<div class=\"parag\"><p>" + |
|
|
|
"<br /><br /><br /><br /><b> IME is the trading name of Subhida UK Ltd company.</b>" + |
|
|
|
"<br /> Registration No.: 6432399" + |
|
|
|
"<br />FCA Registration No.: 576127" + |
|
|
|
"<br />HMRC Registration No.: 12663526" + |
|
|
|
"<br /> Registered Address : Pentax House South Hill Avenue, South Harrow," + |
|
|
|
"<br />London, HA2 0DU" + |
|
|
|
"<br />Email:info@imelondon.co.uk</p> </div></div>" + |
|
|
|
"<h1>Transaction List</h1>"); |
|
|
|
htmlContent.AppendLine("<table style='border-collapse: collapse;'><thead><tr>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>S.N</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Receiver Name</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Send Date</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Tran Id</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Control No</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Delivery Method</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Status</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Transfer Amt</th>" + |
|
|
|
"<th style='border: 1px solid black; padding: 5px;'>Receive Amt</th>" + |
|
|
|
"</tr></thead><tbody>"); |
|
|
|
int sn = 1; |
|
|
|
decimal totalPayoutAmt = 0; |
|
|
|
foreach (var transa in r.RecentTransactions) |
|
|
|
{ |
|
|
|
if (decimal.TryParse(transa.PayoutAmt, out decimal payoutAmtDecimal)) |
|
|
|
{ |
|
|
|
totalPayoutAmt += payoutAmtDecimal; |
|
|
|
} |
|
|
|
htmlContent.AppendLine( |
|
|
|
$"<tr style='border: 1px solid black;'>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{sn}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.User}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.SendDate}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.TranId}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.ControlNo}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.PayoutMode}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.PayStatus}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.CollAmt}</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{transa.PayoutAmt}</td>" + |
|
|
|
$"</tr>"); |
|
|
|
sn++; |
|
|
|
} |
|
|
|
|
|
|
|
htmlContent.AppendLine( |
|
|
|
$"<tr style='border: 1px solid black;'>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td></td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>Total:</td>" + |
|
|
|
$"<td style='border: 1px solid black; padding: 5px;'>{totalPayoutAmt}</td>" + |
|
|
|
$"</tr>"); |
|
|
|
|
|
|
|
htmlContent.AppendLine("</tbody></table></body></html>"); |
|
|
|
//var pdfBytes = GeneratePdf(htmlContent.ToString());
|
|
|
|
//return System.IO.File.OpenRead(pdfBytes, "application/pdf", "TransactionReport.pdf");
|
|
|
|
// string path = "wwwroot/download/workplace-learning-report-2021.pdf";
|
|
|
|
//_ = System.IO.File.ReadAllBytes(path);
|
|
|
|
//return new FileContentResult(htmlContent, "application/pdf");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//string htmlContent = "wwwroot/download/workplace-learning-report-2021.pdf";
|
|
|
|
var stream = new MemoryStream(File.ReadAllBytes(htmlContent.ToString())); |
|
|
|
return new FileStreamResult(stream, new MediaTypeHeaderValue("application/pdf")) |
|
|
|
{ |
|
|
|
FileDownloadName = "TransactionReport.pdf" |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
JsonRxResponse jsonRx = new JsonRxResponse() { ErrorCode = "0", Msg = "Success" }; |
|
|
|
//JsonRxResponse jrx = _requestServicesv2.PrintPdf(userId);
|
|
|
|
jsonRx.Data = "http://77.68.15.91:1082/download/sample.pdf"; |
|
|
|
return jsonRx; |
|
|
|
|
|
|
@ -322,6 +414,42 @@ namespace Business.Mobile |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//private byte[] GeneratePdf(string htmlContent)
|
|
|
|
//{
|
|
|
|
// var fileName = Path.GetTempFileName();
|
|
|
|
|
|
|
|
// // Save the HTML content to a temporary file
|
|
|
|
// System.IO.File.WriteAllText(fileName + ".html", htmlContent);
|
|
|
|
|
|
|
|
// // Run the WkHtmlToPdf process
|
|
|
|
// var process = new Process()
|
|
|
|
// {
|
|
|
|
// StartInfo = new ProcessStartInfo
|
|
|
|
// {
|
|
|
|
// FileName = @"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe", // Provide the full path here
|
|
|
|
// Arguments = $"{fileName}.html {fileName}.pdf",
|
|
|
|
// RedirectStandardOutput = true,
|
|
|
|
// RedirectStandardError = true,
|
|
|
|
// UseShellExecute = false,
|
|
|
|
// CreateNoWindow = true,
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
// process.Start();
|
|
|
|
// process.WaitForExit();
|
|
|
|
|
|
|
|
// // Read the generated PDF into a byte array
|
|
|
|
// var pdfBytes = System.IO.File.ReadAllBytes($"{fileName}.pdf");
|
|
|
|
|
|
|
|
// // Cleanup temporary files
|
|
|
|
// //System.IO.File.Delete($"{fileName}.html");
|
|
|
|
// //System.IO.File.Delete($"{fileName}.pdf");
|
|
|
|
|
|
|
|
// return pdfBytes;
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
public JsonRxResponse UpdateCustomerProfile(CustomerDetailV2 profileV2) |
|
|
|
{ |
|
|
|
|
|
|
|