<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>Customer / Vendor</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/my-bootstrap.min.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/bootstrap-responsive.min.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/OpenSans.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/font-awesome.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/style.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/fieldset.css?ver=1305202513052025" rel="stylesheet">
    <link href="../ui/jquery-ui.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/dashboard.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/bootstrap-tagsinput.css?ver=1305202513052025" rel="stylesheet">

    <link href="css/plans.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/multi-select.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link href="css/jquery-te-1.4.0.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link href="css/select2.min.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link href="css/footable.bootstrap.min.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link href="js/dropzone/dropzone.min.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link href="css/fancybox.css?ver=1305202513052025" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="js/editorjs/editorjs-inline-font-size-tool.css?ver=1305202513052025">

    <link rel="stylesheet" href="css/jquery-ui.css?ver=1305202513052025">
        <link href="css/custom.css?ver=1305202513052025" rel="stylesheet">
    <link href="css/animate.min.css?ver=1305202513052025" rel="stylesheet" />
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

        <script>
        var user_salt = '2fa60e7d044664bb0b8f';
        var start_of_finantial_year = 2025;
        var end_of_finantial_year = 2026;
        var barcode_scanner_length = '6';
        var ship_email_lable = 'Email';
    </script>
    <script src="js/jquery-1.12.4.min.js?ver=1305202513052025"></script>
    <script src="js/jquery-migrate-1.4.1.min.js?ver=1305202513052025"></script>
    <script src="js/general.js?ver=1305202513052025"></script>
    <script src="js/exchangerate.js?ver=1305202513052025"></script>
    <script src="js/jquery.validate.js?ver=1305202513052025"></script>
    <script src="js/JsBarcode.js?ver=1305202513052025"></script>
    <script src="js/bootstrap.js?ver=1305202513052025"></script>
    <script src="js/bootstrap-tagsinput.js?ver=1305202513052025"></script>
    <script src="js/typeahead.js?ver=1305202513052025"></script>
    <script src="../ui/jquery-ui-new.js?ver=1305202513052025"></script>
    <script src="js/uiExtention.js?ver=1305202513052025"></script>
    <script src="js/jquery.multi-select.js?ver=1305202513052025"></script>
    <script src="js/grabzit.min.js?ver=1305202513052025"></script>
    <script src="js/jquery-te-1.4.0.min.js?ver=1305202513052025"></script>
    <script src="js/jquery.fileDownload.js?ver=1305202513052025"></script>
    <script src="js/jquery.table2excel.js?ver=1305202513052025"></script>
    <script src="js/tableToExcel.js?ver=1305202513052025"></script>
    <script src="js/select2.full.min.js?ver=1305202513052025"></script>
    <script src="js/jquery.popupoverlay.js?ver=1305202513052025"></script>
    <script src="js/footable.js?ver=1305202513052025"></script>
    <script src="js/drawer.min.js?ver=1305202513052025"></script>
    <script src="js/tipped.min.js?ver=1305202513052025"></script>
    <script src="js/sweetalert2.js?ver=1305202513052025"></script>
    <script src="js/dropzone/dropzone.min.js?ver=1305202513052025"></script>
    <script src="js/fancybox.js?ver=1305202513052025"></script>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script src="js/jquery.cookie.min.js?ver=1305202513052025"></script>
    <link rel="stylesheet" href="js/daterangepicker/daterangepicker.css??ver=1305202513052025">
    <script src="js/daterangepicker/moment.min.js?ver=1305202513052025"></script>
    <script src="js/daterangepicker/daterangepicker.js?ver=1305202513052025"></script>
    <script src="js/stickynotes.js?ver=1305202513052025"></script>
    <script src="js/algebra.min.js?ver=1305202513052025"></script>
    <script src="js/math.min.js?ver=1305202513052025"></script>


    <script src="js/pdf.min.js?ver=1305202513052025"></script>
        <script>
        var Org_GSTIN_No = "";
                var session_start = 2025;
        var session_end = 2026;
        var shortcutBtn = false;
                    var shortcutBtn = true;
            shortkeys_fun();
        
        var gst_rates_options_igst = "<option value='0' >0</option><option value='0.1' >0.1</option><option value='0.25' >0.25</option><option value='0.5' >0.5</option><option value='1' >1</option><option value='1.5' >1.5</option><option value='3' >3</option><option value='5' >5</option><option value='6' >6</option><option value='7.5' >7.5</option><option value='12' >12</option><option value='18' >18</option><option value='28' >28</option>";
        var gst_rates_options_cgst = "<option value='0' >0 + 0</option><option value='0.05' >0.05 + 0.05</option><option value='0.125' >0.125 + 0.125</option><option value='0.25' >0.25 + 0.25</option><option value='0.5' >0.5 + 0.5</option><option value='0.75' >0.75 + 0.75</option><option value='1.5' >1.5 + 1.5</option><option value='2.5' >2.5 + 2.5</option><option value='3' >3 + 3</option><option value='3.75' >3.75 + 3.75</option><option value='6' >6 + 6</option><option value='9' >9 + 9</option><option value='14' >14 + 14</option>";
        var go_date_long = "dd-M-yy";
        var go_date_short = "dd-M-y";
        var go_date_month_year = "M yy";
        var go_date_month_years = "M-yy";
        var dateRangePicker_format = "DD-MMM-YYYY";
    </script>
    <script>
        var Toast = Swal.mixin({
            toast: true,
            position: 'top-end',
            showConfirmButton: false,
            timer: 3000,
            showClass: {
                popup: 'animate__animated animate__slideInRight'
            },
            hideClass: {
                popup: 'animate__animated animate__slideOutRight'
            },
            timerProgressBar: true,
        });
    </script>

</head>
<style>
    </style>

<body class="drawer drawer--left list_company member-free">
<!--<div style="background: #F1A104;color: #fff;padding: 5px 0;text-align: center;font-size: 16px;">Website will be down from 01:45 AM to 02:30 AM for Schedule Maintenance.</div>
<div style="background: #F1A104;color: #fff;padding: 5px 0;text-align: center;font-size: 16px;">Due to Coronavirus (COVID-19) our phone support is offline for some time please create <a href="https://gogstbill.com/gogstbill-software-support/" style="color: #fff;text-decoration: underline;">Support Request</a> or send us email at <a href="mailto:<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>" style="text-decoration: underline;color: #fff;"><PRESIDIO_ANONYMIZED_EMAIL_ADDRESS></a> Thank you.</div>-->
    <noscript>
    <style type="text/css">
        .noscript {
    position: fixed;
    height: 100%;
    width: 100%;
    display: table;
    background: 
    rgba(255,255,255,0.9);
    z-index: 1000000;
    text-align: center;
}
.noscriptmsg {
    display: table-cell;
    height: 100%;
    width: 100%;
    vertical-align: middle;
	font-size: 26px;
	font-weight: bold;
}
.noscriptmsg h1 {
    font-size: 35px;
    line-height: 1.4;
    margin-bottom: 20px;
	color: #ED541D;
}
.noscriptmsg p {
    font-size: 20px;
    line-height: 1.4;
}
    </style>
    <div class="noscript">
		<div class="noscriptmsg">
			<h1>JavaScript is disabled</h1><p>Your browser JavaScript seems to be disabled.<br> Please enable JavaScript to start using site features.</p>
		</div>
    </div>
</noscript>    	<style>
	#rCMODluVEmXa {
		display: none;
		padding: 10px 10px;
		background: #FEF5F1;
		text-align: center;
		font-weight: bold;
		color: #000;
		border-radius: 5px;
		font-size: 26px;
		font-weight: bold;
	}
	#rCMODluVEmXa h1 {
		font-size: 24px;
		line-height: 1.4;
		margin-bottom: 10px;
		color: #ED541D;
	}
	#rCMODluVEmXa p {
		font-size: 16px;
		line-height: 1.4;
	}
	</style>
	
	<div id="rCMODluVEmXa">
	<h1>You're using an Ad Blocker</h1><p>To continue using Go GST Bill, You can either disable your ad blocker or join Premium Membership.</p>
	</div>
	<script src="js/ads.js" type="text/javascript"></script>
	<script type="text/javascript">
	var coockieval = null;
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf("gogstaccount=") == 0) coockieval= c.substring('gogstaccount='.length,c.length);
	}
	
	if(document.getElementById('jnrqZHKCRbhE')){
		if(coockieval != null)
		{
			document.cookie = 'gogstaccount=; Max-Age=-99999999;';  
		}
	} else {
		document.getElementById('rCMODluVEmXa').style.display='block';
		if(coockieval == null)
		{
			var expires = "";
			var date = new Date();
			date.setTime(date.getTime() + (1*24*60*60*1000));
			expires = "; expires=" + date.toUTCString();
			document.cookie = "gogstaccount=161818" + expires + "; path=/";
		}
	}
	</script>

    <header role="banner">
        <button type="button" class="drawer-toggle drawer-hamburger">
            <span class="sr-only">toggle navigation</span>
            <span class="drawer-hamburger-icon"></span>
        </button>

        <nav class="drawer-nav" role="navigation">
            <div class="mobile-nav-logo"><img src="img/inverted.png?update" alt="Smart GST Billing Software" title="Smart GST Billing Software"></div>
	<ul class="drawer-menu">
				<li  >
					<a href="home.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#dashboard-svg-icon"></use></svg>
						</span>
					<span>Dashboard</span><span class="shortcut_key_ctrl">d</span></a>
				</li>				
								<li class="active">
					<a href="list-company.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#customer-svg-icon"></use></svg></span>
					<span>Customer / Vendor</span><span class="shortcut_key_ctrl">o</span></a>	    				
				</li>
												<li class="drawer-dropdown 
					 
					 
					" >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#product-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Products / Services</span></a>	   
					<ul class="drawer-dropdown-menu">
                        <li><a href="list-product.php">Products / Services<span class="shortcut_key_ctrl">r</span></a></li>
                        <li><a href="list-category.php">Product Group</a></li>
                        <li class="menu_sep_hr"><a><hr></a></li>
						<li><a href="manage-stock.php">Stock</a></li>
                    </ul>   					
				</li>
												<li 									>
					<a href="invoicedetail.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#saleinvoice-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Sale Invoice</span><span class="shortcut_key">s</span></a>	    				
				</li>
												<li  
					   >
					<a href="purchaseinvoicedetail.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#purchase-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Purchase Invoice</span><span class="shortcut_key">p</span></a>	    				
				</li>
												<li class="drawer-dropdown 
					 "    >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#payment-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Payment</span></a>	   
					<ul class="drawer-dropdown-menu">
                        <li><a href="list-paymentreceipt.php?type=inward">Inward Payment (Sales Inv.)<span class="shortcut_key">i</span></a></li>
						<li><a href="list-paymentreceipt.php?type=outward">Outward Payment (Purchase Inv.)<span class="shortcut_key">o</span></a></li>
                    </ul>   					
				</li>
												<li class="drawer-dropdown  locked 
																				"
				>
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#expense-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Expense <br> Income</span></a>	   
					<ul class="drawer-dropdown-menu">
                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Daily Expenses<span class="shortcut_key">d</span></a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">Other Income<span class="shortcut_key">t</span></a></li>	                    </ul>   					
				</li>
								<li class="drawer-dropdown  locked  
																																																																																"
				>
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#otheredoc-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Other Documents</span></a>	   
					<ul class="drawer-dropdown-menu">
                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Quotation<span class="shortcut_key">q</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Proforma<span class="shortcut_key">r</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Delivery Challan<span class="shortcut_key">e</span></a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Order<span class="shortcut_key">u</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sale Order<span class="shortcut_key">i</span></a></li>                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Job Work<span class="shortcut_key">j</span></a></li>                        <li><a data-toggle="modal" data-target="#trialModal_gst">Letters</a></li>																			<li class="menu_sep_hr"><a><hr></a></li>
												<li><a  data-toggle="modal" data-target="#trialModal_gst">Credit Note<span class="shortcut_key">c</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Debit Note<span class="shortcut_key">b</span></a></li>						<li class="menu_sep_hr"><a><hr></a></li>			
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Multi Currency Invoice<span class="shortcut_key">m</span></a></li>						
                    </ul>   					
				</li>
												
												<li class="locked drawer-dropdownlast-header-option"   >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#report-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Report</span></a>	   
					<ul class="drawer-dropdown-menu">
						<li class="menu_heading">Sales Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales</a></li>	
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales Product Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Inward Payment</a></li>
						<li class="menu_heading">Purchase Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Product Report</a></li>						
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Outward Payment</a></li>
						<li class="menu_heading">Other Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Company Ledger</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Company Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Profit & Loss Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Stock Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Product Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Daily Expenses</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Other Income</a></li>
						<li class="menu_heading">GST Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-1</a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-2B</a></li>  						<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-3B</a></li>  						
                    </ul>   					
				</li>
												<li class="settings_menu_mobile drawer-dropdown 
																																																																											" >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#settings-svg-icon"></use>
                                    </svg></span>
					<span style="line-height: 100%;">Settings</span></a>	   
					<ul class="drawer-dropdown-menu">
						<li><a href="list-setting.php">Membership</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Credits</a></li>						<li><a href="edit-userdetail.php">Login & Security</a></li>						<li><a href="edit-eway.php">E-way Bill & E-Invoice</a></li>						<a href="settings-whatsapp.php">WhatsApp Options</a></li>
						<li><a href="edit-organisationdetail.php">Business Profile</a></li>						
						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Staff Account</a></li>                        <li ><a href="file-log.php">Go Drive</a></li>                        <li class=' locked'><a href="settings-digital-signature.php">Digital Sign</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Export Data</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Activity Log</a></li>						<li><a href="smtp-email-settings.php">Email Options</a></li>                        <li class="menu_sep_hr"><a><hr></a></li>
						<li class=" " ><a href="settings-general-option.php"> General Options</a></li>						<li class=" " ><a href="settings-product-option.php"> Product & Stock  Options</a></li>						<li class=" " ><a href="settings-printtemplate-option.php"> Print Template</a></li>						<li class=" " ><a href="settings-print-option.php"> Print Options</a></li>						<li class=" " ><a href="settings-bank-detail.php"> Bank Details</a></li>						<li class=" " ><a href="settings-document-option.php"> Document Options</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst"> Shipping & Envelope Options</a></li>
						<li class=" " ><a href="settings-termscondition-option.php"> Terms and Condition</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Translation Options</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Email & Whatsapp Templates</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Payment Reminder</a></li>						<li class="locked hide_unser_tab"><a   data-toggle="modal" data-target="#trialModal_gst">Design Custom Header</a></li>
						<li class="menu_sep_hr"><a><hr></a></li>
																		
                    </ul>   					
				</li>
				
								<li class="notification_menu_mobile ">
					<a href="list-notifications.php" class="mobile-notification"><span class="fa-icon-svg"><svg width="24" height="24" style="filter: brightness(13%);">
                                        <use href="svg-icon/icons.svg#notification-svg-icon"></use>
                                    </svg></span>
					<span style="line-height: 100%;">Notification</span>
													<div class="indicator">
								<div class="circle"><span>3</span></div>
							</div>
											</a>	    				
				</li>
								
			
<li class="referafrnd mobile-nav-show list-sec " >
	<a href="refer-a-friend.php"><span class="fa-icon-svg"> <svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#refere-svg-icon"></use>
                                    </svg></span><span style="line-height: 100%;"> Refer a friend</span></a>
</li>
<li class="mobile-nav-show mobile-nav-logout">
	<div class="session-and-logout">
		<div class="session-box">
			<form method="post" action="" name="myFormSession">
				<div class="dropdown bill-session-new-tab">
				<a data-toggle="dropdown" href="#" class="btn dropdown-toggle" style="padding-top: 10px;padding-bottom: 10px;">F.Y. 2025-2026</a>
					<ul class="dropdown-menu pull-right">
													<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2017_2018"  >F.Y. 2017-2018</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2018_2019"  >F.Y. 2018-2019</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2019_2020"  >F.Y. 2019-2020</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2020_2021"  >F.Y. 2020-2021</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2021_2022"  >F.Y. 2021-2022</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2022_2023"  >F.Y. 2022-2023</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2023_2024"  >F.Y. 2023-2024</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2024_2025"  >F.Y. 2024-2025</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2025_2026" class="active" >F.Y. 2025-2026</a></li>
																
										</ul>
				</div>
			</form>
		</div>
	</div>
</li>

