invoice,subcription
This commit is contained in:
parent
4888e405f2
commit
f476e90f6c
@ -144,6 +144,8 @@ class Invoice extends BaseController
|
||||
$duedate = $this->request->getVar('due_date');
|
||||
$invdate = $this->request->getVar('invoice_date');
|
||||
$invoice_status = $this->request->getPost('status');
|
||||
// echo 'Hi';
|
||||
// echo($this->request->getPost('invoice_number'));die();
|
||||
$invoice_id = (!empty($this->request->getPost('invoice_id'))) ? $this->request->getPost('invoice_id') : "";
|
||||
$customer_id = (int)$this->request->getPost('customer_name');
|
||||
$invoiceType = $this->request->getPost('invoice_type');
|
||||
@ -164,12 +166,13 @@ class Invoice extends BaseController
|
||||
'discount' => (int)$this->request->getPost('discount'),
|
||||
'total_amount' => (int)$this->request->getPost('grand_total'),
|
||||
'shipping_charge' => (int)$this->request->getPost('shippingCharges'),
|
||||
'shipping_label' =>$this->request->getPost('shippingChargesLabel'),
|
||||
'order_number' => $this->request->getPost('order_number'),
|
||||
'payment_method' => 'Cash on Delivery', // "Credit Card," "Cash on Delivery," "PayPal","PayTm","Gpay"
|
||||
'payment_method' =>$this->request->getPost('payment_method'), // "Credit Card," "Cash on Delivery," "PayPal","PayTm","Gpay"
|
||||
'payment_status' => 'Pending', //"Paid," "Pending," "Failed," "Refunded," "Canceled," "Authorized," and "Completed."
|
||||
'event_id' => (int)$this->request->getPost('event_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'status' => $this->request->getPost('status'),
|
||||
'status' => $this->request->getPost('saveas'),
|
||||
'isactive' => 1
|
||||
];
|
||||
## Based on the invoice ID, we designated Insert or Update on Details...
|
||||
@ -521,8 +524,17 @@ class Invoice extends BaseController
|
||||
$model = new InvoiceModel();
|
||||
$data = $model->getInvoiceData($id);
|
||||
$invoiceItems = $model->getInvoiceItems($id);
|
||||
$invoiceTerms=$model->getInvoiceData($id);
|
||||
// print_r($invoiceTerms);die()
|
||||
$invoiceTerms= $model->getInvoiceData($id);
|
||||
|
||||
foreach($invoiceItems as $index => $singleItem)
|
||||
{
|
||||
$productImgs= $model->getProductImgs($singleItem->product);
|
||||
$invoiceItems[$index]->imgs = $productImgs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// print_r($invoiceItems);die();
|
||||
$invoice_type = $data[0]->invoice_type;
|
||||
|
||||
// print_r($invoiceItems);die();
|
||||
|
||||
@ -8,7 +8,7 @@ class InvoiceModel extends Model
|
||||
protected $table = 'invoice';
|
||||
protected $primaryKey = 'invoice_id';
|
||||
// protected $allowedFields = ['invoice_id','invoice_number','customer_id','invoice_date','event_id','business_id','created_on','business_id'];
|
||||
protected $allowedFields = ['invoice_id', 'invoice_number', 'customer_id','notes', 'invoice_date', 'due_date', 'subtotal', 'tax', 'discount', 'shipping_charge','total_amount', 'payment_status', 'order_number','invoice_type', 'payment_method', 'event_id', 'business_id', 'shipping_address_id', 'billing_address_id', 'created_on', 'created_by', 'updated_on', 'updated_by','category','isactive','billing_address','shipping_address','status'];
|
||||
protected $allowedFields = ['invoice_id', 'invoice_number', 'customer_id','notes', 'invoice_date', 'due_date', 'subtotal', 'tax', 'discount', 'shipping_charge','shipping_label','total_amount', 'payment_status', 'order_number','invoice_type', 'payment_method', 'event_id', 'business_id', 'shipping_address_id', 'billing_address_id', 'created_on', 'created_by', 'updated_on', 'updated_by','category','isactive','billing_address','shipping_address','status'];
|
||||
|
||||
public function saveInvoiceItemDetails($data){
|
||||
$i = 0;
|
||||
@ -125,15 +125,39 @@ public function updateData($table, $data, $where)
|
||||
|
||||
}
|
||||
// this function Also Used For Approve Notification.
|
||||
public function getInvoiceItems($id)
|
||||
{
|
||||
return $this->db->table('invoiceitems')
|
||||
->where(['invoice_id'=>$id,'invoiceitems.isactive'=>1])
|
||||
->join('books as B','B.book_id=invoiceitems.product','left')
|
||||
->select('invoiceitems.*,B.title')
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getInvoiceItems($id)
|
||||
{
|
||||
$data = $this->db->table('invoiceitems')
|
||||
->where(['invoice_id' => $id, 'invoiceitems.isactive' => 1])
|
||||
->join('books as B', 'B.book_id = invoiceitems.product', 'left')
|
||||
// ->join('book_images as BI', 'BI.book_id = invoiceitems.product', 'left')
|
||||
->select('invoiceitems.*,B.*')
|
||||
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
//->limit(1,0)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// print_r($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getProductImgs($productId)
|
||||
{
|
||||
$data = $this->db->table('book_images')
|
||||
->where(['book_id' => $productId])
|
||||
// ->join('books as B', 'B.book_id = invoiceitems.product', 'left')
|
||||
// ->join('book_images as BI', 'BI.book_id = invoiceitems.product', 'left')
|
||||
->select('book_images.*')
|
||||
//->orderBy("book_img_id", "asc") // Order by book_img_id in ascending order
|
||||
//->limit(1,0)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// print_r($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCategoryBooks()
|
||||
{
|
||||
return $this->db->table('books')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,10 +5,10 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="#" id="addNewButton" class="btn btn-primary"><i class="fe-file-text"></i> Add New </a>
|
||||
<a href="new_book_invoice/0" class="btn btn-primary"><i class="ri-currency-line"></i> Add New </a>
|
||||
<!-- HTML for the "Add New" button -->
|
||||
|
||||
<div id="standard-modal" >
|
||||
<!-- <div id="standard-modal" >
|
||||
|
||||
<div id="invoiceTypeModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
@ -28,11 +28,9 @@
|
||||
<div class="modal-footer">
|
||||
<button id="confirmInvoiceType">Continue</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
</div>
|
||||
</div>< /.modal-content -->
|
||||
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
|
||||
@ -237,6 +237,7 @@ if (count($invoiceDateParts) === 3) {
|
||||
<table class="invoice-related-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Image</th>
|
||||
<th>Item Name</th>
|
||||
<th>Qty</th>
|
||||
<th>Rate</th>
|
||||
@ -248,6 +249,14 @@ if (count($invoiceDateParts) === 3) {
|
||||
<tbody>
|
||||
<?php foreach ($invoiceItems as $item) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if (!empty($item->imgs[0]->wp_img_url)) : ?>
|
||||
<img src="<?= $item->imgs[0]->wp_img_url?>" alt="Product Image"style="max-width: 50px; max-height: 30px;">
|
||||
<?php else : ?>
|
||||
<img src="<?= base_url('public/uploads/' . $item->imgs[0]->img_name) ?>" alt="Fallback Image"style="max-width: 50px; max-height: 30px;">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td><?= $item->title ?></td>
|
||||
<td><?= $item->quantity ?></td>
|
||||
<td>₹<?= number_format($item->unit_price, 2, '.', ',') ?></td>
|
||||
@ -276,7 +285,7 @@ if (count($invoiceDateParts) === 3) {
|
||||
<td colspan="5" align="right">Discount : ₹<?= number_format($value->discount, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">Shipping : ₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
|
||||
<td colspan="5" align="right"><?= $value->shipping_label?> : ₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" align="right">Total : ₹<?= number_format($value->subtotal, 2, '.', ',') ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user