'' ORDER BY td.ordid desc;"); $yvs_count = mysqli_num_rows($check_yvs); if($yv_count != $yvs_count){ array_push($arr_1, $arr_zee); } } ksort($arr_1); ?>
0){ $set_sto = mysqli_fetch_array($get_sto); $new_stock = $set_sto['new_stock']; }else{ $new_stock = 0; } $get_prod = mysqli_query($conn, "SELECT * from shop_product where product_id='$row1[product_id]'"); $get_product = mysqli_fetch_array($get_prod, MYSQLI_ASSOC); //opening balance $open_bal = mysqli_query($conn, "select * from tbl_india_update_stock where product_id = '$row1[product_id]' and date(created_at)='$start_date'"); $check_rows = mysqli_num_rows($open_bal); if($check_rows > 0){ $set_bal = mysqli_fetch_array($open_bal); $opening_balance = $set_bal['current_stock']; }else{ $my_open_bal = mysqli_query($conn, "select * from tbl_india_update_stock where product_id = '$row1[product_id]' order by id desc"); $check_rows_3 = mysqli_num_rows($my_open_bal); $my_set_open = mysqli_fetch_array($my_open_bal); $my_date = date('Y-m-d', strtotime($my_set_open['updated_at'])); if($check_rows_3 == 1 && $start_date > $my_date) { $opening_balance = $my_set_open['current_stock']; }else if($check_rows_3 == 1 && $start_date <= $my_date) { $opening_balance = $my_set_open['new_stock']; }else if($check_rows_3 > 1){ $opening_balance = $my_set_open['current_stock']; }else{ $opening_balance = 0; } } ?> 0){ $get_sales = mysqli_fetch_array($get_sale, MYSQLI_ASSOC); ?> 0){ $get_refund = mysqli_fetch_array($get_refu, MYSQLI_ASSOC); $get_refund_count = $get_refund_count + $get_refund['qtys']; } } $balance = $opening_balance - $sale_qty + $new_stock + $get_refund_count; $get_packing = mysqli_query($conn, "SELECT sum(tb.qty + tb.freeqty) AS fqty FROM tbl_confirmorder tc INNER JOIN tbl_order tb ON tc.orderid = tb.orderid WHERE tc.orderstatus = 5 AND tc.varstatus!='Cash' and tc.company_name='Energy Foods' and tb.productid='".$row1['product_id']."'"); $pack_rows = mysqli_num_rows($get_packing); if($pack_rows > 0){ $set_packing = mysqli_fetch_array($get_packing, MYSQLI_ASSOC); $packing = $set_packing['fqty']; }else{ $packing = 0; } $get_new = mysqli_query($conn, "SELECT sum(tb.qty + tb.freeqty) AS fqty FROM tbl_confirmorder tc INNER JOIN tbl_order tb ON tc.orderid = tb.orderid WHERE tc.orderstatus = 0 AND tc.varstatus!='Cash' and tc.company_name='Energy Foods' and tb.productid='".$row1['product_id']."'"); $new_rows = mysqli_num_rows($get_new); if($new_rows > 0){ $set_new = mysqli_fetch_array($get_new, MYSQLI_ASSOC); $new = $set_new['fqty']; }else{ $new = 0; } $pending = $packing + $new; if(!isset($pending)){ $pending = 0; } $instock = $balance + $pending; ?>
Product Name Opening Sales New Stock Returned ID Balance Unpacked In Stock
0