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")] [HttpGet("GetAllForidName")]
public async Task<ActionResult<List<CODIdName<int>>>> 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()} نمی تواند ویرایش شود" }); // return BadRequest(new List<string> { $"صورتحساب در حالت {invoice.invoiceType.GetEnumDisplayName()} نمی تواند ویرایش شود" });
//} //}
if (invoice.invoiceType!=InvoiceType.Cancellation) //if (invoice.invoiceType!=InvoiceType.Cancellation)
{ //{
bool InvoiceHasaRemittanceBillReference = invoice.BillReference.HasValue && await _remittanceService.HasaRemittance(invoice.BillReference.Value); //bool InvoiceHasaRemittanceBillReference = invoice.BillReference.HasValue && await _remittanceService.HasaRemittance(invoice.BillReference.Value);
foreach (var item in invoice.invoiceDetails) await _receiptService.DeleteByInvoiceID(invoice.ID, user.RolUsers.First().CompanyID);
{ await _remittanceService.DeleteByInvoiceID(invoice.ID,user.RolUsers.First().CompanyID);
if (await _remittanceService.HasaRemittance(invoice.ID, item.CODID)) //foreach (var item in invoice.invoiceDetails)
{ //{
await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto() // if (await _remittanceService.HasaRemittance(invoice.ID, item.CODID))
{ // {
CODID = item.CODID, // await _receiptService.ADD(new Shared.DTOs.Warehouse.ReceiptDto()
Count = item.am.GetValueOrDefault(), // {
Date = DateTime.Now.ConvertMiladiToShamsi(), // CODID = item.CODID,
ForSale = true, // Count = item.am.GetValueOrDefault(),
InvoiceID = item.InvoiceID, // Date = DateTime.Now.ConvertMiladiToShamsi(),
Type = TypeReceipt.Shopping, // ForSale = true,
info = $"حذف صورتحساب {item.InvoiceID}", // 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); invoice.LastChangeUserID = Convert.ToInt32(UserID);
//----Update and sendResult //----Update and sendResult

View File

@@ -100,6 +100,7 @@ namespace Back.Controllers
return Ok(await _servInvoiceItem.Add(new InvoiceItem return Ok(await _servInvoiceItem.Add(new InvoiceItem
{ {
vra=model.item.vra,
am = model.item.am, am = model.item.am,
fee = model.item.fee, fee = model.item.fee,
dis = model.item.dis, dis = model.item.dis,
@@ -196,6 +197,7 @@ namespace Back.Controllers
invoiceitem.fee = model.item.fee; invoiceitem.fee = model.item.fee;
invoiceitem.dis = model.item.dis; invoiceitem.dis = model.item.dis;
invoiceitem.CODID = model.item.CODID; invoiceitem.CODID = model.item.CODID;
invoiceitem.vra = model.item.vra;
} }
if (await _servInvoice.UpdateInvoice(invoice)) if (await _servInvoice.UpdateInvoice(invoice))

View File

@@ -64,18 +64,16 @@ namespace Back.Data.Models
//مبلغ قبل از تخفیف //مبلغ قبل از تخفیف
[MaxLength(18)] [MaxLength(18)]
public decimal? prdis { get { return am * fee; } } 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; } } public string? unitTitle { get { return cODItem!=null ? cODItem.CODUnit.Title : null; } }
#endregion #endregion
#region fild #region fild
//نرخ مالیات بر ازش افزوده
[MaxLength(5)]
public decimal? vra { get; set; }
//تعداد/مقدار //تعداد/مقدار
[MaxLength(36)] [MaxLength(36)]
public decimal? am { get; set; } 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") b.Property<decimal?>("_cfee")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<decimal?>("am") b.Property<decimal?>("am")
.HasMaxLength(36) .HasMaxLength(36)
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@@ -668,6 +669,10 @@ namespace Back.Migrations
.HasMaxLength(18) .HasMaxLength(18)
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
b.Property<decimal?>("vra")
.HasMaxLength(5)
.HasColumnType("decimal(18,2)");
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("CODID"); b.HasIndex("CODID");

View File

@@ -33,7 +33,7 @@ namespace Back.Services
public int? Inp { get { return _invoice.inp ?? 1; } } public int? Inp { get { return _invoice.inp ?? 1; } }
public int? Ins { get { return _invoice.ins ?? 1; } } public int? Ins { get { return _invoice.ins ?? 1; } }
public string? Tins { get { return string.IsNullOrEmpty(_invoice.tins) ? null : _invoice.tins; } } 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 public string? Bid
{ {
get get
@@ -96,14 +96,22 @@ namespace Back.Services
public decimal? Nw { get { return level == 10 ? bitem.nw : null; } } public decimal? Nw { get { return level == 10 ? bitem.nw : null; } }
public decimal? Fee { get { return level == 4 ? null : bitem.fee; } } 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 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? Exr { get { return level == 8 ? null : bitem.exr; } }
public decimal? Ssrv { get { return level == 10 ? bitem.ssrv : null; } } public decimal? Ssrv { get { return level == 10 ? bitem.ssrv : null; } }
public decimal? Sscv { get { return level == 10 ? bitem.sscv : null; } } public decimal? Sscv { get { return level == 10 ? bitem.sscv : null; } }
public decimal? Prdis { get { return level == 10 ? null : bitem.prdis; } } public decimal? Prdis { get { return level == 10 ? null : bitem.prdis; } }
public decimal? Dis { get { return level == 10 ? null : bitem.dis; } } public decimal? Dis { get { return level == 10 ? null : bitem.dis; } }
public decimal? Adis { get { return level == 10 ? null : bitem.adis; } } 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 decimal? Vam { get { return bitem.vam; } }
public string? Odt { get { return string.IsNullOrEmpty(bitem.odt) ? null : bitem.odt; } } public string? Odt { get { return string.IsNullOrEmpty(bitem.odt) ? null : bitem.odt; } }
public decimal? Odr { get { return bitem.odr; } } public decimal? Odr { get { return bitem.odr; } }

View File

@@ -33,6 +33,7 @@ namespace Back.Services.Warehouse
ForSale = item.ForSale, ForSale = item.ForSale,
info = item.info, info = item.info,
Type = item.Type, Type = item.Type,
InvoiceID=item.InvoiceID,
Deleted = false Deleted = false
}; };
var returnmodel = await _ReceiptRepo.AddAsync(model); 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(); var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
foreach (var model in models) foreach (var model in models)
model.Deleted = true; model.Deleted = true;
return await _ReceiptRepo.UpdateRangeAsync(models); 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(); var models = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.cODItem.CompanyID == CompanyID && !w.Deleted).ToListAsync();
foreach (var model in models) foreach (var model in models)
model.Deleted = true; model.Deleted = true;
if(models.Any())
return await _ReceiptRepo.UpdateRangeAsync(models); return await _ReceiptRepo.UpdateRangeAsync(models);
return true;
} }
public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID, int CODID, int CompanyID) 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) if (!servCOD.ExistCodByCompanyID(model.Item3.CODID, model.Item1).Result)
context.AddFailure("کالا یافت نشد"); context.AddFailure("کالا یافت نشد");
} }
else context.AddFailure("کالا صحیح نمی باشد"); else context.AddFailure("کالا صحیح نمی باشد");
if (!model.Item3.vra.HasValue)
context.AddFailure("نرخ مالیات را وارد کنید");
}); });
RuleFor(r => r.Item3.am) RuleFor(r => r.Item3.am)
.NotEmpty().WithMessage("تعداد مشخص نشده") .NotEmpty().WithMessage("تعداد مشخص نشده")

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Security.Principal;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -113,7 +114,6 @@ namespace Shared.DTOs
//مبلغ قبل از تخفیف //مبلغ قبل از تخفیف
public decimal? prdis { get; set; } public decimal? prdis { get; set; }
//مبلغ بعد از تخفیف //مبلغ بعد از تخفیف
public decimal? adis { get; set; } public decimal? adis { get; set; }
} }

