function getRegionList()
{
    mysql_query('SET CHARACTER SET utf8');
    $username = $_POST['userName'];
    $mode = $_POST['mode'];
    /*$sWhere = "";
      if ($_POST['sSearch'] != "") {
          $sWhere = " WHERE (RegionName like '%" . mysql_real_escape_string($_POST['sSearch']) . "%' )";
      }*/
    $sLimit = "";
    // if (isset($_POST['iDisplayStart'])) {
    // $sLimit = "limit " . mysql_real_escape_string($_POST['iDisplayStart']) . ", " . mysql_real_escape_string($_POST['iDisplayLength']);
    // }
    if ($mode == 'edit') {
        $sql = "SELECT SQL_CALC_FOUND_ROWS a.RegionMapId, a.UserId, b.RegionId, IF(a.RegionMapId is Null,'false','true') chkValue, RegionName\n             FROM t_user_region_map a \n             RIGHT JOIN t_region b ON (a.RegionId = b.RegionId AND a.UserId = '" . $username . "')\n             ORDER BY RegionName " . $sLimit . "";
    } else {
        $sql = " SELECT SQL_CALC_FOUND_ROWS a.RegionMapId, a.UserId, b.RegionId, IF(a.RegionMapId is Null,'false','true') chkValue, RegionName\n\t\t\t FROM t_user_region_map a \n\t\t\t INNER JOIN t_region b ON (a.RegionId = b.RegionId AND a.UserId = '" . $username . "')\n\t\t\t ORDER BY RegionName " . $sLimit . "";
    }
    //echo $sql;
    $pacrs = mysql_query($sql);
    $sql = "SELECT FOUND_ROWS()";
    $rs = mysql_query($sql);
    $r = mysql_fetch_array($rs);
    $total = $r[0];
    echo '{ "sEcho": ' . intval($_POST['sEcho']) . ', "iTotalRecords":' . $total . ', "iTotalDisplayRecords": ' . $total . ', "aaData":[';
    $f = 0;
    $serial = $_POST['iDisplayStart'] + 1;
    while ($row = @mysql_fetch_object($pacrs)) {
        $RegionId = $row->RegionId;
        $RegionName = $row->RegionName;
        $chkValue = $row->chkValue;
        $RegionMapId = $row->RegionMapId;
        if ($f++) {
            echo ",";
        }
        echo '["' . $RegionMapId . '", "' . getcheckBox($chkValue) . " " . $RegionName . '", "' . $RegionId . '"]';
        $serial++;
    }
    echo ']}';
}
Пример #2
0
function getYcProfileFundingSourceAssign($conn)
{
    //mysql_query('SET CHARACTER SET utf8');
    $CountryId = $_POST['country'];
    $ItemGroupId = $_POST['ItemGroupId'];
    $Year = $_POST['year'];
    $lan = $_POST['lan'];
    $sSearch = isset($_POST['sSearch']) ? $_POST['sSearch'] : '';
    $sWhere = "";
    if ($sSearch != "") {
        $sWhere = " WHERE (GroupName like '%" . mysql_real_escape_string($sSearch) . "%' )";
    }
    $sLimit = "";
    $sql = "SELECT t_fundingsource.ItemGroupId, t_fundingsource.FundingSourceName\n\t,t_yearly_country_fundingsource.YearlyFundingSrcId,t_fundingsource.FundingSourceId\n\t,IF(t_yearly_country_fundingsource.YearlyFundingSrcId is Null,'false','true') chkValue\n\tFROM t_fundingsource\n\tLEFT JOIN t_yearly_country_fundingsource ON (t_yearly_country_fundingsource.FundingSourceId = t_fundingsource.FundingSourceId\n\t\t\tAND t_yearly_country_fundingsource.CountryId = {$CountryId}\n\t\t\tAND t_yearly_country_fundingsource.Year = {$Year}\n\t\t\tAND t_fundingsource.ItemGroupId = {$ItemGroupId})\n\tWHERE t_fundingsource.ItemGroupId = {$ItemGroupId};";
    //echo $sql;
    $pacrs = mysql_query($sql, $conn);
    $sql = "SELECT FOUND_ROWS()";
    $rs = mysql_query($sql, $conn);
    $r = mysql_fetch_array($rs);
    $total = $r[0];
    echo '{ "sEcho": ' . intval($_POST['sEcho']) . ', "iTotalRecords":' . $total . ', "iTotalDisplayRecords": ' . $total . ', "aaData":[';
    $f = 0;
    $serial = $_POST['iDisplayStart'] + 1;
    while ($row = @mysql_fetch_object($pacrs)) {
        $FundingSourceId = $row->FundingSourceId;
        $FundingSourceName = $row->FundingSourceName;
        $chkValue = $row->chkValue;
        $YearlyFundingSrcId = $row->YearlyFundingSrcId;
        if ($f++) {
            echo ",";
        }
        echo '["' . $YearlyFundingSrcId . '", "' . getcheckBox($chkValue) . " " . $FundingSourceName . '", "' . $FundingSourceId . '"]';
        $serial++;
    }
    echo ']}';
}
Пример #3
0
    $sql = "SELECT FOUND_ROWS()";
    $rs = mysql_query($sql, $conn);
    $r = mysql_fetch_array($rs);
    $total = $r[0];
    $f = '';
    $serial = 1;
    while ($row = @mysql_fetch_object($pacrs)) {
        $FundingSourceId = $row->FundingSourceId;
        $FundingSourceName = $row->FundingSourceName;
        $chkValue = $row->chkValue;
        $YearlyFundingSrcId = $row->YearlyFundingSrcId;
        //if ($f++)
        echo '<tr>
					  <td style="text-align: center;">' . $serial . '</td>
					  <td style="text-align: left;">' . $FundingSourceName . '</td>
					   <td style="text-align: left;">' . getcheckBox($chkValue) . '</td>
				  </tr>';
        $serial++;
    }
    echo '</thead>
				</table>
			  </div>
		   </div>  
		</div><br/>';
    //********************************************************************Cases ************************************************
    $ItemGroupId = $_GET['ItemGroupId'];
    if ($ItemGroupId == 1) {
        echo '<div class="row"> 
				<div class="panel panel-default table-responsive" id="grid_country">
					<div class="padding-md clearfix">
					<div class="panel-heading">