
<?php
//$link = mssql_connect('192.168.1.30', 'sa', 'sap123');
$link = mssql_connect('10.1.0.18', 'rctech', 'rc.tech.2016');
$_SESSION['itemcode'] = $_GET['itemcode'];
 
if (!$link)
    die('Unable to connect!');
 
if (!mssql_select_db('invpoca2017', $link))
    die('Unable to select database!');
 
$sql="SELECT top(100000) a.u_op_id as op_id,cast(a.DocDate as date) as dia,(doctotal-vatsum) as totalneto from oinv a where

cast(A.docdate as date) BETWEEN '2017/10/01' AND '2017/10/16'  and left(a.u_op_id,1)='2'  
";

//echo $sql;

$result = mssql_query($sql);

$return_arr = array();

//echo hola;
while ($row = mssql_fetch_array($result)) {
    
   
    $row_array['op_id'] = $row['op_id'];
    $row_array['dia'] = $row['dia'];
    $row_array['totalneto'] = $row['totalneto'];
  
 
  


    array_push($return_arr,$row_array);

//$msg = array("itemcode" => $row['itemcode'], "whscode" => $row['whscode'],"whsname" => $row['whsname'],"onhand" => $row['onhand']);
}

// header('content-type: application/json');
print_r(json_encode($return_arr));
//echo $json;
mssql_free_result($result);
 
?>
