Merge_changes

This commit is contained in:
VE10-Sanjeev 2024-11-25 09:53:36 +00:00
commit 720eb44025
15 changed files with 300 additions and 149 deletions

View File

@ -390,7 +390,6 @@ class Invoice extends BaseController
// Handle invoice creation or update
$invoice_id = $this->create_or_update_invoice($invoice_id, $msg_flag_name);
// Handle invoice items creation or update
$this->create_or_update_invoice_items($invoice_id);
$update_invoice_numbering = [
@ -433,17 +432,20 @@ public function create_or_update_invoice($invoice_id, $msg_flag_name)
$invoice_status = $this->request->getPost('status');
$customer_id = (int)$this->request->getPost('customer_name');
$invoiceType = $this->request->getPost('invoice_type');
// Prepare invoice data
$data = $this->prepare_invoice_data($invoice_id, $msg_flag_name);
// Insert or update invoice based on ID
if (empty($invoice_id)) {
$data['created_by'] = (int)get_logged_user_id();
if ($model->insert($data, 'invoices')) {
$invoice_id = $model->insertID();
session()->setFlashdata('success', $msg_flag_name . 'has been added successfully.');
$this->logger->info($msg_flag_name . ": Added successfully. ID = " . $invoice_id);
if($data['status'] == 'Approved'){
session()->setFlashdata('success', $msg_flag_name . 'has been added successfully.');
$this->logger->info($msg_flag_name . ": Added successfully. ID = " . $invoice_id);
}else{
session()->setFlashdata('success',$msg_flag_name . 'has been added to draft successfully');
}
} else {
session()->setFlashdata('error', $msg_flag_name . 'could not be added. Please try again.');
$this->logger->error($msg_flag_name . ": Could not be added.");
@ -535,22 +537,14 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$to_sub_date = $item['to_subscription'];
//check if membership id is already set for the customer
$membership = $subModel->check_existing_membership_id($customer_id);
//dd($membership);
if (count($membership)>0){
$member = (array)$membership[0];
//dd($member);
$membership_id = $member['membership_id'];
//dd($membership_id);
}
else{
$membership_id = $this->generate_membership_id(6);
// To check if the generated membership is already created for another customer
$result = $subModel->where('membership_id',$membership_id)->findAll();
if (count($result)>0){
$membership_id = $this->generate_membership_id(6);
}
}
// Prepare subscription data
$subscription_data = [
@ -943,7 +937,8 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$htmlFooter = '<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);
$mpdf->setHTMLFooter($htmlFooter);
// Generate the PDF content (HTML)
@ -1201,7 +1196,13 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$this->logger->info("Itemwise Report ");
}
$this->logger->info("'Membership Renewals Report'");
$data['page_name'] = 'Membership Renewals Report';
if (empty($data['selected_data'])){
//dd($data['selected_data']);
$data['page_name'] = 'Membership Renewals Report (30 days)';
}else{
list($fromDate, $toDate) = explode(" - ", $data['selected_data']);
$data['page_name'] = 'Membership Renewals Report - <br>(From '.$fromDate.' To '.$toDate.')';
}
$this->render_page('report_expired_customers', $data);
}
@ -1286,6 +1287,7 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$data['selected_data'] = $this->request->getVar('date');
}
$data['page_name'] = 'Received Payments Report';
log_message('info',json_encode($data));
$this->render_page('received_payments_report',$data);
}
public function itemwise_report_with_payment_method(){
@ -1309,8 +1311,7 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
}
$data['page_name'] = 'Sales By Books';
// var_dump($data);
// die();
// dd($data);
$this->render_page('itemwise_report_with_payment_method',$data);
}
@ -1586,7 +1587,6 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$product_id =(int)$requestData['item_details'][$x];
$from_sub_date = \DateTime::createFromFormat('d/m/Y', $requestData['from_subscription'])->format('Y-m-d');
$to_sub_date = \DateTime::createFromFormat('d/m/Y', $requestData['to_subscription'])->format('Y-m-d');
$subscription_data = [
'customer_id' => $customer_id,
'invoice_id' => $invoice_id,
@ -1616,7 +1616,7 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
$response['subscription']['message'] = 'Subscription There Is No Changes to Updated';
}
$response['success'] = true;
$response['message'] = "Successfully Updation";
$response['message'] = "Successfully Updated";
} catch (\Exception $e) {
$response['success'] = false;
$response['message'] = 'Error: ' . $e->getMessage();

View File

@ -74,10 +74,10 @@ class Payment extends BaseController
{
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$payment_method = preg_match('/mobile/i', $userAgent) ? "mobile" : 'website';
$data = $_POST;
$paramList = array();
$CUST_ID = (string) $this->request->getPost("CustomerID");
$ORDER_ID = (string) uniqid($CUST_ID . "_");
$ORDER_ID = (string) $this->request->getPost("membership_id");
$CHANNEL_ID = ($payment_method == "mobile") ? (string) env('Channel_ID_Mobile') : (string) env('Channel_ID_WEB');
$TXN_AMOUNT = (string) $this->request->getPost("amount");
@ -161,12 +161,15 @@ public function payment_success() {
helper('session');
helper('financial_year_helper');
$ORDER_ID = $this->request->getVar('ORDERID');
$parts = explode('_', $ORDER_ID);
$customer_id = (int)$parts[0];
$past_membership_id = $this->request->getVar('ORDERID');
$payment_method = $this->request->getVar('PAYMENTMODE');
$subModel = new SubscriptionModel();
$customer = $subModel->select('customer_id')->where('membership_id',$past_membership_id)->first();
$customer_id = $customer['customer_id'];
//dd($past_membership_id);
// $parts = explode('_', $ORDER_ID);
// $customer_id = (int)$parts[0];
$currentDate = date('Y-m-d');
// Assuming the model is used for database interactions
$bookModel = new BooksModel();
$model = new InvoiceModel();
$db = \Config\Database::connect();
@ -196,9 +199,11 @@ public function payment_success() {
'sub_total' => $amount,
'exact_total_amount' => $amount,
'grand_total' => $amount,
'total_amount' => $amount,
'invoice_date' => $currentDate,
'billing_address'=> $address['address_1'],
'billing_address_id' => isset($address['customer_address_id']) ? $address['customer_address_id'] : ''
'billing_address_id' => isset($address['customer_address_id']) ? $address['customer_address_id'] : '',
'payment_method' => $payment_method,
];
$model->save($data);
$update_invoice_numbering = [
@ -211,10 +216,20 @@ public function payment_success() {
// var_dump($update_invoice_numbering);die();
$save_invoice = new Invoice();
$save_invoice->update_number_formatting($update_invoice_numbering);
//get the invoice id to insert into the invoiceitems table
$invoice_id = $model->select('invoice_id')->where('invoice_number',$invoice_number)->first();
//var_dump($invoice_id['invoice_id']);die();
$fsubscription = $currentDate;
$tsubscription = date('Y-m-d', strtotime('+1 year', strtotime($currentDate)));
$previous_to_sub = $subModel->select('to_subscription')->where('customer_id',$customer_id)->where('membership_id',$past_membership_id)->first();
$new_subscription_date = $previous_to_sub['to_subscription'];
// Create a DateTime object from the existing subscription date
$date = new \DateTime($new_subscription_date);
// Add one day
$date->add(new \DateInterval('P1D'));
// Format the date (optional, if you need it in a specific format)
$fsubscription = $date->format('Y-m-d');
$tsubscription = date('Y-m-d', strtotime('+1 year', strtotime($fsubscription)));
$data['item_details'] = 3;
$requestData = [
'invoice_id' =>$invoice_id['invoice_id'],
@ -224,12 +239,15 @@ public function payment_success() {
'created_on'=>$currentDate,
'isactive'=>1,
'from_subscription' =>$fsubscription,
'to_subscription' =>$tsubscription
'to_subscription' =>$tsubscription,
];
$invoice = new Invoice();
$db->table('invoiceitems')->insert($requestData);
$model3 = new SubscriptionModel();
$membership_id = $model3->select('membership_id')->where('customer_id',$customer_id)->first();
$invoiceController = new Invoice();
$membership_id = $invoiceController->generate_membership_id(6);
//$membership_id = $model3->select('membership_id')->where('customer_id',$customer_id)->first();
// if ($membership_id<=0){
// $membership_id = $invoice->generate_membership_id(6);
// }
@ -242,7 +260,7 @@ public function payment_success() {
'is_renew' => 1,
'business_id'=>2,
'status' =>1,
'membership_id' =>$membership_id['membership_id']
'membership_id' =>$membership_id
];
$db->table('subscription')->insert($subscriptionData);

View File

@ -31,11 +31,11 @@ class Subscription extends BaseController
$data['invoice'] = $model->getSubscriptionInvoiceDetail($where);
$this->logger->info("Invoice: Listing Count ." . count($data['invoice']));
$data['active_schemes'] = $model->getActiveSchemes();
// $data['subscriber'] = $SubscriptionModel->where($where)->findAll();;
//dd($data);
$SubscriptionModel = new SubscriptionModel();
$swhere = ['subscription.business_id' => (int)$session_bid];
$data['subscriber'] = $SubscriptionModel->getAllSubscribersWithNames($swhere);
@ -174,7 +174,7 @@ public function download_details_by_hema()
$details =$subscriptionModel->getBothDetailsSchemeName($selectedScheme);
}
$customerDetails = array_merge($customerDetails, $details);
}

View File

@ -666,8 +666,28 @@ public function getPaymentReport($f_date = null, $t_date = null)
$builder->where('invoice.invoice_date >=', $f_date)
->where('invoice.invoice_date <=', $t_date);
}
$builder->where('invoice.status','Approved');
$query = $builder->get();
$results = $query->getResultArray();
$result1 = $query->getResultArray();
$builder->select('payment_method, SUM(exact_total_amount) as total_amount');
if ($f_date !== null && $t_date !== null) {
$builder->where('invoice.invoice_date >=', $f_date)
->where('invoice.invoice_date <=', $t_date);
}
$builder->groupBy('payment_method');
$query2 = $builder->get();
$paymentMethodTotals = $query2->getResultArray();
$paymentMethodMap = [];
foreach ($paymentMethodTotals as $row) {
$paymentMethodMap[$row['payment_method']] = $row['total_amount'];
}
$result2 = $paymentMethodMap;
// log_message('info',json_encode($results));
// dd($results);
$results = [
'result1'=>$result1,
'result2'=>$result2
];
return $results;
}
public function itemwise_report_data_with_payment_method($f_date = null, $t_date = null)
@ -769,6 +789,19 @@ public function updateInvoiceCancelStatus($invoiceIds, $cancelReason)
return $updated;
}
public function getActiveSchemes(){
$builder = $this->db->table($this->table.' as I' );
$builder->select('books.short_code');
$builder->join('subscription','subscription.invoice_id = I.invoice_id');
$builder->join('invoiceitems','invoiceitems.invoice_id = I.invoice_id');
$builder->join('books','invoiceitems.product = books.book_id');
$builder->groupBy('short_code');
$query = $builder->get();
$results = $query->getResultArray();
return $results;
}

View File

@ -91,7 +91,7 @@ public function getAllCustomerDetailsBySchemeName($schemeName)
// echo "addresses - Customer";
$currentDate = date('Y-m-d');
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name,customer_addresses.mobile_no, customer_addresses.address_1,customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code,business.title as business_name,business.address as business_address,business.city as business_city,business.state as business_state,business.postal_code as business_postal_code,books.title,from_subscription,to_subscription,business.title as business_name,business.mobile_no as business_mobile_no,states.state_name');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name,customer_addresses.mobile_no, customer_addresses.address_1,customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code,business.title as business_name,business.address as business_address,business.city as business_city,business.state as business_state,business.postal_code as business_postal_code,books.title,from_subscription,to_subscription,business.title as business_name,business.mobile_no as business_mobile_no,states.state_name','subscription.membership_id');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
$builder->join('customer_addresses', 'customer_addresses.customer_id = customers.customer_id AND customer_addresses.address_type = 2','left');
$builder->join('business', 'business.business_id = subscription.business_id');
@ -162,7 +162,7 @@ public function getAllExpiredCustomerDetailsByScheme($schemeName)
$currentDate = date('Y-m-d');
$builder = $this->db->table('subscription');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name, customer_addresses.mobile_no, customer_addresses.address_1, customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, business.title as business_name, books.title, from_subscription, to_subscription, business.mobile_no as business_mobile_no, states.state_name');
$builder->select('customers.customer_id, CONCAT(customers.first_name, " ", customers.last_name) as customer_name, customer_addresses.mobile_no, customer_addresses.address_1, customer_addresses.address_2, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, business.title as business_name, books.title, from_subscription, to_subscription, business.mobile_no as business_mobile_no, states.state_name','subscription.membership_id');
$builder->join('customers', 'customers.customer_id = subscription.customer_id');
$builder->join('customer_addresses', 'customer_addresses.customer_id = customers.customer_id And customer_addresses.address_type = 2','left');
$builder->join('business', 'business.business_id = subscription.business_id');
@ -227,7 +227,7 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
$builder->select("
CONCAT_WS(' ', c.first_name, c.last_name) as customer_name,
c.customer_id, c.mobile_no, c.email, DATEDIFF(s.to_subscription, CURDATE()) AS remaining_days,
s.from_subscription, s.to_subscription, s.scheme_id, bs.title, s.membership_id,s.sub_id,
s.from_subscription, s.to_subscription, s.scheme_id, bs.title, s.membership_id,s.sub_id,bs.title,
i.invoice_id, i.invoice_date, i.shipping_address_id,
ca.customer_address_id, ca.address_1, ca.address_2, ca.city, ca.state, ca.postal_code, ca.address_type, st.state_name,
b.title as business_name, b.address as business_address, b.city as business_city,
@ -294,6 +294,7 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
'invoice_id' => $row['invoice_id'],
'invoice_date' => $row['invoice_date'],
'customer_name' => $row['customer_name'],
'membership_id' =>$row['membership_id'],
'from_subscription' => $row['from_subscription'],
'address_1' => $row['address_1'],
'address_2' => $row['address_2'],
@ -365,6 +366,7 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
$builder = $this->db->table('subscription');
$builder->select('membership_id');
$builder->where('customer_id', $customer_id);
$builder->where('isactive',1);
$builder->orderBy('sub_id', 'DESC');
$builder->limit(1);
$output = $builder->get()->getResult();

View File

@ -1570,7 +1570,7 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
$(".subscribedetails").show(); // Change this line to use the class selector
let message = "No Earlier Membership found";
//$("#schemeName").text(message);
// showAlert(message); // kannan sir tolded no membership founded means don't show the alert dated on 21/nov/2024 evening
//showAlert(message)
}
},
error: function() {

View File

@ -198,15 +198,15 @@
<b>BILLING TO :</b><br>
<b><?= isset($value->customer_biller_name) && trim($value->customer_biller_name) !== '' ? $value->customer_biller_name : $value->customer_name ?></b><br>
<?php if ($value->customer_bill_address && ($value->baddr_id !== null || $value->baddr_id !== '')) { ?>
<?= $value->customer_bill_address ? $value->customer_bill_address . " ," : "" ?><br>
<?= $value->customer_bill_address ? $value->customer_bill_address . "," : "" ?><br>
<?= $value->customer_bill_city ? $value->customer_bill_city : "" ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_bill_postal_code ? " - " . $value->customer_bill_postal_code : ""; ?>
<?= $value->customer_bill_country ? $value->customer_bill_country . "." : $value->bcountry ?><br>
<?php } else if ($value->baddr_id === null || $value->baddr_id === '') {
echo $value->billing_address ? '<p style="white-space: pre-line">' . $value->billing_address . '</p>' : '';
} ?>
<?= $value->bmobile ? "Phone : +91" . $value->bmobile . " ." : ($value->mobile_no ? "Phone : +91" . $value->mobile_no . " ." : "") ?><br>
<?= $value->bemail ? "Email : " . $value->bemail . " ." : ($value->email ? "Email : " . $value->email . " ." : "" ) ?>
<?= $value->bmobile ? "Phone : +91" . $value->bmobile . "." : ($value->mobile_no ? "Phone : +91" . $value->mobile_no . "." : "") ?><br>
<?= $value->bemail ? "Email : " . $value->bemail . "." : ($value->email ? "Email : " . $value->email . "." : "" ) ?>
<?php endforeach; ?>
</td>
@ -215,15 +215,15 @@
<b>SHIPPING TO :</b><br>
<b><?= isset($value->customer_shipper_name) && trim($value->customer_shipper_name) !== '' ? $value->customer_shipper_name : $value->customer_name ?></b><br>
<?php if ($value->customer_ship_address && ($value->saddr_id !== null || $value->saddr_id !== '')) { ?>
<?= $value->customer_ship_address ? $value->customer_ship_address . " ," : "" ?><br>
<?= $value->customer_ship_address ? $value->customer_ship_address . "," : "" ?><br>
<?= $value->customer_ship_city ? $value->customer_ship_city : "" ?>&nbsp;<?= $value->customer_ship_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_ship_postal_code ? " - " . $value->customer_ship_postal_code : ""; ?>
<?= $value->customer_ship_country ? $value->customer_ship_country . "." : $value->scountry ?><br>
<?php } else if ($value->saddr_id === null || $value->saddr_id === '') {
echo $value->shipping_address ? '<p style="white-space: pre-line">' . $value->shipping_address . '</p>' : '';
} ?>
<?= $value->smobile ? "Phone : +91" . $value->smobile . " ." : "" ?><br>
<?= $value->semail ? "Email : " . $value->semail . " ." : "" ?>
<?= $value->smobile ? "Phone : +91" . $value->smobile . "." : "" ?><br>
<?= $value->semail ? "Email : " . $value->semail . "." : "" ?>
<?php endforeach; ?>
</td>

View File

@ -48,7 +48,7 @@
<td style="text-align: left;"><?= $book->book_name ?></td>
<td style="text-align: left;"><?= $book->item_count ?></td>
<td style="text-align: right;"><?= number_format($book->total_cost, 2) ?></td>
<td style="text-align: left;"><?= $row->payment_method ?></td>
<td style="text-align: center;"><?= strtoupper($row->payment_method) ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>

View File

@ -67,9 +67,11 @@
<div class="invoice">
<div class="bill-details">
<!-- <div style="margin-bottom:5px;">To:</div> -->
<?= $customerDetails[$i]['customer_name'] ?>
<?= isset($customerDetails[$i]['membership_id']) ? '('.$customerDetails[$i]['membership_id'].')' : "" ?>
<br>
<?= $customerDetails[$i]['customer_name'] ?>
<?= $customerDetails[$i]['membership_id'] ?><br>
<?= $customerDetails[$i]['address_1'] ?>,<br>
<?php if (!empty($customerDetails[$i]['address_2'])) : ?>
<?= $customerDetails[$i]['address_2'] ?>,<br>

View File

@ -1,11 +1,48 @@
<!-- start page title -->
<div class="row">
<div class="col-md-4">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?= $page_name ?></h4>
<style>
/* Styling for the card layout */
/* Styling for the card layout */
.nav {
display: flex; /* Flex layout for horizontal alignment */
flex-wrap: wrap; /* Allow cards to wrap if needed */
gap: 10px; /* Adds spacing between cards */
justify-content: flex-start; /* Align cards to the left */
padding: 5px; /* Add padding around the card section */
margin-bottom: 10px; /* Space below the cards */
list-style: none; /* Remove bullet points from the list */
}
.card-summary {
flex: 0 1 auto; /* Prevents cards from shrinking or growing too much */
padding: 8px; /* Reduced inner padding for compact size */
text-align: center; /* Center-align card content */
border: 1px solid #ddd; /* Border for the card */
border-radius: 5px; /* Slightly rounded corners */
background-color: #f9f9f9; /* Light background color */
width: 190px; /* Compact card width */
height: 50px; /* Adjusted height for compactness */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
font-size: 0.85rem; /* Slightly smaller font size for compactness */
display: flex; /* Flex layout for alignment */
align-items: center; /* Vertically center content */
justify-content: center; /* Horizontally center content */
}
.card-summary span {
font-size: 0.9rem; /* Adjusted font size */
font-weight: 500; /* Medium font weight */
color: #333; /* Darker color for better readability */
}
</style>
<!-- start page title -->
<div class="row">
<div class="col-md-4">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?= $page_name ?></h4>
</div>
</div>
</div>
<div class="offset-md-3 col-md-5">
<div class="offset-md-3 col-md-5">
<form action="<?php echo base_url('received_payments_report'); ?>" method="post">
<div class="form-group">
<div class="row">
@ -18,9 +55,48 @@
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div>
<ul class="nav">
<!-- Card 1 -->
<li>
<div class="card-summary"<?= isset($payment_data['result2']['UPI'])?'':'hidden'?>>
<span>UPI - <?= isset($payment_data['result2']['UPI'])?$payment_data['result2']['UPI']:''?></span>
</div>
</li>
<!-- Card 2 -->
<li>
<div class="card-summary" <?= isset($payment_data['result2']['cash'])?'':'hidden'?>>
<span>CASH - <?= isset($payment_data['result2']['cash'])?$payment_data['result2']['cash']:''?></span>
</div>
</li>
<!-- Card 3 -->
<li>
<div class="card-summary" <?= isset($payment_data['result2']['debit'])?'':'hidden'?>>
<span>DEBIT CARD - <?= isset($payment_data['result2']['debit'])?$payment_data['result2']['debit']:''?></span>
</div>
</li>
<!-- Card 4 -->
<li>
<div class="card-summary" <?= isset($payment_data['result2']['credit'])?'':'hidden'?>>
<span>CREDIT CARD - <?= isset($payment_data['result2']['credit'])?$payment_data['result2']['credit']:''?></span>
</div>
</li>
<!-- Card 5 -->
<li>
<div class="card-summary" <?= isset($payment_data['result2']['banktransfer'])?'':'hidden'?>>
<span>BANK TRANSFER - <?= isset($payment_data['result2']['banktransfer'])?$payment_data['result2']['banktransfer']:''?></span>
</div>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
@ -38,20 +114,29 @@
</tr>
</thead>
<tbody>
<?php foreach ($payment_data as $row) { ?>
<?php $total = 0; // Initialize total variable ?>
<?php foreach ($payment_data['result1'] as $row) { ?>
<tr>
<td style="text-align: left;"><?php echo $row["invoice_number"]; ?></td>
<?php $unixTime = strtotime($row['invoice_date']);
$invoice_date = date("d/m/Y", $unixTime);?>
<td><?= $invoice_date ?></td>
<td style="text-align: left;"><?= $row['first_name'] ?></td>
<td><?= $row['payment_method']?></td>
<td style="text-align: center;"><?= strtoupper($row['payment_method'])?></td>
<td><?= $row['payment_status'] ?></td>
<td style="text-align: right;"><?= $row['total_amount'] ?></td>
<td style="text-align: right;"><?= $row['total_amount'] ?></td>
<?php
$total += $row['total_amount']; // Add each row's total_amount to $total
?>
</tr>
<?php } ?>
<!-- Total row -->
</tbody>
<tr>
<td colspan="5" style="text-align: right; font-weight: bold;">Total Amount</td>
<td style="text-align: right;"><?= isset($total) ? $total : "" ?></td>
</tr>
</table>
</div>
</div> <!-- end card body-->
@ -60,88 +145,89 @@
</div>
<!-- end row-->
<script>
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [
{
extend: 'print',
title: 'Itemwise Report',
text: 'Print',
customize: function (win) { }
},
{
extend: 'csv',
text: 'CSV',
title: 'Itemwise Report',
exportOptions: {}
}
]
});
});
</script>
<!-- <script>
$(document).ready(function () {
// Initially hide all nested tables
$('.nested-table-data').hide();
// Toggle nested table visibility on parent row click
$('.custom-tbody tr').click(function () {
var nestedTable = $(this).next().find('.nested-table-data');
// Toggle visibility
nestedTable.slideToggle();
// You can add additional styling or animation here if needed
// Prevent the parent row from triggering the toggle when nested table row is clicked
return false;
});
});
</script> -->
<script>
$(document).ready(function() {
var $select_data = '<?php echo $selected_data; ?>';
var dateRangeFilter = $('input.input-daterange-datepicker')
.daterangepicker({
locale: {
format: 'DD/MM/YYYY',
cancelLabel: 'Clear'
<script>
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [
{
extend: 'print',
title: 'Itemwise Report',
text: 'Print',
customize: function (win) { }
},
startDate: $select_data ? moment($select_data.split(' - ')[0], 'DD/MM/YYYY') : moment(),
endDate: $select_data ? moment($select_data.split(' - ')[1], 'DD/MM/YYYY') : moment(),
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'This Month': [moment().startOf('month'), moment().endOf('month')]
{
extend: 'csv',
text: 'CSV',
title: 'Itemwise Report',
exportOptions: {}
}
})
.on('apply.daterangepicker', function(ev, picker) {
var formattedStartDate = picker.startDate.format('DD/MM/YYYY');
var formattedEndDate = picker.endDate.format('DD/MM/YYYY');
var selectedDateRange = formattedStartDate + ' - ' + formattedEndDate;
$(this).val(selectedDateRange);
})
.on('cancel.daterangepicker', function() {
$(this).val('');
]
});
});
</script>
<!-- <script>
$(document).ready(function () {
// Initially hide all nested tables
$('.nested-table-data').hide();
// Toggle nested table visibility on parent row click
$('.custom-tbody tr').click(function () {
var nestedTable = $(this).next().find('.nested-table-data');
// Toggle visibility
nestedTable.slideToggle();
// You can add additional styling or animation here if needed
// Prevent the parent row from triggering the toggle when nested table row is clicked
return false;
});
});
</script> -->
<script>
$(document).ready(function() {
var $select_data = '<?php echo $selected_data; ?>';
var dateRangeFilter = $('input.input-daterange-datepicker')
.daterangepicker({
locale: {
format: 'DD/MM/YYYY',
cancelLabel: 'Clear'
},
startDate: $select_data ? moment($select_data.split(' - ')[0], 'DD/MM/YYYY') : moment(),
endDate: $select_data ? moment($select_data.split(' - ')[1], 'DD/MM/YYYY') : moment(),
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'This Month': [moment().startOf('month'), moment().endOf('month')]
}
})
.on('apply.daterangepicker', function(ev, picker) {
var formattedStartDate = picker.startDate.format('DD/MM/YYYY');
var formattedEndDate = picker.endDate.format('DD/MM/YYYY');
var selectedDateRange = formattedStartDate + ' - ' + formattedEndDate;
$(this).val(selectedDateRange);
})
.on('cancel.daterangepicker', function() {
$(this).val('');
});
$('.today-btn').on('click', function() {
var today = moment();
dateRangeFilter.data('daterangepicker').setStartDate(today);
dateRangeFilter.data('daterangepicker').setEndDate(today);
dateRangeFilter.val(today.format('DD/MM/YYYY') + ' - ' + today.format('DD/MM/YYYY'));
dateRangeFilter.trigger('apply.daterangepicker');
});
$('.today-btn').on('click', function() {
var today = moment();
dateRangeFilter.data('daterangepicker').setStartDate(today);
dateRangeFilter.data('daterangepicker').setEndDate(today);
dateRangeFilter.val(today.format('DD/MM/YYYY') + ' - ' + today.format('DD/MM/YYYY'));
dateRangeFilter.trigger('apply.daterangepicker');
// Trigger "Today" button click to set it as default if $select_data is empty
if ($select_data === '') {
$('.today-btn').trigger('click');
}
});
// Trigger "Today" button click to set it as default if $select_data is empty
if ($select_data === '') {
$('.today-btn').trigger('click');
}
});
</script>
</script>

