tracker items
This commit is contained in:
parent
ac56f59350
commit
d4a0c7acf4
@ -8,7 +8,7 @@ use App\Models\InvoiceModel;
|
||||
use App\Helpers\NotificationHelper;
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
class Invoice extends BaseController
|
||||
{
|
||||
## For Invoice Listing..
|
||||
@ -670,14 +670,30 @@ $encodedUrl = urlencode($url);
|
||||
// print_r($invoiceItems);die();
|
||||
|
||||
// Create an mPDF object
|
||||
$mpdf = new Mpdf();
|
||||
$mpdf = new Mpdf([
|
||||
'mode' => '',
|
||||
'format' => 'A5',
|
||||
'default_font_size' => 0,
|
||||
'default_font' => '',
|
||||
'margin_left' => 2,
|
||||
'margin_right' => 2,
|
||||
'margin_top' => 6,
|
||||
'margin_bottom' => 6,
|
||||
'margin_header' => 6,
|
||||
'margin_footer' =>-30,
|
||||
'orientation' => 'P',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true;
|
||||
// Set PDF properties
|
||||
$mpdf->SetTitle('Invoice');
|
||||
$mpdf->SetAuthor($data[0]->company_name);
|
||||
$mpdf->SetCreator('');
|
||||
|
||||
$htmlFooter='<div >
|
||||
<img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png"style=margin-left:70px;/> </div>';
|
||||
<img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png"style=margin-top:70px;/> </div>';
|
||||
$mpdf->setHTMLFooter($htmlFooter);
|
||||
|
||||
// Generate the PDF content (HTML)
|
||||
@ -696,6 +712,50 @@ $encodedUrl = urlencode($url);
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
}
|
||||
// public function generate_invoice_pdf($id)
|
||||
// {
|
||||
// // Fetch the invoice data based on $invoice_id
|
||||
// $model = new InvoiceModel();
|
||||
// $data = $model->getInvoiceData($id);
|
||||
// $invoiceItems = $model->getInvoiceItems($id, 'groupby');
|
||||
|
||||
// foreach ($invoiceItems as $index => $singleItem) {
|
||||
// $productImgs = $model->getProductImgs($singleItem->product);
|
||||
// $invoiceItems[$index]->imgs = $productImgs;
|
||||
// }
|
||||
// $invoice_type = $data[0]->invoice_type;
|
||||
// // Create a DOMPDF instance
|
||||
// $dompdf = new Dompdf();
|
||||
|
||||
// // Set PDF properties
|
||||
// $options = $dompdf->getOptions();
|
||||
// $options->set("isHtml5ParserEnabled", true);
|
||||
|
||||
// // Set paper size and orientation
|
||||
// $dompdf->setPaper('A5', 'portrait');
|
||||
|
||||
// // Generate the PDF content (HTML)
|
||||
// if ($data[0]->status === 'Draft') {
|
||||
// // Add a watermark for draft status
|
||||
// $dompdf->set_option('page_script', function ($pageNumber, $pageCount, $canvas) {
|
||||
// $canvas->text(20, 20, 'Draft');
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
// // Generate the PDF content (HTML) with data
|
||||
// $html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data]);
|
||||
|
||||
// // Load HTML into the DOMPDF instance
|
||||
// $dompdf->loadHtml($html);
|
||||
|
||||
// // Render PDF (first pass to get the number of pages)
|
||||
// $dompdf->render();
|
||||
|
||||
// // Output the PDF to the browser for download
|
||||
// $dompdf->stream('invoice_' . date('Y-m-d H-i-s') . '.pdf', array('Attachment' => 0));
|
||||
// }
|
||||
|
||||
public function print_address($id)
|
||||
{
|
||||
// Fetch the invoice data based on $id
|
||||
|
||||
@ -469,7 +469,7 @@ class Notifications extends BaseController
|
||||
|
||||
# Step 3: Replace the placeholder WINDOW_TIME with the user-provided value
|
||||
$modifiedQuery = str_replace('WINDOW_TIME', $window_time, $ExpCustomerDetail);
|
||||
|
||||
// print_r($modifiedQuery);die;
|
||||
if (empty($modifiedQuery)) {
|
||||
$this->logger->info('There is no sub query');
|
||||
return;
|
||||
@ -482,9 +482,11 @@ class Notifications extends BaseController
|
||||
$this->logger->info("There is no customer expiring on date:{$newDate}");
|
||||
return;
|
||||
}
|
||||
|
||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||
echo "Started.<br> Dated = ".$newDate." <br> There are ".count($queryResult)." persons <br>";
|
||||
foreach ($queryResult as $inx => $row) {
|
||||
$status = $row['status'];
|
||||
$userFirstName = $row['first_name'];
|
||||
$userLastName = $row['last_name'];
|
||||
$fullName = $userFirstName . ' ' . $userLastName;
|
||||
@ -496,7 +498,7 @@ class Notifications extends BaseController
|
||||
$this->logger->info('There is no subcription Name');
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($status === 'Approved') {
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||
if (count($emailTemplateName) && !empty($emailTemplateName)) {
|
||||
@ -558,8 +560,13 @@ class Notifications extends BaseController
|
||||
echo $history_msg."<br>";
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$this->logger->info("status is Draft");
|
||||
}
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL Closed
|
||||
|
||||
if ($status === 'Approved') {
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP
|
||||
$whatsappTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP);
|
||||
// print_r($whatsappTemplateName);die;
|
||||
@ -644,11 +651,17 @@ class Notifications extends BaseController
|
||||
echo "There is no Whatsapp template <br>";
|
||||
continue;
|
||||
}
|
||||
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP Closed
|
||||
}
|
||||
else{
|
||||
$this->logger->info("statsu is draft");
|
||||
}
|
||||
|
||||
# Loop Closed
|
||||
echo "Process Completed <br>";
|
||||
}
|
||||
}
|
||||
# getExpCustomerDetail fns Closed
|
||||
|
||||
################################################################
|
||||
|
||||
@ -96,11 +96,11 @@
|
||||
</div>
|
||||
<?php if ($invoice_type === '2') : ?>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="fromsubcription">From Subcription<span class="text-danger"> *</span></label>
|
||||
<label for="fromsubcription">From Subscription<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'] : '' ?>" required onchange="updateToDateMinDate(this.value)">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="tosubcription">To Subcription<span class="text-danger"> *</span></label>
|
||||
<label for="tosubcription">To Subscription<span class="text-danger"> *</span></label>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
|
||||
@ -233,13 +233,7 @@ td.invoice-number {
|
||||
<td><?= $item->quantity ?></td>
|
||||
<td>₹<?= number_format($item->unit_price, 2, '.', ',') ?></td>
|
||||
|
||||
<td>
|
||||
<?php if ($item->discount_type === '%') : ?>
|
||||
<?= $item->discount_amount ?>%
|
||||
<?php elseif ($item->discount_type === '₹') : ?>
|
||||
₹<?= number_format((float)$item->discount_amount, 2, '.', ',') ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td>₹<?= number_format($item->subtotal, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@ -73,7 +73,7 @@ $(document).ready(function() {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Experired Invoice Report',
|
||||
title: 'Expired Invoice Report',
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// Exclude the first and last columns
|
||||
|
||||
@ -271,48 +271,56 @@ $(document).ready(function () {
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Assuming you trigger the AJAX on the change event of the role dropdown
|
||||
$('#role').on('change', function () {
|
||||
var selectedRole = $(this).val();
|
||||
// ...
|
||||
|
||||
// Check if the selected role is "manager" before making the AJAX request
|
||||
if (selectedRole === 'manager') {
|
||||
var storedEventId = '<?= isset($details['event_id']) ? $details['event_id'] : '' ?>';
|
||||
// Assuming you trigger the AJAX on the change event of the role dropdown
|
||||
$('#role').on('change', function () {
|
||||
var selectedRole = $(this).val();
|
||||
var storedEventId = '<?= isset($details['event_id']) ? $details['event_id'] : '' ?>';
|
||||
|
||||
// Perform AJAX request to fetch event names based on the selected role
|
||||
$.ajax({
|
||||
url: "<?= base_url('users/fetch_event_names') ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
// Assuming your response has an array of event names
|
||||
var eventNames = data.eventNames;
|
||||
// Check if the selected role is "manager" before making the AJAX request
|
||||
if (selectedRole === 'manager') {
|
||||
// Perform AJAX request to fetch event names based on the selected role
|
||||
$.ajax({
|
||||
url: "<?= base_url('users/fetch_event_names') ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
// Assuming your response has an array of event names
|
||||
var eventNames = data.eventNames;
|
||||
|
||||
// Clear existing options and add the default option
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
// Clear existing options and add the default option
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
|
||||
// Add new options based on the fetched data
|
||||
for (var i = 0; i < eventNames.length; i++) {
|
||||
$('#event_id').append('<option value="' + eventNames[i].event_id + '">' + eventNames[i].event_name + '</option>');
|
||||
}
|
||||
|
||||
// Set the selected option based on the stored event ID
|
||||
if (storedEventId) {
|
||||
$('#event_id').val(storedEventId);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
// Add new options based on the fetched data
|
||||
for (var i = 0; i < eventNames.length; i++) {
|
||||
$('#event_id').append('<option value="' + eventNames[i].event_id + '">' + eventNames[i].event_name + '</option>');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Clear event names dropdown if the selected role is not "manager"
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger the change event initially to populate event names on page load
|
||||
$('#role').change();
|
||||
// Set the selected option based on the stored event ID
|
||||
if (storedEventId && $('#event_id option[value="' + storedEventId + '"]').length > 0) {
|
||||
// Set the stored event ID if it exists in the new options
|
||||
$('#event_id').val(storedEventId);
|
||||
} else {
|
||||
// Set the default "Select Event" option
|
||||
$('#event_id').val('');
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Clear event names dropdown if the selected role is not "manager"
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger the change event initially to populate event names on page load
|
||||
$('#role').change();
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user