ok
Direktori : /proc/self/root/home2/selectio/www/vijay-gases/apis/ |
Current File : //proc/self/root/home2/selectio/www/vijay-gases/apis/get-search-sale.php |
<?php ob_start(); session_start(); include"../config/config.php"; if(isset($_POST['type']) && $_POST['type']=='customer_sale_search'){ $condition=''; $cylinder_customer = $_POST['cylinder_customer']; $get_pro_id =$_POST['pro_id']; if($get_pro_id!=""){ $condition.=" and tbl_product.id=".$get_pro_id." and tbl_customer.id=".$cylinder_customer; } $content =''; $sql="SELECT tbl_product.*,tbl_gas.gas_name FROM tbl_product LEFT JOIN tbl_gas ON tbl_product.product_name=tbl_gas.id LEFT JOIN tbl_sell_items ON tbl_sell_items.product_id=tbl_product.id LEFT JOIN tbl_sell ON tbl_sell.id=tbl_sell_items.sell_id LEFT JOIN tbl_customer ON tbl_customer.id=tbl_sell.customer_id where 1=1 $condition"; $statement = $pdo->prepare("SELECT tbl_product.*,tbl_gas.gas_name FROM tbl_product LEFT JOIN tbl_gas ON tbl_product.product_name=tbl_gas.id LEFT JOIN tbl_sell_items ON tbl_sell_items.product_id=tbl_product.id LEFT JOIN tbl_sell ON tbl_sell.id=tbl_sell_items.sell_id LEFT JOIN tbl_customer ON tbl_customer.id=tbl_sell.customer_id where 1=1 $condition"); $statement->execute(); $emp_data = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $response=array(); if($totalData>0){ $content.= '<tr class="remove_refill_cylinder_row"> <td><input type="text" name="sku_no[]" class="form-control tip" id="sku_no" required="required" value="'.$emp_data[0]['sku'].'" readonly/><input type="hidden" name="product_id[]" class="form-control tip pro_ids" id="product_id" required="required" value="'.$emp_data[0]['id'].'" /></td> <td><input type="text" name="cylinder_no[]" class="form-control tip" id="cylinder_no" required="required" value="'.$emp_data[0]['cylinder_no'].'" readonly/></td> <td><input type="text" name="product_name[]" class="form-control tip" id="product_name" required="required" value="'.$emp_data[0]['gas_name'].'" readonly/></td> <td hidden><input type="text" name="sell_rate[]" class="form-control tip" id="sell_rate" value="'.$emp_data[0]['sell_price'].'" required="required" value="0" onkeypress="return isNumberKey(this, event);"/></td> <td hidden><input type="text" name="test_sell_rate[]" class="form-control tip sell_rate" id="sell_rate" value="0" required="required" value="0" onkeypress="return isNumberKey(this, event);"/></td> <td hidden><input type="text" name="quantity[]" class="form-control tip" id="quantity" value="1" required="required" readonly /></td> <td><center><span class="btn btn-danger btn-sm remove_refill_cylinder" style="width:100%;height:33px;"><i class="fa fa-trash-o" style="font-size:14px;"></i></span></center></td> </tr>'; $datas[] = array('error'=>false,'content'=>$content); } else{ $datas[] = array('error'=>true,'content'=>'This Cylinder Number Sale In Another Customer Please Select The Correct Customer'); } echo json_encode($datas); return 0; } if(isset($_POST['type']) && $_POST['type']=='return_customer_sale_search'){ $location_id = $_REQUEST['location_id']; $return_condition=''; $return_pro_id =$_POST['return_pro_id']; if($return_pro_id!=""){ $return_condition.=" and tbl_product.id=".$return_pro_id; } if(isset($location_id) && $location_id==4){ $rate_type = "Cube_Type"; }else{ $rate_type = ""; } $statement1 = $pdo->prepare("SELECT tbl_product.*,tbl_gas.gas_name,tbl_gas.hsn_code,tbl_gas.cube_no FROM tbl_product LEFT JOIN tbl_gas ON tbl_product.product_name=tbl_gas.id LEFT JOIN tbl_sell_items ON tbl_sell_items.product_id=tbl_product.id where 1=1 $return_condition"); $statement1->execute(); $return_data = $statement1->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement1->rowCount(); if($totalData>0){ if($rate_type=="Cube_Type"){ $rate = $return_data[0]['cube_no']; }else{ $rate = $return_data[0]['sell_price']; } echo'<tr class="remove_return_cylinder_row"> <td> <input type="text" name="return_sku_no[]" class="form-control tip" id="return_sku_no" required="required" value="'.$return_data[0]['hsn_code'].'"/> <input type="hidden" name="return_product_id[]" class="form-control tip return_pro_ids" id="return_product_id" required="required" value="'.$return_data[0]['id'].'" /> </td> <td><input type="text" name="cylinder_no[]" class="form-control tip" id="cylinder_no" required="required" value="'.$return_data[0]['cylinder_no'].'" readonly/></td> <td><input type="text" name="return_product_name[]" class="form-control tip" id="return_product_name" required="required" value="'.$return_data[0]['gas_name'].'" readonly/></td> <td><input type="text" name="return_sell_rate[]" class="form-control tip return_sell_rate" id="return_sell_rate" required="required" value="'.$rate.'" onkeypress="return isNumberKey(this, event);"/></td> <td hidden><input type="text" name="return_quantity[]" class="form-control tip" id="return_quantity" value="1" required="required" readonly /></td> <td><center><span class="btn btn-danger btn-sm remove_return_cylinder" style="width:100%;height:33px;"><i class="fa fa-trash-o" style="font-size:14px;"></i></span></center></td> </tr>'; } } ?> <script> $(document).on('click', '.remove_refill_cylinder', function() { $(this).closest('.remove_refill_cylinder_row').remove(); }); </script> <script> $(document).on('click', '.remove_return_cylinder', function() { $(this).closest('.remove_return_cylinder_row').remove(); }); </script>