feat: billed every 10 cm with 8 mm in the customer's favour, and the Site shows the whole sum (Marcus, 2026-11-27)
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 8m42s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m10s
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 8m42s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m10s
Marcus: a length that passes a 10 cm step by up to 8 mm is billed at that
step; by more, at the next. One rule for every product, on the server
(pricing.billed_length), the Site (arredonda10) and the Montador's estimate;
the print file accepts the 8 mm past the billed length instead of sending
the sheet to hand preparation.
The Site showed four numbers that did not add up (0,88 m, 4,42 m, 4,45 m,
4,50 m), and the team read 4,40 m. The copies line now gives the whole
sum ("5 × 88,4 cm + 4 espaços de 8 mm = 445,2 cm"), and the buy box says
why the billed metres are what they are, as a benefit ("os 4 mm a mais
ficam por nossa conta"). The buy box's parts note said 20 m; parts are
10 m since 18/11.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,7 +154,8 @@ function montarQuoteFigures(lines){
|
||||
});
|
||||
const catalog=MONTAR.catalog?.avulsa;
|
||||
if(!catalog)throw new Error('Preço de tabela indisponível agora.');
|
||||
const billed=heights.map(metres=>Math.max(1,Math.ceil(metres*10)/10));
|
||||
// Every 10 cm, 8 mm in the customer's favour (app/core/pricing.py billed_length).
|
||||
const billed=heights.map(metres=>Math.max(1,Math.ceil(+((metres-0.008)*10).toFixed(6))/10));
|
||||
const total=+billed.reduce((sum,metres)=>sum+metres,0).toFixed(2);
|
||||
let unit=catalog.unit_cents,best=null;
|
||||
for(const band of catalog.bands||[]){
|
||||
|
||||
@@ -12,13 +12,24 @@
|
||||
$('cMetroLbl').textContent = it.extra ? 'Metro · com '+rs(it.extra)+' de arquivo manual' : 'Metro';
|
||||
$('cMetro').textContent=rs(it.unit);
|
||||
$('cMetragem').textContent=fmtM(it.cob)+' m';
|
||||
const partes=ehFolha(it.modo) ? Math.ceil(it.metros/20) : 1;
|
||||
$('cPartes').textContent = partes>1 ? ' Sai em '+partes+' partes de até 20 m.' : '';
|
||||
// Partes de até 10 m (Marcus, 18/11/2026): o FlexiPRINT não abre mais que isso.
|
||||
const partes=ehFolha(it.modo) ? Math.ceil(it.metros/10) : 1;
|
||||
$('cPartes').textContent = partes>1 ? ' Sai em '+partes+' partes de até 10 m.' : '';
|
||||
const sobraCm=Math.round((it.cob-it.metros)*100);
|
||||
// A metragem cobrada explicada como vantagem (Marcus, 27/11/2026): a cada
|
||||
// 10 cm, e até 8 mm a mais ficam por nossa conta.
|
||||
const exata=n1(it.metros*100)+' cm';
|
||||
const aMais=Math.round((it.metros-it.cob)*1000);
|
||||
$('cObs').textContent =
|
||||
it.cob===MINIMO_M && it.metros<MINIMO_M
|
||||
? (ehFolha(it.modo) ? 'Pedido mínimo de 1 m.'
|
||||
: 'Pedido mínimo de 1 m: ainda cabem '+sobraCm+' cm de artes sem custo.')
|
||||
: it.cob<it.metros-1e-6
|
||||
? 'A folha tem '+exata+': cobramos a cada 10 cm e '+
|
||||
(aMais>1?'os '+aMais+' mm a mais ficam':aMais===1?'o 1 mm a mais fica':'o que passou fica')+' por nossa conta.'
|
||||
: it.cob>it.metros+1e-6
|
||||
? 'A folha tem '+exata+'. Cobramos a cada 10 cm, então fica '+fmtM(it.cob)+' m. '+
|
||||
'Se passar até 8 mm de uma faixa, esse pedaço fica por nossa conta.'
|
||||
: '';
|
||||
$('cTotal').textContent=rs(it.total);
|
||||
}
|
||||
|
||||
@@ -206,11 +206,16 @@ function faltaLeitura(l){
|
||||
return s<10 ? 'faltam '+Math.max(1,Math.ceil(s))+' s' : s<60 ? 'faltam cerca de '+Math.ceil(s/5)*5+' s' : 'faltam cerca de '+duracao(s);
|
||||
}
|
||||
const larguraFilme=()=>MODOS[modo].larg;
|
||||
// cobrança proporcional: arredonda para cima em 10 cm · 2,75 m vira 2,80 m
|
||||
const cobrar=m=>Math.max(MINIMO_M, Math.ceil(m*10)/10);
|
||||
// Cobrança a cada 10 cm, com 8 mm a favor do cliente (Marcus, 27/11/2026):
|
||||
// passou até 8 mm de um múltiplo de 10 cm, fica nele; passou mais, vai para o
|
||||
// próximo. 2,75 m vira 2,80 m; 6,005 m fica 6,00 m. A mesma regra do servidor
|
||||
// (app/core/pricing.py billed_length).
|
||||
const TOLERANCIA_M=0.008;
|
||||
const arredonda10=m=>Math.max(0.1, Math.ceil(+((m-TOLERANCIA_M)*10).toFixed(6))/10);
|
||||
const cobrar=m=>Math.max(MINIMO_M, arredonda10(m));
|
||||
// Com as artes em folhas separadas por traço (item 17), cada folha arredonda
|
||||
// a 10 cm e o mínimo de 1 m vale para a soma: o cliente não escolheu separar.
|
||||
const cobrarFolhas=fs=>Math.max(MINIMO_M, +fs.reduce((t,f)=>t+Math.ceil(+(f.alturaCm/100).toFixed(4)*10)/10,0).toFixed(1));
|
||||
const cobrarFolhas=fs=>Math.max(MINIMO_M, +fs.reduce((t,f)=>t+arredonda10(+(f.alturaCm/100).toFixed(4)),0).toFixed(1));
|
||||
const cobrarMontagem=()=>!ehFolha() && montagemFolhas ? cobrarFolhas(montagemFolhas) : cobrar(metros);
|
||||
const fmtM=m=>m.toFixed(2).replace('.',',');
|
||||
const cls=n=>n>=85?'ok':n>=50?'av':'er';
|
||||
|
||||
@@ -257,7 +257,7 @@ function montaFolhasDeTraco(grupos,W){
|
||||
figura.append(legenda,desenho); painel.append(figura);
|
||||
desenhaMontagem(desenho, lista, 0, W, uso, r=>{
|
||||
if(area.montagemVersao!==versao) return; // a montagem mudou nesse meio-tempo
|
||||
legenda.textContent='Folha '+(i+1)+' · '+NOMES_TRACO[i]+' · '+fmtM(Math.ceil(+(r.alturaCm/100).toFixed(4)*10)/10)+' m';
|
||||
legenda.textContent='Folha '+(i+1)+' · '+NOMES_TRACO[i]+' · '+fmtM(arredonda10(+(r.alturaCm/100).toFixed(4)))+' m';
|
||||
feitas[i]={nome:NOMES_TRACO[i], artes:lista, alturaCm:r.alturaCm, folgaCm:r.folgaCm ?? MARGEM_CM,
|
||||
layout:r.placements ? {height_cm:+r.alturaCm.toFixed(4), placements:r.placements} : null};
|
||||
if(feitas.filter(Boolean).length<grupos.length) return;
|
||||
|
||||
@@ -620,7 +620,12 @@ function pintaFolha(){
|
||||
'<span class="passo"><button type="button" data-passo="-1" data-i="'+i+'" aria-label="Menos uma cópia">−</button>'+
|
||||
'<input type="number" id="repf'+i+'" min="1" max="200" data-repf="'+i+'" value="'+x.rep+'">'+
|
||||
'<button type="button" data-passo="1" data-i="'+i+'" aria-label="Mais uma cópia">+</button></span></div>'+
|
||||
'<div class="conta">'+(x.rep>1? x.rep+' × '+fmtM(x.m)+' m = ' : '')+'<b>'+fmtM(sub)+' m</b></div>' : '')+
|
||||
// A conta inteira, como é cobrada: o comprimento exato do arquivo e os
|
||||
// 8 mm entre as cópias (Marcus, 27/11/2026: "falta explicar melhor").
|
||||
'<div class="conta">'+(x.rep>1
|
||||
? x.rep+' × '+n1(x.m*100)+' cm + '+(x.rep-1)+(x.rep>2?' espaços':' espaço')+' de 8 mm = <b>'+
|
||||
n1(sub*100+(x.rep-1)*MARGEM_FOLHA_CM)+' cm</b>'
|
||||
: '<b>'+n1(x.m*100)+' cm</b>')+'</div>' : '')+
|
||||
'</div>' : '';
|
||||
return '<div class="rep" data-folha="'+i+'">'+
|
||||
'<div class="repTopo"><div class="miniF">'+mini+'</div><div class="repInfo">'+
|
||||
|
||||
Reference in New Issue
Block a user