mirror of
https://github.com/itflow-org/itflow
synced 2026-11-11 15:07:24 +00:00
31 lines
986 B
PHP
31 lines
986 B
PHP
<?php
|
|
|
|
require_once '../validate_api_key.php';
|
|
|
|
require_once '../require_get_method.php';
|
|
|
|
|
|
if (isset($_GET['quote_id'])) {
|
|
// quote via ID (single)
|
|
$id = intval($_GET['quote_id']);
|
|
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_id LIKE '$id' AND 1=1 " . apiClientScopeSql('quote_client_id') . "");
|
|
|
|
} else {
|
|
// All quotes (by client ID if given, or all in general if key permits)
|
|
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE 1=1 " . apiClientScopeSql('quote_client_id') . " ORDER BY quote_id LIMIT $limit OFFSET $offset");
|
|
}
|
|
|
|
// Each with its subtotal, tax, tax by part and registration numbers (billingApiTaxFields())
|
|
if ($sql && mysqli_num_rows($sql) > 0) {
|
|
$rows = [];
|
|
while ($row = mysqli_fetch_assoc($sql)) {
|
|
$rows[] = $row + billingApiTaxFields('quote', $row);
|
|
}
|
|
echo json_encode(['success' => 'True', 'count' => count($rows), 'data' => $rows]);
|
|
exit();
|
|
}
|
|
|
|
// Output
|
|
require_once "../read_output.php";
|
|
|