some fixes

This commit is contained in:
2025-07-10 08:04:15 +00:00
parent 34fe281e2c
commit e37b4dd963
14 changed files with 121 additions and 93 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -202,7 +202,7 @@ function createCostDocumentFromInvoice($record)
$doc->doc_symbol = $inv->document_no; $doc->doc_symbol = $inv->document_no;
$doc->revision = 1; $doc->revision = 1;
$doc->category_id = 'revision_note'; $doc->category_id = 'invoice';
$doc->status = '2'; $doc->status = '2';
$doc->transaction_type = '1'; $doc->transaction_type = '1';
$doc->document_type = 'k'; $doc->document_type = 'k';

View File

@@ -1,5 +1,6 @@
<?php <?php
$sugar_config = array( // created: 2025-07-10 06:50:17
$sugar_config = array (
'admin_access_control' => false, 'admin_access_control' => false,
'admin_export_only' => false, 'admin_export_only' => false,
'allow_pop_inbound' => true, 'allow_pop_inbound' => true,
@@ -9,14 +10,14 @@ $sugar_config = array(
'create_default_user' => false, 'create_default_user' => false,
'currency' => '', 'currency' => '',
'dashlet_display_row_options' => 'dashlet_display_row_options' =>
array( array (
0 => '1', 0 => '1',
1 => '3', 1 => '3',
2 => '5', 2 => '5',
3 => '10', 3 => '10',
), ),
'date_formats' => 'date_formats' =>
array( array (
'Y-m-d' => '2010-12-23', 'Y-m-d' => '2010-12-23',
'm-d-Y' => '12-23-2010', 'm-d-Y' => '12-23-2010',
'd-m-Y' => '23-12-2010', 'd-m-Y' => '23-12-2010',
@@ -28,7 +29,8 @@ $sugar_config = array(
'm.d.Y' => '12.23.2010', 'm.d.Y' => '12.23.2010',
), ),
'datef' => 'm/d/Y', 'datef' => 'm/d/Y',
'dbconfig' => array( 'dbconfig' =>
array (
'db_host_name' => 'localhost', 'db_host_name' => 'localhost',
'db_user_name' => 'root', 'db_user_name' => 'root',
'db_password' => '5z#JaL', 'db_password' => '5z#JaL',
@@ -36,7 +38,7 @@ $sugar_config = array(
'db_type' => 'mysql', 'db_type' => 'mysql',
), ),
'dbconfigoption' => 'dbconfigoption' =>
array( array (
'persistent' => true, 'persistent' => true,
'autofree' => false, 'autofree' => false,
'debug' => 0, 'debug' => 0,
@@ -48,93 +50,93 @@ $sugar_config = array(
'default_action' => 'index', 'default_action' => 'index',
'default_charset' => 'UTF-8', 'default_charset' => 'UTF-8',
'default_currencies' => 'default_currencies' =>
array( array (
'AUD' => 'AUD' =>
array( array (
'name' => 'Australian Dollars', 'name' => 'Australian Dollars',
'iso4217' => 'AUD', 'iso4217' => 'AUD',
'symbol' => '$', 'symbol' => '$',
), ),
'BRL' => 'BRL' =>
array( array (
'name' => 'Brazilian Reais', 'name' => 'Brazilian Reais',
'iso4217' => 'BRL', 'iso4217' => 'BRL',
'symbol' => 'R$', 'symbol' => 'R$',
), ),
'GBP' => 'GBP' =>
array( array (
'name' => 'British Pounds', 'name' => 'British Pounds',
'iso4217' => 'GBP', 'iso4217' => 'GBP',
'symbol' => 'ÂŁ', 'symbol' => 'ÂŁ',
), ),
'CAD' => 'CAD' =>
array( array (
'name' => 'Canadian Dollars', 'name' => 'Canadian Dollars',
'iso4217' => 'CAD', 'iso4217' => 'CAD',
'symbol' => '$', 'symbol' => '$',
), ),
'CNY' => 'CNY' =>
array( array (
'name' => 'Chinese Yuan', 'name' => 'Chinese Yuan',
'iso4217' => 'CNY', 'iso4217' => 'CNY',
'symbol' => '¥', 'symbol' => '¥',
), ),
'EUR' => 'EUR' =>
array( array (
'name' => 'Euro', 'name' => 'Euro',
'iso4217' => 'EUR', 'iso4217' => 'EUR',
'symbol' => '€', 'symbol' => '€',
), ),
'HKD' => 'HKD' =>
array( array (
'name' => 'Hong Kong Dollars', 'name' => 'Hong Kong Dollars',
'iso4217' => 'HKD', 'iso4217' => 'HKD',
'symbol' => '$', 'symbol' => '$',
), ),
'INR' => 'INR' =>
array( array (
'name' => 'Indian Rupees', 'name' => 'Indian Rupees',
'iso4217' => 'INR', 'iso4217' => 'INR',
'symbol' => '₨', 'symbol' => '₨',
), ),
'KRW' => 'KRW' =>
array( array (
'name' => 'Korean Won', 'name' => 'Korean Won',
'iso4217' => 'KRW', 'iso4217' => 'KRW',
'symbol' => 'â‚©', 'symbol' => 'â‚©',
), ),
'YEN' => 'YEN' =>
array( array (
'name' => 'Japanese Yen', 'name' => 'Japanese Yen',
'iso4217' => 'JPY', 'iso4217' => 'JPY',
'symbol' => 'ÂĄ', 'symbol' => 'ÂĄ',
), ),
'MXM' => 'MXM' =>
array( array (
'name' => 'Mexican Pesos', 'name' => 'Mexican Pesos',
'iso4217' => 'MXM', 'iso4217' => 'MXM',
'symbol' => '$', 'symbol' => '$',
), ),
'SGD' => 'SGD' =>
array( array (
'name' => 'Singaporean Dollars', 'name' => 'Singaporean Dollars',
'iso4217' => 'SGD', 'iso4217' => 'SGD',
'symbol' => '$', 'symbol' => '$',
), ),
'CHF' => 'CHF' =>
array( array (
'name' => 'Swiss Franc', 'name' => 'Swiss Franc',
'iso4217' => 'CHF', 'iso4217' => 'CHF',
'symbol' => 'SFr.', 'symbol' => 'SFr.',
), ),
'THB' => 'THB' =>
array( array (
'name' => 'Thai Baht', 'name' => 'Thai Baht',
'iso4217' => 'THB', 'iso4217' => 'THB',
'symbol' => '฿', 'symbol' => '฿',
), ),
'USD' => 'USD' =>
array( array (
'name' => 'US Dollars', 'name' => 'US Dollars',
'iso4217' => 'USD', 'iso4217' => 'USD',
'symbol' => '$', 'symbol' => '$',
@@ -159,7 +161,7 @@ $sugar_config = array(
'default_number_grouping_seperator' => ',', 'default_number_grouping_seperator' => ',',
'default_password' => '', 'default_password' => '',
'default_permissions' => 'default_permissions' =>
array( array (
'dir_mode' => 1528, 'dir_mode' => 1528,
'file_mode' => 432, 'file_mode' => 432,
'user' => '', 'user' => '',
@@ -190,7 +192,7 @@ $sugar_config = array(
'googleClientSecret' => 'C6vjyBug2W2h7JefuMnlO-4j', 'googleClientSecret' => 'C6vjyBug2W2h7JefuMnlO-4j',
'googleRedirectUri' => 'http://system.saas-systems.pl/index.php?module=Users&action=googleLogin', 'googleRedirectUri' => 'http://system.saas-systems.pl/index.php?module=Users&action=googleLogin',
'googleScopes' => 'googleScopes' =>
array( array (
0 => 'https://www.googleapis.com/auth/calendar', 0 => 'https://www.googleapis.com/auth/calendar',
1 => 'https://www.googleapis.com/auth/userinfo.email', 1 => 'https://www.googleapis.com/auth/userinfo.email',
2 => 'https://www.googleapis.com/auth/userinfo.profile', 2 => 'https://www.googleapis.com/auth/userinfo.profile',
@@ -198,16 +200,16 @@ $sugar_config = array(
'history_max_viewed' => 50, 'history_max_viewed' => 50,
'host_name' => 'https://crm.twinpol.com', 'host_name' => 'https://crm.twinpol.com',
'http_referer' => 'http_referer' =>
array( array (
'actions' => 'actions' =>
array( array (
0 => 'saveInvoice', 0 => 'saveInvoice',
), ),
'weak' => true, 'weak' => true,
'list' => 'list' =>
array( array (
0 => 'saas-systems.pl', 0 => 'crm.twinpol.com',
1 => 'b2b-meritum.ddns.net', 1 => 'accounts.google.com',
2 => 'crm-meritum.ddns.net', 2 => 'crm-meritum.ddns.net',
3 => '83.3.222.246', 3 => '83.3.222.246',
), ),
@@ -219,7 +221,7 @@ $sugar_config = array(
'js_custom_version' => 1, 'js_custom_version' => 1,
'js_lang_version' => 7, 'js_lang_version' => 7,
'languages' => 'languages' =>
array( array (
'pl_pl' => 'Polski', 'pl_pl' => 'Polski',
'en_us' => 'English (US)', 'en_us' => 'English (US)',
), ),
@@ -233,10 +235,10 @@ $sugar_config = array(
'log_file' => 'sugarcrm.log', 'log_file' => 'sugarcrm.log',
'log_memory_usage' => false, 'log_memory_usage' => false,
'logger' => 'logger' =>
array( array (
'level' => 'off', 'level' => 'off',
'file' => 'file' =>
array( array (
'ext' => '.log', 'ext' => '.log',
'name' => 'sugarcrm', 'name' => 'sugarcrm',
'dateFormat' => '%c', 'dateFormat' => '%c',
@@ -248,7 +250,7 @@ $sugar_config = array(
'max_dashlets_homepage' => '15', 'max_dashlets_homepage' => '15',
'other_group_tab_displayed' => true, 'other_group_tab_displayed' => true,
'passwordsetting' => 'passwordsetting' =>
array( array (
'SystemGeneratedPasswordON' => '1', 'SystemGeneratedPasswordON' => '1',
'generatepasswordtmpl' => '33583ffa-c047-382e-35da-4e54c412cb94', 'generatepasswordtmpl' => '33583ffa-c047-382e-35da-4e54c412cb94',
'lostpasswordtmpl' => '33bd20d2-916c-1029-54ae-4e54c406c303', 'lostpasswordtmpl' => '33bd20d2-916c-1029-54ae-4e54c406c303',
@@ -268,10 +270,10 @@ $sugar_config = array(
'portal_view' => 'single_user', 'portal_view' => 'single_user',
'require_accounts' => true, 'require_accounts' => true,
'resource_management' => 'resource_management' =>
array( array (
'special_query_limit' => 50000, 'special_query_limit' => 50000,
'special_query_modules' => 'special_query_modules' =>
array( array (
0 => 'Reports', 0 => 'Reports',
1 => 'Export', 1 => 'Export',
2 => 'Import', 2 => 'Import',
@@ -298,7 +300,7 @@ $sugar_config = array(
'sugar_version' => '6.0.4', 'sugar_version' => '6.0.4',
'sugarbeet' => 0, 'sugarbeet' => 0,
'time_formats' => 'time_formats' =>
array( array (
'H:i' => '23:00', 'H:i' => '23:00',
'h:ia' => '11:00pm', 'h:ia' => '11:00pm',
'h:iA' => '11:00PM', 'h:iA' => '11:00PM',
@@ -312,7 +314,7 @@ $sugar_config = array(
'translation_string_prefix' => false, 'translation_string_prefix' => false,
'unique_key' => '2b00a93f1188f2ede3ecc6e98ecbab1c', 'unique_key' => '2b00a93f1188f2ede3ecc6e98ecbab1c',
'upload_badext' => 'upload_badext' =>
array( array (
0 => 'php', 0 => 'php',
1 => 'php3', 1 => 'php3',
2 => 'php4', 2 => 'php4',
@@ -335,11 +337,4 @@ $sugar_config = array(
'vcal_time' => '2', 'vcal_time' => '2',
'verify_client_ip' => false, 'verify_client_ip' => false,
); );
?>
if ($_SERVER['HTTP_HOST'] == 'localhost:8080') {
$sugar_config['dbconfig']['db_host_name'] = 'twinpol-mysql56';
$sugar_config['dbconfig']['db_user_name'] = 'root';
$sugar_config['dbconfig']['db_password'] = 'rootpassword';
}

View File

@@ -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-%'; 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'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);

View File

@@ -1,6 +1,6 @@
<?php <?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'); $handle = fopen($filename, 'r');
if ($handle === false) { if ($handle === false) {
die('Cannot open file: ' . $filename); die('Cannot open file: ' . $filename);

View File

@@ -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-%'; 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'); $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/04-2025.csv'; $filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/05-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.04.2025'; $date = '31.05.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;

View File

@@ -69,6 +69,7 @@ function getInvoices($source, $date, $type)
$query .= " AND i.type='$type'"; $query .= " AND i.type='$type'";
} }
$query .= " ORDER BY i.register_date"; $query .= " ORDER BY i.register_date";
$result = $db->query($query); $result = $db->query($query);
$invoices = array(); $invoices = array();
while ($row = $db->fetchByAssoc($result)) { while ($row = $db->fetchByAssoc($result)) {
@@ -129,6 +130,20 @@ function exportToRewizor($source, $date, $type)
$i['corrected_document_no'] = $fv['document_no']; $i['corrected_document_no'] = $fv['document_no'];
$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']))));
} }
$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); $smarty->assign("data", $invoices);

View File

@@ -6,7 +6,6 @@
// FVKOR Polska - 17314 // FVKOR Polska - 17314
// FVKOR domyślna - 7689 // FVKOR domyślna - 7689
/* /*
DELETE p DELETE p
FROM ecommerce_invoices_products p FROM ecommerce_invoices_products p
@@ -21,7 +20,7 @@ function importFV($seriesId)
$IMPORT_START_ID = 1531694; $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']; $lastImportId = $db->fetchByAssoc($dbRes)['id'];
if ($lastImportId == null) { if ($lastImportId == null) {
$lastImportId = $IMPORT_START_ID; $lastImportId = $IMPORT_START_ID;
@@ -30,6 +29,7 @@ function importFV($seriesId)
} }
$invoicesRes = loadInvoices($baselinker_config['token'], $lastImportId, $seriesId); $invoicesRes = loadInvoices($baselinker_config['token'], $lastImportId, $seriesId);
$invoices = $invoicesRes->invoices; $invoices = $invoicesRes->invoices;
usort($invoices, function ($a, $b) { usort($invoices, function ($a, $b) {
@@ -205,7 +205,11 @@ function getInvoiceSource($token, $orderId)
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiParams)); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiParams));
$res = json_decode(curl_exec($curl)); $res = json_decode(curl_exec($curl));
if ($res->orders[0]->order_source != '') {
return $res->orders[0]->order_source; return $res->orders[0]->order_source;
} else {
return 'allegro'; //default
}
} }
function getCorrectTotals($invoice) function getCorrectTotals($invoice)
{ {

View File

@@ -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 "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} {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,,,,,"",, "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] [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} {/foreach}

View File

@@ -1,4 +1,3 @@
[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 "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,,,,,"",, "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] [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} {/foreach}

View File

@@ -50,7 +50,7 @@ $i=0;
$total_quantity=0; $total_quantity=0;
$total_value=0; $total_value=0;
while ($tmp2 = $db->fetchByAssoc($r1)) { while ($tmp2 = $db->fetchByAssoc($r1)) {
$r = $db->query("select * from ecmstockoperations where product_id='" . $tmp2['id'] . "' ".$add_where." and in_id is null and used=0 and type=0 order by counter asc"); $r = $db->query("select * from ecmstockoperations where product_id='" . $tmp2['id'] . "' ".$add_where." and in_id is null and used=0 and type=0 and deleted=0 order by counter asc");
$l = 0; $l = 0;
if ($r->num_rows > 0) { if ($r->num_rows > 0) {
$docs[$i]['unit_id'] = $app_list_strings['ecmproducts_unit_dom'][$tmp2['unit_id']]; $docs[$i]['unit_id'] = $app_list_strings['ecmproducts_unit_dom'][$tmp2['unit_id']];
@@ -63,8 +63,9 @@ while ($tmp2 = $db->fetchByAssoc($r1)) {
$i++; $i++;
} }
while ($tmp = $db->fetchByAssoc($r)) { while ($tmp = $db->fetchByAssoc($r)) {
var_dump($tmp);
$ii = $db->query( "select * from ecmstockoperations where in_id='" . $tmp['id'] ."' and type=1"); $ii = $db->query( "select * from ecmstockoperations where in_id='" . $tmp['id'] ."' and type=1");
echo "select * from ecmstockoperations where in_id='" . $tmp['id'] ."' and type=1";
if ($ii->num_rows > 0) { if ($ii->num_rows > 0) {
// licz ilość dla użytych // licz ilość dla użytych
$quantity_tmp = $tmp['quantity']; $quantity_tmp = $tmp['quantity'];

View File

@@ -14,8 +14,7 @@ class PurchaseCreator{
} }
public function getPurchases($type){ public function getPurchases($type){
//$query = "SELECT * FROM documents WHERE id='790f2a4d-28d7-e135-9be2-68408ca7279a'"; $query="select * from documents where document_date>='" . $this->date_from . "' and document_date<='" . $this->date_to . "' and category_id in ('invoice','compain_note','return_note') and deleted=0";
//$query="select * from documents where document_date>='" . $this->date_from . "' and document_date<='" . $this->date_to . "' and category_id in ('invoice','compain_note','return_note') and deleted=0";
if ($type == "new") { if ($type == "new") {
$query .= " and exported = 0"; $query .= " and exported = 0";
} }

View File

@@ -136,6 +136,7 @@ $return_id = $focus->id;
$focus->ecommerce_invoices = $json->decode(htmlspecialchars_decode($_POST['ecommerce_invoices'])); $focus->ecommerce_invoices = $json->decode(htmlspecialchars_decode($_POST['ecommerce_invoices']));
if (isset($focus->ecommerce_invoices) && count($focus->ecommerce_invoices) > 0) { if (isset($focus->ecommerce_invoices) && count($focus->ecommerce_invoices) > 0) {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
$q = "UPDATE ecommerce_invoices SET ecmstockdoccorrect_id = '$return_id' WHERE id IN ('" . implode("','", $focus->ecommerce_invoices) . "')";
$db->query("UPDATE ecommerce_invoices SET ecmstockdoccorrect_id = '$return_id' WHERE id IN ('" . implode("','", $focus->ecommerce_invoices) . "')"); $db->query("UPDATE ecommerce_invoices SET ecmstockdoccorrect_id = '$return_id' WHERE id IN ('" . implode("','", $focus->ecommerce_invoices) . "')");
} }