<?php
	if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
	?>

	<link rel="stylesheet"  href="https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.css"/>
	<script src="https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.min.js"></script>
	<div id ="scctableprice" class="scctableform hover_bkgr_fricctableprice " style="width: 100%;" >
		<style>
			/* ALL SCREEN SIZES */

			#sccTale_price::-webkit-scrollbar-track
			{
				-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
				background-color: #fff;
				border-radius: 10px;
			}
			#sccTale_price::-webkit-scrollbar
			{
				width: 6px;
				background-color: #fff;
			}
			#sccTale_price::-webkit-scrollbar-thumb
			{
				border-radius: 10px;
				background-color: #FFF;
				background-image: -webkit-gradient(linear, 40% 0%,75% 84%,from(#304af8),to(#304af8),color-stop(.6,#304af8))
			}
			#sccTale_price {
				scrollbar-color: #304af8 white;
				scrollbar-width: thin;
			}
			
			.fa-2x {
				font-size: 1.4em; /* size of top right icons */
			}
			.users-price-summary-scc {
				font-size:  15px;
				color: black;
				margin: 0;
				height: 100%;
				text-align:right;
			}
			.product-desc-summary-scc{
				text-align: left;
				/*padding: 10px;*/
				font-size: 13px;
				color: #8E8E8E;
			}
			.Title-Descriptions-Summary-Window{
				font-size:18px;
			}
			.span2{
				text-align: left;
				font-size: 14px;
			}
			.performance-facts__title {
				font-size: 24px;
			}
			.Total_Price {
				font-size: 20px;
			}
			
			/* Smartphones (portrait and landscape) ----------- */
			@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 14px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color: black;
				}
				.span2{
					font-size: 12px !important;
				}
				.users-price-summary-scc {
					font-size:  12px !important;
				}
				.product-desc-summary-scc{
					font-size: 11px;
					font-weight: 300;
				}
				.performance-facts__title {
					font-size: 20px;
				}
			}

			/* Smartphones (landscape) ----------- */
			@media only screen and (min-width : 321px) {
				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 16px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color: black;
				}
				.Section-Title-Summary-Window {
					text-align: left;
					font-size: 16px !important;
					font-weight:bold;
					color: black;
					margin: 0;
					padding-top:5px;
				}
				.Title-Descriptions-Summary-Window{
					font-size:18px;
				}
				.span2{
					font-size: 12px !important;
				}
				.product-desc-summary-scc{
					font-size: 12px !important;
					font-weight: 300 !important;
				}
				.performance-facts__title {
					font-size: 20px;
				}
			}

			/* Smartphones (portrait) ----------- */
			@media only screen and (max-width : 320px) {
				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 14px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color: black;
				}
				.Section-Title-Summary-Window {
					text-align: left;
					font-size: 14px !important;
					font-weight:600;
					color: black;
					margin: 0;
					padding-top:5px;
				}
				.Title-Descriptions-Summary-Window{
					font-size:16px;
				}
				.span2{
					font-size: 12px !important;
				}
				.product-desc-summary-scc{
					font-size: 11px;
					font-weight: 300;
				}
			}

			/* iPads (portrait and landscape) ----------- */
			@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {

			}

			/* iPads (landscape) ----------- */
			@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {

			}

			/* iPads (portrait) ----------- */
			@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {

			}
			
			/* iPad 3 */
			@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {

			}

			@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 18px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color: black;
				}
			}
			/* Desktops and laptops ----------- */
			@media only screen  and (min-width : 1224px) {
				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 18px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color:black;
				}
				.performance-facts__title {
					font-size: 24px;
				}
				.Section-Title-Summary-Window {
					text-align: left;
					font-size: 19px !important;
					font-weight:bold;
					color: black;
					margin: 0;
					padding-top:15px;
				}
				.span2{
					font-size: 15px !important;
				}
				.users-price-summary-scc {
					font-size:  15px !important;
				}
				.product-desc-summary-scc{
					font-size: 13px;
					font-weight: 300;
				}
			}

			/* Large screens ----------- */
			@media only screen  and (min-width : 1824px) {

				span.Title-Descriptions-Summary-Window.trn.Description, span.Title-Descriptions-Summary-Window.trn.Quantity, span.Title-Descriptions-Summary-Window.trn.Price {
					font-size: 18px !important;
					margin-left: 0px !important;
					padding: 0px !important;
					color:black;
				}
				.Section-Title-Summary-Window {
					text-align: left;
					font-size: 21px !important;
					font-weight:bold;
					color: black;
					margin: 0;
					padding-top:20px;
				}
				.span2{
					font-size: 16px !important;
				}
				.users-price-summary-scc {
					font-size:  16px !important;
				}
				.product-desc-summary-scc{
					font-size: 14px;
					font-weight: 300;
				}
			}

			/* iPhone 4 ----------- */
			@media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {

			}

			@media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {

			}
			.Section-Title-Summary-Window {
				text-align: left;
				font-size: 20px;
				font-weight:bold;
				color: black;
				margin: 0;
			}
			.performance-facts {
				border: 1px solid black;
				margin: 10px;
				float: left;a
				width: 600px;
				padding: 0.5rem;
				table {
					border-collapse: collapse;
				}
			}
			@media screen and (max-width:600px){
				

				.performance-facts__summary {
					text-align: left;
					font-weight: bold;
					font-size:  <?php echo $result_2->servicepricefontsize; ?>px !important;
					color: black;
					margin: 0;
				}
				
				.Desc-Quantity-Price-Title-SCC {
					/* Desktop ? */
					padding: 10px;
					Desktop:test;
					font-size: 20px !important;
				}
				
				.performance-facts__summary2 {
					text-align: center;
					font-size:  <?php echo $result_2->servicepricefontsize; ?> !important;
					color: white;
					width: 100%;
					padding: 10px!important;
					margin: 0;
					height: 100%;
					background: <?php echo $result_2->objectColorPicker; ?> !important;
					display: flex;
					align-items: center;
					justify-content: center;
					padding: 0;
				}
				

				
				.performance-facts__summary4 {
					font-size:  <?php echo $result_2->servicepricefontsize; ?>px !important;
					color: #666;
					margin: 0;
					padding: 10px;
					height: 100%;
				}
				
				.Product-Titles-Summary-Window {
					font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
					color: black;margin: 0;
					height: 100%;
					width: 100%;
					text-align: left;
					padding: 0 !important;
				}
				.performance-facts__header {
					border-bottom: 10px solid black;
					padding: 0 0 0.25rem 0;
					margin: 0 0 0.5rem 0;
					p {
						margin: 0;
					}
				}
				
				.sscfull-height{
					/* height: 100% !important; */
					/* padding: 0.5%; */
					padding-left: 5px !important;
				}
				
				.sscfull-width{
					width: : 100%;
				}
				
				.sscfill-parent{
					width: : 100%;
					height: 100%;
				}
				
				.position-relative{
					position: relative;
				}
				
				.nopadding{
					margin: 0;
					padding: 0;
				}
				
				.hover_bkgr_fricctableprice{
					background:rgba(27, 24, 24, 0.92) !important;
					height:100%;
					position:fixed;
					text-align:center;
					top:0;
					left:0;
					width:100%;
					display:none;
					z-index:10000;
				}
				
				.hover_bkgr_fricctableprice .helper{
					display:inline-block;
					height:100%;
					vertical-align:middle;
				}
				
				.hover_bkgr_fricctableprice > div {
					background-color: #fff;
					display: inline-block;
					height: 100%;
					min-height: 100px;
					vertical-align: middle;
					position: relative;
					max-width: 1000px;
					width:100%;
					padding: 2% 3%;
					font-family: <?php echo isset($fontUsed) && isset($fontUsed->family) ? $fontUsed->family .'!important' :  ''; ?> ;
					font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
					font-weight: normal;
					overflow: auto;
					overflow-x: hidden;
				}
				.scc-span2{
					text-align: left;
					/*padding-left: 10px;*/
					font-weight: normal;
					font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
				}
				
				
				.table__fricctableprice {
					/* background: <?php echo $result_2->objectColorPicker; ?> !important; */
				}
				
				button.scc_btn_table{
					background-color: transparent !important;
					border: none; /* Remove borders */
					color: <?php echo $result_2->objectColorPicker; ?> !important;
					font-size: 10px;
					cursor: pointer; /* Mouse pointer on hover */
					margin:0;
					padding: 10px;
				}
				/* Darker background on mouse-over */
				button.scc_btn_table:hover {
					background-color: RoyalBlue;
				}
				button.scc_button_table:disabled,
				button.scc_btn_table:disabled,
				button.scc_btn_table[disabled]{
					color: #cccccc  !important;
					cursor: not-allowed;
					pointer-events: none;
					background: transparent !important;
				}
				.center-flex{
					display: flex !important;
					justify-content: center !important;
					align-items: center  !important;
				}
				.center-flex-align{
					display: flex !important;
					align-items: center  !important;
				}
				@media only screen and (max-width: 600px){
					.performance-facts {
						border: 1px solid black;
						margin: 10px;
						float: left;
						width: 600px;
						padding: 0.1rem;
						table {
							border-collapse: collapse;
						}
					}

					.performance-facts__summary {
						text-align: left;
						font-weight: bold;
						font-size: 0.35rem;
						color: black;
						margin: 0;
					}
					.Desc-Quantity-Price-Title-SCC {
						/* Mobile Max 600px */
						color: white !important;
						margin: 0;
						display: flex;
						align-items: center;
						Mobile: test;
						font-size: 18px !important;
					}
					.performance-facts__summary2 {
						text-align: center;
						font-size: <?php echo (int)$result_2->servicepricefontsize -2; ?>px !important; /* Set a font size */
						color: white;
						width: 100%;
						margin: 0;
						height: 100%;
						background: <?php echo $result_2->objectColorPicker; ?> !important;
						display: flex;
						align-items: center;
						justify-content: center;
						padding: 0;
					}
					.performance-facts__summary4 {
						font-size: <?php echo (int)$result_2->servicepricefontsize -2; ?>px !important; /* Set a font size */
						color: #666;
						margin: 0;
						height: 100%;
					}
					.Product-Titles-Summary-Window {
						font-size: <?php echo $result_2->servicepricefontsize; ?>px !important;
						color: black;margin: 0;
						height: 100%;
						width: 100%;
						text-align: left;
						padding: 0 !important;
					}
					.table__fricctableprice {
						/* background: <?php echo $result_2->objectColorPicker; ?> !important; */
					}
					.table__fricctableprice2 {
						/* background-color: #F0F0F0; */
					}
					.center-flex{
						display: flex !important;
						justify-content: center !important;
						align-items: center  !important;
					}
					.center-flex-align{
						display: flex !important;
						align-items: center  !important;
					}
					button.scc_button_table:disabled,
					button.scc_btn_table:disabled,
					button.scc_btn_table[disabled]{
						color: #cccccc  !important;
						cursor: not-allowed;
						pointer-events: none;
						background: transparent !important;
					}
				}
				
				.sscfull-container{
					height: 285mm;
					/* padding: 5%; */
				}
				.center-flex{
					display: flex !important;
					justify-content: center !important;
					align-items: center  !important;
				}
		/* #sccTale_price{
		padding: 9%;
		} */
		.make-grid(sm);
		.visible-xs {
			.responsive-invisibility();
		}
		.hidden-xs {
			.responsive-visibility();
		}
		.hidden-xs.hidden-print {
			.responsive-invisibility();
		}
		.hidden-sm {
			.responsive-invisibility();
		}
		.visible-sm {
			.responsive-visibility();
		}
	}
</style>
	<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
	<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
