kts-component-invoice-operate 3.2.204 → 3.2.206

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
@@ -22271,13 +22271,14 @@ var useColumns$1 = (function (form) {
22271
22271
  //含税金额
22272
22272
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
22273
22273
 
22274
- var lineAmountExcludeTax = lineAmountIncludeTax - value;
22274
+ var lineAmountExcludeTax = chain$1(bignumber(lineAmountIncludeTax)).subtract(bignumber(value));
22275
22275
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
22276
22276
 
22277
22277
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
22278
- var total = lineAmountExcludeTax * taxRate / 100;
22278
+ // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
22279
+ var total = lineAmountExcludeTax.multiply(bignumber(taxRate)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
22279
22280
 
22280
- if (Number(Math.abs(total - Number(value))) <= 0.01) {
22281
+ if (Math.abs(total.subtract(bignumber(value)).done().toNumber()) <= 0.01) {
22281
22282
  callback();
22282
22283
  } else {
22283
22284
  callback('税额填写错误,请重新输入');
package/dist/index.js CHANGED
@@ -22281,13 +22281,14 @@ var useColumns$1 = (function (form) {
22281
22281
  //含税金额
22282
22282
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
22283
22283
 
22284
- var lineAmountExcludeTax = lineAmountIncludeTax - value;
22284
+ var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(lineAmountIncludeTax)).subtract(mathjs.bignumber(value));
22285
22285
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
22286
22286
 
22287
22287
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
22288
- var total = lineAmountExcludeTax * taxRate / 100;
22288
+ // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
22289
+ var total = lineAmountExcludeTax.multiply(mathjs.bignumber(taxRate)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
22289
22290
 
22290
- if (Number(Math.abs(total - Number(value))) <= 0.01) {
22291
+ if (Math.abs(total.subtract(mathjs.bignumber(value)).done().toNumber()) <= 0.01) {
22291
22292
  callback();
22292
22293
  } else {
22293
22294
  callback('税额填写错误,请重新输入');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.204",
3
+ "version": "3.2.206",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -1,12 +1,13 @@
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(5.01)).multiply(bignumber(5)).divide(bignumber(100)).done().toNumber())
10
+ console.log(Math.abs(chain(bignumber(5.01)).multiply(bignumber(5)).divide(bignumber(100)).subtract(bignumber(0.24)).done().toNumber()))
10
11
  const controller = React.useMemo(() => new Invoice.InvoiceController(), [])
11
12
 
12
13
  React.useEffect(() => {
@@ -7,6 +7,7 @@ import { AutoComplete, Select, Button, Input, Spin, Tooltip, InputProps } from '
7
7
  import { WrappedFormUtils } from 'kts-components-antd-x3/lib/form/Form';
8
8
  import { getItemNameWithShorthand } from '../../../../../tools/itemName';
9
9
  import { IGood, LineAttributeType } from '../../../../../InvoiceController';
10
+ import { chain, bignumber } from 'mathjs';
10
11
  import Invoice from '../../../../..';
11
12
  import TitleText from './ui/TitleText';
12
13
  import ItemNameInput from './ui/ItemNameInput';
@@ -521,11 +522,13 @@ export default (form: WrappedFormUtils) => {
521
522
  //含税金额
522
523
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
523
524
  //不含税金额
524
- const lineAmountExcludeTax = lineAmountIncludeTax - value;
525
+ const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax)).subtract(bignumber(value));
525
526
  const taxRate = editGood?.taxRate;
526
527
  if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
527
- const total = lineAmountExcludeTax * taxRate / 100;
528
- if (Number(Math.abs(total - Number(value))) <= 0.01) {
528
+ // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
529
+ const total = lineAmountExcludeTax.multiply(bignumber(taxRate)).divide(bignumber(100));
530
+ // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
531
+ if (Math.abs(total.subtract(bignumber(value)).done().toNumber()) <= 0.01) {
529
532
  callback();
530
533
  } else {
531
534
  callback('税额填写错误,请重新输入')