Merge branch 'main' of bitbucket.org:venbainformationtechnology/the_mechanic
This commit is contained in:
commit
2178d60dca
@ -59,6 +59,7 @@ class Products extends BaseController
|
|||||||
|
|
||||||
$ProductModel = new ProductModel();
|
$ProductModel = new ProductModel();
|
||||||
|
|
||||||
|
$tax= $this->request->getPost('tax')/2;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'product_name' => $this->request->getPost('productname'),
|
'product_name' => $this->request->getPost('productname'),
|
||||||
@ -67,12 +68,13 @@ class Products extends BaseController
|
|||||||
'serial_no' => $this->request->getPost('serial_no'),
|
'serial_no' => $this->request->getPost('serial_no'),
|
||||||
'unit_price' => $this->request->getPost('unit_price'),
|
'unit_price' => $this->request->getPost('unit_price'),
|
||||||
'commision_rate' => $this->request->getPost('commision_rate'),
|
'commision_rate' => $this->request->getPost('commision_rate'),
|
||||||
'sgst' => $this->request->getPost('sgst_value'),
|
'sgst' => $tax,
|
||||||
'cgst' => $this->request->getPost('cgst_value'),
|
'cgst' => $tax,
|
||||||
'purchase_cost' => $this->request->getPost('purchase_cost'),
|
'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'),
|
'qty_in_demand'=> $this->request->getPost('qty_in_demand'),
|
||||||
'description' => $this->request->getPost('description'),
|
'description' => $this->request->getPost('description'),
|
||||||
|
'vendor' => $this->request->getPost('vendor'),
|
||||||
'isactive' => 1 ,
|
'isactive' => 1 ,
|
||||||
'branch_id' => $this->session->get('logged_user_branch_id')
|
'branch_id' => $this->session->get('logged_user_branch_id')
|
||||||
];
|
];
|
||||||
|
|||||||
@ -123,7 +123,7 @@ $data['product']=$product;
|
|||||||
$status = $this->request->getPost('status');
|
$status = $this->request->getPost('status');
|
||||||
foreach ($product_ids as $key => $product_id) {
|
foreach ($product_ids as $key => $product_id) {
|
||||||
$qty = isset($quantities[$key]) ? $quantities[$key] : 0;
|
$qty = isset($quantities[$key]) ? $quantities[$key] : 0;
|
||||||
if ($status == 'InvoiceGenerated') {
|
if ($status == 'Paid') {
|
||||||
// echo"hello";die;
|
// echo"hello";die;
|
||||||
// Calculate updated quantity and update Product table
|
// Calculate updated quantity and update Product table
|
||||||
$this->updateProductQuantity($ProductModel, $product_id, $qty);
|
$this->updateProductQuantity($ProductModel, $product_id, $qty);
|
||||||
@ -232,8 +232,8 @@ public function delete_sales_product()
|
|||||||
'format' => 'A5',
|
'format' => 'A5',
|
||||||
'default_font_size' => 0,
|
'default_font_size' => 0,
|
||||||
'default_font' => '',
|
'default_font' => '',
|
||||||
'margin_left' => 2,
|
|
||||||
'margin_right' => 2,
|
// 'margin_right' => 1,
|
||||||
'margin_top' => 6,
|
'margin_top' => 6,
|
||||||
'margin_bottom' => 6,
|
'margin_bottom' => 6,
|
||||||
'margin_header' => 6,
|
'margin_header' => 6,
|
||||||
@ -249,9 +249,7 @@ public function delete_sales_product()
|
|||||||
$mpdf->SetAuthor($data[0]->branch_name);
|
$mpdf->SetAuthor($data[0]->branch_name);
|
||||||
$mpdf->SetCreator('');
|
$mpdf->SetCreator('');
|
||||||
|
|
||||||
$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);
|
|
||||||
|
|
||||||
// Generate the PDF content (HTML)
|
// Generate the PDF content (HTML)
|
||||||
if ($data[0]->status === 'Draft') {
|
if ($data[0]->status === 'Draft') {
|
||||||
@ -273,7 +271,7 @@ public function delete_sales_product()
|
|||||||
|
|
||||||
// Generate the PDF content (HTML) with data
|
// Generate the PDF content (HTML) with data
|
||||||
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]);
|
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]);
|
||||||
// echo $html;die;
|
// echo $html;die;
|
||||||
// Load HTML into the mPDF instance
|
// Load HTML into the mPDF instance
|
||||||
$mpdf->WriteHTML($html);
|
$mpdf->WriteHTML($html);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class ProductModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'products';
|
protected $table = 'products';
|
||||||
protected $primaryKey = 'product_id';
|
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()
|
public function getTax()
|
||||||
|
|||||||
@ -143,7 +143,7 @@ p {
|
|||||||
|
|
||||||
<?php foreach ($sales as $value) : ?>
|
<?php foreach ($sales as $value) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="business-logo-container"style="font-size: 25px;
|
<td class="business-logo-container"style="font-size: 20px;
|
||||||
font-weight: bold;">
|
font-weight: bold;">
|
||||||
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"> -->
|
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"> -->
|
||||||
THE MECHANIC
|
THE MECHANIC
|
||||||
@ -154,7 +154,7 @@ p {
|
|||||||
<p><?= $value->company_address ?>,<br>
|
<p><?= $value->company_address ?>,<br>
|
||||||
<?= $value->company_city ?>,
|
<?= $value->company_city ?>,
|
||||||
<?= $value->company_state ?>
|
<?= $value->company_state ?>
|
||||||
<?= $value->company_postal_code ? " - ".$value->company_postal_code:"" ?>.</p>
|
<?= $value->company_postal_code ?>.</p>
|
||||||
|
|
||||||
<p><?= $value->company_mobile_no ?></p>
|
<p><?= $value->company_mobile_no ?></p>
|
||||||
</td>
|
</td>
|
||||||
@ -180,11 +180,11 @@ p {
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table class="addresses-table">
|
<table class="addresses-table">
|
||||||
<tr>
|
<tr >
|
||||||
<th class="billing-address">Billing Address</th>
|
<th class="billing-address">Billing Address</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr >
|
||||||
<td class="billing-address">
|
<td class="billing-address">
|
||||||
<?php foreach ($sales as $value) : ?>
|
<?php foreach ($sales as $value) : ?>
|
||||||
<?= $value->client_name ?><br>
|
<?= $value->client_name ?><br>
|
||||||
@ -208,9 +208,9 @@ p {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>S.no</th>
|
<th>S.no</th>
|
||||||
<th>Item Name</th>
|
<th>Item Name</th>
|
||||||
<th>Qty</th>
|
|
||||||
<th>Rate</th>
|
|
||||||
|
|
||||||
|
<th>Rate</th>
|
||||||
|
<th>Qty</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -224,8 +224,9 @@ p {
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td><?= $item->product_name ?></td>
|
<td><?= $item->product_name ?></td>
|
||||||
<td><?= $item->qty ?></td>
|
|
||||||
<td>₹<?= number_format($item->net_price, 2, '.', ',') ?></td>
|
<td>₹<?= number_format($item->net_price, 2, '.', ',') ?></td>
|
||||||
|
<td><?= $item->qty ?></td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<td>₹<?= number_format($item->amount, 2, '.', ',') ?></td>
|
<td>₹<?= number_format($item->amount, 2, '.', ',') ?></td>
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Vendor</label>
|
<label for="inputPassword4" class="col-form-label">Vendor</label>
|
||||||
<input type="text" class="form-control" name="vendor" placeholder="Vendor"value="<?= isset($products['vendor_id']) ? $products['vendor_id'] : '' ?>" required>
|
<input type="text" class="form-control" name="vendor" placeholder="Vendor"value="<?= isset($products['vendor']) ? $products['vendor'] : '' ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br>
|
<input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br>
|
||||||
@ -49,26 +49,30 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Unit Price</label>
|
<label for="inputPassword4" class="col-form-label">Unit Price</label>
|
||||||
<input type="number" class="form-control" name="unit_price" placeholder="City"value="<?= isset($products['unit_price']) ? $products['unit_price'] : '' ?>" required>
|
<input type="number" class="form-control" name="unit_price" placeholder="Price"value="<?= isset($products['unit_price']) ? $products['unit_price'] : '' ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4" hidden>
|
<div class="form-group col-md-4" hidden>
|
||||||
<label for="inputPassword4" class="col-form-label">Commision Rate</label>
|
<label for="inputPassword4" class="col-form-label">Commision Rate</label>
|
||||||
<input type="number" class="form-control" name="commision_rate" placeholder="Commision Rate"value="<?= isset($products['commision_rate']) ? $products['commision_rate'] : '' ?>" required>
|
<input type="number" class="form-control" name="commision_rate" placeholder="Commision Rate"value="<?= isset($products['commision_rate']) ? $products['commision_rate'] : '' ?>" >
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Purchase Cost</label>
|
<label for="inputPassword4" class="col-form-label">Purchase Cost</label>
|
||||||
<input type="number" class="form-control" name="purchase_cost" placeholder="Purchase Cost"value="<?= isset($products['purchase_cost']) ? $products['purchase_cost'] : '' ?>" required>
|
<input type="number" class="form-control" name="purchase_cost" placeholder="Purchase Cost"value="<?= isset($products['purchase_cost']) ? $products['purchase_cost'] : '' ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputPassword4" class="col-form-label">Sgst</label>
|
|
||||||
<input type="number" class="form-control d-none" name="sgst_value" id="sgstValue" placeholder="SGST" value="<?= isset($products['sgst']) ? $products['sgst'] : '9' ?>">
|
<label for="inputPassword4" class="col-form-label">Tax</label>
|
||||||
</div>
|
<?php
|
||||||
|
$sgst = isset($products['sgst']) ? $products['sgst'] : 9; // SGST value (half of the tax amount)
|
||||||
|
$cgst = isset($products['cgst']) ? $products['cgst'] : 9; // CGST value (half of the tax amount)
|
||||||
|
$tax = $sgst + $cgst; // Total tax (sum of SGST and CGST)
|
||||||
|
?>
|
||||||
|
<input type="number" class="form-control d-none" name="tax" id="sgstValue" placeholder="Tax" value="<?= $tax ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label for="inputPassword4" class="col-form-label">Cgst</label>
|
|
||||||
<input type="number" class="form-control d-none" name="cgst_value" id="cgstValue" placeholder="CGST" value="<?= isset($products['cgst']) ? $products['cgst'] : '9' ?>">
|
|
||||||
</div>
|
|
||||||
</div><br>
|
</div><br>
|
||||||
<h4 class="header-title">Stock Information :</h4><br>
|
<h4 class="header-title">Stock Information :</h4><br>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -78,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4" hidden>
|
<div class="form-group col-md-4" hidden>
|
||||||
<label for="inputPassword4" class="col-form-label">Qty in Demand</label>
|
<label for="inputPassword4" class="col-form-label">Qty in Demand</label>
|
||||||
<input type="number" class="form-control" name="qty_in_demand" placeholder="Qty in Demand" value="<?= isset($products['qty_in_demand']) ? $products['qty_in_demand'] : '' ?>" required>
|
<input type="number" class="form-control" name="qty_in_demand" placeholder="Qty in Demand" value="<?= isset($products['qty_in_demand']) ? $products['qty_in_demand'] : '' ?>" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -70,9 +70,9 @@
|
|||||||
<td><?= $value['total']; ?></td>
|
<td><?= $value['total']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
<a href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||||
<?php if ($value['status'] == 'InvoiceGenerated') : ?>
|
|
||||||
<a href="<?= "download_invoice/" . $value['sales_order_id']; ?>" class="edit-button"><i class="ri-file-download-line"></i></a>
|
<a href="<?= "download_invoice/" . $value['sales_order_id']; ?>" class="edit-button"><i class="ri-file-download-line"></i></a>
|
||||||
<?php endif; ?>
|
|
||||||
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
<select class="form-control status-select" name="status" required data-toggle="select2">
|
<select class="form-control status-select" name="status" required data-toggle="select2">
|
||||||
<!-- <option value="">Select a Status</option> -->
|
<!-- <option value="">Select a Status</option> -->
|
||||||
<option value="Created" <?= isset($sales['status']) && $sales['status'] === 'Created' ? 'selected' : '' ?>>Created</option>
|
<option value="Created" <?= isset($sales['status']) && $sales['status'] === 'Created' ? 'selected' : '' ?>>Created</option>
|
||||||
<option value="InvoiceGenerated" <?= isset($sales['status']) && $sales['status'] === 'InvoiceGenerated' ? 'selected' : '' ?>>Generate Invoice</option>
|
<option value="Paid" <?= isset($sales['status']) && $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -198,7 +198,10 @@
|
|||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Submit</button>
|
<?php if (!isset($sales['status']) || $sales['status'] !== 'Paid') : ?>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user