{n:"Llave golpe 2-7/16",c:1,e:"OK",k:1},{n:"Llave golpe 2-1/2",c:1,e:"OK",k:1},{n:"Llave golpe 2-3/16",c:1,e:"OK",k:1},{n:"Llave golpe 30mm",c:1,e:"OK",k:1},{n:"Llave golpe 41mm",c:1,e:"OK",k:1},{n:"Llave golpe 45mm",c:1,e:"OK",k:1},{n:"Llave golpe 52mm",c:1,e:"OK",k:1},{n:"Llave golpe 55mm",c:1,e:"OK",k:1},{n:"Llave golpe 65mm",c:1,e:"OK",k:1},{n:"Llave tubo 12",c:1,e:"OK",k:1},{n:"Llave tubo 18",c:1,e:"OK",k:1},{n:"Llave tubo 24",c:1,e:"OK",k:1},{n:"Llave tubo 36",c:1,e:"OK",k:1},{n:"Llave mixta 1",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/2",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/4",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-11/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-3/4",c:1,e:"OK",k:1},{n:"Llave mixta 1-3/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-5/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-5/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-7/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-7/8",c:1,e:"OK",k:1},{n:"Llave mixta 15/16",c:1,e:"OK",k:1},{n:"Llave mixta 2",c:1,e:"OK",k:1},{n:"Llave mixta 2-1/2",c:1,e:"OK",k:1},{n:"Llave mixta 2-1/4",c:1,e:"OK",k:1},{n:"Llave mixta 2-3/16",c:1,e:"OK",k:1},{n:"Llave mixta 2-3/8",c:1,e:"OK",k:1},{n:"Llave mixta 30mm",c:1,e:"OK",k:1},{n:"Llave mixta 32",c:1,e:"OK",k:1},{n:"Llave mixta 36-41",c:1,e:"OK",k:1},{n:"Llave mixta 7/8",c:1,e:"OK",k:1},{n:"Martillo cincelador",c:1,e:"OK",k:1},{n:"Mesa corte tripode",c:1,e:"OK",k:1},{n:"Motor-tool",c:1,e:"OK",k:1},{n:"Nivel 24",c:1,e:"OK",k:1},{n:"Nivel 48",c:1,e:"OK",k:1},{n:"Nivel torpedo",c:1,e:"OK",k:1},{n:"Pala",c:1,e:"OK",k:1},{n:"Parasol",c:1,e:"OK",k:1},{n:"Pico",c:1,e:"OK",k:1},{n:"Piola",c:1,e:"OK",k:1},{n:"Playo comun",c:1,e:"OK",k:1},{n:"Playo presion",c:1,e:"OK",k:1},{n:"Plomada",c:1,e:"OK",k:1},{n:"Prensa manual",c:1,e:"OK",k:1},{n:"Punto centro",c:1,e:"OK",k:1},{n:"Sacabocados 8",c:8,e:"OK",k:1},{n:"Taladro + llave",c:1,e:"OK",k:1},{n:"Tecle cadena 2tn",c:1,e:"OK",k:1},{n:"Tecle señorita",c:1,e:"OK",k:1},{n:"Teflon 5",c:1,e:"OK",k:1},{n:"Termo agua",c:1,e:"OK",k:1},{n:"Termo porta electrodos",c:1,e:"OK",k:1},{n:"Tijera tool",c:1,e:"OK",k:1}]; let LS='FINAL_NOV_08_10';let s=localStorage.getItem(LS);if(s){try{let p=JSON.parse(s);if(p.length>100)H=p}catch(e){}} function calc(){let f=document.getElementById('fechaInput').value;if(!f)return null;let i=new Date(f+'T00:00:00');let h=new Date();h.setHours(0,0,0,0);let d=Math.floor((h-i)/86400000);if(d<0)d=0;let c=d%21;let t=c<14;let dt=0,dv=0,fa=0,te="",cl="";if(t){dt=c+1;fa=14-dt;te=`TRABAJANDO DIA ${dt}/14 - Faltan ${fa} para vacaciones`;cl="banner-trab";}else{dv=c-14+1;fa=7-dv;te=`VACACIONES DIA ${dv}/7 - Faltan ${fa} para trabajar`;cl="banner-vac";}return{trabajando:t,diaTrab:dt,diaVac:dv,faltan:fa,texto:te,clase:cl};} function save(){localStorage.setItem(LS,JSON.stringify(H));localStorage.setItem('camion3606_fecha',document.getElementById('fechaInput').value);} function render(){let f=(document.getElementById('buscar').value||'').toLowerCase();let cont=document.getElementById('lista');cont.innerHTML='';let nov=[];H.forEach((h,idx)=>{if(h.e!=='OK'&&h.e!=='CONSUMIBLES')nov.push({...h,idx});if(f&&!h.n.toLowerCase().includes(f))return;let cc=h.e==='OK'?'st-OK':'st-MAL';let div=document.createElement('div');div.className='row';div.innerHTML=`
${h.n}${h.e}
`;cont.appendChild(div);});let tf=H.length;let fo=H.filter(x=>x.k).length;let tu=H.reduce((a,b)=>a+b.c,0);let uo=H.filter(x=>x.k).reduce((a,b)=>a+b.c,0);document.getElementById('cFilas').innerText=fo;document.getElementById('cFilasDet').innerText=fo+'/'+tf;document.getElementById('cUnid').innerText=uo;document.getElementById('cUnidDet').innerText=uo+'/'+tu;let j=calc();if(j){let b=document.getElementById('vacBanner');b.className='banner '+j.clase;b.innerText=j.texto;document.getElementById('cCiclo').innerText=j.trabajando?j.diaTrab:j.diaVac;document.getElementById('cCicloDet').innerHTML=j.trabajando?`Trab ${j.diaTrab}/14
Faltan ${j.faltan}`:`Vac ${j.diaVac}/7
Faltan ${j.faltan}`;}document.getElementById('novCount').innerText=nov.length;let nl=document.getElementById('novList');if(nov.length===0)nl.innerHTML='
✅ Sin novedades - todo OK
';else nl.innerHTML=nov.map(h=>`
🔸 ${h.n} x${h.c} → ${h.e}
`).join('');} function sol(i){H[i].e='OK';H[i].k=1;save();render();} function toggleTodo(){let a=H.some(h=>!h.k);H.forEach(h=>h.k=a);save();render();} function marcarIngreso(){H.forEach(h=>h.k=1);save();render();} function marcarSalida(){let f=H.filter(h=>!h.k||(h.e!=='OK'&&h.e!=='CONSUMIBLES'));alert('Faltantes: '+f.length+'\n'+f.map(x=>x.n+' -> '+x.e).join('\n'));} function nuevaJornada(){if(confirm('NUEVA JORNADA DIA 1?')){let hoy=new Date().toISOString().split('T')[0];document.getElementById('fechaInput').value=hoy;H.forEach(h=>{h.k=1;});save();render();}} function guardarFecha(){save();render();} function buildPDF(){const{jsPDF}=window.jspdf;const pdf=new jsPDF('p','mm','a4');let left=8,right=202,width=right-left;let top=16;let colDescW=150;let xDesc=left,xCant=left+colDescW;function cab(y){pdf.setFillColor(0,0,0);pdf.setTextColor(255,255,255);pdf.rect(left,y,width,13,'F');pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text('DESCRIPCION',xDesc+5,y+9);pdf.text('CANT',xCant+7,y+9);pdf.setTextColor(0,0,0);return y+13;}pdf.setFont('helvetica','bold');pdf.setFontSize(20);pdf.text('HERRAMIENTAS CAMION SUELDA',105,top,{align:'center'});top+=14;top=cab(top);H.forEach((h,i)=>{let rh=12;if(top+rh>285){pdf.addPage();top=10;top=cab(top);}if(i%2==0){pdf.setFillColor(232,232,232);pdf.rect(left,top,width,rh,'F');}pdf.setDrawColor(160,160,160);pdf.rect(left,top,width,rh);pdf.line(xCant,top,xCant,top+rh);pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text(h.n.substring(0,42),xDesc+5,top+8.5);pdf.setFontSize(18);pdf.text(String(h.c),xCant+10,top+8.5,{align:'center'});top+=rh;});return pdf;} function guardarPDF(){let pdf=buildPDF();pdf.save('HERRAMIENTAS.pdf');} async function enviarListadoPDF(){let pdf=buildPDF();let blob=pdf.output('blob');let file=new File([blob],'HERRAMIENTAS.pdf',{type:'application/pdf'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'HERRAMIENTAS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');} async function enviarNovedadesImagen(){let nov=H.filter(h=>h.e!=='OK'&&h.e!=='CONSUMIBLES');if(nov.length===0){alert('Sin novedades');return;}let c=document.getElementById('canvasNov');let ctx=c.getContext('2d');let ancho=1000;let altoCab=220;let altoFila=75;let alto=altoCab+nov.length*altoFila+40;c.width=ancho;c.height=alto;ctx.fillStyle='#fff';ctx.fillRect(0,0,ancho,alto);ctx.fillStyle='#d32f2f';ctx.font='bold 62px Arial';ctx.textAlign='center';ctx.fillText('⚠️ NOVEDADES',ancho/2,80);ctx.fillStyle='#000';ctx.font='bold 36px Arial';ctx.fillText('CAMION SUELDA - '+nov.length+' ITEMS',ancho/2,130);let y=altoCab;ctx.fillStyle='#000';ctx.fillRect(20,y-55,ancho-40,55);ctx.fillStyle='#fff';ctx.font='bold 34px Arial';ctx.textAlign='left';ctx.fillText('DESCRIPCION',40,y-15);ctx.textAlign='center';ctx.fillText('CANT',750,y-15);ctx.fillText('ESTADO',900,y-15);nov.forEach((h,i)=>{let yy=y+i*altoFila;if(i%2==0){ctx.fillStyle='#e8e8e8';ctx.fillRect(20,yy,ancho-40,altoFila);}ctx.strokeStyle='#ccc';ctx.lineWidth=2;ctx.strokeRect(20,yy,ancho-40,altoFila);ctx.beginPath();ctx.moveTo(680,yy);ctx.lineTo(680,yy+altoFila);ctx.stroke();ctx.beginPath();ctx.moveTo(820,yy);ctx.lineTo(820,yy+altoFila);ctx.stroke();ctx.fillStyle='#000';ctx.font='bold 32px Arial';ctx.textAlign='left';ctx.fillText(h.n.substring(0,30),35,yy+48);ctx.font='bold 38px Arial';ctx.textAlign='center';ctx.fillText(String(h.c),750,yy+50);ctx.font='bold 28px Arial';ctx.fillStyle=h.e=='NO HAY'?'#d32f2f':'#ff6f00';ctx.fillText(h.e,900,yy+50);});c.toBlob(async(blob)=>{let file=new File([blob],'NOVEDADES_'+nov.length+'.png',{type:'image/png'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'NOVEDADES CAMION SUELDA',text:'NOVEDADES CAMION SUELDA - '+nov.length+' ITEMS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');},'image/png');} let fg=localStorage.getItem('camion3606_fecha');if(fg)document.getElementById('fechaInput').value=fg;render(); {n:"Llave golpe 2-7/16",c:1,e:"OK",k:1},{n:"Llave golpe 2-1/2",c:1,e:"OK",k:1},{n:"Llave golpe 2-3/16",c:1,e:"OK",k:1},{n:"Llave golpe 30mm",c:1,e:"OK",k:1},{n:"Llave golpe 41mm",c:1,e:"OK",k:1},{n:"Llave golpe 45mm",c:1,e:"OK",k:1},{n:"Llave golpe 52mm",c:1,e:"OK",k:1},{n:"Llave golpe 55mm",c:1,e:"OK",k:1},{n:"Llave golpe 65mm",c:1,e:"OK",k:1},{n:"Llave tubo 12",c:1,e:"OK",k:1},{n:"Llave tubo 18",c:1,e:"OK",k:1},{n:"Llave tubo 24",c:1,e:"OK",k:1},{n:"Llave tubo 36",c:1,e:"OK",k:1},{n:"Llave mixta 1",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/2",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/4",c:1,e:"OK",k:1},{n:"Llave mixta 1-1/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-11/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-3/4",c:1,e:"OK",k:1},{n:"Llave mixta 1-3/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-5/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-5/8",c:1,e:"OK",k:1},{n:"Llave mixta 1-7/16",c:1,e:"OK",k:1},{n:"Llave mixta 1-7/8",c:1,e:"OK",k:1},{n:"Llave mixta 15/16",c:1,e:"OK",k:1},{n:"Llave mixta 2",c:1,e:"OK",k:1},{n:"Llave mixta 2-1/2",c:1,e:"OK",k:1},{n:"Llave mixta 2-1/4",c:1,e:"OK",k:1},{n:"Llave mixta 2-3/16",c:1,e:"OK",k:1},{n:"Llave mixta 2-3/8",c:1,e:"OK",k:1},{n:"Llave mixta 30mm",c:1,e:"OK",k:1},{n:"Llave mixta 32",c:1,e:"OK",k:1},{n:"Llave mixta 36-41",c:1,e:"OK",k:1},{n:"Llave mixta 7/8",c:1,e:"OK",k:1},{n:"Martillo cincelador",c:1,e:"OK",k:1},{n:"Mesa corte tripode",c:1,e:"OK",k:1},{n:"Motor-tool",c:1,e:"OK",k:1},{n:"Nivel 24",c:1,e:"OK",k:1},{n:"Nivel 48",c:1,e:"OK",k:1},{n:"Nivel torpedo",c:1,e:"OK",k:1},{n:"Pala",c:1,e:"OK",k:1},{n:"Parasol",c:1,e:"OK",k:1},{n:"Pico",c:1,e:"OK",k:1},{n:"Piola",c:1,e:"OK",k:1},{n:"Playo comun",c:1,e:"OK",k:1},{n:"Playo presion",c:1,e:"OK",k:1},{n:"Plomada",c:1,e:"OK",k:1},{n:"Prensa manual",c:1,e:"OK",k:1},{n:"Punto centro",c:1,e:"OK",k:1},{n:"Sacabocados 8",c:8,e:"OK",k:1},{n:"Taladro + llave",c:1,e:"OK",k:1},{n:"Tecle cadena 2tn",c:1,e:"OK",k:1},{n:"Tecle señorita",c:1,e:"OK",k:1},{n:"Teflon 5",c:1,e:"OK",k:1},{n:"Termo agua",c:1,e:"OK",k:1},{n:"Termo porta electrodos",c:1,e:"OK",k:1},{n:"Tijera tool",c:1,e:"OK",k:1}]; let LS='FINAL_NOV_08_10';let s=localStorage.getItem(LS);if(s){try{let p=JSON.parse(s);if(p.length>100)H=p}catch(e){}} function calc(){let f=document.getElementById('fechaInput').value;if(!f)return null;let i=new Date(f+'T00:00:00');let h=new Date();h.setHours(0,0,0,0);let d=Math.floor((h-i)/86400000);if(d<0)d=0;let c=d%21;let t=c<14;let dt=0,dv=0,fa=0,te="",cl="";if(t){dt=c+1;fa=14-dt;te=`TRABAJANDO DIA ${dt}/14 - Faltan ${fa} para vacaciones`;cl="banner-trab";}else{dv=c-14+1;fa=7-dv;te=`VACACIONES DIA ${dv}/7 - Faltan ${fa} para trabajar`;cl="banner-vac";}return{trabajando:t,diaTrab:dt,diaVac:dv,faltan:fa,texto:te,clase:cl};} function save(){localStorage.setItem(LS,JSON.stringify(H));localStorage.setItem('camion3606_fecha',document.getElementById('fechaInput').value);} function render(){let f=(document.getElementById('buscar').value||'').toLowerCase();let cont=document.getElementById('lista');cont.innerHTML='';let nov=[];H.forEach((h,idx)=>{if(h.e!=='OK'&&h.e!=='CONSUMIBLES')nov.push({...h,idx});if(f&&!h.n.toLowerCase().includes(f))return;let cc=h.e==='OK'?'st-OK':'st-MAL';let div=document.createElement('div');div.className='row';div.innerHTML=`
${h.n}${h.e}
`;cont.appendChild(div);});let tf=H.length;let fo=H.filter(x=>x.k).length;let tu=H.reduce((a,b)=>a+b.c,0);let uo=H.filter(x=>x.k).reduce((a,b)=>a+b.c,0);document.getElementById('cFilas').innerText=fo;document.getElementById('cFilasDet').innerText=fo+'/'+tf;document.getElementById('cUnid').innerText=uo;document.getElementById('cUnidDet').innerText=uo+'/'+tu;let j=calc();if(j){let b=document.getElementById('vacBanner');b.className='banner '+j.clase;b.innerText=j.texto;document.getElementById('cCiclo').innerText=j.trabajando?j.diaTrab:j.diaVac;document.getElementById('cCicloDet').innerHTML=j.trabajando?`Trab ${j.diaTrab}/14
Faltan ${j.faltan}`:`Vac ${j.diaVac}/7
Faltan ${j.faltan}`;}document.getElementById('novCount').innerText=nov.length;let nl=document.getElementById('novList');if(nov.length===0)nl.innerHTML='
✅ Sin novedades - todo OK
';else nl.innerHTML=nov.map(h=>`
🔸 ${h.n} x${h.c} → ${h.e}
`).join('');} function sol(i){H[i].e='OK';H[i].k=1;save();render();} function toggleTodo(){let a=H.some(h=>!h.k);H.forEach(h=>h.k=a);save();render();} function marcarIngreso(){H.forEach(h=>h.k=1);save();render();} function marcarSalida(){let f=H.filter(h=>!h.k||(h.e!=='OK'&&h.e!=='CONSUMIBLES'));alert('Faltantes: '+f.length+'\n'+f.map(x=>x.n+' -> '+x.e).join('\n'));} function nuevaJornada(){if(confirm('NUEVA JORNADA DIA 1?')){let hoy=new Date().toISOString().split('T')[0];document.getElementById('fechaInput').value=hoy;H.forEach(h=>{h.k=1;});save();render();}} function guardarFecha(){save();render();} function buildPDF(){const{jsPDF}=window.jspdf;const pdf=new jsPDF('p','mm','a4');let left=8,right=202,width=right-left;let top=16;let colDescW=150;let xDesc=left,xCant=left+colDescW;function cab(y){pdf.setFillColor(0,0,0);pdf.setTextColor(255,255,255);pdf.rect(left,y,width,13,'F');pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text('DESCRIPCION',xDesc+5,y+9);pdf.text('CANT',xCant+7,y+9);pdf.setTextColor(0,0,0);return y+13;}pdf.setFont('helvetica','bold');pdf.setFontSize(20);pdf.text('HERRAMIENTAS CAMION SUELDA',105,top,{align:'center'});top+=14;top=cab(top);H.forEach((h,i)=>{let rh=12;if(top+rh>285){pdf.addPage();top=10;top=cab(top);}if(i%2==0){pdf.setFillColor(232,232,232);pdf.rect(left,top,width,rh,'F');}pdf.setDrawColor(160,160,160);pdf.rect(left,top,width,rh);pdf.line(xCant,top,xCant,top+rh);pdf.setFont('helvetica','bold');pdf.setFontSize(16);pdf.text(h.n.substring(0,42),xDesc+5,top+8.5);pdf.setFontSize(18);pdf.text(String(h.c),xCant+10,top+8.5,{align:'center'});top+=rh;});return pdf;} function guardarPDF(){let pdf=buildPDF();pdf.save('HERRAMIENTAS.pdf');} async function enviarListadoPDF(){let pdf=buildPDF();let blob=pdf.output('blob');let file=new File([blob],'HERRAMIENTAS.pdf',{type:'application/pdf'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'HERRAMIENTAS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');} async function enviarNovedadesImagen(){let nov=H.filter(h=>h.e!=='OK'&&h.e!=='CONSUMIBLES');if(nov.length===0){alert('Sin novedades');return;}let c=document.getElementById('canvasNov');let ctx=c.getContext('2d');let ancho=1000;let altoCab=220;let altoFila=75;let alto=altoCab+nov.length*altoFila+40;c.width=ancho;c.height=alto;ctx.fillStyle='#fff';ctx.fillRect(0,0,ancho,alto);ctx.fillStyle='#d32f2f';ctx.font='bold 62px Arial';ctx.textAlign='center';ctx.fillText('⚠️ NOVEDADES',ancho/2,80);ctx.fillStyle='#000';ctx.font='bold 36px Arial';ctx.fillText('CAMION SUELDA - '+nov.length+' ITEMS',ancho/2,130);let y=altoCab;ctx.fillStyle='#000';ctx.fillRect(20,y-55,ancho-40,55);ctx.fillStyle='#fff';ctx.font='bold 34px Arial';ctx.textAlign='left';ctx.fillText('DESCRIPCION',40,y-15);ctx.textAlign='center';ctx.fillText('CANT',750,y-15);ctx.fillText('ESTADO',900,y-15);nov.forEach((h,i)=>{let yy=y+i*altoFila;if(i%2==0){ctx.fillStyle='#e8e8e8';ctx.fillRect(20,yy,ancho-40,altoFila);}ctx.strokeStyle='#ccc';ctx.lineWidth=2;ctx.strokeRect(20,yy,ancho-40,altoFila);ctx.beginPath();ctx.moveTo(680,yy);ctx.lineTo(680,yy+altoFila);ctx.stroke();ctx.beginPath();ctx.moveTo(820,yy);ctx.lineTo(820,yy+altoFila);ctx.stroke();ctx.fillStyle='#000';ctx.font='bold 32px Arial';ctx.textAlign='left';ctx.fillText(h.n.substring(0,30),35,yy+48);ctx.font='bold 38px Arial';ctx.textAlign='center';ctx.fillText(String(h.c),750,yy+50);ctx.font='bold 28px Arial';ctx.fillStyle=h.e=='NO HAY'?'#d32f2f':'#ff6f00';ctx.fillText(h.e,900,yy+50);});c.toBlob(async(blob)=>{let file=new File([blob],'NOVEDADES_'+nov.length+'.png',{type:'image/png'});if(navigator.canShare&&navigator.canShare({files:[file]})){try{await navigator.share({files:[file],title:'NOVEDADES CAMION SUELDA',text:'NOVEDADES CAMION SUELDA - '+nov.length+' ITEMS'});return;}catch(e){}}window.open(URL.createObjectURL(blob),'_blank');},'image/png');} let fg=localStorage.getItem('camion3606_fecha');if(fg)document.getElementById('fechaInput').value=fg;render();