Live Issues addresses are not printing fixes : ps
This commit is contained in:
parent
85bf5336bc
commit
da41a90bd9
@ -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');
|
||||
|
||||
|
||||
@ -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'];
|
||||
|
||||
@ -10,6 +10,7 @@ use App\Helpers\NotificationHelper;
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
use Dompdf\Dompdf;
|
||||
|
||||
class Invoice extends BaseController
|
||||
{
|
||||
## For Invoice Listing..
|
||||
@ -22,10 +23,10 @@ class Invoice extends BaseController
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Invoice: Listing In Admin BID = " . $session_bid);
|
||||
$where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1,'I.invoice_type'=>1];
|
||||
$where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1, 'I.invoice_type' => 1];
|
||||
} else {
|
||||
$this->logger->info("Invoice: Listing In the Super-Admin ");
|
||||
$where = ['I.business_id != ' => NULL, 'I.isactive != ' => NULL,'I.invoice_type'=>1];
|
||||
$where = ['I.business_id != ' => NULL, 'I.isactive != ' => NULL, 'I.invoice_type' => 1];
|
||||
}
|
||||
|
||||
$model = new InvoiceModel();
|
||||
@ -46,10 +47,10 @@ class Invoice extends BaseController
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Invoice: Listing In Admin BID = " . $session_bid);
|
||||
$where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1,'I.invoice_type'=>1];
|
||||
$where = ['I.business_id' => (int)$session_bid, 'I.isactive' => 1, 'I.invoice_type' => 1];
|
||||
} else {
|
||||
$this->logger->info("Invoice: Listing In the Super-Admin ");
|
||||
$where = ['I.business_id != ' => NULL, 'I.isactive != ' => NULL,'I.invoice_type'=>1];
|
||||
$where = ['I.business_id != ' => NULL, 'I.isactive != ' => NULL, 'I.invoice_type' => 1];
|
||||
}
|
||||
|
||||
$model = new InvoiceModel();
|
||||
@ -87,10 +88,10 @@ class Invoice extends BaseController
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info("Book Invoice: In Edit Details ID =" . $id);
|
||||
$data['page_name'] = 'Edit Book Invoice Details';
|
||||
$data['invoice_type'] ='1';
|
||||
$data['invoice_type'] = '1';
|
||||
$data['invoice_details'] = $model->where(['invoice_id' => $id, 'isactive' => 1])->first();
|
||||
$select = ["customer_address_id", "CONCAT(address_1,' ',address_2) as address"];
|
||||
$where = ['address_type'=>2,'customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$data['invoice_details']['customer_id']];
|
||||
$where = ['address_type' => 2, 'customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$data['invoice_details']['customer_id']];
|
||||
$data['customer_shipping_arr'] = $this->get_customer_address($where, $select);
|
||||
$data['invoice_item_details'] = $this->get_invoice_item($id);
|
||||
}
|
||||
@ -114,16 +115,16 @@ class Invoice extends BaseController
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Subscription Invoice: In Add Page");
|
||||
$data['page_name'] = 'Add Subscription Invoice Details';
|
||||
$data['invoice_type'] ='2';
|
||||
$data['invoice_type'] = '2';
|
||||
$data['invoice_details'] = [];
|
||||
$data['invoice_item_details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info("Subscription Invoice: In Edit Page ID =" . $id);
|
||||
$data['page_name'] = 'Edit Subscription Invoice Details';
|
||||
$data['invoice_type'] ='2';
|
||||
$data['invoice_type'] = '2';
|
||||
$data['invoice_details'] = $model->where(['invoice_id' => $id, 'isactive' => 1])->first();
|
||||
$select = ["customer_address_id", "CONCAT(address_1,' ',address_2) as address"];
|
||||
$where = ['address_type'=>2,'customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$data['invoice_details']['customer_id']];
|
||||
$where = ['address_type' => 2, 'customer_addresses.isactive' => 1, 'customer_addresses.customer_id' => (int)$data['invoice_details']['customer_id']];
|
||||
$data['customer_shipping_arr'] = $this->get_customer_address($where, $select);
|
||||
$data['invoice_item_details'] = $this->get_invoice_item($id);
|
||||
}
|
||||
@ -135,7 +136,7 @@ class Invoice extends BaseController
|
||||
public function get_customer_membership_details()
|
||||
{
|
||||
$customer_id = $this->request->getPost('customer_id');
|
||||
$data['customer_membership'] = $this->get_customer_membership("membership",(int)$customer_id);
|
||||
$data['customer_membership'] = $this->get_customer_membership("membership", (int)$customer_id);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
|
||||
@ -168,15 +169,16 @@ class Invoice extends BaseController
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('customer_addresses');
|
||||
if (empty($select)) {
|
||||
$select = ["customer_addresses.customer_id","customer_addresses.customer_address_id","customer_addresses.first_name","customer_addresses.last_name ","customer_addresses.company","customer_addresses.email","customer_addresses.mobile_no","customer_addresses.address_type","customer_addresses.address_1","customer_addresses.address_2","customer_addresses.city","customer_addresses.state","customer_addresses.postal_code","customer_addresses.country","states.state_name","countries.country_name"];
|
||||
$select = ["customer_addresses.customer_id", "customer_addresses.customer_address_id", "customer_addresses.first_name", "customer_addresses.last_name ", "customer_addresses.company", "customer_addresses.email", "customer_addresses.mobile_no", "customer_addresses.address_type", "customer_addresses.address_1", "customer_addresses.address_2", "customer_addresses.city", "customer_addresses.state", "customer_addresses.postal_code", "customer_addresses.country", "states.state_name", "countries.country_name"];
|
||||
}
|
||||
$address_details = $model->select($select)->join('states', 'states.state_short_name = customer_addresses.state AND customer_addresses.country = "IN"', 'left')->join('countries', 'countries.country_short_name = customer_addresses.country', 'left')->where($where)->findAll();
|
||||
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);
|
||||
$result = $model->getMembershipListForCustomer($category, $id);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ class Invoice extends BaseController
|
||||
}
|
||||
// $now = date('Y-m-d');
|
||||
// $get_exists_subscription_where = ['S.customer_id' => (int)$customer_id,'S.scheme_id' => $scheme_id,'I.status' => 'Approved','I.isactive' => 1,"S.to_subscription <= "=>$now];
|
||||
$get_exists_subscription_where = ['S.customer_id' => (int)$customer_id,'S.scheme_id' => $scheme_id,'I.status' => 'Approved','I.isactive' => 1];
|
||||
$get_exists_subscription_where = ['S.customer_id' => (int)$customer_id, 'S.scheme_id' => $scheme_id, 'I.status' => 'Approved', 'I.isactive' => 1];
|
||||
$get_exists_subscription_dtls = $model->existsSubscriptionDetails($get_exists_subscription_where);
|
||||
|
||||
if ($get_exists_subscription_dtls) {
|
||||
@ -227,13 +229,13 @@ class Invoice extends BaseController
|
||||
## Array Formation For Invoice Details..
|
||||
$data = [
|
||||
'invoice_number' => $this->request->getPost('invoice_number'),
|
||||
'invoice_type'=> $this->request->getPost('invoice_type'),
|
||||
'invoice_type' => $this->request->getPost('invoice_type'),
|
||||
'customer_id' => $customer_id,
|
||||
'billing_address_id' => (int)$this->request->getPost('billing_address_id'),
|
||||
'billing_address' => $this->request->getPost('billing_address'),
|
||||
'shipping_address_id' => (int)$this->request->getPost('shipping_address_id'),
|
||||
'shipping_address' => $this->request->getPost('shipping_address'),
|
||||
'notes'=>$this->request->getPost('notes'),
|
||||
'notes' => $this->request->getPost('notes'),
|
||||
'invoice_date' => (!empty($invdate)) ? date("Y-m-d", strtotime($invdate)) : NULL,
|
||||
'due_date' => (!empty($duedate)) ? date("Y-m-d", strtotime($duedate)) : NULL,
|
||||
'subtotal' => (float)$this->request->getPost('sub_total'),
|
||||
@ -246,7 +248,7 @@ class Invoice extends BaseController
|
||||
'order_number' => $this->request->getPost('order_number'),
|
||||
'payment_method' => $invoice_status !== 'Draft' ? $this->request->getPost('payment_method') : NULL, // "Credit Card," "Cash on Delivery," "PayPal","PayTm","Gpay"
|
||||
'payment_status' => 'Pending', //"Paid," "Pending," "Failed," "Refunded," "Canceled," "Authorized," and "Completed."
|
||||
'payment_note'=> $this->request->getPost('payment_note'),
|
||||
'payment_note' => $this->request->getPost('payment_note'),
|
||||
'event_id' => (int)$this->request->getPost('event_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'status' => $invoice_status,
|
||||
@ -258,30 +260,29 @@ class Invoice extends BaseController
|
||||
$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.": has been added successfully. Inserted ID = " . $invoice_id);
|
||||
session()->setFlashdata('success', $msg_flag_name . 'has been added successfully.');
|
||||
$this->logger->info($msg_flag_name . ": has been added successfully. Inserted ID = " . $invoice_id);
|
||||
// If it's a subscription invoice, also store data in the 'subscription' table
|
||||
|
||||
} else {
|
||||
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.");
|
||||
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)) {
|
||||
// echo $model->getLastQuery();die;
|
||||
session()->setFlashdata('success', $msg_flag_name.'has been updated successfully.');
|
||||
$this->logger->info($msg_flag_name.": has been updated successfully. Updated ID = " . $invoice_id);
|
||||
session()->setFlashdata('success', $msg_flag_name . 'has been updated successfully.');
|
||||
$this->logger->info($msg_flag_name . ": has been updated successfully. Updated ID = " . $invoice_id);
|
||||
} else {
|
||||
session()->setFlashdata('error', $msg_flag_name.'update failed. Please try again.');
|
||||
$this->logger->error($msg_flag_name.": Err Failed to update ID =" . $invoice_id);
|
||||
session()->setFlashdata('error', $msg_flag_name . 'update failed. Please try again.');
|
||||
$this->logger->error($msg_flag_name . ": Err Failed to update ID =" . $invoice_id);
|
||||
}
|
||||
}
|
||||
|
||||
$requestData = $this->request->getPost();
|
||||
|
||||
if($this->request->getPost('next_id')){
|
||||
if ($this->request->getPost('next_id')) {
|
||||
## Array Formation For Invoice Numbering Format Details..
|
||||
$update_invoice_numbering = [
|
||||
'id' => 1,
|
||||
@ -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'));
|
||||
@ -313,21 +315,20 @@ class Invoice extends BaseController
|
||||
'customer_id' => (int)$customer_id,
|
||||
'invoice_id' => $invoice_id,
|
||||
'scheme_id' => $product_id,
|
||||
'from_subscription'=>$from_sub_date,
|
||||
'to_subscription'=> $to_sub_date,
|
||||
'from_subscription' => $from_sub_date,
|
||||
'to_subscription' => $to_sub_date,
|
||||
'business_id' => get_business_id(),
|
||||
'created_by' =>get_logged_user_id(),
|
||||
'created_by' => get_logged_user_id(),
|
||||
'is_renew' => $renewal
|
||||
];
|
||||
if ($invoice_status == 'Draft') {
|
||||
$get_subscription_draft_dtl_where = ['S.customer_id'=>$customer_id,'I.status'=>$invoice_status];
|
||||
$get_subscription_draft_dtl_where = ['S.customer_id' => $customer_id, 'I.status' => $invoice_status];
|
||||
// $get_subscription_draft_dtl_id = $model->InactiveSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
|
||||
// $this->logger->info($msg_flag_name.": has been Inactived. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
|
||||
$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));
|
||||
$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,
|
||||
@ -348,14 +349,13 @@ class Invoice extends BaseController
|
||||
|
||||
|
||||
## Notification For Approve..
|
||||
$this->logger->info($msg_flag_name.": ID = " . $invoice_id.", Status =".$invoice_status);
|
||||
$this->logger->info($msg_flag_name . ": ID = " . $invoice_id . ", Status =" . $invoice_status);
|
||||
if ($invoice_status == 'Approved' && $invoice_id != "") {
|
||||
$this->logger->info($msg_flag_name.": in ".$invoice_status.". ID = " . $invoice_id);
|
||||
$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());
|
||||
$this->logger->error($msg_flag_name . ": Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ class Invoice extends BaseController
|
||||
$where = ['isactive' => 1, 'invoice_id' => (int)$id];
|
||||
// $model->inactiveMissingInvoiceItemDetails($where, $missingValues);
|
||||
$model->deleteMissingInvoiceItemDetails($where, $missingValues);
|
||||
$this->logger->info("Child Item Details : has been Deleted. Inv Child ID = ".implode(", ", $missingValues));
|
||||
$this->logger->info("Child Item Details : has been Deleted. Inv Child ID = " . implode(", ", $missingValues));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,7 +423,7 @@ class Invoice extends BaseController
|
||||
$invoiceitem_arr = [];
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
if(!empty($requestData['item_details'][$x])){
|
||||
if (!empty($requestData['item_details'][$x])) {
|
||||
$invoiceitem_arr[$x]['invoice_id'] = $id;
|
||||
$invoiceitem_arr[$x]['product'] = (int)$requestData['item_details'][$x];
|
||||
$invoiceitem_arr[$x]['quantity'] = (int)$requestData['quantity'][$x];
|
||||
@ -431,7 +431,7 @@ class Invoice extends BaseController
|
||||
$invoiceitem_arr[$x]['unit_price'] = (float)$requestData['rate'][$x];
|
||||
$invoiceitem_arr[$x]['subtotal'] = (float)$requestData['amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_amount'] = (float)$requestData['discount_amount'][$x];
|
||||
$invoiceitem_arr[$x]['discount_type'] =$requestData['discount_type'][$x];
|
||||
$invoiceitem_arr[$x]['discount_type'] = $requestData['discount_type'][$x];
|
||||
if (!empty($requestData['from_subscription'])) {
|
||||
$invoiceitem_arr[0]['from_subscription'] = $requestData['from_subscription'];
|
||||
}
|
||||
@ -531,25 +531,26 @@ 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');
|
||||
if(strtolower(gettype($details)) == "string"){
|
||||
if (strtolower(gettype($details)) == "string") {
|
||||
$this->logger->info("Subscription Inactive : " . $details);
|
||||
$result = $details ;
|
||||
}else{
|
||||
$this->logger->info("Subscription Inactive : " .count($details) . " Subscription Records ". json_encode($details));
|
||||
$success_rating = isset($details['success_rating'])?$details['success_rating']:0;
|
||||
$error_rating = isset($details['error_rating'])?$details['error_rating']:0;
|
||||
$result = "Total ". count($details) . " Subscription Records.\n success rating = ".$success_rating."\n fail rating = ".$error_rating ."\n Note : Check Your Log File";
|
||||
$result = $details;
|
||||
} else {
|
||||
$this->logger->info("Subscription Inactive : " . count($details) . " Subscription Records " . json_encode($details));
|
||||
$success_rating = isset($details['success_rating']) ? $details['success_rating'] : 0;
|
||||
$error_rating = isset($details['error_rating']) ? $details['error_rating'] : 0;
|
||||
$result = "Total " . count($details) . " Subscription Records.\n success rating = " . $success_rating . "\n fail rating = " . $error_rating . "\n Note : Check Your Log File";
|
||||
}
|
||||
return $now." ".$result;
|
||||
return $now . " " . $result;
|
||||
}
|
||||
|
||||
public function approve_notifications($invoice_id)
|
||||
{
|
||||
$this->logger->info("Approve Notifications : ID ".$invoice_id);
|
||||
$this->logger->info("Approve Notifications : ID " . $invoice_id);
|
||||
$model = new InvoiceModel();
|
||||
$where = ['I.business_id' => (int)get_business_id(), 'I.invoice_id' => $invoice_id, 'I.isactive' => 1];
|
||||
$details = $model->getDetailForApproveNotifications($where);
|
||||
@ -565,15 +566,15 @@ class Invoice extends BaseController
|
||||
$tax = "";
|
||||
$total_amount = "";
|
||||
$payment_method = "";
|
||||
$business_name= "";
|
||||
$business_address= "";
|
||||
$business_city= "";
|
||||
$business_state= "";
|
||||
$business_postal_code= "";
|
||||
$business_email= "";
|
||||
$business_mobile_no= "";
|
||||
$business_name = "";
|
||||
$business_address = "";
|
||||
$business_city = "";
|
||||
$business_state = "";
|
||||
$business_postal_code = "";
|
||||
$business_email = "";
|
||||
$business_mobile_no = "";
|
||||
if (isset($details)) {
|
||||
$this->logger->info("Invoice: approve notification Request data type = ".gettype($details));
|
||||
$this->logger->info("Invoice: approve notification Request data type = " . gettype($details));
|
||||
}
|
||||
helper('notification');
|
||||
$notification = new NotificationHelper();
|
||||
@ -587,18 +588,17 @@ class Invoice extends BaseController
|
||||
$recipient_mobile = $rec['customer_mobile'];
|
||||
$subtotal = $rec['subtotal'];
|
||||
$tax = $rec['tax'];
|
||||
$invoiceDate=$rec['invoice_date'];
|
||||
$invoiceDate = $rec['invoice_date'];
|
||||
|
||||
$total_amount = $rec['total_amount'];
|
||||
$payment_method = $rec['payment_method'];
|
||||
$business_name= $rec['business_name'];
|
||||
$business_address= $rec['business_address'];
|
||||
$business_city= $rec['business_city'];
|
||||
$business_state= $rec['business_state'];
|
||||
$business_postal_code= $rec['business_postal_code'];
|
||||
$business_email= $rec['business_email'];
|
||||
$business_mobile_no= $rec['business_mobile_no'];
|
||||
|
||||
$business_name = $rec['business_name'];
|
||||
$business_address = $rec['business_address'];
|
||||
$business_city = $rec['business_city'];
|
||||
$business_state = $rec['business_state'];
|
||||
$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;
|
||||
@ -618,12 +618,10 @@ class Invoice extends BaseController
|
||||
$records['template_name'] = 'approve_template';
|
||||
$records['item'] = $details['item'];
|
||||
// print_r($records['item']);die;
|
||||
$lineitem_html="";
|
||||
$lineitem_html = "";
|
||||
foreach ($records['item'] as $inv) {
|
||||
// print_r($item->title);die;
|
||||
$lineitem_html.='<p>'.$inv->title. ' x ' .$inv->quantity .' => ' .$inv->subtotal.'</p>';
|
||||
|
||||
|
||||
$lineitem_html .= '<p>' . $inv->title . ' x ' . $inv->quantity . ' => ' . $inv->subtotal . '</p>';
|
||||
}
|
||||
// print_r($title);die;
|
||||
$records['subject'] = $invoice_serial_number . " - Approval Notification";
|
||||
@ -658,8 +656,8 @@ class Invoice extends BaseController
|
||||
|
||||
// print_r($records['description']);die;
|
||||
$url = base_url("download_invoice_pdf/" . md5($invoice_id));
|
||||
$encodedUrl = urlencode($url);
|
||||
$template = "Dear " . $recipient_name . ",\r\r\n\nYour Invoice has been generated.\n\nDetails:\r\n- Invoice Date: " . $invoiceDate . "\r\n- Invoice Number: " . $invoice_serial_number . "\r\n- Click here to download the Invoice: " . base_url("download_invoice_pdf/" .$encodedUrl);
|
||||
$encodedUrl = urlencode($url);
|
||||
$template = "Dear " . $recipient_name . ",\r\r\n\nYour Invoice has been generated.\n\nDetails:\r\n- Invoice Date: " . $invoiceDate . "\r\n- Invoice Number: " . $invoice_serial_number . "\r\n- Click here to download the Invoice: " . base_url("download_invoice_pdf/" . $encodedUrl);
|
||||
|
||||
$params = (object) Null;
|
||||
$params->number = (int)'91' . $recipient_mobile;
|
||||
@ -667,10 +665,10 @@ $encodedUrl = urlencode($url);
|
||||
$params->message = $template;
|
||||
$params->instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$params->access_token = $_ENV['WAAI_TOKEN'];
|
||||
$this->logger->info("Approve notification Email Request data = ".json_encode($records));
|
||||
$this->logger->info("Approve notification Email Request data = " . json_encode($records));
|
||||
$email_result = $notification->sendEmail($records);
|
||||
$this->logger->info("Approve notification Email Response = " . json_encode($email_result));
|
||||
$this->logger->info("Approve notification Whatsapp Request data = ".json_encode($params));
|
||||
$this->logger->info("Approve notification Whatsapp Request data = " . json_encode($params));
|
||||
$whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
|
||||
$this->logger->info("Approve notification Whatsapp Response = " . json_encode($whatsapp_result));
|
||||
}
|
||||
@ -682,13 +680,11 @@ $encodedUrl = urlencode($url);
|
||||
// Fetch the invoice data based on $invoice_id
|
||||
$model = new InvoiceModel();
|
||||
$data = $model->getInvoiceData($id);
|
||||
$invoiceItems = $model->getInvoiceItems($id,'groupby');
|
||||
$invoiceItems = $model->getInvoiceItems($id, 'groupby');
|
||||
|
||||
foreach($invoiceItems as $index => $singleItem)
|
||||
{
|
||||
$productImgs= $model->getProductImgs($singleItem->product);
|
||||
foreach ($invoiceItems as $index => $singleItem) {
|
||||
$productImgs = $model->getProductImgs($singleItem->product);
|
||||
$invoiceItems[$index]->imgs = $productImgs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -708,19 +704,20 @@ $encodedUrl = urlencode($url);
|
||||
'margin_top' => 6,
|
||||
'margin_bottom' => 6,
|
||||
'margin_header' => 6,
|
||||
'margin_footer' =>-30,
|
||||
'margin_footer' => -30,
|
||||
'orientation' => 'P',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$mpdf->autoLangToFont = true; $mpdf->autoScriptToLang = true;
|
||||
$mpdf->autoLangToFont = true;
|
||||
$mpdf->autoScriptToLang = true;
|
||||
// Set PDF properties
|
||||
$mpdf->SetTitle('Invoice');
|
||||
$mpdf->SetAuthor($data[0]->company_name);
|
||||
$mpdf->SetCreator('');
|
||||
|
||||
$htmlFooter='<div >
|
||||
$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);
|
||||
|
||||
@ -743,8 +740,8 @@ $encodedUrl = urlencode($url);
|
||||
|
||||
|
||||
// Generate the PDF content (HTML) with data
|
||||
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'invoice_type' => $invoice_type,'invoiceTerms'=>$data]);
|
||||
// echo $html;die;
|
||||
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data]);
|
||||
// echo $html;die;
|
||||
// Load HTML into the mPDF instance
|
||||
$mpdf->WriteHTML($html);
|
||||
|
||||
@ -757,11 +754,10 @@ $encodedUrl = urlencode($url);
|
||||
$model = new InvoiceModel();
|
||||
$data = $model->getInvoiceData($id);
|
||||
// print_r($data);die;
|
||||
$invoiceItems = $model->getInvoiceItems($id,'groupby');
|
||||
$invoiceItems = $model->getInvoiceItems($id, 'groupby');
|
||||
|
||||
foreach($invoiceItems as $index => $singleItem)
|
||||
{
|
||||
$productImgs= $model->getProductImgs($singleItem->product);
|
||||
foreach ($invoiceItems as $index => $singleItem) {
|
||||
$productImgs = $model->getProductImgs($singleItem->product);
|
||||
$invoiceItems[$index]->imgs = $productImgs;
|
||||
}
|
||||
|
||||
@ -901,24 +897,21 @@ $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
|
||||
{
|
||||
$dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
} else {
|
||||
$dateParts = explode(' - ', $this->request->getVar('date'));
|
||||
$fromDate = $dateParts[0];
|
||||
$toDate = $dateParts[1];
|
||||
|
||||
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->get_mem_invoice_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$data['report_data'] = $model->get_mem_invoice_data($dateTime->format('Y-m-d'), $dateTime1->format('Y-m-d'));
|
||||
$this->logger->info("Membership Invoice Report ");
|
||||
$data['page_name'] = 'Membership Invoice Report';
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
@ -928,41 +921,35 @@ $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') );
|
||||
$dateParts = explode(' - ', $this->request->getVar('date'));
|
||||
$fromDate = $dateParts[0];
|
||||
$toDate = $dateParts[1];
|
||||
$dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['expired_customers'] = $model->getExpiredCustomers( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$data['expired_customers'] = $model->getExpiredCustomers($dateTime->format('Y-m-d'), $dateTime1->format('Y-m-d'));
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$this->logger->info("Itemwise Report ");
|
||||
}
|
||||
$this->logger->info("'Membership Renewals Report'");
|
||||
$data['page_name'] = 'Membership Renewals Report';
|
||||
$this->render_page('report_expired_customers', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function itemwise_report()
|
||||
{
|
||||
if ($this->request->getmethod() == 'get')
|
||||
public function itemwise_report()
|
||||
{
|
||||
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();
|
||||
@ -978,10 +965,10 @@ public function itemwise_report()
|
||||
$this->render_page('report_itemwise', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function exportCsv()
|
||||
{
|
||||
private function exportCsv()
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$reportData = $model->itemwise_report_data();
|
||||
|
||||
@ -997,7 +984,7 @@ private function exportCsv()
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add UTF-8 BOM to the CSV file
|
||||
fprintf($output, chr(0xEF).chr(0xBB).chr(0xBF));
|
||||
fprintf($output, chr(0xEF) . chr(0xBB) . chr(0xBF));
|
||||
|
||||
// Write the CSV headers
|
||||
fputcsv($output, ['Publisher Code', 'Book Name', 'Item Count', 'Total Cost']);
|
||||
@ -1026,22 +1013,21 @@ private function exportCsv()
|
||||
|
||||
// Terminate the script to prevent further output
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function calculateTotalBookQuantity(&$reportData)
|
||||
{
|
||||
{
|
||||
// Calculate the total book quantity for each publisher
|
||||
foreach ($reportData as &$row) {
|
||||
$totalBookQuantity = array_sum(array_column($row->books, 'quantity'));
|
||||
$row->total_book_quantity = $totalBookQuantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
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,58 +1035,55 @@ private function exportCsv()
|
||||
$data['page_name'] = 'Books Published';
|
||||
// print_r($data);die;
|
||||
$this->render_page('report_book_publish', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
} else {
|
||||
$dateParts = explode(' - ', $this->request->getVar('date'));
|
||||
$fromDate = $dateParts[0];
|
||||
|
||||
$toDate = $dateParts[1];
|
||||
$dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data_with_publish_code( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$data['report_data'] = $model->itemwise_report_data_with_publish_code($dateTime->format('Y-m-d'), $dateTime1->format('Y-m-d'));
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Books Published';
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$this->render_page('report_book_publish', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public function generate_invoice_pdf($id)
|
||||
// {
|
||||
// // Load the mPDF library
|
||||
// $mpdf = new \Mpdf\Mpdf();
|
||||
// public function generate_invoice_pdf($id)
|
||||
// {
|
||||
// // Load the mPDF library
|
||||
// $mpdf = new \Mpdf\Mpdf();
|
||||
|
||||
// // Fetch invoice data
|
||||
// $invoice = $this->find($id);
|
||||
// // Fetch invoice data
|
||||
// $invoice = $this->find($id);
|
||||
|
||||
// if ($invoice) {
|
||||
// // Fetch related invoice items
|
||||
// $invoiceItems = $this->getInvoiceItems($id);
|
||||
// if ($invoice) {
|
||||
// // Fetch related invoice items
|
||||
// $invoiceItems = $this->getInvoiceItems($id);
|
||||
|
||||
// // Create the HTML content for the PDF
|
||||
// $html = view('pdf/invoice_template', ['invoice' => $invoice, 'invoiceItems' => $invoiceItems]);
|
||||
// // Create the HTML content for the PDF
|
||||
// $html = view('pdf/invoice_template', ['invoice' => $invoice, 'invoiceItems' => $invoiceItems]);
|
||||
|
||||
// // Load HTML content into mPDF
|
||||
// $mpdf->WriteHTML($html);
|
||||
// // Load HTML content into mPDF
|
||||
// $mpdf->WriteHTML($html);
|
||||
|
||||
// // Set PDF filename
|
||||
// $pdfFileName = 'invoice_' . $invoice->invoice_number . '.pdf';
|
||||
// // Set PDF filename
|
||||
// $pdfFileName = 'invoice_' . $invoice->invoice_number . '.pdf';
|
||||
|
||||
// // Output the PDF for download
|
||||
// $mpdf->Output($pdfFileName, 'D');
|
||||
// }
|
||||
// }
|
||||
// // Output the PDF for download
|
||||
// $mpdf->Output($pdfFileName, 'D');
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function getInvoiceItems($invoiceId)
|
||||
// {
|
||||
// // Fetch invoice items related to the given invoice ID
|
||||
// return $this->db->table('invoice_items')->where('invoice_id', $invoiceId)->get()->getResult();
|
||||
// }
|
||||
// public function getInvoiceItems($invoiceId)
|
||||
// {
|
||||
// // Fetch invoice items related to the given invoice ID
|
||||
// return $this->db->table('invoice_items')->where('invoice_id', $invoiceId)->get()->getResult();
|
||||
// }
|
||||
|
||||
|
||||
// Fetch the invoice data based on $invoice_id
|
||||
@ -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
|
||||
@ -1143,21 +1125,18 @@ private function exportCsv()
|
||||
|
||||
// Output the PDF to the browser for download
|
||||
$mpdf->Output("invoice_" . date('Y-m-d H-i-s') . '.pdf', 'D');
|
||||
}else{
|
||||
} else {
|
||||
echo "no code works";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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() {
|
||||
}
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
// Retrieve book details from POST data
|
||||
$bookName = $this->request->getPost('bookName');
|
||||
$publication_date = $this->request->getPost('publication_date');
|
||||
@ -1188,13 +1167,13 @@ public function saveBook() {
|
||||
|
||||
// Send JSON response
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Your controller method to handle updating status and reason
|
||||
public function updateInvoiceStatus()
|
||||
{
|
||||
// Your controller method to handle updating status and reason
|
||||
public function updateInvoiceStatus()
|
||||
{
|
||||
// Retrieve data from the request
|
||||
$invoiceId = $this->request->getPost('invoice_id');
|
||||
$voidReason = $this->request->getPost('void_reason');
|
||||
@ -1215,13 +1194,12 @@ public function updateInvoiceStatus()
|
||||
$response['message'] = 'Failed to update invoice status.';
|
||||
}
|
||||
if ($updated) {
|
||||
|
||||
}
|
||||
// Return the response as JSON
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
public function updateInvoiceCancelStatus()
|
||||
{
|
||||
}
|
||||
public function updateInvoiceCancelStatus()
|
||||
{
|
||||
// Retrieve data from the request
|
||||
$invoiceIds = $this->request->getPost('invoice_id');
|
||||
$cancelReason = $this->request->getPost('cancel_reason');
|
||||
@ -1246,10 +1224,5 @@ public function updateInvoiceCancelStatus()
|
||||
|
||||
// Return the response as JSON
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
<style>
|
||||
td .select2-container{
|
||||
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">
|
||||
@ -15,7 +18,7 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<?php if (isset($invoice_details['customer_id']) && $invoice_details['customer_id'] != "" ) {
|
||||
<?php if (isset($invoice_details['customer_id']) && $invoice_details['customer_id'] != "") {
|
||||
$displayvalue = "";
|
||||
foreach ($customers as $customer) {
|
||||
if ($customer->customer_id === $invoice_details['customer_id']) {
|
||||
@ -24,19 +27,21 @@
|
||||
} ?>
|
||||
<label for="customerName">Customer Name</label>
|
||||
<input type="hidden" name="customer_name" value="<?= $invoice_details['customer_id']; ?>" />
|
||||
<input type="text" class="form-control" value="<?= $displayvalue ?>" readonly/>
|
||||
<input type="text" class="form-control" value="<?= $displayvalue ?>" readonly />
|
||||
<?php } else { ?>
|
||||
<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; ?>
|
||||
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>
|
||||
@ -87,7 +92,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoiceDate">Invoice Date<span class="text-danger"> *</span></label>
|
||||
<input type="date" class="form-control" id="invoiceDate" name="invoice_date" value="<?= isset($invoice_details['invoice_date']) ? $invoice_details['invoice_date'] : date('Y-m-d') ?>" max="<?= date('Y-m-d'); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<label for="invoiceDate">Invoice Date<span class="text-danger"> *</span></label>
|
||||
@ -129,14 +134,19 @@
|
||||
<tr>
|
||||
<td><select class="form-control book-select" id="<?= "book" . $inx; ?>bookSelect" name="item_details[]" onchange="displayBookTag(this,<?= $inx; ?>)" required data-toggle="select2" style="width: 249px !important;">
|
||||
<option value="">Select a <?= $flag_name; ?></option>
|
||||
<?php if($invoice_type === '1'){?>
|
||||
<?php if ($invoice_type === '1') { ?>
|
||||
|
||||
<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" />
|
||||
@ -147,7 +157,7 @@
|
||||
</td>
|
||||
<td style="width:12%;"><input type="number" class="form-control item-amount" id="<?= "amount" . $inx; ?>" name="amount[]" value="<?= isset($ii_details['subtotal']) ? $ii_details['subtotal'] : '' ?>" readonly />
|
||||
</td>
|
||||
<td style="width:12%;"><input type="number" class="form-control item-discount-amount" id="<?= "item_discount_amount" . $inx; ?>" name="discount_amount[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['discount_amount']) ? $ii_details['discount_amount'] : '' ?>" min="0" step="0.01"/>
|
||||
<td style="width:12%;"><input type="number" class="form-control item-discount-amount" id="<?= "item_discount_amount" . $inx; ?>" name="discount_amount[]" oninput="calculateInvoice(this,<?= $inx; ?>)" value="<?= isset($ii_details['discount_amount']) ? $ii_details['discount_amount'] : '' ?>" min="0" step="0.01" />
|
||||
|
||||
</td>
|
||||
<td style="width:10%;">
|
||||
@ -172,21 +182,23 @@
|
||||
<td style="width:30% !important;">
|
||||
<select class="form-control book-select" id="book0" name="item_details[]" onchange="displayBookTag(this,0)" required data-toggle="select2" style="width: 249px !important;">
|
||||
<option value="">Select a <?= $flag_name ?></option>
|
||||
<?php if($invoice_type === '1'){?>
|
||||
<?php if ($invoice_type === '1') { ?>
|
||||
<option value="add_new_book">+ Add New Book</option>
|
||||
<?php }
|
||||
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>
|
||||
<td style="width:8%;"><input type="text" class="form-control item-tax" id="tax0" name="tax[]" /></td>
|
||||
<td style="width:12%;"><input type="text" class="form-control item-amount" id="amount0" name="amount[]" />
|
||||
</td>
|
||||
<td class="discount-cell" style="width:12%;"><input type="number" class="form-control item-discount-amount" id="item_discount_amount0" name="discount_amount[]" oninput="calculateInvoice(this,0)" min="0" step="0.01"/>
|
||||
<td class="discount-cell" style="width:12%;"><input type="number" class="form-control item-discount-amount" id="item_discount_amount0" name="discount_amount[]" oninput="calculateInvoice(this,0)" min="0" step="0.01" />
|
||||
|
||||
</td>
|
||||
<td style="width:12%;">
|
||||
@ -250,7 +262,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<span style="<?= $shippingChargesStyle ?>">
|
||||
<label for="shippingChargesLabel">Charge Name </label>
|
||||
<input type="text" class="form-control" id="shippingChargesLabel" name="shippingChargesLabel" placeholder="Shipping Charges Label" value="<?= isset($invoice_details['shipping_label']) ? $invoice_details['shipping_label'] : 'Shipping Charge' ?>" oninput="calculateOverallTotals()" <?= $shippingChargesHidden ?> >
|
||||
<input type="text" class="form-control" id="shippingChargesLabel" name="shippingChargesLabel" placeholder="Shipping Charges Label" value="<?= isset($invoice_details['shipping_label']) ? $invoice_details['shipping_label'] : 'Shipping Charge' ?>" oninput="calculateOverallTotals()" <?= $shippingChargesHidden ?>>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
@ -296,7 +308,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true">
|
||||
<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">
|
||||
<div class="modal-header">
|
||||
@ -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,116 +402,97 @@
|
||||
</div>
|
||||
<span id="mobileValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="baddress1" class="col-form-label">Billing Address 1<span class="text-danger"> *</span></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>
|
||||
<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 -->
|
||||
<!-- 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>
|
||||
<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>
|
||||
<!-- Shipping Address 2 -->
|
||||
<!-- 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>
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<!-- 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-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>
|
||||
<!-- Reason for Void Modal -->
|
||||
<div class="modal fade" id="voidReasonModal" tabindex="-1" role="dialog" aria-labelledby="voidReasonModalLabel" aria-hidden="true">
|
||||
<!-- Reason for Void Modal -->
|
||||
<div class="modal fade" id="voidReasonModal" tabindex="-1" role="dialog" aria-labelledby="voidReasonModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -493,14 +510,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- </div>
|
||||
</div> -->
|
||||
</div> -->
|
||||
|
||||
|
||||
<!-- Reason for Cancel Modal -->
|
||||
<div class="modal fade" id="cancelReasonModal" tabindex="-1" role="dialog" aria-labelledby="voidReasonModalLabel" aria-hidden="true">
|
||||
<!-- 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">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -519,10 +535,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add Book Modal -->
|
||||
<div class="modal fade" id="addBookModal" tabindex="-1" role="dialog" aria-labelledby="addBookModalLabel" aria-hidden="true">
|
||||
<!-- Add Book Modal -->
|
||||
<div class="modal fade" id="addBookModal" tabindex="-1" role="dialog" aria-labelledby="addBookModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -541,7 +557,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bookPrice">Price<span class="text-danger"> *</span></label>
|
||||
<input type="number" class="form-control" id="bookPrice" name="bookPrice" required min="1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@ -564,7 +580,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publishers_code" class="col-form-label">Publisher Code<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Publisher Code"required />
|
||||
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Publisher Code" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -576,12 +592,11 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var bookData=<?php echo json_encode($books); ?>;
|
||||
var bookData = <?php echo json_encode($books); ?>;
|
||||
|
||||
localStorage.setItem('add_book_index', 0);
|
||||
document.querySelector("#itemTable tbody tr:first-child .remove-item").style.visibility = 'hidden';
|
||||
@ -605,15 +620,15 @@
|
||||
<option value="">Select a <?= $flag_name ?></option>
|
||||
<option value="add_new_book">+ Add New Book</option>`;
|
||||
|
||||
// Populate options from the bookArray
|
||||
bookArray.forEach(function(book) {
|
||||
// Populate options from the bookArray
|
||||
bookArray.forEach(function(book) {
|
||||
|
||||
html += `<option value="${book.book_id}">${book.title}</option>`;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
html += `</select>`;
|
||||
cell1.innerHTML=html;
|
||||
html += `</select>`;
|
||||
cell1.innerHTML = html;
|
||||
|
||||
// cell1.innerHTML = '<input type="text" class="form-control" name="item_details[]">';
|
||||
cell2.innerHTML = '<input type="number" class="form-control item-quantity" id="quantity' + counter + '" name="quantity[]" oninput="calculateInvoice(this,' + counter + ')" min="1">';
|
||||
@ -659,7 +674,7 @@ cell1.innerHTML=html;
|
||||
console.error("Selected book not found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function calculateInvoice(inputElement, counter) {
|
||||
@ -802,7 +817,6 @@ cell1.innerHTML=html;
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- JavaScript for removing a row from the table -->
|
||||
@ -853,7 +867,7 @@ cell1.innerHTML=html;
|
||||
}
|
||||
if (inv_number != '') {
|
||||
$("#invoiceNumber").val(inv_number).prop("readonly", true);
|
||||
}else{
|
||||
} else {
|
||||
var numbering_arr = <?php echo json_encode($invoice_number_formatting); ?>;
|
||||
// console.log(numbering_arr);
|
||||
var filtered_data = $.grep(numbering_arr, function(item) {
|
||||
@ -874,7 +888,7 @@ cell1.innerHTML=html;
|
||||
$('#hiddenBillingAddressId').val(0);
|
||||
} else {
|
||||
$("#storeBillingAddress").prop("readonly", true);
|
||||
if(global_billarr !== ""){
|
||||
if (global_billarr !== "") {
|
||||
$("#storeBillingAddress").val(global_billarr);
|
||||
$('#hiddenBillingAddressId').val(global_billid);
|
||||
}
|
||||
@ -913,9 +927,9 @@ cell1.innerHTML=html;
|
||||
// Billing ajax call
|
||||
function get_customer_billing_details(cust_id) {
|
||||
|
||||
if(cust_id == '0'){
|
||||
if (cust_id == '0') {
|
||||
$('#customerModal').modal('show');
|
||||
}else{
|
||||
} else {
|
||||
$('#editAddressesCheckbox').prop('checked', false);
|
||||
$("#storeBillingAddress").prop("readonly", false);
|
||||
$("#storeShippingAddress").prop("readonly", false);
|
||||
@ -942,15 +956,15 @@ cell1.innerHTML=html;
|
||||
if (cb.length > 0) {
|
||||
$.each(cb, function(k, v) {
|
||||
var state = v.state_name ? v.state_name : v.state;
|
||||
state = v.postal_code ? state+"-"+v.postal_code : state;
|
||||
v.address_1 ? customer_billing_addressDetails.push(v.address_1 + " " + v.address_2):"";
|
||||
v.city ? customer_billing_addressDetails.push(v.city):"";
|
||||
state ? customer_billing_addressDetails.push(state):"";
|
||||
v.country_name ? customer_billing_addressDetails.push(v.country_name) :"";
|
||||
state = v.postal_code ? state + "-" + v.postal_code : state;
|
||||
v.address_1 ? customer_billing_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
||||
v.city ? customer_billing_addressDetails.push(v.city) : "";
|
||||
state ? customer_billing_addressDetails.push(state) : "";
|
||||
v.country_name ? customer_billing_addressDetails.push(v.country_name) : "";
|
||||
customer_billing_id = v.customer_address_id;
|
||||
});
|
||||
}
|
||||
global_billarr = customer_billing_addressDetails.join(', \n')+".";
|
||||
global_billarr = customer_billing_addressDetails.join(', \n') + ".";
|
||||
global_billid = customer_billing_id;
|
||||
$("#storeBillingAddress").val(global_billarr).prop("readonly", true);
|
||||
$('#hiddenBillingAddressId').val(global_billid);
|
||||
@ -967,8 +981,7 @@ cell1.innerHTML=html;
|
||||
}));
|
||||
});
|
||||
$("#storeShippingAddress").val('');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$("#editAddressesCheckbox").prop("checked", true);
|
||||
$("#storeBillingAddress").prop("readonly", false);
|
||||
}
|
||||
@ -1000,15 +1013,15 @@ cell1.innerHTML=html;
|
||||
if (cs.length > 0) {
|
||||
$.each(cs, function(k, v) {
|
||||
var state = v.state_name ? v.state_name : v.state;
|
||||
state = v.postal_code ? state+"-"+v.postal_code : state;
|
||||
state = v.postal_code ? state + "-" + v.postal_code : state;
|
||||
v.address_1 ? customer_shipping_addressDetails.push(v.address_1 + " " + v.address_2) : "";
|
||||
v.city ? customer_shipping_addressDetails.push(v.city) : "";
|
||||
state ? customer_shipping_addressDetails.push(state) :"";
|
||||
v.country_name ? customer_shipping_addressDetails.push(v.country_name):"";
|
||||
state ? customer_shipping_addressDetails.push(state) : "";
|
||||
v.country_name ? customer_shipping_addressDetails.push(v.country_name) : "";
|
||||
customer_shipping_id = v.customer_address_id;
|
||||
});
|
||||
}
|
||||
$("#storeShippingAddress").val(customer_shipping_addressDetails.join(', \n')+".").prop("readonly", true);
|
||||
$("#storeShippingAddress").val(customer_shipping_addressDetails.join(', \n') + ".").prop("readonly", true);
|
||||
},
|
||||
error: function() {
|
||||
alert("Error fetching address.");
|
||||
@ -1017,7 +1030,7 @@ cell1.innerHTML=html;
|
||||
}
|
||||
|
||||
// membership ajax call
|
||||
function get_customer_membership_details(cust_id){
|
||||
function get_customer_membership_details(cust_id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'get_customer_membership_details' ?>",
|
||||
@ -1033,7 +1046,7 @@ cell1.innerHTML=html;
|
||||
text1 = cm[0].is_renew == 1 ? " - Renewal" : "";
|
||||
text2 = cm[0].isactive == 0 ? " - Expried" : "";
|
||||
$(".subscribedetails").show(); // Change this line to use the class selector
|
||||
$("#schemeName").text("Earlier Membership : "+cm[0].title + " ( From: " + cm[0].formatted_from_subscription + " To: " + cm[0].formatted_to_subscription+" )"+text1+text2);
|
||||
$("#schemeName").text("Earlier Membership : " + cm[0].title + " ( From: " + cm[0].formatted_from_subscription + " To: " + cm[0].formatted_to_subscription + " )" + text1 + text2);
|
||||
} else {
|
||||
$(".subscribedetails").show(); // Change this line to use the class selector
|
||||
$("#schemeName").text("No Earlier Membership found");
|
||||
@ -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);} -->
|
||||
@ -1053,7 +1064,7 @@ cell1.innerHTML=html;
|
||||
document.getElementById('saveapproved').addEventListener('click', function(event) {
|
||||
var paymentMode = document.getElementById('paymentMode').value;
|
||||
|
||||
if(paymentMode !== ""){
|
||||
if (paymentMode !== "") {
|
||||
// Get the balance amount
|
||||
var balanceAmount = parseFloat(document.getElementById('balanceAmount').value) || 0;
|
||||
|
||||
@ -1062,14 +1073,13 @@ 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 ");
|
||||
event.preventDefault(); // Pass the event parameter here
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Get the Invoice Date input element by its ID
|
||||
@ -1151,7 +1161,7 @@ cell1.innerHTML=html;
|
||||
document.getElementById('paymentMode').value = "";
|
||||
});
|
||||
// Add event listener for the "Close" button
|
||||
document.getElementById('paymentModal').addEventListener('hidden.bs.modal', function () {
|
||||
document.getElementById('paymentModal').addEventListener('hidden.bs.modal', function() {
|
||||
// Reset the payment_method value to an empty string
|
||||
document.getElementById('paymentMode').value = "";
|
||||
});
|
||||
@ -1176,13 +1186,13 @@ cell1.innerHTML=html;
|
||||
} else {
|
||||
var table = document.getElementById("itemTable").getElementsByTagName("tbody")[0];
|
||||
var counter = table.rows.length;
|
||||
if(counter == 0){
|
||||
if (counter == 0) {
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
alert('At least one row should contain a values.');
|
||||
$('#saveDraftButton').prop('disabled', false);
|
||||
$('#saveApprovedButton').prop('disabled', false);
|
||||
$('#saveapproved').prop('disabled', false);
|
||||
}else{
|
||||
} else {
|
||||
if (status == "Draft") {
|
||||
$('#saveDraftButton').prop('disabled', true);
|
||||
$('#saveApprovedButton').prop('disabled', true);
|
||||
@ -1214,7 +1224,8 @@ cell1.innerHTML=html;
|
||||
validationMessage.style.color = "red";
|
||||
}
|
||||
}
|
||||
function checkExisting(inputvalue,fieldname,elementid){
|
||||
|
||||
function checkExisting(inputvalue, fieldname, elementid) {
|
||||
spanid = elementid == 'cus_email' ? "emailValidationMessage" : "mobileValidationMessage";
|
||||
var validationMessage = document.getElementById(spanid);
|
||||
$.ajax({
|
||||
@ -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;
|
||||
}
|
||||
@ -1323,13 +1331,13 @@ cell1.innerHTML=html;
|
||||
// Handle error response
|
||||
alert(response['data']['message']);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
error: function() {
|
||||
alert("Error occurred while saving customer.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1345,8 +1353,8 @@ cell1.innerHTML=html;
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// JavaScript code to handle form submission and AJAX request
|
||||
$(document).ready(function() {
|
||||
// JavaScript code to handle form submission and AJAX request
|
||||
$(document).ready(function() {
|
||||
$('#addBookForm').submit(function(e) {
|
||||
e.preventDefault(); // Prevent default form submission
|
||||
|
||||
@ -1398,18 +1406,17 @@ $(document).ready(function() {
|
||||
// Failed to save book
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// JavaScript code to handle voiding invoice and submitting reason
|
||||
// JavaScript code to handle voiding invoice and submitting reason
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
// Handle clicking on the "Void" button
|
||||
$('#voidButton').click(function() {
|
||||
var invoiceId = <?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>;
|
||||
@ -1451,14 +1458,13 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
// JavaScript code to handle voiding invoice and submitting reason
|
||||
$(document).ready(function() {
|
||||
// JavaScript code to handle voiding invoice and submitting reason
|
||||
$(document).ready(function() {
|
||||
// Handle clicking on the "Cancel" button
|
||||
$('#cancelButton').click(function() {
|
||||
var invoiceIds = <?= isset($invoice_details['invoice_id']) ? json_encode($invoice_details['invoice_id']) : '' ?>; // Get the invoice_id(s)
|
||||
@ -1494,11 +1500,10 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
var status = "<?php echo isset($invoice_details['status']) ? $invoice_details['status'] : ''; ?>";
|
||||
|
||||
// Function to hide all buttons
|
||||
@ -1548,5 +1553,34 @@ $(document).ready(function() {
|
||||
$('#saveApprovedButton').click(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>
|
||||
@ -1,25 +1,30 @@
|
||||
<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{
|
||||
|
||||
.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>
|
||||
|
||||
|
||||
@ -126,7 +131,7 @@
|
||||
<span id="statusText"></span>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
@ -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>
|
||||
@ -211,8 +221,7 @@
|
||||
alert('Failed to load PDF preview.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// JavaScript click event handler for printing PDF
|
||||
@ -241,5 +250,3 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,26 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
/* Add your CSS styles here to format the invoice for mPDF */
|
||||
body {
|
||||
|
||||
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%;
|
||||
}
|
||||
|
||||
@ -79,62 +85,74 @@
|
||||
table.invoice-related-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
}
|
||||
|
||||
table.invoice-related-table th,
|
||||
table.invoice-related-table td {
|
||||
border: none; /* Remove borders from all cells in the invoice items table */
|
||||
table.invoice-related-table th,
|
||||
table.invoice-related-table td {
|
||||
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 {
|
||||
table.invoice-related-table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
.subtotal-table table {
|
||||
.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 */
|
||||
.subtotal-table th,
|
||||
.subtotal-table td {
|
||||
border: none;
|
||||
/* Remove borders from cells inside the subtotal table */
|
||||
padding: 8px;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.subtotal-table th {
|
||||
.subtotal-table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.subtotal-table td:last-child {
|
||||
font-weight: bold; /* Make the last column (total values) bold */
|
||||
}
|
||||
td.invoice-number {
|
||||
font-size: 18px; /* Increase font size to your desired value */
|
||||
.subtotal-table td:last-child {
|
||||
font-weight: bold;
|
||||
/* Make the last column (total values) bold */
|
||||
}
|
||||
|
||||
td.invoice-number {
|
||||
font-size: 18px;
|
||||
/* Increase font size to your desired value */
|
||||
/* Highlight background color */
|
||||
font-weight: bold; /* Make the text bold */
|
||||
}
|
||||
p {
|
||||
font-weight: bold;
|
||||
/* Make the text bold */
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="main-table">
|
||||
<tr>
|
||||
@ -152,7 +170,7 @@ p {
|
||||
<p><?= $value->company_address ?>,<br>
|
||||
<?= $value->company_city ?>,
|
||||
<?= $value->company_state ?>
|
||||
<?= $value->company_postal_code ? " - ".$value->company_postal_code:"" ?>.</p>
|
||||
<?= $value->company_postal_code ? " - " . $value->company_postal_code : "" ?>.</p>
|
||||
<p><?= $value->company_email ?></p>
|
||||
<p><?= $value->company_mobile_no ?></p>
|
||||
</td>
|
||||
@ -201,29 +219,34 @@ p {
|
||||
<td class="billing-address">
|
||||
<?php foreach ($data as $value) : ?>
|
||||
<?= $value->customer_name ?><br>
|
||||
<?= $value->customer_ship_address." ," ?><br>
|
||||
<?= $value->customer_ship_city ?> <?= $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 : "" ?> <?= $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 ?> <?= $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 : "" ?> <?= $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>
|
||||
<br> <br>
|
||||
<br> <br>
|
||||
<table class="invoice-related-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -260,13 +283,13 @@ p {
|
||||
<td colspan="5" align="right">Subtotal : ₹<?= number_format($value->subtotal, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">Discount : <?= $value->discount ? "(-)".number_format($value->discount, 2, '.', ','): number_format(0, 2, '.', ',') ?></td>
|
||||
<td colspan="5" align="right">Discount : <?= $value->discount ? "(-)" . number_format($value->discount, 2, '.', ',') : number_format(0, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
|
||||
<!-- -->
|
||||
<?php if ($value->shipping_label != '') : ?>
|
||||
<tr>
|
||||
<td colspan="5" align="right"><?= $value->shipping_label?> : ₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
|
||||
<td colspan="5" align="right"><?= $value->shipping_label ?> : ₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
@ -276,24 +299,24 @@ p {
|
||||
$difference = abs($value->exact_total_amount - $value->total_amount);
|
||||
?>
|
||||
|
||||
<td colspan="5" align="right"> Rounding : <?= $sign.number_format($difference, 2, '.', ',') ?></td>
|
||||
<td colspan="5" align="right"> Rounding : <?= $sign . number_format($difference, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">Total : ₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<?php if ($value->status === 'Draft'): ?>
|
||||
<?php if ($value->status === 'Draft') : ?>
|
||||
<!-- Set Balance if status is draft and paid is 0 -->
|
||||
<tr>
|
||||
<td colspan="5" align="right">Balance : ₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if ($value->status === 'Approved'): ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($value->status === 'Approved') : ?>
|
||||
<tr>
|
||||
<td colspan="5" align="right">Paid : ₹<?= number_format($value->total_amount, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<div class="business-stamp">
|
||||
|
||||
@ -305,12 +328,14 @@ p {
|
||||
<!-- <if(!empty($value->notes)){
|
||||
<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>
|
||||
<?php if (!empty($value->reason)) { ?>
|
||||
<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 }
|
||||
@ -319,13 +344,14 @@ p {
|
||||
<?php endforeach; ?>
|
||||
<!-- ... (your existing HTML template) -->
|
||||
|
||||
<!-- Add this to the end of your HTML template -->
|
||||
<!-- Add this to the end of your HTML template -->
|
||||
|
||||
|
||||
<!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> -->
|
||||
<!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> -->
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -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>
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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'],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user