...
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Back.Controllers
|
|||||||
_servInvoice = servInvoice;
|
_servInvoice = servInvoice;
|
||||||
_servUser = servUser;
|
_servUser = servUser;
|
||||||
_validationInvoice = validationInvoice;
|
_validationInvoice = validationInvoice;
|
||||||
_configuration=configuration;
|
_configuration = configuration;
|
||||||
_servTaxPayer = servTaxPayer;
|
_servTaxPayer = servTaxPayer;
|
||||||
_rptQueueRepository = rptQueueRepository;
|
_rptQueueRepository = rptQueueRepository;
|
||||||
|
|
||||||
@@ -475,63 +475,27 @@ namespace Back.Controllers
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
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());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
// 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();
|
|
||||||
return Ok(output);
|
|
||||||
}
|
|
||||||
[HttpPut("SetExternalAccessCode/{InvoiceID}")]
|
|
||||||
public async Task<ActionResult<string>> SetExternalAccessCode(int InvoiceID)
|
|
||||||
{ //-----GetUserAndCompany
|
|
||||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
|
||||||
var UserID = claim.Value;
|
|
||||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
|
||||||
|
|
||||||
var code = DateTime.Now.ToString($"yMMdd{InvoiceID}Hmmss{user.RolUsers.First().CompanyID}");
|
|
||||||
Invoice? Invoice = await _servInvoice.GetInvoiceByInvoiceID(user.RolUsers.First().CompanyID, InvoiceID);
|
|
||||||
if (Invoice == null) return NotFound();
|
|
||||||
if (!string.IsNullOrEmpty(Invoice.ExternalAccessCode))
|
|
||||||
return Ok(Invoice.ExternalAccessCode);
|
|
||||||
|
|
||||||
Invoice.ExternalAccessCode = code;
|
|
||||||
if (await _servInvoice.UpdateInvoice(Invoice))
|
|
||||||
return Ok(code.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
return BadRequest(new List<string> { "خطایی سرور" });
|
|
||||||
|
|
||||||
}
|
|
||||||
[HttpGet("GetReportByExternalAccessCode/{xternalAccessCode}")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<ActionResult<string>> GetReportByExternalAccessCode(string ExternalAccessCode)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(ExternalAccessCode))
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
string output = "";
|
|
||||||
var invoice = await _servInvoice.GetInvoiceByExternalAccessCode(ExternalAccessCode);
|
|
||||||
if (invoice == null)
|
|
||||||
return NotFound();
|
|
||||||
|
|
||||||
// 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 = "C:\\CreateReport\\CreateReport.exe";
|
|
||||||
p.StartInfo.Arguments = $"{invoice.CompanyID} {invoice.ID}";
|
|
||||||
p.Start();
|
|
||||||
output = p.StandardOutput.ReadToEnd();
|
|
||||||
p.WaitForExit();
|
|
||||||
return Ok(output);
|
return Ok(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -97,7 +97,7 @@ namespace Back.Data.Models
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region fild
|
#region fild
|
||||||
public string? ExternalAccessCode { get; set; }
|
// public string? ExternalAccessCode { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string? Des { get; set; }
|
public string? Des { get; set; }
|
||||||
public InvoiceType invoiceType { get; set; }
|
public InvoiceType invoiceType { get; set; }
|
||||||
|
@@ -34,7 +34,7 @@ namespace Back.Services
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
//-----------------------
|
//-----------------------
|
||||||
return await invok
|
return await invok
|
||||||
.Include(inc => inc.invoiceDetails)
|
.Include(inc => inc.invoiceDetails)
|
||||||
.ThenInclude(inc => inc.cODItem)
|
.ThenInclude(inc => inc.cODItem)
|
||||||
.ThenInclude(inc => inc.CODUnit)
|
.ThenInclude(inc => inc.CODUnit)
|
||||||
@@ -43,7 +43,7 @@ namespace Back.Services
|
|||||||
.Include(inc => inc.pattern)
|
.Include(inc => inc.pattern)
|
||||||
.Select(s => new InvoiceDTO()
|
.Select(s => new InvoiceDTO()
|
||||||
{
|
{
|
||||||
ExternalAccessCode=s.ExternalAccessCode,
|
// ExternalAccessCode=s.ExternalAccessCode,
|
||||||
IsDeleted=s.IsDeleted,
|
IsDeleted=s.IsDeleted,
|
||||||
PatternID = s.PatternID,
|
PatternID = s.PatternID,
|
||||||
PatternTitle = s.pattern.Title,
|
PatternTitle = s.pattern.Title,
|
||||||
@@ -105,6 +105,7 @@ namespace Back.Services
|
|||||||
,
|
,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
||||||
{
|
{
|
||||||
@@ -162,11 +163,7 @@ namespace Back.Services
|
|||||||
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
public async Task<Invoice> GetInvoiceByExternalAccessCode( string ExternalAccessCode)
|
|
||||||
{
|
|
||||||
return await _invoiceRepo.Get(w => w.ExternalAccessCode == ExternalAccessCode && !w.IsDeleted).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
||||||
{
|
{
|
||||||
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||||
|
@@ -12,5 +12,6 @@
|
|||||||
"Fixedvalues": {
|
"Fixedvalues": {
|
||||||
"Jwt_Lifetime_Minutes": "144000"
|
"Jwt_Lifetime_Minutes": "144000"
|
||||||
},
|
},
|
||||||
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe"
|
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
|
||||||
|
"ReportLog": "E:\\Report\\log.txt"
|
||||||
}
|
}
|
||||||
|
@@ -13,5 +13,5 @@
|
|||||||
"Jwt_Lifetime_Minutes": "144000"
|
"Jwt_Lifetime_Minutes": "144000"
|
||||||
},
|
},
|
||||||
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
|
"CreateReportFileName": "E:\\CreateReport\\CreateReport.exe",
|
||||||
"rptQueue": "E:\\Report\\ResponseQueue"
|
"ReportLog": "E:\\Report\\log.txt"
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ namespace Shared.DTOs
|
|||||||
public decimal? tbill { get; set; }
|
public decimal? tbill { get; set; }
|
||||||
public int? BillReference { get; set; }
|
public int? BillReference { get; set; }
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted { get; set; }
|
||||||
public string? ExternalAccessCode { get; set; }
|
//public string? ExternalAccessCode { get; set; }
|
||||||
public ICollection<InvoiceItemDTO> items { get; set; }=new List<InvoiceItemDTO>();
|
public ICollection<InvoiceItemDTO> items { get; set; }=new List<InvoiceItemDTO>();
|
||||||
public ICollection<InvoicePaymentDTO> payments { get; set; } = new List<InvoicePaymentDTO>();
|
public ICollection<InvoicePaymentDTO> payments { get; set; } = new List<InvoicePaymentDTO>();
|
||||||
// public ICollection<InvoiceStatusDto> Invoicestatuschanges { get; set; }
|
// public ICollection<InvoiceStatusDto> Invoicestatuschanges { get; set; }
|
||||||
|
@@ -4,17 +4,16 @@
|
|||||||
<Preload LoadingText="در حال بارگذاری..." />
|
<Preload LoadingText="در حال بارگذاری..." />
|
||||||
<Toasts class="p-3" Messages="messages" Placement="ToastsPlacement.MiddleCenter" />
|
<Toasts class="p-3" Messages="messages" Placement="ToastsPlacement.MiddleCenter" />
|
||||||
@layout EmptyLayout
|
@layout EmptyLayout
|
||||||
@page "/InvoiceReport/{ExternalAccessCode}"
|
@page "/InvoiceReport/{InvoiceID:int}"
|
||||||
@using Front.Services
|
@using Front.Services
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||||
List<ToastMessage> messages = new List<ToastMessage>();
|
List<ToastMessage> messages = new List<ToastMessage>();
|
||||||
[Parameter] public string ExternalAccessCode { get; set; }
|
[Parameter] public int? InvoiceID { get; set; }
|
||||||
protected async override Task OnParametersSetAsync()
|
protected async override Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(ExternalAccessCode))
|
await ShowReport();
|
||||||
await ShowReport();
|
|
||||||
await base.OnParametersSetAsync();
|
await base.OnParametersSetAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,22 +30,31 @@
|
|||||||
};
|
};
|
||||||
private async Task ShowReport()
|
private async Task ShowReport()
|
||||||
{
|
{
|
||||||
PreloadService.Show(SpinnerColor.Dark);
|
if (InvoiceID != null && InvoiceID > 0)
|
||||||
var rsp = await hc.Get($"Invoice/GetReportByExternalAccessCode/{ExternalAccessCode}");
|
|
||||||
if (rsp.IsSuccessStatusCode)
|
|
||||||
{
|
{
|
||||||
var str = await rsp.Content.ReadAsStringAsync();
|
|
||||||
if (string.IsNullOrEmpty(str))
|
PreloadService.Show(SpinnerColor.Dark);
|
||||||
ShowMessage(ToastType.Warning, "مشکلی در ساخت فایل رخ داده لطفا مجدد تلاش کنید");
|
var rsp = await hc.Get($"Invoice/GetReport/{InvoiceID}");
|
||||||
else
|
if (rsp.IsSuccessStatusCode)
|
||||||
await DownloadFileFromStream(str, $"{ExternalAccessCode}.pdf");
|
{
|
||||||
|
var str = await rsp.Content.ReadAsStringAsync();
|
||||||
|
if (string.IsNullOrEmpty(str))
|
||||||
|
ShowMessage(ToastType.Warning, "مشکلی در ساخت فایل رخ داده لطفا مجدد تلاش کنید");
|
||||||
|
else
|
||||||
|
await DownloadFileFromStream(str, $"{InvoiceID}.pdf");
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||||
|
ShowMessage(ToastType.Warning, "فاکتوری یافت نشد");
|
||||||
|
|
||||||
|
else ShowMessage(ToastType.Warning, "خطایی در چاپ فاکتور");
|
||||||
|
|
||||||
|
PreloadService.Hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
else hc._nav.NavigateTo("Invoice");
|
||||||
ShowMessage(ToastType.Warning, "فاکتوری یافت نشد");
|
|
||||||
|
|
||||||
else ShowMessage(ToastType.Warning, "خطایی در چاپ فاکتور");
|
|
||||||
|
|
||||||
PreloadService.Hide();
|
|
||||||
}
|
}
|
||||||
//for download
|
//for download
|
||||||
private Stream GetFileStream(byte[] bytes)
|
private Stream GetFileStream(byte[] bytes)
|
||||||
|
@@ -343,7 +343,7 @@
|
|||||||
<Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
||||||
pdf
|
pdf
|
||||||
</Button>
|
</Button>
|
||||||
<Button class="mt-3" Color="ButtonColor.Info" @onclick="onClickExternalAccessCode" Type="ButtonType.Button">
|
<Button class="mt-3" Color="ButtonColor.Info" @onclick="onClickLink" Type="ButtonType.Button">
|
||||||
لینک
|
لینک
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
@@ -489,43 +489,14 @@
|
|||||||
{
|
{
|
||||||
if (InvoiceID.HasValue)
|
if (InvoiceID.HasValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async Task onClickExternalAccessCode()
|
private async Task onClickLink()
|
||||||
{
|
{
|
||||||
|
|
||||||
PreloadService.Show(SpinnerColor.Dark);
|
ExUrl = $"{fv.Domin}/InvoiceReport/" + InvoiceID;
|
||||||
if (!string.IsNullOrEmpty(invoice.ExternalAccessCode))
|
await Codemodal.ShowAsync();
|
||||||
{
|
|
||||||
ExUrl = $"{fv.Domin}/InvoiceReport/" + invoice.ExternalAccessCode;
|
|
||||||
await Codemodal.ShowAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var rsp = await hc.Put($"Invoice/SetExternalAccessCode/{InvoiceID}");
|
|
||||||
if (rsp.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
var str = await rsp.Content.ReadAsStringAsync();
|
|
||||||
if (string.IsNullOrEmpty(str))
|
|
||||||
ShowDangerAlert("مشکلی در ساخت فایل رخ داده لطفا مجدد تلاش کنید");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExUrl = $"{fv.Domin}/InvoiceReport/" + str;
|
|
||||||
await Codemodal.ShowAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
|
||||||
ShowDangerAlert(request[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PreloadService.Hide();
|
|
||||||
}
|
}
|
||||||
private async Task ShowReport()
|
private async Task ShowReport()
|
||||||
{
|
{
|
||||||
|
@@ -37,10 +37,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
|||||||
//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("http://195.88.208.142:7075/api/") });
|
||||||
|
|
||||||
//Home
|
//Home
|
||||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||||
|
|
||||||
//farzan
|
//farzan
|
||||||
//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/") });
|
||||||
|
|
||||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user