<hr class="mobile-nav-show hrcl">
<h5 class="mobile-nav-show quicksupporttxt">Quick Support</h5>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			<svg width="24" height="24" style="scale: 1.1;">
	            <use href="svg-icon/icons.svg#whatsapp-svg-icon"></use>
	        </svg>
		</div>
		<div class="contact-info-section-content">
			<a href="https://api.whatsapp.com/send/?phone=<PRESIDIO_ANONYMIZED_PHONE_NUMBER>&amp;text=Hi, I need help " target="__blank">+91 7043146478</a>
			<p>10 AM to 7 PM - Everyday</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			 <svg width="24" height="24">
                <use href="svg-icon/icons.svg#message-svg-icon"></use>
            </svg>
		</div>
		<div class="contact-info-section-content">
			<a href="/cdn-cgi/l/email-protection#6d0508011d2d0a020a1e190f040101430e0200"><span class="__cf_email__" data-cfemail="355d50594575525a524641575c59591b565a58">[email&#160;protected]</span></a>
			<p>We usually reply within 1 working day</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			<svg width="24" height="24">
                <use href="svg-icon/icons.svg#books-svg-icon"></use>
            </svg>
		</div>
		<div class="contact-info-section-content">

		<a class="ViewKnowledgeModal" data-baseLink="knowledge-base.php">Knowledge Base</a>
			<!-- <a href="https://gogstbill.com/knowledge-base/" target="_blank">Knowledge Base</a> -->
			<p>100+ Questions answered with Screenshots</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="seprator"></div>
	<div class="generate-pin-box">
		<a class="generate-support-pin">Generate Support PIN</a>
	</div>
	</li>
<li  class="mobile-nav-show mobile-nav-logout ">
<a class="switchacc-btn" href="businesses.php?switch=1"><svg width="24" height="24"><use href="svg-icon/icons.svg#switch-user-svg-icon"></use></svg>Switch account</a>
</li>
<li  class="mobile-nav-show mobile-nav-logout ">
	<a class="logout-btn"  href="logout.php"><svg width="24" height="24"><use href="svg-icon/icons.svg#logout-svg-icon"></use></svg>Logout</a>
</li>
</ul>
        </nav>
    </header>
    <main role="main">
        <div class="preloader-overly">
            <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
                xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="80px" height="80px"
                viewBox="0 0 128 128" xml:space="preserve">
                <g>
                    <path fill="#00ba8c" fill-opacity="1"
                        d="M109.25 55.5h-36l12-12a29.54 29.54 0 0 0-49.53 12H18.75A46.04 46.04 0 0 1 96.9 31.84l12.35-12.34v36zm-90.5 17h36l-12 12a29.54 29.54 0 0 0 49.53-12h16.97A46.04 46.04 0 0 1 31.1 96.16L18.74 108.5v-36z" />
                    <animateTransform attributeName="transform" type="rotate" from="0 64 64" to="360 64 64" dur="880ms"
                        repeatCount="indefinite"></animateTransform>
                </g>
            </svg>
        </div>
        <div class="draft-preloader-overly">
            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
                style="margin: auto; background: none; display: block; shape-rendering: auto;" width="40px"
                height="40px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
                <g transform="rotate(0 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(30 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(60 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s"
                            repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(90 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(120 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(150 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s"
                            repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(180 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(210 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(240 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s"
                            repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(270 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(300 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s"
                            begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
                    </rect>
                </g>
                <g transform="rotate(330 50 50)">
                    <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#ffffff">
                        <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s"
                            repeatCount="indefinite"></animate>
                    </rect>
                </g>
            </svg>
            Auto saving to draft
        </div>
        <div id="trialModal_gst" class="modal payment_modal_box modal-lg fade enter_gst_popup" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="btn btn-default btn_close" data-dismiss="modal" ><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
				<h4 class="modal-title">Start Your Trial</h4>
			</div>
			<div class="modal-body">				
				<form method="post" id="">
					<div class="plan-actions">
												<div class="call2action-trial" style="margin-bottom: 10px;">
							<div class="row">
								<div class="span12">
									<center>
										<a href="list-setting.php?action=start-trial" >
											
											<img  src="images/free-trial-phone.png" alt="Start free trial" />
										</a>
									</center>
								</div>
							</div>
						</div>
											</div> <!-- /plan-actions -->
				</form>				
			</div>
		</div>
	</div>
</div>
<style>
div#trialModal_gst {
    width: 630px;
    max-width: 100%;
    margin: -330px 0 0 -310px;
}

@media screen and (max-width: 1024px) {
	div#trialModal_gst {
		margin: -200px 0 0 -384px;
	}
}

@media screen and (max-width: 767px) {
	div#trialModal_gst {
		margin: 70px 0 0 -207px;
	}
}
</style>        <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script src="js/razorpay.js?ver=1305202513052025"></script>
<div id="addRemoveModal" class="modal payment_modal_box modal-lg fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<a type="button" style="float: right;" class="btn btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></a>
				<!-- <button type="button" class="close" data-dismiss="modal" >&times;</button> -->
				<h4 class="modal-title">Upgrade Now</h4>
			</div>
			<div class="modal-body">
				
			<div class="info-more-items" style="display:none;"></div>
			<div class="premium-plan">
				<div class="premium-membership-plans">
	<div class="premium-membership-plans-switcher">
		<p class="fieldset">
			<input type="radio" class="cd-switchmodal" name="membership-type" value="1year" id="1-year-cbmodal" checked data-price="1499" data-product-id="1">
			<label for="1-year-cbmodal">1 Year</label>
			<input type="radio" class="cd-switchmodal" name="membership-type" value="3year" id="3-year-cbmodal" data-price="3499" data-product-id="2">
			<label for="3-year-cbmodal">3 Year <span class="save-amount">SAVE RS. 998</span></label>
			<span class="cd-switch"></span>
		</p>
	</div>
</div>
	<h1 class="plan-amount-textmodal">RS. <span class="price">1499</span></h1>
		<div class="plan-gstrate price-additional">+ 18% GST</div>
	<form method="post">
		<input type="hidden" name="btnpay" />
		<input type="hidden" name="userID" value="161818" />
		<input type="hidden" name="name" value="Anand Kumar K S" />
		<input type="hidden" name="phone" value="8123030275" />
		<input type="hidden" name="email" value="" />
		<input type="hidden" name="amount" id="plan-amountmodal" value="1499" />			
		<input type="hidden" name="product_id" id="plan-product_idmodal" value="1" />		
		<button type="submit" class="btn membership-btn upgradeNow" >Upgrade Now</button>
	</form>	
	<script>
		$(document).ready(function(){
			$('.cd-switchmodal').change(function() {
				$('.plan-amount-textmodal').find('.price').text($(this).attr('data-price'));
				$('#plan-amountmodal').val($(this).attr('data-price'));
				$('#plan-product_idmodal').val($(this).attr('data-product-id'));
			});
		});
	</script>
			</div>	
				<div class="terms-container" style="text-align: center;"><i class="fa fa-info-circle"></i>&nbsp;&nbsp;By clicking upgrade, you are agreeing to the <span style="white-space: nowrap;"><a href="https://gogstbill.com/terms/" target="_blank">Terms</a> and <a href="https://gogstbill.com/privacy/" target="_blank">Privacy Policy</a>.</span></div>
			</div>
		</div>
	</div>
</div>
<style>
.info-more-items {
	text-align: center;
}
.info-more-items span.upto {
    color: #888;
    font-size: 12px;
}
.info-more-items div {
    font-size: 20px;
    font-weight: bold;
}
.plan-heading {
    padding: 0px 26px 10px 26px;
}
.plan-features.remove-line {
    border: 0px;
	padding-bottom: 17px;
}
.plan-features-list li {
    text-align: left;
}
.plan-features-list li i {
    padding-right: 10px;
}
.pricing-plans.plans-2 {
    display: inline-block;
    width: 100%;
}
.pricing-plans-box {
    background: #f5f5f5;
    padding: 20px 30px 20px;
    border-radius: 4px;
	display: table;
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 30px;
	position: relative;
}
.pricing-plans-box .plans-box-inner {
    display: table-cell;
	vertical-align: middle;
}
.pricing-plans-box .btn {
    text-transform: uppercase;
    background: #eba01e;
	border-color: #eba01e;
	color: #fff;
    padding: 1em 0;
    font-size: 16px;
    font-weight: bold;
    min-width: 250px;
}
.pricing-plans-box .plans-box-inner .control-group {
    margin-bottom: 0;
    margin-top: 5px;
}
.pricing-plans-box .plans-box-inner form {
    margin: 0;
}
.promocode-lbl {
    font-size: 12px;
    font-weight: bold;
	margin: 0;
}
.plan-actions .control-group {
    margin-bottom: 0;
    margin-top: 14px;
	padding: 0 20px;
}
.offer-label {
    position: absolute;
    top: 0;
    left: 0;
    background: red;
	color: #fff;
    font-size: 12px;
    padding: 0px 10px;
    line-height: 19px;
	margin-left: -15px;
	margin-top: 7px;
}
.offer-label::before {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0px 0px 15px;
    border-color: red transparent transparent
    transparent;
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
}
.pricing-plans .terms-container {
    display: inline-block;
    width: 100%;
}
.modal-responsive.modal-lg.modal {
    margin: -250px 0 0 -360px;
}

@media screen and (max-width: 767px) {
	.mobile-hide {
		display: none;
	}
	.modal-responsive {
		max-width: 530px;
		margin: -265px 0px 0px -265px !important;
		max-height: 530px;
	}
	.modal-responsive .modal-body {
		max-height: 100% !important;
	}
	.pricing-plans-box .plans-box-inner {
		display: block;
		padding: 10px 0px 0px;
		text-align: center;
	}
	.pricing-plans .plan {
		margin-right: 0px;
	}
}
@media screen and (max-width: 530px) {
	.mobile-hide {
		display: none;
	}
	.modal-responsive {
		max-width: 480px;
		margin: -240px 0px 0px -240px !important;
		max-height: 480px;
	}
}
@media screen and (max-width: 480px) {
	.modal-responsive {
		max-width: 320px;
		margin: -160px 0px 0 -160px !important;
		position: fixed !important;
		left: 50% !important;
		top: 50% !important;
		max-height: 320px;
	}
	.modal-responsive .modal-header .close {
		padding: 0px 5px;
		margin: -3px 0px 0px !important;
	}
	.modal-responsive .modal-body {
		padding: 20px;
	}
	.pricing-plans-box .btn {
		min-width: 210px;
	}
	.pricing-plans-box {
		padding: 10px 20px 20px;
	}
}
input.not_valid_gst:focus {
    border-color: #e9322d;
    -webkit-box-shadow: 0 0 6px #f8b9b7;
    -moz-box-shadow: 0 0 6px #f8b9b7;
    box-shadow: 0 0 6px #f8b9b7;
}
span.error_msg {
    color: red;
    font-style: italic;
}
input.not_valid_gst + .error_msg {
    display: block !important;
    margin-top: -5px;
    margin-bottom: 5px;
}
.modal-lg.modal.enter_gst_popup {
    width: 450px;
    margin: -160px 0 0 -220px;
}
.enter_gst_popup .plan-actions {
    padding: 1.15em 0;
    background: unset;
    background-color: unset;
    border: unset;
    display: grid;
}
.enter_gst_popup input[type="text"] {
    width: 100%;
    margin-top: 8px;
}

.enter_gst_popup .plan-actions .btn {
    padding:2px 11px;
    margin: unset;
    display: unset;
    font-size: unset;
    font-weight: unset;
}
.enter_gst_popup input#with_gst_num {
    float: right;
}
.enter_gst_popup form {
    margin-bottom: 0;
}
.enter_gst_popup .modal-body {
    padding: 10px 30px 10px;
}
</style>
<script>
$(function(){
	$(".promocode-lbl").click(function(){
		$(this).parents(".control-group").find(".promocode-box").show();
	});
	$(".btnApply").click(function(e){
		e.preventDefault();
		var clickedele = $(this);
		var promocode = $(this).parents(".control-group").find(".promocode").val();
		if(promocode == ""){
			$(this).parents(".control-group").find(".result").html('<span style="color:red;">Error! Please Enter Promocode.</span>');
		}else{
			var data = {
				action: 'checkpromocode',
				promocode: promocode
			}
			$.ajax({  
				type: "POST",  
				url: "ajaxcall.php",
				ContentType : 'application/json',
				dataType: 'json',
				data: data,
				success: function(data){     
					if (data.status == 'APPLY')
					{ 
						clickedele.parents(".control-group").find(".promocode-box").hide();
						clickedele.parents(".control-group").find(".promocode-lbl").hide();
						clickedele.parents(".control-group").find(".result").html('<span style="color:green;">'+data.msg+'</span>');
						clickedele.parents(".control-group").find('.hidden_discount').val(data.value);
					} 
					else if (data.status == 'UNAPPLY')
					{ 
						clickedele.parents(".control-group").find(".result").html('<span style="color:red;">'+data.msg+'</span>');
						clickedele.parents(".control-group").find('.hidden_discount').val(data.value);
					} 
					else{
						clickedele.parents(".control-group").find(".result").html('<span style="color:red;">Error! Please try again.</span>');
					}
				},
				complete: function(data){
				}
			});
		}
	});
});

	

$(document).ready(function () {

    $('#enter_gst_pop  #with_gst_num').on('click', function() {		
		var gst_num = $('#enter_gst_pop input[name=gst_num]').val();	
		if(gst_num.length == 15) {						
			$('#enter_gst_pop input[name=gst_num]').removeClass('not_valid_gst');
			$('#enter_gst_pop input[name=gst_num]').val();
			return true;
		}else{
			$('#enter_gst_pop input[name=gst_num]').addClass('not_valid_gst');
			$('#enter_gst_pop input[name=gst_num]').focus();
			return false;	
		}
	});

	$('#enter_gst_pop_3yr #with_gst_num').on('click', function() {		
		var gst_num = $('#enter_gst_pop_3yr input[name=gst_num]').val();	
		if(gst_num.length == 15) {						
			$('#enter_gst_pop_3yr input[name=gst_num]').removeClass('not_valid_gst');
			$('#enter_gst_pop_3yr input[name=gst_num]').val();
			return true;
		}else{
			$('#enter_gst_pop_3yr input[name=gst_num]').addClass('not_valid_gst');
			$('#enter_gst_pop_3yr input[name=gst_num]').focus();
			return false;	
		}
	});

	$("[name='btnpay']").on('click', function() {		
		var targetmodal = $(this).data('target');
		var discount = $(this).parent().find('.hidden_discount').val();
		$(targetmodal).find('.hidden_discount').val(discount);
	});
	$("a[data-target='#addRemoveModal']").on('click', function() {		
		$("#addRemoveModal .info-more-items").hide();
	});

});

function alertAddMaxItems(document_item_allowed,action='add'){
	var member_type = 'free';
	if(member_type === "premium"){
		if (action == 'edit') {
            var html = `<div>You can add Max ${document_item_allowed} items in Single document.</div>`;
        } else {
            var html = `<div>You can add Max ${document_item_allowed} items in Single document.</div>`;
        }
        Swal.fire({ title: 'Maximum Limit Reached', html: html, icon: 'warning', confirmButtonText: 'Ok', focusConfirm: false });
	}else{
		if(action == 'edit'){
			var html = `<div>To edit this invoice </div>
					<div>please upgrade your membership !</div>
					<span class="upto">(The free plan allows editing invoices with a maximum of ${document_item_allowed} items)</span>`;
		}else{
			var html = `<div>To add more items </div>
					<div>please upgrade your membership !</div>
					<span class="upto">(On Premium membership, you can add up to ${document_item_allowed} items)</span>`;
		}
		$('#addRemoveModal .info-more-items').html(html).show();
		$('#addRemoveModal').modal('show');
	}
	
}

</script>
                <!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WKL66NX');</script>
<!-- End Google Tag Manager -->        
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <a class="brand texttitle" href="home.php">
                        A1 Tax Assist                    </a>

                    <div class="nav-collapse session-and-logout">

                        <ul class="nav pull-right">
                            <li>
                                <div class="session-box">
                                    <form method="post" action="" name="myFormSession">
                                        <div class="dropdown bill-session-new-tab">
                                            <a data-toggle="dropdown" href="#" class="btn dropdown-toggle" style="justify-content: space-between;">F.Y.
                                                2025-2026                                                <svg width="20" height="20" style="scale: 0.8;"><use href="svg-icon/icons.svg#caret-down-svg-icon"></use></svg>
                                            </a>
                                            <ul class="dropdown-menu pull-right">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2017_2018" >F.Y.
                                                            2017-2018</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2018_2019" >F.Y.
                                                            2018-2019</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2019_2020" >F.Y.
                                                            2019-2020</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2020_2021" >F.Y.
                                                            2020-2021</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2021_2022" >F.Y.
                                                            2021-2022</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2022_2023" >F.Y.
                                                            2022-2023</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2023_2024" >F.Y.
                                                            2023-2024</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2024_2025" >F.Y.
                                                            2024-2025</a>
                                                    </li>
                                                    <hr class="hrcl">
                                                                                                    <li style="text-align: left;" class="list-sec"><a href="#"
                                                            data-session="_2025_2026" class="active">F.Y.
                                                            2025-2026</a>
                                                    </li>
                                                    
                                                                                            </ul>
                                        </div>
                                    </form>
                                </div>
                            </li>
                            <li>
                                <div>
                                    <a href="#ShortCutKeyModal" data-toggle="modal" class="viewShortKey pull-right">
                                        <svg width="24" height="24">
                                            <use href="svg-icon/icons.svg#keyboard-svg-icon"></use>
                                        </svg>
                                    </a>
                                </div>
                            </li>
                                                            <li>
                                    <div class=" dropdown notification-dropdown"
                                        style="float: right;padding:0;margin-left: 15px;">
                                        <a class=" viewNotifications pull-right  dropdown-toggle dropdown"
                                            data-toggle="dropdown">
                                            <svg width="24" height="24">
                                                <use href="svg-icon/icons.svg#notification-svg-icon"></use>
                                            </svg>
                                                                                            <div class="indicator">
                                                    <div class="circle"><span>3</span></div>
                                                </div>
                                                                                    </a>
                                        <div class="dropdown-menu">
                                            <div class="dropdown-list">
                                                                                                        <div
                                                            class="dropdown-item   version_update">
                                                            <div class="icon">
                                                                <img src="assets/svgs/version_update.svg" alt="SVG Icon"
                                                                    class="svg-icon">
                                                            </div>
                                                            <div class="notification-content">
                                                                <p class="notification-title">New Update Available!</p>
                                                                <p class="notification-time">27-Feb-25 06:10 AM</p>
                                                                <p class="notification-msg">New UI and improvements have been released. Check out the full details in the <a target="_blank" href="https://bill.gogstbill.com/gst/change-log.php">Change Log</a>.</p>
                                                                <div class="notification-action-btn action-btn">
                                                                    </div>
                                                            </div>
                                                        </div>
                                                                                                            <div
                                                            class="dropdown-item   version_update">
                                                            <div class="icon">
                                                                <img src="assets/svgs/version_update.svg" alt="SVG Icon"
                                                                    class="svg-icon">
                                                            </div>
                                                            <div class="notification-content">
                                                                <p class="notification-title">New Update Available!</p>
                                                                <p class="notification-time">18-Feb-25 06:17 AM</p>
                                                                <p class="notification-msg">New features and improvements have been released. Check out the full details in the <a target="_blank" href="https://bill.gogstbill.com/gst/change-log.php">Change Log</a>.</p>
                                                                <div class="notification-action-btn action-btn">
                                                                    </div>
                                                            </div>
                                                        </div>
                                                                                                            <div
                                                            class="dropdown-item unread  user_trail">
                                                            <div class="icon">
                                                                <img src="assets/svgs/user_trail.svg" alt="SVG Icon"
                                                                    class="svg-icon">
                                                            </div>
                                                            <div class="notification-content">
                                                                <p class="notification-title">Start Your 30-Day Free Trial</p>
                                                                <p class="notification-time">13-Dec-24 07:31 PM</p>
                                                                <p class="notification-msg">Explore all the features of Go GST Bill with a 30-day free trial. No payment required.</p>
                                                                <div class="notification-action-btn action-btn">
                                                                    <a href="list-setting.php?action=start-trial" class="btn btn-primary notification-start-trial" >Start Trial</a></div>
                                                            </div>
                                                        </div>
                                                                                                </div>
                                            <input type="hidden" name="last_notification_time" id="last_notification_time"
                                                value="2025-02-27 06:10:56">
                                            <div class="dropdown-footer">
                                                <a href="list-notifications.php" class="view-all-notification">View all</a>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                                                        <li class="dropdown menu_account tmp">
                                <a href="#MenuSideBarModal" data-toggle="modal" class="pull-right">
                                    <svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#user-svg-icon"></use>
                                    </svg>
                                </a>
                            </li>
                        </ul>
                        <div class="dropdown create-new-tab" style="float: right;">
                            <a data-toggle="dropdown" href="#" class="btn dropdown-toggle"
                                style="display:flex;align-items: center;justify-content: space-between;">
                                <div class="d-flex">
                                    <svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#plus-icon-svg-icon"></use>
                                    </svg><span style="margin-left:5px;"> Create </span>
                                </div>
                                <svg width="20" height="20" style="scale: 0.8;"><use href="svg-icon/icons.svg#caret-down-svg-icon"></use></svg>
                            </a>
                            <ul class="dropdown-menu pull-right">
                                <li style="text-align: left;" class="list-sec"><a href="invoicebill.php">Sale
                                        Invoice</a></li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a
                                        href="purchaseinvoicebill.php">Purchase Invoice </a></li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="quotationbill.php">Quotation</a>
                                </li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="challanbill.php">Delivery
                                        Challan</a></li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="proformabill.php">Proforma</a>
                                </li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="purchaseorderbill.php">Purchase
                                        Order</a></li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="saleorderbill.php">Sale
                                        Order</a></li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="jobworkbill.php">Job Work</a>
                                </li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="creditbill.php">Credit Note</a>
                                </li>
                                <hr class="hrcl">
                                <li style="text-align: left;" class="list-sec"><a href="debitbill.php">Debit Note</a>
                                </li>
                            </ul>
                        </div>

                        <!-- <div class="shortcut-icon"><i class="fa fa-keyboard"></i></div> -->
                    </div>
                    <!--/.nav-collapse -->
                </div> <!-- /container -->
            </div> <!-- /navbar-inner -->
        </div> <!-- /navbar -->

        <div class="subnavbar"
            >
            <div class="subnavbar-inner">
                <div class="container">
                    <div class="mobile-nav-logo"><img src="img/inverted.png?update" alt="Smart GST Billing Software" title="Smart GST Billing Software"></div>
	<ul class="mainnav">
				<li  >
					<a href="home.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#dashboard-svg-icon"></use></svg>
						</span>
					<span>Dashboard</span><span class="shortcut_key_ctrl">d</span></a>
				</li>				
								<li class="active">
					<a href="list-company.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#customer-svg-icon"></use></svg></span>
					<span>Customer / Vendor</span><span class="shortcut_key_ctrl">o</span></a>	    				
				</li>
												<li class="dropdown subnavbar-open-right 
					 
					 
					" >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#product-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Products / Services</span></a>	   
					<ul class="dropdown-menu">
                        <li><a href="list-product.php">Products / Services<span class="shortcut_key_ctrl">r</span></a></li>
                        <li><a href="list-category.php">Product Group</a></li>
                        <li class="menu_sep_hr"><a><hr></a></li>
						<li><a href="manage-stock.php">Stock</a></li>
                    </ul>   					
				</li>
												<li 									>
					<a href="invoicedetail.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#saleinvoice-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Sale<br>Invoice</span><span class="shortcut_key">s</span></a>	    				
				</li>
												<li  
					   >
					<a href="purchaseinvoicedetail.php"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#purchase-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Purchase<br>Invoice</span><span class="shortcut_key">p</span></a>	    				
				</li>
												<li class="dropdown subnavbar-open-right 
					 "    >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#payment-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Payment</span></a>	   
					<ul class="dropdown-menu">
                        <li><a href="list-paymentreceipt.php?type=inward">Inward Payment (Sales Inv.)<span class="shortcut_key">i</span></a></li>
						<li><a href="list-paymentreceipt.php?type=outward">Outward Payment (Purchase Inv.)<span class="shortcut_key">o</span></a></li>
                    </ul>   					
				</li>
												<li class="dropdown subnavbar-open-right  locked 
																				"
				>
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#expense-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Expense <br> Income</span></a>	   
					<ul class="dropdown-menu">
                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Daily Expenses<span class="shortcut_key">d</span></a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">Other Income<span class="shortcut_key">t</span></a></li>	                    </ul>   					
				</li>
								<li class="dropdown subnavbar-open-right  locked  
																																																																																"
				>
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#otheredoc-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Other<br>Documents</span></a>	   
					<ul class="dropdown-menu">
                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Quotation<span class="shortcut_key">q</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Proforma<span class="shortcut_key">r</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Delivery Challan<span class="shortcut_key">e</span></a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Order<span class="shortcut_key">u</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sale Order<span class="shortcut_key">i</span></a></li>                        <li><a  data-toggle="modal" data-target="#trialModal_gst">Job Work<span class="shortcut_key">j</span></a></li>                        <li><a data-toggle="modal" data-target="#trialModal_gst">Letters</a></li>																			<li class="menu_sep_hr"><a><hr></a></li>
												<li><a  data-toggle="modal" data-target="#trialModal_gst">Credit Note<span class="shortcut_key">c</span></a></li>						<li><a  data-toggle="modal" data-target="#trialModal_gst">Debit Note<span class="shortcut_key">b</span></a></li>						<li class="menu_sep_hr"><a><hr></a></li>			
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Multi Currency Invoice<span class="shortcut_key">m</span></a></li>						
                    </ul>   					
				</li>
												
												<li class="locked dropdown subnavbar-open-rightlast-header-option"   >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg><use href="svg-icon/icons.svg#report-svg-icon"></use></svg></span>
					<span style="line-height: 100%;">Report</span></a>	   
					<ul class="dropdown-menu">
						<li class="menu_heading">Sales Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales</a></li>	
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Sales Product Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Inward Payment</a></li>
						<li class="menu_heading">Purchase Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Purchase Product Report</a></li>						
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Outward Payment</a></li>
						<li class="menu_heading">Other Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Company Ledger</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Company Outstanding</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Profit & Loss Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Stock Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Product Report</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Daily Expenses</a></li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">Other Income</a></li>
						<li class="menu_heading">GST Reports</li>
						<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-1</a></li>							<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-2B</a></li>  						<li><a  data-toggle="modal" data-target="#trialModal_gst">GSTR-3B</a></li>  						
                    </ul>   					
				</li>
												<li class="settings_menu_mobile dropdown subnavbar-open-right 
																																																																											" >
					<a  class="dropdown-toggle" data-toggle="dropdown"><span class="fa-icon-svg"><svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#settings-svg-icon"></use>
                                    </svg></span>
					<span style="line-height: 100%;">Settings</span></a>	   
					<ul class="dropdown-menu">
						<li><a href="list-setting.php">Membership</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Credits</a></li>						<li><a href="edit-userdetail.php">Login & Security</a></li>						<li><a href="edit-eway.php">E-way Bill & E-Invoice</a></li>						<a href="settings-whatsapp.php">WhatsApp Options</a></li>
						<li><a href="edit-organisationdetail.php">Business Profile</a></li>						
						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Staff Account</a></li>                        <li ><a href="file-log.php">Go Drive</a></li>                        <li class=' locked'><a href="settings-digital-signature.php">Digital Sign</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Export Data</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Activity Log</a></li>						<li><a href="smtp-email-settings.php">Email Options</a></li>                        <li class="menu_sep_hr"><a><hr></a></li>
						<li class=" " ><a href="settings-general-option.php"> General Options</a></li>						<li class=" " ><a href="settings-product-option.php"> Product & Stock  Options</a></li>						<li class=" " ><a href="settings-printtemplate-option.php"> Print Template</a></li>						<li class=" " ><a href="settings-print-option.php"> Print Options</a></li>						<li class=" " ><a href="settings-bank-detail.php"> Bank Details</a></li>						<li class=" " ><a href="settings-document-option.php"> Document Options</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst"> Shipping & Envelope Options</a></li>
						<li class=" " ><a href="settings-termscondition-option.php"> Terms and Condition</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Translation Options</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Email & Whatsapp Templates</a></li>						<li class="locked"><a  data-toggle="modal" data-target="#trialModal_gst">Payment Reminder</a></li>						<li class="locked hide_unser_tab"><a   data-toggle="modal" data-target="#trialModal_gst">Design Custom Header</a></li>
						<li class="menu_sep_hr"><a><hr></a></li>
																		
                    </ul>   					
				</li>
				
								<li class="notification_menu_mobile ">
					<a href="list-notifications.php" class="mobile-notification"><span class="fa-icon-svg"><svg width="24" height="24" style="filter: brightness(13%);">
                                        <use href="svg-icon/icons.svg#notification-svg-icon"></use>
                                    </svg></span>
					<span style="line-height: 100%;">Notification</span>
													<div class="indicator">
								<div class="circle"><span>3</span></div>
							</div>
											</a>	    				
				</li>
								
			
<li class="referafrnd mobile-nav-show list-sec " >
	<a href="refer-a-friend.php"><span class="fa-icon-svg"> <svg width="24" height="24">
                                        <use href="svg-icon/icons.svg#refere-svg-icon"></use>
                                    </svg></span><span style="line-height: 100%;"> Refer a friend</span></a>
</li>
<li class="mobile-nav-show mobile-nav-logout">
	<div class="session-and-logout">
		<div class="session-box">
			<form method="post" action="" name="myFormSession">
				<div class="dropdown bill-session-new-tab">
				<a data-toggle="dropdown" href="#" class="btn dropdown-toggle" style="padding-top: 10px;padding-bottom: 10px;">F.Y. 2025-2026</a>
					<ul class="dropdown-menu pull-right">
													<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2017_2018"  >F.Y. 2017-2018</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2018_2019"  >F.Y. 2018-2019</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2019_2020"  >F.Y. 2019-2020</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2020_2021"  >F.Y. 2020-2021</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2021_2022"  >F.Y. 2021-2022</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2022_2023"  >F.Y. 2022-2023</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2023_2024"  >F.Y. 2023-2024</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2024_2025"  >F.Y. 2024-2025</a></li>
							<hr class="hrcl">									
												<li style="text-align: left;"class="list-sec" ><a href="#" data-session="_2025_2026" class="active" >F.Y. 2025-2026</a></li>
																
										</ul>
				</div>
			</form>
		</div>
	</div>
</li>

<hr class="mobile-nav-show hrcl">
<h5 class="mobile-nav-show quicksupporttxt">Quick Support</h5>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			<svg width="24" height="24" style="scale: 1.1;">
	            <use href="svg-icon/icons.svg#whatsapp-svg-icon"></use>
	        </svg>
		</div>
		<div class="contact-info-section-content">
			<a href="https://api.whatsapp.com/send/?phone=<PRESIDIO_ANONYMIZED_PHONE_NUMBER>&amp;text=Hi, I need help " target="__blank">+91 7043146478</a>
			<p>10 AM to 7 PM - Everyday</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			 <svg width="24" height="24">
                <use href="svg-icon/icons.svg#message-svg-icon"></use>
            </svg>
		</div>
		<div class="contact-info-section-content">
			<a href="/cdn-cgi/l/email-protection#58303d3428183f373f2b2c3a313434763b3735"><span class="__cf_email__" data-cfemail="d2bab7bea292b5bdb5a1a6b0bbbebefcb1bdbf">[email&#160;protected]</span></a>
			<p>We usually reply within 1 working day</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="contact-info-section">
		<div class="contact-info-section-icon">
			<svg width="24" height="24">
                <use href="svg-icon/icons.svg#books-svg-icon"></use>
            </svg>
		</div>
		<div class="contact-info-section-content">

		<a class="ViewKnowledgeModal" data-baseLink="knowledge-base.php">Knowledge Base</a>
			<!-- <a href="https://gogstbill.com/knowledge-base/" target="_blank">Knowledge Base</a> -->
			<p>100+ Questions answered with Screenshots</p>
		</div>
	</div>
</li>
<li class="mobile-nav-show list-sec">
	<div class="seprator"></div>
	<div class="generate-pin-box">
		<a class="generate-support-pin">Generate Support PIN</a>
	</div>
	</li>
<li  class="mobile-nav-show mobile-nav-logout ">
<a class="switchacc-btn" href="businesses.php?switch=1"><svg width="24" height="24"><use href="svg-icon/icons.svg#switch-user-svg-icon"></use></svg>Switch account</a>
</li>
<li  class="mobile-nav-show mobile-nav-logout ">
	<a class="logout-btn"  href="logout.php"><svg width="24" height="24"><use href="svg-icon/icons.svg#logout-svg-icon"></use></svg>Logout</a>
</li>
</ul>                </div> <!-- /container -->
            </div> <!-- /subnavbar-inner -->
        </div> <!-- /subnavbar -->

        <div class="main">
            <div class="main-inner">
                
                <button class="sticky-notes-btn btn" style="z-index: 3;display: none;">
                    <svg width="24" height="24"><use href="svg-icon/icons.svg#sticky-notes-svg-icon"></use></svg>
                </button>


                <div class="container">
                    <div><div id="MenuSideBarModal" class="modal fade popup_right_slider " role="dialog" style="display: none;">
  <div class="modal-dialog">
    <form class="form-horizontal" method="post">
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <div class="header-section">
            <div class="logo">
              <div class="">
                                <span class="company-logo" >A1</span>

              </div>
              <div class="title">
                <span>A1 Tax Assist</span>
                <p>Admin</p>
              </div>
            </div>
            <button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20">
                <use href="svg-icon/icons.svg#closebtn-svg-icon"></use>
              </svg></button>
          </div>


        </div>
        <div class="modal-body">
          <div class="menu-header">
            <div class="main-info">
              <div >
                                  <a href="businesses.php?switch=1" class="plan">
                    <span><svg width='24' height='24'><use href='svg-icon/icons.svg#plan-svg-icon'></use></svg> Add New Business </a></span>
                  </a>
                                <a href="logout.php" class="logout-btn"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#logout-svg-icon"></use>
                  </svg> Log Out</a>
              </div>
              <hr>
              <a href="list-setting.php" class="plan">
                <span><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#plan-svg-icon"></use>
                  </svg>
                  Plan</span>
                <span>Free</span>
              </a>
              <hr>
              <a href="credits.php" class="credit">
                <span><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#credit-svg-icon"></use>
                  </svg>
                  Credit</span>
                <span>0</span>
              </a>
              <hr>
                            <a href="file-log.php" class="storage">
                                <span><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#folder-svg-icon"></use>
                  </svg>Go Storage</span>
                <span class="go_storage"><svg width="20" height="20" class="svg-icon" data-storage-toggle="tooltip"
                      title="Storage Full" ><use href="svg-icon/icons.svg#limit-warning-svg-icon"></use></svg>0KB / 0KB                </span>
              </a>
                          </div>
            <div class="actions">
              <a href="list-setting.php">
                <div><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#settings-svg-icon"></use>
                  </svg></div><span>Setting</span>
              </a>
              <a href="list-staffAccount.php">
                <div><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#staff-user-svg-icon"></use>
                  </svg></div>
                <sapn>Staff Account</sapn>
              </a>
              <a href="refer-a-friend.php">
                <div><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#refere-svg-icon"></use>
                  </svg></div>
                <sapn>Refer a friend </sapn>
              </a>
            </div>
            <div>
              <h3>Quick Support</h3>
              <div class="support">
                <a href="https://api.whatsapp.com/send/?phone=<PRESIDIO_ANONYMIZED_PHONE_NUMBER>&amp;text=Hi, I need help " target="__blank" class="support-item">
                  <div><svg width="24" height="24">
                      <use href="svg-icon/icons.svg#whatsapp-svg-icon"></use>
                    </svg></div>
                  <p><span>+91 7043146478</span><br><small>10 AM to 7 PM - Everyday</small></p>
                </a>
                <a href="/cdn-cgi/l/email-protection#4b232e273b0b2c242c383f2922272765282426" class="support-item">
                  <div><svg width="24" height="24">
                      <use href="svg-icon/icons.svg#message-svg-icon"></use>
                    </svg></div>
                  <p><span><span class="__cf_email__" data-cfemail="08606d6478486f676f7b7c6a616464266b6765">[email&#160;protected]</span></span><br><small class="">We usually reply within 1 working day</small></p>
                </a>
              </div>
              <a data-baselink="knowledge-base.php" class="knowledge-base-section ViewKnowledgeModal">
                <div><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#books-svg-icon"></use>
                  </svg></div>
                <p><span>Knowledge Base</span><br><small>100+ Questions answered with Screenshots</small></p>
              </a>
                                      <div class="generate-pin-box">
                            <a class="generate-support-pin">Generate Support PIN</a>
                        </div>
                                              <div class="upgradelink">
                                        <a class="planbtn" href="list-setting.php?action=start-trial" style="width: 100% !important;">Start Trial</a>
                                                  </div>
              <div class="anydesk-section">
                <a class="socialicon" target="_blank" href="https://download.anydesk.com/AnyDesk.exe"><svg width="31" height="21">
                    <use href="svg-icon/icons.svg#anydesk-svg-icon"></use>
                  </svg><span>Download AnyDesk</span></a>
              </div>
            </div>
          </div>
          <div class="menu-footer">
            <div class="app-links">
              <div class="qr_container">
                <img src="img/all_new_svg/top-header/downloadappqr.svg" alt="" class="qr_img">
                <span>SCAN QR CODE</span>
              </div>
              <div class="verticalhr"></div>
              <div class="play-btn">
                <h4>Download App</h4>
                <div class="play-btn-1">
                  <a href="https://play.google.com/store/apps/details?id=com.ifox.gogstbill" target="blenk"><img src="img/all_new_svg/top-header/google-play-btn.svg" alt=""></a>
                </div>
                <div class="play-btn-2">
                  <a href="https://apps.apple.com/tr/app/go-gst-bill/id6446317558?platform=iphone" target="blenk"><img src="img/all_new_svg/top-header/app-store-btn.svg" alt=""></a>
                </div>
              </div>
            </div>
            <hr style="border-bottom:1px solid #00000026;">
            <div class="social-link">
              <h4>Follow Us</h4>
              <div class="sociallink-icon">
                <a href="https://www.facebook.com/gogstbill" target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#facebook-svg-icon"></use>
                  </svg></a>
                <a href="https://www.youtube.com/channel/UCTp5ti6LFiVa887z0NQGG0A" target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#youtube-svg-icon"></use>
                  </svg></a>
                <a href="https://api.whatsapp.com/send/?phone=<PRESIDIO_ANONYMIZED_PHONE_NUMBER>&text=Hi, I need help " target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#whatsapp-social-svg-icon"></use>
                  </svg></a>
                <a href="https://www.twitter.com/gogstbill" target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#twitter-svg-icon"></use>
                  </svg></a>
                <a href="https://www.linkedin.com/company/gogstbill/" target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#linkedin-svg-icon"></use>
                  </svg></a>
                <a href="https://www.instagram.com/gogstbill" target="_blank"><svg width="24" height="24">
                    <use href="svg-icon/icons.svg#instagram-svg-icon"></use>
                  </svg></a>
              </div>
            </div>
          </div>

        </div>
        </div>
    </form>
  </div>
</div> </div>                                                       
                    <div><div id="ShortCutKeyModal" class="modal fade popup_right_slider " role="dialog" style="display: none;">
  <div class="modal-dialog">
  <form class="form-horizontal" method="post" id="ShortCutKeyModalForm"   >
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
        <h4 class="modal-title">Shortcut Key</h4>
                      <input type="checkbox" class="checkbox shortctkeyoption" id="shortctkeyoption" checked="checked" name="shortctkeyoption">
              <label for="shortctkeyoption"><span></span></label>
              <input type="hidden"  class="keyactive" value="0" />
                    
      </div>
      <div class="modal-body">
      	    <div class="">
              <div class="view-control-label viewKeylist" style="display: block;">
                <div class="control-group">
                  <label for="name" class="control-label">Dashboard</label>
                  <div class="controls">
                    <span class="label">Ctrl</span>
                    <span class="label">d</span>
                  </div> 
                  <div class="control">
                    <label for="name" class="control-label">- Refresh Dashboard</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div><!-- /controls -->
                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Customer / Vendor</label>
                  <div class="controls">
                    <span class="label">Ctrl</span>
                    <span class="label">o</span>
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Add Customer / Vendor</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Customer / Vendor</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  
                </div> <!-- /control-group -->
                 <div class="control-group">
                  <label for="name" class="control-label">Product / Services</label>
                  <div class="controls">
                    <span class="label">Ctrl</span>
                    <span class="label">r</span>
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Add Product / Services</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Product / Services</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Sale Invoice</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">s</span>
                  </div> <!-- /controls -->
               
                  <div class="control">
                    <label for="name" class="control-label">- Create Sale Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Sale Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Sale Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Purchase Invoice</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">p</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Purchase Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Purchase Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Purchase Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Quotation</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">q</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Quotation</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Quotation</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Quotation</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Job Work</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">j</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Job Work</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Job Work</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Job Work</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Proforma Invoice</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">r</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Proforma Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Proforma Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Proforma Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Delivery Challan</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">e</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Delivery Challan</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Delivery Challan</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Purchase Order</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">u</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Purchase Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Purchase Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Purchase Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Sale Order</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">i</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Sale Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Sale Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Sale Order</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Credit Note</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">c</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Credit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Credit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Credit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                <div class="control-group">
                  <label for="name" class="control-label">Debit Note</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">b</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Debit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Debit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Debit Note</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->
                
                <div class="control-group">
                  <label for="name" class="control-label">Multi Currency Invoice</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">m</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Create Multi Currency Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Multi Currency Invoice</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->

                <div class="control-group">
                  <label for="name" class="control-label">Daily Expenses</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">d</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Add Daily Expenses</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Daily Expenses</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Daily Expenses</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->


                <div class="control-group">
                  <label for="name" class="control-label">Other Income</label>
                  <div class="controls">
                    <span class="label">Alt</span>
                    <span class="label">t</span>
                  </div> <!-- /controls -->

                  <div class="control">
                    <label for="name" class="control-label">- Add Other Income</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">a</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Search Other Income</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->
                  <div class="control">
                    <label for="name" class="control-label">- Summary Other Income</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">i</span>
                    </div> <!-- /controls -->
                  </div> <!-- /controls -->

                </div> <!-- /control-group -->


                <div class="control-group">
                  <label for="name" class="control-label">Sales Report</label>
                  <div class="controls">
                  </div> <!-- /controls -->
                
                 <div class="control">
                    <label for="name" class="control-label">- Customize Report</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /control-group -->
                
                </div> <!-- /control-group -->
              
                <div class="control-group">
                  <label for="name" class="control-label">Sales Outstanding Report</label>
                  <div class="controls">
                  </div> <!-- /controls -->
                
                 <div class="control">
                    <label for="name" class="control-label">- Customize Report</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /control-group -->
                
                </div> <!-- /control-group -->
                
                <div class="control-group">
                  <label for="name" class="control-label">Purchase Report</label>
                  <div class="controls">
                  </div> <!-- /controls -->
                
                 <div class="control">
                    <label for="name" class="control-label">- Customize Report</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /control-group -->
                
                </div> <!-- /control-group -->
                
                <div class="control-group">
                  <label for="name" class="control-label">Purchase Outstanding Report</label>
                  <div class="controls">
                  </div> <!-- /controls -->
                
                 <div class="control">
                    <label for="name" class="control-label">- Customize Report</label>
                    <div class="controls">
                      <span class="label">Ctrl</span>
                      <span class="label">f</span>
                    </div> <!-- /controls -->
                  </div> <!-- /control-group -->
                
                </div> <!-- /control-group -->
                

              </div> <!-- /widget-content -->
            </div> <!-- /widget -->
  
      </div>
      <div class="modal-footer">
			   <button type="button" class="btn btn-default" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
      </div>
    </div>
	</form>
  </div>
</div>
<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script>
  $(document).on('change','.shortctkeyoption',function(){
    var keyactive = $('.keyactive').val();
    $.ajax({  
        type: "POST",  
        url: "ajaxcall.php",  
        ContentType : 'application/json',
        dataType: 'json',
        data: {action:'updateShortCutKey',isactive:keyactive},
        success: function(data){
          if(keyactive == 0){
            $('.keyactive').val(1);
            $('#ShortCutKeyModal .viewKeylist').css('display','none'); 
            $('.shortcut_key_ctrl').hide();
            $('.shortcut_key').hide();
            shortcutBtn = false;
            shortkeys_fun();
          }else{
            $('.keyactive').val(0);
            $('#ShortCutKeyModal .viewKeylist').css('display','block'); 
            $('.shortcut_key_ctrl').show();
            $('.shortcut_key').show();
            shortcutBtn = true;
            shortkeys_fun();
          } 
         
        },
    });
    
  });
</script></div>

		<div class="widget" id="ContentPlace_trmsg">
		<div class="widget-header container-header">
			<h3>Customer / Vendor</h3>
			<div class="search_summary_buttons_wrap">
				<button type="button" class="btn btn-primary pull-right AddCustomerModal"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg>Add New<span class="shortcut_key_ctrl">a</span></button>
				<a class="btn btn-search pull-right" data-status="blank" data-type="Company" data-drawer="search" data-ctype="Customer"><svg width="20" height="20"><use href="svg-icon/icons.svg#search-svg-icon"></use></svg>Search<span class="shortcut_key_ctrl">f</span></a>
									<a data-toggle="modal" href="void(0);" data-target="#addRemoveModal" class="btn pull-right"><svg width="20" height="20"><use href="svg-icon/icons.svg#download-file-svg-icon"></use></svg>Import</a>
							</div>
		</div>
		<div class="widget-content widget-content-search widget-content-toggle closed" style="display:none;width:100%;">
			<hr class="seperator-search-box" />
			<form method="post">
				<div class="control-group-search-container">
					<div class="control-group-search" style="float:left; margin-left:20px;">
						<label class="control-label" for="firstname">Name</label>
						<input type="text" class="span3" name="companyname" id="autoCustomerField" value="" />
						<input type="hidden" name="hidden-companyname" id="hidden-companyname" />
					</div>
					<div class="control-group-search" style="float:left; margin-left:20px;">
						<label class="control-label" for="firstname">GSTIN</label>
						<input type="text" class="span3" name="gstno" value="" />
					</div>
					<div class="control-group-search" style="float:left; margin-left:20px;">
						<label class="control-label" for="firstname">Company Type</label>
						<select name="companytype" class="span4 select2-search select2-search-input" id="listBoxCompany">
							<option value="">Select Company Type</option>
							<option  value="Customer">Customer</option>
							<option  value="Vendor">Vendor</option>
							<option  value="Customer-Vendor">Customer/Vendor</option>
						</select>
					</div>
					<div class="control-group-search" style="float:left; margin-left:20px;">
						<label class="control-label" for="firstname">Contact Person</label>
						<input type="text" class="span3" name="contactperson" value=""  />
					</div>
					<div class="control-group-search" style="float:left; margin-left:20px;">
						<label class="control-label" for="firstname">License No.</label>
						<input type="text" class="span3" name="searchextrafield" value="" />
					</div>
					<div class="list-detail-search-action">
						<div class="control-group-search control-group-search-action search-btn" style=" margin-left:20px; margin-top:20px;">

							<button type="submit" class="btn btn-primary" value="Search" name="btnSearch"><svg width="20" height="20" style="filter: brightness(500%);"><use href="svg-icon/icons.svg#search-svg-icon"></use></svg>Search</button>
							<button class="btn" value="Show All Data" id="showdata"><svg width="20" height="20"><use href="svg-icon/icons.svg#summary-svg-icon"></use></svg>Show All</button>
						</div>
					</div>
				</div>
			</form>
		</div><!-- /widget-content -->
		<div class="widget-summary widget-content widget-content-toggle widget-content-summary opened" style="display:block;width:100%;">
			<hr class="seperator-search-box" />
			<center>
			<div class="control-group-search span2" style="float:left; ">
				<label class="control-label" >Total</label>
				<b class="total">1</b>
			</div>
			<div class="control-group-search span2" style="float:left; ">
				<label class="control-label" >Customer</label>
				<b class="total_customer">1</b>
			</div>
			<div class="control-group-search span2" style="float:left; ">
				<label class="control-label" >Vendor</label>
				<b class="total_vendor">0</b>
			</div>
			<div class="control-group-search span2" style="float:left; ">
				<label class="control-label" >Customer Vendor</label>
				<b class="total_customer_vendor">0</b>
			</div>
			</center>
		</div>
	</div><!-- /widget -->

	<script>
		var autoCustomerList = [];
		function initializeSearchDrawer(headerele) {
			var status = $(headerele).attr('data-status');
			if(status == "blank")
			{
				var type = $(headerele).attr('data-type');
				var data = {
					action: 'UpdateCustomerSearchDropdowns',
					type:type,
					getcustomerarray:1
				}
				$.ajax({
					type: 'POST',
					url: "ajaxcall.php",  
					data: data,
					dataType: 'json',
					beforeSend: function() {
						$("body").addClass("is-loading");
					},
					success: function(data) {
						if(data.status=='OK')
						{
							$(headerele).attr("data-status","loaded");
							autoCustomerList = data.customerdata;
						}
						else
						{
							errorMessage(data.data,'Error In Completing Your Request','','error');
							$("body").removeClass("is-loading");
						}
					},
					complete: function() {
						
					}
				});
			}
		}
		$(document).ready(function() {
			$("#autoCustomerField").autocomplete({
				source: function (request, response) {
					var results = $.grep(autoCustomerList, function (item) {return (item.label.toLowerCase().includes(request.term.toLowerCase()));});response(results.slice(0, 500));
				},
				change: function(event, ui) {
					if (ui.item == null || ui.item == undefined) {} else {
						if (ui.item) {
							$("#autoCustomerField").val(ui.item.label);
							$(event.target).attr("data-oldval", ui.item.label);
							$("#hidden-companyname").val(ui.item.value);

						}
					}
				},
				select: function(event, ui) {
					$("#autoCustomerField").val(ui.item.label);
					$(event.target).attr("data-oldval", ui.item.label);
					$("#hidden-companyname").val(ui.item.value);
					return false;
				},
				minLength: 0
			}).focus(function() {
				$(this).autocomplete("search");
			});
		});
	</script>

	<style>
		@media print {

			#CompanyLedgerModal {
			    display: block;
			 }


			.table td {
				word-break: break-all;
				font-size: 11px;
				padding: 3px 2px;
			}

			.table th {
				font-size: 12px;
			}

			.main {
				padding-bottom: 0px;
				overflow: hidden;
			}

			#CompanyLedgerModal .modal-header,
			#CompanyLedgerModal .modal-footer,
			.searchForm form .control-label,
			.subnavbar,
			.navbar,
			.form-actions,
			.footer,
			button[name="btnSubmit"],
			.drawer-toggle.drawer-hamburger,
			#ContentPlace_trmsg,
			.expiring_soon {
				display: none !important;
			}

			.modal-body {
				overflow-y: hidden !important;
				padding: 0;
			}

			.main-inner>.container>* {
				display: none;
			}

			body #CompanyLedgerModal.popup_right_slider,
			body #CompanyLedgerModal.popup_right_slider .modal-dialog {
				position: static;
			}

			.modal-backdrop,
			.modal-backdrop.fade.in {
				display: none;
			}

			#CompanyLedgerModal,
			.span12 {
				box-shadow: none !important;
				background: #fff !important;
				width: 100% !important;
				max-width: none !important;
				padding: 0 5px !important;
			}

			#CompanyLedgerModal,
			.searchForm form input {
				border: none !important;
				padding: 0 !important;
			}

			#CompanyLedgerModal .searchForm {
				margin-left: 5% !important;
			}

			#CompanyLedgerModal .span12,
			#CompanyLedgerModal .widget,
			#CompanyLedgerModal .control-group-search {
				padding: 0 !important;
				box-shadow: 0 !important;
			}

			#CompanyLedgerModal .modal-content {
				width: 100% !important;
			}

			body {
				min-width: 0;
				min-height: 0;
			}
			
			.main .widget {
				box-shadow: none !important;
			}

			.main .widget-content {
				border: none !important;
			}

			body {
				background: #fff;
				padding: 0 !important;
			}

			.floating-highlight-contact {
				display: none;
			}

			.adsbygoogle {
				display: none !important;
			}

			.main-inner>.container {
				margin: 0;
				padding: 0;
			}
			.main-inner .container {
				width: 100% !important;
			}
			.report-button .form-actions.form-actions-floating{
				display: none !important;
			}
			
		}

		.btn+.btn {
			margin-left: 10px;
		}

		#CompanyLedgerModal .send-email-btn,
		#CompanyLedgerModal .wa_ladger_report{
			display: none;
		}
		
	</style>




		<div class="row">
		<div class="span12">
			<form id="list-data-table" name="tabledata" method="post">
								<div class="widget widget-table action-table">
					<div class="widget-content">
													<table class="table" id="company-table" data-footable data-toggle-column="last">
								<thead>
									<tr>
										<th class="chkbox">
											<center>
												<div class="form-check"><label class="form-check-label"><input type="checkbox" onclick="selectall();" name="del"><i class="input-frame"></i></label></div>
											</center>
										</th>
										<th><a href="list-company.php?sort=DESC&field=c.companyname">Name </a></th>
										<th data-breakpoints="md">Get Oustanding</th>
										<th data-breakpoints="md"><a href="list-company.php?sort=DESC&field=c.contactno1">Phone </a></th>
										<th data-breakpoints="xs"><a href="list-company.php?sort=DESC&field=c.companytype">Type </a></th>
										<th><a href="list-company.php?sort=DESC&field=c.state">State </a></th>
										<th data-breakpoints="sm">
											<center>Action</center>
										</th>

									</tr>
								</thead>
								<tbody>
																			<tr>
											<td>
												<center>
													<div class="form-check"><label class="form-check-label"><input type="checkbox" class="delall" name="delall[]" value="80455-RetailSale" data-openingBalanace="0"><i class="input-frame"></i></label></div>
												</center>
											</td>
											<td class="link-text-dark">
																									<a data-toggle="modal" data-target="#trialModal_gst">Retail Sale</a>
																								<div>	
														
												</div>
											</td>
											<td class="link-text-primary" style="display: grid; grid-template-columns: auto auto; align-items: center;">
												<a data-company="80455" class="company_total"> Get Oustanding </a>
											</td>
											<td></td>
											<td>Customer</td>
											<td>Karnataka</td>
											<td class="td-actions">
												<center><a data-value="80455" class="btn edit-btn CustomerEditModel"><svg width="20" height="20"><use href="svg-icon/icons.svg#edit-svg-icon"></use></svg>Edit</a></center>
												<center>
													<a style="float:left" target="_blank" data-value="80455" class="btn CustomerViewModel"><svg width="20" height="20"><use href="svg-icon/icons.svg#eye-svg-icon"></use></svg>View</a>
													<div class="btn-group other-action-btn action-btn-mt" style="float: right;">
														<a data-toggle="dropdown" href="#" class="btn dropdown-toggle"><svg width="20" height="20"><use href="svg-icon/icons.svg#caret-down-svg-icon"></use></svg></a>
														<ul class="dropdown-menu pull-right">
															<li style="text-align: left;" class="locked">
																																	<a data-toggle="modal" data-target="#trialModal_gst">Ledger</a>
																															</li>
															<li style="text-align: left;">
																<a class="rowDelete" data-value="80455-RetailSale">Delete</a>

															</li>
																															<li style="text-align: left;"  class="locked"><a data-toggle="modal" data-target="#trialModal_gst">Attach File</a></li>
																													</ul>
													</div>
												</center>
											</td>
										</tr>
																	</tbody>
							</table>
											</div>
				</div>
												<div class="form-actions form-actions-floating">
					<button type="submit" class="btn btn-danger" value="Delete" name="btndelete"><svg width="20" height="20"><use href="svg-icon/icons.svg#trash-svg-icon"></use></svg>Delete</button>
					<input type="hidden" value="" name="form_action" />
					<input type="hidden" value="searchcompany=&searchgstno=&searchcompanytype=&searchcontactperson=&searchextrafield=&sort=ASC&field=c.is_active desc, c.companyname" name="url_string" id="url_string" />
					
				</div>

			</form>
		</div>
	</div>

    <script src="js/socket.io.min.js?ver=1305202513052025"></script>
	<script>
		$(document).ready(function() {

            let wa_send_type = 0;
            const share_wa_api = true;

			$(".btn-merge-customer").click(function() {

				if ($(".delall:checked").length == 2) {
					var checked = " checked ";
					var htmlstr = "<div class='merge-customer-popup'>";
					htmlstr += "<p>Select Primary Customer to merge, After Merge Secondary Customer will be deleted.</p>";
					htmlstr += "<table class='table  '>";
					$(".delall:checked").each(function() {
						var name = $(this).parents("td").next().html();
						var val = $(this).val();
						var openingBalanace = $(this).data('openingbalanace');
						htmlstr += "<tr>";
						htmlstr += "<td>";
						htmlstr += "<center><input type='radio' name='merge_delete' class='merge_delete' value='" + val + "' " + checked + " data-balance='"+openingBalanace+"'/></center>";
						htmlstr += "</td>";
						htmlstr += "<td>";
						htmlstr += name;
						htmlstr += "</td>";
						htmlstr += "</tr>";
						checked = " ";
					});
					htmlstr += "</table>";
					htmlstr += "</div>";

					Swal.fire({
						title: 'Merge Customer Option',
						html: htmlstr,
						showDenyButton: false,
						showCancelButton: true,
						confirmButtonText: '<svg width="20" height="20"><use href="svg-icon/icons.svg#trash-svg-icon"></use></svg> Merge Customer',
						confirmButtonColor: '#00ba8b',
					}).then((result) => {
						if (result.isConfirmed) {
							UpdateMergeCustomerTrigger();
						} else {
							return false;
						}
					});

				} else {
					errorMessage("Please select exact 2 customer to merge.", "Error In Merge Customer");
				}
			});

			function UpdateMergeCustomerTrigger() {
				var cust1, cust2,mergeBalance, primary;
				cust1 = $(".delall:checked:eq(0)").val().split("-");
				cust2 = $(".delall:checked:eq(1)").val().split("-");
				merge = $(".merge_delete:checked").val().split("-");
				mergeBalance = $(".merge_delete:unchecked").data('balance');
				
				if (!(typeof cust1 === "undefined") && !(typeof cust2 === "undefined") && !(typeof merge === "undefined")) {
					if(mergeBalance > 0){
						errorMessage("Secondary Customer must have zero opening balanace", 'Error In Merge Customer', '', 'error');
					}else{
						var data = {
							action: 'MergeCustomer',
							cust1: cust1[0],
							cust2: cust2[0],
							merge: merge[0]
						}
						$.ajax({
							type: "POST",
							url: "ajaxcall.php",
							ContentType: 'application/json',
							dataType: 'json',
							data: data,
							beforeSend: function(data) {
								$("body").addClass('is-loading');
							},
							success: function(data) {
								if (data.status == "ERROR") {
									errorMessage(data.msg, 'Error In Merge Customer', '', 'error');
								} else if (data.status == "OK") {
									window.location.reload();
								}
							},
							complete: function(data) {
								$("body").removeClass('is-loading');
							}
						});
					}
				}

			}
			$(".company_total").click(function() {
				var attr = $(this).attr('data-company');
				var curEle = $(this);
				if (typeof attr !== typeof undefined && attr !== false) {
					var data = {
						action: 'GetCustomerTotalOutstanding',
						id: $(this).attr('data-company'),
                        get_reminder_btn: true,
					}
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						data: data,
						beforeSend: function(data) {
							$("body").addClass('is-loading');
						},
						success: function(data) {
							if (data.status == "ERROR") {
								errorMessage(data.outstanding, 'Error In Completing Your Request', '', 'error');
							} else if (data.status == "OK") {
								curEle.parent().html(data.outstanding);
							}
						},
						complete: function(data) {
							$("body").removeClass('is-loading');
						}
					});
				}
			});

			$('.AddCustomerModal').click(function() {
                
				$('.bankdetailopt').hide();
				$('#CustomerModal .enableCompany').show();
				$('#CustomerModal #CustomerModalForm')[0].reset();
				$("#CustomerModal [name=old_gstno]").val('');
				$("#CustomerModal [name=company_id]").val('');
				$('#CustomerModal .amountTextLbl').text('');
				$('#CustomerModal .amountTextLbl_vendor').text('');
				$('#CustomerModal #listBox option').attr("selected", false);
				$('#CustomerModal [name=country]').attr('data-value', 'India');
				$('#CustomerModal .companyTypecls').html(`<label class="radio inline">
										<input type="radio" value="Customer" class="companytype" name="companytype" id="listBoxCompany-c" checked > Customer
										<span class="checkmark"></span>
									</label>
									<label class="radio inline">
										<input type="radio" value="Vendor" class="companytype" name="companytype" id="listBoxCompany-v" > Vendor
										<span class="checkmark"></span>
									</label>
									<label class="radio inline">
										<input type="radio" value="Customer-Vendor" class="companytype" name="companytype" id="listBoxCompany-cv" > Customer / Vendor
										<span class="checkmark"></span>
									</label>`);
				$('#CustomerModal .shipping_address_section').html('');
				$('#CustomerModal [name=is_active]').prop('checked', true);
				$('#CustomerModal .modal-title').text("Add Customer / Vendor");
				$('#CustomerModal .update-gstinfield').hide();
				$("#CustomerModal [name=balance_type][value=Credit]").prop('checked', true);
				$("#CustomerModal [name=balance_amount]").val(0);
				$("#CustomerModal [name=balance_type_vendor][value=Credit]").prop('checked', true);
				$("#CustomerModal [name=balance_amount_vendor]").val(0);
				$('#CustomerModalForm input[name="companytype"]:checked ').trigger("click");
				$('#CustomerModal .control-balance-type-customer').show();
				$('#CustomerModal .control-balance-type-vendor').hide();
				$('#CustomerModal .manage_shipping').hide();
				$('#CustomerModal .add_shipping').show();
				$("#progressbar").css({"width":0 +"%","background-color": "#f7f7f7" ,"font-weight": "bold"});
				$("#progressbar").text("");
				$("#cmp_reputation").val("");
				$('#CustomerModal').modal('show');
				$("#alredyExist").closest(".control-group").hide();
				$("#alredyExist").html("");
				getCountry();
                			});


			$(".CustomerEditModel").click(function() {
                				var attr = $(this).data('value');
				$("#alredyExist").closest(".control-group").hide();
				$("#alredyExist").html("");
				editCompany(attr);
                			});

						function editCompany(attr){
				$('#CustomerModal [name=is_active]').removeProp("checked", false);
				if (typeof attr !== typeof undefined && attr !== false) {
					var data = {
						action: 'getCustomerDetails',
						company_id: attr
					}
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						data: data,
						success: function(data) {
							$('#CustomerModal .modal-title').text("Edit Customer / Vendor");
							$('#CustomerModal .enableCompany').show();
							$('#CustomerModal [name=company_id]').val(data.company_id);
							$('#CustomerModal [name=gstno]').val(data.gstno);
							$('#CustomerModal [name=old_gstno]').val(data.gstno);
							$('#CustomerModal [name=companyname]').val(data.companyname);
							$('#CustomerModal [name=contactperson]').val(data.contactperson);
							$('#CustomerModal [name=contactno1]').val(data.contactno1);
							$('#CustomerModal [name=address1]').val(data.address1);
							$('#CustomerModal [name=address2]').val(data.address2);
							$('#CustomerModal [name=landmark]').val(data.landmark);
							$('#CustomerModal [name=amount_limit]').val(data.amount_limit);
							$('#CustomerModal [name=country]').attr('data-value', data.country);
							$('#CustomerModal .update-gstinfield').show();
							if (data.country == "India") {
								$('#CustomerModal #newState').attr('name', 'statex');
								$('#CustomerModal #listBox').attr('name', 'state');
								$('#CustomerModal #newState').hide();
								$('#CustomerModal [name=state]').show();
								$('#CustomerModal [name=state]').val(data.state);
							} else {
								$('#CustomerModal #listBox').attr('name', 'statex');
								$('#CustomerModal #newState').attr('name', 'state');
								$('#CustomerModal #listBox').hide();
								$('#CustomerModal [name=state]').show();
								$('#CustomerModal [name=state]').val(data.state);
							}
							if (data.companytype != 'Customer') {
								$('#CustomerModal .bankdetailopt').show();
							} else {
								$('#CustomerModal .bankdetailopt').hide();
							}
							if (data.companytype == 'Customer') {
								$('.control-balance-type-customer').show();
								$('.control-balance-type-vendor').hide();
							} else if (data.companytype == 'Vendor') {
								$('.control-balance-type-customer').hide();
								$('.control-balance-type-vendor').show();
							} else {
								$('.control-balance-type-customer').show();
								$('.control-balance-type-vendor').show();
							}
							$('#CustomerModal [name=city]').val(data.city);
							$('#CustomerModal [name=website]').val(data.website);
							$('#CustomerModal [name=email]').val(data.email);
							$('#CustomerModal [name=pan]').val(data.pan);
							$('#CustomerModal [name=registration_type]').val(data.registration_type);
							$('#CustomerModal [name=party_type]').val(data.party_type);
							$('#CustomerModal [name=pincode]').val(data.pincode);
							$('#CustomerModal [name=faxno]').val(data.faxno);
							$('#CustomerModal [name=bankname]').val(data.bankname);
							$('#CustomerModal [name=ifsccode]').val(data.ifsccode);
							$('#CustomerModal [name=accountno]').val(data.accountno);
							$('#CustomerModal [name=branchname]').val(data.branchname);
							$('#CustomerModal [name=distance_eway]').val(data.distance_eway);
							$('#CustomerModal [name=customer_text_1]').val(data.customer_text_1);
							$('#CustomerModal [name=customer_text_2]').val(data.customer_text_2);
							$('#CustomerModal [name=customer_text_3]').val(data.customer_text_3);
							$('#CustomerModal [name=company_due_date]').val(data.company_due_date);
							$('#CustomerModal [name=note]').val(data.note);
							$('#CustomerModal [name=is_active]').prop('checked', data.is_active);
							$('#CustomerModal .companyTypecls').html(data.vendow_bank_class);
							if (data.balance_type != '') {
								$("#CustomerModal [name=balance_type][value=" + data.balance_type + "]").prop('checked', true);
								$("#CustomerModal [name=balance_amount]").val(data.balance_amount);
							} else {
								$("#CustomerModal [name=balance_type][value=Credit]").prop('checked', true);
								$("#CustomerModal [name=balance_amount]").val(0);
							}

							if (data.balance_type_vendor != '') {
								$("#CustomerModal [name=balance_type_vendor][value=" + data.balance_type_vendor + "]").prop('checked', true);
								$("#CustomerModal [name=balance_amount_vendor]").val(data.balance_amount_vendor);
							} else {
								$("#CustomerModal [name=balance_type_vendor][value=Credit]").prop('checked', true);
								$("#CustomerModal [name=balance_amount_vendor]").val(0);
							}

							$('#CustomerModal .shipping_address_section').html('');
							$('#CustomerModal .manage_shipping').attr('href','list-shipping.php?companyid='+data.company_id).show();
							$('#CustomerModal .add_shipping').hide();
							var reputationDetail = getReputationDetail(data.cmp_reputation);
							$("#CustomerModal #progressbar").css({"width":data.cmp_reputation +"%","background-color": "#" + reputationDetail.color,"font-weight": "bold"});
							$("#CustomerModal #progressbar").text(reputationDetail.reputation);
							$("#CustomerModal #cmp_reputation").val(data.cmp_reputation);

							getState();
							getCountry();
							getBalanceAmount();
							$('#CustomerModal').modal('show');
						},
					});
				}
			}
			$(".companyLedger").click(function() {
				var attr = $(this).attr('data-company');
				var curEle = $(this);
				if (typeof attr !== typeof undefined && attr !== false) {
					var data = {
						customer: $(this).attr('data-company'),
						action: "getCompany_ledger",
					}
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						data: data,
						success: function(data) {
							if (data.status == "ERROR") {

							} else if (data.status == "OK") {
								$('#CompanyLedgerModal').css({
									'width': '1200',
									'max-width': '80%'
								});
								$('#CompanyLedgerModal .modal-title').text("Report - Company Ledger");
								$('#CompanyLedgerModal .modal-body').html(data.data);
								$('#CompanyLedgerModal').modal('show');
							}

						},
					});
				}
			});



			var mqls = [
				window.matchMedia("(max-width: 1499px)"),
				window.matchMedia("(max-width: 991px)"),
				window.matchMedia("(max-width: 767px)")
			]

			function mediaqueryresponse(mql) {
				if (mqls[0].matches) {
					$('#CompanyLedgerModal').css('width', 600);
				}
				if (mqls[1].matches) {
					$('#CompanyLedgerModal').css('width', 500);
				}
				if (mqls[2].matches) {
					$('#CompanyLedgerModal').css('width', "90%");
				}
				if (!mqls[0].matches && !mqls[1].matches) {
					$('#CompanyLedgerModal').css('width', 700);
				}
			}


			$(".CustomerViewModel").click(function() {
				var attr = $(this).data('value');
				var curEle = $(this);
				if (typeof attr !== typeof undefined && attr !== false) {
					var data = {
						action: 'getCompany_Details',
						company_id: attr
					}
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'html',
						data: data,
						success: function(data) {
							for (var i = 0; i < mqls.length; i++) {
								mediaqueryresponse(mqls[i])
								mqls[i].addListener(mediaqueryresponse)
							}
							$('#CompanyLedgerModal .modal-title').text("Company Details");
							$('#CompanyLedgerModal .modal-body').html(data);
							$('#CompanyLedgerModal').modal('show');
						},
					});
				}
			});


			$("#list-data-table [type=submit]").click(function(e) {
				e.preventDefault();
				if ($(this).val() == "Delete") {
					confirmationForDelete('multiple',$(this).val());

				} else {
					$("#list-data-table [name=form_action]").val($(this).val());
					$("#list-data-table").submit();
				}
			});
			$("#list-data-table").submit(function(e) {
				e.preventDefault();
				$.ajax({
					type: $(this).attr("method"),
					data: $(this).serialize(),
					dataType: 'json',
					beforeSend: function() {
						$("body").addClass("is-loading");
					},
					success: function(data) {
						if (data.status == 'OK') {
							var baseUrl = "";
							if (data.redirect.indexOf('?') !== -1) {
								baseUrl = data.redirect.split('?')[0];
								baseUrl += '?' + $("#url_string").val();
							} else {
								baseUrl = window.location.href;
							}

							if (data.del_status == 'OK') {
								Swal.fire({
									icon: 'warning',
									title: data.data
								}).then((result) => {
									window.location.href = baseUrl;
								});
							} else {
								window.location.href = data.redirect + '&' + $("#url_string").val();
							}

						} else {
							errorMessage(data.data, 'Error In Completing Your Request', '', 'error');
							$("body").removeClass("is-loading");
						}
					},
					complete: function() {

					}
				});
			});

			function getState(listBox = '') {

				var options = '';
				for (var i = 0; i < handles.length; i++) {
					if (handles[i] == "Select State") {
						options += '<option value="">' + handles[i] + '</option>';
					} else {
						if (handles[i] == "Dadra and Nagar Haveli" || handles[i] == "Daman and Diu") {
							options += '<option value="' + handles[i] + '">' + handles[i] + handlesCodes[i] + '**</option>';
						} else {
							options += '<option value="' + handles[i] + '">' + handles[i] + handlesCodes[i] + '</option>';
						}

					}
				}

				try {
					$('#listBox1').html(options);
					/* Edit Time Set State Selected Code */
					if ($('#listBox1[data-value]').length > 0) {
						if ($('#listBox1').attr("data-value") != "") {
							$('#listBox1').val($('#listBox1').attr("data-value"));
						}

					}

					$('.all_state_list').html(options);
					$(".all_state_list").each(function() {
						if ($(this).attr('data-value').length > 0) {
							if ($(this).attr("data-value") != "") {
								$(this).val($(this).attr("data-value"));
							}

						}

					});

				} catch (err) {

				}
			}

            $(document).on('click', '.share_amount_btn', function() {
                let company_name = $(this).attr('data-company-name')
                let company_phone = $(this).attr('data-phone')
                let company_email = $(this).attr('data-email')
                let company_bcc = $(this).attr('data-bcc')
                let total_outstanding_amount = $(this).attr('data-total-outstanding-amount')

                var subject_message = `Payment reminder from {{org-name}}`

                var emailBody = `Dear {{company}},<br><br>This is a gentle reminder regarding your outstanding payment of ₹{{outstanding-amount}}. <br>We kindly request you to arrange the payment at the earliest.<br><br>Best regards,<br>{{org-name}}`;
                emailBody = emailBody.replace('{{company}}',company_name)
                    .replace('{{outstanding-amount}}',total_outstanding_amount)
                    .replace('{{org-name}}',`A1 Tax Assist`)

                var whatsappBody = `Dear {{company}},

This is a gentle reminder regarding your outstanding payment of ₹{{outstanding-amount}}.
		
We kindly request you to arrange the payment at the earliest.
		
Best regards,
{{org-name}}`;
                whatsappBody = whatsappBody.replace('{{company}}',company_name)
                    .replace('{{outstanding-amount}}',total_outstanding_amount)
                    .replace('{{org-name}}',`A1 Tax Assist`)

                var smsBody = ``;
                smsBody = smsBody.replace('{{company}}',company_name)
                    .replace('{{outstanding-amount}}',total_outstanding_amount)
                    .replace('{{org-name}}',`A1 Tax Assist`)

                $(".modal-body .whatsappbody").html(whatsappBody);
                $(".modal-body .smsbody").html(smsBody);
                $(".modal-body #emailTab .jqte_editor").html(emailBody);
                $(".modal-body #emailTab [name='body']").html(emailBody);
                $(".modal-body #cmp_email").val(company_email.split(' ').join(''));
                $(".modal-body #cmp_bcc").val(company_bcc);
                $(".modal-body #subject").val(subject_message);
                $(".modal-body #cmp_phone").val(company_phone);
                $(".modal-body #cmp_name").val(company_name);
                $(".modal-body #mobile_number").val(company_phone);
                $("#outstandingAmountModel form #total_outstanding_amount").val(total_outstanding_amount);
                $('#outstandingAmountModel .sendRemBtn')[0].click();
                $('#outstandingAmountModel').modal('show');
            });

            $('.jqte-test2').jqte();

            $.validator.addMethod("checkWhatsapp", function(value, element) {
                var ret = createWhatsappPhone(value);
                if(!ret){}
                else{ret = true;}
                return ret;
            }, "Please enter the correct WhatsApp number only numerical values are allowed. (Don't use brackets, dashes, comma, plus)");

            function customerOutstandingAmountSendMail(ajax_data){
                $.ajax({
                    type: "POST",
                    url: "ajaxcall.php",
                    ContentType : 'application/json',
                    dataType: 'json',
                    data: ajax_data,
                    beforeSend: function() {
                        $("#outstandingAmountModel #btnSubmit").html('Sending ...');
                        $("#outstandingAmountModel #btnSubmit").prop('disabled', true);
                    },
                    success: function(data){
                        $("#outstandingAmountModel #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                        $("#outstandingAmountModel #btnSubmit").prop('disabled', false);
                        if(data.status === "ERROR") {
                            if(data.error_button !== undefined && data.error_button === 1){
                                Swal.fire({
                                    title: data.msg,
                                    icon: 'error',
                                    confirmButtonText: 'Buy Credits',
                                }).then((result) => {
                                    if (result.isConfirmed) {
                                        window.location.href = 'credits.php';
                                    }
                                });
                            }else{
                                if (data.failed_via_go_gst == 0){
                                    Swal.fire({
                                        title: 'Unable to Send Email',
                                        html: "We couldn't send the email using your account.  <br>Please check your email settings and try again, <br>or send it from Go GST Bill account.",
                                        icon: 'warning',
                                        showDenyButton: true,
                                        confirmButtonColor: '#3085d6',
                                        confirmButtonText: 'Send Via Go GST Bill',
                                        denyButtonText: 'View Settings ',
                                        reverseButtons: true,
                                        customClass: { denyButton: 'recodeCancel-btn' }
                                    }).then((result) => {
                                        if (result.isConfirmed) {
                                            ajax_data = {...ajax_data, go_gst_bill_mode: 1};
                                            customerOutstandingAmountSendMail(ajax_data)
                                        }else if (result.isDenied) {
                                            window.location.replace('smtp-email-settings.php?mail_error=1');
                                        }
                                    });
                                }else{
                                    errorMessage('', data.msg, '', 'error')
                                }
                            }
                        }
                        else if(data.status === "OK")
                        {
                            $('#outstandingAmountModel').modal('hide');
                            if(data.link !== undefined && data.link !== "")
                            {
                                var url = data.link;
                                window.open(url, '_blank');
                            }else{
                                Toast.fire({
                                    icon: 'success',
                                    title: data.msg
                                });


                            }
                        }
                    },
                });
            }

            $( "#outstandingAmountModel form" ).validate({
                rules: {
                    field: {
                        required: true
                    },
                    cmp_email: {
                        required: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "email") {
                                return true;
                            } else {
                                return false;
                            }
                        },
                        multiplemail: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "email") {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    },
                    subject: {
                        required: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "email") {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    },
                    body: {
                        required: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "email") {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    },
                    mobile_number: {
                        required: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "whatsapp") {
                                return true;
                            } else {
                                return false;
                            }
                        },
                        checkWhatsapp: true
                    },
                    cmp_phone: {
                        required: function (element) {
                            var mode = $("[name=mode]").val();
                            if (mode === "sms") {
                                return true;
                            } else {
                                return false;
                            }
                        },
                        checkWhatsapp: true
                    },
                },
                messages: {
                    cmp_email: {
                        required: "Please enter email address.",
                        validate_email: "Please enter a valid email address.",
                    },
                    subject: "Please enter subject",
                    body: "Please enter body some text",
                    cmp_phone: {
                        required: "Please enter customer phone",
                        checkWhatsapp: "Please enter the correct phone number only numerical values are allowed. (Don't use brackets, dashes, comma, plus)",
                    },
                    mobile_number: {
                        required: "Please enter customer phone",
                        checkWhatsapp: "Please enter the correct WhatsApp number only numerical values are allowed. (Don't use brackets, dashes, comma, plus)",
                    }
                },
                submitHandler: function(form) {

                    var msg_send_type = $("#outstandingAmountModel form input[name='mode']").val();
                    if(msg_send_type == "whatsapp" && wa_send_type == 1 && share_wa_api) {
                        const socket = io('https://utility.gogstbill.com');
                        let connectionAttempts = 0;
                        const maxRetries = 3;
                        socket.on('connect', function () {
                            console.log('Connected to the Socket');
                        });
                        socket.on('connect_error', function (error) {
                            connectionAttempts++;
                            if (connectionAttempts >= maxRetries) {
                                console.log('Max connection attempts reached. Stopping Socket.');
                                errorMessage('Please try again after some time.', 'Server Disconnected!', '', 'error');
                                socket.disconnect();
                            }
                        });

                        var send_wa_data = {
                            action: 'sendWhatsappMessageWithAPI',
                            mobile_number: createWhatsappPhone($("#outstandingAmountModel form input[name='mobile_number']").val()),
                        }
                        $.ajax({
                            type: "POST",
                            url: "ajaxcall.php",
                            ContentType: 'application/json',
                            dataType: 'json',
                            data: send_wa_data,
                            beforeSend: function () {
                                $("#outstandingAmountModel #btnSubmit").html('Sending ...');
                                $("#outstandingAmountModel #btnSubmit").prop('disabled', true);
                            },
                            success: function (data) {
                                if (data.status == "ERROR") {
                                    $("#outstandingAmountModel #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                                    $("#outstandingAmountModel #btnSubmit").prop('disabled', false);
                                    $('#outstandingAmountModel').modal('toggle');
                                    errorMessage('', data.msg, '', 'error');
                                } else if (data.status == "OK") {
                                    if (data.wa_token != "") {

                                        const wa_token = data.wa_token;
                                        const base_64_format = `data:application/pdf;base64,${data.base_64_format}`;
                                        const number = createWhatsappPhone($("#outstandingAmountModel form input[name='mobile_number']").val());
                                        const message = $("#outstandingAmountModel form textarea[name='whatsbody']").val();

                                        socket.emit('send-message', {
                                            wa_token: wa_token,
											user_id: 161818,
											inv_id:'report',
											from_number:data.contact_number,
                                            number: number,
                                            message: message
                                        });
                                    }else{
                                        $("#outstandingAmountModel #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                                        $("#outstandingAmountModel #btnSubmit").prop('disabled', false);
                                        $('#outstandingAmountModel').modal('toggle');
                                        Swal.fire({
                                            title: 'WhatsApp Connection Error',
                                            text:'Authenticate WhatsApp once again',
                                            icon: 'warning',
                                            showDenyButton: true,
                                            confirmButtonColor: '#3085d6',
                                            denyButtonColor: '#07ad83',
                                            confirmButtonText: 'Send Using Link',
                                            denyButtonText: 'Authenticate ',
                                            reverseButtons: true,
                                            customClass: {
                                                confirmButton: 'send-using-link'
                                            }
                                        }).then((result) => {
                                            if (result.isConfirmed) {
                                                wa_send_type = 0;
                                                if ($("#outstandingAmountModel form").valid()) {
                                                    $("#outstandingAmountModel form").submit();
                                                }
                                            }else if (result.isDenied) {
                                                window.top.location.href = 'settings-whatsapp.php';
                                            }
                                        });
                                    }
                                }
                            }
                        });
                        socket.on('messageStatus', function(data) {
                            if(data.code == '200'){
                                $("#outstandingAmountModel #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                                $("#outstandingAmountModel #btnSubmit").prop('disabled', false);
                                $('#outstandingAmountModel').modal('toggle');
                                $('#outstandingAmountModel form')[0].reset();
                                Toast.fire({
                                    icon: 'success',
                                    title: 'Message sent successfully'
                                });
                            }
                        });
                        socket.on('userLogout', function(userLogout) {
                            if(userLogout.code == 401){
                                var data = {
                                    action: 'authenticateWhatsappSession',
                                    user_id: 161818,
                                    wa_token: userLogout.wa_token,
                                    status:0
                                }
                                $.ajax({
                                    type: "POST",
                                    url: "ajaxcall.php",
                                    ContentType : 'application/json',
                                    dataType: 'json',
                                    data: data,
                                    success: function(data){
                                        if(data.status == 'OK')
                                        {
                                            $("#outstandingAmountModel #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                                            $("#outstandingAmountModel #btnSubmit").prop('disabled', false);
                                            $('#outstandingAmountModel').modal('toggle');
                                            errorMessage('Please Login With WhatsApp','Whatsapp is Logout','','error');

                                        }
                                        else{
                                            errorMessage('Please try again!','Something went wrong','','error');
                                        }
                                    },
                                    complete: function(data){
                                    }

                                });

                            }else{
                                errorMessage(userLogout.message,'Something went wrong','','error');
                            }
                        });
						socket.on('error', function(error) {
							errorMessage(error.message,'Disconnected from server','','error');
						});
                    }else{
                        let data = {
                            action: 'submitOutstandingAmountModel',
                            cmp_email:$("#outstandingAmountModel form input[name='cmp_email']").val(),
                            mobile_number:createWhatsappPhone($("#outstandingAmountModel form input[name='mobile_number']").val()),
                            subject:$("#outstandingAmountModel form input[name='subject']").val(),
                            body:$("#outstandingAmountModel form textarea[name='body']").val(),
                            whatsbody:$("#outstandingAmountModel form textarea[name='whatsbody']").val(),
                            smsbody:$("#outstandingAmountModel form input[name='smsbody']").val(),
                            cmp_name:$("#outstandingAmountModel form input[name='cmp_name']").val(),
                            org_name:$("#outstandingAmountModel form input[name='org_name']").val(),
                            cmp_cc:$("#outstandingAmountModel form input[name='cmp_cc']").val(),
                            cmp_bcc:$("#outstandingAmountModel form input[name='cmp_bcc']").val(),
                            mode:$("#outstandingAmountModel form input[name='mode']").val(),
                            replay_email:$("#outstandingAmountModel form input[name='replay_email']").val(),
                            total_outstanding_amount:$("#outstandingAmountModel form input[name='total_outstanding_amount']").val(),
                        }

                        customerOutstandingAmountSendMail(data)
                    }
                }
            });

            $(document).on('click','.sendRemBtn',function(){
                if($(this).data('mode') == 'whatsapp'){
                    $('#outstandingAmountModel [name=mode]').val('whatsapp');
                }else{
                    $('#outstandingAmountModel [name=mode]').val('email');
                }

            });
			

		// Get URL and the value of 'open_que' parameter
			const url = new URL(window.location.href);
			const openQue = url.searchParams.get("open_que");
			const customerModal = $('#CustomerModal');
			if (openQue === "0") {
				$(".search_summary_buttons_wrap .AddCustomerModal").trigger('click');
			} else if (openQue) {	
				const targetLink = $('#company-table tbody tr td a[data-value="' + openQue + '"].CustomerEditModel');
				if (targetLink.length) {
					targetLink.trigger('click');
				} else {
					console.error('Target link not found for openQue:', openQue);
				}
			}
			customerModal.on('shown.bs.modal', function () {
				url.searchParams.delete("open_que");
				window.history.replaceState(null, null, url);
			});
		});
	</script>

<div id="outstandingAmountModel" class="popup_right_slider modal fade" role="dialog" style="display: none;">
    <div class="modal-dialog">
        <form class="form-horizontal" method="post" id="outstandingAmountForm"   >
            <!-- Modal content-->
            <input type="hidden" name="mode" value="whatsapp" />
            <input type="hidden" name="cmp_name" id="cmp_name" />
            <input type="hidden" name="total_outstanding_amount" id="total_outstanding_amount" value="" />
            <input type="hidden" name="replay_email" id="replay_email" value="" />
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
                    <h4 class="modal-title">Send Payment Reminder</h4>
                </div>
                <div class="modal-body">
                    <div class="tabbable">
                        <ul class="nav nav-tabs">
                            <li class="active"><a href="#emailTab" class="sendRemBtn" data-mode="email" data-toggle="tab"><svg width="20" height="20"><use href="svg-icon/icons.svg#email-svg-icon"></use></svg>Email</a></li>
                            <li><a href="#whatsappTab" class="sendRemBtn" data-mode="whatsapp" data-toggle="tab"><svg width="20" height="20"><use href="svg-icon/icons.svg#whatsapp-svg-icon"></use></svg>Whatsapp</a></li>
                          
                        </ul>

                        <div class="tab-content">
                            <div class="tab-pane active" id="emailTab">
                                <fieldset>
                                    <div class="control-group">
                                        <label for="To" class="control-label" >To<span class="star_red">*</span></label>
                                        <div class="controls" style="margin-left: 80px;">
                                            <input type="text" name="cmp_email" id="cmp_email" class="span4" value="" maxlength="150">
                                            <div class="note">Note : Use comma(,) as address separator to enter Multiple Email.</div>
                                            <div id="cmp_email_validate"></div>
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label for="cmp_cc" class="control-label" >Cc</label>
                                        <div class="controls" style="margin-left: 80px;">
                                            <input type="text" name="cmp_cc" id="cmp_cc" class="span4" value="" maxlength="150">
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label for="cmp_bcc" class="control-label" >Bcc</label>
                                        <div class="controls" style="margin-left: 80px;">
                                            <input type="text" name="cmp_bcc" id="cmp_bcc" class="span4" value="" maxlength="150">
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label for="Subject" class="control-label" >Subject<span class="star_red">*</span></label>
                                        <div class="controls" style="margin-left: 80px;">
                                            <input type="text" name="subject" id="subject" class="span4" value="" maxlength="100">
                                            <div id="subject_validate"></div>
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label for="name" class="control-label" >Body<span class="star_red">*</span></label>
                                        <div class="controls" style="margin-left: 80px;">
                                            <textarea name="body" class="span4 jqte-test2 emailbody" required ></textarea>
                                            <div id="body_validate"></div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                            <div class="tab-pane" id="whatsappTab">
                                <fieldset>
                                    <div class="control-group">
                                        <label for="To" class="control-label" >Phone<span class="star_red">*</span></label>
                                        <div class="controls" style="margin-left: 70px;">
                                            <input type="text" name="mobile_number" id="mobile_number" class="span4" value="" maxlength="10">
                                            <div id="cmp_email_validate"></div>
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label for="name" class="control-label">Message</label>
                                        <div class="controls" style="margin-left: 70px;">
                                            <textarea name="whatsbody" class="span4 whatsappbody" rows="10" required>Dear {{company}},

This is a gentle reminder regarding your outstanding payment of ₹{{outstanding-amount}}.
		
We kindly request you to arrange the payment at the earliest.
		
Best regards,
{{org-name}}</textarea>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button  class="btn btn-primary" name="btnsubmit" id="btnSubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send</button>
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- Modal -->
<div id="CompanyLedgerModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">

		<!-- Modal content-->
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
				<h4 class="modal-title"></h4>
			</div>
			<div class="modal-body">

			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	var availableCategory = [];
</script>

<!-- <div id="ShipRocketModal" class="modal popup_right_slider fade" role="dialog" style="display: none;">
    <div class="modal-dialog">
        <form class="form-horizontal" method="post" id="ShipRocketModalForm">
            
            <div class="modal-content steps-all" style="display: none;">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add ShipRocket Order</h4>
				</div>
				
                <div class="modal-body">
                    <fieldset>
                        <div class="step-1-success">
                            <h3>Step 1</h3>
                            <img src="assets/svgs/shiprocket_steps_complete.svg" class="quick-link-card-img" alt="">
                            <p>Order Created Successfully</p>
                            <p class="step-1-order-no">Your Order No. is <span>#856231471256</span></p>
                        </div>

                        <div class="step-2-success">
                            <h3>Step 2</h3>
                            <img src="assets/svgs/shiprocket_steps_complete.svg" class="quick-link-card-img" alt="" style="display: none;">
                            <p class="step-2-text">Select Your Delivery Partner</p>
                            <div class="step-2-text-details">
                                <p class="available-balance-lable">Available Balance</p>
                                <p class="available-balance">₹ 0000</p>
                            </div>
                            <p class="step-2-del-name">Delivery Partner Name</p>

                            <div class="shipping-selection"></div>
                        </div>

                        <div class="step-3-success">
                            <h3>Step 3</h3>
                            <img src="assets/svgs/shiprocket_steps_complete.svg" class="quick-link-card-img" alt="" style="display: none;">
                            <p class="step-3-text">Choose Pickup Date</p>

                            <div class="pickup-date-section"></div>

                            <div class="pick-del-info">
                                <div class="pick-del-blocks">
                                    <p class="pick-del-texts headings">Pickup Date:</p> 
                                    <p class="pick-del-texts pickup-date">10-11-2024</p> 
                                </div>
                                <div class="pick-del-blocks">
                                    <p class="pick-del-texts calculated-days">2 Days</p> 
                                </div>
                                <div class="pick-del-blocks">
                                    <p class="pick-del-texts headings">Approx Delivery Date:</p> 
                                    <p class="pick-del-texts delivery-date">12-11-2024</p> 
                                </div>
                            </div>
                        </div>
                        
                        <div class="shipment-successful" style="display: none;">
                            <img src="assets/svgs/shirocket_ship_selected.svg">
                            <p class="ship-success-text">Shipment Booked Successfully</p>
                            <p class="ship-awb-text">Your AWB No. is <span>#AWB45456</span></p>
                            <a class="btn btn-primary pull-right" id="print_shipping" download>Print Shipping Label</a>
                        </div>
                        
                    </fieldset>
                </div>
                <div class="modal-footer">
					
				</div>
                
                
            </div>
            <div class="modal-content step-1">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add ShipRocket Order</h4>
				</div>
				
                <div class="modal-body">
                    <fieldset>
                        <div class="shipping-details">
                            <input type="hidden" id="invoice_detail_id" name="invoice_detail_id">
                            <h4><img src="assets/svgs/shiprocket_customer.svg" alt="shiprocket_customer">Customer Details</h4>
                            <hr>
                            <p class="c_name">Customer Name Here</p>
                            <input type="hidden" id="c_name" name="c_name">
                            <p class="c_email">Customer Email Here</p>
                            <input type="hidden" id="c_email" name="c_email">
                            <p class="c_phone">Customer Phone Here</p>
                            <input type="hidden" id="c_phone" name="c_phone">
                            
                            <input type="hidden" id="shipping_is_billing" name="shipping_is_billing">

                            <div class="billing_address" style="display: none;">
                                <h5>Billing Address</h5>
                                <div class="address-blocks">
                                    <p class="c_address1">Address lines 1</p>
                                    <input type="hidden" id="c_address1" name="c_address1">
                                    <p class="c_address2">Address lines 2</p>
                                    <input type="hidden" id="c_address2" name="c_address2">
                                    <p class="c_merge">City, State, Country, Pin</p>
                                    <input type="hidden" id="c_city" name="c_city">
                                    <input type="hidden" id="c_state" name="c_state">
                                    <input type="hidden" id="c_country" name="c_country">
                                    <input type="hidden" id="c_pincode" name="c_pincode">
                                </div>
                            </div>

                            <div class="shipping-address">
                                <h5>Shipping Address</h5>
                                <div class="address-blocks">
                                    <p class="ship_address1">Address lines 1</p>
                                    <input type="hidden" id="ship_address1" name="ship_address1">
                                    <p class="ship_address2">Address lines 2</p>
                                    <input type="hidden" id="ship_address2" name="ship_address2">
                                    <p class="ship_merge">City, State, Country, Pin</p>
                                    <input type="hidden" id="ship_city" name="ship_city">
                                    <input type="hidden" id="ship_state" name="ship_state">
                                    <input type="hidden" id="ship_country" name="ship_country">
                                    <input type="hidden" id="ship_pincode" name="ship_pincode">
                                </div>
                            </div>

                        </div>
                        <div class="shipping-details">
                            <hr>
                            <h4><img src="assets/svgs/shiprocket_pickup.svg" alt="shiprocket_pickup">Pickup Details</h4>
                            <hr>
                            <div class="businessplace"></div>
                        </div>
                        <div class="shipping-details">
                            <hr>
                            <h4><img src="assets/svgs/shiprocket_order.svg" alt="shiprocket_order">Order Details</h4>
                            <hr>
                            <table class="table footable footable-1 table-striped" id="shiporderdetails">
                                <thead>
                                    <tr class="footable-header">
                                        <th style="text-align: left;">Name</th>
                                        <th style="text-align: center;">Quantity</th>
                                        <th style="text-align: right;">Price</th>
                                    </tr>
                                </thead>
                                <tbody></tbody>
                            </table>
                            <input type="hidden" id="product_title" name="product_title[]">
                            <input type="hidden" id="product_qty" name="product_qty[]">
                            <input type="hidden" id="product_price" name="product_price[]">
                            <input type="hidden" id="product_total" name="product_total">
                        </div>
                        <div class="shipping-details">
                            <hr>
                            <h4><img src="assets/svgs/shiprocket_payment.svg" alt="shiprocket_payment">Payment Details</h4>
                            <hr>
                            <div class="payment-options">
                                <label for="Company Type" class="control-label">Company Type</label>
                                <div class="controls input-prepend-small feedback-resolve">
                                    <label class="radio inline">
                                    <input type="radio" value="Prepaid" id="payment_type_prepaid" name="payment_type"> Prepaid </label>
                                    <label class="radio inline">
                                    <input type="radio" value="COD" id="payment_type_cod" name="payment_type"> Cash On Delivery </label>
                                </div>
                            </div>
                        </div>
                        <div class="shipping-details">
                            <hr>
                            <h4><img src="assets/svgs/shiprocket_package.svg" alt="shiprocket_package">Package Details</h4>
                            <hr>
                            <div class="controls-vol">
                                <label class="control-label"> Dead Weight (KG)</label>
                                <input type="number" id="ship_weight" name="ship_weight" min="0.50"> 
                            </div>
                            <div class="volumetric">
                                <div class="controls-vol">
                                    <label class="control-label-vol"> Length (CM) </label>
                                    <input type="number" id="ship_length" name="ship_length" min="0.50"> 
                                </div>
                                <div class="controls-vol">
                                    <label class="control-label-vol"> Breadth (CM) </label>
                                    <input type="number" id="ship_breadth" name="ship_breadth" min="0.50"> 
                                </div>
                                <div class="controls-vol">
                                    <label class="control-label-vol"> Height (CM) </label>
                                    <input type="number" id="ship_height" name="ship_height" min="0.50"> 
                                </div>
                            </div>

                            <p class="ship_volumetric"><span>Volumetric Weight: </span></p>
                            <p class="ship_weight_main"><span>Applicable Weight: </span></p>
                        </div>
                        <div class="shipping-details">
                            <hr>
                            <h4><img src="assets/svgs/shiprocket_secure.svg" alt="shiprocket_secure">Secure Your Shipment</h4>
                            <hr>
                            <div class="package-box">
                                <div class="form-check"><label class="form-check-label">
                                    <input type="checkbox" id="secure_package" name="secure_package" value="true"> Yes, Secure my shipment
                                    <i class="input-frame"></i></label>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                </div>
                
                <div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Add Order</button>
				</div>
            </div>
        </form>
    </div>
</div> -->

