kts-component-invoice-operate 3.2.253 → 3.2.254

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
@@ -10195,11 +10195,9 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
10195
10195
  /** 税额 */
10196
10196
 
10197
10197
  var onChangeTaxAmount = lazyFn(function (controller, form, record) {
10198
- /** 金额(不含税) */
10199
- var lineAmountExcludeTax;
10200
10198
  form.validateFields( /*#__PURE__*/function () {
10201
10199
  var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(err, values) {
10202
- var record, priceExcludeTax;
10200
+ var record, lineAmountIncludeTax;
10203
10201
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
10204
10202
  while (1) {
10205
10203
  switch (_context23.prev = _context23.next) {
@@ -10220,27 +10218,27 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
10220
10218
 
10221
10219
  case 6:
10222
10220
  // 计数不含税金额
10223
- lineAmountExcludeTax = countAmountExcludeTax((record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) || 0, values.taxAmount);
10221
+ // lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
10222
+ // form.setFieldsValue({ lineAmountExcludeTax });
10223
+ // const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
10224
+ // await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
10225
+ // form.setFieldsValue({ priceExcludeTax });
10226
+ // 计算含税金额
10227
+ lineAmountIncludeTax = chain$1(bignumber((record === null || record === void 0 ? void 0 : record.lineAmountExcludeTax) || 0)).add(bignumber(values.taxAmount || 0)).done().toNumber();
10224
10228
  form.setFieldsValue({
10225
- lineAmountExcludeTax: lineAmountExcludeTax
10229
+ lineAmountIncludeTax: lineAmountIncludeTax
10226
10230
  });
10227
- priceExcludeTax = countPrice(lineAmountExcludeTax || '', (record === null || record === void 0 ? void 0 : record.quantity) || '', controller.state.calculatingDigits);
10228
- _context23.next = 11;
10231
+ _context23.next = 10;
10229
10232
  return controller.setEditGood({
10230
- lineAmountExcludeTax: lineAmountExcludeTax,
10231
10233
  taxAmount: values.taxAmount,
10232
- priceExcludeTax: priceExcludeTax
10234
+ lineAmountIncludeTax: lineAmountIncludeTax
10233
10235
  });
10234
10236
 
10235
- case 11:
10236
- form.setFieldsValue({
10237
- priceExcludeTax: priceExcludeTax
10238
- }); // 清楚 计算中启动字段
10239
-
10240
- _context23.next = 14;
10237
+ case 10:
10238
+ _context23.next = 12;
10241
10239
  return clearCalculatingField(controller);
10242
10240
 
10243
- case 14:
10241
+ case 12:
10244
10242
  case "end":
10245
10243
  return _context23.stop();
10246
10244
  }
@@ -14858,18 +14856,18 @@ var useColumns = (function (form) {
14858
14856
  message: '税额必须为数字'
14859
14857
  }, {
14860
14858
  validator: function validator(rule, value, callback) {
14861
- //含税金额
14859
+ //含税金额(lineAmountExcludeTax)
14862
14860
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
14863
14861
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
14864
14862
 
14865
- var lineAmountExcludeTax = chain$1(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
14863
+ var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
14866
14864
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
14867
14865
 
14868
- if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
14866
+ if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
14869
14867
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
14870
- var total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
14868
+ var total = chain$1(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
14871
14869
 
14872
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
14870
+ if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
14873
14871
  callback();
14874
14872
  } else {
14875
14873
  callback('税额填写错误,请重新输入');
@@ -14884,8 +14882,9 @@ var useColumns = (function (form) {
14884
14882
  textAlign: 'right'
14885
14883
  },
14886
14884
  loading: isCipher(changeField, 'taxAmount'),
14887
- onChange: function onChange() {// setChangeField('taxAmount');
14888
- // onChangeTaxAmount(controller, form, record);
14885
+ onChange: function onChange() {
14886
+ setChangeField('taxAmount');
14887
+ onChangeTaxAmount(controller, form, record);
14889
14888
  }
14890
14889
  }) : /*#__PURE__*/React.createElement(MyDiv, {
14891
14890
  loading: isCipher(changeField, 'taxAmount')
@@ -24172,7 +24171,6 @@ var useColumns$1 = (function (form) {
24172
24171
 
24173
24172
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
24174
24173
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
24175
- console.log('taxRate ===>', taxRate);
24176
24174
 
24177
24175
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
24178
24176
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
package/dist/index.js CHANGED
@@ -10205,11 +10205,9 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
10205
10205
  /** 税额 */
10206
10206
 
10207
10207
  var onChangeTaxAmount = lazyFn(function (controller, form, record) {
10208
- /** 金额(不含税) */
10209
- var lineAmountExcludeTax;
10210
10208
  form.validateFields( /*#__PURE__*/function () {
10211
10209
  var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(err, values) {
10212
- var record, priceExcludeTax;
10210
+ var record, lineAmountIncludeTax;
10213
10211
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
10214
10212
  while (1) {
10215
10213
  switch (_context23.prev = _context23.next) {
@@ -10230,27 +10228,27 @@ var onChangeTaxAmount = lazyFn(function (controller, form, record) {
10230
10228
 
10231
10229
  case 6:
10232
10230
  // 计数不含税金额
10233
- lineAmountExcludeTax = countAmountExcludeTax((record === null || record === void 0 ? void 0 : record.lineAmountIncludeTax) || 0, values.taxAmount);
10231
+ // lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
10232
+ // form.setFieldsValue({ lineAmountExcludeTax });
10233
+ // const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
10234
+ // await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
10235
+ // form.setFieldsValue({ priceExcludeTax });
10236
+ // 计算含税金额
10237
+ lineAmountIncludeTax = mathjs.chain(mathjs.bignumber((record === null || record === void 0 ? void 0 : record.lineAmountExcludeTax) || 0)).add(mathjs.bignumber(values.taxAmount || 0)).done().toNumber();
10234
10238
  form.setFieldsValue({
10235
- lineAmountExcludeTax: lineAmountExcludeTax
10239
+ lineAmountIncludeTax: lineAmountIncludeTax
10236
10240
  });
10237
- priceExcludeTax = countPrice(lineAmountExcludeTax || '', (record === null || record === void 0 ? void 0 : record.quantity) || '', controller.state.calculatingDigits);
10238
- _context23.next = 11;
10241
+ _context23.next = 10;
10239
10242
  return controller.setEditGood({
10240
- lineAmountExcludeTax: lineAmountExcludeTax,
10241
10243
  taxAmount: values.taxAmount,
10242
- priceExcludeTax: priceExcludeTax
10244
+ lineAmountIncludeTax: lineAmountIncludeTax
10243
10245
  });
10244
10246
 
10245
- case 11:
10246
- form.setFieldsValue({
10247
- priceExcludeTax: priceExcludeTax
10248
- }); // 清楚 计算中启动字段
10249
-
10250
- _context23.next = 14;
10247
+ case 10:
10248
+ _context23.next = 12;
10251
10249
  return clearCalculatingField(controller);
10252
10250
 
10253
- case 14:
10251
+ case 12:
10254
10252
  case "end":
10255
10253
  return _context23.stop();
10256
10254
  }
@@ -14868,18 +14866,18 @@ var useColumns = (function (form) {
14868
14866
  message: '税额必须为数字'
14869
14867
  }, {
14870
14868
  validator: function validator(rule, value, callback) {
14871
- //含税金额
14869
+ //含税金额(lineAmountExcludeTax)
14872
14870
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
14873
14871
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
14874
14872
 
14875
- var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(lineAmountIncludeTax || 0)).subtract(mathjs.bignumber(value || 0));
14873
+ var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
14876
14874
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
14877
14875
 
14878
- if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
14876
+ if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
14879
14877
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
14880
- var total = lineAmountExcludeTax.multiply(mathjs.bignumber(taxRate || 0)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
14878
+ var total = mathjs.chain(mathjs.bignumber(lineAmountExcludeTax)).multiply(mathjs.bignumber(taxRate || 0)).divide(mathjs.bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
14881
14879
 
14882
- if (Math.abs(total.subtract(mathjs.bignumber(value || 0)).done().toNumber()) <= 0.01) {
14880
+ if (Math.abs(total.subtract(mathjs.bignumber(value || 0)).done().toNumber()) <= 0.06) {
14883
14881
  callback();
14884
14882
  } else {
14885
14883
  callback('税额填写错误,请重新输入');
@@ -14894,8 +14892,9 @@ var useColumns = (function (form) {
14894
14892
  textAlign: 'right'
14895
14893
  },
14896
14894
  loading: isCipher(changeField, 'taxAmount'),
14897
- onChange: function onChange() {// setChangeField('taxAmount');
14898
- // onChangeTaxAmount(controller, form, record);
14895
+ onChange: function onChange() {
14896
+ setChangeField('taxAmount');
14897
+ onChangeTaxAmount(controller, form, record);
14899
14898
  }
14900
14899
  }) : /*#__PURE__*/React__default['default'].createElement(MyDiv, {
14901
14900
  loading: isCipher(changeField, 'taxAmount')
@@ -24182,7 +24181,6 @@ var useColumns$1 = (function (form) {
24182
24181
 
24183
24182
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
24184
24183
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
24185
- console.log('taxRate ===>', taxRate);
24186
24184
 
24187
24185
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
24188
24186
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.253",
3
+ "version": "3.2.254",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -11,6 +11,7 @@ import { message } from 'kts-components-antd-x3'
11
11
  import { format2, format15, countTaxAmount, countAmountExcludeTax, countPrice } from '../../../../../../tools/calculate';
12
12
  import moment from 'moment';
13
13
  import { equal } from 'mathjs';
14
+ import { chain, bignumber } from 'mathjs';
14
15
 
15
16
  export { format2, format15 } from '../../../../../../tools/calculate';
16
17
 
@@ -668,13 +669,19 @@ export const onChangeTaxAmount = lazyFn(
668
669
  }
669
670
 
670
671
  // 计数不含税金额
671
- lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
672
- form.setFieldsValue({ lineAmountExcludeTax });
672
+ // lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
673
+ // form.setFieldsValue({ lineAmountExcludeTax });
673
674
 
674
- const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
675
+ // const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
675
676
 
676
- await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
677
- form.setFieldsValue({ priceExcludeTax });
677
+ // await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
678
+ // form.setFieldsValue({ priceExcludeTax });
679
+
680
+ // 计算含税金额
681
+ const lineAmountIncludeTax = chain(bignumber(record?.lineAmountExcludeTax || 0)).add(bignumber(values.taxAmount || 0)).done().toNumber();
682
+ form.setFieldsValue({ lineAmountIncludeTax });
683
+
684
+ await controller.setEditGood({ taxAmount: values.taxAmount, lineAmountIncludeTax });
678
685
 
679
686
  // 清楚 计算中启动字段
680
687
  await clearCalculatingField(controller);
@@ -566,17 +566,17 @@ export default (form: WrappedFormUtils) => {
566
566
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
567
567
  {
568
568
  validator: (rule: any, value: any, callback: any) => {
569
- //含税金额
569
+ //含税金额(lineAmountExcludeTax)
570
570
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
571
571
  //不含税金额
572
572
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
573
- const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
573
+ const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
574
574
  const taxRate = editGood?.taxRate;
575
- if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
575
+ if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
576
576
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
577
- const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
577
+ const total = chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
578
578
  // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
579
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
579
+ if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
580
580
  callback();
581
581
  } else {
582
582
  callback('税额填写错误,请重新输入')
@@ -593,8 +593,8 @@ export default (form: WrappedFormUtils) => {
593
593
  style={{ textAlign: 'right' }}
594
594
  loading={isCipher(changeField, 'taxAmount')}
595
595
  onChange={() => {
596
- // setChangeField('taxAmount');
597
- // onChangeTaxAmount(controller, form, record);
596
+ setChangeField('taxAmount');
597
+ onChangeTaxAmount(controller, form, record);
598
598
  }}
599
599
  />
600
600
  : <MyDiv loading={isCipher(changeField, 'taxAmount')} />
@@ -539,7 +539,6 @@ export default (form: WrappedFormUtils) => {
539
539
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
540
540
  const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
541
541
  const taxRate = editGood?.taxRate;
542
- console.log('taxRate ===>', taxRate);
543
542
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
544
543
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
545
544
  const total = chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));