/* Consultgenix agency-finance-scorecard v1: styles written during parse, page script after DOM ready */
document.write("\n");
(function(){function run(){
(function(){
/* Agency Finance Scorecard. Mechanics copied from /finance-function-scorecard. Results form: CGX - Agency Scorecard results. */
var FORM_ID = "XakZpBgBLeXNTuoiksQB";
var FORM_URL = "https://api.leadconnectorhq.com/widget/form/" + FORM_ID;
var CATS = {
comm: "Commission reconciliation",
trust: "Premium trust",
prod: "Producer pay",
close: "Close and reporting",
cash: "Cash and sale readiness"
};
var Q = [
{c:"comm", t:"When a carrier commission statement arrives, what happens to it?",
o:[["It is reconciled line by line to the deposit and the agency management system, the same month",3],["Someone checks the total matches the deposit",2],["The deposit is booked as revenue and the statement is filed",1],["Nobody looks at it closely",0]]},
{c:"comm", t:"Does your monthly P&L move with production or with bank timing?",
o:[["With production. Revenue follows the statements",3],["Mostly production, cleaned up at year end",2],["With bank timing. Revenue is whatever was deposited",1],["I could not say",0]]},
{c:"comm", t:"When a chargeback or return commission hits, where does it show up?",
o:[["Posted in the month, against the policy and the producer",3],["Posted when someone notices it",2],["Netted out of the next deposit without a separate entry",1],["We find them at year end, if at all",0]]},
{c:"trust", t:"Is premium you collect kept apart from operating cash?",
h:"If the agency is direct bill only and never holds premium, pick the first answer.",
o:[["Yes. A separate trust account, never used for operations",3],["Separate account, with occasional transfers we track",2],["Separate account, but operating cash borrows from it",1],["It sits in the same account as operating cash",0]]},
{c:"trust", t:"How often is the trust balance reconciled to what you owe carriers?",
h:"If the agency is direct bill only and never holds premium, pick the first answer.",
o:[["Monthly, with a written reconciliation",3],["Quarterly",2],["When the CPA asks",1],["Never",0]]},
{c:"trust", t:"If a carrier or an examiner asked today to see that trust funds cover premium owed, how long would it take you?",
h:"If the agency is direct bill only and never holds premium, pick the first answer.",
o:[["Same day",3],["A few days",2],["Weeks",1],["We could not show it",0]]},
{c:"prod", t:"How are producer commissions calculated?",
o:[["From the same carrier statements as revenue, and tied to the ledger",3],["From the agency management system, not tied to the ledger",2],["From a spreadsheet one person keeps",1],["Agreed case by case each month",0]]},
{c:"prod", t:"When a policy charges back, does the producer's payout reverse?",
o:[["Yes, under a written agreement, in the same month",3],["Yes, when someone remembers",2],["Rarely",1],["We have never clawed one back",0]]},
{c:"prod", t:"Do you know what each producer's book earns after their split and the cost of servicing it?",
o:[["Yes, by producer, every month",3],["Roughly, once a year",2],["We see revenue by producer, not profit",1],["No",0]]},
{c:"close", t:"How many business days after month end are your books final?",
o:[["Ten or fewer",3],["Eleven to twenty",2],["More than twenty",1],["They are only final at year end",0]]},
{c:"close", t:"Do the agency management system totals agree to QuickBooks each month?",
o:[["Yes, and any difference is explained in writing",3],["Close, with gaps we know about",2],["They disagree and we live with it",1],["We have never compared them",0]]},
{c:"close", t:"Can you see profit by line of business, for example personal lines, commercial and benefits?",
o:[["Yes, every month",3],["Once a year",2],["Revenue by line, not profit",1],["No",0]]},
{c:"cash", t:"How far ahead can you see the agency's own cash, after money owed to carriers?",
o:[["Thirteen weeks, updated weekly",3],["A month or two",2],["The bank balance less what we think we owe",1],["We look at the bank balance",0]]},
{c:"cash", t:"If a buyer or a bank asked tomorrow for three years of clean financials, could you hand them over?",
o:[["Yes, ready now",3],["After a few weeks of cleanup",2],["After months of cleanup",1],["No",0]]}
];
var TIERS = [
{min:34, name:"Clean", text:"The books are not your constraint. Use them: price producer contracts, plan hires and value the book on numbers you trust."},
{min:25, name:"Workable", text:"The basics hold, with gaps that cost hours each month and would cost more in a sale or a bank review. Close the gaps in order."},
{min:15, name:"Exposed", text:"The P&L and the trust position are not reliable enough to decide on. Sequence matters now. Fix the weakest area before anything else."},
{min:0, name:"At risk", text:"Revenue, trust money and producer pay cannot be tied to each other. Treat this as the priority, not a project for later."}
];
var FIX = {
comm: {
weak:"Reconcile every carrier commission statement to the deposit and to the agency management system each month, and post chargebacks in the month they happen. This one change makes the P&L follow production instead of bank timing.",
ok:"Commission reconciliation holds. Keep it documented by carrier so it survives staff turnover and a growing carrier list."
},
trust: {
weak:"Keep premium in its own account, stop operating cash borrowing from it, and reconcile the trust balance to premium owed every month in writing. Trust money is fiduciary money. It is the area with the least room for error.",
ok:"The trust position is under control. Keep the monthly reconciliation on file so you can produce it the day a carrier or examiner asks."
},
prod: {
weak:"Calculate producer pay from the same carrier statements as revenue, tie the total to the ledger, and put chargeback reversal in the written agreement. Then measure what each producer's book earns after split and servicing.",
ok:"Producer pay ties out. The next gain is profit by producer, so the next contract is priced on margin, not revenue."
},
close: {
weak:"Set a fixed close calendar with a target of day ten to twelve, and agree the agency management system to QuickBooks every month with differences explained in writing. A close you can predict is a close you can shorten.",
ok:"The close is in good shape. Add profit by line of business if you do not have it, since that is where pricing and hiring decisions start."
},
cash: {
weak:"Build a rolling thirteen week cash view of the agency's own money, with premium owed to carriers taken out first. Then start keeping the monthly package a buyer or bank would ask for, so year three is already done.",
ok:"Cash and records are in order. Keep three years of monthly packages on file. That is what shortens a sale or a bank review."
}
};
var order = Object.keys(CATS), MAX = {};
order.forEach(function(k){ MAX[k] = Q.filter(function(q){ return q.c === k; }).length * 3; });
var TOTAL = order.reduce(function(a,k){ return a + MAX[k]; }, 0);
var state = { i:0, a:new Array(Q.length).fill(null) };
function $(id){ return document.getElementById(id); }
function show(which){
["sc-hero","sc-quiz","sc-result"].forEach(function(id){
$(id).style.display = (id === which) ? "block" : "none";
});
}
function render(){
var q = Q[state.i];
$("sc-cat").textContent = CATS[q.c];
$("sc-qtext").textContent = q.t;
$("sc-help").textContent = q.h || "";
$("sc-count").textContent = (state.i + 1) + " / " + Q.length;
$("sc-fill").style.width = (state.i / Q.length * 100) + "%";
$("sc-prev").style.visibility = state.i === 0 ? "hidden" : "visible";
var box = $("sc-opts"); box.innerHTML = "";
q.o.forEach(function(pair, idx){
var li = document.createElement("li");
var b = document.createElement("button");
b.type = "button"; b.className = "sc-opt";
b.setAttribute("aria-pressed", state.a[state.i] === idx ? "true" : "false");
var dot = document.createElement("span"); dot.className = "dot";
var txt = document.createElement("span"); txt.textContent = pair[0];
b.appendChild(dot); b.appendChild(txt);
b.addEventListener("click", function(){ pick(idx); });
li.appendChild(b); box.appendChild(li);
});
}
function pick(idx){
state.a[state.i] = idx;
if (state.i < Q.length - 1){ state.i++; render(); scrollTop(); }
else finish();
}
function scrollTop(){
var el = $("sc-quiz");
if (el && el.scrollIntoView) el.scrollIntoView({behavior:"smooth", block:"start"});
}
function scores(){
var s = {}; order.forEach(function(k){ s[k] = 0; });
Q.forEach(function(q, i){ if (state.a[i] !== null) s[q.c] += q.o[state.a[i]][1]; });
return s;
}
function tierFor(p){ for (var i=0;i= TIERS[i].min) return TIERS[i]; } return TIERS[TIERS.length-1]; }
function barColour(pct){
if (pct >= 80) return "#1e8e5a";
if (pct >= 60) return "#0b5fa5";
if (pct >= 36) return "#c9a24a";
return "#c23b3b";
}
function dimRow(title, pts){
var row = document.createElement("div"); row.className = "sc-row";
var top = document.createElement("div"); top.className = "sc-rowtop";
var nm = document.createElement("span"); nm.className = "sc-name"; nm.textContent = title;
top.appendChild(nm);
if (pts){ var p = document.createElement("span"); p.className = "sc-pts"; p.textContent = pts; top.appendChild(p); }
row.appendChild(top);
return row;
}
function finish(){
var s = scores();
var total = order.reduce(function(a,k){ return a + s[k]; }, 0);
var t = tierFor(total);
$("sc-pts").textContent = total;
$("sc-tier").textContent = t.name;
$("sc-tiertext").textContent = t.text;
var box = $("sc-dims"); box.innerHTML = "";
order.forEach(function(k){
var pct = Math.round(s[k] / MAX[k] * 100);
var row = dimRow(CATS[k], s[k] + " / " + MAX[k] + " ยท " + pct + "%");
var bar = document.createElement("div"); bar.className = "sc-bar";
var i2 = document.createElement("i"); i2.style.width = pct + "%"; i2.style.background = barColour(pct);
bar.appendChild(i2); row.appendChild(bar); box.appendChild(row);
});
var ranked = order.slice().sort(function(a,b){ return (s[a]/MAX[a]) - (s[b]/MAX[b]); });
var fx = $("sc-fixes"); fx.innerHTML = "";
ranked.forEach(function(k, n){
var pct = s[k] / MAX[k] * 100;
var row = dimRow((n+1) + ". " + CATS[k], Math.round(pct) + "%");
var note = document.createElement("p"); note.className = "sc-note";
note.textContent = pct < 70 ? FIX[k].weak : FIX[k].ok;
row.appendChild(note); fx.appendChild(row);
});
mountForm(s, total, ranked);
show("sc-result");
$("sc-result").scrollIntoView({behavior:"smooth", block:"start"});
}
function mountForm(s, total, ranked){
var wrap = $("sc-form");
if (!wrap || wrap.getAttribute("data-mounted") === "1") return;
wrap.setAttribute("data-mounted", "1");
var p = {
cgx_scorecard_score: total + "/" + TOTAL + " (" + Math.round(total / TOTAL * 100) + "%)",
cgx_scorecard_tier: tierFor(total).name,
cgx_scorecard_weakest_area: CATS[ranked[0]],
cgx_scorecard_breakdown: order.map(function(k){ return CATS[k] + " " + s[k] + "/" + MAX[k]; }).join("; "),
cgx_source_page: "agency-finance-scorecard",
cgx_lead_magnet: "Agency Finance Scorecard"
};
var qs = Object.keys(p).map(function(k){ return encodeURIComponent(k) + "=" + encodeURIComponent(p[k]); }).join("&");
var f = document.createElement("iframe");
f.src = FORM_URL + "?" + qs;
f.id = "inline-" + FORM_ID;
f.title = "Send me the breakdown";
f.setAttribute("data-layout", '{"id":"INLINE"}');
f.setAttribute("data-trigger-type", "alwaysShow");
f.setAttribute("data-activation-type", "alwaysActivated");
f.setAttribute("data-deactivation-type", "neverDeactivate");
f.setAttribute("data-form-name", "CGX - Agency Scorecard results");
f.setAttribute("data-layout-iframe-id", "inline-" + FORM_ID);
f.setAttribute("data-form-id", FORM_ID);
wrap.appendChild(f);
if (!document.getElementById("ghl-embed-js")) {
var sc = document.createElement("script");
sc.id = "ghl-embed-js";
sc.src = "https://link.msgsndr.com/js/form_embed.js";
document.body.appendChild(sc);
}
}
$("sc-start").addEventListener("click", function(){
state.i = 0; render(); show("sc-quiz"); scrollTop();
});
$("sc-prev").addEventListener("click", function(){ if (state.i > 0){ state.i--; render(); } });
$("sc-restart").addEventListener("click", function(){
state = { i:0, a:new Array(Q.length).fill(null) };
var w = $("sc-form"); if (w){ w.innerHTML = ""; w.setAttribute("data-mounted", ""); }
render(); show("sc-quiz"); scrollTop();
});
})();
}
if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',run);}else{run();}})();