kts-component-invoice-operate 3.2.249 → 3.2.251
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/.vscode/settings.json +14 -0
- package/dist/Invoice/ui/digtal/Architecture/index.d.ts +4 -0
- package/dist/index.esm.js +187 -76
- package/dist/index.js +186 -75
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/importGoods/index.tsx +82 -27
- package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +15 -7
- package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +11 -10
- package/src/Invoice/InvoiceController/fns/itemBlur.ts +9 -2
- package/src/Invoice/_test/importBuyer/index.tsx +1 -0
- package/src/Invoice/_test/importGoods/index.tsx +84 -29
- package/src/Invoice/index.tsx +4 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +5 -2
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +3 -2
- package/src/Invoice/ui/digtal/Architecture/index.less +4 -0
- package/src/Invoice/ui/digtal/Architecture/index.tsx +45 -7
- package/src/Invoice/ui/digtal/Architecture/svg/plus.svg +1 -0
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +14 -7
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +9 -11
- package/src/Invoice/ui/digtal/GoodsList/ui/Statistics/index.tsx +25 -23
|
@@ -69,16 +69,6 @@ export default class InvoiceControllerForm extends GreyReactBox<InvoiceControlle
|
|
|
69
69
|
|
|
70
70
|
_values.set('payList', this.state.payListState.goodsList.slice());
|
|
71
71
|
|
|
72
|
-
// 金额(含税)
|
|
73
|
-
_values.set('lineAmountIncludeTax', (() => {
|
|
74
|
-
let sum = chain(bignumber(0));
|
|
75
|
-
this.state.goodsListState.goodsList.forEach(e => {
|
|
76
|
-
if (!e || e.lineAttribute === LineAttributeType.赠品行) return;
|
|
77
|
-
sum = sum.add(bignumber(e.lineAmountIncludeTax || 0));
|
|
78
|
-
});
|
|
79
|
-
return sum.done().toNumber();
|
|
80
|
-
})());
|
|
81
|
-
|
|
82
72
|
// 金额(不含税)
|
|
83
73
|
_values.set('lineAmountExcludeTax', (() => {
|
|
84
74
|
let sum = chain(bignumber(0));
|
|
@@ -99,6 +89,17 @@ export default class InvoiceControllerForm extends GreyReactBox<InvoiceControlle
|
|
|
99
89
|
return sum.done().toNumber();
|
|
100
90
|
})());
|
|
101
91
|
|
|
92
|
+
// 金额(含税)
|
|
93
|
+
_values.set('lineAmountIncludeTax', (() => {
|
|
94
|
+
let sum = chain(bignumber(0));
|
|
95
|
+
this.state.goodsListState.goodsList.forEach(e => {
|
|
96
|
+
if (!e || e.lineAttribute === LineAttributeType.赠品行) return;
|
|
97
|
+
sum = sum.add(bignumber(e.lineAmountIncludeTax || 0));
|
|
98
|
+
});
|
|
99
|
+
return sum.done().toNumber();
|
|
100
|
+
// return chain(bignumber(_values.get('lineAmountExcludeTax'))).add(bignumber(_values.get('taxAmount'))).done().toNumber();
|
|
101
|
+
})());
|
|
102
|
+
|
|
102
103
|
// 含税标记
|
|
103
104
|
_values.set('isTaxIncluded', this.state.goodsListState.isTaxIncluded)
|
|
104
105
|
|
|
@@ -4,17 +4,18 @@ import { InvoiceControllerState, IGood } from '../';
|
|
|
4
4
|
/**
|
|
5
5
|
* 项目名称智能赋码
|
|
6
6
|
*/
|
|
7
|
-
export default async (s: InvoiceControllerState, record: any, controller:any) => {
|
|
7
|
+
export default async (s: InvoiceControllerState, record: any, controller: any) => {
|
|
8
8
|
Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
|
|
9
9
|
|
|
10
10
|
// 没用 被编辑的货物 和 form 就退出
|
|
11
11
|
if (!s.goodsListState.editGood || !s.goodsListState.form) return;
|
|
12
12
|
|
|
13
13
|
// 中间数据
|
|
14
|
-
const between: any = {...record };
|
|
14
|
+
const between: any = { ...record };
|
|
15
15
|
|
|
16
16
|
between.taxClassificationCode = record.taxClassificationCode;
|
|
17
17
|
between.shorthand = record.shorthand;
|
|
18
|
+
between.mtzlDm = undefined;
|
|
18
19
|
|
|
19
20
|
// 设置编辑货物
|
|
20
21
|
const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
|
|
@@ -35,6 +36,12 @@ export default async (s: InvoiceControllerState, record: any, controller:any) =>
|
|
|
35
36
|
s.goodsListState.isTaxIncluded
|
|
36
37
|
? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
|
|
37
38
|
: await updateUnitPriceTax(controller, s.goodsListState.form, record)
|
|
39
|
+
|
|
40
|
+
if (s.goodsListState.isValidateMeiTan) {
|
|
41
|
+
if (await s.goodsListState.verifyMeiTanFn(record) === true) {
|
|
42
|
+
s.goodsListState.meiTanGoodIndex = [editGood.$index];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
|
|
@@ -30,36 +30,91 @@ class MyInvoiceController extends InvoiceController {
|
|
|
30
30
|
|
|
31
31
|
return new Promise((resolve, reject) => {
|
|
32
32
|
resolve([
|
|
33
|
+
// {
|
|
34
|
+
// "taxCategoryCode": "1030206030000000000",
|
|
35
|
+
// "productName": "醋及醋代用品",
|
|
36
|
+
// "shorthand": "调味品",
|
|
37
|
+
// "id": null,
|
|
38
|
+
// "specification": null,
|
|
39
|
+
// "createTime": null,
|
|
40
|
+
// "status": 1,
|
|
41
|
+
// "versionCode": "48.0",
|
|
42
|
+
// "version": "32.0",
|
|
43
|
+
// "startTime": "20190401",
|
|
44
|
+
// "endTime": null,
|
|
45
|
+
// "cargo": null,
|
|
46
|
+
// "desc": null,
|
|
47
|
+
// "taxRate": "13%",
|
|
48
|
+
// "keyword": "食醋、米醋、酒醋、啤酒醋、麦芽醋、酒精醋、水果醋、醋精",
|
|
49
|
+
// "summarizedItem": "N",
|
|
50
|
+
// "countCode": null,
|
|
51
|
+
// "customsItem": null,
|
|
52
|
+
// "updateTime": null,
|
|
53
|
+
// "hzx": null,
|
|
54
|
+
// "children": null,
|
|
55
|
+
// "vatspecialManagement": "",
|
|
56
|
+
// "pid": "1030206000000000000",
|
|
57
|
+
// "vatpolicyBasis": null,
|
|
58
|
+
// "vatspecialManagementCode": "",
|
|
59
|
+
// "gstpolicyBasisCode": null,
|
|
60
|
+
// "gstspecialManagement": null,
|
|
61
|
+
// "gstpolicyBasis": null
|
|
62
|
+
// },
|
|
33
63
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
"attributeVOList": null,
|
|
65
|
+
"productName": '原煤',
|
|
66
|
+
"name": null,
|
|
67
|
+
"productCode": "0003",
|
|
68
|
+
"shorthand": "小型起重设备",
|
|
69
|
+
"id": "10881474649024102400167947617243",
|
|
70
|
+
"specification": null,
|
|
71
|
+
"categoryId": "10688389540499947520167487266471",
|
|
72
|
+
"categoryName": "水果",
|
|
73
|
+
"internalNumber": null,
|
|
74
|
+
"taxCategoryName": "轻小型起重设备配套件",
|
|
75
|
+
"referenceAmount": null,
|
|
76
|
+
"priceAmount": 200.000,
|
|
77
|
+
"taxId": null,
|
|
78
|
+
"taxRate": null,
|
|
79
|
+
"brandName": null,
|
|
80
|
+
"buyGroupCode": null,
|
|
81
|
+
"buyGroupId": null,
|
|
82
|
+
"buyGroupName": null,
|
|
83
|
+
"categoryId": 2073,
|
|
84
|
+
"categoryName": "通用",
|
|
85
|
+
"companyId": "41daec4c-baa2-451f-b756-e26067b8657c",
|
|
86
|
+
"createTime": "2021-09-10 15:45:43.0",
|
|
87
|
+
"enjoyPreferentialPolicies": 0,
|
|
88
|
+
"factoryCode": null,
|
|
89
|
+
"factoryId": null,
|
|
90
|
+
"factoryName": null,
|
|
91
|
+
"id": 146200,
|
|
92
|
+
"internalNumber": "发动机盖",
|
|
93
|
+
"isUalityInspection": null,
|
|
94
|
+
"name": "原煤",
|
|
95
|
+
"preferentialPoliciesType": null,
|
|
96
|
+
"priceAmount": 50,
|
|
97
|
+
"procurementCycle": 0,
|
|
98
|
+
"shorthand": "煤炭",
|
|
99
|
+
"specification": "abc",
|
|
100
|
+
"spuCode": "6000001738252675",
|
|
101
|
+
"status": 1,
|
|
102
|
+
"taxCategoryCode": "1020101000000000000",
|
|
103
|
+
"taxExemptionType": "",
|
|
104
|
+
"taxId": 11,
|
|
105
|
+
"taxRate": null,
|
|
106
|
+
"unitId": 30,
|
|
107
|
+
"unitName": "件",
|
|
108
|
+
"itemType": "通用",
|
|
109
|
+
"itemNo": "6000001738252675",
|
|
110
|
+
"itemName": "原煤",
|
|
111
|
+
"itemCode": "123123",
|
|
112
|
+
"itemModelName": "abc",
|
|
113
|
+
"unit": "件",
|
|
114
|
+
"priceIncludeTax": 50,
|
|
115
|
+
"priceExcludeTax": 50,
|
|
116
|
+
"taxClassificationCode": "1020101000000000000"
|
|
117
|
+
},
|
|
63
118
|
]);
|
|
64
119
|
|
|
65
120
|
});
|
package/src/Invoice/index.tsx
CHANGED
|
@@ -148,6 +148,10 @@ const Main = (props: IInvoiceProps) => {
|
|
|
148
148
|
useToGenerateId(controller);
|
|
149
149
|
|
|
150
150
|
React.useEffect(() => { setKey(key + 1) }, [controller]);
|
|
151
|
+
// React.useEffect(() => {
|
|
152
|
+
// setKey(key + 1)
|
|
153
|
+
// controller.state.stakeholder.enables = ['taxAmount']
|
|
154
|
+
// }, [controller]);
|
|
151
155
|
|
|
152
156
|
return (
|
|
153
157
|
<InvoiceContext.Provider key={key} value={controller}>
|
|
@@ -439,8 +439,11 @@ export const updateUnitPriceTax = async (controller: InvoiceController, form: Wr
|
|
|
439
439
|
await controller.setEditGood({ priceIncludeTax });
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
-
// 税额 = 金额(含税)-金额(不含税)
|
|
443
|
-
const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
|
|
442
|
+
// 税额 = 金额(含税)-金额(不含税) (老逻辑)
|
|
443
|
+
// const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
|
|
444
|
+
|
|
445
|
+
// 税额 = 金额(含税)-金额(不含税)(新逻辑)
|
|
446
|
+
const taxAmount = evaluate(`${lineAmountExcludeTax} * ${values.taxRate}/100`);
|
|
444
447
|
form.setFieldsValue({ taxAmount });
|
|
445
448
|
await controller.setEditGood({ taxAmount });
|
|
446
449
|
} else {
|
|
@@ -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')} />
|
|
@@ -770,3 +770,4 @@ function dcoding(v: string): string {
|
|
|
770
770
|
function isDutyFree(record: IGood): boolean {
|
|
771
771
|
return (record.taxFreeType as any) === 1 && record.favouredPolicyName === '免税';
|
|
772
772
|
}
|
|
773
|
+
|
|
@@ -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<string>;
|
|
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
|
-
|
|
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,41 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
|
|
|
102
119
|
})(
|
|
103
120
|
readOnly
|
|
104
121
|
? <MyNY />
|
|
105
|
-
: <Select
|
|
122
|
+
: <Select
|
|
123
|
+
placeholder='请选择'
|
|
124
|
+
style={{ width: '100%' }}
|
|
125
|
+
onChange={(value) => setCrossCitiesSign(value)}
|
|
126
|
+
>
|
|
106
127
|
<Select.Option value='Y'>是</Select.Option>
|
|
107
128
|
<Select.Option value='N'>否</Select.Option>
|
|
108
129
|
</Select>
|
|
109
130
|
)}
|
|
110
131
|
</Form.Item>
|
|
111
132
|
</Col>
|
|
133
|
+
|
|
134
|
+
<Col span={6} >
|
|
135
|
+
<Form.Item label='跨区域涉税事项报验管理编号' >
|
|
136
|
+
{getFieldDecorator('crossRegionTaxReportNo', {
|
|
137
|
+
rules: [{ required: crossCitiesSign === 'Y', message:'请输入跨区域涉税事项报验管理编号' }]
|
|
138
|
+
})(
|
|
139
|
+
<Input readOnly autoComplete='off'
|
|
140
|
+
addonAfter={props.showGetCrossRegionTaxReportNoButton && <Button style={{ height: 0, padding: 0, width: "auto" }} type="link" icon={<Icon component={I001} />} disabled={readOnly || crossCitiesSign !== 'Y'}
|
|
141
|
+
onClick={async () => {
|
|
142
|
+
const no = await props.getCrossRegionTaxReportNo?.();
|
|
143
|
+
form.setFieldsValue({ crossRegionTaxReportNo: no });
|
|
144
|
+
}}
|
|
145
|
+
/>}
|
|
146
|
+
/>
|
|
147
|
+
)}
|
|
148
|
+
</Form.Item>
|
|
149
|
+
</Col>
|
|
150
|
+
|
|
112
151
|
<Col span={6} >
|
|
113
152
|
<Form.Item label='建筑项目名称' >
|
|
114
|
-
{getFieldDecorator('constructName', {
|
|
153
|
+
{getFieldDecorator('constructName', {
|
|
154
|
+
rules: readOnly ? [] : [
|
|
115
155
|
{ required: true, message: '请输入建筑项目名称' },
|
|
116
156
|
{ max: 200, message: '建筑项目名称最多200个字符' },
|
|
117
|
-
|
|
118
157
|
]
|
|
119
158
|
})(
|
|
120
159
|
readOnly
|
|
@@ -123,7 +162,6 @@ export default decorator<RealEstateInfoProps, FormComponentProps & RealEstateInf
|
|
|
123
162
|
)}
|
|
124
163
|
</Form.Item>
|
|
125
164
|
</Col>
|
|
126
|
-
|
|
127
165
|
</Row>
|
|
128
166
|
</div>
|
|
129
167
|
)
|
|
@@ -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
|
-
|
|
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({
|
|
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 =
|
|
540
|
+
const lineAmountExcludeTax = editGood?.lineAmountExcludeTax || 0;
|
|
541
541
|
const taxRate = editGood?.taxRate;
|
|
542
|
-
|
|
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.
|
|
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(
|
|
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(
|
|
96
|
+
<div style={{ minWidth: 119, maxWidth: 300 }} >¥{parseFloat(lineAmountExcludeTax+taxAmount).toFixed(2)}</div>
|
|
95
97
|
</div>
|
|
96
98
|
</div >
|
|
97
99
|
);
|