diff --git a/assets/download.svg b/assets/download.svg
new file mode 100644
index 0000000..82a5ad4
--- /dev/null
+++ b/assets/download.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/print.svg b/assets/print.svg
new file mode 100644
index 0000000..cfa0682
--- /dev/null
+++ b/assets/print.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/customers/.hta_slug/billing-details.php b/customers/.hta_slug/billing-details.php
index b5542e7..5c3157c 100644
--- a/customers/.hta_slug/billing-details.php
+++ b/customers/.hta_slug/billing-details.php
@@ -190,7 +190,7 @@
Amount |
Date |
Payment Date |
- Payment Status |
+ Status |
Action |
@@ -208,7 +208,7 @@
-
+ |
= $emi['payStatus'] == 0 ? 'Unpaid' : 'Paid'; ?>
diff --git a/customers/.hta_slug/edit-invoice.php b/customers/.hta_slug/edit-invoice.php
index 302deb8..83f536f 100644
--- a/customers/.hta_slug/edit-invoice.php
+++ b/customers/.hta_slug/edit-invoice.php
@@ -22,41 +22,10 @@
$description = $_POST['description'];
$quantity = $_POST['quantity'];
$rate = $_POST['rate'];
- $discount = $_POST['discount'];
$discountAmount = $_POST['discountAmount'];
-
-
- // EMI Calculation
- $emiAmount = round($totalAmount / $tenure, 2);
- $outstandingAmount = $totalAmount;
- $emiDate = new DateTime($bookingDate); // Set initial date
-
- // $stmt = $db->prepare("INSERT INTO emi (customerId, emiNumber, emiAmount, emiDate, totalAmount, outstanding, tenure, frequency, bookingDate, invoiceId) VALUES (:customerId, :emiNumber, :emiAmount, :emiDate, :totalAmount, :outstanding, :tenure, :frequency, :bookingDate, :invoiceId)");
- // for ($i = 1; $i <= $tenure; $i++) {
- // $outstandingAmount -= $emiAmount;
- // $emiDateFormatted = $emiDate->format('Y-m-d');
- // $stmt->bindParam(':customerId', $_GET['customerId']);
- // $stmt->bindParam(':emiNumber', $i);
- // $stmt->bindParam(':emiAmount', $emiAmount);
- // $stmt->bindParam(':emiDate', $emiDateFormatted);
- // $stmt->bindParam(':totalAmount', $totalAmount);
- // $stmt->bindParam(':outstanding', $outstandingAmount);
- // $stmt->bindParam(':tenure', $tenure);
- // $stmt->bindParam(':frequency', $frequency);
- // $stmt->bindParam(':bookingDate', $bookingDate);
- // $stmt->bindParam(':invoiceId', $invoiceId);
- // $stmt->execute();
- // // Move to the next EMI date
- // if (trim(strtolower($frequency)) === 'weekly') {
- // $emiDate->modify('+1 week');
- // } elseif (trim(strtolower($frequency)) === 'monthly') {
- // $emiDate->modify('+1 month');
- // }
- // }
-
- // Insert into invoice table
- $stmt2 = $db->prepare("UPDATE invoice SET customerName = :customerName, address = :address, invoiceDate = :invoiceDate, paymentMode = :paymentMode, salesAgent = :salesAgent, marketingAgent = :marketingAgent, item = :item, description = :description, adminNote = :adminNote WHERE customerId = :customerId AND invoiceId = :invoiceId");
+ // Update invoice table
+ $stmt2 = $db->prepare("UPDATE invoice SET customerName = :customerName, address = :address, invoiceDate = :invoiceDate, paymentMode = :paymentMode, salesAgent = :salesAgent, marketingAgent = :marketingAgent, item = :item, description = :description, adminNote = :adminNote, discountAmount = :discountAmount, totalAmount = :totalAmount WHERE customerId = :customerId AND invoiceId = :invoiceId");
$stmt2->bindParam(':customerId', $_GET['customerId']);
$stmt2->bindParam(':invoiceId', $invoiceId);
$stmt2->bindParam(':customerName', $customerName);
@@ -68,8 +37,11 @@
$stmt2->bindParam(':item', $item);
$stmt2->bindParam(':description', $description);
$stmt2->bindParam(':adminNote', $adminNote);
+ $stmt2->bindParam(':discountAmount', $discountAmount);
+ $stmt2->bindParam(':totalAmount', $totalAmount);
$stmt2->execute();
- echo ' New EMI Plan Saved Successfully! ';
+
+ echo 'Invoice Updated Successfully! ';
echo '
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/customers/.hta_slug/generate-invoice.php b/customers/.hta_slug/generate-invoice.php
index baf2bbd..bbf22ca 100644
--- a/customers/.hta_slug/generate-invoice.php
+++ b/customers/.hta_slug/generate-invoice.php
@@ -22,7 +22,6 @@
$description = $_POST['description'];
$quantity = $_POST['quantity'];
$rate = $_POST['rate'];
- $discount = $_POST['discount'];
$discountAmount = $_POST['discountAmount'];
// EMI Calculation
@@ -54,7 +53,7 @@
}
// Insert into invoice table
- $stmt2 = $db->prepare("INSERT INTO invoice (customerId, invoiceId, customerName, address, frequency, invoiceDate, paymentMode, salesAgent, marketingAgent, tenure, item, description, qty, rate, discount, totalAmount, adminNote, discountAmount) VALUES (:customerId, :invoiceId, :customerName, :address, :frequency, :invoiceDate, :paymentMode, :salesAgent, :marketingAgent, :tenure, :item, :description, :qty, :rate, :discount, :totalAmount, :adminNote, :discountAmount)");
+ $stmt2 = $db->prepare("INSERT INTO invoice (customerId, invoiceId, customerName, address, frequency, invoiceDate, paymentMode, salesAgent, marketingAgent, tenure, item, description, qty, rate, totalAmount, adminNote, discountAmount) VALUES (:customerId, :invoiceId, :customerName, :address, :frequency, :invoiceDate, :paymentMode, :salesAgent, :marketingAgent, :tenure, :item, :description, :qty, :rate, :totalAmount, :adminNote, :discountAmount)");
$stmt2->bindParam(':customerId', $_GET['customerId']);
$stmt2->bindParam(':invoiceId', $invoiceId);
$stmt2->bindParam(':customerName', $customerName);
@@ -69,7 +68,6 @@
$stmt2->bindParam(':description', $description);
$stmt2->bindParam(':qty', $quantity);
$stmt2->bindParam(':rate', $rate);
- $stmt2->bindParam(':discount', $discount);
$stmt2->bindParam(':totalAmount', $totalAmount);
$stmt2->bindParam(':adminNote', $adminNote);
$stmt2->bindParam(':discountAmount', $discountAmount);
@@ -111,7 +109,6 @@
$stmt = $db->query("SELECT invoiceId FROM invoice ORDER BY id DESC LIMIT 1");
$lastInvoicePrint = $stmt->fetch(PDO::FETCH_ASSOC);
- // $invoiceIdPrint = "ASDQ-" . ($lastInvoice ? ($lastInvoice['id'] + 1) : '1');
} catch (PDOException $e) {
echo 'Error: ' . $e->getMessage() . ' ';
@@ -214,7 +211,6 @@
| Description |
Qty |
Rate |
- Discount % |
Discount $ |
Amount |
@@ -234,18 +230,7 @@
-
-
- |
-
-
+
|
@@ -269,8 +254,6 @@
const formattedDate = today.toISOString().split('T')[0];
document.getElementById('bookingDate').value = formattedDate;
-
-
function changeTenureField() {
const tenureAuto = document.getElementById('tenureAuto');
const tenureCustom = document.getElementById('tenureCustom');
@@ -299,75 +282,27 @@
tenureAuto.value = "";
}
}
+
document.addEventListener("DOMContentLoaded", function () {
const quantityInput = document.getElementById("quantity");
const rateInput = document.getElementById("rate");
- const discountSelect = document.getElementById("discountAuto");
- const discountInput = document.getElementById("discountCustom");
const discountAmountInput = document.getElementById("discountAmount");
const totalAmountInput = document.getElementById("totalAmount");
- function getDiscountValue() {
- // Use the visible element's value (dropdown or input)
- if (!discountSelect.disabled) {
- return parseFloat(discountSelect.value) || 0;
- } else {
- return parseFloat(discountInput.value) || 0;
- }
- }
-
function calculateTotal() {
const quantity = parseFloat(quantityInput.value) || 0;
const rate = parseFloat(rateInput.value) || 0;
- const discount = getDiscountValue();
+ const discountAmount = parseFloat(discountAmountInput.value) || 0;
let subtotal = quantity * rate;
- let discountAmount = (subtotal * discount) / 100;
let grandTotal = subtotal - discountAmount;
- discountAmountInput.value = discountAmount.toFixed(2);
totalAmountInput.value = grandTotal.toFixed(2);
}
// Event listeners for real-time calculation
quantityInput.addEventListener("input", calculateTotal);
rateInput.addEventListener("input", calculateTotal);
- discountSelect.addEventListener("change", calculateTotal);
- discountInput.addEventListener("input", calculateTotal);
+ discountAmountInput.addEventListener("input", calculateTotal);
});
-
-
- function changeDiscountField() {
- const discountAuto = document.getElementById('discountAuto');
- const discountCustom = document.getElementById('discountCustom');
-
- if (discountAuto.value === "0") { // "Custom" option selected
- discountAuto.classList.add('visually-hidden');
- discountAuto.removeAttribute('name');
- discountAuto.setAttribute('disabled', 'true');
-
- discountCustom.classList.remove('visually-hidden');
- discountCustom.setAttribute('name', 'discount');
- discountCustom.removeAttribute('disabled');
- discountCustom.focus();
- }
- }
-
- function restoreDiscounDropdown(input) {
- const discountAuto = document.getElementById('discountAuto');
-
- if (input.value.trim() === "") { // If input is empty, restore the dropdown
- discountAuto.classList.remove('visually-hidden');
- discountAuto.removeAttribute('disabled');
- discountAuto.setAttribute('name', 'discount');
- discountAuto.value = "";
-
- input.classList.add('visually-hidden');
- input.removeAttribute('name');
- input.setAttribute('disabled', 'true');
- }
- }
-
-
-
\ No newline at end of file
diff --git a/customers/.hta_slug/print-invoice.php b/customers/.hta_slug/print-invoice.php
index 912f70a..011afa7 100644
--- a/customers/.hta_slug/print-invoice.php
+++ b/customers/.hta_slug/print-invoice.php
@@ -19,8 +19,13 @@ if ($invoiceInfo['tenure'] > 1) {
$emiPlans = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
?>
-
-
+
+
+
+
+
+
+

@@ -54,7 +59,6 @@ if ($invoiceInfo['tenure'] > 1) {
Description |
Qty |
Rate |
- Discount(%) |
Discount |
Total |
@@ -65,7 +69,6 @@ if ($invoiceInfo['tenure'] > 1) {
= $invoiceInfo['description'] ?> |
= $invoiceInfo['qty'] ?> |
= $invoiceInfo['rate'] ?> |
- = $invoiceInfo['discount'] ?>% |
$= $invoiceInfo['discountAmount'] ?> |
$= number_format($invoiceInfo['totalAmount'], 2) ?> |
@@ -135,11 +138,8 @@ if ($invoiceInfo['tenure'] > 1) {
Admin Note: = $invoiceInfo['adminNote'] ?>
Invoice Generate Date:
-
-
-
-
+
|