<div id="invoice">
  <header class="clearfix">
    <div id="project">
      Le Palmier s&agrave;rl
      <br>Route de Peney 51
      <br>1214 Vernier
      <br>TVA: CHE-485.765.573
			<br>contact@lepalmier-distribution.ch
			<br>+41 77 996 51 81
    </div>
    <div id="slogan" class="clearfix">
      Osez l&apos;originalit&eacute;
    </div>
    <div class="clearfix"> </div>
    <div id="contact">
    </div>
    <div id="company">
      {{order.clientName}}
      <br>{{order.street}}
      <br>{{order.postalCode}} {{order.city}}
    </div>
    <div class="clearfix"></div>
    <div id="facture">
      Facture n&ordm; {{date | date:'yyyyMMdd'}}{{idClient.clientId}}
    </div>
    <div id="date">
      Date: {{date | date:'dd.MM.yyyy'}}
    </div>
  </header>
  <main>
    <table id="order">
      <thead>
        <tr>
          <th class="desc">D&eacute;signation</th>
          <th class="unit">Prix unit.</th>
          <th class="qty">Qt&eacute;</th>
          <th class="total">Montant</th>
          <th class="tva">TVA</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="article in articles" ng-if="$index < 38"> <!-- 19 -->
          <td class="desc">{{article.designation}}</td>
          <td class="unit">{{article.price | number: 2}}</td>
          <td class="qty">{{article.quantity}}</td>
          <td class="total">{{article.quantity * article.price | number: 2}}</td>
          <td class="tva">{{article.tva}}%</td>
        </tr>
      </tbody>
    </table>
    <table id="order">
      <tbody>
        <tr ng-repeat="article in articles" ng-if="$index >= 38"> <!-- 19 -->
          <td class="desc">{{article.designation}}</td>
          <td class="unit">{{article.price | number: 2}}</td>
          <td class="qty">{{article.quantity}}</td>
          <td class="total">{{article.quantity * article.price | number: 2}}</td>
          <td class="tva">{{article.tva}}%</td>
        </tr>
      </tbody>
    </table>
    <div class="clearfix"></div>
    <div id="tva">
      <span>D&eacute;tail TVA:</span>
      <table>
        <thead>
          <tr>
            <th>Base</th>
            <th>Taux</th>
            <th>TVA</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>{{base7 | number: 2}}</td>
            <td>7.7%</td>
            <td>{{tva7 | number: 2}}</td>
          </tr>
          <tr>
            <td>{{base2 | number: 2}}</td>
            <td>2.5%</td>
            <td>{{tva2 | number: 2}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div id="montant">
      <table>
        <tbody>
          <tr>
            <td class="first">Total net</td>
            <td class="last">{{totalHT | number: 2}}</td>
          </tr>
          <tr>
            <td class="first">TVA</td>
            <td  class="last">{{totalTVA | number: 2}}</td>
          </tr>
          <tr>
            <td class="first">Montant total TTC</td>
            <td  class="last">{{totalTTC | number: 2}}</td>
          </tr>
        </tbody>
      </table>
      <span>{{totalFrancs}} francs et {{totalCentimes}} centimes</span>
    </div>
    <div class="clearfix"></div>
    <div id="notices">
			Compte POSTFINANCE IBAN CH59 0900 0000 1451 3853 5<br>
      Avec nos remerciements pour votre commande.
      <br>contact@lepalmier-distribution.ch
    </div>
  </main>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.0/jspdf.umd.min.js"></script>
<script>
$(document).ready(function(){

	  if ($("#order:nth-child(2) tbody tr").length == 0) {
//	   	$("#order:nth-child(2)").hide();

		$("#dashboard-options-menu").css("display", "none");
		$(".dashboard-body").css("display", "none");
		$(".shadow-film").css("display", "none");
		$("#invoice").css("display", "block");
		$("#invoice").css("height", "31.7cm");

	} else {
			   $("#order:nth-child(2)").show();

		 $("#order:nth-child(2)").css("margin-top", "6cm");
		$("#invoice").css("height", "63.7cm");

	}

	$('#invoice').printThis();

	setTimeout(function(){ 
		
		var monSite = window.location.href;
		var splitUrl = monSite.split('/');
		var idCom = parseInt(splitUrl[7]) + 1;
		var newURL = "http://51.77.144.166/myprovider/admin/#!/orderALL/" + idCom;
		if (idCom <2010) {
			//window.location.href = newURL;
		}
		

	}, 2000);

});
</script>
