Tracker issue
This commit is contained in:
parent
cc68fff67f
commit
eeca1f21b6
@ -199,18 +199,45 @@ public function getSubscriptionInvoiceDetail($where)
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
// public function getInvoiceData($id)
|
||||
// {
|
||||
// // Fetch invoice data
|
||||
// return $this->db->table('invoice')
|
||||
// ->where('invoice_id', $id)
|
||||
// ->join('customers as C','C.customer_id= invoice.customer_id','left')
|
||||
// ->join('business as B','B.business_id = invoice.business_id','left')
|
||||
// ->join('customer_addresses as CA', 'CA.customer_id = invoice.customer_id AND CA.customer_address_id = invoice.shipping_address_id', 'left')
|
||||
// ->select('invoice.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date,DATE_FORMAT(invoice.due_date, "%d/%m/%Y") AS formatted_due_date ,concat(C.first_name," ",C.last_name) as customer_name,C.mobile_no as customer_mobile')
|
||||
// ->select('B.title as company_name,B.business_logo,B.terms as company_terms,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.email as company_email,B.mobile_no as company_mobile_no')
|
||||
// // ->select('COALESCE(NULLIF(states.state_name, ""), A.state) AS customer_bill_state')
|
||||
// // ->select(' customer_bill_country')
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
// }
|
||||
public function getInvoiceData($id)
|
||||
{
|
||||
// return $this->db->table('invoice')
|
||||
// ->where('invoice_id', $id)
|
||||
// ->join('customer_addresses as A','A.customer_address_id=invoice.shipping_address_id ','left')
|
||||
// ->select('invoice.*,A.*')
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
// Fetch invoice data
|
||||
return $this->db->table('invoice')
|
||||
->where('invoice_id', $id)
|
||||
->join('customers as C','C.customer_id= invoice.customer_id','left')
|
||||
->join('business as B','B.business_id = invoice.business_id','left')
|
||||
|
||||
->select('invoice.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date,DATE_FORMAT(invoice.due_date, "%d/%m/%Y") AS formatted_due_date ,concat(C.first_name," ",C.last_name) as customer_name,C.mobile_no as customer_mobile')
|
||||
->join('customer_addresses as A','A.customer_address_id=invoice.shipping_address_id','left')
|
||||
->join('customer_addresses as S','S.customer_address_id=invoice.billing_address_id','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.*,DATE_FORMAT(invoice.invoice_date, "%d/%m/%Y") AS formatted_invoice_date,DATE_FORMAT(invoice.due_date, "%d/%m/%Y") AS formatted_due_date ,concat(C.first_name," ",C.last_name) as customer_name,C.mobile_no,A.address_1, A.address_2,A.postal_code,A.city, A.state,C.mobile_no as customer_mobile')
|
||||
->select('B.title as company_name,B.business_logo,B.terms as company_terms,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.email as company_email,B.mobile_no as company_mobile_no')
|
||||
// ->select('COALESCE(NULLIF(states.state_name, ""), A.state) AS customer_bill_state')
|
||||
// ->select(' customer_bill_country')
|
||||
->select('COALESCE(NULLIF(states.state_name, ""), A.state) AS customer_bill_state')
|
||||
->select('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')
|
||||
->select('concat(S.address_1," ", S.address_2) as customer_ship_address,S.postal_code as customer_ship_postal_code ,S.city as customer_ship_city, countries.country_name as customer_ship_country')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
@ -50,8 +50,12 @@
|
||||
?>
|
||||
<div class="invoice">
|
||||
<div class="bill-details">
|
||||
<?= $value->customer_name ?><br>
|
||||
<?= $value->shipping_address ?><br>
|
||||
<?= $value->customer_name ?><br>
|
||||
<?= $value->customer_bill_address." ," ?><br>
|
||||
<?= $value->customer_bill_city ?> <?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
|
||||
<?= $value->customer_bill_postal_code ? " - ".$value->customer_bill_postal_code :""; ?>
|
||||
<?= $value->customer_bill_country." ." ?><br>
|
||||
<?= $value->mobile_no." ." ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
<td hidden><input type="hidden" class="form-control" id="<?= "hiddenInvoiceChildId" . $inx; ?>" name="invoice_child_id[]" value="" placeholder="hidden for invoice child/item id" value="<?= isset($ii_details['invoice_child_id']) ? $ii_details['invoice_child_id'] : '' ?>" /></td>
|
||||
<?php if ($invoice_type === '1') : ?>
|
||||
<td>
|
||||
<center><i class="fa fa-trash remove-item "></i></center>
|
||||
<!-- <center><i class="fa fa-trash remove-item "></i></center> -->
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
@ -500,9 +500,11 @@
|
||||
|
||||
<script>
|
||||
var bookData=<?php echo json_encode($books); ?>;
|
||||
|
||||
localStorage.setItem('add_book_index', 0);
|
||||
document.getElementById("addItem").addEventListener("click", function() {
|
||||
var bookArray = bookData;
|
||||
console.log(bookArray);
|
||||
var table = document.getElementById("itemTable").getElementsByTagName("tbody")[0];
|
||||
var counter = table.rows.length;
|
||||
var newRow = table.insertRow(table.rows.length);
|
||||
@ -516,13 +518,19 @@
|
||||
var cell7 = newRow.insertCell(6);
|
||||
var cell8 = newRow.insertCell(7);
|
||||
|
||||
cell1.innerHTML = `<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>
|
||||
<option value="add_new_book">+ Add New Book</option>
|
||||
<?php foreach ($books as $book) : if ((int)$book->isactive === 1) : ?>
|
||||
<option value="<?= $book->book_id ?>"><?= $book->title ?></option>
|
||||
<?php endif; endforeach; ?>
|
||||
</select>`;
|
||||
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>
|
||||
<option value="add_new_book">+ Add New Book</option>`;
|
||||
|
||||
// Populate options from the bookArray
|
||||
bookArray.forEach(function(book) {
|
||||
|
||||
html += `<option value="${book.book_id}">${book.title}</option>`;
|
||||
|
||||
});
|
||||
|
||||
html += `</select>`;
|
||||
cell1.innerHTML=html;
|
||||
|
||||
// cell1.innerHTML = '<input type="text" class="form-control" name="item_details[]">';
|
||||
cell2.innerHTML = '<input type="number" class="form-control item-quantity" id="quantity' + counter + '" name="quantity[]" oninput="calculateInvoice(this,' + counter + ')" min="1">';
|
||||
|
||||
@ -200,12 +200,23 @@ p {
|
||||
<tr>
|
||||
<td class="billing-address">
|
||||
<?php foreach ($data as $value) : ?>
|
||||
<p><?= $value->customer_name ?><br><?= $value->billing_address ?></p>
|
||||
<?= $value->customer_name ?><br>
|
||||
<?= $value->customer_ship_address." ," ?><br>
|
||||
<?= $value->customer_bill_city ?> <?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
|
||||
<?= $value->customer_bill_postal_code ? " - ".$value->customer_bill_postal_code :""; ?>
|
||||
<?= $value->customer_bill_country." ." ?><br>
|
||||
<?= $value->mobile_no." ." ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td class="shipping-address">
|
||||
<?php foreach ($data as $value) : ?>
|
||||
<p><?= $value->customer_name ?><br><?= $value->shipping_address ?></p>
|
||||
<?= $value->customer_name ?><br>
|
||||
<?= $value->customer_bill_address." ," ?><br>
|
||||
<?= $value->customer_bill_city ?> <?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
|
||||
<?= $value->customer_bill_postal_code ? " - ".$value->customer_bill_postal_code :""; ?>
|
||||
<?= $value->customer_bill_country." ." ?><br>
|
||||
<?= $value->mobile_no." ." ?>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -277,9 +288,9 @@ p {
|
||||
<?php foreach ($data as $value) : ?>
|
||||
<div class="terms">
|
||||
<p>Thank you!</p>
|
||||
<?php if(!empty($value->notes)){ ?>
|
||||
<br><p style="text-align: left !important;"><b>Notes:</b> <?= $value->notes; ?></p>
|
||||
<?php } ?>
|
||||
<!-- <if(!empty($value->notes)){
|
||||
<br><p style="text-align: left !important;"><b>Notes:</b> $value->notes; ?></p>
|
||||
} ?> -->
|
||||
<?php if(!empty($value->reason)){ ?>
|
||||
<br><p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p>
|
||||
<?php } ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user