View File

@@ -21,8 +21,7 @@
<select @bind="itemDTO.CODID" @bind:after="async () => <select @bind="itemDTO.CODID" @bind:after="async () =>
{ {
await AfterAsync(); await AfterAsync();
if(itemDTO.ID==null) itemDTO.vra=await GetVra(itemDTO.CODID);
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
}" class="form-control" aria-label="Default select example" id="inputcod"> }" class="form-control" aria-label="Default select example" id="inputcod">
@if (itemDTO.CODID > 0) @if (itemDTO.CODID > 0)
{ {
@@ -54,7 +53,7 @@
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label class="col-sm-6 col-form-label">نرخ مالیات</label> <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>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label> <label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
@@ -98,24 +97,24 @@
</div> </div>
</form> </form>
<div class="row g-3"> <div class="row g-3">
<div class="col-md-10"> <div class="col-md-10">
@if (itemDTO.ID == null) @if (itemDTO.ID == null)
{ {
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید جدید
</Button> </Button>
} }
else else
{ {
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات ثبت تغییرات
</Button> </Button>
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف حذف
</Button> </Button>
} }
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" /> <Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div> </div>
@@ -146,7 +145,8 @@ else
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
SpinnerVisible = false; SpinnerVisible = false;
if (!itemDTO.ID.HasValue)
itemDTO.vra = 0;
result = new ActionInResultComponent() result = new ActionInResultComponent()
{ {
Status = ComponentStatus.fild Status = ComponentStatus.fild
@@ -157,9 +157,9 @@ else
} }
} }
@functions { @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 => new ToastMessage
{ {
Type = toastType, Type = toastType,
@@ -172,6 +172,16 @@ else
alertIconName = IconName.CheckCircleFill; alertIconName = IconName.CheckCircleFill;
alertMessage = msg; 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) private void ShowDangerAlert(string msg)
{ {
Hidealert = false; Hidealert = false;
@@ -266,10 +276,10 @@ else
} }
var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem" var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem"
, new InvoiceItemAction<InvoiceItemDTO> , new InvoiceItemAction<InvoiceItemDTO>
{ {
invoiceID=InvoiceID, invoiceID = InvoiceID,
item = itemDTO item = itemDTO
}); });
if (rsp.IsSuccessStatusCode) if (rsp.IsSuccessStatusCode)
{ {
var request = await rsp.Content.ReadFromJsonAsync<bool>(); var request = await rsp.Content.ReadFromJsonAsync<bool>();

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/") }); //builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://moadiran.ir:444/api/") });
//Home //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 //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"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");