Inventory & Invoice System
Buka sheets.new → nama: MMB Inventory 1448H
const SS=SpreadsheetApp.getActiveSpreadsheet();
function doPost(e){
try{
var d=JSON.parse(e.postData.contents);
if(d.action==='sync_inventory'){
var sh=SS.getSheetByName('Inventory')||SS.insertSheet('Inventory');
sh.clearContents();
sh.appendRow(['ID','Kota','Tanggal','Dur','Flight','Rute','Total','Terbook','Tersedia','Harga','Ket']);
d.inventory.forEach(r=>sh.appendRow([r.id,r.kota,r.tgl,r.dur,r.flight,r.rute,r.total,r.booked,r.total-r.booked,r.harga,r.ket]));
}
if(d.action==='sync_invoices'){
var si=SS.getSheetByName('Invoices')||SS.insertSheet('Invoices');
si.clearContents();
si.appendRow(['No Invoice','Tgl','Agen','PIC','WA','Kota','Tgl Terbang','Dur','Flight','Seat','Harga','Total','DP','Sisa','Status']);
d.invoices.forEach(r=>si.appendRow([r.no,r.created.split('T')[0],r.agenNama,r.agenPic,r.agenWa,r.kota,r.tgl,r.dur,r.flight,r.seat,r.harga,r.total,r.dp,r.sisa,r.status]));
}
return ContentService.createTextOutput(JSON.stringify({ok:true})).setMimeType(ContentService.MimeType.JSON);
}catch(err){return ContentService.createTextOutput(JSON.stringify({ok:false,error:err.message})).setMimeType(ContentService.MimeType.JSON);}
}Copy URL → paste di bar hijau → Sync.
Input jadwal + 4 segmen penerbangan
UPG: 118 jadwal • PKU: 79 jadwal • STPC termasuk dalam program
| Kota | Tanggal | Dur | Flight | Rute | Harga/Seat | Total | Terbook | Tersedia | Status | Aksi |
|---|
Termasuk tanggal detail per segmen & STPC
Isi form di kiri dan klik Generate Invoice.
| No. Invoice | Tanggal | Agen | Flight | Seat | Total | DP | Status | Aksi |
|---|
Yakin hapus schedule ini?
Belum ada kontak.
Buka supabase.com → Sign up → New project → nama: mmb-travel → region: Singapore
-- Run di Supabase SQL Editor
create table if not exists inventory (
id text primary key, kota text, tgl date, dur text default '',
flight text, rute text default '',
segments jsonb default '{}', seg_dates jsonb default '{}',
total integer default 0, booked integer default 0,
harga bigint default 0, maskapai text default 'Malaysia Airlines (MH)',
ket text default '', stpc boolean default true, musim text default '1448H',
created_at timestamptz default now()
);
create table if not exists invoices (
id text primary key, no text unique not null,
flight_id text references inventory(id),
kota text, tgl date, dur text default '',
flight text, rute text, maskapai text,
segments jsonb default '{}', seg_dates jsonb default '{}', stpc boolean default true,
agen_nama text, agen_pic text default '', agen_wa text default '', agen_kota text default '',
seat integer, harga bigint default 0,
subtotal bigint default 0, disc bigint default 0, disc_input text default '0',
disc_type text default 'pct', cb bigint default 0, cb_input text default '0',
cb_type text default 'pct', tax bigint default 0, tax_input text default '0',
tax_type text default 'pct', total bigint, dp bigint default 0,
dp_per_pax bigint default 0, dp_mode text default 'total',
sisa bigint default 0, notes text default '', due_date date, status text,
created_at timestamptz default now()
);
alter table inventory enable row level security;
alter table invoices enable row level security;
drop policy if exists "public_all_inventory" on inventory;
drop policy if exists "public_all_invoices" on invoices;
create policy "public_all_inventory" on inventory for all using (true) with check (true);
create policy "public_all_invoices" on invoices for all using (true) with check (true);Paste di bar gelap atas → klik Hubungkan. Sistem auto-upload 197 jadwal preset.
netlify.com → drag & drop file HTML → dapat URL publik → akses dari HP/laptop mana saja.