Merge branch 'main' into #3-Analiza-sprzedaży-AI

This commit is contained in:
Michał Zieliński
2025-08-25 16:16:53 +02:00
5 changed files with 11 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ DELETE FROM ecommerce_invoices_products WHERE invoice_id IN (
DELETE FROM ecommerce_invoices WHERE origin='amazon b2b' AND register_date LIKE '2025-04-%'; DELETE FROM ecommerce_invoices WHERE origin='amazon b2b' AND register_date LIKE '2025-04-%';
*/ */
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/06-2025.csv'; $filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/07-2025.csv';
$handle = fopen($filename, 'r'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);

View File

@@ -1,7 +1,7 @@
<?php <?php
// https://crm.twinpol.com/?module=EcmInvoiceOuts&action=ecommerce&amazon-wz=true // https://crm.twinpol.com/?module=EcmInvoiceOuts&action=ecommerce&amazon-wz=true
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/amazon-wz-06-2025.csv'; $filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/amazon-wz-07-2025.csv';
$handle = fopen($filename, 'r'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);

View File

@@ -9,7 +9,7 @@ DELETE FROM ecommerce_invoices_products WHERE invoice_id IN (
DELETE FROM ecommerce_invoices WHERE origin='amazon vat local' AND register_date LIKE '2025-02-%'; DELETE FROM ecommerce_invoices WHERE origin='amazon vat local' AND register_date LIKE '2025-02-%';
*/ */
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/06-2025.csv'; $filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/07-2025.csv';
$handle = fopen($filename, 'r'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);

View File

@@ -4,7 +4,7 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
ini_set('display_errors', 1); ini_set('display_errors', 1);
// read csv file tab separated // read csv file tab separated
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/06-2025.csv'; $filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/07-2025.csv';
$handle = fopen($filename, 'r'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);
@@ -57,7 +57,7 @@ function createInvoice($type, $products, $DO_REAL_SAVE = false)
$invoice->parent_address_city = 'Obrowo'; $invoice->parent_address_city = 'Obrowo';
$invoice->type = 'normal'; $invoice->type = 'normal';
$date = '30.06.2025'; $date = '31.07.2025';
$invoice->register_date = $date; $invoice->register_date = $date;
$invoice->sell_date = $date; $invoice->sell_date = $date;
$invoice->validtill_date = $date; $invoice->validtill_date = $date;
@@ -83,6 +83,11 @@ function createInvoice($type, $products, $DO_REAL_SAVE = false)
$p[10] = substr($p[10], 0, -1); $p[10] = substr($p[10], 0, -1);
} }
// fixes.. (07.2025)
if ($p[10] == 'FR00148_') {
$p[10] = 'FR00148_1000_amz_de_3pcs';
}
$fromDb = $db->fetchByAssoc($db->query("SELECT id, name, code, product_category_id, unit_id FROM ecmproducts WHERE code = '$p[10]' OR amazon_code = '$p[10]'")); $fromDb = $db->fetchByAssoc($db->query("SELECT id, name, code, product_category_id, unit_id FROM ecmproducts WHERE code = '$p[10]' OR amazon_code = '$p[10]'"));
if ($fromDb == false) { if ($fromDb == false) {
var_dump($p); var_dump($p);

View File

@@ -132,7 +132,7 @@ function exportToRewizor($source, $date, $type)
$i['corrected_register_date'] = date("Ymd000000",strtotime(date('d.m.Y', strtotime($fv['register_date'])))); $i['corrected_register_date'] = date("Ymd000000",strtotime(date('d.m.Y', strtotime($fv['register_date']))));
} }
if ($source == 'amazon b2b') { if ($source == 'amazon b2b') {
$i['category'] = 'Dostawa Wewnątrzwspólnotowa'; $i['category'] = 'WDT';
$i['parent_country_code'] = substr($i['parent_nip'], 0, 2); $i['parent_country_code'] = substr($i['parent_nip'], 0, 2);
$i['parent_name'] = $i['parent_name'] . ' ' . $i['parent_nip']; $i['parent_name'] = $i['parent_name'] . ' ' . $i['parent_nip'];
$i['parent_hash'] = $i['parent_nip']; //substr(md5($i['parent_name']), 0, 20); $i['parent_hash'] = $i['parent_nip']; //substr(md5($i['parent_name']), 0, 20);