-->
<div id='sccTale_price'></div>
<!-- <div id='sccCom_price' style="position: sticky;margin-top: -165px;background: transparent;" ></div> -->
</div>
<!-- Modal -->
<div class="scc-modal-2020 fade scc_send_quote_info" id="myModalSCCEmailQuote" role="dialog">
	<div class="scc-modal-dialog-2020" >
		<!-- Modal content-->
		<div class="scc-modal-content-2020">
			<div class="scc-modal-header-2020">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="scc-modal-title-2020">Important Notice</h4>
			</div>
			<div class="scc-modal-body-2020">
				<p>This feature is only for Premium users. You can purchase the premium version at <a href='https://stylishcostcalculator.com/' class='alert-link'><strong>https://stylishcostcalculator.com</strong></a></p>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			</div>
		</div>
	</div>
	
	<div id ="scctableprice" class="scctableform hover_bkgr_fricctableprice " style="width: 100%;" data-simplebar>
		<style>
			.dd-scc{
				border:2px solid #F0F0F0;
				border-left: 4px solid <?php echo $result_2->objectColorPicker; ?>;
			}
			.dd-scc .ddChild li:hover{background-color:#F0F0F0;border-left: 2px solid <?php echo $result_2->objectColorPicker; ?>;}
			.performance-facts {
				border: 1px solid black;
				margin: 10px;
				float: left;
				width: 600px;
				padding: 0.5rem;
				table {
					border-collapse: collapse;
				}
			}
			
			.performance-facts__summary {
				text-align: left;
				font-weight: bold;
				font-size:  <?php echo $result_2->servicepricefontsize; ?> !important;
				color: black;
				margin: 0;
			}
			
			.Desc-Quantity-Price-Title-SCC {
				color: white !important;
				margin: 0;
				/*display: flex;*/
				align-items: center;
				notsure:test;
				font-size: 20px !important; /* Set a font size */
			}
			
			.performance-facts__summary2 {
				text-align: center;
				font-size:  <?php echo $result_2->servicepricefontsize; ?> !important;
				color: white;
				width: 100%;
				padding: 10px!important;
				margin: 0;
				height: 100%;
				background: <?php echo $result_2->objectColorPicker; ?> !important;
				display: flex;
				align-items: center;
				justify-content: center;
				padding: 0;
			}
			
			
			.performance-facts__summary4 {
				font-size:  <?php echo $result_2->servicepricefontsize; ?> !important;
				color: #666;
				margin: 0;
				padding: 10px;
				height: 100%;
			}
			
			.Product-Titles-Summary-Window {
				font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
				color: black;margin: 0;
				height: 100%;
				width: 100%;
				text-align: left;
				padding: 0 !important;
			}
			.performance-facts__header {
				border-bottom: 10px solid black;
				padding: 0 0 0.25rem 0;
				margin: 0 0 0.5rem 0;
				p {
					margin: 0;
				}
			}
			
			.sscfull-height{
				/*height: 100% !important;*/
				/*padding: 0.5%;*/
			}
			.sccfull-height-2{
				padding-left: 5px !important;
			}
			
			.sscfull-width{
				width: : 100%;
			}
			
			.sscfill-parent{
				width: : 100%;
				height: 100%;
			}
			
			.position-relative{
				position: relative;
			}
			
			.nopadding{
				margin: 0;
				padding: 0;
			}
			
			.hover_bkgr_fricctableprice{
				background:rgba(27, 24, 24, 0.92) !important;
				height:100%;
				position:fixed;
				text-align:center;
				top:0;
				left:0;
				width:100%;
				display:none;
				z-index:10000;
			}
			
			.hover_bkgr_fricctableprice .helper{
				display:inline-block;
				height:100%;
				vertical-align:middle;
			}
			
			/* important */
			.hover_bkgr_fricctableprice > div {
				background-color: #fff;
				display: inline-block;
				height: 100%;
				min-height: 100px;
				vertical-align: middle;
				position: relative;
				max-width: 1000px;
				width:100%;
				padding: 0.5% 2%;
				font-family: <?php echo isset($fontUsed) && isset($fontUsed->family) ? $fontUsed->family .'!important' :  ''; ?> ;
				font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
				font-weight: normal;
				overflow: auto;
				overflow-x: hidden;
			} 
			.scc-span2{
				text-align: left;
				/*padding-left: 10px;*/
				font-weight: normal;
				font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
			}
			#framtablename, .framtableicon{

			}
			.table__fricctableprice {
				/* background: <?php echo $result_2->objectColorPicker; ?> !important;*/
			}
			
			.scc_btn_table{
				background-color: transparent !important;
				border: none; /* Remove borders */
				color: <?php echo $result_2->objectColorPicker; ?> !important;
				font-size: <?php echo (int)$result_2->servicepricefontsize; ?>px !important; /* Set a font size */
				cursor: pointer; /* Mouse pointer on hover */
			}
			/* Darker background on mouse-over */
			.scc_btn_table:hover {
				background-color: RoyalBlue;
			}
			
			button.scc_button_table:disabled,
			button.scc_btn_table:disabled,
			button.scc_btn_table[disabled]{
				color: #cccccc  !important;
				cursor: not-allowed;
				pointer-events: none;
				background: transparent !important;
			}
			
			.center-flex{
				display: flex !important;
				justify-content: center !important;
				align-items: center  !important;
			}
			
			.center-flex-align{
				display: flex !important;
				align-items: center  !important;
			}
			
			@media only screen and (max-width: 600px){
				.performance-facts {
					border: 1px solid black;
					margin: 10px;
					float: left;
					width: 600px;
					padding: 0.1rem;
					table {
						border-collapse: collapse;
					}


				}

				.performance-facts__summary {
					text-align: left;
					font-weight: bold;
					font-size: 0.35rem;
					color: black;
					margin: 0;
				}
				.Desc-Quantity-Price-Title-SCC {
					/* Mobile ?? */
					color: white !important;
					margin: 0;
					display: flex;
					align-items: center;
					test:isthismobile;
					font-size: 20px;
				}
				.performance-facts__summary2 {
					text-align: center;
					font-size: <?php echo (int)$result_2->servicepricefontsize -2; ?>px !important; /* Set a font size */
					color: white;
					width: 100%;
					margin: 0;
					height: 100%;
					background: <?php echo $result_2->objectColorPicker; ?> !important;
					display: flex;
					align-items: center;
					justify-content: center;
					padding: 0;
				}
				
				
				.Product-Titles-Summary-Window {
					font-size: <?php echo $result_2->servicepricefontsize; ?> !important;
					color: black;margin: 0;
					height: 100%;
					width: 100%;
					text-align: left;
					padding: 0 !important;
				}

				.table__fricctableprice {
					/* background: <?php echo $result_2->objectColorPicker; ?> !important; */
				}
				.table__fricctableprice2 {
					/* background-color: #F0F0F0; */
				}
				.center-flex{
					display: flex !important;
					justify-content: center !important;
					align-items: center  !important;
				}
				
				.center-flex-align{
					display: flex !important;
					align-items: center  !important;
				}
				
				.scc_button_table:disabled,
				button.scc_btn_table:disabled,
				button.scc_btn_table[disabled]{
					color: #cccccc  !important;
					cursor: not-allowed;
					pointer-events: none;
					background: transparent !important;
				}
			}

			.sscfull-container{
				height: 285mm;
				/* padding: 5%; */
			}
			.right-flex{
				/*display: flex !important; */
				justify-content: right !important;
				align-items: right  !important;
				text-align:right !important;
			}
			/* #sccTale_price{
			padding: 9%;
			} */
			.make-grid(sm);
			
			.visible-xs {
				.responsive-invisibility();
			}
			
			.hidden-xs {
				.responsive-visibility();
			}
			
			.hidden-xs.hidden-print {
				.responsive-invisibility();
			}
			
			.hidden-sm {
				.responsive-invisibility();
			}
			
			.visible-sm {
				.responsive-visibility();
			}
		}
		.scc_sending_email_progress {
			border: 16px solid #f3f3f3;
			border-radius: 50%;
			border-top: 16px solid <?php echo $result_2->objectColorPicker; ?>;
			width: 120px;
			height: 120px;
			-webkit-animation: spin 2s linear infinite; /* Safari */
			animation: spin 2s linear infinite;
		}
		
		/* Safari */
		@-webkit-keyframes spin {
			0% { -webkit-transform: rotate(0deg); }
			100% { -webkit-transform: rotate(360deg); }
		}
		
		@keyframes spin {
			0% { transform: rotate(0deg); }
			100% { transform: rotate(360deg); }
		}
	</style>
	


	<div id='sccTale_price' data-simplebar></div>
	
	<!-- <div id='sccCom_price' style="position: sticky;margin-top: -165px;background: transparent;" ></div> -->