<script>
    /*function calculateVolumetricWeight() {
        var weight = parseFloat($(".shipping-details #ship_weight").val());
        var length = parseFloat($(".shipping-details #ship_length").val());
        var breadth = parseFloat($(".shipping-details #ship_breadth").val());
        var height = parseFloat($(".shipping-details #ship_height").val());

        if (length < 0.5 || isNaN(length)) {
            length = 0.5;
        }
        if (breadth < 0.5 || isNaN(breadth)) {
            breadth = 0.5;
        }
        if (height < 0.5 || isNaN(height)) {
            height = 0.5;
        }

        var volumetricWeight = (length * breadth * height) / 5000;
        volumetricWeight = volumetricWeight;

        $(".shipping-details .ship_volumetric").html("<span>Volumetric Weight: </span>"+volumetricWeight.toFixed(2));
        var vol_weight = parseFloat($(".ship_volumetric").clone().children("span").remove().end().text().trim());
        
        if (!isNaN(vol_weight) && vol_weight !== '' && !isNaN(weight) && weight !== '') {
            var largerWeight = Math.max(vol_weight, weight);
            $(".shipping-details .ship_weight_main").html("<span>Applicable Weight: </span>"+largerWeight.toFixed(2));
        }
    }

    $(document).ready(function() {
        $('#submit_pickup_date').hide();
        $(document).on('change', '.pickup-date-section input[type="radio"]', function() {
            if ($(this).is(':checked')) {
                $('#submit_pickup_date').slideDown(); 
            }
        });
        
        $(document).on("click", "#submit_pickup_date", function() {
            var selectedDate = $('input[name="pickup_date"]:checked').val();
            var shipment_id = $("#shipment_id_fpd").val();
            
            $.ajax({
                type: 'POST',
                url: "ajaxcall.php",
                data: {
                    action: 'ShipRocketAddPickup',
                    selected_date: selectedDate, 
                    shipment_id: shipment_id
                },
                dataType: 'json',
                beforeSend: function() {
                    $("body").addClass("is-loading");
                },
                success: function(data) {
                    if(data.status=='OK')
                    {
                        let invoice_detail_id = data.invoice_detail_id;
                        $.ajax({
                            url: 'ajaxcall.php', 
                            type: 'POST',        
                            data: {
                                action: 'ShipRocketFetchData', 
                                invoiceid: invoice_detail_id
                            },
                            success: function(response) {
                                ShipRocketFetchDataResponseHandle(response);               
                            },
                            error: function(xhr, status, error) {
                                console.error('AJAX Error:', error);
                            }
                        });
                    }
                },
                error: function(xhr, status, error) { 
                    var err = xhr.responseText;
                    var errTitle = 'Error In Saving Expense';
                    errorMessage(err.Message,errTitle,'','error');
                    $("body").removeClass("is-loading");
                },
                complete: function() {
                    
                }
            });
        });
        $(document).on('click','.getRow', function() {
            $('.getRow').removeClass('selected');
            $(this).addClass('selected');
        });
        $(document).on("input change",".shipping-details #ship_weight, .shipping-details #ship_length, .shipping-details #ship_breadth, .shipping-details #ship_height", function() {
            calculateVolumetricWeight();
        });

        $( "#ShipRocketModalForm" ).validate({
            rules: {
                field: {required: true},
                ignore: '[readonly=readonly],[readonly],[readonly=true]',
            },
            messages: {
            },
            
            submitHandler: function(form) {

                $('input[name="pick_phone"], input[name="pick_email"], input[name="pick_orgname"], input[name="pick_name"], input[name="pick_address1"], input[name="pick_address2"], input[name="pick_city"], input[name="pick_state"], input[name="pick_country"], input[name="pick_pincode"]').prop('disabled', true);
                var formData = $(form).serialize();

                var selectedAddressRow = $('.getRow.selected');
                
                var pick_orgname = selectedAddressRow.find('input[name="pick_orgname"]').val();
                var pick_name = selectedAddressRow.find('input[name="pick_name"]').val();
                var pick_phone = selectedAddressRow.find('input[name="pick_phone"]').val();
                var pick_email = selectedAddressRow.find('input[name="pick_email"]').val();
                var pick_address1 = selectedAddressRow.find('input[name="pick_address1"]').val();
                var pick_address2 = selectedAddressRow.find('input[name="pick_address2"]').val();
                var pick_city = selectedAddressRow.find('input[name="pick_city"]').val();
                var pick_state = selectedAddressRow.find('input[name="pick_state"]').val();
                var pick_country = selectedAddressRow.find('input[name="pick_country"]').val();
                var pick_pincode = selectedAddressRow.find('input[name="pick_pincode"]').val();
                var secure_package = $('#secure_package').is(':checked') ? 1 : 0;
                
                formData += '&pick_orgname=' + encodeURIComponent(pick_orgname);
                formData += '&pick_name=' + encodeURIComponent(pick_name);
                formData += '&pick_phone=' + encodeURIComponent(pick_phone);
                formData += '&pick_email=' + encodeURIComponent(pick_email);
                formData += '&pick_address1=' + encodeURIComponent(pick_address1);
                formData += '&pick_address2=' + encodeURIComponent(pick_address2);
                formData += '&pick_city=' + encodeURIComponent(pick_city);
                formData += '&pick_state=' + encodeURIComponent(pick_state);
                formData += '&pick_country=' + encodeURIComponent(pick_country);
                formData += '&pick_pincode=' + encodeURIComponent(pick_pincode);
                formData += '&secure_package=' + encodeURIComponent(secure_package);
                formData += '&action=ShipRocketAddOrder'; 

                var params = new URLSearchParams(formData);
                var queryArray = {};
                params.forEach(function(value, key) {
                    queryArray[key] = value;
                });
                $.ajax({
                    type: 'POST',
                    url: "ajaxcall.php",
                    data: formData,
                    dataType: 'json',
                    beforeSend: function() {
                        $("body").addClass("is-loading");
                    },
                    success: function(data) {
                        if(data.status=='OK')
                        {
                            let invoice_detail_id = data.invoice_detail_id;
                            $.ajax({
                                url: 'ajaxcall.php', 
                                type: 'POST',        
                                data: {
                                    action: 'ShipRocketFetchData', 
                                    invoiceid: invoice_detail_id
                                },
                                success: function(response) {
                                    ShipRocketFetchDataResponseHandle(response);               
                                },
                                error: function(xhr, status, error) {
                                    console.error('AJAX Error:', error);
                                }
                            });
                        }
                        else if(data.status=='ERROR')
                        {
                            console.log(data,'error');
                            var errTitle = 'Error Creating ShipRocket Order';
                            errorMessage('',errTitle,data.data,'warning');
                            $("body").removeClass("is-loading");
                        }
                    },
                    error: function(xhr, status, error) { 
                        var err = xhr.responseText;
                        var errTitle = 'Error In Saving Expense';
                        errorMessage(err.Message,errTitle,'','error');
                        $("body").removeClass("is-loading");
                    },
                    complete: function() {
                        
                    }
                });
            }
        });

        $(document).on('click','.shipping-button', function() {
            var shipment_id = $(this).closest('.shipping-block').find(".shipment-id span").html();
            var courier_id = $(this).closest('.shipping-block').find(".courier-id span").html();

            $.ajax({
                url: 'ajaxcall.php', 
                type: 'POST', 
                data: {
                    action: 'ShipRocketSelectCompany', 
                    shipment_id: shipment_id,         
                    courier_id: courier_id            
                },
                success: function(data) {
                    if(data.status=='OK')
                    {
                        let invoice_detail_id = data.invoice_detail_id;
                        $.ajax({
                            url: 'ajaxcall.php', 
                            type: 'POST',        
                            data: {
                                action: 'ShipRocketFetchData', 
                                invoiceid: invoice_detail_id
                            },
                            success: function(response) {
                                ShipRocketFetchDataResponseHandle(response);
                            },
                            error: function(xhr, status, error) {
                                console.error('AJAX Error:', error);
                            }
                        });
                    }
                    else if(data.status=='ERROR')
                    {
                        if(data.about_err == "Low Balance") {
                            var errTitle = data.about_err;
                            errorMessage('',errTitle,data.data,'warning');
                            $("body").removeClass("is-loading");
                        } else if(data.about_err == "KYC Verification Required") {
                            var errTitle = data.about_err;
                            errorMessage('',errTitle,data.data,'warning');
                            $("body").removeClass("is-loading");
                        }
                    }
                },
                error: function(xhr, status, error) {
                    console.log('Error:', error);
                }
            });
        });

    });*/
</script>

<div id="CustomerModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="CustomerModalForm">

			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<div class="modal-title-wrapper" style="display: flex;align-items: center;">
						<button type="button" style="top:unset;" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
						<h4 class="modal-title">Add Customer / Vendor</h4>
													<a id="CustomFieldModal-btn" class="CustomFieldModal-btn round-custom-filed" data-toggle="modal" data-target="#CustomFieldModal" title="Custom Fields">
								<svg width="20" height="24" data-toggle="tooltip" data-html="true" title="Custom Fields">
									<use href="svg-icon/icons.svg?ver=1305202513052025#custom-field-setting-svg-icon-new"></use>
								</svg>
							</a>
											</div>
				</div>
				<div class="modal-body">
					<fieldset>
						<h4><svg width="24" height="24"><use href="svg-icon/icons.svg#note-detail-svg-icon"></use></svg> Customer / Vendor Detail</h4> <hr>
						<div class="control-group ">
							<label for="Company Type" class="control-label">Company Type</label>
							<div class="controls input-prepend-small feedback-resolve companyTypecls">
																	<label class="radio inline">
									<input type="radio" value="Customer" class="companytype" name="companytype" id="listBoxCompany-c" > Customer
                                    <span class="checkmark"></span>
									</label>
																									<label class="radio inline">
									<input type="radio" value="Vendor" class="companytype" name="companytype" id="listBoxCompany-v"  > Vendor
                                    <span class="checkmark"></span>
									</label>
																<label class="radio inline">
								<input type="radio" value="Customer-Vendor" class="companytype" name="companytype" id="listBoxCompany-cv"> Customer / Vendor
                                <span class="checkmark"></span>
								</label>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">GSTIN</label>
							<div class="controls" style="position:relative;">
								<input type="text" name="gstno" id="gstno" class="span4" oninput="this.value = this.value.toUpperCase()" placeholder="Enter GSTIN" maxlength="15">
								<input type="hidden" name="old_gstno" id="old_gstno">
																	<div class="btn gstdata_autofill div-inner-input" >Auto Fill</div>
																	</div> <!-- /controls -->
								
						</div> <!-- /control-group -->
						<div class="control-group" style="display: none;">
							<label for="reputation" class="control-label" >Reputation</label>
							<div class="controls" style="position:relative;">
							<div class="progress" style="height: 21px;  border-radius: 15px; margin-top: 3px;margin-bottom:0;">
												<div class="progress-bar" id="progressbar" role="progressbar" aria-valuemin="0" aria-valuemax="100">
												</div>
											</div>
											<input type="hidden" name="cmp_reputation" id="cmp_reputation">
								</div> <!-- /controls -->
								
						</div> <!-- /control-group -->

						<div class="control-group update-gstinfield">											
							<label  class="control-label">Update GSTIN ?</label>
							<div class="controls">
								<div class="form-check"><label class="form-check-label"><input type="checkbox" name="update_gstno" value="1" id="update_gstno"> Update above GST number on all previous invoices.</input><i class="input-frame"></i></label></div>
							</div> <!-- /controls -->				
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Company Name <span class="star_red">*</span></label>
							<div class="controls" style="position:relative;">
								<input type="text" value="" name="companyname" id="companyname" maxlength="150" class="span4" placeholder="Enter Company name" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group" style="display:none;" >
							<!-- <div class="controls" style="position:relative;max-width:100%"> -->
								<div class="customer-exist">
									<div class="customer-exist-header">
										<h4>Company(s) Already Exists with matching Name/GSTIN.</h4>
									</div>
									<div class="customer-exist-header-content alredyExist" id="alredyExist">

									</div>
								</div>
							<!-- </div> -->
						</div>

						<div class="control-group">
							<label for="firstname" class="control-label">Contact Person</label>
							<div class="controls">
								<input type="text" value="" name="contactperson" id="contactperson" class="span4" placeholder="Enter contact person" maxlength="150">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Contact No</label>
							<div class="controls">
								<input type="text" value="" name="contactno1" id="contactno1" class="span4" placeholder="Enter contact No." maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Email</label>
							<div class="controls">
								<input type="text" placeholder="emailaddress@domain.com" name="email" id="email" class="span4" placeholder="Enter email address" maxlength="150">
								<div class="note">Note : Use comma(,) as address separator to enter Multiple Email.</div>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="registration_type" class="control-label">Registration Type</label>
							<div class="controls">
								<select name="registration_type" class="span4">
									<option value="Unregistered">Unregistered</option>
									<option value="Regular">Regular</option>
									<option value="Regular-UIN">Regular-Embassy/UN Body</option>
									<option value="Regular-SEZ">Regular-SEZ</option>
									<option value="Composition">Composition</option>
								</select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">PAN</label>
							<div class="controls">
								<input type="text" name="pan" id="pan" class="span4" placeholder="Enter PAN" maxlength="10">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						

						<h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#billing-address-svg-icon"></use></svg> Billing Address</h4> <hr>

						<div class="control-group">
							<label for="firstname" class="control-label">Address</label>
							<div class="controls">
								<input type="text" value="" name="address1" id="address1" maxlength="100" class="span4" placeholder="Enter address1"></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<div class="controls">
								<input type="text" value="" name="address2" id="address2" maxlength="100" class="span4" placeholder="Enter address2"></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Landmark </label>
							<div class="controls">
								<input type="text" value="" name="landmark" class="span4" placeholder="Enter landmark" maxlength="30">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">City <span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" id="city" name="city" class="span4" placeholder="Enter city" maxlength="50" required/>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="Country" class="control-label">Country <span class="star_red">*</span></label>
							<div class="controls">
								<select onchange='selct_state_option(this.value,"listBox","newState","state")' type="list" data-value="India" name="country" class="span4 listBoxCountry1" id="listBoxCountry" required></select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">State <span class="star_red">*</span></label>
							<div class="controls">
								<select type="list" name="state" class="span4" id="listBox" required></select>
								<input type="text" name="newstate" id="newState" placeholder="Enter State" class="span4 hide" />
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Pincode</label>
							<div class="controls">
								<input type="text" value="" name="pincode" id="pincode" placeholder="Enter pincode" class="span4" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="Distance for e-way bill (in km)" class="control-label">Distance for e-way bill (in km)</label>
							<div class="controls" style="position:relative;">
								<input type="text" value="" name="distance_eway" id="distance_eway" class="span4" placeholder="Enter Distance for e-way bill (in km)">
																	<div class="btn distance_autofill div-inner-input">Auto Fill</div>
									<input type="hidden" id="org_state" name="org_state" value="Karnataka">
									<input type="hidden" id="org_pincode" name="org_pincode" value="560112">
															</div> <!-- /controls -->
						</div> <!-- /controlgroup -->

                        <h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#address-svg-icon"></use></svg>Shipping Address
                            <div class="btn btn-primary add_shipping has_modal_lbl_btn"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg>Add</div>
                            <a class="btn btn-primary manage_shipping has_modal_lbl_btn" target="_blank" style="display:none;">Manage</a>
                        </h4><hr>
                        <div class="shipping_address_section">

                        </div>


						<h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#balance-svg-icon"></use></svg> Opening Balance</h4> <hr>

						<div class="control-group control-balance-type-customer">
							<label for="Company Type" class="control-label">Customer Balance</label>
							<div class="controls input-prepend-small feedback-resolve">
									<label class="radio inline">
									<input type="radio" value="Credit" class="balance_type" name="balance_type"> Credit <span class="checkmark"></span></label>
									<label class="radio inline">
									<input type="radio" value="Debit" class="balance_type" name="balance_type"> Debit <span class="checkmark"></span></label>
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->

						<div class="control-group control-balance-type-customer">
							<label for="Account Number" class="control-label">Amount</label>
							<div class="controls">
								<input type="text" value="" name="balance_amount" onkeypress="return allowOnlyNumber(event);" class="balance_amount" placeholder="Enter Amount" class="span4">
								<span class="amountTextLbl"></span>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						
						
						<div class="control-group control-balance-type-vendor">
							<label for="Company Type" class="control-label">Vendor Balance</label>
							<div class="controls input-prepend-small feedback-resolve">
									<label class="radio inline">
									<input type="radio" value="Credit" class="balance_type_vendor" name="balance_type_vendor"> Credit <span class="checkmark"></span></label>
									<label class="radio inline">
									<input type="radio" value="Debit" class="balance_type_vendor" name="balance_type_vendor"> Debit <span class="checkmark"></span></label>
								</label>
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->

						<div class="control-group control-balance-type-vendor">
							<label for="Account Number" class="control-label">Amount</label>
							<div class="controls">
								<input type="text" value="" name="balance_amount_vendor" onkeypress="return allowOnlyNumber(event);" class="balance_amount_vendor" placeholder="Enter Amount" class="span4">
								<span class="amountTextLbl_vendor"></span>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						
						
                        <h4 class="has_modal_lbl bankdetailopt"><svg width="24" height="24"><use href="svg-icon/icons.svg#bank-detail-svg-icon"></use></svg> Vendor Bank Details</h4>
						<hr class="bankdetailopt">

						<div class="control-group bankdetailopt">
							<label for="Bank Name" class="control-label">Bank Name</label>
							<div class="controls">
								<input type="text" value="" name="bankname" id="bankname" placeholder="Enter bank name" class="span4" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group  bankdetailopt">
							<label for="IFSC Code" class="control-label">Bank IFSC Code</label>
							<div class="controls">
								<input type="text" value="" name="ifsccode" id="ifsccode" placeholder="Enter IFSC code" class="span4" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group  bankdetailopt">
							<label for="Account Number" class="control-label">Bank Account Number</label>
							<div class="controls">
								<input type="text" value="" name="accountno" id="accountno" placeholder="Enter account number" class="span4" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						
						<div class="control-group  bankdetailopt">
							<label for="Branch Name" class="control-label">Bank Branch Name</label>
							<div class="controls">
								<input type="text" value="" name="branchname" id="branchname" placeholder="Enter branch name" class="span4" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

                        <h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#custom-field-svg-icon"></use></svg> Custom Fields</h4> <hr>
						
						<div class="control-group">
							<label class="control-label">License No.</label>
							<div class="controls">
								<input type="text" value="" name="customer_text_1" id="customer_text_1" class="span4" placeholder="Enter License No.">
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->
						<div class="control-group">
							<label class="control-label">custom field 1</label>
							<div class="controls">
								<input type="text" value="" name="customer_text_2" id="customer_text_2" class="span4" placeholder="Enter custom field 1">
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->
						<div class="control-group">
							<label class="control-label">custom field 2</label>
							<div class="controls">
								<input type="text" value="" name="customer_text_3" id="customer_text_3" class="span4" placeholder="Enter custom field 2">
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->

						<h4  class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#additional-note-svg-icon"></use></svg>Additional Details</h4> <hr>


						

						<div class="control-group">
							<label for="firstname" class="control-label">Fax No</label>
							<div class="controls">
								<input type="text" name="faxno" id="faxno" class="span4" placeholder="Enter fax No." maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Website</label>
							<div class="controls">
								<input type="text" placeholder="www.sitename.com" name="website" id="website" class="span4" placeholder="Enter website name" maxlength="100">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="firstname" class="control-label">Credit Limit</label>
							<div class="controls">
								<input type="text" name="amount_limit" id="amount_limit" class="span4" placeholder="Enter amount">
								<div class="note">Note : A warning will be displayed if the customer’s credit limit is exceeded while generating an invoice</div>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label class="control-label">Due Days</label>
							<div class="controls">
								<input type="text" value="" name="company_due_date" id="company_due_date" class="span4" placeholder="Enter due days">
								<div class="note">Note : Keep it blank to use the default due date from settings. Enter a number to set the due date as days from the invoice date. </div>
							</div> <!-- /controls -->
						</div> <!-- /controlgroup -->

						<div class="control-group">
							<label for="note" class="control-label">Note</label>
							<div class="controls">
								<textarea name="note" id="note" class="span4" placeholder="Enter note"></textarea>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group enableCompany"  style="display: none;">
							<label class="control-label">Enable</label>
							<div class="controls">
								<div class="form-check"><label class="form-check-label">
									<input type="checkbox" id="is_active" name="is_active" checked="checked"> Company will be visible on all document.</input>
									<i class="input-frame"></i></label></div>
							</div><!-- /controls -->
						</div><!-- /control-group -->
						<input type="hidden" name="company_id" class="company_id" value=""/>
						<input type="hidden" name="hmac" id="hmac" value="89a6fefd59553921ffed" />
						<!--------------- -------------------------------------------------->
					</fieldset>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>



<div id="TransportModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="TransportModalForm">
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add Transport</h4>
				</div>
				<div class="modal-body">
					<fieldset>
						<div class="control-group">
							<label for="name" class="control-label">Transport ID / GSTIN</label>
							<div class="controls" style="position:relative;">
								<input type="text" name="transportid" id="transportid" class="span4" placeholder="Enter your transport id" maxlength="100">
																		<div class="btn transportgstdata_autofill div-inner-input" data-gstfor="shipping" >Auto Fill</div>
																</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="name" class="control-label">Transport Name<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="name" id="name" class="span4" placeholder="Enter your transport name" maxlength="255" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="name" class="control-label">Vehicle No</label>
							<div class="controls">
								<input type="text" name="vehicleno" id="vehicleno" class="span4" placeholder="Enter your vehicle no" maxlength="50">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

                        <div class="control-group">
                            <label for="tracking_link" class="control-label">Tracking Link</label>
                            <div class="controls">
                                <input type="text" name="tracking_link" id="tracking_link" class="span4" placeholder="Enter Tracking Link" />
                                <small class="text-muted">Use <code>{{LR No}}</code> as a placeholder in the tracking URL</small>
                            </div>
                        </div>

						<div class="control-group enableTransport" style="display: none;"> 	
							<label class="control-label">Enable</label>	
							<div class="controls">			
								<div class="form-check"><label class="form-check-label">
									<input type="checkbox" id="is_active" name="is_active" checked="checked"> Transport will be visiable on all document.	
									<i class="input-frame"></i></label></div>
							</div><!-- /controls -->	
						</div>
						<input type="hidden" name="hmac" id="hmac" value="c093bd74547d5f87f7f7" />
					</fieldset>
				</div>
				<div class="modal-footer">
				<a href="list-transport.php" target="_blank" class="btn btn-primary Margin_Bottom_btn" style="float:left;"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>View All Transport</a>					
					<a type="button" class="btn btn-default Margin_Bottom_btn pull-left" data-dismiss="modal" style="background:#D9D9D9;border-color:#D9D9D9;"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</a>
					<button class="btn btn-primary Margin_Bottom_btn" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>

<div id="ShippingModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="ShippingModalForm">
			<!-- Modal content -->
			<div class="modal-content">
				<div class="modal-header">
					<div class="modal-title-wrapper" style="display: flex;align-items: center;">
						<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
						<h4 class="modal-title">Add Shipping Address </h4>
											</div>
				</div>
				<div class="modal-body">
					<div class="shipping_address_reapiter">
						<fieldset>
							<div class="control-group">
								<label for="SHIP. GSTIN" class="control-label">GSTIN</label>
								<div class="controls" style="position:relative;">
									<input type="text" oninput="this.value = this.value.toUpperCase()" id="gstno" name="ship_gstno[]" class="span4 ship_gstno" placeholder="Enter shipping GSTIN" maxlength="20">
																			<div class="btn gstdata_autofill div-inner-input" data-gstfor="shipping">Auto Fill</div>
																	</div> <!-- /controls -->
							</div> <!-- /control-group -->
							<input type="hidden" value="" name="shipping_address_id[]" class="span4 shipping_address_id">
							<div class="control-group">
								<label for="SHIP. Name" class="control-label">Name <span class="star_red">*</span></label>
								<div class="controls">
									<input type="text" value="" name="ship_name[]" class="span4 ship_name" placeholder="Enter shipping name">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="SHIP. Cperson" class="control-label">Contact Person</label>
								<div class="controls">
									<input type="text" value="" name="ship_cperson[]" class="span4 ship_cperson" placeholder="Enter shipping contact person name">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="SHIP. Phone" class="control-label">Phone</label>
								<div class="controls">
									<input type="text" value="" name="ship_phone[]" class="span4 ship_phone" placeholder="Enter shipping phone " maxlength="20">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="SHIP. Email" class="control-label">Email</label>
								<div class="controls">
									<input type="text" value="" name="ship_email[]" class="span4 ship_email" placeholder="Enter Email">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="Ship To" class="control-label">Address <span class="star_red">*</span></label>
								<div class="controls">
									<textarea name="ship_address[]" class="span4 ship_address" placeholder="Enter shipping address"></textarea>
								</div> <!-- /controls -->
							</div> <!-- /control-group -->
							<div class="control-group">
								<label for="firstname" class="control-label">Landmark <span class="star_red">*</span></label>
								<div class="controls">
									<input type="text" value="" name="ship_landmark[]" class="span4 ship_landmark" placeholder="Enter shipping landmark" maxlength="30">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->
							<div class="control-group">
								<label for="ship_pincode" class="control-label">Pincode <span class="star_red">*</span></label>
								<div class="controls">
									<input type="text" value="" name="ship_pincode[]" class="span4 ship_pincode" placeholder="Enter shipping pincode" maxlength="20">
								</div> <!-- /controls -->
							</div> <!-- /control-group -->
							<div class="control-group">
								<label for="firstname" class="control-label">City <span class="star_red">*</span></label>
								<div class="controls">
									<input type="text" id="ship_city" name="ship_city[]" class="span4 ship_city" placeholder="Enter shipping city" maxlength="50" />
								</div> <!-- /controls -->
							</div> <!-- /control-group -->
							<div class="control-group">
								<label for="SHIP. State" class="control-label">State <span class="star_red">*</span></label>
								<div class="controls">
									<select type="list" data-value="" name="ship_state[]" class="span4 all_state_list"></select>
									<input type="text" name="ship_statex" id="newState1" placeholder="Enter State" value="" class="span4 hide newState1" />
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="ship_country" class="control-label">Country</label>
								<div class="controls">
									<select data-value="India" type="list" name="ship_country[]" class="span4 listBoxCountry1"></select>
								</div> <!-- /controls -->
							</div> <!-- /control-group -->

							<div class="control-group">
								<label for="Distance for e-way bill (in km)" class="control-label">Distance for e-way bill (in km)</label>
								<div class="controls" style="position:relative;">
									<input type="text" value="" name="shipping_distance_eway[]" class="span4 shipping_distance_eway" placeholder="Enter Distance for e-way bill (in km)">
																			<div class="btn distance_autofill div-inner-input" distance_for="shipping">Auto Fill</div>
																	</div> <!-- /controls -->
							</div> <!-- /controlgroup -->
							
						</fieldset>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>

<!-- Invoice Upload Modal -->
<div id="invoice_upload_modal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
    <div class="modal-dialog">
        <form class="form-horizontal" method="post" id="invoiceUploadForm" action="file-upload-ajaxcall.php">
            <div class="modal-content">
                <input type="hidden" name="reference_id" id="reference_id" />
                <input type="hidden" name="reference_type" id="reference_type" />
                <div class="modal-header">
                    <button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
                    <h4 class="modal-title">Upload Document</h4>
                </div>
                <div class="modal-body">
                    <div class="invoice_wrapper">
                        <div class="invoice_container">

                        </div>
                        <div class="dropzone" id="invoice_dropzone"></div>
                        <p id="error_message" style="color: red"></p>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- Invoice Upload Modal -->

<script>
	const price_decimal_value = '2';
    $(document).ready(function (){

        let invoiceDropzone;
        let errorMessage = "";

        function fetchUserFiles(reference_id,reference_type){
            $.ajax({
                type: 'POST',
                url: 'ajaxcall.php',
                data: { action: 'fetch_user_files', reference_id: reference_id, reference_type: reference_type },
                success: function (response){

                    $('.upload_file_' + reference_id).attr('data-file-count', response.total_file_count)
                    if (response.files.length == 0){ $('.actions_detail_icons.upload_file_'+reference_id).hide() }

                    if (response.go_storage != undefined){ $('.go_storage').text(response.go_storage) }

                    var image_box = ""
                    $(".invoice_container").html("");
                    $.each(response.files, function(key,file) { image_box += file.html });
                    $(".invoice_container").append(image_box);

                    if(invoiceDropzone) invoiceDropzone.destroy()

                    const maxFilesAllowed = 5;
                    const currentFileCount = response.total_file_count;
                    const maxFiles = maxFilesAllowed - currentFileCount;

                    invoiceDropzone = new Dropzone("#invoice_dropzone", {
                        maxFiles: maxFiles,
                        maxFilesize: 5,
                        dictFileTooBig: "Upload failed: The uploaded file exceeds the maximum allowed size of 5 MB. Please upload a smaller file.",
                        dictMaxFilesExceeded: "Upload failed: Maximum 5 files can be attached per document.",
						dictDefaultMessage: "<div style='display-flex; flex-direction:column;'><img src='assets/svgs/image_icon.svg'><p style='font-weight:bold;'>Click To Upload</p></div>",
                        acceptedFiles: '.pdf,.png,.jpg,.jpeg,.doc,.docx,.xls,.xlsx,.xlsm,.csv,.ppt,.pptx,.ppsx,.one,.txt,.rtf',
                        url: "file-upload-ajaxcall.php",
                        params: function() { return { action: "upload_invoice_file", reference_id: $('#reference_id').val(), reference_type: $('#reference_type').val() }; },
                        init: function() {

                            const myDropzone = this;

                            errorMessage = "";

                            myDropzone.on("addedfile", function(file) {
                                if (myDropzone.files.length > myDropzone.options.maxFiles) {
                                    myDropzone.removeFile(file);
                                    errorMessage = "Upload failed: Maximum 5 files can be attached per document.";
                                }
                            });

                            myDropzone.on("sending", function(file, xhr, formData) {
                                $("body").addClass("is-loading");
                                $('.dz-message').show();
                            });

                            myDropzone.on("queuecomplete", function () {
                                $('.actions_detail_icons.upload_file_'+reference_id).show()
                                fetchUserFiles(reference_id, reference_type);
                                $('#error_message').text(errorMessage)
                            });

                            myDropzone.on("error", function(file, error) {
                                if (file.size > (5 * 1024 * 1024)) {
                                    errorMessage = "Upload failed: The uploaded file exceeds the maximum allowed size of 5 MB. Please upload a smaller file.";
                                } else if (myDropzone.files.length > myDropzone.options.maxFiles) {
                                    errorMessage = "Upload failed: Maximum 5 files can be attached per document.";
                                } else {
                                    errorMessage = error
                                }
                                myDropzone.removeFile(file);
                            });
                        },
                        success: function (file, response){
                            if (response.go_storage_limit_exceed && !response.success){
                                Swal.fire({
                                    icon: 'warning',
                                    title: "Your Go Drive storage is full.",
                                    text: "Upgrade your storage plan to continue uploading files.",
                                    showCancelButton: true,
                                    confirmButtonText: 'Upgrade',
                                    cancelButtonText: 'Cancel',
                                    reverseButtons: true
                                }).then((result) => {
                                    if (result.isConfirmed) {
                                        window.location.href = response.redirect_url;
                                    }
                                });
                            }else if(!response.success) {
								if(response.access_denied){
									Swal.fire({ icon: 'warning', title: "Access Denied", text: "You don’t have permission to complete this action."  });
								}else{
									Swal.fire({ icon: 'error', title: response.message });
								} 
                            }
                        },
                    });
                },
            })
        }

        Dropzone.autoDiscover = false;
        $(document).on('click', '.upload_invoice_btn', function (){
            const reference_id = $(this).data('reference-id');
            const reference_type = $(this).data('reference-type');

            $('#error_message').text('')
            $('#reference_id').val(reference_id)
            $('#reference_type').val(reference_type)
            $('#invoice_upload_modal').modal('show')

            fetchUserFiles(reference_id,reference_type)
        })

        $(document).on("click", ".invoice_icons .delete_file", function(e) {
            $('#error_message').text('');
            const user_file_id = $(this).data('id');
            const reference_id = $(this).data('reference-id');
            const reference_type = $(this).data('reference-type');
			Swal.fire({
				title: "Do you really want to delete this document?",
				icon: "warning",
				showCancelButton: true,
				confirmButtonText: "Delete",
				cancelButtonText: "Cancel",
				reverseButtons: true,
				customClass: {
					confirmButton: 'recodeDelete-btn',
					cancelButton: 'recodeCancel-btn'
				}
			}).then((result) => {
			if(result.isConfirmed){
				$.ajax({
					
					type: 'POST',
					url: 'ajaxcall.php',
					data: { action: 'delete_user_files', user_file_id: user_file_id, reference_id: reference_id, reference_type: reference_type },
					success: function (response){
						if(response.success){
                        fetchUserFiles(response.reference_id,response.reference_type)
						}else {
							if(response.access_denied){
								Swal.fire({ icon: 'warning', title: "Access Denied", text: "You don’t have permission to complete this action."  });
							}else{
								Swal.fire({ icon: 'error', title: "Delete User Files", text: response.message  });
							}
						}
					}
				})
			}
		});

        });

        $(document).on('click', '.invoice_icons .view_file', function (){
            var imageSrc = $(this).closest('.invoice_box').find('img').attr('src');
            var gallery = [{ src: imageSrc, thumb: imageSrc }];
            Fancybox.show(gallery);
        })
    })
</script>

<script>
	var autoUOMListModal = [
		{
			value: "BAG",
			label: "Bags - BAG"
		},{
			value: "BGS",
			label: "BagsBGS - BGS"
		},{
			value: "BLS",
			label: "Bails - BLS"
		},{
			value: "BTL",
			label: "Bottles - BTL"
		},{
			value: "BOU",
			label: "Bou - BOU"
		},{
			value: "BOX",
			label: "Boxes - BOX"
		},{
			value: "BKL",
			label: "Buckles - BKL"
		},{
			value: "BLK",
			label: "Bulk - BLK"
		},{
			value: "BUN",
			label: "Bunches - BUN"
		},{
			value: "BDL",
			label: "Bundles - BDL"
		},{
			value: "CAN",
			label: "Cans - CAN"
		},{
			value: "CTS",
			label: "Carats - CTS"
		},{
			value: "CTN",
			label: "Cartons - CTN"
		},{
			value: "CAS",
			label: "Cases - CAS"
		},{
			value: "CMS",
			label: "Centimeter - CMS"
		},{
			value: "CHK",
			label: "Chauka - CHK"
		},{
			value: "CHI",
			label: "Chest - CHI"
		},{
			value: "CLS",
			label: "Coils - CLS"
		},{
			value: "COL",
			label: "Collies - COL"
		},{
			value: "CRI",
			label: "Crates - CRI"
		},{
			value: "CCM",
			label: "Cubic Centimeter - CCM"
		},{
			value: "CFT",
			label: "Cubic Feet - CFT"
		},{
			value: "CIN",
			label: "Cubic Inches - CIN"
		},{
			value: "CBM",
			label: "Cubic Meter - CBM"
		},{
			value: "CQM",
			label: "Cubic Meters - CQM"
		},{
			value: "CYL",
			label: "Cylinder - CYL"
		},{
			value: "DAY",
			label: "Days - DAY"
		},{
			value: "SDM",
			label: "Decameter Square - SDM"
		},{
			value: "DOZ",
			label: "Dozen - DOZ"
		},{
			value: "DRM",
			label: "Drums - DRM"
		},{
			value: "FTS",
			label: "Feet - FTS"
		},{
			value: "FLK",
			label: "Flasks - FLK"
		},{
			value: "GMS",
			label: "Grams - GMS"
		},{
			value: "GGR",
			label: "Great Gross - GGR"
		},{
			value: "TON",
			label: "Greate Britain Ton - TON"
		},{
			value: "GRS",
			label: "Gross - GRS"
		},{
			value: "GYS",
			label: "Gross Yards - GYS"
		},{
			value: "HBK",
			label: "Habbuck - HBK"
		},{
			value: "HKS",
			label: "Hanks - HKS"
		},{
			value: "HRS",
			label: "Hours - HRS"
		},{
			value: "INC",
			label: "Inches - INC"
		},{
			value: "IND",
			label: "Inch Dia - IND"
		},{
			value: "INM",
			label: "Inch Meter - INM"
		},{
			value: "JAR",
			label: "Jar - JAR"
		},{
			value: "JOB",
			label: "Job - JOB"
		},{
			value: "JTA",
			label: "Jotta - JTA"
		},{
			value: "KGS",
			label: "Kilograms - KGS"
		},{
			value: "KLR",
			label: "Kiloliter - KLR"
		},{
			value: "KME",
			label: "Kilometers - KME"
		},{
			value: "KMS",
			label: "Kilometers - KMS"
		},{
			value: "KW",
			label: "Kilowatt - KW"
		},{
			value: "LTR",
			label: "Liters - LTR"
		},{
			value: "LIN",
			label: "Lines - LIN"
		},{
			value: "LOAD",
			label: "Load - LOAD"
		},{
			value: "LOG",
			label: "Logs - LOG"
		},{
			value: "LOT",
			label: "Lots - LOT"
		},{
			value: "LS",
			label: "Lumpsum - LS"
		},{
			value: "MTR",
			label: "Meter - MTR"
		},{
			value: "MTS",
			label: "Metric Ton - MTS"
		},{
			value: "MGS",
			label: "Milli Grams - MGS"
		},{
			value: "MLT",
			label: "Milli Litre - MLT"
		},{
			value: "MMT",
			label: "Milli Meter - MMT"
		},{
			value: "MO",
			label: "Month - MO"
		},{
			value: "MIN",
			label: "Minute - MIN"
		},{
			value: "NOS",
			label: "Numbers - NOS"
		},{
			value: "ODD",
			label: "Odds - ODD"
		},{
			value: "OTH",
			label: "Others - OTH"
		},{
			value: "PKG",
			label: "Package - PKG"
		},{
			value: "PKT",
			label: "Packet - PKT"
		},{
			value: "PKD",
			label: "Peck - Dry Measure - PKD"
		},{
			value: "PAC",
			label: "Packs - PAC"
		},{
			value: "PAI",
			label: "Pails - PAI"
		},{
			value: "PRS",
			label: "Pairs - PRS"
		},{
			value: "PLT",
			label: "Pallets - PLT"
		},{
			value: "PCS",
			label: "Pieces - PCS"
		},{
			value: "LBS",
			label: "Pounds - LBS"
		},{
			value: "QTR",
			label: "Quarter - QTR"
		},{
			value: "QTL",
			label: "Quintal - QTL"
		},{
			value: "REL",
			label: "Reels - REL"
		},{
			value: "RIM",
			label: "RIM - RIM"
		},{
			value: "ROL",
			label: "Rolls - ROL"
		},{
			value: "RFT",
			label: "Running Feet - RFT"
		},{
			value: "RM",
			label: "Running Meter - RM"
		},{
			value: "SET",
			label: "Sets - SET"
		},{
			value: "SHT",
			label: "Sheets - SHT"
		},{
			value: "SLB",
			label: "Slabs - SLB"
		},{
			value: "SQC",
			label: "Sqaure Centimeters - SQC"
		},{
			value: "SQF",
			label: "Sqaure Feet - SQF"
		},{
			value: "SQI",
			label: "Square Inches - SQI"
		},{
			value: "SQM",
			label: "Square Meter - SQM"
		},{
			value: "SQY",
			label: "Square Yards - SQY"
		},{
			value: "BLO",
			label: "Steel Blocks - BLO"
		},{
			value: "STR",
			label: "Strings - STR"
		},{
			value: "TBL",
			label: "Tables - TBL"
		},{
			value: "TBS",
			label: "Tablets - TBS"
		},{
			value: "TGM",
			label: "Ten Gross - TGM"
		},{
			value: "THD",
			label: "Thousands - THD"
		},{
			value: "TIN",
			label: "Tins - TIN"
		},{
			value: "TOL",
			label: "Tola - TOL"
		},{
			value: "TRK",
			label: "Trunk - TRK"
		},{
			value: "TUB",
			label: "Tubes - TUB"
		},{
			value: "UGS",
			label: "US Gallons - UGS"
		},{
			value: "UNT",
			label: "Units - UNT"
		},{
			value: "VLS",
			label: "Vials - VLS"
		},{
			value: "CSK",
			label: "Wooden Cases - CSK"
		},{
			value: "YDS",
			label: "Yards - YDS"
		},{
			value: "YO",
			label: "Year - YO"
		}	];
</script>
<script>
	var countuomsection = 0;
	var autoSecondUOMListModal = autoUOMListModal;
	$(document).ready(function() {

		$("#uommodal").autocomplete({
			source: autoUOMListModal,
			change: function(event, ui) {
				if (ui.item == null || ui.item == undefined) {} else {
					if (ui.item) {
						$("#uommodal").val(ui.item.value);
					}
				}
			},
			select: function(event, ui) {
				var olduom = $("#ProductModal #uommodal").attr('data-value');
				$("#uommodal").val(ui.item.value);
				$("#ProductModal #uommodal").attr('data-value',ui.item.value);
				$('#ProductModal').find('.uom-base-unit').text(ui.item.value);
				$('#ProductModal').find('[name="secoundry_unit[]"][value='+ui.item.value+']').closest('.conversion-uom-section').remove();
				var previousSection = $('#ProductModal .uom-conversion-section').find('.conversion-uom-section:last');
				previousSection.find('.removeUnitRates').after(`<div class="btn btn-primary right_modal_btn addUnitRates btnaddmoreoption"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></div>`);
				previousSection.find('.removeUnitRates').remove('.removeUnitRates');
				if(autoSecondUOMListModal != '' && autoSecondUOMListModal != undefined){
					autoSecondUOMListModal = $.grep(autoSecondUOMListModal, function (element, index) {
					    return element.value != ui.item.value;
					});
					if(olduom != ''){
						var adduom = $.grep(autoUOMListModal, function (element, index) {
						    return element.value == olduom;
						});
						if (adduom.length > 0) {
		                    autoSecondUOMListModal.push(adduom[0]);
		                    autoSecondUOMListModal.sort((a, b) => a.label.localeCompare(b.label));
		                }
					}
				}
			
				return false;
			},
			minLength: 0
		}).focus(function() {
			$(this).autocomplete("search");
		});


		$('.balance_amount,.balance_amount_vendor').keyup(function(){
			getBalanceAmount();
		});
		
		$('.balance_type,.balance_type_vendor').change(function(){
			getBalanceAmount();
		});
		
	});
	$('#CustomerModalForm .balance_type').trigger("change");
	function getBalanceAmount() {
			var balance_type = $('.balance_type:checked').val();	
			var balance_amount = $('.balance_amount').val();	
			var balance_type_vendor = $('.balance_type_vendor:checked').val();	
			var balance_amount_vendor = $('.balance_amount_vendor').val();	
			if(balance_type != undefined  && balance_amount != ''){
				var payText = '';
				var color = '';
				if(balance_type.trim() == 'Credit'){payText = 'You pay the customer';	color = 'red';}else{payText = 'Customer pays you';color = 'green';}
				$('.amountTextLbl').css('color',color).text('₹ '+balance_amount+' '+payText);
			}
			if(balance_type_vendor != undefined && balance_amount_vendor != ''){
				var payText = '';
				var color = '';
				if(balance_type_vendor.trim() == 'Credit'){payText = 'You pay the vendor';	color = 'red';}else{payText = 'Vendor pays you';color = 'green';}
				$('.amountTextLbl_vendor').css('color',color).text('₹ '+balance_amount_vendor+' '+payText);
			}
			

	}


