...
This commit is contained in:
@@ -22,6 +22,14 @@ namespace Back.Controllers
|
||||
_servCompany = servCompany;
|
||||
_servTaxPayer = servTaxPayer;
|
||||
}
|
||||
[HttpGet("GetCompany")]
|
||||
public async Task<ActionResult<CompanyDTO>> GetCompany()
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
return Ok(await _servCompany.GetCompany(user.RolUsers.First().CompanyID));
|
||||
}
|
||||
[HttpPost("ChangeLogo")]
|
||||
public async Task<ActionResult<bool>> ChangeLogo(byte[] logo)
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Common;
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Back.Validations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -36,6 +37,32 @@ namespace Back.Controllers
|
||||
return Ok(await _servCus.GetCustomers(user.RolUsers.First().CompanyID, itemSerch));
|
||||
|
||||
|
||||
}
|
||||
[HttpGet("GetCustomer/{ID}")]
|
||||
public async Task<ActionResult<RCustomer>> GetCustomer(int ID)
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var cus = await _servCus.GetCustomerByCustomerID(ID, user.RolUsers.First().CompanyID);
|
||||
return Ok(new RCustomer
|
||||
{
|
||||
Address = cus.Address,
|
||||
BranchID = cus.BranchID,
|
||||
CustomerType = cus.CustomerType,
|
||||
CustomerTypeTitle = cus.CustomerType.GetEnumDisplayName(),
|
||||
EconomicCode = cus.EconomicCode,
|
||||
Email = cus.Email,
|
||||
FullName = cus.FullName,
|
||||
ID = ID,
|
||||
Info = cus.Info,
|
||||
MeliCode = cus.MeliCode,
|
||||
PassportNumber = cus.PassportNumber,
|
||||
Phone = cus.Phone,
|
||||
ZipCode = cus.ZipCode
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
[HttpGet("GetAllForidName")]
|
||||
public async Task<ActionResult<List<ForCustomerSearch>>> GetAllForSearch()
|
||||
|
@@ -440,10 +440,10 @@ namespace Back.Controllers
|
||||
{
|
||||
return Ok(await _servTaxPayer.GetPatterns());
|
||||
}
|
||||
[HttpGet("GetReport")]
|
||||
public IActionResult GetReport()
|
||||
[HttpGet("GetReport/{InvoiceID}")]
|
||||
public IActionResult GetReport(int InvoiceID)
|
||||
{
|
||||
var reportPath = $"Reports\\TwoSimpleLists.mrt";
|
||||
var reportPath = $"Reports\\invoice.mrt";
|
||||
var bytes = System.IO.File.ReadAllBytes(reportPath);
|
||||
return new FileContentResult(bytes, "application/xml");
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ namespace Back.Controllers
|
||||
|
||||
else
|
||||
{
|
||||
if (!result.PatternID.HasValue)
|
||||
if (!result.PatternID.HasValue || result.PatternID==0)
|
||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
|
||||
if (result.invoiceType == InvoiceType.Bidding)
|
||||
|
@@ -6,6 +6,7 @@ using Back.Services;
|
||||
using Back.Validations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Text;
|
||||
using TaxPayer.Infrastructure.Persistence;
|
||||
@@ -85,6 +86,7 @@ builder.Services.AddCors(options =>
|
||||
{
|
||||
policy.WithOrigins("https://localhost:7224", "http://localhost:5107")
|
||||
.AllowAnyHeader()
|
||||
.WithHeaders(HeaderNames.ContentType)
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
1599
Back/Reports/Invoice.mrt
Normal file
1599
Back/Reports/Invoice.mrt
Normal file
File diff suppressed because it is too large
Load Diff
2001
Back/Reports/invoice1.mrt
Normal file
2001
Back/Reports/invoice1.mrt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,8 @@ namespace Front
|
||||
private List<ForCustomerSearch>? Cus=null;
|
||||
private List<IdName<int>>? Patterns = null;
|
||||
private List<CODIdName<int>>? Cods = null;
|
||||
private CompanyDTO? InfoCompany = null;
|
||||
public InvoiceDTO? invoice { get; set; }=null;
|
||||
public Fixedvalues(HttpClientController hc)
|
||||
{
|
||||
_hc = hc;
|
||||
@@ -58,5 +60,18 @@ namespace Front
|
||||
|
||||
return Patterns;
|
||||
}
|
||||
public async Task<CompanyDTO?> GetInfoCompany()
|
||||
{
|
||||
|
||||
if (InfoCompany == null)
|
||||
{
|
||||
var rspCompany = await _hc.Get($"Company/GetCompany");
|
||||
if (rspCompany.IsSuccessStatusCode)
|
||||
InfoCompany = await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>();
|
||||
}
|
||||
|
||||
|
||||
return InfoCompany;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,28 +1,172 @@
|
||||
<PageTitle>صورتحساب</PageTitle>
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@using Stimulsoft.Base
|
||||
@using Stimulsoft.Report
|
||||
@using Stimulsoft.Report.Blazor
|
||||
@inject Fixedvalues fv;
|
||||
@inject HttpClientController hc;
|
||||
@layout EmptyLayout
|
||||
@page "/InvoiceReport/{InvoiceID:int}"
|
||||
<StiBlazorViewer Report="@Report" />
|
||||
|
||||
@code {
|
||||
|
||||
public CompanyDTO? company { get; set; }
|
||||
private StiReport Report;
|
||||
[Parameter] public int InvoiceID { get; set; }
|
||||
private int[] NoArray = default;
|
||||
private int[] ItemArray = new int[] { 1011, 1012 };
|
||||
private string[] ItemNArray = new string[] { "کالا 1", "کالا 2" };
|
||||
private int[] amArray = new int[] { 1, 2 };
|
||||
private string[] UnitNArray = new string[] { "1011", "1012" };
|
||||
private string[] feeArray = new string[] { "کالا 1", "کالا 2" };
|
||||
private string[] prdisArray = new string[] { "", "" };
|
||||
private string[] disArray = new string[] { "1011", "1012" };
|
||||
private string[] adisArray = new string[] { "کالا 1", "کالا 2" };
|
||||
private string[] vamArray = new string[] { " 1, 2" };
|
||||
private string[] tsstamArray = new string[] { "1011", "1012" };
|
||||
private string[] vraArray = new string[] { "کالا 1", "کالا 2" };
|
||||
|
||||
|
||||
protected async override Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
if (fv.invoice==null)
|
||||
{
|
||||
hc._nav.NavigateTo($"InvoiceDetails/{InvoiceID}");
|
||||
}
|
||||
string CustomerName = "";
|
||||
string CustomerEconomicCode = "";
|
||||
string CustomerPhone = "";
|
||||
string CompanyName = "";
|
||||
string CompanyEconomicCode = "";
|
||||
string CompanyPhone = "";
|
||||
var cus =await GetCus();
|
||||
if (cus!=null)
|
||||
{
|
||||
CustomerName = cus?.FullName;
|
||||
CustomerEconomicCode = cus?.EconomicCode;
|
||||
CustomerPhone = cus?.Phone;
|
||||
}
|
||||
var company =await GetCompany();
|
||||
if (company != null)
|
||||
{
|
||||
CompanyName = company?.Name;
|
||||
CompanyEconomicCode = company?.EconomicCode;
|
||||
CompanyPhone = company?.Phone;
|
||||
}
|
||||
//datasource
|
||||
NoArray = Enumerable
|
||||
.Repeat(1, (int)((fv.invoice.items.Count() - 1) / 1) + 1)
|
||||
.Select((tr, ti) => Convert.ToInt32(tr + (1 * ti)))
|
||||
.ToArray();
|
||||
ItemArray = fv.invoice.items.Select(s => s.CODID).ToArray();
|
||||
ItemNArray = fv.invoice.items.Select(s => s.sstt).ToArray();
|
||||
amArray = fv.invoice.items.Select(s => Convert.ToInt32(s.am)).ToArray();
|
||||
UnitNArray= fv.invoice.items.Select(s => s.mu).ToArray();
|
||||
feeArray = fv.invoice.items.Select(s => s.fee.ToString("N0")).ToArray();
|
||||
prdisArray = fv.invoice.items.Select(s => s.prdis?.ToString("N0")).ToArray();
|
||||
disArray = fv.invoice.items.Select(s => s.dis?.ToString("N0")).ToArray();
|
||||
adisArray = fv.invoice.items.Select(s => s.adis?.ToString("N0")).ToArray();
|
||||
vamArray = fv.invoice.items.Select(s => s.vam?.ToString("N0")).ToArray();
|
||||
tsstamArray = fv.invoice.items.Select(s => s.tsstam?.ToString("N0")).ToArray();
|
||||
vraArray = fv.invoice.items.Select(s => s.vra?.ToString("N0")).ToArray();
|
||||
|
||||
//Create empty report object
|
||||
this.Report = new StiReport();
|
||||
|
||||
|
||||
//Load report template
|
||||
var reportBytes = await hc._hc.GetByteArrayAsync("Invoice/GetReport");
|
||||
|
||||
var reportBytes = await hc._hc.GetByteArrayAsync($"Invoice/GetReport/{InvoiceID}");
|
||||
|
||||
|
||||
//Set value
|
||||
Report["InvoiceID"] = fv.invoice?.ID;
|
||||
Report["invoicedate"] = fv.invoice?.InvoiceDate;
|
||||
Report["CusName"] = CustomerName;
|
||||
Report["CusEconomicCode"] = CustomerEconomicCode;
|
||||
Report["CusPhone"] = CustomerPhone;
|
||||
Report["CompanyName"] = CompanyName;
|
||||
Report["CompanyEconomicCode"] = CompanyEconomicCode;
|
||||
Report["CompanyPhone"] = CompanyPhone;
|
||||
|
||||
// var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}");
|
||||
// if (rspCustomer.IsSuccessStatusCode)
|
||||
// Cus = await rspCustomer.Content.ReadFromJsonAsync<RCustomer>();
|
||||
|
||||
// var rspCompany = await hc.Get($"Company/GetCompany");
|
||||
// if (rspCompany.IsSuccessStatusCode)
|
||||
// company = await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Report["cusname"] = CustomerName;
|
||||
|
||||
|
||||
|
||||
this.Report.Load(reportBytes);
|
||||
|
||||
//Create User Data
|
||||
var stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData();
|
||||
stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] {
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("No", "No", "No", typeof(int), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("Item", "Item", "Item", typeof(int), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("ItemN", "ItemN", "ItemN", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("am", "am", "am", typeof(int), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("UnitN", "UnitN", "UnitN", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("fee", "fee", "fee", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("prdis", "prdis", "prdis", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("dis", "dis", "dis", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("adis", "adis", "adis", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("vam", "vam", "vam", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("tsstam", "tsstam", "tsstam", typeof(string), null),
|
||||
new Stimulsoft.Report.Dictionary.StiDataColumn("vra", "vra", "vra", typeof(string), null)
|
||||
|
||||
});
|
||||
stiUserData1.Count = fv.invoice.items.Count();
|
||||
stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(stiUserData1_GetData);
|
||||
|
||||
//Register new data in the report template
|
||||
this.Report.RegData("Items", stiUserData1);
|
||||
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void stiUserData1_GetData(object sender, Stimulsoft.Report.Dictionary.StiUserGetDataEventArgs e)
|
||||
{
|
||||
if (e.ColumnName == "No") e.Data = NoArray[e.Position];
|
||||
if (e.ColumnName == "Item") e.Data = ItemArray[e.Position];
|
||||
if (e.ColumnName == "ItemN") e.Data = ItemNArray[e.Position];
|
||||
if (e.ColumnName == "am") e.Data = amArray[e.Position];
|
||||
if (e.ColumnName == "UnitN") e.Data = UnitNArray[e.Position];
|
||||
if (e.ColumnName == "fee") e.Data = feeArray[e.Position];
|
||||
if (e.ColumnName == "prdis") e.Data = prdisArray[e.Position];
|
||||
if (e.ColumnName == "dis") e.Data = disArray[e.Position];
|
||||
if (e.ColumnName == "adis") e.Data = adisArray[e.Position];
|
||||
if (e.ColumnName == "vam") e.Data = vamArray[e.Position];
|
||||
if (e.ColumnName == "tsstam") e.Data = tsstamArray[e.Position];
|
||||
if (e.ColumnName == "vra") e.Data = vraArray[e.Position];
|
||||
}
|
||||
|
||||
}
|
||||
@functions{
|
||||
private async Task<RCustomer?> GetCus()
|
||||
{
|
||||
var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}");
|
||||
if (rspCustomer.IsSuccessStatusCode)
|
||||
return await rspCustomer.Content.ReadFromJsonAsync<RCustomer>();
|
||||
else return null;
|
||||
}
|
||||
private async Task<CompanyDTO?> GetCompany()
|
||||
{
|
||||
var rspCompany = await hc.Get($"Company/GetCompany");
|
||||
if (rspCompany.IsSuccessStatusCode)
|
||||
return await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>();
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
@@ -89,11 +89,13 @@
|
||||
if (invoice.InvoiceSendTaxs.Any(a=>a.InvoiceType==invoice.invoiceType
|
||||
&& a.SentStatus==SentStatus.Send))
|
||||
{
|
||||
SendInvoice = false;
|
||||
<h6 >این صورتحساب با این وضعیت به سامانه مودیان ارسال شده ،برای اطلاع از وضعیت لطفا تعیین وضعیت کنید</h6>
|
||||
}
|
||||
else if (invoice.InvoiceSendTaxs.Any(a => a.InvoiceType == invoice.invoiceType
|
||||
&& a.SentStatus == SentStatus.Successful))
|
||||
{
|
||||
SendInvoice = false;
|
||||
<h6>
|
||||
این صورتحساب با این وضعیت به سامانه مودیان ارسال و تائید شده
|
||||
</h6>
|
||||
@@ -107,6 +109,7 @@
|
||||
else if (invoice.InvoiceSendTaxs.Any(a => a.InvoiceType == invoice.invoiceType
|
||||
&& (a.SentStatus == SentStatus.pending || a.SentStatus == SentStatus.IN_PROGRESS)))
|
||||
{
|
||||
SendInvoice = false;
|
||||
<h6 >
|
||||
این صورتحساب با این وضعیت به سامانه مودیان ارسال و در حال بررسی می باشد
|
||||
</h6>
|
||||
@@ -114,6 +117,7 @@
|
||||
else if (invoice.InvoiceSendTaxs.Any(a => a.InvoiceType == invoice.invoiceType
|
||||
&& (a.SentStatus == SentStatus.NOT_FOUND || a.SentStatus == SentStatus.Unknown)))
|
||||
{
|
||||
SendInvoice = false;
|
||||
<h6 >
|
||||
این صورتحساب با این وضعیت به سامانه مودیان ارسال شده ولی وضعیت آن مشخص نیست
|
||||
</h6>
|
||||
@@ -327,9 +331,9 @@
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
@* <Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
||||
<Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
||||
چاپ
|
||||
</Button> *@
|
||||
</Button>
|
||||
|
||||
}
|
||||
}
|
||||
@@ -379,10 +383,10 @@
|
||||
public List<ForCustomerSearch>? Cus { get; set; }
|
||||
public List<IdName<int>>? Patterns { get; set; }
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
fv.invoice = null;
|
||||
invoice = new InvoiceDTO();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
@@ -466,6 +470,7 @@
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
{
|
||||
|
||||
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
||||
}
|
||||
}
|
||||
@@ -473,6 +478,7 @@
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
{
|
||||
fv.invoice = invoice;
|
||||
hc._nav.NavigateTo($"InvoiceReport/{InvoiceID}");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user