some fixes
This commit is contained in:
@@ -8,7 +8,7 @@ DELETE FROM ecommerce_invoices_products WHERE invoice_id IN (
|
||||
DELETE FROM ecommerce_invoices WHERE origin='amazon b2b' AND register_date LIKE '2025-04-%';
|
||||
*/
|
||||
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/04-2025.csv';
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/05-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/amazon-wz-04-2025.csv';
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/amazon-wz-05-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
|
||||
@@ -8,7 +8,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-%';
|
||||
*/
|
||||
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/04-2025.csv';
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/05-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
|
||||
@@ -4,7 +4,7 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
// read csv file tab separated
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/04-2025.csv';
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/05-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
@@ -57,7 +57,7 @@ function createInvoice($type, $products, $DO_REAL_SAVE = false)
|
||||
$invoice->parent_address_city = 'Obrowo';
|
||||
|
||||
$invoice->type = 'normal';
|
||||
$date = '30.04.2025';
|
||||
$date = '31.05.2025';
|
||||
$invoice->register_date = $date;
|
||||
$invoice->sell_date = $date;
|
||||
$invoice->validtill_date = $date;
|
||||
|
||||
@@ -69,6 +69,7 @@ function getInvoices($source, $date, $type)
|
||||
$query .= " AND i.type='$type'";
|
||||
}
|
||||
$query .= " ORDER BY i.register_date";
|
||||
|
||||
$result = $db->query($query);
|
||||
$invoices = array();
|
||||
while ($row = $db->fetchByAssoc($result)) {
|
||||
@@ -129,6 +130,20 @@ function exportToRewizor($source, $date, $type)
|
||||
$i['corrected_document_no'] = $fv['document_no'];
|
||||
$i['corrected_register_date'] = date("Ymd000000",strtotime(date('d.m.Y', strtotime($fv['register_date']))));
|
||||
}
|
||||
$i['vats'] = array();
|
||||
foreach ($i['products'] as $p) {
|
||||
if (!isset($i['vats'][$p['vat_value']])) {
|
||||
$i['vats'][$p['vat_value']] = array(
|
||||
'netto' => 0,
|
||||
'brutto' => 0,
|
||||
'vat' => 0,
|
||||
);
|
||||
}
|
||||
$i['vats'][$p['vat_value']]['netto'] += $p['price_netto'] * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['brutto'] += $p['price_brutto'] * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['vat'] += ($p['price_brutto'] - $p['price_netto']) * $p['quantity'];
|
||||
$i['vats'][$p['vat_value']]['vat_value'] = $p['vat_value'];
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("data", $invoices);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
// FVKOR Polska - 17314
|
||||
// FVKOR domyślna - 7689
|
||||
|
||||
|
||||
/*
|
||||
DELETE p
|
||||
FROM ecommerce_invoices_products p
|
||||
@@ -21,7 +20,7 @@ function importFV($seriesId)
|
||||
|
||||
$IMPORT_START_ID = 1531694;
|
||||
|
||||
$dbRes = $db->query("SELECT id FROM ecommerce_invoices WHERE origin = 'allegro' AND type = 'normal' AND series_id = '$seriesId' ORDER BY id DESC LIMIT 1");
|
||||
$dbRes = $db->query("SELECT id FROM ecommerce_invoices WHERE origin = 'allegro' AND type = 'normal' AND series_id = '$seriesId' ORDER BY CAST(id AS UNSIGNED) DESC LIMIT 1");
|
||||
$lastImportId = $db->fetchByAssoc($dbRes)['id'];
|
||||
if ($lastImportId == null) {
|
||||
$lastImportId = $IMPORT_START_ID;
|
||||
@@ -30,6 +29,7 @@ function importFV($seriesId)
|
||||
}
|
||||
|
||||
$invoicesRes = loadInvoices($baselinker_config['token'], $lastImportId, $seriesId);
|
||||
|
||||
$invoices = $invoicesRes->invoices;
|
||||
|
||||
usort($invoices, function ($a, $b) {
|
||||
@@ -205,7 +205,11 @@ function getInvoiceSource($token, $orderId)
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiParams));
|
||||
$res = json_decode(curl_exec($curl));
|
||||
return $res->orders[0]->order_source;
|
||||
if ($res->orders[0]->order_source != '') {
|
||||
return $res->orders[0]->order_source;
|
||||
} else {
|
||||
return 'allegro'; //default
|
||||
}
|
||||
}
|
||||
function getCorrectTotals($invoice)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[INFO]
|
||||
[INFO]
|
||||
"1.05.4",0,1250,"Subiekt GT","GT","SubTest","Firma przykładowa systemu InsERT GT","Wrocław","54-445","Bławatkowa 25/3","111-111-11-11","MAG","Główny","Magazyn główny",,1,20170101000000,20170331000000,"Kowalski Jan",20170804155934,"Polska","PL",,0
|
||||
|
||||
{foreach from=$data item=i name=loop}
|
||||
@@ -6,7 +6,10 @@
|
||||
"FS",1,0,0,"{$i.document_no}","FS","{$i.document_no}",,,"{$i.order_no}",,"{$i.parent_hash}","{$i.parent_short_name}","{$i.parent_name}","{$i.parent_address_city}","{$i.parent_address_postalcode}","{$i.parent_address_street}","{$i.parent_nip}","Sprzedaż",,"Obrowo","{$i.register_date}","{$i.sell_date}","{$i.register_date}",1,0,,{$i.total_netto},{$i.total_vat},{$i.total_brutto},0,,,,"{$i.sell_date}",{$i.total_brutto},{$i.total_brutto},0,0,0,0,"",,,,,"PLN",,"",,,,0,,0,,,,,"",,
|
||||
|
||||
[ZAWARTOSC]
|
||||
"23",23,{$i.total_netto},{$i.total_vat},{$i.total_brutto},0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
{foreach from=$i.vats item=vat name=vatloop}
|
||||
"{$vat.vat_value}",{$vat.vat_value},{$vat.netto},{$vat.vat},{$vat.brutto},0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
{/foreach}
|
||||
|
||||
|
||||
{/foreach}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
[INFO]
|
||||
"1.05.4",0,1250,"Subiekt GT","GT","SubTest","Firma przykładowa systemu InsERT GT","Wrocław","54-445","Bławatkowa 25/3","111-111-11-11","MAG","Główny","Magazyn główny",,1,20170101000000,20170331000000,"Kowalski Jan",20170804155934,"Polska","PL",,0
|
||||
|
||||
@@ -7,7 +6,10 @@
|
||||
"KFS",1,0,0,"{$i.document_no}","FS","{$i.document_no}","{$i.corrected_document_no}","{$i.corrected_register_date}","{$i.order_no}",,"{$i.parent_hash}","{$i.parent_short_name}","{$i.parent_name}","{$i.parent_address_city}","{$i.parent_address_postalcode}","{$i.parent_address_street}","{$i.parent_nip}","Sprzedaż",,"Obrowo","{$i.register_date}","{$i.sell_date}","{$i.register_date}",1,0,,{$i.total_netto},{$i.total_vat},{$i.total_brutto},0,,,,"{$i.sell_date}",{$i.total_brutto},{$i.total_brutto},0,0,0,0,"",,,,,"PLN",,"",,,,0,,0,,,,,"",,
|
||||
|
||||
[ZAWARTOSC]
|
||||
"23",23,{$i.total_netto},{$i.total_vat},{$i.total_brutto},0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
{foreach from=$i.vats item=vat name=vatloop}
|
||||
"{$vat.vat_value}",{$vat.vat_value},{$vat.netto},{$vat.vat},{$vat.brutto},0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
{/foreach}
|
||||
|
||||
|
||||
{/foreach}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user