View File

@ -1,6 +1,6 @@
<!-- start page title -->
<div class="row">
<div class="col-md-4">
<div style="max-width: max-content;" class="col-md-4">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"><?= $page_name ?></h4>
</div>

View File

@ -73,7 +73,7 @@
<td style="text-align: center;"><?php echo $row->item_count; ?></td>
<td><?php echo ($row->invoice_type == 1) ? 'Book' : 'Membership'; ?></td>
<td><?php echo $row->status; ?></td>
<td><?php echo $row->payment_method; ?></td>
<td style="text-align: center;"><?php echo strtoupper($row->payment_method); ?></td>
<td style="text-align: right;"><?php echo number_format($row->discount, 2, '.', ','); ?></td>
<td style="text-align: right;"><?php echo number_format($row->shipping_charge, 2, '.', ','); ?></td>
<td style="text-align: right;"><?php echo $row->tax ? $row->tax : '0.00'; ?></td>

View File

@ -48,7 +48,7 @@
<td style="text-align: left;"><?= $row['event_name'] ?></td>
<td style="text-align: left;"><?= $row['first_name']?></td>
<td style="text-align: center;"><?= $row['books_sold'] ?></td>
<td style="text-align: left;"><?= $row['payment_method']?></td>
<td style="text-align: center;"><?= strtoupper($row['payment_method'])?></td>
<td style="text-align: right;"><?= $row['total_amount'] ?></td>
</tr>
<?php } ?>