</div>
<script>
	var jsonPDF = {  };
	let tableTitle = "<?php echo (isset($result) && isset($result->formname) ? $result->formname : ''); ?>";

	function germanCharactersInverseFrontEnd(text) {
		
		if(typeof text == "string") {
			text = text.replace(/\[a\]/g, 'ä')
			text = text.replace(/\[o\]/g, 'ö')
			text = text.replace(/\[u\]/g, 'ü')
			text = text.replace(/\[b\]/g, 'ß')
			text = text.replace(/\[A\]/g, 'Ä')
			text = text.replace(/\[O\]/g, 'Ö')
			text = text.replace(/\[U\]/g, 'Ü')
			text = text.replace(/\[B\]/g, 'ẞ')
		}
		
		return text
	}

	function CreateTable(parts, comments){
		
		// if(scc_jQuery('#sccTale_price').length){
		//   scc_jQuery('#sccTale_price').empty();
		
		// }
		jsonPDF = {
			pdf_title: "<?php echo (isset($result) && isset($result->formname) ? $result->formname : ''); ?>",
			logo_image: "<?php echo get_option('scc_email_logo_image') ?>",
			banner_image: "<?php echo get_option('scc_email_banner_image') ?>",
			description: "",
			unit: "",
			quantity: "",
			price: "",
			footer: "<?php echo str_replace('\\', '',preg_replace("/\r|\n/", "< br/>",htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_footerdisclaimer')))))); ?>",
			date: "<?php echo date('m/d/Y')?>",
			rows: []
		};
		<?php
		
		  //  translated date
		$trans_desc = isset($arr_new['Description']['en']) ? $arr_new['Description']['en'] : 'Description'; 
		$trans_qnty = isset($arr_new['Quantity']['en']) ? $arr_new['Quantity']['en'] : 'Quantity'; 
		$trans_unit = isset($arr_new['Unit Price']['en']) ? $arr_new['Unit Price']['en'] : 'Unit Price'; 
		$trans_price = isset($arr_new['Price']['en']) ? $arr_new['Price']['en'] : 'Price'; 
		$trans_totl_price = isset($arr_new['Total Price']['en']) ? $arr_new['Total Price']['en'] : 'Total Price';
		
		
		$licens = get_option('scc_licensed');
		if($licens ==0) $licens_enable ="disabled"; else $licens_enable ="";
		
			//start style for printing method
		$body = '<style>';
		$body .= '  .scc-col-lg-1,.scc-col-lg-10,.scc-col-lg-11,.scc-col-lg-12,.scc-col-lg-2,.scc-col-lg-3,.scc-col-lg-4,.scc-col-lg-5,.scc-col-lg-6,.scc-col-lg-7,.scc-col-lg-8,.scc-col-lg-9,.scc-col-md-1,.scc-col-md-10,.scc-col-md-11,.scc-col-md-12,.scc-col-md-2,.scc-col-md-3,.scc-col-md-4,.scc-col-md-5,.scc-col-md-6,.scc-col-md-7,.scc-col-md-8,.scc-col-md-9,.scc-col-sm-1,.scc-col-sm-10,.scc-col-sm-11,.scc-col-sm-12,.scc-col-sm-2,.scc-col-sm-3,.scc-col-sm-4,.scc-col-sm-5,.scc-col-sm-6,.scc-col-sm-7,.scc-col-sm-8,.scc-col-sm-9,.scc-col-xs-1,.scc-col-xs-10,.scc-col-xs-11,.scc-col-xs-12,.scc-col-xs-2,.scc-col-xs-3,.scc-col-xs-4,.scc-col-xs-5,.scc-col-xs-6,.scc-col-xs-7,.scc-col-xs-8,.scc-col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:0px}.scc-col-xs-1,.scc-col-xs-10,.scc-col-xs-11,.scc-col-xs-12,.scc-col-xs-2,.scc-col-xs-3,.scc-col-xs-4,.scc-col-xs-5,.scc-col-xs-6,.scc-col-xs-7,.scc-col-xs-8,.scc-col-xs-9{float:left}.scc-col-xs-12{width:100%}.scc-col-xs-11{width:91.66666667%}.scc-col-xs-10{width:83.33333333%}.scc-col-xs-9{width:75%}.scc-col-xs-8{width:66.66666667%}.scc-col-xs-7{width:58.33333333%}.scc-col-xs-6{width:50%}.scc-col-xs-5{width:41.66666667%}.scc-col-xs-4{width:33.33333333%}.scc-col-xs-3{width:25%}.scc-col-xs-2{width:16.66666667%}.scc-col-xs-1{width:8.33333333%}.scc-col-xs-pull-12{right:100%}.scc-col-xs-pull-11{right:91.66666667%}.scc-col-xs-pull-10{right:83.33333333%}.scc-col-xs-pull-9{right:75%}.scc-col-xs-pull-8{right:66.66666667%}.scc-col-xs-pull-7{right:58.33333333%}.scc-col-xs-pull-6{right:50%}.scc-col-xs-pull-5{right:41.66666667%}.scc-col-xs-pull-4{right:33.33333333%}.scc-col-xs-pull-3{right:25%}.scc-col-xs-pull-2{right:16.66666667%}.scc-col-xs-pull-1{right:8.33333333%}.scc-col-xs-pull-0{right:auto}.scc-col-xs-push-12{left:100%}.scc-col-xs-push-11{left:91.66666667%}.scc-col-xs-push-10{left:83.33333333%}.scc-col-xs-push-9{left:75%}.scc-col-xs-push-8{left:66.66666667%}.scc-col-xs-push-7{left:58.33333333%}.scc-col-xs-push-6{left:50%}.scc-col-xs-push-5{left:41.66666667%}.scc-col-xs-push-4{left:33.33333333%}.scc-col-xs-push-3{left:25%}.scc-col-xs-push-2{left:16.66666667%}.scc-col-xs-push-1{left:8.33333333%}.scc-col-xs-push-0{left:auto}.scc-col-xs-offset-12{margin-left:100%}.scc-col-xs-offset-11{margin-left:91.66666667%}.scc-col-xs-offset-10{margin-left:83.33333333%}.scc-col-xs-offset-9{margin-left:75%}.scc-col-xs-offset-8{margin-left:66.66666667%}.scc-col-xs-offset-7{margin-left:58.33333333%}.scc-col-xs-offset-6{margin-left:50%}.scc-col-xs-offset-5{margin-left:41.66666667%}.scc-col-xs-offset-4{margin-left:33.33333333%}.scc-col-xs-offset-3{margin-left:25%}.scc-col-xs-offset-2{margin-left:16.66666667%}.scc-col-xs-offset-1{margin-left:8.33333333%}.scc-col-xs-offset-0{margin-left:0}@media (min-width:768px){.scc-col-sm-1,.scc-col-sm-10,.scc-col-sm-11,.scc-col-sm-12,.scc-col-sm-2,.scc-col-sm-3,.scc-col-sm-4,.scc-col-sm-5,.scc-col-sm-6,.scc-col-sm-7,.scc-col-sm-8,.scc-col-sm-9{float:left}.scc-col-sm-12{width:100%}.scc-col-sm-11{width:91.66666667%}.scc-col-sm-10{width:83.33333333%}.scc-col-sm-9{width:75%}.scc-col-sm-8{width:66.66666667%}.scc-col-sm-7{width:58.33333333%}.scc-col-sm-6{width:50%}.scc-col-sm-5{width:41.66666667%}.scc-col-sm-4{width:33.33333333%}.scc-col-sm-3{width:25%}.scc-col-sm-2{width:16.66666667%}.scc-col-sm-1{width:8.33333333%}.scc-col-sm-pull-12{right:100%}.scc-col-sm-pull-11{right:91.66666667%}.scc-col-sm-pull-10{right:83.33333333%}.scc-col-sm-pull-9{right:75%}.scc-col-sm-pull-8{right:66.66666667%}.scc-col-sm-pull-7{right:58.33333333%}.scc-col-sm-pull-6{right:50%}.scc-col-sm-pull-5{right:41.66666667%}.scc-col-sm-pull-4{right:33.33333333%}.scc-col-sm-pull-3{right:25%}.scc-col-sm-pull-2{right:16.66666667%}.scc-col-sm-pull-1{right:8.33333333%}.scc-col-sm-pull-0{right:auto}.scc-col-sm-push-12{left:100%}.scc-col-sm-push-11{left:91.66666667%}.scc-col-sm-push-10{left:83.33333333%}.scc-col-sm-push-9{left:75%}.scc-col-sm-push-8{left:66.66666667%}.scc-col-sm-push-7{left:58.33333333%}.scc-col-sm-push-6{left:50%}.scc-col-sm-push-5{left:41.66666667%}.scc-col-sm-push-4{left:33.33333333%}.scc-col-sm-push-3{left:25%}.scc-col-sm-push-2{left:16.66666667%}.scc-col-sm-push-1{left:8.33333333%}.scc-col-sm-push-0{left:auto}.scc-col-sm-offset-12{margin-left:100%}.scc-col-sm-offset-11{margin-left:91.66666667%}.scc-col-sm-offset-10{margin-left:83.33333333%}.scc-col-sm-offset-9{margin-left:75%}.scc-col-sm-offset-8{margin-left:66.66666667%}.scc-col-sm-offset-7{margin-left:58.33333333%}.scc-col-sm-offset-6{margin-left:50%}.scc-col-sm-offset-5{margin-left:41.66666667%}.scc-col-sm-offset-4{margin-left:33.33333333%}.scc-col-sm-offset-3{margin-left:25%}.scc-col-sm-offset-2{margin-left:16.66666667%}.scc-col-sm-offset-1{margin-left:8.33333333%}.scc-col-sm-offset-0{margin-left:0}}@media (min-width:992px){.scc-col-md-1,.scc-col-md-10,.scc-col-md-11,.scc-col-md-12,.scc-col-md-2,.scc-col-md-3,.scc-col-md-4,.scc-col-md-5,.scc-col-md-6,.scc-col-md-7,.scc-col-md-8,.scc-col-md-9{float:left}.scc-col-md-12{width:100%}.scc-col-md-11{width:91.66666667%}.scc-col-md-10{width:83.33333333%}.scc-col-md-9{width:75%}.scc-col-md-8{width:66.66666667%}.scc-col-md-7{width:58.33333333%}.scc-col-md-6{width:50%}.scc-col-md-5{width:41.66666667%}.scc-col-md-4{width:33.33333333%}.scc-col-md-3{width:25%}.scc-col-md-2{width:16.66666667%}.scc-col-md-1{width:8.33333333%}.scc-col-md-pull-12{right:100%}.scc-col-md-pull-11{right:91.66666667%}.scc-col-md-pull-10{right:83.33333333%}.scc-col-md-pull-9{right:75%}.scc-col-md-pull-8{right:66.66666667%}.scc-col-md-pull-7{right:58.33333333%}.scc-col-md-pull-6{right:50%}.scc-col-md-pull-5{right:41.66666667%}.scc-col-md-pull-4{right:33.33333333%}.scc-col-md-pull-3{right:25%}.scc-col-md-pull-2{right:16.66666667%}.scc-col-md-pull-1{right:8.33333333%}.scc-col-md-pull-0{right:auto}.scc-col-md-push-12{left:100%}.scc-col-md-push-11{left:91.66666667%}.scc-col-md-push-10{left:83.33333333%}.scc-col-md-push-9{left:75%}.scc-col-md-push-8{left:66.66666667%}.scc-col-md-push-7{left:58.33333333%}.scc-col-md-push-6{left:50%}.scc-col-md-push-5{left:41.66666667%}.scc-col-md-push-4{left:33.33333333%}.scc-col-md-push-3{left:25%}.scc-col-md-push-2{left:16.66666667%}.scc-col-md-push-1{left:8.33333333%}.scc-col-md-push-0{left:auto}.scc-col-md-offset-12{margin-left:100%}.scc-col-md-offset-11{margin-left:91.66666667%}.scc-col-md-offset-10{margin-left:83.33333333%}.scc-col-md-offset-9{margin-left:75%}.scc-col-md-offset-8{margin-left:66.66666667%}.scc-col-md-offset-7{margin-left:58.33333333%}.scc-col-md-offset-6{margin-left:50%}.scc-col-md-offset-5{margin-left:41.66666667%}.scc-col-md-offset-4{margin-left:33.33333333%}.scc-col-md-offset-3{margin-left:25%}.scc-col-md-offset-2{margin-left:16.66666667%}.scc-col-md-offset-1{margin-left:8.33333333%}.scc-col-md-offset-0{margin-left:0}}@media (min-width:1200px){.scc-col-lg-1,.scc-col-lg-10,.scc-col-lg-11,.scc-col-lg-12,.scc-col-lg-2,.scc-col-lg-3,.scc-col-lg-4,.scc-col-lg-5,.scc-col-lg-6,.scc-col-lg-7,.scc-col-lg-8,.scc-col-lg-9{float:left}.scc-col-lg-12{width:100%}.scc-col-lg-11{width:91.66666667%}.scc-col-lg-10{width:83.33333333%}.scc-col-lg-9{width:75%}.scc-col-lg-8{width:66.66666667%}.scc-col-lg-7{width:58.33333333%}.scc-col-lg-6{width:50%}.scc-col-lg-5{width:41.66666667%}.scc-col-lg-4{width:33.33333333%}.scc-col-lg-3{width:25%}.scc-col-lg-2{width:16.66666667%}.scc-col-lg-1{width:8.33333333%}.scc-col-lg-pull-12{right:100%}.scc-col-lg-pull-11{right:91.66666667%}.scc-col-lg-pull-10{right:83.33333333%}.scc-col-lg-pull-9{right:75%}.scc-col-lg-pull-8{right:66.66666667%}.scc-col-lg-pull-7{right:58.33333333%}.scc-col-lg-pull-6{right:50%}.scc-col-lg-pull-5{right:41.66666667%}.scc-col-lg-pull-4{right:33.33333333%}.scc-col-lg-pull-3{right:25%}.scc-col-lg-pull-2{right:16.66666667%}.scc-col-lg-pull-1{right:8.33333333%}.scc-col-lg-pull-0{right:auto}.scc-col-lg-push-12{left:100%}.scc-col-lg-push-11{left:91.66666667%}.scc-col-lg-push-10{left:83.33333333%}.scc-col-lg-push-9{left:75%}.scc-col-lg-push-8{left:66.66666667%}.scc-col-lg-push-7{left:58.33333333%}.scc-col-lg-push-6{left:50%}.scc-col-lg-push-5{left:41.66666667%}.scc-col-lg-push-4{left:33.33333333%}.scc-col-lg-push-3{left:25%}.scc-col-lg-push-2{left:16.66666667%}.scc-col-lg-push-1{left:8.33333333%}.scc-col-lg-push-0{left:auto}.scc-col-lg-offset-12{margin-left:100%}.scc-col-lg-offset-11{margin-left:91.66666667%}.scc-col-lg-offset-10{margin-left:83.33333333%}.scc-col-lg-offset-9{margin-left:75%}.scc-col-lg-offset-8{margin-left:66.66666667%}.scc-col-lg-offset-7{margin-left:58.33333333%}.scc-col-lg-offset-6{margin-left:50%}.scc-col-lg-offset-5{margin-left:41.66666667%}.scc-col-lg-offset-4{margin-left:33.33333333%}.scc-col-lg-offset-3{margin-left:25%}.scc-col-lg-offset-2{margin-left:16.66666667%}.scc-col-lg-offset-1{margin-left:8.33333333%}.scc-col-lg-offset-0{margin-left:0}}';
		$body .= '  .Product-Titles-Summary-Window { font-size:'.$result_2->servicepricefontsize.' !important;color: black;margin: 0;height: 100%;width: 100%;text-align: left;padding: 0 !important;}';
		$body .= '  .printing-improve{margin-left: -10px}';
		$body .= ' .scc_wrapper * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;} .scc_wrapper *::before,.scc_wrapper *::after {-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}';
		$body .= ' @media only screen and (max-width: 565px) {  #scc-summary-view-header { justify-content: right; align-items: center;background-color: #F1F1F1 !important;padding: 7px 0px 7px 0px; min-height:80px} }';
		$body .= ' @media only screen and (min-width: 565px) {  #scc-summary-view-header { justify-content: right; align-items: center;background-color: #F1F1F1 !important;padding: 7px 0px 7px 0px; min-height:40px} }';
		$body .= ' @media only print { @page  { size:  auto; margin: 0mm;} .Product-Titles-Summary-Window { font-size:'.$result_2->servicepricefontsize.' !important;color: black;margin: 0;height: 100%;width: 100%;text-align: left;padding: 0 !important;} .scc-col-lg-1,.scc-col-lg-10,.scc-col-lg-11,.scc-col-lg-12,.scc-col-lg-2,.scc-col-lg-3,.scc-col-lg-4,.scc-col-lg-5,.scc-col-lg-6,.scc-col-lg-7,.scc-col-lg-8,.scc-col-lg-9,.scc-col-md-1,.scc-col-md-10,.scc-col-md-11,.scc-col-md-12,.scc-col-md-2,.scc-col-md-3,.scc-col-md-4,.scc-col-md-5,.scc-col-md-6,.scc-col-md-7,.scc-col-md-8,.scc-col-md-9,.scc-col-sm-1,.scc-col-sm-10,.scc-col-sm-11,.scc-col-sm-12,.scc-col-sm-2,.scc-col-sm-3,.scc-col-sm-4,.scc-col-sm-5,.scc-col-sm-6,.scc-col-sm-7,.scc-col-sm-8,.scc-col-sm-9,.scc-col-xs-1,.scc-col-xs-10,.scc-col-xs-11,.scc-col-xs-12,.scc-col-xs-2,.scc-col-xs-3,.scc-col-xs-4,.scc-col-xs-5,.scc-col-xs-6,.scc-col-xs-7,.scc-col-xs-8,.scc-col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.scc-col-xs-1,.scc-col-xs-10,.scc-col-xs-11,.scc-col-xs-12,.scc-col-xs-2,.scc-col-xs-3,.scc-col-xs-4,.scc-col-xs-5,.scc-col-xs-6,.scc-col-xs-7,.scc-col-xs-8,.scc-col-xs-9{float:left}.scc-col-xs-12{width:100%}.scc-col-xs-11{width:91.66666667%}.scc-col-xs-10{width:83.33333333%}.scc-col-xs-9{width:75%}.scc-col-xs-8{width:66.66666667%}.scc-col-xs-7{width:58.33333333%}.scc-col-xs-6{width:50%}.scc-col-xs-5{width:37.66666667%}.scc-col-xs-4{width:33.33333333%}.scc-col-xs-3{width:25%}.scc-col-xs-2{width:18.66666667%}.scc-col-xs-1{width:8.33333333%}.scc-col-xs-pull-12{right:100%}.scc-col-xs-pull-11{right:91.66666667%}.scc-col-xs-pull-10{right:83.33333333%}.scc-col-xs-pull-9{right:75%}.scc-col-xs-pull-8{right:66.66666667%}.scc-col-xs-pull-7{right:58.33333333%}.scc-col-xs-pull-6{right:50%}.scc-col-xs-pull-5{right:41.66666667%}.scc-col-xs-pull-4{right:33.33333333%}.scc-col-xs-pull-3{right:25%}.scc-col-xs-pull-2{right:16.66666667%}.scc-col-xs-pull-1{right:8.33333333%}.scc-col-xs-pull-0{right:auto}.scc-col-xs-push-12{left:100%}.scc-col-xs-push-11{left:91.66666667%}.scc-col-xs-push-10{left:83.33333333%}.scc-col-xs-push-9{left:75%}.scc-col-xs-push-8{left:66.66666667%}.scc-col-xs-push-7{left:58.33333333%}.scc-col-xs-push-6{left:50%}.scc-col-xs-push-5{left:41.66666667%}.scc-col-xs-push-4{left:33.33333333%}.scc-col-xs-push-3{left:25%}.scc-col-xs-push-2{left:16.66666667%}.scc-col-xs-push-1{left:8.33333333%}.scc-col-xs-push-0{left:auto}.scc-col-xs-offset-12{margin-left:100%}.scc-col-xs-offset-11{margin-left:91.66666667%}.scc-col-xs-offset-10{margin-left:83.33333333%}.scc-col-xs-offset-9{margin-left:75%}.scc-col-xs-offset-8{margin-left:66.66666667%}.scc-col-xs-offset-7{margin-left:58.33333333%}.scc-col-xs-offset-6{margin-left:50%}.scc-col-xs-offset-5{margin-left:41.66666667%}.scc-col-xs-offset-4{margin-left:33.33333333%}.scc-col-xs-offset-3{margin-left:25%}.scc-col-xs-offset-2{margin-left:16.66666667%}.scc-col-xs-offset-1{margin-left:8.33333333%}.scc-col-xs-offset-0{margin-left:0}@media (min-width:768px){.scc-col-sm-1,.scc-col-sm-10,.scc-col-sm-11,.scc-col-sm-12,.scc-col-sm-2,.scc-col-sm-3,.scc-col-sm-4,.scc-col-sm-5,.scc-col-sm-6,.scc-col-sm-7,.scc-col-sm-8,.scc-col-sm-9{float:left}.scc-col-sm-12{width:100%}.scc-col-sm-11{width:91.66666667%}.scc-col-sm-10{width:83.33333333%}.scc-col-sm-9{width:75%}.scc-col-sm-8{width:66.66666667%}.scc-col-sm-7{width:58.33333333%}.scc-col-sm-6{width:50%}.scc-col-sm-5{width:41.66666667%}.scc-col-sm-4{width:33.33333333%}.scc-col-sm-3{width:25%}.scc-col-sm-2{width:16.66666667%}.scc-col-sm-1{width:8.33333333%}.scc-col-sm-pull-12{right:100%}.scc-col-sm-pull-11{right:91.66666667%}.scc-col-sm-pull-10{right:83.33333333%}.scc-col-sm-pull-9{right:75%}.scc-col-sm-pull-8{right:66.66666667%}.scc-col-sm-pull-7{right:58.33333333%}.scc-col-sm-pull-6{right:50%}.scc-col-sm-pull-5{right:41.66666667%}.scc-col-sm-pull-4{right:33.33333333%}.scc-col-sm-pull-3{right:25%}.scc-col-sm-pull-2{right:16.66666667%}.scc-col-sm-pull-1{right:8.33333333%}.scc-col-sm-pull-0{right:auto}.scc-col-sm-push-12{left:100%}.scc-col-sm-push-11{left:91.66666667%}.scc-col-sm-push-10{left:83.33333333%}.scc-col-sm-push-9{left:75%}.scc-col-sm-push-8{left:66.66666667%}.scc-col-sm-push-7{left:58.33333333%}.scc-col-sm-push-6{left:50%}.scc-col-sm-push-5{left:41.66666667%}.scc-col-sm-push-4{left:33.33333333%}.scc-col-sm-push-3{left:25%}.scc-col-sm-push-2{left:16.66666667%}.scc-col-sm-push-1{left:8.33333333%}.scc-col-sm-push-0{left:auto}.scc-col-sm-offset-12{margin-left:100%}.scc-col-sm-offset-11{margin-left:91.66666667%}.scc-col-sm-offset-10{margin-left:83.33333333%}.scc-col-sm-offset-9{margin-left:75%}.scc-col-sm-offset-8{margin-left:66.66666667%}.scc-col-sm-offset-7{margin-left:58.33333333%}.scc-col-sm-offset-6{margin-left:50%}.scc-col-sm-offset-5{margin-left:41.66666667%}.scc-col-sm-offset-4{margin-left:33.33333333%}.scc-col-sm-offset-3{margin-left:25%}.scc-col-sm-offset-2{margin-left:16.66666667%}.scc-col-sm-offset-1{margin-left:8.33333333%}.scc-col-sm-offset-0{margin-left:0}}@media (min-width:992px){.scc-col-md-1,.scc-col-md-10,.scc-col-md-11,.scc-col-md-12,.scc-col-md-2,.scc-col-md-3,.scc-col-md-4,.scc-col-md-5,.scc-col-md-6,.scc-col-md-7,.scc-col-md-8,.scc-col-md-9{float:left}.scc-col-md-12{width:100%}.scc-col-md-11{width:91.66666667%}.scc-col-md-10{width:83.33333333%}.scc-col-md-9{width:75%}.scc-col-md-8{width:66.66666667%}.scc-col-md-7{width:58.33333333%}.scc-col-md-6{width:50%}.scc-col-md-5{width:41.66666667%}.scc-col-md-4{width:33.33333333%}.scc-col-md-3{width:25%}.scc-col-md-2{width:16.66666667%}.scc-col-md-1{width:8.33333333%}.scc-col-md-pull-12{right:100%}.scc-col-md-pull-11{right:91.66666667%}.scc-col-md-pull-10{right:83.33333333%}.scc-col-md-pull-9{right:75%}.scc-col-md-pull-8{right:66.66666667%}.scc-col-md-pull-7{right:58.33333333%}.scc-col-md-pull-6{right:50%}.scc-col-md-pull-5{right:41.66666667%}.scc-col-md-pull-4{right:33.33333333%}.scc-col-md-pull-3{right:25%}.scc-col-md-pull-2{right:16.66666667%}.scc-col-md-pull-1{right:8.33333333%}.scc-col-md-pull-0{right:auto}.scc-col-md-push-12{left:100%}.scc-col-md-push-11{left:91.66666667%}.scc-col-md-push-10{left:83.33333333%}.scc-col-md-push-9{left:75%}.scc-col-md-push-8{left:66.66666667%}.scc-col-md-push-7{left:58.33333333%}.scc-col-md-push-6{left:50%}.scc-col-md-push-5{left:41.66666667%}.scc-col-md-push-4{left:33.33333333%}.scc-col-md-push-3{left:25%}.scc-col-md-push-2{left:16.66666667%}.scc-col-md-push-1{left:8.33333333%}.scc-col-md-push-0{left:auto}.scc-col-md-offset-12{margin-left:100%}.scc-col-md-offset-11{margin-left:91.66666667%}.scc-col-md-offset-10{margin-left:83.33333333%}.scc-col-md-offset-9{margin-left:75%}.scc-col-md-offset-8{margin-left:66.66666667%}.scc-col-md-offset-7{margin-left:58.33333333%}.scc-col-md-offset-6{margin-left:50%}.scc-col-md-offset-5{margin-left:41.66666667%}.scc-col-md-offset-4{margin-left:33.33333333%}.scc-col-md-offset-3{margin-left:25%}.scc-col-md-offset-2{margin-left:16.66666667%}.scc-col-md-offset-1{margin-left:8.33333333%}.scc-col-md-offset-0{margin-left:0}}@media (min-width:1200px){.scc-col-lg-1,.scc-col-lg-10,.scc-col-lg-11,.scc-col-lg-12,.scc-col-lg-2,.scc-col-lg-3,.scc-col-lg-4,.scc-col-lg-5,.scc-col-lg-6,.scc-col-lg-7,.scc-col-lg-8,.scc-col-lg-9{float:left}.scc-col-lg-12{width:100%}.scc-col-lg-11{width:91.66666667%}.scc-col-lg-10{width:83.33333333%}.scc-col-lg-9{width:75%}.scc-col-lg-8{width:66.66666667%}.scc-col-lg-7{width:58.33333333%}.scc-col-lg-6{width:50%}.scc-col-lg-5{width:41.66666667%}.scc-col-lg-4{width:33.33333333%}.scc-col-lg-3{width:25%}.scc-col-lg-2{width:16.66666667%}.scc-col-lg-1{width:8.33333333%}.scc-col-lg-pull-12{right:100%}.scc-col-lg-pull-11{right:91.66666667%}.scc-col-lg-pull-10{right:83.33333333%}.scc-col-lg-pull-9{right:75%}.scc-col-lg-pull-8{right:66.66666667%}.scc-col-lg-pull-7{right:58.33333333%}.scc-col-lg-pull-6{right:50%}.scc-col-lg-pull-5{right:41.66666667%}.scc-col-lg-pull-4{right:33.33333333%}.scc-col-lg-pull-3{right:25%}.scc-col-lg-pull-2{right:16.66666667%}.scc-col-lg-pull-1{right:8.33333333%}.scc-col-lg-pull-0{right:auto}.scc-col-lg-push-12{left:100%}.scc-col-lg-push-11{left:91.66666667%}.scc-col-lg-push-10{left:83.33333333%}.scc-col-lg-push-9{left:75%}.scc-col-lg-push-8{left:66.66666667%}.scc-col-lg-push-7{left:58.33333333%}.scc-col-lg-push-6{left:50%}.scc-col-lg-push-5{left:41.66666667%}.scc-col-lg-push-4{left:33.33333333%}.scc-col-lg-push-3{left:25%}.scc-col-lg-push-2{left:16.66666667%}.scc-col-lg-push-1{left:8.33333333%}.scc-col-lg-push-0{left:auto}.scc-col-lg-offset-12{margin-left:100%}.scc-col-lg-offset-11{margin-left:91.66666667%}.scc-col-lg-offset-10{margin-left:83.33333333%}.scc-col-lg-offset-9{margin-left:75%}.scc-col-lg-offset-8{margin-left:66.66666667%}.scc-col-lg-offset-7{margin-left:58.33333333%}.scc-col-lg-offset-6{margin-left:50%}.scc-col-lg-offset-5{margin-left:41.66666667%}.scc-col-lg-offset-4{margin-left:33.33333333%}.scc-col-lg-offset-3{margin-left:25%}.scc-col-lg-offset-2{margin-left:16.66666667%}.scc-col-lg-offset-1{margin-left:8.33333333%}.scc-col-lg-offset-0{margin-left:0}} * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;} *:before,*:after {-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;} body {font-size: 14px;line-height: 1.42857143;color: #333333;background-color: #fff;} #scc-summary-view-header { -webkit-print-color-adjust: exact; justify-content: right; align-items: center;background-color: #F1F1F1 !important;padding: 7px 0px 7px 0px; min-height:40px} }';
		
		$body .= '</style>';
			//end  style for printing method

			// START OF THREE TOP RIGHT BUTTONS
		$body .=   "<div class=' sscfull-width position-relative scc-buttons-visibility' style='margin-top:40px;text-align:right;background-color:#FFF;'><div class='scc-detailed-list-head'></div>";
		
		if(isset($result_2) && isset($result_2->objectsaveicon) && $result_2->objectsaveicon == ''){
				//$body .=  "<span class='' ><button class='scc_btn_table'><i class='fa fa-floppy-o fa-2x' href='javascript:void(0)' onclick='SaveDoc(".$licens.")'></i></button></span>";
			$body .=  "<span class='' ><button class='scc_btn_table' onclick='sendPDF(".$licens.")'><i class='fa fa-floppy-o fa-2x' href='javascript:void(0)'></i></button></span>";
		}
			// OLD DATE $body .=   "<div class='scc-col-md-12 scc-col-xs-12 sscfull-height position-relative center-flex users-price-summary-scc' style='color: black;'><!--<span style='padding: 1%; height: 100%; display: flex;position: relative;align-items: flex-end;'>".date('m/d/Y')."</span>--></div>";
		$body .=   "<span class='sscfull-height position-relative right-flex nopadding' id='sccprinterid'><button  class='scc_btn_table' onclick='PrintDoc(".$licens.")'><i class='fa fa-print fa-2x' href='javascript:void(0)'></i></button></span>";
		$body .=   "<span class='sscfull-height position-relative right-flex nopadding' ><button class='scc_btn_table' onclick='ClosePopup_scc2()'><i class='fa fa-close fa-2x' href='javascript:void(0)'></i></button></span>";
		$body .=   "</div>";
		$body .=   "<div class=' full-width position-relative scc-detailed-list-head' style='margin:20px; display: flex;justify-content: center; align-items: right; text-align:left!important;'></div>";
		
			$body .=   "<div class=' sscfull-width position-relative ' style='display:flex;align-items: center;'>"; //test
			// END OF THREE TOP RIGHT BUTTONS
			// START OF BANNER AND LOGO
			if(get_option('scc_email_banner_image') && (get_option('scc_email_logo_image') != '')){ // logo and banner
				$body .=   "<div class='scc_email_template_view' id='scctembanimage' style='width:100%;'><center><img src=".htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_email_banner_image'))))." alt='banner-img' style='width100%;padding-top:30px;'><div style='width:100%;text-align: center;'><img src=".htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_email_logo_image'))))." alt='logo-img' style='margin-top:25px;max-width: 275px;'></div></center></div>";
			}
			if(get_option('scc_email_banner_image') && (get_option('scc_email_logo_image') == '')){ // banner only
				$body .=   "<div class='scc_email_template_view' id='scctembanimage' style='width:100%;'><img src=".htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_email_banner_image'))))." alt='banner-img' style='width: 100%;padding-top:30px;'></div>"; 
			}
			if((get_option('scc_email_banner_image') == '') && (get_option('scc_email_logo_image') != '')){ // logo only
				$body .=   "<div class='scc_email_template_view' id='scctembanimage' style='width:100%;'><div style='width:100%;text-align: center;'><img src=".htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_email_logo_image'))))." alt='logo-img' style='width: 250px;'></div></div>"; 
			}
			if((get_option('scc_email_banner_image') == '') && (get_option('scc_email_logo_image') == '')){ // no logo and no banner
				$body .=   "<div class='scc_email_template_view' id='scctembanimage' style='width:100%;'></div>"; 
			}
			
			$objtitlelbl = (isset($result_2->objectscctitlelabel) ? $result_2->objectscctitlelabel : '');
			
			// EMD OF BANNER AND LOGO
			$body .=   "</div>";
			$body .= "   <div style='text-align:right'><span style='width: 100%;height: 100%;position: relative;align-items: right;justify-content:right;position:relative; right:0px;width:100%;text-align:right'>".date(get_option('scc_pdf_datefmt') == 'mm-dd-yyyy' ? 'm/d/y' : 'd/m/y')."</span></div>";
			$body .=   "<div class=' sscfull-width position-relative' style='padding-bottom:30px; display: flex;justify-content: center; align-items: center; text-align:center;'>";
			$body .=   "<div class='scc-col-md-10 scc-col-xs-12' style='padding-top:30px;padding-bottom:20px;font-size:30px'>";
			
			if($objtitlelbl == ''){
				$body .=   "<span id='framtablename' class='performance-facts__title' style='margin-top:50px;font-size:18px'>".isset($result) && isset($result->formname) ? $result->formname : '' ." </span>";
			}else{
				$body .=   "<span id='framtablename' class='performance-facts__title' style='margin-top:50px;'>.</span>";
			}
			$body .=   "</div>";
			$body .=   "</div>";
			
			$useragent=$_SERVER['HTTP_USER_AGENT'];


			$body .=   "<div id='scc-summary-view-header' class=' sscfull-width position-relative table__fricctableprice'>";
			
			$body .=   "<div class='scc-col-md-6 scc-col-xs-5 Desc-Quantity-Price-Title-SCC' style='text-align:left'><span class='Title-Descriptions-Summary-Window trn Description'  style=' text-align: right;'>".$trans_desc."</span></div>";
			$body .=   "<div class='scc-col-md-2 scc-col-xs-2 Desc-Quantity-Price-Title-SCC' style='text-align:right'><span class='Title-Descriptions-Summary-Window trn Quantity'  >".$trans_qnty."</span></div>";
			$body .=   "<div class='scc-col-md-2 scc-col-xs-2 Desc-Quantity-Price-Title-SCC' style='text-align:right'><span class='Title-Descriptions-Summary-Window trn Unit Price'  >".$trans_unit."</span></div>";
			$body .=   "<div class='scc-col-md-2 scc-col-xs-3 Desc-Quantity-Price-Title-SCC' style='text-align:right'><span class='Title-Descriptions-Summary-Window trn Price' >".$trans_price."</span></div>";
			$body .=   "</div>";
			
			?>
			var table_body = `<?php echo $body; ?>`;
			var totalPrice =0;
			var subTotal = 0;
			var height = 0;
			var tax=0;
			var taxrate = <?php echo ((isset($result_2->objecttaxrate) && $result_2->objecttaxrate ? $result_2->objecttaxrate : 0)) ?>;
			var onTax = '<?php echo (isset($result_2->objecttaxrate) && $result_2->objecttaxrate ? $result_2->objecttaxrate : 'TAX_RATE_ON'); ?>';
			var TAX_RATE_ON = "TAX_RATE_ON";
			var displayTax = taxrate;
			var finalTotal=0;
			var currencyType = '<?php echo htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_currency'))))?>';
			<?php
			
			$objectscccurrencylabel = isset($result_2) && isset($result_2->objectscccurrencylabel) && $result_2->objectscccurrencylabel ? $result_2->objectscccurrencylabel : '';
 	//	$formstored = isset($result) && isset ($result->formstored) ? json_decode(stripslashes(stripslashes($result->formstored))) : null;
			
			$count =0;
			if (is_array($formstored) || $formstored instanceof Traversable)
			//if (is_array($formstored) || is_object($formstored))
			{
				foreach ($formstored as $opt) {
					//		echo "console.log(".json_encode(var_export($opt, true)).");";
					?>
					
					
					
					var lastTitle = ''
					var currentSubsection = -1
					var sections = []
					var section = []
					var subsection = []

					for(var i=0;i<parts.length;i++){
						var _count = <?php echo $count; ?>;
						var currentTitle = germanCharactersInverseFrontEnd("<?php  echo esc_html($opt->name) ?>")
						
						if(_count == parts[i].section){
							
							if( ((parts[i].value > 0 || parts[i].value < 0 ) && parts[i].unit != 0) || (parts[i].value === 0 && parts[i].unit > 0) || parts[i].comment) {
								if(parts[i].value == 0.001){
									parts[i].value = 0
								}
								if(parts[i].subsection != currentSubsection) {
									section.push(subsection)
									subsection = []
									currentSubsection = parts[i].subsection
								}
								if(lastTitle != currentTitle){
									if(lastTitle != '') {
										sections.push(section)
										section = []
									}
									table_body+="<div class=' sscfull-width position-relative' >";
									table_body+=germanCharactersInverseFrontEnd("<div class='Section-Title-Summary-Window' style='margin-left:5px;'><?php echo esc_html($opt->name) ?></div></div>");
									height +=6;
									lastTitle = currentTitle;
									var jsonPDFrowSection = {
										type: "section_title",
										section_title: currentTitle
									}
									jsonPDF.rows.push(jsonPDFrowSection)
								}
								if(isNaN(parts[i].unit)){
									parts[i].unit = 1;  
								}
								var jsonPDFrow = {}
								var elementName = ""
								if(scc_jQuery(parts[i].name).hasClass('row-fluid Product-Titles-Summary-Window')){
									if(scc_jQuery(parts[i].name).children().length == 2) {
										jsonPDFrow = {
											type: "element_dropdown",
											attr: {
												name: scc_jQuery(parts[i].name).find('.span2').text().trim(),
												description: scc_jQuery(parts[i].name).find('.product-desc-summary-scc').text(),
												unit: parts[i].unit,
												unit_price: "",
												total_price: "",
												value: parts[i].value
											}
										}
									}else{
										if(!parts[i].comment){
											jsonPDFrow = {
												type: "element",
												attr: {
													name: scc_jQuery(parts[i].name).find('.span2').text().trim(),
													unit: parts[i].unit,
													unit_price: "",
													total_price: "",
													value: parts[i].value,
													isSlidingScale: parts[i].isSlidingScale,
												}
											}
										}
										
									}
								} else {
									if(scc_jQuery(parts[i].name).hasClass('span2')){
										jsonPDFrow = {
											type: "element",
											attr: {
												name: scc_jQuery(parts[i].name).text().trim(),
												unit: parts[i].unit,
												unit_price: "",
												total_price: "",
												value: parts[i].value
											}
										}
									}else{
										if(parts[i].custom_math) {
											<?php if($objectscccurrencylabel == "scc_remove_currency_label") { ?>       									
												jsonPDFrow = {
													type: "custom_math",
													attr: {
														value_with_currency: priceCommaStyler(parts[i].value),
														value:  parts[i].value,
														type: parts[i].custom_math_type,
														name: scc_jQuery(parts[i].name).text().trim(),
														show_detailed_list: parts[i].show_detailed_list
													}
												}
											<?php } else {  ?>
												jsonPDFrow = {
													type: "custom_math",
													attr: {
														value_with_currency: priceCommaStyler(parts[i].value),
														value: parts[i].value,
														type: parts[i].custom_math_type,
														name: scc_jQuery(parts[i].name).text().trim(),
														show_detailed_list: parts[i].show_detailed_list
													}
												}
											<?php }  ?>
										}else {

											jsonPDFrow = {
												type: "element",
												attr: {
													name: (parts[i].name).trim(),
													unit: parts[i].unit,
													value: parts[i].value,
													unit_price: "",
													total_price: ""
												}
												
											}
											
										}
									}	
								}
								if(parts[i].custom_math){
						/*
                            adding currency in frontend custom math:
                            */
                            
                            scc_jQuery('.scc_custom_math_value_front_end').each(function(index, ob){
                            	scc_jQuery(ob).text()
                            	<?php if($objectscccurrencylabel == "scc_remove_currency_label") { ?>                                
                            		scc_jQuery(ob).text(priceCommaStyler(parts[i].value))
                            	<?php }else{ ?> 
                            		scc_jQuery(ob).text((priceCommaStyler(parts[i].value)))
                            	<?php } ?>                                   
                            })
                            /* CUSTOM MATH */
                            if(parts[i].show_detailed_list) {
                            	notPercentTypeWithCurrency = parts[i].custom_math_type + " " + (priceCommaStyler(parts[i].value));
                            	notPercentTypeWithoutCurrency = parts[i].custom_math_type + " " + priceCommaStyler(parts[i].value);
                            	percentType = parts[i].value + parts[i].custom_math_type;
                            	table_body += "<div class='scc-preview-row'>"
                            	table_body += " <div class='scc-col-md-7 scc-col-xs-5 sscfull-height sccfull-height-2  ' style='text-align:left;'><span style='' class='users-price-summary-scc '> "+parts[i].name+"</span></div>";
                            	table_body += "<div class='scc-col-md-2 scc-col-xs-2 sscfull-height' style='text-align:left;'><span class='users-price-summary-scc '> </span></div>";
                            	<?php if($objectscccurrencylabel == "scc_remove_currency_label") { ?>                                
                            		table_body += " <div class='scc-col-md-1 scc-col-xs-1 sscfull-height ' style='text-align:right'><span style=' margin-right:0px' class='users-price-summary-scc ' >" + ( (parts[i].custom_math_type == '%') ? percentType : notPercentTypeWithoutCurrency ) + "</span></div>";
                            	<?php }else{ ?> 
                            		table_body += " <div class='scc-col-md-1 scc-col-xs-1 sscfull-height' style='text-align:right'><span style=' margin-right:8px' class='users-price-summary-scc ' >" + ( (parts[i].custom_math_type == '%') ? percentType : notPercentTypeWithCurrency ) + "</span></div>";
                            	<?php } ?>
								//table_body += "<div class='scc-col-xs-2 scc-col-md-2 ' style='min-height:50px'></div>" 
								table_body += " <div class='scc-col-md-2 scc-col-xs-3 sscfull-height' style='text-align:right'><span style=' margin-right:8px' class='users-price-summary-scc ' >" + ( (parts[i].custom_math_type == '%') ? '' : '' ) + "</span></div>";
								table_body += "</div>"
							}
						}else {
							if(parts[i].comment){
								
								table_body += "<div class='comments-printing-improvement' style= 'display: flex;justify-content: left;'>"
								table_body += " <div class='scc-col-md-4 scc-col-xs-4 sscfull-height  ' style=''><span class='users-price-summary-scc ' >"+parts[i].name+"</span></div>";
								table_body += " <div class='scc-col-md-8 scc-col-xs-8 sscfull-height' style='text-align:left'><span class='users-price-summary-scc ' style=''>" + parts[i].text + " </span></div>";
								
								table_body += "</div>"

								var jsonDPDFcomment = {
									type: "comment",
									attr: {
										title: scc_jQuery(parts[i].name).find('.span2').text(),
										comment: parts[i].text
									}
								}
								jsonPDF.rows.push(jsonDPDFcomment)
							}else {
								table_body+="<div class='scc-preview-row'>";
								table_body+="<div class='scc-col-md-7 scc-col-xs-5 sscfull-height sccfull-height-2 ' style='text-align:left !important'>"+parts[i].name+"</div>";
								// table_body+="<div class='scc-col-md-2 scc-col-xs-2 sscfull-height center-flex-align'><span class='users-price-summary-scc'>"+parts[i].value+" <?php echo sanitize_text_field(get_option('scc_currency')); ?></span></div>";
								table_body+="<div class='scc-col-md-1 scc-col-xs-1 sscfull-height  ' style='text-align:right'><span class='users-price-summary-scc'>"+parts[i].unit+" </span></div>"; //Quantity for all items
								
								<?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>
									table_body+="<div class='scc-col-md-2 scc-col-xs-3 sscfull-height  ' style='text-align:right'><span class='users-price-summary-scc'>"+priceCommaStyler(parts[i].value) + " </span></div>"; //Unit value for all items
									table_body+="<div class='scc-col-md-2 scc-col-xs-3 sscfull-height ' style='text-align:right'><span class='users-price-summary-scc'>"+priceCommaStyler(( !(parts[i].isSlidingScale) ? parts[i].unit * parts[i].value : parts[i].value).toFixed(2)) : +" </span></div>"; // Price for all items
									
									jsonPDFrow.attr["unit_price"] = parts[i].value
									jsonPDFrow.attr["total_price"] = currencyStyle(priceCommaStyler((!(parts[i].isSlidingScale) ? parts[i].unit * parts[i].value : parts[i].value).toFixed(2)))

								<?php }else{ ?> 
									table_body+="<div class='scc-col-md-2 scc-col-xs-3 sscfull-height ' style='text-align:right'><span class='users-price-summary-scc' style='position:relative; right:0px;' ><span class='currency-prefix'></span><span>&nbsp;  "+priceCommaStyler(parts[i].value) + "</span><span class='currency-sufix'></span>	</span></div>"; //Unit value for all items
									table_body+="<div class='scc-col-md-2 scc-col-xs-3 sscfull-height  ' style='text-align:right'><span class='users-price-summary-scc'><span class='currency-prefix'></span><span>&nbsp;  "+priceCommaStyler( ( !(parts[i].isSlidingScale) ? parts[i].unit * parts[i].value : parts[i].value ).toFixed(2) )+"</span><span class='currency-sufix'></span></span></div>"; // Price for all items		
									
									jsonPDFrow.attr["unit_price"] = parts[i].value
									jsonPDFrow.attr["total_price"] = currencyStyle(priceCommaStyler((!(parts[i].isSlidingScale) ? parts[i].unit * parts[i].value : parts[i].value).toFixed(2)))
								<?php } ?>
							}
							
							
						}
						
						

						jsonPDF.rows.push(jsonPDFrow)
						subsection.push(jsonPDFrow)
						table_body+="</div>";
					//	totalPrice +=(parts[i].unit*parts[i].value);
					height +=6;
					
				}else{
				}
			}
		}

		section.push(subsection)
		sections.push(section)
		
				/*
					START - CUSTOM MATH CALCULATOR 
					*/
				for(var i = 0; i < sections.length; i++) { // sections
					var sectionPrice = 0;
					for (var j = 0; j < sections[i].length; j++) { // subsections
						var subsectionPrice = 0
						for(var k = 0; k < sections[i][j].length; k++) { // elements
							if(sections[i][j][k].type === "custom_math") {
								console.log(sections[i][j][k])
								switch (sections[i][j][k].attr.type) {
									case "+":
									subsectionPrice = subsectionPrice + Number(sections[i][j][k].attr.value)
									break
									case "-":
									subsectionPrice = subsectionPrice - Number(sections[i][j][k].attr.value)
									break
									case "x":
									subsectionPrice = subsectionPrice * Number(sections[i][j][k].attr.value)
									break
									case "%":
									subsectionPrice = subsectionPrice * Number(1 + (sections[i][j][k].attr.value/100))
									break
								}
							}else if (sections[i][j][k].type === "element" || sections[i][j][k].type === "element_dropdown") {
								subsectionPrice += !(sections[i][j][k].attr.isSlidingScale) ? sections[i][j][k].attr.unit * sections[i][j][k].attr.value : sections[i][j][k].attr.value
								
							}
						}
						if(subsectionPrice < 0) {
						//	subsectionPrice = 0
					}
					sectionPrice += subsectionPrice
				}
				totalPrice += sectionPrice

				var sectionTotalElement = jQuery(`.scc-section-total[data-section=${_count}] .scc-multiple-total-text`);
				var sectionTotalText = (currencyStyleOption === 0) ? currencySymbol(currencyLabel) + priceCommaStyler(sectionPrice) : priceCommaStyler(sectionPrice) + ' ' + currencyLabel;
				sectionTotalElement.text(sectionTotalText);
			}
			if(totalPrice < 0) {
				totalPrice = 0
			}
				/*
					END - CUSTOM MATH CALCULATOR 
					*/

					subTotal = totalPrice;
					
					
					if(taxrate !=0 && taxrate !=''){
						tax = (totalPrice * taxrate)/100;
						finalTotal = totalPrice + tax;            
					}else{
						finalTotal = totalPrice;    
					}
					
					
					<?php
					++$count;
				}
			}
			?>
		//mark-10072019 tax view position change
		if(comments && comments.length > 0){
			table_body +="<br/>"
			table_body +="<br/>"
			for(var i=0; i<comments.length; i++){
				table_body += "<div class='comments-printing-improvement' style= 'margin-left:-10px'>"
				table_body += " <div class='scc-col-md-4 scc-col-xs-4 sscfull-height  '><span class='users-price-summary-scc '>"+comments[i].title+"</span></div>";
				table_body += " <div class='scc-col-md-4 scc-col-xs-4 sscfull-height' style='text-align:right'><span class='users-price-summary-scc ' style='margin-right:-15px'>" + comments[i].text + " </span></div>";
				table_body += "<div class='scc-col-xs-4 scc-col-md-4 ' style='min-height:50px'></div>" 
				table_body += "</div>"

				var jsonDPDFcomment = {
					type: "comment",
					attr: {
						title: scc_jQuery(comments[i].title).find('.span2').text(),
						comment: comments[i].text
					}
				}
				jsonPDF.rows.push(jsonDPDFcomment)
			}
//			table_body +="<br/>"
}

