some fixes
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal 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
|
||||
@@ -202,7 +202,7 @@ function createCostDocumentFromInvoice($record)
|
||||
$doc->doc_symbol = $inv->document_no;
|
||||
$doc->revision = 1;
|
||||
|
||||
$doc->category_id = 'revision_note';
|
||||
$doc->category_id = 'invoice';
|
||||
$doc->status = '2';
|
||||
$doc->transaction_type = '1';
|
||||
$doc->document_type = 'k';
|
||||
|
||||
83
config.php
83
config.php
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$sugar_config = array(
|
||||
// created: 2025-07-10 06:50:17
|
||||
$sugar_config = array (
|
||||
'admin_access_control' => false,
|
||||
'admin_export_only' => false,
|
||||
'allow_pop_inbound' => true,
|
||||
@@ -9,14 +10,14 @@ $sugar_config = array(
|
||||
'create_default_user' => false,
|
||||
'currency' => '',
|
||||
'dashlet_display_row_options' =>
|
||||
array(
|
||||
array (
|
||||
0 => '1',
|
||||
1 => '3',
|
||||
2 => '5',
|
||||
3 => '10',
|
||||
),
|
||||
'date_formats' =>
|
||||
array(
|
||||
array (
|
||||
'Y-m-d' => '2010-12-23',
|
||||
'm-d-Y' => '12-23-2010',
|
||||
'd-m-Y' => '23-12-2010',
|
||||
@@ -28,7 +29,8 @@ $sugar_config = array(
|
||||
'm.d.Y' => '12.23.2010',
|
||||
),
|
||||
'datef' => 'm/d/Y',
|
||||
'dbconfig' => array(
|
||||
'dbconfig' =>
|
||||
array (
|
||||
'db_host_name' => 'localhost',
|
||||
'db_user_name' => 'root',
|
||||
'db_password' => '5z#JaL',
|
||||
@@ -36,7 +38,7 @@ $sugar_config = array(
|
||||
'db_type' => 'mysql',
|
||||
),
|
||||
'dbconfigoption' =>
|
||||
array(
|
||||
array (
|
||||
'persistent' => true,
|
||||
'autofree' => false,
|
||||
'debug' => 0,
|
||||
@@ -48,93 +50,93 @@ $sugar_config = array(
|
||||
'default_action' => 'index',
|
||||
'default_charset' => 'UTF-8',
|
||||
'default_currencies' =>
|
||||
array(
|
||||
array (
|
||||
'AUD' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Australian Dollars',
|
||||
'iso4217' => 'AUD',
|
||||
'symbol' => '$',
|
||||
),
|
||||
'BRL' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Brazilian Reais',
|
||||
'iso4217' => 'BRL',
|
||||
'symbol' => 'R$',
|
||||
),
|
||||
'GBP' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'British Pounds',
|
||||
'iso4217' => 'GBP',
|
||||
'symbol' => 'ÂŁ',
|
||||
),
|
||||
'CAD' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Canadian Dollars',
|
||||
'iso4217' => 'CAD',
|
||||
'symbol' => '$',
|
||||
),
|
||||
'CNY' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Chinese Yuan',
|
||||
'iso4217' => 'CNY',
|
||||
'symbol' => '¥',
|
||||
),
|
||||
'EUR' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Euro',
|
||||
'iso4217' => 'EUR',
|
||||
'symbol' => '€',
|
||||
),
|
||||
'HKD' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Hong Kong Dollars',
|
||||
'iso4217' => 'HKD',
|
||||
'symbol' => '$',
|
||||
),
|
||||
'INR' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Indian Rupees',
|
||||
'iso4217' => 'INR',
|
||||
'symbol' => '₨',
|
||||
),
|
||||
'KRW' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Korean Won',
|
||||
'iso4217' => 'KRW',
|
||||
'symbol' => 'â‚©',
|
||||
),
|
||||
'YEN' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Japanese Yen',
|
||||
'iso4217' => 'JPY',
|
||||
'symbol' => 'ÂĄ',
|
||||
),
|
||||
'MXM' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Mexican Pesos',
|
||||
'iso4217' => 'MXM',
|
||||
'symbol' => '$',
|
||||
),
|
||||
'SGD' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Singaporean Dollars',
|
||||
'iso4217' => 'SGD',
|
||||
'symbol' => '$',
|
||||
),
|
||||
'CHF' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Swiss Franc',
|
||||
'iso4217' => 'CHF',
|
||||
'symbol' => 'SFr.',
|
||||
),
|
||||
'THB' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'Thai Baht',
|
||||
'iso4217' => 'THB',
|
||||
'symbol' => '฿',
|
||||
),
|
||||
'USD' =>
|
||||
array(
|
||||
array (
|
||||
'name' => 'US Dollars',
|
||||
'iso4217' => 'USD',
|
||||
'symbol' => '$',
|
||||
@@ -159,7 +161,7 @@ $sugar_config = array(
|
||||
'default_number_grouping_seperator' => ',',
|
||||
'default_password' => '',
|
||||
'default_permissions' =>
|
||||
array(
|
||||
array (
|
||||
'dir_mode' => 1528,
|
||||
'file_mode' => 432,
|
||||
'user' => '',
|
||||
@@ -190,7 +192,7 @@ $sugar_config = array(
|
||||
'googleClientSecret' => 'C6vjyBug2W2h7JefuMnlO-4j',
|
||||
'googleRedirectUri' => 'http://system.saas-systems.pl/index.php?module=Users&action=googleLogin',
|
||||
'googleScopes' =>
|
||||
array(
|
||||
array (
|
||||
0 => 'https://www.googleapis.com/auth/calendar',
|
||||
1 => 'https://www.googleapis.com/auth/userinfo.email',
|
||||
2 => 'https://www.googleapis.com/auth/userinfo.profile',
|
||||
@@ -198,16 +200,16 @@ $sugar_config = array(
|
||||
'history_max_viewed' => 50,
|
||||
'host_name' => 'https://crm.twinpol.com',
|
||||
'http_referer' =>
|
||||
array(
|
||||
array (
|
||||
'actions' =>
|
||||
array(
|
||||
array (
|
||||
0 => 'saveInvoice',
|
||||
),
|
||||
'weak' => true,
|
||||
'list' =>
|
||||
array(
|
||||
0 => 'saas-systems.pl',
|
||||
1 => 'b2b-meritum.ddns.net',
|
||||
array (
|
||||
0 => 'crm.twinpol.com',
|
||||
1 => 'accounts.google.com',
|
||||
2 => 'crm-meritum.ddns.net',
|
||||
3 => '83.3.222.246',
|
||||
),
|
||||
@@ -219,7 +221,7 @@ $sugar_config = array(
|
||||
'js_custom_version' => 1,
|
||||
'js_lang_version' => 7,
|
||||
'languages' =>
|
||||
array(
|
||||
array (
|
||||
'pl_pl' => 'Polski',
|
||||
'en_us' => 'English (US)',
|
||||
),
|
||||
@@ -233,10 +235,10 @@ $sugar_config = array(
|
||||
'log_file' => 'sugarcrm.log',
|
||||
'log_memory_usage' => false,
|
||||
'logger' =>
|
||||
array(
|
||||
array (
|
||||
'level' => 'off',
|
||||
'file' =>
|
||||
array(
|
||||
array (
|
||||
'ext' => '.log',
|
||||
'name' => 'sugarcrm',
|
||||
'dateFormat' => '%c',
|
||||
@@ -248,7 +250,7 @@ $sugar_config = array(
|
||||
'max_dashlets_homepage' => '15',
|
||||
'other_group_tab_displayed' => true,
|
||||
'passwordsetting' =>
|
||||
array(
|
||||
array (
|
||||
'SystemGeneratedPasswordON' => '1',
|
||||
'generatepasswordtmpl' => '33583ffa-c047-382e-35da-4e54c412cb94',
|
||||
'lostpasswordtmpl' => '33bd20d2-916c-1029-54ae-4e54c406c303',
|
||||
@@ -268,10 +270,10 @@ $sugar_config = array(
|
||||
'portal_view' => 'single_user',
|
||||
'require_accounts' => true,
|
||||
'resource_management' =>
|
||||
array(
|
||||
array (
|
||||
'special_query_limit' => 50000,
|
||||
'special_query_modules' =>
|
||||
array(
|
||||
array (
|
||||
0 => 'Reports',
|
||||
1 => 'Export',
|
||||
2 => 'Import',
|
||||
@@ -298,7 +300,7 @@ $sugar_config = array(
|
||||
'sugar_version' => '6.0.4',
|
||||
'sugarbeet' => 0,
|
||||
'time_formats' =>
|
||||
array(
|
||||
array (
|
||||
'H:i' => '23:00',
|
||||
'h:ia' => '11:00pm',
|
||||
'h:iA' => '11:00PM',
|
||||
@@ -312,7 +314,7 @@ $sugar_config = array(
|
||||
'translation_string_prefix' => false,
|
||||
'unique_key' => '2b00a93f1188f2ede3ecc6e98ecbab1c',
|
||||
'upload_badext' =>
|
||||
array(
|
||||
array (
|
||||
0 => 'php',
|
||||
1 => 'php3',
|
||||
2 => 'php4',
|
||||
@@ -335,11 +337,4 @@ $sugar_config = array(
|
||||
'vcal_time' => '2',
|
||||
'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';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -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}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ $i=0;
|
||||
$total_quantity=0;
|
||||
$total_value=0;
|
||||
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;
|
||||
if ($r->num_rows > 0) {
|
||||
$docs[$i]['unit_id'] = $app_list_strings['ecmproducts_unit_dom'][$tmp2['unit_id']];
|
||||
@@ -63,8 +63,9 @@ while ($tmp2 = $db->fetchByAssoc($r1)) {
|
||||
$i++;
|
||||
}
|
||||
while ($tmp = $db->fetchByAssoc($r)) {
|
||||
|
||||
var_dump($tmp);
|
||||
$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) {
|
||||
// licz ilość dla użytych
|
||||
$quantity_tmp = $tmp['quantity'];
|
||||
|
||||
@@ -14,8 +14,7 @@ class PurchaseCreator{
|
||||
}
|
||||
|
||||
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") {
|
||||
$query .= " and exported = 0";
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ $return_id = $focus->id;
|
||||
$focus->ecommerce_invoices = $json->decode(htmlspecialchars_decode($_POST['ecommerce_invoices']));
|
||||
if (isset($focus->ecommerce_invoices) && count($focus->ecommerce_invoices) > 0) {
|
||||
$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) . "')");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user