View File

@ -136,16 +136,23 @@
// foreach ($subscriber as $scheme) :
// if (!in_array($scheme['title'], $uniqueSchemes)) {
// $uniqueSchemes[] = $scheme['title'];
//log_message('info',json_encode($membershipbooks));
if (!empty($membershipbooks)) :
if(!empty($active_schemes)):
foreach ($membershipbooks as $scheme) :
foreach($active_schemes as $active):
if ($scheme->short_code == $active['short_code']):
?>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="selected_schemes[]" value="<?= $scheme->book_ids; ?>">
<input class="form-check-input" type="checkbox" name="selected_schemes[]" value="<?= $scheme->book_ids; ?>"checked>
<label class="form-check-label"><?= $scheme->short_code; ?></label>
</div>
<?php
endif;
endforeach;
endforeach;
endif;
endif;
?>
</div>
</div>

View File

@ -34,7 +34,7 @@
}
.subscription-status {
font-size: 0.85rem;
color: #6c757d;
}
.hidden-details {
margin-top: 10px;
@ -50,6 +50,9 @@
<body>
<div class="container">
<div class="card">
<div class="logo">
<img src="public/uploads/Vijayabharatham_withname_1.png"/><br><br>
</div>
<div class="card-header text-center">
<h4 class="mb-1">Subscription Renewal</h4>
</div>
@ -57,7 +60,7 @@
<div class="card-body">
<form action="<?= base_url('pay') ?>" method="post">
<div class="form-group">
<label for="membership_id">Membership ID</label>
<label style="font-size: 1.25rem; " for="membership_id">Membership ID</label>
<input type="text" value="<?= isset($membership_id) && ($membership_id != null) ? $membership_id : '' ?>" class="form-control" id="membership_id" name="membership_id" placeholder="Enter your Membership ID" required>
</div>
<input type="hidden" id="amount" name = 'amount' value = "<?=isset($amount)?$amount: ''?>">
@ -91,7 +94,7 @@
</div>
<div class="footer">
<p>&copy; 2023 - 2024 Vijayabharatham Prasuram. All rights reserved.</p>
<p>&copy; 2024 - 2025 Vijayabharatham Prasuram. All rights reserved.</p>
</div>
<!-- AJAX Script -->