</script>

<div id="ProductModal" class=" popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="ProductModalForm">
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add Product / Service</h4>
				</div>
				<div class="modal-body">
					<script>
						var productVarient1 = [];
						var productVarient2 = [];
						var productVarient3 = [];
						var productVarient4 = [];
					</script>
										
					<script>
										</script>
					<script>
						$(document).ready(function() {

							if ($(".attrib-combobox-1").length > 0) {
								$(".attrib-combobox-1").autocomplete({
									source: productVarient1,
									change: function(event, ui) {
										if (ui.item == null || ui.item == undefined) {
											$("[name='hidden-attrib-1-val']").val("");
										} else {
											if (ui.item) {
												$("[name='hidden-attrib-1-val']").val(ui.item.label);
												$(event.target).val(ui.item.label);
											}
										}
									},
									select: function(event, ui) {
										$("[name='hidden-attrib-1-val']").val(ui.item.label);
										$(event.target).val(ui.item.label);
										return false;
									},
									minLength: 0
								}).focus(function() {
									$(this).autocomplete("search");
								});
							}
							if ($(".attrib-combobox-2").length > 0) {
								$(".attrib-combobox-2").autocomplete({
									source: productVarient2,
									change: function(event, ui) {
										if (ui.item == null || ui.item == undefined) {
											$("[name='hidden-attrib-2-val']").val("");
										} else {
											if (ui.item) {
												$("[name='hidden-attrib-2-val']").val(ui.item.label);
												$(event.target).val(ui.item.label);
											}
										}
									},
									select: function(event, ui) {
										$("[name='hidden-attrib-2-val']").val(ui.item.label);
										$(event.target).val(ui.item.label);
										return false;
									},
									minLength: 0
								}).focus(function() {
									$(this).autocomplete("search");
								});
							}
							if ($(".attrib-combobox-3").length > 0) {
								$(".attrib-combobox-3").autocomplete({
									source: productVarient3,
									change: function(event, ui) {
										if (ui.item == null || ui.item == undefined) {
											$("[name='hidden-attrib-3-val']").val("");
										} else {
											if (ui.item) {
												$("[name='hidden-attrib-3-val']").val(ui.item.label);
												$(event.target).val(ui.item.label);
											}
										}
									},
									select: function(event, ui) {
										$("[name='hidden-attrib-3-val']").val(ui.item.label);
										$(event.target).val(ui.item.label);
										return false;
									},
									minLength: 0
								}).focus(function() {
									$(this).autocomplete("search");
								});
							}
							if ($(".attrib-combobox-4").length > 0) {
								$(".attrib-combobox-4").autocomplete({
									source: productVarient4,
									change: function(event, ui) {
										if (ui.item == null || ui.item == undefined) {
											$("[name='hidden-attrib-4-val']").val("");
										} else {
											if (ui.item) {
												$("[name='hidden-attrib-4-val']").val(ui.item.label);
												$(event.target).val(ui.item.label);
											}
										}
									},
									select: function(event, ui) {
										$("[name='hidden-attrib-4-val']").val(ui.item.label);
										$(event.target).val(ui.item.label);
										return false;
									},
									minLength: 0
								}).focus(function() {
									$(this).autocomplete("search");
								});
							}
						});
					</script>

					<fieldset>
					<div class="control-group ">
                        <h4><svg width="24" height="24"><use href="svg-icon/icons.svg#note-detail-svg-icon"></use></svg> Product Detail</h4> <hr>
							<label for="Company Type" class="control-label">Item Type</label>
							<div class="controls input-prepend-small feedback-resolve">
									<label class="radio inline">
									   <input type="radio" value="Product" checked name="itemType" id="itemType-P"> Product 
                                       <span class="checkmark"></span>
                                    </label>
									<label class="radio inline">
    									<input type="radio" value="Service" name="itemType" id="itemType-S"> Service 
                                        <span class="checkmark"></span>
                                    </label>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="name" class="control-label">Name<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="name" id="name" class="span4" placeholder="Enter your product / service name" maxlength="490" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">	
							<label class="control-label">Product Note</label>	
							<div class="controls">
								<textarea id="product_note" name="product_note" class="span4" ></textarea>					
							</div><!-- /controls -->	
						</div><!-- /control-group -->
												<div class="control-group generate_barcode-field">
						<label for="name" class="control-label">Barcode/Serial No.</label>
						<div class="controls" style="position:relative;">
							<input type="text" name="barcode_no" id="barcode_no" class="span4 valid" oninput="this.value = this.value.toUpperCase()" placeholder="Enter Barcode No. or Scan it" maxlength="40" aria-invalid="false">
						</div><!-- /controls -->
						</div><!-- /control-group -->
						<div class="control-group">
							<label for="name" class="control-label">HSN/SAC Code</label>
							<div class="controls hsn_field" style="position:relative;">
							<input type="text" name="hsn" id="hsn" class="span4" placeholder="Enter your HSN code" maxlength="20">
							 	<a class="ViewhsnFinder" data-baseLink="goods_service_finder.php"&backUrl=bGlzdC1wcm9kdWN0LnBocD8=><div class="btn div-inner-input">Find</div></a>
							</div>
						</div>

						<div class="control-group">
							<label for="name" class="control-label">Unit of Measurement</label>
							<div class="controls" style="position:relative;">
								<input type="text" name="uom" data-value="" id="uommodal" class="span4" placeholder="Enter Unit of Measurement" maxlength="20">
								<div class="btn uomconversionbtn div-inner-input" >Conversion</div>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="controls uom-conversion-section addmore-section" style="display:none;">
							
						</div>

						<h4 class="has_modal_lbl"> <svg width="24" height="24"><use href="svg-icon/icons.svg#price-detail-svg-icon"></use></svg> Tax & Pricing</h4> <hr>


						<div class="control-group">
							<label for="name" class="control-label">Tax <span class="star_red">*</span></label>
							<div class="controls">
								<select name="gstval" id="gstval" class="span4" required>
									<option value="">Select Tax</option>
									<option value="0.1">0.1</option>
									<option value="0.25">0.25</option>
									<option value="0.5">0.5</option>
									<option value="1">1</option>
									<option value="1.5">1.5</option>
									<option value="3">3</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7.5">7.5</option>
									<option value="12">12</option>
									<option value="18">18</option>
									<option value="28">28</option>		
									<option value="Nil Rated">Nil Rated</option>
									<option value="Exempt">Exempt</option>
									<option value="Non-GST">Non-GST</option>			
								</select>
								<input type="hidden" name="taxability" id="taxability"  class="span4">
								<input type="hidden" name="igst" id="igst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
								<input type="hidden" name="cgst" id="cgst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
								<input type="hidden" name="sgst" id="sgst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="CESS" class="control-label">CESS %</label>
							<div class="controls">
								<input type="text" name="cess" id="cess" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your CESS " maxlength="5">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						
						<div class="control-group">
							<label for="CESS Amount" class="control-label">CESS Amount</label>
							<div class="controls" style="display: flex; align-items: center; border: 1px solid #ccc; border-radius: 8px; overflow: hidden;">
								<input type="text" name="cess_amount" id="cess_amount" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your CESS Amount " maxlength="10" style="border:none; border-right: 1px solid #ccc;border-radius:0px">
								<select name="cess_type" id="cess_type" style="border: none; height: 100%; background: white;width: 185px;outline:none;">
									<option value="0">Fixed</option>
									<option value="1">Per Unit</option>
								</select>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label">No-ITC</label>
							<div class="controls">
								<div class="form-check"><label class="form-check-label">
										<input type="checkbox" id="no_itc" name="no_itc"> Is Product ineligible for Input Credit?</input>
										<i class="input-frame"></i></label>
                                </div>
							</div><!-- /controls -->
						</div><!-- /control-group -->
						
						<div class="control-group MngstockOption" style="margin-bottom: 18px;">
						<h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#note-detail-svg-icon"></use></svg> Manage Stock</h4> <hr>
							<label for="name" class="control-label">Type</label>
							<div class="controls input-prepend-small feedback-resolve">
									<label class="radio inline">
									<input type="radio" value="Normal" checked name="stockType" > Normal <span class="checkmark"></span></label>
									<label class="radio inline not-allowed-batch">
									<input type="radio" value="Batch" name="stockType"> Batch <span class="checkmark"></span></label>
									<label class="radio inline not-allowed-batch">
									<input type="radio" value="Serial" name="stockType"> Serial No. <span class="checkmark"></span></label>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="normal-section ">
							<!-- <h4 class="has_modal_lbl changeStockName">Normal Stock 
							</h4>
							<hr> -->
							
							<div class="serialno-section "   style="display: none;">
								<div class="control-group">
									<label for="name" class="control-label">Serial No(s).</label>
									<div class="controls">
										<input type="hidden" name="serialno" id="tagInputs" class="span4"/>
									</div> <!-- /controls -->
								</div>
							</div>

							<div class="normalOpt stockOption control-group ">
								<label for="name" class="control-label">Available Qty</label>
								<div class="controls">
									<input type="text" name="items_available" id="items_available" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your available qty " maxlength="8">
								</div> <!-- /controls -->
							</div>
							<div class="normalOpt">
								<hr class="hide-hr">
								<div class="control-group">
									<label for="Sell Price" class="control-label">Sell Price</label>
									<div class="controls">
										<input type="text" name="sellprice" id="sellprice" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your sell price" maxlength="10">
									</div> <!-- /controls -->
								</div> <!-- /control-group -->

								<div class="control-group">
									<label for="Sell Price" class="control-label">Sell Price (Incl. Tax)</label>
									<div class="controls">
										<input type="text" name="sellprice_incl_tax" id="sellprice_incl_tax" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your sell price (Incl. Tax)" maxlength="10">
									</div> <!-- /controls -->
								</div> <!-- /control-group -->
								<div class="control-group">
									<label for="Purchase Price" class="control-label">Purchase Price</label>
									<div class="controls">
										<input type="text" name="purchaseprice" id="purchaseprice" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your purchase price" maxlength="10">
									</div> <!-- /controls -->
								</div> <!-- /control-group -->
								<div class="control-group">
									<label for="Purchase Price" class="control-label">Purchase Price (Incl. Tax)</label>
									<div class="controls">
										<input type="text" name="purchaseprice_incl_tax" id="purchaseprice_incl_tax" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter your purchase price (Incl. Tax)" maxlength="10">
									</div> <!-- /controls -->
								</div> <!-- /control-group -->	
								
								
								<div class="control-group">
									<label  class="control-label">Low Stock Alert</label>
										<div class="controls">			
											<label class="form-check-label">
												<input type="text" id="product_lsa" name="product_lsa" placeholder="Low Stock Alert"></input> 	
												<i class="input-frame"></i></label>
										</div><!-- /controls -->	
								</div> <!-- /control-group -->	
							</div> <!-- /control-group -->	
						</div>

						<div class="batch-section" style="display: none;">
							<h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#batch-svg-icon"></use></svg>Batch Stock
							</h4>
							<hr>
							<div class="batchOpt">
								<table class="table  table-bordered">
									<thead>
										<tr>
											<th>Batch No.</th>																																																							 <th class="batchQty">Quantity</th> 																						<th>Sale Price</th>
											<th>Sale Price (Incl. Tax)</th>
											<th>Purchase Price</th>
											<th>Purchase Price (Incl. Tax)</th>
											<th></th>
										</tr>
									</thead>
									<tbody>
										
									</tbody>
								</table>	
							</div>
							<div class="control-group">
								<label  class="control-label">Low Stock Alert</label>
									<div class="controls">			
										<label class="form-check-label">
											<input type="text" id="product_lsa_batch" name="product_lsa" placeholder="Low Stock Alert"></input> 	
											<i class="input-frame"></i></label>
									</div><!-- /controls -->	
							</div> <!-- /control-group -->
						</div>
                        <div class="has_modal_lbl">
						<h4 ><svg width="24" height="24"><use href="svg-icon/icons.svg#box-svg-icon"></use></svg> Product Group <div class="btn btn-primary right_modal_btn has_modal_lbl_btn addProductCategory"><svg width="24" height="24"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg>Add Product Group</div></div>
						</h4>
						<hr>

						<div class="control-group">											
							<label for="name" class="control-label">Product Group </label>
							<div class="controls">
								<select class="product_group_id" multiple="multiple" name="product_category_id[]">
								</select>
							</div> <!-- /controls -->	
						</div> <!-- /control-group -->

						<div class="controls cate_section categoryOpt" style="display:none;">
							<label for="categoryname" class="control-label">Product Group Name</label>
							<input type="text" class="categoryname" placeholder="Enter your product group name" maxlength="500" onkeydown="enterpressFunction(event.keyCode);">
							<input type="hidden" id="cathmac" value="59e33dae65e72b6bb952" />
							<a class="btn btn-primary catesave">Save</a>
						</div>

                        <h4 class="has_modal_lbl"><svg width="24" height="24"><use href="svg-icon/icons.svg#additional-note-svg-icon"></use></svg> Additional Details </h4>
                        <hr>
                        
						
												
						<div class="control-group">
                            <label for="CESS Amount" class="control-label">Product Discount</label>
                            <div class="controls" style="display: flex; align-items: center; border: 1px solid #ccc; border-radius: 8px; overflow: hidden;">
                                <input type="text" name="product_disc" id="product_disc" class="span4" placeholder="Enter product discount " maxlength="10" style="border:none; border-right: 1px solid #ccc;border-radius:0px">
                                <select name="product_disc_in" id="product_disc_in" style="border: none; height: 100%; background: white;width: 185px;outline:none;">
                                    <option value="rupee">Rupee</option>
                                    <option value="percentage">Percentage</option>
                                </select>
                            </div>
                        </div>
						
						<div class="control-group product_dropzone">
							<label class="control-label">Product Images</label>
							<div class="controls product-dropzone">

                                    <div class="dropzone  lockeddrop" data-target="#trialModal_gst" " id="id_dropzone" ></div>
                                    <div id="product_error_msg" style="color: red"></div>
            
                                 
							</div><!-- /controls -->
						</div><!-- /control-group -->

                        <!-- <div class="control-group">
							<label for="product discount" class="control-label product_length">Product Length (CM)</label>
							<div class="controls product_len" style="position:relative;">
								<input type="text" class="span2" id="product_len" name="product_len" placeholder="Product Length">
							</div> 
						</div>

                        <div class="control-group">
							<label for="product discount" class="control-label product_breadth">Product Breadth (CM)</label>
							<div class="controls product_brdth" style="position:relative;">
								<input type="text" class="span2" id="product_brdth" name="product_brdth" placeholder="Product Breadth">
							</div>
						</div> 

                        <div class="control-group">
							<label for="product discount" class="control-label product_height">Product Height (CM)</label>
							<div class="controls product_ht" style="position:relative;">
								<input type="text" class="span2" id="product_ht" name="product_ht" placeholder="Product Height">
							</div>
						</div> 

                        <div class="control-group">
							<label for="product discount" class="control-label product_weight">Product Weight (KG)</label>
							<div class="controls product_wt" style="position:relative;">
								<input type="text" class="span2" id="product_wt" name="product_wt" placeholder="Product Weight">
							</div>
						</div>  -->

						<div class="control-group">
							<label class="control-label">Non-Sellable Product</label>
							<div class="controls">
								<div class="form-check">
                                    <label class="form-check-label">
                                        <input type="checkbox" id="non_salable_product" name="non_salable_product"> Selling and inventory tracking for this product will be disabled</input>
                                        <i class="input-frame"></i>
                                        <span data-toggle="tooltip" title="Non-sellable items are not for direct sale but used internally, like packing materials, office supplies, or for internal processes." class='non-salable-tooltip' ><svg width="12" height="12"><use href="svg-icon/icons.svg#info-dark-svg-icon"></use></svg></span>
                                    </label>
                                </div>
							</div><!-- /controls -->
						</div><!-- /control-group -->
						<div class="control-group enableProduct" style="display:none;"> 	
							<label class="control-label">Enable</label>	
							<div class="controls">			
								<div class="form-check"><label class="form-check-label">
									<input type="checkbox" id="is_active" name="is_active" checked="checked"> Product will be visiable on all document.</input>	
									<i class="input-frame"></i></label></div>
							</div><!-- /controls -->	
						</div><!-- /control-group -->


												<input type="hidden" name="hmac" id="hmac" value="e5e2057aff8004c1369b" />
						<input type="hidden" name="oldstockType" class="oldstockType" value="" />
						<input type="hidden" name="totalStock" class="totalStock" value="" />
						<input type="hidden" name="NewStock" class="NewStock" value="0" />
					</fieldset>
					<div id="PrIntHsnModal" class="modal popup_right_slider fade" role="dialog" style="display: none;">
						<div class="modal-dialog">
								<div class="modal-content is-loading">
									<div id="iframeContainer">
										<iframe name="print_iframe" id="hsn_iframe" src="" frameborder="0" style="width:100%;height:100vh;float:left;"></iframe>
									</div>
									<div class="preloader-overly">
									<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="80px" height="80px" viewBox="0 0 128 128" xml:space="preserve"><g><path fill="#00ba8c" fill-opacity="1" d="M109.25 55.5h-36l12-12a29.54 29.54 0 0 0-49.53 12H18.75A46.04 46.04 0 0 1 96.9 31.84l12.35-12.34v36zm-90.5 17h36l-12 12a29.54 29.54 0 0 0 49.53-12h16.97A46.04 46.04 0 0 1 31.1 96.16L18.74 108.5v-36z"></path><animateTransform attributeName="transform" type="rotate" from="0 64 64" to="360 64 64" dur="880ms" repeatCount="indefinite"></animateTransform></g></svg>
									</div>
								</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	Dropzone.autoDiscover = false;
	$(document).ready(function () {
        $('.lockeddrop').click(function () { $('#addRemoveModal').modal('show').css('z-index', Math.max(...$('.modal').map((_, e) => +$(e).css('z-index'))) + 10); });
			
		var totalProductFiles = 0;
        var uploadedProductFiles = 0;

		arrayData = [];
		var image_box = "";
		$("#id_dropzone").dropzone({
			maxFiles: 5,
			maxFilesize: 2, 
			dictDefaultMessage: "<div style='display-flex; flex-direction:column;'><img src='assets/svgs/image_icon.svg'><p style='font-weight:bold;'>Click To Upload</p></div>",
			acceptedFiles: '.jpeg,.png,.jpg',
			url: "file-upload-ajaxcall.php",
			params: {
				upload_type: 1			},
			clickable: false,        });

            $(document).on("click", ".product_box .eye", function(e) {
			var imageSrc = $(this).closest('.product_box').find('img').attr('src');
			var gallery = [
				{
					src: imageSrc,
					thumb: imageSrc,
				},
			];
			Fancybox.show(gallery);
			
		});
		$(document).on("click", ".product_box .trash", function(e) {
			$(this).parent('.product_box').find('input[name="file_id[]"]').attr('name', 'deleted_file_id[]');
			$(this).parent('.product_box').find('input[name="file_name[]"]').attr('name', 'deleted_file_name[]');
			$(this).parent('.product_box').hide();
		});
	});
</script>

<div id="Get-whatsapp-email-Modal" class="modal fade" role="dialog" style="display: none;">
  <div class="modal-dialog">
  <form class="form-horizontal" method="post" id="PaymentModalForm" novalidate="novalidate">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="btn btn-default btn_close" data-dismiss="modal" ><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
        <h4 class="modal-title">Enter Mobile No</h4>
      </div>
      <div class="modal-body">
			<fieldset>
				<div class="control-group">											
					<label for="name" class="control-label">Mobile No</label>
					<div class="controls">
						<input type="text"  name="filed-input" id="filed-input" class="span4">
						<span id="error_message" style="color:red;"></span></div>				
				</div>
			</fieldset>
      </div>
      <div class="modal-footer">
			<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg> Send</button> 
			<button type="button" class="btn btn-default" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
      </div>
    </div>
	</form>
  </div>
</div>

<div id="TransportChargeModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="TransportChargeModalForm">
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add Additional Charges</h4>
				</div>
				<div class="modal-body">

					<fieldset>
						<div class="control-group">
							<label for="name" class="control-label">Name<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="name" id="name" class="span4" placeholder="Enter additional charge name" maxlength="500" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">	
							<label class="control-label">Product Note</label>	
							<div class="controls">
								<textarea id="product_note" name="product_note" class="span4" ></textarea>					
							</div><!-- /controls -->
						</div><!-- /control-group -->

						<div class="control-group">
							<label for="Sell Price" class="control-label">Price</label>
							<div class="controls">
								<input type="text" name="sellprice" id="sellprice" onkeypress="return allowOnlyNumber(event);" class="span4" placeholder="Enter price" maxlength="10">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label for="name" class="control-label">HSN/SAC Code</label>
							<div class="controls">
								<input type="text" name="hsn" id="hsn" class="span4" placeholder="Enter your HSN code" maxlength="20">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label class="control-label">No-ITC</label>
							<div class="controls">
								<div class="form-check"><label class="form-check-label">
										<input type="checkbox" id="no_itc" name="no_itc"> Is Product ineligible for Input Credit?</input>
										<i class="input-frame"></i></label></div>
							</div><!-- /controls -->
						</div><!-- /control-group -->
						<div class="control-group">
							<label for="name" class="control-label">Tax <span class="star_red">*</span></label>
							<div class="controls">
								<select name="gstval" id="gstval" class="span4" required>
									<option value="">Select Tax</option>
									<option value="0.1">0.1</option>
									<option value="0.25">0.25</option>
									<option value="0.5">0.5</option>
									<option value="1">1</option>
									<option value="1.5">1.5</option>
									<option value="3">3</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7.5">7.5</option>
									<option value="12">12</option>
									<option value="18">18</option>
									<option value="28">28</option>		
									<option value="Nil Rated">Nil Rated</option>
									<option value="Exempt">Exempt</option>
									<option value="Non-GST">Non-GST</option>			
								</select>
								<input type="hidden" name="taxability" id="taxability"  class="span4">
								<input type="hidden" name="igst" id="igst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
								<input type="hidden" name="cgst" id="cgst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
								<input type="hidden" name="sgst" id="sgst" onkeypress="return allowOnlyNumber(event);" class="span4"  maxlength="5">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
							<label class="control-label">Service Item</label>
							<div class="controls">
								<div class="form-check"><label class="form-check-label">
										<input type="checkbox" id="is_service_product" name="is_service_product">Check if it is service, Ex - Computer Service, Consulting Services (No Stock Count)</input>
										<i class="input-frame"></i></label></div>
							</div><!-- /controls -->
						</div><!-- /control-group -->

						<div class="control-group enableAdditional" style="display:none;">	
							<label class="control-label">Enable</label>	
							<div class="controls">			
								<div class="form-check"><label class="form-check-label">
									<input type="checkbox" checked id="is_active" name="is_active" >Additional Charge will be visiable on all document.</input>	
								<i class="input-frame"></i></label></div>
							</div><!-- /controls -->	
						</div><!-- /control-group -->
						<input type="hidden" name="hmac" id="hmac" value="311674aca606f8196fa7" />
					</fieldset>
				</div>
				<div class="modal-footer">
					<a href="list-transport-charges.php" target="_blank" class="btn btn-primary Margin_Bottom_btn" style="float:left;"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>View All Additional Charges</a>					<a type="button" class="btn btn-default Margin_Bottom_btn pull-left" data-dismiss="modal" style="background: #D9D9D9;border-color: #D9D9D9;"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</a>
					<button class="btn btn-primary Margin_Bottom_btn" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div id="ProductCategoryModal" class=" popup_right_slider modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="ProductCategoryModalForm">
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Add Product Group</h4>
				</div>
				<div class="modal-body">
					<fieldset>
						<div class="control-group">
							<label for="name" class="control-label">Name<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="category_name" id="name" class="span4" placeholder="Enter your product group name" maxlength="500" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group enableCategory" style="display: none;"> 	
							<label class="control-label">Enable</label>	
							<div class="controls">			
								<div class="form-check"><label class="form-check-label">
									<input type="checkbox" id="is_active" name="is_active" checked="checked"> Product Group will be visiable on all document.	
									<i class="input-frame"></i></label></div>
							</div><!-- /controls -->	
						</div>
						
												<input type="hidden" name="hmac" id="hmac" value="59e33dae65e72b6bb952" />
					</fieldset>

				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div id="extendewaymodal" class="modal popup_right_slider fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="extendewaymodalForm">
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Extend Eway Bill</h4>
				</div>
				<div class="modal-body">
					<fieldset>
						<div class="control-group">
							<label for="validtill" class="control-label">Eway Bill Valid till<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="valid_till" id="valid_till" class="span4"  required>
								<input type="hidden" name="ewayID" id="ewayID">
								<input type="hidden" name="invid" id="invid">
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="ext_reason" class="control-label">Extension Reason<span class="star_red">*</span></label>
							<div class="controls">
							<select type="list" name="ext_reason" class="span4 ext_reason"  required>
								<option value="">Select Extension Reason</option>
								<option value="1">Natural Calamity</option>
								<option value="2">Law and Order Situation</option>
								<option value="4">Transshipment</option>
								<option value="5">Accident</option>
								<option value="99">Others</option>
								</select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="ext_remark" class="control-label">Extension Remarks<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="ext_remark" id="ext_remark" class="span4"  required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="cur_place" class="control-label">Current Place<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="cur_place" id="cur_place" class="span4"  required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="cur_pincode" class="control-label">Current Pincode<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="cur_pincode" id="cur_pincode" class="span4"  required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="to_pincode" class="control-label">Destination Pincode<span class="star_red">*</span></label>
							<div class="controls">
								<label type="text" id="to_pincode_label" class="span4 to_pincode_label"></label>
								<input type="hidden" name="to_pincode" id="to_pincode" class="span4 to_pincode"></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->

						<div class="control-group">
						<label for="eway_distance" class="control-label">Approximate Distance </label>
							<div class="controls">
								<input type="text" name="eway_distance" id="eway_distance" class="span4" >
								<label for="auto-distance" class="">Auto Calculated Distance <span class="auto-distance"> </span></label>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
						<label for="cur_state" class="control-label">Current State<span class="star_red">*</span></label>
							<div class="controls">
								<select type="list" name="cur_state" class="span4 all_state_list"  required></select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
						<label for="address_line_1" class="control-label">Address 1</label>
							<div class="controls">
								<input type="text"  name="address_line_1" class="span4 address_line_1" disabled></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
						<label for="address_line_2" class="control-label">Address 2</label>
							<div class="controls">
								<input type="text"  name="address_line_2" class="span4 address_line_2" disabled></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
						<label for="address_line_3" class="control-label">Address 3</label>
							<div class="controls">
								<input type="text"  name="address_line_3" class="span4 address_line_3" disabled></input>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="consignment_in" class="control-label">Consignment Is<span class="star_red">*</span></label>
							<div class="controls">
								<input type="hidden" name="consignment_in_hidden" class="consignment_in_hidden">
								<select type="list" name="consignment_in" class="span4 consignment_in"  required>
									<option value="M">in Movement</option>
									<option value="T">in Transit</option>
								</select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="trans_mode" class="control-label">Transport Mode<span class="star_red">*</span></label>
							<div class="controls">
								<select type="list" name="trans_mode" class="span4 trans_mode"  required>
								<option value="">Select Transport Mode</option>
								<option value="1">Road</option>
								<option value="2">Rail</option>
								<option value="3">Air</option>
								<option value="4">Ship</option>
								<option value="5">in Transit</option>
								</select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="transport_no" class="control-label">Transport No<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="transport_no" id="transport_no" class="span4" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="transit_type" class="control-label">Transmit Type<span class="star_red">*</span></label>
							<div class="controls">
								<select type="list" name="transit_type" class="span4 transit_type"  required>
								<option value="">Select Transmit Type</option>
								<option value="R">Road</option>
								<option value="W">Warehouse</option>
								<option value="O">Others</option>
								</select>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
						<div class="control-group">
							<label for="vehicle_no" class="control-label">vehicle No<span class="star_red">*</span></label>
							<div class="controls">
								<input type="text" name="vehicle_no" id="vehicle_no" class="span4" placeholder="GJ01TR1234" required>
							</div> <!-- /controls -->
						</div> <!-- /control-group -->
					</fieldset>

				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" name="btnsubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div id="cancelEwayBillModal" class="modal fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="cancelEwayBillForm" style="margin: 0;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Cancel E-Way Bill</h4>
				</div>
				<div class="modal-body">
					<div class="control-group">											
						<label for="eway_cancel_reason" class="control-label">Reason<span class="star_red">*</span></label>
						<div class="controls">
							<select name="eway_cancel_reason" class="span4" id="eway_cancel_reason" required>
								<option value="">Select Reason</option>
								<option value="1">Duplicate</option>
								<option value="2" selected>Order Cancelled</option>
								<option value="3">Data Entry Mistake</option>
								<option value="4">Others</option>
							</select>
						</div>	
					</div> 
					<div class="control-group">											
						<label for="eway_cancel_remarks" class="control-label">Remarks</label>
						<div class="controls">
							<textarea name="eway_cancel_remarks" id="eway_cancel_remarks" class="span4" placeholder="Remarks"></textarea>
						</div>		
					</div>
				</div>
				<div class="modal-footer" style="display: flex; justify-content: end;">
					<button type="button" class="btn btn-default" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<button class="btn btn-primary" id="cancel_eway_btn" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#ban-svg-icon"></use></svg>Cancel E-Way Bill</button> 
				</div>
			</div>
		</form>
	</div>
</div>

