aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2024-07-07 22:15:06 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2024-07-07 22:15:06 +0530
commit350105c637626f686369a1a52be08beefb5d88c7 (patch)
treeca0d98198cb6fcd1ced9b5a8fc350912ae34b210
parentf192b92ad382d9e8b89ac836bde96f8973ea2844 (diff)
added total in words
-rw-r--r--package-lock.json7
-rw-r--r--package.json1
-rw-r--r--src/components/PrintPreviewFooter.vue8
3 files changed, 13 insertions, 3 deletions
diff --git a/package-lock.json b/package-lock.json
index 34eb4fe..29c26db 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"bootstrap-icons": "^1.11.1",
"bootstrap-icons-vue": "^1.11.1",
"currency.js": "^2.0.4",
+ "number-to-words": "^1.2.4",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vue-toast-notification": "^3.1.1"
@@ -3526,6 +3527,12 @@
"url": "https://github.com/fb55/nth-check?sponsor=1"
}
},
+ "node_modules/number-to-words": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/number-to-words/-/number-to-words-1.2.4.tgz",
+ "integrity": "sha512-/fYevVkXRcyBiZDg6yzZbm0RuaD6i0qRfn8yr+6D0KgBMOndFPxuW10qCHpzs50nN8qKuv78k8MuotZhcVX6Pw==",
+ "license": "MIT"
+ },
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
diff --git a/package.json b/package.json
index f190f42..17e06f1 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"bootstrap-icons": "^1.11.1",
"bootstrap-icons-vue": "^1.11.1",
"currency.js": "^2.0.4",
+ "number-to-words": "^1.2.4",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vue-toast-notification": "^3.1.1"
diff --git a/src/components/PrintPreviewFooter.vue b/src/components/PrintPreviewFooter.vue
index 4594a92..48c9e51 100644
--- a/src/components/PrintPreviewFooter.vue
+++ b/src/components/PrintPreviewFooter.vue
@@ -1,6 +1,5 @@
<script setup lang="ts">
- import { toRaw, onMounted } from "vue"
- import { InvoiceTotal } from "./../classes/invoice.ts"
+ import Converter from "number-to-words"
const props = defineProps(["total"])
</script>
@@ -9,7 +8,7 @@
<div class="print-preview-footer">
<div class="footer--col1">
<div class="total-words-label"></div>
- <div class="total-words"></div>
+ <div class="total-words">{{ Number.isFinite(props.total.TotalWithGST.value) && `${Converter.toWords(props.total.TotalWithGST.value)} only` }}</div>
</div>
<div class="footer--col2">
<div class="total-summary">
@@ -36,6 +35,9 @@
</template>
<style>
+.total-words {
+ text-transform: capitalize;
+}
.print-preview-footer {
border: 1px solid gray;
display: grid;