subTotal = displayCouponDiscountInFrontEnd(subTotal)
		// Start of Displaying Coupon Discount
		
		if(taxrate !=0 && taxrate !=''){
			tax = (subTotal * taxrate)/100;
			finalTotal = subTotal + tax;            
		}else{
			finalTotal = subTotal;    
		}
		

		//table_body+="  <div class=' full-width position-relative' style='height: 5%; display: flex;justify-content: center; align-items: center;'></div>";
		table_body+="  <div class=' full-width position-relative' >";
		if(coupon){
			table_body+="   <div class='scc-col-md-offset-5 scc-col-xs-offset-5 scc-col-md-7 scc-col-xs-7' id='display_price_table' style='margin-top: 20px;'>";
			
			if(Number(coupon.discountpercentage) != -1){
				var jsonPDFcoupon = {
					type: "coupon",
					attr: {
						title: "Coupon Discount " + coupon.discountpercentage + "%",
						discount_price: ""
					}
				}
				if(window.hasOwnProperty("translatorJson")){
					if(translatorJson['Coupon Discount'] && translatorJson['Coupon Discount']['en']) {
						jsonPDFcoupon = {
							type: "coupon",
							attr: {
								title: translatorJson['Coupon Discount']['en'] + " " + coupon.discountpercentage + "%",
								discount_price: ""
							}
						}
					} 
				}
				table_body+="   <div class='scc-col-md-12 scc-col-xs-12 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; max-width:250px'><span class='Coupon_percentage' style='font-weight:bold;margin-right:20px' ><?php /*echo $trans_totl_price;*/ ?><span class='trn'>Coupon Discount</span> " + coupon.discountpercentage + "%</span></div>";
				<?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>

					jsonPDFcoupon.attr["discount_price"] = "-" + currencyStyle(priceCommaStyler(coupon.discount_value_total.toFixed(2))) +""
					table_body+="   <div  style='border: 1px solid white; text-align:right; justify-content: right; align-items: center;'><span class='Total_Price' id='' style='font-weight:bold;position:relative; right:0px;width:100%;'>-" + priceCommaStyler(coupon.discount_value_total.toFixed(2)) +"</span></div>";
					
				<?php }else{ ?>

					jsonPDFcoupon.attr["discount_price"] = "-" + currencyStyle(priceCommaStyler(coupon.discount_value_total.toFixed(2))) +""
					table_body+="   <div  style='border: 1px solid white; text-align:right; justify-content: right; align-items: center;'><span class='Total_Price' id='coupon_discount_with_currency_label' style='font-weight:bold;position:relative; right:0px;width:100%;'>-" + priceCommaStyler(coupon.discount_value_total.toFixed(2)) +" <?php echo sanitize_text_field(get_option('scc_currency')); ?></span></div>";
				<?php } ?>

				jsonPDF.rows.push(jsonPDFcoupon)

			}
			if(Number(coupon.discountvalue) != -1){
				var jsonPDFcoupon = {
					type: "coupon",
					attr: {
						title: "",
						discount_price: ""
					}
				}
				<?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>

					jsonPDFcoupon.attr["title"] = "Coupon Discount " + priceCommaStyler(coupon.discountvalue)
					jsonPDFcoupon.attr["discount_price"] = "-" + priceCommaStyler(coupon.discount_value_total.toFixed(2)) +""

					if(window.hasOwnProperty("translatorJson")){
						if(translatorJson['Coupon Discount'] && translatorJson['Coupon Discount']['en']) {
							jsonPDFcoupon.attr["title"] = translatorJson['Coupon Discount']['en'] + " " + priceCommaStyler(coupon.discountvalue)
						} 
					}
					table_body+="   <div class='scc-col-md-12 scc-col-xs-12 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; max-width:250px'><span class='trn Coupon_percentage' style='font-weight:bold;margin-right:20px' ><?php /*echo $trans_totl_price;*/ ?><span class='trn'>Coupon Discount</span> " + priceCommaStyler(coupon.discountvalue) + "</span></div>";
					table_body+="   <div  style='border: 1px solid white;display: flex; justify-content: right; align-items: center;'><span class='Total_Price' id='' style='font-weight:bold;position:relative; right:0px;width:100%;'>-" + priceCommaStyler(coupon.discount_value_total.toFixed(2)) +"</span></div>";
				<?php }else{ ?>

					jsonPDFcoupon.attr["title"] = "Coupon Discount " + currencyStyle(priceCommaStyler(Number(coupon.discountvalue).toFixed(2))) 
					jsonPDFcoupon.attr["discount_price"] = "-" + currencyStyle(priceCommaStyler(coupon.discount_value_total.toFixed(2))) 
					
					if(window.hasOwnProperty("translatorJson")){
						if(translatorJson['Coupon Discount'] && translatorJson['Coupon Discount']['en']) {
							jsonPDFcoupon.attr["title"] = translatorJson['Coupon Discount']['en'] + " " + currencyStyle(priceCommaStyler(Number(coupon.discountvalue).toFixed(2))) 
						} 
					}

					table_body+="   <div class='scc-col-md-12 scc-col-xs-12 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; justify-content: right; align-items: center;max-width:250px'><span class='trn Coupon_percentage' style='font-weight:bold;margin-right:20px' ><?php /*echo $trans_totl_price;*/ ?><span class='trn'>Coupon Discount</span> " + priceCommaStyler(Number(coupon.discountvalue).toFixed(2))  +  " <?php echo esc_html(sanitize_text_field(get_option('scc_currency'))); ?></span></div>";
					table_body+="   <div  style='border: 1px solid white;text-align:right; justify-content: right; align-items: center;'><span class='Total_Price' id='coupon_discount_with_currency_label' style='font-weight:bold;position:relative; right:0px;width:100%;'> -" + priceCommaStyler(coupon.discount_value_total.toFixed(2)) +" <?php echo sanitize_text_field(get_option('scc_currency')); ?></span></div>";
				<?php } ?>
				jsonPDF.rows.push(jsonPDFcoupon)
			}
			table_body+=" </div>"
		}
		//table_body+="   <div class='scc-col-md-6 scc-col-xs-0'></div>";
		table_body+="   <div class='scc-col-md-offset-6 scc-col-xs-offset-6 scc-col-md-6 scc-col-xs-6' id='display_price_table' style='margin-top: 20px;border-top: 2px solid #E8E8E8;padding-top:10px'>";
		
		
		// Start of Displaying Sub-total Tax
		<?php if(isset($result_2->objecttaxrate) && ($result_2->objecttaxrate != '') && ($result_2->objecttaxrate != 0)): ?>
		var jsonPDFtax = {
			type: "subtotal_tax",
			attr: {
				title: "",
				price: ""
			}
		}
		table_body+="   <div class=' scc-col-md-6 scc-col-xs-6 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; height:35px;max-width:150px'><span class='Title-Descriptions-Summary-Window trn Total_Price subtotal_tax_for_pdf' style='' >Sub Total</span></div>";
		<?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>
			jsonPDFtax.attr["price"] = subTotal.toFixed(2)
			table_body+="   <div  style='border: 1px solid white;  justify-content: right; align-items: center;height:35px;text-align:right'><span class='Title-Descriptions-Summary-Window ' style='position:relative; right:0px;' id=''>"+ subTotal.toFixed(2) +"</span></div>";
			jsonPDF.rows.push(jsonPDFtax)
		<?php }else{ ?>
			jsonPDFtax.attr["price"] = currencyStyle(priceCommaStyler(subTotal.toFixed(2)))
			table_body+="   <div  style='border: 1px solid white;  justify-content: right; align-items: right;height:35px;text-align:right'><span class='Title-Descriptions-Summary-Window ' style='position:relative; right:0px;' id='subtotal_price_with_currency_label'>"+ priceCommaStyler(subTotal.toFixed(2)) +"<?php echo sanitize_text_field(get_option('scc_currency')); ?></span></div>";
			jsonPDF.rows.push(jsonPDFtax)
		<?php } endif; ?>
		// End of Displaying Sub-total Tax
		
		// Start of Displaying Tax
		<?php if(isset($result_2->objecttaxrate) && ($result_2->objecttaxrate != '') && ($result_2->objecttaxrate != 0)): ?>
		var jsonPDFtax = {
			type: "tax",
			attr: {
				title: "",
				title_second_part: displayTax + " %",
				price: ""
			}
		}
		table_body+="   <div class=' scc-col-md-6 scc-col-xs-6 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; height:35px;max-width:150px'><span class='Title-Descriptions-Summary-Window Total_Price'><span class='trn tax_for_pdf'>TAX</span> "+ displayTax +" %</span></div>";
		<?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>
			table_body+="   <div  style='border: 1px solid white; text-align:right; justify-content: right; align-items: center;height:35px;'><span class='Title-Descriptions-Summary-Window ' style='position:relative; right:0px;' id=''>"+ tax +"</span></div>";		    
			jsonPDFtax.attr["price"] = tax
			jsonPDF.rows.push(jsonPDFtax)
		<?php }else{ ?>
			table_body+="   <div  style='border: 1px solid white; text-align:right; justify-content: right; align-items: center;height:35px;'><span class='Title-Descriptions-Summary-Window ' style='position:relative; right:0px;' id='tax_price_with_currency_label'>"+ tax +" "+ currencyType +"</span></div>";
			jsonPDFtax.attr["price"] = currencyStyle(Number(tax).toFixed(2))
			jsonPDF.rows.push(jsonPDFtax)
		<?php } endif; ?>
	    // End of Displaying Tax
	    
	    
	    
	    
	    var jsonPDFtotal = {
	    	type: "total",
	    	attr: {
	    		title: "<?php echo $trans_totl_price; ?>",
	    		price: ""
	    	}
	    }

	    table_body+="   <div class=' scc-col-md-6 scc-col-xs-6 sscfull-height position-relative table__fricctableprice' style='border: 1px solid white;text-align:right; max-width:150px'><span class='trn Total_Price' style='font-weight:bold;' ><?php echo $trans_totl_price; ?></span></div>";
	    <?php if($objectscccurrencylabel == "scc_remove_currency_label"){ ?>
	    	jsonPDFtotal.attr["price"] = priceCommaStyler(finalTotal.toFixed(2))
	    	table_body+="   <div  style='border: 1px solid white;text-align:right; justify-content: right; align-items: center;'><span class='Total_Price' id='' style='font-weight:bold;position:relative; right:0px;width:100%;'>" + priceCommaStyler(finalTotal.toFixed(2)) +"</span></div>";
	    <?php }else{ ?>
	    	jsonPDFtotal.attr["price"] = currencyStyle(priceCommaStyler(finalTotal.toFixed(2)))
	    	table_body+="   <div  style='border: 1px solid white;text-align:right; justify-content: right; align-items: center;'><span class='Total_Price' id='total_price_with_currency_label' style='font-weight:bold;position:relative; right:0px;width:100%;text-align:right'>" + priceCommaStyler(finalTotal.toFixed(2)) +" <?php echo sanitize_text_field(get_option('scc_currency')); ?></span></div>";
	    <?php } ?>

	    jsonPDF.rows.push(jsonPDFtotal)
	    
	    table_body+="   </div></div>";
	    table_body+="   <div class='scc_email_template_view' id='scc_email_temfootdiscr' style='margin-top: 84px;'><div style='max-width: 65%;margin: auto;padding-top:75px;'><?php echo str_replace('\\', '',preg_replace("/\r|\n/", "< br/>",htmlspecialchars(stripslashes(sanitize_text_field(get_option('scc_footerdisclaimer')))))); ?></div></div>";
	    
	    /* table_body+="<div class='scc-col-md-9 scc-col-xs-9 sscfull-height position-relative center-flex users-price-summary-scc' style='color: black;'><span style='width: 100%; padding: 1%; height: 100%; display: flex;position: relative;align-items: flex-end;'>Issue On:  ".date('m/d/Y H:i')."</span></div>"; */
	    var xheight = 42+height - 100;
		if (xheight <= 5) xheight =5;//console.log(xheight, height);
		table_body+="  <div class='row sscfull-width position-relative' style='height:"+xheight+"%; display: flex;justify-content: center; align-items: center;'></div>";
	//   table_body+="<div id='sccidsent' class='sscfull-height position-relative'>"
	//   table_body+="<div class='row sscfull-width position-relative scccontrol' id='sccemailid' style='height: 7%; display: flex;justify-content: center; align-items: center;'>";
	//   table_body+="<div class='scc-col-md-3 scc-col-xs-3 sscfull-height' style='background:#f0f0f0;display: flex; justify-content: center; align-items: center;padding: 0.5%;'><input id='sscuserAddress' class='performance-facts__summary4' type='text'placeholder='Name' style='color:#666;'/></div>";
	//   table_body+="<div class='scc-col-md-3 scc-col-xs-3 sscfull-height' style='background:#f0f0f0;display: flex; justify-content: center; align-items: center;padding: 0.5%;'><input id='sscemailAddress' class='performance-facts__summary4' type='email' placeholder='Email' style='color:#666;'/></div>";
	//   table_body+="<div class='scc-col-md-3 scc-col-xs-3 sscfull-height' style='background:#f0f0f0;display: flex; justify-content: center; align-items: center;padding: 0.5%;'><input class='performance-facts__summary4' type='text' placeholder='Phone (Optional)' style='color:#666;'/></div>";
	//   table_body+="<div class='scc-col-md-3 scc-col-xs-3 sscfull-height' style='background:#f0f0f0;display: flex; justify-content: center; align-items: center;padding: 0.5%;'><button "+'<?php echo $licens_enable; ?>'+" class='scc_button_table performance-facts__summary2' style='' onclick='javascript:sendemail("+<?php echo $licens; ?>+");' id='sendemail'><span class='trn SEND'>SEND</span></button></div>";
	//   table_body+="</div>";
	table_body+="</div>";
	table_body+="</div>";
	scc_jQuery('#sccTale_price').html(table_body);
	
	if(window.hasOwnProperty("translatorJson")){
		initTranslationScriptSCC('body', {lang: "en", t: translatorJson});
	}

	scc_jQuery('body').find('.Description').each(function(index, ob){
		jsonPDF.description = scc_jQuery(ob).text()
	})
	scc_jQuery('body').find('.Quantity').each(function(index, ob){
		jsonPDF.quantity = scc_jQuery(ob).text()
	})
	scc_jQuery('body').find('.Unit').each(function(index, ob){
		jsonPDF.unit = scc_jQuery(ob).text()
	})
	scc_jQuery('body').find('.Price').each(function(index, ob){
		jsonPDF.price = scc_jQuery(ob).text()
	})
	scc_jQuery('body').find('.subtotal_tax_for_pdf').each(function(index, ob){
		for(var i= 0; i < jsonPDF.rows.length;  i++){
			if(jsonPDF.rows[i].type == "subtotal_tax") {
				jsonPDF.rows[i].attr.title = scc_jQuery(ob).text()
			}
		}
	})
	scc_jQuery('body').find('.tax_for_pdf').each(function(index, ob){
		for(var i= 0; i < jsonPDF.rows.length;  i++){
			if(jsonPDF.rows[i].type == "tax") {
				jsonPDF.rows[i].attr.title = scc_jQuery(ob).text()
			}
		}
	})
	
	return subTotal
}
function priceCommaStyler(price){
	<?php if(get_option('scc_currency_style') == "comma") {
		echo "isCommaBasedStyling = true;";
	} else echo "isCommaBasedStyling = false;"; ?>

	price = price + '';
	if (isCommaBasedStyling) {
		var dot = price.indexOf('.') === -1 ? false : true
		var newPrice = ''

		for(var i = (price.split('').length - 1) ; i >= 0; i--){
			if(price.indexOf('-') === -1){
				if(!dot && (i === ((price.split('').length - 1) - 3) || i === ((price.split('').length - 1) - 6) || i === ((price.split('').length - 1) - 9))){
					newPrice = ',' + newPrice
				}else if(dot && (i === ((price.split('').length - 1) - 6) || i === ((price.split('').length - 1) - 9) || i === ((price.split('').length - 1) - 12))){
					newPrice = ',' + newPrice
				}            
				newPrice = price.split('')[i] + newPrice
			}else{
				if(!dot && (i === ((price.split('').length - 1) - 4) || i === ((price.split('').length - 1) - 6) || i === ((price.split('').length - 1) - 9))){
					if(price.split('').length > 4){
						newPrice = ',' + newPrice
					}
				}else if(dot && (i === ((price.split('').length - 1) - 6) || i === ((price.split('').length - 1) - 9) || i === ((price.split('').length - 1) - 12))){
					if(price.split('').length > 7){
						newPrice = ',' + newPrice
					}
				}            
				newPrice = price.split('')[i] + newPrice
			}
			
		}
		if(newPrice.length >= 3 && ( newPrice.substring(newPrice.length - 3, newPrice.length - 1) === '.00' || newPrice.substring(newPrice.length - 3, newPrice.length) === '.00')  ){
			newPrice = newPrice.split('.')[0]
		}
		return newPrice;
	}
	return parseFloat(price).toLocaleString(navigator.languages[0]);
}

