PageSourceSearch

https://elementarylending.com/modules/module572/calculators/js/seller_net_sheet.js?ver=1749444448

js elementarylending.com collected 2026-09-29 17:58:07 UTC 23,608 bytes, 665 lines download raw bytes

1window.calculatorHandlers = window.calculatorHandlers || {};
2window.calculatorOutputs = window.calculatorOutputs || {};
3
4window.calculatorHandlers.seller_net_sheet = function ($form, $container, response) {
5  function show_error(text) {
6    let errorContainer = $container.find(".out-error-message");
7    let resultsContainer = $container.find(".wwd-calculator-results");
8
9    if (text === "") {
10      resultsContainer.show();
11      errorContainer.hide();
12    } else {
13      resultsContainer.hide();
14      errorContainer.text(text).show();
15    }
16  }
17
18  var inputs = {};
19
20  inputs.closingLocation = $form.find("#closing_location").val();
21
22  // Basic inputs
23  inputs.salesPrice = parseFloat($form.find("#sales_price").val().replace(/,/g, ""));
24  inputs.closingDate = $form.find("#closing_date").val();
25
26  // Property Tax
27  // inputs.propertyTaxAmount = parseFloat($form.find("#property_tax_amount").val().replace(/,/g, ""));
28  inputs.includeEstimatedPropertyTax = $form.find("#include_estimated_property_tax").is(":checked");
29  inputs.propertyTaxPercentage = $form.find("#property_tax_percentage").length ? parseFloat($form.find("#property_tax_percentage").val().replace(/,/g, "")) / 100 : 0;
30
31  // Commission inputs
32  inputs.listingSalesCommissionAmount = parseFloat($form.find("#listing_sales_commission_amount").val().replace(/,/g, ""));
33  inputs.listingSalesCommissionPercentage = parseFloat($form.find("#listing_sales_commission_percentage").val().replace(/,/g, "")) / 100;
34  inputs.buyersSalesCommissionAmount = parseFloat($form.find("#buyers_sales_commission_amount").val().replace(/,/g, ""));
35  inputs.buyersSalesCommissionPercentage = parseFloat($form.find("#buyers_sales_commission_percentage").val().replace(/,/g, "")) / 100;
36
37  // Loan Payoff inputs
38  // inputs.includeLoanPayoff = $form.find("#include_loan_payoff").is(":checked");
39  inputs.includeLoanPayoff = true;
40  inputs.payoffBalance = parseFloat($form.find("#payoff_balance").val().replace(/,/g, ""));
41
42  // Additional loans
43  inputs.includeAdditionalLoans = $form.find("#include_additional_loans").is(":checked");
44  inputs.additionalPayoffBalance = parseFloat($form.find("#additional_payoff_balance").val().replace(/,/g, ""));
45
46  // HOA inputs
47  inputs.includeHOA = $form.find("#include_hoa").is(":checked");
48  inputs.hoaDuesFrequency = $form.find("#hoa_dues_frequency").val();
49  inputs.hoaDues = parseFloat($form.find("#hoa_dues").val().replace(/,/g, ""));
50  inputs.hoaResaleCertificate = parseFloat($form.find("#hoa_resale_certificate").val().replace(/,/g, ""));
51  inputs.hoaTransferFee = parseFloat($form.find("#hoa_transfer_fee").val().replace(/,/g, ""));
52
53  // Service Warranty inputs
54  inputs.includeSellerWarranty = $form.find("#include_seller_warranty").is(":checked");
55  inputs.warrantyCost = parseFloat($form.find("#warranty_cost").val().replace(/,/g, ""));
56
57  // Title and Settlement Fee inputs
58  inputs.changeTitleAndSettlementCharge = $form.find("#change_title_settlement").is(":checked");
59  inputs.titleAndSettlementCharge = parseFloat($form.find("#title_settlement_charge").val().replace(/,/g, ""));
60
61  // Repair inputs
62  inputs.includeSellerRepairs = $form.find("#include_seller_repairs").is(":checked");
63  inputs.repairCost = parseFloat($form.find("#repair_cost").val().replace(/,/g, ""));
64
65  // Buyer Points inputs
66  inputs.includeBuyerPoints = false;
67
68  generateSellerNetSheet(inputs);
69
70  function generateSellerNetSheet(inputs) {
71    // Helper functions
72    function getDaysInYear(dateString) {
73      const year = new Date(dateString).getFullYear();
74      return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 ? 366 
74: 365;
75    }
76
77    function getDaysInYearBeforeDate(dateString) {
78      const currentDate = new Date(dateString);
79      const startOfYear = new Date(currentDate.getFullYear(), 0, 1);
80      return Math.floor((currentDate - startOfYear) / (1000 * 60 * 60 * 24)) + 1;
81    }
82
83    function getDaysInPeriod(date, frequency) {
84      const currentDate = new Date(date);
85      const year = currentDate.getFullYear();
86      const month = currentDate.getMonth();
87
88      switch (frequency) {
89        case "monthly":
90          return new Date(year, month + 1, 0).getDate();
91        case "quarterly":
92          const quarterStartMonth = Math.floor(month / 3) * 3;
93          const quarterStart = new Date(year, quarterStartMonth, 1);
94          const quarterEnd = new Date(year, quarterStartMonth + 3, 0);
95          return Math.floor((quarterEnd - quarterStart) / (1000 * 60 * 60 * 24)) + 1;
96        case "annually":
97          return getDaysInYear(date);
98        default:
99          return 0;
100      }
101    }
102
103    function calculateProratedHOADues() {
104      console.log(inputs);
105      if (!inputs.includeHOA || !inputs.closingDate || !inputs.hoaDues || !inputs.hoaDuesFrequency) {
106        return 0;
107      }
108
109      const closingDate = new Date(inputs.closingDate);
110      const daysInPeriod = getDaysInPeriod(closingDate, inputs.hoaDuesFrequency);
111      console.log(daysInPeriod);
112      const perDay = inputs.hoaDues / daysInPeriod;
113
114      // Calculate remaining days based on frequency
115      const yearEnd = new Date(closingDate.getFullYear() + 1, 0, 0);
116      const quarterEnd = new Date(closingDate.getFullYear(), Math.ceil((closingDate.getMonth() + 1) / 3) * 3, 0);
117      const monthEnd = new Date(closingDate.getFullYear(), closingDate.getMonth() + 1, 0);
118
119      let daysRemaining;
120      switch (inputs.hoaDuesFrequency) {
121        case "monthly":
122          daysRemaining = Math.floor((monthEnd - closingDate) / (1000 * 60 * 60 * 24));
123          break;
124        case "quarterly":
125          daysRemaining = Math.floor((quarterEnd - closingDate) / (1000 * 60 * 60 * 24));
126          break;
127        case "annually":
128          daysRemaining = Math.floor((yearEnd - closingDate) / (1000 * 60 * 60 * 24));
129          break;
130        default:
131          daysRemaining = 0;
132      }
133
134      return perDay * daysRemaining;
135    }
136
137    // Calculate main values
138    var daysInYear = getDaysInYear(inputs.closingDate);
139    var daysInYearToClose = getDaysInYearBeforeDate(inputs.closingDate);
140    var proratedHOADues = calculateProratedHOADues();
141
142    var proratedPropertyTax = 0;
143    if (inputs.includeEstimatedPropertyTax && inputs.propertyTaxPercentage > 0 && inputs.salesPrice > 0 && inputs.closingDate) {
144      var dailyTaxRate = (inputs.salesPrice * inputs.propertyTaxPercentage) / daysInYear;
145      proratedPropertyTax = dailyTaxRate * daysInYearToClose;
146    }
147
148    // console.log("Days in year: ", daysInYear);
149    // console.log("Days in year to close: ", daysInYearToClose);
150
151    function getTitlePolicyCost(salesPrice, otpPayer, state) {
152      // If buyer is paying, return 0
153      if (otpPayer !== "seller") {
154        return 0;
155      }
156
157      // Title insurance rates as percentage of $400,000
158      const titleRates = {
159        AL: 0.00344,
160        AK: 0.00519,
161        AZ: 0.00743,
162        AR: 0.00246,
163        CA: 0.00537,
164        CO: 0.00635,
165        CT: 0.00433,
166        DE: 0.00414,
167        FL: 0.00525,
168        GA: 0.00565,
169        HI: 0.00521,
170        ID: 0.00466,
171        IL: 0.00759,
172        IN: 0.00275,
173        IA: 0,
174        KS: 0.00262,
175        KY: 0.00406,
176        LA: 0.00499,
177        ME: 0.00343,
178        MD: 0.0065,
179        MA: 0.00444,
180        MI: 0.00768,
181        MN: 0.0035,
182        MS: 0.00768,
183        MO: 0.00094,
184        MT: 0.00403,
185        NE: 0.00358,
186        NV: 0.00598,
187        NH: 0.003,
188        NJ: 0.00456,
189        NM: 0.00517,
190        NY: 0.00524,
191        NC: 0.00219,
192        ND: 0.00256,
193        OH: 0.00484,
194        OK: 0.0032,
195        OR: 0.00387,
196        PA: 0.00684,
197        RI: 0.00363,
198        SC: 0.00313,
199        SD: 0.00288,
200        TN: 0.0065,
201        TX: 0.00628,
202        UT: 0.00774,
203        VT: 0.00356,
204        VA: 0.00533,
205        WA: 0.00466,
206        DC: 0.00682,
207        WV: 0.00378,
208        WI: 0.00543,
209        WY: 0.00474,
210      };
211
212      // Title fees
213      const titleFees = {
214        AL: 0,
215        AK: 1045,
216        AZ: 1635,
217        AR: 0,
218        CA: 3158,
219        CO: 310,
220        CT: 1000,
221        DE: 0,
222        FL: 958,
223        GA: 0,
224        HI: 0,
225        ID: 1545,
226        IL: 3136,
227        IN: 945,
228        IA: 0,
229        KS: 325,
230        KY: 910,
231        LA: 1250,
232        ME: 695,
233        MD: 1845,
234        MA: 1225,
235        MI: 1035,
236        MN: 1390,
237        MS: 775,
238        MO: 685,
239        MT: 1550,
240        NE: 494,
241        NV: 1980,
242        NH: 1020,
243        NJ: 1170,
244        NM: 1181,
245        NY: 0,
246        NC: 0,
247        ND: 0,
248        OH: 1125,
249        OK: 1606,
250        OR: 1960,
251        PA: 1205,
252        RI: 1025,
253        SC: 600,
254        SD: 531,
255        TN: 1235,
256        TX: 1181,
257        UT: 750,
258        VT: 600,
259        VA: 1290,
260        WA: 2823,
261        DC: 1800,
262        WV: 0,
263        WI: 260,
264        WY: 0,
265      };
266
267      // Get rates for the given state
268      const insuranceRate = titleRates[state] || 0;
269      const feeRate = titleFees[state] || 0;
270
271      // Calculate total cost
272      // const totalCost = salesPrice * feeRate;
273      const totalCost = feeRate;
274
275      return Math.round(totalCost);
276    }
277
278    function getTransferTax(salesPrice, state) {
279      // Transfer tax rates as percentage of sales price
280      const transferTaxRates = {
281        AL: 0.001, // 0.1%
282        AK: 0, // No transfer tax
283        AZ: 0.00002, // Flat $2 fee
284        AR: 0.0033, // 0.33%
285        CA: 0.0011, // 0.11%
286        CO: 0.0001, // 0.01%
287        CT: 0.0075, // 0.75% (using lower end of 0.75%-1.25%)
288        DE: 0.04, // 4%
289        FL: 0.006, // 0.6% (using lower end of 0.6%-0.7%)
290        GA: 0.001, // 0.1%
291        HI: 0.001, // 0.1% (using lower end of 0.1%-1.25%)
292        ID: 0, // No transfer tax
293        IL: 0.001, // 0.1% (using lower end of 0.1%-0.45%)
294        IN: 0, // No transfer tax
295        IA: 0.0016, // 0.16%
296        KS: 0, // No transfer tax
297        KY: 0.001, // 0.1%
298        LA: 0, // No transfer tax
299        ME: 0.0044, // 0.44%
300        MD: 0.0025, // 0.25% (using lower end of 0.25%-5%)
301        MA: 0.0046, // 0.46%
302        MI: 0.0075, // 0.75%
303        MN: 0.0033, // 0.33%
304        MS: 0, // No transfer tax
305        MO: 0, // No transfer tax
306        MT: 0, // No transfer tax
307        NE: 0.0023, // 0.23%
308        NV: 0.0039, // 0.39%
309        NH: 0.015, // 1.5%
310        NJ: 0.004, // 0.4% (using lower end of 0.4%-1.21%)
311        NM: 0, // No transfer tax
312        NY: 0.004, // 0.4% (using lower end of 0.4%-1.4%)
313        NC: 0.002, // 0.2%
314        ND: 0, // No transfer tax
315        OH: 0.001, // 0.1%
316        OK: 0.0015, // 0.15%
317        OR: 0.001, // 0.1%
318        PA: 0.01, // 1%
319        RI: 0.0046, // 0.46%
320        SC: 0.0037, // 0.37%
321        SD: 0.001, // 0.1%
322        TN: 0.0037, // 0.37%
323        TX: 0, // No transfer tax
324        UT: 0, // No transfer tax
325        VT: 0.005, // 0.5% for first 100k, using simpler rate
326        VA: 0.0035, // 0.35%
327        WA: 0.011, // 1.1% (using lower end of 1.1%-3%)
328        DC: 0.00725, // 0.725% (using lower end of 0.725%-1.45%)
329        WV: 0.0011, // 0.11%
330        WI: 0.003, // 0.3%
331        WY: 0, // No transfer tax
332      };
333
334      // Get rate for the given state
335      const transferTaxRate = transferTaxRates[state] || 0;
336
337      // Calculate total cost
338      const totalCost = salesPrice * transferTaxRate;
339
340      return Math.round(totalCost);
341    }
342
343    function updateText(selector, value) {
344      $container.find(selector).text(value);
345    }
346
347    /**
348     * Calculate the different sections
349     * 1. Total Loan Payoffs
350     * 2. Total Taxes
351     * 3. Total HOA
352     * 4. Total Title
353     * 5. Total Lender
354     * 6. Other Closing Costs
355     * 7. Net Proceeds
356     */
357
358    // 1. Total Loan Payoffs
359    let totalLoanPayoffs = inputs.includeLoanPayoff ? inputs.payoffBalance : 0;
360    totalLoanPayoffs += inputs.includeAdditionalLoans && inputs.includeLoanPayoff ? inputs.additionalPayoffBalance : 0;
361
362    const recordationTaxes = (inputs.salesPrice * 0.002) / 2;
363
364    // 2. Total Taxes/HOA
365    const totalHOAFees = inputs.hoaResaleCertificate + inputs.hoaTransferFee;
366    const totalHOA = inputs.includeHOA ? proratedHOADues + totalHOAFees : 0;
367
368    // 3. Total Taxes - removed from calculation
369    // const proratedPropertyTax = (inputs.propertyTaxAmount / daysInYear) * daysInYearToClose;
370    // const totalTaxes = proratedPropertyTax;
371    var transferTax = getTransferTax(inputs.salesPrice, inputs.closingLocation);
372    var totalTaxes = transferTax + proratedPropertyTax;
373
374    // 4. Total Title
375    // ownersTitlePolicy, escrowFee, recordingFee, deletionFee, taxCertificate
376    const ownersTitlePolicy = getTitlePolicyCost(inputs.salesPrice, "seller", inputs.closingLocation);
377    const totalTitle = inputs.changeTitleAndSettlementCharge ? inputs.titleAndSettlementCharge : ownersTitlePolicy;
378
379    // 4. Total Lender
380    const discountPoints = 0;
381    const totalLender = 0;
382
383    // 5. Other Closing Costs
384    // listingSalesCommission, buyersSalesCommission, warrantyCost, repairCost
385    const listingSalesCommission = inputs.listingSalesCommissionAmount;
386    const buyersSalesCommission = inputs.buyersSalesCommissionAmount;
387    const warrantyCost = inputs.includeSellerWarranty ? inputs.warrantyCost : 0;
388    const repairCost = inputs.includeSellerRepairs ? inputs.repairCost : 0;
389
390    const otherClosingCosts = listingSalesCommission + buyersSalesCommission + warrantyCost + repairCost;
391
392    // 6. Net Proceeds
393    const grossProceeds = inputs.salesPrice - totalLoanPayoffs;
394
395    // Total Closing Costs
396    var totalClosingCostsTraditional = recordationTaxes + totalHOA + totalTaxes + totalTitle + totalLender + otherClosingCosts;
397
398    // Net Proceeds after fees
399    const netProceedsTraditional = grossProceeds - totalClosingCostsTraditional;
400
401    // Results
402
403    updateText(".out-sales-price", wwd_moneyFormat(inputs.salesPrice, 0));
404
405    // Update loan payoffs section
406    if (inputs.includeLoanPayoff) {
407      updateText(".out-loan-payoff", wwd_moneyFormat(inputs.payoffBalance, 0));
408      if (inputs.includeAdditionalLoans) {
409        updateText(".out-second-lien-payoff", wwd_moneyFormat(inputs.additionalPayoffBalance, 0));
410      } else {
411        updateText(".out-second-lien-payoff", "0");
412      }
413      $container.find(".loan-payoffs-wrapper").each(function () {
414        $(this).show();
415      });
416    } else {
417      $container.find(".loan-payoffs-wrapper").each(function () {
418        $(this).hide();
419      });
420    }
421
422    if (inputs.includeAdditionalLoans) {
423      $container.find(".additional-loans-wrapper").each(function () {
424        $(this).show();
425      });
426    } else {
427      $container.find(".additional-loans-wrapper").each(function () {
428        $(this).hide();
429      });
430    }
431
432    if (inputs.includeHOA) {
433      $container.find(".hoa-fees-wrapper").each(function () {
434        $(this).show();
435      });
436    } else {
437      $container.find(".hoa-fees-wrapper").each(function () {
438        $(this).hide();
439      });
440    }
441
442    if (inputs.includeAdditionalLoans || inputs.includeHOA) {
443      $container.find(".additional-seperator").each(function () {
444        $(this).show();
445      });
446    } else {
447      $container.find(".additional-seperator").each(function () {
448        $(this).hide();
449      });
450    }
451
452    if (inputs.includeSellerWarranty) {
453      $container.find(".service-warranty-wrapper").each(function () {
454        $(this).show();
455      });
456    } else {
457      $container.find(".service-warranty-wrapper").each(function () {
458        $(this).hide();
459      });
460    }
461
462    if (inputs.includeSellerRepairs) {
463      $container.find(".repair-costs-wrapper").each(function () {
464        $(this).show();
465      });
466    } else {
467      $container.find(".repair-costs-wrapper").each(function () {
468        $(this).hide();
469      });
470    }
471
472    if (inputs.includeBuyerPoints) {
473      $container.find(".discount-points-wrapper").each(function () {
474        $(this).show();
475      });
476    } else {
477      $container.find(".discount-points-wrapper").each(function () {
478        $(this).hide();
479      });
480    }
481
482    // Show/hide property tax row
483    if (inputs.includeEstimatedPropertyTax) {
484      $container.find(".property-tax-wrapper").show();
485    } else {
486      $container.find(".property-tax-wrapper").hide();
487    }
488    updateText(".out-prorated-property-tax", wwd_moneyFormat(proratedPropertyTax, 0));
489
490    // update the summary section
491    updateText(".out-total-loan-payoffs", wwd_moneyFormat(totalLoanPayoffs, 0));
492    updateText(".out-title-settlement-fees", wwd_moneyFormat(totalTitle, 0));
493    updateText(".out-recordation-taxes", wwd_moneyFormat(recordationTaxes, 0));
494    updateText(".out-transfer-tax", wwd_moneyFormat(transferTax, 0));
495    // updateText(".out-prorated-taxes", wwd_moneyFormat(proratedPropertyTax, 0));
496    updateText(".out-hoa-fees-total", wwd_moneyFormat(totalHOA, 0));
497    updateText(".out-discount-points", wwd_moneyFormat(discountPoints, 0));
498    updateText(".out-listing-commission", wwd_moneyFormat(listingSalesCommission, 0));
499    updateText(".out-buyers-commission", wwd_moneyFormat(buyersSalesCommission, 0));
500    updateText(".out-total-closing-cost-traditional", wwd_moneyFormat(totalClosingCostsTraditional, 0));
501    if (netProceedsTraditional >= 0) {
502      updateText(".out-net-proceeds-traditional", "$" + wwd_moneyFormat(netProceedsTraditional, 0));
503    } else {
504      updateText(".out-net-proceeds-traditional", "- $" + wwd_moneyFormat(netProceedsTraditional, 0));
505    }
506
507    // Update HOA section
508    updateText(".out-prorated-hoa-dues", wwd_moneyFormat(proratedHOADues, 0));
509    updateText(".out-hoa-resale-cert", wwd_moneyFormat(inputs.hoaResaleCertificate, 0));
510    updateText(".out-hoa-transfer-fee", wwd_moneyFormat(inputs.hoaTransferFee, 0));
511    updateText(".out-total-hoa", wwd_moneyFormat(totalHOA, 0));
512
513    // Update lender section
514    updateText(".out-discount-points", wwd_moneyFormat(discountPoints, 0));
515
516    // Update other closing costs section
517    updateText(".out-service-warranty", wwd_moneyFormat(warrantyCost, 0));
518    updateText(".out-repair-costs", wwd_moneyFormat(repairCost, 0));
519  }
520
521  function updateUI(result, mortgageResults, inputs) {
522    console.log(result);
523
524    // Helper function to update text content
525    function updateText(selector, value) {
526      $container.find(selector).text(value);
527    }
528
529    // Helper function to show/hide elements
530    function toggleVisibility(selector, isVisible) {
531      $container.find(selector).toggle(isVisible);
532    }
533
534    // Summary
535    updateText("#out-lender-costs", wwd_moneyFormat(result.totalEstimatedLenderFees, 0));
536  }
537};
538
539function initSellerNetSheetCalculator() {
540  var hasCalculator = jQuery(".wwd-calculator-form[data-type='seller_net_sheet']").length > 0;
541  if (!hasCalculator) {
542    return;
543  }
544
545  jQuery(".wwd-calculator-wrapper.seller_net_sheet-calculator").each(function () {
546    function updateListingSalesCommissionAmount() {
547      var salesPrice = parseFloat($("#sales_price").val().replace(/,/g, "")) || 0;
548      var percentage = parseFloat($("#listing_sales_commission_percentage").val()) || 0;
549      var amount = salesPrice * (percentage / 100);
550      $("#listing_sales_commission_amount").val(wwd_moneyFormat(amount, 0));
551      window.wwd_submitForms("seller_net_sheet");
552    }
553
554    function updateBuyersSalesCommissionAmount() {
555      var salesPrice = parseFloat($("#sales_price").val().replace(/,/g, "")) || 0;
556      var percentage = parseFloat($("#buyers_sales_commission_percentage").val()) || 0;
557      var amount = salesPrice * (percentage / 100);
558      $("#buyers_sales_commission_amount").val(wwd_moneyFormat(amount, 0));
559      window.wwd_submitForms("seller_net_sheet");
560    }
561
562    function updatePropertyTaxAmount() {
563      var salesPrice = parseFloat($("#sales_price").val().replace(/,/g, "")) || 0;
564      var percentage = parseFloat($("#property_tax_percentage").val()) || 0;
565      var amount = salesPrice * (percentage / 100);
566      $("#property_tax_amount").val(wwd_moneyFormat(amount, 0));
567      window.wwd_submitForms("seller_net_sheet");
568    }
569
570    jQuery(document).ready(function ($) {
571      // Initial calculation
572      updateBuyersSalesCommissionAmount();
573      updateListingSalesCommissionAmount();
574      updatePropertyTaxAmount();
575
576      // Update when sales price changes
577      $("#sales_price").on("input change keyup", function () {
578        updateBuyersSalesCommissionAmount();
579        updateListingSalesCommissionAmount();
580        updatePropertyTaxAmount();
581      });
582
583      // Update when listing commission percentage changes
584      $("#listing_sales_commission_percentage").on("input change keyup", function () {
585        updateListingSalesCommissionAmount();
586      });
587
588      // Update when buyers commission percentage changes
589      $("#buyers_sales_commission_percentage").on("input change keyup", function () {
590        updateBuyersSalesCommissionAmount();
591      });
592
593      // Update when property tax percentage changes
594      $("#property_tax_percentage").on("input change keyup", function () {
595        updatePropertyTaxAmount();
596      });
597    });
598
599    jQuery(document).ready(function ($) {
600      // Initial calculation
601      updateBuyersSalesCommissionAmount();
602      updateListingSalesCommissionAmount();
603      updatePropertyTaxAmount();
604
605      // Update when s
605ales price changes
606      $("#sales_price").on("input change keyup", function () {
607        updateBuyersSalesCommissionAmount();
608        updateListingSalesCommissionAmount();
609        updatePropertyTaxAmount();
610      });
611
612      // Update when listing commission percentage changes
613      $("#listing_sales_commission_percentage").on("input change keyup", function () {
614        updateListingSalesCommissionAmount();
615      });
616
617      // Update when buyers commission percentage changes
618      $("#buyers_sales_commission_percentage").on("input change keyup", function () {
619        updateBuyersSalesCommissionAmount();
620      });
621
622      // Update when property tax percentage changes
623      $("#property_tax_percentage").on("input change keyup", function () {
624        updatePropertyTaxAmount();
625      });
626
627      // Update when listing commission amount changes
628      $("#listing_sales_commission_amount").on("input change keyup", function () {
629        updateListingSalesCommissionAmount();
630      });
631
632      // Update when buyers commission amount changes
633      $("#buyers_sales_commission_amount").on("input change keyup", function () {
634        updateBuyersSalesCommissionAmount();
635      });
636    });
637
638    function updateListingSalesCommissionPercentage() {
639      var salesPrice = parseFloat($("#sales_price").val().replace(/,/g, "")) || 0;
640      var amount = parseFloat($("#listing_sales_commission_amount").val().replace(/,/g, "")) || 0;
641      var percentage = (amount / salesPrice) * 100;
642      $("#listing_sales_commission_percentage").val(percentage.toFixed(3));
643      window.wwd_submitForms("seller_net_sheet");
644    }
645
646    function updateBuyersSalesCommissionPercentage() {
647      var salesPrice = parseFloat($("#sales_price").val().replace(/,/g, "")) || 0;
648      var amount = parseFloat($("#buyers_sales_commission_amount").val().replace(/,/g, "")) || 0;
649      var percentage = (amount / salesPrice) * 100;
650      $("#buyers_sales_commission_percentage").val(percentage.toFixed(3));
651      window.wwd_submitForms("seller_net_sheet");
652    }
653  });
654
655  window.addEventListener("load", function () {
656    window.wwd_submitForms("seller_net_sheet");
657  });
658
659  // Example: If you have tabs or other UI elements that might re-trigger calculations:
660  // window.addEventListener("wwdTabSwitch", function() {
661  //   setTimeout(function() { window.wwd_submitForms("seller_net_sheet"); }, 100);
662  // });
663}
664
665initSellerNetSheetCalculator();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.