7th nov Bug fixes : ps

This commit is contained in:
VE10-Sanjeev 2023-11-08 18:54:10 +05:30
parent 9348f0ee3f
commit 42cf774ff9
4 changed files with 57 additions and 38 deletions

View File

@ -125,8 +125,10 @@ public function updateData($table, $data, $where)
->join('customers as C','C.customer_id= invoice.customer_id','left') ->join('customers as C','C.customer_id= invoice.customer_id','left')
->join('business as B','B.business_id = invoice.business_id','left') ->join('business as B','B.business_id = invoice.business_id','left')
->join('customer_addresses as A','A.customer_id=invoice.customer_id and A.address_type=1','left') ->join('customer_addresses as A','A.customer_id=invoice.customer_id and A.address_type=1','left')
->join('states', 'states.state_short_name = A.state AND A.country = "IN"', 'left')
->join('countries', 'countries.country_short_name = A.country', 'left')
->select('invoice.*,concat(C.first_name," ",C.last_name) as customer_name,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no,B.title,B.business_logo,B.terms,B.address,B.city,B.state,B.postal_code,B.email,B.mobile_no') ->select('invoice.*,concat(C.first_name," ",C.last_name) as customer_name,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no,B.title,B.business_logo,B.terms,B.address,B.city,B.state,B.postal_code,B.email,B.mobile_no')
->select('states.state_name != "",states.state_name,A.state) as customer_bill_state,concat(A.address_1," ", A.address_2) as customer_bill_address,A.postal_code as customer_bill_postal_code ,A.city as customer_bill_city, countries.country_name as customer_bill_country')
->get() ->get()
->getResult(); ->getResult();
@ -139,7 +141,8 @@ public function updateData($table, $data, $where)
->join('books as B', 'B.book_id = invoiceitems.product', 'left') ->join('books as B', 'B.book_id = invoiceitems.product', 'left')
->join('book_categories as BC', 'BC.book_id = invoiceitems.product', 'left') ->join('book_categories as BC', 'BC.book_id = invoiceitems.product', 'left')
->join('category as C', 'C.id = BC.category_id', 'left') ->join('category as C', 'C.id = BC.category_id', 'left')
->select('invoiceitems.*,B.*,C.name as category_name') ->select('invoiceitems.*,B.*,GROUP_CONCAT(C.name SEPARATOR \',\') as name')
->groupBy('invoiceitems.invoice_child_id')
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order //->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
//->limit(1,0) //->limit(1,0)
->get() ->get()
@ -195,13 +198,16 @@ public function updateData($table, $data, $where)
} }
public function getNonMembershipCategoryBooks() public function getNonMembershipCategoryBooks()
{ {
return $this->db->table('books') $data = $this->db->table('books')
->select('books.*')
->join('book_categories', 'book_categories.book_id= books.book_id', 'left') ->join('book_categories', 'book_categories.book_id= books.book_id', 'left')
->join('category','category.id=book_categories.category_id') ->join('category','category.id=book_categories.category_id')
->where('category.name !=', 'membership') ->where('category.name !=', 'membership')
->groupBy('books.book_id') ->groupBy('books.book_id')
->get() ->get()
->getResult(); ->getResult();
return $data;
} }
public function insertSubscriptionData($data) public function insertSubscriptionData($data)
{ {

View File

@ -60,13 +60,13 @@
<?= $value->postal_code ?> <?= $value->postal_code ?>
</div> </div>
<div class="address"> <div class="address">
<p>To:</p> <p>To:</p>
<p><?= $value->customer_name ?></p> <p><?= $value->customer_name ?></p>
<p><?= $value->address_1 ?><?= $value->address_2 ?></p> <p><?= $value->customer_bill_address ?></p>
<p><?= $value->city ?>&nbsp;<?= $value->state ?></p> <p><?= $value->customer_bill_city ?>&nbsp;<?= $value->customer_bill_state ?></p>
<p><?= $value->postal_code ?></p> <p><?= $value->customer_bill_postal_code ?></p>
<p><?= $value->customer_bill_country ?></p>
</div> </div>
<div class="barcode"> <div class="barcode">
<img src="barcode.png" alt="Barcode"> <img src="barcode.png" alt="Barcode">

View File

@ -315,6 +315,8 @@
<script> <script>
$("#addressCopiedAsShipping").on("change", function() { $("#addressCopiedAsShipping").on("change", function() {
var count = $(".after-shipping-addr-add-more").length;
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
var customerAddress1 = $("#baddress1").val(); var customerAddress1 = $("#baddress1").val();
var customerAddress2 = $("#baddress2").val(); var customerAddress2 = $("#baddress2").val();
@ -326,13 +328,13 @@
$("#saddress1").val(customerAddress1).prop("readonly", false); $("#saddress1").val(customerAddress1).prop("readonly", false);
$("#saddress2").val(customerAddress2).prop("readonly", false); $("#saddress2").val(customerAddress2).prop("readonly", false);
$("#scountry0").val(customerCountry).prop("readonly", false); $("#scountry"+count).val(customerCountry).prop("readonly", false);
if (customerCountry == 'IN') { if (customerCountry == 'IN') {
$("#sistate0").val(customerInputState).css("display", "none").prop("readonly", false); $("#sistate"+count).val(customerInputState).css("display", "none").prop("readonly", false);
$("#sdstate0").val(customerDropdownState).css("display", "block").prop("readonly", false); $("#sdstate"+count).val(customerDropdownState).css("display", "block").prop("readonly", false);
} else { } else {
$("#sistate0").val(customerInputState).css("display", "block").prop("readonly", false); $("#sistate"+count).val(customerInputState).css("display", "block").prop("readonly", false);
$("#sdstate0").val(customerDropdownState).css("display", "none").prop("readonly", false); $("#sdstate"+count).val(customerDropdownState).css("display", "none").prop("readonly", false);
} }
$("#scity").val(customerCity).prop("readonly", false); $("#scity").val(customerCity).prop("readonly", false);
$("#szip").val(customerPostalCode).prop("readonly", false); $("#szip").val(customerPostalCode).prop("readonly", false);
@ -340,10 +342,10 @@
// Clear the billing address fields when the checkbox is unchecked // Clear the billing address fields when the checkbox is unchecked
$("#saddress1").val("").prop("readonly", false); $("#saddress1").val("").prop("readonly", false);
$("#saddress2").val("").prop("readonly", false); $("#saddress2").val("").prop("readonly", false);
$("#scountry0").val("").prop("readonly", false);
$("#scity").val("").prop("readonly", false); $("#scity").val("").prop("readonly", false);
$("#sistate0").val("").prop("readonly", false); $("#scountry"+count).val("").prop("readonly", false);
$("#sdstate0").val("").prop("readonly", false); $("#sistate"+count).val("").css("display", "block").prop("readonly", false);
$("#sdstate"+count).val("").css("display", "none").prop("readonly", false);
$("#szip").val("").prop("readonly", false); $("#szip").val("").prop("readonly", false);
$("#scustomer_address_id").val("") // Hidden Field ressetted bcoz Adress history $("#scustomer_address_id").val("") // Hidden Field ressetted bcoz Adress history
} }
@ -450,6 +452,8 @@
alert("At least one Shipping Address must be displayed."); alert("At least one Shipping Address must be displayed.");
} }
toggleButtons(); toggleButtons();
// if($('#addressCopiedAsShipping').is(':checked')){}
// else{ $('#addressCopiedAsShipping').prop("checked", false); }
}); });
function toggleButtons() { function toggleButtons() {

View File

@ -1,9 +1,8 @@
<!-- <style> <style>
/* Target the Select2 container and set the width */ td .select2-container{
.select2-container .select2-dropdown {
width: 249px !important; width: 249px !important;
} }
</style> --> </style>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card"> <div class="card">
@ -79,12 +78,12 @@
</div> </div>
<?php if ($invoice_type === '1') : ?> <?php if ($invoice_type === '1') : ?>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="fromsubcription">From Subcription</label> <label for="fromsubcription">From Subcription<span class="text-danger"> *</span></label>
<input type="date" class="form-control" id="fromsubcription" name="from_subscription" value="<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : '' ?>"> <input type="date" class="form-control" id="fromsubcription" name="from_subscription" value="<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : '' ?>" required onchange="updateToDateMinDate(this.value)">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="tosubcription">To Subcription</label> <label for="tosubcription">To Subcription<span class="text-danger"> *</span></label>
<input type="date" class="form-control" id="to_subcription" name="to_subscription" value="<?= isset($invoice_item_details[0]['to_subscription']) ? $invoice_item_details[0]['to_subscription'] : '' ?>"> <input type="date" class="form-control" id="tosubcription" name="to_subscription" value="<?= isset($invoice_item_details[0]['to_subscription']) ? $invoice_item_details[0]['to_subscription'] : '' ?>" required>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -122,7 +121,7 @@
</td> </td>
<td style="width:8%;"><input type="text" class="form-control item-tax" id="<?= "tax" . $inx; ?>" name="tax[]" value="<?= isset($ii_details['tax']) ? $ii_details['tax'] : '' ?>" readonly /> <td style="width:8%;"><input type="text" class="form-control item-tax" id="<?= "tax" . $inx; ?>" name="tax[]" value="<?= isset($ii_details['tax']) ? $ii_details['tax'] : '' ?>" readonly />
</td> </td>
<td style="width:12%;"><input type="text" class="form-control item-amount" id="<?= "amount" . $inx; ?>" name="amount[]" value="<?= isset($ii_details['subtotal']) ? $ii_details['subtotal'] : '' ?>" /> <td style="width:12%;"><input type="text" class="form-control item-amount" id="<?= "amount" . $inx; ?>" name="amount[]" value="<?= isset($ii_details['subtotal']) ? $ii_details['subtotal'] : '' ?>" readonly />
</td> </td>
<td style="width:12%;"><input type="text" class="form-control item-discount-amount" id="<?= "item_discount_amount" . $inx; ?>" name="discount_amount[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['discount_amount']) ? $ii_details['discount_amount'] : '' ?>" /> <td style="width:12%;"><input type="text" class="form-control item-discount-amount" id="<?= "item_discount_amount" . $inx; ?>" name="discount_amount[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['discount_amount']) ? $ii_details['discount_amount'] : '' ?>" />
@ -146,10 +145,11 @@
<tr> <tr>
<td style="width:30% !important;"><select class="form-control book-select" id="book0" name="item_details[]" onchange="displayBookTag(this,0)" required data-toggle="select2" style="width: 249px !important;"> <td style="width:30% !important;"><select class="form-control book-select" id="book0" name="item_details[]" onchange="displayBookTag(this,0)" required data-toggle="select2" style="width: 249px !important;">
<option value="">Select a book</option> <option value="">Select a book</option>
<?php foreach ($books as $book) : ?> <?php
<option value="<?= $book->book_id ?>"><?= $book->title ?> foreach ($books as $book) :
</option> if ((int)$book->isactive === 1) : ?>
<?php endforeach; ?> <option value="<?= $book->book_id ?>"><?= $book->title; ?></option>
<?php endif; endforeach; ?>
</select></td> </select></td>
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="quantity0" name="quantity[]" oninput="calculateInvoice(this,0)" /> <td style="width:10%;"><input type="number" class="form-control item-quantity" id="quantity0" name="quantity[]" oninput="calculateInvoice(this,0)" />
</td> </td>
@ -316,9 +316,9 @@
cell1.innerHTML = `<select class="form-control book-select" id="book${counter}" name="item_details[]" onchange="displayBookTag(this, ${counter})" data-toggle="select2"> cell1.innerHTML = `<select class="form-control book-select" id="book${counter}" name="item_details[]" onchange="displayBookTag(this, ${counter})" data-toggle="select2">
<option value="">Select a book</option> <option value="">Select a book</option>
<?php foreach ($books as $book) : ?> <?php foreach ($books as $book) : if ((int)$book->isactive === 1) : ?>
<option value="<?= $book->book_id ?>"><?= $book->title ?></option> <option value="<?= $book->book_id ?>"><?= $book->title ?></option>
<?php endforeach; ?> <?php endif; endforeach; ?>
</select>`; </select>`;
// cell1.innerHTML = '<input type="text" class="form-control" name="item_details[]">'; // cell1.innerHTML = '<input type="text" class="form-control" name="item_details[]">';
@ -375,7 +375,7 @@
} else { } else {
row.querySelector('#amount' + counter).value = ''; // Clear the amount if either quantity or rate is not a number row.querySelector('#amount' + counter).value = ''; // Clear the amount if either quantity or rate is not a number
} }
row.querySelector('#amount' + counter).readOnly = true;
calculateOverallTotals(); calculateOverallTotals();
} }
@ -506,7 +506,6 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var iid_arr = <?php echo json_encode($invoice_item_details); ?>; var iid_arr = <?php echo json_encode($invoice_item_details); ?>;
var cust_id = "<?= isset($invoice_details['customer_id']) ? $invoice_details['customer_id'] : ""; ?>"; var cust_id = "<?= isset($invoice_details['customer_id']) ? $invoice_details['customer_id'] : ""; ?>";
var ship_addr_id = "<?= isset($invoice_details['shipping_address_id']) ? $invoice_details['shipping_address_id'] : ""; ?>"; var ship_addr_id = "<?= isset($invoice_details['shipping_address_id']) ? $invoice_details['shipping_address_id'] : ""; ?>";
@ -514,7 +513,10 @@
load_details1(ship_addr_id, cust_id); load_details1(ship_addr_id, cust_id);
load_details2(ship_addr_id, cust_id); load_details2(ship_addr_id, cust_id);
} }
var fromDateValue = "<?= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : ""; ?>";
if (fromDateValue != '') {
updateToDateMinDate(fromDateValue)
}
var bill_addr = ""; var bill_addr = "";
$("#customerName").change(function() { $("#customerName").change(function() {
@ -670,11 +672,10 @@
return serial_number; return serial_number;
} }
bill_addr = "<?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : ""; ?>";
if (bill_addr != '') { $("#storeBillingAddress").val(bill_addr);}
}); });
</script> </script>
<!-- bill_addr = "<?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : ""; ?>"; -->
<!-- if (bill_addr != '') { $("#storeBillingAddress").val(bill_addr);} -->
<script> <script>
document.getElementById('saveapproved').addEventListener('click', function() { document.getElementById('saveapproved').addEventListener('click', function() {
// Set the status field to 'Draft' before submitting // Set the status field to 'Draft' before submitting
@ -695,6 +696,14 @@
// Set the min and max date attributes // Set the min and max date attributes
invoiceDateInput.setAttribute("min", minDate); invoiceDateInput.setAttribute("min", minDate);
invoiceDateInput.setAttribute("max", maxDate); invoiceDateInput.setAttribute("max", maxDate);
const fromsubcriptionDateInput = document.getElementById("fromsubcription");
fromsubcriptionDateInput.setAttribute("max", maxDate);
function updateToDateMinDate(fromDateValue) {
const toDateInput = document.getElementById('tosubcription');
toDateInput.min = fromDateValue;
}
</script> </script>
<script> <script>