added insurance to formula

This commit is contained in:
Ali 2026-01-08 17:19:13 +04:00
parent 1c944e352d
commit 2eef01d153
1 changed files with 14 additions and 14 deletions

View File

@ -765,7 +765,7 @@ function highlight_invalid_cells(frm, invalid_rows_1, invalid_rows_2) {
// ==================== END VALIDATION ====================
// ==================== FORMULA 509.1 CALCULATION (TAM İL) ====================
// Calculate field 509.1 based on formula: ((501.1 + 504.1) / 2) * 1% + 505 * 1%
// Calculate field 509.1 based on formula: ((501.1 + 504.1) / 2) * 1% + 505.1 * 1%
function calculate_509_1(frm) {
// Only calculate when tam_il is checked
@ -791,16 +791,16 @@ function calculate_509_1(frm) {
}
});
// Get value from field 505 (sığorta from vergi_hesab_3cu)
let value_505 = 0;
// Get value from field 505.1 (sığorta from vergi_hesab_3cu)
let value_505_1 = 0;
(frm.doc.vergi_hesab_3cu || []).forEach(row => {
if (row.göstəricilər && row.göstəricilər.startsWith('505 ')) {
value_505 = flt(row.manatla);
if (row.göstəricilər && row.göstəricilər.startsWith('505.1 ')) {
value_505_1 = flt(row.manatla);
}
});
// Calculate: ((501.1 + 504.1) / 2) * 1% + 505 * 1%
let result = ((value_501_1 + value_504_1) / 2) * 0.01 + value_505 * 0.01;
// Calculate: ((501.1 + 504.1) / 2) * 1% + 505.1 * 1%
let result = ((value_501_1 + value_504_1) / 2) * 0.01 + value_505_1 * 0.01;
// Set value to field 509.1 (manatla in vergi_hesab_5ci)
(frm.doc.vergi_hesab_5ci || []).forEach(row => {
@ -820,7 +820,7 @@ function calculate_509_1(frm) {
}
// ==================== FORMULA 509.2 CALCULATION (İL ƏRZİNDƏ) ====================
// Calculate field 509.2 based on formula: ((503.1 + 504.1) / 24 * 507) * 1% + 505 * 1%
// Calculate field 509.2 based on formula: ((503.1 + 504.1) / 24 * 507) * 1% + 505.1 * 1%
function calculate_509_2(frm) {
// Only calculate when il_erzinde is checked
@ -852,16 +852,16 @@ function calculate_509_2(frm) {
}
});
// Get value from field 505 (sığorta from vergi_hesab_3cu)
let value_505 = 0;
// Get value from field 505.1 (sığorta from vergi_hesab_3cu)
let value_505_1 = 0;
(frm.doc.vergi_hesab_3cu || []).forEach(row => {
if (row.göstəricilər && row.göstəricilər.startsWith('505 ')) {
value_505 = flt(row.manatla);
if (row.göstəricilər && row.göstəricilər.startsWith('505.1 ')) {
value_505_1 = flt(row.manatla);
}
});
// Calculate: ((503.1 + 504.1) / 24 * 507) * 1% + 505 * 1%
let result = ((value_503_1 + value_504_1) / 24 * value_507) * 0.01 + value_505 * 0.01;
// Calculate: ((503.1 + 504.1) / 24 * 507) * 1% + 505.1 * 1%
let result = ((value_503_1 + value_504_1) / 24 * value_507) * 0.01 + value_505_1 * 0.01;
// Set value to field 509.2 (manatla in vergi_hesab_5ci)
(frm.doc.vergi_hesab_5ci || []).forEach(row => {