diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index fbadc66e..5349988e 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -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(); diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index b508a178..f9e820d6 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -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') diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index 6559c9cf..7926660c 100644 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -1,767 +1,890 @@ - + + + .discount-header { + text-align: center; + /* Add this to center-align the content */ + } + + -
-
-
-
-

- -
-
-
-
- - - -
-
Please select customer.
-
- - -
-
Please select shipping address.
-
-
-
- - - -
-
- - -
-
-
-
- - - -
Please select an events.
-
-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
- - - - - -
-
- - - -
-
- +
+
+
+
+

+ + +
+
+
+ + -
-
-

Item Details

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Item DetailsQtyRateTaxAmount DiscountActions
- - - - - - -
-
- - - - - - -
-
- +
Please select customer.
+
+ +
-
-
-
-
-

Calculation

-
- - -
-
- - -
-
- - -
+
+
+ + + +
+
+ + +
+
+
+
+ + + +
Please select an events.
+
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + + + + +
+
+ + + +
+
-
- - +
+
+

Item Details

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item DetailsQtyRateTaxAmount DiscountActions
+ + + + + + + + + +
+
+ + + + + + + +
+
+ -
- - + +
+
+
+
+
+

Calculation

+
+ + +
+
+ + +
+ +
+ + + > + + + + > + +
+ + + +
+ + +
+
+ + +
+ +
+ + > +
+ +
+ + > +
-
-
-
- - +
-
- - + + +
- - - - - - - - - - -
-
+ + + + + + + + + + +
+
+
-
- - - - - + + + - function load_details1(ship_addr_id, cust_id) { - $.ajax({ - type: "POST", - url: "", - data: { - selectedValue: cust_id - }, - success: function(response) { - cs = response['data']['customer_shipping']; - cb = response['data']['customer_billing']; - $('#hiddenBillingAddressId').val(''); - customer_billing = ""; - if (cb.length > 0) { - $.each(cb, function(k, v) { - customer_billing = v.address_1 + " " + v.address_2 + ",\n" + v.city + ",\n" + v.state + " - "+v.postal_code+",\n"+ v.country +"." - customer_billing_id = v.customer_address_id - }); - } - // console.log(customer_billing); - // var address_compare = bill_addr == customer_billing ? customer_billing : bill_addr - // - if ((bill_addr != "") && (bill_addr != customer_billing)) { - $("#storeBillingAddress").val(bill_addr).prop("readonly", false); - $('#editAddressesCheckbox').prop('checked', true); - } else { - $("#storeBillingAddress").val(customer_billing).prop("readonly", true); - $('#editAddressesCheckbox').prop('checked', false); - } + - + - + - - - + + + - + + \ No newline at end of file diff --git a/app/Views/invoice_list.php b/app/Views/invoice_list.php index 0691b7f0..629e05a7 100644 --- a/app/Views/invoice_list.php +++ b/app/Views/invoice_list.php @@ -5,10 +5,10 @@
- -
+
< /.modal-content --> + +

diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index 3392d455..aa552b9e 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -237,6 +237,7 @@ if (count($invoiceDateParts) === 3) { + @@ -248,6 +249,14 @@ if (count($invoiceDateParts) === 3) { + + @@ -276,7 +285,7 @@ if (count($invoiceDateParts) === 3) { - +