D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
add_new_item.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login == ''){ echo '<script>location.replace("index.php")</script>'; } if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Invoice Management | Invoice</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" /> <meta content="Coderthemes" name="author" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Font Awsome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- App favicon --> <link rel="shortcut icon" href="assets/images/favicon.png"> <!-- Pie Chart Css --> <link href="assets/pie charts/style.css" rel="stylesheet" type="text/css" /> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.css" rel="stylesheet" type="text/css" /> <link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/style.css" rel="stylesheet" type="text/css" /> <script src="assets/js/modernizr.min.js"></script> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css'> <link href="plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css"> <link href="plugins/jquery-toastr/jquery.toast.min.css" rel="stylesheet" /> </head> <body> <!-- Begin page --> <div id="wrapper"> <!-- Top Bar Start --> <?php include 'top-header.php'; ?> <!-- Top Bar End --> <!-- ========== Left Sidebar Start ========== --> <?php include 'left-sidebar.php'; ?> <!-- Left Sidebar End --> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box"> <h4 class="page-title float-left">Add New Item</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Inventory</li> <li class="breadcrumb-item active">Add New Item</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <form action="insert_new_item.php" method="post" role="form" id="frm" enctype="multipart/form-data"> <div class="card-box"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="exampleInputEmail1">Category</label> <select class="form-control select" name="category" id="category" onchange="showUser(this.value)" required> <option value="">Select Option</option> <?php $sql1 = "SELECT * FROM category WHERE is_deleted = 'NO' AND source_id = '$source_id' order by category"; $result1 = mysqli_query($conn,$sql1); while( $row = mysqli_fetch_array($result1)){ ?> <option value="<?php echo $row['id'] ?>" ><?php echo $row['category'] ?></option> <?php } ?> </select> </div> </div> </div> </div> <!-- end row --> <div class="card-box"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Item Code</label> <input class="form-control" id="item_code" name="item_code" placeholder="Enter Item Code" required> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>HSN Code</label> <input class="form-control" name="hsncode" placeholder="Enter HSN Code"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Name<span style="color:red;padding-left:30px">Do not use double / single quote ("/')</span></label> <input class="form-control" id="name" name="name" placeholder="Enter Name" required> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Item Quantity</label> <input class="form-control" name="item_qty" placeholder="Enter Name"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Size</label> <input class="form-control" name="size" placeholder="Enter Size"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Unit Of Measure</label> <select name="unit_of_measure" class="form-control select22"> <option value=''>--select units--</option> <option value="Yard">Yard</option> <option value="Box">Box</option> <option value="Cms">Cms</option> <option value="Gross">Gross</option> <option value="Kg">Kg</option> <option value="Mtr">Mtr</option> <option value="Mile Meter">Mile Meter</option> <option value="Nothing">Nothing</option> <option value="N/A">N/A</option> <option value="Nos">Nos</option> <option value="Pairs">Pairs</option> <option value="Pcs">Pcs</option> <option value="Sets">Sets</option> <option value="Sheet">Sheet</option> <option value="Sqft">Sqft</option> <option value="Styles">Styles</option> <option value="mm">mm</option> <option value="cm">cm</option> <option value="dm">dm</option> <option value="km">km</option> <option value="other">Other</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Stock High Threshold</label> <input class="form-control" placeholder="Enter Stock High Threshold" name="stock_high_threshold"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Tax Inclusive</label> <select class="form-control" name="tax_inclusive"> <option value=''>--select type--</option> <option value='No'>No</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Color</label> <input class="form-control" name="color" placeholder="Enter Color"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Material</label> <input class="form-control" placeholder="Enter Material" name="material"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Item Image</label> <input type="file" class="form-control" name="image"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Cost Variance Limit(%)</label> <input class="form-control" placeholder="Enter Group" name="cost_variance_limit"> </div> </div> </div> <button type="submit" id="btn" class="btn btn-purple waves-effect waves-light w-100">Submit</button> </div> </form> </div> <!-- container --> </div> <!-- content --> </div> <?php include 'copyrignt.php' ?> <!-- ============================================================== --> <!-- End Right content here --> <!-- ============================================================== --> </div> <div id="myModal" class="modal fade" role="dialog" style="z-index:999999"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> <form action="" method="post" role="form" id="categoryForm"> <input type="hidden" name="sourceId" value="<?php echo $source_id; ?>"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="exampleInputEmail1">Category</label> <input type="text" class="form-control" name="categoryName" id="categoryName" placeholder="Enter category"> </div> </div> <div class="col-md-12"> <button type="button" id="submitCategory" class="btn btn-purple waves-effect waves-light">Submit</button> </div> </div> </form> </div> </div> </div> </div> <!-- END wrapper --> <!-- jQuery --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/popper.min.js"></script><!-- Popper for Bootstrap --> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/metisMenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/jquery.slimscroll.js"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js'></script> <!-- App js --> <script src="assets/js/jquery.core.js"></script> <script src="assets/js/jquery.app.js"></script> <!-- Chart Js --> <!-- <!-- <script src="assets/pie charts/script.js"></script> --> --> <script src="plugins/sweet-alert2/sweetalert2.min.js"></script> <script src="plugins/jquery-toastr/jquery.toast.min.js" type="text/javascript"></script> <script> var lst = ["\"", "&", "'"]; $('#name').on('input', function () { debugger var inputText = $(this).val(); var index = 0; for (var i = 0; i < inputText.length; i++) { index = $.inArray(inputText.charAt(i), lst); if (index >= 0) { var myregexp = new RegExp(lst[index], 'g'); $(this).val($(this).val().replace(myregexp, "")); } } }); // $('#name').blur(function(e){ // e.preventDefault(); // var inputText = $("#name").val(); // var lst = ["\"", "&", "'", "%"]; // var index = 0; // for (var i = 0; i < inputText.length; i++) { // index = $.inArray(inputText.charAt(i), lst); // if (index >= 0) { // var myregexp = new RegExp(lst[index], 'g'); // $(this).val($(this).val().replace(myregexp, "")); // } // } // // var regParts = inputValue.match( /^[a-zA-Z]+$/); // // if(!regParts){ // // errorToast("Please enter only alphabets"); // // return false; // // } // }); $(document).ready(function () { var flg = 0; $('.select').select2().on("select2:open", function () { flg++; if (flg == 1) { $(".select2-results").append("<div onclick='openModal()' class='select2-results__option' style='color:blue;cursor:pointer'> +Add New</div>"); } }); }); $(function () { $(".select22") .on('select2:close', function() { var el = $(this); if(el.val()==="other") { var newval = prompt("Enter other value you want: "); if(newval !== null) { el.append('<option>'+newval+'</option>') .val(newval); } } }); }); function selectOption() { $('.select22').select2(); } $(document).ready(function() { forSelect(); }); function forSelect() { selectOption(); $('#add').click(function() { var text = $('#text').html(); $('#demo').append(text); $('#demo .select').select2(); $('#demo .select').last().next().next().remove(); }); } function openModal(){ $("#myModal").modal("toggle"); } $(document).ready(function(){ if (localStorage.getItem("CategoryAdded") == "true") { successMessage("Category Successfully Added."); localStorage.setItem("CategoryAdded", "false"); } if (localStorage.getItem("ItemUpdated") == "true") { successMessage("Item Successfully Updated."); localStorage.setItem("ItemUpdated", "false"); } if (localStorage.getItem("ItemDeleted") == "true") { successMessage("Item Successfully Deleted."); localStorage.setItem("ItemDeleted", "false"); } if (localStorage.getItem("ItemAdded") == "true") { successMessage("Item Successfully Added."); localStorage.setItem("ItemAdded", "false"); } // if (localStorage.getItem("ContactAdded") == "true") { // successMessage("Contact Successfully Added."); // localStorage.setItem("ContactAdded", "false"); // } }); $("#submitCategory").click(function(){ if($("#categoryName").val() == ""){ errorToast("Please Enter Category Name"); } else{ $.ajax({ url : "PHP/response.php", data : $("#categoryForm").serialize()+"&action=AddCategory", method : "POST", async : false, success : function(response){ if(response == "SUCCESS"){ localStorage.setItem("CategoryAdded", "true"); location.reload(); } else{ errorMessage("Category could not be added"); } }, error : function(error){ errorMessage("Category could not be added"); } }) } }); function errorToast(msg){ $.toast({ heading: 'Error!', text: msg, position: 'top-right', loaderBg: '#bf441d', icon: 'error', hideAfter: 3000, stack: 1 }); } function successMessage(msg){ swal({ title: 'Success!', text: msg, type: 'success', confirmButtonColor: '#4fa7f3' }); } function errorMessage(msg){ swal({ title: 'Error!', text: msg, type: 'error', confirmButtonColor: '#4fa7f3' }); } $("#btn").click(function(){ if($("#category").val() == ""){ errorToast("Please Select Category"); } if($("#item_code").val() == ""){ errorToast("Please Enter Item Code"); } if($("#name").val() == ""){ errorToast("Please Enter Item Name"); } }) function showUser(str) { $.ajax({ url : "PHP/response.php", data : "action=getCategoryById&categoryId="+str, method : "POST", async : false, success : function(response){ var str = JSON.parse(response); var tax = str.tax; var categoryFor = str.category_for; $("#tax").val(tax); $("#categoryfor").val(categoryFor); if(categoryFor.trim() === "Product"){ $("#divHSNCode").css({"display": "block"}); $("#divSACCode").css({"display": "none"}); $("#divQuantity").css({"display" : "block"}); } else { $("#divHSNCode").css({"display": "none"}); $("#divSACCode").css({"display": "block"}); $("#divQuantity").css({"display" : "none"}); $("#quantity").val("0"); } }, error:function(){} }); } </script> </body> </html>