# Full Finished `index.html` ```html SN System Order Form

SN System

Order Form + Invoice Generator

``` --- # REQUIRED GOOGLE APPS SCRIPT Replace ALL Apps Script code with this: ```javascript function doPost(e) { try { const data = JSON.parse(e.postData.contents); const ownerEmail = 'YOUR_EMAIL@gmail.com'; const customerName = data.name; const customerEmail = data.email; const customerPhone = data.phone; const notes = data.notes; const packageName = data.packageName; const packagePrice = data.packagePrice; const orderId = data.orderId; const currentDate = data.currentDate; // ===================================== // PDF FROM BASE64 // ===================================== const pdfData = data.pdfBase64 .replace(/^data:application\/pdf;filename=generated.pdf;base64,/, '') .replace(/^data:application\/pdf;base64,/, ''); const pdfBlob = Utilities.newBlob( Utilities.base64Decode(pdfData), 'application/pdf', 'invoice-' + orderId + '.pdf' ); // ===================================== // EMAIL TO OWNER // ===================================== MailApp.sendEmail({ to: ownerEmail, subject: 'New Order - ' + orderId, htmlBody: `

New Order Received

Order ID: ${orderId}

Date: ${currentDate}


Name: ${customerName}

Email: ${customerEmail}

Phone: ${customerPhone}


Package: ${packageName}

Price: £${packagePrice}


Notes:

${notes}

`, attachments: [pdfBlob] }); // ===================================== // EMAIL TO CUSTOMER // ===================================== MailApp.sendEmail({ to: customerEmail, subject: 'Your Invoice - ' + orderId, htmlBody: `

Thank You For Your Order

Hello ${customerName},

Your order has been received successfully.

Order ID: ${orderId}

Package: ${packageName}

Total: £${packagePrice}

Your invoice PDF is attached.


SN System

`, attachments: [pdfBlob] }); return ContentService .createTextOutput( JSON.stringify({ success: true }) ) .setMimeType(ContentService.MimeType.JSON); } catch(error) { return ContentService .createTextOutput( JSON.stringify({ success: false, error: error.toString() }) ) .setMimeType(ContentService.MimeType.JSON); } } ``` --- # IMPORTANT DEPLOY SETTINGS Apps Script → Deploy → Manage Deployments Use: * Execute as: * Me * Access: * Anyone Then redeploy. --- # FINAL RESULT You now have: ✅ Working order form ✅ Google Apps Script integration ✅ Real POST requests ✅ Invoice PDF generation ✅ Customer invoice email ✅ Owner notification email ✅ Unique order IDs ✅ Automatic PDF download ✅ Error handling ✅ Modern responsive UI