png invoice

This commit is contained in:
mmrbnjd
2025-01-09 16:01:37 +03:30
parent 8f9a30c310
commit 83a690ba6b
7 changed files with 362 additions and 53 deletions

View File

@@ -24,6 +24,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="TaxCollectData.Library" Version="0.0.23" />
</ItemGroup>

View File

@@ -23,12 +23,14 @@ namespace Back.Controllers
private readonly servUser _servUser;
private readonly AddOrUpdateInvoiceValidation _validationInvoice;
private readonly servTaxPayer _servTaxPayer;
private readonly servReport _servReport;
private readonly IAsyncRepository<rptQueue> _rptQueueRepository;
public InvoiceController(servInvoice servInvoice, servUser servUser
, AddOrUpdateInvoiceValidation validationInvoice
, servTaxPayer servTaxPayer, IConfiguration configuration
, IAsyncRepository<rptQueue> rptQueueRepository)
, IAsyncRepository<rptQueue> rptQueueRepository, servReport servReport)
{
_servReport= servReport;
_servInvoice = servInvoice;
_servUser = servUser;
_validationInvoice = validationInvoice;
@@ -593,7 +595,6 @@ namespace Back.Controllers
[HttpGet("GetReport/{InvoiceID}")]
public async Task<ActionResult<string>> GetReport(int InvoiceID)
{
string output = "";
//-----GetUserAndCompany
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
@@ -604,37 +605,10 @@ namespace Back.Controllers
if (!await _servInvoice.ExistInvoiceByInvoiceID(CompanyID.Value, InvoiceID))
return NotFound();
//if( await _rptQueueRepository.AddBoolResultAsync(new rptQueue
// {
// CompanyID= CompanyID.Value,InvoicID= InvoiceID,
//}))
// {
// Thread.Sleep(2000);
// if(System.IO.File.Exists(_configuration["rptQueue"].ToString()+ InvoiceID + ".txt"))
// {
// output= System.IO.File.ReadAllText(_configuration["rptQueue"].ToString() + InvoiceID + ".txt");
// }
var result = await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID,InvoiceID);
// }
try
{
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = _configuration["CreateReportFileName"].ToString();
p.StartInfo.Arguments = $"{CompanyID} {InvoiceID}";
p.Start();
output = await p.StandardOutput.ReadToEndAsync();
await p.WaitForExitAsync();
}
catch (Exception ex)
{
System.IO.File.AppendAllText(_configuration["ReportLog"].ToString(), ex.ToString());
}
return Ok(output);
string base64= await _servReport.CreateImage(result, user?.RolUsers.First().Company.Logo==null ?"":Convert.ToBase64String(user?.RolUsers.First().Company.Logo), user?.RolUsers.First().Company.Name);
return Ok(base64);
}
}

View File

@@ -83,6 +83,7 @@ builder.Services.AddScoped<ServOrders>();
builder.Services.AddScoped<ServPricing>();
builder.Services.AddScoped<ServWalt>();
builder.Services.AddScoped<AUInvoicePayValidation>();
builder.Services.AddScoped<servReport>();
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
string origins = "OriginTaxPayer";
@@ -94,7 +95,7 @@ builder.Services.AddCors(options =>
policy.WithOrigins("https://localhost:7224", "http://localhost:5107"
, "http://195.88.208.142", "http://moadiran.ir"
, "https://195.88.208.142", "https://moadiran.ir"
, "https://195.88.208.142:440", "https://moadiran.ir:440")
, "https://195.88.208.142:440", "https://moadiran.ir:440", "https://localhost:44346")
.AllowAnyHeader()
.WithHeaders(HeaderNames.ContentType)
.AllowAnyMethod();

View File

@@ -1,33 +1,24 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:24292",
"sslPort": 44346
}
},
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5271",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5271"
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7075;http://localhost:5271",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7075;http://localhost:5271"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -37,5 +28,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50659/",
"sslPort": 44391
}
}
}

268
Back/Services/servReport.cs Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -34,10 +34,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
// Server
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
//Home
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//farzan
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });