kts-component-invoice-operate 3.2.205 → 3.2.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -22270,14 +22270,16 @@ var useColumns$1 = (function (form) {
|
|
|
22270
22270
|
validator: function validator(rule, value, callback) {
|
|
22271
22271
|
//含税金额
|
|
22272
22272
|
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
22273
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
22273
22274
|
|
|
22274
|
-
var lineAmountExcludeTax = lineAmountIncludeTax
|
|
22275
|
+
var lineAmountExcludeTax = chain$1(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
|
|
22275
22276
|
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
22276
22277
|
|
|
22277
22278
|
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
22278
|
-
|
|
22279
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
22280
|
+
var total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
22279
22281
|
|
|
22280
|
-
if (
|
|
22282
|
+
if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
22281
22283
|
callback();
|
|
22282
22284
|
} else {
|
|
22283
22285
|
callback('税额填写错误,请重新输入');
|
package/dist/index.js
CHANGED
|
@@ -22280,14 +22280,16 @@ var useColumns$1 = (function (form) {
|
|
|
22280
22280
|
validator: function validator(rule, value, callback) {
|
|
22281
22281
|
//含税金额
|
|
22282
22282
|
var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
|
|
22283
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
22283
22284
|
|
|
22284
|
-
var lineAmountExcludeTax = lineAmountIncludeTax
|
|
22285
|
+
var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(lineAmountIncludeTax || 0)).subtract(mathjs.bignumber(value || 0));
|
|
22285
22286
|
var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
|
|
22286
22287
|
|
|
22287
22288
|
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
22288
|
-
|
|
22289
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
22290
|
+
var total = lineAmountExcludeTax.multiply(mathjs.bignumber(taxRate || 0)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
22289
22291
|
|
|
22290
|
-
if (
|
|
22292
|
+
if (Math.abs(total.subtract(mathjs.bignumber(value || 0)).done().toNumber()) <= 0.01) {
|
|
22291
22293
|
callback();
|
|
22292
22294
|
} else {
|
|
22293
22295
|
callback('税额填写错误,请重新输入');
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Invoice from '../../..';
|
|
3
3
|
import 'antd/dist/antd.css';
|
|
4
|
-
|
|
4
|
+
import { chain, bignumber } from 'mathjs';
|
|
5
5
|
export default () => {
|
|
6
6
|
const callback = (e: any) => {
|
|
7
7
|
console.log(e.target.checked)
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
console.log(chain(bignumber(null)))
|
|
10
|
+
console.log(chain(bignumber(5.01)).multiply(bignumber(5)).divide(bignumber(100)).done().toNumber())
|
|
11
|
+
console.log(Math.abs(chain(bignumber(5.01)).multiply(bignumber(5)).divide(bignumber(100)).subtract(bignumber(0.24)).done().toNumber()))
|
|
10
12
|
const controller = React.useMemo(() => new Invoice.InvoiceController(), [])
|
|
11
13
|
|
|
12
14
|
React.useEffect(() => {
|
|
@@ -522,12 +522,14 @@ export default (form: WrappedFormUtils) => {
|
|
|
522
522
|
//含税金额
|
|
523
523
|
const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
|
|
524
524
|
//不含税金额
|
|
525
|
-
const lineAmountExcludeTax = lineAmountIncludeTax
|
|
525
|
+
// const lineAmountExcludeTax = lineAmountIncludeTax-value;
|
|
526
|
+
const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax||0)).subtract(bignumber(value||0));
|
|
526
527
|
const taxRate = editGood?.taxRate;
|
|
527
528
|
if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
|
|
528
|
-
const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
529
|
+
// const total = bignumber(lineAmountExcludeTax * taxRate / 100);
|
|
530
|
+
const total = lineAmountExcludeTax.multiply(bignumber(taxRate||0)).divide(bignumber(100));
|
|
529
531
|
// if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
|
|
530
|
-
if (
|
|
532
|
+
if (Math.abs(total.subtract(bignumber(value||0)).done().toNumber()) <= 0.01) {
|
|
531
533
|
callback();
|
|
532
534
|
} else {
|
|
533
535
|
callback('税额填写错误,请重新输入')
|