Compare commits
3 Commits
8349ce5b41
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| da7b320032 | |||
| 43efa11d9c | |||
| 5d492de137 |
@@ -173,6 +173,9 @@
|
||||
<th class="py-1 text-right">
|
||||
@Model.Translation.Price
|
||||
</th>
|
||||
<th class="py-1 text-right">
|
||||
@Model.Translation.Discount
|
||||
</th>
|
||||
<th class="py-1 text-right">
|
||||
@Model.Translation.Amount
|
||||
</th>
|
||||
@@ -222,6 +225,7 @@
|
||||
|| Model.Invoice.Type == Models.Invoice.Invoice.InvoiceType.BuyersOrder)
|
||||
{
|
||||
<td class="text-right">@Html.DisplayFor(x => item.Price)</td>
|
||||
<td class="text-right">@Html.DisplayFor(x => item.Discount)%</td>
|
||||
<td class="text-right">@Html.DisplayFor(x => item.TotalValue)</td>
|
||||
}
|
||||
else if (Model.Invoice.Type == Models.Invoice.Invoice.InvoiceType.Order)
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace EveryThing.Pages.Invoices
|
||||
public string Article { get; set; } = "Artikel";
|
||||
public string Quantity { get; set; } = "Količina";
|
||||
public string Price { get; set; } = "Cena";
|
||||
public string Discount { get; set; } = "Rabat";
|
||||
public string Amount { get; set; } = "Znesek";
|
||||
public string Dimensions { get; set; } = "Dimenzije";
|
||||
public string Total { get; set; } = "Skupaj";
|
||||
@@ -301,6 +302,7 @@ namespace EveryThing.Pages.Invoices
|
||||
OrderNumber = invoiceState == Invoice.InvoiceState.Offer ? "Anfrage No." : "Bestellnummer",
|
||||
Price = "Preis(€)",
|
||||
Quantity = "Menge(Stk)",
|
||||
Discount = "Rabatt",
|
||||
SwiftBic = "SWIFT/BIC",
|
||||
Total = "Gesamtsumme",
|
||||
Project = "Projekt",
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
@using System.Globalization
|
||||
@model EveryThing.Models.Project.ProjectPartItem
|
||||
|
||||
<tr data-idpartitem="@Model.IdProjectPartItem" style="cursor: pointer;" ondblclick="if(!$(event.target).closest('a,button,input').length) { $('[data-toggle=tooltip]').tooltip('hide'); $(this).find('.btn-tbl-inline-edit').click(); }">
|
||||
@{
|
||||
var hasNote = !string.IsNullOrWhiteSpace(Model.Note);
|
||||
}
|
||||
|
||||
<tr data-idpartitem="@Model.IdProjectPartItem" class="@(hasNote ? "project-part-item-has-note" : "")" style="cursor: pointer;" ondblclick="if(!$(event.target).closest('a,button,input').length) { $('[data-toggle=tooltip]').tooltip('hide'); $(this).find('.btn-tbl-inline-edit').click(); }">
|
||||
<td style="width: 20px;">
|
||||
@if(Model.Status != Models.Project.ProjectPartItemStatus.Shipped)
|
||||
{
|
||||
@@ -18,6 +22,10 @@
|
||||
@Html.DisplayFor(modelItem => Model.IdItemFk)
|
||||
}
|
||||
<br/>
|
||||
@if (hasNote)
|
||||
{
|
||||
<i class="fas fa-sticky-note text-warning mr-1" data-toggle="tooltip" data-placement="top" title="@Model.Note"></i>
|
||||
}
|
||||
@(Model.ProjectPartNumberFormatted)
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.project-part-item-has-note {
|
||||
background-color: #fff8e1;
|
||||
}
|
||||
|
||||
.tab-panel-invoices{
|
||||
height: 490px;
|
||||
overflow-y: auto;
|
||||
@@ -195,7 +199,7 @@
|
||||
<tbody>
|
||||
@foreach (var invoice in Model.Invoices.Where(x => x.Type == Models.Invoice.Invoice.InvoiceType.Order))
|
||||
{
|
||||
<tr class="invoice-row" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem.IdProjectPartFk) ?? Array.Empty<int>())">
|
||||
<tr class="invoice-row" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem?.IdProjectPartFk ?? 0) ?? Array.Empty<int>())">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => invoice.InvoiceYear) - @Html.DisplayFor(modelItem => invoice.InvoiceNumber)
|
||||
</td>
|
||||
@@ -261,7 +265,7 @@
|
||||
<tbody>
|
||||
@foreach (var invoice in Model.Invoices.Where(x => x.Type == Models.Invoice.Invoice.InvoiceType.DeliveryNote))
|
||||
{
|
||||
<tr class="invoice-row" data-idinvoice="@invoice.IdInvoice" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem.IdProjectPartFk) ?? Array.Empty<int>())">
|
||||
<tr class="invoice-row" data-idinvoice="@invoice.IdInvoice" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem?.IdProjectPartFk ?? 0) ?? Array.Empty<int>())">
|
||||
<td style="width: 20px;">
|
||||
@if (invoice.State == Invoice.InvoiceState.Confirmed)
|
||||
{
|
||||
@@ -331,7 +335,7 @@
|
||||
<tbody>
|
||||
@foreach (var invoice in Model.Invoices.Where(x => x.Type == Models.Invoice.Invoice.InvoiceType.Invoice))
|
||||
{
|
||||
<tr class="invoice-row" data-idinvoice="@invoice.IdInvoice" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem.IdProjectPartFk) ?? Array.Empty<int>())">
|
||||
<tr class="invoice-row" data-idinvoice="@invoice.IdInvoice" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem?.IdProjectPartFk ?? 0) ?? Array.Empty<int>())">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => invoice.InvoiceYear) - @Html.DisplayFor(modelItem => invoice.InvoiceNumber)
|
||||
</td>
|
||||
@@ -533,7 +537,7 @@
|
||||
<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) ?? Array.Empty<int>())">
|
||||
<tr class="invoice-row" data-idparts="@string.Join(",", invoice.InvoiceInvoiceItem?.Select(x => x.ProjectPartItem?.IdProjectPartFk ?? 0) ?? Array.Empty<int>())">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => invoice.InvoiceYear) - @Html.DisplayFor(modelItem => invoice.InvoiceNumber)
|
||||
</td>
|
||||
@@ -748,6 +752,7 @@
|
||||
<button class="btn btn-secondary" onclick="createOrderSelectPartner(true, 2); return false;">Kreiraj povpraševanje izdelka</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-secondary" onclick="bulkPrintPartItems(); return false;"><i class="ion ion-md-print"></i> Natisni naloge</button>
|
||||
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
@@ -877,6 +882,16 @@
|
||||
function tooltips() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
|
||||
function bulkPrintPartItems() {
|
||||
let ids = getSelectedPartItems();
|
||||
if (ids.length <= 0) {
|
||||
alert("Izberi pozicije!");
|
||||
return;
|
||||
}
|
||||
window.open('/Projects/PrintPartItem?ids=' + ids.join(','), '_blank');
|
||||
}
|
||||
|
||||
function createOrderSelectPartner(inquiry, positionsType) {
|
||||
$.blockUI();
|
||||
$.ajax({
|
||||
|
||||
@@ -39,99 +39,114 @@
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
<div class="card pt-2" style="width: 595pt; margin-bottom:10px;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 text-right">
|
||||
<button id="btnPrint" type="button" class="btn btn-sm btn-primary btn-print ladda-button pull-right" data-style="zoom-out"><i class="ion ion-md-print"></i> Natisni</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card pt-2" style="width: 595pt">
|
||||
<div id="print-content" class="card-body pb-4 pl-4 pt-0" style="padding-right: 2rem !important">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<address class="mb-0">
|
||||
<strong>@Html.DisplayFor(modelItem => Model.PartItem.ProjectPart.Project.Company.Title)</strong> <br/>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<h4 class="font-weight-bold mb-3">
|
||||
Projekt št.: @Html.DisplayFor(modelItem => Model.PartItem.ProjectPart.Project.ProjectNumberFormatted)
|
||||
</h4>
|
||||
|
||||
<div class="text-big mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
@Html.DisplayFor(modelItem => Model.PartItem.ProjectPart.Project.Title)
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Del projekta</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.ProjectPartNumberFormatted)</strong>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Artikel</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.Item.Title)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Material</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.Material.Title)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Dimenzije surovca</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.MaterialDimensions)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Število kosov</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.NumberOfItems)</strong>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.PartItem.ProjectPart.PathOfPlans))
|
||||
@for (int i = 0; i < Model.Items.Count; i++)
|
||||
{
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Pot načrtov</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => Model.PartItem.ProjectPart.PathOfPlans)</strong>
|
||||
</div>
|
||||
}
|
||||
var item = Model.Items[i];
|
||||
<div style="@(i > 0 ? "page-break-before: always;" : "")">
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.PartItem.Note))
|
||||
{
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<br />
|
||||
<i class="">@Html.DisplayFor(modelItem => Model.PartItem.Note)</i>
|
||||
</div>
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<address class="mb-0">
|
||||
<strong>@Html.DisplayFor(modelItem => item.PartItem.ProjectPart.Project.Company.Title)</strong> <br/>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
|
||||
<h6>Operacije</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table m-0 table-bordered">
|
||||
<thead style="font-size: 0.75rem">
|
||||
<tr>
|
||||
<th style="width: 30px">#</th>
|
||||
<th class="py-1">
|
||||
Operacija
|
||||
</th>
|
||||
<th class="py-1" style="width: 150px">
|
||||
Čas
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="font-size: 0.75rem">
|
||||
@foreach (var item in Model.Operations)
|
||||
{
|
||||
<h4 class="font-weight-bold mb-3">
|
||||
Projekt št.: @Html.DisplayFor(modelItem => item.PartItem.ProjectPart.Project.ProjectNumberFormatted)
|
||||
</h4>
|
||||
|
||||
<div class="text-big mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
@Html.DisplayFor(modelItem => item.PartItem.ProjectPart.Project.Title)
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Del projekta</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.ProjectPartNumberFormatted)</strong>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Artikel</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.Item.Title)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Material</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.Material.Title)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Dimenzije surovca</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.MaterialDimensions)</strong>
|
||||
</div>
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Število kosov</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.NumberOfItems)</strong>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(item.PartItem.ProjectPart.PathOfPlans))
|
||||
{
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<label style="margin-top: 0 !important; margin-bottom: 0 !important;">Pot načrtov</label>:
|
||||
<strong class="font-weight-semibold">@Html.DisplayFor(modelItem => item.PartItem.ProjectPart.PathOfPlans)</strong>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(item.PartItem.Note))
|
||||
{
|
||||
<div class="mb-3" style="margin-top: 0 !important; margin-bottom: 0 !important;">
|
||||
<br />
|
||||
<i class="">@Html.DisplayFor(modelItem => item.PartItem.Note)</i>
|
||||
</div>
|
||||
}
|
||||
|
||||
<br/>
|
||||
|
||||
<h6>Operacije</h6>
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table m-0 table-bordered">
|
||||
<thead style="font-size: 0.75rem">
|
||||
<tr>
|
||||
<td>
|
||||
@(Model.Operations.IndexOf(item) + 1)
|
||||
</td>
|
||||
<td>@Html.DisplayFor(x => item.Operation.Title)</td>
|
||||
<td></td>
|
||||
<th style="width: 30px">#</th>
|
||||
<th class="py-1">
|
||||
Operacija
|
||||
</th>
|
||||
<th class="py-1" style="width: 150px">
|
||||
Čas
|
||||
</th>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody style="font-size: 0.75rem">
|
||||
@{ var opIndex = 0; }
|
||||
@foreach (var op in item.Operations)
|
||||
{
|
||||
opIndex++;
|
||||
<tr>
|
||||
<td>@opIndex</td>
|
||||
<td>@Html.DisplayFor(x => op.Operation.Title)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button id="btnPrint" type="button" class="btn btn-primary btn-print ladda-button pull-right" data-style="zoom-out"><i class="ion ion-md-print"></i> Natisni</button>
|
||||
</div>
|
||||
</div>
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
@@ -19,14 +19,18 @@ namespace EveryThing.Pages.Projects
|
||||
[Authorize(Roles = "Administrator,InvoicingUser,ProjecThingUser")]
|
||||
public class PrintPartItem : PageModel
|
||||
{
|
||||
|
||||
public class PrintPartItemData
|
||||
{
|
||||
public ProjectPartItem PartItem { get; set; }
|
||||
public IList<ProjectPartItemOperation> Operations { get; set; }
|
||||
}
|
||||
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly UserManager<IdentityApplicationUser> _userManager;
|
||||
|
||||
public ProjectPartItem PartItem { get; set; }
|
||||
|
||||
public IList<ProjectPartItemOperation> Operations { get; set; }
|
||||
public IList<PrintPartItemData> Items { get; set; } = new List<PrintPartItemData>();
|
||||
|
||||
public PrintPartItem(ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager)
|
||||
{
|
||||
@@ -34,27 +38,57 @@ namespace EveryThing.Pages.Projects
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetAsync(int id)
|
||||
public async Task<IActionResult> OnGetAsync(int? id, string ids)
|
||||
{
|
||||
var user = _userManager.GetUserAsync(User).Result;
|
||||
|
||||
PartItem = await _context.ProjectPartItems
|
||||
.Include(x => x.ProjectPart)
|
||||
.ThenInclude(x => x.Project)
|
||||
.ThenInclude(x => x.Company)
|
||||
.Include(x => x.Material)
|
||||
.Include(x => x.Item)
|
||||
.FirstOrDefaultAsync(x => x.IdProjectPartItem == id && x.ProjectPart.Project.Company.IdCompany == user.IdCompanyFk);
|
||||
var itemIds = new List<int>();
|
||||
|
||||
if (PartItem == null)
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
itemIds = ids.Split(',', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => int.TryParse(x.Trim(), out var v) ? v : 0)
|
||||
.Where(x => x > 0)
|
||||
.ToList();
|
||||
}
|
||||
else if (id.HasValue)
|
||||
{
|
||||
itemIds.Add(id.Value);
|
||||
}
|
||||
|
||||
if (!itemIds.Any())
|
||||
return NotFound();
|
||||
|
||||
|
||||
Operations = await _context.ProjectPartItemOperations
|
||||
.Include(x => x.Operation)
|
||||
.Where(x => x.IdProjectPartItemFk == PartItem.IdProjectPartItem)
|
||||
var partItems = await _context.ProjectPartItems
|
||||
.Include(x => x.ProjectPart)
|
||||
.ThenInclude(x => x.Project)
|
||||
.ThenInclude(x => x.Company)
|
||||
.Include(x => x.Material)
|
||||
.Include(x => x.Item)
|
||||
.Where(x => itemIds.Contains(x.IdProjectPartItem) && x.ProjectPart.Project.Company.IdCompany == user.IdCompanyFk)
|
||||
.ToListAsync();
|
||||
|
||||
if (!partItems.Any())
|
||||
return NotFound();
|
||||
|
||||
var allOperations = await _context.ProjectPartItemOperations
|
||||
.Include(x => x.Operation)
|
||||
.Where(x => itemIds.Contains(x.IdProjectPartItemFk))
|
||||
.OrderBy(x => x.Order)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var partItem in partItems.OrderBy(x => itemIds.IndexOf(x.IdProjectPartItem)))
|
||||
{
|
||||
Items.Add(new PrintPartItemData
|
||||
{
|
||||
PartItem = partItem,
|
||||
Operations = allOperations.Where(x => x.IdProjectPartItemFk == partItem.IdProjectPartItem).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
// Keep backward compatibility for single-item references
|
||||
PartItem = Items.First().PartItem;
|
||||
Operations = Items.First().Operations;
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user