GWM : JC calculation

This commit is contained in:
Gowtham M 2025-04-10 16:42:36 +05:30
parent 78e01c1256
commit 4a8cfeace5
2 changed files with 6 additions and 15 deletions

View File

@ -940,7 +940,9 @@ class Jobcard extends BaseController
}
$product['qty'] = $pt->qty;
$product['tax'] = $pt->tax;
$product['amount'] = $pt->amount / $pt->qty; //(isset($rework) ? 0 : $pt->amount / $pt->qty );
$product['amount'] = $pt->amount;
// $product['amount'] = $pt->amount / $pt->qty;
//(isset($rework) ? 0 : $pt->amount / $pt->qty );
if(empty($pt->id)) {
$this->JobcardProductModel->insert($product);
$job_card_product_id = $this->JobcardProductModel->getInsertID();

View File

@ -709,7 +709,7 @@ $(document).ready(async function() {
newRow += '<option value="' + product.product_id + '" selected>' + product.pname +'-'+ product.manufacturer_name + '</option>';
newRow += '</select></td>' +
'<td><input type="text" class="form-control rate-d-only" value="'+product.amount+'" readonly /></td>' +
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="' + product.amount * product.qty + '" readonly /></td>' +
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="' + product.amount + '" readonly /></td>' +
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="' + product.qty + '" name="quantity[]"/></td>';
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
newRow += '<td><input type="number" class="form-control issued-qty" min="'+product.issued_qty+'" max="'+product.qty+'" value="'+product.issued_qty+'" name="issued-qty" /></td>';
@ -1562,7 +1562,7 @@ $(document).ready(function() {
var taxAmount = final_amount-amt;
console.log(taxAmount);
$(row).find('.tax-amount').val(parseFloat(taxAmount).toFixed(2)).attr('value', taxAmount.toFixed(2));
$(row).find('.total-tax-amount').val(parseFloat(taxAmount).toFixed(2)).attr('value', taxAmount.toFixed(2));
var rate = amt / quantity;
@ -1676,18 +1676,7 @@ $(document).ready(function() {
updateCalculations();
});
//gwm
$(document).on('keyup change', '.rate-d-only', function() {
alert();
className = $(this).closest('tr').attr('class');
if(className == 'product') {
calculateAmount($(this).closest('tr'), $(this).closest('tr').attr('class'),'child');
}
// Calculate amount and update amount input field
updateCalculations();
});