From 0f84e3ea718165c29e8482ff835729bb98ff639d Mon Sep 17 00:00:00 2001 From: heama Date: Sat, 6 Apr 2024 10:29:57 +0530 Subject: [PATCH] Product_saleorder --- app/Controllers/Products.php | 8 +++++--- app/Controllers/Sales.php | 12 +++++------- app/Models/ProductModel.php | 2 +- app/Views/invoice_pdf_template.php | 15 ++++++++------- app/Views/product_form.php | 28 ++++++++++++++++------------ app/Views/sales_list.php | 4 ++-- app/Views/sales_order_form.php | 7 +++++-- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 5832359..3b7954c 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -59,6 +59,7 @@ class Products extends BaseController $ProductModel = new ProductModel(); + $tax= $this->request->getPost('tax')/2; $data = [ 'product_name' => $this->request->getPost('productname'), @@ -67,12 +68,13 @@ class Products extends BaseController 'serial_no' => $this->request->getPost('serial_no'), 'unit_price' => $this->request->getPost('unit_price'), 'commision_rate' => $this->request->getPost('commision_rate'), - 'sgst' => $this->request->getPost('sgst_value'), - 'cgst' => $this->request->getPost('cgst_value'), + 'sgst' => $tax, + 'cgst' => $tax, 'purchase_cost' => $this->request->getPost('purchase_cost'), - 'qty'=> $this->request->getPost('qty_in_stock'), + 'qty_stock'=> $this->request->getPost('qty_in_stock'), 'qty_in_demand'=> $this->request->getPost('qty_in_demand'), 'description' => $this->request->getPost('description'), + 'vendor' => $this->request->getPost('vendor'), 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id') ]; diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 6966aee..630fb97 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -123,7 +123,7 @@ $data['product']=$product; $status = $this->request->getPost('status'); foreach ($product_ids as $key => $product_id) { $qty = isset($quantities[$key]) ? $quantities[$key] : 0; - if ($status == 'InvoiceGenerated') { + if ($status == 'Paid') { // echo"hello";die; // Calculate updated quantity and update Product table $this->updateProductQuantity($ProductModel, $product_id, $qty); @@ -232,8 +232,8 @@ public function delete_sales_product() 'format' => 'A5', 'default_font_size' => 0, 'default_font' => '', - 'margin_left' => 2, - 'margin_right' => 2, + + // 'margin_right' => 1, 'margin_top' => 6, 'margin_bottom' => 6, 'margin_header' => 6, @@ -249,9 +249,7 @@ public function delete_sales_product() $mpdf->SetAuthor($data[0]->branch_name); $mpdf->SetCreator(''); - $htmlFooter='
-
'; - $mpdf->setHTMLFooter($htmlFooter); + // Generate the PDF content (HTML) if ($data[0]->status === 'Draft') { @@ -273,7 +271,7 @@ public function delete_sales_product() // Generate the PDF content (HTML) with data $html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]); -// echo $html;die; +// echo $html;die; // Load HTML into the mPDF instance $mpdf->WriteHTML($html); diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index 07d7997..d971eea 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -5,7 +5,7 @@ class ProductModel extends Model { protected $table = 'products'; protected $primaryKey = 'product_id'; - protected $allowedFields = ['product_id','product_name','branch_id','search_tag','product_category','mfr_part_no','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive']; + protected $allowedFields = ['product_id','product_name','branch_id','search_tag','product_category','mfr_part_no','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive']; public function getTax() diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index c74606a..f964299 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -143,7 +143,7 @@ p { - THE MECHANIC @@ -154,7 +154,7 @@ p {

company_address ?>,
company_city ?>, company_state ?> - company_postal_code ? " - ".$value->company_postal_code:"" ?>.

+ company_postal_code ?>.

company_mobile_no ?>

@@ -180,11 +180,11 @@ p { - + - + - + - + @@ -224,8 +224,9 @@ p { - + + diff --git a/app/Views/product_form.php b/app/Views/product_form.php index 0b1a5ab..be7a8bd 100644 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -41,7 +41,7 @@
- +

@@ -49,26 +49,30 @@
- +
-
- - -
+
+ + + + +
-
- - -
+ +

Stock Information :


@@ -78,7 +82,7 @@
diff --git a/app/Views/sales_list.php b/app/Views/sales_list.php index 22ec871..1ed5e6e 100644 --- a/app/Views/sales_list.php +++ b/app/Views/sales_list.php @@ -70,9 +70,9 @@ diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php index 676dacf..6ecf2c2 100644 --- a/app/Views/sales_order_form.php +++ b/app/Views/sales_order_form.php @@ -41,7 +41,7 @@ @@ -197,7 +197,10 @@ - + + + +
Billing Address
client_name ?>
@@ -208,9 +208,9 @@ p {
S.no Item NameQtyRateQty Total
product_name ?>qty ?> net_price, 2, '.', ',') ?>qty ?>amount, 2, '.', ',') ?> " class="edit-button"> - + " class="edit-button"> - + " class="delete-button">