+ Timeout logout
+ Pred kreiranjem povpraševanja vprašaj za partnerja + Prikaz TOP 100 (predolgo nalaga) + Dodaj Sorovec na Urejanje Artikla (zadnji surovec) + V Urejanju artikla popravi opis v pot dokumentov + Kooperant
This commit is contained in:
16
EveryThing/Keys/key-e803459e-6187-453a-92e2-246643ca1beb.xml
Normal file
16
EveryThing/Keys/key-e803459e-6187-453a-92e2-246643ca1beb.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<key id="e803459e-6187-453a-92e2-246643ca1beb" version="1">
|
||||||
|
<creationDate>2025-07-18T03:36:53.332167Z</creationDate>
|
||||||
|
<activationDate>2025-07-18T03:36:53.2539748Z</activationDate>
|
||||||
|
<expirationDate>2025-10-16T03:36:53.2539748Z</expirationDate>
|
||||||
|
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
|
||||||
|
<descriptor>
|
||||||
|
<encryption algorithm="AES_256_CBC" />
|
||||||
|
<validation algorithm="HMACSHA256" />
|
||||||
|
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
|
||||||
|
<!-- Warning: the key below is in an unencrypted form. -->
|
||||||
|
<value>dvPmRFK1RknKgQ74zgbcJgxSjN+LpaD4ch2GfGpz1CiTymQOdtOjD+wIv/dtG62IaBfeB5+By3/i3EpBCKtLHg==</value>
|
||||||
|
</masterKey>
|
||||||
|
</descriptor>
|
||||||
|
</descriptor>
|
||||||
|
</key>
|
||||||
@@ -27,7 +27,7 @@ namespace EveryThing.Models.CodeTable
|
|||||||
[Display(Name = "Naziv")]
|
[Display(Name = "Naziv")]
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Opis")]
|
[Display(Name = "Pot dokumentov")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace EveryThing.Models.Invoice
|
|||||||
{
|
{
|
||||||
public class InvoiceStateAttribute : Attribute
|
public class InvoiceStateAttribute : Attribute
|
||||||
{
|
{
|
||||||
public string AllowedTypes { get; set; } = "0,1,2,3";
|
public string AllowedTypes { get; set; } = "0,1,2,3,4";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum InvoiceType
|
public enum InvoiceType
|
||||||
@@ -25,6 +25,8 @@ namespace EveryThing.Models.Invoice
|
|||||||
DeliveryNote = 2,
|
DeliveryNote = 2,
|
||||||
[Display(Name = "Naročilo kupca", ShortName = "Narocilo")]
|
[Display(Name = "Naročilo kupca", ShortName = "Narocilo")]
|
||||||
BuyersOrder = 3,
|
BuyersOrder = 3,
|
||||||
|
[Display(Name = "Kooperacija", ShortName = "Kooperacija")]
|
||||||
|
Cooperation = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum InvoiceState
|
public enum InvoiceState
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
<br />Cena skupaj: <b>@Model.TotalPrice €</b>
|
<br />Cena skupaj: <b>@Model.TotalPrice €</b>
|
||||||
<br />Prodajna cena: <b>@Model.SellingPrice €</b>
|
<br />Prodajna cena: <b>@Model.SellingPrice €</b>
|
||||||
<br />Razlika: <b>@Model.DifferenceInPricePercentage %</b>
|
<br />Razlika: <b>@Model.DifferenceInPricePercentage %</b>
|
||||||
|
<br />Material: <b>@Model.Material </b>
|
||||||
|
<br />Dimenzije surovca: <b>@Model.MaterialDimensions </b>
|
||||||
</div>
|
</div>
|
||||||
@if (Model.Files != null && Model.Files.Count > 0)
|
@if (Model.Files != null && Model.Files.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ namespace EveryThing.Pages.CodeTableItems
|
|||||||
public string TotalPrice { get; set; }
|
public string TotalPrice { get; set; }
|
||||||
public string SellingPrice { get; set; }
|
public string SellingPrice { get; set; }
|
||||||
public string DifferenceInPricePercentage { get; set; }
|
public string DifferenceInPricePercentage { get; set; }
|
||||||
|
public string MaterialDimensions { get; set; }
|
||||||
|
public string Material { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ApplicationDbContext _context;
|
private readonly ApplicationDbContext _context;
|
||||||
@@ -51,17 +52,29 @@ namespace EveryThing.Pages.CodeTableItems
|
|||||||
{
|
{
|
||||||
var user = _userManager.GetUserAsync(User).Result;
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
ViewData["SearchString"] = searchString;
|
ViewData["SearchString"] = searchString ?? "";
|
||||||
|
|
||||||
|
var search = !string.IsNullOrEmpty(searchString);
|
||||||
|
|
||||||
Item = await _context.CodeTableItems
|
Item = await _context.CodeTableItems
|
||||||
.Where(x => x.IdCompanyFk == user.IdCompanyFk)
|
.Where(x => x.IdCompanyFk == user.IdCompanyFk
|
||||||
.Include(j => j.Company).ToListAsync();
|
&& EF.Functions.Like(x.Title, $"%{searchString}%")
|
||||||
|
|| EF.Functions.Like(x.Description, $"%{searchString}%"))
|
||||||
|
.Include(j => j.Company).Take(100).ToListAsync();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchString))
|
//Item = await _context.CodeTableItems
|
||||||
{
|
// .Where(x => x.IdCompanyFk == user.IdCompanyFk
|
||||||
Item = Item.Where(s => s.Title.Contains(searchString, StringComparison.InvariantCultureIgnoreCase)
|
// && (!search
|
||||||
|| (s.Description != null && s.Description.Contains(searchString, StringComparison.InvariantCultureIgnoreCase))).ToList();
|
// || 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 workPrice = 0d;
|
||||||
var sellingPrice = 0d;
|
var sellingPrice = 0d;
|
||||||
var differenceInPricePercentage = 0d;
|
var differenceInPricePercentage = 0d;
|
||||||
|
var materialDimensions = "";
|
||||||
|
var material = "";
|
||||||
|
|
||||||
if (edit)
|
if (edit)
|
||||||
{
|
{
|
||||||
@@ -98,6 +113,7 @@ namespace EveryThing.Pages.CodeTableItems
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var projectPartItem = _context.ProjectPartItems
|
var projectPartItem = _context.ProjectPartItems
|
||||||
|
.Include(x => x.Material)
|
||||||
.OrderByDescending(x => x.DateModified)
|
.OrderByDescending(x => x.DateModified)
|
||||||
.ThenByDescending(x => x.IdProjectPartItem)
|
.ThenByDescending(x => x.IdProjectPartItem)
|
||||||
.FirstOrDefault(x => x.IdItemFk == item.IdItem);
|
.FirstOrDefault(x => x.IdItemFk == item.IdItem);
|
||||||
@@ -108,6 +124,8 @@ namespace EveryThing.Pages.CodeTableItems
|
|||||||
workPrice = projectPartItem.WorkPrice;
|
workPrice = projectPartItem.WorkPrice;
|
||||||
sellingPrice = projectPartItem.SellingPrice;
|
sellingPrice = projectPartItem.SellingPrice;
|
||||||
differenceInPricePercentage = projectPartItem.DifferenceInPricePercentage;
|
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")),
|
SellingPrice = sellingPrice.ToString("#,###,##0.00", new CultureInfo("sl-SI")),
|
||||||
TotalPrice = (materialPrice + workPrice).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")),
|
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
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
using System;
|
using EveryThing.Data;
|
||||||
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.Models;
|
using EveryThing.Models;
|
||||||
using EveryThing.Models.CodeTable;
|
using EveryThing.Models.CodeTable;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
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
|
namespace EveryThing.Pages.CodeTablePartners
|
||||||
{
|
{
|
||||||
@@ -49,5 +51,30 @@ namespace EveryThing.Pages.CodeTablePartners
|
|||||||
.ToList();
|
.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 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
case 3:
|
case 3:
|
||||||
<i>Naročila kupcev</i>
|
<i>Naročila kupcev</i>
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Kooperacije</i>
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<i>Fakture</i>
|
<i>Fakture</i>
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -56,6 +56,9 @@
|
|||||||
case 3:
|
case 3:
|
||||||
<i>Naročila kupcev</i>
|
<i>Naročila kupcev</i>
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Kooperacije</i>
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<i>Fakture</i>
|
<i>Fakture</i>
|
||||||
break;
|
break;
|
||||||
@@ -145,6 +148,9 @@
|
|||||||
case 3:
|
case 3:
|
||||||
<i>Naročilo kupca</i>
|
<i>Naročilo kupca</i>
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Kooperacija</i>
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<i>Faktura</i>
|
<i>Faktura</i>
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Identity;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using EveryThing.Models.Project;
|
using EveryThing.Models.Project;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using EveryThing.Models.Invoice;
|
||||||
using static EveryThing.Pages.Projects.EditModel;
|
using static EveryThing.Pages.Projects.EditModel;
|
||||||
|
|
||||||
namespace EveryThing.Pages.Invoices
|
namespace EveryThing.Pages.Invoices
|
||||||
@@ -106,11 +107,27 @@ namespace EveryThing.Pages.Invoices
|
|||||||
return Page();
|
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("<div><br></div>", "");
|
Invoice.PostText = Invoice.PostText.Replace("<div><br></div>", "");
|
||||||
Invoice.PreText = Invoice.PreText.Replace("<div><br></div>", "");
|
Invoice.PreText = Invoice.PreText.Replace("<div><br></div>", "");
|
||||||
|
|
||||||
_context.Attach(Invoice).State = EntityState.Modified;
|
_context.Attach(Invoice).State = EntityState.Modified;
|
||||||
|
|
||||||
|
if (Invoice.Type == Invoice.InvoiceType.Cooperation
|
||||||
|
&& statusChanged
|
||||||
|
&& Invoice.State == Invoice.InvoiceState.Closed)
|
||||||
|
{
|
||||||
|
await _context.InvoiceItems
|
||||||
|
.Where(x => x.IdInvoiceFk == Invoice.IdInvoice)
|
||||||
|
.Include(invoiceItem => invoiceItem.ProjectPartItem).ForEachAsync(x =>
|
||||||
|
{
|
||||||
|
x.ProjectPartItem.Status = ProjectPartItemStatus.Finished;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
case 3:
|
case 3:
|
||||||
<i>Naročila kupcev</i>
|
<i>Naročila kupcev</i>
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Kooperacije</i>
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<i>Fakture</i>
|
<i>Fakture</i>
|
||||||
break;
|
break;
|
||||||
@@ -127,7 +130,27 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="card-footer py-3 text-right">
|
<div class="card-footer py-3 text-right">
|
||||||
<a asp-page="Create" asp-route-type="@ViewData["Type"]" class="btn btn-primary">Vnos fakture</a>
|
<a asp-page="Create" asp-route-type="@ViewData["Type"]" class="btn btn-primary">@switch (@ViewData["Type"])
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
<i>Vnos naročila dobaviteljem</i>
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
<i>Vnos računa</i>
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
<i>Vnos dobavnice</i>
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
<i>Vnos naročila kupcev</i>
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Vnos kooperacije</i>
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
<i>Vnos fakture</i>
|
||||||
|
break;
|
||||||
|
}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
case 3:
|
case 3:
|
||||||
<i>Naročila kupcev</i>
|
<i>Naročila kupcev</i>
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
<i>Kooperacija</i>
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<i>Fakture</i>
|
<i>Fakture</i>
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ namespace EveryThing.Pages.Invoices
|
|||||||
case Invoice.InvoiceType.DeliveryNote:
|
case Invoice.InvoiceType.DeliveryNote:
|
||||||
Translation.InvoiceType = "Dobavnica";
|
Translation.InvoiceType = "Dobavnica";
|
||||||
break;
|
break;
|
||||||
|
case Invoice.InvoiceType.Cooperation:
|
||||||
|
Translation.InvoiceType = "Kooperacija";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Translation.InvoiceType = "Faktura";
|
Translation.InvoiceType = "Faktura";
|
||||||
break;
|
break;
|
||||||
@@ -231,6 +234,9 @@ namespace EveryThing.Pages.Invoices
|
|||||||
case Invoice.InvoiceType.DeliveryNote:
|
case Invoice.InvoiceType.DeliveryNote:
|
||||||
Translation.InvoiceType = "Lieferschein";
|
Translation.InvoiceType = "Lieferschein";
|
||||||
break;
|
break;
|
||||||
|
case Invoice.InvoiceType.Cooperation:
|
||||||
|
Translation.InvoiceType = "Zusammenarbeit";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Translation.InvoiceType = "Faktura";
|
Translation.InvoiceType = "Faktura";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -70,6 +70,9 @@
|
|||||||
<li class="sidenav-item@(currentPage.StartsWith("/Invoices/") && ViewData["Type"]?.ToString() == "2" ? " active" : "")">
|
<li class="sidenav-item@(currentPage.StartsWith("/Invoices/") && ViewData["Type"]?.ToString() == "2" ? " active" : "")">
|
||||||
<a asp-page="/Invoices/Index" asp-route-type="2" class="sidenav-link"><i class="sidenav-icon fas fa-file"></i><div>Dobavnice </div></a>
|
<a asp-page="/Invoices/Index" asp-route-type="2" class="sidenav-link"><i class="sidenav-icon fas fa-file"></i><div>Dobavnice </div></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="sidenav-item@(currentPage.StartsWith("/Invoices/") && ViewData["Type"]?.ToString() == "4" ? " active" : "")">
|
||||||
|
<a asp-page="/Invoices/Index" asp-route-type="4" class="sidenav-link"><i class="sidenav-icon fas fa-hands-helping"></i><div>Kooperacije </div></a>
|
||||||
|
</li>
|
||||||
}
|
}
|
||||||
@*<li class="sidenav-item">
|
@*<li class="sidenav-item">
|
||||||
<a asp-page="/Index" class="sidenav-link"><i class="sidenav-icon fas fa-ruler"></i><div>Planiranje</div></a>
|
<a asp-page="/Index" class="sidenav-link"><i class="sidenav-icon fas fa-ruler"></i><div>Planiranje</div></a>
|
||||||
|
|||||||
@@ -164,6 +164,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#files-project-part">Datoteke del projekta</a>
|
<a class="nav-link" data-toggle="tab" href="#files-project-part">Datoteke del projekta</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#invoice-cooperatioins">Koop.</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane tab-panel-invoices fade show active" id="invoice-orders">
|
<div class="tab-pane tab-panel-invoices fade show active" id="invoice-orders">
|
||||||
@@ -494,6 +497,69 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane tab-panel-invoices fade show" id="invoice-cooperatioins">
|
||||||
|
<div class="card-body" style="padding: 0.5rem">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Partner
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Datum
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Datum odpreme
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Status
|
||||||
|
</th>
|
||||||
|
<th><a href="Javascript:;" class="btn btn-sm btn-primary" onclick="showAllInvoices();">Pokaži vse</a></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var invoice in Model.Invoices.Where(x => x.Type == Invoice.InvoiceType.Cooperation))
|
||||||
|
{
|
||||||
|
<tr class="invoice-row" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem.Select(x => x.ProjectPartItem.IdProjectPartFk))">
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => invoice.InvoiceYear) - @Html.DisplayFor(modelItem => invoice.InvoiceNumber)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(x => invoice.Partner.Title)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(x => invoice.Date)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(x => invoice.DateOfDispatch)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@switch (invoice.State)
|
||||||
|
{
|
||||||
|
case Models.Invoice.Invoice.InvoiceState.Closed:
|
||||||
|
<span class='badge badge-success'>@Html.DisplayFor(modelItem => invoice.State)</span>
|
||||||
|
break;
|
||||||
|
case Models.Invoice.Invoice.InvoiceState.Confirmed:
|
||||||
|
<span class='badge badge-warning'>@Html.DisplayFor(modelItem => invoice.State)</span>
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
<span class='badge badge-info'>@Html.DisplayFor(modelItem => invoice.State)</span>
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<a class="btn btn-xs icon-btn btn-outline-primary borderless" asp-page="/Invoices/Print" asp-route-id="@invoice.IdInvoice" data-toggle="tooltip" data-placement="top" title="Tiskanje" data-state="primary"><i class="ion ion-md-print"></i></a>
|
||||||
|
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="/Invoices/Edit" asp-route-id="@invoice.IdInvoice" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -663,8 +729,9 @@
|
|||||||
<div class="card-footer py-3">
|
<div class="card-footer py-3">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<button class="btn btn-success" onclick="createOrder(false); return false;">Kreiraj naročilo</button>
|
<button class="btn btn-success" onclick="createOrderSelectPartner(false); return false;">Kreiraj naročilo</button>
|
||||||
<button class="btn btn-success" onclick="createOrder(true); return false;">Kreiraj povpraševanje</button>
|
<button class="btn btn-success" onclick="createOrderSelectPartner(true); return false;">Kreiraj povpraševanje</button>
|
||||||
|
<button class="btn btn-info" onclick="createCooperationSelectPartner(); return false;">Kreiraj kooperacijo</button>
|
||||||
<button class="btn btn-primary" onclick="createInvoice(); return false;">Kreiraj dobavnico</button>
|
<button class="btn btn-primary" onclick="createInvoice(); return false;">Kreiraj dobavnico</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -778,8 +845,57 @@
|
|||||||
function tooltips() {
|
function tooltips() {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
}
|
}
|
||||||
|
function createOrderSelectPartner(inquiry) {
|
||||||
|
$.blockUI();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/CodeTablePartners/Index/?handler=Partners",
|
||||||
|
data: {
|
||||||
|
suppliers: true
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$.unblockUI();
|
||||||
|
if (data.successful) {
|
||||||
|
console.log(data.jsonPartners);
|
||||||
|
(async () => {
|
||||||
|
|
||||||
|
const { value: idPartner } = await Swal.fire({
|
||||||
|
title: 'Izberi partnerja',
|
||||||
|
input: 'select',
|
||||||
|
inputOptions: JSON.parse(data.jsonPartners),
|
||||||
|
inputPlaceholder: 'Samodejno',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Potrdi',
|
||||||
|
cancelButtonText: 'Prekliči',
|
||||||
|
inputValidator: (value) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
createOrder(inquiry, idPartner);
|
||||||
|
})();
|
||||||
|
} else {
|
||||||
|
console.log(data);
|
||||||
|
Swal.fire('Napaka pri pridobivanju partnerjev',
|
||||||
|
data.error,
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
|
console.log(xhr);
|
||||||
|
alert(xhr.responseText);
|
||||||
|
$.unblockUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createOrder(inquiry, idPartner) {
|
||||||
|
if (idPartner == null || idPartner == undefined || isNaN(idPartner))
|
||||||
|
idPartner = 0;
|
||||||
|
|
||||||
function createOrder(inquiry) {
|
|
||||||
let object = getSelectedPartItems();
|
let object = getSelectedPartItems();
|
||||||
|
|
||||||
if (object.length <= 0) {
|
if (object.length <= 0) {
|
||||||
@@ -794,7 +910,7 @@
|
|||||||
$('input:hidden[name="__RequestVerificationToken"]').val());
|
$('input:hidden[name="__RequestVerificationToken"]').val());
|
||||||
},
|
},
|
||||||
url: "Edit/?handler=CreateOrder",
|
url: "Edit/?handler=CreateOrder",
|
||||||
data: { itemsJson: JSON.stringify(object), inquiry: inquiry },
|
data: { itemsJson: JSON.stringify(object), inquiry: inquiry, idPartner: idPartner },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.successful) {
|
if (data.successful) {
|
||||||
if (inquiry) {
|
if (inquiry) {
|
||||||
@@ -814,6 +930,92 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createCooperationSelectPartner() {
|
||||||
|
$.blockUI();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/CodeTablePartners/Index/?handler=Partners",
|
||||||
|
data: {
|
||||||
|
suppliers: true
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$.unblockUI();
|
||||||
|
if (data.successful) {
|
||||||
|
console.log(data.jsonPartners);
|
||||||
|
(async () => {
|
||||||
|
|
||||||
|
const { value: idPartner } = await Swal.fire({
|
||||||
|
title: 'Izberi partnerja',
|
||||||
|
input: 'select',
|
||||||
|
inputOptions: JSON.parse(data.jsonPartners),
|
||||||
|
inputPlaceholder: 'Izberi partnerja',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Potrdi',
|
||||||
|
cancelButtonText: 'Prekliči',
|
||||||
|
inputValidator: (value) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
if (value) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
resolve("Partner ni izbran!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (idPartner) {
|
||||||
|
createCooperation(idPartner);
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
} else {
|
||||||
|
console.log(data);
|
||||||
|
Swal.fire('Napaka pri pridobivanju partnerjev',
|
||||||
|
data.error,
|
||||||
|
'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
|
console.log(xhr);
|
||||||
|
alert(xhr.responseText);
|
||||||
|
$.unblockUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCooperation(idPartner) {
|
||||||
|
if (idPartner == null || idPartner == undefined || isNaN(idPartner))
|
||||||
|
idPartner = 0;
|
||||||
|
|
||||||
|
let object = getSelectedPartItems();
|
||||||
|
|
||||||
|
if (object.length <= 0) {
|
||||||
|
alert("Izberi pozicije!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.blockUI();
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
beforeSend: function(xhr) {
|
||||||
|
xhr.setRequestHeader("XSRF-TOKEN",
|
||||||
|
$('input:hidden[name="__RequestVerificationToken"]').val());
|
||||||
|
},
|
||||||
|
url: "Edit/?handler=CreateCooperation",
|
||||||
|
data: { itemsJson: JSON.stringify(object), idPartner: idPartner },
|
||||||
|
success: function(data) {
|
||||||
|
if (data.successful) {
|
||||||
|
window.location.href = '/Invoices/Edit?id=' + data.idInvoice;
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, ajaxOptions, thrownError) {
|
||||||
|
alert(xhr.responseText);
|
||||||
|
$.unblockUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function createInvoice() {
|
function createInvoice() {
|
||||||
let object = getSelectedPartItems();
|
let object = getSelectedPartItems();
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace EveryThing.Pages.Projects
|
|||||||
return Partial("DetailsPartItem", item);
|
return Partial("DetailsPartItem", item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult OnPostCreateOrder(string itemsJson, bool inquiry)
|
public IActionResult OnPostCreateCooperation(string itemsJson, int idPartner)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserAsync(User).Result;
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
@@ -197,6 +197,83 @@ namespace EveryThing.Pages.Projects
|
|||||||
var suppliers = _context.ProjectPartItems
|
var suppliers = _context.ProjectPartItems
|
||||||
.Where(x => itemsId.Contains(x.IdProjectPartItem))
|
.Where(x => itemsId.Contains(x.IdProjectPartItem))
|
||||||
.Select(x => x.IdMaterialSupplierFk).Distinct().ToList();
|
.Select(x => x.IdMaterialSupplierFk).Distinct().ToList();
|
||||||
|
|
||||||
|
if (idPartner > 0) //vse na izbranega partnerja
|
||||||
|
suppliers = new List<int?> { idPartner };
|
||||||
|
|
||||||
|
var idInvoice = -1;
|
||||||
|
|
||||||
|
foreach (var idSupplier in suppliers)
|
||||||
|
{
|
||||||
|
var invoice = _context.Invoices
|
||||||
|
.Include(x => x.InvoiceInvoiceItem)
|
||||||
|
.ThenInclude(x => x.ProjectPartItem)
|
||||||
|
.ThenInclude(x => x.ProjectPart)
|
||||||
|
.Where(x => x.State == Models.Invoice.Invoice.InvoiceState.New
|
||||||
|
&& x.Type == Models.Invoice.Invoice.InvoiceType.Cooperation
|
||||||
|
//Ce ze kateri item obstaja na dobavnici
|
||||||
|
&& x.InvoiceInvoiceItem.Any(invoiceItem => items.Select(item => item.ProjectPart.IdProjectFk).Contains(invoiceItem.ProjectPartItem.ProjectPart.IdProjectFk)))
|
||||||
|
.FirstOrDefault(x => x.IdPartnerFk == idSupplier);
|
||||||
|
|
||||||
|
|
||||||
|
if (invoice == null)
|
||||||
|
{
|
||||||
|
//Create new invoice
|
||||||
|
var newInvoice = new Models.Invoice.Invoice();
|
||||||
|
Pages.Invoices.CreateModel.SetNewInvoice(user.IdCompanyFk, Models.Invoice.Invoice.InvoiceType.Cooperation, ref newInvoice, _context);
|
||||||
|
newInvoice.IdPartnerFk = idSupplier;
|
||||||
|
newInvoice.Date = DateTime.Now.Date;
|
||||||
|
|
||||||
|
_context.Invoices.Add(newInvoice);
|
||||||
|
_context.SaveChanges();
|
||||||
|
idInvoice = newInvoice.IdInvoice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Add to existing invoice
|
||||||
|
idInvoice = invoice.IdInvoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var projectPartItem in items.Where(x => idPartner > 0 || //ce damo vse na izbranega partnerja
|
||||||
|
x.IdMaterialSupplierFk == idSupplier))
|
||||||
|
{
|
||||||
|
var newInvoiceItem = new Models.Invoice.InvoiceItem
|
||||||
|
{
|
||||||
|
Discount = 0,
|
||||||
|
IdInvoiceFk = idInvoice,
|
||||||
|
IdProjectPartItem = projectPartItem.IdProjectPartItem,
|
||||||
|
IdItemFk = projectPartItem.IdMaterialFk,
|
||||||
|
ItemDescription = projectPartItem.MaterialDimensions,
|
||||||
|
Note = "",
|
||||||
|
Price = projectPartItem.MaterialPrice,
|
||||||
|
Quantity = projectPartItem.NumberOfItems
|
||||||
|
};
|
||||||
|
_context.InvoiceItems.Add(newInvoiceItem);
|
||||||
|
}
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResult(new { error = "", successful = true, idInvoice });
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult OnPostCreateOrder(string itemsJson, bool inquiry, int idPartner)
|
||||||
|
{
|
||||||
|
var user = _userManager.GetUserAsync(User).Result;
|
||||||
|
|
||||||
|
var itemsId = JsonSerializer.Deserialize<List<int>>(itemsJson);
|
||||||
|
|
||||||
|
var items = _context.ProjectPartItems
|
||||||
|
.Include(x => x.ProjectPart)
|
||||||
|
.ThenInclude(x => x.Project)
|
||||||
|
.Where(x => itemsId.Contains(x.IdProjectPartItem)).ToList();
|
||||||
|
|
||||||
|
var suppliers = _context.ProjectPartItems
|
||||||
|
.Where(x => itemsId.Contains(x.IdProjectPartItem))
|
||||||
|
.Select(x => x.IdMaterialSupplierFk).Distinct().ToList();
|
||||||
|
|
||||||
|
if (idPartner > 0) //vse na izbranega partnerja
|
||||||
|
suppliers = new List<int?> { idPartner };
|
||||||
|
|
||||||
var idInvoice = -1;
|
var idInvoice = -1;
|
||||||
|
|
||||||
foreach (var idSupplier in suppliers)
|
foreach (var idSupplier in suppliers)
|
||||||
@@ -232,7 +309,8 @@ namespace EveryThing.Pages.Projects
|
|||||||
idInvoice = invoice.IdInvoice;
|
idInvoice = invoice.IdInvoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var projectPartItem in items.Where(x => x.IdMaterialSupplierFk == idSupplier))
|
foreach (var projectPartItem in items.Where(x => idPartner > 0 || //ce damo vse na izbranega partnerja
|
||||||
|
x.IdMaterialSupplierFk == idSupplier))
|
||||||
{
|
{
|
||||||
var newInvoiceItem = new Models.Invoice.InvoiceItem
|
var newInvoiceItem = new Models.Invoice.InvoiceItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace EveryThing
|
|||||||
// Session
|
// Session
|
||||||
services.AddSession(options =>
|
services.AddSession(options =>
|
||||||
{
|
{
|
||||||
options.IdleTimeout = TimeSpan.FromMinutes(15);
|
options.IdleTimeout = TimeSpan.FromHours(3);
|
||||||
options.Cookie.HttpOnly = true;
|
options.Cookie.HttpOnly = true;
|
||||||
options.Cookie.IsEssential = true;
|
options.Cookie.IsEssential = true;
|
||||||
options.Cookie.MaxAge = TimeSpan.FromHours(3);
|
options.Cookie.MaxAge = TimeSpan.FromHours(3);
|
||||||
@@ -129,7 +129,7 @@ namespace EveryThing
|
|||||||
options.LoginPath = $"/User/Login";
|
options.LoginPath = $"/User/Login";
|
||||||
options.LogoutPath = $"/User/Logout";
|
options.LogoutPath = $"/User/Logout";
|
||||||
options.AccessDeniedPath = $"/";
|
options.AccessDeniedPath = $"/";
|
||||||
options.ExpireTimeSpan = TimeSpan.FromMinutes(15);//Povecano na 15min
|
options.ExpireTimeSpan = TimeSpan.FromHours(3);//Povecano na 15min
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddDistributedMemoryCache();
|
services.AddDistributedMemoryCache();
|
||||||
|
|||||||
Reference in New Issue
Block a user