av6-core 1.0.22 → 1.0.24
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.js +8 -5
- package/dist/index.mjs +8 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1143,7 +1143,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1143
1143
|
let baseRate = it.rate;
|
|
1144
1144
|
if (it.addonPercentage) {
|
|
1145
1145
|
baseRate = baseRate + percentage(baseRate, it.addonPercentage);
|
|
1146
|
-
baseRate =
|
|
1146
|
+
baseRate = applyRound(baseRate, lineFmt, precision);
|
|
1147
1147
|
}
|
|
1148
1148
|
const subtotal = applyRound(it.qty * baseRate, lineFmt, precision);
|
|
1149
1149
|
const other = applyRound(it.otherCharge ?? 0, lineFmt, precision);
|
|
@@ -1152,7 +1152,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1152
1152
|
if (masterExtra.coPayMode === "PERCENTAGE-AMOUNT") {
|
|
1153
1153
|
const copayType = it.coPaymentType ?? "AMOUNT";
|
|
1154
1154
|
const copayValue = it.coPayValue ?? 0;
|
|
1155
|
-
copayAmount2 = copayType === "PERCENTAGE" ? percentage(
|
|
1155
|
+
copayAmount2 = copayType === "PERCENTAGE" ? percentage(subtotal, copayValue) : Math.min(copayValue, subtotal);
|
|
1156
1156
|
}
|
|
1157
1157
|
const dMode = it.discountMode ?? "AMOUNT";
|
|
1158
1158
|
const dVal = it.discountValue ?? 0;
|
|
@@ -1165,6 +1165,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1165
1165
|
baseAfterTaxDisc = basePreTax / inclusiveTaxMultiplier;
|
|
1166
1166
|
}
|
|
1167
1167
|
baseAfterTaxDisc = maybeStep(baseAfterTaxDisc, stepwise, lineFmt, precision);
|
|
1168
|
+
const inxInclusiveDiff = applyRound(basePreTax - baseAfterTaxDisc, lineFmt, precision);
|
|
1168
1169
|
if (dMode === "AMOUNT") {
|
|
1169
1170
|
discountValue = dVal;
|
|
1170
1171
|
} else if (dMode === "PERCENTAGE") {
|
|
@@ -1185,9 +1186,10 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1185
1186
|
const patientRaw = grossAmount2 - copay;
|
|
1186
1187
|
const patientRounded = applyRound(patientRaw, lineFmt, precision);
|
|
1187
1188
|
const lineRoundOff = patientRounded - patientRaw;
|
|
1189
|
+
const normalizedLineRoundOff = Object.is(lineRoundOff, -0) ? 0 : lineRoundOff;
|
|
1188
1190
|
return {
|
|
1189
1191
|
baseRate: applyRound(baseRate, lineFmt, precision),
|
|
1190
|
-
subtotalAmount: subtotal,
|
|
1192
|
+
subtotalAmount: applyRound(subtotal + other - inxInclusiveDiff, lineFmt, precision),
|
|
1191
1193
|
otherChargeAmount: other,
|
|
1192
1194
|
discountMode: dMode,
|
|
1193
1195
|
discountValue: dVal,
|
|
@@ -1199,7 +1201,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1199
1201
|
grossAmount: applyRound(grossAmount2, lineFmt, precision),
|
|
1200
1202
|
netAmount: patientRounded,
|
|
1201
1203
|
// patient payable at line
|
|
1202
|
-
roundOffAmount: applyRound(
|
|
1204
|
+
roundOffAmount: applyRound(normalizedLineRoundOff, "TO_FIXED", 2),
|
|
1203
1205
|
// rounded - raw
|
|
1204
1206
|
copayAmount: copay
|
|
1205
1207
|
// insurer covered at line
|
|
@@ -1223,6 +1225,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1223
1225
|
const patientAfterExtra = Math.max(0, patientRawTotal - masterExtraApplied);
|
|
1224
1226
|
const netAmount = applyRound(patientAfterExtra, headFmt, precision);
|
|
1225
1227
|
const roundOffAmount = netAmount - patientAfterExtra;
|
|
1228
|
+
const normalizedRoundOffAmount = Object.is(roundOffAmount, -0) ? 0 : roundOffAmount;
|
|
1226
1229
|
const master = {
|
|
1227
1230
|
additionalDiscountMode: masterExtra.mode,
|
|
1228
1231
|
additionalDiscountValue: masterExtra.value,
|
|
@@ -1234,7 +1237,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1234
1237
|
grossAmount: applyRound(grossAmount, headFmt, precision),
|
|
1235
1238
|
netAmount,
|
|
1236
1239
|
// patient payable after master extra + rounding
|
|
1237
|
-
roundOffAmount: applyRound(
|
|
1240
|
+
roundOffAmount: applyRound(normalizedRoundOffAmount, "TO_FIXED", 2),
|
|
1238
1241
|
// rounded - raw
|
|
1239
1242
|
copayAmount: applyRound(copayAmount, headFmt, precision)
|
|
1240
1243
|
// Σ line copay (insurer covered)
|
package/dist/index.mjs
CHANGED
|
@@ -1095,7 +1095,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1095
1095
|
let baseRate = it.rate;
|
|
1096
1096
|
if (it.addonPercentage) {
|
|
1097
1097
|
baseRate = baseRate + percentage(baseRate, it.addonPercentage);
|
|
1098
|
-
baseRate =
|
|
1098
|
+
baseRate = applyRound(baseRate, lineFmt, precision);
|
|
1099
1099
|
}
|
|
1100
1100
|
const subtotal = applyRound(it.qty * baseRate, lineFmt, precision);
|
|
1101
1101
|
const other = applyRound(it.otherCharge ?? 0, lineFmt, precision);
|
|
@@ -1104,7 +1104,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1104
1104
|
if (masterExtra.coPayMode === "PERCENTAGE-AMOUNT") {
|
|
1105
1105
|
const copayType = it.coPaymentType ?? "AMOUNT";
|
|
1106
1106
|
const copayValue = it.coPayValue ?? 0;
|
|
1107
|
-
copayAmount2 = copayType === "PERCENTAGE" ? percentage(
|
|
1107
|
+
copayAmount2 = copayType === "PERCENTAGE" ? percentage(subtotal, copayValue) : Math.min(copayValue, subtotal);
|
|
1108
1108
|
}
|
|
1109
1109
|
const dMode = it.discountMode ?? "AMOUNT";
|
|
1110
1110
|
const dVal = it.discountValue ?? 0;
|
|
@@ -1117,6 +1117,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1117
1117
|
baseAfterTaxDisc = basePreTax / inclusiveTaxMultiplier;
|
|
1118
1118
|
}
|
|
1119
1119
|
baseAfterTaxDisc = maybeStep(baseAfterTaxDisc, stepwise, lineFmt, precision);
|
|
1120
|
+
const inxInclusiveDiff = applyRound(basePreTax - baseAfterTaxDisc, lineFmt, precision);
|
|
1120
1121
|
if (dMode === "AMOUNT") {
|
|
1121
1122
|
discountValue = dVal;
|
|
1122
1123
|
} else if (dMode === "PERCENTAGE") {
|
|
@@ -1137,9 +1138,10 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1137
1138
|
const patientRaw = grossAmount2 - copay;
|
|
1138
1139
|
const patientRounded = applyRound(patientRaw, lineFmt, precision);
|
|
1139
1140
|
const lineRoundOff = patientRounded - patientRaw;
|
|
1141
|
+
const normalizedLineRoundOff = Object.is(lineRoundOff, -0) ? 0 : lineRoundOff;
|
|
1140
1142
|
return {
|
|
1141
1143
|
baseRate: applyRound(baseRate, lineFmt, precision),
|
|
1142
|
-
subtotalAmount: subtotal,
|
|
1144
|
+
subtotalAmount: applyRound(subtotal + other - inxInclusiveDiff, lineFmt, precision),
|
|
1143
1145
|
otherChargeAmount: other,
|
|
1144
1146
|
discountMode: dMode,
|
|
1145
1147
|
discountValue: dVal,
|
|
@@ -1151,7 +1153,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1151
1153
|
grossAmount: applyRound(grossAmount2, lineFmt, precision),
|
|
1152
1154
|
netAmount: patientRounded,
|
|
1153
1155
|
// patient payable at line
|
|
1154
|
-
roundOffAmount: applyRound(
|
|
1156
|
+
roundOffAmount: applyRound(normalizedLineRoundOff, "TO_FIXED", 2),
|
|
1155
1157
|
// rounded - raw
|
|
1156
1158
|
copayAmount: copay
|
|
1157
1159
|
// insurer covered at line
|
|
@@ -1175,6 +1177,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1175
1177
|
const patientAfterExtra = Math.max(0, patientRawTotal - masterExtraApplied);
|
|
1176
1178
|
const netAmount = applyRound(patientAfterExtra, headFmt, precision);
|
|
1177
1179
|
const roundOffAmount = netAmount - patientAfterExtra;
|
|
1180
|
+
const normalizedRoundOffAmount = Object.is(roundOffAmount, -0) ? 0 : roundOffAmount;
|
|
1178
1181
|
const master = {
|
|
1179
1182
|
additionalDiscountMode: masterExtra.mode,
|
|
1180
1183
|
additionalDiscountValue: masterExtra.value,
|
|
@@ -1186,7 +1189,7 @@ function calculateBillingFromChildren(inputs, masterExtra, options = {}) {
|
|
|
1186
1189
|
grossAmount: applyRound(grossAmount, headFmt, precision),
|
|
1187
1190
|
netAmount,
|
|
1188
1191
|
// patient payable after master extra + rounding
|
|
1189
|
-
roundOffAmount: applyRound(
|
|
1192
|
+
roundOffAmount: applyRound(normalizedRoundOffAmount, "TO_FIXED", 2),
|
|
1190
1193
|
// rounded - raw
|
|
1191
1194
|
copayAmount: applyRound(copayAmount, headFmt, precision)
|
|
1192
1195
|
// Σ line copay (insurer covered)
|