diff --git a/Back/Controllers/CustomerController.cs b/Back/Controllers/CustomerController.cs index c2cc7f0..3f74ca2 100644 --- a/Back/Controllers/CustomerController.cs +++ b/Back/Controllers/CustomerController.cs @@ -36,6 +36,19 @@ namespace Back.Controllers return Ok(await _servCus.GetCustomers(user.RolUsers.First().CompanyID, itemSerch)); + } + [HttpGet("GetAllForidName")] + public async Task>> GetAllForSearch() + { + var claim = HttpContext.User.Claims.First(c => c.Type == "UserID"); + var UserID = claim.Value; + var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID)); + + + + return Ok(await _servCus.GetCustomers(user.RolUsers.First().CompanyID)); + + } [HttpPost("Add")] public async Task> Add(RCustomer item) diff --git a/Back/Services/servCustomer.cs b/Back/Services/servCustomer.cs index 8d646f0..80acaa5 100644 --- a/Back/Services/servCustomer.cs +++ b/Back/Services/servCustomer.cs @@ -61,6 +61,20 @@ namespace Back.Services }).OrderByDescending(o=>o.ID) .Paging(itemSerch.PageIndex, itemSerch.PageSize); } + public async Task?> GetCustomers(int CompanyID) + { + var invok = _repoCus + .Get(w => w.CompanyID == CompanyID && !w.IsDeleted); + + //----------------------- + return await invok.Select(s => new ForCustomerSearch() + { + CustomerName=s.FullName, + ID = s.ID + + }).OrderByDescending(o => o.ID) + .ToListAsync(); + } public async Task GetCustomerByCustomerID(int CustomerID, int CompanyID) { return await _repoCus diff --git a/Back/Services/servInvoice.cs b/Back/Services/servInvoice.cs index 2ffc250..af2fedc 100644 --- a/Back/Services/servInvoice.cs +++ b/Back/Services/servInvoice.cs @@ -13,9 +13,9 @@ namespace Back.Services private readonly IAsyncRepository _invoiceStatusChangPaymentRepo; private readonly CheckPermission _checkPermission; public servInvoice(IAsyncRepository invoiceRepo, CheckPermission checkPermission - ,IAsyncRepository invoiceStatusChangPaymentRepo) + , IAsyncRepository invoiceStatusChangPaymentRepo) { - _invoiceStatusChangPaymentRepo= invoiceStatusChangPaymentRepo; + _invoiceStatusChangPaymentRepo = invoiceStatusChangPaymentRepo; _invoiceRepo = invoiceRepo; _checkPermission = checkPermission; @@ -45,9 +45,11 @@ namespace Back.Services return await invok .Include(inc => inc.invoiceDetails) .Include(inc => inc.payments) + .Include(inc => inc.pattern) .Select(s => new InvoiceDTO() { - PatternID= s.PatternID, + PatternID = s.PatternID, + PatternTitle = s.pattern.Title, CustomerID = s.CustomerID, CustomerName = s.Customer.FullName, ID = s.ID, @@ -93,9 +95,9 @@ namespace Back.Services }) .Paging(itemSerch.PageIndex, itemSerch.PageSize); } - public async Task ExistInvoiceByInvoiceID(int CompanyID,int InvoiceID) + public async Task ExistInvoiceByInvoiceID(int CompanyID, int InvoiceID) { - return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync(); + return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync(); } public async Task AddInvoice(Invoice invoice, bool calculate = true) @@ -113,7 +115,7 @@ namespace Back.Services { return await _invoiceRepo.AddBoolResultAsync(invoice); } - + } public async Task UpdateInvoice(Invoice invoice) { @@ -121,7 +123,7 @@ namespace Back.Services invoice.PreparedtoSendtoTax = false; - return await _invoiceRepo.UpdateAsync(invoice); + return await _invoiceRepo.UpdateAsync(invoice); } public async Task GetInvoiceByInvoiceID(int CompanyID, int InvoiceID) { @@ -180,8 +182,8 @@ namespace Back.Services Date = DateTime.Now.ConvertMiladiToShamsi(), UserID = invoiceitem.LastChangeUserID }); - if(action) - return await _invoiceRepo.UpdateAsync(invoiceitem); + if (action) + return await _invoiceRepo.UpdateAsync(invoiceitem); else return true; //_contextMongodb.InsertItem(new SysLog() //{ diff --git a/Shared/DTOs/ForCustomerSearch.cs b/Shared/DTOs/ForCustomerSearch.cs new file mode 100644 index 0000000..48efdef --- /dev/null +++ b/Shared/DTOs/ForCustomerSearch.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Shared.DTOs +{ + public class ForCustomerSearch + { + public int ID { get; set; } + public string CustomerName { get; set; } + } +} diff --git a/Shared/DTOs/InvoiceDtos.cs b/Shared/DTOs/InvoiceDtos.cs index 607e34c..46b2e34 100644 --- a/Shared/DTOs/InvoiceDtos.cs +++ b/Shared/DTOs/InvoiceDtos.cs @@ -19,25 +19,34 @@ namespace Shared.DTOs } public class InvoiceDTO { + [Display(Name = "شناسه")] public int ID { get; set; } + [Display(Name = "عنوان")] + public string Title { get; set; } public InvoiceType? invoiceType { get; set; } public int? PatternID { get; set; } + public string? PatternTitle { get; set; } + [Display(Name = "نوع صورتحساب")] public string? invoiceTypeTitle { get; set; } public int CustomerID { get; set; } + [Display(Name = "مشتری")] public string CustomerName { get; set; } public string? Udate { get; set; } + [Display(Name = "تاریخ صدور")] public string InvoicIssueDate { get; set; } public string InvoiceDate { get; set; } public bool PreparedtoSendtoTax { get; set; } - public string Title { get; set; } public string? Des { get; set; } //مجموع تخفیفات + [Display(Name = "مجموع تخفیفات")] public decimal? tdis { get; set; } //مجموع مالیات بر ارزش افزوده [MaxLength(18)] + [Display(Name = "مجموع مالیات")] public decimal? tvam { get; set; } //مجموع صورتحساب [MaxLength(18)] + [Display(Name = "مجموع صورتحساب")] public decimal? tbill { get; set; } public int? BillReference { get; set; } public ICollection items { get; set; } diff --git a/Shared/DTOs/Serch/ItemSerchGetInvoices.cs b/Shared/DTOs/Serch/ItemSerchGetInvoices.cs index 9f71b7c..cde5db0 100644 --- a/Shared/DTOs/Serch/ItemSerchGetInvoices.cs +++ b/Shared/DTOs/Serch/ItemSerchGetInvoices.cs @@ -8,10 +8,10 @@ namespace Shared.DTOs.Serch { public class ItemSerchGetInvoices : IFildGlobalItemSerch { - public string? Title { get; set; } - public int? InvoiceID { get; set; } + public string? Title { get; set; }// + public int? InvoiceID { get; set; }// public int? CustomerID { get; set; } - public InvoiceType? invoiceType { get; set; } + public InvoiceType? invoiceType { get; set; }// public int PageIndex { get; set; } = 1; public int PageSize { get; set; } = 5; } diff --git a/Shared/ExMethod.cs b/Shared/ExMethod.cs new file mode 100644 index 0000000..0925ae3 --- /dev/null +++ b/Shared/ExMethod.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Shared +{ + public static class ExMethod + { + public static string GetEnumDisplayName(this Enum enumType) + { + return enumType.GetType().GetMember(enumType.ToString()) + .First() + .GetCustomAttribute() + .Name; + } + } +} diff --git a/TaxPayerFull/Layout/PanelNavMenu.razor b/TaxPayerFull/Layout/PanelNavMenu.razor index 618ed9e..2d63b22 100644 --- a/TaxPayerFull/Layout/PanelNavMenu.razor +++ b/TaxPayerFull/Layout/PanelNavMenu.razor @@ -26,7 +26,7 @@