invoice number fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-03-25 17:16:41 +05:30
parent 6ddcf84527
commit 2860a18b3e
5 changed files with 16 additions and 17 deletions

View File

@ -19,8 +19,7 @@ class App extends BaseConfig
* http://example.com/
*/
// public string $baseURL = 'http://localhost:8080/';
public string $baseURL = '';
// public string $baseURL = 'http://localhost/vb_book/public/';
public string $baseURL = 'http://localhost/vb_book/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.

View File

@ -30,7 +30,7 @@ class Invoice extends BaseController
$model = new InvoiceModel();
$data['page_name'] = 'Online Invoice Details';
$data['invoice'] = $model->getJoinedData($where);
$data['invoice'] = $model->getJoinedData($where, ['I.invoice_date', 'DESC']);
$this->logger->info("Invoice: Listing Count ." . count($data['invoice']));
$this->render_page('invoice_list', $data);
} else {
@ -54,7 +54,7 @@ class Invoice extends BaseController
$model = new InvoiceModel();
$data['page_name'] = 'Offline Invoice Details';
$data['invoice'] = $model->getJoinedData($where);
$data['invoice'] = $model->getJoinedData($where, ['I.invoice_date', 'DESC']);
$this->logger->info("Invoice: Listing Count ." . count($data['invoice']));
$this->render_page('offline_invoice_list', $data);
} else {

View File

@ -120,8 +120,7 @@ public function getSubscriptionInvoiceDetail($where)
return $result;
}
public function getJoinedData($where)
public function getJoinedData($where, $orderby = [])
{
$query = $this->db->table($this->table.' as I' )
->join('customers as C', 'C.customer_id = I.customer_id', 'left')
@ -130,14 +129,16 @@ public function getJoinedData($where)
->join('business as B', 'B.business_id = I.business_id', 'left')
->join('users as U1', 'U1.user_id = I.created_by', 'left')
->join('users as U2', 'U2.user_id = I.updated_by', 'left')
->select('I.invoice_id, I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name,DATE_FORMAT(I.created_on, "%d/%m/%Y") as created_on_format,I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name,DATE_FORMAT(I.updated_on, "%d/%m/%Y") as updated_on_format, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.from_subscription,S.to_subscription,DATEDIFF(S.to_subscription, S.from_subscription) as subscription_in_days,S.scheme_id')
->where($where)
// ->like('C.first_name',"%John%")
->orderBy('I.invoice_id', 'DESC')
->groupBy('I.invoice_id')
->get();
$resultArray = $query->getResultArray();
->select('I.invoice_id,I.wp_api_order_id,I.invoice_number, I.customer_id,concat(C.first_name," ",C.last_name) as customer_name , I.invoice_date, I.due_date, I.subtotal, I.tax, I.discount, I.total_amount,I.status, I.payment_status, I.order_number, I.payment_method,I.invoice_type, I.event_id,E.event_name, I.business_id,B.title as business_name,DATE_FORMAT(I.created_on, "%d/%m/%Y") as created_on_format,I.created_on, I.created_by,concat(U1.first_name," ",U1.last_name) as created_by_name,DATE_FORMAT(I.updated_on, "%d/%m/%Y") as updated_on_format, I.updated_by,concat(U2.first_name," ",U2.last_name) as updated_by_name, I.isactive,C.email as customer_email,C.mobile_no as customer_mobile,I.shipping_address_id,I.shipping_address,I.billing_address_id,I.billing_address,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.from_subscription,S.to_subscription,DATEDIFF(S.to_subscription, S.from_subscription) as subscription_in_days,S.scheme_id')
->where($where);
if (!empty($orderby)) {
$query->orderBy($orderby[0], $orderby[1]);
} else {
$query->orderBy('invoice_id', 'DESC');
}
$query->groupBy('I.invoice_id');
$resultArray = $query->get()->getResultArray();
// Print the last executed query
// echo $this->db->getLastQuery();die;

View File

@ -1,5 +1,4 @@
<style>
<style>
/* CSS for modal content */
#pdfPreviewModal .modal-dialog {
@ -71,7 +70,7 @@
?>
<tr>
<td hidden><?= $row['invoice_id']; ?></td>
<td class="preview-pdf" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['order_number']; ?></td>
<td class="preview-pdf" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['invoice_number']; ?></td>
<td class="preview-pdf" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $invoice_date; ?></td>
<td class="preview-pdf" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['customer_name']; ?></td>
<td class="preview-pdf" id="status-column" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['status']; ?></td>

View File

@ -164,7 +164,7 @@ p {
<table class="invoice-info-table">
<?php foreach ($data as $value) : ?>
<tr>
<th><?php echo ($value->order_number) ? 'Order # ' . $value->order_number : 'Invoice # ' . $value->invoice_number; ?></th>
<th><?php echo ($value->wp_api_order_id) ? 'Order # ' . $value->invoice_number : 'Invoice # ' . $value->invoice_number; ?></th>
</tr>
<tr>
<th>Invoice Date : <?= $value->formatted_invoice_date ?></th>