feat: the 8 mm between a ready sheet's copies stay on the film but are no longer billed (Marcus, 2026-12-03)
All checks were successful
Build and deploy / Validate source (push) Successful in 59s
Build and deploy / Integration suite on a real stack (push) Successful in 8m58s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m45s

Marcus on 26/11 had the gaps count in the billed metres; on 2026-12-03,
after customers of Lais and Kedma refused orders billed 10 and 20 cm more,
"por hora pode tirar a cobrança". A ready sheet is now billed on the sum of
its sheets and copies (pricing.billable_metres: the layout's height less
unbilled_gaps_cm, at most 8 mm between each two pieces); `metres` stays the
film laid out, which the print file, the parts and the folders follow, and
the print file's billed-length guard allows the gap film. Loose art keeps
its packing. The Site bills folhaCobradaM, the copies line reads
"5 × 45,9 cm = 229,3 cm" and the buy box explains that length. The Lais
case, 5 sheets of 100 cm, bills 5,00 m instead of 5,10 m.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-03 11:24:13 -03:00
parent 3b4f851fc2
commit 911892351f
10 changed files with 91 additions and 21 deletions

View File

@@ -414,6 +414,8 @@ function carrinho(){
layout=montagemLayout;
}
itemAtual={modo, tit:MODOS[modo].tit, nota, metros, cob, unit, extra, total:tot,
// What is billed: a ready sheet without its gaps (Marcus, 03/12/2026).
cobravel:ehFolha()?+folhaCobradaM().toFixed(4):metros,
localFiles:(ehFolha()?folhas:artes).map(x=>x.f),
mini:(ehFolha()?folhas:artes).map(x=>x.miniSrc).find(Boolean)||null,
fotos:(ehFolha()?folhas:artes).map(x=>x.fotoSrc||null),

View File

@@ -58,19 +58,21 @@
// 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 ready sheet is billed without the gaps between its copies (03/12/2026).
const base=it.cobravel??it.metros;
const sobraCm=Math.round((it.cob-base)*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);
const exata=n1(base*100)+' cm';
const aMais=Math.round((base-it.cob)*1000);
$('cObs').textContent =
it.cob===MINIMO_M && it.metros<MINIMO_M
it.cob===MINIMO_M && base<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
: it.cob<base-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
: it.cob>base+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.'
: '';

View File

@@ -132,11 +132,15 @@ let CLIENTE='SEU NOME AQUI', PEDIDO='000000';
let modo=null, artes=[], recemChegada=null, metros=0, nota=0, reencaixado=false;
let folhas=[]; // [{f, med, rep, m}] · o cliente pode subir várias
// Entre uma cópia e outra da folha pronta, e entre uma folha e outra, 8 mm de
// filme limpo para o recorte; entram na metragem cobrada (Marcus, 26/11/2026).
// filme limpo para o recorte (Marcus, 26/11/2026). Ficam na montagem, mas não
// são cobrados (Marcus, 03/12/2026: "por hora pode tirar a cobrança"): a
// metragem cobrada é a soma das folhas e cópias (app/core/pricing.py
// billable_metres).
const MARGEM_FOLHA_CM=0.8;
const folhaCobradaM=()=>folhas.reduce((t,x)=>t+(x.m||0)*(x.rep||1),0);
const folhaTotalM=()=>{
const copias=folhas.reduce((t,x)=>t+(x.m>0?(x.rep||1):0),0);
return folhas.reduce((t,x)=>t+(x.m||0)*(x.rep||1),0)+Math.max(0,copias-1)*MARGEM_FOLHA_CM/100;
return folhaCobradaM()+Math.max(0,copias-1)*MARGEM_FOLHA_CM/100;
};
// O cliente declara o que está mandando escolhendo o produto, em vez de o site
// adivinhar pelo formato do arquivo. A declaração de folha montada é conferida na
@@ -225,7 +229,8 @@ 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+arredonda10(+(f.alturaCm/100).toFixed(4)),0).toFixed(1));
const cobrarMontagem=()=>!ehFolha() && montagemFolhas ? cobrarFolhas(montagemFolhas) : cobrar(metros);
const cobrarMontagem=()=>ehFolha() ? cobrar(folhaCobradaM())
: montagemFolhas ? cobrarFolhas(montagemFolhas) : cobrar(metros);
const fmtM=m=>m.toFixed(2).replace('.',',');
const cls=n=>n>=85?'ok':n>=50?'av':'er';
const dpiDe=a=>a.cm>0? (a.giro?a.py:a.px)/(a.cm/2.54) : 0;

View File

@@ -276,7 +276,7 @@ function previaAoVivo(){
if(!ehFolha()) $('bAmpliar').hidden=true;
if(ehFolha()){
$('vUso').innerHTML='';
const tot=folhaTotalM();
const tot=folhaCobradaM();
$('vMt').textContent = tot>0 ? fmtM(cobrar(tot))+' m' : '—';
const medidas=folhas.filter(x=>x.med);
// Sheets still being read show a placeholder; a sheet printed N times is

View File

@@ -597,7 +597,7 @@ function pintaFolha(){
$('zona').classList.toggle('compacta', folhas.length>0);
if(!folhas.length){ $('lista').innerHTML=''; agendaAvaliacao(); previaAoVivo(); agendaEnvios(); return; }
const tot=folhaTotalM();
const tot=folhaCobradaM(); // the metres billed, without the gaps
$('lista').innerHTML = '<div class="listaCab"><h4>Seus arquivos</h4><span>'+
folhas.length+' folha'+(folhas.length>1?'s':'')+(tot>0? ' · '+fmtM(tot)+' m' : '')+'</span></div>'+
folhas.map((x,i)=>{
@@ -663,11 +663,10 @@ 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>'+
// 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").
// A conta como é cobrada: o comprimento exato do arquivo vezes as
// cópias; os 8 mm entre elas não entram (Marcus, 03/12/2026).
'<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>'
? x.rep+' × '+n1(x.m*100)+' cm = <b>'+n1(sub*100)+' cm</b>'
: '<b>'+n1(x.m*100)+' cm</b>')+'</div>' : '')+
'</div>' : '';
return '<div class="rep" data-folha="'+i+'">'+