...
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Stimulsoft.Reports.Blazor" Version="2024.2.5" />
|
||||
<PackageReference Include="Blazor.Bootstrap" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
|
||||
|
7
TaxPayerFull/Layout/EmptyLayout.razor
Normal file
7
TaxPayerFull/Layout/EmptyLayout.razor
Normal file
@@ -0,0 +1,7 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
@Body
|
||||
</div>
|
||||
</div>
|
@@ -49,6 +49,7 @@
|
||||
|
||||
@code {
|
||||
[Parameter] public int InvoiceID { get; set; }
|
||||
[Parameter] public bool IsDeleted { get; set; }
|
||||
[Parameter] public EventCallback<string> OnMultipleOfThree { get; set; }
|
||||
[Parameter] public IEnumerable<InvoiceItemDTO> InvoiceItems { get; set; }
|
||||
private Modal modal = default!;
|
||||
@@ -61,14 +62,18 @@
|
||||
}
|
||||
private async Task OnRowClick(GridRowEventArgs<InvoiceItemDTO> args)
|
||||
{
|
||||
var parameters = new Dictionary<string, object>();
|
||||
if (!IsDeleted)
|
||||
{
|
||||
var parameters = new Dictionary<string, object>();
|
||||
|
||||
|
||||
parameters.Add("itemDTO", args.Item);
|
||||
parameters.Add("InvoiceID", InvoiceID);
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBack));
|
||||
await modal.ShowAsync<CUSComponent.InvoiceItem>(title: "ویرایش اطلاعات", parameters: parameters);
|
||||
parameters.Add("itemDTO", args.Item);
|
||||
parameters.Add("InvoiceID", InvoiceID);
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBack));
|
||||
await modal.ShowAsync<CUSComponent.InvoiceItem>(title: "ویرایش اطلاعات", parameters: parameters);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task CallBack(ActionInResultComponent result)
|
||||
|
28
TaxPayerFull/Pages/InvoiceReport.razor
Normal file
28
TaxPayerFull/Pages/InvoiceReport.razor
Normal file
@@ -0,0 +1,28 @@
|
||||
<PageTitle>صورتحساب</PageTitle>
|
||||
@using Front.Services
|
||||
@using Stimulsoft.Base
|
||||
@using Stimulsoft.Report
|
||||
@using Stimulsoft.Report.Blazor
|
||||
@inject HttpClientController hc;
|
||||
@layout EmptyLayout
|
||||
@page "/InvoiceReport/{InvoiceID:int}"
|
||||
<StiBlazorViewer Report="@Report" />
|
||||
|
||||
@code {
|
||||
|
||||
private StiReport Report;
|
||||
[Parameter] public int InvoiceID { get; set; }
|
||||
protected async override Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
//Create empty report object
|
||||
this.Report = new StiReport();
|
||||
|
||||
//Load report template
|
||||
var reportBytes = await hc._hc.GetByteArrayAsync("Invoice/GetReport");
|
||||
|
||||
this.Report.Load(reportBytes);
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
}
|
@@ -22,6 +22,9 @@
|
||||
<div class="col-md-1">
|
||||
<input @bind-value="itemsearch.InvoiceID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input @bind-value="itemsearch.refInvoiceID" placeholder="شناسه مرجع" style="text-align:center;" class="form-control" type="text">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select @bind="ItemSearchInvoicetype" class="form-control" aria-label="Default select example">
|
||||
<option value="100" style="color: #b5b5b5" selected>نوع صورتحساب...</option>
|
||||
|
@@ -1,6 +1,8 @@
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@using Shared
|
||||
|
||||
|
||||
@inject HttpClientController hc;
|
||||
@layout PanelLayout
|
||||
@inject Fixedvalues fv;
|
||||
@@ -10,6 +12,15 @@
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
|
||||
|
||||
|
||||
|
||||
@if (invoice.IsDeleted)
|
||||
{
|
||||
<h1 style="color:red">این صورتحساب حذف شده و در دسترس نمی باشد</h1>
|
||||
<br />
|
||||
<hr class="hr" />
|
||||
}
|
||||
<form>
|
||||
@* alert *@
|
||||
<div class="row">
|
||||
@@ -19,7 +30,7 @@
|
||||
</Alert>
|
||||
|
||||
</div>
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true && !invoice.IsDeleted)
|
||||
{
|
||||
<div class="row g-3">
|
||||
|
||||
@@ -27,31 +38,31 @@
|
||||
@switch (invoice.invoiceType)
|
||||
{
|
||||
case(InvoiceType.Bidding):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Sale)" id="cut"><span>فاکتور</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Sale)" id="cut"><span>فاکتور</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred1"><span>ابطال</span></Button>
|
||||
break;
|
||||
|
||||
case (InvoiceType.Sale):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)" id="copy"><span>برگشت فروش</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Repair)" id="paste"><span>اصلاح</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.BackFrmSale)" id="copy"><span>برگشت فروش</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Repair)" id="paste"><span>اصلاح</span></Button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" id="sred1" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)"><span>لغو</span></Button> *@
|
||||
break;
|
||||
|
||||
case (InvoiceType.BackFrmSale):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)" id="sred1"><span>لغو</span></Button> *@
|
||||
break;
|
||||
|
||||
case (InvoiceType.Repair):
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||
<button class="button" id="copy" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)"><span>برگشت فروش</span></button>
|
||||
<Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.Cancellation)" id="sred"><span>ابطال</span></Button>
|
||||
@* <Button class="button" style="color:white;" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)" id="sred1"><span>لغو</span></Button> *@
|
||||
<Button class="button" style="color:white;" id="copy" @onclick="() => ChangeStatus((int)InvoiceType.BackFrmSale)"><span>برگشت فروش</span></Button>
|
||||
break;
|
||||
|
||||
case (InvoiceType.Cancellation):
|
||||
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||
break;
|
||||
@* case (InvoiceType.Cancellation):
|
||||
<Button class="button" style="color:white;" id="sred1" @onclick="() => ChangeStatus((int)InvoiceType.CANCEL)"><span>لغو</span></Button>
|
||||
break; *@
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +174,7 @@
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
||||
</div>
|
||||
</div>
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true )
|
||||
{
|
||||
<br /> <hr class="hr" />
|
||||
<div class="row g-3">
|
||||
@@ -174,15 +185,18 @@
|
||||
<div class="form-group col-md-11">
|
||||
@if (InvoiceID.HasValue && invoice.items.Count > 0)
|
||||
{
|
||||
<LGridInvoiceItem InvoiceID="InvoiceID.Value" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
<LGridInvoiceItem IsDeleted="invoice.IsDeleted" InvoiceID="InvoiceID.Value" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
|
||||
}
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
@if (!invoice.IsDeleted)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -236,35 +250,46 @@
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||
|
||||
</div>
|
||||
@* @if (invoice.BillReference.HasValue)
|
||||
{
|
||||
<div class="row g-3">
|
||||
<Button Color="ButtonColor.Link"><NavLink href="InvoiceDetails/@invoice.BillReference.Value">صورتحساب مرجع</NavLink></Button>
|
||||
</div>
|
||||
} *@
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<br />
|
||||
@if (InvoiceID == 0 || InvoiceID == null)
|
||||
@if (!invoice.IsDeleted)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
@if (InvoiceID == 0 || InvoiceID == null)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowReport" Type="ButtonType.Button">
|
||||
چاپ
|
||||
</Button>
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br />
|
||||
<div class="row g-3">
|
||||
@if (invoice.BillReference.HasValue)
|
||||
{
|
||||
<div class="row g-3">
|
||||
@{
|
||||
string Prefence = "InvoiceDetails/" + invoice.BillReference.Value.ToString();
|
||||
}
|
||||
<Button Color="ButtonColor.Link"><NavLink href="@Prefence">صورتحساب مرجع</NavLink></Button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -272,6 +297,7 @@
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
List<ToastMessage> messages = new List<ToastMessage>();
|
||||
private ConfirmDialog dialog = default!;
|
||||
private Modal modal = default!;
|
||||
@@ -285,9 +311,10 @@
|
||||
public List<ForCustomerSearch>? Cus { get; set; }
|
||||
public List<IdName<int>>? Patterns { get; set; }
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
invoice = new InvoiceDTO();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
@@ -344,15 +371,17 @@
|
||||
|
||||
|
||||
}
|
||||
private async Task ChangeStatus(InvoiceType type)
|
||||
private async Task ChangeStatus(int type)
|
||||
{
|
||||
var rsp = await hc.Post<InvoiceType>($"Invoice/ChangeInvoiceType/{InvoiceID}",type);
|
||||
|
||||
var rsp = await hc.Post($"Invoice/ChangeInvoiceType/{InvoiceID}?invoiceType={type}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var resinvoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
if (resinvoice!=null)
|
||||
{
|
||||
invoice = resinvoice;
|
||||
InvoiceID = resinvoice.ID;
|
||||
ShowSuccessAlert("تغییر وضعیت با موفقیت انجام شد");
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
@@ -362,20 +391,33 @@
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowReport()
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
{
|
||||
hc._nav.NavigateTo($"InvoiceReport/{InvoiceID}");
|
||||
}
|
||||
}
|
||||
private async Task LoadData()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}/{true}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else if(rsp.StatusCode==System.Net.HttpStatusCode.BadRequest)
|
||||
{
|
||||
ShowDangerAlert("صورتحساب مرجع یافت نشد");
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Panel");
|
||||
|
||||
{
|
||||
ShowDangerAlert("خطایی در بارگذاری");
|
||||
}
|
||||
PreloadService.Hide();
|
||||
}
|
||||
public async Task CallBack(ActionInResultComponent result)
|
||||
|
@@ -38,6 +38,15 @@ namespace Front.Services
|
||||
_nav.NavigateTo("/Sign-in/unon");
|
||||
return request;
|
||||
}
|
||||
public async Task<HttpResponseMessage> Post(string route)
|
||||
{
|
||||
var jsonString = "{\"appid\":1,\"platformid\":1,\"rating\":3}";
|
||||
var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
|
||||
var request = await _hc.PostAsync(route, httpContent);
|
||||
if (request.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
_nav.NavigateTo("/Sign-in/unon");
|
||||
return request;
|
||||
}
|
||||
public async Task<HttpResponseMessage> Put<T>(string route, T mode)
|
||||
{
|
||||
var request = await _hc.PutAsJsonAsync(route, mode);
|
||||
|
Reference in New Issue
Block a user