diff --git a/EveryThing/Keys/key-e803459e-6187-453a-92e2-246643ca1beb.xml b/EveryThing/Keys/key-e803459e-6187-453a-92e2-246643ca1beb.xml
new file mode 100644
index 0000000..5535049
--- /dev/null
+++ b/EveryThing/Keys/key-e803459e-6187-453a-92e2-246643ca1beb.xml
@@ -0,0 +1,16 @@
+
+
Cena skupaj: @Model.TotalPrice €
Prodajna cena: @Model.SellingPrice €
Razlika: @Model.DifferenceInPricePercentage %
+
Material: @Model.Material
+
Dimenzije surovca: @Model.MaterialDimensions
@if (Model.Files != null && Model.Files.Count > 0)
{
diff --git a/EveryThing/Pages/CodeTableItems/Index.cshtml.cs b/EveryThing/Pages/CodeTableItems/Index.cshtml.cs
index 67aab76..5633958 100644
--- a/EveryThing/Pages/CodeTableItems/Index.cshtml.cs
+++ b/EveryThing/Pages/CodeTableItems/Index.cshtml.cs
@@ -29,7 +29,8 @@ namespace EveryThing.Pages.CodeTableItems
public string TotalPrice { get; set; }
public string SellingPrice { get; set; }
public string DifferenceInPricePercentage { get; set; }
-
+ public string MaterialDimensions { get; set; }
+ public string Material { get; set; }
}
private readonly ApplicationDbContext _context;
@@ -51,17 +52,29 @@ namespace EveryThing.Pages.CodeTableItems
{
var user = _userManager.GetUserAsync(User).Result;
- ViewData["SearchString"] = searchString;
+ ViewData["SearchString"] = searchString ?? "";
+
+ var search = !string.IsNullOrEmpty(searchString);
Item = await _context.CodeTableItems
- .Where(x => x.IdCompanyFk == user.IdCompanyFk)
- .Include(j => j.Company).ToListAsync();
+ .Where(x => x.IdCompanyFk == user.IdCompanyFk
+ && EF.Functions.Like(x.Title, $"%{searchString}%")
+ || EF.Functions.Like(x.Description, $"%{searchString}%"))
+ .Include(j => j.Company).Take(100).ToListAsync();
- if (!string.IsNullOrEmpty(searchString))
- {
- Item = Item.Where(s => s.Title.Contains(searchString, StringComparison.InvariantCultureIgnoreCase)
- || (s.Description != null && s.Description.Contains(searchString, StringComparison.InvariantCultureIgnoreCase))).ToList();
- }
+ //Item = await _context.CodeTableItems
+ // .Where(x => x.IdCompanyFk == user.IdCompanyFk
+ // && (!search
+ // || EF.Functions.Like(x.Title, $"%{searchString}%")
+ // || (x.Description != null
+ // && EF.Functions.Like(x.Description, $"%{searchString}%"))))
+ // .Include(j => j.Company).Take(100).ToListAsync();
+
+ //if ()
+ //{
+ // Item = Item.Where(s => s.Title.Contains(searchString, StringComparison.InvariantCultureIgnoreCase)
+ // || (s.Description != null && s.Description.Contains(searchString, StringComparison.InvariantCultureIgnoreCase))).ToList();
+ //}
}
@@ -75,6 +88,8 @@ namespace EveryThing.Pages.CodeTableItems
var workPrice = 0d;
var sellingPrice = 0d;
var differenceInPricePercentage = 0d;
+ var materialDimensions = "";
+ var material = "";
if (edit)
{
@@ -98,6 +113,7 @@ namespace EveryThing.Pages.CodeTableItems
else
{
var projectPartItem = _context.ProjectPartItems
+ .Include(x => x.Material)
.OrderByDescending(x => x.DateModified)
.ThenByDescending(x => x.IdProjectPartItem)
.FirstOrDefault(x => x.IdItemFk == item.IdItem);
@@ -108,6 +124,8 @@ namespace EveryThing.Pages.CodeTableItems
workPrice = projectPartItem.WorkPrice;
sellingPrice = projectPartItem.SellingPrice;
differenceInPricePercentage = projectPartItem.DifferenceInPricePercentage;
+ materialDimensions = projectPartItem.MaterialDimensions;
+ material = projectPartItem.Material.Title;
}
}
@@ -122,7 +140,9 @@ namespace EveryThing.Pages.CodeTableItems
SellingPrice = sellingPrice.ToString("#,###,##0.00", new CultureInfo("sl-SI")),
TotalPrice = (materialPrice + workPrice).ToString("#,###,##0.00", new CultureInfo("sl-SI")),
WorkPrice = workPrice.ToString("#,###,##0.00", new CultureInfo("sl-SI")),
- DifferenceInPricePercentage = differenceInPricePercentage.ToString("#,###,##0.00", new CultureInfo("sl-SI"))
+ DifferenceInPricePercentage = differenceInPricePercentage.ToString("#,###,##0.00", new CultureInfo("sl-SI")),
+ MaterialDimensions = materialDimensions,
+ Material = material
});
}
diff --git a/EveryThing/Pages/CodeTablePartners/Index.cshtml.cs b/EveryThing/Pages/CodeTablePartners/Index.cshtml.cs
index 404cccc..9abb880 100644
--- a/EveryThing/Pages/CodeTablePartners/Index.cshtml.cs
+++ b/EveryThing/Pages/CodeTablePartners/Index.cshtml.cs
@@ -1,16 +1,18 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.RazorPages;
-using Microsoft.EntityFrameworkCore;
-using EveryThing.Data;
+using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Data.SqlClient;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
namespace EveryThing.Pages.CodeTablePartners
{
@@ -49,5 +51,30 @@ namespace EveryThing.Pages.CodeTablePartners
.ToList();
}
}
+
+ public IActionResult OnGetPartners(bool? suppliers)
+ {
+ var user = _userManager.GetUserAsync(User).Result;
+
+ var successful = true;
+ var error = "";
+
+ var partners = _context.CodeTablePartners
+ .Where(x => x.IdCompanyFk == user.IdCompanyFk);
+
+ if (suppliers != null)
+ partners = partners.Where(x => x.Supplier == suppliers);
+
+ var sbJson = new StringBuilder();
+
+ foreach (var codeTablePartner in partners)
+ {
+ if (sbJson.Length > 0)
+ sbJson.Append(",");
+ sbJson.Append($"\"{codeTablePartner.IdPartner}\": \"{codeTablePartner.Title}\"");
+ }
+
+ return new JsonResult(new { jsonPartners = $"{{{sbJson}}}", error = error, successful = successful });
+ }
}
}
diff --git a/EveryThing/Pages/Invoices/Create.cshtml b/EveryThing/Pages/Invoices/Create.cshtml
index fd36652..c60a426 100644
--- a/EveryThing/Pages/Invoices/Create.cshtml
+++ b/EveryThing/Pages/Invoices/Create.cshtml
@@ -27,6 +27,9 @@
case 3:
Naročila kupcev
break;
+ case 4:
+ Kooperacije
+ break;
default:
Fakture
break;
diff --git a/EveryThing/Pages/Invoices/Edit.cshtml b/EveryThing/Pages/Invoices/Edit.cshtml
index 83c73b0..4d52f9b 100644
--- a/EveryThing/Pages/Invoices/Edit.cshtml
+++ b/EveryThing/Pages/Invoices/Edit.cshtml
@@ -56,6 +56,9 @@
case 3:
Naročila kupcev
break;
+ case 4:
+ Kooperacije
+ break;
default:
Fakture
break;
@@ -145,6 +148,9 @@
case 3:
Naročilo kupca
break;
+ case 4:
+ Kooperacija
+ break;
default:
Faktura
break;
diff --git a/EveryThing/Pages/Invoices/Edit.cshtml.cs b/EveryThing/Pages/Invoices/Edit.cshtml.cs
index 9c750cd..6e1b167 100644
--- a/EveryThing/Pages/Invoices/Edit.cshtml.cs
+++ b/EveryThing/Pages/Invoices/Edit.cshtml.cs
@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Authorization;
using EveryThing.Models.Project;
using System.Text.Json;
+using EveryThing.Models.Invoice;
using static EveryThing.Pages.Projects.EditModel;
namespace EveryThing.Pages.Invoices
@@ -106,10 +107,26 @@ namespace EveryThing.Pages.Invoices
return Page();
}
+ //var oldInvoice = _context.Invoices.FirstOrDefault(x => x.IdInvoice == Invoice.IdInvoice);
+
+ var statusChanged = true;//oldInvoice == null || oldInvoice.State != Invoice.State;
+
Invoice.PostText = Invoice.PostText.Replace("
| + # + | ++ Partner + | ++ Datum + | ++ Datum odpreme + | ++ Status + | +Pokaži vse | +
|---|---|---|---|---|---|
| + @Html.DisplayFor(modelItem => invoice.InvoiceYear) - @Html.DisplayFor(modelItem => invoice.InvoiceNumber) + | ++ @Html.DisplayFor(x => invoice.Partner.Title) + | ++ @Html.DisplayFor(x => invoice.Date) + | ++ @Html.DisplayFor(x => invoice.DateOfDispatch) + | ++ @switch (invoice.State) + { + case Models.Invoice.Invoice.InvoiceState.Closed: + @Html.DisplayFor(modelItem => invoice.State) + break; + case Models.Invoice.Invoice.InvoiceState.Confirmed: + @Html.DisplayFor(modelItem => invoice.State) + break; + default: + @Html.DisplayFor(modelItem => invoice.State) + break; + } + | ++ + + | +