Live Issues addresses are not printing fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-04-02 19:00:10 +05:30
parent 85bf5336bc
commit da41a90bd9
10 changed files with 1401 additions and 1345 deletions

View File

@ -49,7 +49,7 @@ $routes->get('dashboard/', 'Home::index');
# Users Routes
$routes->get("user_list/", "Users::index");
$routes->get("user_page/(:any)", "Users::user_page/$1");
$routes->get("user_page/(:any)/(:any)", "Users::user_page/$1/$2");
$routes->post("insert_users", "Users::insert_users");
$routes->get('users/fetch_event_names', 'Users::fetch_event_names');

View File

@ -742,8 +742,10 @@ class ApiIntegration extends ResourceController
$billing_addr = NULL;$shipping_addr = NULL;
$lineitems_array = [];
$billing_array = []; $shipping_array = [];
$lineitems_subtotal = 0; $lineitems_tax = 0;
$lineitems_discount = 0; $lineitems_total=0;
$lineitems_subtotal = 0; ## for lineitem product wise price total
$lineitems_tax = 0; ## for lineitem product wise tax
$lineitems_discount = 0; ## for lineitem product wise discount
$lineitems_total=0; ## for lineitem grand total
// $line_items = ;
@ -794,7 +796,8 @@ class ApiIntegration extends ResourceController
}
}
$subtotal = (float)$lineitems_subtotal + (float)$records['shipping_total'];
// $subtotal = (float)$lineitems_subtotal + (float)$records['shipping_total'];
$subtotal = (float)$lineitems_subtotal;
$tax = $lineitems_tax + (float)$records['shipping_tax'];
$total = ($lineitems_total)+(float)$records['shipping_total'] + (float)$records['shipping_tax'];
$final_status = '';
@ -830,7 +833,8 @@ class ApiIntegration extends ResourceController
$invoice_data['subtotal']=(int)$subtotal;
$invoice_data['tax']=(int)$tax;
$invoice_data['discount']=(int)$lineitems_discount;
$invoice_data['total_amount']= $records['total'];
$invoice_data['total_amount']= round($records['total']);
$invoice_data['exact_total_amount']= (float)$records['total'];
$invoice_data['payment_status']=$records['status'];
$invoice_data['order_number']=$records['order_key'];
$invoice_data['payment_method']=$records['payment_method_title'];

View File

