function ws_getCreditTypeById($creditTypeId)
{
    try {
        $client = new SoapClient(WSDL_QS, array('location' => LOCATION_QS));
        $creditType = $client->getCreditTypeById($creditTypeId);
    } catch (Exception $e) {
        $creditType = null;
    } catch (SoapFault $soapfault) {
        $creditType = null;
    }
    return $creditType;
}
function ct_getCreditType($id)
{
    try {
        $client = new SoapClient(WSDL_QS, array('location' => LOCATION_QS));
        $credittype = $client->getCreditTypeById($id);
        return array("creditType" => $credittype);
    } catch (Exception $e) {
        return array("success" => false, "message" => $e->getMessage());
    } catch (SoapFault $soapfault) {
        return array("success" => false, "message" => $soapfault->getMessage());
    }
}
Example #3
0
     }
     $item = db_getItem($id);
     echo json_encode(array("item" => $item));
 } else {
     if ($action == "getInventory") {
         $inventory = db_getInventory();
         $formattedInventory = array();
         foreach ($inventory as $item) {
             if ($item->billable == 1) {
                 $price = $item->price;
             } else {
                 $price = 'Not Billable';
             }
             try {
                 $client = new SoapClient(WSDL_QS, array('location' => LOCATION_QS));
                 $creditType = $client->getCreditTypeById($item->referenceid);
                 //print_r($creditType);
             } catch (Exception $e) {
                 $creditType = null;
             } catch (SoapFault $soapfault) {
                 $creditType = null;
             }
             if ($creditType != null) {
                 $i = array($item->id, $item->name, $item->description, $item->type, $price, $creditType->name, $item->active, $item->creationdate);
                 array_push($formattedInventory, $i);
             }
         }
         //print_r($inventory);
         //print_r($formattedInventory);
         echo json_encode($formattedInventory);
     } else {