tiskanje in posiljanje po mailo

This commit is contained in:
2026-03-03 09:16:17 +01:00
parent 1da4b1e751
commit 4cdfbace03
7 changed files with 258 additions and 55 deletions

View File

@@ -739,14 +739,15 @@
</div>
<div class="card-footer py-3">
<div class="row">
<div class="col-6">
<div class="col-9">
<button class="btn btn-success" onclick="createOrderSelectPartner(false); return false;">Kreiraj naročilo</button>
<button class="btn btn-success" onclick="createOrderSelectPartner(true); return false;">Kreiraj povpraševanje</button>
<button class="btn btn-success" onclick="createOrderSelectPartner(true); return false;">Kreiraj povpraševanje materiala</button>
<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>
</div>
<div class="col-6 text-right">
<div class="col-3 text-right">
<a asp-page="CreatePart" asp-route-idProject="@Model.Project.IdProject" class="btn btn-primary pull-right">Nov del projekta</a>
</div>
</div>
@@ -867,7 +868,7 @@
function tooltips() {
$('[data-toggle="tooltip"]').tooltip();
}
function createOrderSelectPartner(inquiry) {
function createOrderSelectPartner(inquiry, positionsType) {
$.blockUI();
$.ajax({
type: "GET",
@@ -895,7 +896,7 @@
}
}).then((result) => {
if (result.isConfirmed) {
createOrder(inquiry, result.value);
createOrder(inquiry, result.value, positionsType);
}
});
} else {
@@ -914,10 +915,14 @@
});
}
function createOrder(inquiry, idPartner) {
function createOrder(inquiry, idPartner, positionsType) {
if (idPartner == null || idPartner == undefined || isNaN(idPartner))
idPartner = 0;
if (isNaN(positionsType) || positionsType == null || positionsType == undefined){
positionsType = 1;
}
let object = getSelectedPartItems();
if (object.length <= 0) {
@@ -932,7 +937,7 @@
$('input:hidden[name="__RequestVerificationToken"]').val());
},
url: "Edit/?handler=CreateOrder",
data: { itemsJson: JSON.stringify(object), inquiry: inquiry, idPartner: idPartner },
data: { itemsJson: JSON.stringify(object), inquiry: inquiry, idPartner: idPartner, positionsType: positionsType },
success: function(data) {
if (data.successful) {
if (inquiry) {

View File

@@ -272,7 +272,7 @@ namespace EveryThing.Pages.Projects
return new JsonResult(new { error = "", successful = true, idInvoice });
}
public IActionResult OnPostCreateOrder(string itemsJson, bool inquiry, int idPartner)
public IActionResult OnPostCreateOrder(string itemsJson, bool inquiry, int idPartner, int positionsType)
{
var user = _userManager.GetUserAsync(User).Result;
@@ -330,16 +330,24 @@ namespace EveryThing.Pages.Projects
{
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 * projectPartItem.NumberOfSets
Quantity = projectPartItem.NumberOfItems
Discount = 0,
IdInvoiceFk = idInvoice,
IdProjectPartItem = projectPartItem.IdProjectPartItem,
Note = "",
Price = projectPartItem.MaterialPrice,
Quantity = projectPartItem.NumberOfItems
};
if (positionsType == 2)
{
newInvoiceItem.IdItemFk = projectPartItem.IdItemFk;
}
else
{
newInvoiceItem.IdItemFk = projectPartItem.IdMaterialFk;
newInvoiceItem.ItemDescription = projectPartItem.MaterialDimensions;
}
_context.InvoiceItems.Add(newInvoiceItem);
}
_context.SaveChanges();