@ -10,6 +10,7 @@ use App\Helpers\NotificationHelper;
use Mpdf\Mpdf;
use Dompdf\Dompdf;
class Invoice extends BaseController
{
## For Invoice Listing..
@ -174,7 +175,8 @@ class Invoice extends BaseController
return $address_details;
}
public function get_customer_membership($category,$id){
public function get_customer_membership($category, $id)
{
$model = new InvoiceModel();
$result = $model->getMembershipListForCustomer($category, $id);
return $result;
@ -266,7 +268,6 @@ class Invoice extends BaseController
session()->setFlashdata('error', $msg_flag_name . 'could not be added. Please try again.');
$this->logger->error($msg_flag_name . ": Err Occur could not be added. Please try again.");
}
} else {
$data['updated_by'] = (int)get_logged_user_id();
if ($model->update($invoice_id, $data)) {
@ -290,7 +291,8 @@ class Invoice extends BaseController
'business_id' => (int)get_business_id(),
'updated_by' => get_logged_user_id()
];
$this->update_number_formatting($update_invoice_numbering);}
$this->update_number_formatting($update_invoice_numbering);
}
## For Invoice Item Details Insert/Update..
$this->save_invoice_item($invoice_id, $requestData, (int)$this->request->getVar('product'));
@ -326,8 +328,7 @@ class Invoice extends BaseController
$get_subscription_draft_dtl_id = $model->deleteSubscriptionDraftDetails($get_subscription_draft_dtl_where, get_logged_user_id());
$this->logger->info($msg_flag_name . ": has been Deleted. Inv ID = " . implode(", ", $get_subscription_draft_dtl_id));
// $subscriptionModel->insertSubscriptionData($subscription_data);
}
else{
} else {
// Check if there is a draft entry for the customer_id and scheme_id
$get_subscription_draft_dtl_where = [
'S.customer_id' => $customer_id,
@ -353,7 +354,6 @@ class Invoice extends BaseController
$this->logger->info($msg_flag_name . ": in " . $invoice_status . ". ID = " . $invoice_id);
$this->approve_notifications((int)$invoice_id);
}
} catch (\Exception $e) {
$this->logger->error($msg_flag_name . ": Err Occur =" . $e->getMessage());
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
@ -531,7 +531,8 @@ class Invoice extends BaseController
// Redirect back to the invoice list
return redirect()->route('offline_invoice');
}
public function subscription_inactive(){
public function subscription_inactive()
{
$model = new InvoiceModel();
$details = $model->subscription_inactive();
$now = date('d-m-Y');
@ -598,7 +599,6 @@ class Invoice extends BaseController
$business_postal_code = $rec['business_postal_code'];
$business_email = $rec['business_email'];
$business_mobile_no = $rec['business_mobile_no'];
}
$records['invoice_order_number'] = $reference_number;
$records['invoice_serial_number'] = $invoice_serial_number;
@ -622,8 +622,6 @@ class Invoice extends BaseController
foreach ($records['item'] as $inv) {
// print_r($item->title);die;
$lineitem_html .= '<p>' . $inv->title . ' x ' . $inv->quantity . ' => ' . $inv->subtotal . '</p>';
}
// print_r($title);die;
$records['subject'] = $invoice_serial_number . " - Approval Notification";
@ -684,11 +682,9 @@ $encodedUrl = urlencode($url);
$data = $model->getInvoiceData($id);
$invoiceItems = $model->getInvoiceItems($id, 'groupby');
foreach($invoiceItems as $index => $singleItem)
{
foreach ($invoiceItems as $index => $singleItem) {
$productImgs = $model->getProductImgs($singleItem->product);
$invoiceItems[$index]->imgs = $productImgs;
}
@ -714,7 +710,8 @@ $encodedUrl = urlencode($url);
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->autoScriptToLang = true;
// Set PDF properties
$mpdf->SetTitle('Invoice');
$mpdf->SetAuthor($data[0]->company_name);
@ -759,8 +756,7 @@ $encodedUrl = urlencode($url);
// print_r($data);die;
$invoiceItems = $model->getInvoiceItems($id, 'groupby');
foreach($invoiceItems as $index => $singleItem)
{
foreach ($invoiceItems as $index => $singleItem) {
$productImgs = $model->getProductImgs($singleItem->product);
$invoiceItems[$index]->imgs = $productImgs;
}
@ -901,16 +897,13 @@ $encodedUrl = urlencode($url);
public function general_membership_inv_rp()
{
if($this->request->getmethod() == 'get')
{
if ($this->request->getmethod() == 'get') {
$model = new InvoiceModel();
$data['report_data'] = $model->get_mem_invoice_data();
$this->logger->info("Membership Invoice Report ");
$data['page_name'] = 'Membership Invoice Report';
$this->render_page('report_mem_invoice', $data);
}
else
{
} else {
$dateParts = explode(' - ', $this->request->getVar('date'));
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
@ -928,13 +921,10 @@ $encodedUrl = urlencode($url);
public function expired_customer_report()
{
$model = new InvoiceModel();
if($this->request->getmethod() == 'get')
{
if ($this->request->getmethod() == 'get') {
$data['expired_customers'] = $model->getExpiredCustomers();
$data['selected_data'] = "";
}
else
{
} else {
$dateParts = explode(' - ', $this->request->getVar('date'));
$fromDate = $dateParts[0];
@ -953,16 +943,13 @@ $encodedUrl = urlencode($url);
public function itemwise_report()
{
if ($this->request->getmethod() == 'get')
{
if ($this->request->getmethod() == 'get') {
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data();
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Bookswise Report';
$this->render_page('report_itemwise', $data);
}
else
{
} else {
if ($this->request->getPost('export_csv')) {
// Handle CSV export
$this->exportCsv();
@ -1040,8 +1027,7 @@ private function exportCsv()
}
public function book_publishwise_Report()
{
if($this->request->getmethod() == 'get')
{
if ($this->request->getmethod() == 'get') {
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data_with_publish_code();
$data['selected_data'] = "";
@ -1049,9 +1035,7 @@ private function exportCsv()
$data['page_name'] = 'Books Published';
// print_r($data);die;
$this->render_page('report_book_publish', $data);
}
else
{
} else {
$dateParts = explode(' - ', $this->request->getVar('date'));
$fromDate = $dateParts[0];
@ -1065,7 +1049,6 @@ private function exportCsv()
$data['selected_data'] = $this->request->getVar('date');
$this->render_page('report_book_publish', $data);
}
}
@ -1131,8 +1114,7 @@ private function exportCsv()
$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>';
$htmlFooter = '<div ><img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png"style=margin-left:70px;/> </div>';
$mpdf->setHTMLFooter($htmlFooter);
// Generate the PDF content (HTML) with data
@ -1146,18 +1128,15 @@ private function exportCsv()
} else {
echo "no code works";
}
}
private function getInvoiceIdByMd5($md5Hash)
// private function getInvoiceIdByMd5($md5Hash)
// {
// // Assuming you have a table named 'invoices' with columns 'invoice_id' and 'md5_hash'
// $result = $this->db->table('invoices')->select('invoice_id')->where('md5_hash', $md5Hash)->get()->getRow();
// return $result ? $result->invoice_id : null;
// }
public function saveBook()
{
// Assuming you have a table named 'invoices' with columns 'invoice_id' and 'md5_hash'
$result = $this->db->table('invoices')->select('invoice_id')->where('md5_hash', $md5Hash)->get()->getRow();
return $result ? $result->invoice_id : null;
}
public function saveBook() {
// Retrieve book details from POST data
$bookName = $this->request->getPost('bookName');
$publication_date = $this->request->getPost('publication_date');
@ -1215,7 +1194,6 @@ public function updateInvoiceStatus()
$response['message'] = 'Failed to update invoice status.';
}
if ($updated) {
}
// Return the response as JSON
return $this->response->setJSON($response);
@ -1247,9 +1225,4 @@ public function updateInvoiceCancelStatus()
// Return the response as JSON
return $this->response->setJSON($response);
}
}

View File

@ -49,12 +49,13 @@ class Users extends BaseController
}
## To Load User Add/Update page
public function user_page($id)
public function user_page($id,$flag)
{
helper('session');
$session_role = get_user_role();
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
$data['dummy_flag'] = $flag; // for redirect purpose.
if ($id === '0') {
$this->logger->info("Users: In Add page");
$data['page_name'] = 'Add User';
@ -247,8 +248,13 @@ class Users extends BaseController
$this->logger->error("Users: Err Occur =".$e->getMessage());
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
}
// Redirect back to the user_page function or any other appropriate page
if($this->request->getPost('dummy_flag') == 1){
return redirect()->to(base_url("user_page/{$user_id}/1"));
}else{
return redirect()->route('user_list');
}
}
## For delete the user details (Which means inactive the details)
public function delete_user($id)

View File

@ -2,7 +2,10 @@
td .select2-container {
width: 249px !important;
}
.blueText{ color:blue !important; }
.blueText {
color: blue !important;
}
</style>
<?php $flag_name = $invoice_type === '1' ? " Books" : " Scheme"; ?>
<div class="row">
@ -29,14 +32,16 @@
<label for="customerName">Customer Name<span class="text-danger"> *</span></label>
<select class="form-control" id="customerName" name="customer_name" required data-toggle="select2" onchange="get_customer_billing_details(this.value); get_customer_membership_details(this.value)">
<option value="">Select a customer</option>
<?php if ($invoice_type === '1') { // invoice means Add new costomers; ?>
<?php if ($invoice_type === '1') { // invoice means Add new costomers;
?>
<option class="blueText" value="0"> + Add a customer</option>
<?php } ?>
<?php foreach ($customers as $customer) :
if ((int)$customer->isactive == 1) { ?>
<option value="<?= $customer->customer_id ?>"> <?= $customer->first_name . ' ' . $customer->last_name; ?>
</option>
<?php } endforeach; ?>
<?php }
endforeach; ?>
</select>
<?php } ?>
<div class="invalid-feedback"> Please select customer. </div>
@ -133,10 +138,15 @@
<option value="add_new_book">+ Add New Book</option>
<?php }foreach ($books as $book) : ?>
<?php }
foreach ($books as $book) : ?>
<?php $disabled = ((int)$book->isactive == 0) ? 'disabled' : ''; ?>
<option value="<?= $book->book_id ?>" <?php if (isset($ii_details['product']) && ($ii_details['product'] === $book->book_id)) echo "selected"; ?> <?= $disabled; ?>>
<?php if((int)$book->isactive == 0){ echo $book->title." (Disabled) ";}else{ echo $book->title; } ?></option>
<?php if ((int)$book->isactive == 0) {
echo $book->title . " (Disabled) ";
} else {
echo $book->title;
} ?></option>
<?php endforeach; ?>
</select></td>
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="<?= "quantity" . $inx; ?>" name="quantity[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['quantity']) ? $ii_details['quantity'] : '' ?>" min="1" />
@ -178,8 +188,10 @@
foreach ($books as $book) :
if ((int)$book->isactive === 1) : ?>
<option value="<?= $book->book_id ?>"><?= $book->title; ?></option>
<?php endif; endforeach; ?>
</select></td>
<?php endif;
endforeach; ?>
</select>
</td>
<td style="width:10%;"><input type="number" class="form-control item-quantity" id="quantity0" name="quantity[]" oninput="calculateInvoice(this,0)" min="1" />
</td>
<td style="width:10%;"><input type="text" class="form-control item-rate" id="rate0" name="rate[]" oninput="calculateInvoice(this,0)" /></td>
@ -296,6 +308,30 @@
</div>
</div>
</div>
<input type="hidden" id="status" name="status" value="<?= isset($invoice_details['status']) ? $invoice_details['status'] : 'Draft' ?>">
<input type="hidden" id="hiddenInvoiceId" name="invoice_id" placeholder="hidden for invoice id" value="<?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>" />
<div class="form-group text-right m-b-0">
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] == 'Approved') : ?>
<button type="button" class="btn btn-primary waves-effect mr-1" name="cancel" value="Cancel" id="cancelButton">Cancel</button>
<?php endif; ?>
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] !== 'Approved') : ?>
<!-- Show the "Save as Draft" button only if the status is not "Approved" -->
<button type="submit" class="btn btn-primary waves-effect mr-1" name="saveas" value="Draft" id="saveDraftButton">Save as Draft</button>
<button type="button" class="btn btn-primary waves-effect mr-1" name="void" value="Void" id="voidButton">Void</button>
<?php endif; ?>
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] !== 'Approved') : ?>
<!-- Show the "Save as Approved" button only if the status is not "Approved" -->
<button type="button" class="btn btn-primary waves-effect mr-1" name="saveas" value="Approved" id="saveApprovedButton">Save as Approved</button>
<?php endif; ?>
<input type="hidden" name="invoice_type" value="<?php echo ($page_name === 'Add Subscription Invoice Details' || $page_name === 'Edit Subscription Invoice Details') ? '2' : '1'; ?>">
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Payment Modal -->
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
@ -324,6 +360,7 @@
</div>
</div>
</div>
<!-- Customer Quick Add Modal -->
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
@ -347,11 +384,10 @@
<label for="cus_date_of_birth" class="col-form-label">Date Of Birth</label>
<input type="date" id="cus_date_of_birth" class="form-control" max="<?= date('Y-m-d', strtotime('-18 years')); ?>" placeholder="Date Of Birth" />
</div> -->
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="cus_email" class="col-form-label">Email<span class="text-danger"> *</span></label>
<label for="cus_email" class="col-form-label">Email</label>
<input type="text" class="form-control" id="cus_email" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cus_email')" />
<span id="emailValidationMessage"></span>
</div>
@ -366,111 +402,92 @@
</div>
<span id="mobileValidationMessage"></span>
</div>
</div>
<div class="form-row">
<!-- Address 1 -->
<div class="form-group col-md-6">
<label for="baddress1" class="col-form-label">Billing Address 1<span class="text-danger"> *</span></label>
<label for="baddress1" class="col-form-label">Billing Address 1</label>
<input type="text" class="form-control" id="baddress1" name="baddress1" placeholder="Address (eg : 1234 Main St)" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<!-- Address 2 -->
<div class="form-group col-md-6">
<label for="baddress2" class="col-form-label">Billing Address 2<span class="text-danger"> *</span></label>
<label for="baddress2" class="col-form-label">Billing Address 2</label>
<input type="text" class="form-control" id="baddress2" name="baddress2" placeholder="Address (eg : 1234 Main St)" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="bcountry" class="col-form-label">Country<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bcountry" name="bcountry" placeholder="Country" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="bstate" class="col-form-label">State<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bstate" name="bstate" placeholder="State" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">City<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bcity" name="bcity" placeholder="city" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="bpincode" class="col-form-label">Pincode<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bpincode" name="bpincode"minlength="6" maxlength="6" placeholder="Pincode" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="after-shipping-addr-add-more">
<div class="form-group">
<div class="form-row">
<!-- Shipping Address 1 -->
<div class="form-group col-md-6">
<label for="saddress1" class="col-form-label">Shipping Address 1<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="saddress1" name="saddress1" placeholder="Address (eg : 1234 Main St)" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<!-- Shipping Address 2 -->
<div class="form-group col-md-6">
<label for="saddress2" class="col-form-label">Shipping Address 2<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="saddress2" name="saddress2" placeholder="Address (eg : 1234 Main St)" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<!-- Country -->
<div class="form-group col-md-6">
<label for="scountry" class="col-form-label">Country<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="scountry" name="scountry" placeholder="Country" />
<div class="invalid-feedback"> Please provide. </div>
<label for="bcountry" class="col-form-label">Country</label>
<input type="text" class="form-control" id="bcountry" name="bcountry" placeholder="Country" />
</div>
<!-- State -->
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">State<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="sstate" name="sstate" placeholder="State" />
<div class="invalid-feedback"> Please provide. </div>
<label for="bstate" class="col-form-label">State</label>
<input type="text" class="form-control" id="bstate" name="bstate" placeholder="State" />
</div>
</div>
<div class="form-row">
<!-- City -->
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">City<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="scity" name="scity" placeholder="city" />
<div class="invalid-feedback"> Please provide. </div>
<label for="bcity" class="col-form-label">City</label>
<input type="text" class="form-control" id="bcity" name="bcity" placeholder="City" />
</div>
<!-- Pincode -->
<div class="form-group col-md-6">
<label for="spincode" class="col-form-label">Pincode<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="spincode" name="spincode"minlength="6" maxlength="6" placeholder="Pincode" />
<label for="bpincode" class="col-form-label">Pincode</label>
<input type="text" class="form-control" id="bpincode" name="bpincode" minlength="6" maxlength="6" placeholder="Pincode" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<!-- Checkbox for Copy -->
<div class="form-group col-md-12 text-right checkbox checkbox-purple">
<input type="checkbox" id="addressCopiedAsShipping" />
<label for="addressCopiedAsShipping"> Is the above address same as the shipping address?</label>
</div>
</div>
<div class="form-row">
<!-- Shipping Address 1 -->
<div class="form-group col-md-6">
<label for="saddress1" class="col-form-label">Shipping Address 1</label>
<input type="text" class="form-control" id="saddress1" name="saddress1" placeholder="Address (eg : 1234 Main St)" />
</div>
<!-- Shipping Address 2 -->
<div class="form-group col-md-6">
<label for="saddress2" class="col-form-label">Shipping Address 2</label>
<input type="text" class="form-control" id="saddress2" name="saddress2" placeholder="Address (eg : 1234 Main St)" />
</div>
</div>
<div class="form-row">
<!-- Country -->
<div class="form-group col-md-6">
<label for="scountry" class="col-form-label">Country</label>
<input type="text" class="form-control" id="scountry" name="scountry" placeholder="Country" />
</div>
<!-- State -->
<div class="form-group col-md-6">
<label for="sstate" class="col-form-label">State</label>
<input type="text" class="form-control" id="sstate" name="sstate" placeholder="State" />
</div>
</div>
<div class="form-row">
<!-- City -->
<div class="form-group col-md-6">
<label for="scity" class="col-form-label">City</label>
<input type="text" class="form-control" id="scity" name="scity" placeholder="City" />
</div>
<!-- Pincode -->
<div class="form-group col-md-6">
<label for="spincode" class="col-form-label">Pincode</label>
<input type="text" class="form-control" id="spincode" name="spincode" minlength="6" maxlength="6" placeholder="Pincode" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="closeCustomerModal">Close</button>
<button type="button" class="btn btn-primary save-invoice-customer" onclick="saveInvoiceCustomer()">Save Customer</button>
</div>
<!-- Country, State, City, Postal Code, etc. fields for Shipping Address -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="status" name="status" value="<?= isset($invoice_details['status']) ? $invoice_details['status'] : 'Draft' ?>">
<input type="hidden" id="hiddenInvoiceId" name="invoice_id" placeholder="hidden for invoice id" value="<?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>" />
<div class="form-group text-right m-b-0">
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] == 'Approved') : ?>
<button type="button" class="btn btn-primary waves-effect mr-1" name="cancel" value="Cancel" id="cancelButton">Cancel</button>
<?php endif; ?>
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] !== 'Approved') : ?>
<!-- Show the "Save as Draft" button only if the status is not "Approved" -->
<button type="submit" class="btn btn-primary waves-effect mr-1" name="saveas" value="Draft" id="saveDraftButton">Save as Draft</button>
<button type="button" class="btn btn-primary waves-effect mr-1" name="void" value="Void" id="voidButton">Void</button>
<?php endif; ?>
<?php if (!isset($invoice_details['status']) || $invoice_details['status'] !== 'Approved') : ?>
<!-- Show the "Save as Approved" button only if the status is not "Approved" -->
<button type="button" class="btn btn-primary waves-effect mr-1" name="saveas" value="Approved" id="saveApprovedButton">Save as Approved</button>
<?php endif; ?>
<input type="hidden" name="invoice_type" value="<?php echo ($page_name === 'Add Subscription Invoice Details' || $page_name === 'Edit Subscription Invoice Details') ? '2' : '1'; ?>">
</div>
</form>
</div>
</div>
</div>
</div>
@ -498,7 +515,6 @@
<!-- </div>
</div> -->
<!-- Reason for Cancel Modal -->
<div class="modal fade" id="cancelReasonModal" tabindex="-1" role="dialog" aria-labelledby="voidReasonModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
@ -579,7 +595,6 @@
</div>
<script>
var bookData = <?php echo json_encode($books); ?>;
@ -802,7 +817,6 @@ cell1.innerHTML=html;
}
</script>
<!-- JavaScript for removing a row from the table -->
@ -967,8 +981,7 @@ cell1.innerHTML=html;
}));
});
$("#storeShippingAddress").val('');
}
else{
} else {
$("#editAddressesCheckbox").prop("checked", true);
$("#storeBillingAddress").prop("readonly", false);
}
@ -1044,8 +1057,6 @@ cell1.innerHTML=html;
}
});
}
</script>
<!-- bill_addr = "<?= isset($invoice_details['billing_address']) ? $invoice_details['billing_address'] : ""; ?>"; -->
<!-- if (bill_addr != '') { $("#storeBillingAddress").val(bill_addr);} -->
@ -1062,8 +1073,7 @@ cell1.innerHTML=html;
// Set the status field to 'Draft' before submitting
document.getElementById('status').value = 'Approved';
}
else{
} else {
// Prevent the form submission
// document.getElementById('paymentMode').focus();
alert("Choose Your payment Mode ");
@ -1214,6 +1224,7 @@ cell1.innerHTML=html;
validationMessage.style.color = "red";
}
}
function checkExisting(inputvalue, fieldname, elementid) {
spanid = elementid == 'cus_email' ? "emailValidationMessage" : "mobileValidationMessage";
var validationMessage = document.getElementById(spanid);
@ -1239,6 +1250,7 @@ cell1.innerHTML=html;
}
});
}
function restriction(event) {
var charCode = event.which || event.keyCode;
if ((charCode >= 48 && charCode <= 57)) {
@ -1268,11 +1280,7 @@ cell1.innerHTML=html;
var sstate = document.getElementById("sstate").value;
var scity = document.getElementById("scity").value;
var szip = document.getElementById("spincode").value;
if (
!cus_first_name || !cus_last_name || !cus_email || !cus_mobile_no ||
!baddress1 || !baddress2 || !bcountry || !bstate || !bcity || !bzip ||
!saddress1 || !saddress2 || !scountry || !sstate || !scity || !szip
) {
if (!cus_first_name || !cus_last_name || !cus_mobile_no) {
alert("Please fill in all required fields.");
return;
}
@ -1404,7 +1412,6 @@ $(document).ready(function() {
});
});
});
</script>
<script>
// JavaScript code to handle voiding invoice and submitting reason
@ -1452,7 +1459,6 @@ $(document).ready(function() {
});
});
});
</script>
@ -1495,7 +1501,6 @@ $(document).ready(function() {
});
});
});
</script>
<script>
$(document).ready(function() {
@ -1549,4 +1554,33 @@ $(document).ready(function() {
console.log('Save as Approved button clicked');
});
});
$("#addressCopiedAsShipping").on("change", function() {
if ($(this).is(":checked")) {
var customerAddress1 = $("#baddress1").val();
var customerAddress2 = $("#baddress2").val();
var customerCountry = $("#bcountry").val();
var customerState = $("#bstate").val();
var customerCity = $("#bcity").val();
var customerPostalCode = $("#bpincode").val();
$("#saddress1").val(customerAddress1).prop("readonly", false);
$("#saddress2").val(customerAddress2).prop("readonly", false);
$("#scountry").val(customerCountry).prop("readonly", false);
$("#sstate").val(customerState).prop("readonly", false);
$("#scity").val(customerCity).prop("readonly", false);
$("#spincode").val(customerPostalCode).prop("readonly", false);
} else {
// Clear the billing address fields when the checkbox is unchecked
$("#saddress1").val("").prop("readonly", false);
$("#saddress2").val("").prop("readonly", false);
$("#scountry").val("").prop("readonly", false);
$("#sstate").val("").prop("readonly", false);
$("#scity").val("").prop("readonly", false);
$("#spincode").val("").prop("readonly", false);
}
});
</script>

