@unimaze/billing 0.21.36 → 0.21.38
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.
|
@@ -204,7 +204,7 @@ var AttachmentModal = function (props) {
|
|
|
204
204
|
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
205
205
|
props.onRemove(attachment.file);
|
|
206
206
|
} })))),
|
|
207
|
-
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { rules: [
|
|
207
|
+
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { initialValue: attachment.description, rules: [
|
|
208
208
|
{
|
|
209
209
|
required: true,
|
|
210
210
|
message: props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
@@ -22,13 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
var react_1 = __importStar(require("react"));
|
|
27
30
|
var antd_1 = require("antd");
|
|
28
31
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
29
32
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
30
33
|
var react_intl_1 = require("react-intl");
|
|
31
|
-
var
|
|
34
|
+
var InvoicePreviewTotalAmountPreview_1 = __importDefault(require("../invoice-preview/InvoicePreviewTotalAmountPreview"));
|
|
32
35
|
var translationMessages = (0, react_intl_1.defineMessages)({
|
|
33
36
|
billingCalculations_labels_TaxAmountWithoutVat: {
|
|
34
37
|
id: "billingCalculations_labels_TaxAmountWithoutVat",
|
|
@@ -95,58 +98,82 @@ var BillingCalculations = function (props) {
|
|
|
95
98
|
}
|
|
96
99
|
var roundedAmount = Math.round(totals.totalTaxInclusiveAmount);
|
|
97
100
|
var roundingAmount = totals.totalTaxInclusiveAmount - roundedAmount;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
101
|
+
var _totals = (0, BillingLineUtility_1.getTotals)(props.formInstance.getFieldValue(["invoice", "invoiceLines"]));
|
|
102
|
+
// TODO check if we still need commented out render
|
|
103
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, (invoiceLines === null || invoiceLines === void 0 ? void 0 : invoiceLines.length) > 0 && react_1.default.createElement(antd_1.Col, { span: 24 },
|
|
104
|
+
react_1.default.createElement(InvoicePreviewTotalAmountPreview_1.default, { form: props.formInstance, totals: _totals })))
|
|
105
|
+
// <Flex vertical>
|
|
106
|
+
// <Flex justify="end" gap={'large'}>
|
|
107
|
+
// <Flex vertical style={{ fontWeight: 300 }}>
|
|
108
|
+
// <Typography.Text>
|
|
109
|
+
// {props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat)}:
|
|
110
|
+
// </Typography.Text>
|
|
111
|
+
//
|
|
112
|
+
// <Typography.Text >
|
|
113
|
+
// {props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat)}:
|
|
114
|
+
// </Typography.Text>
|
|
115
|
+
// {totals.discountAmount > 0 && (
|
|
116
|
+
// <Typography.Text >
|
|
117
|
+
// {props.intl.formatMessage(translationMessages.billingLines_discount)}:
|
|
118
|
+
// </Typography.Text>
|
|
119
|
+
// )}
|
|
120
|
+
// {roundingAmount !== 0 && (
|
|
121
|
+
// <Typography.Text >
|
|
122
|
+
// {props.intl.formatMessage(translationMessages.billingCalculations_labels_RoundingAmount)}:
|
|
123
|
+
// </Typography.Text>
|
|
124
|
+
// )}
|
|
125
|
+
// </Flex>
|
|
126
|
+
//
|
|
127
|
+
// <Flex vertical style={{alignItems:'end'}}>
|
|
128
|
+
// <Typography.Text strong>
|
|
129
|
+
// {icelandicNumberLocaleWorkaroundChrome(totals.totalTaxableAmount, props.intl, {
|
|
130
|
+
// style: "decimal",
|
|
131
|
+
// })} {props.formInstance.getFieldValue(["invoice", "currencyCode"])}
|
|
132
|
+
// </Typography.Text>
|
|
133
|
+
// <Typography.Text strong>
|
|
134
|
+
// {icelandicNumberLocaleWorkaroundChrome(totals.totalTaxInclusiveAmount, props.intl, {
|
|
135
|
+
// style: "decimal",
|
|
136
|
+
// })} {props.formInstance.getFieldValue(["invoice", "currencyCode"])}
|
|
137
|
+
// </Typography.Text>
|
|
138
|
+
// {totals.discountAmount > 0 && (
|
|
139
|
+
// <Typography.Text strong>
|
|
140
|
+
// {icelandicNumberLocaleWorkaroundChrome(totals.discountAmount, props.intl, {
|
|
141
|
+
// style: "decimal",
|
|
142
|
+
// })} {props.formInstance.getFieldValue(["invoice", "currencyCode"])}
|
|
143
|
+
// </Typography.Text>
|
|
144
|
+
// )}
|
|
145
|
+
// {roundingAmount !== 0 && (
|
|
146
|
+
// <Typography.Text strong>
|
|
147
|
+
// {icelandicNumberLocaleWorkaroundChrome(roundingAmount, props.intl, {
|
|
148
|
+
// style: "decimal",
|
|
149
|
+
// })} {props.formInstance.getFieldValue(["invoice", "currencyCode"])}
|
|
150
|
+
// </Typography.Text>
|
|
151
|
+
// )}
|
|
152
|
+
// </Flex>
|
|
153
|
+
// </Flex>
|
|
154
|
+
//
|
|
155
|
+
// <Row>
|
|
156
|
+
// <Col span={24}>
|
|
157
|
+
// <hr />
|
|
158
|
+
// </Col>
|
|
159
|
+
// </Row>
|
|
160
|
+
// <Flex justify="end">
|
|
161
|
+
// <Typography.Text strong style={{ fontSize: "18px" }}>
|
|
162
|
+
// {" "}
|
|
163
|
+
// ={" "}
|
|
164
|
+
// {icelandicNumberLocaleWorkaroundChrome(roundedAmount, props.intl, {
|
|
165
|
+
// style: "decimal",
|
|
166
|
+
// })} {props.formInstance.getFieldValue(["invoice", "currencyCode"])}
|
|
167
|
+
// </Typography.Text>
|
|
168
|
+
//
|
|
169
|
+
// {/*<Col span={24}>*/}
|
|
170
|
+
// {/* <InvoicePreviewInvoiceLines form={props.formInstance}/>*/}
|
|
171
|
+
// {/*</Col>*/}
|
|
172
|
+
// <Col span={24}>
|
|
173
|
+
// <InvoicePreviewTotalAmountPreview form={props.formInstance} totals={_totals}/>
|
|
174
|
+
// </Col>
|
|
175
|
+
// </Flex>
|
|
176
|
+
// </Flex>
|
|
177
|
+
);
|
|
151
178
|
};
|
|
152
179
|
exports.default = (0, react_intl_1.injectIntl)(BillingCalculations);
|
|
@@ -97,9 +97,9 @@ var BillingLines = function (props) {
|
|
|
97
97
|
React.createElement(tooltip_1.default, { title: props.intl.formatMessage(exports.translationMessages.billingLines_tooltip_title) }))),
|
|
98
98
|
React.createElement(NewBillingLines_1.default, { formInstance: props.formInstance, receiverRequirements: props.receiverRequirements, outsideVatScope: props.outsideVatScope, newLineSaved: newLineSaved, setNewLineSaved: setNewLineSaved })),
|
|
99
99
|
React.createElement(antd_1.Flex, { gap: "middle", vertical: true },
|
|
100
|
-
React.createElement(BillingCalculations_1.default, { currencyCode: currencyCode, formInstance: props.formInstance, outsideVatScope: props.outsideVatScope, newLineSaved: newLineSaved }),
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
React.createElement(BillingCalculations_1.default, { currencyCode: currencyCode, formInstance: props.formInstance, outsideVatScope: props.outsideVatScope, newLineSaved: newLineSaved })),
|
|
101
|
+
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(exports.translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"], style: { marginBottom: 0 } },
|
|
102
|
+
React.createElement(antd_1.Input.TextArea, { placeholder: props.intl.formatMessage(exports.translationMessages.baseInformation_notes) })))));
|
|
103
103
|
};
|
|
104
104
|
var BillingLinesIntl = (0, react_intl_1.injectIntl)(BillingLines);
|
|
105
105
|
exports.default = BillingLinesIntl;
|
|
@@ -193,19 +193,21 @@ exports.getFieldNames = getFieldNames;
|
|
|
193
193
|
var combinedTaxesForLines = function (invoiceLines) {
|
|
194
194
|
var taxes = [];
|
|
195
195
|
invoiceLines === null || invoiceLines === void 0 ? void 0 : invoiceLines.forEach(function (invoiceLine) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
196
|
+
if (invoiceLine === null || invoiceLine === void 0 ? void 0 : invoiceLine.taxableAmount) {
|
|
197
|
+
var taxType = mapi_1.TaxCategoryTypeEnum[invoiceLine.taxCategoryType];
|
|
198
|
+
var taxPercentage = (0, exports.calculateTaxPercentage)(enums_1.AvailableTaxCategoryTypeEnum[taxType]);
|
|
199
|
+
if (taxPercentage !== 0) {
|
|
200
|
+
var taxIndex = taxes.findIndex(function (tax) { return tax.taxCategoryType === invoiceLine.taxCategoryType; });
|
|
201
|
+
var amountToAdd = (0, exports.calculateTaxAmount)(invoiceLine.taxableAmount, taxPercentage);
|
|
202
|
+
if (taxIndex !== -1) {
|
|
203
|
+
taxes[taxIndex].taxAmount += amountToAdd;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
taxes.push({
|
|
207
|
+
taxCategoryType: invoiceLine.taxCategoryType,
|
|
208
|
+
taxAmount: amountToAdd,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
});
|