StockSyncTEAM v4
Multi-user warehouse counting platform
Select Role
👷
Counter
👔
Supervisor
or
Step 1 of 3 — Connect Google Sheets
Paste your Apps Script Web App URL
Apps Script Web App URL
ℹ️Deploy the script code shown below, then paste the Web App URL here.
Apps Script Code — paste into Code.gs
const MASTER_PASS = 'admin123'; // CHANGE THIS function doGet(e) { return R({status:'StockSync ready'}); } function doPost(e) { try { var d=JSON.parse(e.postData.contents),a=d.action; if(a==='auth') return auth(d); if(a==='write') return writeRow(d); if(a==='read') return readRows(d); if(a==='createSession') return createSess(d); return R({error:'unknown action'}); } catch(ex){ return R({error:ex.toString()}); } } function auth(d) { if(d.role==='supervisor') { return d.pass===MASTER_PASS ? R({ok:true,role:'supervisor'}) : R({ok:false,msg:'Wrong master password'}); } var s=getSessions()[d.code]; if(!s) return R({ok:false,msg:'Session not found: '+d.code}); return s.password===d.pass ? R({ok:true,role:'counter',session:s}) : R({ok:false,msg:'Wrong password for '+d.code}); } function writeRow(d) { var ss=SpreadsheetApp.getActiveSpreadsheet(); var nm=san(d.session)+'_'+san(d.table||'counts'); var ws=ss.getSheetByName(nm); if(!ws) { ws=ss.insertSheet(nm); var h=Object.keys(d.row); ws.appendRow(h); ws.getRange(1,1,1,h.length) .setFontWeight('bold') .setBackground('#1a2540') .setFontColor('#ffffff'); ws.setFrozenRows(1); } ws.appendRow(Object.values(d.row)); return R({ok:true}); } function readRows(d) { var ss=SpreadsheetApp.getActiveSpreadsheet(); var nm=san(d.session)+'_'+san(d.table||'counts'); var ws=ss.getSheetByName(nm); if(!ws) return R({rows:[]}); var data=ws.getDataRange().getValues(); if(data.length<2) return R({rows:[]}); var h=data[0]; return R({rows:data.slice(1).map(function(r){ var o={};h.forEach(function(k,i){o[k]=r[i];});return o; })}); } function createSess(d) { if(d.masterPass!==MASTER_PASS) return R({ok:false,msg:'Wrong master password'}); var s=getSessions(); s[d.code]={code:d.code,name:d.name,password:d.password, customer:d.customer||'',date:d.date||'', createdAt:new Date().toISOString()}; saveSessions(s); var ss=SpreadsheetApp.getActiveSpreadsheet(); var ws=ss.getSheetByName('_Sessions'); if(!ws){ ws=ss.insertSheet('_Sessions'); ws.appendRow(['Code','Name','Password','Customer','Date','Created']); ws.getRange(1,1,1,6).setFontWeight('bold') .setBackground('#1a2540').setFontColor('#ffffff'); ws.setFrozenRows(1); } ws.appendRow([d.code,d.name,d.password, d.customer||'',d.date||'',new Date().toISOString()]); return R({ok:true,session:s[d.code]}); } function getSessions(){ try{return JSON.parse( PropertiesService.getScriptProperties() .getProperty('sessions')||'{}'); }catch(e){return{};} } function saveSessions(s){ PropertiesService.getScriptProperties() .setProperty('sessions',JSON.stringify(s)); } function san(x){ return String(x||'data') .replace(/[^a-zA-Z0-9_-]/g,'-').substring(0,50); } function R(d){ return ContentService .createTextOutput(JSON.stringify(d)) .setMimeType(ContentService.MimeType.JSON); } // Run this ONCE manually in the editor to create first session: function createFirstSession(){ var s=getSessions(); s['WH-MUM-01']={code:'WH-MUM-01',name:'Mumbai Warehouse', password:'count123',createdAt:new Date().toISOString()}; saveSessions(s); Logger.log('Done: WH-MUM-01 / count123'); }
Master Password
⚠️Enter the MASTER_PASS value from line 1 of your Apps Script. Default: admin123. Change it before going live.
ℹ️Saved only on this device. Used for Supervisor login.
Create First Counting Session
One session = one counting job per customer/warehouse. Share code + password with your team.
Ready
Find / Scan SKU
0
Counters
0
Batches
0
SKUs
0
Units
Active Counters
👥
No counters yet
Live Activity Feed
📡
Activity will appear here
0
SKUs
0
Mismatch
0
Shortage
0
Surplus
Count Progress0%
0 of 0
SKUSystemPhysicalVarianceCountersStatus
ℹ️Combines all counters' data from Sheets. Tap Sync first.
All Batches — Session
📦
No data — tap Sync
👔Supervisor — create sessions, set system stock, monitor all counters.
Sessions
📋
No sessions
System Stock (ERP Quantities)
⚠️Set system quantities for live variance calculation.
Google Sheets
⚠️Not configured
Branding
Session Info
Session:
User:
Role:
My batches: 0
All barcode formats supported