kts-component-invoice-operate 3.2.250 → 3.2.252

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.
@@ -3,10 +3,12 @@ import React from "react";
3
3
  import { decorator } from 'grey-react-box';
4
4
  import { Form } from 'kts-components-antd-x3';
5
5
  import { FormComponentProps } from 'kts-components-antd-x3/lib/form';
6
+ import Icon from '@ant-design/icons';
6
7
  import Invoice from '../../..';
7
8
  import './index.less';
8
- import { Cascader, Col, Input, Row, Select } from "kts-components-antd-x4";
9
+ import { Cascader, Col, Input, Row, Select, Button } from "kts-components-antd-x4";
9
10
  import moment from "moment";
11
+ import { ReactComponent as I001 } from './svg/plus.svg'
10
12
 
11
13
 
12
14
  export interface RealEstateInfoProps {
@@ -19,6 +21,12 @@ export interface RealEstateInfoProps {
19
21
  * 建筑服务地址数据字段名
20
22
  */
21
23
  fieldNames?: any;
24
+
25
+ /** 获取"跨区域涉税事项报验管理编号" */
26
+ getCrossRegionTaxReportNo?: () => Promise<any>;
27
+
28
+ /** 是否显示 【 获取"跨区域涉税事项报验管理编号"】按钮 */
29
+ showGetCrossRegionTaxReportNoButton?: boolean;
22
30
  }
23
31
 
24
32
  /** 特殊信息-建筑服务 */
@@ -38,6 +46,15 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
38
46
  // 注册 form
39
47
  controller.useForm('serviceDataDtoInfo', form);
40
48
 
49
+ // 监听 crossCitiesSign 字段值变化
50
+ const [crossCitiesSign, setCrossCitiesSign] = React.useState(form.getFieldValue('crossCitiesSign'));
51
+
52
+ // 同步表单初始值和外部更新
53
+ React.useEffect(() => {
54
+ const currentValue = form.getFieldValue('crossCitiesSign');
55
+ setCrossCitiesSign(currentValue);
56
+ }, [form]);
57
+
41
58
  return (
42
59
  <div className="kts-invoice-operate-real-estate-info-digtal">
43
60
  <div className='real-estate-info-digtal-label' >特定信息-建筑服务</div>
@@ -45,7 +62,7 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
45
62
  <Col span={6} >
46
63
  <Form.Item label='土地增值税项目编号' >
47
64
  {getFieldDecorator('landNumber', {
48
- rules: [
65
+ rules: [
49
66
  { max: 16, message: '最多16个字符' },
50
67
  ]
51
68
  })(
@@ -55,7 +72,7 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
55
72
  )}
56
73
  </Form.Item>
57
74
  </Col>
58
-
75
+
59
76
 
60
77
  <Col span={6} >
61
78
  <Form.Item label='建筑服务发生地' >
@@ -102,19 +119,53 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
102
119
  })(
103
120
  readOnly
104
121
  ? <MyNY />
105
- : <Select placeholder='请选择' style={{ width: '100%' }} >
122
+ : <Select
123
+ placeholder='请选择'
124
+ style={{ width: '100%' }}
125
+ onChange={(value) => {
126
+ setCrossCitiesSign(value)
127
+ if (value === 'N') {
128
+ form.setFieldsValue({
129
+ crossRegionTaxReportNo: '',
130
+ constructAddress: [],
131
+ constructDetailAddress: '',
132
+ constructName: '',
133
+ });
134
+ }
135
+ }}
136
+ >
106
137
  <Select.Option value='Y'>是</Select.Option>
107
138
  <Select.Option value='N'>否</Select.Option>
108
139
  </Select>
109
140
  )}
110
141
  </Form.Item>
111
142
  </Col>
143
+
144
+ <Col span={6} >
145
+ <Form.Item label='跨区域涉税事项报验管理编号' >
146
+ {getFieldDecorator('crossRegionTaxReportNo', {
147
+ rules: readOnly ? [] : [{ required: crossCitiesSign === 'Y', message: '请输入跨区域涉税事项报验管理编号' }]
148
+ })(
149
+ readOnly
150
+ ? <MyDiv />
151
+ : <Input readOnly autoComplete='off'
152
+ addonAfter={props.showGetCrossRegionTaxReportNoButton && <Button style={{ height: 0, padding: 0, width: "auto" }} type="link" icon={<Icon component={I001} />} disabled={readOnly || crossCitiesSign !== 'Y'}
153
+ onClick={async () => {
154
+ const values = await props.getCrossRegionTaxReportNo?.();
155
+ form.setFieldsValue(values);
156
+ }}
157
+ />}
158
+ />
159
+ )}
160
+ </Form.Item>
161
+ </Col>
162
+
112
163
  <Col span={6} >
