mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
Compare commits
9 Commits
dependabot
...
tax-calcul
| Author | SHA1 | Date | |
|---|---|---|---|
| 9608ab6207 | |||
| c14eb1b414 | |||
| 6d0edb4b5a | |||
| 0dc8941975 | |||
| f11437ce63 | |||
| dbd75bbe68 | |||
| 4fc67c74e4 | |||
| 27660c6bce | |||
| 05d5ce26fd |
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,4 +16,5 @@ Homestead.yaml
|
||||
.gitkeep
|
||||
/public/docs
|
||||
/.scribe
|
||||
!storage/fonts/.gitkeep
|
||||
!storage/fonts/.gitkeep
|
||||
.DS_Store
|
||||
|
||||
@ -45,15 +45,21 @@ class EstimatesRequest extends FormRequest
|
||||
'nullable'
|
||||
],
|
||||
'discount' => [
|
||||
'numeric',
|
||||
'required',
|
||||
],
|
||||
'discount_val' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'sub_total' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'total' => [
|
||||
'integer',
|
||||
'numeric',
|
||||
'max:99999999',
|
||||
'required',
|
||||
],
|
||||
'tax' => [
|
||||
@ -77,9 +83,11 @@ class EstimatesRequest extends FormRequest
|
||||
'required',
|
||||
],
|
||||
'items.*.quantity' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'items.*.price' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
];
|
||||
|
||||
@ -45,15 +45,21 @@ class InvoicesRequest extends FormRequest
|
||||
'nullable'
|
||||
],
|
||||
'discount' => [
|
||||
'numeric',
|
||||
'required',
|
||||
],
|
||||
'discount_val' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'sub_total' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'total' => [
|
||||
'integer',
|
||||
'numeric',
|
||||
'max:99999999',
|
||||
'required',
|
||||
],
|
||||
'tax' => [
|
||||
@ -77,9 +83,11 @@ class InvoicesRequest extends FormRequest
|
||||
'required',
|
||||
],
|
||||
'items.*.quantity' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'items.*.price' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
];
|
||||
|
||||
@ -43,15 +43,21 @@ class RecurringInvoiceRequest extends FormRequest
|
||||
'nullable'
|
||||
],
|
||||
'discount' => [
|
||||
'numeric',
|
||||
'required',
|
||||
],
|
||||
'discount_val' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'sub_total' => [
|
||||
'integer',
|
||||
'required',
|
||||
],
|
||||
'total' => [
|
||||
'integer',
|
||||
'numeric',
|
||||
'max:99999999',
|
||||
'required',
|
||||
],
|
||||
'tax' => [
|
||||
|
||||
263
composer.lock
generated
263
composer.lock
generated
@ -4390,30 +4390,25 @@
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "1.6.2",
|
||||
"version": "1.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
|
||||
"reference": "77a32518733312af16a44300404e945338981de3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3",
|
||||
"reference": "77a32518733312af16a44300404e945338981de3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"rector/rector": "^0.13.9",
|
||||
"vimeo/psalm": "^4.25"
|
||||
"psalm/phar": "^4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -4439,9 +4434,9 @@
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1"
|
||||
},
|
||||
"time": "2022-10-14T12:47:21+00:00"
|
||||
"time": "2022-03-15T21:29:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
@ -7671,7 +7666,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
"version": "v3.0.2",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
@ -7718,7 +7713,7 @@
|
||||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2"
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -7738,16 +7733,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/error-handler",
|
||||
"version": "v5.4.19",
|
||||
"version": "v5.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/error-handler.git",
|
||||
"reference": "438ef3e5e6481244785da3ce8cf8f4e74e7f2822"
|
||||
"reference": "c116cda1f51c678782768dce89a45f13c949455d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/error-handler/zipball/438ef3e5e6481244785da3ce8cf8f4e74e7f2822",
|
||||
"reference": "438ef3e5e6481244785da3ce8cf8f4e74e7f2822",
|
||||
"url": "https://api.github.com/repos/symfony/error-handler/zipball/c116cda1f51c678782768dce89a45f13c949455d",
|
||||
"reference": "c116cda1f51c678782768dce89a45f13c949455d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -7789,7 +7784,7 @@
|
||||
"description": "Provides tools to manage errors and ease debugging PHP code",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/error-handler/tree/v5.4.19"
|
||||
"source": "https://github.com/symfony/error-handler/tree/v5.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -7805,20 +7800,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-01T08:32:19+00:00"
|
||||
"time": "2022-05-21T13:57:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v6.0.19",
|
||||
"version": "v6.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a"
|
||||
"reference": "5c85b58422865d42c6eb46f7693339056db098a8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2eaf8e63bc5b8cefabd4a800157f0d0c094f677a",
|
||||
"reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5c85b58422865d42c6eb46f7693339056db098a8",
|
||||
"reference": "5c85b58422865d42c6eb46f7693339056db098a8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -7872,7 +7867,7 @@
|
||||
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v6.0.19"
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v6.0.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -7888,11 +7883,11 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-01T08:36:10+00:00"
|
||||
"time": "2022-05-05T16:45:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
"version": "v3.0.2",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
|
||||
@ -7951,7 +7946,7 @@
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2"
|
||||
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8034,16 +8029,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v5.4.20",
|
||||
"version": "v5.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "d0435363362a47c14e9cf50663cb8ffbf491875a"
|
||||
"reference": "6b0d0e4aca38d57605dcd11e2416994b38774522"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0435363362a47c14e9cf50663cb8ffbf491875a",
|
||||
"reference": "d0435363362a47c14e9cf50663cb8ffbf491875a",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b0d0e4aca38d57605dcd11e2416994b38774522",
|
||||
"reference": "6b0d0e4aca38d57605dcd11e2416994b38774522",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8055,11 +8050,8 @@
|
||||
"require-dev": {
|
||||
"predis/predis": "~1.0",
|
||||
"symfony/cache": "^4.4|^5.0|^6.0",
|
||||
"symfony/dependency-injection": "^5.4|^6.0",
|
||||
"symfony/expression-language": "^4.4|^5.0|^6.0",
|
||||
"symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4",
|
||||
"symfony/mime": "^4.4|^5.0|^6.0",
|
||||
"symfony/rate-limiter": "^5.2|^6.0"
|
||||
"symfony/mime": "^4.4|^5.0|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/mime": "To use the file extension guesser"
|
||||
@ -8090,7 +8082,7 @@
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.4.20"
|
||||
"source": "https://github.com/symfony/http-foundation/tree/v5.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8106,20 +8098,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-29T11:11:52+00:00"
|
||||
"time": "2022-05-17T15:07:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v5.4.20",
|
||||
"version": "v5.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "aaeec341582d3c160cc9ecfa8b2419ba6c69954e"
|
||||
"reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/aaeec341582d3c160cc9ecfa8b2419ba6c69954e",
|
||||
"reference": "aaeec341582d3c160cc9ecfa8b2419ba6c69954e",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/34b121ad3dc761f35fe1346d2f15618f8cbf77f8",
|
||||
"reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8202,7 +8194,7 @@
|
||||
"description": "Provides a structured process for converting a Request into a Response",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v5.4.20"
|
||||
"source": "https://github.com/symfony/http-kernel/tree/v5.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8218,20 +8210,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-01T08:18:48+00:00"
|
||||
"time": "2022-05-27T07:09:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v5.4.19",
|
||||
"version": "v5.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "a858429a9c704edc53fe057228cf9ca282ba48eb"
|
||||
"reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/a858429a9c704edc53fe057228cf9ca282ba48eb",
|
||||
"reference": "a858429a9c704edc53fe057228cf9ca282ba48eb",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e",
|
||||
"reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8245,16 +8237,15 @@
|
||||
"egulias/email-validator": "~3.0.0",
|
||||
"phpdocumentor/reflection-docblock": "<3.2.2",
|
||||
"phpdocumentor/type-resolver": "<1.4.0",
|
||||
"symfony/mailer": "<4.4",
|
||||
"symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6"
|
||||
"symfony/mailer": "<4.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"egulias/email-validator": "^2.1.10|^3.1|^4",
|
||||
"egulias/email-validator": "^2.1.10|^3.1",
|
||||
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
|
||||
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
|
||||
"symfony/property-access": "^4.4|^5.1|^6.0",
|
||||
"symfony/property-info": "^4.4|^5.1|^6.0",
|
||||
"symfony/serializer": "^5.4.14|~6.0.14|^6.1.6"
|
||||
"symfony/serializer": "^5.2|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@ -8286,7 +8277,7 @@
|
||||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v5.4.19"
|
||||
"source": "https://github.com/symfony/mime/tree/v5.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8302,20 +8293,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-09T05:43:46+00:00"
|
||||
"time": "2022-05-21T10:24:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
|
||||
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
|
||||
"reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
||||
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8330,7 +8321,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8368,7 +8359,7 @@
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8384,7 +8375,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-iconv",
|
||||
@ -8471,16 +8462,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
|
||||
"reference": "511a08c03c1960e08a883f4cffcacd219b758354"
|
||||
"reference": "433d05519ce6990bf3530fba6957499d327395c2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354",
|
||||
"reference": "511a08c03c1960e08a883f4cffcacd219b758354",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2",
|
||||
"reference": "433d05519ce6990bf3530fba6957499d327395c2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8492,7 +8483,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8532,7 +8523,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8548,20 +8539,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||
"reference": "639084e360537a19f9ee352433b84ce831f3d2da"
|
||||
"reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da",
|
||||
"reference": "639084e360537a19f9ee352433b84ce831f3d2da",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8",
|
||||
"reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8575,7 +8566,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8619,7 +8610,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8635,20 +8626,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-normalizer",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||
"reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6"
|
||||
"reference": "219aa369ceff116e673852dce47c3a41794c14bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6",
|
||||
"reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd",
|
||||
"reference": "219aa369ceff116e673852dce47c3a41794c14bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8660,7 +8651,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8703,7 +8694,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8719,20 +8710,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
|
||||
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
|
||||
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8747,7 +8738,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8786,7 +8777,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8802,20 +8793,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||
"reference": "869329b1e9894268a8a61dabb69153029b7a8c97"
|
||||
"reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97",
|
||||
"reference": "869329b1e9894268a8a61dabb69153029b7a8c97",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2",
|
||||
"reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8824,7 +8815,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8862,7 +8853,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8878,20 +8869,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php73.git",
|
||||
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9"
|
||||
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
|
||||
"reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85",
|
||||
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8900,7 +8891,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -8941,7 +8932,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -8957,20 +8948,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-24T11:49:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.27.0",
|
||||
"version": "v1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
|
||||
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
|
||||
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
|
||||
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8979,7 +8970,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
"dev-main": "1.26-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@ -9024,7 +9015,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -9040,7 +9031,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-11-03T14:55:06+00:00"
|
||||
"time": "2022-05-10T07:21:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
@ -9275,16 +9266,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v2.5.2",
|
||||
"version": "v2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c"
|
||||
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
|
||||
"reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
|
||||
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -9338,7 +9329,7 @@
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.2"
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -9354,20 +9345,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-05-30T19:17:29+00:00"
|
||||
"time": "2022-03-13T20:07:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v6.0.19",
|
||||
"version": "v6.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "d9e72497367c23e08bf94176d2be45b00a9d232a"
|
||||
"reference": "df9f03d595aa2d446498ba92fe803a519b2c43cc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a",
|
||||
"reference": "d9e72497367c23e08bf94176d2be45b00a9d232a",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/df9f03d595aa2d446498ba92fe803a519b2c43cc",
|
||||
"reference": "df9f03d595aa2d446498ba92fe803a519b2c43cc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -9423,7 +9414,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v6.0.19"
|
||||
"source": "https://github.com/symfony/string/tree/v6.0.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -9439,7 +9430,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-01T08:36:10+00:00"
|
||||
"time": "2022-04-22T08:18:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@ -9538,16 +9529,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
"version": "v3.0.2",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation-contracts.git",
|
||||
"reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282"
|
||||
"reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/acbfbb274e730e5a0236f619b6168d9dedb3e282",
|
||||
"reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282",
|
||||
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9",
|
||||
"reference": "c4183fc3ef0f0510893cbeedc7718fb5cafc9ac9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -9596,7 +9587,7 @@
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation-contracts/tree/v3.0.2"
|
||||
"source": "https://github.com/symfony/translation-contracts/tree/v3.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -9612,20 +9603,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-27T17:10:44+00:00"
|
||||
"time": "2022-01-02T09:55:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v5.4.19",
|
||||
"version": "v5.4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "2944bbc23f5f8da2b962fbcbf7c4a6109b2f4b7b"
|
||||
"reference": "af52239a330fafd192c773795520dc2dd62b5657"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2944bbc23f5f8da2b962fbcbf7c4a6109b2f4b7b",
|
||||
"reference": "2944bbc23f5f8da2b962fbcbf7c4a6109b2f4b7b",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657",
|
||||
"reference": "af52239a330fafd192c773795520dc2dd62b5657",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -9685,7 +9676,7 @@
|
||||
"dump"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v5.4.19"
|
||||
"source": "https://github.com/symfony/var-dumper/tree/v5.4.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -9701,7 +9692,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-16T10:52:33+00:00"
|
||||
"time": "2022-05-21T10:24:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
@ -11865,5 +11856,5 @@
|
||||
"php": "^7.4 || ^8.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ return [
|
||||
'tokenizer',
|
||||
'JSON',
|
||||
'cURL',
|
||||
'zip',
|
||||
],
|
||||
'apache' => [
|
||||
'mod_rewrite',
|
||||
|
||||
@ -271,23 +271,19 @@ const price = computed({
|
||||
} else {
|
||||
updateItemAttribute('price', newValue)
|
||||
}
|
||||
setDiscount()
|
||||
},
|
||||
})
|
||||
|
||||
const subtotal = computed(() => props.itemData.price * props.itemData.quantity)
|
||||
const subtotal = computed(() => Math.round(props.itemData.price * props.itemData.quantity))
|
||||
|
||||
const discount = computed({
|
||||
get: () => {
|
||||
return props.itemData.discount
|
||||
},
|
||||
set: (newValue) => {
|
||||
if (props.itemData.discount_type === 'percentage') {
|
||||
updateItemAttribute('discount_val', (subtotal.value * newValue) / 100)
|
||||
} else {
|
||||
updateItemAttribute('discount_val', Math.round(newValue * 100))
|
||||
}
|
||||
|
||||
updateItemAttribute('discount', newValue)
|
||||
setDiscount()
|
||||
},
|
||||
})
|
||||
|
||||
@ -313,7 +309,7 @@ const showRemoveButton = computed(() => {
|
||||
const totalSimpleTax = computed(() => {
|
||||
return Math.round(
|
||||
sumBy(props.itemData.taxes, function (tax) {
|
||||
if (!tax.compound_tax) {
|
||||
if (tax.amount) {
|
||||
return tax.amount
|
||||
}
|
||||
return 0
|
||||
@ -321,18 +317,7 @@ const totalSimpleTax = computed(() => {
|
||||
)
|
||||
})
|
||||
|
||||
const totalCompoundTax = computed(() => {
|
||||
return Math.round(
|
||||
sumBy(props.itemData.taxes, function (tax) {
|
||||
if (tax.compound_tax) {
|
||||
return tax.amount
|
||||
}
|
||||
return 0
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
const totalTax = computed(() => totalSimpleTax.value + totalCompoundTax.value)
|
||||
const totalTax = computed(() => totalSimpleTax.value)
|
||||
|
||||
const rules = {
|
||||
name: {
|
||||
@ -399,7 +384,7 @@ const v$ = useVuelidate(
|
||||
|
||||
function updateTax(data) {
|
||||
props.store.$patch((state) => {
|
||||
state[props.storeProp].items[props.index]['taxes'][data.index] = data.item
|
||||
state[props.storeProp].items[props.index]['taxes'][data.index] = data.item
|
||||
})
|
||||
|
||||
let lastTax = props.itemData.taxes[props.itemData.taxes.length - 1]
|
||||
@ -416,6 +401,16 @@ function updateTax(data) {
|
||||
syncItemToStore()
|
||||
}
|
||||
|
||||
function setDiscount() {
|
||||
const newValue = props.store[props.storeProp].items[props.index].discount
|
||||
|
||||
if (props.itemData.discount_type === 'percentage'){
|
||||
updateItemAttribute('discount_val', Math.round((subtotal.value * newValue) / 100))
|
||||
}else{
|
||||
updateItemAttribute('discount_val', Math.round(newValue * 100))
|
||||
}
|
||||
}
|
||||
|
||||
function searchVal(val) {
|
||||
updateItemAttribute('name', val)
|
||||
}
|
||||
@ -485,10 +480,12 @@ function syncItemToStore() {
|
||||
total: total.value,
|
||||
sub_total: subtotal.value,
|
||||
totalSimpleTax: totalSimpleTax.value,
|
||||
totalCompoundTax: totalCompoundTax.value,
|
||||
totalTax: totalTax.value,
|
||||
tax: totalTax.value,
|
||||
taxes: [...itemTaxes],
|
||||
tax_type_ids: itemTaxes.flatMap(_t =>
|
||||
_t.tax_type_id ? _t.tax_type_id : [],
|
||||
),
|
||||
}
|
||||
|
||||
props.store.updateItem(data)
|
||||
|
||||
@ -146,14 +146,14 @@ const filteredTypes = computed(() => {
|
||||
})
|
||||
|
||||
const taxAmount = computed(() => {
|
||||
if (localTax.compound_tax && props.discountedTotal) {
|
||||
return ((props.discountedTotal + props.totalTax) * localTax.percent) / 100
|
||||
}
|
||||
|
||||
if (props.discountedTotal && localTax.percent) {
|
||||
const taxPerItemEnabled = props.store[props.storeProp].tax_per_item === 'YES'
|
||||
const discountPerItemEnabled = props.store[props.storeProp].discount_per_item === 'YES'
|
||||
if (taxPerItemEnabled && !discountPerItemEnabled){
|
||||
return getTaxAmount()
|
||||
}
|
||||
return (props.discountedTotal * localTax.percent) / 100
|
||||
}
|
||||
|
||||
return 0
|
||||
})
|
||||
|
||||
@ -171,6 +171,13 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => taxAmount.value,
|
||||
() => {
|
||||
updateRowTax()
|
||||
},
|
||||
)
|
||||
|
||||
// Set SelectedTax
|
||||
if (props.taxData.tax_type_id > 0) {
|
||||
selectedTax.value = taxTypeStore.taxTypes.find(
|
||||
@ -183,7 +190,6 @@ updateRowTax()
|
||||
function onSelectTax(val) {
|
||||
localTax.percent = val.percent
|
||||
localTax.tax_type_id = val.id
|
||||
localTax.compound_tax = val.compound_tax
|
||||
localTax.name = val.name
|
||||
|
||||
updateRowTax()
|
||||
@ -220,6 +226,27 @@ function openTaxModal() {
|
||||
function removeTax(index) {
|
||||
props.store.$patch((state) => {
|
||||
state[props.storeProp].items[props.itemIndex].taxes.splice(index, 1)
|
||||
state[props.storeProp].items[props.itemIndex].tax = 0
|
||||
state[props.storeProp].items[props.itemIndex].totalTax = 0
|
||||
})
|
||||
}
|
||||
|
||||
function getTaxAmount() {
|
||||
let total = 0
|
||||
let discount = 0
|
||||
const itemTotal = props.discountedTotal
|
||||
const modelDiscount = props.store[props.storeProp].discount ? props.store[props.storeProp].discount : 0
|
||||
const type = props.store[props.storeProp].discount_type
|
||||
if (modelDiscount > 0) {
|
||||
props.store[props.storeProp].items.forEach((_i) => {
|
||||
total += _i.total
|
||||
})
|
||||
const proportion = (itemTotal / total).toFixed(2)
|
||||
discount = type === 'fixed' ? modelDiscount * 100 : (total * modelDiscount) / 100
|
||||
const itemDiscount = Math.round(discount * proportion)
|
||||
const discounted = itemTotal - itemDiscount
|
||||
return Math.round((discounted * localTax.percent) / 100)
|
||||
}
|
||||
return Math.round((props.discountedTotal * localTax.percent) / 100)
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -191,7 +191,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, inject, ref } from 'vue'
|
||||
import { computed, inject, ref, watch } from 'vue'
|
||||
import Guid from 'guid'
|
||||
import Tax from './CreateTotalTaxes.vue'
|
||||
import TaxStub from '@/scripts/admin/stub/abilities'
|
||||
@ -227,19 +227,20 @@ const utils = inject('$utils')
|
||||
|
||||
const companyStore = useCompanyStore()
|
||||
|
||||
watch(
|
||||
() => props.store[props.storeProp].items,
|
||||
(val) => {
|
||||
setDiscount()
|
||||
}, { deep: true },
|
||||
)
|
||||
|
||||
const totalDiscount = computed({
|
||||
get: () => {
|
||||
return props.store[props.storeProp].discount
|
||||
},
|
||||
set: (newValue) => {
|
||||
if (props.store[props.storeProp].discount_type === 'percentage') {
|
||||
props.store[props.storeProp].discount_val = Math.round(
|
||||
(props.store.getSubTotal * newValue) / 100
|
||||
)
|
||||
} else {
|
||||
props.store[props.storeProp].discount_val = Math.round(newValue * 100)
|
||||
}
|
||||
props.store[props.storeProp].discount = newValue
|
||||
setDiscount()
|
||||
},
|
||||
})
|
||||
|
||||
@ -265,7 +266,7 @@ const itemWiseTaxes = computed(() => {
|
||||
} else if (tax.tax_type_id) {
|
||||
taxes.push({
|
||||
tax_type_id: tax.tax_type_id,
|
||||
amount: tax.amount,
|
||||
amount: Math.round(tax.amount),
|
||||
percent: tax.percent,
|
||||
name: tax.name,
|
||||
})
|
||||
@ -284,6 +285,19 @@ const defaultCurrency = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
function setDiscount() {
|
||||
const newValue = props.store[props.storeProp].discount
|
||||
|
||||
if (props.store[props.storeProp].discount_type === 'percentage') {
|
||||
props.store[props.storeProp].discount_val
|
||||
= Math.round((props.store.getSubTotal * newValue) / 100)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
props.store[props.storeProp].discount_val = Math.round(newValue * 100)
|
||||
}
|
||||
|
||||
function selectFixed() {
|
||||
if (props.store[props.storeProp].discount_type === 'fixed') {
|
||||
return
|
||||
@ -295,24 +309,21 @@ function selectFixed() {
|
||||
}
|
||||
|
||||
function selectPercentage() {
|
||||
if (props.store[props.storeProp].discount_type === 'percentage') {
|
||||
if (props.store[props.storeProp].discount_type === 'percentage'){
|
||||
return
|
||||
}
|
||||
props.store[props.storeProp].discount_val =
|
||||
(props.store.getSubTotal * props.store[props.storeProp].discount) / 100
|
||||
|
||||
const val = Math.round(props.store[props.storeProp].discount * 100) / 100
|
||||
|
||||
props.store[props.storeProp].discount_val
|
||||
= Math.round((props.store.getSubTotal * val) / 100)
|
||||
|
||||
props.store[props.storeProp].discount_type = 'percentage'
|
||||
}
|
||||
|
||||
function onSelectTax(selectedTax) {
|
||||
let amount = 0
|
||||
|
||||
if (selectedTax.compound_tax && props.store.getSubtotalWithDiscount) {
|
||||
amount = Math.round(
|
||||
((props.store.getSubtotalWithDiscount + props.store.getTotalSimpleTax) *
|
||||
selectedTax.percent) /
|
||||
100
|
||||
)
|
||||
} else if (props.store.getSubtotalWithDiscount && selectedTax.percent) {
|
||||
if (props.store.getSubtotalWithDiscount && selectedTax.percent) {
|
||||
amount = Math.round(
|
||||
(props.store.getSubtotalWithDiscount * selectedTax.percent) / 100
|
||||
)
|
||||
@ -323,7 +334,6 @@ function onSelectTax(selectedTax) {
|
||||
id: Guid.raw(),
|
||||
name: selectedTax.name,
|
||||
percent: selectedTax.percent,
|
||||
compound_tax: selectedTax.compound_tax,
|
||||
tax_type_id: selectedTax.id,
|
||||
amount,
|
||||
}
|
||||
|
||||
@ -77,17 +77,6 @@
|
||||
@input="v$.currentTaxType.description.$touch()"
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
|
||||
<BaseInputGroup
|
||||
:label="$t('tax_types.compound_tax')"
|
||||
variant="horizontal"
|
||||
class="flex flex-row-reverse"
|
||||
>
|
||||
<BaseSwitch
|
||||
v-model="taxTypeStore.currentTaxType.compound_tax"
|
||||
class="flex items-center"
|
||||
/>
|
||||
</BaseInputGroup>
|
||||
</BaseInputGrid>
|
||||
</div>
|
||||
<div
|
||||
@ -209,14 +198,7 @@ async function submitTaxTypeData() {
|
||||
|
||||
function SelectTax(taxData) {
|
||||
let amount = 0
|
||||
if (taxData.compound_tax && estimateStore.getSubtotalWithDiscount) {
|
||||
amount = Math.round(
|
||||
((estimateStore.getSubtotalWithDiscount +
|
||||
estimateStore.getTotalSimpleTax) *
|
||||
taxData.percent) /
|
||||
100
|
||||
)
|
||||
} else if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
|
||||
if (estimateStore.getSubtotalWithDiscount && taxData.percent) {
|
||||
amount = Math.round(
|
||||
(estimateStore.getSubtotalWithDiscount * taxData.percent) / 100
|
||||
)
|
||||
@ -226,7 +208,6 @@ function SelectTax(taxData) {
|
||||
id: Guid.raw(),
|
||||
name: taxData.name,
|
||||
percent: taxData.percent,
|
||||
compound_tax: taxData.compound_tax,
|
||||
tax_type_id: taxData.id,
|
||||
amount,
|
||||
}
|
||||
@ -242,7 +223,6 @@ function selectItemTax(taxData) {
|
||||
id: Guid.raw(),
|
||||
name: taxData.name,
|
||||
percent: taxData.percent,
|
||||
compound_tax: taxData.compound_tax,
|
||||
tax_type_id: taxData.id,
|
||||
}
|
||||
modalStore.refreshData(data)
|
||||
|
||||
@ -143,7 +143,8 @@ export const useEstimateStore = (useWindow = false) => {
|
||||
axios
|
||||
.get(`/api/v1/estimates/${id}`)
|
||||
.then((response) => {
|
||||
Object.assign(this.newEstimate, response.data.data)
|
||||
this.setEstimateData(response.data.data)
|
||||
this.setCustomerAddresses(this.newEstimate.customer)
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
@ -154,6 +155,41 @@ export const useEstimateStore = (useWindow = false) => {
|
||||
})
|
||||
},
|
||||
|
||||
setEstimateData(estimate) {
|
||||
Object.assign(this.newEstimate, estimate)
|
||||
if (this.newEstimate.tax_per_item === 'YES') {
|
||||
this.newEstimate.items.forEach((_i) => {
|
||||
if (_i.taxes && !_i.taxes.length){
|
||||
_i.taxes.push({ ...taxStub, id: Guid.raw() })
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.newEstimate.discount_per_item === 'YES') {
|
||||
this.newEstimate.items.forEach((_i, index) => {
|
||||
if (_i.discount_type === 'fixed'){
|
||||
this.newEstimate.items[index].discount = _i.discount / 100
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (this.newEstimate.discount_type === 'fixed'){
|
||||
this.newEstimate.discount = this.newEstimate.discount / 100
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setCustomerAddresses(customer) {
|
||||
const customer_business = customer.customer_business
|
||||
|
||||
if (customer_business?.billing_address){
|
||||
this.newEstimate.customer.billing_address = customer_business.billing_address
|
||||
}
|
||||
|
||||
if (customer_business?.shipping_address){
|
||||
this.newEstimate.customer.shipping_address = customer_business.shipping_address
|
||||
}
|
||||
},
|
||||
|
||||
addSalesTaxUs() {
|
||||
const taxTypeStore = useTaxTypeStore()
|
||||
let salesTax = { ...taxStub }
|
||||
|
||||
@ -133,8 +133,8 @@ export const useInvoiceStore = (useWindow = false) => {
|
||||
axios
|
||||
.get(`/api/v1/invoices/${id}`)
|
||||
.then((response) => {
|
||||
Object.assign(this.newInvoice, response.data.data)
|
||||
this.newInvoice.customer = response.data.data.customer
|
||||
this.setInvoiceData(response.data.data)
|
||||
this.setCustomerAddresses(this.newInvoice.customer)
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
@ -144,6 +144,38 @@ export const useInvoiceStore = (useWindow = false) => {
|
||||
})
|
||||
},
|
||||
|
||||
setInvoiceData(invoice) {
|
||||
Object.assign(this.newInvoice, invoice)
|
||||
|
||||
if (this.newInvoice.tax_per_item === 'YES') {
|
||||
this.newInvoice.items.forEach((_i) => {
|
||||
if (_i.taxes && !_i.taxes.length)
|
||||
_i.taxes.push({ ...taxStub, id: Guid.raw() })
|
||||
})
|
||||
}
|
||||
|
||||
if (this.newInvoice.discount_per_item === 'YES') {
|
||||
this.newInvoice.items.forEach((_i, index) => {
|
||||
if (_i.discount_type === 'fixed')
|
||||
this.newInvoice.items[index].discount = _i.discount / 100
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (this.newInvoice.discount_type === 'fixed')
|
||||
this.newInvoice.discount = this.newInvoice.discount / 100
|
||||
}
|
||||
},
|
||||
|
||||
setCustomerAddresses(customer) {
|
||||
const customer_business = customer.customer_business
|
||||
|
||||
if (customer_business?.billing_address)
|
||||
this.newInvoice.customer.billing_address = customer_business.billing_address
|
||||
|
||||
if (customer_business?.shipping_address)
|
||||
this.newInvoice.customer.shipping_address = customer_business.shipping_address
|
||||
},
|
||||
|
||||
addSalesTaxUs() {
|
||||
const taxTypeStore = useTaxTypeStore()
|
||||
let salesTax = { ...taxStub }
|
||||
|
||||
@ -138,6 +138,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, watch, onMounted } from 'vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
@ -257,11 +258,30 @@ async function submitForm() {
|
||||
|
||||
isSaving.value = true
|
||||
|
||||
let data = {
|
||||
let data = cloneDeep({
|
||||
...estimateStore.newEstimate,
|
||||
sub_total: estimateStore.getSubTotal,
|
||||
total: estimateStore.getTotal,
|
||||
tax: estimateStore.getTotalTax,
|
||||
})
|
||||
if (data.discount_per_item === 'YES') {
|
||||
data.items.forEach((item, index) => {
|
||||
if (item.discount_type === 'fixed'){
|
||||
data.items[index].discount = Math.round(item.discount * 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (data.discount_type === 'fixed'){
|
||||
data.discount = Math.round(data.discount * 100)
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!estimateStore.newEstimate.tax_per_item === 'YES'
|
||||
&& data.taxes.length
|
||||
){
|
||||
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
|
||||
}
|
||||
|
||||
const action = isEdit.value
|
||||
|
||||
@ -147,6 +147,7 @@ import {
|
||||
decimal,
|
||||
} from '@vuelidate/validators'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
import { useInvoiceStore } from '@/scripts/admin/stores/invoice'
|
||||
import { useModuleStore } from '@/scripts/admin/stores/module'
|
||||
@ -258,11 +259,29 @@ async function submitForm() {
|
||||
|
||||
isSaving.value = true
|
||||
|
||||
let data = {
|
||||
let data = cloneDeep({
|
||||
...invoiceStore.newInvoice,
|
||||
sub_total: invoiceStore.getSubTotal,
|
||||
total: invoiceStore.getTotal,
|
||||
tax: invoiceStore.getTotalTax,
|
||||
})
|
||||
if (data.discount_per_item === 'YES') {
|
||||
data.items.forEach((item, index) => {
|
||||
if (item.discount_type === 'fixed'){
|
||||
data.items[index].discount = item.discount * 100
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (data.discount_type === 'fixed'){
|
||||
data.discount = data.discount * 100
|
||||
}
|
||||
}
|
||||
if (
|
||||
!invoiceStore.newInvoice.tax_per_item === 'YES'
|
||||
&& data.taxes.length
|
||||
){
|
||||
data.tax_type_ids = data.taxes.map(_t => _t.tax_type_id)
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -20,21 +20,6 @@
|
||||
:data="fetchData"
|
||||
:columns="taxTypeColumns"
|
||||
>
|
||||
<template #cell-compound_tax="{ row }">
|
||||
<BaseBadge
|
||||
:bg-color="
|
||||
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
|
||||
.bgColor
|
||||
"
|
||||
:color="
|
||||
utils.getBadgeStatusColor(row.data.compound_tax ? 'YES' : 'NO')
|
||||
.color
|
||||
"
|
||||
>
|
||||
{{ row.data.compound_tax ? 'Yes' : 'No'.replace('_', ' ') }}
|
||||
</BaseBadge>
|
||||
</template>
|
||||
|
||||
<template #cell-percent="{ row }"> {{ row.data.percent }} % </template>
|
||||
|
||||
<template v-if="hasAtleastOneAbility()" #cell-actions="{ row }">
|
||||
@ -91,11 +76,6 @@ const taxTypeColumns = computed(() => {
|
||||
thClass: 'extra',
|
||||
tdClass: 'font-medium text-gray-900',
|
||||
},
|
||||
{
|
||||
key: 'compound_tax',
|
||||
label: t('settings.tax_types.compound_tax'),
|
||||
tdClass: 'font-medium text-gray-900',
|
||||
},
|
||||
{
|
||||
key: 'percent',
|
||||
label: t('settings.tax_types.percent'),
|
||||
|
||||
@ -309,6 +309,8 @@ function changeSorting(column) {
|
||||
}
|
||||
|
||||
if (!usesLocalData.value) {
|
||||
if (pagination.value)
|
||||
pagination.value.currentPage = 1
|
||||
mapDataToRows()
|
||||
}
|
||||
}
|
||||
@ -326,7 +328,10 @@ async function pageChange(page) {
|
||||
await mapDataToRows()
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
async function refresh(isPreservePage = false) {
|
||||
if (pagination.value && !isPreservePage)
|
||||
pagination.value.currentPage = 1
|
||||
|
||||
await mapDataToRows()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user