example CSV rest action
This commit is contained in:
@@ -313,3 +313,26 @@ function brecho($msg)
|
||||
var_dump($msg);
|
||||
echo '<br><br>';
|
||||
}
|
||||
// AI analysis
|
||||
function createCSVReports() {
|
||||
// Zestawienie faktur
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT ";
|
||||
$res = $db->query("
|
||||
SELECT i.document_no, i.register_date, i.parent_name, p.code, p.name, p.group_ks, ii.quantity, ii.price_netto
|
||||
FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id
|
||||
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id
|
||||
WHERE i.type = 'normal' AND YEAR(i.register_date) = 2024
|
||||
ORDER BY i.register_date DESC;");
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
var_dump($row);
|
||||
}
|
||||
// TODO: zapisaś wynik do pliku CSV
|
||||
// zetawienie faktur korygujących
|
||||
|
||||
// zestawienie RW
|
||||
|
||||
// zestawienie aktualnych stanów magazynowych
|
||||
die();
|
||||
}
|
||||
@@ -38,6 +38,9 @@
|
||||
case 'createCostDocumentFromInvoice':
|
||||
createCostDocumentFromInvoice($_GET['record']);
|
||||
break;
|
||||
case 'createCSVReports':
|
||||
createCSVReports();
|
||||
break;
|
||||
}
|
||||
// https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=createCostDocumentFromInvoice&record=c3f6eaa6-0cbd-8c89-1a8c-683ff19a36db
|
||||
?>
|
||||
Reference in New Issue
Block a user