Example #1
0
function getGroups($expand)
{
    global $country;
    $query = "SELECT * FROM groups g ORDER BY g.id";
    $result = mysql_query($query);
    if ($expand == 'FULL') {
        $rows = array();
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $row['cloths'] = getCloths($row['id'], $expand);
            array_push($rows, $row);
        }
        return $rows;
    }
    if ($expand == 'WITH_ROLLS') {
        $rows = array();
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $row['cloths'] = getCloths($row['id'], $expand);
            array_push($rows, $row);
        }
        return $rows;
    }
    return fetch_array($result);
}
Example #2
0
include_once '../include/headers.php';
include_once '../include/dbutils.php';
include_once '../include/main.php';
include_once 'domain/plotters.php';
include_once 'domain/cloths.php';
include_once 'domain/orders.php';
include_once 'domain/rolls.php';
include_once 'domain/queries.php';
db_connect();
$expand = isset($_GET['expand']) ? $_GET['expand'] : null;
if (isset($_GET['plottersHistory'])) {
    $value = getClothPlotters($_GET['clothId'], null, null, null, null, null, null);
} else {
    if (isset($_GET['underStock'])) {
        $groupId = isset($_GET['groupId']) ? $_GET['groupId'] : null;
        $value = getCloths($groupId);
    } else {
        if (isset($_GET['betweenDates']) && $_GET['type'] == 'plotters') {
            $value = getClothPlotters($_GET['clothId'], $_GET['startDate'], $_GET['endDate'], $_GET['userName'], $_GET['providerName'], $_GET['groupName'], $_GET['groupBy']);
        } else {
            if (isset($_GET['betweenDates']) && $_GET['type'] == 'orders') {
                $value = getClothOrders($_GET['startDate'], $_GET['endDate'], $_GET['clothId'], $_GET['invoiceNumber'], $_GET['providerName'], $_GET['groupName']);
            } else {
                if (isset($_GET['betweenDates']) && $_GET['type'] == 'all') {
                    //	$value1 = getClothPlotters($_GET['clothId'], $_GET['startDate'], $_GET['endDate']);
                    //	$value2 = getClothOrders($_GET['startDate'], $_GET['endDate'], $_GET['clothId']);
                    $value = getClothAllPlottersAndOrders($_GET['clothId'], $_GET['startDate'], $_GET['endDate']);
                } else {
                    if (isset($_GET['clothRolls'])) {
                        $value = getClothRolls($_GET['clothId'], $_GET['onlyAvailables']);
                    } else {
Example #3
0
<?php

// Get list of all users or one in particualr if the id is given
include_once '../include/headers.php';
include_once '../include/dbutils.php';
include_once '../include/main.php';
include_once 'domain/cloths.php';
db_connect();
$expand = isset($_GET['expand']) ? $_GET['expand'] : null;
$groupId = isset($_GET['groupId']) ? $_GET['groupId'] : null;
$previsionCountry = isset($_GET['previsionCountry']) ? $_GET['previsionCountry'] : null;
$clothCountry = isset($_GET['clothCountry']) ? $_GET['clothCountry'] : null;
if (isset($_GET['id'])) {
    $value = getCloth($_GET['id']);
} else {
    if (isset($_GET['dolar'])) {
        $value = getDolar();
    } else {
        if (isset($_GET['pctNac'])) {
            $value = getPctNac();
        } else {
            if (isset($_GET['matchIds'])) {
                $value = getClothsWithMatchIdsInCountry($_GET['matchIds'], $previsionCountry);
            } else {
                $value = getCloths($groupId, $expand);
            }
        }
    }
}
//return JSON array
exit(json_encode($value));