CHANGE_INVOICE_FORM_AMOUNT_CALCULATION_DESCRIPTION_CSS_EXTRA_TD_REMOVE : AADHAVAN

This commit is contained in:
aadhavan valli 2024-05-06 17:31:56 +05:30
parent 0ab6b686d9
commit ae0f2bc613

View File

@ -160,7 +160,7 @@
} ?></option>
<?php endforeach; ?>
</select>
<textarea name="description[]" id="<?= "description" . $inx; ?>" cols="30" rows="2" style="height: 37px;"><?= isset($ii_details['description']) ? $ii_details['description'] : '' ?></textarea>
<textarea name="description[]" class="form-control" placeholder="Enter Description" id="<?= "description" . $inx; ?>" cols="26" rows="2" style="margin-top: 16px;border-color: lightgray;width:247px;"><?= isset($ii_details['description']) ? $ii_details['description'] : '' ?></textarea>
</td>
<td style="width:7%;"><input type="number" class="form-control item-quantity" id="<?= "quantity" . $inx; ?>" name="quantity[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['quantity']) ? $ii_details['quantity'] : '' ?>" min="1" />
</td>
@ -204,7 +204,7 @@
<?php endif;
endforeach; ?>
</select>
<textarea name="description[]" id="" cols="34" rows="2" style="margin-top: 16px;border-color: lightgray;"></textarea>
<textarea name="description[]" class="form-control" placeholder="Enter Description" id="" cols="26" rows="2" style="margin-top: 16px;border-color: lightgray;width:247px;"></textarea>
</td>
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="quantity0" name="quantity[]" oninput="calculateInvoice(this,0)" min="1" />
@ -321,10 +321,8 @@
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="notes">Bank Details</label>
<textarea readonly class="form-control" id="notes" name="notes" rows="3">Bank Name : State Bank Of India
IFSC code : SBIN00989
Account No : 89900787655</textarea>
<label for="notes">Notes</label>
<textarea class="form-control" id="notes" name="notes" rows="2"></textarea>
</div>
</div>
</div>
@ -731,11 +729,14 @@ Account No : 89900787655</textarea>
var cell2 = newRow.insertCell(1);
var cell3 = newRow.insertCell(2);
var cell4 = newRow.insertCell(3);
cell4.style.display = "none";
var cell5 = newRow.insertCell(4);
var cell6 = newRow.insertCell(5);
var cell7 = newRow.insertCell(6);
var cell8 = newRow.insertCell(7);
var cell9 = newRow.insertCell(8);
// var cell9 = newRow.insertCell(8);
html = `<select class="form-control book-select" id="book${counter}" name="item_details[]" onchange="displayBookTag(this, ${counter})" data-toggle="select2" required>
<option value="">Select a <?= $flag_name ?></option>
@ -752,14 +753,14 @@ Account No : 89900787655</textarea>
cell1.innerHTML = html;
// cell1.innerHTML = '<input type="text" class="form-control" name="item_details[]">';
cell1.innerHTML += '<textarea name="description[]" id="description'+counter+'" cols="34" rows="2" style="margin-top: 16px;border-color: lightgray;"></textarea>';
cell1.innerHTML += '<textarea name="description[]" class="form-control" placeholder="Enter Description" id="description'+counter+'" cols="26" rows="2" style="margin-top: 16px;border-color: lightgray;width:247px;"></textarea>';
cell2.innerHTML = '<input type="number" class="form-control item-quantity" id="quantity' + counter + '" name="quantity[]" oninput="calculateInvoice(this,' + counter + ')" min="1">';
cell3.innerHTML = '<input type="number" class="form-control item-rate" id="rate' + counter + '" name="rate[]" oninput="calculateInvoice(this,' + counter + ')" min="0" step="0.01">';
// cell4.innerHTML = '<input type="number" class="form-control item-tax" id="tax' + counter + '" name="tax[]" min="0" step="0.01">';
cell4.innerHTML = '<input type="number" class="form-control item-amount" id="amount' + counter + '" name="amount[]" min="0" step="0.01">';
cell5.innerHTML = '<input type="number" class="form-control item-discount-amount" id="item_discount_amount' + counter + '" name="discount_amount[]" oninput="calculateInvoice(this,' + counter + ')" min="0" step="0.01">';
cell6.innerHTML = '<select class="form-control item-discount-type" style=""width:12%;" id="item_discount_type' + counter + '" name="discount_type[]" oninput="calculateInvoice(this,' + counter + ')"><option value="₹">₹</option><option value="%">%</option></select>';
cell7.innerHTML = '<input type="hidden" class="form-control" id="hiddenInvoiceChildId' + counter + '" placeholder="hidden for invoice child/item id" name="invoice_child_id[]" value=""><center><i class="fa fa-trash remove-item "></center>';
cell4.innerHTML = '<input type="hidden" type="number" class="form-control item-tax" id="tax' + counter + '" name="tax[]" min="0" step="0.01">';
cell5.innerHTML = '<input type="number" class="form-control item-amount" id="amount' + counter + '" name="amount[]" min="0" step="0.01">';
cell6.innerHTML = '<input type="number" class="form-control item-discount-amount" id="item_discount_amount' + counter + '" name="discount_amount[]" oninput="calculateInvoice(this,' + counter + ')" min="0" step="0.01">';
cell7.innerHTML = '<select class="form-control item-discount-type" style=""width:12%;" id="item_discount_type' + counter + '" name="discount_type[]" oninput="calculateInvoice(this,' + counter + ')"><option value="₹">₹</option><option value="%">%</option></select>';
cell8.innerHTML = '<input type="hidden" class="form-control" id="hiddenInvoiceChildId' + counter + '" placeholder="hidden for invoice child/item id" name="invoice_child_id[]" value=""><center><i class="fa fa-trash remove-item "></center>';
$(newRow.querySelector('.book-select')).select2();
localStorage.setItem('add_book_index', counter);
@ -781,6 +782,7 @@ Account No : 89900787655</textarea>
var selectedBook = bookData.find(book => book.book_id == bookId);
if (selectedBook) {
console.log(row);
// Update the fields in the current row with book details
row.querySelector('#quantity' + counter).value = 1;
row.querySelector('#rate' + counter).value = selectedBook.price;
@ -806,6 +808,7 @@ Account No : 89900787655</textarea>
var discountType = row.querySelector('select[name="discount_type[]"]').value; // Get the selected discount type
var discountAmount = parseFloat(row.querySelector('input[name="discount_amount[]"]').value) || 0;
console.log(rate);
if (!isNaN(quantity) && !isNaN(rate)) {
var amount = quantity * rate;