...
This commit is contained in:
@@ -52,6 +52,17 @@ namespace Back.Controllers
|
||||
|
||||
});
|
||||
}
|
||||
[HttpGet("GetVra/{ID}")]
|
||||
public async Task<ActionResult<decimal>> GetVra(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 cod = await _servCOD.GetCodByCodID(ID, user.RolUsers.First().CompanyID);
|
||||
if(cod!=null)
|
||||
return Ok(cod.TaxRate);
|
||||
return NotFound();
|
||||
}
|
||||
[HttpGet("GetAllForidName")]
|
||||
public async Task<ActionResult<List<CODIdName<int>>>> GetAllForidName()
|
||||
{
|
||||
|
@@ -234,40 +234,31 @@ namespace Back.Controllers
|
||||
//{
|
||||
// return BadRequest(new List<string> { $"صورتحساب در حالت {invoice.invoiceType.GetEnumDisplayName()} نمی تواند ویرایش شود" });
|
||||
//}
|
||||
if (invoice.invoiceType!=InvoiceType.Cancellation)
|
||||
{
|
||||
bool InvoiceHasaRemittanceBillReference = invoice.BillReference.HasValue && await _remittanceService.HasaRemittance(invoice.BillReference.Value);
|
||||
foreach (var item in invoice.invoiceDetails)
|
||||
{
|
||||
if (await _remittanceService.HasaRemittance(invoice.ID, item.CODID))
|
||||
{
|
||||
await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
|
||||
{
|
||||
CODID = item.CODID,
|
||||
Count = item.am.GetValueOrDefault(),
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
ForSale = true,
|
||||
InvoiceID = item.InvoiceID,
|
||||
Type = TypeReceipt.Shopping,
|
||||
info = $"حذف صورتحساب {item.InvoiceID}",
|
||||
//if (invoice.invoiceType!=InvoiceType.Cancellation)
|
||||
//{
|
||||
//bool InvoiceHasaRemittanceBillReference = invoice.BillReference.HasValue && await _remittanceService.HasaRemittance(invoice.BillReference.Value);
|
||||
await _receiptService.DeleteByInvoiceID(invoice.ID, user.RolUsers.First().CompanyID);
|
||||
await _remittanceService.DeleteByInvoiceID(invoice.ID,user.RolUsers.First().CompanyID);
|
||||
//foreach (var item in invoice.invoiceDetails)
|
||||
//{
|
||||
// if (await _remittanceService.HasaRemittance(invoice.ID, item.CODID))
|
||||
// {
|
||||
// await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
|
||||
// {
|
||||
// CODID = item.CODID,
|
||||
// Count = item.am.GetValueOrDefault(),
|
||||
// Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
// ForSale = true,
|
||||
// InvoiceID = item.InvoiceID,
|
||||
// Type = TypeReceipt.Shopping,
|
||||
// info = $"حذف صورتحساب {item.InvoiceID}",
|
||||
|
||||
}, user.RolUsers.First().CompanyID, true);
|
||||
// }, user.RolUsers.First().CompanyID, true);
|
||||
|
||||
//if (invoice.BillReference.HasValue && InvoiceHasaRemittanceBillReference)
|
||||
//{
|
||||
// await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
|
||||
// {
|
||||
// CODID = item.CODID,
|
||||
// Count = item.am.GetValueOrDefault(),
|
||||
// Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
// InvoiceID = invoice.BillReference.Value,
|
||||
// Type = TypeRemittance.Sale,
|
||||
// info = $"حواله خودکار از صورتحساب {invoice.BillReference.Value}",
|
||||
// });
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
invoice.LastChangeUserID = Convert.ToInt32(UserID);
|
||||
//----Update and sendResult
|
||||
|
@@ -100,6 +100,7 @@ namespace Back.Controllers
|
||||
|
||||
return Ok(await _servInvoiceItem.Add(new InvoiceItem
|
||||
{
|
||||
vra=model.item.vra,
|
||||
am = model.item.am,
|
||||
fee = model.item.fee,
|
||||
dis = model.item.dis,
|
||||
@@ -196,6 +197,7 @@ namespace Back.Controllers
|
||||
invoiceitem.fee = model.item.fee;
|
||||
invoiceitem.dis = model.item.dis;
|
||||
invoiceitem.CODID = model.item.CODID;
|
||||
invoiceitem.vra = model.item.vra;
|
||||
}
|
||||
|
||||
if (await _servInvoice.UpdateInvoice(invoice))
|
||||
|
@@ -64,18 +64,16 @@ namespace Back.Data.Models
|
||||
//مبلغ قبل از تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? prdis { get { return am * fee; } }
|
||||
//نرخ مالیات بر ازش افزوده
|
||||
[MaxLength(5)]
|
||||
public decimal? vra { get { return
|
||||
//صادرات مالیات ندارد
|
||||
invoice?.pattern?.ID == 10 ? 0
|
||||
:cODItem != null ? cODItem.TaxRate
|
||||
: null; } }
|
||||
|
||||
|
||||
//واحد اندازه گیری عنوان
|
||||
public string? unitTitle { get { return cODItem!=null ? cODItem.CODUnit.Title : null; } }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
//نرخ مالیات بر ازش افزوده
|
||||
[MaxLength(5)]
|
||||
public decimal? vra { get; set; }
|
||||
//تعداد/مقدار
|
||||
[MaxLength(36)]
|
||||
public decimal? am { get; set; }
|
||||
|
2090
Back/Migrations/20250125085346_invoicetb.Designer.cs
generated
Normal file
2090
Back/Migrations/20250125085346_invoicetb.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
Back/Migrations/20250125085346_invoicetb.cs
Normal file
32
Back/Migrations/20250125085346_invoicetb.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Back.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class invoicetb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "vra",
|
||||
table: "InvoiceItems",
|
||||
type: "decimal(18,2)",
|
||||
maxLength: 5,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "vra",
|
||||
table: "InvoiceItems");
|
||||
}
|
||||
}
|
||||
}
|
@@ -584,6 +584,7 @@ namespace Back.Migrations
|
||||
b.Property<decimal?>("_cfee")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
|
||||
b.Property<decimal?>("am")
|
||||
.HasMaxLength(36)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
@@ -668,6 +669,10 @@ namespace Back.Migrations
|
||||
.HasMaxLength(18)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal?>("vra")
|
||||
.HasMaxLength(5)
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CODID");
|
||||
|
@@ -33,7 +33,7 @@ namespace Back.Services
|
||||
public int? Inp { get { return _invoice.inp ?? 1; } }
|
||||
public int? Ins { get { return _invoice.ins ?? 1; } }
|
||||
public string? Tins { get { return string.IsNullOrEmpty(_invoice.tins) ? null : _invoice.tins; } }
|
||||
public int? Tob { get { return level == 10 || _invoice.tob==0 ? null : _invoice.tob == 5 ? 1 : _invoice.tob == 6 ? 4 : _invoice.tob; } }
|
||||
public int? Tob { get { return level == 10 || _invoice.tob == 0 ? null : _invoice.tob == 5 ? 1 : _invoice.tob == 6 ? 4 : _invoice.tob; } }
|
||||
public string? Bid
|
||||
{
|
||||
get
|
||||
@@ -96,14 +96,22 @@ namespace Back.Services
|
||||
public decimal? Nw { get { return level == 10 ? bitem.nw : null; } }
|
||||
public decimal? Fee { get { return level == 4 ? null : bitem.fee; } }
|
||||
public decimal? Cfee { get { return bitem.cfee == 0 || level == 8 || level == 10 ? null : bitem.cfee; } }
|
||||
public string? Cut { get{ return level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut; } }
|
||||
public string? Cut { get { return level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut; } }
|
||||
public decimal? Exr { get { return level == 8 ? null : bitem.exr; } }
|
||||
public decimal? Ssrv { get { return level == 10 ? bitem.ssrv : null; } }
|
||||
public decimal? Sscv { get { return level == 10 ? bitem.sscv : null; } }
|
||||
public decimal? Prdis { get { return level == 10 ? null : bitem.prdis; } }
|
||||
public decimal? Dis { get { return level == 10 ? null : bitem.dis; } }
|
||||
public decimal? Adis { get { return level == 10 ? null : bitem.adis; } }
|
||||
public decimal? Vra { get { return bitem.vra; } }
|
||||
public decimal? Vra
|
||||
{
|
||||
get
|
||||
{
|
||||
return level == 14 ? 0
|
||||
:
|
||||
bitem.vra;
|
||||
}
|
||||
}
|
||||
public decimal? Vam { get { return bitem.vam; } }
|
||||
public string? Odt { get { return string.IsNullOrEmpty(bitem.odt) ? null : bitem.odt; } }
|
||||
public decimal? Odr { get { return bitem.odr; } }
|
||||
|
@@ -33,6 +33,7 @@ namespace Back.Services.Warehouse
|
||||
ForSale = item.ForSale,
|
||||
info = item.info,
|
||||
Type = item.Type,
|
||||
InvoiceID=item.InvoiceID,
|
||||
Deleted = false
|
||||
};
|
||||
var returnmodel = await _ReceiptRepo.AddAsync(model);
|
||||
@@ -88,7 +89,9 @@ namespace Back.Services.Warehouse
|
||||
var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
|
||||
foreach (var model in models)
|
||||
model.Deleted = true;
|
||||
return await _ReceiptRepo.UpdateRangeAsync(models);
|
||||
if (models.Any())
|
||||
return await _ReceiptRepo.UpdateRangeAsync(models);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -73,8 +73,9 @@ namespace Back.Services.Warehouse
|
||||
var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
|
||||
foreach (var model in models)
|
||||
model.Deleted = true;
|
||||
if(models.Any())
|
||||
return await _ReceiptRepo.UpdateRangeAsync(models);
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID, int CODID, int CompanyID)
|
||||
{
|
||||
|
@@ -37,9 +37,13 @@ namespace Back.Validations
|
||||
if (!servCOD.ExistCodByCompanyID(model.Item3.CODID, model.Item1).Result)
|
||||
context.AddFailure("کالا یافت نشد");
|
||||
}
|
||||
|
||||
else context.AddFailure("کالا صحیح نمی باشد");
|
||||
|
||||
if (!model.Item3.vra.HasValue)
|
||||
context.AddFailure("نرخ مالیات را وارد کنید");
|
||||
|
||||
|
||||
|
||||
});
|
||||
RuleFor(r => r.Item3.am)
|
||||
.NotEmpty().WithMessage("تعداد مشخص نشده")
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -113,7 +114,6 @@ namespace Shared.DTOs
|
||||
//مبلغ قبل از تخفیف
|
||||
public decimal? prdis { get; set; }
|
||||
//مبلغ بعد از تخفیف
|
||||
|
||||
public decimal? adis { get; set; }
|
||||
|
||||
}
|
||||
|
@@ -21,8 +21,7 @@
|
||||
<select @bind="itemDTO.CODID" @bind:after="async () =>
|
||||
{
|
||||
await AfterAsync();
|
||||
if(itemDTO.ID==null)
|
||||
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
|
||||
itemDTO.vra=await GetVra(itemDTO.CODID);
|
||||
}" class="form-control" aria-label="Default select example" id="inputcod">
|
||||
@if (itemDTO.CODID > 0)
|
||||
{
|
||||
@@ -54,7 +53,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
|
||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
|
||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
||||
@@ -98,24 +97,24 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-10">
|
||||
@if (itemDTO.ID == null)
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
@if (itemDTO.ID == null)
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
|
||||
</div>
|
||||
@@ -146,7 +145,8 @@ else
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
SpinnerVisible = false;
|
||||
|
||||
if (!itemDTO.ID.HasValue)
|
||||
itemDTO.vra = 0;
|
||||
result = new ActionInResultComponent()
|
||||
{
|
||||
Status = ComponentStatus.fild
|
||||
@@ -157,9 +157,9 @@ else
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowMessage(ToastType toastType,string msg) => messages.Add(CreateToastMessage(toastType,msg));
|
||||
private void ShowMessage(ToastType toastType, string msg) => messages.Add(CreateToastMessage(toastType, msg));
|
||||
|
||||
private ToastMessage CreateToastMessage(ToastType toastType,string msg)
|
||||
private ToastMessage CreateToastMessage(ToastType toastType, string msg)
|
||||
=> new ToastMessage
|
||||
{
|
||||
Type = toastType,
|
||||
@@ -172,6 +172,16 @@ else
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private async Task<decimal> GetVra(int CODID)
|
||||
{
|
||||
var rsp = await hc.Get($"COD/GetVra/{CODID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
return await rsp.Content.ReadFromJsonAsync<decimal>();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
@@ -266,10 +276,10 @@ else
|
||||
}
|
||||
var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem"
|
||||
, new InvoiceItemAction<InvoiceItemDTO>
|
||||
{
|
||||
invoiceID=InvoiceID,
|
||||
{
|
||||
invoiceID = InvoiceID,
|
||||
item = itemDTO
|
||||
});
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
|
@@ -37,10 +37,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
//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("https://localhost:7075/api/") });
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||
|
||||
|
Reference in New Issue
Block a user