This commit is contained in:
mmrbnjd
2025-01-25 12:57:07 +03:30
parent 48072d6e00
commit b57839a212
14 changed files with 2229 additions and 74 deletions

View File

@@ -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()
{

View File

@@ -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}",
}, user.RolUsers.First().CompanyID, true);
//if (invoice.BillReference.HasValue && InvoiceHasaRemittanceBillReference)
//if (invoice.invoiceType!=InvoiceType.Cancellation)
//{
// await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
//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(),
// InvoiceID = invoice.BillReference.Value,
// Type = TypeRemittance.Sale,
// info = $"حواله خودکار از صورتحساب {invoice.BillReference.Value}",
// });
// ForSale = true,
// InvoiceID = item.InvoiceID,
// Type = TypeReceipt.Shopping,
// info = $"حذف صورتحساب {item.InvoiceID}",
// }, user.RolUsers.First().CompanyID, true);
// }
//}
// }
}
}
}
invoice.LastChangeUserID = Convert.ToInt32(UserID);
//----Update and sendResult

View File

@@ -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))

View File

@@ -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; }

File diff suppressed because it is too large Load Diff

View 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");
}
}
}

View File

@@ -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");

View File

@@ -103,7 +103,15 @@ namespace Back.Services
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; } }

View File

@@ -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;
if (models.Any())
return await _ReceiptRepo.UpdateRangeAsync(models);
return true;
}

View File

@@ -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)
{

View File

@@ -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("تعداد مشخص نشده")

View File

@@ -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; }
}

View File

@@ -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>
@@ -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
@@ -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;

View File

@@ -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");