113
164
  <Form.Item label='建筑项目名称' >
114
- {getFieldDecorator('constructName', { rules: readOnly ? [] : [
165
+ {getFieldDecorator('constructName', {
166
+ rules: readOnly ? [] : [
115
167
  { required: true, message: '请输入建筑项目名称' },
116
168
  { max: 200, message: '建筑项目名称最多200个字符' },
117
-
118
169
  ]
119
170
  })(
120
171
  readOnly
@@ -123,7 +174,6 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
123
174
  )}
124
175
  </Form.Item>
125
176
  </Col>
126
-
127
177
  </Row>
128
178
  </div>
129
179
  )
@@ -0,0 +1 @@
1
+ <svg t="1767497722334" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16431" width="200" height="200"><path d="M644.879 886.426c0-71.304-56.367-129.106-125.887-129.106-69.511 0-125.898 57.802-125.898 129.106 0 71.323 56.388 129.124 125.898 129.124 69.52 0 125.887-57.803 125.887-129.124z m0-387.336c0-71.303-56.367-129.124-125.887-129.124-69.511 0-125.898 57.822-125.898 129.124 0 71.303 56.388 129.106 125.898 129.106 69.52 0 125.887-57.803 125.887-129.106z m0-361.515c0-71.324-56.367-129.125-125.887-129.125-69.511 0-125.898 57.801-125.898 129.125 0 71.304 56.388 129.105 125.898 129.105 69.52-0.001 125.887-57.802 125.887-129.105z" p-id="16432"></path></svg>
@@ -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
 
@@ -361,13 +362,18 @@ export const onChangeTaxAmount = lazyFn(
361
362
  }
362
363
 
363
364
  // 计数不含税金额
364
- lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
365
- form.setFieldsValue({ lineAmountExcludeTax });
366
-
367
- const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
365
+ // lineAmountExcludeTax = countAmountExcludeTax(record?.lineAmountIncludeTax || 0, values.taxAmount);
366
+ // form.setFieldsValue({ lineAmountExcludeTax });
367
+ // const priceExcludeTax: any = countPrice(lineAmountExcludeTax || '', record?.quantity || '', controller.state.calculatingDigits);
368
+
369
+ // await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
370
+ // form.setFieldsValue({ priceExcludeTax });
371
+
372
+ // 计算含税金额
373
+ const lineAmountIncludeTax = chain(bignumber(record?.lineAmountExcludeTax || 0)).add(bignumber(values.taxAmount || 0)).done().toNumber();
374
+ form.setFieldsValue({ lineAmountIncludeTax });
368
375
 
369
- await controller.setEditGood({ lineAmountExcludeTax, taxAmount: values.taxAmount, priceExcludeTax });
370
- form.setFieldsValue({ priceExcludeTax });
376
+ await controller.setEditGood({ taxAmount: values.taxAmount, lineAmountIncludeTax });
371
377
 
372
378
  // 清楚 计算中启动字段
373
379
  await clearCalculatingField(controller);
@@ -481,7 +487,8 @@ export const updateUnitPriceTax = async (controller: InvoiceController, form: Wr
481
487
  }
482
488
 
483
489
  // 税额 = 金额(含税)-金额(不含税)
484
- const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
490
+ // const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
491
+ const taxAmount = format2(evaluate(`${lineAmountExcludeTax} * ${values.taxRate}/100`));
485
492
  form.setFieldsValue({ taxAmount });
486
493
  await controller.setEditGood({ taxAmount });
487
494
  } else {
@@ -473,7 +473,7 @@ export default (form: WrappedFormUtils) => {
473
473
  key: 'taxRate',
474
474
  align: 'right',
475
475
  width: 70,
476
- render: (value: string|number, record: IGood) => {
476
+ render: (value: string | number, record: IGood) => {
477
477
  if (editGood?.$index === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
478
478
  return (
479
479
  <Form.Item>
@@ -533,28 +533,27 @@ export default (form: WrappedFormUtils) => {
533
533
  { required: isValidateGood, message: '税额不能为空' },
534
534
  {
535
535
  validator: (rule, value, callback) => {
536
- //含税金额
536
+ //含税金额(lineAmountExcludeTax)
537
537
  const lineAmountIncludeTax = editGood?.lineAmountIncludeTax || 0;
538
538
  //不含税金额
539
539
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
540
- const lineAmountExcludeTax = chain(bignumber(lineAmountIncludeTax || 0)).subtract(bignumber(value || 0));
540
+ const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
541
541
  const taxRate = editGood?.taxRate;
542
- if (lineAmountExcludeTax && taxRate && lineAmountIncludeTax) {
542
+ console.log('taxRate ===>', taxRate);
543
+ if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
543
544
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
544
- const total = lineAmountExcludeTax.multiply(bignumber(taxRate || 0)).divide(bignumber(100));
545
+ const total = chain(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
545
546
  // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
546
- if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.01) {
547
+ if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
547
548
  callback();
548
549
  } else {
549
- callback('税额填写错误,请重新输入')
550
- }
550
+ callback('' + (record.serialNo) + '行税额校验不通过!')
551
+ }
551
552
  } else {
552
553
  callback();
553
554
  }
554
-
555
555
  }
556
556
  },
557
-
558
557
  { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '税额必须为数字' },
559
558
  ],
560
559
  })(
@@ -581,7 +580,6 @@ export default (form: WrappedFormUtils) => {
581
580
  dataIndex: 'remarks',
582
581
  key: 'remarks',
583
582
  width: 150,
584
-
585
583
  },
586
584
  ]
587
585
  // 含税不含税
@@ -13,27 +13,7 @@ export default () => {
13
13
  /** 是否不含税) */
14
14
  const isTaxIncluded = controller.useMemo(s => s.goodsListState.isTaxIncluded, []);
15
15
 
16
- /** 金额(含税) */
17
- const lineAmountIncludeTax = controller.useMemo((s) => {
18
- if (typeof s.goodsListState.amountIncludeTax === 'number') {
19
- return s.goodsListState.amountIncludeTax
20
- }
21
-
22
- let sum = chain(bignumber(0));
23
- const editGood = s.goodsListState.editGood; // 正在编辑的货物
24
- const err = s.goodsListState.form?.getFieldsError() ?? {};
25
-
26
- s.goodsListState.goodsList.forEach((e) => {
27
- if (e.$index === editGood?.$index) {
28
- if (!err.lineAmountIncludeTax) {
29
- sum = sum.add(bignumber(editGood.lineAmountIncludeTax || 0));
30
- }
31
- } else {
32
- sum = sum.add(bignumber(e.lineAmountIncludeTax || 0));
33
- }
34
- });
35
- return sum.done().toNumber();
36
- }, []);
16
+
37
17
 
38
18
  /** 金额(不含税) */
39
19
  const lineAmountExcludeTax = controller.useMemo((s) => {
@@ -75,6 +55,28 @@ export default () => {
75
55
  return sum.done().toNumber();
76
56
  }, []);
77
57
 
58
+ /** 金额(含税) */
59
+ const lineAmountIncludeTax = controller.useMemo((s) => {
60
+ if (typeof s.goodsListState.amountIncludeTax === 'number') {
61
+ return s.goodsListState.amountIncludeTax
62
+ }
63
+
64
+ let sum = chain(bignumber(0));
65
+ const editGood = s.goodsListState.editGood; // 正在编辑的货物
66
+ const err = s.goodsListState.form?.getFieldsError() ?? {};
67
+
68
+ s.goodsListState.goodsList.forEach((e) => {
69
+ if (e.$index === editGood?.$index) {
70
+ if (!err.lineAmountIncludeTax) {
71
+ sum = sum.add(bignumber(editGood.lineAmountIncludeTax || 0));
72
+ }
73
+ } else {
74
+ sum = sum.add(bignumber(e.lineAmountIncludeTax || 0));
75
+ }
76
+ });
77
+ return sum.done().toNumber();
78
+ }, []);
79
+
78
80
  return (
79
81
  <div className='kts-invoice-operate-goods-list-statistics-digtal' >
80
82
  <div className='statistics-digtal-total' >
@@ -87,11 +89,11 @@ export default () => {
87
89
  <div>价税合计(大写)</div>
88
90
  <div style={{ paddingLeft: 30 }} >
89
91
  <Icon style={{fontSize: 16}} component={ForkSvg} />
90
- <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{Money.toStringChinese(lineAmountIncludeTax)}</span>
92
+ <span style={{ fontWeight: 'bold', marginLeft: 4 }} >{Money.toStringChinese(lineAmountExcludeTax+taxAmount)}</span>
91
93
  </div>
92
94
  <div style={{ flex: 1 }} />
93
95
  <div style={{ width: 90, color: '#9F613E' }} >(小写)</div>
94
- <div style={{ minWidth: 119, maxWidth: 300 }} >¥{parseFloat(lineAmountIncludeTax).toFixed(2)}</div>
96
+ <div style={{ minWidth: 119, maxWidth: 300 }} >¥{parseFloat(lineAmountExcludeTax+taxAmount).toFixed(2)}</div>
95
97
  </div>
96
98
  </div >
97
99
  );