@@ -49,7 +49,7 @@ function lcTaxPriceUpdate(priceType) { | |||
* @returns {string} | |||
*/ | |||
function getPrice(priceWithTax, taxRate) { | |||
return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(3); | |||
return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(4); | |||
} | |||
/** | |||
@@ -65,8 +65,14 @@ function getPriceWithTax(priceWithoutTax, taxRate) { | |||
function formatNumber(number, toFixed){ | |||
return Number(number).toFixed(toFixed); | |||
if(number)return Number(number.replace(',', '.')).toFixed(toFixed); | |||
else return null; | |||
} | |||
function formatNumberWithoutFixed(number){ | |||
if(number)return Number(number.replace(',', '.')); | |||
else return null; | |||
} | |||
/** | |||
* Formate un prix en l'arrondissant et en ajoutant le sigle de la monnaie |
@@ -48,8 +48,8 @@ let mixinPrice = { | |||
} | |||
}, | |||
initByPiece: function () { | |||
this.buyingPriceUpdated(); | |||
this.priceUpdated(); | |||
this.buyingPriceUpdated(); | |||
}, | |||
initByRefUnit: function () { | |||
@@ -92,7 +92,8 @@ let mixinPrice = { | |||
priceUpdated: function () { | |||
if (this.price) { | |||
this.price = formatNumber(this.priceByRefUnit, 4) | |||
this.price = formatNumber(this.price, 4) | |||
this.setPriceWithTax(); | |||
this.setMultiplyingFactor(); | |||
this.setPriceByRefUnit(); | |||
@@ -123,7 +124,8 @@ let mixinPrice = { | |||
}, | |||
priceWithTaxUpdated: function () { | |||
this.priceWithTax = formatNumber(this.priceWithTax, 2) | |||
this.priceWithTax = formatNumber(this.priceWithTax, 2); | |||
log(this.priceWithTax); | |||
this.setPriceFromPriceWithTax(); | |||
this.priceUpdated(); | |||
}, | |||
@@ -139,6 +141,8 @@ let mixinPrice = { | |||
this.quantityUpdated(); | |||
}, | |||
quantityUpdated: function () { | |||
this.quantity = formatNumberWithoutFixed(this.quantity) | |||
if(this.quantity) { | |||
if (this.behaviorPriceValue == 'by-piece') { | |||
this.setBuyingPriceByRefUnit(); |
@@ -139,6 +139,64 @@ | |||
</template> | |||
</tbody> | |||
<tfoot> | |||
<th> | |||
</th> | |||
<th colspan="2" class="string"> | |||
${title} | |||
</th> | |||
<th colspan="1" class="string "> | |||
{#${productFamily.quantity}#} | |||
</th> | |||
<th colspan="2" class="quantity"> | |||
Unité | |||
</th> | |||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="buyingPriceByRefUnit"> | |||
PA HT / ${ getUnitReference() } | |||
</th> | |||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="priceByRefUnit"> | |||
PA TTC / ${ getUnitReference() } | |||
</th> | |||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||
PA HT | |||
</th> | |||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||
PA TTC | |||
</th> | |||
<th colspan="2" class=""> | |||
Coef | |||
</th> | |||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class=""> | |||
PV HT / ${ getUnitReference() } | |||
</th> | |||
<th v-show="getBehaviorPrice() == 'by-reference-unit'" colspan="2" class="price"> | |||
PV TTC / ${ getUnitReference() } | |||
</th> | |||
<th colspan="2" class="price" v-show="getBehaviorPrice() =='by-piece'"> | |||
PV HT | |||
</th> | |||
<th colspan="2" class="price"> | |||
PV TTC | |||
</th> | |||
<th v-show="behaviorCountStock== 'by-product'"> | |||
Stock | |||
</th> | |||
<th v-show="behaviorCountStock== 'by-product'"> | |||
Stock par défaut | |||
</th> | |||
<th colspan="2" class="" v-show="behaviorExpirationDate== 'by-product'"> | |||
<span style="text-transform: uppercase"> ${typeExpirationDate}</span> | |||
</th> | |||
<th class=""> | |||
Action | |||
</th> | |||
</tfoot> | |||
</table> | |||
<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span | |||
class="fa fa-plus"></span> Ajouter une déclinaison |