View File

@ -1,23 +1,28 @@
<style>
/* CSS for modal content */
#pdfPreviewModal .modal-dialog {
max-width: 210mm; /* A5 width */
max-width: 210mm;
/* A5 width */
width: auto;
margin: 1.75rem auto;
}
#pdfPreviewModal .modal-body {
font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
}
.table-responsive {
font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 12px;
}
#printPdfButton .ri-printer-line {
font-size: 8px;
}
.modal-lg, .modal-xl {
.modal-lg,
.modal-xl {
max-width: 678px;
}
</style>
@ -171,8 +176,13 @@
$(document).ready(function() {
var actionColumnIndex = $('#action-column').index();
$('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [ [0, "desc"] ], // 4 is the column index of "created_on" in your table
"columnDefs": [{ "targets": [actionColumnIndex], "orderable": false }]
"order": [
[0, "desc"]
], // 4 is the column index of "created_on" in your table
"columnDefs": [{
"targets": [actionColumnIndex],
"orderable": false
}]
});
});
</script>
@ -212,7 +222,6 @@
}
});
});
</script>
<script>
// JavaScript click event handler for printing PDF
@ -241,5 +250,3 @@
});
});
</script>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
@ -8,19 +9,22 @@
font-family: 'Times New Roman', Times, sans-serif;
font-size: 12px; /* Change this value to your desired font size */
font-size: 12px;
/* Change this value to your desired font size */
}
/* Style for the main table with border */
table.main-table {
width: 100%;
border-collapse: collapse;
border: -0.5px solid black; /* Add a border around the entire invoice */
border: -0.5px solid black;
/* Add a border around the entire invoice */
}
table.main-table th,
table.main-table td {
border: none; /* Remove borders from all cells inside the main table */
border: none;
/* Remove borders from all cells inside the main table */
padding: 8px;
}
@ -41,7 +45,8 @@
}
img.business-logo {
max-width: 200px; /* Adjust the size of the logo */
max-width: 200px;
/* Adjust the size of the logo */
}
/* Style for the business name */
@ -71,7 +76,8 @@
}
/* Style for the billing and shipping addresses */
.billing-address, .shipping-address {
.billing-address,
.shipping-address {
width: 50%;
}
@ -83,9 +89,11 @@
table.invoice-related-table th,
table.invoice-related-table td {
border: none; /* Remove borders from all cells in the invoice items table */
border: none;
/* Remove borders from all cells in the invoice items table */
padding: 8px;
text-align: center; /* Center-align text in cells */
text-align: center;
/* Center-align text in cells */
}
table.invoice-related-table th {
@ -94,10 +102,12 @@ table.invoice-related-table th {
}
/* Style for the business stamp and terms */
.business-stamp, .terms {
.business-stamp,
.terms {
text-align: center;
margin-top: 20px;
}
.subtotal-table {
width: 100%;
margin-top: 20px;
@ -106,12 +116,14 @@ table.invoice-related-table th {
.subtotal-table table {
width: 100%;
border-collapse: collapse;
border: 1px solid black; /* Add a border around the subtotal table */
border: 1px solid black;
/* Add a border around the subtotal table */
}
.subtotal-table th,
.subtotal-table td {
border: none; /* Remove borders from cells inside the subtotal table */
border: none;
/* Remove borders from cells inside the subtotal table */
padding: 8px;
text-align: right;
}
@ -122,19 +134,25 @@ table.invoice-related-table th {
}
.subtotal-table td:last-child {
font-weight: bold; /* Make the last column (total values) bold */
font-weight: bold;
/* Make the last column (total values) bold */
}
td.invoice-number {
font-size: 18px; /* Increase font size to your desired value */
font-size: 18px;
/* Increase font size to your desired value */
/* Highlight background color */
font-weight: bold; /* Make the text bold */
font-weight: bold;
/* Make the text bold */
}
p {
margin-top: 0;
margin-bottom: 0rem;
}
</style>
</head>
<body>
<table class="main-table">
<tr>
@ -201,25 +219,30 @@ p {
<td class="billing-address">
<?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br>
<?= $value->customer_ship_address." ," ?><br>
<?= $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>
<?= $value->mobile_no." ." ?>
<?php endforeach; ?>
<?php if($value->customer_bill_address){ ?>
<?= $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>
<?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php }else{
echo $value->billing_address;
echo "<br>";
echo $value->mobile_no ? $value->mobile_no." ." : ""; } endforeach; ?>
</td>
<td class="shipping-address">
<?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br>
<?= $value->customer_bill_address." ," ?><br>
<?= $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>
<?= $value->mobile_no." ." ?>
<?php endforeach; ?>
<?php if($value->customer_ship_address){ ?>
<?= $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>
<?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php }else{
echo $value->shipping_address;
echo "<br>";
echo $value->mobile_no ? $value->mobile_no." ." : ""; } endforeach; ?>
</td>
</tr>
</table>
@ -306,11 +329,13 @@ p {
<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>
<br>
<p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p>
<?php } ?>
<?php foreach ($invoiceTerms as $row) :
if (!empty($row->terms)) { ?>
<br><pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">
<br>
<pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">
<?= $row->terms ?>
</pre>
<?php }
@ -328,4 +353,5 @@ p {
</body>
</html>

View File

@ -70,7 +70,7 @@
</div>
<!-- item-->
<a href="<?= base_url()."user_page/".$loggedin_person_id; ?>" class="dropdown-item notify-item">
<a href="<?= base_url()."user_page/".$loggedin_person_id."/1"; ?>" class="dropdown-item notify-item">
<i class="ri-account-circle-line"></i>
<span>My Account</span>
</a>

View File

@ -42,7 +42,7 @@
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
</div>
<div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label>
<label for="role" class="col-form-label" id="role_label">Role<span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required>
<option value="">Select Role</option>
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
@ -126,6 +126,7 @@
<?php } ?>
</div>
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
<input type="hidden" id="dummy_flag" name="dummy_flag" placeholder="hidden for dummy flag redirect purpose" value="<?= isset($dummy_flag) ? $dummy_flag : '' ?>" />
<?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
@ -250,6 +251,11 @@
<!-- Modify the existing JavaScript code -->
<script>
$(document).ready(function () {
var flag_for_validations = "<?= isset($dummy_flag) ? $dummy_flag : '' ?>";
if (flag_for_validations == '1') {
$('#role_label').html('Role');
$('#role').removeAttr("required").prop('disabled', true);
}
// Function to show/hide the event name container based on the selected role
function toggleEventNameContainer() {
var selectedRole = $('#role').val();

View File

@ -3,7 +3,7 @@
<div class="card">
<div class="card-body">
<div class="float-right">
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
<a href="<?= base_url()."user_page/0/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
@ -52,7 +52,7 @@
$class = 'badge badge-soft-danger';
$message = 'In-Active';
}
$edit_page_route = base_url()."user_page/".$row['user_id'];
$edit_page_route = base_url()."user_page/".$row['user_id']."/0";
$addressParts = array(
$row['address'],
$row['city'],