Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/new_invoice.php
Назад
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Invoice Generator</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; background-color: #f4f4f4; } .container { background-color: white; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0,0,0,0.1); max-width: 800px; margin: 0 auto; } h1 { text-align: center; margin-bottom: 20px; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; font-weight: bold; } input, textarea, select { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; } .row { display: flex; gap: 15px; } .col { flex: 1; } table { width: 100%; border-collapse: collapse; margin: 20px 0; } table, th, td { border: 1px solid #ddd; } th, td { padding: 10px; text-align: left; } th { background-color: #f2f2f2; } .item-row input { width: 100%; } .buttons { display: flex; justify-content: space-between; margin-top: 20px; } button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background-color: #45a049; } #addItem { background-color: #2196F3; } #addItem:hover { background-color: #0b7dda; } #printInvoice { background-color: #ff9800; } #printInvoice:hover { background-color: #e68a00; } </style> </head> <body> <div class="container"> <h1>BILL OF SUPPLY</h1> <form id="invoiceForm"> <!-- Consignor Information --> <div class="form-group"> <label for="consignorName">Consignor Name:</label> <input type="text" id="consignorName" name="consignorName"> </div> <div class="form-group"> <label for="consignorAddress">Consignor Address:</label> <textarea id="consignorAddress" name="consignorAddress" rows="3"></textarea> </div> <div class="row"> <div class="col form-group"> <label for="consignorPhone">Mobile:</label> <input type="text" id="consignorPhone" name="consignorPhone"> </div> <div class="col form-group"> <label for="consignorPincode">Pincode:</label> <input type="text" id="consignorPincode" name="consignorPincode"> </div> </div> <!-- Consignee Information --> <div class="form-group"> <label for="consigneeName">Consignee (Ship to):</label> <input type="text" id="consigneeName" name="consigneeName"> </div> <div class="form-group"> <label for="consigneeAddress">Consignee Address:</label> <textarea id="consigneeAddress" name="consigneeAddress" rows="3"></textarea> </div> <!-- Buyer Information --> <div class="form-group"> <label for="buyerName">Buyer (Bill to):</label> <input type="text" id="buyerName" name="buyerName"> </div> <div class="form-group"> <label for="buyerAddress">Buyer Address:</label> <textarea id="buyerAddress" name="buyerAddress" rows="3"></textarea> </div> <!-- Invoice Details --> <div class="row"> <div class="col form-group"> <label for="invoiceNo">Invoice No:</label> <input type="text" id="invoiceNo" name="invoiceNo"> </div> <div class="col form-group"> <label for="invoiceDate">Date:</label> <input type="date" id="invoiceDate" name="invoiceDate"> </div> </div> <div class="row"> <div class="col form-group"> <label for="deliveryNote">Delivery Note:</label> <input type="text" id="deliveryNote" name="deliveryNote"> </div> <div class="col form-group"> <label for="paymentTerms">Mode/Terms of Payment:</label> <input type="text" id="paymentTerms" name="paymentTerms"> </div> </div> <div class="row"> <div class="col form-group"> <label for="reference">Reference No. & Date:</label> <input type="text" id="reference" name="reference"> </div> <div class="col form-group"> <label for="otherReferences">Other References:</label> <input type="text" id="otherReferences" name="otherReferences"> </div> </div> <div class="row"> <div class="col form-group"> <label for="buyerOrderNo">Buyer's Order No:</label> <input type="text" id="buyerOrderNo" name="buyerOrderNo"> </div> <div class="col form-group"> <label for="buyerOrderDate">Dated:</label> <input type="date" id="buyerOrderDate" name="buyerOrderDate"> </div> </div> <div class="row"> <div class="col form-group"> <label for="dispatchDocNo">Dispatch Doc No:</label> <input type="text" id="dispatchDocNo" name="dispatchDocNo"> </div> <div class="col form-group"> <label for="deliveryNoteDate">Delivery Note Date:</label> <input type="date" id="deliveryNoteDate" name="deliveryNoteDate"> </div> </div> <div class="row"> <div class="col form-group"> <label for="dispatchedThrough">Dispatched through:</label> <input type="text" id="dispatchedThrough" name="dispatchedThrough"> </div> <div class="col form-group"> <label for="destination">Destination:</label> <input type="text" id="destination" name="destination"> </div> </div> <div class="form-group"> <label for="termsOfDelivery">Terms of Delivery:</label> <input type="text" id="termsOfDelivery" name="termsOfDelivery"> </div> <!-- Item Details --> <table id="itemTable"> <thead> <tr> <th>Description of Goods</th> <th>Qty Shipped</th> <th>Qty Billed</th> <th>Rate</th> <th>Per</th> <th>Amount</th> </tr> </thead> <tbody> <tr class="item-row"> <td><input type="text" name="description[]"></td> <td><input type="number" step="0.01" name="qtyShipped[]" class="qty-shipped"></td> <td><input type="number" step="0.01" name="qtyBilled[]" class="qty-billed"></td> <td><input type="number" step="0.01" name="rate[]" class="rate"></td> <td><input type="text" name="per[]"></td> <td><input type="number" step="0.01" name="amount[]" class="amount" readonly></td> </tr> </tbody> <tfoot> <tr> <td colspan="4"></td> <td><strong>Total</strong></td> <td><input type="number" step="0.01" id="totalAmount" name="totalAmount" readonly></td> </tr> </tfoot> </table> <div class="form-group"> <label for="amountInWords">Amount Chargeable (in words):</label> <input type="text" id="amountInWords" name="amountInWords" readonly> </div> <div class="form-group"> <label for="remarks">Remarks:</label> <textarea id="remarks" name="remarks" rows="2"></textarea> </div> <div class="form-group"> <label for="declaration">Declaration:</label> <textarea id="declaration" name="declaration" rows="3">We declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.</textarea> </div> <div class="buttons"> <button type="button" id="addItem">Add Item</button> <button type="button" id="calculateTotal">Calculate Total</button> <button type="button" id="printInvoice">Save & Print</button> </div> </form> </div> <script> // Add item row document.getElementById('addItem').addEventListener('click', function() { const tbody = document.querySelector('#itemTable tbody'); const tr = document.createElement('tr'); tr.className = 'item-row'; tr.innerHTML = ` <td><input type="text" name="description[]"></td> <td><input type="number" step="0.01" name="qtyShipped[]" class="qty-shipped"></td> <td><input type="number" step="0.01" name="qtyBilled[]" class="qty-billed"></td> <td><input type="number" step="0.01" name="rate[]" class="rate"></td> <td><input type="text" name="per[]"></td> <td><input type="number" step="0.01" name="amount[]" class="amount" readonly></td> `; tbody.appendChild(tr); }); // Calculate amount for each row and total document.getElementById('calculateTotal').addEventListener('click', function() { const rows = document.querySelectorAll('.item-row'); let total = 0; rows.forEach(row => { const qtyBilled = parseFloat(row.querySelector('.qty-billed').value) || 0; const rate = parseFloat(row.querySelector('.rate').value) || 0; const amount = qtyBilled * rate; row.querySelector('.amount').value = amount.toFixed(2); total += amount; }); document.getElementById('totalAmount').value = total.toFixed(2); document.getElementById('amountInWords').value = numberToWords(total) + " Only"; }); // Convert number to words function numberToWords(num) { const units = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']; const tens = ['', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']; if (num === 0) return 'Zero'; function convertLessThanOneThousand(n) { if (n < 20) { return units[n]; } if (n < 100) { return tens[Math.floor(n / 10)] + (n % 10 !== 0 ? ' ' + units[n % 10] : ''); } return units[Math.floor(n / 100)] + ' Hundred' + (n % 100 !== 0 ? ' ' + convertLessThanOneThousand(n % 100) : ''); } let result = ''; // Handle rupees const rupees = Math.floor(num); if (rupees > 0) { let lakhs = Math.floor(rupees / 100000); if (lakhs > 0) { result += convertLessThanOneThousand(lakhs) + ' Lakh '; rupees %= 100000; } let thousands = Math.floor(rupees / 1000); if (thousands > 0) { result += convertLessThanOneThousand(thousands) + ' Thousand '; rupees %= 1000; } if (rupees > 0) { result += convertLessThanOneThousand(rupees); } result = 'INR ' + result; } return result; } // Save and print invoice document.getElementById('printInvoice').addEventListener('click', function() { // First calculate the total document.getElementById('calculateTotal').click(); // Gather form data const formData = new FormData(document.getElementById('invoiceForm')); // Send data to server fetch('save_invoice.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { alert('Invoice saved successfully!'); // Open print view window.open('print_invoice.php?id=' + data.invoice_id, '_blank'); } else { alert('Error saving invoice: ' + data.message); } }) .catch(error => { console.error('Error:', error); alert('An error occurred while saving the invoice.'); }); }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка