Download FV asDocument from E5 CRM; E-Commerce: fix rewizor encoding

This commit is contained in:
2025-06-05 20:02:44 +00:00
parent 7e46fc97b6
commit 0c87d23283
11 changed files with 666 additions and 503 deletions

View File

@@ -53,14 +53,20 @@ function show()
function getInvoices($source, $date, $type)
{
$db = $GLOBALS['db'];
if ($source =='') $source = '%';
$date .= '%';
$query = "SELECT i.*, wz.document_no AS wz_document_no, wz.id AS wz_id FROM ecommerce_invoices AS i
LEFT JOIN ecmstockdocouts AS wz on wz.id = i.ecmstockdocout_id
";
$query .= " WHERE i.origin LIKE '$source' AND i.register_date LIKE '$date'";
if ($type !='') {
$query.=" AND i.type='$type'";
$query .= " WHERE i.register_date LIKE '$date'";
if ($source != '') {
if ($source == 'baselinker') {
$query .= " AND i.origin IN ('allegro', 'shop')";
} else {
$query .= " AND i.origin = '$source'";
}
}
if ($type != '') {
$query .= " AND i.type='$type'";
}
$query .= " ORDER BY i.register_date";
$result = $db->query($query);
@@ -99,10 +105,11 @@ function getDates()
function getSources() {
$db = $GLOBALS['db'];
$sources = array();
$res = $db->query("SELECT DISTINCT origin FROM ecommerce_invoices");
$res = $db->query("SELECT DISTINCT origin FROM ecommerce_invoices WHERE origin NOT IN ('allegro', 'shop')");
while ($row = $db->fetchByAssoc($res)) {
$sources[]= $row['origin'];
}
$sources[] = 'baselinker';
return $sources;
}
@@ -125,14 +132,13 @@ function exportToRewizor($source, $date, $type)
}
$smarty->assign("data", $invoices);
$result = '';
if ($type == 'normal') {
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor.tpl');
$result = $smarty->fetch(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor.tpl');
} else {
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor_fvkor.tpl');
$result = $smarty->fetch(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor_fvkor.tpl');
}
// encode result as ansi
echo $result;
//echo mb_convert_encoding($result, 'ANSI', 'UTF-8');
echo mb_convert_encoding($result, 'ISO-8859-2', 'UTF-8');
}
function brecho($var)