Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

HTML code with Javascript inside (Odoo gives error on for loop) / Tried separate .js file (don't know how to import it)

By
Bojan
on 9/7/15, 2:24 AM 633 views


<!DOCTYPE html>

<html lang="mk">

<head>

<meta charset="utf-8" />

<title>Nike sale</title>

<!--[if !IE]><!-->

<link rel="stylesheet" href="/css/main.css" />

<!--<![endif]-->

<!--[if gte IE 7]>

<link rel="stylesheet" type="text/css" href="/css/main.css" media="screen, projection" />

<![endif]-->

<!--[if IE 6]>

<link rel="stylesheet" type="text/css" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" media="screen, projection" />

<![endif]-->

<style>

.tabela { /* Body / Position and size */

width: 85%;

margin-left: auto;

margin-right: auto;

}

#tabelaFooter { /* Footer / Position and size */

padding-top: 5%;

width: 85%;

margin-left:auto;

margin-right:auto;

}

.outline { /* Line */

outline: thin solid black;

}

#metaProdavac td { /* Header / Seller Adress */

padding-top: 2%;

}

#naslov { /* Header / Title, position and size */

font-size: 40px;

padding-top: 4%;

}

.span {

padding-right: 20px;

text-align: right;

padding-top: 0;

padding-bottom: 0;

}

#spacing td {

padding-top: 1%;

}

#footer { text-align: center; }

#footer ul { list-style: none;}

#footer li {

display: inline;

padding-right: 40px;

}

</style>

</head>

<body onload="presmetka()">

<!-- Header table -->

<table class="tabela">

<tr>

<td> <img src="D:\Bojan\Neotel_logo.png" width="100" height="50" alt="Try other source"/> </td>

<td colspan="5" style="text-align: right"> <h3>Neotel Company - Skopje</h3> </td>

</tr>

<tr class="outline"> </tr> <!-- Linija -->

<tr id="metaProdavac">

<td style="vertical-align: text-top">Примач - Nike</td> <td></td> <td></td>

<td width="20%"> <address><strong>Продавач:</strong><br/>Бојан Ѓорески<br/>

Коста Новаковиќ бр. 6<br/>Скопје<br/>Македонија</address> </td>

</tr>

<tr> <td id="naslov">Интернет Услуги</td> </tr>

<tr> <td style="padding-top: 2%">Invoice data</td> </tr>

<tr> <td style="padding-bottom: 1%">08.21.2015</td> </tr>

</table>

<!-- Body table -->

<table class="tabela">

<tr id="spacing">

<td><strong>Опис</strong> </td>

<td class="span"> <strong>Количина</strong> </td>

<td class="span"> <strong>Единечна цена</strong> </td>

<td class="span"> <strong>Данок</strong> </td>

<td class="span"> <strong>Цена со Данок</strong> </td>

</tr>

<tr class="outline"> </tr> <!-- Line -->

<tr>

<td>[350] Интернет пакет – Net Basic на 3 години</td>

<td class="span"> <p class="kolicina">1</p> </td>

<td class="span"> <p class="cena">690.956</p> </td>

<td class="span">18%</td>

<td class="span"> <p class="print"></p> </td>

</tr>

<tr>

<td>[350] Интернет пакет – Net Basic на 2 години</td>

<td class="span"> <p class="kolicina">5</p> </td>

<td class="span"> <p class="cena">590</p> </td>

<td class="span">18%</td>

<td class="span"> <p class="print"></p> </td>

</tr>

<tr>

<td>[350] Интернет пакет – Net Basic на 1 година</td>

<td class="span"> <p class="kolicina">2</p> </td>

<td class="span"> <p class="cena">490</p> </td>

<td class="span">18%</td>

<td class="span"> <p class="print"></p> </td>

</tr>

<tr>

<td>[350] Интернет пакет – Net Basic на 5 години</td>

<td class="span"> <p class="kolicina">1</p> </td>

<td class="span"> <p class="cena">1000</p> </td>

<td class="span">18%</td>

<td class="span"> <p class="print"></p> </td>

</tr>

</table>

<!-- Total table -->

<table style="padding-right: 7.5%;" align="right">

<tr>

<td colspan="3"> <!-- Line -->

<svg width="100%" height="5%">

<line x1="0" y1="0" x2="100%" y2="0" style="stroke:rgb(0,0,0);stroke-width:3" />

</svg>

</td>

</tr>

<tr>

<td> <strong>Тотално без даноци</strong> </td>

<td class="span" id="zbirBezDDV"></td>

</tr>

<tr>

<td colspan="3"> <!-- Line -->

<svg width="100%" height="5%">

<line x1="0" y1="0" x2="100%" y2="0" style="stroke:rgb(0,0,0);stroke-width:1" />

</svg>

</td>

</tr>

<tr>

<td> <strong>Данок</strong> </td>

<td class="span" id="DDV"></td>

</tr>

<tr>

<td colspan="3"> <!-- Line -->

<svg width="100%" height="5%">

<line x1="0" y1="0" x2="100%" y2="0" style="stroke:rgb(0,0,0);stroke-width:3" />

</svg>

</td>

</tr>

<tr>

<td> <strong>Тотално</strong> </td>

<td class="span" id="zbirSoDDV"></td>

</tr>

</table>

<!-- Footer table -->

<table id="tabelaFooter">

<tr class="outline"> <!-- Linija --> </tr> <!-- Linija -->

<tr>

<td id="footer">

<ul>

<li>Email: info@neodata.com</li>

<li>Website: <a href="http://www.neodata.com.mk/en_US/" target="_blank">

http://www.neodata.com.mk </a></li>

</ul>

</td>

</tr>

</table>

<p id="test"></p>

<script>

function presmetka() {

var i,

bezDDV = 0, //Total without tax

posrednik = [], //intermediary for - Individual price with tax

total = [], //Individualna cena so DDV

list = document.getElementsByClassName("cena"), //Array for price elements

quantity = document.getElementsByClassName("kolicina"); //Array for quantity elements

for (i=0; i<list.length; i++) {

posrednik[i] = (parseInt(quantity[i].innerHTML))*(parseFloat(list[i].innerHTML) *

18/100 + parseFloat(list[i].innerHTML));

total = document.getElementsByClassName("print");

total[i].innerHTML = parseFloat(posrednik[i]).toFixed(2);

bezDDV += parseInt(quantity[i].innerHTML) * parseFloat(list[i].innerHTML)

}

document.getElementById("zbirBezDDV").innerHTML = parseFloat(bezDDV).toFixed(2); //Total price, no tax (Rounded to 2 decimal places)

document.getElementById("DDV").innerHTML = parseFloat(bezDDV * 0.18).toFixed(2); //Tax of total price (Rounded to 2 decimal places)

document.getElementById("zbirSoDDV").innerHTML = Math.round(bezDDV + (bezDDV * 0.18)); //Total price with tax (Rounded to an integer)

}

</script>

</body>

</html>

0
Bojan
On 9/17/15, 5:06 AM

Found the solution, for those having the same problem. My '<' - smaller than & '>' - greater than signs (in the for loop) were seen as tags. So i changed them to their entities < = &lt; and > = &gt;

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/7/15, 2:24 AM
Seen: 633 times
Last updated: 9/17/15, 5:22 PM