ok
Direktori : /home2/selectio/public_html/vijay-gases/ |
Current File : //home2/selectio/public_html/vijay-gases/sales-edit.php |
<?php include "header.php";?> <div class="content-wrapper"> <section class="content-header"> <h1>Add Purchase</h1> <ol class="breadcrumb"> <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Add Purchase</li> </ol> </section> <div class="col-lg-12 alerts"> <div id="custom-alerts" style="display:none;"> <div class="alert alert-dismissable"> <div class="custom-msg"></div> </div> </div> <?php if ($error) { ?> <div class="alert alert-danger alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-ban"></i> Error</h4> <?= $error; ?> </div> <?php $error=0;} if ($warning) { ?> <div class="alert alert-warning alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-warning"></i> Warning</h4> <?= $warning; ?> </div> <?php $warning=0;} if ($message) { ?> <div class="alert alert-success alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4> <i class="icon fa fa-check"></i> Success</h4> <?= $message; ?> </div> <?php $message=0; } ?> </div> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box box-primary"> <div class="box-header"> <div class="row" style=""> <div class="col-md-10 col-sm-10 col-xs-8"> <div style="list-style: none; padding-inline-start: 0px; padding: 5px 0px 5px 0px;"> <?php include "header/sale_header.php"; ?> </div> </div> <div class="col-md-2 col-sm-2 col-xs-4"> <?php //include "header/buttons-ui.php"; ?> </div> </div> </div> <div class="box-body"> <div class="col-lg-12"> <form enctype="multipart/form-data" method="post" id="add_sale_form"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label class="required" for="name">Sale Date</label> <input type="date" name="sale_date" value="<?=date('Y-m-d')?>" class="form-control tip" id="sale_date" required="required" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label class="control-label" for="departement_id">Select Customer</label> <select name="customer" class="form-control tip select2" style="width:100%" id="customer" required="required"> <option value="">All Customer</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_customer` where status='1' and cust_type='1'"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { echo "<option value=".$result['id'].">".$result['customer_name']."</option>"; }?> </select> </div> <span></span> </div> <div class="col-sm-4"> <div class="form-group"> <label class="control-label" for="departement_id">Select Location</label> <select name="location" class="form-control select2" style="width:100%" id="location" required="required"> <option value="">All Location</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_location` where status='1'"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { echo "<option value=".$result['id'].">".$result['name']."</option>"; }?> </select> </div> </div> </div> <div class="row"> <div class="col-md-6"> <center><b>Collected Cylinder From Customer</b></center> <div class="row"> <div class="col-md-12"> <div class="form-group search-box"> <label class="" for="pro_category">Search Product info</label> <input type="text" name="search_item" placeholder="Search Product" class="form-control tip " id="search_text" style='text-transform:uppercase'/> <div class="result"></div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <table id="collect_customer_table"> <thead> <tr> <th>SKU No</th> <th>Product Name</th> <th>Sell Rate</th> <th>Quantity</th> <th>Action</th> </tr> </thead> <tbody id="collect_customer_row"> <tr style="background-color: burlywood;"> <td></td> <td></td> <td><input type="text" name="total_sell_rate" value="0" class="form-control tip total_sell_rate" readonly/></td> <td></td> <td></td> </tr> </tbody> </table> </div> </div> </div> <div class="col-md-6"> <center><b>Sales Cylinder</b></center><br> <div class="row"> <div class="col-md-12"> <div class="form-group sale-search-box"> <label class="" for="pro_category">Search Product info</label> <input type="text" name="sale_search_item" placeholder="Search Product" class="form-control tip " id="sale_search_text" style='text-transform:uppercase'/> <div class="sale_result"></div> </div> </div> </div> <table id="return_customer_table"> <thead> <tr> <th>SKU No</th> <th>Product Name</th> <th>Sell Rate</th> <th>Quantity</th> <th>Action</th> </tr> </thead> <tbody id="return_customer_row"> <tr style="background-color: burlywood;"> <td></td> <td></td> <td><input type="text" name="total_new_sell_rate" value="0" class="form-control tip total_new_cylinder_sell_rate" readonly/></td> <td></td> <td></td> </tr> </tbody> </table> </div> </div> <br> <div class="row"> <div class="col-md-6"></div> <div class="col-md-6"> <div class="row"> <div class="col-md-4"></div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="name">Total Amount</label> <input type="text" name="total_amount" value="0" class="form-control tip total_final_amount" id="total_amount" required="required" readonly/> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="name">Advance Amount</label> <input type="text" name="advance_amount" value="0" class="form-control tip" id="advance_amount"/> </div> </div> </div> </div> </div> <div class="form-group" style="text-align:center;"> <input type="submit" name="add_sale" value="Add Sale" class="btn btn-success" /> </form> </div> </div> <div class="form-group" style="text-align:center;"> <a href="sale-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="sales.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <script> $(document).ready(function(){ var n=''; n=parseInt(n) || 0; //console.log('bn Value='+n); $('.search-box input[type="text"]').on("keyup input", function(){ var search_text = $(this).val(); var resultDropdown = $(this).siblings(".result"); if(search_text.length>1){ $.get("apis/sale-search-api.php", {search_text: search_text}).done(function(data){ resultDropdown.html(data); }); } else{ resultDropdown.empty(); } }); }); function append_row(id){ /*console.log('table row added'+id);*/ $('.search-box input[type="text"]').val(''); $(".result").empty(); $('.search-box input[type="text"]').focus(); } var selectedIds=[]; function product_selection(id){ selectedIds.push(id); // Use a more descriptive variable name console.log(selectedIds); console.log('table row added'+id); $.ajax({ url: 'apis/get-search-sale.php', type: 'post', dataType: 'text', data:{pro_id:id,type:'customer_sale_search'}, success: function (response) { console.log('Id :'+id); $('#collect_customer_table').prepend(response); $('.search-box input[type="text"]').val(''); $(".result").empty(); $('.search-box input[type="text"]').focus(); } }); } </script> <!--Sale Search And Append Query Is Started Here--> <script> $(document).ready(function(){ var n=''; n=parseInt(n) || 0; //console.log('bn Value='+n); $('.sale-search-box input[type="text"]').on("keyup input", function(){ var search_text = $(this).val(); var resultDropdown = $(this).siblings(".sale_result"); if(search_text.length>1){ $.get("apis/customer_sale-search-api.php", {search_text: search_text}).done(function(data){ resultDropdown.html(data); }); } else{ resultDropdown.empty(); } }); }); function append_row(id){ /*console.log('table row added'+id);*/ $('.sale-search-box input[type="text"]').val(''); $(".sale_result").empty(); $('.sale-search-box input[type="text"]').focus(); } var selectedIds=[]; function product_selections(id){ selectedIds.push(id); // Use a more descriptive variable name console.log(selectedIds); // console.log('table row added'+id); $.ajax({ url: 'apis/get-search-sale.php', type: 'post', dataType: 'text', data:{pro_id:id,type:'return_customer_sale_search'}, success: function (response) { console.log('Id :'+id); $('#return_customer_table').prepend(response); $('.sale-search-box input[type="text"]').val(''); $(".sale_result").empty(); $('.sale-search-box input[type="text"]').focus(); } }); } </script> <!--Sale Search And Append Query Is Ended Here--> <script> // ************************** INSERT AJAX START ****************************** $(document).ready(function(){ $('#add_sale_form').on('submit', function(e){ e.preventDefault(); $("#add_sale").attr('disabled','disabled'); console.log('Sale Submit Option Start...'); var formData = new FormData(this); console.log(formData) formData.append('type', 'add_sale'); $.ajax({ url: 'apis/cylinder-sale-add-api.php', type: 'post', dataType: 'json', data: formData, cache: false, contentType: false, processData: false, enctype: 'multipart/form-data', success: function (response) { console.log(response); console.log("Response id " +response['id']); if(response['status']==200){ //put success coode $('#add_sale_form').trigger("reset"); $("#add_sale").removeAttr('disabled'); alert(response['message']); }else{ //put falied code alert(response['message']); $("#add_sale").removeAttr('disabled'); } } }); }); }); // ************************** INSERT AJAX END ****************************** </script> <script> $(document).ready(function(){ }); </script> <script> $(document).ready(function(){ $('table#collect_customer_table tbody').on('change keyup', 'tr.remove_refill_cylinder_row', function() { final_calculation(); }); function final_calculation(){ console.log('BRINDHA'); var sum = 0; $(".sell_rate").each(function(){ sum += +$(this).val(); }); $(".total_sell_rate").val(sum); total_final_amount(); } $('table#return_customer_table tbody').on('change keyup', 'tr.remove_return_cylinder_row', function() { console.log('Table Calculation'); new_cylinder_calculation(); }); function new_cylinder_calculation(){ var sum = 0; $(".return_sell_rate").each(function(){ console.log('Venkateshan Anna'); sum += +$(this).val(); }); $(".total_new_cylinder_sell_rate").val(sum); total_final_amount(); } function total_final_amount(){ console.log('Final Calculation Starts Here'); console.log('BRINDHA'); var sum = 0; $(".total_sell_rate").each(function(){ sum += +$(this).val(); }); $(".total_new_cylinder_sell_rate").each(function(){ sum += +$(this).val(); }); $(".total_final_amount").val(sum); } }); </script> <?php include "footer.php"; ?> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <style> .select2-container--default .select2-selection--multiple .select2-selection__choice { background-color: rgb(228, 228, 228); box-sizing: border-box; display: inline-block; margin-left: 5px; margin-top: 5px; position: relative; max-width: 100%; text-overflow: ellipsis; vertical-align: bottom; white-space-collapse: collapse; text-wrap: nowrap; border-width: 1px; border-style: solid; border-color: rgb(170, 170, 170); border-image: initial; border-radius: 4px; padding: 0px 10px 0px 20px; overflow: hidden; color: black; font-weight: 800; } .select2-container--default .select2-selection--multiple { background-color: white; border: 1px solid #aaa; border-radius: 4px; cursor: text; height: 100px; padding-bottom: 5px; padding-right: 5px; position: relative; } </style> <style> table { border-collapse: collapse; width: 100%; } tr:nth-child(even){background-color: #f2f2f2} th{ background-color: #b34923; color: white; text-align: center; padding-top: 5px; padding-bottom: 5px; } </style> <style> body { font-weight: bolder; background: white; } .search-box{ width: auto; display: inline-block; font-size: 14px; } .search-box { padding: 5px 10px; font-size: 14px; } .result{ position: absolute; z-index: 999; top: 89%; left: 0; } .search-box, .result{ width: 100%; box-sizing: border-box; } /* Formatting result items */ .result div{ margin: 0; background: white; padding: 7px 10px; border: 1px solid #CCCCCC; border-top: none; cursor: pointer; margin-top:-10px; } .result div:hover{ background: blue; color: white; } /*sale Search Style Starts Here */ .sale-search-box{ width: auto; display: inline-block; font-size: 14px; } .sale-search-box { padding: 5px 10px; font-size: 14px; } .sale_result{ position: absolute; z-index: 999; top: 89%; left: 0; } .sale-search-box, .sale_result{ width: 100%; box-sizing: border-box; } /* Formatting result items */ .sale_result div{ margin: 0; background: white; padding: 7px 10px; border: 1px solid #CCCCCC; border-top: none; cursor: pointer; margin-top:-10px; } .sale_result div:hover{ background: blue; color: white; } /*Sale Search Style Ends Here*/ </style>