kohjhjhصثقصثقصثقgdfgdg
Ele57885fddfgdfgfghgقفغفغفقhfg555434536
/
home
/
u402332945
/
domains
/
simmar.co.in
/
public_html
/
Admin-Panel
/
Upload FileeE
HOME
<?php include 'db.php'; ?> <?php require_once 'db.php'; $cid=intval($_GET['cid']); $sql = "SELECT * FROM cust WHERE order_id = $cid"; $result = $db->query($sql); $data = $result->fetch_row(); ?> <!DOCTYPE html> <html lang="en"> <!-- Mirrored from thememinister.com/crm/add-customer.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 03 Oct 2019 15:43:24 GMT --> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Lulusmart</title> <!-- Favicon and touch icons --> <link rel="shortcut icon" href="assets/dist/img/ico/favicon.png" type="image/x-icon"> <!-- Start Global Mandatory Style =====================================================================--> <!-- jquery-ui css --> <link href="assets/plugins/jquery-ui-1.12.1/jquery-ui.min.css" rel="stylesheet" type="text/css"/> <!-- Bootstrap --> <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <!-- Bootstrap rtl --> <!--<link href="assets/bootstrap-rtl/bootstrap-rtl.min.css" rel="stylesheet" type="text/css"/>--> <!-- Lobipanel css --> <link href="assets/plugins/lobipanel/lobipanel.min.css" rel="stylesheet" type="text/css"/> <!-- Pace css --> <link href="assets/plugins/pace/flash.css" rel="stylesheet" type="text/css"/> <!-- Font Awesome --> <link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/> <!-- Pe-icon --> <link href="assets/pe-icon-7-stroke/css/pe-icon-7-stroke.css" rel="stylesheet" type="text/css"/> <!-- Themify icons --> <link href="assets/themify-icons/themify-icons.css" rel="stylesheet" type="text/css"/> <!-- End Global Mandatory Style =====================================================================--> <!-- Start Theme Layout Style =====================================================================--> <!-- Theme style --> <link href="assets/dist/css/stylecrm.css" rel="stylesheet" type="text/css"/> <!-- Theme style rtl --> <!--<link href="assets/dist/css/stylecrm-rtl.css" rel="stylesheet" type="text/css"/>--> <!-- End Theme Layout Style =====================================================================--> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.1/css/bootstrap-select.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.1/js/bootstrap-select.js"></script> </head> <body class="hold-transition sidebar-mini"> <?php include('include/header.php'); ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="header-icon"> </div> <div class="header-title"> <h1>Edit Sales</h1> <small></small> </div> </section> <!-- Main content --> <section class="content"> <div class="row"> <!-- Form controls --> <div class="col-sm-12"> <div class="panel panel-bd lobidrag"> <div class="panel-heading"> <div class="btn-group" id="buttonlist"> </div> </div> <div class="panel-body"> <form class="form-horizontal" method="POST" action="createOrderawnt.php" id="createOrderForm"> <div class="col-sm-3"> <div class="form-group"> <label>Invoice No</label> <input name="awnt" type="text" value="<?php echo $cid; ?>" class="form-control" placeholder="" required readonly> </div> </div> <input name="name" type="hidden" value="<?php echo $data[1]; ?>" class="form-control" placeholder="select Date" > <div class="col-sm-3"> <div class="form-group"> <label>Invoice Date</label> <input name="name1" type="Date" value="<?php echo $data[3]; ?>" class="form-control" placeholder="select Date" required> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Entry Date</label> <input name="name2" type="Date" value="<?php echo $data[3]; ?>" class="form-control" placeholder="select Date" required> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Mode of payment</label> <select name="name3" class="form-control"> <option value="cash">Cash</option> <option value="bank">bank</option> <option value="credit">Credit</option>> </select> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Customer Name</label> <input name="name4" type="text" id="cusname" value="<?php echo $data[13]; ?>" class="form-control" readonly> </div> </div> <!--<div class="col-sm-4"> <div class="form-group"> <label>Email</label> <input name="name5" type="text" id="address" value="<?php echo $data[14]; ?>" class="form-control" readonly> </div> </div>--> <div class="col-sm-4"> <div class="form-group"> <label>Address</label> <input name="name5" type="text" id="cnm" value="<?php echo $data[16]; ?>" class="form-control" placeholder="select Customer Address" required> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Mobile Number</label> <input name="name6" type="text" id="cnm" value="<?php echo $data[15]; ?>" class="form-control" readonly> </div> </div> <table class="table" id="productTable"> <thead> <tr> <th style="width:30%;">Product</th> <th style="width:10%;">Rate</th> <th style="width:10%;">Product Qty</th> <!-- <th style="width:10%;">GST</th> --> <!--<th style="width:10%;">Quantity</th> <th style="width:10%;">Unit</th>--> <!-- <th style="width:10%;">Total Amount</th>--> <th style="width:10%;">Total</th> <!--<th style="width:5%;">Purchase</th> <th style="width:10%;">Profit</th>--> <th style="width:5%;"></th> <th style="width:5%;"></th> </tr> </thead> <tbody> <?php //$subTotal = ""; // $subTotal = 0; $orderItemSql = "SELECT * FROM customer_order WHERE tr_id = $cid"; $orderItemResult = $db->query($orderItemSql); // $orderItemData = $orderItemResult->fetch_all(); // print_r($orderItemData); $arrayNumber = 0; // for($x = 1; $x <= count($orderItemData); $x++) { $x = 1; while($orderItemData = $orderItemResult->fetch_array()) { $pid =$orderItemData['pid']; $qty =$orderItemData['p_qty']; $price =$orderItemData['p_price']; $orderItemSqlt = "SELECT id,name16 FROM p15 WHERE id ='$pid'"; $orderItemResultwt = $db->query($orderItemSqlt); $orderResultwt = $db->query($orderItemSqlt); $orderData = $orderResultwt->fetch_array(); $purchaserate= $orderData[1]; $purchaseamount= $qty*$price-$qty*$purchaserate; ?> <tr id="row<?php echo $x; ?>" class="<?php echo $arrayNumber; ?>"> <td style="margin-left:10px;"> <div class="form-group"> <select class="selectpicker form-control" data-live-search="true" name="productName[]" id="productName<?php echo $x; ?>" onchange="getProductData(<?php echo $x; ?>)" > <option value="">~~SELECT~~</option> <?php $productSql = "SELECT * FROM p15"; $productData = $db->query($productSql); while($row = $productData->fetch_array()) { $selected = ""; if($row['id'] == $orderItemData['pid']) { $selected = "selected"; } else { $selected = ""; } echo "<option value='".$row['id']."' id='changeProduct".$row['id']."' ".$selected." >".$row['name7']." ".$row['name8']." ".$row['name10']."</option>"; } // /while ?> </select> </div> </td> <td style="padding-left:10px;"> <input type="text" name="rate[]" id="rate<?php echo $x; ?>" onkeyup="getTotal(<?php echo $x ?>)" autocomplete="off" value="<?php echo $orderItemData['p_price']; ?>" class="form-control" /> <input type="hidden" name="rateValue[]" id="rateValue<?php echo $x; ?>" value="<?php echo $orderItemData['p_price']; ?>" autocomplete="off" class="form-control" /> </td> <td style="padding-left:10px;"> <input type="text" name="quantity[]" id="quantityamwt<?php echo $x; ?>" onkeyup="getTotal(<?php echo $x ?>)" autocomplete="off" value="<?php echo $orderItemData['p_qty']; ?>" class="form-control" /> </td> <!--<td style="padding-left:10px;">--> <input type="hidden" name="hsn[]" id="hsn<?php echo $x; ?>" autocomplete="off" value="<?php echo $orderItemData['qnwt']; ?>" class="form-control" /> <!--</td>--> <!--<td style="padding-left:10px;">--> <input type="hidden" name="hsn1[]" id="hsn1<?php echo $x; ?>" autocomplete="off" value="<?php echo $orderItemData['unit']; ?>" class="form-control" /> <!--</td>--> <input type="hidden" name="hsn2[]" id="hsn2<?php echo $x; ?>" autocomplete="off" value="<?php echo $orderItemData['amnt']; ?>" class="form-control" /> <input type="hidden" name="productNament[]" id="productNament<?php echo $x; ?>" value="<?php echo $orderItemData['p_name']; ?>" autocomplete="off" class="form-control" readonly/> <input type="hidden" name="quantity1[]" id="quantity1<?php echo $x; ?>" onkeyup="getTotal1(<?php echo $x ?>)" autocomplete="off" value="<?php echo $orderItemData['p_price']; ?>" class="form-control" /> <input type="hidden" name="quantity2[]" id="quantity2<?php echo $x; ?>" autocomplete="off" value="<?php echo $orderItemData['p_price']; ?>" class="form-control" readonly/> <input type="hidden" name="totalamnt[]" id="totalamnt<?php echo $x; ?>" value="<?php echo $orderItemData['total']; ?>" autocomplete="off" class="form-control" readonly/> <input type="hidden" name="totalValueamnt[]" id="totalValueamnt<?php echo $x; ?>" value="<?php echo $orderItemData['total']; ?>" autocomplete="off" class="form-control" /> <td style="padding-left:10px;"> <input type="text" name="total[]" id="total<?php echo $x; ?>" autocomplete="off" value="<?php echo $orderItemData['total']; ?>" class="form-control" readonly/> <input type="hidden" name="totalValue[]" id="totalValue<?php echo $x; ?>" value="<?php echo $orderItemData['total']; ?>" autocomplete="off" class="form-control" /> </td> <!--<td style="padding-left:10px;"> <?php if ($orderItemData['purchaserate']== '') { ?> <input type="text" name="quantity3[]" id="quantity3<?php echo $x; ?>" value="<?php echo $purchaserate; ?>" onkeyup="getTotal2(<?php echo $x ?>)" autocomplete="off" class="form-control" /> <?php } else { ?> <input type="text" name="quantity3[]" id="quantity3<?php echo $x; ?>" value="<?php echo $orderItemData['purchaserate']; ?>" onkeyup="getTotal2(<?php echo $x ?>)" autocomplete="off" class="form-control" /> <?php } ?> </td> <td style="padding-left:10px;"> <?php if ($orderItemData['totalamount']== '') { ?> <input type="text" name="quantity4[]" id="quantity4<?php echo $x; ?>" value="<?php echo $purchaseamount; ?>" autocomplete="off" class="form-control" readonly/> <?php } else { ?> <input type="text" name="quantity4[]" id="quantity4<?php echo $x; ?>" value="<?php echo $orderItemData['totalamount']; ?>" autocomplete="off" class="form-control" readonly/> <?php } ?> </td>--> <td> <button type="button" class="btn btn-default" onclick="addRow()" id="addRowBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-plus-sign"></i> Add More </button> </td> <td> <button class="btn btn-default removeProductRowBtn" type="button" id="removeProductRowBtn" onclick="removeProductRow(<?php echo $x; ?>)"><i class="glyphicon glyphicon-trash"></i></button> </td> </tr> <?php $arrayNumber++; $x++; $subTotal += $purchaseamount; } // /for ?> </tbody> </table> <div class="col-sm-3"> <div class="form-group"> <label>Grand Total</label> <input name="totalat" type="text" value="<?php echo $data[5]; ?>" id="subTotal" class="form-control" placeholder="Total Value" readonly> </div> </div> <!--<div class="col-sm-4"> <div class="form-group"> <label>Delivery Charges</label> <input name="offer" type="text" value="<?php echo $data[6]; ?>" class="form-control" placeholder="Total Value" readonly> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Total Value</label> <input name="totaloffer" type="text" value="<?php echo $data[7]; ?>" id="totaloffer" class="form-control" placeholder="Total Value" readonly> </div> </div>--> <div class="col-sm-3"> <div class="form-group"> <label>Discount Percentage</label> <input name="amountwt" type="text" id="amountwt" class="form-control" placeholder="Discount Percentage" onkeyup="discountamtw()"> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Discounts</label> <input name="discount" type="text" value="<?php echo $data[9]; ?>" id="amount" class="form-control" placeholder="Taxable Value" readonly> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Net Value</label> <input name="name9" type="text" value="<?php echo $data[10]; ?>" id="discountamnt" class="form-control" placeholder="Enter Visitor Name" readonly> </div> </div> <!-- <div class="col-sm-4"> <div class="form-group"> <label>Total Profit</label> <?php if ($data[11]== '') { ?> <input name="purchaseamount" type="text" value="<?php echo $subTotal; ?>" id="purchaseamount" class="form-control" placeholder="Enter Visitor Name" readonly> <?php } else { ?> <input name="purchaseamount" type="text" value="<?php echo $data[11]; ?>" id="purchaseamount" class="form-control" placeholder="Enter Visitor Name" readonly> <?php } ?> </div> </div>--> <!-- <div class="col-sm-6"> <div class="form-group"> <label>Discount</label> <input name="discount" type="text" value="<//?php echo $data[16] ?>" id="amount" class="form-control" placeholder="Discount Amount" onkeyup="discountamtw()" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Total Amount</label> <input name="name9" type="text" value="<//?php echo $data[10] ?>" id="discountamnt" class="form-control" placeholder="Enter Visitor Name" readonly required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Paid</label> <input name="name10" type="text" value="<//?php echo $data[11] ?>" id="subTotal" class="form-control" placeholder="Enter Visitor Name" readonly> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Balance</label> <input name="name11" type="text" value="<//?php echo $data[12] ?>" id="subTotal" class="form-control" placeholder="Enter Visitor Name" readonly> </div> </div>--> <input name="id" type="hidden" value="<?php echo $cid ?>" id="id" class="form-control" placeholder="Enter Visitor Name" required> <div class="reset-button"> <button type="submit" id="createOrderBtn" data-loading-text="Loading..." class="btn btn-success"><i class="glyphicon glyphicon-ok-sign"></i>Save & Print</button> <a href="#" class="btn btn-black">Reset</a> </div> </form> </div> </div> </div> </div> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <footer class="main-footer"> <strong>Copyright ©2020<a href="https://foxthreetechnologies.com/">Fox Three Technologies</a>.</strong> All rights reserved. </footer> </div> <!-- ./wrapper --> <!-- Start Core Plugins =====================================================================--> <!-- jQuery --> <!-- jquery-ui --> <script src="assets/plugins/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script> <!-- Bootstrap --> <script src="assets/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!-- lobipanel --> <script src="assets/plugins/lobipanel/lobipanel.min.js" type="text/javascript"></script> <!-- Pace js --> <script src="assets/plugins/pace/pace.min.js" type="text/javascript"></script> <!-- SlimScroll --> <script src="assets/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script> <!-- FastClick --> <script src="assets/plugins/fastclick/fastclick.min.js" type="text/javascript"></script> <!-- CRMadmin frame --> <script src="assets/dist/js/custom.js" type="text/javascript"></script> <!-- End Core Plugins =====================================================================--> <!-- Start Theme label Script =====================================================================--> <!-- Dashboard js --> <script src="assets/dist/js/dashboard.js" type="text/javascript"></script> <!-- End Theme label Script =====================================================================--> <script src="js/order.js"></script> <script type="text/javascript"> function getProductDataw() { var name = $("#name").val(); if(name == "") { $("#cusname").val(""); $("#address").val(""); $("#cnm").val(""); } else { $.ajax({ url: 'fetchcust2.php', type: 'post', data: {name : name}, dataType: 'json', success:function(response) { // setting the rate value into the rate input field $("#cusname").val(response.name2); $("#address").val(response.name3); $("#cnm").val(response.name4); } // /success }); // /ajax function to fetch the product data } } function addRow() { $("#addRowBtn").button("loading"); var tableLength = $("#productTable tbody tr").length; var tableRow; var arrayNumber; var count; if(tableLength > 0) { tableRow = $("#productTable tbody tr:last").attr('id'); arrayNumber = $("#productTable tbody tr:last").attr('class'); count = tableRow.substring(3); count = Number(count) + 1; arrayNumber = Number(arrayNumber) + 1; } else { // no table row count = 1; arrayNumber = 0; } $.ajax({ url: 'fetchProductData.php', type: 'post', dataType: 'json', success:function(response) { $("#addRowBtn").button("reset"); $('.selectpicker').selectpicker(); var tr = '<tr id="row'+count+'" class="'+arrayNumber+'">'+ '<td>'+ '<div class="form-group">'+ '<select name="productName[]" id="productName'+count+'" class="form-control selectpicker" data-live-search="true" onchange="getProductData('+count+')" >'+ '<option value="">~~SELECT~~</option>'; // console.log(response); $.each(response, function(index, value) { tr += '<option value="'+value[0]+'">'+value[1]+'</option>'; }); tr += '</select>'+ '</div>'+ '</td>'+ '<td style="padding-left:10px;"">'+ '<input type="text" name="rate[]" id="rate'+count+'" onkeyup="getTotal('+count+')" autocomplete="off" class="form-control" />'+ '<input type="hidden" name="rateValue[]" id="rateValue'+count+'" autocomplete="off" class="form-control" />'+ '</td style="padding-left:20px;">'+ '<td style="padding-left:10px;">'+ '<input type="text" name="quantity[]" id="quantityamwt'+count+'" onkeyup="getTotal('+count+')" autocomplete="off" class="form-control" />'+ '</td>'+ //'<td style="padding-left:10px;">'+ '<input type="hidden" name="hsn[]" id="hsn'+count+'" autocomplete="off" class="form-control" />'+ //'</td>'+ //'<td style="padding-left:10px;">'+ //'<input type="hidden" name="hsn1[]" id="hsn1'+count+'" autocomplete="off" class="form-control" />'+ //'</td>'+ '<input type="hidden" name="hsn2[]" id="hsn2'+count+'" autocomplete="off" class="form-control" />'+ '<input type="hidden" name="productNament[]" id="productNament'+count+'" autocomplete="off" class="form-control" />'+ '<input type="hidden" name="quantity1[]" id="quantity1'+count+'" onkeyup="getTotal1('+count+')" autocomplete="off" class="form-control" min="1" />'+ '<input type="hidden" name="quantity2[]" id="quantity2'+count+'" autocomplete="off" class="form-control" readonly/>'+ '<input type="hidden" name="totalamnt[]" id="totalamnt'+count+'" autocomplete="off" class="form-control" readonly />'+ '<input type="hidden" name="totalValueamnt[]" id="totalValueamnt'+count+'" autocomplete="off" class="form-control" />'+ '<td style="padding-left:10px;">'+ '<input type="text" name="total[]" id="total'+count+'" autocomplete="off" class="form-control" readonly />'+ '<input type="hidden" name="totalValue[]" id="totalValue'+count+'" autocomplete="off" class="form-control" />'+ '</td>'+ //'<td style="padding-left:10px;">'+ //'<input type="text" name="quantity3[]" id="quantity3'+count+'" onkeyup="getTotal2('+count+')" autocomplete="off" class="form-control" min="1" />'+ //'</td>'+ //'<td style="padding-left:10px;">'+ //'<input type="text" name="quantity4[]" id="quantity4'+count+'" autocomplete="off" class="form-control" readonly/>'+ //'</td>'+ '<td>'+ '<button type="button" class="btn btn-default" onclick="addRow()('+count+')" id="addRowBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-plus-sign"></i> Add Row </button>'+ '</td>'+ '<td>'+ '<button class="btn btn-default removeProductRowBtn" type="button" onclick="removeProductRow('+count+')"><i class="glyphicon glyphicon-trash"></i></button>'+ '</td>'+ '</tr>'; $('.selectpicker').selectpicker(); if(tableLength > 0) { $("#productTable tbody tr:last").after(tr); $('.selectpicker').selectpicker(); } else { $("#productTable tbody").append(tr); $('.selectpicker').selectpicker(); } } // /success }); // get the product data } // /add row function removeProductRow(row = null) { if(row) { $("#row"+row).remove(); subAmount(); } else { alert('error! Refresh the page again'); } } // select on product data function getProductData(row = null) { if(row) { var productId = $("#productName"+row).val(); if(productId == "") { $("#rate"+row).val(""); $("#quantityamwt"+row).val(""); $("#hsn"+row).val(""); $("#hsn1"+row).val(""); $("#hsn2"+row).val(""); $("#productNament"+row).val(""); $("#quantity1"+row).val(""); $("#hsn1"+row).val(""); $("#quantity2"+row).val(""); $("#totalamnt"+row).val(""); $("#quantity3"+row).val(""); $("#quantity4"+row).val(""); $("#total"+row).val(""); // remove check if product name is selected // var tableProductLength = $("#productTable tbody tr").length; // for(x = 0; x < tableProductLength; x++) { // var tr = $("#productTable tbody tr")[x]; // var count = $(tr).attr('id'); // count = count.substring(3); // var productValue = $("#productName"+row).val() // if($("#productName"+count).val() == "") { // $("#productName"+count).find("#changeProduct"+productId).removeClass('div-hide'); // console.log("#changeProduct"+count); // } // } // /for } else { $.ajax({ url: 'fetchSelectedProduct.php', type: 'post', data: {productId : productId}, dataType: 'json', success:function(response) { // setting the rate value into the rate input field $("#rate"+row).val(response.name12); $("#rateValue"+row).val(response.name12); $("#quantityamwt"+row).val(1); $("#hsn"+row).val(response.name8); $("#hsn1"+row).val(response.name10); $("#hsn2"+row).val(response.name); $("#productNament"+row).val(response.name7); var total = Number(response.name12) * 1; total = total.toFixed(2); $("#totalamnt"+row).val(total); $("#totalValueamnt"+row).val(total); $("#quantity1"+row).val(response.name4); var quantity2 = Number($("#totalamnt"+row).val()) -(Number($("#totalamnt"+row).val()) * (100/(100+ Number($("#quantity1"+row).val())))); quantity2 = quantity2.toFixed(2); $("#quantity2"+row).val(quantity2); $("#quantity3"+row).val(response.name16); var quantity4 = Number($("#totalamnt"+row).val()) - (Number($("#quantityamwt"+row).val()) * Number($("#quantity3"+row).val())); quantity4 = quantity4.toFixed(2); $("#quantity4"+row).val(quantity4); var total1 = Number($("#totalamnt"+row).val()); total1 = total1.toFixed(2); $("#total"+row).val(total1); $("#totalValue"+row).val(total1); subAmount(); } // /success }); // /ajax function to fetch the product data } } else { alert('no row! please refresh the page'); } } // /select on product data function getTotal1(row = null) { if(row) { var quantity2 = Number($("#totalamnt"+row).val()) -(Number($("#totalamnt"+row).val()) * (100/(100+ Number($("#quantity1"+row).val())))); quantity2 = quantity2.toFixed(2); $("#quantity2"+row).val(quantity2); subAmount(); } else { alert('no row !! please refresh the page'); } } // table total function getTotal2(row = null) { if(row) { var quantity4 = Number($("#totalamnt"+row).val()) - (Number($("#quantityamwt"+row).val()) * Number($("#quantity3"+row).val())); quantity4 = quantity4.toFixed(2); $("#quantity4"+row).val(quantity4); var total1 = Number($("#totalamnt"+row).val()); total1 = total1.toFixed(2); $("#total"+row).val(total1); $("#totalValue"+row).val(total1); subAmount(); } else { alert('no row !! please refresh the page'); } } function getTotal(row = null) { if(row) { var total = Number($("#rate"+row).val()) * Number($("#quantityamwt"+row).val()); total = total.toFixed(2); $("#totalamnt"+row).val(total); $("#totalValueamnt"+row).val(total); var quantity2 = Number($("#totalamnt"+row).val()) -(Number($("#totalamnt"+row).val()) * (100/(100+ Number($("#quantity1"+row).val())))); quantity2 = quantity2.toFixed(2); $("#quantity2"+row).val(quantity2); var quantity4 = Number($("#totalamnt"+row).val()) - (Number($("#quantityamwt"+row).val()) * Number($("#quantity3"+row).val())); quantity4 = quantity4.toFixed(2); $("#quantity4"+row).val(quantity4); var total1 = Number($("#totalamnt"+row).val()); total1 = total1.toFixed(2); $("#total"+row).val(total1); $("#totalValue"+row).val(total1); subAmount(); } else { alert('no row !! please refresh the page'); } } function subAmount() { var tableProductLength = $("#productTable tbody tr").length; var totalSubAmount = 0; var subamot = 0; var totalSubAmount1 = 0; var subamot1 = 0; for(x = 0; x < tableProductLength; x++) { var tr = $("#productTable tbody tr")[x]; var count = $(tr).attr('id'); count = count.substring(3); totalSubAmount = Number(totalSubAmount) + Number($("#totalamnt"+count).val()); subamot = Number(subamot) + Number($("#quantity2"+count).val()); totalSubAmount1 = Number(totalSubAmount1) + Number($("#total"+count).val()); subamot1 = Number(subamot1) + Number($("#quantity4"+count).val()); } // /for totalSubAmount = totalSubAmount.toFixed(2); subamot = subamot.toFixed(2); totalSubAmount1 = totalSubAmount1.toFixed(2); subamot1 = subamot1.toFixed(2); // sub total $("#subTotal").val(totalSubAmount); $("#subTotalValue").val(totalSubAmount); $("#subamot").val(subamot); var subtotalamt = Number($("#subTotal").val()) - Number($("#subamot").val()); $("#subtotalamt").val(subtotalamt); $("#purchaseamount").val(subamot1); amount = Number($("#subTotal").val()) * Number($("#amountwt").val())/100; amount = amount.toFixed(2); $("#amount").val(amount); var discountamnt = Number($("#subTotal").val()) - Number($("#amount").val()); $("#discountamnt").val(discountamnt); //var discountpetr = Number($("#subTotal").val()) - (Number($("#subTotal").val())/100)*Number($("#percentage").val()); //$("#discountpetr").val(discountpetr); // vat var vat = (Number($("#subTotal").val())/100) * 13; vat = vat.toFixed(2); $("#vat").val(vat); $("#vatValue").val(vat); // total amount var totalAmount = (Number($("#subTotal").val()) + Number($("#vat").val())); totalAmount = totalAmount.toFixed(2); $("#totalAmount").val(totalAmount); $("#totalAmountValue").val(totalAmount); var discount = $("#discount").val(); if(discount) { var grandTotal = Number($("#totalAmount").val()) - Number(discount); grandTotal = grandTotal.toFixed(2); $("#grandTotal").val(grandTotal); $("#grandTotalValue").val(grandTotal); } else { $("#grandTotal").val(totalAmount); $("#grandTotalValue").val(totalAmount); } // /else discount var paidAmount = $("#paid").val(); if(paidAmount) { paidAmount = Number($("#grandTotal").val()) - Number(paidAmount); paidAmount = paidAmount.toFixed(2); $("#due").val(paidAmount); $("#dueValue").val(paidAmount); } else { $("#due").val($("#grandTotal").val()); $("#dueValue").val($("#grandTotal").val()); } // else } // /sub total amount function discountamtw() { var amount = $("#totaloffer").val(); var subTotal = Number($("#subTotal").val()); amount = Number($("#subTotal").val()) * Number($("#amountwt").val())/100; amount = amount.toFixed(2); $("#amount").val(amount); var discountamnt = Number($("#subTotal").val()) - Number($("#amount").val()); $("#discountamnt").val(discountamnt); } // /discount function function discountperw() { var percentage = $("#percentage").val(); var subTotal = Number($("#subTotal").val()); var discountpetr = Number($("#subTotal").val()) - (Number($("#subTotal").val())/100)* Number($("#percentage").val()); $("#discountpetr").val(discountpetr); } // /discount function function paidAmount() { var grandTotal = $("#grandTotal").val(); if(grandTotal) { var dueAmount = Number($("#grandTotal").val()) - Number($("#paid").val()); dueAmount = dueAmount.toFixed(2); $("#due").val(dueAmount); $("#dueValue").val(dueAmount); } // /if } // /paid amoutn function </script> </body> <!-- Mirrored from thememinister.com/crm/add-customer.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 03 Oct 2019 15:43:24 GMT --> </html>