194 lines
6.9 KiB
Plaintext
194 lines
6.9 KiB
Plaintext
@page
|
|
@using System.Web
|
|
@using EveryThing.Models.Invoice
|
|
@using Org.BouncyCastle.Asn1
|
|
@model EveryThing.Pages.Projects.PrintProjectPartPathsModel
|
|
|
|
@{
|
|
ViewData["Title"] = "Izpis";
|
|
Layout = "~/Pages/Layouts/_Layout.cshtml";
|
|
}
|
|
|
|
<style type="text/css">
|
|
table {
|
|
page-break-inside: auto;
|
|
color: black !important;
|
|
}
|
|
|
|
tr {
|
|
page-break-inside: avoid;
|
|
page-break-after: auto
|
|
}
|
|
|
|
thead {
|
|
display: table-header-group
|
|
}
|
|
|
|
tfoot {
|
|
display: table-footer-group
|
|
}
|
|
|
|
body {
|
|
color: black !important;
|
|
}
|
|
</style>
|
|
|
|
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
|
<span>
|
|
<span class="text-muted font-weight-light">
|
|
Projekt poti /</span> Izpis
|
|
</span>
|
|
</h4>
|
|
|
|
<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-6 h-100 my-auto">
|
|
@*<img src="~/img/logos/trans-fer.png"/>*@
|
|
<img src="~/img/logos/@Html.DisplayFor(modelItem => Model.Project.Company.LogoFileName)"/>
|
|
</div>
|
|
<div class="col-6">
|
|
<address class="mb-0">
|
|
<strong>@Html.DisplayFor(modelItem => Model.Project.Company.Title)</strong>
|
|
</address>
|
|
</div>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<address class="mb-2">
|
|
<strong>@Html.DisplayFor(modelItem => Model.ProjectNumber)</strong> <br/>
|
|
</address>
|
|
|
|
<div class="table-responsive mb-4">
|
|
<table class="table m-0">
|
|
<thead style="font-size: 0.75rem">
|
|
<tr>
|
|
<th class="py-1">
|
|
Projekt - Artikel
|
|
<br/>
|
|
Pot
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody style="font-size: 0.75rem">
|
|
@foreach (var item in Model.Items)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@item.ProjectPartNumberFormatted - @item.Item.Title
|
|
<br>
|
|
@item.Item.Description
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<div style="display: none" id="footer1">@Html.DisplayFor(modelItem => Model.Project.Company.Title), @Html.DisplayFor(modelItem => Model.Project.Company.Street) @Html.DisplayFor(modelItem => Model.Project.Company.HouseNumber), @Html.DisplayFor(modelItem => Model.Project.Company.PostNumber) @Html.DisplayFor(modelItem => Model.Project.Company.Post), @Html.DisplayFor(modelItem => Model.Project.Company.Country.TranslationSlovenian); ID za DDV: @Html.DisplayFor(modelItem => Model.Project.Company.TaxNumber), E-pošta: @Html.DisplayFor(modelItem => Model.Project.Company.Email)</div>
|
|
<div style="display: none" id="footer2">Tel.: @Html.DisplayFor(modelItem => Model.Project.Company.Phone), @Html.DisplayFor(modelItem => Model.Project.Company.Bank); IBAN: @Html.DisplayFor(modelItem => Model.Project.Company.Iban); SWIFT/BIC: @Html.DisplayFor(modelItem => Model.Project.Company.SwiftBic)</div>
|
|
|
|
</div>
|
|
<div class="card-footer">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
</div>
|
|
<div class="col-6 text-right">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
@Html.AntiForgeryToken()
|
|
|
|
@section Scripts {
|
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
|
|
|
<!-- PDF -->
|
|
<script src="~/vendor/libs/html2pdf.js/dist/html2pdf.bundle.min.js" asp-append-version="true"></script>
|
|
|
|
<script>
|
|
var laddaPrint = Ladda.create(document.querySelector('#btnPrint'));
|
|
var laddaPrintAndConfirm = document.querySelector('#btnPrintAndConfirm') == null ? null : Ladda.create(document.querySelector('#btnPrintAndConfirm'));
|
|
|
|
var element = document.getElementById('print-content');
|
|
var opt = {
|
|
//pagebreak: { mode: 'avoid-all' },
|
|
filename: 'nalog.pdf',
|
|
image: { type: 'png' },
|
|
enableLinks: false,
|
|
margin: [5, 0, 13, 0],
|
|
html2canvas: {
|
|
scale: 1.2,
|
|
scrollX: 0,
|
|
scrollY: 0,
|
|
dpi: 300,
|
|
letterRendering: true
|
|
},
|
|
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
|
|
};
|
|
|
|
function print(confirm) {
|
|
laddaPrint.start();
|
|
if (laddaPrintAndConfirm != null) {
|
|
laddaPrintAndConfirm.start();
|
|
}
|
|
|
|
|
|
html2pdf().set(opt).from(element).toPdf().get('pdf').then(function (pdf) {
|
|
|
|
var totalPages = pdf.internal.getNumberOfPages();
|
|
for (i = 1; i <= totalPages; i++) {
|
|
pdf.setPage(i);
|
|
pdf.setFontSize(8);
|
|
pdf.setTextColor(0);
|
|
var fontSize = pdf.internal.getFontSize();
|
|
var pageWidth = pdf.internal.pageSize.width;
|
|
|
|
var txt = $('#footer1').text();
|
|
var txtWidth = pdf.getStringUnitWidth(txt) * fontSize / pdf.internal.scaleFactor;
|
|
var x = (pageWidth - txtWidth) / 2;
|
|
|
|
pdf.text(x, pdf.internal.pageSize.getHeight() - 8, txt);
|
|
|
|
txt = $('#footer2').text();
|
|
txtWidth = pdf.getStringUnitWidth(txt) * fontSize / pdf.internal.scaleFactor;
|
|
x = (pageWidth - txtWidth) / 2;
|
|
|
|
pdf.text(x, pdf.internal.pageSize.getHeight() - 5, txt);
|
|
|
|
//pdf.addImage("YOUR_IMAGE", 'JPEG', pdf.internal.pageSize.getWidth() - 1.1, pdf.internal.pageSize.getHeight() - 0.25, 1, 0.2);
|
|
}
|
|
laddaPrint.stop();
|
|
if (laddaPrintAndConfirm != null) {
|
|
laddaPrintAndConfirm.stop();
|
|
}
|
|
|
|
//window.open(pdf.output('bloburl'), '_blank');
|
|
let link = document.createElement('a');
|
|
link.target = '_blank';
|
|
link.href = pdf.output('bloburl');
|
|
link.download = '@Model.ProjectNumber.Replace("-", "_")';
|
|
link.click();
|
|
link.remove();
|
|
if (confirm) {
|
|
confirmInvoice();
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
//print();
|
|
});
|
|
|
|
$(".btn-print").click(function () {
|
|
print($(this).attr("data-confirm") === 'true');
|
|
});
|
|
|
|
</script>
|
|
} |