function hiddenClone(element){
	// Create clone of element
	var clone = element.cloneNode(true);
	
	// Position element relatively within the 
	// body but still out of the viewport
	var style = clone.style;
	//	style.position = 'absolute';
	//	style.top = - window.innerHeight + 'px';
	style.left = 0;
	style.top = 1000 + 'px'
	//	style.background = '#FFFFFF'
	
	// Append clone to body and return the clone
	document.body.appendChild(clone);
	return clone;
}




function sendPDF(enable){
	if(enable ==0){
		scc_jQuery('.scc-alert').remove();  
		
		return;
	}

	
	$ajaxQuery= {
		url: rt_vars.rt_urlajax,
		type: 'POST',
		xhrFields: {
			responseType: ''
		},
		data: {
			action: 'sccSendPDF',
			payload: Base64.encode(JSON.stringify(jsonPDF)),
			tableTitle,
		},
		success: function(b64){
			
			const linkSource = `data:application/pdf;base64,${b64}`;
			const downloadLink = document.createElement("a");
			const fileName = "quote.pdf";

			downloadLink.href = linkSource;
			downloadLink.download = fileName;
			downloadLink.click();
			
		},
		error: function(err){
			console.log('err', err)
			console.log('err', err.responseText)
			

			var disposition = err.getResponseHeader('content-disposition');
			var matches = /"([^"]*)"/.exec(disposition);
			var filename = (matches != null && matches[1] ? matches[1] : 'file.pdf');

				// The actual download
				var blob = new Blob([err.responseText], { type: 'application/pdf' });
				var link = document.createElement('a');
				link.href = window.URL.createObjectURL(blob);
				link.download = filename;

				document.body.appendChild(link);

				link.click();

				document.body.removeChild(link);
			}
		}
		scc_jQuery.ajax($ajaxQuery);
        // var xmlhttp = new XMLHttpRequest();
        // xmlhttp.open("POST", rt_vars.rt_urlajax, true);
        // xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        // xmlhttp.send(JSON.stringify({
        //     action: 'sccSendPDF',
        //     payload: JSON.stringify(jsonPDF),
        // }));
    }
    var isMobile = false
    function sendemail($enable){

    	if($enable ==0){
    		scc_jQuery("#myModalSCCEmailQuote").modal();
    		scc_jQuery('.modal-backdrop').each(function(){
    			scc_jQuery(this).removeClass('modal-backdrop')
    		})
    		return;
    	}
    	console.log("scc_jQuery('#sscemailAddress').val().length", scc_jQuery('#sscemailAddress').val().length)
    	if(!scc_jQuery('#sscemailAddress') || !scc_jQuery('#sscemailAddress').val() 
    		|| !scc_jQuery('#sscemailAddress').val().includes('@')
    		|| !scc_jQuery('#sscemailAddress').val().includes('.')
    		|| scc_jQuery('#sscemailAddress').val().includes('#')
    		|| scc_jQuery('#sscemailAddress').val().length < 4){
    		scc_jQuery('#email-error').html('Email not valid')
    	return;
    }
    createSendEmailModal()
		// saving current display properties of the headers and footers to data for use when modal is closed
		scc_jQuery('header').each(function () {
			var headerState = scc_jQuery(this).css('display');
			jQuery(this)
			.data('scc-headerState', headerState)
			.css({
				display: 'none'
			});
		});
		scc_jQuery('footer').each(function () {
			var footerState = scc_jQuery(this).css('display');
			jQuery(this)
			.data('scc-footerState', footerState)
			.css({
				display: 'none'
			});
		});
		var title = document.getElementById("framtablename") ? document.getElementById("framtablename").innerText : '';
		var bar=new RadialProgress(document.getElementById("scc_sendemail_progress_bar"),{indeterminate:false,colorFg:"<?php echo $result_2->objectColorPicker; ?>",thick:10,fixedTextSize:0.2});
		bar.setValue(0.1);
		scc_jQuery('.hover_bkgr_fricctableprice').show();
		scc_jQuery('#sccprinterid').attr('style','display:none !important');
		scc_jQuery('#sccidsent').hide();
		scc_jQuery('#sccemailid').hide();
		
		
		var currentScroll = scc_jQuery(document).scrollTop()
		scc_jQuery(document).scrollTop(0)
		var bodyWidth = scc_jQuery('body').css('width')
		

		if( navigator.userAgent.match(/Android/i)
			|| navigator.userAgent.match(/webOS/i)
			|| navigator.userAgent.match(/iPhone/i)
			|| navigator.userAgent.match(/iPad/i)
			|| navigator.userAgent.match(/iPod/i)
			|| navigator.userAgent.match(/BlackBerry/i)
			|| navigator.userAgent.match(/Windows Phone/i)){
			isMobile = true
	}
		/*
		scc_jQuery('.scc-buttons-visibility').each(function(index, ob){
			scc_jQuery(ob).css('display', 'none')
		})
		*/

		bar.setValue(0.3)

		bar.setValue(0.5)


		scc_jQuery.getJSON('https://httpbin.org/ip', function(data) {
			var titleFromDatabase = "<?php echo sanitize_text_field(get_option('scc_emailsubject')) ?>";
			
			if(titleFromDatabase && titleFromDatabase.length > 0){
				title = titleFromDatabase
			}
			var email = scc_jQuery('#sscemailAddress').val()
			var user = scc_jQuery('#sscuserAddress').val()
			var phone  = scc_jQuery('#sscuserPhone').val();
			
			bar.setValue(0.90);
			
			scc_jQuery(document).scrollTop(currentScroll)
			var ipaddress = 'no IP'
			if(data){
				if(data.origin){
					if(data.origin.length > 0 ){
						ipaddress = data.origin.split(',')[0]
					}
				}
			}
			var browserInfo = ""
			var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
			var isFirefox = typeof InstallTrigger !== 'undefined';
			var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
			var isIE = /*@cc_on!@*/false || !!document.documentMode;
			var isEdge = !isIE && !!window.StyleMedia;
			var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
			var isBlink = (isChrome || isOpera) && !!window.CSS;

			if(isOpera) browserInfo = "Opera"
				if(isFirefox) browserInfo = "Firefox"
					if(isSafari) browserInfo = "Safari"
						if(isIE) browserInfo = "Internet Explorer"
							if(isEdge) browserInfo = "Edge"
								if(isChrome) browserInfo = "Chrome"
									
									$fragment_refresh={
										url: rt_vars.rt_urlajax,
										type: 'POST',
										data: {
											action: 'sccSendEmail',
											payload: Base64.encode(JSON.stringify(jsonPDF)),
											email_to: email,
											user_to: user,
											title: title,
											phone: phone,
											ipaddress: ipaddress,
											browserInfo: browserInfo,
											device: isMobile
										},
										success: function(data) {
											
											bar.setValue(1);
											ClosePopup_scc2()
											setTimeout(() => {
												removeSendEmailProgress()
												scc_jQuery('body').css({
													overflow: 'visible'
												});
				// restore header and footer's initial display property value
				scc_jQuery('header').each(function () {
					var initialState = jQuery(this).data('scc-headerState');
					scc_jQuery(this).css({display: initialState});
				});
				scc_jQuery('footer').each(function () {
					var initialState = jQuery(this).data('scc-footerState');
					scc_jQuery(this).css({display: initialState});
				});
			}, 1000);
											scc_jQuery('#statusMsg').html('<span class="scc-col-lg-8 scc-col-md-8 scc-col-xs-12" style="font-size:17px;color:#34A853"> Thank you, '+user+'. Your quote has been sent to '+email+'</span>');
										}
									}
									scc_jQuery.ajax( $fragment_refresh )
								})
		.fail(function() {
			$fragment_refresh={
				url: rt_vars.rt_urlajax,
				type: 'POST',
				data: {
					action: 'sccSendEmail',
					payload: Base64.encode(JSON.stringify(jsonPDF)),
					email_to: email,
					user_to: user,
					title: title,
					phone: phone,
					ipaddress: '',
					browserInfo: browserInfo,
					device: isMobile
				},
				success: function(data) {
					
					bar.setValue(1)
					ClosePopup_scc2()
					setTimeout(() => {
						removeSendEmailProgress()
						scc_jQuery('body').css({
							overflow: 'visible'
						});
					// restore header and footer's initial display property value
					scc_jQuery('header').each(function () {
						var initialState = jQuery(this).data('scc-headerState');
						scc_jQuery(this).css({display: initialState});
					});
					scc_jQuery('footer').each(function () {
						var initialState = jQuery(this).data('scc-footerState');
						scc_jQuery(this).css({display: initialState});
					});
				}, 1000);
					scc_jQuery('#statusMsg').html('<span class="scc-col-lg-8 scc-col-md-8 scc-col-xs-12" style="font-size:17px;color:#34A853"> Thank you, '+user+'. Your quote has been sent to '+email+'</span>');
				}
			}
			scc_jQuery.ajax( $fragment_refresh )
		})





		scc_jQuery('.scc-email-popup-close').click();
		setTimeout(function(){scc_jQuery('#sccidsent').show();},600);
	}

	
	function check(doc,title, clone, currentScroll, bar){
		scc_jQuery.getJSON('https://httpbin.org/ip', function(data) {
			var titleFromDatabase = "<?php echo sanitize_text_field(get_option('scc_emailsubject')) ?>";
			
			if(titleFromDatabase && titleFromDatabase.length > 0){
				title = titleFromDatabase
			}
			var email = scc_jQuery('#sscemailAddress').val()
			var user = scc_jQuery('#sscuserAddress').val()
			var phone  = scc_jQuery('#sscuserPhone').val();
			
			bar.setValue(0.90);
			
			var pdf = btoa(doc.output()); 
			scc_jQuery(document).scrollTop(currentScroll)
			var ipaddress = 'no IP'
			if(data){
				if(data.origin){
					if(data.origin.length > 0 ){
						ipaddress = data.origin.split(',')[0]
					}
				}
			}
			var browserInfo = ""
			var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
			var isFirefox = typeof InstallTrigger !== 'undefined';
			var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
			var isIE = /*@cc_on!@*/false || !!document.documentMode;
			var isEdge = !isIE && !!window.StyleMedia;
			var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
			var isBlink = (isChrome || isOpera) && !!window.CSS;

			if(isOpera) browserInfo = "Opera"
				if(isFirefox) browserInfo = "Firefox"
					if(isSafari) browserInfo = "Safari"
						if(isIE) browserInfo = "Internet Explorer"
							if(isEdge) browserInfo = "Edge"
								if(isChrome) browserInfo = "Chrome"
									
									$fragment_refresh={
										url: rt_vars.rt_urlajax,
										type: 'POST',
										data: {
											action: 'sccSendEmail',
											payload: Base64.encode(JSON.stringify(jsonPDF)),
											email_to: email,
											user_to: user,
											title: title,
											phone: phone,
											ipaddress: ipaddress,
											browserInfo: browserInfo,
											device: isMobile
										},
										success: function(data) {
											
											bar.setValue(1);
											ClosePopup_scc2();
											document.body.removeChild(clone);
											setTimeout(() => {
												removeSendEmailProgress()
												scc_jQuery('body').css({
													overflow: 'visible'
												});
				// restore header and footer's initial display property value
				scc_jQuery('header').each(function () {
					var initialState = jQuery(this).data('scc-headerState');
					scc_jQuery(this).css({display: initialState});
				});
				scc_jQuery('footer').each(function () {
					var initialState = jQuery(this).data('scc-footerState');
					scc_jQuery(this).css({display: initialState});
				});
			}, 1000);
											scc_jQuery('#statusMsg').html('<span class="scc-col-lg-8 scc-col-md-8 scc-col-xs-12" style="font-size:17px;color:#34A853"> Thank you, '+user+'. Your quote has been sent to '+email+'</span>');
										}
									}
									scc_jQuery.ajax( $fragment_refresh )
								})
		.fail(function() {
			$fragment_refresh={
				url: rt_vars.rt_urlajax,
				type: 'POST',
				data: {
					action: 'sccSendEmail',
					payload: Base64.encode(JSON.stringify(jsonPDF)),
					email_to: email,
					user_to: user,
					title: title,
					phone: phone,
					ipaddress: '',
					browserInfo: browserInfo,
					device: isMobile
				},
				success: function(data) {
			//	scc_jQuery('#scc_sending_email_progress_container').css('display', 'none')
			updateSendEmailProgress(100)
			ClosePopup_scc2();
			document.body.removeChild(clone);
			setTimeout(() => {
				removeSendEmailProgress()
				scc_jQuery('body').css({
					overflow: 'visible'
				});
					// restore header and footer's initial display property value
					scc_jQuery('header').each(function () {
						var initialState = jQuery(this).data('scc-headerState');
						scc_jQuery(this).css({display: initialState});
					});
					scc_jQuery('footer').each(function () {
						var initialState = jQuery(this).data('scc-footerState');
						scc_jQuery(this).css({display: initialState});
					});
				}, 1000);
			scc_jQuery('#statusMsg').html('<span class="scc-col-lg-8 scc-col-md-8 scc-col-xs-12" style="font-size:17px;color:#34A853"> Thank you, '+user+'. Your quote has been sent to '+email+'</span>');
		}
	}
	scc_jQuery.ajax( $fragment_refresh )
})
	}	
	
	PrintDoc = function(enable){
		if(enable === 0){
			scc_jQuery('.scc-alert').remove();  
			scc_jQuery('body').find('.scc-detailed-list-head').each(function(index, ob){
				scc_jQuery(ob).html(`<div class='alert alert-info scc-alert' role='alert'><button class='close' type='button' data-dismiss='alert'>×</button>This feature is only for Premium users. Please click  <a href=\"https://stylishcostcalculator.com/\" class='alert-link'>https://stylishcostcalculator.com </a> to purchase.</div>`);
			})
			return;
		}
		
		scc_jQuery('.scc-buttons-visibility').each(function(index, ob){
			scc_jQuery(ob).css('display', 'none')
		})
		
		scc_jQuery('.Section-Title-Summary-Window').each(function(index, ob){
			scc_jQuery(ob).css('margin-left','15px')
		})
		
		scc_jQuery('.comments-printing-improvement').each(function(index, ob){
			scc_jQuery(ob).css('padding-left', 10)
		}) 
		
	//scc_jQuery('#scc-summary-view-header').css('background-color', 'grey')

	var printContents = document.getElementById('scctableprice').innerHTML;
	var originalContents = document.body.innerHTML;
	
	document.body.style.padding = "10px";
	document.body.style.height = "100%";
	document.body.style.width = "100%";
	document.body.innerHTML = printContents;

	
	window.print();
	document.body.innerHTML = originalContents;
	
	scc_jQuery('.Section-Title-Summary-Window').each(function(index, ob){
		scc_jQuery(ob).css('margin-left:5px')
	})
	
	scc_jQuery('.scc-buttons-visibility').each(function(index, ob){
		scc_jQuery(ob).css('display', 'block')
	})
	scc_jQuery('.comments-printing-improvement').each(function(index, ob){
		scc_jQuery(ob).css('padding-left', 0)
	}) 
	
	//scc_jQuery('#scc-summary-view-header').css('background-color', '#F1F1F1') 
	
	
}	
function updateSendEmailProgress(value){
	var elem = document.getElementById("myBar_scc");
	
	elem.innerHTML = value  + "%";		
		//scc_jQuery('#scc_sendemail_progress_value').html(value + '%')
	}
	function removeSendEmailProgress(){
		scc_jQuery('#scc_send_email_progress_modal').modal('hide')
		scc_jQuery('#scc_sending_email_progress_container').html('')
		scc_jQuery('#scc_send_email_progress_modal').modal('hide')
		scc_jQuery('#scc_send_email_progress_modal').modal('hide')
		setTimeout(() => {
			scc_jQuery('#scc_send_email_progress_modal').remove()
			scc_jQuery('.modal-backdrop').each((index, element) => {
				scc_jQuery('#preview_modal').modal('hide')
				element.remove()
				scc_jQuery(element).remove()
				setTimeout(() => {
					scc_jQuery('#scc_send_email_progress_modal').modal('hide')
					scc_jQuery('#scc_send_email_progress_modal').modal('hide')
				}, 1000);
			});
			
		}, 1000);
	}
	
	
	
	
	
	
	
	function createSendEmailModal(){
		var code = ''
		
		code += '<div id="scc_send_email_progress_modal" class="scc-modal-2020 fade" role="dialog" style="z-index:90000; margin-top:320px">'
		code += '	<div class="scc-modal-dialog-2020" style="background:transparent;">'
		code += '		<div class="scc-modal-content-2020-scc" style="">'
		code += '		<div class="scc-modal-body-2020" style="margin-top:20px;">'
		code += '			<center><div id="scc_sendemail_progress_bar" style="z-index:900090;"></div></center>'
		code += '           <div><center><div id="scc_sendemail_progress_value"></div></center></div>'
		code += '           <div><center><div id="scc_sendemail_progress_description"></div></center></div>'
		code += '           <div><div id="myProgress_scc" style="width: 100%;text-align:center;background: transparent"><div id="myBar_scc" style="width: 100%;text-align:center;background: transparent"></div></div><center><div id="scc_sendemail_progress_description"></div></center></div>'
		code += '		</div>'
		code += '		</div>'
		code += '	</div>'
		code += '	</div>'
		
		scc_jQuery('#scc_sending_email_progress_container').html(code)
		scc_jQuery('#scc_send_email_progress_modal').modal('show')
		if( navigator.userAgent.match(/Android/i)
			|| navigator.userAgent.match(/webOS/i)
			|| navigator.userAgent.match(/iPhone/i)
			|| navigator.userAgent.match(/iPad/i)
			|| navigator.userAgent.match(/iPod/i)
			|| navigator.userAgent.match(/BlackBerry/i)
			|| navigator.userAgent.match(/Windows Phone/i)){
			scc_jQuery('#scc_send_email_progress_modal').css('left', 80)
		scc_jQuery('#scc_send_email_progress_modal').css('top', 80)
	}
}
window.rp_requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||(function(callback,element){setTimeout(callback,1000/60);});
function RadialProgress(container,cfg){
	container.innerHTML="";
	var nc=document.createElement("div");
	nc.style.width="10em"; nc.style.height="10em";
	nc.style.position="relative";
	container.appendChild(nc);
	container=nc;
	if(!cfg) cfg={};
	this.colorBg=cfg.colorBg==undefined?"#404040":cfg.colorBg;
	this.colorFg=cfg.colorFg==undefined?"#007FFF":cfg.colorFg;
	this.colorText=cfg.colorText==undefined?"#000000":cfg.colorText;
	this.indeterminate=cfg.indeterminate==undefined?false:cfg.indeterminate;
	this.round=cfg.round==undefined?false:cfg.round;
	this.thick=cfg.thick==undefined?2:cfg.thick;
	this.progress=cfg.progress==undefined?0:cfg.progress;
	this.noAnimations=cfg.noAnimations==undefined?0:cfg.noAnimations;
	this.fixedTextSize=cfg.fixedTextSize==undefined?false:cfg.fixedTextSize;
	this.animationSpeed=cfg.animationSpeed==undefined?1:cfg.animationSpeed>0?cfg.animationSpeed:1;
	this.noPercentage=cfg.noPercentage==undefined?false:cfg.noPercentage;
	this.spin=cfg.spin==undefined?false:cfg.spin;
	if(cfg.noInitAnimation) this.aniP=this.progress; else this.aniP=0;
	var c=document.createElement("canvas");
	c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.width="100%";c.style.height="100%";c.className="rp_canvas";
	container.appendChild(c);
	this.canvas=c;
	var tcc=document.createElement("div");
	tcc.style.position="absolute";tcc.style.display="table";tcc.style.width="100%";tcc.style.height="100%";
	var tc=document.createElement("div");
	tc.style.display="table-cell";tc.style.verticalAlign="middle";
	var t=document.createElement("div");
	t.style.color=this.colorText;t.style.textAlign="center";t.style.overflow="visible";t.style.whiteSpace="nowrap";t.className="rp_text";
	tc.appendChild(t);
	tcc.appendChild(tc);
	container.appendChild(tcc);
	this.text=t;
	this.prevW=0; this.prevH=0; this.prevP=0; this.indetA=0; this.indetB=0.2; this.rot=0;
	this.draw=function(f){
		if(!(f==true))rp_requestAnimationFrame(this.draw);
		var c=this.canvas;
		var dp=window.devicePixelRatio||1;
		c.width=c.clientWidth*dp; c.height=c.clientHeight*dp;
		if(!(f==true)&&!this.spin&&!this.indeterminate&&(Math.abs(this.prevP-this.progress)<1&&this.prevW==c.width&&this.prevH==c.height)) return;
		var centerX=c.width/2, centerY=c.height/2, bw=(c.clientWidth/100.0), radius=c.height/2-(this.thick*bw*dp)/2, bw=(c.clientWidth/100.0);
		this.text.style.fontSize=(this.fixedTextSize?(c.clientWidth*this.fixedTextSize):(c.clientWidth*0.26-this.thick))+"px";
		if(this.noAnimations) this.aniP=this.progress; else{var aniF=Math.pow(0.93,this.animationSpeed);this.aniP=this.aniP*aniF+this.progress*(1-aniF);}
		c=c.getContext("2d");
		c.beginPath();
		c.strokeStyle=this.colorBg;
		c.lineWidth=this.thick*bw*dp;
		c.arc(centerX,centerY,radius,-Math.PI/2, 2*Math.PI);
		c.stroke();
		c.beginPath();
		c.strokeStyle=this.colorFg;
		c.lineWidth=this.thick*bw*dp;
		if(this.round) c.lineCap="round";
		if(this.indeterminate){
			this.indetA=(this.indetA+0.07*this.animationSpeed)%(2*Math.PI);this.indetB=(this.indetB+0.14*this.animationSpeed)%(2*Math.PI);
			c.arc(centerX,centerY,radius,this.indetA, this.indetB);
			if(!this.noPercentage)this.text.innerHTML="";
		}else{
			if(this.spin&&!this.noAnimations)this.rot=(this.rot+0.07*this.animationSpeed)%(2*Math.PI)
				c.arc(centerX,centerY,radius,this.rot-Math.PI/2, this.rot+this.aniP*(2*Math.PI)-Math.PI/2);
			if(!this.noPercentage)this.text.innerHTML=Math.round(100*this.aniP)+" %";
		}
		c.stroke();
		this.prevW=c.width; this.prevH=c.height; this.prevP=this.aniP;
	}.bind(this);
	this.draw();
}
RadialProgress.prototype={
	constructor:RadialProgress,
	setValue:function(p){this.progress=p<0?0:p>1?1:p;},
	setIndeterminate:function(i){this.indeterminate=i;},
	setText:function(t){this.text.innerHTML=t;}
}
</script>
<!-- Modal -->
<div class="scc-modal-2020 fade scc_send_quote_info" id="myModalSCCEmailQuote" role="dialog">
	<div class="scc-modal-dialog-2020">
		<!-- Modal content-->
		<div class="scc-modal-content-2020">
			<div class="scc-modal-header-2020">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="scc-modal-title-2020">Important Notice</h4>
			</div>
			<div class="scc-modal-body-2020">
				<!--<p>This feature is only for Premium users. You can purchase the premium version at <a href='https://stylishcostcalculator.com/' class='alert-link'><strong>https://stylishcostcalculator.com</strong></a></p>-->
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			</div>
		</div>
		
	</div>
</div>