EVOLUTION-NINJA
Edit File: edit_generated_po.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('dashboard_assets/css/main.css'); ?>" /> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <script src="<?php echo base_url('assets/js/jquery-ui.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('dashboard_assets/js/popper.min.js'); ?>" ></script> <div class="container"> <div class="page-content-wrapper"> <div class="page-content"> <h3 class="page-title" style="padding-top: 20px;">Edit Generated PO</h3> <form method="post" id="po_submit"> <div class="row"> <div class="col-sm-4"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>PO#</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <input class="form-control" type="text" name="po_no" id="po_no" style="width: 100%;border: transparent; background: #ffffff !important; border:1px solid black;" value="<?php echo $po->po_no; ?>" readonly> <input type="hidden" name="po_id" id="po_id" value="<?php echo $po->po_id; ?>" style="background: #ffffff !important;"> <input type="hidden" name="financial_year" id="financial_year" value="<?php echo $po->financial_year; ?>" style="background: #ffffff !important;"> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Level</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <select name="level" class="form-control" id="level" required> <option value="">Select</option> <?php foreach ($level as $key => $value) {?> <option value="<?php echo $value->id;?>" <?php if($value->id==$po->level_id) {echo 'selected';} ?>><?php echo $value->level_name;?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Date</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <input class="form-control" type="text" name="g_date" id="g_date" style="width: 100%;border: transparent; background: #ffffff !important; border:1px solid black;" value="<?php $date = new DateTime($po->po_date); echo $date->format('d-m-Y'); ?>" readonly> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Currency</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <select name="currency" id="currency" class="form-control" style="width: 100%;border: transparent;" required> <option value="INR" <?php if($po->currency == "INR") echo "selected='selected'" ?>>INR</option> <option value="CHF" <?php if($po->currency == "CHF") echo "selected='selected'" ?>>CHF</option> <option value="EUR" <?php if($po->currency == "EUR") echo "selected='selected'" ?>>EUR</option> <option value="GBP" <?php if($po->currency == "GBP") echo "selected='selected'" ?>>GBP</option> <option value="USD" <?php if($po->currency == "USD") echo "selected='selected'" ?>>USD</option> </select> </div> </div> </div> </div> <div class="col-sm-4"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Layout</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <select name="layout" class="form-control" id="layout" required> <option value="">Select</option> <?php foreach ($layouts as $key => $value) {?> <option value="<?php echo $value->id;?>" <?php if($value->id==$po->layout_id) {echo 'selected';} ?>><?php echo $value->layout_name;?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Customer</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <input class="form-control" type="text" name="customer" id="customer" value="<?php echo $po->customer; ?>" readonly > </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Customer Address</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <textarea name="customer_address" class="form-control customer_address" id="customer_address" required><?php echo $po->customer_address; ?></textarea> </div> </div> </div> </div> <div class="col-sm-4"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Site</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <select name="site_number" class="form-control site_number" id="site_number" required > </select> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Vendor</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <select name="vendor" class="form-control change_vendor" id="vendor" required> <option value="">Select</option> <?php foreach ($vendor as $key => $value) {?> <option value="<?php echo $value->id;?>" <?php if($value->id==$po->vendor_name) {echo 'selected';} ?>><?php echo $value->vendor;?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label><b>Vendor Address</b></label> </div> </div> <div class="col-sm-8"> <div class="form-group"> <textarea name="vendor_address" class="form-control vendor_address" id="vendor_address" readonly ></textarea> </div> </div> </div> </div> </div> <div class="row"> <div class="table-responsive tablerow"> <table style="width:100%;" class="table table-bordered"> <thead class="thead-default"> <tr> <th>Sl. No.</th> <th>Product Name</th> <th style="width: 200px;">Product Type</th> <?php if($po->indent_id != 0) { ?> <th style="width: 200px;">Indent</th> <th style="width: 200px;">Layout</th> <th style="width: 200px;">Site/Home No</th> <?php } else { ?> <?php } ?> <!--<th>Department</th>--> <!-- <th>Stock Quantity</th> --> <th>Quantity</th> <th>Unit Price</th> <th class="inr_val" id="inr_val" name="inr_val">INR Value</th> <th class="chf_val" id="chf_val" name="chf_val" style="display: none;">CHF Value</th> <th style="display: none;" class="eur_val" id="eur_val" name="eur_val">EUR Value</th> <th style="display: none;" class="gbp_val" id="gbp_val" name="gbp_val">GBP Value</th> <th style="display: none;" class="usd_val" id="usd_val" name="usd_val">USD Value</th> <th>SGST</th> <th>CGST</th> <th>IGST</th> <th>Total Value</th> <th class="action">Action</th> </tr> </thead> <tbody> <?php $i=1; ?> <?php if(isset($po_data)) { foreach($po_data as $key=>$po_data) { ?> <input type="hidden" name="edit_id[]" class="edit_id<?php echo $key;?>" value="<?php echo $po_data->id;?>" > <tr> <td scope="row"><?php echo $i; ?></td> <td><input type="text" class="product_name" name="product_name[]" id="product_name" value="<?php echo $po_data->product_name;?>" style="border: transparent;text-transform: uppercase !important;" readonly="readonly" required> </td> <td><input type="text" style="border:transparent;text-transform: uppercase !important;" class="product_type" name="product_type[]" id="product_type" value="<?php echo $po_data->product_type; ?>" readonly > </td> <?php if($po->indent_id != 0) { ?> <td><input type="text" class="indent_no" name="indent_no[]" id="indent_no" value="<?php echo $po_data->indent_no; ?>" style="border: transparent;"> </td> <td><input type="text" style="border:transparent;text-transform: uppercase !important;" class="layout" name="layout[]" id="layout" value="<?php echo $po_data->layout; ?>" readonly > </td> <td><input type="text" style="border:transparent;text-transform: uppercase !important;" class="site" name="site[]" id="site" value="<?php echo $po_data->site; ?>" readonly > </td> <?php } else { ?> <input type="hidden" class="indent_no" name="indent_no[]" id="indent_no" value="product_po" style="border: transparent;"> <?php } ?> <!--<td><input type="text" class="department" name="department[]" id="department" value="<?php echo $po_data->department;?>" style="border: transparent;text-transform: uppercase !important;" readonly="readonly" required> </td>--> <!-- <td><input type="text" style="border:transparent;text-transform: uppercase !important;" class="site" name="stock_quantity[]" id="stock_quantity" value="<?php echo $po_data->stock_quantity; ?>" readonly > </td> --> <td><!-- <input type="text" id="quantity_no<?php echo $key;?>" class="quantity_no<?php echo $key;?>" name="quantity_no[]" value="<?php echo $po_data->quantity_no; ?>" style="width: 100%;border: transparent;" required> --> <input type="text" id="quantity_no<?php echo $key;?>" onkeyup="quantity_valuefirst(this.value,<?php echo $key;?>)" class="quantity_no<?php echo $key;?>" name="quantity_no[]"value="<?php echo $po_data->quantity; ?>" style="width: 100%;border: transparent;" required> </td> <td><input type="text" id="unit_price<?php echo $key;?>" name="unit_price[]" onkeyup="unit_valuefirst(this.value,<?php echo $key;?>)" class="unit_price<?php echo $key;?>" value="<?php echo $po_data->unit_price; ?>" style="width: 100%;border: transparent;" required></td> <td><input type="text" class="inr_value<?php echo $key;?> inrval" id="inr_value<?php echo $key;?>" name="inr_value[]" value="<?php echo $po_data->inr_value; ?>" style="width: 100%;border: transparent;" required readonly></td> <td ><input type="text" class="sgst<?php echo $key;?>" id="sgst<?php echo $key;?>" name="sgst[]" onkeyup="gstvalue1(this.value,<?php echo $key;?>)" value="<?php echo $po_data->sgst; ?>" style="width: 50%;border: transparent;" required> <span>%</span></td> <td><input type="text" class="cgst<?php echo $key;?>" id="cgst<?php echo $key;?>" name="cgst[]" onkeyup="gstvalue2(this.value,<?php echo $key;?>)" value="<?php echo $po_data->cgst; ?>" style="width: 50%;border: transparent;" required> <span>%</span></td> <td><input type="text" class="igst<?php echo $key;?>" id="igst<?php echo $key;?>" name="igst[]" onkeyup="gstvalue3(this.value,<?php echo $key;?>)" value="<?php echo $po_data->igst; ?>" style="width: 50%;border: transparent;" required> <span>%</span></td> <td><input type="text" class="total_value<?php echo $key;?> tot_val" id="total_value<?php echo $key;?>" name="total_value[]" value="<?php echo $po_data->total_value; ?>" style="width: 100%;border: transparent;" required readonly></td> <td class="action" style="text-align:center;padding: 5px;border: 1px solid #000;vertical-align: middle;"><a onclick="remove(<?php echo $key;?>);" class="remove" href="javascript:void(0);"><i class="fa fa-trash" aria-hidden="true"></i></a></td> </tr> <?php $i++; } } ?> <tr> <th scope="row"></th> <?php if($po->indent_id != 0) { ?> <td colspan="6"> <?php } else { ?> <td colspan="2"> <?php } ?> <input type="text" placeholder="OTHER CHARGES :" name="ot_charges" value="<?php echo $po->ot_charges; ?>" id="ot_charges" style="width: 100%;border: transparent;text-transform: uppercase !important;" ></td> <td ><input type="text" id="ot_charges_quantity" name="ot_charges_quantity" value="<?php echo $po->ot_charges_quantity; ?>" style="width: 100%;border: transparent;" ></td> <td ><input type="text" id="ot_charges_unit_price" name="ot_charges_unit_price" value="<?php echo $po->ot_charges_unit_price; ?>" onkeyup="unitvalue1(this.value)" style="width: 100%;border: transparent;" ></td> <td><input type="text" class="ot_charges_inr_value" id="ot_charges_inr_value" name="ot_charges_inr_value" value="<?php echo $po->ot_charges_inr_value; ?>" style="width: 100%;border: transparent;" readonly></td> <td><input type="text" class="ot_charges_sgst ot_sgst" id="ot_charges_sgst" name="ot_charges_sgst" value="<?php echo $po->ot_charges_sgst; ?>" onkeyup="sgstvalue1(this.value)" style="width: 42%;border: transparent;" > <span>%</span></td> <td><input type="text" class="ot_charges_cgst ot_cgst" id="ot_charges_cgst" name="ot_charges_cgst" value="<?php echo $po->ot_charges_cgst; ?>" onkeyup="sgstvalue2(this.value)" style="width: 42%;border: transparent;" > <span>%</span></td> <td><input type="text" class="ot_charges_igst ot_igst" id="ot_charges_igst" name="ot_charges_igst" value="<?php echo $po->ot_charges_igst; ?>" onkeyup="sgstvalue3(this.value)" style="width: 42%;border: transparent;" > <span>%</span></td> <td><input type="text" class="ot_charges_tot_val to_val" id="ot_charges_tot_val" name="ot_charges_tot_val" value="<?php echo $po->ot_charges_tot_val; ?>" style="width: 100%;border: transparent;" ></td> </tr> <tr> <?php if($po->indent_id != 0) { ?> <th colspan="9" rowspan="5"> <?php } else { ?> <th colspan="5" rowspan="5"> <?php } ?> <textarea rows="3" id="note" name="note" style="width: 100%; border: transparent;text-transform: uppercase !important;" placeholder="NOTE : " ><?php echo $po->note; ?></textarea> </th> <td colspan="3">TOTAL AMOUNT</td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" class="total_amt" id="total_amt" name="total_amt" value="<?php echo $po->total_amt; ?>" style="width: 100%;border: transparent;" readonly="readonly" required onfocusin="amount_total1()"></td> </tr> <!--<tr> <td colspan="3">DISCOUNT %<br/>DISCOUNT Rs</td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" class="discount" id="discount" name="discount" value="<?php echo $po->discount; ?>" onkeyup="discountvalue(this.value)" style="width: 100%;border: transparent;"> <span>%</span> <tdcolspan="2" style="padding-bottom: 10px;"><input type="text" name="discount_amount" class="discount_amount" value="<?php echo $po->discount_amount; ?>" onkeyup="discountamount(this.value)" style="width: 100%;border: transparent;margin-top: 10px;"> <span>Rs</span> </td> </tr>--> <tr> <td colspan="3">TAX AMOUNT</td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" name="tax_amount" id="tax_amount" class="tax_amount" value="<?php echo $po->tax_amount; ?>" style="width: 100%;border: transparent;" readonly="readonly" required> </td> </tr> <tr> <td colspan="3">TOTAL</td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" name="total" id="total" class="total" value="<?php echo $po->total; ?>" style="width: 100%;border: transparent;" readonly="readonly" required> </td> </tr> <tr> <td colspan="3"><p><span onclick="plus_function();">Plus</span>/<span onclick="minus_function();">Minus</span></p></td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" name="round_off" id="round_off" class="round_off" onkeyup="rounded_of(this.value)" value="<?php echo $po->round_off; ?>" style="width: 100%;border: transparent;" required> </td> </tr> <tr> <td colspan="3">GRAND TOTAL</td> <td colspan="2" style="padding-bottom: 10px;"><input type="text" class="g_total" id="g_total" name="g_total" value="<?php echo $po->g_total; ?>" style="width: 100%;border: transparent;" readonly="readonly" required></td> </tr> <tr> <td colspan="10" style=""> <h5 style="padding-bottom: 15px;">Terms and Conditions:</h5> <ol> <li>Material Delivery :<input type="text" class="comment" id="comment" name="comment" value="<?php echo $po->comment; ?>" style="width: 70%;border: transparent; text-transform: uppercase !important;" ></li> <li>GST No. :<input type="text" class="gst_no" id="gst_no" name="gst_no" value="<?php echo $po->gst_no; ?>" style="width: 70%;border: transparent; text-transform: uppercase !important;" ></li> <li>Terms of payment :<input type="text" class="terms_payment" id="terms_payment" name="terms_payment" value="<?php echo $po->terms_payment; ?>" style="width: 70%;border: transparent; text-transform: uppercase !important;" ></li> <li>BANK DETAILS :<input type="text" class="bank_details" id="bank_details" name="bank_details" value="<?php echo $po->bank_details; ?>" style="width: 70%;border: transparent; text-transform: uppercase !important;" ></li> </ol> </td> </tr> </tbody> </table> </div> </div> <br/><br/> <button type="submit" class="btn center-block" id="submit_button" style="float: left;margin-left: 39%;width: 100px; background: #405189 !important ; color: white;">Update</button> <button type="button" class="btn default cancel" style="background: white; margin-left: 20px;" >Cancel</button> <br/><br/> </form> </div> <!-- page-content --> </div> </div> <script type="text/javascript"> changelayout_onload(); changevendor_onload(); $('.cancel').click(function(){ window.location = '<?php echo site_url("po-list")?>'; }); function changelayout_onload() { var layout_name = '<?php echo $po->layout_id; ?>'; var site_id = '<?php echo $po->site_id; ?>'; /*alert(layout_name); alert(site_id);*/ $.ajax({ type:'post', url:'<?php echo site_url('fetch-site-id');?>', data:{"layout_name":layout_name}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var con = ''; //con += '<option value="">select</option>'; $.each(response.message, function( key, value ) { con += '<option value="'+value.id+'"'; if(site_id == value.id) { con += ' selected >'+value.site_no+'</option>'; } else { con += ' >'+value.site_no+'</option>'; } }); $('.site_number').empty(); $('.site_number').append(con); } else { toastr["error"](response.message); } } }); } $('#layout').change(function() { var layout_name = $(this).val(); $.ajax({ type:'post', url:'<?php echo site_url('fetch-site-id');?>', data:{"layout_name":layout_name}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var con = ''; con += '<option value="">select</option>'; $.each( response.message, function( key, value ) { con += '<option value="'+value.id+'">'+value.site_no+'</option>'; }); $('.site_number').empty(); $('.site_number').append(con); } else { toastr["error"](response.message); } } }); }); $('#site_number').change(function() { var layout_id = $('#layout').val(); var site_number = $(this).val(); /*alert(layout_id); alert(site_number);*/ $.ajax({ type:'post', url:'<?php echo site_url('fetch-sales-customer');?>', data:{"layout_id":layout_id,"site_id":site_number}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var customer_name = response.message.name; var customer_address = response.message.address; $('#customer').val(customer_name); $('#customer_address').val(customer_address); } else { toastr["error"](response.message); } } }); }); $('#site_number').change(function() { var layout_id = $('#layout').val(); var site_number = $(this).val(); $.ajax({ type:'post', url:'<?php echo site_url('fetch-sales-customer');?>', data:{"layout_id":layout_id,"site_id":site_number}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var customer_name = response.message.name; var customer_address = response.message.address; $('#customer').val(customer_name); $('#customer_address').val(customer_address); } else { toastr["error"](response.message); } } }); }); $(document).ready(function() { $("#vendor_name" ).autocomplete({ source: '<?php echo site_url("auto-complete-vendor-name"); ?>', }); }); function changevendor_onload() { var id = '<?php echo $po->vendor_name; ?>'; $.ajax({ type : 'post', url :"<?php echo site_url('vendor-data')?>", data :{'id':id}, success:function(response) { obj=jQuery.parseJSON(response); console.log(obj); if(obj.result == 1) { document.getElementById('vendor_address').value+=obj.message.address+"\n"; document.getElementById('vendor_address').value+=obj.message.city+"\n"; document.getElementById('vendor_address').value+=obj.message.country+"\n"; document.getElementById('vendor_address').value+=obj.message.pincode; } } }); } $('.change_vendor').change(function() { var id = $('#vendor option:selected').val(); $.ajax({ type : 'post', url :"<?php echo site_url('vendor-data')?>", data :{'id':id}, success:function(response) { obj=jQuery.parseJSON(response); console.log(obj); if(obj.result == 1) { var con = ''; con += obj.message.address+"\n"; con += obj.message.city+"\n"; con += obj.message.country+"\n"; con += obj.message.pincode; $('#vendor_address').val(con); } } }); }); $('#po_submit').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); swal({ title: "Are you sure?", text: "You want to Save this?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : 'post', url : "<?php echo site_url('update-created-po');?>", data : formdata, contentType: false, processData: false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { toastr["success"](response.message); setTimeout(function wait(){ window.location = '<?php echo site_url("po-list")?>'; }, 1000); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); function remove(i) { var del_id = $('.edit_id'+i).val(); //alert(del_id); swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("delete-created-po")?>", type:"POST", data:{'p_id':del_id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { location.reload(); amount_total1(); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } /*$('.remove').click(function(){ $(this).closest('tr').remove(); amount_total1(); });*/ function unit_valuefirst(str,i) { var unit=str; var quantity_val = $('.quantity_no'+i).val(); var inr_val = str * quantity_val; $('.inr_value'+i).val(inr_val); var cgst =$('.cgst'+i).val(); var sgst =$('.sgst'+i).val(); var igst =$('.igst'+i).val(); var tax=parseFloat(cgst) + parseFloat(sgst)+ parseFloat(igst); var total_val =(inr_val * tax)/100 ; var total=parseFloat(total_val) + parseFloat(inr_val); $('.total_value'+i).val(total); amount_total1(); } function quantity_valuefirst(str,i) { var quantity=str; var unit_val = $('.unit_price'+i).val(); var inr_val = parseFloat(quantity) * parseFloat(unit_val); $('.inr_value'+i).val(inr_val); var cgst =$('.cgst'+i).val(); var sgst =$('.sgst'+i).val(); var igst =$('.igst'+i).val(); var tax=parseFloat(cgst) + parseFloat(sgst)+ parseFloat(igst); var total_val =(parseFloat(inr_val) * parseFloat(tax))/100 ; var total=parseFloat(total_val) + parseFloat(inr_val); $('.total_value'+i).val(total); amount_total1(); } function amount_total1() { var a=$(".to_val").val(); var tot_vals=[]; $('.tot_val').each(function () { tot_vals.push($(this).val()); }); var sum = 0; for(var i=0; i < tot_vals.length; i++) { sum += parseFloat(tot_vals[i]); } /*if(a=="") { $('.total_amt').val(parseFloat(sum).toFixed(2)); $('.g_total').val(total_amt.toFixed(2)); } else { var amnt=parseFloat(sum) + parseFloat(a); $('.total_amt').val(amnt.toFixed(2)); $('.g_total').val(amnt.toFixed(2)); }*/ var sum=0; $(".tot_val").each(function(i,val){ if($(this).val()!=''){ m=$(this).val(); m=parseFloat(m); sum+=m; } }); var sum1=0; $(".inrval").each(function(i,val){ if($(this).val()!=''){ m1=$(this).val(); m1=parseFloat(m1); sum1+=m1; } }); var sum2=parseFloat(sum)-parseFloat(sum1); $('.total_amt').val(sum1.toFixed(2)); $('.tax_amount').val(sum2.toFixed(2)); $('.g_total').val(sum.toFixed(2)); $('.total').val(sum.toFixed(2)); } function unitvalue1(str) { var unit=str; var quantity_val =$('#ot_charges_quantity').val(); var inr_val = str * quantity_val; $('.ot_charges_inr_value').val(inr_val); var cgst =$('.ot_charges_cgst').val(); var sgst =$('.ot_charges_sgst').val(); var igst =$('.ot_charges_igst').val(); var tax=parseFloat(cgst) + parseFloat(sgst) + parseFloat(igst); var total_val =(inr_val * tax)/100 ; var total=parseFloat(total_val) + parseFloat(inr_val); $('.ot_charges_tot_val').val(total); amount_total1(); } function gstvalue1(str,i) { var gst=str; var inr_val =$('.inr_value'+i).val(); var cgst =$('.cgst'+i).val(); var igst =$('.igst'+i).val(); var sgst =$('.sgst'+i).val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst) + parseFloat(inr_val); $('.total_value'+i).val(total); amount_total1(); } function gstvalue2(str,i) { var inr_val =$('.inr_value'+i).val(); var cgst =$('.cgst'+i).val(); var igst =$('.igst'+i).val(); var sgst =$('.sgst'+i).val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst)+ parseFloat(inr_val); $('.total_value'+i).val(total); amount_total1(); } function gstvalue3(str,i) { var inr_val =$('.inr_value'+i).val(); var cgst =$('.cgst'+i).val(); var igst =$('.igst'+i).val(); var sgst =$('.sgst'+i).val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst)+ parseFloat(inr_val); $('.total_value'+i).val(total); amount_total1(); } function sgstvalue1(str) { var gst=str; var inr_val =$('.ot_charges_inr_value').val(); var cgst =$('.ot_charges_cgst').val(); var igst =$('.ot_charges_igst').val(); var sgst =$('.ot_charges_sgst').val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst)+ parseFloat(inr_val); $('.ot_charges_tot_val').val(total); amount_total1(); } function sgstvalue2(str) { var gst=str; var inr_val =$('.ot_charges_inr_value').val(); var sgst =$('.ot_charges_sgst').val(); var igst =$('.ot_charges_igst').val(); var cgst =$('.ot_charges_cgst').val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst)+ parseFloat(inr_val); $('.ot_charges_tot_val').val(total); amount_total1(); } function sgstvalue3(str) { var gst=str; var inr_val =$('.ot_charges_inr_value').val(); var sgst =$('.ot_charges_sgst').val(); var igst =$('.ot_charges_igst').val(); var cgst =$('.ot_charges_cgst').val(); var total_cgst =(inr_val * cgst)/100 ; var total_sgst =(inr_val * sgst)/100 ; var total_igst =(inr_val * igst)/100 ; var total=parseFloat(total_cgst) + parseFloat(total_sgst) + parseFloat(total_igst)+ parseFloat(inr_val); $('.ot_charges_tot_val').val(total); amount_total1(); } var discount_total_value=0; function discountvalue(str) { var discount=str; var total_amt = $(".total_amt").val(); var mul_val =(discount * total_amt)/100; var discount_total_value= parseFloat(total_amt) - parseFloat(mul_val); var g_total = Math.round(discount_total_value); $('.g_total').val(g_total.toFixed(2)); } function discountamount(str) { var discount=str; var total_amt = $(".total_amt").val(); var mul_val =total_amt - discount; var discount_total_value= parseFloat(mul_val); //alert(discount_total_value); var g_total = Math.round(discount_total_value); $('.g_total').val(g_total.toFixed(2)); } function plus_function() { /*var total_amt = $(".total").val(); var a=Math.ceil(total_amt); var b=parseFloat(a) - parseFloat(total_amt); $(".round_off").val(b.toFixed(2)); $('.g_total').val(a.toFixed(2));*/ $(".round_off").val('+'); } function minus_function() { /* var total_amt = $(".total").val(); var a= Math.floor(total_amt); var b=parseFloat(total_amt) - parseFloat(a); $(".round_off").val(b.toFixed(2)); $('.g_total').val(a.toFixed(2));*/ $(".round_off").val('-'); } function rounded_of() { var total_amt = $(".total").val(); var a= $(".round_off").val(); var b=parseFloat(a) + parseFloat(total_amt); $('.g_total').val(b.toFixed(2)); } </script> <?php $this->load->view('includes/footer.php')?> <style type="text/css"> .page-content-wrapper{ /*padding-left: 50px; padding-right: 50px;*/ } table { border-collapse: collapse !important; } table, th, td { border: 1px solid black !important; } table input, textarea{ background: #eeeeee !important; } #po_submit{ padding-top: 30px; padding-bottom: 20px; } .tablerow{ margin-top: 20px; } .tablerow input{ background: none !important; } .tablerow input,textarea{ background: none !important; } </style>