<?php

include_once '../function_header.php';
$objectId = $_REQUEST['objectId'];
$additionalId = $_REQUEST['additionalId'];
$infoNeed = $_REQUEST['type'];
$response['type'] = $infoNeed;
//type = projectInfo | supplierInfo | materialPrice
switch ($infoNeed) {
    case 'estimateInfo':
        $estimateInfo = getEstimateInfo($conexion, $objectId);
        $response['displayFrom'] = $estimateInfo['fakeprojectName'] . " @ " . $estimateInfo['addressLine1'];
        break;
    case 'supplierInfo':
        $supplierInfo = getSupplierInfo($conexion, $objectId);
        $response['displayTo'] = $supplierInfo['supplierName'] . " @ " . $supplierInfo['addressLine1'];
        break;
    case 'materialPrice':
        //echo "SELECT * FROM suppliermaterial WHERE materialId = '$objectId' AND supplierId = '$additionalId'";
        $materialInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM suppliermaterial WHERE materialId = '{$objectId}' AND supplierId = '{$additionalId}'", $conexion));
        $response['materialPrice'] = $materialInfo['supplierMaterialPrice'];
        $response['materialLast'] = to_MDY($materialInfo['supplierMaterialLastModified']);
        break;
}
echo json_encode($response);
示例#2
0
<?php

$customer = 0;
$supplier = 0;
$estimate = 0;
$material = 0;
$displayFrom = "";
$displayTo = "";
$materialPrice = "";
if (isset($_GET['customerId'])) {
    $customer = $_GET['customerId'];
}
if (isset($_GET['estimateId'])) {
    $estimate = $_GET['estimateId'];
    $estimateInfo = getEstimateInfo($conexion, $estimate);
    $displayFrom = $estimateInfo['estimateName'] . " @ " . $estimateInfo['addressLine1'];
}
if (isset($_GET['supplierId'])) {
    $supplier = $_GET['supplierId'];
    $supplierInfo = getSupplierInfo($conexion, $supplier);
    $displayTo = $supplierInfo['supplierName'] . " @ " . $supplierInfo['addressLine1'];
}
if (isset($_GET['materialId']) && isset($_GET['supplierId'])) {
    $material = $_GET['materialId'];
    $materialInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM suppliermaterial WHERE materialId = '{$material}' AND supplierId = '{$supplier}'", $conexion));
    $materialPrice = decimalPad($materialInfo['supplierMaterialPrice']);
}
?>
<script type="text/javascript">
$(document).ready(function() {