NonInventPurchasingSystem/CPRNIMS.WebApps/wwwroot/JsFunctions/PO/PrintingV2.js
2026-01-20 07:44:30 +08:00

1357 lines
52 KiB
JavaScript

function printDRPO() {
var purchasedby = document.getElementById('purchasedby').innerText;
printerSettingsDR(purchasedby);
}
function printSIPO() {
var purchasedby = document.getElementById('purchasedby').innerText;
printerSettingsSI(purchasedby);
}
function printerSettingsDR(purchaseBy) {
var printContent = document.getElementById('printableSIPO').innerHTML;
var printWindow = window.open('', '_blank', 'width=800,height=600');
if (purchaseBy == 'JEANE MAULAWIN') {
printWindow.document.write(`
<html>
<head>
<title>Print P.O. DR</title>
<style>
@media print {
body {
margin: 10px !important; /* Added !important to ensure margin */
padding: 10px !important; /* Added padding for inner spacing */
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt !important; /* Use pt for print media */
width: 8.5in;
height: 11in;
overflow: hidden;
position: relative;
page-break-after: avoid !important;
page-break-before: avoid !important;
}
.print-area {
width: 100%;
height: calc(11in - 0.5in); /* Adjust height to account for footer */
position: relative;
overflow: hidden;
page-break-after: avoid !important;
page-break-inside: avoid !important;
}
.content {
width: 100%;
height: calc(100% - 0.5in);
overflow: hidden;
}
.rowSupplier {
display: flex;
position: fixed;
top: 1.9in;
flex-direction: column;
margin-left: 85px;
}
.address {
display: block;
}
#address {
font-size: 8pt; /* Reduced from your default 10pt */
line-height: 1.1; /* Tighter line height */
display: block; /* Ensure it's a block element */
}
.col-md-4 {
width: 33%;
display: block;
}
table {
width: 97% !important;
position: fixed !important;
text-align: left !important;
top: 3.3in;
border-collapse: collapse;
border: none;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt !important;
table-layout: fixed;
}
th {
background-color: transparent;
}
/* Row alignment */
tr {
page-break-inside: avoid;
vertical-align: top;
}
th.qty, td.qty {
width: 10%; text-align: left;
}
th.uomName, td.uomName {
width: 10%; text-align: left;
font-size: 8pt !important;
word-wrap: break-word;
word-break: break-word;
}
th.itemNo, td.itemNo {
width: 15%; text-align: left;
}
th.unitPrice, td.unitPrice {
width: 10%;
text-align: left;
white-space:nowrap;
}
th.totalAmount, td.totalAmount {
width: 10%;
text-align: left;
}
td.unitPrice {
text-align: left !important;
white-space:nowrap;
}
td.totalAmount {
text-align: left !important;
}
th.itemDescription,
td.itemDescription {
text-align: left;
width:45% !important;
text-align: left!important;
font-size: 10pt !important;
}
#poSIDRRemarks {
display: block;
text-align: center;
margin: 10px auto;
font-size: 10pt;
font-weight: bold;
}
.break-line-row td {
height: 20px;
width: 85%;
margin: 0 auto;
background-color: transparent;
}
.text-center {
text-align: center;
}
.row {
display: flex;
justify-content: flex-center;
width: 100%;
margin: 10px;
}
th, td {
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt;
line-height: normal;
padding: 3px 5px;
height: 20px; /* Ensure minimum row height */
box-sizing: border-box; /* Ensure padding does not overflow */
}
.ml-auto {
margin-left: auto;
text-align: right;
padding-right: 10px;
}
.poReference {
display: flex;
flex-direction: column;
line-height: normal;
padding: 5px 0;
position: fixed;
top: 0.9in; /* Adjust vertical position */
right: .4in; /* Moves the container to the right side */
align-items: flex-start; /* Keeps content justified to the left */
text-align: left; /* Ensures text itself remains left-aligned */
padding-right: 10px; /* Optional: Add some padding from the right edge */
}
.po-details {
display: flex;
justify-content: flex-start;
margin-bottom: 5px;
}
.po-details strong {
margin-right: 1px;
}
.po-details span {
text-align: left;
display: inline-block;
margin-left: 15px;
}
#terms {
display: inline-block;
max-width: 12ch;
word-wrap: break-word;
white-space: normal;
}
.text-left {
text-align: left;
}
#totalGrossAmountContainer {
margin-top: 10px;
}
#totalAmountSIPO {
position: fixed;
bottom: 5.6in;
margin-right: 40px;
right: 10px;
text-align: right;
z-index: 1000;
}
.footer-row {
position: fixed; /* Change to fixed */
bottom: 5in;
left : 0;
right: 0;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: auto;
background-color: white;
margin: 0 5px; /* Add small margin to match body padding */
}
.footer-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 5px;
margin-right:15px;
height: auto; /* Remove fixed height */
}
/*.footer-span {
text-decoration: underline;
text-underline-position: under;
} */
/* Hide these images during printing */
#purchasedbyImage, #poApproverSIPOImage,#C-deliveryDate {
display: none;
}
/* Page Break Control */
.content, .table-container, .poRemarks, .footer-row {
page-break-inside: avoid;
}
/* Force single page */
.print-area, body {
-webkit-region-break-inside: avoid;
page-break-inside: avoid;
}
/* Prevent any content from creating additional pages */
* {
page-break-after: avoid;
page-break-before: avoid;
}
@page {
size: 8.5in 11in;
margin: 10px;
}
/* Force single page */
html, body {
height: 11in;
max-height: 11in !important;
overflow: hidden !important;
}
}
</style>
</head>
<body>
<div class="print-area">
${printContent}
</div>
<script>
// Enhanced print control
window.onbeforeprint = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
document.documentElement.style.overflow = 'hidden';
};
// Ensure proper rendering before print
window.onload = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
};
</script>
</body>
</html>
`);
} else {
printWindow.document.write(`
<html>
<head>
<title>Print P.O. DR</title>
<style>
@media print {
body {
margin: 10px !important; /* Added !important to ensure margin */
padding: 10px !important; /* Added padding for inner spacing */
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt !important; /* Use pt for print media */
width: 8.5in;
height: 11in;
overflow: hidden;
position: relative;
page-break-after: avoid !important;
page-break-before: avoid !important;
}
.print-area {
width: 100%;
height: calc(11in - 0.5in); /* Adjust height to account for footer */
position: relative;
overflow: hidden;
page-break-after: avoid !important;
page-break-inside: avoid !important;
}
.content {
width: 100%;
height: calc(100% - 0.5in);
overflow: hidden;
}
.rowSupplier {
display: flex;
position: fixed;
top: 1.8in;
flex-direction: column;
margin-left: 85px;
}
.address {
display: block;
}
.col-md-4 {
width: 33%;
display: block;
}
table {
width: 97% !important;
position: fixed !important;
text-align: left;
top: 3.1in;
border-collapse: collapse;
border: none;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt !important;
table-layout: fixed;
}
th {
background-color: transparent;
}
/* Row alignment */
tr {
page-break-inside: avoid;
vertical-align: top;
}
th.qty, td.qty {
width: 10%; text-align: left;
}
th.uomName, td.uomName {
width: 10%; text-align: left;
}
th.itemNo, td.itemNo {
width: 15%; text-align: left;
}
th.unitPrice, td.unitPrice {
width: 10%;
text-align: left;
white-space:nowrap;
}
th.totalAmount, td.totalAmount {
width: 10%;
text-align: left;
}
/* Fine-tune positioning */
td.unitPrice {
text-align: left !important;
white-space:nowrap;
}
td.totalAmount {
text-align: left !important;
}
th.itemDescription,
td.itemDescription {
text-align: left !important;
width: 40% !important;
}
#poSIDRRemarks {
display: block;
text-align: center;
margin: 10px auto;
font-size: 10pt;
font-weight: bold;
}
.break-line-row td {
height: 20px;
width: 85%;
margin: 0 auto;
background-color: transparent;
}
.text-center {
text-align: center;
}
.row {
display: flex;
justify-content: flex-center;
width: 100%;
margin: 10px;
}
th, td {
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt;
line-height: normal;
padding: 3px 5px;
height: 20px; /* Ensure minimum row height */
box-sizing: border-box; /* Ensure padding does not overflow */
}
.ml-auto {
margin-left: auto;
text-align: right;
padding-right: 10px;
}
.poReference {
display: flex;
flex-direction: column;
line-height: normal;
padding: 5px 0;
position: fixed;
top: 0.8in; /* Adjust vertical position */
right: .4in; /* Moves the container to the right side */
align-items: flex-start; /* Keeps content justified to the left */
text-align: left; /* Ensures text itself remains left-aligned */
padding-right: 10px; /* Optional: Add some padding from the right edge */
}
.po-details {
display: flex;
justify-content: flex-start;
margin-bottom: 5px;
}
.po-details strong {
margin-right: 1px;
}
.po-details span {
text-align: left;
display: inline-block;
margin-left: 15px;
}
#terms {
display: inline-block;
max-width: 12ch; /* Limits to approximately 10 characters */
word-wrap: break-word;
white-space: normal;
}
.text-left {
text-align: left;
}
#totalGrossAmountContainer {
margin-top: 10px;
}
#totalAmountSIPO {
position: fixed;
bottom: 5.7in; /* Positioned slightly above the footer-row */
margin-right: 40px;
right: 10px;
text-align: right;
z-index: 1000;
}
.footer-row {
position: fixed; /* Change to fixed */
bottom: 5.2in;
left : 0;
right: 0;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: auto;
background-color: white;
margin: 0 5px; /* Add small margin to match body padding */
}
.footer-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 5px;
margin-right:15px;
height: auto; /* Remove fixed height */
}
/*.footer-span {
text-decoration: underline;
text-underline-position: under;
} */
/* Hide these images during printing */
#purchasedbyImage, #poApproverSIPOImage,#C-deliveryDate {
display: none;
}
/* Page Break Control */
.content, .table-container, .poRemarks, .footer-row {
page-break-inside: avoid;
}
/* Force single page */
.print-area, body {
-webkit-region-break-inside: avoid;
page-break-inside: avoid;
}
/* Prevent any content from creating additional pages */
* {
page-break-after: avoid;
page-break-before: avoid;
}
@page {
size: 8.5in 11in;
margin: 10px;
}
/* Force single page */
html, body {
height: 11in;
max-height: 11in !important;
overflow: hidden !important;
}
}
</style>
</head>
<body>
<div class="print-area">
${printContent}
</div>
<script>
// Enhanced print control
window.onbeforeprint = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
document.documentElement.style.overflow = 'hidden';
};
// Ensure proper rendering before print
window.onload = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
};
</script>
</body>
</html>
`);
}
printWindow.document.close();
printWindow.focus();
setTimeout(function () {
printWindow.print();
printWindow.close();
}, 250);
}
function printerSettingsSI(purchaseBy) {
var printContent = document.getElementById('printableSIPO').innerHTML;
var printWindow = window.open('', '_blank', 'width=800,height=600');
if (purchaseBy == 'JEANE MAULAWIN') {
printWindow.document.write(`
<html>
<head>
<title>Print P.O. SI</title>
<style>
@media print {
body {
margin: 0 !important; /* Added !important to ensure margin */
padding: 0 !important; /* Added padding for inner spacing */
box-sizing: border-box;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
width: 8.5in;
height: 11in;
overflow: hidden;
position: relative;
page-break-after: avoid !important;
page-break-before: avoid !important;
}
.print-area {
width: 100%;
height: calc(11in - 0.5in); /* Adjust height to account for footer */
position: relative;
padding-right: 50px !important;
overflow: hidden;
page-break-after: avoid !important;
page-break-inside: avoid !important;
}
.content {
width: 100%;
height: calc(100% - 0.5in);
overflow: hidden;
}
.rowSupplier {
display: flex;
position: fixed; /* Change to fixed */
top: 1.6in;
flex-direction: column;
margin-left: 150px;
padding: 2px 0;
line-height: normal;
}
.address {
display: block;
}
#address {
font-size: 8pt; /* Reduced from your default 10pt */
line-height: 1.1; /* Tighter line height */
display: block; /* Ensure it's a block element */
}
.col-md-4 {
width: 33%;
display: block;
}
table {
width: 98%;
position: fixed !important;
text-align: center;
top: 2.5in;
border-collapse: collapse;
border: none;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
table-layout: fixed !important;
}
th {
background-color: transparent;
}
/* Row alignment */
tr {
page-break-inside: avoid;
vertical-align: top; /* Aligns content to top */
}
th.qty, td.qty {
width: 10%; text-align: center;
}
th.uomName, td.uomName {
width: 10%;
text-align: left;
padding-left: 30px !important;
padding-right: 0 !important;
font-size: 8pt !important;
word-wrap: break-word; /* Enable word wrapping */
word-break: break-word; /* Allow breaking at appropriate points */
}
th.itemNo, td.itemNo {
width: 15%; text-align: center;
}
th.unitPrice, td.unitPrice {
width: 10%;
text-align: left;
/*padding-left: 100px !important;*/
/*padding-right: 0 !important;*/
white-space:nowrap;
}
th.totalAmount, td.totalAmount {
width: 10%;
text-align: left;
padding-right: 0 !important;
}
/* Fine-tune positioning */
td.unitPrice {
text-align: left !important;
width: 10%;
padding-right: 0 !important;
white-space:nowrap;
}
td.totalAmount {
width: 10%;
text-align: left !important;
/*padding-left: 65px !important; padding-right: 0 !important;*/
}
th.itemDescription, td.itemDescription {
width: 45% !important;
text-align: left; /* Align content to the left */
padding-left: 10px !important;
font-size: 10pt !important;
max-width: 100%;
padding-right: 0 !important;
}
/* Add padding to space out rows */
th, td {
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
padding: 5px 5px; /* Add vertical and horizontal padding */
height: 20px; /* Ensure minimum row height */
box-sizing: border-box; /* Ensure padding does not overflow */
border: 1px solid transparent; /* Optional: Add borders for debugging alignment */
}
#poSIDRRemarks {
display: block;
text-align: center;
margin: 10px auto;
font-size: 10pt;
font-weight: bold;
}
.row {
display: flex;
justify-content: flex-center;
width: 100%;
margin: 10px;
}
.ml-auto {
margin-left: auto;
text-align: right;
padding-right: 10px;
}
.poReference {
display: flex;
flex-direction: column;
line-height: normal;
padding: 5px 0;
position: fixed;
top: 0.8in; /* Adjust vertical position */
right: .3in; /* Moves the container to the right side */
align-items: flex-start; /* Keeps content justified to the left */
text-align: left; /* Ensures text itself remains left-aligned */
padding-right: 10px; /* Optional: Add some padding from the right edge */
}
.po-details {
display: flex;
justify-content: flex-start;
margin-bottom: 5px;
}
.po-details strong {
margin-right: 1px;
}
.po-details span {
text-align: left;
display: inline-block;
margin-left: 15px;
}
#terms {
display: inline-block;
max-width: 12ch; /* Limits to approximately 10 characters */
word-wrap: break-word;
white-space: normal;
}
.text-left {
text-align: left;
}
#totalGrossAmountContainer {
margin-top: 10px;
}
#totalAmountSIPO {
position: fixed;
bottom: 4.3in; /* Positioned slightly above the footer-row */
margin-right: 40px;
right: 10px;
text-align: right;
z-index: 1000;
}
.footer-row {
position: fixed; /* Change to fixed */
bottom: 3.9in;
left : 0;
right: 0;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: auto;
line-height: normal;
background-color: white;
margin: 0 5px; /* Add small margin to match body padding */
}
.footer-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 5px;
line-height: normal;
margin-right:15px;
// height: auto; /* Remove fixed height */
}
/* Hide these images during printing */
#purchasedbyImage, #poApproverSIPOImage {
display: none;
}
.break-line-row td {
height: 20px;
width: 85%;
margin: 0 auto;
background-color: transparent;
}
/* Page Break Control */
.content, .table-container, .poRemarks, .footer-row {
page-break-inside: avoid;
}
/* Force single page */
.print-area, body {
-webkit-region-break-inside: avoid;
page-break-inside: avoid;
}
/* Prevent any content from creating additional pages */
* {
page-break-after: avoid;
page-break-before: avoid;
}
@page {
size: 8.5in 11in;
margin: 10px;
}
/* Force single page */
html, body {
height: 11in;
max-height: 11in !important;
overflow: hidden !important;
}
}
</style>
</head>
<body>
<div class="print-area">
${printContent}
</div>
<script>
// Enhanced print control
window.onbeforeprint = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
document.documentElement.style.overflow = 'hidden';
};
// Ensure proper rendering before print
window.onload = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
};
</script>
</body>
</html>
`);
printWindow.document.close();
printWindow.focus();
} else {
printWindow.document.write(`
<html>
<head>
<title>Print P.O. SI</title>
<style>
@media print {
body {
margin: 0 !important; /* Added !important to ensure margin */
padding: 0 !important; /* Added padding for inner spacing */
box-sizing: border-box;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
width: 8.5in;
height: 11in;
overflow: hidden;
position: relative;
page-break-after: avoid !important;
page-break-before: avoid !important;
}
.print-area {
width: 100%;
height: calc(11in - 0.5in); /* Adjust height to account for footer */
position: relative;
padding-right: 50px !important;
overflow: hidden;
page-break-after: avoid !important;
page-break-inside: avoid !important;
}
.content {
width: 100%;
height: calc(100% - 0.5in);
overflow: hidden;
}
.rowSupplier {
display: flex;
position: fixed; /* Change to fixed */
top: 1.5in;
flex-direction: column;
margin-left: 160px;
padding: 2px 0;
line-height: normal;
}
.address {
display: block;
}
#address {
font-size: 8pt; /* Reduced from your default 10pt */
line-height: 1.1; /* Tighter line height */
display: block; /* Ensure it's a block element */
}
.col-md-4 {
width: 33%;
display: block;
}
table {
width: 98% !important;
margin-right: 20px !important; /* Add right margin */
position: fixed !important;
text-align: center;
top: 2.4in;
border-collapse: collapse;
border: none;
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 8pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
table-layout: fixed !important;
}
th {
background-color: transparent;
}
/* Row alignment */
tr {
page-break-inside: avoid;
vertical-align: top; /* Aligns content to top */
}
th.qty, td.qty {
width: 10%; text-align: center;
}
th.uomName, td.uomName {
width: 7%;
text-align: left;
font-size: 8pt !important;
word-wrap: break-word; /* Enable word wrapping */
word-break: break-word; /* Allow breaking at appropriate points */
}
th.itemNo, td.itemNo {
width: 15%; text-align: left;
}
th.unitPrice, td.unitPrice {
width: 12%;
text-align: left;
white-space:nowrap;
}
th.totalAmount, td.totalAmount {
width: 13%;
text-align: right !important;
}
/* Format currency to ensure it fits */
td.unitPrice, td.totalAmount {
font-size: 9pt !important; /* Slightly smaller font */
}
/* Fine-tune positioning */
td.unitPrice {
text-align: left !important;
width: 10%;
padding-right: 0 !important;
white-space:nowrap;
}
td.totalAmount {
width: 10%;
text-align: left !important;
}
th.itemDescription, td.itemDescription {
width: 45% !important;
text-align: left;
font-size: 11pt !important;
max-width: 100%;
}
/* Add padding to space out rows */
th, td {
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 10pt; /* Ensure consistent font size */
line-height: normal; /* Avoid font clipping */
padding: 5px 5px; /* Add vertical and horizontal padding */
height: 20px; /* Ensure minimum row height */
box-sizing: border-box; /* Ensure padding does not overflow */
border: 1px solid transparent; /* Optional: Add borders for debugging alignment */
}
#poSIDRRemarks {
display: block;
text-align: center;
margin: 10px auto;
font-size: 10pt;
font-weight: bold;
}
.row {
display: flex;
justify-content: flex-center;
width: 100%;
margin: 10px;
}
.ml-auto {
margin-left: auto;
text-align: right;
padding-right: 10px;
}
.poReference {
display: flex;
flex-direction: column;
line-height: normal;
padding: 5px 0;
position: fixed;
top: 0.6in; /* Adjust vertical position */
right: .3in; /* Moves the container to the right side */
align-items: flex-start; /* Keeps content justified to the left */
text-align: left; /* Ensures text itself remains left-aligned */
padding-right: 10px; /* Optional: Add some padding from the right edge */
}
.po-details {
display: flex;
justify-content: flex-start;
margin-bottom: 5px;
}
.po-details strong {
margin-right: 1px;
}
.po-details span {
text-align: left;
display: inline-block;
margin-left: 15px;
}
#terms {
display: inline-block;
max-width: 12ch; /* Limits to approximately 10 characters */
word-wrap: break-word;
white-space: normal;
}
.text-left {
text-align: left;
}
#totalGrossAmountContainer {
margin-top: 10px;
}
#totalAmountSIPO {
position: fixed;
bottom: 4.4in; /* Positioned slightly above the footer-row */
margin-right: 40px;
right: 10px;
text-align: right;
z-index: 1000;
}
.footer-row {
position: fixed; /* Change to fixed */
bottom: 3.9in;
left : 0;
right: 0;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: auto;
line-height: normal;
background-color: white;
margin: 0 5px; /* Add small margin to match body padding */
}
.footer-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 5px;
line-height: normal;
margin-right:15px;
// height: auto; /* Remove fixed height */
}
/* Hide these images during printing */
#purchasedbyImage, #poApproverSIPOImage {
display: none;
}
.break-line-row td {
height: 20px;
width: 85%;
margin: 0 auto;
background-color: transparent;
}
/* Page Break Control */
.content, .table-container, .poRemarks, .footer-row {
page-break-inside: avoid;
}
/* Force single page */
.print-area, body {
-webkit-region-break-inside: avoid;
page-break-inside: avoid;
}
/* Prevent any content from creating additional pages */
* {
page-break-after: avoid;
page-break-before: avoid;
}
@page {
size: 8.5in 11in;
margin: 10px;
}
/* Force single page */
html, body {
height: 11in;
max-height: 11in !important;
overflow: hidden !important;
}
}
</style>
</head>
<body>
<div class="print-area">
${printContent}
</div>
<script>
// Enhanced print control
window.onbeforeprint = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
document.documentElement.style.overflow = 'hidden';
};
// Ensure proper rendering before print
window.onload = function() {
document.body.style.height = '11in';
document.body.style.maxHeight = '11in';
document.body.style.overflow = 'hidden';
};
</script>
</body>
</html>
`);
}
printWindow.document.close();
printWindow.focus();
setTimeout(function () {
printWindow.print();
printWindow.close();
}, 250);
}
function printImportPO() {
var printContent = document.getElementById('printableContent').innerHTML;
var printWindow = window.open('', '', 'width=800,height=600');
printWindow.document.write('<html><head><title>Print PO Details</title>');
printWindow.document.write('<style>');
printWindow.document.write(`
body {
font-family: "Consolas", "Courier New", Courier, monospace;
margin: 10px;
font-size: 12px; /* Reduced base font size */
}
.content {
margin-bottom: 15px;
}
.row {
margin-bottom: 8px;
display: flex;
flex-wrap: wrap;
}
.column {
flex: 1;
padding: 6px; /* Reduced padding */
border: 1px solid #ccc;
min-width: 0;
word-wrap: break-word;
}
.table-container {
margin-top: 15px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 11px; /* Smaller table font */
}
th, td {
border: 1px solid #ccc;
padding: 4px; /* Reduced cell padding */
text-align: left;
}
.footer {
text-align: center;
margin-top: 15px;
}
#totalAmount {
text-align: center;
}
/* Page break styles */
.first-page {
page-break-after: always;
}
.second-page {
page-break-before: always;
}
/* Fix for text overflow */
.column span, .column label {
display: inline-block;
word-break: break-word;
max-width: 100%;
font-size: 11px; /* Smaller text for labels and spans */
}
/* Header and title styles */
h4, .modal-title {
font-size: 14px; /* Smaller headings */
margin: 5px 0;
}
strong {
font-size: 11px; /* Smaller bold text */
}
/* Image sizing */
img[src*="llilogoedited.png"] {
width: 140px; /* Smaller logo */
}
/* Signature image height adjustment */
#requestedByImage, #preparedByImage, #poApproverImportPOImage {
max-height: 80px; /* Smaller signature images */
width: auto;
object-fit: contain;
}
/* Signature name font size adjustment */
#requestedBy, #preparedBy, #approvedBy {
font-size: 10px; /* Smaller signature names */
text-decoration: underline;
text-underline-position: under;
display: block;
margin-bottom: 3px; /* Reduced margin */
}
/* Second page specific styles */
.second-page .container-Form {
font-size: 11px !important;
}
.instructions p, .instructions ul li, .shipping-address p {
font-size: 11px !important;
line-height: 1.3 !important;
margin-bottom: 4px !important;
}
.instructions ul {
padding-left: 15px !important;
margin-bottom: 10px !important;
}
.instructions ul li {
margin-bottom: 4px !important;
}
.conforme {
margin-top: 20px !important;
}
.conforme span {
font-size: 11px !important;
}
/* Additional print-specific styles */
@media print {
@page {
margin: 0.5cm 1cm 0.5cm 0.7cm; /* Increased left margin to 0.7cm */
}
body {
margin-left: 0.2cm; /* Add a small left margin to body */
margin-right: 0.5cm; /* Right margin */
}
#toggleShippingInstructions {
display: none;
}
/* Fixed column widths during printing */
.row {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 8px; /* Reduced gap */
}
/* For rows with only two columns */
.row:has(> .column:nth-child(2):last-child) {
grid-template-columns: 1fr 1fr;
}
/* For rows with only one column */
.row:has(> .column:only-child) {
grid-template-columns: 1fr;
}
/* Ensure signature images and names are properly sized */
#requestedByImage, #preparedByImage, #poApproverImportPOImage {
max-height: 80px !important;
width: auto !important;
}
#requestedBy, #preparedBy, #approvedBy {
font-size: 10px !important;
}
/* Compact layout for footer section */
.footer .row .column {
padding: 4px !important;
}
/* Second page adjustments for print */
.second-page * {
font-size: 11px !important;
}
.header p, .supplier p {
font-size: 11px !important;
margin-bottom: 5px !important;
}
.instructions p, .shipping-address p {
line-height: 1.3 !important;
margin-bottom: 4px !important;
}
}
`);
printWindow.document.write('</style>');
printWindow.document.write('</head><body>');
printWindow.document.write(printContent);
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
printWindow.close();
}