...
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Back.Controllers
|
||||
private readonly WarehouseService _warehouseService;
|
||||
private readonly ReceiptService _receiptService;
|
||||
|
||||
public InvoiceController(IConfiguration configuration, servInvoice servInvoice, servUser servUser, AddOrUpdateInvoiceValidation validationInvoice, servTaxPayer servTaxPayer, servReport servReport, IAsyncRepository<rptQueue> rptQueueRepository, RemittanceService remittanceService, WarehouseService warehouseService)
|
||||
public InvoiceController(IConfiguration configuration, servInvoice servInvoice, servUser servUser, AddOrUpdateInvoiceValidation validationInvoice, servTaxPayer servTaxPayer, servReport servReport, IAsyncRepository<rptQueue> rptQueueRepository, RemittanceService remittanceService, WarehouseService warehouseService, ReceiptService receiptService)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_servInvoice = servInvoice;
|
||||
@@ -42,6 +42,7 @@ namespace Back.Controllers
|
||||
_rptQueueRepository = rptQueueRepository;
|
||||
_remittanceService = remittanceService;
|
||||
_warehouseService = warehouseService;
|
||||
_receiptService = receiptService;
|
||||
}
|
||||
|
||||
[HttpPost("GetAll")]
|
||||
@@ -233,6 +234,40 @@ 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)
|
||||
//{
|
||||
// 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
|
||||
@@ -359,7 +394,29 @@ namespace Back.Controllers
|
||||
foreach (var item in Invoice.invoiceDetails)
|
||||
{
|
||||
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
|
||||
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result);
|
||||
{
|
||||
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID,item.CODID, user.RolUsers.First().CompanyID);
|
||||
//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} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
|
||||
|
||||
//}, user.RolUsers.First().CompanyID, true);
|
||||
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
|
||||
{
|
||||
CODID = item.CODID,
|
||||
Count = item.am.GetValueOrDefault(),
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
InvoiceID = result,
|
||||
Type = TypeRemittance.Sale,
|
||||
info = $"حواله خودکار: از صورتحساب {result}"
|
||||
});
|
||||
}
|
||||
}
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result));
|
||||
}
|
||||
@@ -434,7 +491,29 @@ namespace Back.Controllers
|
||||
foreach (var item in Invoice.invoiceDetails)
|
||||
{
|
||||
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
|
||||
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result1);
|
||||
{
|
||||
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID, item.CODID, user.RolUsers.First().CompanyID);
|
||||
//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} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
|
||||
|
||||
//}, user.RolUsers.First().CompanyID, true);
|
||||
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
|
||||
{
|
||||
CODID = item.CODID,
|
||||
Count = item.am.GetValueOrDefault(),
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
InvoiceID = result1,
|
||||
Type = TypeRemittance.Sale,
|
||||
info = $"حواله خودکار: از صورتحساب {result1}"
|
||||
});
|
||||
}
|
||||
}
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result1));
|
||||
}
|
||||
@@ -537,7 +616,29 @@ namespace Back.Controllers
|
||||
foreach (var item in Invoice.invoiceDetails)
|
||||
{
|
||||
if (await _remittanceService.HasaRemittance(Invoice.ID, item.CODID))
|
||||
await _remittanceService.ChangeRemittance(Invoice.ID, item.CODID, result2);
|
||||
{
|
||||
await _remittanceService.DeleteByCODIDAndInvoiceID(Invoice.ID, item.CODID, user.RolUsers.First().CompanyID);
|
||||
//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} از {Invoice.invoiceType.GetEnumDisplayName()} به {((InvoiceType)invoiceType).GetEnumDisplayName()}",
|
||||
|
||||
//}, user.RolUsers.First().CompanyID, true);
|
||||
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
|
||||
{
|
||||
CODID = item.CODID,
|
||||
Count = item.am.GetValueOrDefault(),
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
InvoiceID = result2,
|
||||
Type = TypeRemittance.Sale,
|
||||
info = $"حواله خودکار: از صورتحساب {result2}"
|
||||
});
|
||||
}
|
||||
}
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result2));
|
||||
}
|
||||
@@ -709,6 +810,11 @@ namespace Back.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, InvoiceID).Result)
|
||||
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+'\r'+
|
||||
"نمیتواند برای این صورتحساب حواله صادر کنید، ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
|
||||
|
||||
List<string> errors = new List<string>();
|
||||
var result = await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
|
||||
if (result.invoiceType == InvoiceType.Bidding || result.invoiceType == InvoiceType.Cancellation)
|
||||
@@ -720,9 +826,9 @@ namespace Back.Controllers
|
||||
.GroupBy(i => i.CODID).Select(g => new { CODID = g.Key, TotalAm = g.Sum(i => i.am) }))
|
||||
{
|
||||
var Inventory = await _warehouseService.Inventory(CompanyID.Value, item.CODID);
|
||||
if (Inventory - item.TotalAm <= 0)
|
||||
if (Inventory - item.TotalAm < 0)
|
||||
{
|
||||
errors.Add($"موجودی کالا {item.CODID} کمتر از درخواست شماست");
|
||||
errors.Add($"موجودی کالا {result.items.First(w => w.CODID == item.CODID).sstt} کمتر از درخواست شماست");
|
||||
}
|
||||
}
|
||||
if (errors.Count == 0)
|
||||
@@ -751,6 +857,28 @@ namespace Back.Controllers
|
||||
|
||||
|
||||
|
||||
}
|
||||
[HttpPost("FreeRemittance/{InvoiceID}")]
|
||||
public async Task<ActionResult> FreeRemittance(int InvoiceID)
|
||||
{
|
||||
//-----GetUserAndCompany
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
|
||||
var CompanyID = user?.RolUsers.First().CompanyID;
|
||||
|
||||
if (!await _servInvoice.ExistInvoiceByInvoiceID(CompanyID.Value, InvoiceID))
|
||||
return NotFound();
|
||||
|
||||
|
||||
await _receiptService.DeleteByInvoiceID(InvoiceID, CompanyID.Value);
|
||||
await _remittanceService.DeleteByInvoiceID(InvoiceID, CompanyID.Value);
|
||||
|
||||
return Ok();
|
||||
//return BadRequest(new List<string>() { $"حواله ای یافت نشد" });
|
||||
|
||||
|
||||
}
|
||||
[HttpGet("HasaRemittance/{InvoiceID}")]
|
||||
public async Task<ActionResult> HasaRemittance(int InvoiceID)
|
||||
|
@@ -26,15 +26,17 @@ namespace Back.Controllers
|
||||
private readonly servInvoice _servInvoice;
|
||||
private readonly RemittanceService _remittanceService;
|
||||
private readonly WarehouseService _warehouseService;
|
||||
public InvoiceItemController(servInvoiceItem servInvoiceItem, AUInvoiceItemValidation validationInvoiceItem
|
||||
, servUser servUser, servInvoice servInvoice)
|
||||
|
||||
public InvoiceItemController(servInvoiceItem servInvoiceItem, servUser servUser, AUInvoiceItemValidation validationInvoiceItem, servInvoice servInvoice, RemittanceService remittanceService, WarehouseService warehouseService)
|
||||
{
|
||||
_servInvoiceItem = servInvoiceItem;
|
||||
_validationInvoiceItem = validationInvoiceItem;
|
||||
_servUser = servUser;
|
||||
_validationInvoiceItem = validationInvoiceItem;
|
||||
_servInvoice = servInvoice;
|
||||
|
||||
_remittanceService = remittanceService;
|
||||
_warehouseService = warehouseService;
|
||||
}
|
||||
|
||||
[HttpPost("AddItem")]
|
||||
public async Task<ActionResult<bool>> AddItem([FromBody] InvoiceItemAction<InvoiceItemDTO> model)
|
||||
{
|
||||
@@ -53,6 +55,10 @@ namespace Back.Controllers
|
||||
if (invoice == null)
|
||||
return BadRequest(new List<string> { "invoice notFound..." });
|
||||
|
||||
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, model.invoiceID).Result)
|
||||
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
|
||||
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
|
||||
|
||||
if (invoice.invoiceType == InvoiceType.Repair)
|
||||
{
|
||||
return BadRequest(new List<string> { "امکان افزودن کالا جدید در صورتحساب اصلاحی وجود ندارد" });
|
||||
@@ -123,7 +129,9 @@ namespace Back.Controllers
|
||||
if (invoice == null)
|
||||
return BadRequest(new List<string> { "invoice notFound..." });
|
||||
|
||||
|
||||
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, model.invoiceID).Result)
|
||||
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
|
||||
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
|
||||
|
||||
//-----Validaton
|
||||
var resultValidationmodel = await _validationInvoiceItem.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, model.invoiceID, model.item, eActionValidation.update));
|
||||
@@ -178,6 +186,8 @@ namespace Back.Controllers
|
||||
|
||||
invoice.LastChangeUserID = Convert.ToInt32(UserID);
|
||||
|
||||
var copyInvoice = (InvoiceItem)invoiceitem.Clone();
|
||||
|
||||
if (invoice.invoiceType == InvoiceType.BackFrmSale)
|
||||
invoiceitem.am = model.item.am;
|
||||
else
|
||||
@@ -190,14 +200,14 @@ namespace Back.Controllers
|
||||
|
||||
if (await _servInvoice.UpdateInvoice(invoice))
|
||||
{
|
||||
if (invoiceitem.am != model.item.am || invoiceitem.CODID != model.item.CODID)
|
||||
if (copyInvoice.am != model.item.am || copyInvoice.CODID != model.item.CODID)
|
||||
{
|
||||
if (await _remittanceService.HasaRemittance(invoiceitem.invoice.ID, invoiceitem.CODID))
|
||||
if (await _remittanceService.HasaRemittance(model.invoiceID, copyInvoice.CODID))
|
||||
{
|
||||
var inv = await _warehouseService.Inventory(user.RolUsers.First().CompanyID, model.item.CODID);
|
||||
if (inv - model.item.am <= 0)
|
||||
return BadRequest(new List<string> { "موجودی کالا کمتر از درخواست شماست" });
|
||||
else await _remittanceService.DeleteByInvoiceIDandCODID(invoiceitem.invoice.ID, invoiceitem.CODID);
|
||||
if (inv+ copyInvoice.am - model.item.am < 0)
|
||||
return BadRequest(new List<string> { "خطای انبار :"+"موجودی کالا کمتر از درخواست شماست" });
|
||||
else await _remittanceService.DeleteByInvoiceIDandCODID(model.invoiceID, copyInvoice.CODID);
|
||||
|
||||
// حواله جئدید
|
||||
await _remittanceService.ADD(new Shared.DTOs.Warehouse.RemittanceDto()
|
||||
@@ -205,9 +215,9 @@ namespace Back.Controllers
|
||||
CODID = model.item.CODID,
|
||||
Count = model.item.am,
|
||||
Date = DateTime.Now.ConvertMiladiToShamsi(),
|
||||
info = $"حواله خودکار از صورتحساب {invoiceitem.invoice.ID}",
|
||||
info = $"حواله خودکار از صورتحساب {model.invoiceID}",
|
||||
Type = TypeRemittance.Sale,
|
||||
InvoiceID = invoiceitem.invoice.ID
|
||||
InvoiceID = model.invoiceID
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,6 +243,10 @@ namespace Back.Controllers
|
||||
if (invoiceitem == null)
|
||||
return NotFound(new List<string> { "invoice Item notFound..." });
|
||||
|
||||
if (_servInvoice.checkFatherInvoiceByInvoiceID(user.RolUsers.First().CompanyID, InvoiceItemID).Result)
|
||||
return BadRequest(new List<string> {"این صورتحساب، مرجع چند صورتحساب دیگر می باشد " +'\n'+
|
||||
"برای تغییر در آیتم ها ابتدا صورتحساب هایی که ارتباط دارند را حذف کنید" });
|
||||
|
||||
//-----Validaton
|
||||
var resultValidationmodel = await _validationInvoiceItem.ValidateAsync(Tuple.Create(user.RolUsers.First().CompanyID, invoiceitem.InvoiceID.Value, new InvoiceItemDTO(), eActionValidation.delete));
|
||||
if (!resultValidationmodel.IsValid)
|
||||
|
@@ -27,7 +27,7 @@ namespace Back.Controllers.Warehouse
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var CompanyID = user.RolUsers.First().CompanyID;
|
||||
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID));
|
||||
return Ok(await _warehouseService.Circulation(CompanyID,date,CODID,PageIndex,PageSize));
|
||||
}
|
||||
[HttpGet("Inventory/{CODID}")]
|
||||
public async Task<IActionResult> Inventory(int CODID)
|
||||
|
@@ -148,7 +148,7 @@ namespace Back.Data.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
return pattern.BillTypeID == 3 || (pattern.BillTypeID == 2 && pattern.ID == 10)
|
||||
return pattern!=null && (pattern.BillTypeID == 3 || (pattern.BillTypeID == 2 && pattern.ID == 10))
|
||||
? 1
|
||||
: _setm;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class InvoiceItem
|
||||
public class InvoiceItem : ICloneable
|
||||
{
|
||||
#region Key
|
||||
public int ID { get; set; }
|
||||
@@ -147,6 +147,11 @@ namespace Back.Data.Models
|
||||
|
||||
[ForeignKey("CODID")]
|
||||
public virtual CODItem cODItem { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
@@ -83,6 +83,23 @@ namespace Back.Services.Warehouse
|
||||
return await _ReceiptRepo.UpdateAsync(model);
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteByInvoiceID(int InvoiceID, int CompanyID)
|
||||
{
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
//public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID,int CODID, int CompanyID)
|
||||
//{
|
||||
// var model = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID==CODID && w.cODItem.CompanyID == CompanyID && !w.Deleted).FirstOrDefaultAsync();
|
||||
// model.Deleted = true;
|
||||
// return await _ReceiptRepo.UpdateAsync(model);
|
||||
|
||||
|
||||
//}
|
||||
public async Task<ReceiptDto?> Get(int itemID, int CompanyID)
|
||||
{
|
||||
return await _ReceiptRepo.Get(w => w.ID == itemID && w.cODItem.CompanyID == CompanyID && !w.Deleted)
|
||||
|
@@ -24,6 +24,7 @@ namespace Back.Services.Warehouse
|
||||
Count = item.Count,
|
||||
info = item.info,
|
||||
Type = item.Type,
|
||||
InvoiceID = item.InvoiceID,
|
||||
Deleted=false
|
||||
};
|
||||
var returnmodel = await _ReceiptRepo.AddAsync(model);
|
||||
@@ -66,6 +67,22 @@ namespace Back.Services.Warehouse
|
||||
model.Deleted = true;
|
||||
return await _ReceiptRepo.UpdateAsync(model);
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteByInvoiceID(int InvoiceID, int CompanyID)
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteByCODIDAndInvoiceID(int InvoiceID, int CODID, int CompanyID)
|
||||
{
|
||||
var model = await _ReceiptRepo.Get(w => w.InvoiceID == InvoiceID && w.CODID == CODID && w.cODItem.CompanyID == CompanyID && !w.Deleted).FirstOrDefaultAsync();
|
||||
model.Deleted = true;
|
||||
return await _ReceiptRepo.UpdateAsync(model);
|
||||
|
||||
|
||||
}
|
||||
public async Task<RemittanceDto?> Get(int itemID, int CompanyID)
|
||||
{
|
||||
|
@@ -4,23 +4,28 @@ using Shared.DTOs.Serch;
|
||||
using Shared.DTOs;
|
||||
using Back.Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Back.Services.Warehouse;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class servInvoice
|
||||
{
|
||||
private readonly RemittanceService _remittanceService;
|
||||
|
||||
private readonly IAsyncRepository<Invoice> _invoiceRepo;
|
||||
private readonly IAsyncRepository<Coding> _CodingRepo;
|
||||
private readonly IAsyncRepository<InvoiceStatusChang> _invoiceStatusChangPaymentRepo;
|
||||
private readonly CheckPermission _checkPermission;
|
||||
public servInvoice(IAsyncRepository<Invoice> invoiceRepo, CheckPermission checkPermission
|
||||
, IAsyncRepository<InvoiceStatusChang> invoiceStatusChangPaymentRepo, IAsyncRepository<Coding> codingRepo)
|
||||
|
||||
public servInvoice(RemittanceService remittanceService, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<Coding> codingRepo, IAsyncRepository<InvoiceStatusChang> invoiceStatusChangPaymentRepo, CheckPermission checkPermission)
|
||||
{
|
||||
_invoiceStatusChangPaymentRepo = invoiceStatusChangPaymentRepo;
|
||||
_remittanceService = remittanceService;
|
||||
_invoiceRepo = invoiceRepo;
|
||||
_checkPermission = checkPermission;
|
||||
_CodingRepo = codingRepo;
|
||||
_invoiceStatusChangPaymentRepo = invoiceStatusChangPaymentRepo;
|
||||
_checkPermission = checkPermission;
|
||||
}
|
||||
|
||||
public async Task<List<Coding>> GetCodingPMT()
|
||||
{
|
||||
return await _CodingRepo.Get(w => w.FildID == 71).ToListAsync();
|
||||
@@ -65,6 +70,7 @@ namespace Back.Services
|
||||
tbill = item.tbill,
|
||||
Des = item.Des,
|
||||
PreparedtoSendtoTax = item.PreparedtoSendtoTax,
|
||||
HasaRemittance= await _remittanceService.HasaRemittance(ID),
|
||||
tdis = item.tdis,
|
||||
tvam = item.tvam,
|
||||
Udate = item.Udate.ShamciToFormatShamci(),
|
||||
|
@@ -87,7 +87,7 @@ namespace Shared.DTOs
|
||||
[MaxLength(10)]
|
||||
[Display(Name = "سریال صورتحساب داخلی حافظه مالیاتی")]
|
||||
public string? inno { get; set; }
|
||||
|
||||
public bool HasaRemittance { get; set; }
|
||||
|
||||
}
|
||||
public class InvoiceItemDTO
|
||||
|
@@ -11,7 +11,7 @@ namespace Shared.DTOs.Warehouse
|
||||
{
|
||||
public int? ID { get; set; }
|
||||
public int CODID { get; set; }
|
||||
public string CODTitle { get; set; }
|
||||
public string? CODTitle { get; set; }
|
||||
public decimal Count { get; set; }
|
||||
public string Date { get; set; }
|
||||
public TypeRemittance Type { get; set; }
|
||||
|
@@ -31,6 +31,15 @@
|
||||
<li style="color:dodgerblue">زمان ویرایش دقت کنید<br /> تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
|
||||
}
|
||||
|
||||
@if (InventoryValue > 0)
|
||||
{
|
||||
<li style="color:seagreen">موجودی کالا در انبار : @InventoryValue</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li style="color:red">این کالا در انبار موجودی ندارد</li>
|
||||
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
<div class="row g-3">
|
||||
@@ -38,8 +47,7 @@
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">نام کالا</label>
|
||||
@if (Cod.ID == 0 || !_UsedInTheInvoice)
|
||||
{
|
||||
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا"
|
||||
/>
|
||||
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,16 +101,16 @@
|
||||
|
||||
|
||||
</form>
|
||||
<div class="row g-3">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-10">
|
||||
@if (Cod.ID == 0)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (Cod.ID == 0)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!_SuccessfulSubmissiontoTaxPayer)
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
@@ -113,18 +121,19 @@ else
|
||||
</Button>
|
||||
}
|
||||
|
||||
@if (_UsedInTheInvoice)
|
||||
@if (_UsedInTheInvoice)
|
||||
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
|
||||
صورتحساب های مرتبط
|
||||
</Button>
|
||||
}
|
||||
}
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
|
||||
صورتحساب های مرتبط
|
||||
</Button>
|
||||
}
|
||||
|
||||
}
|
||||
</div>
|
||||
<div class="col-md-2" >
|
||||
<div class="col-md-2">
|
||||
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@code {
|
||||
public bool SpinnerVisible { get; set; } = false;
|
||||
@@ -154,6 +163,9 @@ else
|
||||
alertMessage = "";
|
||||
await UsedInTheInvoice();
|
||||
await SuccessfulSubmissiontoTaxPayer();
|
||||
// موجودی
|
||||
await Inventory();
|
||||
//
|
||||
SpinnerVisible = false;
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
@@ -165,7 +177,7 @@ else
|
||||
}
|
||||
public async Task UsedInTheInvoice()
|
||||
{
|
||||
if (Cod.ID!=0)
|
||||
if (Cod.ID != 0)
|
||||
{
|
||||
var rsp = await hc.Get($"Cod/UsedInTheInvoice/{Cod.ID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
@@ -175,6 +187,16 @@ else
|
||||
}
|
||||
|
||||
}
|
||||
public decimal InventoryValue { get; set; } = 0;
|
||||
public async Task Inventory()
|
||||
{
|
||||
if (Cod.ID != 0)
|
||||
{
|
||||
var rsp = await hc.Get($"Warehouse/Inventory/{Cod.ID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
InventoryValue = await rsp.Content.ReadFromJsonAsync<decimal>();
|
||||
}
|
||||
}
|
||||
public async Task SuccessfulSubmissiontoTaxPayer()
|
||||
{
|
||||
SpinnerVisible = true;
|
||||
@@ -187,7 +209,7 @@ else
|
||||
else _SuccessfulSubmissiontoTaxPayer = false;
|
||||
}
|
||||
|
||||
SpinnerVisible = false ;
|
||||
SpinnerVisible = false;
|
||||
}
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
@@ -295,7 +317,7 @@ else
|
||||
message2: "اطمینان دارید?");
|
||||
|
||||
if (confirmation)
|
||||
await OnClickDelete();
|
||||
await OnClickDelete();
|
||||
|
||||
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
@if (_UsedFromInvoice)
|
||||
{
|
||||
<ul>
|
||||
<li> style="color:indianred"این سند از فاکتور صادر شده، ویرایش مستقیم آن ممکن نیست</li>
|
||||
<li style="color:red"> این سند از فاکتور صادر شده، ویرایش مستقیم آن ممکن نیست</li>
|
||||
<br />
|
||||
</ul>
|
||||
}
|
||||
@@ -31,11 +31,12 @@
|
||||
DataProvider="CODDataProvider"
|
||||
PropertyName="Title"
|
||||
Placeholder="جستجو در کالا..."
|
||||
Disabled="!NewItem"
|
||||
OnChanged="(CODIdName<int> cod) => OnAutoCompleteChanged(cod)" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="col-sm-4 col-form-label" style="color:red">تعداد</label>
|
||||
<InputNumber @bind-Value="model.Count" style="text-align:center" type="text" class="form-control" placeholder="تعداد" />
|
||||
<label class="col-sm-4 col-form-label" style="color:red">مقدار</label>
|
||||
<InputNumber @bind-Value="model.Count" style="text-align:center" type="text" class="form-control" placeholder="مقدار" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="col-sm-5 col-form-label" for="inputInvoicIssueDate">تاریخ</label>
|
||||
@@ -179,15 +180,12 @@
|
||||
var rsp = await hc.Delete($"{route}/{model.ID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (request)
|
||||
{
|
||||
|
||||
ActionInResultComponent result = new ActionInResultComponent();
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.delete;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
|
||||
}
|
||||
|
||||
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
@using System.Reflection
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Shared.DTOs
|
||||
@using Shared.DTOs.Warehouse
|
||||
@typeparam T
|
||||
|
||||
<div class="row">
|
||||
@@ -79,7 +80,26 @@
|
||||
}
|
||||
|
||||
}
|
||||
else if (property.Name.ToLower() == "msgtype" && item.ToString() == "Shared.DTOs.Warehouse.CirculationDto")
|
||||
{
|
||||
var convertmodel = (CirculationDto)Convert.ChangeType(item, typeof(CirculationDto));
|
||||
switch (convertmodel.Type)
|
||||
{
|
||||
case TypeCirculation.Receipt:
|
||||
<td style="background-color:#ffab00">@property.GetValue(item, null)</td>
|
||||
break;
|
||||
|
||||
case TypeCirculation.Remittance:
|
||||
<td style="background-color:#66c732">@property.GetValue(item, null)</td>
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
<td>@property.GetValue(item, null)</td>
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (property.Name.ToLower() == "id" && item.ToString() != "Shared.DTOs.SentTaxDto")
|
||||
{
|
||||
if (id > 0)
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user