<script>
    
 
	var addCateArr = [];
	$(document).ready(function() {
		$('.AddCustomerModal, .add_customer_modal_button').click(function(e) {
            
			var businessState = 'Karnataka';
			var isPresent = handles.includes(businessState);
			if(isPresent){
				$("#listBox option[value='"+ businessState +"']").prop("selected", true);
			} 
            		});
		$('.add_transport_charge_modal_button').click(function(e) {
            		});
		$('.add_transport_modal_button').click(function(e) {
            		});
		$('#CustomerModal .update-gstinfield').hide();

		$(document).on("change blur keypress keyup", "#CustomerModal #gstno", function(e) {
			if ($(this).val() != "" && $('#CustomerModal select[name=registration_type]').val() == 'Unregistered') {
				$("#CustomerModal select[name=registration_type]").val("Regular").change();
			} else if ($(this).val() == "") {
				$("#CustomerModal select[name=registration_type]").val("Unregistered").change();
			}
		});

		$('#CustomerModalForm').on("blur",'#companyname',function(){

			var cmpName = $('#companyname').val();
			$.ajax({
					type: "POST",
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					data: {term: cmpName,action:'checkCustomerExist'},
					beforeSend: function() {
						$("body").removeClass("is-loading");
					},
					success: function(data) {
						if (data.status == "OK") {
							var cmpExist = data.cmpExist;
							if(cmpExist != ""){
								$("#alredyExist").html("");
								$("#alredyExist").closest(".control-group").show();
								cmpExist.map(function(cmp) {
									var html = "";
									html = `<div class='span6 span-md-6 span-xs-12 span-sm-6 equal-height' style="padding:2px"><div class="getRow ">
												<h4>${cmp.companyname}</h4>
												<p>${cmp.gstno}</p>
												<p>${cmp.address}</p>
												<span class='label'>${cmp.companytype}</span>
											</div></div>`;
									$("#alredyExist").append(html);
								});
								equalheight('.equal-height');
							}else{
								$("#alredyExist").html("");
								$("#alredyExist").closest(".control-group").hide();
							}
						} 
					},
					complete: function(data) {}
				});
		});
		$.validator.addMethod("validateGSIN", function(value, element) {
			var gstinValid = true;
			var state = $("#listBox option:selected").text();
			if (value != "" && value.length == 15) {
				if (value.length != 15) {
					return false;
				}
				if (state != "") {
					state = state.replace("(New)", "");
					if (state.indexOf('(') !== -1) {
						state = state.split('(')[1];
						state = state.split(')')[0];
						state = state.trim();
						gstinValid = value.startsWith(state);
					}
				} else {
					gstinValid = true;
				}
			}
			return gstinValid;
		}, 'Entered GSTIN is invalid for the selected state.');

		jQuery.validator.addMethod("req_type_validate", function(value, element) {
			var valid_reg = false;
			var registration_type = $('select[name=registration_type]').val();
			var gstno = $('#gstno').val();
			if (registration_type == 'Unregistered' && gstno == "") {
				valid_reg = true;
			} else if (registration_type != 'Unregistered' && gstno != "") {
				valid_reg = true;
				if (registration_type != 'Regular-UIN' && gstno.length != 15) {
					valid_reg = false;
				}
			}
			return valid_reg;
		}, "Please enter valid registration type.");

		jQuery.validator.addMethod("validate_shipname", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_name[]"]').val() == "") {
						$(this).find('.ship_name_error').remove();
						$(this).find('[name="ship_name[]"]').after('<label class="error ship_name_error" >Please enter ship name</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");

		jQuery.validator.addMethod("validate_shipaddress", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_address[]"]').val() == "") {
						$(this).find('.ship_address_error').remove();
						$(this).find('[name="ship_address[]"]').after('<label class="error ship_address_error" >Please enter ship address</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");

		jQuery.validator.addMethod("validate_shiplandmark", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_landmark[]"]').val() == "") {
						$(this).find('.ship_landmark_error').remove();
						$(this).find('[name="ship_landmark[]"]').after('<label class="error ship_landmark_error" >Please enter ship landmark</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");

		jQuery.validator.addMethod("validate_shipcity", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_city[]"]').val() == "") {
						$(this).find('.ship_city_error').remove();
						$(this).find('[name="ship_city[]"]').after('<label class="error ship_city_error" >Please enter ship city</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");

		jQuery.validator.addMethod("validate_shippincode", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_pincode[]"]').val() == "") {
						$(this).find('.ship_pincode_error').remove();
						$(this).find('[name="ship_pincode[]"]').after('<label class="error ship_pincode_error" >Please enter ship landmark</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");

		jQuery.validator.addMethod("validate_shipstate", function(value, element) {
			var is_valid = true;
			if($('.shipping_address_section .shipping_address_reapiter').length > 0){
				$('.shipping_address_section .shipping_address_reapiter').each(function() {
					if ($(this).find('[name="ship_country[]"]').val() == "India" && $(this).find('[name="ship_state[]"]').val() == "") {
						$(this).find('.ship_state_error').remove();
						$(this).find('[name="ship_state[]"]').after('<label class="error ship_state_error" >Please enter ship state</label>');
						is_valid = false;
					}
				});
			}	
			return is_valid;
	
		}, "");
		
		$("#CustomerModal form").validate({
			rules: {
				field: {
					required: true
				},
				email : { multiplemail: true },
				state: {
					required: function(element) {
						return $("#listBoxCountry").val() == "India";
					}
				},
				'ship_name[]': {
					validate_shipname: true
				},
				'ship_state[]': {
					validate_shipstate: true
				},
				'ship_address[]': {
					validate_shipaddress: true
				},
				'ship_landmark[]': {
					validate_shiplandmark: true
				},
				'ship_city[]': {
					validate_shipcity: true
				},
				'ship_pincode[]': {
					validate_shippincode: true
				},
				'ship_email[]': {
					email: true
				},
				
				gstno: {
					validateGSIN: true
				},
				registration_type: {
					req_type_validate: true
				},
			},
			messages: {
				companyname: "Please enter customer / vendor name",
				contactperson: "Please select contactperson name",
				contactno1: "Please enter contact number",
				address1: "Please enter address1",
				city: "Please enter city",
				state: "Please enter state name",
				email : {validate_email: "Please enter a valid email address."}
			},
			submitHandler: function(form) {
				var data = $(form).serialize() + '&action=SubmitCustomerModel';
				$.ajax({
					type: "POST",
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					data: data,
					success: function(data) {

						if (data.status == 'OK') {
							var currentURL = window.location.href;
							pageURL = currentURL.replace(/^.*[\\\/]/, '');
							if (pageURL == "list-company.php" || pageURL.indexOf("list-company.php") != -1) {
								var mode = data.redirect.split('?')[1].split('=');
								if(mode == 'insert'){
									window.location.href = data.redirect;
								}else{
									window.location.href = data.redirect+'&'+ $("#url_string").val();
								}
							} else {
								var addressParts = [
									data.contactperson,
									data.landmark,
									data.city
								].filter(Boolean).map(part => part.trim());

								var list_address = addressParts.join(", ");
								var companyName = data.companyname?.trim() || "";
								var gst = data.gst?.trim();
								var custlabel = `${companyName}${gst ? ", " + gst : ""} (${companyName}${list_address ? ", " + list_address : ""})`;

								var newCustomer = {
									label: custlabel,
									value: data.id,
									companyname: companyName,
									companytype: data.companytype,
									gstno: gst,
									contactno1: data.phone,
									address: list_address
								};

								availableCustomer.push(newCustomer);

								$("#autoCustomerField").autocomplete("option", "source", (request, response) => {
									var term = request.term.toLowerCase();
									response(availableCustomer.filter(item => item.label.toLowerCase().includes(term)).slice(0, 500));
								});

								var match = availableCustomer.find(item => item.value === data.id);
								if (match) {
									$("#autoCustomerField").val(match.label).trigger('change');
									$("#customers").val(match.value).attr("data-type", match.companytype);
									$("#hidden_companyname").val(match.label);
								}

								$(".customer-information-invoice #cmp_contactperson").val(data.contactperson);
								$(".customer-information-invoice #cmp_address1").val(data.address1);
								$(".customer-information-invoice #cmp_address2").val(data.address2);
								$(".customer-information-invoice #cmp_landmark").val(data.landmark);
								$(".customer-information-invoice #cmp_pincode").val(data.pincode);
								$(".customer-information-invoice #cmp_country").val(data.country);
								$(".customer-information-invoice #cmp_city").val(data.city);
								$(".customer-information-invoice #address").html(data.address);
								$(".customer-information-invoice #phone").val(data.phone);
								$(".customer-information-invoice #cmp_gstno").val(data.gst);
								$(".customer-information-invoice #cmp_gstno[data-value='']").val(data.gst);
								$(".customer-information-invoice #hidden-invoice-state").attr("data-value", data.state).val(data.state);
								if (!pageURL.includes("purchaseinvoicebill.php") && !pageURL.includes("purchaseorderbill.php")) {
									console.log(pageURL);
									$(".customer-information-invoice .PlaceofSupply").val(data.state);
									$(".customer-information-invoice .PlaceofSupply[data-value='']").val(data.state);
								}
								$(".customer-information-invoice #amount_limit").val(data.amount_limit);


								if (data.gst == "") {
									$("#reverse_Charge").val("0");									$("#reverse_Charge").attr("disabled", true).trigger("change");
								} else {
									$("#reverse_Charge").attr("disabled", false).trigger("change");
								}

								InvoiceTypeSet(data.country, data.party_type);

								SetIGTS();



								if (data.country == "India") {
									$(".control-group-PlaceofSupply").show();
								} else {
									$(".customer-information-invoice .PlaceofSupply[data-value='']").val("");
									$(".control-group-PlaceofSupply").hide();
								}

								var shipping_options = '';
								var shipping_addresses_obj = jQuery.parseJSON(data.shipping_addresses);
								$.each(shipping_addresses_obj, function(i, ship_single) {
									shipping_options = shipping_options + '<option value="' + ship_single.ship_name + '" ship_address="' + ship_single.ship_address + '" ship_phone="' + ship_single.ship_phone +  '" ship_email="' + ship_single.ship_email + '" ship_pincode="' + ship_single.ship_pincode + '" ship_gstno="' + ship_single.ship_gstno + '" ship_country="' + ship_single.ship_country + '" ship_state="' + ship_single.ship_state + '" >' + ship_single.ship_name + '</option>';
								});
								if (shipping_options != "") {
									$("#shipping_address").html(shipping_options);
								} else {
									$("#shipping_address").html('<option value="">--</option>');
								}
								$("#shipping_address").trigger('change');
								
								var shipping_address_id = ''; 
								var ship_name = ''; 
								var ship_address = ''; 
								var ship_phone = ''; 
								var ship_email = ''; 
								var ship_pincode = ''; 
								var ship_gstno = ''; 
								var ship_country = ''; 
								var ship_state = ''; 
								var shipping_distance_eway = ''; 

								if(shipping_addresses_obj.length > 0){
									for (var i = 0; i < 1; i++) {
										shipping_address_id = shipping_addresses_obj[i].shipping_address_id; 
										ship_name = shipping_addresses_obj[i].ship_name; 
										ship_address = shipping_addresses_obj[i].ship_address; 
										ship_phone = shipping_addresses_obj[i].ship_phone; 
										ship_email = shipping_addresses_obj[i].ship_email; 
										ship_pincode = shipping_addresses_obj[i].ship_pincode; 
										ship_gstno = shipping_addresses_obj[i].ship_gstno; 
										ship_country = shipping_addresses_obj[i].ship_country; 
										ship_state = shipping_addresses_obj[i].ship_state; 
										shipping_distance_eway = shipping_addresses_obj[i].shipping_distance_eway; 
									}
								}
								$(".customer-information-invoice #shipping_address_id").val(shipping_address_id);
								$(".customer-information-invoice #shippingName").val(ship_name);
								$(".customer-information-invoice #shippingAddress").html(ship_address);
								$(".customer-information-invoice #shippingPhone").val(ship_phone);
								$(".customer-information-invoice #shippingEmail").val(ship_email);
								$(".customer-information-invoice #shippingPincode").val(ship_pincode);
								$(".customer-information-invoice #shippingGSTIN").val(ship_gstno);
								$(".customer-information-invoice [name='shippingCountry']").val(ship_country).trigger("change");
								$(".customer-information-invoice [name='shippingState']").val(ship_state);
								$(".customer-information-invoice [name='shipping_distance_eway']").val(shipping_distance_eway);
								
								
								$("#CustomerModal [name=balance_type][value=Credit]").prop('checked', true);
								$("#CustomerModal [name=balance_amount]").val(0);
								$("#CustomerModal form input[type='text']").val('');
								$("#CustomerModal form input[type='hidden']").val('');
								$("#CustomerModal form textarea").val('');
								$("#listBoxCountry").val('India').trigger("change");
								$("#listBox").val('Select State');
								$("#listBoxCountry2").val('India').trigger("change");
								$("#listBox2").val('Select State');
								$("#listBoxCompany").val('Customer');
								$("#customers").val(data.id);
								SetIGTS();
								if ($('#datepicker_lr').length > 0) {
									if (data.company_due_date != "") {
										$("#datepicker_lr").attr("data-default-due", data.company_due_date);
										$("#datepicker_bill").trigger("change");
									} else {
										$("#datepicker_lr").attr("data-default-due", $("#datepicker_lr").attr("data-main-default-due"));
										$("#datepicker_bill").trigger("change");
									}
								}

								$("#CustomerModal").modal("hide");
								if (pageURL == "pos-bill.php" || pageURL.indexOf("pos-bill.php") != -1) {
									$('#customers_modal').append($('<option>', {
										value: data.id,
										text: data.companyname
									}));
									$(".select_customer_modal_button").text(data.companyname);
									$('#customers').trigger('change');
								}
							}
						}
						if (data.status == "ERROR") {
							errorMessage(data.msg,'Error In Saving Detail','','error');
						}
					},
					complete: function(data) {}
				});
			}
		});

		
		
		$('#CustomerModalForm').on("click",'input[name="companytype"]',function(){
			if ($(this).is(':checked')) {
				if($(this).val() == 'Customer'){
					$('.bankdetailopt').hide();
				}
				else{
					$('.bankdetailopt').show();
				}
				if($(this).val() == 'Customer'){
					$('.control-balance-type-customer').show();
					$('.control-balance-type-vendor').hide();
				}
				else if($(this).val() == 'Vendor'){
					$('.control-balance-type-customer').hide();
					$('.control-balance-type-vendor').show();
				}
				else{
					$('.control-balance-type-customer').show();
					$('.control-balance-type-vendor').show();
				}
				
			}
		}).change();

		$('#CustomerModalForm input[name="companytype"]:checked ').trigger("click");

        $.validator.addMethod("customUrl", function(value, element) {
            // Allow URLs with {{LR No}} or similar placeholders
            return this.optional(element) || /^(http|https):\/\/[^\s$.?#].[^\s]*({{LR No}})?$/.test(value);
        }, "Please enter a valid tracking URL");

		$("#TransportModal form").validate({
			rules: {
				field: {
					required: true
				},
                customUrl: {
                    url: true,
                }
			},
			messages: {
				name: "Please enter your transport name",
                customUrl: {
                    url: "Please enter a valid tracking URL"
                }
			},
			submitHandler: function(form) {
				
				var data = $(form).serialize() + '&action=SubmitTransportModel';
				$.ajax({
					type: "POST",
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					data: data,
					success: function(data) {
						var currentURL = window.location.href;
							pageURL = currentURL.replace(/^.*[\\\/]/, '');
						if (pageURL == "list-transport.php" || pageURL.indexOf("list-transport.php") != -1) {
							var mode = data.redirect.split('?')[1].split('=');
							if(mode == 'insert'){
								window.location.href = data.redirect;
							}else{
								window.location.href = data.redirect+'&'+ $("#url_string").val();
							}
						}else {
							if (data.status == "OK") {
								$("#TransportModal form input").val('');
								availableTransports.push({
									value: data.value,
									label: data.label,
									vehicleno: data.vehicleno,
									transportID: data.transportID,
									name: data.name
								});
								$(".transport-combobox").val(data.label);
								$("#hidden-transport-id").val(data.value);
								$("#hidden-transport-name").val(data.name);
								$("#hidden-transport-transportID").val(data.transportID);
								$("#hidden-transport-vehicleno").val(data.vehicleno);

								$("#transport_id_label").val(data.transportID);
								$("#vehicle_no_label").val(data.vehicleno);
								$('#TransportModal').modal('toggle');
							} else if (data.status == "ERROR") {
								errorMessage(data.msg,'Error In Saving Detail','','error');
							}
							
						}
					},
					complete: function(data) {}
				});
			}
		});
		$("#ShippingModal form").validate({
			rules: {
				'ship_name[]': {
					required: true
				},
				'ship_state[]': {
					required: function(element) {
						return $("#ShippingModal .listBoxCountry1").val() == "India";
					}
				},
				'ship_address[]': {
					required: true
				},
				'ship_landmark[]': {
					required: true
				},
				'ship_city[]': {
					required: true
				},
				'ship_pincode[]': {
					required: true
				},
			},
			messages: {
				'ship_name[]': "Please enter your shipping name",
				'ship_state[]': "Please enter shipping state",
				'ship_address[]': "Please enter shipping address",
				'ship_landmark[]': "Please enter shipping landmark",
				'ship_city[]': "Please enter shipping city",
				'ship_pincode[]': "Please enter shipping pincode",
			},
			submitHandler: function(form) {
				var data = $(form).serialize() + '&action=SubmitShippingModel&customer='+$("#customers").val();
				$.ajax({
					type: "POST",
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					data: data,
					success: function(data) {
						if (data.status == "OK") {
							$("#customers").trigger('change');
							$("#ShippingModal form input").val('');
							$("#ShippingModal form textarea").val('');
							$('#ShippingModal').modal('toggle');
							if(data.shipurl != undefined){
								window.location.href = data.shipurl;
							}


						} else if (data.status == "ERROR") {
							errorMessage(data.msg,'Error In Saving Detail','','error');
						}
						
					},
					complete: function(data) {}
				});
			}
		});
		$('body').on('change', '#igst', function() {
			var igst = $(this).val();
			if (!isNaN(igst) && igst != "") {
				$(this).siblings('#cgst').val(igst / 2);
				$(this).siblings('#sgst').val(igst / 2);
			} else {
				$('#sgst').val("");
				$('#cgst').val("");
			}

		});
		$('body').on('change', '#gstval', function() {
			var gstval = $(this).val();
			
			if (!isNaN(gstval) && gstval != "") {
				
				$(this).siblings('#taxability').val('Taxable');
				$(this).siblings('#igst').val(gstval);
				$(this).siblings('#cgst').val(gstval / 2);
				$(this).siblings('#sgst').val(gstval / 2);
			} else {
				if(gstval ==  "Nil Rated" || gstval == "Exempt" || gstval == 'Non-GST'){
					$(this).siblings('#taxability').val(gstval);
					$(this).siblings('#igst').val('');
					$(this).siblings('#cgst').val('');
					$(this).siblings('#sgst').val('');
				}
			}

		});
		jQuery.validator.addMethod("tax_validate", function(value, element) {
			var tax_validate = true;
			var taxability = $('select[name=taxability]').val();
			var igst = $('#igst').val();
			var sgst = $('#sgst').val();
			var cgst = $('#cgst').val();
			if (taxability == "Taxable") {
				if ((igst == "" || igst == "0") || (sgst == "" || sgst == "0") || (cgst == "" || cgst == "0")) {
					tax_validate = false;
				}
			} else {
				if (!(igst == "" || igst == "0") || !(sgst == "" || sgst == "0") || !(cgst == "" || cgst == "0")) {
					tax_validate = false;
				}
			}
			return tax_validate;
		}, "Invalid product type for entered GST");

		jQuery.validator.addMethod("hsn_validate", function(value, element) {
			var hsn_validate = true;
			if(value != "" && jQuery.inArray(value, hsnCodes) === -1) 
			{
				hsn_validate = false;
			}
			return hsn_validate;
		}, "Invalid HSN/SAC code");
		
		jQuery.validator.addMethod("mrp_validate", function(value, element) {
			var mrp_validate = true;
			var require_product_mrp = 0;
			if(value == "" && require_product_mrp === 1) 
			{
				mrp_validate = false;
			}
			return mrp_validate;
		}, "Please Enter MRP");

		jQuery.validator.addMethod("product_code_validate", function(value, element) {
			var product_code_validate = true;
			var require_product_code = 0;
			if(value == "" && require_product_code === 1) 
			{
				product_code_validate = false;
			}
			return product_code_validate;
		}, "Please Enter Product Code");


		$("#ProductModal form").validate({
			rules: {
				field: {
					required: true
				},
				
				hsn: {
					hsn_validate: true
				},
				mrp: {
					mrp_validate: true
				},
				product_code: {
					product_code_validate: true
				},
				product_note: {
					maxlength: 1200
				}
			},
			messages: {
				name: "Please enter your product name",
				'batch_name[]': "Please enter batch no.",
				'quantity[]': "Please enter quantity",
				product_note: "Product description must be less than 1200 character."
			},
			submitHandler: function(form) {
				var data = $(form).serialize() + '&action=SubmitProductModel';
					
				var params = new URLSearchParams(data);
				var product_code = (params.has('product_code') ? params.get('product_code') : '');
				var product_id = (params.get('product_id'));

				checkProductCode(product_code,product_id, function(isAllowed) {
					if (isAllowed) {
				
					if (validateBatchRows()) {
				
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						data: data,
						success: function(data) {
							$("body").removeClass("is-loading");
							if (data.status == "OK") {

								var currentURL = window.location.href;
								pageURL = currentURL.replace(/^.*[\\\/]/, '');
								if (pageURL == "list-product.php" || pageURL.indexOf("list-product.php") != -1) {
									var mode = data.redirect.split('?')[1].split('=');
									if(mode == 'insert'){
										window.location.href = data.redirect;
									}else{
										window.location.href = data.redirect+'&'+ $("#url_string").val();
									}
								}else{



								$("#ProductModal form input[type='text']").val('');
								if (data.Attrib1New != "") {
									productVarient1.push(data.Attrib1New);
								}
								if (data.Attrib2New != "") {
									productVarient2.push(data.Attrib2New);
								}
								if (data.Attrib3New != "") {
									productVarient3.push(data.Attrib3New);
								}
								if (data.Attrib4New != "") {
									productVarient4.push(data.Attrib4New);
								}

								$("#ProductModal form input[name='hidden-attrib-1-val']").val('');
								$("#ProductModal form input[name='hidden-attrib-2-val']").val('');
								$("#ProductModal form input[name='hidden-attrib-3-val']").val('');
								$("#ProductModal form input[name='hidden-attrib-4-val']").val('');
								availableProducts.push({
									value: data.value,
									label: data.label,
									attr1name: data.attr1name,
									attr1val: data.attr1val,
									attr2name: data.attr2name,
									attr2val: data.attr2val,
									attr3name: data.attr3name,
									attr3val: data.attr3val,
									attr4name: data.attr4name,
									attr4val: data.attr4val,
									sellprice: data.sellprice,
									customerprice: data.sellprice,
									purchaseprice: data.purchaseprice,
									items_available: data.items_available,
									cgst: data.cgst,
									sgst: data.sgst,
									igst: data.igst,
									cess: data.cess,
									cess_amount: data.cess_amount,
									is_transport: '0',
									name: data.name,
									uom: data.uom,
									hsn: data.hsn,
									product_note: data.product_note,
									is_service_product: data.is_service_product,
									stockType: data.stockType,
									mrp: data.mrp,
									barcode_no: data.barcode_no,
									product_code: data.product_code

								});
								$('#ProductModal').modal('toggle');
								}
							} else if (data.status == "ERROR") {
								errorMessage(data.msg,'Error In Saving Detail','','error');
							}

						},
						complete: function(data) {}
					});
				
				}
			}
			});
		}
			
		});

		function checkProductCode(product_code,product_id, callback) {
			 product_code = ''; 			let lableProcode = 'Product Code';
					if(product_code!=""){		
						var data = {
							'product_code': product_code,
							'action': 'getProductCode',
							'product_id': product_id,
						};
					$.ajax({
						type: "POST",
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						data: data,
						success: function(data) {
							$("body").removeClass("is-loading");
							if (data.status == "OK") {
								Swal.fire({	
									title: lableProcode+ ' value already exists',
        							html: `This ${lableProcode} has already been used.<br> Do you want to save it with a duplicate value?`,
									icon: 'warning',
									showCancelButton: true,
									confirmButtonColor: '#3085d6',
									cancelButtonColor: '#d33',
									confirmButtonText: 'Continue',
									cancelButtonText: 'Cancel',
									customClass: {
										cancelButton: 'recodeCancel-btn'
									},
									reverseButtons: true
								}).then((result) => {
									if (result.isConfirmed) {
										callback(true);
									} 
								});
								
							} else {
								callback(true);

							}
						}
					})
				}
				else{
					callback(true);
				}
		}
		jQuery.validator.addMethod("transport_tax_validate", function(value, element) {
			var tax_validate = true;
			var taxability = $('#TransportChargeModal select[name=taxability]').val();
			var igst = $('#TransportChargeModal #igst').val();
			var sgst = $('#TransportChargeModal #sgst').val();
			var cgst = $('#TransportChargeModal #cgst').val();
			if (taxability == "Taxable") {
				if ((igst == "" || igst == "0") || (sgst == "" || sgst == "0") || (cgst == "" || cgst == "0")) {
					tax_validate = false;
				}
			} else {
				if (!(igst == "" || igst == "0") || !(sgst == "" || sgst == "0") || !(cgst == "" || cgst == "0")) {
					tax_validate = false;
				}
			}
			return tax_validate;
		}, "Invalid product type for entered GST");

		$("#TransportChargeModal form").validate({
			rules: {
				field: {
					required: true
				},
				product_note: {
					maxlength: 1200
				}
			},
			messages: {
				name: "Please enter additional charge name",
				product_note: "product description must be less than 1200 character."
			},
			submitHandler: function(form) {
				var data = $(form).serialize() + '&action=SubmitTransportChargeModel';
				$.ajax({
					type: "POST",
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					data: data,
					success: function(data) {
						if (data.status == "OK") {
							var currentURL = window.location.href;
							pageURL = currentURL.replace(/^.*[\\\/]/, '');
							if (pageURL == "list-transport-charges.php" || pageURL.indexOf("list-transport-charges.php") != -1) {
								var mode = data.redirect.split('?')[1].split('=');
								if(mode == 'insert'){
									window.location.href = data.redirect;
								}else{
									window.location.href = data.redirect+'&'+ $("#url_string").val();
								}
							}else{


							$("#TransportChargeModal form input[type='text']").val('');
							availableProducts.push({
								value: data.value,
								label: data.name,
								attr1name: "",
								attr1val: "",
								attr2name: "",
								attr2val: "",
								attr3name: "",
								attr3val: "",
								attr4name: "",
								attr4val: "",
								barcode_no: "",
								sellprice: data.sellprice,
								customerprice: data.sellprice,
								purchaseprice: "0.00",
								items_available: "0.00",
								cgst: data.cgst,
								sgst: data.sgst,
								igst: data.igst,
								cess: "",
								cess_amount: "",
								is_transport: "1",
								name: data.name,
								uom: "",
								hsn: data.hsn,
								is_service_product: data.is_service_product

							});
							$('#TransportChargeModal').modal('toggle');
							}
						} else if (data.status == "ERROR") {
							errorMessage(data.msg,'Error In Saving Detail','','error');
						}

					},
					complete: function(data) {}
				});
			}
		});

		$("#sellprice_incl_tax").on('keyup change blur', function() {
			var totaltax = 0;
			var sell = $("#sellprice").val();
			var sell_inc = $("#sellprice_incl_tax").val();
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
			if (sell_inc != "") {
				sell_inc = parseFloat(sell_inc);
				if (cess_amount != "") {
					cess_amount = parseFloat(cess_amount);
					sell_inc = sell_inc - cess_amount;
				}
				if (cgst != "" && sgst != "") {
					cgst = parseFloat(cgst);
					sgst = parseFloat(sgst);
					totaltax = totaltax + cgst + sgst;
				} else {
					if (igst != "") {
						igst = parseFloat(igst);
						totaltax = totaltax + igst;
					}
				}
				if (cess != "") {
					cess = parseFloat(cess);
					totaltax = totaltax + cess;
				}
				sell = (sell_inc * 100) / (100 + totaltax);
				sell = Math.round(sell * price_decimal_rounding) / price_decimal_rounding;
				$("#sellprice").val(sell);
			}

		});
		$("#sellprice,#cgst,#sgst,#igst,#cess").on('keyup change blur', function() {
			var totaltax = 0;
			var igstrate = 0;
			var cessrate = 0;
			var sell = $("#sellprice").val();
			var sell_inc = $("#sellprice_incl_tax").val();
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
			if (sell != "") {
				sell = parseFloat(sell);
				sell_inc = parseFloat(sell_inc);

				if (cgst != "" && sgst != "") {
					cgst = parseFloat(cgst);
					sgst = parseFloat(sgst);
					igstrate = (sell * (cgst + sgst)) / 100;
					igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
				} else {
					if (igst != "") {
						igstrate = (sell * igst) / 100;
						igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
					}
				}


				if (cess != "") {
					cessrate = (sell * cess) / 100;
					cessrate = Math.round(cessrate * gst_decimal_rounding) / gst_decimal_rounding;
				}
				sell_inc = sell + igstrate + cessrate;
				if (cess_amount != "") {
					cess_amount = parseFloat(cess_amount);
					sell_inc = sell_inc + cess_amount;
				}
				sell_inc = Math.round(sell_inc * price_decimal_rounding) / price_decimal_rounding;
				$("#sellprice_incl_tax").val(sell_inc);
			}

		});
		$("#purchaseprice_incl_tax").on('keyup change blur', function() {
			var totaltax = 0;
			var purc = $("#purchaseprice").val();
			var purc_inc = $("#purchaseprice_incl_tax").val();
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();

			if (purc_inc != "") {
				purc_inc = parseFloat(purc_inc);
				if (cess_amount != "") {
					cess_amount = parseFloat(cess_amount);
					purc_inc = purc_inc - cess_amount;
				}
				if (cgst != "" && sgst != "") {
					cgst = parseFloat(cgst);
					sgst = parseFloat(sgst);
					totaltax = totaltax + cgst + sgst;
				} else {
					if (igst != "") {
						igst = parseFloat(igst);
						totaltax = totaltax + igst;
					}
				}
				if (cess != "") {
					cess = parseFloat(cess);
					totaltax = totaltax + cess;
				}
				purc = (purc_inc * 100) / (100 + totaltax);
				purc = Math.round(purc * price_decimal_rounding) / price_decimal_rounding;
				$("#purchaseprice").val(purc);
			}
		});
		$("#purchaseprice,#igst,#cess").on('keyup change blur', function() {
			var totaltax = 0;
			var igstrate = 0;
			var cessrate = 0;
			var purc = $("#purchaseprice").val();
			var purc_inc = $("#purchaseprice_incl_tax").val();
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
			if (purc != "") {
				purc = parseFloat(purc);
				if (cgst != "" && sgst != "") {
					cgst = parseFloat(cgst);
					sgst = parseFloat(sgst);
					igstrate = (purc * (cgst + sgst)) / 100;
					igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
				} else {
					if (igst != "") {
						igstrate = (purc * igst) / 100;
						igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
					}
				}
				if (cess != "") {
					cessrate = (purc * cess) / 100;
					cessrate = Math.round(cessrate * gst_decimal_rounding) / gst_decimal_rounding;
				}
				purc_inc = purc + igstrate + cessrate;
				if (cess_amount != "") {
					cess_amount = parseFloat(cess_amount);
					purc_inc = purc_inc + cess_amount;
				}
				purc_inc = Math.round(purc_inc * price_decimal_rounding) / price_decimal_rounding;
				$("#purchaseprice_incl_tax").val(purc_inc);
			}
		});



		$(document).on('keyup change blur',"[name='sellpriceincltax[]']", function() {
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
		
			$('#ProductModal table tr').each(function(i,val){
				var totaltax = 0;
				var sell = $(this).find("[name='price[]']").val();
				var sell_inc = $(this).find("[name='sellpriceincltax[]']").val();
				if (sell_inc != "" && sell_inc != undefined) {
					
					if((sell_inc.charAt(sell_inc.length -1) != '.'  && price_decimal_rounding_by > 0 && sell_inc.toString().indexOf('.') > -1)){
						sell_inc  = sell_inc.toString().substring(0, sell_inc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='sellpriceincltax[]']").val(sell_inc);
						sell_inc = parseFloat(sell_inc);
					}else if(price_decimal_rounding_by == 0 && sell_inc.toString().indexOf('.') > -1 ){
						sell_inc  = sell_inc.toString().substring(0, sell_inc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='sellpriceincltax[]']").val(sell_inc);
					}else{
						sell_inc = parseFloat(sell_inc);
					}
					

					if (cess_amount != "") {
						cess_amount = parseFloat(cess_amount);
						sell_inc = sell_inc - cess_amount;
					}
					if (cgst != "" && sgst != "") {
						cgst = parseFloat(cgst);
						sgst = parseFloat(sgst);
						totaltax = totaltax + cgst + sgst;
					} else {
						if (igst != "") {
							igst = parseFloat(igst);
							totaltax = totaltax + igst;
						}
					}
					if (cess != "") {
						cess = parseFloat(cess);
						totaltax = totaltax + cess;
					}
					sell = (sell_inc * 100) / (100 + totaltax);
					sell = Math.round(sell * price_decimal_rounding) / price_decimal_rounding;
					sell = sell.toFixed(price_decimal_value);
					$(this).find("[name='price[]']").val(sell);
				}
	   		});

			

		});


		$(document).on('keyup change blur',"[name='price[]'],#cgst,#sgst,#igst,#cess", function() {
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
			$('#ProductModal table tr').each(function(i,val){
				var totaltax = 0;
				var igstrate = 0;
				var cessrate = 0;
				var sell = $(this).find("[name='price[]']").val();
				var sell_inc = $(this).find("[name='sellpriceincltax[]']").val();
				if (sell != "" && sell != undefined) {
					if((sell.charAt(sell.length -1) != '.'  && price_decimal_rounding_by > 0 && sell.toString().indexOf('.') > -1)){
						sell  = sell.toString().substring(0, sell.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='price[]']").val(sell);
						sell = parseFloat(sell);
					}else if(price_decimal_rounding_by == 0 && sell.toString().indexOf('.') > -1 ){
						sell  = sell.toString().substring(0, sell.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='price[]']").val(sell);
					}else{
						sell = parseFloat(sell);
					}
					sell_inc = parseFloat(sell_inc);

					if (cgst != "" && sgst != "") {
						cgst = parseFloat(cgst);
						sgst = parseFloat(sgst);
						igstrate = (sell * (cgst + sgst)) / 100;
						igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
					} else {
						if (igst != "") {
							igstrate = (sell * igst) / 100;
							igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
						}
					}


					if (cess != "") {
						cessrate = (sell * cess) / 100;
						cessrate = Math.round(cessrate * gst_decimal_rounding) / gst_decimal_rounding;
					}
					sell_inc = sell + igstrate + cessrate;
					if (cess_amount != "") {
						cess_amount = parseFloat(cess_amount);
						sell_inc = sell_inc + cess_amount;
					}
					sell_inc = Math.round(sell_inc * price_decimal_rounding) / price_decimal_rounding;
					$(this).find("[name='sellpriceincltax[]']").val(sell_inc);
				}
			});

		});

		$(document).on('keyup change blur',"[name='purchasepriceincltax[]']", function() {
			var totaltax = 0;
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();

			$('#ProductModal table tr').each(function(i,val){
				var totaltax = 0;
				var totaltax = 0;
				var purc = $(this).find("[name='purchase_price[]']").val();
				var purc_inc = $(this).find("[name='purchasepriceincltax[]']").val();
				
				if (purc_inc != "" && purc_inc != undefined) {
					if((purc_inc.charAt(purc_inc.length -1) != '.'  && price_decimal_rounding_by > 0 && purc_inc.toString().indexOf('.') > -1)){
						purc_inc  = purc_inc.toString().substring(0, purc_inc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='purchasepriceincltax[]']").val(purc_inc);
						purc_inc = parseFloat(purc_inc);
					}else if(price_decimal_rounding_by == 0 && purc_inc.toString().indexOf('.') > -1 ){
						purc_inc  = purc_inc.toString().substring(0, purc_inc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='purchasepriceincltax[]']").val(purc_inc);
					}else{
						purc_inc = parseFloat(purc_inc);
					}
					if (cess_amount != "") {
						cess_amount = parseFloat(cess_amount);
						purc_inc = purc_inc - cess_amount;
					}
					if (cgst != "" && sgst != "") {
						cgst = parseFloat(cgst);
						sgst = parseFloat(sgst);
						totaltax = totaltax + cgst + sgst;
					} else {
						if (igst != "") {
							igst = parseFloat(igst);
							totaltax = totaltax + igst;
						}
					}
					if (cess != "") {
						cess = parseFloat(cess);
						totaltax = totaltax + cess;
					}
					purc = (purc_inc * 100) / (100 + totaltax);
					purc = Math.round(purc * price_decimal_rounding) / price_decimal_rounding;
					$(this).find("[name='purchase_price[]']").val(purc);
				}
			});
		});

		$(document).on('keyup change blur',"[name='purchase_price[]'],#igst,#cess", function() {
			var cgst = $("#cgst").val();
			var sgst = $("#sgst").val();
			var igst = $("#igst").val();
			var cess = $("#cess").val();
			var cess_amount = $("#cess_amount").val();
			$('#ProductModal table tr').each(function(i,val){
				var totaltax = 0;
				var igstrate = 0;
				var cessrate = 0;
				var purc = $(this).find("[name='purchase_price[]']").val();
				var purc_inc = $(this).find("[name='purchasepriceincltax[]']").val();
				if (purc != "" && purc != undefined) {

					if((purc.charAt(purc.length -1) != '.'  && price_decimal_rounding_by > 0 && purc.toString().indexOf('.') > -1)){
						purc  = purc.toString().substring(0, purc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='purchase_price[]']").val(purc);
						purc = parseFloat(purc);
					}else if(price_decimal_rounding_by == 0 && purc.toString().indexOf('.') > -1 ){
						purc  = purc.toString().substring(0, purc.toString().indexOf('.') + 1 + price_decimal_rounding_by);
						$(this).find("[name='purchase_price[]']").val(purc);
					}else{
						purc = parseFloat(purc);
					}
					if (cgst != "" && sgst != "") {
						cgst = parseFloat(cgst);
						sgst = parseFloat(sgst);
						igstrate = (purc * (cgst + sgst)) / 100;
						igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
					} else {
						if (igst != "") {
							igstrate = (purc * igst) / 100;
							igstrate = Math.round(igstrate * gst_decimal_rounding) / gst_decimal_rounding;
						}
					}
					if (cess != "") {
						cessrate = (purc * cess) / 100;
						cessrate = Math.round(cessrate * gst_decimal_rounding) / gst_decimal_rounding;
					}
					purc_inc = purc + igstrate + cessrate;
					if (cess_amount != "") {
						cess_amount = parseFloat(cess_amount);
						purc_inc = purc_inc + cess_amount;
					}
					purc_inc = Math.round(purc_inc * price_decimal_rounding) / price_decimal_rounding;
					$(this).find("[name='purchasepriceincltax[]']").val(purc_inc);
				}
			});
		});






		$(document).on('click', ".transportgstdata_autofill", function() {
			var gstno = $("#TransportModal #transportid").val();
			var regex = /^\d{2}/;
			if (gstno.substr(0, 2) !== "88") {
			if (gstno.length == 15 && regex.test(gstno)) {
				var data = {
					action: 'gstapicall',
					gstno: gstno,
					fromgstno: '',
					userid: '161818'				}
				$.ajax({
					type: 'POST',
					data: data,
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					beforeSend: function() {
						$("body").addClass("is-loading");
					},
					success: function(data) {
						if (data.status == 'OK') {
							var gstno = data.gstno.substr(0, 2);
							var data = data.gstapicall_data;
							if (jQuery.isEmptyObject(data)) {
								if ($("#TransportModal #gstno-error").length == 0) {
									$('#TransportModal #transportid').after('<label id="gstno-error" class="error" for="gstno">Invalid Transport ID/GSTIN.</label>');
								} else {
									$('#TransportModal #gstno-error').html('Invalid Transport ID/GSTIN.');
								}

							} else {
								$('#TransportModal #gstno-error').remove();
								arr = JSON.parse(JSON.stringify(data));
								$("#TransportModal #name").val(arr.cmpname);
							}

						} else {
							if(data.errorTitle)
							{
								var errTitle = data.errorTitle;
							}
							else{
								var errTitle = 'Error';
							}
							errorMessage('',errTitle,data.data,'error');
							$("body").removeClass("is-loading");
						}
					},
					complete: function() {

					}
				});
			} else {
				if ($("#TransportModal #gstno-error").length == 0) {
					$('#TransportModal #transportid').after('<label id="gstno-error" class="error" for="gstno">Invalid Transport ID/GSTIN.</label>');
				} else {
					$('#TransportModal #gstno-error').html('Invalid Transport ID/GSTIN.');
				}
				$('#TransportModal #gstno-error').show();
			}
		}else{
			Swal.fire({
				icon: 'warning',
				title: `Unable to fetch details for this GSTIN, please enter the details manually.`,
				confirmButtonColor: '#1399dc',
			});
		}
		});

		$(document).on('click', ".gstdata_autofill", function() {
			$('#gstno-error').text('');
			var gstfor = $(this).data('gstfor');
			if (gstfor != '' && gstfor == 'shipping') {
				var shipping_address_reapiter = $(this).closest('.shipping_address_reapiter');
				var gstno = $(this).closest('.shipping_address_reapiter').find(".ship_gstno").val();
				var pan = $(this).closest('.shipping_address_reapiter').find(".ship_gstno").val();
			} else {
				var gstno = $("#gstno").val();
				var pan = $("#gstno").val();
			}


			pan = pan.substring(2, 12);
			var regex = /^\d{2}/;
			if (gstno.length == 15 && regex.test(gstno)) {
				var data = {
					action: 'gstapicall',
					gstno: gstno,
					fromgstno: '',
					userid: '161818'				}
				$.ajax({
					type: 'POST',
					data: data,
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					beforeSend: function() {
						$("body").addClass("is-loading");
						$("#progressbar").css({"width":0 +"%","background-color": "#f7f7f7" ,"font-weight": "bold"});
						$("#progressbar").text("");
						$("#cmp_reputation").val("");
					},
					success: function(data) {
						if (data.status == 'OK') {
							var cmpExist = data.cmpExist;
							var gstno = data.gstno.substr(0, 2);
							var data = data.gstapicall_data;
							if (jQuery.isEmptyObject(data)) {
								if ($("#gstno-error").length == 0) {
									$('#gstno').after('<label id="gstno-error" class="error" for="gstno">Invalid GSTIN.</label>');
								} else {
									$('#gstno-error').html('Invalid GSTIN.');
								}

							} else {
								arr = JSON.parse(JSON.stringify(data));
								if (gstfor != '' && gstfor == 'shipping') {
									shipping_address_reapiter.find(".ship_name").val(arr.cmpname);
									shipping_address_reapiter.find(".ship_address").val(arr.address1 + '\r\n' + arr.address2);
									shipping_address_reapiter.find(".ship_pincode").val(arr.pincode);
									shipping_address_reapiter.find(".ship_landmark").val(arr.landmark);
									shipping_address_reapiter.find(".ship_city").val(arr.city);
									shipping_address_reapiter.find(".all_state_list option[data-statecode='"+ gstno +"']").attr("selected", true);
								} else {
									$("#companyname").val(arr.cmpname);
									$("#address1").val(arr.address1);
									$("#address2").val(arr.address2);
									$("input[name='landmark']").val(arr.landmark);
									$("#city").val(arr.city);
									$("#contactperson").val(arr.name);
									$("#pincode").val(arr.pincode);
									$("#listBox option").attr("selected", false);
									$("#listBox option[data-statecode='"+ gstno +"']").attr("selected", true);
									$("#pan").val(pan);
									if(cmpExist != ""){
										$("#alredyExist").html("");
										$("#alredyExist").closest(".control-group").show();
										cmpExist.map(function(cmp) {
											var html = "";
											html = `<div class='span6 span-md-6 span-xs-12 span-sm-6 equal-height' style="padding:2px"><div class="getRow ">
														<h4>${cmp.companyname}</h4>
														<p>${cmp.gstno}</p>
														<p>${cmp.address}</p>
														<span class='label'>${cmp.companytype}</span>
													</div></div>`;
											$("#alredyExist").append(html);
										});
										equalheight('.equal-height');
									}else{
										$("#alredyExist").html("");
										$("#alredyExist").closest(".control-group").hide();
									}
																	}
							}

						} else {
							if(data.errorTitle)
							{
								var errTitle = data.errorTitle;
							}
							else{
								var errTitle = 'Error';
							}
							errorMessage('',errTitle,data.data,'error');
							$("body").removeClass("is-loading");
						}
					},
					complete: function() {

					}
				});
			} else {
				if ($("#gstno-error").length == 0) {
					$('#gstno').after('<label id="gstno-error" class="error" for="gstno">Invalid GSTIN.</label>');
				} else {
					$('#gstno-error').html('Invalid GSTIN.');
				}
				$('#gstno-error').show();
			}
		});

		$(document).on("click", ".distance_autofill", function(e) {
			var org_state = $("#org_state").val();
			var org_pincode = $("#org_pincode").val();
			var current_ele = $(this);
			if (current_ele.attr('distance_for') == "shipping") {
				var pincode = current_ele.closest('.shipping_address_reapiter').find('input[name="ship_pincode[]"]').val();
				var state = current_ele.closest('.shipping_address_reapiter').find('select[name="ship_state[]"]').val();
				var listBoxCountry = current_ele.closest('.shipping_address_reapiter').find('select[name="ship_country[]"]').val();
			} else {
				var pincode = $("#pincode").val();
				var state = $("select[name='state']").val();
				var listBoxCountry = $("#listBoxCountry").val();
			}
			if (pincode.length > 0 && state.length > 0 && listBoxCountry.length > 0 && listBoxCountry == "India") {
				var data = {
					action: 'dist_apicall',
					from: org_pincode,
					to: pincode,
					tocookie: org_pincode + pincode + state,
					userid: '161818'				}
				$.ajax({
					type: 'POST',
					data: data,
					url: "ajaxcall.php",
					ContentType: 'application/json',
					dataType: 'json',
					beforeSend: function() {
						$("body").addClass("is-loading");
					},
					success: function(data) {
						if (data.status == 'OK') {
							if (current_ele.attr('distance_for') == "shipping") {
								current_ele.closest('.shipping_address_reapiter').find('.shipping_distance_eway').val(data.dist_apicall);
								$('.dist-error').hide();
							} else {
								$("#distance_eway").val(data.dist_apicall);
								$('#dist-error').hide();
							}
						} else {
							if(data.errorTitle)
							{
								var errTitle = data.errorTitle;
							}
							else{
								var errTitle = 'Error';
							}
							errorMessage('',errTitle,data.data,'error');
							$("body").removeClass("is-loading");
						}
					},
					complete: function() {

					}
				});
			} else {
				if (listBoxCountry != "India") {
					if (current_ele.attr('distance_for') == "shipping") {
						if (current_ele.closest('.shipping_address_reapiter').find(".dist-error").length == 0) {
							current_ele.after('<label class="dist-error error">Country must be india to calculate Distance for e-way bill.</label>');
						} else {
							current_ele.closest('.shipping_address_reapiter').find(".dist-error").html('Country must be india to calculate Distance for e-way bill.');
						}
					} else {
						if ($("#dist-error").length == 0) {
							$('#distance_eway').after('<label id="dist-error" class="error" for="gstno">Country must be india to calculate Distance for e-way bill.</label>');
						} else {
							$('#dist-error').html('Country must be india to calculate Distance for e-way bill.');
						}
					}
				} else {
					if (current_ele.attr('distance_for') == "shipping") {
						if (current_ele.closest('.shipping_address_reapiter').find(".dist-error").length == 0) {
							current_ele.after('<label class="dist-error error">Pincode, state and country required.</label>');
						} else {
							current_ele.closest('.shipping_address_reapiter').find(".dist-error").html('Pincode, state and country required.');
						}
					} else {
						if ($("#dist-error").length == 0) {
							$('#distance_eway').after('<label id="dist-error" class="error" for="gstno">Pincode, state and country required.</label>');
						} else {
							$('#dist-error').html('Pincode, state and country required.');
						}
					}
				}
				$('#dist-error').show();

			}
		});

});


var addmorenormal = `<tr>
						<input type="hidden" name="product_batch_id[]">
						<td><input type="text" name="quantity[]"></td>
						<input type="hidden" name="mrp[]">						<td><input type="text" name="price[]" class="sellprice"></td>
						<td><input type="text" name="sellpriceincltax[]" class="sellpriceincltax"></td>
						<td><input type="text" name="purchase_price[]"></td>
						<td><input type="text" name="purchasepriceincltax[]"></td>
						<td>
							<div class="addmore-section">
								<a class="btn btn-primary addNormal btnaddmoreoption"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></a>
								<a class="btn btn-danger removeNormal btnaddmoreoption"><svg width="20" height="20"><use href="svg-icon/icons.svg#minus-svg-icon"></use></svg></a>
							</div>
						</td>
					</tr>`;

var addmorebatch = `<tr>
					<td>
						<div class="inputlabel_wrapper">
							<input type="text" name="batch_name[]" placeholder="Batch No." autocomplete="off" maxlength="20">
							<input type="hidden" name="product_batch_id[]">
														<input type="hidden" name="model_no[]"> 							<input type="hidden" name="size[]"> 							<input type="hidden" name="manufacture_date[]"> 							<input type="hidden" name="expiry_date[]"> 							<input type="hidden" name="mrp[]"> 							<label for="batch_name[]">Batch No.</label>
						</div></td>																				 					 	<td class="batchQty">
							<div class="inputlabel_wrapper">
								<input type="text" name="quantity[]" placeholder="Qty" onkeypress="return allowOnlyNumber(event);" maxlength="10">
								<label for="quantity[]">Qty.</label>
							</div>
						</td>
															<td>
						<div class="inputlabel_wrapper">
							<input type="text" name="price[]" autocomplete="off" placeholder="Sale Price" class="sellprice" onkeypress="return allowOnlyNumber(event);" maxlength="10">
							<label for="price[]">Sale Price</label>
						</div>
					</td>
					<td>
						<div class="inputlabel_wrapper">
							<input type="text" name="sellpriceincltax[]" autocomplete="off"  placeholder="Sale Price (Incl. Tax)" class="sellpriceincltax" onkeypress="return allowOnlyNumber(event);" maxlength="10">
							<label for="sellpriceincltax[]">Sale Price (Incl. Tax)</label>
						</div>
					</td>
					<td>
						<div class="inputlabel_wrapper">
							<input type="text" name="purchase_price[]" autocomplete="off"  placeholder="Purchase Price" onkeypress="return allowOnlyNumber(event);" maxlength="10">
							<label for="purchase_price[]">Purchase Price</label>
						</div>
					</td>
					<td>
						<div class="inputlabel_wrapper">
							<input type="text" name="purchasepriceincltax[]" autocomplete="off"  placeholder="Purchase Price (Incl. Tax)" onkeypress="return allowOnlyNumber(event);" maxlength="10">
							<label for="purchasepriceincltax[]">Purchase Price (Incl. Tax)</label>
						</div>
					</td>
					<td>
						<div class="addmore-section">
							<a class="btn btn-primary addBatch btnaddmoreoption"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></a>
							<a class="btn btn-danger removeBatch btnaddmoreoption"><svg width="20" height="20"><use href="svg-icon/icons.svg#minus-svg-icon"></use></svg></a>
						</div>
					</td>
					
				</tr>`;
					
var addmoreserial = `<div class="controls">
										<input type="text" class="mergeserialno" name="serialno[]" placeholder="Enter Serial No." style="width: 95%;" onkeypress="return allowOnlyNumber(event);">
										<div class="addmore-section" style="margin-left: 5px;">
											<a class="btn btn-primary addSerialNo btnaddmoreoptionserial"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></a>
											<a class="btn btn-danger removeSerialNo btnaddmoreoptionserial" style="display: none;"><svg width="20" height="20"><use href="svg-icon/icons.svg#minus-svg-icon"></use></svg></a>
										</div>
									</div>
								</div>`;


$(document).on('click','.addProduct',function(){
    
	autoSecondUOMListModal = autoUOMListModal;
	$("#ProductModal .product_id").remove();
	$('#ProductModal .modal-title').text('Add Products / Services');
	$("#ProductModal .product_category_id").remove();
	$('#ProductModal .categoryOpt').css('display','none');
	$('#ProductModalForm')[0].reset();
	getListCategory();
	$("#ProductModal .product_group_id").val('');
	if($('#ProductModal .stockOption').hasClass('hidestock'))
	{
		$('#ProductModal .stockOption').hide();
	}
	else
	{
		$('#ProductModal .stockOption').show();
	}
	$('#ProductModal .normal-section').show();
	$('#ProductModal [name="itemType"][value="Product"]').click();
	$('#ProductModal [name="stockType"][value="Normal"]').click();
	$('#ProductModal #tagInputs').tagsinput('removeAll');
	$('#ProductModal .bootstrap-tagsinput input').attr('maxlength','30');
	$("#ProductModal .oldstockType").val('');
	$("#ProductModal .totalStock").val('');
	$("#ProductModal .uom-conversion-section").html('');
	$("#ProductModal .uom-conversion-section").hide();
	$('#ProductModal').modal('show');
    });

$(document).on('click','.addProductCategory',function(){
	$('#catename-error').remove();
	if($('.categoryOpt').css('display') == 'none'){
		$('.categoryOpt').slideDown();
	}else{
		$('.categoryOpt').slideUp();
	}
});

$(document).on('click','.catesave',function(){
	$('#catename-error').remove();
	var catename = $('.categoryname').val();
	var cathmac = $('#cathmac').val();
	if(catename == ''){
		$('.categoryname').after(`<label id="catename-error" class="error">Please enter your product group name</label>`);
	}else{
		var data = {category_name:catename,hmac:cathmac,is_active:'on',action:'SubmitCategoryModel'};
		$.ajax({
			type: "POST",
			url: "ajaxcall.php",
			ContentType: 'application/json',
			dataType: 'json',
			data: data,
			success: function(data) {
				if (data.status == 'OK') {
					$("body").removeClass("is-loading");
					$('.categoryname').val('');
					$('.categoryOpt').slideUp();
					availableCategory.push({
						value: data.cateid,
						name: data.catename,
					});
					addCateArr.push(data.cateid);
					getListCategory(addCateArr);
				}else{
					if(data.errorTitle)
					{
						var errTitle = data.errorTitle;
						var errMsg = data.data;
					}
					else{
						var errTitle = 'Error In Saving Product Group';
						var errMsg = data.msg;
					}
					errorMessage(errMsg,errTitle,'','error');
				}
				
			},
			complete: function(data) {}
		});
	}
});

	
$(document).ready(function() {
	$("#ProductCategoryModal form").validate({
		rules: {
			field: {
				required: true
			},
		},
		messages: {
			category_name: "Please enter product group name",
		},
		submitHandler: function(form) {
			var data = $(form).serialize() + '&action=SubmitCategoryModel';
			$.ajax({
				type: "POST",
				url: "ajaxcall.php",
				ContentType: 'application/json',
				dataType: 'json',
				data: data,
				success: function(data) {
					if (data.status == 'OK') {
						$('#ProductCategoryModal').modal('toggle');
						var currentURL = window.location.href;
						pageURL = currentURL.replace(/^.*[\\\/]/, '');
						if (pageURL == "list-category.php" || pageURL.indexOf("list-category.php") != -1) {
							var mode = data.redirect.split('?')[1].split('=');
							if(mode == 'insert'){
								window.location.href = data.redirect;
							}else{
								window.location.href = data.redirect+'&'+ $("#url_string").val();
							}

						} else {
							$("body").removeClass("is-loading");
							availableCategory.push({
								value: data.cateid,
								name: data.catename
							});
							getListCategory(data.cateid);
						}
					}
					if (data.status == "ERROR") {
						errorMessage(data.msg,'Error In Saving Detail','','error');
					}
				},
				complete: function(data) {}
			});
		}
	});
});


	function enterpressFunction(presskey){
		if (presskey === 13) {
			event.preventDefault();
	        $("#ProductModal .catesave").click();
	    }
	}

	function getListCategory(sel=''){

	   		var data = [];
	   		$.each(availableCategory,function(i,val){
	   				data.push({id:val.value, text:val.name});
	   		});
			$('#ProductModal .product_group_id').select2({
				data: data,
				dropdownParent: $('#ProductModal .product_group_id').parent()
			}).val(null).trigger("change"); 
			if(Array.isArray(sel))
	   		{
	   			try {
	  				$('#ProductModal .product_group_id').select2('destroy');
				}
				catch(err) {}

				$.each(sel, function(i,e){
	    			$("#ProductModal .product_group_id option[value='" + e + "']").attr("selected", "selected");
				});
				$('#ProductModal .product_group_id').select2({
					dropdownParent: $('#ProductModal .product_group_id').parent()
				});

				let productGroup = []
				$.each(data,function(i,val){
	   				if(sel.includes(val.id))
					{
						productGroup.push(val.text)
					}
					try {
						$('#ProdcutViewModal .prodcutgroup').text(productGroup.join())
					}
					catch(err) {}
					
	   			});
			}
	    }

	var membertype = 'free';
	$(document).on('click','[name=stockType]',function(){ 
		$('#ProductModal .stockchangenote').remove();
		if($(this).val() == 'Batch'){
			$('#ProductModal .batchQty').show();
			if(membertype != "premium"){
				$('#ProductModal').modal('hide');
				$('#trialModal_gst').modal('show');

			}else{
				$('#ProductModal .changeStockName').text('Batch Stock');
				$('#ProductModal .normal-section').hide();
				$('#ProductModal .serialno-section').hide();
				$('#ProductModal .serialno-section [name="serialno[]"]').val('');
				$('#ProductModal .batchOpt table tbody').html(addmorebatch);
				$('.stockOption ').hide();
				$('#product_lsa_batch').attr('name', 'product_lsa');
				$('#product_lsa').attr('name', 'disabled_product_lsa');
				if($('.oldstockType').val() != $(this).val()){
					$('.batch-section').show();
					monthYearDatepicker();
					dayWiseDatepicker();
					addMoreButtonFn('Batch');	
				}

			}

		}else if($(this).val() == 'Serial'){
			if(membertype != "premium"){
				$('#ProductModal').modal('hide');
				$('#trialModal_gst').modal('show');
			}else{
				$('#ProductModal .changeStockName').text('Serial No.');
				$('.batch-section').hide();
				$('.stockOption ').hide();
				$('#product_lsa_batch').attr('name', 'disabled_product_lsa');
				$('#product_lsa').attr('name', 'product_lsa');
				$('#ProductModal .normal-section').show();
				if($('.oldstockType').val() != $(this).val()){
					$('#ProductModal .serialno-section').show();
					addMoreButtonFn('Serial');
				}
			}
			$('#ProductModal .uom-conversion-section').hide();
		}else{
			$('#ProductModal .changeStockName').text('Normal Stock');
			$('#ProductModal .batchOpt table tbody').html('');
			$('#ProductModal .normal-section').show();
			$('#ProductModal .serialno-section').hide();
			$('#ProductModal .serialno-section [name="serialno[]"]').val('');
			$('#product_lsa_batch').attr('name', 'disabled_product_lsa');
			$('#product_lsa').attr('name', 'product_lsa');
			$('.stockOption').show();
			$('.batch-section').hide();
		}
		var quantity_decimal_rounding_by = 2;
		if($("#ProductModal [name='product_id']").val() != '' && $("#ProductModal [name='product_id']").val() != undefined){
			$('.stockOption').hide();
            if(($(this).val() == 'Normal' || $(this).val() == 'Batch') && $('.oldstockType').val() == 'Serial'){
                Swal.fire({
                    html: "Do you really want to convert this product? <br> Once converted, all serial no. will be permanently deleted and cannot be restored.",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonText: "OK",
                    cancelButtonText: "Cancel",
                    reverseButtons: true,
                  }).then((result) => {
                    if (result.isConfirmed) {
                        return true;
                    }else{
                        $("#ProductModal [name='stockType'][value='Serial']").click();
                    }
                });
            } else if($(this).val() != 'Normal' && $('.oldstockType').val() != $(this).val()){
				$('#ProductModal [name="NewStock"]').val($('#ProductModal .totalStock').val());
				$('#ProductModal .serialno-section .bootstrap-tagsinput').after(`<span class="stockchangenote">please enter ${$('#ProductModal .totalStock').val()} serial no. </span>`);
				var stocktype = $(this).val();
				$.ajax({  
					type: "POST",  
					url: "ajaxcall.php",  
					ContentType : 'application/json',
					dataType: 'json',
					data: {action:'getMigrateStock',product_id:$("#ProductModal [name='product_id']").val(),stockType:$(this).val()},
					beforeSend: function() {
 	  					$("body").addClass("is-loading");
 	  				},
					success: function(data){
						if(data.status=='OK')
						{
							if(data.htmldata != ''){
								var newStockTemp = 0;
								if(stocktype == 'Batch'){
									$(data.htmldata).each(function(i,v){
										newStockTemp += parseFloat(v.quantity);
										var quantity = v.quantity;
										quantity  = quantity.toString().substring(0, quantity.toString().indexOf('.') + 1 + quantity_decimal_rounding_by);
										$('#ProductModal .batchOpt [name="batch_name[]"]:last').val(v.batch_name);
										$('#ProductModal .batchOpt [name="model_no[]"]:last').val(v.model_no);
										$('#ProductModal .batchOpt [name="size[]"]:last').val(v.size);
										$('#ProductModal .batchOpt [name="manufacture_date[]"]:last').val(v.manufacture_date);
										$('#ProductModal .batchOpt [name="expiry_date[]"]:last').val(v.expiry_date);
										$('#ProductModal .batchOpt [name="quantity[]"]:last').val(quantity);
										$('#ProductModal .batchOpt [name="product_batch_id[]"]:last').val(v.product_batch_id);
										$('#ProductModal .batchOpt [name="price[]"]:last').val(v.price);
										$('#ProductModal .batchOpt [name="purchase_price[]"]:last').val(v.purchase_price).change();
										$('#ProductModal #cgst').change();
										$('.removeBatch:last').css({'visibility':'hidden'});
										$('.addBatch:last').click();
									});
								}else{
									var tags = data.htmldata;
									$.each(tags, function(i, el){
										newStockTemp ++;
										$('#ProductModal #tagInputs').tagsinput('add',el.serialno);
									});
								}	

								$('#ProductModal [name="NewStock"]').val(newStockTemp);
							}
							// $('#ProductModal .totalStock').val(data.data);
							// var totalitemavl = $('#ProductModal .totalStock').attr('totalitemavl');
							// if(totalitemavl != data.data){
							// 	$('#ProductModal .changeStockName').after(`<span class="stockchangenote">Note :- ${totalitemavl - data.data} quantity already use in invoice and please enter exact ${data.data} quantity </span>`);
							// }else{
							// 	$('#ProductModal .changeStockName').after(`<span class="stockchangenote">Note :- please enter exact ${data.data} quantity </span>`);
							// }

						}
					}
				});

			}
		}

		if($('#ProductModal .stockOption').hasClass('hidestock')){
			$('.hidestock').hide();	
		}

	});
	
	$('#ProductModal #tagInputs').tagsinput({
		confirmKeys: [13, 44],
		itemText: function(item) {
			return item.replace(/\b\w/g, l => l.toUpperCase());
		},
		maxTags: 250,
	});

	$('#ProductModal  input').on('keypress', function(e){
		if (e.keyCode == 13){
			e.keyCode = 188;
			e.preventDefault();
		};
	});

	$(document).on('click','.addNormal',function(){
		$('#ProductModal .normalOpt table tbody tr:last').after(addmorenormal);
	});	

	$(document).on('click','.addSerialNo',function(){
		$('#ProductModal .serialno-section .controls:last').after(addmoreserial);
		addMoreButtonFn('Serial');
	});	

function addMoreButtonFn(option=''){
	if(option == 'Batch'){
		var stockcls = '.batchOpt';
		var stockaddbtn = '.addBatch';
		var stockremovebtn = '.removeBatch';
		var row = $('#ProductModal '+stockcls+' table tbody tr');
	}else if(option == 'Serial'){
		var stockaddbtn = '.addSerialNo';
		var stockremovebtn = '.removeSerialNo';
		var row = $('#ProductModal .serialno-section .controls');
	}else{
		var stockcls = '.normalOpt';
		var stockaddbtn = '.addNormal';
		var stockremovebtn = '.removeNormal';
		var row = $('#ProductModal '+stockcls+' table tbody tr');
	}
	var rowcounter = 1;
	var rowlength = row.length;
	row.each(function(){
		if(rowlength == rowcounter)
		{
			$(this).find(stockaddbtn).show();
			$(this).find(stockremovebtn).hide();
		}
		else
		{
			$(this).find(stockaddbtn).hide();
			$(this).find(stockremovebtn).show();
		}
		rowcounter += 1;
	});
}	 

$(document).on('click','.removeSerialNo',function(){
	$(this).closest('.controls').remove();
	addMoreButtonFn('Serial');
});

$(document).on('click','.addBatch',function(){
	$('#ProductModal .batchOpt table tbody tr:last').after(addmorebatch);
	addMoreButtonFn('Batch');	
	monthYearDatepicker();
	dayWiseDatepicker();					
});	 

$(document).on('click','.removeBatch',function(){
	var removeclass = $(this).closest('tr');
	var batchid = $(this).closest('tr').find('[name="product_batch_id[]"]').val();
	if(batchid != ''){
		Swal.fire({
			  title: 'Do you really want to delete these batch?',
			  icon: 'warning',
			  showCancelButton: true,
			  confirmButtonColor: '#3085d6',
			  cancelButtonColor: '#d33',
			  cancelButtonText: 'No',
			  confirmButtonText: 'Yes',
			  reverseButtons: true
		}).then((result) => {
		  	if (result.isConfirmed) {
				var product_id = $('#ProductModal [name=product_id]').val();		
				
				var data = {
					action: 'deleteProductBatch',			
					id:batchid,
					product_id:product_id,
				}
				$.ajax({  
					type: "POST",  
					url: "ajaxcall.php",  
					ContentType : 'application/json',
					dataType: 'json',
					data: data,
					success: function(data){
						if(data.status=='OK')
						{
							removeclass.remove();					
						}else{
							errorMessage(data.message,'ERROR','','error');
						}
					}
				});
			}
		});
	
	}else{
		addMoreButtonFn('Batch');
		$(this).closest('tr').remove();
	} 
	calculateBatchQty();
});

$(document).on('change',"#ProductModal .batchOpt table tbody tr:last [name='price[]'] , #ProductModal .batchOpt table tbody tr:last [name='quantity[]'], #ProductModal .batchOpt table tbody tr:last [name='sellpriceincltax[]']",function(){
	if($(this).closest('tr').find("[name='quantity[]']").val() != '' && $(this).closest('tr').find("[name='price[]']").val() != ''
		&& $('#ProductModal [name="oldstockType"]').val() != $("#ProductModal input[name='stockType']:checked").val()){
		var sellprice = $(this).closest('tr').find("[name='price[]']").val();
		var sellpriceincltax = $(this).closest('tr').find("[name='sellpriceincltax[]']").val();
		$('#ProductModal .batchOpt table tbody').append(addmorebatch);	
		addMoreButtonFn('Batch');	
		monthYearDatepicker();
		dayWiseDatepicker();
		$("#ProductModal .batchOpt table tbody tr:last [name='price[]']").val(sellprice);	
		$("#ProductModal .batchOpt table tbody tr:last [name='sellpriceincltax[]']").val(sellpriceincltax);	
	}
});


$(document).on('change',"#ProductModal .batchOpt table tbody tr [name='quantity[]']",function(){
	calculateBatchQty();	
});

function calculateBatchQty(){
	var newStockTemp = 0;
	$("#ProductModal .batchOpt table tbody tr").each(function(){
		if($(this).find("[name='quantity[]']").val() != ''){
			newStockTemp += parseFloat($(this).find("[name='quantity[]']").val());
			$('#ProductModal [name="NewStock"]').val(newStockTemp);
		}
	});
}

function validateBatchRows(){
	var isValid = true;
	var productid = $("#ProductModal [name='product_id']").val();
	if(productid == '' || productid == undefined || ($('#ProductModal [name="product_id"]').val() != '' && $('#ProductModal [name="totalStock"]').val() != '')){
		var stockType = $("#ProductModal input[name='stockType']:checked").val();
		var totalStock = parseFloat($('#ProductModal [name="totalStock"]').val());
		if(stockType == 'Batch'){
			if($("#ProductModal .batchOpt table tbody tr").length>0)
			{
				var RowCounter = 1;
				var totalRowsData = $("#ProductModal .batchOpt table tbody tr");
				var counttotalRowsData = totalRowsData.length;
				totalRowsData.each(function(){
					if(counttotalRowsData == 1 || counttotalRowsData >= RowCounter){
						if(counttotalRowsData == RowCounter){
							var isPriceval = true;
							$(this).find("input").each(function(){
								var attrName = $(this).attr('name');
								var attrVal = $(this).val().trim();
								var colname = '';
								switch(attrName){
									case 'batch_name[]': colname = "Batch No."; if(attrVal != ''){
											isPriceval = false;
										} break;
																	case 'quantity[]': 
										colname = "Quantity";
										if(attrVal != ''){
											isPriceval = false;
										}
										break;
									case 'price[]': 
										colname = "Sale Price";
								}
							});	
							
							    if(isPriceval) {
									return false;
								}		
						}
						$(this).find("input").each(function(){
								var attrName = $(this).attr('name');
								var attrVal = $(this).val().trim();
								var colname = '';
								switch(attrName){
									case 'batch_name[]': colname = "Batch No."; break;
																	case 'quantity[]': 
										colname = "Quantity";
										break;
									case 'price[]': 
										colname = "Sale Price";
										break;
								}
								if( attrVal == "" && colname != '')
								{
									Swal.fire({
										icon: 'warning',
										title: 'Please Enter '+colname,
										didClose: (e) => {
											$(this).focus();
										}
									});
									isValid = false;
									return false;
								}
						});
						RowCounter++;
					}

				});
			}
			
			if($('#ProductModal [name="oldstockType"]').val() != stockType){
				if($('#ProductModal [name="product_id"]').val() != '' && $('#ProductModal [name="totalStock"]').val() != ''){
					var newStock = parseFloat($('#ProductModal [name="NewStock"]').val());
					if(totalStock != newStock){
						Swal.fire({
									icon: 'warning',
									title: 'Please Enter Exact '+totalStock+' Quantity',
									didClose: (e) => {
										$('#ProductModal .batchOpt [name="quantity[]"]:last').focus();
									}
								});
						isValid = false;
						return false;
					}
				}	
			}

		}else if(stockType == 'Serial' && $('#ProductModal [name="oldstockType"]').val() != 'Serial'){
									if(productid != '' && productid != undefined){
							if(totalStock != $("#ProductModal [name='serialno']").val().split(',').length){
								Swal.fire({
									icon: 'warning',
									title: 'Please Enter Exact '+totalStock+' Serial No.',
									didClose: (e) => {
										$('#ProductModal .bootstrap-tagsinput input').focus();
									}
								});
								isValid = false;
								return false;
							}
						}
								
		}
	}
	return isValid;
}

$(document).on('keyup',"#ProductModal [name='batch_name[]']",function(){
	var product_id = $('#ProductModal [name=product_id]').val();
	var curcls = $(this).closest('tr');
	$batchName = $(this);
	$batchName.autocomplete({
		source: function( request, response ) {
			$.ajax({
	          type:'POST',	
	          url: "ajaxcall.php",
	          dataType: "json",
	          data: {
	            q: request.term,action:'getBatch',product_id:product_id,quantity:1
	          },
	          beforeSend: function() {
			        $("body").removeClass("is-loading");
			  },
	          success: function( data ) {
	          	response( data.batchdata );
	          }
	        });
	      },
	      minLength: 1,
		change: function(event, ui) {
			if (ui.item == null || ui.item == undefined) {
				var $targetparnt = $(this).parents(".product-item-row");
			}
			else{
				if (ui.item) {
					var $targetparnt = $(this).parents(".product-item-row");
					$($targetparnt).find( ".batch_name" ).val( ui.item.batch_name);			
				}
			}
		},
		select: function( event, ui ) {
			curcls.find("[name='product_batch_id[]']").val(ui.item.product_batch_id);
			curcls.find("[name='batch_name[]']").val(ui.item.batch_name);
			curcls.find("[name='manufacture_date[]']").val(ui.item.manufacture_date);
			curcls.find("[name='expiry_date[]']").val(ui.item.expiry_date);
			curcls.find("[name='quantity[]']").val(ui.item.quantity);
			curcls.find("[name='mrp[]']").val(ui.item.mrp);
			curcls.find("[name='price[]']").val(ui.item.price);
			return false;
		}, minLength:0
	}).focus(function(){            
	        $(this).autocomplete("search");
	});

});

$(document).on('keyup change blur','#ProductModal .batchOpt .inputlabel_wrapper input',function(){
	$('#ProductModal .batchOpt .inputlabel_wrapper input[type="text"]').each(function(){
		var inputlabel_wrapper = $(this).closest('.inputlabel_wrapper');
		if($(this).val() || $(this).is(':focus')) {
			inputlabel_wrapper.addClass('active_inputlabel');
		}else{
			inputlabel_wrapper.removeClass('active_inputlabel');
		}
	});
});

$(document).on('click','[name=itemType]',function(){
	var itemType = $(this).val();
	$("#ProductModal [name='stockType'][value='Normal']").click();
	$("#ProductModal [name='stockType'][value='Batch']").closest('label').show();
	$("#ProductModal [name='stockType'][value='Serial']").closest('label').show();
	$("#ProductModal .stockOption").show();
	if(itemType == 'Service'){
		$("#ProductModal .stockOption").hide();
		$("#ProductModal [name='stockType'][value='Batch']").closest('label').hide();
		$("#ProductModal [name='stockType'][value='Serial']").closest('label').hide();
	}
});

function getProductBatch(productid){
	$.ajax({  
			type: "POST",  
			url: "ajaxcall.php",  
			ContentType : 'application/json',
			dataType: 'json',
			data: {action:'getProductBatch',productid:productid},
			beforeSend: function() {
				$("body").addClass("is-loading");
			},
			success: function(data){
				$('#ProductModal .batchQty').hide();
				if(data.status=='OK')
				{
					if(data.data != ''){
						$('#ProductModal .batchOpt tbody').html(data.data);
						$('#ProductModal #igst').change();
						monthYearDatepicker();
						dayWiseDatepicker();
					}
				}
				$('#ProductModal .batchOpt .addmore-section').show();

			}
		});	
}	

//for show goods and service finder model

	$(document).on("click", ".ViewhsnFinder", function() {
		var iframeSrc = $(this).attr("data-baselink");
		var hsncode =  $(this).closest('.hsn_field').find('#hsn').val();
		if(hsncode != ""){
			iframeSrc = iframeSrc+'?hsn='+hsncode;
		}
		if(iframeSrc != ""){
			$('#PrIntHsnModal').modal('show').on('shown', function() {
									parent.$("#PrIntHsnModal").css({"z-index":"200001"});
								$("#PrIntHsnModal iframe").attr("src", iframeSrc );
				$("#PrIntHsnModal .modal-content").removeClass("is-loading");
				if(window.innerHeight < $('#PrIntHsnModal iframe').height())
				{
					$('#PrIntHsnModal, #PrIntHsnModal #hsn_iframe').height(window.innerHeight);
				}
			});
		}
	
	});

$(document).on('click','#ProductModal .uomconversionbtn',function(){
	if($('#ProductModal [name="uom"]').val() != '' && $('#ProductModal [name="oldstockType"]').val() != 'Serial' && $("#ProductModal [name='stockType']:checked").val() != 'Serial'){
		var unitBase = $('#ProductModal [name="uom"]').val();
		$('#ProductModal .uom-conversion-section').html(`<div class="conversion-uom-section"> 1 <span class="uom-base-unit">${unitBase}</span> = <input type="text" name="uom_rates[]" class="decimal_numeric_only" maxlength="10" placeholder="Qty."> <input type="hidden" name="secoundry_unit[]" value="">
			<input type="text" class="secoundry_unit" placeholder="Select UOM">
			<div class="btn btn-primary right_modal_btn addUnitRates btnaddmoreoption "><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></div></div>`);
		if($('#ProductModal .uom-conversion-section').css('display') == 'none'){
			$('#ProductModal .uom-conversion-section').slideDown();
			autocompleteUom(".secoundry_unit");
			countuomsection++;
		}else{
			$('#ProductModal .uom-conversion-section').slideUp();
		}
	}

});

function autocompleteUom(request){
	$(request).autocomplete({
		source: autoSecondUOMListModal,
		change: function(event, ui) {
			if (ui.item == null || ui.item == undefined) {} else {
				if (ui.item) {
					$(this).val(ui.item.value);
				}
			}
		},
		select: function(event, ui) {
			$(this).val(ui.item.value);
			$(this).closest('.conversion-uom-section').find('[name="secoundry_unit[]"]').val(ui.item.value);
			autoSecondUOMListModal = $.grep(autoSecondUOMListModal, function (element, index) {
			    return element.value != ui.item.value;
			});
			return false;
		},
		minLength: 0
	}).focus(function() {
		$(this).autocomplete("search");
	});
}

$(document).on('focus',"#ProductModal .secoundry_unit",function(){
	var dataValue = $(this).closest('.conversion-uom-section').find('[name="secoundry_unit[]"]').val();
	if(dataValue != '' && dataValue != undefined){
		var uomArr = [];
		$(this).closest('.uom-conversion-section').find('.conversion-uom-section').each(function(n,v){
			if($(this).find('[name="secoundry_unit[]"]').val() != ''){
				uomArr.push($(this).find('[name="secoundry_unit[]"]').val());
			}
		});
		if(uomArr.length > 0){
			autoSecondUOMListModal = $.grep(autoSecondUOMListModal, function (element, index) {
			    return $.inArray(element.value, uomArr) == -1;
			});
			var currentdata = $.grep(autoUOMListModal, function (element, index) {
			    return element.value == dataValue;
			});
			autoSecondUOMListModal.push(currentdata[0]);
			autoSecondUOMListModal.sort((a, b) => a.label.localeCompare(b.label));
		}
	}
	autocompleteUom($(this));
	

});

$(document).on('click','#ProductModal .addUnitRates',function(){
	if(countuomsection < 5){
		var i = $(this).closest('.conversion-uom-section').index();
		var unitBase = $('#ProductModal [name="uom"]').val();
		
		$('#ProductModal .uom-conversion-section .conversion-uom-section:last').after(`<div class="conversion-uom-section"> 1 <span class="uom-base-unit">${unitBase}</span> = <input type="text" name="uom_rates[]" class="decimal_numeric_only" maxlength="10" placeholder="Qty."> <input type="hidden" name="secoundry_unit[]" value="">
				<input type="text" class="secoundry_unit" placeholder="Select UOM">
				<div class="btn btn-primary right_modal_btn addUnitRates btnaddmoreoption "><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg></div></div>`);

		autocompleteUom('.secoundry_unit');      
		var previousSection = $('#ProductModal .uom-conversion-section').find('.conversion-uom-section:last').prev('.conversion-uom-section');
		previousSection.find('.addUnitRates').after(`<div class="btn btn-danger right_modal_btn removeUnitRates btnaddmoreoption "><svg width="20" height="20"><use href="svg-icon/icons.svg#minus-svg-icon"></use></svg></div>`);
		previousSection.find('.addUnitRates').remove('.addUnitRates');
	}
	countuomsection++;
});

$(document).on('click','#ProductModal .removeUnitRates',function(){
	var uomSection = $(this).closest('.conversion-uom-section');
	var dataValue = $(this).closest('.conversion-uom-section').find("[name='secoundry_unit[]']").val();
	if(dataValue != ''){
		var deleteuom = true;
		var productid = $('#ProductModal .product_id').val();
		if(productid != ''){
			var data = {
				action: 'deleteProductUOM',			
				uom:dataValue,
				product_id:productid,
			}
			$.ajax({  
				type: "POST",  
				url: "ajaxcall.php",  
				ContentType : 'application/json',
				dataType: 'json',
				data: data,
				beforeSend: function() {
                   $("body").removeClass("is-loading");
                },
				success: function(data){
					if(data.status=='OK')
					{
						var currentdata = $.grep(autoUOMListModal, function (element, index) {
							return element.value == dataValue;
						});
						autoSecondUOMListModal.push(currentdata[0]);
						autoSecondUOMListModal.sort((a, b) => a.label.localeCompare(b.label));
						uomSection.remove();
						countuomsection--;			
					}else{
						deleteuom = false;
						errorMessage(data.message,'ERROR','','error');
					}
				}
			});
		}else{
			var currentdata = $.grep(autoUOMListModal, function (element, index) {
				return element.value == dataValue;
			});
			autoSecondUOMListModal.push(currentdata[0]);
			autoSecondUOMListModal.sort((a, b) => a.label.localeCompare(b.label));
			uomSection.remove();
			countuomsection--;	
		}
		
	}else{
		uomSection.remove();
		countuomsection--;
	}
	
});
$(document).ready(function(){
	$(document).on('change','.trans_mode', function(){
		checkewayvalidation($(this));
	});
	$(document).on('input', '#cur_pincode', function() {
		var cur_pincode = $(this).val().replace(/\s+/g, '');
			if (/^\d{6}$/.test(cur_pincode)) {
				var org_pincode = cur_pincode;
				var pincode = $('#to_pincode').val();
				
					data = {
						action: 'dist_apicall',
						from: org_pincode,
						to: pincode
					}
					$.ajax({
						type: 'POST',
						data: data,
						url: "ajaxcall.php",
						ContentType: 'application/json',
						dataType: 'json',
						beforeSend: function() {
							$("body").addClass("is-loading");
						},
						success: function(data) {
							if (data.status == 'OK') {
								$('#eway_distance').val(data.dist_apicall);
								$('.auto-distance').text(data.dist_apicall);
							} else {
								if(data.errorTitle)
								{
									var errTitle = data.errorTitle;
								}
								else{
									var errTitle = 'Error';
								}
								errorMessage('',errTitle,data.data,'error');
								$("body").removeClass("is-loading");
							}
						},
						error: function(xhr, status, error) {
							var err = xhr.responseText;
							if(data.errorTitle)
							{
								var errTitle = data.errorTitle;
							}
							else{
								var errTitle = 'Error';
							}
							errorMessage('',errTitle,err.Message,'error');
							$("body").removeClass("is-loading");
						},
						complete: function() {

						}
					});
			}
	});

});
	$("#extendewaymodal form").validate({
			rules: {
				'ext_reason': {
					required: true
				},'ext_remark': {
					required: true
				},'vehicle_no': {
					required: true
				},'trans_mode': {
					required: true
				},'consignment_in': {
					required: true
				},'cur_state': {
					required: true
				},'cur_pincode': {
					required: true
				},'cur_place': {
					required: true
				},
				'address_line_1': {
					required: function() {
						return $('.trans_mode').val() == 5;
					}
				},
				'address_line_2': {
					required: function() {
						return $('.trans_mode').val() == 5;
					}
				},
				'address_line_3': {
					required: function() {
						return $('.trans_mode').val() == 5;
					}
				}
			},
			messages: {
				'ext_reason': "Please enter your Extenstion Reason",
				'ext_remark': "Please enter Extension Remark",
				'vehicle_no': "Please enter Vehical Number",
				'trans_mode': "Please enter Transport mode",
				'consignment_in': "Please enter Consignment",
				'cur_state': "Please enter Current state",
				'cur_pincode': "Please enter Current pincode",
				'cur_place': "Please enter Current place",
				'address_line_1': "Please enter Address 1",
				'address_line_2': "Please enter Address 2",
				'address_line_3': "Please enter Address 3",
			},
			submitHandler: function(form) {
						var cur_statecode = $('select[name="cur_state"] option:selected').data('statecode');
						var formData = $(form).serializeArray();
						var formDataObj = {};
						$.each(formData, function (i, field) {
							formDataObj[field.name] = field.value;
						});
						if(formDataObj.trans_mode != 5)
						{
							formDataObj.transit_type = '';
						}
						var ccdata = {
						"action": "EXTENDVALIDITY",
						"invid": formDataObj.invid,
						"ewbNo": formDataObj.ewayID,
						"vehicleNo": formDataObj.vehicle_no,
						"fromPlace": formDataObj.cur_place,
						"fromState": cur_statecode,
						"remainingDistance": formDataObj.eway_distance,
						"transDocNo": formDataObj.trans_mode,
						"transDocDate": "11/10/2024",
						"transMode": formDataObj.trans_mode,
						"extnRsnCode": 1,
						"extnRemarks": formDataObj.ext_remark,
						"fromPincode": formDataObj.cur_pincode,
						"consignmentStatus": formDataObj.consignment_in_hidden,
						"transitType": formDataObj.transit_type,
						"addressLine1": formDataObj.address_line_1,
						"addressLine2": formDataObj.address_line_2,
						"addressLine3": formDataObj.address_line_3
						}
						var data = {
							action: 'ExtendEwayBill',			
							data:ccdata
						};
						$.ajax({  
							type: "POST",  
							url: "eway_einvoice/eway.php",  
							ContentType : 'application/json',
							dataType: 'json',
							data: data,
							success: function(response) {
										if (response.status === 'OK') {
											if (response.data.ewayBillNo) {  // Check if ewayBillNo exists
												Swal.fire({
													icon: 'success',
													title: 'E-Way Bill Extend Successfully',
													text: `E-Way Bill No: ${response.data.ewayBillNo}, Updated Date: ${response.data.updatedDate}`
												})
												update_ewaydetail(response.data.ewayBillNo,response.data.updatedDate,response.data.validUpto);
											}
										} else if (response.status === 'ERROR') {
											errorMessage('', 'Error', response.data, 'error');
										}
									},
							});
				
			},
			error: function(data) {
			},
			complete: function(data) {}
		});

		function checkewayvalidation(curele){
			if (curele.val() == ''){
				$('select.transit_type').prop('disabled',false);
				$('.consignment_in').prop('disabled', false);
			}

			if (curele.val() >= 1 && curele.val() <= 4) {	
				$('select.consignment_in').val('M');
				$('input.consignment_in_hidden').val('M');
				$('select.transit_type').val('');
				$('select.transit_type option[value=""]').prop('selected',true);
				$('select.transit_type').prop('disabled',true);
				$('.consignment_in').prop('disabled', true);

				$('.address_line_1').prop('disabled', true);
				$('.address_line_1').val('');
				$('.address_line_2').prop('disabled', true);
				$('.address_line_2').val('');
				$('.address_line_3').prop('disabled', true);
				$('.address_line_3').val('');
			}else if(curele.val() == 5){
				$('select.consignment_in').val('T');
				$('input.consignment_in_hidden').val('T');
				$('select.transit_type').prop('disabled',false);
				$('.consignment_in').prop('disabled', true);
				
				$('.address_line_1').prop('disabled', false);
				$('.address_line_2').prop('disabled', false);
				$('.address_line_3').prop('disabled', false);
			}

		}
		function update_ewaydetail(ewayno,updated_on,new_validity,invid)
		{
			var invid = $('#extendewaymodalForm #invid').val();
			
			var data = {
				action: 'update_ewayvalidity',			
				invid:invid,
				ewayno:ewayno,
				updated_on:updated_on,
				new_validity:new_validity
			};
			$.ajax({  
					type: "POST",  
					url: "ajaxcall.php",  
					ContentType : 'application/json',
					dataType: 'json',
					data: data,
					success: function(response) {
					if(response.status=="OK")
					{
						$('.actions_detail_icons_eway[data-id='+invid+']').show();
						$('.actions_detail_icons_eway[data-id='+invid+']').attr('title',response.tooltip_msg);
						$('.actions_detail_icons_eway[data-id='+invid+'] i').removeClass('eway-einvoice-cancel').addClass('eway-einvoice-active');
						$('.extendEwayBill[data-id='+invid+']').attr('data-valid',new_validity);
						$('#extendewaymodal').modal('hide');
					}
					}
				});
		}

</script>
<script>
	$(window).load(function() {
		equalheight('.equal-height');
	});
	$(window).resize(function() {
		equalheight('.equal-height');
	});
</script>


<div id="CustomFieldModal" class="popup_right_slider modal fade " role="dialog" style="display: none;">
	<div class="modal-dialog">


		<form class="form-horizontal customfiledform custom-field-form" id="customfiledform" >
			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Custom Field</h4>
				</div>
				<div class="modal-body">
						<div class="widget-content">
								<fieldset>
									<div id="PrintOptions">	
																								
																						  
																							
											

											
											

										
											

										
											
											
											
											  	                                        <div id="CustomerVendor" class="custom-filed-section">
												<table class="table custom_field_table" data-footable data-toggle-column="last">
															<thead>
																<tr>
																	<th style="width:15px">No.</th>
																	<th >Type</th>
																	<th data-breakpoints="xs">Print</th>
																	<th data-breakpoints="sm">Name</th>
																</tr>
															</thead><!-- /thead -->
															<tbody>

																<tr>
																	<td>1</td>
																	<td><div class="d-flex"><svg width="20" height="20"><use href="svg-icon/icons.svg#cursor-svg-icon"></use></svg> Text</div>
																	<td>
																		<div class="custom_field_align_right">
																			<div class="checkbox-toggle-switch">
																				<input type="checkbox" id="print_customer_text_1" name="print_customer_text_1" class="checkbox-toggle" >
																				<label for="print_customer_text_1" class="checkbox-toggle-label"></label>
																			</div>
																		</div>
																	</td>
																	<td>
																		<input type="text"  value="License No." name="customer_text_1_lable" id="customer_text_1_lable" class="span4" placeholder="Enter Field 1 Label" >
																	</td>
																</tr>
																<tr>
																	<td>2</td>
																	<td><div class="d-flex"><svg width="20" height="20"><use href="svg-icon/icons.svg#cursor-svg-icon"></use></svg> Text</div>
																	<td>
																		<div class="custom_field_align_right">
																			<div class="checkbox-toggle-switch">
																				<input type="checkbox" id="print_customer_text_2" name="print_customer_text_2" class="checkbox-toggle" >
																				<label for="print_customer_text_2" class="checkbox-toggle-label"></label>
																			</div>
																		</div>
																	</td>
																	<td>
																		<input type="text"  value="custom field 1" name="customer_text_2_lable" id="customer_text_2_lable" class="span4" placeholder="Enter Field 2 Label" >
																	</td>
																</tr>
																<tr>
																	<td>3</td>
																	<td><div class="d-flex"><svg width="20" height="20"><use href="svg-icon/icons.svg#cursor-svg-icon"></use></svg> Text</div>
																	<td>
																		<div class="custom_field_align_right">
																			<div class="checkbox-toggle-switch">
																				<input type="checkbox" id="print_customer_text_3" name="print_customer_text_3" class="checkbox-toggle" >
																				<label for="print_customer_text_3" class="checkbox-toggle-label"></label>
																			</div>
																		</div>
																	</td>
																	<td>
																		<input type="text"  value="custom field 2" name="customer_text_3_lable" id="customer_text_3_lable" class="span4" placeholder="Enter Field 3 Label" >
																	</td>
																</tr>

															</tbody><!-- /tbody -->
														</table><!-- /table -->
	                                          </div>
											  											  
                                            											  
											
	                                  </div>
	                                </div> 
                              </fieldset>
                     	 </div>
                  </div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
					<input type="hidden" value="161818" name="select_id" id="select_id" >
					<input type="hidden" name="hidden_submit_form_data" id="hidden_submit_form_data" value="yes"/>
					<input type="hidden" value="general_options" name="submit_type">
					<button  class="btn btn-primary pull-mobile-right floate-right" id="submit-custom-filed" type="btn"><svg width="20" height="20"><use href="svg-icon/icons.svg#save-svg-icon"></use></svg>Save</button>
				</div>
			</div>
		</form>

			  <script>
				var pagename = 'list-company';
				var is_shipping_filed = '';
				function checkFirstCheckboxInRow(row) {
							var checkboxes = row.find('input[type="checkbox"]');
							var firstCheckbox = checkboxes.first();
							isChecked=false;
							var name = firstCheckbox.prop('name');
							if(!name.endsWith('_lable')){
									if (!firstCheckbox.is(':checked')) {
										firstCheckbox.prop('checked', true);
										isChecked=true;
									}
							}
							if (name.endsWith('extra_select_field') || name.endsWith('_extra_select_field')) {
								if (isChecked) {	
									$('.' + name + '_data').slideToggle();	
									return;
								}	
							}
						}

					function uncheckCheckboxInRow(row) {
							var checkboxes = row.find('input[type="checkbox"]');
							var firstCheckbox = checkboxes.first();
							var name = firstCheckbox.prop('name');
							if(!name.endsWith('_lable')){
							if (firstCheckbox.is(':not(:checked)')) {
								checkboxes.prop('checked', false);
								}	
							}			
							}
							$(document).ready(function() {  
								
						$('#CustomFieldModal input[type="checkbox"]').on('change', function() {
							var checkbox = $(this);
							var viewportWidth = window.innerWidth || document.documentElement.clientWidth;	
							if (viewportWidth <= 1200) {
								var row = checkbox.closest('#CustomFieldModal tbody');
							} else {
								var row = checkbox.closest('tr');
							}
							var checkboxesInRow = row.find('input[type="checkbox"]');
							var index = checkboxesInRow.index(checkbox); 
							if(index<1){		
								uncheckCheckboxInRow(row)
							}else{
								checkFirstCheckboxInRow(row);
							}
							
					});
				  });
				const url = new URL(window.location.href);
				  $('#customfiledform').on('submit', function(e) {
						e.preventDefault(); 
						var formData = $(this).serialize();
						formData += "&action=submitCustomFiled";
						$.ajax({
							url: 'custom_field_column.php',
							type: 'POST',
							data: formData,
							beforeSend: function() {
								$('#CustomFieldModal button[name="btnsubmit"]').prop('disabled', true);
							},
							success: function(response) {
								if(response.status=="SUCCESS"){
									const updateUrlParam = (param, value) => {
										url.searchParams.set(param, value);
										url.searchParams.set("custom_field", "update");
										window.location.href = url.toString();
									};
									if (pagename === "list-company") {
										let companyId = $('#CustomerModal').find(".company_id").val();
										updateUrlParam("open_que", companyId || 0);
									} 
									else if (pagename === "shipping_address" && is_shipping_filed!="") {
										let shipping_id = $('#ShippingModal').find(".shipping_address_id").val();
										updateUrlParam("open_que", shipping_id || 0);
									} 
									else if (pagename === "list-paymentreceipt") {
										let receiptNo = $("#PaymentRecieptModal .modal-body").find("input[name='id']").val()
										updateUrlParam("open_que", receiptNo || 0);
									} else {
										url.searchParams.set("custom_field", "update");
										window.location.href = url.toString();
									}	
								}
								else{
									Swal.fire({
										icon: 'error',
										title:response.status
									});
								}
								
							},
						});
					});	
					if (url.searchParams.get("custom_field") === "update") {
						url.searchParams.delete("custom_field");
						window.history.replaceState({}, document.title, url.toString());
						Toast.fire({
							icon: 'success',
							title:"Custom Field Details Updated successfully."
						});
					}
					$('#CustomFieldModal').on('shown.bs.modal', function () {
						$('.CustomFieldModal-btn svg').tooltip("close");
					});
			  </script>
			  
	</div>
	</div></div> </div> </div>  <!-- /main -->
    
        
<div class="footer">
	<div class="footer-inner">
		<div class="container">
			<div class="row">
    			<div class="span12">
    				&copy; 2025 <a href="">Go GST Bill</a>&nbsp;
					
					
									</div> <!-- /span12 -->
    		</div> <!-- /row -->
		</div> <!-- /container -->
	</div> <!-- /footer-inner -->
</div> <!-- /footer -->

<script>

var refreshSn = function ()
{
    var time = 600000; 
    setTimeout(
        function ()
        {
        $.ajax({
           url: 'keep_alive.php',
           cache: false,
           complete: function () {refreshSn();}
        });
    },
    time
);
};


refreshSn();

			$(document).on("click", ".ViewKnowledgeModal", function() {
				var iframeSrc = $(this).attr("data-baselink");
				if(iframeSrc != ""){
					$('#ViewKnowledgeModal').modal('show').on('shown', function() {	
						$("#ViewKnowledgeModal iframe").attr("src", iframeSrc );
						$("#ViewKnowledgeModal .modal-content").removeClass("is-loading");
						if(window.innerHeight < $('#ViewKnowledgeModal iframe').height())
					    {
					    	$('#ViewKnowledgeModal, #ViewKnowledgeModal #ViewKnowledgeModal_iframe').height(window.innerHeight);
					    }
					});
				}
			
			});

</script>
<div id="gogst_popup" class="widget">
	<div class="widget-header">
		<i class="fa fa-info"></i>
		<h3 class="gogst_popup-header"></h3>
	</div>
	<div class="widget-content">
	<div class="gogst_popup-content">
	</div>
	<button class="gogst_popup_close btn btn-info"><i class="fa fa-remove"></i> Close</button>
	</div>
    
</div>
<div id="ViewKnowledgeModal" class="modal popup_right_slider fade" role="dialog" style="display: none;z-index: 99999;">
	<div class="modal-dialog">
			<div class="modal-content is-loading">
				<div id="iframeContainer">
				<div class="modal-header">
					<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
					<h4 class="modal-title">Knowledge Base</h4>
				</div>
					<iframe name="print_iframe" id="ViewKnowledgeModal_iframe" src="" frameborder="0" style="width:100%;height:100vh;float:left;"></iframe>
				<div class="modal-footer">
					<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
				</div>	
				</div>
				<div class="preloader-overly">
				<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="80px" height="80px" viewBox="0 0 128 128" xml:space="preserve"><g><path fill="#00ba8c" fill-opacity="1" d="M109.25 55.5h-36l12-12a29.54 29.54 0 0 0-49.53 12H18.75A46.04 46.04 0 0 1 96.9 31.84l12.35-12.34v36zm-90.5 17h36l-12 12a29.54 29.54 0 0 0 49.53-12h16.97A46.04 46.04 0 0 1 31.1 96.16L18.74 108.5v-36z"></path><animateTransform attributeName="transform" type="rotate" from="0 64 64" to="360 64 64" dur="880ms" repeatCount="indefinite"></animateTransform></g></svg>
				</div>
			</div>
	</div>
</div>
<!-- Modal -->
<style>
    .jqte{
    border-color: #ccc !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    }
    .jqte_tool_label:active , .jqte_tool_label:hover{
    text-decoration: none !important;
    } 
    .jqte_toolbar{
    background: #fff;
    border-bottom-color:#ccc ;
    }
    .jqte_tool:hover .jqte_tool_icon, .jqte_tool:hover .jqte_tool_label, .jqte_tool, .jqte_tool_icon, .jqte_tool_label{
    border: none !important;
    }
    #EmailModal .upload_file{
        background-color: #fafafa;
        text-align: center;
        padding: 15px 20px 25px 20px;
        border: 1px dashed #8A8A8A;
        cursor: pointer;
        font-size: 13px;
        color: #333333;
        border-radius: 8px;
    }
    #EmailModal .upload_file:hover{
        border: 1px dashed #00ba8b;
    }
    #EmailModal .modal-dialog .invoice_wrapper {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    #EmailModal .modal-dialog .invoice_wrapper .invoice_container {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        max-height: calc(100% - 60px);
        box-sizing: border-box;
        margin-bottom: 20px;
        overflow-y: auto;
        overflow: visible;
        padding-bottom: 120px;
    }
    #EmailModal .modal-dialog .invoice_wrapper .invoice_container .invoice_box {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        overflow: visible;
        border: 1px solid #ddd;
        border-radius: 5px;
        width: calc(25% - 10px);
        height: 180px;
        width: 150px;
        padding: 8px 8px 0 8px;
        box-sizing: border-box;
        margin: 0;
    }
    #EmailModal .modal-dialog .invoice_wrapper .invoice_container .invoice_box img {
        width: 130px;
        height: 120px;
        display: block;
        object-fit: contain;
    }
    #EmailModal .modal-dialog .invoice_wrapper .invoice_container .invoice_box .invoice_content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        width: 100%;
        padding: 8px;
    }

    #EmailModal .modal-dialog .invoice_wrapper .invoice_container .invoice_box .invoice_content .title {
        width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 12px;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-all;
        line-height: 1.3;
    }
    #EmailModal .invoice_container .delete_btn {
        position: absolute;
        top: 2px;
        right: 2px;
        transform: translate(50%, -50%); /* Moves 50% outside the box */
        background-color: #fb5454;
        color: white;
        border: none;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        font-size: 14px;
        font-weight: bold;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        transition: background-color 0.3s ease;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        z-index: 10; /* Ensure it stays on top */
    }
    #EmailModal .modal-dialog .invoice_wrapper .invoice_container .invoice_box .svg_icon {
        width: auto;
        height: 85px;
        margin: auto;
    }
</style><div id="EmailModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
  <div class="modal-dialog">
  <form class="form-horizontal" method="post" id="EmailModalForm"   >
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
		<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
        <h4 class="modal-title">Email</h4>
      </div>
      <div class="modal-body">
        
			<fieldset>
				<div class="control-group">											
					<label for="To" class="control-label" style="width: 80px;">To<span class="star_red">*</span></label>
					<div class="controls" style="margin-left: 90px;">
						<input type="text" name="cmp_email" id="cmp_email" class="span4" value="" maxlength="150" required>
						<div class="note">Note : Use comma(,) as address separator to enter Multiple Email.</div>
						<div id="cmp_email_validate"></div>
					</div> <!-- /controls -->				
				</div> <!-- /control-group -->
				
				<div class="control-group">											
					<label for="cmp_cc" class="control-label" style="width: 80px;">Cc</label>
					<div class="controls" style="margin-left: 90px;">
						<input type="text" name="cmp_cc" id="cmp_cc" class="span4" value="" maxlength="150">
					</div> <!-- /controls -->				
				</div> <!-- /control-group -->
				
				<div class="control-group">											
					<label for="cmp_bcc" class="control-label" style="width: 80px;">Bcc</label>
					<div class="controls" style="margin-left: 90px;">
						<input type="text" name="cmp_bcc" id="cmp_bcc" class="span4" value="" maxlength="150">
					</div> <!-- /controls -->				
				</div> <!-- /control-group -->
				
				<div class="control-group">											
					<label for="Subject" class="control-label" style="width: 80px;">Subject<span class="star_red">*</span></label>
					<div class="controls" style="margin-left: 90px;">
						<input type="text" name="subject" id="subject" class="span4" value="Ledger from {{org-name}} - {{from-date}} To {{to-date}}" maxlength="100" required>
						<div id="subject_validate"></div>
					</div> <!-- /controls -->				
				</div> <!-- /control-group -->
				
				<div class="control-group">											
					<label for="name" class="control-label" style="width: 80px;">Body<span class="star_red">*</span></label>
					<div class="controls" style="margin-left: 90px;">
						<textarea name="body" id="body" class="span4 jqte-test1" required >Dear {{company}},<br><br>Please find the attached ledger for the period {{from-date}} to {{to-date}}.<br><br>Feel free to reach out if you have any questions or need clarification.<br><br>Best regards,<br>{{org-name}}</textarea>
						<div id="body_validate"></div>
						<input type="hidden" name="cmp_name" id="cmp_name" value="" >
						<input type="hidden" name="inv_id" id="inv_id" value="" >
						<input type="hidden" name="po_date" id="po_date" value="" >
						<input type="hidden" name="po_no" id="po_no" value="" >
						<input type="hidden" name="inv_detail_id" id="inv_detail_id" value="" >
						<input type="hidden" name="inv_date" id="inv_date" value="" >
						<input type="hidden" name="inv_amount" id="inv_amount" value="" >
						<input type="hidden" name="replay_email" id="replay_email" value="" >
						<input type="hidden" name="filename" id="filename" value="" >
						<input type="hidden" name="baseLink" id="baseLink" value="" >
						<input type="hidden" name="fromdate" id="fromdate" value="" >
						<input type="hidden" name="todate" id="todate" value="" >
						<input type="hidden" name="template" id="template" value="" >
						<input type="hidden" name="template_size" id="template_size" value="" >
						<input type="hidden" name="template_orientation" id="template_orientation" value="" >
					</div> <!-- /controls -->				
				</div> <!-- /control-group -->
				<div class="control-group">											
					<div class="controls" style="margin-left: 90px;">
						<label class="note last">Note: Document PDF file will attached with mail body.</label>
					</div>
				</div> <!-- /control-group -->

							</fieldset>
		
      </div>
      <div class="modal-footer">
            <input type="hidden" class="isexcel" name="isexcel" value="">
			<button  class="btn btn-primary pull-right" name="btnsubmit" id="btnSubmit" type="submit"><svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send</button> 
			<button type="button" class="btn btn-default pull-left " data-dismiss="modal"><svg width="20" height="20" style="filter: brightness(1);"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
      </div>
    </div>
	</form>
  </div>
</div>

<script>
	$('.jqte-test1').jqte();
$(document).ready(function() {

	let totalSize = 0;
	let all_attached_files = [];
	var enable_custom_field1= '';
	var enable_custom_field2= '';
	var enable_custom_field3= '';
	var enable_custom_field4= '';
	var enable_custom_field5= '';
	var enable_custom_field6= '';
	var enable_custom_field7= '';
	var enable_custom_field8= '';
	var enable_custom_field9= '';
	var enable_custom_field10= '';

    $('.upload_file').click(function(){
        $("#attached_files").click();
    });

    $("#attached_files").change(function(event) {
        let files = event.target.files;

		for (let i = 0; i < files.length; i++) {
			let file = files[i];
			let fileType = file.type;
			let fileSize = file.size / 1024 / 1024;

			if (fileType !== "application/pdf" && fileType !== "image/jpeg" && fileType !== "image/jpg" && fileType !== "image/png" ) {
				$('#attach_file_error').text("Only PDF and JPG files are allowed!");
				continue;
			}

			if (fileSize > 10) {
				$('#attach_file_error').text(`Maximum file size 10 MB.`);
				continue;
			}

			if (totalSize + fileSize > 10) {
				$('#attach_file_error').text(`Total file size limit exceeded (Max 10MB).`);
				continue;
			}

			let reader = new FileReader();
			reader.onload = function(event) {
				let fileData = event.target.result; 
				let previewSrc = fileType === "application/pdf" ? "img/pdf-img.png" : fileData;
				let img_svg = fileType === "application/pdf" ? "svg_icon" : "";

				all_attached_files.push({ name: file.name, data: fileData, type: fileType });
				totalSize += fileSize;

				$(".invoice_container").append(`
					<div class="invoice_box">
						<img src="${previewSrc}" class="${img_svg}" width="100">
						<div class="invoice_content"><p class="title">${file.name}</p></div>
						<button class="delete_btn" data-name="${file.name}" data-size="${fileSize}">x</i></button>
					</div>
				`);
			};

			if (fileType === "application/pdf") {
				reader.readAsDataURL(file);
			} else {
				reader.readAsDataURL(file);
			}
			$('#attach_file_error').text('')	
		}
    });

	$(document).on("click", ".delete_btn", function() {
		let fileName = $(this).data("name");
		let fileSize = parseFloat($(this).data("size"));
		all_attached_files = all_attached_files.filter(file => file.name !== fileName);
		totalSize -= fileSize;
		$('#attach_file_error').text('')
		$(this).parent().remove();
	});

    function sendInvoiceEmail(ajax_data, callback){
        $.ajax({
            type: "POST",
            url: "ajaxcall.php",
            ContentType : 'application/json',
            dataType: 'json',
            data: ajax_data,
            beforeSend: function() {
                $("#EmailModal #btnSubmit").html('Sending ...');
                $("#EmailModal #btnSubmit").prop('disabled', true);
            },
            success: function(data){
                $("#EmailModal #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
                $("#EmailModal #btnSubmit").prop('disabled', false);
                if(data.status == "ERROR")
                {

                    if (data.failed_via_go_gst == 0){
                        Swal.fire({
                            title: 'Unable to Send Email',
                            html: "We couldn't send the email using your account.  <br>Please check your email settings and try again, <br>or send it from Go GST Bill account.",
                            icon: 'warning',
                            showDenyButton: true,
                            confirmButtonColor: '#3085d6',
                            confirmButtonText: 'Send Via Go GST Bill',
                            denyButtonText: 'View Settings ',
                            reverseButtons: true,
                            customClass: { denyButton: 'recodeCancel-btn' }
                        }).then((result) => {
                            if (result.isConfirmed) {
                                ajax_data = {...ajax_data, go_gst_bill_mode: 1};
								sendInvoiceEmail(ajax_data, callback); 
                            }else if (result.isDenied) {
                                window.location.replace('smtp-email-settings.php?mail_error=1');
                            }
                        });
                    }else{
                        errorMessage('', data.msg, '', 'error')
                    }
					if (callback) callback(false);
                }
                else if(data.status == "OK")
                {
                    $('#EmailModal').modal('hide');
                    var Toast = Swal.mixin({
                        toast: true,
                        position: 'top-end',
                        showConfirmButton: false,
                        timer: 3000,
                        showClass: {popup: 'animate__animated animate__slideInRight'},
                        hideClass: {popup: 'animate__animated animate__slideOutRight'},
                        timerProgressBar: true,
                    });

                    Toast.fire({
                        icon: 'success',
                        title: data.msg
                    }).then((result) => {
                        $('.actions_detail_icons_email[data-id='+data.inv_detail_id+']').show();
                        $('.actions_detail_icons_email[data-id='+data.inv_detail_id+']').attr('title',data.tooltip_msg);
                    });
					if (callback) callback(true); 
                }
            },
        });
    }

	try{

	$('#EmailModal input').on('keypress', function(e) {
		if (e.key === 'Enter') {
			e.preventDefault();
			$("#EmailModal form").submit();
		}
	});

	$( "#EmailModal form" ).validate({
		ignore: [],
		rules: {
			field: {required: true},
			cmp_email: {
					multiplemail: true
				},
		},
		errorPlacement: function (error, element) {
			var name = $(element).attr("name");
			error.appendTo($("#" + name + "_validate"));	
		},
		messages: {
			cmp_email: {
            required: "Please enter customer email address.",
            validate_email: "Please enter a valid email address.",
        },
			subject: "Please enter subject",
			body: "Please enter body some text"
		},
		submitHandler: function(form) {
			var data = {
				action: 'SubmitEmailModel',
				cmp_email:$("#EmailModal form input[name='cmp_email']").val(),
				cmp_cc:$("#EmailModal form input[name='cmp_cc']").val(),
				cmp_bcc:$("#EmailModal form input[name='cmp_bcc']").val(),
				subject:$("#EmailModal form input[name='subject']").val(),
				body:$("#EmailModal form textarea[name='body']").val(),
				cmp_name:$("#EmailModal form input[name='cmp_name']").val(),
				inv_id:$("#EmailModal form input[name='inv_id']").val(),
				inv_detail_id:$("#EmailModal form input[name='inv_detail_id']").val(),
				inv_date:$("#EmailModal form input[name='inv_date']").val(),
				inv_amount:$("#EmailModal form input[name='inv_amount']").val(),
				po_no:$("#EmailModal form input[name='po_no']").val(),
				po_date:$("#EmailModal form input[name='po_date']").val(),
				replay_email:$("#EmailModal form input[name='replay_email']").val(),
				filename:$("#EmailModal form input[name='filename']").val(),
				baseLink:$("#EmailModal form input[name='baseLink']").val(),
				fromdate:$("#EmailModal form input[name='fromdate']").val(),
				todate:$("#EmailModal form input[name='todate']").val(),
				template:$("#EmailModal form input[name='template']").val(),
				template_size:$("#EmailModal form input[name='template_size']").val(),
				template_orientation:$("#EmailModal form input[name='template_orientation']").val(),
				isexcel:$("#EmailModal form input[name='isexcel']").val()
				,isEway:$("#EmailModal form input[name='inv_id']").attr('data-isEway')
			}
			const filename = $("#EmailModal form input[name='filename']").val(); 
			const template = $("#EmailModal form input[name='template']").val(); 
			const template_size = $("#EmailModal form input[name='template_size']").val(); 
			const template_orientation = $("#EmailModal form input[name='template_orientation']").val(); 
			const baselink = $("#EmailModal form input[name='baseLink']").val(); 
			const digitalsign = $(".pdf-download-form input[name='digital_sign']").val(); 
			const hasLetter  = $("body").hasClass("printletter"); 

			if((digitalsign == 'true' && template != '') && hasLetter != true){
				digitalsignature(filename, template, template_size, template_orientation, baselink, '', JSON.stringify({...data, all_attached_files: all_attached_files}), function(response) {
					if (response.status === "OK") {
						$("#EmailModal #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
						$("#EmailModal #btnSubmit").prop('disabled', false);	
							var Toast = Swal.mixin({
								toast: true,
								position: 'top-end',
								showConfirmButton: false,
								timer: 3000,
								showClass: {popup: 'animate__animated animate__slideInRight'},
								hideClass: {popup: 'animate__animated animate__slideOutRight'},
								timerProgressBar: true,
							});

							Toast.fire({
								icon: 'success',
								title: response.msg
							}).then((result) => {
								$('.actions_detail_icons_email[data-id='+response.inv_detail_id+']').show();
								$('.actions_detail_icons_email[data-id='+response.inv_detail_id+']').attr('title',response.tooltip_msg);
							});
							totalSize = 0;
							$('.invoice_container').html('')
							all_attached_files = [];
							
						} else {
							errorMessage('',response.msg,'','error');
							$("#EmailModal #btnSubmit").html('<svg width="20" height="20"><use href="svg-icon/icons.svg#send-svg-icon"></use></svg>Send');
							$("#EmailModal #btnSubmit").prop('disabled', false);
						}
						$('#EmailModal').modal('toggle');
				});
				return;
			}else{
                sendInvoiceEmail({...data, all_attached_files: all_attached_files}, function(success){
					if (success) {
						totalSize = 0;
						$('.invoice_container').html('')
						all_attached_files = []; 
					}
				})
			}
		}
	})
	
	$(document).on("click", ".email-btn", function () {
		$('#attach_file_error').text('')
		var cmp_email = $(this).attr('data-email')??"";
		var cmp_bcc = $(this).attr('data-bcc');
		var cmp_name = $(this).attr('data-name');
		var cmp_contactperson = $(this).attr('data-contactperson');
		var inv_id = $(this).attr('data-id');
		var inv_detail_id = $(this).attr('data-detail-id');
		var is_Eway = $(this).attr('data-isEway');
		var inv_date = $(this).attr('data-date');
		var inv_amount = $(this).attr('data-amount');
		var filename = $(this).attr('data-filename');
		var baseLink = $(this).attr('data-baseLink');
		var custom_field1 = $(this).attr("data-custom_field1") || "";
		var custom_field2 = $(this).attr("data-custom_field2") || "";
		var custom_field3 = $(this).attr("data-custom_field3") || "";
		var custom_field4 = $(this).attr("data-custom_field4") || "";
		var custom_field5 = $(this).attr("data-custom_field5") || "";
		var custom_field6 = $(this).attr("data-custom_field6") || "";
		var custom_field7 = $(this).attr("data-custom_field7") || "";
		var custom_field8 = $(this).attr("data-custom_field8") || "";
		var custom_field9 = $(this).attr("data-custom_field9") || "";
		var custom_field10 = $(this).attr("data-custom_field10") || "";
		var template = $(this).attr("data-template");
		var template_size = $(this).attr("data-template-size");
		var template_orientation = $(this).attr("data-template-orientation");
        var tracking_link = $(this).attr('data-tracking-link');
		var mySubject = $(this).attr('data-subject') || `Ledger from {{org-name}} - {{from-date}} To {{to-date}}`;
		var myBody = $(this).attr('data-body') || `Dear {{company}},<br><br>Please find the attached ledger for the period {{from-date}} to {{to-date}}.<br><br>Feel free to reach out if you have any questions or need clarification.<br><br>Best regards,<br>{{org-name}}`;

        if($(this).attr('data-isexcel') == "true") {
            $(".isexcel").val($(this).attr('data-isexcel'));
            $.getJSON(baseLink, function(response) {
                $('.modal-body #baseLink').val(response.baseLink);
            });
            $(".note.last").html("Note: Document Excel file will attached with mail body.");
        }
		var myBody = myBody.replace('{{company}}',cmp_name)
												.replace('{{contact-person}}',cmp_contactperson)
												.replace('{{invoice-no}}',inv_id)
												.replace('{{amount}}',inv_amount)
												.replace('{{invoice-date}}',inv_date)
												.replace('{{org-name}}',`A1 Tax Assist`);
												if (custom_field1 !== "" && enable_custom_field1==1) { myBody = myBody.replace(/{{cf-1}}/g, custom_field1);} else { myBody = myBody.replace(/{{cf-1}}/g, ''); }
												if (custom_field2 !== "" && enable_custom_field2==1) { myBody = myBody.replace(/{{cf-2}}/g, custom_field2); } else { myBody = myBody.replace(/{{cf-2}}/g, ''); }
												if (custom_field3 !== "" && enable_custom_field3==1) { myBody = myBody.replace(/{{cf-3}}/g, custom_field3); } else { myBody = myBody.replace(/{{cf-3}}/g, ''); }
												if (custom_field4 !== "" && enable_custom_field4==1) { myBody = myBody.replace(/{{cf-4}}/g, custom_field4); } else { myBody = myBody.replace(/{{cf-4}}/g, ''); }
												if (custom_field5 !== "" && enable_custom_field5==1) { myBody = myBody.replace(/{{cf-5}}/g, custom_field5); } else { myBody = myBody.replace(/{{cf-5}}/g, ''); }
												if (custom_field6 !== "" && enable_custom_field6==1) { myBody = myBody.replace(/{{cf-6}}/g, custom_field6); } else { myBody = myBody.replace(/{{cf-6}}/g, ''); }
												if (custom_field7 !== "" && enable_custom_field7==1) { myBody = myBody.replace(/{{cf-7}}/g, custom_field7); } else { myBody = myBody.replace(/{{cf-7}}/g, ''); }
												if (custom_field8 !== "" && enable_custom_field8==1) { myBody = myBody.replace(/{{cf-8}}/g, custom_field8); } else { myBody = myBody.replace(/{{cf-8}}/g, ''); }
												if (custom_field9 !== "" && enable_custom_field9==1) { myBody = myBody.replace(/{{cf-9}}/g, custom_field9); } else { myBody = myBody.replace(/{{cf-9}}/g, ''); }
												if (custom_field10 !== "" && enable_custom_field10==1) { myBody = myBody.replace(/{{cf-10}}/g, custom_field10); } else { myBody = myBody.replace(/{{cf-10}}/g, ''); }

        if (tracking_link) {
            myBody = myBody.replace('{{tracking-link}}', 'Tracking Link : ' + tracking_link);
        } else {
            myBody = myBody.replace('{{tracking-link}}', '');
        }

        var products = [];

        if(products.length > 0){
            myBody = myBody.replace(/{{product}}(.*?){{--product}}/gs, function(_, match) {
                return products.map(product => {
                    return match.replace(/{{(p-[\w-]+)(?::([^}]+))?}}/g, function(_, key, label) {
                        let value = '';

                        if (key === 'p-name') {
                            value = product.name;
                        } else if (key === 'p-quantity') {
                            value = product.qty;
                        } else if (key === 'p-price') {
                            value = product.price;
                        } else if (key === 'p-taxable-amount') {
                            value = product.taxable_amount;
                        } else if (key === 'p-total') {
                            value = product.grand_total;
                        }

                        if (label) {
                            if (label.includes('|')) {
                                const parts = label.split('|');
                                const prefix = parts[0] ? parts[0].trim() + ' ' : '';
                                const suffix = parts[1] ? ' ' + parts[1].trim() : '';
                                return `${prefix}${value}${suffix}`.trim();
                            } else {
                                return `${label} ${value}`;
                            }
                        } else {
                            return `${value}`;
                        }
                    });
                }).join('');
            });
        }

		mySubject = mySubject.replace('{{invoice-no}}',inv_id)
												 .replace('{{org-name}}',`A1 Tax Assist`);
		
		if (cmp_email && cmp_email.trim() !== "") {
			$(".modal-body #cmp_email").val( cmp_email.split(' ').join('') );
		}
		$(".modal-body #cmp_cc").val('');
		$(".modal-body #cmp_bcc").val(cmp_bcc);
		$(".modal-body #subject").val( mySubject );
		$(".modal-body .jqte_editor").html( myBody );
        $(".modal-body #body").html( myBody );
        $(".modal-body #cmp_name").val( cmp_name );
		$(".modal-body #inv_id").val( inv_id );
		$(".modal-body #inv_id").attr('data-isEway',is_Eway);
		$(".modal-body #po_date").val( po_date );
		$(".modal-body #po_no").val( po_no );
		$(".modal-body #inv_detail_id").val( inv_detail_id );
		$(".modal-body #inv_date").val( inv_date );
		$(".modal-body #inv_amount").val( inv_amount );
		$(".modal-body #filename").val( filename );
		$(".modal-body #baseLink").val( baseLink );
		$(".modal-body #template").val( template );
		$(".modal-body #template_size").val( template_size );
		$(".modal-body #template_orientation").val( template_orientation );
		$(".modal-body #to_validate").html( "" );
		$(".modal-body #subject_validate").html( "" );
		$(".modal-body #body_validate").html( "" );
	});
	
	}
	catch(error) {
  
}

});
</script>
<!-- Modal -->
<div id="StickyNotesModal" class="popup_right_slider modal fade" role="dialog" style="display: none;">
			<div class="modal-dialog">

				<!-- Modal content-->
				<form class="form-horizontal" method="post" id="ManageStickyNotesForm" name="ManageStickyNotesForm">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="btn btn-default btn_close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg></button>
							<h4 class="modal-title">Sticky Notes</h4>
						</div>
						<div class="modal-body" >

							
						</div>
					</div>
					<div class="modal-footer" style="z-index: 3">
						<input type="hidden" id="openmodel">
						
						<button type="button" class="btn btn-default pull-left btn-close" data-dismiss="modal"><svg width="20" height="20"><use href="svg-icon/icons.svg#closebtn-svg-icon"></use></svg>Close</button>
						<button class="btn btn-primary addNotesBtn" type="button" name="addNotesBtn"><svg width="20" height="20"><use href="svg-icon/icons.svg#plus-svg-icon"></use></svg>Add Notes</button>
					</div>
				</form>
			</div>
</div>
	
<div id="PrintInvoiceModal" class="modal popup_right_slider fade" role="dialog" style="display: none;">
	<div class="modal-dialog">
		<form class="form-horizontal" method="post" id="PrintInvoiceModalForm">
			<!-- Modal content-->
			<div class="modal-content is-loading">
				<div id="iframeContainer">
					<iframe name="print_iframe" id="Invoice_iframe" src="" frameborder="0" style="width:100%;height:100vh;float:left;"></iframe>
				</div>
				<div class="preloader-overly">
				<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="80px" height="80px" viewBox="0 0 128 128" xml:space="preserve"><g><path fill="#00ba8c" fill-opacity="1" d="M109.25 55.5h-36l12-12a29.54 29.54 0 0 0-49.53 12H18.75A46.04 46.04 0 0 1 96.9 31.84l12.35-12.34v36zm-90.5 17h36l-12 12a29.54 29.54 0 0 0 49.53-12h16.97A46.04 46.04 0 0 1 31.1 96.16L18.74 108.5v-36z"></path><animateTransform attributeName="transform" type="rotate" from="0 64 64" to="360 64 64" dur="880ms" repeatCount="indefinite"></animateTransform></g></svg>
				</div>
				
			</div>
		</form>
	</div>
</div>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#PrintInvoiceModal').on('hidden.bs.modal', function () {
		        $("#PrintInvoiceModal .modal-content").addClass("is-loading");
		        $("#PrintInvoiceModal iframe").attr("src", "" );
		    });
		    $(document).on("click", ".ViewPrintModal", function() {
		    	var iframeSrc  =  $(this).attr("data-baselink");
				if(iframeSrc != ""){
					$('#PrintInvoiceModal').modal('show').on('shown', function() {
						$("#PrintInvoiceModal iframe").attr("src", iframeSrc );
						$("#PrintInvoiceModal .modal-content").removeClass("is-loading");
						if(window.innerHeight < $('#PrintInvoiceModal iframe').height())
					    {
					    	$('#PrintInvoiceModal, #PrintInvoiceModal #Invoice_iframe').height(window.innerHeight);
					    }
					});
				}
			});
		});
	</script>

</main>
</body>
</html>

i need auto fill fucntion details from above page i need