recommitted SerialNo : ps
This commit is contained in:
parent
a9be6d4177
commit
56f2b02904
@ -916,7 +916,8 @@ class ApiIntegration extends ResourceController
|
||||
$toDateTimestamp = strtotime("+$duration months", $fromDateTimestamp);
|
||||
$fromDate = date("Y-m-d", strtotime($records['date_created']));
|
||||
$toDate = date("Y-m-d", $toDateTimestamp);
|
||||
$scheme_id = $result_book_category[$x]['category_id'];
|
||||
// $scheme_id = $result_book_category[$x]['category_id']; b4
|
||||
$scheme_id = $result_book_category[$x]['book_id'];
|
||||
$dataToCheck = ['scheme_id'=>$scheme_id,'customer_id' => $local_customer_id,'invoice_id' => $invoice_id ];
|
||||
$existing_subscription = $api_model->getData('subscription', $dataToCheck);
|
||||
if (count($existing_subscription) > 0) {
|
||||
|
||||
@ -119,6 +119,7 @@ class Invoice extends BaseController
|
||||
$data['customer_shipping'] = $this->get_customer_address($where, []);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
// public function generate_serial_no(){}
|
||||
|
||||
## For Gethering Address Details...
|
||||
public function get_customer_address($where, $select)
|
||||
@ -210,11 +211,12 @@ class Invoice extends BaseController
|
||||
|
||||
$requestData = $this->request->getPost();
|
||||
|
||||
if($this->request->getPost('event_next_id') != ""){
|
||||
if($this->request->getPost('next_id')){
|
||||
## Array Formation For Events Details And Updating Events also Here..
|
||||
$update_events = [
|
||||
'id' => 1,
|
||||
'next_id' => $this->request->getPost('event_next_id'),
|
||||
'next_id' => (int)$this->request->getPost('next_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'updated_by' => get_logged_user_id()
|
||||
];
|
||||
$this->update_number_formatting($update_events);}
|
||||
@ -537,8 +539,7 @@ class Invoice extends BaseController
|
||||
// Fetch the invoice data based on $invoice_id
|
||||
$model = new InvoiceModel();
|
||||
$data = $model->getInvoiceData($id);
|
||||
$invoiceItems = $model->getInvoiceItems($id);
|
||||
$invoiceTerms= $model->getInvoiceData($id);
|
||||
$invoiceItems = $model->getInvoiceItems($id,'groupby');
|
||||
|
||||
foreach($invoiceItems as $index => $singleItem)
|
||||
{
|
||||
@ -569,13 +570,13 @@ class Invoice extends BaseController
|
||||
}
|
||||
|
||||
// Generate the PDF content (HTML) with data
|
||||
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'invoice_type' => $invoice_type,'invoiceTerms'=>$invoiceTerms]);
|
||||
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'invoice_type' => $invoice_type,'invoiceTerms'=>$data]);
|
||||
|
||||
// Load HTML into the mPDF instance
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output('invoice_' . $id . '.pdf', 'D');
|
||||
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
}
|
||||
public function print_address($id)
|
||||
{
|
||||
@ -602,7 +603,8 @@ class Invoice extends BaseController
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
// Output the PDF for download
|
||||
$pdfFileName = 'customer_address_' . $id . '.pdf';
|
||||
|
||||
$pdfFileName = 'customer_address_' . date('Y-m-d H-i-s') . '.pdf';
|
||||
$mpdf->Output($pdfFileName, 'D');
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public function updateData($table, $data, $where)
|
||||
$scheme_name = [];
|
||||
$from_subscription = [];
|
||||
$to_subscription = [];
|
||||
$invoiceItems = $this->getInvoiceItems2($invoiceId);
|
||||
$invoiceItems = $this->getInvoiceItems($invoiceId,'');
|
||||
foreach ($invoiceItems as $j => $child) {
|
||||
if ($child->category_name == 'Membership') {
|
||||
$scheme_name[] = $child->title;
|
||||
@ -98,7 +98,7 @@ public function updateData($table, $data, $where)
|
||||
if(!empty($result)){
|
||||
foreach ($result as $object) {
|
||||
$invoiceId = $object['invoice_id'];
|
||||
$items = $this->getInvoiceItems($invoiceId);
|
||||
$items = $this->getInvoiceItems($invoiceId,'');
|
||||
}
|
||||
}else{
|
||||
$items = [];
|
||||
@ -127,48 +127,46 @@ public function updateData($table, $data, $where)
|
||||
->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('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')
|
||||
->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 as customer_mobile')
|
||||
->select('B.title as ,B.business_logo,B.terms,B.address,B.city,B.state,B.postal_code,B.email,B.mobile_no')
|
||||
->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')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
}
|
||||
// this function Also Used For Approve Notification.
|
||||
public function getInvoiceItems($id)
|
||||
public function getInvoiceItems($id,$stringflag)
|
||||
{
|
||||
$data = $this->db->table('invoiceitems')
|
||||
->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1])
|
||||
->join('books as B', 'B.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')
|
||||
->select('invoiceitems.*,B.*,GROUP_CONCAT(C.name SEPARATOR \',\') as name')
|
||||
->groupBy('invoiceitems.invoice_child_id')
|
||||
|
||||
if ($stringflag == 'groupby') {
|
||||
$select = 'invoiceitems.*, B.*, GROUP_CONCAT(C.name SEPARATOR \',\') as name';
|
||||
$group_by = 'invoiceitems.invoice_child_id';
|
||||
} else {
|
||||
$select = 'invoiceitems.*, B.*, C.name as category_name';
|
||||
$group_by = "";
|
||||
}
|
||||
|
||||
$data = $this->db->table('invoiceitems')
|
||||
->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1])
|
||||
->join('books as B', 'B.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')
|
||||
->select($select)
|
||||
->groupBy($group_by) // Fixed the variable name here
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
//->limit(1,0)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
// print_r($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getInvoiceItems2($id)
|
||||
{
|
||||
$data = $this->db->table('invoiceitems')
|
||||
->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1])
|
||||
->join('books as B', 'B.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')
|
||||
->select('invoiceitems.*,B.*,C.name as category_name')
|
||||
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
//->limit(1,0)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// print_r($this->db->getLastQuery());
|
||||
// print_r($this->db->getLastQuery());die;
|
||||
// print_r($data);die("ends -- here");
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function getMembershipListForCustomer($category, $id)
|
||||
{
|
||||
$data = $this->db->table('subscription as S')
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="event" class="col-form-label">Events</label>
|
||||
<input type="hidden" id="hiddenEventNextId" name="event_next_id" placeholder="hidden for event next id" />
|
||||
<select class="form-control" id="event" name="event_id" data-toggle="select2">
|
||||
<option value="">Select an Events</option>
|
||||
<?php foreach ($events as $event) : ?>
|
||||
@ -65,6 +64,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="invoiceNumber">Invoice Number</label>
|
||||
<input type="text" class="form-control" id="invoiceNumber" name="invoice_number" value="<?= isset($invoice_details['invoice_number']) ? $invoice_details['invoice_number'] : '' ?>">
|
||||
<input type="hidden" id="hiddenNextId" name="next_id" placeholder="hidden for next id" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="orderNumber">Order Number</label>
|
||||
@ -506,7 +506,7 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// var final_sno = generateSerialNumber(filtered_data);
|
||||
|
||||
// $("#invoiceNumber").val(final_sno).prop("readonly", true);
|
||||
var iid_arr = <?php echo json_encode($invoice_item_details); ?>;
|
||||
var cust_id = "<?= isset($invoice_details['customer_id']) ? $invoice_details['customer_id'] : ""; ?>";
|
||||
@ -669,7 +669,7 @@
|
||||
|
||||
var serial_number = prefix_string + '-' + padded_id;
|
||||
next_id_numberic++;
|
||||
$("#hiddenEventNextId").val(next_id_numberic).prop("readonly", true);
|
||||
$("#hiddenNextId").val(next_id_numberic).prop("readonly", true);
|
||||
|
||||
return serial_number;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user