Add php files
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
/*
|
||||
DELETE FROM ecommerce_invoices_products WHERE invoice_id IN (
|
||||
SELECT id 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';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
$b2b = [];
|
||||
while (($data = fgetcsv($handle, 0, "\t")) !== false) {
|
||||
if ($data[1] == 'WDT - B2B' && $data[8] == 'PL' && $data[9] != 'PL') {
|
||||
$b2b[] = $data;
|
||||
if ($data[20] != 'PLN') {
|
||||
echo '~PLN';
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
$groupedB2B = [];
|
||||
foreach ($b2b as $el) {
|
||||
if ($el[6] == 'Sprzedaz - Transport') {
|
||||
$el[10] = '00195';
|
||||
$el[11] = '1';
|
||||
}
|
||||
$groupedB2B[$el[21]][] = $el;
|
||||
}
|
||||
|
||||
foreach ($groupedB2B as $invoiceNo => $invoice) {
|
||||
if (checkInvoice($invoiceNo)) {
|
||||
echo 'Invoice already exists' . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
$totalNetto = 0;
|
||||
$totalVat = 0;
|
||||
$totalBrutto = 0;
|
||||
foreach ($invoice as $item) {
|
||||
$totalNetto += str_replace(',', '.', $item[17]);
|
||||
$totalVat += str_replace(',', '.', $item[18]);
|
||||
$totalBrutto += str_replace(',', '.', $item[19]);
|
||||
}
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$db->query("SET NAMES utf8mb4");
|
||||
$i = $invoice[0];
|
||||
$type = '';
|
||||
foreach ($invoice as $item) {
|
||||
if ($item[6] == 'Sprzedaz - Produkt') {
|
||||
$type = 'normal';
|
||||
break;
|
||||
} else if ($item[6] == 'Zwrot - Produkt') {
|
||||
$type = 'correcting';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$invoiceId = getId();
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices VALUES ('%s', '%s', '%s', '%s', '%s', 'amazon b2b', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%f', null, null, null, null, null);",
|
||||
$invoiceId, $i[21], $type, formatDate($i[5]), formatDate($i[5]),
|
||||
null, 'AmazonCustomer', $i[22], null, null, '',
|
||||
'', null, 'PLN', $totalNetto, $totalBrutto, $totalVat);
|
||||
$res = $db->query($query);
|
||||
if (!$res) {
|
||||
echo "Query error: ".$query.PHP_EOL;
|
||||
}
|
||||
|
||||
foreach ($invoice as $p) {
|
||||
// if last character is dot, remove it
|
||||
if (substr($p[10], -1) == '.') {
|
||||
$p[10] = substr($p[10], 0, -1);
|
||||
}
|
||||
if (substr($p[10], -1) == '-') {
|
||||
$p[10] = substr($p[10], 0, -1);
|
||||
}
|
||||
|
||||
if (checkProduct($p[10])) {
|
||||
echo 'Cannot find product: '. $p[10] . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
$productId = $db->fetchByAssoc($db->query(sprintf("SELECT id FROM ecmproducts WHERE code='%s' OR amazon_code='%s' AND deleted=0", $p[10], $p[10])))['id'];
|
||||
$quantity = str_replace(',', '.', $p[11]);
|
||||
$vatValue = str_replace(',', '.', $p[12]) * 100;
|
||||
$netto = str_replace(',', '.', $p[17]) / $quantity;
|
||||
$vat = str_replace(',', '.', $p[18]) / $quantity;
|
||||
$brutto = str_replace(',', '.', $p[19]) / $quantity;
|
||||
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices_products VALUES('%s', '%s', '%s', null, '%f', '%f', '%f', '%f', '%f', '%s')",
|
||||
getId(), $productId, $invoiceId, $quantity, $netto, $brutto, $vat, $vatValue, $p[10]);
|
||||
$res = $db->query($query);
|
||||
if (!$res) {
|
||||
echo "Query error: ".$query.PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo 'Koniec. Smutne.';
|
||||
|
||||
function checkProduct($code)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecmproducts WHERE code='%s' OR amazon_code='%s' AND deleted=0", $code, $code));
|
||||
return $res->num_rows > 0 ? false : true;
|
||||
}
|
||||
function checkInvoice($number) {
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecommerce_invoices WHERE document_no = '%s'", $number));
|
||||
return $res->num_rows > 0;
|
||||
}
|
||||
function formatDate($date) {
|
||||
$dateTime = DateTime::createFromFormat('d-m-Y', $date);
|
||||
return $dateTime ? $dateTime->format('Y-m-d') : false;
|
||||
}
|
||||
function getId() {
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->fetchByAssoc($db->query("SELECT UUID() as id;"));
|
||||
return $res['id'];
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
$filename = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/amazon-wz-04-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
$products = [];
|
||||
$db = $GLOBALS['db'];
|
||||
global $app_list_strings;
|
||||
|
||||
while (($data = fgetcsv($handle, 0, ";")) !== false) {
|
||||
if ($data[2] != 'SKU' && $data[2] != '' && $data[3] != '') {
|
||||
$p = array();
|
||||
$p['product_code'] = $data[2];
|
||||
if (substr($p['product_code'], -1) == '.' || substr($p['product_code'], -1) == '-') {
|
||||
$p['product_code'] = substr($p['product_code'], 0, -1);
|
||||
}
|
||||
$p['quantity'] = floatval(str_replace(' ', '', $data[3]));
|
||||
$p['total'] = floatval(str_replace(' ', '', str_replace(',', '.', $data[5])));
|
||||
$p['price_netto'] = round($p['total'] / $p['quantity'], 2);
|
||||
$fromDb = $db->fetchByAssoc($db->query("SELECT * FROM ecmproducts WHERE deleted=0 AND (code = '" . $p['product_code'] . "' OR amazon_code = '" . $p['product_code'] . "')"));
|
||||
if (empty($fromDb)) {
|
||||
echo 'Nie znaleziono produktu: ' . $p['product_code'] . PHP_EOL;
|
||||
die('KONIEC');
|
||||
}
|
||||
$p['product_id'] = $fromDb['id'];
|
||||
$p['name'] = $fromDb['name'];
|
||||
$p['unit_id'] = $fromDb['unit_id'];
|
||||
$p['unit_name'] = $app_list_strings['ecmproducts_unit_dom'][$p['unit_id']];
|
||||
$p['ecmvat_name'] = '0%';
|
||||
$p['ecmvat_value'] = 0;
|
||||
$p['ecmvat_id'] = '9b783d21-5548-6653-e1d6-49610eb3f9dd';
|
||||
$products[] = $p;
|
||||
}
|
||||
}
|
||||
|
||||
$mergedProducts = [];
|
||||
foreach ($products as $product) {
|
||||
if (!isset($mergedProducts[$product['product_id']])) {
|
||||
$mergedProducts[$product['product_id']] = $product;
|
||||
} else {
|
||||
$mergedProducts[$product['product_id']]['quantity'] += $product['quantity'];
|
||||
$mergedProducts[$product['product_id']]['total'] += $product['total'];
|
||||
$mergedProducts[$product['product_id']]['price'] = round($mergedProducts[$product['product_id']]['total'] / $mergedProducts[$product['product_id']]['quantity'], 2);
|
||||
}
|
||||
}
|
||||
$products = array_values($mergedProducts);
|
||||
fclose($handle);
|
||||
|
||||
$sessionId = create_guid();
|
||||
$_SESSION[$sessionId] = $products;
|
||||
|
||||
echo '<input title="Wystaw WZ" class="button primary" type="button" name="Edit" id="edit_button" value="Wystaw WZ"
|
||||
onclick="window.open(\'index.php?module=EcmStockDocOuts&action=EditView&amazonWZ=' . $sessionId . '\')">';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getStockStates($products)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT s.product_id, s.quantity FROM ecmstockstates AS s WHERE s.stock_id = 'add8ef6f-3d1f-5ccf-c486-64719142f096' AND s.product_id IN ('" . implode('\',\'', $products) . "')";
|
||||
$res = $db->query($query);
|
||||
$stockStates = array();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$stockStates[$row['product_id']] = isset($row['quantity']) ? intval($row['quantity']) : 0;
|
||||
}
|
||||
return $stockStates;
|
||||
}
|
||||
|
||||
function getProductsForWZ($invoiceIds)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT ip.ecmproduct_id, SUM(ip.quantity) AS quantity, ip.price_netto
|
||||
FROM ecommerce_invoices_products AS ip
|
||||
WHERE invoice_id IN ('" . implode('\',\'', $invoiceIds) . "')
|
||||
AND ip.ecmproduct_id NOT IN ('', '165f364e-9301-25ac-5906-58e38f1de4ca')
|
||||
GROUP BY ip.ecmproduct_id, ip.price_netto;";
|
||||
$res = $db->query($query);
|
||||
$products = array();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$products[] = array(
|
||||
'ecmproduct_id' => $row['ecmproduct_id'],
|
||||
'quantity' => $row['quantity'],
|
||||
'price_netto' => $row['price_netto'],
|
||||
);
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
/*
|
||||
DELETE FROM ecommerce_invoices_products WHERE invoice_id IN (
|
||||
SELECT id 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';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
$localVat = [];
|
||||
while (($data = fgetcsv($handle, 0, "\t")) !== false) {
|
||||
if ($data[1] == 'VAT - Lokalny' && $data[8] == 'PL' && $data[9] == 'PL') {
|
||||
$localVat[] = $data;
|
||||
if ($data[20] != 'PLN') {
|
||||
echo '~PLN';
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
$groupedLocalVat = [];
|
||||
foreach ($localVat as $vat) {
|
||||
if ($vat[6] == 'Sprzedaz - Transport') {
|
||||
$vat[10] = '00195';
|
||||
$vat[11] = '1';
|
||||
}
|
||||
$groupedLocalVat[$vat[21]][] = $vat;
|
||||
}
|
||||
|
||||
foreach ($groupedLocalVat as $invoiceNo => $invoice) {
|
||||
if (checkInvoice($invoiceNo)) {
|
||||
echo 'Invoice already exists' . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
$totalNetto = 0;
|
||||
$totalVat = 0;
|
||||
$totalBrutto = 0;
|
||||
foreach ($invoice as $item) {
|
||||
$totalNetto += str_replace(',', '.', $item[17]);
|
||||
$totalVat += str_replace(',', '.', $item[18]);
|
||||
$totalBrutto += str_replace(',', '.', $item[19]);
|
||||
}
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$db->query("SET NAMES utf8mb4");
|
||||
$i = $invoice[0];
|
||||
$type = '';
|
||||
foreach ($invoice as $item) {
|
||||
if ($item[6] == 'Sprzedaz - Produkt') {
|
||||
$type = 'normal';
|
||||
break;
|
||||
} else if ($item[6] == 'Zwrot - Produkt') {
|
||||
$type = 'correcting';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$invoiceId = getId();
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices VALUES ('%s', '%s', '%s', '%s', '%s', 'amazon vat local', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%f', null, null, null, null, null);",
|
||||
$invoiceId, $i[21], $type, formatDate($i[5]), formatDate($i[5]),
|
||||
null, 'AmazonCustomer', $i[22], null, null, '',
|
||||
'', null, 'PLN', $totalNetto, $totalBrutto, $totalVat);
|
||||
$res = $db->query($query);
|
||||
if (!$res) {
|
||||
echo "Query error: ".$query.PHP_EOL;
|
||||
}
|
||||
|
||||
foreach ($invoice as $p) {
|
||||
// if last character is dot, remove it
|
||||
if (substr($p[10], -1) == '.') {
|
||||
$p[10] = substr($p[10], 0, -1);
|
||||
}
|
||||
|
||||
if (checkProduct($p[10])) {
|
||||
echo 'Cannot find product: '. $p[10] . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
$productId = $db->fetchByAssoc($db->query(sprintf("SELECT id FROM ecmproducts WHERE code='%s' OR amazon_code='%s' AND deleted=0", $p[10], $p[10])))['id'];
|
||||
$quantity = str_replace(',', '.', $p[11]);
|
||||
$vatValue = str_replace(',', '.', $p[12]) * 100;
|
||||
$netto = str_replace(',', '.', $p[17]) / $quantity;
|
||||
$vat = str_replace(',', '.', $p[18]) / $quantity;
|
||||
$brutto = str_replace(',', '.', $p[19]) / $quantity;
|
||||
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices_products VALUES('%s', '%s', '%s', null, '%f', '%f', '%f', '%f', '%f', '%s')",
|
||||
getId(), $productId, $invoiceId, $quantity, $netto, $brutto, $vat, $vatValue, $p[10]);
|
||||
$res = $db->query($query);
|
||||
if (!$res) {
|
||||
echo "Query error: ".$query.PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo 'Koniec. Smutne.';
|
||||
|
||||
function checkProduct($code)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecmproducts WHERE code='%s' OR amazon_code='%s' AND deleted=0", $code, $code));
|
||||
return $res->num_rows > 0 ? false : true;
|
||||
}
|
||||
function checkInvoice($number) {
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecommerce_invoices WHERE document_no = '%s'", $number));
|
||||
return $res->num_rows > 0;
|
||||
}
|
||||
function formatDate($date) {
|
||||
$dateTime = DateTime::createFromFormat('d-m-Y', $date);
|
||||
return $dateTime ? $dateTime->format('Y-m-d') : false;
|
||||
}
|
||||
function getId() {
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->fetchByAssoc($db->query("SELECT UUID() as id;"));
|
||||
return $res['id'];
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// read all csv files in directory
|
||||
$dir = getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/files/';
|
||||
$files = scandir($dir);
|
||||
$csvFiles = [];
|
||||
foreach ($files as $file) {
|
||||
if (strpos($file, '.csv') !== false && strpos($file, '2025') == false) {
|
||||
$csvFiles[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
// read files from csvFiles[] one by one
|
||||
$report = [];
|
||||
$sum = 0;
|
||||
foreach ($csvFiles as $file) {
|
||||
$filename = $dir . $file;
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
// && ($data[10] == 'FR00148_1000_amz_de' || $data[10] == 'FR00148')
|
||||
while (($data = fgetcsv($handle, 0, "\t")) !== false) {
|
||||
if ($data[1] == 'Przemieszczenie - WDT' && $data[8] == 'PL' && $data[9] == 'CZ' && ($data[10] == 'FR00148_1000_amz_de' || $data[10] == 'FR00148') ) {
|
||||
$sum += intval($data[11]);
|
||||
$report[] = $data;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
var_dump($sum);
|
||||
//var_dump($report);
|
||||
|
||||
die();
|
||||
$outputFilename = $dir . '../report.csv';
|
||||
$outputHandle = fopen($outputFilename, 'w');
|
||||
if ($outputHandle === false) {
|
||||
die('Cannot open file for writing: ' . $outputFilename);
|
||||
}
|
||||
|
||||
// Write header row if needed
|
||||
if (!empty($report)) {
|
||||
fputcsv($outputHandle, array_keys($report[0]), "\t");
|
||||
}
|
||||
|
||||
// Write data rows
|
||||
foreach ($report as $row) {
|
||||
fputcsv($outputHandle, $row, "\t");
|
||||
}
|
||||
|
||||
fclose($outputHandle);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
$invoices = getInvoices('2024');
|
||||
|
||||
$products = array();
|
||||
foreach ($invoices as $invoice) {
|
||||
foreach ($invoice['products'] as $product) {
|
||||
$products[] = $product['ecmproduct_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$states = getStockStates($products);
|
||||
$canProceed = [];
|
||||
$cantProceed = [];
|
||||
$missingProducts = [];
|
||||
$msg = [];
|
||||
foreach ($invoices as $invoice) {
|
||||
if ($DEBUG) {
|
||||
$msg[] = "Sprawdzam fakture: " . $invoice['document_no'] . "<br>";
|
||||
}
|
||||
$proceed = true; // hope :)
|
||||
foreach ($invoice['products'] as $product) {
|
||||
if ($DEBUG) {
|
||||
$msg[] = " Sprawdzam produkt: " . $product['code'] . " (Ilość: " . $product['quantity'] . ")<br>";
|
||||
$msg[] = "  Stan magazynowy: " . $states[$product['ecmproduct_id']] . "<br>";
|
||||
}
|
||||
if ($states[$product['ecmproduct_id']] < $product['quantity']) {
|
||||
if ($DEBUG) {
|
||||
$msg[] = "  <b>Nie ma wystarczającej ilości produktu w magazynie</b><br>";
|
||||
}
|
||||
if (!isset($missingProducts[$product['code']])) {
|
||||
$missingProducts[$product['code']] = array();
|
||||
$missingProducts[$product['code']]['id'] = $product['ecmproduct_id'];
|
||||
$missingProducts[$product['code']]['code'] = $product['code'];
|
||||
$missingProducts[$product['code']]['missing'] = $product['quantity'] - $states[$product['ecmproduct_id']];
|
||||
} else {
|
||||
$missingProducts[$product['code']]['missing'] += $product['quantity'] - $states[$product['ecmproduct_id']];
|
||||
}
|
||||
$proceed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($proceed) {
|
||||
$canProceed[] = $invoice;
|
||||
foreach ($invoice['products'] as $product) {
|
||||
$states[$product['ecmproduct_id']] -= $product['quantity'];
|
||||
}
|
||||
} else {
|
||||
$cantProceed[] = $invoice;
|
||||
}
|
||||
}
|
||||
|
||||
// create list of invoice ids from canProceed
|
||||
$invoiceIds = array();
|
||||
foreach ($canProceed as $invoice) {
|
||||
$invoiceIds[] = $invoice['id'];
|
||||
}
|
||||
|
||||
$sessionId = create_guid();
|
||||
$_SESSION[$sessionId] = $invoiceIds;
|
||||
|
||||
if (count($cantProceed) == 0) {
|
||||
echo '<input title="Wystaw WZ" class="button primary" type="button" name="Edit" id="edit_button" value="Wystaw WZ"
|
||||
onclick="window.open(\'index.php?module=EcmStockDocOuts&action=EditView&ecommerceWZ=' . $sessionId . '\')">';
|
||||
} else {
|
||||
var_dump($cantProceed);
|
||||
}
|
||||
die();
|
||||
|
||||
function getInvoices($date)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$invoices = array();
|
||||
// fomat date from d.m.y to mysql format
|
||||
$query = "SELECT ip.ecmproduct_id, ip.code, i.document_no, SUM(ip.quantity) AS quantity, i.register_date, i.id
|
||||
FROM ecommerce_invoices_products AS ip
|
||||
INNER JOIN ecommerce_invoices AS i ON ip.invoice_id = i.id AND i.register_date LIKE '$date%' AND i.type='normal'
|
||||
AND i.origin IN ('amazon vat local')
|
||||
WHERE ip.ecmproduct_id != '' AND ip.ecmproduct_id !='165f364e-9301-25ac-5906-58e38f1de4ca'
|
||||
AND i.ecmstockdocout_id IS NULL
|
||||
GROUP BY i.id, ip.ecmproduct_id
|
||||
ORDER BY i.register_date;";
|
||||
$res = $db->query($query);
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
if (!isset($invoices[$row['document_no']])) {
|
||||
$invoices[$row['document_no']] = array();
|
||||
$invoices[$row['document_no']]['document_no'] = $row['document_no'];
|
||||
$invoices[$row['document_no']]['register_date'] = $row['register_date'];
|
||||
$invoices[$row['document_no']]['id'] = $row['id'];
|
||||
$invoices[$row['document_no']]['products'] = array();
|
||||
$invoices[$row['document_no']]['products'][] = array(
|
||||
'ecmproduct_id' => $row['ecmproduct_id'],
|
||||
'code' => $row['code'],
|
||||
'quantity' => $row['quantity'],
|
||||
);
|
||||
} else {
|
||||
$invoices[$row['document_no']]['products'][] = array(
|
||||
'ecmproduct_id' => $row['ecmproduct_id'],
|
||||
'code' => $row['code'],
|
||||
'quantity' => $row['quantity'],
|
||||
);
|
||||
}
|
||||
}
|
||||
$invoices = array_values($invoices);
|
||||
usort($invoices, function ($a, $b) {
|
||||
return $a['id'] - $b['id'];
|
||||
});
|
||||
return $invoices;
|
||||
}
|
||||
|
||||
function getStockStates($products)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT s.product_id, s.quantity FROM ecmstockstates AS s WHERE s.stock_id = 'add8ef6f-3d1f-5ccf-c486-64719142f096' AND s.product_id IN ('" . implode('\',\'', $products) . "')";
|
||||
$res = $db->query($query);
|
||||
$stockStates = array();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$stockStates[$row['product_id']] = isset($row['quantity']) ? intval($row['quantity']) : 0;
|
||||
}
|
||||
return $stockStates;
|
||||
}
|
||||
|
||||
function getProductsForWZ($invoiceIds)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT ip.ecmproduct_id, SUM(ip.quantity) AS quantity, ip.price_netto
|
||||
FROM ecommerce_invoices_products AS ip
|
||||
WHERE invoice_id IN ('" . implode('\',\'', $invoiceIds) . "')
|
||||
AND ip.ecmproduct_id NOT IN ('', '165f364e-9301-25ac-5906-58e38f1de4ca')
|
||||
GROUP BY ip.ecmproduct_id, ip.price_netto;";
|
||||
$res = $db->query($query);
|
||||
$products = array();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$products[] = array(
|
||||
'ecmproduct_id' => $row['ecmproduct_id'],
|
||||
'quantity' => $row['quantity'],
|
||||
'price_netto' => $row['price_netto'],
|
||||
);
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
// show all php errors
|
||||
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';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
$de = [];
|
||||
$cz = [];
|
||||
while (($data = fgetcsv($handle, 0, "\t")) !== false) {
|
||||
if (count($data) == 1 && $data[0] == null) {
|
||||
continue;
|
||||
}
|
||||
if ($data[1] != 'Przemieszczenie - WDT') {
|
||||
continue;
|
||||
}
|
||||
if ($data[8] == 'PL' && $data[9] == 'DE') {
|
||||
$de[] = $data;
|
||||
}
|
||||
if ($data[8] == 'PL' && $data[9] == 'CZ') {
|
||||
$cz[] = $data;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
//if (count($de) == 0) {
|
||||
// die('No data for DE');
|
||||
//}
|
||||
//createInvoice('DE', $de);
|
||||
|
||||
if (count($cz) == 0) {
|
||||
die('No data for CZ');
|
||||
}
|
||||
createInvoice('CZ', $cz, true);
|
||||
|
||||
function createInvoice($type, $products, $DO_REAL_SAVE = false)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$invoice = new EcmInvoiceOut();
|
||||
if ($type == 'DE') {
|
||||
$invoice->parent_id = 'a711623a-0217-41bd-ecf6-664c84553473';
|
||||
$invoice->parent_name = 'Twinpol DE';
|
||||
$invoice->parent_nip = '367123377';
|
||||
}
|
||||
if ($type == 'CZ') {
|
||||
$invoice->parent_id = 'bf60a128-0b62-4154-c21f-6797718a6354';
|
||||
$invoice->parent_name = 'Twinpol CZ';
|
||||
$invoice->parent_nip = 'CZ687253791';
|
||||
}
|
||||
$invoice->parent_address_street = 'Aleja Lipowa 48';
|
||||
$invoice->parent_address_postalcode = '87-126';
|
||||
$invoice->parent_address_city = 'Obrowo';
|
||||
|
||||
$invoice->type = 'normal';
|
||||
$date = '30.04.2025';
|
||||
$invoice->register_date = $date;
|
||||
$invoice->sell_date = $date;
|
||||
$invoice->validtill_date = $date;
|
||||
|
||||
$invoice->payment_date = $invoice->register_date;
|
||||
$invoice->payment_date_days = 0;
|
||||
$invoice->payment_method = '1568e47e-1732-e0ad-0000-67b6377f26df';
|
||||
|
||||
$invoice->pdf_type = "K";
|
||||
$invoice->currency_id = 'PLN';
|
||||
global $current_user;
|
||||
$invoice->created_by = $current_user->id;
|
||||
$invoice->assigned_user_id = $current_user->id;
|
||||
|
||||
$invoice->wz_id = '';
|
||||
$invoice->wz_name = '';
|
||||
|
||||
$invoice->position_list = [];
|
||||
|
||||
foreach ($products as $p) {
|
||||
// if last character is dot, remove it
|
||||
if (substr($p[10], -1) == '.') {
|
||||
$p[10] = substr($p[10], 0, -1);
|
||||
}
|
||||
|
||||
$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) {
|
||||
var_dump($p);
|
||||
die('Product not found in DB');
|
||||
}
|
||||
$prod = searchProduct($fromDb['id'], $invoice->position_list);
|
||||
if ($prod) {
|
||||
$prod['quantity'] += intval($p[11]);
|
||||
$prod['total_netto'] += floatval(str_replace(",", ".", $p[17]));
|
||||
$prod['total_brutto'] += floatval(str_replace(",", ".", $p[17]));
|
||||
|
||||
$prod['price_start'] = round($prod['total_netto'] / $prod['quantity'], 2);
|
||||
$prod['price_netto'] = $prod['price_start'];
|
||||
$prod['price_brutto'] = $prod['price_netto'];
|
||||
|
||||
foreach ($invoice->position_list as $key => $value) {
|
||||
if ($value['product_id'] == $prod['product_id']) {
|
||||
$invoice->position_list[$key] = $prod;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$prod['product_id'] = $fromDb['id'];
|
||||
$prod['name'] = $fromDb['name'];
|
||||
$prod['product_code'] = $fromDb['code'];
|
||||
$prod['quantity'] = intval($p[11]);
|
||||
$prod['total_netto'] = floatval(str_replace(",", ".", $p[17]));
|
||||
$prod['total_brutto'] = floatval(str_replace(",", ".", $p[17]));
|
||||
$prod['total_vat'] = 0;
|
||||
|
||||
$prod['price_start'] = round($prod['total_netto'] / $prod['quantity'], 2);
|
||||
$prod['price_netto'] = $prod['price_start'];
|
||||
$prod['price_brutto'] = $prod['price_netto'];
|
||||
|
||||
$prod['ecmvat_id'] = '9b783d21-5548-6653-e1d6-49610eb3f9dd';
|
||||
$prod['ecmvat_name'] = '0%';
|
||||
$prod['ecmvat_value'] = 0;
|
||||
|
||||
$prod['ecmproductcategory_id'] = $fromDb['product_category_id'];
|
||||
|
||||
$prod['dd_unit_id'] = $fromDb['unit_id'];
|
||||
global $app_list_strings;
|
||||
$prod['dd_unit_name'] = $app_list_strings['ecmproducts_unit_dom'][$fromDb['unit_id']];
|
||||
|
||||
$invoice->position_list[] = $prod;
|
||||
}
|
||||
}
|
||||
if ($DO_REAL_SAVE) {
|
||||
$id = $invoice->save();
|
||||
echo $id;
|
||||
} else {
|
||||
var_dump($invoice->position_list);
|
||||
}
|
||||
}
|
||||
|
||||
function searchProduct($productId, $products)
|
||||
{
|
||||
foreach ($products as $p) {
|
||||
if ($p['product_id'] == $productId) {
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
// show all php errors
|
||||
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/01-2025.csv';
|
||||
$handle = fopen($filename, 'r');
|
||||
if ($handle === false) {
|
||||
die('Cannot open file: ' . $filename);
|
||||
}
|
||||
|
||||
$de = [];
|
||||
$cz = [];
|
||||
while (($data = fgetcsv($handle, 0, "\t")) !== false) {
|
||||
if (count($data) == 1 && $data[0] == null) {
|
||||
continue;
|
||||
}
|
||||
if ($data[1] != 'Przemieszczenie - WNT') {
|
||||
continue;
|
||||
}
|
||||
if ($data[8] == 'DE' && $data[9] == 'PL') {
|
||||
$de[] = $data;
|
||||
}
|
||||
if ($data[8] == 'CZ' && $data[9] == 'PL') {
|
||||
$cz[] = $data;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
/*
|
||||
if (count($de) == 0) {
|
||||
var_dump('No data for DE');
|
||||
} else {
|
||||
createFVKOR('DE', $de);
|
||||
}
|
||||
|
||||
if (count($cz) == 0) {
|
||||
var_dump('No data for CZ');
|
||||
} else {
|
||||
createFVKOR('CZ', $cz);
|
||||
}
|
||||
|
||||
*/
|
||||
//var_dump($cz);
|
||||
createFVKOR('DE', $de);
|
||||
|
||||
die();
|
||||
|
||||
|
||||
function createFVKOR($type, $products, $DO_REAL_SAVE = false)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$invoice = new EcmInvoiceOut();
|
||||
if ($type == 'DE') {
|
||||
$invoice->parent_id = 'a711623a-0217-41bd-ecf6-664c84553473';
|
||||
$invoice->parent_name = 'Twinpol DE';
|
||||
$invoice->parent_nip = '367123377';
|
||||
}
|
||||
if ($type == 'CZ') {
|
||||
$invoice->parent_id = 'bf60a128-0b62-4154-c21f-6797718a6354';
|
||||
$invoice->parent_name = 'Twinpol CZ';
|
||||
$invoice->parent_nip = 'CZ687253791';
|
||||
}
|
||||
$invoice->parent_address_street = 'Aleja Lipowa 48';
|
||||
$invoice->parent_address_postalcode = '87-126';
|
||||
$invoice->parent_address_city = 'Obrowo';
|
||||
|
||||
$invoice->type = 'correct';
|
||||
$date = '31.01.2025';
|
||||
$invoice->register_date = $date;
|
||||
$invoice->sell_date = $date;
|
||||
$invoice->validtill_date = $date;
|
||||
|
||||
$invoice->payment_date = $invoice->register_date;
|
||||
$invoice->payment_date_days = 0;
|
||||
$invoice->payment_method = '1568e47e-1732-e0ad-0000-67b6377f26df';
|
||||
|
||||
$invoice->pdf_type = "K";
|
||||
$invoice->currency_id = 'PLN';
|
||||
global $current_user;
|
||||
$invoice->created_by = $current_user->id;
|
||||
$invoice->assigned_user_id = $current_user->id;
|
||||
|
||||
$invoice->wz_id = '';
|
||||
$invoice->wz_name = '';
|
||||
|
||||
$invoice->position_list = groupProductsAndFindFV($products, $invoice->parent_id, $date);
|
||||
|
||||
$invoiceId = $invoice->position_list[0]['old_ecminvoiceout_id'];
|
||||
foreach ($invoice->position_list as $p) {
|
||||
if ($p['old_ecminvoiceout_id'] != $invoiceId) {
|
||||
die('Different ecminvoiceout_id in position_list');
|
||||
}
|
||||
}
|
||||
|
||||
$invoice->id = $invoice->position_list[0]['old_ecminvoiceout_id'];
|
||||
|
||||
var_dump($invoice->position_list);
|
||||
|
||||
if ($DO_REAL_SAVE) {
|
||||
$id = $invoice->save();
|
||||
echo $id;
|
||||
}
|
||||
}
|
||||
|
||||
function groupProductsAndFindFV($products, $client, $date)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$position_list = [];
|
||||
|
||||
foreach ($products as $p) {
|
||||
// if last character is dot, remove it
|
||||
if (substr($p[10], -1) == '.') {
|
||||
$p[10] = substr($p[10], 0, -1);
|
||||
}
|
||||
$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) {
|
||||
var_dump($p);
|
||||
continue;
|
||||
}
|
||||
|
||||
$prod = searchProduct($fromDb['id'], $position_list);
|
||||
|
||||
if ($prod) {
|
||||
$prod['quantity'] += intval($p[11]);
|
||||
$prod['total_netto'] += floatval(str_replace(",", ".", $p[17]));
|
||||
|
||||
foreach ($position_list as $key => $value) {
|
||||
if ($value['product_id'] == $prod['product_id']) {
|
||||
$position_list[$key] = $prod;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$prod['product_id'] = $fromDb['id'];
|
||||
$prod['name'] = $fromDb['name'];
|
||||
$prod['product_code'] = $fromDb['code'];
|
||||
$prod['quantity'] = intval($p[11]);
|
||||
$prod['total_netto'] = floatval(str_replace(",", ".", $p[17]));
|
||||
|
||||
$prod['total_vat'] = 0;
|
||||
$prod['ecmvat_id'] = '9b783d21-5548-6653-e1d6-49610eb3f9dd';
|
||||
$prod['ecmvat_name'] = '0%';
|
||||
$prod['ecmvat_value'] = 0;
|
||||
|
||||
$prod['ecmproductcategory_id'] = $fromDb['product_category_id'];
|
||||
|
||||
$prod['dd_unit_id'] = $fromDb['unit_id'];
|
||||
global $app_list_strings;
|
||||
$prod['dd_unit_name'] = $app_list_strings['ecmproducts_unit_dom'][$fromDb['unit_id']];
|
||||
|
||||
$position_list[] = $prod;
|
||||
}
|
||||
}
|
||||
// find FV
|
||||
$date = explode(".", $date);
|
||||
$date = $date[2] . '-' . $date[1] . '-' . $date[0];
|
||||
$final_list = [];
|
||||
var_dump($position_list);
|
||||
foreach ($position_list as $prod) {
|
||||
$qty = $prod['quantity'];
|
||||
$prodId = $prod['product_id'];
|
||||
$query = "
|
||||
SELECT ii.*, i.id AS invoiceId
|
||||
FROM ecminvoiceoutitems AS ii
|
||||
INNER JOIN ecminvoiceouts AS i
|
||||
ON i.id = ii.ecminvoiceout_id
|
||||
WHERE ii.quantity >= $qty AND ii.ecmproduct_id = '$prodId'
|
||||
AND i.type = 'normal' AND i.parent_id = '$client' AND i.register_date < '$date'
|
||||
ORDER BY i.register_date DESC LIMIT 0,1
|
||||
";
|
||||
$fromFV = $db->fetchByAssoc($db->query($query));
|
||||
if ($fromFV == null) {
|
||||
die('Nie znaleziono produktu'. $query);
|
||||
}
|
||||
$prod['product_itemold_id'] = $fromFV['id'];
|
||||
$prod['old_total_netto'] = floatval($fromFV['total_netto']);
|
||||
$prod['old_total_vat'] = floatval($fromFV['total_vat']);
|
||||
$prod['old_total_brutto'] = floatval($fromFV['total_brutto']);
|
||||
$prod['old_quantity'] = floatval($fromFV['quantity']);
|
||||
|
||||
$prod['total_netto'] = $prod['old_total_netto'] - $prod['total_netto'];
|
||||
$prod['quantity'] = $prod['old_quantity'] - $prod['quantity'];
|
||||
|
||||
$prod['price_netto'] = $prod['total_netto'] / $prod['quantity'];
|
||||
$prod['price_brutto'] = $prod['price_netto'];
|
||||
$prod['price_start'] = $prod['price_netto'];
|
||||
|
||||
$prod['total_netto'] = $prod['quantity'] * $prod['price_netto'];
|
||||
$prod['total_brutto'] = $prod['total_netto'];
|
||||
|
||||
$prod['old_ecminvoiceout_id'] = $fromFV['invoiceId'];
|
||||
$final_list[] = $prod;
|
||||
$fromFV['old_ecminvoiceout_id'] = $fromFV['invoiceId'];
|
||||
$fromFV['product_corrected'] = 'true';
|
||||
$final_list[] = $fromFV;
|
||||
}
|
||||
return $final_list;
|
||||
}
|
||||
|
||||
function searchProduct($productId, $products)
|
||||
{
|
||||
foreach ($products as $p) {
|
||||
if ($p['product_id'] == $productId) {
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
$db = $GLOBALS['db'];
|
||||
global $app_list_strings;
|
||||
|
||||
if (!isset($_GET['source'])) {
|
||||
$_GET['source'] = '';
|
||||
}
|
||||
if (!isset($_GET['date'])) {
|
||||
$_GET['date'] = date('Y-m', strtotime('-1 month'));
|
||||
}
|
||||
|
||||
if (!isset($_GET['type'])) {
|
||||
$_GET['type'] = '';
|
||||
}
|
||||
|
||||
if (isset($_GET['ajax'])) {
|
||||
switch ($_GET['ajax']) {
|
||||
case 'exportToRewizor':
|
||||
exportToRewizor($_GET['source'], $_GET['date'], $_GET['type']);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
show();
|
||||
}
|
||||
function show()
|
||||
{
|
||||
$smarty = new Sugar_Smarty();
|
||||
$inv = getInvoices($_GET['source'], $_GET['date'], $_GET['type']);
|
||||
$total_netto = 0;
|
||||
$total_brutto = 0;
|
||||
$total_vat = 0;
|
||||
foreach ($inv as $invoice) {
|
||||
$total_netto += $invoice['total_netto'];
|
||||
$total_brutto += $invoice['total_brutto'];
|
||||
$total_vat += $invoice['total_vat'];
|
||||
}
|
||||
// format totals with 2 decimals
|
||||
$total_netto = number_format($total_netto, 2, '.', '');
|
||||
$total_brutto = number_format($total_brutto, 2, '.', '');
|
||||
$total_vat = number_format($total_vat, 2, '.', '');
|
||||
$smarty->assign("data", $inv);
|
||||
$smarty->assign("totalNetto", $total_netto);
|
||||
$smarty->assign("totalBrutto", $total_brutto);
|
||||
$smarty->assign("totalVat", $total_vat);
|
||||
$smarty->assign("sources", getSources());
|
||||
$smarty->assign("source", $_GET['source']);
|
||||
$smarty->assign("dates", getDates());
|
||||
$smarty->assign("date", $_GET['date']);
|
||||
$smarty->assign("type", $_GET['type']);
|
||||
echo $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/ecommerceInvoicesListView.tpl');
|
||||
}
|
||||
|
||||
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 .= " ORDER BY i.register_date";
|
||||
$result = $db->query($query);
|
||||
$invoices = array();
|
||||
while ($row = $db->fetchByAssoc($result)) {
|
||||
// format date in row register_date from mysql format into d.m.Y
|
||||
$row['register_date'] = date('d.m.Y', strtotime($row['register_date']));
|
||||
$row['sell_date'] = date('d.m.Y', strtotime($row['sell_date']));
|
||||
$row['products'] = getInvoicProducts($row['id']);
|
||||
$invoices[] = $row;
|
||||
}
|
||||
return $invoices;
|
||||
}
|
||||
function getInvoicProducts($invoiceId) {
|
||||
$db = $GLOBALS['db'];
|
||||
$query = sprintf("SELECT p.id, p.code, p.name, ip.price_netto, ip.price_brutto, ip.quantity, ip.code as ecommerce_code, ip.vat_value FROM ecommerce_invoices_products as ip INNER JOIN ecmproducts AS p ON ip.ecmproduct_id = p.id WHERE ip.invoice_id='%s'", $invoiceId);
|
||||
$result = $db->query($query);
|
||||
$products = array();
|
||||
while ($row = $db->fetchByAssoc($result)) {
|
||||
$row['vat_value'] =str_replace(".00","",$row['vat_value']);
|
||||
$products[] = $row;
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
function getDates()
|
||||
{
|
||||
$dates = array();
|
||||
$date = new DateTime();
|
||||
$dates[] = $date->format('Y-m');
|
||||
while ($date->format('Y-m') != '2024-01') {
|
||||
$date->modify('-1 month');
|
||||
$dates[] = $date->format('Y-m');
|
||||
}
|
||||
return $dates;
|
||||
}
|
||||
function getSources() {
|
||||
$db = $GLOBALS['db'];
|
||||
$sources = array();
|
||||
$res = $db->query("SELECT DISTINCT origin FROM ecommerce_invoices");
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
$sources[]= $row['origin'];
|
||||
}
|
||||
return $sources;
|
||||
}
|
||||
|
||||
function exportToRewizor($source, $date, $type)
|
||||
{
|
||||
$smarty = new Sugar_Smarty();
|
||||
$invoices = getInvoices($source, $date, $type);
|
||||
foreach ($invoices as &$i) {
|
||||
$i['register_date'] = date("Ymd000000",strtotime($i['register_date']));
|
||||
$i['sell_date'] = date("Ymd000000",strtotime($i['sell_date']));
|
||||
// create 20 characters length hash from parent_name
|
||||
$i['parent_hash'] = substr(md5($i['parent_name']), 0, 20);
|
||||
$i['parent_short_name'] = substr($i['parent_name'], 0, 40);
|
||||
if ($type == 'correcting') {
|
||||
$db = $GLOBALS['db'];
|
||||
$fv = $db->fetchByAssoc($db->query(sprintf("SELECT document_no, register_date FROM ecommerce_invoices WHERE id='%s'", $i['corrected_invoice_id'])));
|
||||
$i['corrected_document_no'] = $fv['document_no'];
|
||||
$i['corrected_register_date'] = date("Ymd000000",strtotime(date('d.m.Y', strtotime($fv['register_date']))));
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("data", $invoices);
|
||||
if ($type == 'normal') {
|
||||
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor.tpl');
|
||||
} else {
|
||||
$result = $smarty->display(getcwd() . '/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/rewizor_fvkor.tpl');
|
||||
}
|
||||
// encode result as ansi
|
||||
echo $result;
|
||||
//echo mb_convert_encoding($result, 'ANSI', 'UTF-8');
|
||||
}
|
||||
|
||||
function brecho($var)
|
||||
{
|
||||
echo '<pre>';
|
||||
print_r($var);
|
||||
echo '</pre>';
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
brecho("Import Amazon");
|
||||
$filePath = "modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonXML/9_2024.csv";
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
echo "Error: File not found";
|
||||
exit();
|
||||
}
|
||||
$file = fopen($filePath, 'r');
|
||||
if (!$file) {
|
||||
echo "Error: Unable to open file";
|
||||
exit();
|
||||
}
|
||||
|
||||
$invoices = array();
|
||||
|
||||
$lineNumber = -1;
|
||||
while (($d = fgetcsv($file)) !== false) {
|
||||
$lineNumber++;
|
||||
if ($lineNumber == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$documentNo = $d[51];
|
||||
|
||||
$isReturn = false;
|
||||
if ($d[3] == 'RETURN') {
|
||||
$isReturn = true;
|
||||
//brecho("Korekta!");
|
||||
//brecho($d);
|
||||
continue;
|
||||
} else if ($d[4] != 'FALSE' || $d[3] != 'SHIPMENT' || $documentNo == 'N/A') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($invoices[$documentNo])) {
|
||||
$invoices[$documentNo] = array();
|
||||
}
|
||||
$invoices[$documentNo]['items'][] = $d;
|
||||
$invoices[$documentNo]['document_no'] = $documentNo;
|
||||
$invoices[$documentNo]['id'] = $d[8];
|
||||
$invoices[$documentNo]['order_no'] = $d[5];
|
||||
$invoices[$documentNo]['register_date'] = new DateTime($d[6]);
|
||||
$invoices[$documentNo]['sell_date'] = new DateTime($d[2]);
|
||||
$invoices[$documentNo]['parent_nip'] = $d[43];
|
||||
$invoices[$documentNo]['total_brutto'] = array_sum(array_column($invoices[$documentNo]['items'], 23));
|
||||
$invoices[$documentNo]['total_netto'] = array_sum(array_column($invoices[$documentNo]['items'], 25));
|
||||
$invoices[$documentNo]['total_vat'] = array_sum(array_column($invoices[$documentNo]['items'], 24));
|
||||
$invoices[$documentNo]['currency'] = $d[15];
|
||||
$invoices[$documentNo]['parent_address_city'] = str_replace("'", "",$d[59]);
|
||||
$invoices[$documentNo]['parent_address_postalcode'] = str_replace("'", "",$d[62]);
|
||||
$invoices[$documentNo]['parent_address_country'] = str_replace("'", "",$d[61]);
|
||||
$invoices[$documentNo]['url'] = $d[52];
|
||||
}
|
||||
fclose($file);
|
||||
|
||||
brecho("Ilość faktur: ".count($invoices));
|
||||
|
||||
foreach ($invoices as $documentNo => $invoice) {
|
||||
$add = true;
|
||||
foreach ($invoice['items'] as $item) {
|
||||
if (!checkProduct($item[10])) {
|
||||
brecho("Brak produktu: " . $item[10]);
|
||||
$add = false;
|
||||
}
|
||||
}
|
||||
if ($add && !checkInvoice($invoice['id'])) {
|
||||
addInvoice($invoice);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
brecho("Koniec. Smutne.");
|
||||
|
||||
function addInvoice($i) {
|
||||
brecho($i['document_no']);
|
||||
$db = $GLOBALS['db'];
|
||||
$db->query("SET NAMES utf8mb4");
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices VALUES ('%d', '%s', '%s', '%s', '%s', 'amazon', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%f', '%s');",
|
||||
$i['id'], $i['document_no'], 'normal', $i['register_date']->format("Y-m-d"), $i['sell_date']->format("Y-m-d"),
|
||||
$i['order_no'], 'AmazonCustomer', $i['parent_nip'], $i['parent_address_city'], $i['parent_address_postalcode'], '',
|
||||
'', $i['parent_address_country'], $i['currency'], $i['total_netto'], $i['total_brutto'], $i['total_vat'], $i['url']);
|
||||
$db->query($query);
|
||||
brecho($query);
|
||||
foreach ($i['items'] as $p) {
|
||||
addProduct($i['id'], $p);
|
||||
}
|
||||
}
|
||||
|
||||
function addProduct($invoiceId, $p) {
|
||||
$db = $GLOBALS['db'];
|
||||
$id = $db->fetchByAssoc($db->query(sprintf("SELECT id FROM ecmproducts WHERE code ='%s' OR amazon_code = '%s'", $p[10], $p[10])))['id'];
|
||||
|
||||
$uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0x0fff) | 0x4000,
|
||||
mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
|
||||
$query = sprintf("INSERT INTO ecommerce_invoices_products VALUES('%s', '%s', '%s', '%d', '%f', '%f', '%f', '%f', '%s')",
|
||||
$uuid, $id, $invoiceId, $p[11], $p[25], $p[23], $p[24], $p[13]*100, $p[10]);
|
||||
$db->query($query);
|
||||
}
|
||||
function checkProduct($code)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecmproducts WHERE code='%s' OR amazon_code='%s' AND deleted=0", $code, $code));
|
||||
return $res->num_rows > 0;
|
||||
}
|
||||
function checkInvoice($id) {
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query(sprintf("SELECT id FROM ecommerce_invoices WHERE id = '%s'", $id));
|
||||
return $res->num_rows > 0;
|
||||
}
|
||||
function brecho($msg)
|
||||
{
|
||||
echo "<br><br>";
|
||||
var_dump($msg);
|
||||
echo "<br><br>";
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
// serie faktur baselinker
|
||||
// FV Polska (stare) - 15356
|
||||
// FV Polska - 7688
|
||||
// FV Niemcy - 15357
|
||||
// FVKOR Polska - 17314
|
||||
// FVKOR domyślna - 7689
|
||||
|
||||
|
||||
/*
|
||||
DELETE p
|
||||
FROM ecommerce_invoices_products p
|
||||
LEFT JOIN ecommerce_invoices i ON p.invoice_id = i.id
|
||||
WHERE i.id IS NULL;
|
||||
*/
|
||||
function importFV($seriesId)
|
||||
{
|
||||
$baselinker_config = loadConfiguration();
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$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");
|
||||
$lastImportId = $db->fetchByAssoc($dbRes)['id'];
|
||||
if ($lastImportId == null) {
|
||||
$lastImportId = $IMPORT_START_ID;
|
||||
} else {
|
||||
$lastImportId++; //get next
|
||||
}
|
||||
|
||||
$invoicesRes = loadInvoices($baselinker_config['token'], $lastImportId, $seriesId);
|
||||
$invoices = $invoicesRes->invoices;
|
||||
|
||||
usort($invoices, function ($a, $b) {
|
||||
return $a->date_add - $b->date_add;
|
||||
});
|
||||
|
||||
if (count($invoices) > 0) {
|
||||
foreach ($invoices as $invoice) {
|
||||
$invoice->order_source = getInvoiceSource($baselinker_config['token'], $invoice->order_id);
|
||||
$invoice->total_price_vat = $invoice->total_price_brutto - $invoice->total_price_netto;
|
||||
$invoice->series_id = $seriesId;
|
||||
addInvoice($invoice);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function importFVKOR($seriesId)
|
||||
{
|
||||
$baselinker_config = loadConfiguration();
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$IMPORT_CORRECTION_START_ID = 2106464;
|
||||
|
||||
$dbRes = $db->query("SELECT id FROM ecommerce_invoices WHERE origin = 'Allegro' AND type = 'correcting' AND series_id = '$seriesId' ORDER BY id DESC LIMIT 1");
|
||||
$lastImportId = $db->fetchByAssoc($dbRes)['id'];
|
||||
if ($lastImportId == null) {
|
||||
$lastImportId = $IMPORT_CORRECTION_START_ID;
|
||||
} else {
|
||||
$lastImportId++; //get next
|
||||
}
|
||||
|
||||
$invoicesRes = loadInvoices($baselinker_config['token'], $lastImportId, $seriesId);
|
||||
|
||||
$invoices = $invoicesRes->invoices;
|
||||
|
||||
usort($invoices, function ($a, $b) {
|
||||
return $a->date_add - $b->date_add;
|
||||
});
|
||||
|
||||
if (count($invoices) > 0) {
|
||||
foreach ($invoices as $invoice) {
|
||||
$invoice->order_source = getInvoiceSource($baselinker_config['token'], $invoice->correcting_to_invoice_id);
|
||||
$total = getCorrectTotals($invoice);
|
||||
$invoice->series_id = $seriesId;
|
||||
$invoice->total_price_netto = $total['netto'];
|
||||
$invoice->total_price_brutto = $total['brutto'];
|
||||
$invoice->total_price_vat = $total['vat'];
|
||||
$invoice->order_source = $total['order_source'];
|
||||
addInvoice($invoice);
|
||||
}
|
||||
}
|
||||
}
|
||||
function addInvoice($i)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$name = strlen($i->invoice_nip) > 0 ?
|
||||
$i->invoice_company :
|
||||
$i->invoice_fullname;
|
||||
$db->query("SET NAMES utf8mb4");
|
||||
$query = sprintf(
|
||||
"INSERT INTO ecommerce_invoices VALUES ('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f', '%f', '%s', '%s', null, null, '%s');",
|
||||
$i->invoice_id,
|
||||
$i->number,
|
||||
$i->type,
|
||||
date("Y-m-d", $i->date_add),
|
||||
date("Y-m-d", $i->date_sell),
|
||||
$i->order_source,
|
||||
$i->order_id,
|
||||
$name,
|
||||
$i->invoice_nip,
|
||||
$i->invoice_city,
|
||||
$i->invoice_postcode,
|
||||
$i->invoice_address,
|
||||
$i->invoice_country,
|
||||
$i->invoice_country_code,
|
||||
$i->currency,
|
||||
$i->total_price_netto,
|
||||
$i->total_price_brutto,
|
||||
$i->total_price_vat,
|
||||
'',
|
||||
$i->correcting_to_invoice_id,
|
||||
$i->series_id
|
||||
);
|
||||
$db->query($query);
|
||||
|
||||
|
||||
if ($db->last_error) {
|
||||
return;
|
||||
}
|
||||
// delete products for this invoice if exists
|
||||
$db->query(sprintf("DELETE FROM ecommerce_invoices_products WHERE invoice_id='%s'", $i->invoice_id));
|
||||
foreach ($i->items as $p) {
|
||||
addProduct($i->invoice_id, $p);
|
||||
}
|
||||
}
|
||||
function addProduct($invoiceId, $p)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$id = $p->is_shipment == 1 ? '165f364e-9301-25ac-5906-58e38f1de4ca' : $db->fetchByAssoc($db->query(sprintf("SELECT id FROM ecmproducts WHERE code ='%s'", $p->sku)))['id'];
|
||||
// generate random uuid v4
|
||||
$uuid = sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0x0fff) | 0x4000,
|
||||
mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff)
|
||||
);
|
||||
$query = sprintf(
|
||||
"INSERT INTO ecommerce_invoices_products VALUES('%s', '%s', '%s', '%s', '%d', '%f', '%f', '%f', '%f', '%s')",
|
||||
$uuid,
|
||||
$id,
|
||||
$invoiceId,
|
||||
$p->order_product_id,
|
||||
$p->quantity,
|
||||
$p->price_netto,
|
||||
$p->price_brutto,
|
||||
$p->price_brutto - $p->price_netto,
|
||||
$p->tax_rate,
|
||||
$p->sku
|
||||
);
|
||||
$db->query($query);
|
||||
}
|
||||
function loadConfiguration()
|
||||
{
|
||||
global $db;
|
||||
$dbRes = $db->query("SELECT * FROM config WHERE category='baselinker'");
|
||||
$config = [];
|
||||
while ($row = $db->fetchByAssoc($dbRes)) {
|
||||
$config[$row['name']] = $row['value'];
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
function loadInvoices($token, $lastImportId, $seriesId)
|
||||
{
|
||||
$methodParams = '{
|
||||
"id_from": ' . $lastImportId . ',
|
||||
"get_external_invoices": false,
|
||||
"series_id": ' . $seriesId . '
|
||||
}';
|
||||
$apiParams = [
|
||||
"method" => "getInvoices",
|
||||
"parameters" => $methodParams
|
||||
];
|
||||
|
||||
$curl = curl_init("https://api.baselinker.com/connector.php");
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, ["X-BLToken: " . $token]);
|
||||
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiParams));
|
||||
$response = json_decode(curl_exec($curl));
|
||||
return $response;
|
||||
}
|
||||
function getInvoiceSource($token, $orderId)
|
||||
{
|
||||
$methodParams = '{
|
||||
"order_id": ' . $orderId . '
|
||||
}';
|
||||
$apiParams = [
|
||||
"method" => "getOrders",
|
||||
"parameters" => $methodParams
|
||||
];
|
||||
|
||||
$curl = curl_init("https://api.baselinker.com/connector.php");
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, ["X-BLToken: " . $token]);
|
||||
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||
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;
|
||||
}
|
||||
function getCorrectTotals($invoice)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$i = $db->fetchByAssoc($db->query(sprintf("SELECT * FROM ecommerce_invoices WHERE id='%s'", $invoice->correcting_to_invoice_id)));
|
||||
if (!isset($i)) {
|
||||
die(); // w tym przypadku nie wszystkie FV są zaciągnięte. Trzeba przerwać skrypt i odpalić następnym razem
|
||||
}
|
||||
$c = $db->fetchByAssoc($db->query(sprintf("SELECT SUM(total_netto) as total_netto, SUM(total_brutto) as total_brutto FROM ecommerce_invoices WHERE corrected_invoice_id='%s'", $invoice->correcting_to_invoice_id)));
|
||||
$total_netto = $invoice->total_price_netto - (float) $i['total_netto'] - (float) $c['total_netto'];
|
||||
$total_brutto = $invoice->total_price_brutto - (float) $i['total_brutto'] - (float) $c['total_brutto'];
|
||||
$total_vat = $total_brutto - $total_netto;
|
||||
return array(
|
||||
'netto' => $total_netto,
|
||||
'brutto' => $total_brutto,
|
||||
'vat' => $total_vat,
|
||||
'order_source' => $i['origin']
|
||||
);
|
||||
}
|
||||
|
||||
function brecho($msg)
|
||||
{
|
||||
echo '<br><pre>';
|
||||
var_dump($msg);
|
||||
echo PHP_EOL;
|
||||
echo '</pre><br>';
|
||||
}
|
||||
117
modules/EcmInvoiceOuts/Dashlets/MyEcmOfferesDashlet/MyEcmOfferesDashlet.data.php
Executable file
117
modules/EcmInvoiceOuts/Dashlets/MyEcmOfferesDashlet/MyEcmOfferesDashlet.data.php
Executable file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $current_user;
|
||||
|
||||
$dashletData['MyEcmInvoiceOutsDashlet']['searchFields'] = array('name' => array('default' => ''),
|
||||
'date_entered' => array('default' => ''),
|
||||
'status' => array('default' => ''),
|
||||
'assigned_user_id' => array('type' => 'assigned_user_name',
|
||||
'default' => $current_user->name));
|
||||
$dashletData['MyEcmInvoiceOutsDashlet']['columns'] = array(
|
||||
'STATUS' => array(
|
||||
'width' => '1',
|
||||
'label' => ' ',
|
||||
'default' => true,
|
||||
),
|
||||
'DOCUMENT_NO' => array(
|
||||
'width' => '8',
|
||||
'label' => 'LBL_DOCUMENT_NO',
|
||||
'sortable' => true,
|
||||
'link' => true,
|
||||
'default' => true,
|
||||
),
|
||||
'NAME' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_NAME',
|
||||
'sortable' => true,
|
||||
'link' => false,
|
||||
//'customCode' => '<a href="index.php?module=EcmInvoiceOuts&action=EditView&record={$ID}">{$NAME}</a>',
|
||||
'default' => true,
|
||||
),
|
||||
'REGISTER_DATE'=>array(
|
||||
'width'=>15,
|
||||
'label'=>'LBL_REGISTER_DATE',
|
||||
'default'=>true,
|
||||
'sortable'=>true,
|
||||
),
|
||||
'PARENT_ID'=>array(
|
||||
'width'=>0,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
'sortable'=>false,
|
||||
),
|
||||
'PARENT_NAME' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_PARENT_NAME',
|
||||
'default' => true,
|
||||
'id'=>'PARENT_ID',
|
||||
'module'=>'Accounts',
|
||||
'link'=>true,
|
||||
),
|
||||
'TOTAL' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_TOTAL',
|
||||
'default' => true,
|
||||
'align' => 'left',
|
||||
),
|
||||
|
||||
'ASSIGNED_USER_NAME' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER',
|
||||
'default' => true
|
||||
),
|
||||
'OPTIONS' => array(
|
||||
'width' => '5',
|
||||
'label' => ' ',
|
||||
'link' => false,
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'align' => 'right',
|
||||
),
|
||||
|
||||
'date_entered' => array('width' => '15',
|
||||
'label' => 'LBL_DATE_ENTERED'),
|
||||
|
||||
|
||||
);
|
||||
|
||||
k
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['MyEcmInvoiceOutsDashlet'] = array('module' => 'EcmInvoiceOuts',
|
||||
'title' => translate('LBL_DASHLET_MY_ECMQUOTES', 'EcmInvoiceOuts'),
|
||||
'description' => 'A customizable view into Quotes',
|
||||
'category' => 'Module Views');
|
||||
?>
|
||||
61
modules/EcmInvoiceOuts/Dashlets/MyEcmOfferesDashlet/MyEcmOfferesDashlet.php
Executable file
61
modules/EcmInvoiceOuts/Dashlets/MyEcmOfferesDashlet/MyEcmOfferesDashlet.php
Executable file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGeneric.php');
|
||||
require_once('modules/EcmInvoiceOuts/EcmInvoiceOut.php');
|
||||
|
||||
class MyEcmInvoiceOutsDashlet extends DashletGeneric {
|
||||
function MyEcmInvoiceOutsDashlet($id, $def = null) {
|
||||
global $current_user, $app_strings;
|
||||
require('modules/EcmInvoiceOuts/Dashlets/MyEcmInvoiceOutsDashlet/MyEcmInvoiceOutsDashlet.data.php');
|
||||
|
||||
parent::DashletGeneric($id, $def);
|
||||
|
||||
if(empty($def['title'])) $this->title = translate('LBL_DASHLET_MY_ECMQUOTES', 'EcmInvoiceOuts');
|
||||
|
||||
$this->searchFields = $dashletData['MyEcmInvoiceOutsDashlet']['searchFields'];
|
||||
$this->columns = $dashletData['MyEcmInvoiceOutsDashlet']['columns'];
|
||||
|
||||
$this->seedBean = new EcmInvoiceOut();
|
||||
$this->lvs->quickViewLinks = false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
142
modules/EcmInvoiceOuts/DetailView.php
Executable file
142
modules/EcmInvoiceOuts/DetailView.php
Executable file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
|
||||
|
||||
require_once ('modules/EcmInvoiceOuts/EcmInvoiceOut.php');
|
||||
|
||||
|
||||
require_once ('include/time.php');
|
||||
|
||||
require_once ('include/json_config.php');
|
||||
|
||||
//add jquery
|
||||
|
||||
echo '<script type="text/javascript" src="include/ECM/SearchProductTable.js"></script>';
|
||||
|
||||
|
||||
$json_config = new json_config ();
|
||||
|
||||
$focus = new EcmInvoiceOut ();
|
||||
|
||||
if (isset ( $_REQUEST ['record'] )) {
|
||||
$focus->retrieve ( $_REQUEST ['record'] );
|
||||
$focus->format_all_fields ();
|
||||
|
||||
$OPT ['status'] = $focus->status;
|
||||
}
|
||||
|
||||
require_once ('include/MVC/View/SugarView.php');
|
||||
|
||||
require_once ('modules/EcmInvoiceOuts/views/DetailView/view.detail.my.php');
|
||||
|
||||
//create position list table
|
||||
$pl = $focus->getPositionList();
|
||||
$kp=false;
|
||||
$z=$focus->db->query("select id from ecmnewkpkws where so_id='$focus->id'");
|
||||
$dd=$focus->db->fetchByAssoc($z);
|
||||
|
||||
if($dd['id']==""){
|
||||
$kp=true;
|
||||
}
|
||||
|
||||
$edit = new ViewDetailMy ();
|
||||
$edit->ss = new Sugar_Smarty ();
|
||||
$edit->module = 'EcmInvoiceOuts';
|
||||
|
||||
//SendMailFromUserAccount($focus->id,'EcmInvoiceOuts',$focus->parent_id);
|
||||
$btn = '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createPDF&to_pdf=1&show_img=\'+$(\'#pdf_images\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&show_remarks=\'+$(\'#pdf_remarks\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
|
||||
$edit->ss->assign("CREATE_PDF",$btn);
|
||||
|
||||
$btn = '<input id="duplicate_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createPDF&to_pdf=1&isDuplicatePDF=1&&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Generuj duplikat"></div>';
|
||||
$edit->ss->assign("CREATE_DUPLICATE_PDF",$btn);
|
||||
|
||||
$btn ='<input title="Generuj Katalog" class="button" onclick="if($(\'#div_cat\').css(\'display\') == \'none\'){$(\'#div_cat\').show(\'slow\'); } else { $(\'#div_cat\').hide(\'slow\'); }" type="button" name="productcat" id="productcat" value="Generuj Katalog">';
|
||||
$btn .= '<div id="div_cat" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||
$btn .= 'EAN: <select name="cat_ean" id="cat_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
|
||||
$btn .= '<input name="cat_pdf" id="cat_pdf" title="Show Cat" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createCatalogue&to_pdf=1&show_ean=\'+$(\'#cat_ean\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż Katalog"></div>';
|
||||
$edit->ss->assign("CATALOGUE",$btn);
|
||||
|
||||
$btn ='<input title="Generuj XLS" class="button" onclick="if($(\'#div_xls\').css(\'display\') == \'none\'){$(\'#div_xls\').show(\'slow\'); } else { $(\'#div_xls\').hide(\'slow\'); }" type="button" name="productxls" id="productxls" value="Generuj XLS">';
|
||||
$btn .= '<div id="div_xls" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||
$btn .= 'EAN: <select name="xls_ean" id="xls_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
|
||||
$btn .= '<input name="cat_xls" id="cat_xls" title="Generuj XLS" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createXLS&to_pdf=1&show_ean=\'+$(\'#xls_ean\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż XLS"></div>';
|
||||
$edit->ss->assign("CREATE_XLS",$btn);
|
||||
$create_cor=false;
|
||||
if($focus->type!='correct'){
|
||||
$create_cor=true;
|
||||
}
|
||||
|
||||
if($focus->check_mail_addresses()==1){
|
||||
$btn='<input name="send_mail" id="send_mail" class="button" type="button" value="'.$mod_strings['LBL_SEND_MAIL'].'" onClick="SendMail(\''.$focus->id.'\',\'EcmInvoiceOuts\',\''.$focus->parent_id.'\');">';
|
||||
$edit->ss->assign("SEND_PDF",$btn);
|
||||
echo '<div id="sendreturn" style="display:none;"></div>';
|
||||
}
|
||||
$can_edit = false;
|
||||
global $current_user;
|
||||
if ($focus->assigned_user_id == $current_user->id || is_admin($current_user))
|
||||
$can_edit = true;
|
||||
|
||||
if($focus->type=='normal'){
|
||||
$btne='<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}"
|
||||
class="button" onclick="this.form.return_module.value=\'EcmInvoiceOuts\';
|
||||
this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\''.$focus->id.'\';
|
||||
this.form.action.value=\'EditView\';" type="submit" name="Edit" id="edit_button" value="Edytuj"> ';
|
||||
} else {
|
||||
$btne='<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}"
|
||||
class="button" onclick="window.location=\'index.php?module=EcmInvoiceOuts&return_module=EcmInvoiceOuts&action=EditView&return_action=index&record='.$focus->id.'&correctEdit=true&isDuplicate=false\';" type="button" name="Edit" id="edit_button" value="Edytuj"> ';
|
||||
}
|
||||
|
||||
$edit->ss->assign('editButton',$btne);
|
||||
$edit->ss->assign("CAN_EDIT", $can_edit);
|
||||
$edit->ss->assign("CREATE_COR",$create_cor);
|
||||
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
|
||||
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);
|
||||
$edit->ss->assign("CREATE_KP", $kp);
|
||||
|
||||
$a = new EcmSale();
|
||||
$a->retrieve($focus->so_id);
|
||||
$the_array ['ZS_NO'] = "<a target='_blank' href='index.php?module=EcmSales&action=DetailView&record=$a->id'>".$a->document_no."</a>";
|
||||
$edit->ss->assign("zs_no", $the_array ['ZS_NO']);
|
||||
$zap=$focus->db->query("select id,document_no from ecmstockdocouts where id in ('".implode("','",explode("@",$focus->wz_id))."')");
|
||||
$array=[];
|
||||
while($wz=$focus->db->fetchByAssoc($zap)){
|
||||
|
||||
$array[]="<a target='_blank' href='index.php?module=EcmStockDocOuts&action=DetailView&record=".$wz['id']."'>".$wz['document_no']."</a>";
|
||||
}
|
||||
|
||||
$edit->ss->assign("wz_no", implode(",",$array));
|
||||
//$focus->prepaid = $focus->prepaid;
|
||||
//get paid left
|
||||
if($focus->type=='correct'){
|
||||
$edit->ss->assign('PAID_LEFT', format_number(abs($focus->total_brutto)- ($focus->prepaid + $focus->paid_val)));
|
||||
} else {
|
||||
$edit->ss->assign('PAID_LEFT', format_number($focus->total_brutto- ($focus->prepaid + $focus->paid_val)));
|
||||
}
|
||||
|
||||
if ($focus->parent_id === '682d24c0-0f28-83c5-a840-64d9bbb03632' || $focus->parent_id === '226a168c-2fef-b92f-0918-6200de91bb31') {
|
||||
$edit->ss->assign('EDI', true);
|
||||
}
|
||||
|
||||
$edit->bean = $focus;
|
||||
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||||
|
||||
$edit->preDisplay ();
|
||||
|
||||
//check number
|
||||
$db = $GLOBALS['db'];
|
||||
$res = $db->query("SELECT id FROM ecminvoiceouts WHERE document_no='$focus->document_no' AND type='$focus->type' AND deleted='0'");
|
||||
if ($res->num_rows > 1) {
|
||||
echo '<h1 style="color: red;">Błąd numeracji, skontaktuj się z administratorem! Nie drukuj/publikuj dokumentu!</h1>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo $edit->display ();
|
||||
|
||||
require_once ('include/SubPanel/SubPanelTiles.php');
|
||||
$subpanel = new SubPanelTiles ( $focus, 'EcmInvoiceOuts' );
|
||||
echo $subpanel->display ();
|
||||
//loading view
|
||||
echo '<link rel="stylesheet" type="text/css" href="modules/EcmInvoiceOuts/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
||||
1808
modules/EcmInvoiceOuts/EcmInvoiceOut.php
Executable file
1808
modules/EcmInvoiceOuts/EcmInvoiceOut.php
Executable file
File diff suppressed because it is too large
Load Diff
334
modules/EcmInvoiceOuts/EditView.php
Executable file
334
modules/EcmInvoiceOuts/EditView.php
Executable file
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry)
|
||||
die('NotAValidEntryPoint');
|
||||
|
||||
//loading view
|
||||
echo '<link rel="stylesheet" type="text/css" href="modules/EcmInvoiceOuts/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
|
||||
require_once('modules/EcmInvoiceOuts/EcmInvoiceOut.php');
|
||||
require_once('include/time.php');
|
||||
|
||||
echo '<script type="text/javascript";
|
||||
src="modules/EcmInvoiceOuts/javascript/searchcolumndefs.js?time=' . md5(microtime()) . '"></script>';
|
||||
echo '<script type="text/javascript"
|
||||
src="include/ECM/SearchProductTable.js?time=' . md5(microtime()) . '"></script>';
|
||||
echo '<script type="text/javascript"
|
||||
src="include/ECM/tablenavigator.js?time=' . md5(microtime()) . '"></script>';
|
||||
// $cq=$current_user->getPreference('confirm_quotes');
|
||||
|
||||
$new_number = false;
|
||||
$is_correct = false;
|
||||
$is_wz = false;
|
||||
$is_sale = false;
|
||||
$duplicate = false;
|
||||
$focus = new EcmInvoiceOut();
|
||||
$db = $GLOBALS['db'];
|
||||
$refreshPositions = '0';
|
||||
|
||||
if (isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] == "false") {
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
if (isset($focus->id) && $focus->id != '') {
|
||||
$focus->format_all_fields();
|
||||
$wz_id = $focus->wz_id;
|
||||
$wz_name = $focus->wz_name;
|
||||
$so_id = $focus->so_id;
|
||||
$is_wz = true;
|
||||
$refreshPositions = '1';
|
||||
if ($focus->type == 'correct') {
|
||||
$is_correct = true;
|
||||
}
|
||||
}
|
||||
} else if ($_REQUEST['isDuplicate'] == "true") {
|
||||
$new_number = true;
|
||||
$duplicate = true;
|
||||
//get data
|
||||
$focus->retrieve($_REQUEST['return_id']);
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->sell_date = date("d.m.Y");
|
||||
$focus->validtill_date = date("d.m.Y");
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
} else if ($_REQUEST['isCorrect'] == "true") {
|
||||
$new_number = true;
|
||||
$is_correct = true;
|
||||
//get data
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
if (isset($focus->id) && $focus->id != '') {
|
||||
$focus->format_all_fields();
|
||||
}
|
||||
$tmp = new EcmInvoiceOut();
|
||||
$tmp->retrieve($_REQUEST['record']);
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->sell_date = date("d.m.Y", strtotime($tmp->sell_date));
|
||||
$focus->validtill_date = date("d.m.Y");
|
||||
$focus->type = 'correct';
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
$focus->currency_id = $tmp->currency_id;
|
||||
unset($tmp);
|
||||
} else if ($_REQUEST['isWZ'] == "true" || $_REQUEST['isWz'] == "true") {
|
||||
$new_number = true;
|
||||
$is_wz = true;
|
||||
//get data
|
||||
$wz = new EcmStockDocOut;
|
||||
$lists = explode('@', $_REQUEST['record']);
|
||||
$wz->retrieve($lists[0]);
|
||||
$wz_id = $_REQUEST['record'];
|
||||
$so_id = $wz->so_id;
|
||||
$wz_name = $wz->document_no;
|
||||
// load from wz
|
||||
$focus->parent_id = $wz->parent_id;
|
||||
$focus->parent_name = $wz->parent_name;
|
||||
$focus->order_no = $wz->order_no;
|
||||
//dates
|
||||
$focus->type = 'normal';
|
||||
$focus->stock_id = $wz->stock_id;
|
||||
$focus->stock_name = $wz->stock_name;
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->sell_date = $wz->register_date;
|
||||
|
||||
$focus->payment_method_paid = "0";
|
||||
|
||||
|
||||
$focus->validtill_date = date("d.m.Y");
|
||||
if ($so_id != '') {
|
||||
$so = new EcmSale();
|
||||
$so->retrieve($so_id);
|
||||
$focus->so_id = $so_id;
|
||||
$focus->payment_date = $so->payment_date;
|
||||
$focus->payment_date_days = $so->payment_date_days;
|
||||
$focus->payment_method = $so->payment_method;
|
||||
|
||||
$focus->parent_shipping_address_name = $so->shipping_address_name;
|
||||
$focus->parent_shipping_address_street = $so->shipping_address_street;
|
||||
$focus->parent_shipping_address_postalcode = $so->shipping_address_postalcode;
|
||||
$focus->parent_shipping_address_city = $so->shipping_address_city;
|
||||
$focus->parent_shipping_address_country = $so->shipping_address_country;
|
||||
$focus->parent_shipping_nip = $so->shipping_nip;
|
||||
$focus->parent_shipping_iln = $so->shipping_iln;
|
||||
|
||||
if ($so->order_source == 'allegro') {
|
||||
$focus->paid_val = $wz->total_brutto;
|
||||
if ($so->payment_method == 'PRZEDPLATA') {
|
||||
$focus->payment_method_paid = '0';
|
||||
} else {
|
||||
$focus->payment_method_paid = '1';
|
||||
}
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
}
|
||||
|
||||
// saturn??
|
||||
$tmp_a = new Account();
|
||||
$tmp_a->retrieve($wz->parent_id);
|
||||
if ($tmp_a->parent_id == '1249') {
|
||||
$a = new Account();
|
||||
$a->retrieve('1249');
|
||||
$focus->supplier_code = '2503793';
|
||||
$focus->parent_payer_address_name = $a->name;
|
||||
$focus->parent_payer_address_street = $a->register_address_street;
|
||||
$focus->parent_payer_address_postalcode = $a->register_address_postalcode;
|
||||
$focus->parent_payer_address_city = $a->register_address_city;
|
||||
$focus->parent_payer_address_country = $a->register_address_country;
|
||||
|
||||
$focus->parent_address_street = 'Al. Jerozolimskie 179';
|
||||
$focus->parent_address_postalcode = '02-222';
|
||||
$focus->parent_address_city = 'Warszawa';
|
||||
$focus->parent_address_country = 'Polska';
|
||||
|
||||
$focus->parent_payer_nip = $a->to_vatid;
|
||||
$focus->parent_payer_iln = $a->iln;
|
||||
}
|
||||
} else {
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
}
|
||||
|
||||
// Handle prepaid
|
||||
if ($s->main_sale_id) {
|
||||
$prepaids = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select SUM(inv_value) as total, GROUP_CONCAT(document_no, '') as documents FROM ecmprepaymentinvoices WHERE ecmsale_id
|
||||
='" . $s->main_sale_id . "' GROUP BY ecmsale_id"));
|
||||
} else {
|
||||
$prepaids = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select SUM(inv_value) as total, GROUP_CONCAT(document_no, '') as documents FROM ecmprepaymentinvoices WHERE ecmsale_id
|
||||
='" . $s->id . "' GROUP BY ecmsale_id"));
|
||||
}
|
||||
$focus->prepaid = $prepaids['total'];
|
||||
$focus->prepaid_nr = $prepaids['documents'];
|
||||
|
||||
if ($focus->prapaid != '') {
|
||||
$focus->ecmpaymentcondition_id = 'ec14f1da-09c5-7b99-77ef-4e9fd3cfd67f';
|
||||
$focus->ecmpaymentcondition_name = 'Przedpłata';
|
||||
}
|
||||
} else if ($_REQUEST['isSALE'] == "true") {
|
||||
|
||||
$new_number = true;
|
||||
$is_sale = true;
|
||||
//get data
|
||||
$wz = new EcmSale();
|
||||
$wz->retrieve($_REQUEST['record']);
|
||||
$so_id = $_REQUEST['record'];
|
||||
$wz_name = $wz->document_no;
|
||||
// load from sale...
|
||||
$focus->parent_id = $wz->parent_id;
|
||||
$focus->parent_name = $wz->parent_name;
|
||||
|
||||
$wz2 = new EcmStockDocOut();
|
||||
$wz2->retrieve_by_string_fields(['so_id' => $_REQUEST['record']]);
|
||||
if ($wz2->id != "") {
|
||||
$wz_name = $wz2->document_no;
|
||||
$wz_id = $wz2->id;
|
||||
}
|
||||
|
||||
$focus->order_no = $wz->parent_document_no;
|
||||
$focus->ecmpaymentcondition_name = $wz->ecmpaymentcondition_name;
|
||||
$focus->ecmpaymentcondition_id = $wz->ecmpaymentcondition_id;
|
||||
//dates
|
||||
$focus->type = 'normal';
|
||||
$focus->stock_id = $wz2->stock_id;
|
||||
$focus->stock_name = $wz2->stock_name;
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->sell_date = date("d.m.Y");
|
||||
$focus->validtill_date = date("d.m.Y");
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
$focus->payment_date = $wz->payment_date;
|
||||
$focus->payment_date_days = $wz->payment_date_days;
|
||||
|
||||
|
||||
$focus->so_id = $so_id;
|
||||
$focus->payment_date = $wz->payment_date;
|
||||
$focus->payment_date_days = $wz->payment_date_days;
|
||||
//var_dump($wz->payment_method);
|
||||
$focus->payment_method = $wz->payment_method;
|
||||
|
||||
$focus->parent_shipping_address_name = $wz->shipping_address_name;
|
||||
$focus->parent_shipping_address_street = $wz->shipping_address_street;
|
||||
$focus->parent_shipping_address_postalcode = $wz->shipping_address_postalcode;
|
||||
$focus->parent_shipping_address_city = $wz->shipping_address_city;
|
||||
$focus->parent_shipping_address_country = $wz->shipping_address_country;
|
||||
$focus->parent_shipping_nip = $wz->shipping_nip;
|
||||
$focus->parent_shipping_iln = $wz->shipping_iln;
|
||||
|
||||
|
||||
if ($wz->order_source == 'allegro') {
|
||||
$focus->paid_val = $wz->total_brutto;
|
||||
if ($wz->payment_method == 'PRZEDPLATA') {
|
||||
$focus->payment_method_paid = '0';
|
||||
} else {
|
||||
$focus->payment_method_paid = '1';
|
||||
}
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->payment_date_days = '0';
|
||||
}
|
||||
|
||||
// saturn??
|
||||
$tmp_a = new Account();
|
||||
$tmp_a->retrieve($wz->parent_id);
|
||||
if ($tmp_a->parent_id == '1249') {
|
||||
$a = new Account();
|
||||
$a->retrieve('1249');
|
||||
$focus->supplier_code = '2503793';
|
||||
$focus->parent_payer_address_name = $a->name;
|
||||
$focus->parent_payer_address_street = $a->register_address_street;
|
||||
$focus->parent_payer_address_postalcode = $a->register_address_postalcode;
|
||||
$focus->parent_payer_address_city = $a->register_address_city;
|
||||
$focus->parent_payer_address_country = $a->register_address_country;
|
||||
$focus->parent_address_street = 'Al. Jerozolimskie 179';
|
||||
$focus->parent_address_postalcode = '02-222';
|
||||
$focus->parent_address_city = 'Warszawa';
|
||||
$focus->parent_address_country = 'Polska';
|
||||
$focus->parent_payer_nip = $a->to_vatid;
|
||||
$focus->parent_payer_iln = $a->iln;
|
||||
}
|
||||
//$focus->register_date=$wz->register_date;
|
||||
// $focus->sell_date=$wz->register_date;
|
||||
$z = $GLOBALS['db']->query("select id from ecmprepaymentinvoices where ecmsale_id='" . $wz->id . "'");
|
||||
if ($z->num_rows > 0) {
|
||||
$focus->endinvoice = 1;
|
||||
$z2 = $GLOBALS['db']->query("select document_no,prepaid_amount from ecmprepaymentinvoices where ecmsale_id='" . $wz->id . "'");
|
||||
while ($d2 = $GLOBALS['db']->fetchByAssoc($z2)) {
|
||||
$focus->prepaid += $d2['prepaid_amount'];
|
||||
$focus->prepaid_nr .= $d2['document_no'] . ', ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$new_number = true;
|
||||
//dates
|
||||
$focus->stock_id = $current_user->stock_id;
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->sell_date = date("d.m.Y");
|
||||
$focus->validtill_date = date("d.m.Y");
|
||||
$focus->payment_date = date("d.m.Y");
|
||||
$focus->type = 'normal';
|
||||
|
||||
$focus->assigned_user_id = $current_user->id;
|
||||
$focus->assigned_user_name = $current_user->first_name . " " . $current_user->last_name;
|
||||
$focus->payment_date_days = 0;
|
||||
//$focus->number= EcmInvoiceOut::generateNumber($focus->stock_id,$focus->register_date );
|
||||
//$focus->document_no= EcmInvoiceOut::formatNumber($focus->number,$focus->stock_id);
|
||||
//for subpanels??
|
||||
if (isset($_REQUEST['contact_id']) && $_REQUEST['contact_id'] != '' && isset($_REQUEST['contact_name']) && $_REQUEST['contact_name'] != '') {
|
||||
$_REQUEST['parent_type'] = 'Contacts';
|
||||
$_REQUEST['parent_name'] = $_REQUEST['contact_name'];
|
||||
$_REQUEST['parent_id'] = $_REQUEST['contact_id'];
|
||||
$OPT['check_parent_id'] = false;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '' && isset($_REQUEST['account_name']) && $_REQUEST['account_name'] != '') {
|
||||
$_REQUEST['parent_type'] = 'Accounts';
|
||||
$_REQUEST['parent_name'] = $_REQUEST['account_name'];
|
||||
$_REQUEST['parent_id'] = $_REQUEST['account_id'];
|
||||
$OPT['check_parent_id'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
$res = $db->query("SELECT id, name FROM ecmstocks WHERE deleted = '0' ORDER BY name");
|
||||
$stock = '<select id="stock" name="stock"><option value=""></option>';
|
||||
$stock_body = '';
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
if ($focus->stock_id != '' && $row['id'] == $focus->stock_id) {
|
||||
$s = 'selected';
|
||||
} else {
|
||||
$s = '';
|
||||
}
|
||||
$stock_body .= '<option value="' . $row['id'] . '" ' . $s . '>' . $row['name'] . '</option>';
|
||||
}
|
||||
$stock .= $stock_body . '</select><input id="stock_id" name="stock_id" type="hidden" value="' . $focus->stock_id . '"/>';
|
||||
//includ OO VAT
|
||||
$v = new EcmVat();
|
||||
$v->retrieve('a8c52d5e-15df-2a13-c934-5578307bebd2');
|
||||
$oo = array('id' => 'a8c52d5e-15df-2a13-c934-5578307bebd2', 'name' => strtoupper($v->name), 'value' => $v->value);
|
||||
echo '<script> var OO=\'' . json_encode($oo) . '\'</script>';
|
||||
//stock operations
|
||||
|
||||
$operation = '<select id="operation_type" name="operation_type">';
|
||||
$operation_b = $app_list_strings['ecmoperation_type'];
|
||||
foreach ($operation_b as $key => $val) {
|
||||
$operation_b .= '<option value="' . $key . '">' . $val . '</option>';
|
||||
}
|
||||
$operation .= $operation_b . '</select><input id="operation_id" name="operation_id" type="hidden" value="' . $focus->operation_id . '"/>';
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
require_once('modules/EcmInvoiceOuts/views/EditView/view.edit.ecminvoiceouts.php');
|
||||
$edit = new ViewEditEcmInvoiceOuts();
|
||||
$edit->ss = new Sugar_Smarty();
|
||||
$edit->module = 'EcmInvoiceOuts';
|
||||
$edit->bean = $focus;
|
||||
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
|
||||
$edit->preDisplay();
|
||||
|
||||
$edit->ss->assign("correctEdit", $_REQUEST['correctEdit']);
|
||||
$edit->ss->assign("NEW_NUMBER", $new_number);
|
||||
$edit->ss->assign("IS_CORRECT", $is_correct);
|
||||
$edit->ss->assign("IS_WZ", $is_wz);
|
||||
$edit->ss->assign("IS_SALE", $is_sale);
|
||||
$edit->ss->assign("REFRESHPOSITIONS", $refreshPositions);
|
||||
$edit->ss->assign("WZ_ID", $wz_id);
|
||||
$edit->ss->assign("WZ_NAME", $wz_name);
|
||||
$edit->ss->assign("SO_ID", $so_id);
|
||||
$edit->ss->assign("DUPLICATE", $duplicate);
|
||||
$edit->ss->assign("STOCK", $stock);
|
||||
$edit->ss->assign("OPERATION_TYPE", $operation);
|
||||
echo $edit->display();
|
||||
0
modules/EcmInvoiceOuts/LoadFromEcmNewStockDocOuts.php
Executable file
0
modules/EcmInvoiceOuts/LoadFromEcmNewStockDocOuts.php
Executable file
106
modules/EcmInvoiceOuts/Menu.php
Executable file
106
modules/EcmInvoiceOuts/Menu.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
|
||||
* with the License. You may obtain a copy of the License at
|
||||
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
|
||||
* either express or implied.
|
||||
|
||||
*
|
||||
|
||||
* You may:
|
||||
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
|
||||
* a royalty or other fee.
|
||||
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
|
||||
* publicly available and document your modifications clearly.
|
||||
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
|
||||
* obligations for your customers.
|
||||
|
||||
*
|
||||
|
||||
* You may NOT:
|
||||
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
|
||||
* Provider).
|
||||
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
|
||||
* involves PHYSICAL media.
|
||||
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
|
||||
* or License text in the Licensed Software
|
||||
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
|
||||
* Licensed Software.
|
||||
|
||||
*
|
||||
|
||||
* You must:
|
||||
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
|
||||
*
|
||||
|
||||
* The Original Code is: CommuniCore
|
||||
|
||||
* Olavo Farias
|
||||
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
|
||||
* All Rights Reserved.
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
global $mod_strings, $current_user;
|
||||
|
||||
if(ACLController::checkAccess('EcmInvoiceOuts', "edit", true)) $module_menu [] = Array("index.php?module=".'EcmInvoiceOuts'."&action=EditView&return_module=".'EcmInvoiceOuts'."&return_action=DetailView", translate('LNK_NEW_'.'ECMQUOTE', 'EcmInvoiceOuts'),"CreateEcmInvoiceOuts", 'EcmInvoiceOuts');
|
||||
|
||||
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=index&return_module=EcmInvoiceOuts&return_action=DetailView", translate('LNK_ECMQUOTES_LIST','EcmInvoiceOuts'),"EcmInvoiceOuts", 'EcmInvoiceOuts');
|
||||
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=Report_INTRASTAT", "Raport INTRASTAT","EcmInvoiceOuts", 'EcmInvoiceOuts');
|
||||
|
||||
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=ecommerce", "Faktury E-Commerce","EcmInvoiceOuts", 'EcmInvoiceOuts');
|
||||
223
modules/EcmInvoiceOuts/ModuleFieldsParser/ModuleFieldsParser.php
Executable file
223
modules/EcmInvoiceOuts/ModuleFieldsParser/ModuleFieldsParser.php
Executable file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
class ModuleFieldsParser {
|
||||
|
||||
|
||||
|
||||
var $modules;
|
||||
|
||||
var $name;
|
||||
|
||||
|
||||
|
||||
function ModuleFieldsParser($name = 'mfp') {
|
||||
|
||||
$this->modules = Array();
|
||||
|
||||
if(file_exists('modules/EcmInvoiceOuts/ModuleFieldsParser/config.php')) {
|
||||
|
||||
require_once('modules/EcmInvoiceOuts/ModuleFieldsParser/config.php');
|
||||
|
||||
$this->modules = $mfp_modules;
|
||||
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getModulesSelectOptions($fieldRealNames = false) {
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
$arr = array();
|
||||
|
||||
if(count($this->modules)>0) {
|
||||
|
||||
foreach($this->modules as $key => $value) {
|
||||
|
||||
if(isset($value['name']) && $value['name'] != '')
|
||||
|
||||
if(isset($app_list_strings['moduleList'][$value['name']]) && $app_list_strings['moduleList'][$value['name']] != '')
|
||||
|
||||
$value['name'] = $app_list_strings['moduleList'][$value['name']];
|
||||
|
||||
$arr[$key]['name'] = $value['name'];
|
||||
|
||||
$arr[$key]['fields'] = $this->getModuleFieldsSelectOptions($key,$fieldRealNames);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $arr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getModuleFieldsSelectOptions($module,$fieldRealNames = false) {
|
||||
|
||||
global $beanList, $current_language, $GLOBALS;
|
||||
|
||||
$dict = null;
|
||||
|
||||
$file = 'cache/modules/'.$module.'/'.$beanList[$module].'vardefs.php';
|
||||
|
||||
if(file_exists($file)) {
|
||||
|
||||
include($file);
|
||||
|
||||
$dict = $GLOBALS['dictionary'][$beanList[$module]]['fields'];
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$file = 'modules/'.$module.'/vardefs.php';
|
||||
|
||||
if(file_exists($file)) { include($file); $dict = $dictionary[$beanList[$module]]['fields']; }
|
||||
|
||||
}
|
||||
|
||||
if($dict) {
|
||||
|
||||
$mod = return_module_language($current_language, $module);
|
||||
|
||||
$arr = array();
|
||||
|
||||
foreach($dict as $key => $value) {
|
||||
|
||||
$tmp = '$'.$this->modules[$module]['prefix'].$value['name'];
|
||||
|
||||
if(!$fieldRealNames)
|
||||
|
||||
$arr[$tmp] = ((isset($mod[$value['vname']]) && $mod[$value['vname']] != '') ? $mod[$value['vname']] : $value['name']);
|
||||
|
||||
else
|
||||
|
||||
$arr[$tmp] = $value['name'];
|
||||
|
||||
}
|
||||
|
||||
return $arr;
|
||||
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getJS() {
|
||||
|
||||
$json = getJSONobj();
|
||||
|
||||
$js = '<script language="javascript">';
|
||||
|
||||
$js .= 'var '.$this->name.'_data = '.$json->encode($this->getModulesSelectOptions()).';';
|
||||
|
||||
$js .= 'function '.$this->name.'_loadModules() { var ms = document.getElementById("'.$this->name.'_module"); for(x in '.$this->name.'_data) { ms.options[ms.options.length] = new Option('.$this->name.'_data[x]["name"],x,false); }; }';
|
||||
|
||||
$js .= 'function '.$this->name.'_loadFields() { var ms = document.getElementById("'.$this->name.'_module"); var fs = document.getElementById("'.$this->name.'_fields"); while(fs.options.length>0) fs.remove(0); var fields = '.$this->name.'_data[ms.value]["fields"]; for(x in fields) fs.options[fs.options.length] = new Option(fields[x],x,false); fs.onchange(); };';
|
||||
|
||||
$js .= 'function '.$this->name.'_loadField() { var fs = document.getElementById("'.$this->name.'_fields"); var fe = document.getElementById("'.$this->name.'_field"); fe.value = fs.value; };';
|
||||
|
||||
$js .= $this->name.'_loadModules(); '.$this->name.'_loadFields(); '.$this->name.'_loadField();';
|
||||
|
||||
$js .= '</script>';
|
||||
|
||||
return $js;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getFormHTML($smarty = false, $name = '') {
|
||||
|
||||
if($name != '') $this->name = $name;
|
||||
|
||||
$html = '
|
||||
|
||||
<span>
|
||||
|
||||
<select id="'.$this->name.'_module" name="'.$this->name.'_module" onChange="'.$this->name.'_loadFields();"></select>
|
||||
|
||||
<select id="'.$this->name.'_fields" name="'.$this->name.'_fields" onChange="'.$this->name.'_loadField()"></select>
|
||||
|
||||
<input id="'.$this->name.'_field" name="'.$this->name.'_field" value="" size="40">'
|
||||
|
||||
.($smarty ? '{literal}' : '').$this->getJS().($smarty ? '{/literal}' : '').
|
||||
|
||||
'</span>';
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fillFocusToModules() {
|
||||
|
||||
foreach($this->modules as $key => $value) {
|
||||
|
||||
if((!isset($value['focus']) || $value['focus'] == '') && (isset($value['id']) && $value['id'] != '')) {
|
||||
|
||||
global $beanFiles, $beanList;
|
||||
|
||||
$path = $beanFiles[$beanList[$key]];
|
||||
|
||||
if(file_exists($path)) {
|
||||
|
||||
require_once($path);
|
||||
|
||||
$this->modules[$key]['focus'] = new $beanList[$key]();
|
||||
|
||||
$this->modules[$key]['focus']->format_all_fields();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function parseText($text) {
|
||||
|
||||
$this->fillFocusToModules();
|
||||
|
||||
$temp = $this->getModulesSelectOptions(true);
|
||||
|
||||
foreach($this->modules as $module => $arr) {
|
||||
|
||||
if(isset($arr['focus']) && $arr['focus']!='') {
|
||||
|
||||
foreach($temp[$module]['fields'] as $field => $value) {
|
||||
|
||||
//$text = str_replace($field,((isset($this->modules[$module]['focus']->$value) && $this->modules[$module]['focus']->$value != '')?$this->modules[$module]['focus']->$value:''),$text);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
?>
|
||||
75
modules/EcmInvoiceOuts/ModuleFieldsParser/config.php
Executable file
75
modules/EcmInvoiceOuts/ModuleFieldsParser/config.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
|
||||
|
||||
$mfp_modules = Array(
|
||||
|
||||
'EcmInvoiceOuts' => array(
|
||||
|
||||
'name' => $app_list_strings['moduleList']['EcmInvoiceOuts'],
|
||||
|
||||
'prefix' => 'off_',
|
||||
|
||||
'id' => '',
|
||||
|
||||
'focus' => ''
|
||||
|
||||
),
|
||||
|
||||
'EcmDocumentTemplates' => array(
|
||||
|
||||
'name' => $app_list_strings['moduleList']['EcmDocumentTemplates'],
|
||||
|
||||
'prefix' => 'dt_',
|
||||
|
||||
'id' => '',
|
||||
|
||||
'focus' => ''
|
||||
|
||||
),
|
||||
|
||||
'Accounts' => array(
|
||||
|
||||
'name' => $app_list_strings['moduleList']['Accounts'],
|
||||
|
||||
'prefix' => 'acc_',
|
||||
|
||||
'id' => '',
|
||||
|
||||
'focus' => ''
|
||||
|
||||
),
|
||||
|
||||
'Contacts' => array(
|
||||
|
||||
'name' => $app_list_strings['moduleList']['Contacts'],
|
||||
|
||||
'prefix' => 'con_',
|
||||
|
||||
'id' => '',
|
||||
|
||||
'focus' => ''
|
||||
|
||||
),
|
||||
|
||||
'Users' => array(
|
||||
|
||||
'name' => $app_list_strings['moduleList']['Users'],
|
||||
|
||||
'prefix' => 'us_',
|
||||
|
||||
'id' => '',
|
||||
|
||||
'focus' => ''
|
||||
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
593
modules/EcmInvoiceOuts/PDFTemplate/content.php
Executable file
593
modules/EcmInvoiceOuts/PDFTemplate/content.php
Executable file
@@ -0,0 +1,593 @@
|
||||
<?php
|
||||
$w = "90"; // first column width
|
||||
$w3 = "90";
|
||||
$db=$GLOBALS['db'];
|
||||
$w2 = "20"; // second column width
|
||||
if($focus->type=='normal')$text='Faktura nr';
|
||||
if($focus->type=='correct')$text='FAKTURA KOREKTA nr';
|
||||
$content = '<p style="text-align: center;"><b>'.$text.' '.$focus->document_no.'</b></p>
|
||||
<table style="width: 100%; font-size: 14pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%"></td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . str_replace( "\n","<br>",$focus->parent_name) . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%"></td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
|
||||
$content.= '</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>
|
||||
<td valign="top" style="width: ' . $w2 . '%"></td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="28%">'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'</td><td width="25%"><b>'.$focus->register_date.'</b></td>
|
||||
<td width="22%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></tr>
|
||||
<tr><td width="29%">'.$labels['LBL_PDF_CONTENT_SELL_DATE_OTHER'].'</td><td width="25%"><b>'.$focus->sell_date.'</b>
|
||||
<td width="21%" style="text-align:right;"></td><td style="text-align:right;" width="25%"></td></td></tr>';
|
||||
|
||||
|
||||
if($focus->order_no!=''){
|
||||
$content.=' <tr><td width="28%">Numer zamówienia klienta:</td><td width="25%"><b>'.$focus->order_no.'</b></td>
|
||||
<td width="22%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></tr>';
|
||||
|
||||
}
|
||||
if($focus->ecminvoiceout_id!=''){
|
||||
$tmp=new EcmInvoiceOut();
|
||||
$tmp->retrieve($focus->ecminvoiceout_id);
|
||||
$a='<b>' . $tmp->document_no.'</b> z dnia '.date('d.m.Y',strtotime($tmp->register_date)).'<br>';
|
||||
$content.=' <tr><td width="28%">Korekta do Faktury nr:</td><td width="25%"><b>'.$a.'</b></td>
|
||||
<td width="22%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></tr>';
|
||||
|
||||
}
|
||||
|
||||
$content.='</table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp.',
|
||||
'align' => 'center'
|
||||
);
|
||||
//$pk_avaiable = true;
|
||||
if($pk_avaiable){
|
||||
$name_label = '
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left"><b>Nazwa</b></td>
|
||||
<td style="width:10%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left"><b>Indeks</b></td>
|
||||
<td style="width:10%;text-align:right"><b>PKWiU</b></td>
|
||||
</tr>
|
||||
</table>';
|
||||
}else{
|
||||
$name_label = 'Nazwa<br>Indeks';
|
||||
}
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
|
||||
),
|
||||
'label' => $name_label,
|
||||
'align' => 'left'
|
||||
);
|
||||
if(!$pk_avaiable){
|
||||
$columns ['name']['field'][] = 'product_code';
|
||||
}
|
||||
/*
|
||||
if($pk_avaiable==true){
|
||||
$columns ['pkwiu'] = array (
|
||||
'field' => array (
|
||||
'pkwiu',
|
||||
),
|
||||
'label' => 'PKWiU',
|
||||
'align' => 'left'
|
||||
);
|
||||
} */
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość<br>J.m.',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
if($discount_avaiable){
|
||||
$columns ['price_start'] = array (
|
||||
'field' => array (
|
||||
'price_start',
|
||||
'discount'
|
||||
),
|
||||
'label' => 'Cena pocz<br>Upust',
|
||||
'align' => 'right'
|
||||
);
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_netto'] = array (
|
||||
'field' => array (
|
||||
'total_netto'
|
||||
),
|
||||
'label' => 'Wartość<br>netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['ecmvat_name'] = array (
|
||||
'field' => array (
|
||||
'ecmvat_name'
|
||||
),
|
||||
'label' => 'VAT<br>(%)',
|
||||
'align' => 'center'
|
||||
);
|
||||
$columns ['total_vat'] = array (
|
||||
'field' => array (
|
||||
'total_vat'
|
||||
),
|
||||
'label' => 'Wartość<br>VAT',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość<br>brutto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
// set widths
|
||||
$totals = array ();
|
||||
|
||||
$columns ['position'] ['width'] = '3';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
/*
|
||||
if($pk_avaiable==true){
|
||||
$columns ['pkwiu'] ['width'] = '10';
|
||||
} */
|
||||
$columns ['qty'] ['width'] = '7';
|
||||
|
||||
if($discount_avaiable==true){
|
||||
$columns ['price_start'] ['width'] = '10';
|
||||
}
|
||||
//$columns ['unit_name'] ['width'] = '7';
|
||||
$columns ['price_netto'] ['width'] = '10';
|
||||
$columns ['total_netto'] ['width'] = '10';
|
||||
$columns ['ecmvat_name'] ['width'] = '4';
|
||||
$columns ['total_vat'] ['width'] = '10';
|
||||
$columns ['total_brutto'] ['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
if($focus->type=='normal'){
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
foreach ( $columns as $col) {
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
if($pk_avaiable && $f=='product_code'){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($f=='name' && $pk_avaiable){
|
||||
$pr =new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
//$pos[$f] = $pr->pkwiu;
|
||||
|
||||
|
||||
$content .= '
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos ['name'] . '</td>
|
||||
<td style="width:10%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos ['product_code'] . '</td>
|
||||
<td style="width:10%;text-align:right">' . $pr->pkwiu . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
continue;
|
||||
}else{
|
||||
$content .= $pos [$f] . '<br>';
|
||||
}
|
||||
/* if ($f == 'pkwiu'){
|
||||
|
||||
|
||||
|
||||
} else
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-'; */
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if($pk_avaiable && $f=='product_code'){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($f=='name' && $pk_avaiable){
|
||||
$pr =new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
//$pos[$f] = $pr->pkwiu;
|
||||
|
||||
|
||||
$content .= '
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos ['name'] . '</td>
|
||||
<td style="width:10%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos ['product_code'] . '</td>
|
||||
<td style="width:10%;text-align:right">' . $pr->pkwiu . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
continue;
|
||||
}else{
|
||||
$content .= $pos [$f] . '<br>';
|
||||
}
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
$pos['name'] = 'było';
|
||||
$pos['total_netto'] =format_number( $pos['old_total_netto']);
|
||||
$pos['total_brutto'] = format_number($pos['old_total_brutto']);
|
||||
$pos['total_vat'] = format_number($pos['old_total_vat']);
|
||||
$pos['price_netto'] = format_number($pos['old_price_netto']);
|
||||
$pos['quantity'] = $pos['old_quantity'];
|
||||
|
||||
$pos['position']='';
|
||||
$pos['product_code']=' ';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->symbol;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20'){
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
-'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_vat).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_brutto).'</b>
|
||||
</td></tr>';
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
if($focus->total_brutto>0){
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
} else {
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_PAID_RETURN'].'</td><td style="text-align: right;"><b>'.format_number(abs($focus->total_brutto)).' '.$symbol.'</b></td><td></td></tr>';
|
||||
}
|
||||
if($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20'){
|
||||
$left_to_paid='0';
|
||||
$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>8.610,00 '.$symbol.'</b> </td><td>Nr FK 001/14</td></tr>';
|
||||
}
|
||||
if($focus->paid_val!='' && $focus->id!='c2d7473a-c0b8-6718-0947-54993423de20'){
|
||||
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
|
||||
if($focus->type=='normal'){
|
||||
$content .= '<tr><td>'.$labels['LBL_PDF_PAID'].'</td><td style="text-align: right;"><b>'.format_number(abs($focus->paid_val)).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
|
||||
|
||||
} else {
|
||||
$content .= '<tr><td>Zwrócono:</td><td style="text-align: right;"><b>'.format_number(abs($focus->paid_val)).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->register_date))/(3600*24);
|
||||
$paid_text='w Terminie <b>'.round($dni).' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_REQUEST['pdf_type']=='1')
|
||||
$focus->pdf_text.=PHP_EOL."<br>Duplikat wystawiony dnia: ".($focus->id=='2f55c9e1-1b0d-3856-2552-57f34edef340' ? date('30.09.Y'):date('d.m.Y'));
|
||||
|
||||
if(abs($left_to_paid)>=0) $content .= '<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number(abs($left_to_paid)).' '.$symbol.'</b></td><td style="text-align:left;">'.(round(abs($left_to_paid))==0 ? "" : $paid_text).'</td></tr>
|
||||
';
|
||||
if($focus->pdf_type!="K"){
|
||||
$z=$db->query("select * from currency_nbp_archive where nbp_table_name='".$focus->currency_table."'");
|
||||
$dddd=$db->fetchByAssoc($z);
|
||||
$content .= '<tr><td>Kurs: </td><td colspan="2"><b>'.$focus->currency_value_nbp.'</b> z dnia <b>'.date("d.m.Y",strtotime($dddd['date'])).'</b> wg tabeli kursu NBP <b>'.$focus->currency_table.'</b></td></tr>
|
||||
';
|
||||
}
|
||||
$z=$focus->db->query("select value2,value8 from operating_values where value0='bankAccount' and value9='".$focus->bankaccount."'");
|
||||
$dan2=$focus->db->fetchByAssoc($z);
|
||||
if($focus->bankaccount!="" && $focus->payment_method=='PRZELEW'){
|
||||
$content .= '<tr><td>Konto bankowe nr:</td><td colspan="2" style="text-align:right"><b>'.($dan2['value8']!="" ? $dan2['value8']." " : "").$focus->bankaccount . '</b></td></tr>';
|
||||
}
|
||||
|
||||
$u = new User();
|
||||
|
||||
$u->retrieve($focus->assigned_user_id);
|
||||
if($focus->type=='normal'){
|
||||
$content .= '<tr><td>' . $labels['LBL_PDF_CONTENT_ISSUED_BY'] . '</td><td><b>' .$u->first_name . ' '.$u->last_name.'</b></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$content .= '</table>';
|
||||
|
||||
if($focus->pdf_text!='' && $focus->type=='correct'){
|
||||
$content.= '<table style="font-size: 12pt;vertical-align: top;">';
|
||||
$content.="<tr><td>Tytułem:</td><td>".$focus->pdf_text ."</td></tr>";
|
||||
$content .= '</table>';
|
||||
} else {
|
||||
if($focus->pdf_text!=''){
|
||||
$content.= '<table style="font-size: 8pt;">';
|
||||
$content.="<tr><td>".$focus->pdf_text ."</td></tr>";
|
||||
$content .= '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($focus->type=='correct'){
|
||||
$content.='<br>
|
||||
<table style="width:100%;font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="text-align:center;"><b>'.$focus->assigned_user_name.'</b></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
|
||||
</tr>
|
||||
</table>';
|
||||
} else {
|
||||
$EcmSysInfo = new EcmSysInfo();
|
||||
if($EcmSysInfo->getDatabaseName() == 'preDb_5d9477918f845c6fdc25532d415f9e73'){
|
||||
$content.='<br>
|
||||
<table style="width:100%;font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="text-align:center;"><b>'.$focus->assigned_user_name.'</b></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
}
|
||||
|
||||
//echo $content; die();
|
||||
593
modules/EcmInvoiceOuts/PDFTemplate/content_end.php
Executable file
593
modules/EcmInvoiceOuts/PDFTemplate/content_end.php
Executable file
@@ -0,0 +1,593 @@
|
||||
<?php
|
||||
$w = "90"; // first column width
|
||||
$w3 = "90";
|
||||
$w2 = "20"; // second column width
|
||||
if($focus->type=='normal')$text='Faktura nr ';
|
||||
if($focus->type=='correct')$text='FAKTURA KOREKTA nr';
|
||||
$content = '<p style="text-align: center;"><b>'.$text.' '.$focus->document_no.'</b></p>
|
||||
<table style="width: 100%; font-size: 14pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%"></td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%"></td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
|
||||
$content.= '</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>
|
||||
<td valign="top" style="width: ' . $w2 . '%"></td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
$sale=new EcmSale();
|
||||
$sale->retrieve($focus->so_id);
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="28%">'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'</td><td width="25%"><b>'.$focus->register_date.'</b></td>
|
||||
<td width="22%" style="text-align:right;">'.$labels['LBL_PDF_SALE_LABEL'].'</td><td style="text-align:right;" width="25%"><b>'.$sale->document_no.'</b></td></tr>
|
||||
<tr><td width="29%">'.$labels['LBL_PDF_CONTENT_SELL_DATE_OTHER'].'</td><td width="25%"><b>'.$focus->register_date.'</b>
|
||||
<td width="21%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></td>';
|
||||
|
||||
|
||||
$content.='</tr></table>';
|
||||
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa<br>Indeks',
|
||||
'align' => 'left'
|
||||
);
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość<br>J.m.',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
/*
|
||||
$columns ['price_start'] = array (
|
||||
'field' => array (
|
||||
'price_start'
|
||||
),
|
||||
'label' => 'Cena<br>Upust',
|
||||
'align' => 'right'
|
||||
);
|
||||
*/
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_netto'] = array (
|
||||
'field' => array (
|
||||
'total_netto'
|
||||
),
|
||||
'label' => 'Wartość<br>netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['ecmvat_name'] = array (
|
||||
'field' => array (
|
||||
'ecmvat_name'
|
||||
),
|
||||
'label' => 'VAT<br>(%)',
|
||||
'align' => 'center'
|
||||
);
|
||||
$columns ['total_vat'] = array (
|
||||
'field' => array (
|
||||
'total_vat'
|
||||
),
|
||||
'label' => 'Wartość<br>VAT',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość<br>brutto',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
$totals = array ();
|
||||
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
$columns ['qty'] ['width'] = '10';
|
||||
$columns ['price_netto'] ['width'] = '10';
|
||||
$columns ['total_netto'] ['width'] = '10';
|
||||
$columns ['ecmvat_name'] ['width'] = '4';
|
||||
$columns ['total_vat'] ['width'] = '10';
|
||||
$columns ['total_brutto'] ['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
if($focus->type=='normal'){
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
foreach ( $columns as $col) {
|
||||
|
||||
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
|
||||
if ($f == 'price_start') $pos[$f] = ' '.format_number($pos['price_start'],2).' <br>'.$pos['discount'].'% ';
|
||||
else
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if ((! $pos [$f] || $pos [$f] == '') && $f!='quantity')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
$pos['name'] = 'było';
|
||||
$pos['total_netto'] =format_number( $pos['old_total_netto']);
|
||||
$pos['total_brutto'] = format_number($pos['old_total_brutto']);
|
||||
$pos['total_vat'] = format_number($pos['old_total_vat']);
|
||||
$pos['price_netto'] = format_number($pos['old_price_netto']);
|
||||
$pos['quantity'] = $pos['old_quantity'];
|
||||
$pos['position']='';
|
||||
$pos['product_code']=' ';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->symbol;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<table style="width:100%"><tr><td width="60%"></td><td>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 290px;">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
}
|
||||
if($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20'){
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
-'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
|
||||
}
|
||||
// totals
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_vat).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->id=='c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_brutto).'</b>
|
||||
</td></tr></table></td></tr></table>';
|
||||
if($focus->id!='3c4482f1-6b7e-e9db-8606-58887512be46'){
|
||||
$content.='<table style="width:100%;">
|
||||
<tr><td width="62%" style="text-align:top;vertical-align: text-top;">
|
||||
<span style="font-size: 7pt;"><b>'.$labels['LBL_PDF_PREPAID_BEFORE'].'</b></span>
|
||||
<table style="width: 380px; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;">
|
||||
<tr>
|
||||
<th style="font-size: 6.5pt; border: 0.5 solid black; width: 15%;text-align: center;background-color: #E9E9E9;">'.$labels['LBL_PDF_PREPAID_NO'].'</th>
|
||||
<th style="font-size: 6.5pt; border: 0.5 solid black; width: 30%;text-align: center;background-color: #E9E9E9;">'.$labels['LBL_PDF_PREPAID_NUMBER'].'</th>
|
||||
<th style="font-size: 6.5pt; border: 0.5 solid black; width: 18%;text-align: center;background-color: #E9E9E9;">'.$labels['LBL_PDF_PREPAID_DATE'].'</th>
|
||||
<th style="font-size: 6.5pt; border: 0.5 solid black; width: 18%;text-align: center;background-color: #E9E9E9;">'.$labels['LBL_PDF_PREPAID_NETTO'].'</th>
|
||||
<th style="font-size: 6.5pt; border: 0.5 solid black; width: 18%;text-align: center;background-color: #E9E9E9;">'.$labels['LBL_PDF_PREPAID_BRUTTO'].'</th>
|
||||
</tr>';
|
||||
$z=$GLOBALS['db']->query('select document_no,register_date,prepaid_amount,total_vat from ecmprepaymentinvoices where ecmsale_id="'.$focus->so_id.'"');
|
||||
$nr=1;
|
||||
$t1=0;
|
||||
$t2=0;
|
||||
while($dd=$GLOBALS['db']->fetchByAssoc($z)){
|
||||
$content.='<tr>
|
||||
<td style="text-align:center;border: 0.5 solid black;">'.$nr.'</td>
|
||||
<td style="text-align:left;border: 0.5 solid black;">'.$dd['document_no'].'</td>
|
||||
<td style="text-align:left;border: 0.5 solid black;">'.date("d.m.Y",strtotime($dd['register_date'])).'</td>
|
||||
<td style="text-align:right;border: 0.5 solid black;">'.format_number($dd['prepaid_amount']-$dd['total_vat']).'</td>
|
||||
<td style="text-align:right;border: 0.5 solid black;">'.format_number($dd['prepaid_amount']).'</td>
|
||||
</tr>';
|
||||
$nr++;
|
||||
$t1+=$dd['prepaid_amount']-$dd['total_vat'];
|
||||
$t2+=$dd['prepaid_amount'];
|
||||
}
|
||||
$content.='<tr><td colspan="3" style="text-align:right;"><b>Razem:<b></td><td style="text-align:right;border: 0.5 solid black;">'.format_number($t1).'</td><td style="text-align:right;border: 0.5 solid black;
|
||||
">'.format_number($t2).'</td></tr></table>';
|
||||
|
||||
} else {
|
||||
$content.='<table style="width:100%;">
|
||||
<tr><td width="62%" style="text-align:top;vertical-align: text-top;font-size: 7pt;"> Faktura zaliczkowa nr: <b>3/2016</b>';
|
||||
}
|
||||
$content .= '<br>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr></table>';
|
||||
$content .= '
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>Przedpłata:</td><td style="text-align: right;"><b>'.format_number($focus->prepaid).' '.$symbol.'</b></td><td></td></tr></table>';
|
||||
if($focus->paid_val!='0'){
|
||||
$content .= '
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_PAID'].'</td><td style="text-align: right;"><b>'.format_number(abs($focus->paid_val)).' '.$symbol.'</b></td><td></td></tr></table>';
|
||||
}
|
||||
|
||||
$paid_text='w Terminie <b>'.$focus->payment_date_days.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
if($focus->id!='3c4482f1-6b7e-e9db-8606-58887512be46'){
|
||||
$content .= '
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto-abs($focus->paid_val)-$focus->prepaid).' '.$symbol.'</b></td><td>'.$paid_text.'</td></tr></table>';
|
||||
} else {
|
||||
$content .= '
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto-abs($focus->paid_val)-$focus->prepaid).' '.$symbol.'</b></td><td></td></tr></table>';
|
||||
}
|
||||
$content .= ' </td>
|
||||
<td width="38%" style="text-align:top;vertical-align: text-top;">
|
||||
<div style="height: 20px;"> </div>';
|
||||
$content .= '
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px;">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
$t1=0;
|
||||
$t2=0;
|
||||
$t3=0;
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
$vat=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id from ecmvats where name like '".$v2[0]."' and deleted='0'"));
|
||||
if($focus->id!='3c4482f1-6b7e-e9db-8606-58887512be46'){
|
||||
|
||||
$z=$GLOBALS['db']->fetchByAssoc(
|
||||
$GLOBALS['db']->query('select sum(total_vat) as vat,sum(prepaid_amount) as brutto,sum(prepaid_amount-total_vat) as netto from ecmprepaymentinvoices where ecmsale_id="'.$focus->so_id.'" and vat_id="'.$vat['id'].'"'));
|
||||
} else {
|
||||
$v2[0]='23%';
|
||||
$z['netto']='1624';
|
||||
$z['vat']='373.52';
|
||||
$z['brutto']='1997.52';
|
||||
}
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($z['netto']*-1).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($z['vat']*-1).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number($z['brutto']*-1).'
|
||||
</td></tr>';
|
||||
$t1+=$z['netto']*-1;
|
||||
$t2+=$z['vat']*-1;
|
||||
$t3+=$z['brutto']*-1;
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($t1).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($t2).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($t3).'</b>
|
||||
</td></tr></table>';
|
||||
$content .= '<p style="font-size: 5px;"> </p>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px;">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
$t1=0;
|
||||
$t2=0;
|
||||
$t3=0;
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
$vat=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id from ecmvats where name like '".$v2[0]."' and deleted='0'"));
|
||||
if($focus->id!='3c4482f1-6b7e-e9db-8606-58887512be46'){
|
||||
|
||||
$z=$GLOBALS['db']->fetchByAssoc(
|
||||
$GLOBALS['db']->query('select sum(total_vat) as vat,sum(prepaid_amount) as brutto,sum(prepaid_amount-total_vat) as netto from ecmprepaymentinvoices where ecmsale_id="'.$focus->so_id.'" and vat_id="'.$vat['id'].'"'));
|
||||
} else {
|
||||
$v2[0]='23%';
|
||||
$z['netto']='1624';
|
||||
$z['vat']='373.52';
|
||||
$z['brutto']='1997.52';
|
||||
}
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number(abs($z['netto']-$v2[1])).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number(abs($z['vat']-$v2[2])).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number(abs($z['brutto']-$v2[3])).'
|
||||
</td></tr>';
|
||||
$t1+=$z['netto']-$v2[1];
|
||||
$t2+=$z['vat']-$v2[2];
|
||||
$t3+=$z['brutto']-$v2[3];
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number(abs($t1)).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number(abs($t2)).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number(abs($t3)).'</b>
|
||||
</td></tr></table>';
|
||||
|
||||
$content .= '
|
||||
</table>';
|
||||
$content .= '
|
||||
</table>';
|
||||
|
||||
$content .= ' </td></tr>
|
||||
</table>';
|
||||
|
||||
|
||||
$content .= '<br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
||||
<br><br>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
100
modules/EcmInvoiceOuts/PDFTemplate/footer-en_us.php
Executable file
100
modules/EcmInvoiceOuts/PDFTemplate/footer-en_us.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
$w = "62"; //first column width
|
||||
$w2 = "12"; //second column width
|
||||
$footer = '
|
||||
<hr>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
e5 Polska Sp. z o.o
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
28207
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
ul. Wąwozowa 11
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
PL 525-21-73-990
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
02-796 Warszawa
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
016280234
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Tel: +48 (22) 228 20 90
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
';
|
||||
if ($bank=='milenium')
|
||||
$footer.='BANK MILLENIUM';
|
||||
if ($bank=='mbank')
|
||||
$footer.='MBANK';
|
||||
$footer.='
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Fax: +48 (56) 674 60 47
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
';
|
||||
if ($bank=='milenium')
|
||||
$footer.='PL36116022020000000064080587';
|
||||
if ($bank=='mbank')
|
||||
$footer.='PL96114010100000548212001002';
|
||||
$footer.='
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
'.$user->email1.'
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_SWIFT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
';
|
||||
if ($bank=='milenium')
|
||||
$footer.='BIGBPLPW';
|
||||
if ($bank=='mbank')
|
||||
$footer.='BREXPLPW';
|
||||
$footer.='
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: 50%;">
|
||||
{PAGENO}/{nb}
|
||||
</td>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<b>'.$focus->document_no.'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
95
modules/EcmInvoiceOuts/PDFTemplate/footer-pl_pl.php
Executable file
95
modules/EcmInvoiceOuts/PDFTemplate/footer-pl_pl.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
$w = "62"; //first column width
|
||||
$w2 = "12"; //second column width
|
||||
$footer = '
|
||||
<hr>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
e5 Polska Sp. z o.o
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
28207
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
ul. Wąwozowa 11
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
PL 525-21-73-990
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
02-796 Warszawa
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
016280234
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Tel: +48 (22) 228 20 90
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
';
|
||||
if ($bank=='milenium')
|
||||
$footer.='BANK MILLENIUM';
|
||||
if ($bank=='mbank')
|
||||
$footer.='MBANK';
|
||||
$footer.='
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Fax: +48 (56) 674 60 47
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
';
|
||||
if ($bank=='milenium')
|
||||
$footer.='35 1160 2202 0000 0000 6408 0411';
|
||||
if ($bank=='mbank')
|
||||
$footer.='26 1140 1010 0000 5482 1200 1001';
|
||||
$footer.='
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
'.$user->email1.'
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_GIOS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
E0006254W
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: 50%;">
|
||||
{PAGENO}/{nb}
|
||||
</td>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<b>'.$focus->document_no.'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
5
modules/EcmInvoiceOuts/PDFTemplate/header.php
Executable file
5
modules/EcmInvoiceOuts/PDFTemplate/header.php
Executable file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$db = $GLOBALS ['db'];
|
||||
$querySelect = 'SELECT text0 FROM operating_values WHERE id="11"';
|
||||
$rows = $db->fetchByAssoc($db->query($querySelect));
|
||||
$header = html_entity_decode($rows['text0']);
|
||||
105
modules/EcmInvoiceOuts/PDFTemplate/helper.php
Executable file
105
modules/EcmInvoiceOuts/PDFTemplate/helper.php
Executable file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
function formatPDFPositionsEng($positions, $focus) {
|
||||
$result = array();
|
||||
|
||||
|
||||
foreach ($positions as $pos) {
|
||||
|
||||
$pos['quantity'] = intval($pos['quantity']);
|
||||
$pos['old_quantity'] = intval($pos['old_quantity']);
|
||||
|
||||
$pos['position'] = intval($pos['position'])+1;
|
||||
$pos['price_netto']=format_number($pos['price_netto']);
|
||||
$pos['total_vat']=format_number($pos['total_vat']);
|
||||
$pos['ecmvat_value']=format_number($pos['ecmvat_value']);
|
||||
$pos['total_brutto']=format_number($pos['total_brutto']);
|
||||
$pos['total_netto']=format_number($pos['total_netto']);
|
||||
$pos['old_total_netto']=format_number($pos['old_total_netto']);
|
||||
$pos['old_total_brutto']=format_number($pos['old_total_brutto']);
|
||||
$pos['old_total_vat']=format_number($pos['old_total_vat']);
|
||||
$pos['old_price_netto']=format_number($pos['old_price_netto']);
|
||||
|
||||
$result[] = $pos;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function formatPDFPositions($positions, $focus) {
|
||||
$result = array();
|
||||
foreach ($positions as $pos) {
|
||||
$pos['position'] = intval($pos['position']) + 1;
|
||||
$pos['quantity'] = number_format($pos['quantity'],$pos['product_precision'],",","");
|
||||
$pos['old_quantity'] = number_format($pos['old_quantity'],$pos['product_precision'],",","");
|
||||
$pos['ecmproduct_id'] = $pos['product_id'];
|
||||
$pos['price_netto'] = format_number($pos['price_netto']);
|
||||
$pos['total_vat'] = format_number($pos['total_vat']);
|
||||
$pos['price_start'] = format_number($pos['price_start']);
|
||||
$pos['discount'] = $pos['discount'].'%';
|
||||
$pos['ecmvat_value'] = format_number($pos['ecmvat_value']);
|
||||
$pos['total_brutto'] = format_number($pos['total_brutto']);
|
||||
$pos['total_netto'] = format_number($pos['total_netto']);
|
||||
$pos['recipient_code']=$pos['recipient_code'];
|
||||
$result[] = $pos;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function formatPDFPositionsCorrect($pos, $focus) {
|
||||
$pos['position'] = intval($pos['position']) + 1;
|
||||
$pos['quantity'] = round($pos['quantity'],$pos['product_precision']);
|
||||
$pos['price_netto'] = format_number($pos['price_netto']);
|
||||
$pos['total_vat'] = format_number($pos['total_vat']);
|
||||
$pos['ecmvat_value'] = format_number($pos['ecmvat_value']);
|
||||
$pos['total_brutto'] = format_number($pos['total_brutto']);
|
||||
$pos['total_netto'] = format_number($pos['total_netto']);
|
||||
return $pos;
|
||||
}
|
||||
|
||||
function mysql_escape_gpc($dirty) {
|
||||
if (ini_get('magic_quotes_gpc')) {
|
||||
return $dirty;
|
||||
} else {
|
||||
return mysql_real_escape_string($dirty);
|
||||
}
|
||||
}
|
||||
|
||||
function checkIsDiscount($positions, $focus) {
|
||||
$result = array();
|
||||
$discount=false;
|
||||
foreach ($positions as $pos) {
|
||||
|
||||
if($pos['discount']!=0){
|
||||
$discount=true;
|
||||
}
|
||||
|
||||
}
|
||||
return $discount;
|
||||
}
|
||||
function checkIsPK($positions, $focus) {
|
||||
$result = array();
|
||||
$oo=false;
|
||||
foreach ($positions as $pos) {
|
||||
|
||||
$pr= new EcmProduct();
|
||||
$pr->retrieve($pos['product_id']);
|
||||
if($pr->pkwiu!=''){
|
||||
$oo=true;
|
||||
}
|
||||
|
||||
}
|
||||
return $oo;
|
||||
}
|
||||
function checkIsOO($positions, $focus) {
|
||||
$result = array();
|
||||
$oo=false;
|
||||
foreach ($positions as $pos) {
|
||||
|
||||
if($pos['ecmvat_id']=='a8c52d5e-15df-2a13-c934-5578307bebd2'){
|
||||
$oo=true;
|
||||
}
|
||||
|
||||
}
|
||||
return $oo;
|
||||
}
|
||||
376
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en.php
Executable file
376
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en.php
Executable file
@@ -0,0 +1,376 @@
|
||||
<?php
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>NABYWCA / BUYER</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>DOSTAWA / DELIVERY</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if($focus->parent_payer_address_name!=''){
|
||||
$content.= '<b>PŁATNIK / PAYER</b>';
|
||||
}$content.= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
|
||||
$content.=', '.$focus->parent_payer_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
if($focus->ecminvoiceout_name!=''){
|
||||
$corl='Korekta do / Correct to:<br>';
|
||||
}
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
|
||||
<tr><td width="25%" style="text-align: left;">Data wystawienia / '.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>Miejsce wystawienia / Place of register:<br>Data sprzedaży / Selling date:<br>'.$corl.'</td>
|
||||
<td style="text-align: left;" width="40%"><b>' . $focus->register_date . '</b><br><b>Obrowo</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b></td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='Dokument WZ / WZ Document:<br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='Nr zamówienia / Order No:<br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='Kod dostawcy / Supplier code:<br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='Termin płatności / Payment date:<br>';
|
||||
}
|
||||
if($focus->payment_method!=''){
|
||||
$content.='Metoda płatności / Payment method:<br>';
|
||||
}
|
||||
|
||||
$content.='</td>
|
||||
<td rowspan="2" style="vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='<b>' . $focus->wz_name.'</b><br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='<b>' . $focus->order_no.'</b><br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='<b>' . $focus->supplier_code.'</b><br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
|
||||
}
|
||||
if($focus->payment_method!=''){
|
||||
$content.='<b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method].'</b><br>';
|
||||
}
|
||||
$content.='</td></tr></table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp. / Pos.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa / Name<br>Indeks / Index ',
|
||||
'align' => 'left'
|
||||
);
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] = array (
|
||||
'field' => array (
|
||||
'recipient_code'
|
||||
),
|
||||
'label' => 'Kod Tow. / Recipient Code',
|
||||
'align' => 'center'
|
||||
);
|
||||
}
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość / Qantity<br>J.m. / Unit',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena / Price',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość / Value',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
$totals = array ();
|
||||
if($recipient_code==1){
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
$columns ['recipient_code'] ['width'] = '12';
|
||||
$columns ['qty'] ['width'] = '12';
|
||||
$columns ['price_netto'] ['width'] = '12';
|
||||
$columns ['total_brutto'] ['width'] = '12';
|
||||
} else {
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '51';
|
||||
$columns ['qty'] ['width'] = '14';
|
||||
$columns ['price_netto'] ['width'] = '14';
|
||||
$columns ['total_brutto'] ['width'] = '14';
|
||||
}
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
if($focus->type=='normal'){
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if ($f=='product_code') {
|
||||
$pr = new EcmProduct();
|
||||
$pr->retrieve($pos['product_id']);
|
||||
if (strlen($pr->ean) > 0) {
|
||||
$pos['product_code'].=' EAN '.$pr->ean;
|
||||
}
|
||||
$content.=$pos['product_code'];
|
||||
} else {
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
}
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['ecminvoiceoutitem_id']), $focus );
|
||||
$pos2['name']='było / was';
|
||||
$pos2['position']='';
|
||||
$pos2['product_code']=' ';
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos2 [$f] || $pos2 [$f] == '')
|
||||
$pos2 [$f] = '-';
|
||||
$content .= $pos2 [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->name;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem / Total</b>
|
||||
</td>
|
||||
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_brutto).' '.$symbol.'</b>
|
||||
</td></tr></table>';
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
if($focus->type=='correct'){
|
||||
$content .= '<table style="font-size: 7pt;"><tr><td >Do zwrotu / To paid back:</td><td style="text-align: right;">
|
||||
<b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr></table>';
|
||||
} else {
|
||||
$content .= '
|
||||
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>Do zapłaty / To pay:</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
if($focus->paid_val!=''){
|
||||
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
|
||||
$content .= '<tr><td>Zapłacono / Paid:</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
|
||||
}
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
|
||||
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
$content .= '<tr><td>Pozostało do zapłaty / Left to paid:</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
|
||||
</table>';}$content .= '<br><br><br>Dla wszystkich pozycji faktury zastosowano stawkę VAT 0%
|
||||
<br>VAT is 0% for all invoice items
|
||||
<br>(Zgodnie z art. 41 ust. 3 ustawy o podatku VAT)<br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
|
||||
//echo $content; die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
407
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en_correct.php
Executable file
407
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en_correct.php
Executable file
@@ -0,0 +1,407 @@
|
||||
<?php
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$ret = $db->query("
|
||||
SELECT distinct o.ecminvoiceout_id
|
||||
FROM
|
||||
ecminvoiceoutitems as ii
|
||||
INNER JOIN ecminvoiceouts as i
|
||||
ON ii.ecminvoiceout_id = i.id
|
||||
INNER JOIN ecminvoiceoutitems AS o
|
||||
ON o.id = ii.ecminvoiceoutitem_id
|
||||
WHERE
|
||||
ii.ecminvoiceout_id = '$focus->id'");
|
||||
|
||||
|
||||
if ($ret->num_rows > 1) $multi_correct = true;
|
||||
|
||||
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>NABYWCA / BUYER</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>DOSTAWA / DELIVERY</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if($focus->parent_payer_address_name!=''){
|
||||
$content.= '<b>PŁATNIK / PAYER</b>';
|
||||
}$content.= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
|
||||
$content.=', '.$focus->parent_payer_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
|
||||
$content.='NIP/Vat ID: '.$focus->parent_payer_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
|
||||
if ($nip) $content.'<br>'; $nip = false;
|
||||
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_payer_iln;
|
||||
}
|
||||
$content.='</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
if($focus->type=='correct'){
|
||||
$corl='Korekta do / Correct to:';
|
||||
$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] = "Numer zwrotu / Return number";
|
||||
}
|
||||
|
||||
$labels['LBL_PLACE_PDF'] = 'Miejsce wystawienia / Place of register:';
|
||||
$labels['LBL_PDF_CONTENT_SELL_DATE'] = 'Data sprzedaży / Sell date:';
|
||||
if (!$multi_correct) {
|
||||
$inv = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT register_date FROM ecminvoiceouts WHERE id='".$focus->ecminvoiceout_id."'"));
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="25%" >Data wystawienia / Register date<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
|
||||
<td style="text-align: left;" width="40%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b>, '.$inv['register_date'].'</td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top; width: 25%;">';
|
||||
} else {
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="25%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br></td>
|
||||
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b></b></td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top; width: 25%">';
|
||||
}
|
||||
if($focus->wz_name!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='Data płatności / Payment date:<br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='Metoda płatności / Payment method:<br>';
|
||||
}
|
||||
|
||||
$pay=new EcmPaymentCondition();
|
||||
|
||||
$pay->retrieve($focus->ecmpaymentcondition_id);
|
||||
|
||||
$content.='</td>
|
||||
<td rowspan="2" style="vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='<b>' . $focus->wz_name.'</b><br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='<b>' . $focus->order_no.'</b><br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='<b>' . $focus->supplier_code.'</b><br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
|
||||
}
|
||||
$content.='</td></tr></table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp. / Pos.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa / Name<br>Indeks / Index ',
|
||||
'align' => 'left'
|
||||
);
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] = array (
|
||||
'field' => array (
|
||||
'recipient_code'
|
||||
),
|
||||
'label' => 'Kod Tow. / Recipient Code',
|
||||
'align' => 'center'
|
||||
);
|
||||
}
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość / Qantity<br>J.m. / Unit',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena /Price',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość / Value',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
// set widths
|
||||
$totals = array ();
|
||||
if($recipient_code==1){
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
$columns ['recipient_code'] ['width'] = '12';
|
||||
$columns ['qty'] ['width'] = '12';
|
||||
$columns ['price_netto'] ['width'] = '12';
|
||||
$columns ['total_brutto'] ['width'] = '12';
|
||||
} else {
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '51';
|
||||
$columns ['qty'] ['width'] = '14';
|
||||
$columns ['price_netto'] ['width'] = '14';
|
||||
$columns ['total_brutto'] ['width'] = '14';
|
||||
}
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if ((! $pos [$f] || $pos [$f] == '') && $f!='quantity')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
$pos['name'] = 'było';
|
||||
if ($multi_correct) {
|
||||
// get invoice
|
||||
$c = $db->fetchByAssoc ( $db->query ( "
|
||||
SELECT i.document_no, i.order_no, register_date FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecminvoiceoutitems as ii
|
||||
ON i.id=ii.ecminvoiceout_id
|
||||
WHERE ii.id = '" . $pos ['ecminvoiceoutitem_id'] . "'
|
||||
" ) );
|
||||
if ($c['order_no'] && $c['order_no']!='')
|
||||
$pos['name'] .= '<br>' . $corl . ' ' . $c ['document_no'] .' - '.$c['register_date'].'<br>' .
|
||||
$mod_strings ['LBL_PDF_ORDER_NO'].' '.$c['order_no'];
|
||||
else
|
||||
$pos['name'] .= '<br>' . $corl .' '.$c ['document_no'] .' - '.$c['register_date'];
|
||||
unset ( $c );
|
||||
}
|
||||
$pos['total_netto'] = $pos['old_total_netto'];
|
||||
$pos['total_brutto'] = $pos['old_total_brutto'];
|
||||
$pos['total_vat'] = $pos['old_total_vat'];
|
||||
$pos['price_netto'] = $pos['old_price_netto'];
|
||||
$pos['quantity'] = $pos['old_quantity'];
|
||||
$pos['position']='';
|
||||
$pos['product_code']=' ';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->iso4217;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość / Value</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_brutto).'</b>
|
||||
</td>
|
||||
';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
|
||||
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
|
||||
if ($focus->total_brutto > 0)
|
||||
$labels['LBL_PDF_TO_PAY'] = 'Do zapłaty / To paid: ';
|
||||
else
|
||||
$labels['LBL_PDF_TO_PAY'] = 'Do zwrotu / To paid back: ';
|
||||
|
||||
$total_brutto = abs($focus->total_brutto);
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
|
||||
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$focus->pdf_text || $focus->pdf_text=="")
|
||||
$focus->pdf_text = "Przyczyna korekty: Zwrot towaru.<br>Correct reason: Products return.";
|
||||
|
||||
$content .= '
|
||||
</table><br><p style="font-size: 7pt;">Wystawił / Issued by <b>'.$user->full_name.'</b></p>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
385
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k.php
Executable file
385
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k.php
Executable file
@@ -0,0 +1,385 @@
|
||||
<?php
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if($focus->parent_payer_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_PAYER'].'</b>';
|
||||
}$content.= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
|
||||
$content.=', '.$focus->parent_payer_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_payer_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_payer_iln;
|
||||
}
|
||||
$content.='</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
|
||||
<td style="text-align: left;" width="35%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b>'.$korekta.'</td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.=$labels['LBL_PAYMENT_DATE_PDF'].':<br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.=$labels['LBL_PAYMENT_METHOD_PDF'].':<br>';
|
||||
}
|
||||
|
||||
$pay=new EcmPaymentCondition();
|
||||
|
||||
$pay->retrieve($focus->ecmpaymentcondition_id);
|
||||
|
||||
$content.='</td>
|
||||
<td rowspan="2" style="vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='<b>' . $focus->wz_name.'</b><br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='<b>' . $focus->order_no.'</b><br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='<b>' . $focus->supplier_code.'</b><br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
|
||||
}
|
||||
$content.='</td></tr></table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa<br>Indeks',
|
||||
'align' => 'left'
|
||||
);
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] = array (
|
||||
'field' => array (
|
||||
'recipient_code'
|
||||
),
|
||||
'label' => 'Kod Tow.',
|
||||
'align' => 'center'
|
||||
);
|
||||
}
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość<br>J.m.',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_netto'] = array (
|
||||
'field' => array (
|
||||
'total_netto'
|
||||
),
|
||||
'label' => 'Wartość<br>netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['ecmvat_name'] = array (
|
||||
'field' => array (
|
||||
'ecmvat_name'
|
||||
),
|
||||
'label' => 'VAT<br>(%)',
|
||||
'align' => 'center'
|
||||
);
|
||||
$columns ['total_vat'] = array (
|
||||
'field' => array (
|
||||
'total_vat'
|
||||
),
|
||||
'label' => 'Wartość<br>VAT',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość<br>brutto',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
$totals = array ();
|
||||
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] ['width'] = '10';
|
||||
}
|
||||
$columns ['qty'] ['width'] = '10';
|
||||
$columns ['price_netto'] ['width'] = '10';
|
||||
$columns ['total_netto'] ['width'] = '10';
|
||||
$columns ['ecmvat_name'] ['width'] = '4';
|
||||
$columns ['total_vat'] ['width'] = '10';
|
||||
$columns ['total_brutto'] ['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->symbol;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_netto).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_vat).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_brutto).'</b>
|
||||
</td></tr>';
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
if($focus->paid_val!=''){
|
||||
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
|
||||
$content .= '<tr><td>'.$labels['LBL_PDF_PAID'].'</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
|
||||
}
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
|
||||
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
$content .= '<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
|
||||
</table>';
|
||||
if ($focus->currency_id!='PLN') {
|
||||
//get currency date
|
||||
$dd = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT date, value FROM currency_nbp_archive WHERE currency_id='".$focus->currency_id."' AND nbp_table_name='".$focus->currency_table."' "));
|
||||
$content.="<p style='font-size: 7pt;'>Wartość VAT w zł: ".format_number(($focus->total_vat*$dd['value'])).". Przeliczowo wg. kursu NBP (".$focus->currency_table.": ".format_number($dd['value'],4,4)." zł) z dnia ".$dd['date'].'</p>';
|
||||
}
|
||||
$content.='<p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
462
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k_correct.php
Executable file
462
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k_correct.php
Executable file
@@ -0,0 +1,462 @@
|
||||
<?php
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
$ret = $db->query("
|
||||
SELECT distinct o.ecminvoiceout_id
|
||||
FROM
|
||||
ecminvoiceoutitems as ii
|
||||
INNER JOIN ecminvoiceouts as i
|
||||
ON ii.ecminvoiceout_id = i.id
|
||||
INNER JOIN ecminvoiceoutitems AS o
|
||||
ON o.id = ii.ecminvoiceoutitem_id
|
||||
WHERE
|
||||
ii.ecminvoiceout_id = '$focus->id'");
|
||||
|
||||
|
||||
if ($ret->num_rows > 1) $multi_correct = true;
|
||||
|
||||
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if($focus->parent_payer_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_CONTENT_PAYER'].'</b>';
|
||||
}$content.= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
|
||||
$content.=', '.$focus->parent_payer_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) {$content.='<br>'; $nip = false;}
|
||||
$content.='ILN: '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
|
||||
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_payer_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_payer_iln;
|
||||
}
|
||||
$content.='</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
if($focus->type=='correct'){
|
||||
$corl=$labels['LBL_PDF_CORRECT_TO'];
|
||||
$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] = "Numer zwrotu";
|
||||
}
|
||||
|
||||
|
||||
if (!$multi_correct) {
|
||||
$inv = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT register_date FROM ecminvoiceouts WHERE id='".$focus->ecminvoiceout_id."'"));
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
|
||||
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b>, z dnia '.$inv['register_date'].'</td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
||||
} else {
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br></td>
|
||||
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b></b></td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
||||
}
|
||||
if($focus->wz_name!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.=$labels['LBL_PAYMENT_DATE_PDF'].':<br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.=$labels['LBL_PAYMENT_METHOD_PDF'].':<br>';
|
||||
}
|
||||
|
||||
$pay=new EcmPaymentCondition();
|
||||
|
||||
$pay->retrieve($focus->ecmpaymentcondition_id);
|
||||
|
||||
$content.='</td>
|
||||
<td rowspan="2" style="vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='<b>' . $focus->wz_name.'</b><br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='<b>' . $focus->order_no.'</b><br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='<b>' . $focus->supplier_code.'</b><br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='<b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method].'</b><br>';
|
||||
}
|
||||
$content.='</td></tr></table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa<br>Indeks',
|
||||
'align' => 'left'
|
||||
);
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] = array (
|
||||
'field' => array (
|
||||
'recipient_code'
|
||||
),
|
||||
'label' => 'Kod Tow.',
|
||||
'align' => 'center'
|
||||
);
|
||||
}
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość<br>J.m.',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_netto'] = array (
|
||||
'field' => array (
|
||||
'total_netto'
|
||||
),
|
||||
'label' => 'Wartość<br>netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['ecmvat_name'] = array (
|
||||
'field' => array (
|
||||
'ecmvat_name'
|
||||
),
|
||||
'label' => 'VAT<br>(%)',
|
||||
'align' => 'center'
|
||||
);
|
||||
$columns ['total_vat'] = array (
|
||||
'field' => array (
|
||||
'total_vat'
|
||||
),
|
||||
'label' => 'Wartość<br>VAT',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość<br>brutto',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
$totals = array ();
|
||||
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] ['width'] = '10';
|
||||
}
|
||||
$columns ['qty'] ['width'] = '10';
|
||||
$columns ['price_netto'] ['width'] = '10';
|
||||
$columns ['total_netto'] ['width'] = '10';
|
||||
$columns ['ecmvat_name'] ['width'] = '4';
|
||||
$columns ['total_vat'] ['width'] = '10';
|
||||
$columns ['total_brutto'] ['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if ((! $pos [$f] || $pos [$f] == '') && $f!='quantity')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
$pos['name'] = 'było';
|
||||
if ($multi_correct) {
|
||||
// get invoice
|
||||
$c = $db->fetchByAssoc ( $db->query ( "
|
||||
SELECT i.document_no, i.order_no, register_date FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecminvoiceoutitems as ii
|
||||
ON i.id=ii.ecminvoiceout_id
|
||||
WHERE ii.id = '" . $pos ['ecminvoiceoutitem_id'] . "'
|
||||
" ) );
|
||||
if ($c['order_no'] && $c['order_no']!='')
|
||||
$pos['name'] .= '<br>' . $corl . ' ' . $c ['document_no'] .' - '.$c['register_date'].'<br>' .
|
||||
$mod_strings ['LBL_PDF_ORDER_NO'].' '.$c['order_no'];
|
||||
else
|
||||
$pos['name'] .= '<br>' . $corl .' '.$c ['document_no'] .' - '.$c['register_date'];
|
||||
unset ( $c );
|
||||
}
|
||||
$pos['total_netto'] = $pos['old_total_netto'];
|
||||
$pos['total_brutto'] = $pos['old_total_brutto'];
|
||||
$pos['total_vat'] = $pos['old_total_vat'];
|
||||
$pos['price_netto'] = $pos['old_price_netto'];
|
||||
$pos['quantity'] = $pos['old_quantity'];
|
||||
$pos['position']='';
|
||||
$pos['product_code']=' ';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->symbol;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v){
|
||||
if($v=='')continue;
|
||||
$v2 = explode(":", $v);
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
'.$v2[0].'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[1]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
'.format_number($v2[2]).'
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
'.format_number($v2[3]).'
|
||||
</td></tr>';
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_netto).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_vat).'</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_brutto).'</b>
|
||||
</td></tr>';
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
|
||||
if ($focus->total_brutto > 0)
|
||||
$labels['LBL_PDF_TO_PAY'] = 'Do zapłaty: ';
|
||||
else
|
||||
$labels['LBL_PDF_TO_PAY'] = 'Do zwrotu: ';
|
||||
|
||||
$total_brutto = abs($focus->total_brutto);
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
|
||||
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$focus->pdf_text || $focus->pdf_text=="")
|
||||
$focus->pdf_text = "Przyczyna korekty: Zwrot towaru.";
|
||||
|
||||
$content .= '
|
||||
</table><br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
366
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_u.php
Executable file
366
modules/EcmInvoiceOuts/PDFTemplate/tpl/content_u.php
Executable file
@@ -0,0 +1,366 @@
|
||||
<?php
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
$content = '
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>'.$labels['LBL_PDF_UE_BUYER_TITLE'].'</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if($focus->parent_shipping_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_UE_DELIVERY_TITLE'].'</b>';
|
||||
}
|
||||
|
||||
$content.= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if($focus->parent_payer_address_name!=''){
|
||||
$content.= '<b>'.$labels['LBL_PDF_UE_PAYER_TITLE'].'</b>';
|
||||
}$content.= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'.$focus->parent_shipping_address_name.'
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
|
||||
$content.=', '.$focus->parent_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
'. $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
|
||||
$content.=', '.$focus->parent_shipping_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
|
||||
$content.=', '.$focus->parent_payer_address_country;
|
||||
$content.='
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
|
||||
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='
|
||||
</td>';
|
||||
$content.='
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
|
||||
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_shipping_address_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content.='<br>'; $nip = false;
|
||||
$content.='ILN: '.$focus->parent_shipping_iln;
|
||||
}
|
||||
$content.='</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content.='
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
if($focus->ecminvoiceout_name!=''){
|
||||
$corl='Korekta do / Correct to:<br>';
|
||||
}
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
|
||||
<tr><td width="44%" >Data wystawienia / '.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>Miejsce wystawienia / Place of register:<br>Data sprzedaży / Selling date:<br>'.$corl.'</td>
|
||||
<td style="text-align: left;" width="20%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b></td>
|
||||
<td rowspan="2" style="text-align: left;vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='Dokument WZ / WZ Document:<br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='Nr zamówienia / Order No:<br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='Kod dostawcy / Supplier code:<br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='Termin płatności / Payment date:<br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='Metoda płatności / Payment method:<br>';
|
||||
}
|
||||
$pay=new EcmPaymentCondition();
|
||||
|
||||
$pay->retrieve($focus->ecmpaymentcondition_id);
|
||||
$content.='</td>
|
||||
<td rowspan="2" style="vertical-align:top;">';
|
||||
if($focus->wz_name!=''){
|
||||
$content.='<b>' . $focus->wz_name.'</b><br>';
|
||||
}
|
||||
if($focus->order_no!=''){
|
||||
$content.='<b>' . $focus->order_no.'</b><br>';
|
||||
}
|
||||
if($focus->supplier_code!=''){
|
||||
$content.='<b>' . $focus->supplier_code.'</b><br>';
|
||||
}
|
||||
if($focus->payment_date!=''){
|
||||
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
|
||||
}
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
|
||||
}
|
||||
$content.='</td></tr></table><br>';
|
||||
// start items table
|
||||
$columns = array ();
|
||||
|
||||
$columns ['position'] = array (
|
||||
'field' => array (
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp. / Pos.',
|
||||
'align' => 'center'
|
||||
);
|
||||
|
||||
$columns ['name'] = array (
|
||||
'field' => array (
|
||||
'name',
|
||||
'product_code'
|
||||
),
|
||||
'label' => 'Nazwa / Name<br>Indeks / Index ',
|
||||
'align' => 'left'
|
||||
);
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] = array (
|
||||
'field' => array (
|
||||
'recipient_code'
|
||||
),
|
||||
'label' => 'Kod Tow. / Recipient Code',
|
||||
'align' => 'center'
|
||||
);
|
||||
}
|
||||
$columns ['qty'] = array (
|
||||
'field' => array (
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość / Qantity<br>J.m. / Unit',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns ['price_netto'] = array (
|
||||
'field' => array (
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena / Price',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns ['total_brutto'] = array (
|
||||
'field' => array (
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość / Value',
|
||||
'align' => 'right'
|
||||
);
|
||||
// set widths
|
||||
$totals = array ();
|
||||
|
||||
$columns ['position'] ['width'] = '5';
|
||||
$columns ['name'] ['width'] = '41';
|
||||
if($recipient_code==1){
|
||||
$columns ['recipient_code'] ['width'] = '10';
|
||||
}
|
||||
$columns ['qty'] ['width'] = '10';
|
||||
$columns ['price_netto'] ['width'] = '10';
|
||||
$columns ['total_brutto'] ['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ( $columns as $col ) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter=1;
|
||||
if($focus->type=='normal'){
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
foreach ( $positions as $pos ) {
|
||||
$content .= '<tr>';
|
||||
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['ecminvoiceoutitem_id']), $focus );
|
||||
$pos2['name']='było / was';
|
||||
$pos2['position']='';
|
||||
$pos2['product_code']=' ';
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-';
|
||||
$content .= $pos [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
foreach ( $columns as $col ) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
|
||||
foreach ( $col ['field'] as $f ) {
|
||||
|
||||
if (! $pos2 [$f] || $pos2 [$f] == '')
|
||||
$pos2 [$f] = '-';
|
||||
$content .= $pos2 [$f] . '<br>';
|
||||
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency ();
|
||||
$c->retrieve ( $focus->currency_id );
|
||||
$symbol = $c->name;
|
||||
unset ( $c );
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content.='</tr>
|
||||
';
|
||||
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem / Total</b>
|
||||
</td>
|
||||
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>'.format_number($focus->total_brutto).' '.$symbol.'</b>
|
||||
</td></tr></table>';
|
||||
$left_to_paid=$focus->total_brutto-$focus->paid_val;
|
||||
if($focus->type=='correct'){
|
||||
$content .= '<table style="font-size: 7pt;"><tr><td >Do zwrotu / To paid back:</td><td style="text-align: right;">
|
||||
<b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr></table>';
|
||||
} else {
|
||||
$content .= '
|
||||
|
||||
<table style="font-size: 7pt;">
|
||||
<tr><td>Do zapłaty / To pay:</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
|
||||
if($focus->paid_val!=''){
|
||||
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
|
||||
$content .= '<tr><td>Zapłacono / Paid:</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
|
||||
}
|
||||
|
||||
if($focus->ecmpaymentcondition_id!=''){
|
||||
|
||||
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
|
||||
$r=$db->fetchByAssoc($q);
|
||||
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if($focus->payment_date!=''){
|
||||
|
||||
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
|
||||
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
$content .= '<tr><td>Pozostało do zapłaty / Left to paid:</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
|
||||
</table>';}$content .= '<br><b>Dla wszystkich pozycji faktury zastosowano stawkę VAT 0%
|
||||
<br>VAT is 0% for all invoice items
|
||||
<br>(Zgodnie z art. 41 ust. 3 ustawy o podatku VAT)</b><br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
|
||||
<br><br>
|
||||
' . $focus->pdf_text . '
|
||||
';
|
||||
|
||||
//echo $content; die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
114
modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-en_us.php
Executable file
114
modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-en_us.php
Executable file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
$w = "62"; //first column width
|
||||
$w2 = "12"; //second column width
|
||||
//get bank information
|
||||
$a = new Account();
|
||||
$a->retrieve($focus->parent_id);
|
||||
|
||||
if ($focus->bankaccount=='6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'){
|
||||
// eur
|
||||
$ba_number = 'PL 36 1160 2202 0000 0000 6408 0587';
|
||||
$ba_name = 'BANK MILLENIUM';
|
||||
$ba_swift = 'BIGBPLPW';
|
||||
}
|
||||
|
||||
|
||||
$db= $GLOBALS['db'];
|
||||
|
||||
$query ="select * from operating_values where value9='".$focus->bankaccount."'";
|
||||
|
||||
$res = $db->query($query);
|
||||
|
||||
$row = $db->fetchByAssoc($res);
|
||||
$ba_number = null;
|
||||
$ba_name = null;
|
||||
$ba_swift = null;
|
||||
if(isset($row['id']) && $row['id']!=""){
|
||||
$ba_number = $row['value9'];
|
||||
$ba_name = $row['value8'];;
|
||||
$ba_swift = $row['value4'];;
|
||||
}
|
||||
|
||||
unset($a);
|
||||
$footer = '
|
||||
<hr>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Twinpol sp. z O. O.
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
533184
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
ul. Al. Lipowa 48
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
PL 879-26-76-609
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
87-126 Obrowo
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
360223008
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
'.$ba_name.'
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
'.$ba_number.'
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
'.$user->email1.'
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_SWIFT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
'.$ba_swift.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: 50%;">
|
||||
{PAGENO}/{nb}
|
||||
</td>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<b>'.$focus->document_no.'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
93
modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-pl_pl.php
Executable file
93
modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-pl_pl.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
$w = "62"; //first column width
|
||||
$w2 = "12"; //second column width
|
||||
//get bank information
|
||||
$a = new Account();
|
||||
$a->retrieve($focus->parent_id);
|
||||
|
||||
$ba_number = '35 1160 2202 0000 0000 6408 0411';
|
||||
$ba_name = 'BANK MILLENIUM';
|
||||
|
||||
unset($a);
|
||||
$footer = '
|
||||
<hr>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
e5 Polska Sp. z o.o
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
28207
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
ul. Wąwozowa 11
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
PL525273990
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
02-796 Warszawa
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
016280234
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Tel: +48 (22) 228 20 90
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
'.$ba_name.'
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
Fax: +48 (56) 674 60 47
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
'.$ba_number.'
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: '.$w.'%">
|
||||
'.$user->email1.'
|
||||
</td>
|
||||
<td style="width: '.$w2.'%">
|
||||
<b>'.$labels['LBL_PDF_FOOTER_GIOS'].'</b>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
E0006254W
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width: 100%; font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="width: 50%;">
|
||||
{PAGENO}/{nb}
|
||||
</td>
|
||||
<td style="width: 50%; text-align: right">
|
||||
<b>'.$focus->document_no.'</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
22
modules/EcmInvoiceOuts/PDFTemplate/tpl/header.php
Executable file
22
modules/EcmInvoiceOuts/PDFTemplate/tpl/header.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if($focus->type=='normal')$text='Faktura nr';
|
||||
if($focus->type=='correct')$text='Faktura korygująca nr';
|
||||
|
||||
$header = '
|
||||
<table style="font-size: 8pt; width: 100%"><tr>
|
||||
<td width="35%" style="text-align: left; vertical-align: top;">
|
||||
<b>SPRZEDAWCA</b><br />
|
||||
e5 Polska Sp. z o. o.<br />
|
||||
ul. Wąwozowa 11<br />
|
||||
02-796 Warszawa<br />
|
||||
NIP: 5252173990
|
||||
</td>
|
||||
<td style="text-align: left; vertical-align: middle;"><p style="text-align: center;font-size: 12pt;"><b>'.$text.' '.$focus->document_no.'</b></p>
|
||||
</td>
|
||||
|
||||
<td width="15%">
|
||||
<img style="width: 70px;" src="modules/EcmDocumentTemplates/files/13899e0f-321c-229a-aa3e-48be4a1532c1.png"/>
|
||||
</td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
';
|
||||
24
modules/EcmInvoiceOuts/PDFTemplate/tpl/header_en.php
Executable file
24
modules/EcmInvoiceOuts/PDFTemplate/tpl/header_en.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
if($focus->type=='normal')$text='Faktura/Invoice';
|
||||
if($focus->type=='correct')$text='Faktura korygująca nr/Correct Invoice';
|
||||
|
||||
$header = '
|
||||
<table style="font-size: 8pt; width: 100%"><tr>
|
||||
|
||||
<td width="35%" style="text-align: left; vertical-align: top;">
|
||||
<b>SPRZEDAWCA / SELLER
|
||||
</b><br />
|
||||
Twinpol sp. z O. O.<br />
|
||||
ul. Al. Lipowa 48<br />
|
||||
87-126 Obrowo<br />
|
||||
NIP: PL8792676609
|
||||
</td>
|
||||
</td>
|
||||
<td style="text-align: left; vertical-align: middle;"><p style="text-align: center;font-size: 12pt;"><b>'.$text.' '.$focus->document_no.'</b></p>
|
||||
</td>
|
||||
<td width="15%">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
';
|
||||
674
modules/EcmInvoiceOuts/PDFTemplate/twinpol.php
Executable file
674
modules/EcmInvoiceOuts/PDFTemplate/twinpol.php
Executable file
@@ -0,0 +1,674 @@
|
||||
<?php
|
||||
$w = "90"; // first column width
|
||||
$w3 = "90";
|
||||
$db = $GLOBALS['db'];
|
||||
$w2 = "20"; // second column width
|
||||
if ($focus->type == 'normal') $text = 'Faktura nr';
|
||||
if ($focus->type == 'correct') $text = 'FAKTURA KOREKTA nr';
|
||||
$w = "35"; // first column width
|
||||
$w3 = "35";
|
||||
$w2 = "25"; // second column width
|
||||
|
||||
|
||||
$content = '<p style="text-align: center;"><b>' . $text . ' ' . $focus->document_no . '</b></p>
|
||||
<table style="width: 100%; font-size: 8pt;">
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
<b>' . $labels['LBL_PDF_CONTENT_INVOICE_FOR'] . '</b>
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">';
|
||||
if ($focus->parent_shipping_address_name != '') {
|
||||
$content .= '<b>DOSTAWA</b>';
|
||||
}
|
||||
|
||||
$content .= '</td>
|
||||
<td style="width: ' . $w2 . '%">';
|
||||
if ($focus->parent_payer_address_name != '') {
|
||||
$content .= '<b>PŁATNIK</b>';
|
||||
}
|
||||
$content .= '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_name . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">' . $focus->parent_payer_address_name . '</td>
|
||||
<td style="text-align: right"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_street . '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_street . '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: ' . $w . '%">
|
||||
' . $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
|
||||
if (!is_null($focus->parent_address_country) & $focus->parent_address_country != '')
|
||||
$content .= ', ' . $focus->parent_address_country;
|
||||
$content .= '
|
||||
</td>
|
||||
<td style="width: ' . $w3 . '%">
|
||||
' . $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
|
||||
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country != '')
|
||||
$content .= ', ' . $focus->parent_shipping_address_country;
|
||||
$content .= '
|
||||
</td>
|
||||
<td style="width: ' . $w2 . '%">
|
||||
' . $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
|
||||
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country != '')
|
||||
$content .= ', ' . $focus->parent_payer_address_country;
|
||||
$content .= '
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content .= '
|
||||
<tr>
|
||||
<td valign="top" style="width: ' . $w . '%">';
|
||||
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
|
||||
$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
|
||||
if ($nip) $content . '<br>';
|
||||
$nip = false;
|
||||
$content .= '<br>ILN: ' . $focus->parent_iln;
|
||||
}
|
||||
$content .= '
|
||||
</td>';
|
||||
$content .= '
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) {
|
||||
$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_shipping_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
|
||||
if ($nip) $content . '<br>';
|
||||
$nip = false;
|
||||
$content .= '<br>ILN: ' . $focus->parent_shipping_iln;
|
||||
}
|
||||
$content .= '
|
||||
</td>';
|
||||
$content .= '
|
||||
<td valign="top" style="width: ' . $w3 . '%">';
|
||||
if (!is_null($focus->parent_payer_nip) && $focus->parent_payer_nip) {
|
||||
$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_payer_nip;
|
||||
$nip = true;
|
||||
}
|
||||
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
|
||||
if ($nip) $content . '<br>';
|
||||
$nip = false;
|
||||
$content .= '<br>ILN: ' . $focus->parent_payer_iln;
|
||||
}
|
||||
$content .= '</td>
|
||||
<td colspan="0" valign="top" style="text-align: right">
|
||||
|
||||
</td>
|
||||
</tr>';
|
||||
$content .= '
|
||||
</table>
|
||||
';
|
||||
if ($focus->name && $focus->name != '') {
|
||||
$content .= '
|
||||
<table style="width: 100%; text-align: center">
|
||||
<tr><td>
|
||||
<b>' . $focus->name . '</b>
|
||||
</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
|
||||
<tr><td width="28%">' . $labels['LBL_PDF_CONTENT_REGISTER_DATE'] . '</td><td width="25%"><b>' . $focus->register_date . '</b></td>
|
||||
<td width="22%" style="text-align:right;">Miejsce wystawienia: </td><td style="text-align:right;" width="25%"><b>Obrowo</b></td></tr>
|
||||
<tr><td width="29%">Data sprzedaży:</td><td width="25%"><b>' . $focus->sell_date . '</b>
|
||||
<td width="21%" style="text-align:right;">Termin płatności:</td><td style="text-align:right;" width="25%"><b>' . $focus->payment_date . '</b></td></td></tr>';
|
||||
|
||||
|
||||
|
||||
$content .= ' <tr><td width="28%">' . ($focus->order_no != '' ? 'Numer zamówienia klienta:' : '') . '</td><td width="25%"><b>' . ($focus->order_no != '' ? $focus->order_no : '') . '</b></td>
|
||||
<td width="22%" style="text-align:right;">Metoda płatności:</td><td style="text-align:right;" width="25%"><b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method] . '</b></td></tr>';
|
||||
|
||||
|
||||
$content .= ' <tr><td width="28%">' . ($focus->supplier_code != '' ? 'Kod dostawcy:' : '') . '</td><td width="25%"><b>' . ($focus->supplier_code != '' ? $focus->supplier_code : '') . '</b></td>
|
||||
<td width="22%" style="text-align:right;">' . ($focus->wz_name != '' || true ? 'Nr dokumentu WZ:' : '') . '</td><td style="text-align:right;" width="25%"><b>' . ($focus->wz_name != '' ? $focus->wz_name : '') . '</b></td></tr>';
|
||||
|
||||
|
||||
if ($focus->ecminvoiceout_id != '') {
|
||||
$tmp = new EcmInvoiceOut();
|
||||
$tmp->retrieve($focus->ecminvoiceout_id);
|
||||
$a = '<b>' . $tmp->document_no . '</b> z dnia ' . date('d.m.Y', strtotime($tmp->register_date)) . '<br>';
|
||||
$content .= ' <tr><td width="28%">Korekta do Faktury nr:</td><td width="25%"><b>' . $a . '</b></td>
|
||||
<td width="22%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></tr>';
|
||||
}
|
||||
|
||||
$content .= '</table><br>';
|
||||
// start items table
|
||||
$columns = array();
|
||||
|
||||
$columns['position'] = array(
|
||||
'field' => array(
|
||||
'position'
|
||||
),
|
||||
'label' => 'Lp.',
|
||||
'align' => 'center'
|
||||
);
|
||||
//$pk_avaiable = true;
|
||||
if ($pk_avaiable) {
|
||||
$name_label = '
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left"><b>Nazwa</b></td>
|
||||
<td style="width:10%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left"><b>Indeks</b></td>
|
||||
<td style="width:10%;text-align:right"><b>EAN</b></td>
|
||||
</tr>
|
||||
</table>';
|
||||
} else {
|
||||
$name_label = 'Nazwa<br>Indeks';
|
||||
}
|
||||
|
||||
$columns['name'] = array(
|
||||
'field' => array(
|
||||
'name',
|
||||
|
||||
),
|
||||
'label' => $name_label,
|
||||
'align' => 'left'
|
||||
);
|
||||
if (!$pk_avaiable) {
|
||||
$columns['name']['field'][] = 'product_code';
|
||||
}
|
||||
/*
|
||||
if($pk_avaiable==true){
|
||||
$columns ['pkwiu'] = array (
|
||||
'field' => array (
|
||||
'pkwiu',
|
||||
),
|
||||
'label' => 'PKWiU',
|
||||
'align' => 'left'
|
||||
);
|
||||
} */
|
||||
$columns['recipient_code'] = array(
|
||||
'field' => array(
|
||||
'recipient_code',
|
||||
'pkwiu'
|
||||
),
|
||||
'label' => 'Kod odbiorcy<br>PKWiU',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns['qty'] = array(
|
||||
'field' => array(
|
||||
'quantity',
|
||||
'unit_name'
|
||||
),
|
||||
'label' => 'Ilość<br>J.m.',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
if ($discount_avaiable) {
|
||||
$columns['price_start'] = array(
|
||||
'field' => array(
|
||||
'price_start',
|
||||
'discount'
|
||||
),
|
||||
'label' => 'Cena pocz<br>Upust',
|
||||
'align' => 'right'
|
||||
);
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
$columns['price_netto'] = array(
|
||||
'field' => array(
|
||||
'price_netto'
|
||||
),
|
||||
'label' => 'Cena netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns['total_netto'] = array(
|
||||
'field' => array(
|
||||
'total_netto'
|
||||
),
|
||||
'label' => 'Wartość<br>netto',
|
||||
'align' => 'right'
|
||||
);
|
||||
$columns['ecmvat_name'] = array(
|
||||
'field' => array(
|
||||
'ecmvat_name'
|
||||
),
|
||||
'label' => 'VAT<br>(%)',
|
||||
'align' => 'center'
|
||||
);
|
||||
$columns['total_vat'] = array(
|
||||
'field' => array(
|
||||
'total_vat'
|
||||
),
|
||||
'label' => 'Wartość<br>VAT',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
$columns['total_brutto'] = array(
|
||||
'field' => array(
|
||||
'total_brutto'
|
||||
),
|
||||
'label' => 'Wartość<br>brutto',
|
||||
'align' => 'right'
|
||||
);
|
||||
|
||||
// set widths
|
||||
$totals = array();
|
||||
|
||||
$columns['position']['width'] = '3';
|
||||
$columns['name']['width'] = '31';
|
||||
$columns['recipient_code']['width'] = '10';
|
||||
/*
|
||||
if($pk_avaiable==true){
|
||||
$columns ['pkwiu'] ['width'] = '10';
|
||||
} */
|
||||
$columns['qty']['width'] = '7';
|
||||
|
||||
if ($discount_avaiable == true) {
|
||||
$columns['price_start']['width'] = '10';
|
||||
}
|
||||
//$columns ['unit_name'] ['width'] = '7';
|
||||
$columns['price_netto']['width'] = '10';
|
||||
$columns['total_netto']['width'] = '10';
|
||||
$columns['ecmvat_name']['width'] = '4';
|
||||
$columns['total_vat']['width'] = '10';
|
||||
$columns['total_brutto']['width'] = '10';
|
||||
|
||||
// rysujemy :)
|
||||
$content .= '
|
||||
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
|
||||
<tr>
|
||||
';
|
||||
|
||||
foreach ($columns as $col) {
|
||||
$content .= '
|
||||
<th style="border: 0.5 solid black; width: ' . $col['width'] . '%;background-color: #E9E9E9;">' . $col['label'] . '</th>
|
||||
';
|
||||
}
|
||||
$content .= '
|
||||
</tr></thead><tbody>
|
||||
';
|
||||
$counter = 1;
|
||||
if ($focus->type == 'normal') {
|
||||
foreach ($positions as $pos) {
|
||||
$content .= '<tr>';
|
||||
foreach ($columns as $col) {
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
|
||||
foreach ($col['field'] as $f) {
|
||||
if ($pk_avaiable && $f == 'product_code') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($f == 'name' && $pk_avaiable) {
|
||||
$pr = new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
//$pos[$f] = $pr->pkwiu;
|
||||
|
||||
|
||||
$content .= '
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left" colspan="2">' . $pos['name'] . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos['product_code'] . '</td>
|
||||
<td style="width:10%;text-align:right">' . $pr->ean . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
continue;
|
||||
} else if ($f == 'recipient_code') {
|
||||
$pr = new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
$content .= $pos[$f] . '<br>' . $pr->pkwiu . '<br>';
|
||||
} else {
|
||||
$content .= $pos[$f] . '<br>';
|
||||
}
|
||||
/* if ($f == 'pkwiu'){
|
||||
|
||||
|
||||
|
||||
} else
|
||||
if (! $pos [$f] || $pos [$f] == '')
|
||||
$pos [$f] = '-'; */
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
foreach ($positions as $pos) {
|
||||
$content .= '<tr>';
|
||||
|
||||
foreach ($columns as $col) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
|
||||
foreach ($col['field'] as $f) {
|
||||
|
||||
if ($pk_avaiable && $f == 'product_code') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($f == 'name' && $pk_avaiable) {
|
||||
$pr = new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
//$pos[$f] = $pr->pkwiu;
|
||||
|
||||
|
||||
$content .= '
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos['name'] . '</td>
|
||||
<td style="width:10%;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%;text-align:left">' . $pos['product_code'] . '</td>
|
||||
<td style="width:10%;text-align:right">' . $pr->ean . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
continue;
|
||||
} else if ($f == 'recipient_code') {
|
||||
$pr = new EcmProduct();
|
||||
$pr->retrieve($pos['ecmproduct_id']);
|
||||
$content .= $pos[$f] . '<br>' . $pr->pkwiu . '<br>';
|
||||
} else {
|
||||
$content .= $pos[$f] . '<br>';
|
||||
}
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr><tr>';
|
||||
// old correct item
|
||||
$pos['name'] = 'było';
|
||||
$pos['total_netto'] = format_number($pos['old_total_netto']);
|
||||
$pos['total_brutto'] = format_number($pos['old_total_brutto']);
|
||||
$pos['total_vat'] = format_number($pos['old_total_vat']);
|
||||
$pos['price_netto'] = format_number($pos['old_price_netto']);
|
||||
$pos['quantity'] = $pos['old_quantity'];
|
||||
|
||||
$pos['position'] = '';
|
||||
$pos['product_code'] = ' ';
|
||||
|
||||
foreach ($columns as $col) {
|
||||
|
||||
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
|
||||
foreach ($col['field'] as $f) {
|
||||
|
||||
if (!$pos[$f] || $pos[$f] == '')
|
||||
$pos[$f] = '-';
|
||||
$content .= $pos[$f] . '<br>';
|
||||
}
|
||||
$content .= '</td>';
|
||||
}
|
||||
$content .= '</tr>';
|
||||
}
|
||||
}
|
||||
$content .= '
|
||||
</tbody></table>
|
||||
';
|
||||
// summary table
|
||||
// get currency symbol
|
||||
$c = new Currency();
|
||||
$c->retrieve($focus->currency_id);
|
||||
$symbol = $c->symbol;
|
||||
unset($c);
|
||||
$content .= '
|
||||
<br>
|
||||
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
|
||||
';
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
<b>VAT (%)</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość netto</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
|
||||
<b>Wartość VAT</b>
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
|
||||
<b>Wartość brutto</b>
|
||||
</td>';
|
||||
|
||||
$content .= '</tr>
|
||||
';
|
||||
$vats = explode(",", $focus->vats_summary);
|
||||
foreach ($vats as $v) {
|
||||
if ($v == '') continue;
|
||||
$v2 = explode(":", $v);
|
||||
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
' . $v2[0] . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
' . format_number($v2[1]) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
' . format_number($v2[2]) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
' . format_number($v2[3]) . '
|
||||
</td></tr>';
|
||||
}
|
||||
|
||||
$total_paid_vat = 0;
|
||||
$total_paid_netto = 0;
|
||||
if ($focus->prepaid > 0) {
|
||||
|
||||
$vat_value = substr($k, 0, -1) + '';
|
||||
if (strlen($vat_value) == 1) $vat_value = '0' . $vat_value;
|
||||
$paid_netto = round($focus->prepaid / 1.23, 2);
|
||||
$paid_vat = $focus->prepaid - $paid_netto;
|
||||
$total_paid_netto += $paid_netto;
|
||||
$total_paid_vat += $paid_vat;
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
23%
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-' . format_number($paid_netto) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-' . format_number($paid_vat) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
-' . format_number($focus->prepaid) . '
|
||||
</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20') {
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
|
||||
' . $v2[0] . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-' . format_number($v2[1]) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
|
||||
-' . format_number($v2[2]) . '
|
||||
</td>
|
||||
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
|
||||
-' . format_number($v2[3]) . '
|
||||
</td></tr>';
|
||||
}
|
||||
// totals
|
||||
$content .= '
|
||||
<tr>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
|
||||
<b>Razem</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto - $total_paid_netto) . '</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_vat - $total_paid_vat) . '</b>
|
||||
</td>
|
||||
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
|
||||
<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_brutto - $focus->prepaid) . '</b>
|
||||
</td></tr>';
|
||||
$left_to_paid = $focus->total_brutto - $focus->paid_val - $focus->prepaid;
|
||||
$content .= '
|
||||
</table>
|
||||
<table style="font-size: 7pt;">
|
||||
';
|
||||
if ($focus->prepaid > 0) {
|
||||
$content .= '<tr><td>FV Przedpłatowa</td><td style="text-align: right;"><b>' . $focus->prepaid_nr . '</b></td></tr>';
|
||||
}
|
||||
if ($focus->total_brutto > 0) {
|
||||
$content .= '
|
||||
<tr><td>' . $labels['LBL_PDF_TO_PAY'] . '</td><td style="text-align: right;"><b>' . format_number($focus->total_brutto) . ' ' . $symbol . '</b></td><td></td></tr>';
|
||||
} else {
|
||||
$content .= '
|
||||
<tr><td>' . $labels['LBL_PDF_PAID_RETURN'] . '</td><td style="text-align: right;"><b>' . format_number(abs($focus->total_brutto)) . ' ' . $symbol . '</b></td><td></td></tr>';
|
||||
}
|
||||
if ($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20') {
|
||||
$left_to_paid = '0';
|
||||
$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>8.610,00 ' . $symbol . '</b> </td><td>Nr FK 001/14</td></tr>';
|
||||
}
|
||||
if ($focus->prepaid > 0) {
|
||||
$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>' . format_number($focus->prepaid) . ' ' . $symbol . '</b></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($focus->paid_val != '' && $focus->id != 'c2d7473a-c0b8-6718-0947-54993423de20') {
|
||||
if ($focus->paid_val != 0) $pay_text = $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
|
||||
if ($focus->type == 'normal') {
|
||||
$content .= '<tr><td>' . $labels['LBL_PDF_PAID'] . '</td><td style="text-align: right;"><b>' . format_number(abs($focus->paid_val)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $pay_text . '</td></tr>';
|
||||
} else {
|
||||
$content .= '<tr><td>Zwrócono:</td><td style="text-align: right;"><b>' . format_number(abs($focus->paid_val)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $pay_text . '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($focus->ecmpaymentcondition_id != '') {
|
||||
|
||||
$q = $db->query("select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'");
|
||||
$r = $db->fetchByAssoc($q);
|
||||
$paid_text = 'w Terminie <b>' . $r['name'] . '</b> do <b>' . date('d.m.Y', strtotime($focus->payment_date)) . '</b> ' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
} else {
|
||||
if ($focus->payment_date != '') {
|
||||
|
||||
$dni = (strtotime($focus->payment_date) - strtotime($focus->register_date)) / (3600 * 24);
|
||||
$paid_text = 'w Terminie <b>' . round($dni) . ' dni</b> do <b>' . date('d.m.Y', strtotime($focus->payment_date)) . '</b> ' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_REQUEST['pdf_type'] == '1')
|
||||
$focus->pdf_text .= PHP_EOL . "<br>Duplikat wystawiony dnia: " . ($focus->id == '2f55c9e1-1b0d-3856-2552-57f34edef340' ? date('30.09.Y') : date('d.m.Y'));
|
||||
|
||||
if (abs($left_to_paid) >= 0) $content .= '<tr><td>' . $labels['LBL_PDF_LEFT_TO_PAID'] . '</td><td style="text-align: right;"><b>' . format_number(abs($left_to_paid)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . (round(abs($left_to_paid)) == 0 ? "" : $paid_text) . '</td></tr>
|
||||
';
|
||||
if ($focus->pdf_type != "K") {
|
||||
$z = $db->query("select * from currency_nbp_archive where nbp_table_name='" . $focus->currency_table . "'");
|
||||
$dddd = $db->fetchByAssoc($z);
|
||||
$content .= '<tr><td>Kurs: </td><td colspan="2"><b>' . $focus->currency_value_nbp . '</b> z dnia <b>' . date("d.m.Y", strtotime($dddd['date'])) . '</b> wg tabeli kursu NBP <b>' . $focus->currency_table . '</b></td></tr>
|
||||
';
|
||||
}
|
||||
$z = $focus->db->query("select value2 from operating_values where value0='bankAccount' and value9='" . $focus->bankaccount . "'");
|
||||
$dan2 = $focus->db->fetchByAssoc($z);
|
||||
|
||||
$accc = new Account();
|
||||
$accc->retrieve($focus->parent_id);
|
||||
|
||||
if ($accc->parent_id == 1249) {
|
||||
$content .= '<tr><td>Konto bankowe nr:</td><td colspan="2" style="text-align:right"><b>ING Bank Śląski S.A. PL49 1050 1025 1000 0090 3129 6339</b></td></tr>';
|
||||
} else {
|
||||
if ($focus->bankaccount != "" && $focus->payment_method == 'PRZELEW') {
|
||||
$content .= '<tr><td>Konto bankowe nr:</td><td colspan="2" style="text-align:right"><b>' . ($dan2['value2'] != "" ? $dan2['value2'] . " " : "") . $focus->bankaccount . '</b></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$u = new User();
|
||||
|
||||
$u->retrieve($focus->assigned_user_id);
|
||||
if ($focus->type == 'normal') {
|
||||
$content .= '<tr><td>' . $labels['LBL_PDF_CONTENT_ISSUED_BY'] . '</td><td><b>' . $u->first_name . ' ' . $u->last_name . '</b></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$content .= '</table>';
|
||||
|
||||
if ($focus->pdf_text != '' && $focus->type == 'correct') {
|
||||
$content .= '<table style="font-size: 12pt;vertical-align: top;">';
|
||||
$content .= "<tr><td>Tytułem:</td><td>" . $focus->pdf_text . "</td></tr>";
|
||||
$content .= '</table>';
|
||||
} else {
|
||||
if ($focus->pdf_text != '') {
|
||||
$content .= '<table style="font-size: 8pt;">';
|
||||
$content .= "<tr><td>" . $focus->pdf_text . "</td></tr>";
|
||||
$content .= '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($focus->type == 'correct') {
|
||||
$content .= '<br>
|
||||
<table style="width:100%;font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="text-align:center;"><b>' . $focus->assigned_user_name . '</b></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
|
||||
</tr>
|
||||
</table>';
|
||||
} else {
|
||||
$EcmSysInfo = new EcmSysInfo();
|
||||
if ($EcmSysInfo->getDatabaseName() == 'preDb_5d9477918f845c6fdc25532d415f9e73') {
|
||||
$content .= '<br>
|
||||
<table style="width:100%;font-size: 7pt;">
|
||||
<tr>
|
||||
<td style="text-align:center;"><b>' . $focus->assigned_user_name . '</b></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
<td style="text-align:center;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
|
||||
<td style="width:10%;text-align:center"></td>
|
||||
<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
}
|
||||
|
||||
//echo $content; die();
|
||||
10
modules/EcmInvoiceOuts/PDFTemplate/types.php
Executable file
10
modules/EcmInvoiceOuts/PDFTemplate/types.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
global $pdf_types;
|
||||
$pdf_types = array(
|
||||
'0' => 'Faktura',
|
||||
'1' => 'Duplikat',
|
||||
'lr' => 'Lista przychodowo/rozchodowa',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
131
modules/EcmInvoiceOuts/Report_INTRASTAT.php
Executable file
131
modules/EcmInvoiceOuts/Report_INTRASTAT.php
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
// ini_set('display_errors', 1);
|
||||
// ini_set('display_startup_errors', 1);
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
require_once ('include/time.php');
|
||||
require_once ('include/json_config.php');
|
||||
|
||||
$json_config = new json_config ();
|
||||
$db = $GLOBALS['db'];
|
||||
$process = false;
|
||||
|
||||
$edit->ss = new Sugar_Smarty ();
|
||||
|
||||
if ($_POST['process']) {
|
||||
$where = "YEAR(i.register_date)=".$_POST['year']." AND MONTH(i.register_date)=".$_POST['month']."
|
||||
AND i.pdf_type='U' AND i.deleted=0 AND i.canceled=0";
|
||||
$process = true;
|
||||
$invoices = getInvoices($db, $where);
|
||||
$badProducts = getBadProducts($db, $where);
|
||||
$data = getData($db, $where);
|
||||
$edit->ss->assign("data", $data );
|
||||
$edit->ss->assign("invoices", $invoices);
|
||||
$edit->ss->assign("badProducts", $badProducts);
|
||||
}
|
||||
|
||||
if ($_POST['xml']) {
|
||||
$month = $_POST['xml_month'];
|
||||
if (strlen($month) == 1) {
|
||||
$month = '0'.$month;
|
||||
}
|
||||
$where = "YEAR(i.register_date)=".$_POST['xml_year']." AND MONTH(i.register_date)=".$_POST['xml_month']."
|
||||
AND i.pdf_type='U' AND i.deleted=0 AND i.canceled=0";
|
||||
ob_end_clean();
|
||||
header_remove();
|
||||
header("Content-type: text/xml");
|
||||
header('Content-Disposition: attachment; filename="01'.$month.''.$_POST['xml_year'].'TWIN.xml"');
|
||||
$data = getData($db, $where);
|
||||
$edit->ss->assign("month", $month);
|
||||
$edit->ss->assign("year", $_POST['xml_year']);
|
||||
$edit->ss->assign("today", date("Y").'-'.date("m").'-'.date('d'));
|
||||
$edit->ss->assign("data", $data );
|
||||
$edit->ss->assign("total", array_reduce($data, "sum"));
|
||||
$edit->ss-> display('modules/EcmInvoiceOuts/tpls/Report_INTRASTAT_XML.tpl');
|
||||
exit();
|
||||
} else {
|
||||
$edit->ss->assign("process", $process);
|
||||
if ($_POST['process']) {
|
||||
$edit->ss->assign("year", $_POST['year']);
|
||||
$edit->ss->assign("month", $_POST['month']);
|
||||
} else {
|
||||
$edit->ss->assign("year", date("Y"));
|
||||
$edit->ss->assign("month", date("m"));
|
||||
}
|
||||
$edit->module = 'EcmInvoiceOuts';
|
||||
$edit->ss-> display('modules/EcmInvoiceOuts/tpls/Report_INTRASTAT.tpl');
|
||||
}
|
||||
function sum($carry, $item) {
|
||||
$carry += $item['total'];
|
||||
return $carry;
|
||||
}
|
||||
function getData($db, $where) {
|
||||
$data = [];
|
||||
$res = $db->query("SELECT i.document_no, i.parent_id, i.parent_nip as nip,
|
||||
REPLACE(SUBSTRING(p.pkwiu, 3),' ','') as pkwiu, ROUND(SUM(ii.quantity * p.qty_per_unit)) as qty_intrastat,SUBSTRING(i.parent_nip, 1, 2) as country,
|
||||
ROUND(SUM(p.product_brutto_weight * ii.quantity)) as weight, ROUND(SUM(ii.total_netto * i.currency_value_nbp)) as total
|
||||
FROM ecminvoiceoutitems as ii
|
||||
INNER JOIN ecminvoiceouts AS i ON i.id = ii.ecminvoiceout_id
|
||||
INNER JOIN accounts AS a ON a.id=i.parent_id
|
||||
INNER JOIN ecmproducts as p ON p.id = ii.ecmproduct_id
|
||||
WHERE ".$where."
|
||||
AND p.ks_group <> 3
|
||||
GROUP BY i.parent_nip, p.pkwiu
|
||||
ORDER BY i.register_date;");
|
||||
|
||||
global $app_list_strings;
|
||||
$intrastat_codes = $app_list_strings['intrastat_codes_list'];
|
||||
|
||||
$position = 1;
|
||||
while($r = $db->fetchByAssoc ( $res )) {
|
||||
$item = array();
|
||||
$item['position'] = $position;
|
||||
$item['pkwiu'] = $r['pkwiu'];
|
||||
$item['description'] = $intrastat_codes[$r['pkwiu']];
|
||||
$item['nip'] = $r['nip'];
|
||||
$item['country'] = $r['country'];
|
||||
$item['weight'] = $r['weight'];
|
||||
$item['total'] = $r['total'];
|
||||
$item['qty_intrastat'] = $r['qty_intrastat'];
|
||||
array_push($data, $item);
|
||||
$position++;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
function getInvoices($db, $where) {
|
||||
$invoices = [];
|
||||
$invoicesRes = $db->query("SELECT id, document_no FROM ecminvoiceouts as i WHERE ".$where." ORDER BY i.register_date");
|
||||
while ($r = $db->fetchByAssoc($invoicesRes)) {
|
||||
$item = array();
|
||||
$item['id'] = $r['id'];
|
||||
$item['document_no'] = $r['document_no'];
|
||||
array_push($invoices, $item);
|
||||
}
|
||||
return $invoices;
|
||||
}
|
||||
function getBadProducts($db, $where) {
|
||||
$badProducts = [];
|
||||
$productsRes = $db->query("SELECT p.id as id, p.code as code, p.name as name, p.pkwiu as pkwiu, p.product_brutto_weight as weight
|
||||
FROM ecminvoiceoutitems as ii
|
||||
INNER JOIN ecmproducts as p ON p.id = ii.ecmproduct_id
|
||||
INNER JOIN ecminvoiceouts as i ON i.id = ii.ecminvoiceout_id
|
||||
WHERE ".$where."
|
||||
AND (p.ks_group = 1 OR p.ks_group = 2)
|
||||
AND (p.pkwiu IS NULL OR p.pkwiu = '' OR p.product_brutto_weight IS NULL OR p.product_brutto_weight = '')
|
||||
GROUP BY p.code ORDER BY p.code");
|
||||
while ($r = $db->fetchByAssoc($productsRes)) {
|
||||
$item = array();
|
||||
$item['id'] = $r['id'];
|
||||
$item['code'] = $r['code'];
|
||||
$item['name'] = $r['name'];
|
||||
$item['pkwiu'] = $r['pkwiu'];
|
||||
$item['weight'] = $r['weight'];
|
||||
array_push($badProducts, $item);
|
||||
}
|
||||
return $badProducts;
|
||||
}
|
||||
|
||||
?>
|
||||
139
modules/EcmInvoiceOuts/Save.php
Executable file
139
modules/EcmInvoiceOuts/Save.php
Executable file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
|
||||
* with the License. You may obtain a copy of the License at
|
||||
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
|
||||
* either express or implied.
|
||||
|
||||
*
|
||||
|
||||
* You may:
|
||||
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
|
||||
* a royalty or other fee.
|
||||
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
|
||||
* publicly available and document your modifications clearly.
|
||||
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
|
||||
* obligations for your customers.
|
||||
|
||||
*
|
||||
|
||||
* You may NOT:
|
||||
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
|
||||
* Provider).
|
||||
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
|
||||
* involves PHYSICAL media.
|
||||
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
|
||||
* or License text in the Licensed Software
|
||||
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
|
||||
* Licensed Software.
|
||||
|
||||
*
|
||||
|
||||
* You must:
|
||||
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
|
||||
*
|
||||
|
||||
* The Original Code is: CommuniCore
|
||||
|
||||
* Olavo Farias
|
||||
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
|
||||
* All Rights Reserved.
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
$json = getJSONobj();
|
||||
require_once("modules/EcmInvoiceOuts/EcmInvoiceOut.php");
|
||||
require_once('include/formbase.php');
|
||||
$focus = new EcmInvoiceOut();
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['record']) && $_POST['record'] != '') {
|
||||
$focus->retrieve($_POST['record']);
|
||||
}
|
||||
|
||||
if(!$focus->ACLAccess('Save')){
|
||||
ACLController::displayNoAccess(true);
|
||||
sugar_cleanup(true);
|
||||
}
|
||||
$check_notify = FALSE;
|
||||
|
||||
foreach($focus->column_fields as $field){
|
||||
if(isset($_POST[$field])){
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($focus->additional_column_fields as $field){
|
||||
if(isset($_POST[$field])){
|
||||
$value = $_POST[$field];
|
||||
$focus->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$focus->position_list = $json->decode(htmlspecialchars_decode($_POST['position_list']));
|
||||
// die(var_dump( $focus->position_list));
|
||||
$focus->save($check_notify);
|
||||
|
||||
$return_id = $focus->id;
|
||||
|
||||
echo $return_id;
|
||||
|
||||
handleRedirect($return_id,'EcmInvoiceOuts');
|
||||
?>
|
||||
27
modules/EcmInvoiceOuts/bimit_sendInvoiceToAllegro.php
Normal file
27
modules/EcmInvoiceOuts/bimit_sendInvoiceToAllegro.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// https://crm.twinpol.com/index.php?module=EcmInvoiceOuts&action=bimit_sendInvoiceToAllegro&record=a1a26133-6111-ce47-7c12-660fcc41e492
|
||||
|
||||
$invoice = new EcmInvoiceOut();
|
||||
$invoice->retrieve($_REQUEST['record']);
|
||||
|
||||
$sale = new EcmSale();
|
||||
$sale->retrieve($invoice->so_id.'1');
|
||||
|
||||
if ($sale->order_source != 'allegro') {
|
||||
echo "Faktura nie dotyczy zamówienia Allegro!";
|
||||
return;
|
||||
}
|
||||
|
||||
var_dump($sale->order_source);
|
||||
|
||||
return;
|
||||
|
||||
/*
|
||||
getBlob() {
|
||||
$EcmInvoiceOut = new EcmInvoiceOut();
|
||||
|
||||
$file_location = $EcmInvoiceOut->get_PDF_file_path($_REQUEST['pdf_type']);
|
||||
$blob= file_get_contents($file_location);
|
||||
var_dump($pdfData);
|
||||
}
|
||||
*/
|
||||
10
modules/EcmInvoiceOuts/calculatePurchase.php
Executable file
10
modules/EcmInvoiceOuts/calculatePurchase.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$db=$GLOBALS['db'];
|
||||
$r=$db->query("select * from ecminvoiceouts");
|
||||
while($a=$db->fetchByAssoc($r)){
|
||||
$db->query("update ecminvoiceouts set purchase_price=(select round(sum(quantity*price_purchase),2) as sum from ecminvoiceoutitems
|
||||
where ecminvoiceout_id='".$a['id']."') where id='".$a['id']."'
|
||||
");
|
||||
}
|
||||
?>
|
||||
35
modules/EcmInvoiceOuts/createCatalogue.php
Executable file
35
modules/EcmInvoiceOuts/createCatalogue.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
set_time_limit (99999999);
|
||||
ini_set('memory_limit', '-1');
|
||||
include_once("modules/EcmProducts/productCardUltraNew.php");
|
||||
include_once("include/MPDF57/mpdf.php");
|
||||
$p=new mPDF('utf-8','A4-L', null, 'helvetica');
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select c.iso4217 as s from currencies as c inner join ecminvoiceouts as q on q.currency_id=c.id where q.id='".$_REQUEST['record']."'"));
|
||||
$symbol=$rr['s'];
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$focus = new EcmInvoiceOut();
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
if ($focus->ecmlanguage=='pl_pl')
|
||||
$lang = "pl";
|
||||
if ($focus->ecmlanguage=='en_us')
|
||||
$lang = "en";
|
||||
|
||||
$products = $db->query("SELECT id,ecmproduct_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id='".$_REQUEST['record']."' AND deleted='0' ORDER BY position");
|
||||
|
||||
while ($prod = $db->fetchByAssoc($products)) {
|
||||
$p=productCardNew($p,$prod['ecmproduct_id'],$lang,true,true,"",$symbol,true, $_REQUEST['show_ean'], $prod['id'], "EcmInvoiceOuts");
|
||||
}
|
||||
|
||||
if($_REQUEST['create_img']==1){
|
||||
$guid=create_guid();
|
||||
$type="F";
|
||||
$file="cache/upload/Catalogue".$guid.".pdf";
|
||||
}
|
||||
else{
|
||||
$type="D";
|
||||
$file="Catalogue".date("YmdHi").".pdf";
|
||||
}
|
||||
$p->Output($file,$type);
|
||||
231
modules/EcmInvoiceOuts/createPDF.php
Executable file
231
modules/EcmInvoiceOuts/createPDF.php
Executable file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
global $current_user;
|
||||
if ($current_user->id == '4965a9d3419a3f09b5e2d4135e664700') {
|
||||
//ini_set('display_errors',1);
|
||||
}
|
||||
if ($_REQUEST['createBlob']) {
|
||||
$type = 'BLOB';
|
||||
} else {
|
||||
$type = isset($_REQUEST['file']) ? 'FILE' : 'BROSWER';
|
||||
}
|
||||
if ($_REQUEST['action'] == 'createPDF') {
|
||||
|
||||
$EcmSysInfo = new EcmSysInfo();
|
||||
if ($EcmSysInfo->getDatabaseName() == 'preDb_60b08fe051546309b61d2714d4a0438d') {
|
||||
newPDFCreator($_REQUEST['record'], $type);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($EcmSysInfo->getDatabaseName() == 'preDb_8a7e080a76ef97c3e304cf463118ef9b') {
|
||||
$EcmInvoiceOut = new EcmInvoiceOut();
|
||||
$EcmInvoiceOut->retrieve($_GET['record']);
|
||||
|
||||
header("Location: " . $EcmInvoiceOut->get_PDF_file_path($_REQUEST['pdf_type']));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($EcmSysInfo->getDatabaseName() == 'preDb_0dcc87940d3655fa574b253df04ca1c3') {
|
||||
$EcmInvoiceOut = new EcmInvoiceOut();
|
||||
$EcmInvoiceOut->retrieve($_GET['record']);
|
||||
|
||||
if ($EcmInvoiceOut->pdf_type != 'K' && $EcmInvoiceOut->ecmlanguage == 'en_us' && $EcmInvoiceOut->type == 'normal') {
|
||||
|
||||
createEngFv($EcmInvoiceOut);
|
||||
}
|
||||
}
|
||||
|
||||
createEcmInvoiceOutPdf($_REQUEST['record'], $type);
|
||||
}
|
||||
|
||||
function newPDFCreator($record, $outputtype, $save = null)
|
||||
{
|
||||
if ($record == '') {
|
||||
echo "Brak rekordu";
|
||||
}
|
||||
|
||||
//Sprawdzamy czy katalog istneje jak nie to tworzymy
|
||||
$EcmSysInfo = new EcmSysInfo();
|
||||
$dir = 'upload/' . $EcmSysInfo->getDatabaseName() . '/pdf/EcmInvoiceOuts/';
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir, '755', true);
|
||||
}
|
||||
//Pobieramy fakturke z bazy
|
||||
$EcmInvoiceOut = new EcmInvoiceOut();
|
||||
$EcmInvoiceOut->retrieve($record);
|
||||
|
||||
// Tworzymy nazwe pliku
|
||||
$data_array = explode(".", $EcmInvoiceOut->register_date);
|
||||
$prefix = "FK";
|
||||
$infix = $data_array[2] . $data_array[1] . $data_array[0];
|
||||
$suffix = str_replace('/', '', (str_replace(' ', '', $EcmInvoiceOut->document_no)));
|
||||
|
||||
|
||||
$file_name = $prefix . "_" . $infix . "_" . $suffix . '.pdf';
|
||||
|
||||
//Sprawdzam czy pdf juz istnieje
|
||||
if (file_exists($dir . $file_name) && $save == null) {
|
||||
header("Location: " . $file_location);
|
||||
return;
|
||||
}
|
||||
// jak nie to tworzmy : )
|
||||
include_once("include/MPDF57/mpdf.php");
|
||||
|
||||
if (file_exists('custom/' . $EcmSysInfo->getDatabaseName() . '/pdf_teplate/EcmInviceoutContent.tpl')) {
|
||||
if ($EcmInvoiceOut->type == 'normal') {
|
||||
global $mod_strings, $app_list_strings;
|
||||
include_once("modules/EcmKpkw/PDFTemplate/kwota.php");
|
||||
$kwota = new KwotaSlownie();
|
||||
|
||||
$slownieKwota = $kwota->convertPrice(floatval($EcmInvoiceOut->total_brutto));
|
||||
$EcmInvoiceOut->position_list = $EcmInvoiceOut->getPositionList(true);
|
||||
$vats_array = explode(",", $EcmInvoiceOut->vats_summary);
|
||||
|
||||
foreach ($vats_array as $key => $value) {
|
||||
if ($value == "") {
|
||||
unset($vats_array[$key]);
|
||||
continue;
|
||||
}
|
||||
$vats_array[$key] = explode(":", $value);
|
||||
}
|
||||
|
||||
$EcmInvoiceOut->vats_summary = $vats_array;
|
||||
|
||||
$tmp = explode(".", $EcmInvoiceOut->register_date);
|
||||
$EcmInvoiceOut->register_date = $tmp[2] . "-" . $tmp[1] . "-" . $tmp[0];
|
||||
|
||||
$tmp = explode(".", $EcmInvoiceOut->sell_date);
|
||||
$EcmInvoiceOut->sell_date = $tmp[2] . "-" . $tmp[1] . "-" . $tmp[0];
|
||||
|
||||
$smarty = new Sugar_Smarty();
|
||||
|
||||
if ($_REQUEST['pdf_type'] == '1') {
|
||||
$duplikat = "<br>Duplikat wystawiony dnia: <b>" . date('d.m.Y') . '</b>';
|
||||
$smarty->assign("duplikat", $duplikat);
|
||||
}
|
||||
|
||||
$smarty->assign("MOD", $mod_strings);
|
||||
$smarty->assign("APP_LIST_STRINGS", $app_list_strings);
|
||||
$smarty->assign("DATA", $data);
|
||||
$smarty->assign("EcmSysInfo", $EcmSysInfo);
|
||||
$smarty->assign("EcmInvoiceOut", $EcmInvoiceOut);
|
||||
$smarty->assign("slownieKwota", $slownieKwota);
|
||||
$content = $smarty->fetch('custom/' . $EcmSysInfo->getDatabaseName() . '/pdf_teplate/EcmInviceoutContent.tpl');
|
||||
|
||||
$mPDF = new mPDF('pl', 'A4', 9, 'arial', 10, 10, 125, 20, 14, 20);
|
||||
$mPDF->setAutoTopMargi = 'stretch';
|
||||
$mPDF->setAutoBottomMargin = 'stretch';
|
||||
$mPDF->mirrorMargins = 1;
|
||||
$mPDF->WriteHTML($content);
|
||||
//echo $content;
|
||||
if ($save == true) {
|
||||
$mPDF->Output($file_name, "F");
|
||||
return $file_name;
|
||||
} else {
|
||||
$mPDF->Output($file_name, "I");
|
||||
}
|
||||
} else {
|
||||
|
||||
createEcmInvoiceOutPdf($record, $outputtype);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
/* foreach($EcmInvoiceOut as $key => $val){
|
||||
echo $key . '<Br>';
|
||||
var_dump($val);
|
||||
echo '<Br><Br>';
|
||||
}*/
|
||||
}
|
||||
|
||||
function createEcmInvoiceOutPdf($record, $outputtype)
|
||||
{
|
||||
$EcmInvoiceOut = new EcmInvoiceOut();
|
||||
$EcmInvoiceOut->retrieve($record);
|
||||
var_dump($record);
|
||||
$file_location = $EcmInvoiceOut->get_PDF_file_path($_REQUEST['pdf_type']);
|
||||
$EcmSysInfo = new EcmSysInfo();
|
||||
/*
|
||||
if($EcmSysInfo->getDatabaseName() == 'preDb_60b08fe051546309b61d2714d4a0438d'){
|
||||
$file_location=newPDFCreator($record, $type,true);
|
||||
} */
|
||||
// return;
|
||||
switch ($outputtype) {
|
||||
case "BROSWER":
|
||||
header("Location: " . $file_location);
|
||||
return true;
|
||||
case "FILE":
|
||||
$path = $file_location;
|
||||
break;
|
||||
case "EMAIL":
|
||||
include_once 'include/ECM/EcmSendMail/EcmSendMail.inc';
|
||||
$path = EcmSendMail::TEMP_DIR . 'ZS_' . $EcmInvoiceOut->number . '.pdf';
|
||||
//$path=EcmSendMail::$file_location;
|
||||
copy($file_location, $path);
|
||||
break;
|
||||
case "MULTIPDF":
|
||||
include_once 'include/ECM/EcmMultiPdf/EcmMultiPdf.inc';
|
||||
$path = EcmMultiPdf::TEMP_DIR . 'EcmSales_' . $focus->id . '_' . create_guid() . '.pdf';
|
||||
copy($file_location, $path);
|
||||
break;
|
||||
case "BLOB":
|
||||
var_dump($file_location);
|
||||
$pdfData = file_get_contents($file_location);
|
||||
var_dump($pdfData);
|
||||
break;
|
||||
};
|
||||
return $file_location;
|
||||
}
|
||||
|
||||
function createEngFv($focus)
|
||||
{
|
||||
|
||||
include_once("modules/EcmInvoiceOuts/PDFTemplate/helper.php");
|
||||
|
||||
$user = new User();
|
||||
$user->retrieve($focus->assigned_user_id);
|
||||
$labels = return_module_language($focus->ecmlanguage, 'EcmInvoiceOuts');
|
||||
include_once("include/MPDF57/mpdf.php");
|
||||
$p = new mPDF('', 'A4', null, 'helvetica', 10, 10, 30, 45, 5, 5);
|
||||
$mpdf->mirrorMargins = 1;
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
// document pdf
|
||||
// document already exist?
|
||||
$recipient_code = 0;
|
||||
foreach ($focus->getPositionList(true) as $k => $v) {
|
||||
if ($v['recipient_code'] != '') {
|
||||
$recipient_code = 1;
|
||||
}
|
||||
}
|
||||
$recipient_code;
|
||||
$res = $db->query("SELECT footer, content, header FROM ecminvoiceout_pdf WHERE id='$record'");
|
||||
if ($res->num_rows == 0) {
|
||||
// create and save document
|
||||
$positions = formatPDFPositionsEng($focus->getPositionList(true), $focus);
|
||||
$header = '';
|
||||
$footer = '';
|
||||
$content = '';
|
||||
include_once("modules/EcmInvoiceOuts/PDFTemplate/tpl/header_en.php");
|
||||
include_once("modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en.php");
|
||||
include_once("modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-en_us.php");
|
||||
|
||||
global $current_user, $app_list_strings;
|
||||
|
||||
$db->query("INSERT INTO ecminvoiceout_pdf VALUES ('$record','$current_user->id', NOW(),'" . urlencode($footer) . "', '" . urlencode($content) . "', '" . urlencode($header) . "')");
|
||||
} else {
|
||||
$row = $db->fetchByAssoc($res);
|
||||
$footer = urldecode($row['footer']);
|
||||
$header = urldecode($row['header']);
|
||||
$content = urldecode($row['content']);
|
||||
}
|
||||
|
||||
$p->SetHTMLHeader($header);
|
||||
$p->SetHTMLFooter($footer);
|
||||
$p->WriteHTML($content);
|
||||
//echo $content;
|
||||
// draw PDF
|
||||
$filename = str_replace(" ", "_", str_replace("/", "_", $focus->document_no));
|
||||
$p->Output($filename . '.pdf', 'I');
|
||||
die();
|
||||
}
|
||||
205
modules/EcmInvoiceOuts/createXLS.php
Executable file
205
modules/EcmInvoiceOuts/createXLS.php
Executable file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
set_time_limit(999999);
|
||||
|
||||
include_once("modules/EcmInvoiceOuts/EcmInvoiceOut.php");
|
||||
include_once("modules/EcmDocumentTemplates/EcmDocumentTemplate.php");
|
||||
$q=new EcmInvoiceOut();
|
||||
$q->retrieve($_REQUEST['record']);
|
||||
|
||||
require_once('modules/EcmTexts/EcmText.php');
|
||||
if(isset($q->ecmlanguage) && $q->ecmlanguage != '') {
|
||||
$data = EcmText::LoadText(null,null,"EcmInvoiceOuts",$q->ecmlanguage);
|
||||
if(isset($data[0]) && isset($data[0]['data']) && isset($data[0]['data']['labels'])) {
|
||||
$data = $data[0]['data']['labels'];
|
||||
foreach($data as $key => $value) {
|
||||
$mod_strings[$value['label']] = $value['translation'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$t=new EcmDocumentTemplate();
|
||||
$t=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$q->template_id."'"));
|
||||
|
||||
set_include_path('include/PHPExcel/');
|
||||
|
||||
include 'PHPExcel.php';
|
||||
include 'PHPExcel/Writer/Excel2007.php';
|
||||
include 'PHPExcel/IOFactory.php';
|
||||
|
||||
$objPHPExcel = new PHPExcel();
|
||||
$objPHPExcel->getProperties()->setCreator("E5 CRM");
|
||||
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
|
||||
$objPHPExcel->getProperties()->setTitle("Office 2007 QUOTE");
|
||||
$objPHPExcel->getProperties()->setSubject("Office 2007 QUOTE");
|
||||
$objPHPExcel->getProperties()->setDescription("QUOTE");
|
||||
|
||||
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(50);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(10);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
|
||||
|
||||
|
||||
|
||||
|
||||
$t->footer_text=str_replace("/$dt_account_name",$t['account_name'],$t['footer_text']);
|
||||
$ftt=explode("
|
||||
",$t['footer_text']);
|
||||
foreach($ftt as $ft){
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ft);
|
||||
}
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A1',$t['account_name']);
|
||||
$i+=2;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_QUOTE_FOR']);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_NUMBER']);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$q->parent_name);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->document_no);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_DATE_REGISTER']);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->register_date);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_OWNER']);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->assigned_user_name);
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setSize(24);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$q->name);
|
||||
|
||||
$i+=2;
|
||||
|
||||
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
|
||||
array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('argb' => 'FFCCFFCC')
|
||||
),
|
||||
'borders' => array(
|
||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
||||
)
|
||||
),
|
||||
"A".$i.":G".$i
|
||||
);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('B'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('D'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('E'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_LIST_POSITION']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$mod_strings['LBL_PDF_LIST_CODE']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$mod_strings['LBL_PDF_LIST_DESCRIPTION']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$mod_strings['LBL_PDF_LIST_QUANTITY']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$mod_strings['LBL_PDF_LIST_UNIT']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_LIST_PRICE']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_LIST_TOTAL']);
|
||||
|
||||
|
||||
$ii++;
|
||||
$i++;
|
||||
//$lv=return_app_list_strings_language($this->ecmlanguage);
|
||||
$ww=$GLOBALS['db']->query("select * from ecminvoiceoutitems where ecminvoiceout_id='".$q->id."' and deleted='0'");
|
||||
while($p=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position='0'");
|
||||
if(mysql_num_rows($w)>0){
|
||||
$r=$GLOBALS['db']->fetchByAssoc($w);
|
||||
$p_name=$r['name'];
|
||||
$p_code=$r['code'];
|
||||
}
|
||||
else {
|
||||
$p_name=$p['name'];
|
||||
$p_code=$p['code'];
|
||||
}
|
||||
|
||||
$total_netto+=$p['price']*$p['quantity'];
|
||||
$total_vat+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
|
||||
$vats[$p['ecmvat_value']]+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
|
||||
if($q->show_ean)$p_code.='
|
||||
'.$p['ean'];
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ii);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$p_code);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$p_name);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$p['quantity']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$p['dd_unit_id']]);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$p['price']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$p['total']);
|
||||
|
||||
if($p['ecmproduct_id']){
|
||||
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position>0 order by name asc");
|
||||
if(mysql_num_rows($w)>0){
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,"+");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$r['code']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$r['name']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$r['quantity']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$r['dd_unit_id']]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$ii++;
|
||||
}
|
||||
|
||||
$sumary_start=$i;
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_TOTAL']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$total_netto);
|
||||
foreach($vats as $k=>$v){
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_VAT']." (".$k."%)");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$v);
|
||||
}
|
||||
$i++;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_END_TOTAL']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,($total_netto+$total_vat));
|
||||
|
||||
$summary_end=$i;
|
||||
|
||||
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
|
||||
array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('argb' => 'FFCCFFCC')
|
||||
),
|
||||
'borders' => array(
|
||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
||||
)
|
||||
),
|
||||
"F".$sumary_start.":G".$summary_end
|
||||
);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Simple');
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
chmod("cache/upload",0777);
|
||||
$microtime=str_replace(".","",str_replace(" ","",microtime()));
|
||||
$name="cache/upload/Quote".$microtime.".xlsx";
|
||||
$objWriter->save($name);
|
||||
chmod($name,0777);
|
||||
|
||||
header("Location: ".$name);
|
||||
?>
|
||||
22
modules/EcmInvoiceOuts/ecommerce.php
Normal file
22
modules/EcmInvoiceOuts/ecommerce.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if (isset($_REQUEST['import_baselinker'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/importBaselinkerInvoices.php');
|
||||
} else if (isset($_REQUEST['import_amazon'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/importAmazonVATReport.php');
|
||||
} else if (isset($_REQUEST['wdt'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/wdtReader.php');
|
||||
} else if (isset($_REQUEST['report'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/report.php');
|
||||
} else if (isset($_REQUEST['local-vat'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/localVatReader.php');
|
||||
} else if (isset($_REQUEST['b2b'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/B2BReader.php');
|
||||
} else if (isset($_REQUEST['wz-local-vat'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/vatLocalWZ.php');
|
||||
} else if (isset($_REQUEST['wnt'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/wntReader.php');
|
||||
} else if (isset($_REQUEST['amazon-wz'])) {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/amazonWDT/amazonWZ.php');
|
||||
} else {
|
||||
include_once(getcwd().'/modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/ecommerceInvoicesListView.php');
|
||||
}
|
||||
539
modules/EcmInvoiceOuts/edi/createInvoiceXML.php
Normal file
539
modules/EcmInvoiceOuts/edi/createInvoiceXML.php
Normal file
@@ -0,0 +1,539 @@
|
||||
<?php
|
||||
class invoiceEdiXML
|
||||
{
|
||||
|
||||
private $xml;
|
||||
private $id;
|
||||
private $i;
|
||||
|
||||
private $ediInvoicesPath = '/var/edi/twinpol/invoices/';
|
||||
|
||||
function invoiceEdiXML ($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->i = new EcmInvoiceOut();
|
||||
$this->i->retrieve($this->id);
|
||||
}
|
||||
|
||||
public function getXML () {
|
||||
$i = $this->i;
|
||||
if ($i->type == 'normal')
|
||||
$this->xml = $this->createInvoiceXML();
|
||||
elseif ($i->type == 'correct')
|
||||
$this->xml = $this->createCorrectInvoiceXML();
|
||||
|
||||
$this->xml->flush();
|
||||
}
|
||||
|
||||
private function createInvoiceXML () {
|
||||
global $timedate;
|
||||
$db = $GLOBALS['db'];
|
||||
$i = $this->i;
|
||||
// get data
|
||||
// get WZ && Sale info
|
||||
$wz = $db->fetchByAssoc($db->query(
|
||||
"SELECT
|
||||
parent_id, document_no, register_date, so_id
|
||||
FROM ecmstockdocouts WHERE id ='$i->wz_id'"));
|
||||
$sale = $db->fetchByAssoc(
|
||||
$db->query(
|
||||
"SELECT document_no, register_date, parent_document_no FROM ecmsales WHERE id = '" .
|
||||
$i->so_id . "'"));
|
||||
// get ILNs
|
||||
$xml = new XMLWriter();
|
||||
$name = str_replace('/', '_', $i->document_no);
|
||||
$name = str_replace(' ', '', $name);
|
||||
$name = str_replace('FV', '', $name);
|
||||
$xml->openURI($this->ediInvoicesPath . $name . '.xml');
|
||||
$xml->startDocument('1.0', 'UTF-8');
|
||||
$xml->startElement('Document-Invoice');
|
||||
$xml->startElement('Invoice-Header');
|
||||
$xml->writeElement('InvoiceNumber', $i->document_no);
|
||||
$xml->writeElement('InvoiceDate',
|
||||
$timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
|
||||
$c = new Currency();
|
||||
$c->retrieve($i->currency_id);
|
||||
$xml->writeElement('InvoiceCurrency', $c->iso4217);
|
||||
unset($c);
|
||||
$xml->writeElement('InvoicePaymentDueDate',
|
||||
$timedate->to_db_date($i->payment_date));
|
||||
$xml->writeElement('InvoicePaymentTerms', $i->payment_date_days);
|
||||
$xml->writeElement('InvoicePostDate',
|
||||
$timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('DocumentFunctionCode', 'O');
|
||||
$xml->startElement('Order');
|
||||
$xml->writeElement('BuyerOrderNumber', $sale['parent_document_no']);
|
||||
$xml->writeElement('BuyerOrderDate', $sale['register_date']);
|
||||
$xml->endElement(); // </Line-Order>
|
||||
$xml->startElement('Delivery');
|
||||
$xml->writeElement('DeliveryLocationNumber', $i->parent_shipping_iln);
|
||||
$xml->writeElement('DespatchNumber', $wz['document_no']);
|
||||
$xml->writeElement('DeliveryDate', $wz['register_date']);
|
||||
$xml->endElement(); // </Line-Delivery>
|
||||
$xml->endElement(); // </Invoice-Header>
|
||||
$xml->startElement('Invoice-Parties');
|
||||
$xml->startElement('Buyer');
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '')
|
||||
$i->parent_iln = $a->iln;
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
$xml->endElement(); // </Buyer>
|
||||
$xml->startElement('Invoicee');
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '')
|
||||
$i->parent_iln = $a->iln;
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
$xml->endElement(); // </Invoicee>
|
||||
$xml->startElement('Payer');
|
||||
if ($i->parent_payer_address_name && $i->parent_payer_address_name != "") {
|
||||
$iln = $db->fetchByAssoc(
|
||||
$db->query(
|
||||
"SELECT iln, to_vatid FROM accounts WHERE name = '" .
|
||||
$i->parent_payer_address_name . "'"));
|
||||
$xml->writeElement('ILN', $iln['iln']);
|
||||
$xml->writeElement('TaxID', $iln['to_vatid']);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber',
|
||||
$i->parent_payer_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_payer_address_city);
|
||||
$xml->writeElement('PostalCode',
|
||||
$i->parent_payer_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
} else {
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '') {
|
||||
$i->parent_iln = $a->iln;
|
||||
}
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
}
|
||||
$xml->endElement(); // </Payer>
|
||||
$seller_info = array(
|
||||
'Seller',
|
||||
'Payee',
|
||||
'SellerHeadquarters'
|
||||
);
|
||||
foreach ($seller_info as $val) {
|
||||
$xml->startElement($val);
|
||||
$xml->writeElement('ILN', '5909000896239'); // 5909000837119
|
||||
if ($val != 'SellerHeadquarters')
|
||||
$xml->writeElement('TaxID', '8792676609');
|
||||
$xml->writeElement('Name', 'Twinpol Sp. z o.o.');
|
||||
$xml->writeElement('StreetAndNumber', 'Al. Lipowa 48');
|
||||
$xml->writeElement('CityName', 'Obrowo');
|
||||
$xml->writeElement('PostalCode', '87-126');
|
||||
$xml->writeElement('Country', 'PL');
|
||||
if ($val == 'Seller') {
|
||||
if ($i->parent_id == '682d24c0-0f28-83c5-a840-64d9bbb03632') {
|
||||
$xml->writeElement('CodeByBuyer', '017776'); // Carefour
|
||||
} else { // Auchan
|
||||
if ($i->parent_shipping_iln == '5900014200012') {
|
||||
$xml->writeElement('CodeByBuyer', '845');
|
||||
} else {
|
||||
$xml->writeElement('CodeByBuyer', '843');
|
||||
}
|
||||
}
|
||||
}
|
||||
$xml->endElement();
|
||||
}
|
||||
$xml->endElement(); // </Invoice-Parties>
|
||||
$xml->startElement('Invoice-Lines');
|
||||
$pl = $i->getPositionList(true);
|
||||
foreach ($pl as $p) {
|
||||
if ($i->parent_id == '682d24c0-0f28-83c5-a840-64d9bbb03632') { // Carrefour - EAN2
|
||||
$ean = $db->fetchByAssoc($db->query("SELECT ean2 as ean FROM ecmproducts WHERE id = '" . $p['product_id'] . "'"));
|
||||
} else { // Others - EAN
|
||||
$ean = $db->fetchByAssoc($db->query("SELECT ean as ean FROM ecmproducts WHERE id = '" . $p['product_id'] . "'"));
|
||||
}
|
||||
$unitPrecision = isset($p['unit_precision']) ? $p['unit_precision']: 2;
|
||||
$p['quantity'] = round($p['quantity'], $unitPrecision);
|
||||
$xml->startElement('Line');
|
||||
$xml->startElement('Line-Item');
|
||||
$xml->writeElement('LineNumber', $p['position'] + 1);
|
||||
$xml->writeElement('BuyerItemCode', $p['recipient_code']);
|
||||
$xml->writeElement('EAN', $ean['ean']);
|
||||
$xml->writeElement('SupplierItemCode', $p['product_code']);
|
||||
// prepare name
|
||||
if (strlen($p['name']) > 70){
|
||||
mb_internal_encoding("UTF-8");
|
||||
|
||||
$p['name'] = mb_substr($p['name'], 0, 67, "utf-8") . '...';
|
||||
|
||||
}
|
||||
$xml->writeElement('ItemDescription', $p['name']);
|
||||
$xml->writeElement('ItemType', 'CU');
|
||||
$xml->writeElement('InvoiceQuantity', $p['quantity']);
|
||||
$xml->writeElement('UnitOfMeasure', 'PCE');
|
||||
$xml->writeElement('InvoiceUnitPacksize', '1');
|
||||
$xml->writeElement('PackItemUnitOfMeasure', 'PCE');
|
||||
$xml->writeElement('InvoiceUnitNetPrice', $p['price_netto']);
|
||||
$xml->writeElement('TaxRate', $p['ecmvat_value']);
|
||||
$xml->writeElement('TaxCategoryCode', 'S');
|
||||
$xml->writeElement('TaxAmount', $p['total_vat']);
|
||||
$xml->writeElement('NetAmount', $p['total_netto']);
|
||||
$xml->endElement(); // </Line>
|
||||
$xml->endElement(); // </Line-Item>
|
||||
}
|
||||
$xml->endElement(); // </Invoice-Lines>
|
||||
$xml->startElement('Invoice-Summary');
|
||||
$xml->writeElement('TotalLines', sizeof($pl));
|
||||
$xml->writeElement('TotalNetAmount', $i->total_netto);
|
||||
$xml->writeElement('TotalTaxableBasis', $i->total_netto);
|
||||
$xml->writeElement('TotalTaxAmount', $i->total_vat);
|
||||
$xml->writeElement('TotalGrossAmount', $i->total_brutto);
|
||||
$xml->startElement('Tax-Summary');
|
||||
|
||||
$vats = explode(',', $i->vats_summary);
|
||||
array_pop($vats);
|
||||
foreach ($vats as $v) {
|
||||
$vat = explode(':',$v);
|
||||
$xml->startElement('Tax-Summary-Line');
|
||||
$xml->writeElement('TaxRate', explode('%', $vat[0])[0]);
|
||||
$xml->writeElement('TaxCategoryCode', 'S');
|
||||
$xml->writeElement('TaxAmount', $vat[2]);
|
||||
$xml->writeElement('TaxableBasis', $vat[1]);
|
||||
$xml->writeElement('TaxableAmount', $vat[1]);
|
||||
$xml->writeElement('GrossAmount', $vat[3]);
|
||||
$xml->endElement(); // </Tax-Summary-Line>
|
||||
}
|
||||
$xml->endElement(); // </Tax-Summary>
|
||||
$xml->endElement(); // </Invoice-Summary>
|
||||
$xml->endElement(); // </Document-Invoice>
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
private function createCorrectInvoiceXML () {
|
||||
global $timedate;
|
||||
$db = $GLOBALS['db'];
|
||||
$i = $this->i;
|
||||
|
||||
$xml = new XMLWriter();
|
||||
$name = str_replace('/', '_', $i->document_no);
|
||||
$name = str_replace(' ', '', $name);
|
||||
$name = str_replace('FV', '', $name);
|
||||
$xml->openURI($this->ediInvoicesPath . 'KOR_' . $name . '.xml');
|
||||
|
||||
$oldInvoice = $db->fetchByAssoc($db->query("
|
||||
SELECT i.total_netto, i.total_brutto, i.total_vat, i.vats_summary, i.document_no, i.register_date,
|
||||
s.shipping_iln
|
||||
FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecmsales AS s ON s.id = i.so_id
|
||||
WHERE i.id='".$i->ecminvoiceout_id."'"));
|
||||
|
||||
$xml->startDocument('1.0', 'UTF-8');
|
||||
$xml->startElement('Document-Invoice');
|
||||
$xml->startElement('Invoice-Header');
|
||||
$xml->writeElement('InvoiceNumber', $i->document_no);
|
||||
$xml->writeElement('InvoiceDate',
|
||||
$timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
|
||||
$c = new Currency();
|
||||
$c->retrieve($i->currency_id);
|
||||
$xml->writeElement('InvoiceCurrency', $c->iso4217);
|
||||
unset($c);
|
||||
$xml->writeElement('InvoicePaymentDueDate',
|
||||
$timedate->to_db_date($i->payment_date));
|
||||
$xml->writeElement('InvoicePaymentTerms', $i->payment_date_days);
|
||||
$xml->writeElement('InvoicePostDate',
|
||||
$timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('DocumentFunctionCode', 'C');
|
||||
// TODO: FIX
|
||||
//$xml->writeElement('CorrectionReason', 'zgł. rekl.030/19/P320');
|
||||
$xml->startElement('Order');
|
||||
$xml->writeElement('BuyerOrderNumber', end(explode(' ', $i->order_no)));
|
||||
// FIX $xml->writeElement('BuyerOrderDate', $timedate->to_db_date($i->register_date));
|
||||
$xml->writeElement('BuyerOrderDate', '2023-08-01');
|
||||
$xml->endElement(); // </Line-Order>
|
||||
$xml->startElement('Reference');
|
||||
$xml->writeElement('InvoiceReferenceNumber', $oldInvoice['document_no']);
|
||||
$xml->writeElement('InvoiceReferenceDate', $timedate->to_db_date($oldInvoice['register_date']));
|
||||
$xml->endElement(); // </Reference>
|
||||
$xml->startElement('Delivery');
|
||||
$xml->writeElement('DeliveryLocationNumber', $oldInvoice['shipping_iln']);
|
||||
$xml->writeElement('DespatchNumber', $i->document_no);
|
||||
$xml->writeElement('DeliveryDate', $timedate->to_db_date($i->register_date));
|
||||
$xml->endElement(); // </Line-Delivery>
|
||||
$xml->endElement(); // </Invoice-Header>
|
||||
$xml->startElement('Invoice-Parties');
|
||||
$xml->startElement('Buyer');
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '')
|
||||
$i->parent_iln = $a->iln;
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
$xml->endElement(); // </Buyer>
|
||||
$xml->startElement('Invoicee');
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '')
|
||||
$i->parent_iln = $a->iln;
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
$xml->endElement(); // </Invoicee>
|
||||
$xml->startElement('Payer');
|
||||
if ($i->parent_payer_address_name && $i->parent_payer_address_name != "") {
|
||||
$iln = $db->fetchByAssoc(
|
||||
$db->query(
|
||||
"SELECT iln, to_vatid FROM accounts WHERE name = '" .
|
||||
$i->parent_payer_address_name . "'"));
|
||||
$xml->writeElement('ILN', $iln['iln']);
|
||||
$xml->writeElement('TaxID', $iln['to_vatid']);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber',
|
||||
$i->parent_payer_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_payer_address_city);
|
||||
$xml->writeElement('PostalCode',
|
||||
$i->parent_payer_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
} else {
|
||||
$a = new Account();
|
||||
$a->retrieve($i->parent_id);
|
||||
if (! $i->parent_iln || $i->parent_iln == '')
|
||||
$i->parent_iln = $a->iln;
|
||||
unset($a);
|
||||
$xml->writeElement('ILN', $i->parent_iln);
|
||||
$xml->writeElement('TaxID', $i->parent_nip);
|
||||
$xml->writeElement('Name', $i->parent_name);
|
||||
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
|
||||
$xml->writeElement('CityName', $i->parent_address_city);
|
||||
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
|
||||
$xml->writeElement('Country', 'PL');
|
||||
}
|
||||
$xml->endElement(); // </Payer>
|
||||
$e5_info = array(
|
||||
'Seller',
|
||||
'Payee',
|
||||
'SellerHeadquarters'
|
||||
);
|
||||
foreach ($e5_info as $val) {
|
||||
$xml->startElement($val);
|
||||
$xml->writeElement('ILN', '5909000896239');
|
||||
if ($val != 'SellerHeadquarters')
|
||||
$xml->writeElement('TaxID', '8792676609');
|
||||
$xml->writeElement('Name', 'Twinpol Sp. z o.o.');
|
||||
$xml->writeElement('StreetAndNumber', 'Al. Lipowa 48');
|
||||
$xml->writeElement('CityName', 'Obrowo');
|
||||
$xml->writeElement('PostalCode', '87-126');
|
||||
$xml->writeElement('Country', 'PL');
|
||||
if ($val == 'Seller') {
|
||||
if ($i->parent_id == '682d24c0-0f28-83c5-a840-64d9bbb03632') {
|
||||
$xml->writeElement('CodeByBuyer', '017776'); // Carefour
|
||||
} else { //Auchan
|
||||
if ($oldInvoice['shipping_iln'] == '5900014200012') {
|
||||
$xml->writeElement('CodeByBuyer', '845');
|
||||
} else {
|
||||
$xml->writeElement('CodeByBuyer', '843');
|
||||
}
|
||||
}
|
||||
}
|
||||
$xml->endElement();
|
||||
}
|
||||
$xml->endElement(); // </Invoice-Parties>
|
||||
$xml->startElement('Invoice-Lines');
|
||||
|
||||
$products = $db->query("
|
||||
SELECT i.id, i.code, i.position, i.recipient_code, p.ean, i.name,
|
||||
i.quantity, i.price_netto, i.total_netto, i.total_vat, i.total_brutto, i.ecmvat_value,
|
||||
c.quantity as c_quantity, c.price_netto as c_price_netto,
|
||||
c.total_netto as c_total_netto, c.total_vat as c_total_vat,
|
||||
c.total_brutto as c_total_brutto, c.ecmvat_value as c_ecmvat_value
|
||||
FROM ecminvoiceoutitems as i
|
||||
LEFT JOIN ecminvoiceoutitems as c ON i.id = c.old_ecminvoiceoutitem_id
|
||||
INNER JOIN ecmproducts as p ON i.ecmproduct_id = p.id
|
||||
WHERE c.ecminvoiceout_id = '".$i->id."'
|
||||
GROUP BY i.position
|
||||
");
|
||||
|
||||
$sum = Array();
|
||||
$sum['total_netto'] = 0;
|
||||
$sum['total_vat'] = 0;
|
||||
$sum['total_brutto'] = 0;
|
||||
$sum['c_total_netto'] = 0;
|
||||
$sum['c_total_vat'] = 0;
|
||||
$sum['c_total_brutto'] = 0;
|
||||
$sum['vats'] = array();
|
||||
while ($p = $db->fetchByAssoc($products)) {
|
||||
$unitPrecision = isset($p['unit_precision']) ? $p['unit_precision']: 2;
|
||||
$p['quantity'] = round($p['quantity'], $unitPrecision);
|
||||
$p['c_quantity'] = round($p['c_quantity'], $unitPrecision);
|
||||
|
||||
$xml->startElement('Line');
|
||||
$xml->startElement('Line-Item');
|
||||
$xml->writeElement('LineNumber', $p['position'] + 1);
|
||||
$xml->writeElement('BuyerItemCode', $p['recipient_code']);
|
||||
$xml->writeElement('EAN', $p['ean']);
|
||||
$xml->writeElement('SupplierItemCode', $p['code']);
|
||||
// prepare name
|
||||
if (strlen($p['name']) > 70){
|
||||
mb_internal_encoding("UTF-8");
|
||||
|
||||
$p['name'] = mb_substr($p['name'], 0, 67, "utf-8") . '...';
|
||||
|
||||
}
|
||||
$xml->writeElement('ItemDescription', $p['name']);
|
||||
$xml->writeElement('ItemType', 'CU');
|
||||
$xml->writeElement('UnitOfMeasure', 'PCE');
|
||||
$xml->writeElement('InvoiceUnitPacksize', '1');
|
||||
$xml->writeElement('PackItemUnitOfMeasure', 'PCE');
|
||||
|
||||
|
||||
if (!is_numeric($p['c_quantity'])) {
|
||||
$p['c_quantity'] = $p['quantity'];
|
||||
$p['c_price_netto'] = $p['price_netto'];
|
||||
$p['c_total_netto'] = $p['total_netto'];
|
||||
$p['c_total_vat'] = $p['total_vat'];
|
||||
$p['c_total_brutto'] = $p['total_brutto'];
|
||||
$p['c_ecmvat_value'] = $p['ecmvat_value'];
|
||||
}
|
||||
|
||||
$xml->writeElement('InvoiceQuantity', $p['c_quantity']);
|
||||
$xml->writeElement('InvoiceUnitNetPrice', $p['c_price_netto']);
|
||||
$xml->writeElement('TaxRate', $p['c_ecmvat_value']);
|
||||
$xml->writeElement('TaxCategoryCode', 'S');
|
||||
$xml->writeElement('TaxAmount', $p['c_total_vat']);
|
||||
$xml->writeElement('NetAmount', $p['c_total_netto']);
|
||||
|
||||
$xml->writeElement('PreviousInvoiceQuantity', $p['quantity']);
|
||||
$xml->writeElement('PreviousInvoiceUnitNetPrice', $p['price_netto']);
|
||||
// $xml->writeElement('PreviousTaxRate', $p['total_vat']);
|
||||
$xml->writeElement('PreviousTaxCategoryCode', 'S');
|
||||
$xml->writeElement('PreviousTaxRate', $p['ecmvat_value']);
|
||||
$xml->writeElement('PreviousTaxAmount', $p['total_vat']);
|
||||
$xml->writeElement('PreviousNetAmount', $p['total_netto']);
|
||||
|
||||
$xml->writeElement('CorrectionInvoiceQuantity', round($p['c_quantity'] - $p['quantity'],2));
|
||||
$xml->writeElement('CorrectionInvoiceUnitNetPrice', round($p['c_price_netto'] - $p['price_netto'],2));
|
||||
$xml->writeElement('CorrectionTaxAmount', round($p['c_total_vat'] - $p['total_vat'],2));
|
||||
$xml->writeElement('CorrectionNetAmount', round($p['c_total_netto'] - $p['total_netto'],2));
|
||||
|
||||
$xml->endElement(); // </Line>
|
||||
$xml->endElement(); // </Line-Item>
|
||||
|
||||
$sum['total_netto'] += $p['total_netto'];
|
||||
$sum['c_total_netto'] += $p['c_total_netto'];
|
||||
$sum['total_vat'] += $p['total_vat'];
|
||||
$sum['c_total_vat'] += $p['c_total_vat'];
|
||||
$sum['total_brutto'] += $p['total_brutto'];
|
||||
$sum['c_total_brutto'] += $p['c_total_brutto'];
|
||||
|
||||
if ($sum['vats'][$p['ecmvat_value']] == null) {
|
||||
$sum['vats'][$p['ecmvat_value']]['netto'] = $p['total_netto'];
|
||||
$sum['vats'][$p['ecmvat_value']]['vat'] = $p['total_vat'];
|
||||
$sum['vats'][$p['ecmvat_value']]['brutto'] = $p['total_brutto'];
|
||||
$sum['vats'][$p['ecmvat_value']]['c_netto'] = 0;
|
||||
$sum['vats'][$p['ecmvat_value']]['c_vat'] = 0;
|
||||
$sum['vats'][$p['ecmvat_value']]['c_brutto'] = 0;
|
||||
} else {
|
||||
$sum['vats'][$p['ecmvat_value']]['netto'] += $p['total_netto'];
|
||||
$sum['vats'][$p['ecmvat_value']]['vat'] += $p['total_vat'];
|
||||
$sum['vats'][$p['ecmvat_value']]['brutto'] += $p['total_brutto'];
|
||||
}
|
||||
|
||||
if ($sum['vats'][$p['c_ecmvat_value']] == null) {
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_netto'] = $p['c_total_netto'];
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_vat'] = $p['c_total_vat'];
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_brutto'] = $p['c_total_brutto'];
|
||||
$sum['vats'][$p['c_ecmvat_value']]['netto'] = 0;
|
||||
$sum['vats'][$p['c_ecmvat_value']]['vat'] = 0;
|
||||
$sum['vats'][$p['c_ecmvat_value']]['brutto'] = 0;
|
||||
} else {
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_netto'] += $p['c_total_netto'];
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_vat'] += $p['c_total_vat'];
|
||||
$sum['vats'][$p['c_ecmvat_value']]['c_brutto'] += $p['c_total_brutto'];
|
||||
}
|
||||
}
|
||||
$xml->endElement(); // </Invoice-Lines>
|
||||
$xml->startElement('Invoice-Summary');
|
||||
$xml->writeElement('TotalLines', $products->num_rows);
|
||||
$xml->writeElement('TotalNetAmount', $sum['c_total_netto']);
|
||||
$xml->writeElement('TotalTaxableBasis', $sum['c_total_netto']);
|
||||
$xml->writeElement('TotalTaxAmount', $sum['c_total_vat']);
|
||||
$xml->writeElement('TotalGrossAmount', $sum['c_total_brutto']);
|
||||
|
||||
$xml->writeElement('PreviousTotalNetAmount', $sum['total_netto']);
|
||||
$xml->writeElement('PreviousTotalTaxableBasis', $sum['total_netto']);
|
||||
$xml->writeElement('PreviousTotalTaxAmount', $sum['total_vat']);
|
||||
$xml->writeElement('PreviousTotalGrossAmount', $sum['total_brutto']);
|
||||
|
||||
$xml->writeElement('CorrectionTotalNetAmount', round($sum['c_total_netto'] - $sum['total_netto'],2));
|
||||
$xml->writeElement('CorrectionTotalTaxableBasis', round($sum['c_total_netto'] - $sum['total_netto'],2));
|
||||
$xml->writeElement('CorrectionTotalTaxAmount', round($sum['c_total_vat'] - $sum['total_vat'],2));
|
||||
$xml->writeElement('CorrectionTotalGrossAmount', round($sum['c_total_brutto'] - $sum['total_brutto'],2));
|
||||
|
||||
$xml->startElement('Tax-Summary');
|
||||
|
||||
if ($i->total_netto != round($sum['c_total_netto'] - $sum['total_netto'],2)) {
|
||||
die("Błąd sumy podczas generowania pliku XML. Skontaktuj się z administratorem.");
|
||||
}
|
||||
|
||||
foreach ($sum['vats'] as $k=>$v) {
|
||||
$xml->startElement('Tax-Summary-Line');
|
||||
$xml->writeElement('TaxRate', $k);
|
||||
$xml->writeElement('TaxCategoryCode', 'S');
|
||||
$xml->writeElement('TaxAmount', $v['c_vat']);
|
||||
$xml->writeElement('TaxableAmount', $v['c_netto']);
|
||||
|
||||
$xml->writeElement('PreviousTaxRate', $k);
|
||||
$xml->writeElement('PreviousTaxCategoryCode', 'S');
|
||||
$xml->writeElement('PreviousTaxAmount', $v['vat']);
|
||||
$xml->writeElement('PreviousTaxableAmount', $v['netto']);
|
||||
|
||||
$xml->writeElement('CorrectionTaxAmount', round($v['c_vat'] - $v['vat'],2));
|
||||
$xml->writeElement('CorrectionTaxableAmount', round($v['c_netto'] - $v['netto'],2));
|
||||
$xml->endElement(); // </Tax-Summary-Line>
|
||||
}
|
||||
|
||||
$xml->endElement(); // </Tax-Summary>
|
||||
$xml->endElement(); // </Invoice-Summary>
|
||||
$xml->endElement(); // </Document-Invoice>
|
||||
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
|
||||
function brecho() {
|
||||
echo '<pre>';
|
||||
foreach (func_get_args() as $arg) {
|
||||
print_r($arg);
|
||||
echo "<br>";
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
68
modules/EcmInvoiceOuts/generuj.php
Executable file
68
modules/EcmInvoiceOuts/generuj.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
if (count ( $_REQUEST ['mass'] )) {
|
||||
|
||||
|
||||
$db = $GLOBALS ['db'];
|
||||
$zap = $db->query ( "select id,document_no from ecminvoiceouts where id in ('" . implode ( "','", $_REQUEST ['mass'] ) . "') order by register_date asc" );
|
||||
$n = new EcmInvoiceOut ();
|
||||
$files = [ ];
|
||||
|
||||
while ( $dane = $db->fetchByAssoc ( $zap ) ) {
|
||||
|
||||
$files [] = createEcmInvoiceOutPdf ( $dane ['id'], 'FILE' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
include 'PDFMerger.php';
|
||||
|
||||
|
||||
if (count ( $files ) > 0) {
|
||||
|
||||
$pdf = new PDFMerger ();
|
||||
foreach ( $files as $file ) {
|
||||
$pdf->addPDF ( $file );
|
||||
}
|
||||
try {
|
||||
$pdf->merge ( "file", 'faktury.pdf' );
|
||||
} catch ( Exception $e ) {
|
||||
|
||||
}
|
||||
header ( "Location: faktury.pdf" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createEcmInvoiceOutPdf($record, $outputtype) {
|
||||
$EcmInvoiceOut = new EcmInvoiceOut ();
|
||||
$EcmInvoiceOut->retrieve ( $record );
|
||||
$file_location = $EcmInvoiceOut->get_PDF_file_path ( '0' );
|
||||
$EcmSysInfo = new EcmSysInfo ();
|
||||
if ($EcmSysInfo->getDatabaseName () == 'preDb_60b08fe051546309b61d2714d4a0438d') {
|
||||
$file_location = newPDFCreator ( $record, $type, true );
|
||||
}
|
||||
// return;
|
||||
switch ($outputtype) {
|
||||
case "BROSWER" :
|
||||
header ( "Location: " . $file_location );
|
||||
return true;
|
||||
case "FILE" :
|
||||
$path = $file_location;
|
||||
break;
|
||||
case "EMAIL" :
|
||||
include_once 'include/ECM/EcmSendMail/EcmSendMail.inc';
|
||||
$path = EcmSendMail::TEMP_DIR . 'ZS_' . $EcmInvoiceOut->number . '.pdf';
|
||||
copy ( $file_location, $path );
|
||||
|
||||
break;
|
||||
case "MULTIPDF" :
|
||||
include_once 'include/ECM/EcmMultiPdf/EcmMultiPdf.inc';
|
||||
$path = EcmMultiPdf::TEMP_DIR . 'EcmSales_' . $focus->id . '_' . create_guid () . '.pdf';
|
||||
copy ( $file_location, $path );
|
||||
break;
|
||||
}
|
||||
;
|
||||
return $file_location;
|
||||
}
|
||||
?>
|
||||
18
modules/EcmInvoiceOuts/getEDI.php
Normal file
18
modules/EcmInvoiceOuts/getEDI.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if (!$_REQUEST['record'])
|
||||
die('Brak rekordu');
|
||||
|
||||
$invoice = new EcmInvoiceOut();
|
||||
$invoice->retrieve($_REQUEST['record']);
|
||||
|
||||
|
||||
if ($invoice->parent_id == '682d24c0-0f28-83c5-a840-64d9bbb03632' // Carrefour
|
||||
|| $invoice->parent_id == '226a168c-2fef-b92f-0918-6200de91bb31' // Auchan
|
||||
) {
|
||||
require_once('modules/EcmInvoiceOuts/edi/createInvoiceXML.php');
|
||||
$xml = new invoiceEdiXML($_REQUEST['record']);
|
||||
$xml->getXML();
|
||||
echo 'Plik został wygenerowany sprawdź poprawność wysyłki.';
|
||||
} else {
|
||||
echo "Odbiorca nie wspierany.";
|
||||
}
|
||||
8
modules/EcmInvoiceOuts/import.php
Executable file
8
modules/EcmInvoiceOuts/import.php
Executable file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
echo "no hej";
|
||||
|
||||
$GLOBALS['db']->query("USE preDb_0dcc87940d3655fa574b253df04ca1c3;");
|
||||
require_once('modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/importBaselinkerInvoices.php');
|
||||
//importFVKOR('17314'); // stare
|
||||
importFVKOR('7689');
|
||||
?>
|
||||
19
modules/EcmInvoiceOuts/importRewizor.php
Executable file
19
modules/EcmInvoiceOuts/importRewizor.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
Class importRewizor{
|
||||
|
||||
private $db;
|
||||
private $file_name;
|
||||
private $handle;
|
||||
private $invoice;
|
||||
|
||||
function __construct($id){
|
||||
$this->db=$GLOBALS['db'];
|
||||
$this->invoice= new EcmInvoiceOut();
|
||||
$this->invoice->retrieve($id);
|
||||
$this->break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
1
modules/EcmInvoiceOuts/javahelper.php
Executable file
1
modules/EcmInvoiceOuts/javahelper.php
Executable file
@@ -0,0 +1 @@
|
||||
<?php require_once('modules/EcmInvoiceOuts/javascript/helper.php');
|
||||
622
modules/EcmInvoiceOuts/javascript/helper.php
Executable file
622
modules/EcmInvoiceOuts/javascript/helper.php
Executable file
@@ -0,0 +1,622 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( '-1' );
|
||||
if (! $_POST ['job'] || $_POST ['job'] == '')
|
||||
die ( '-1' );
|
||||
switch ($_POST ['job']) {
|
||||
case 'getParentInfo' :
|
||||
getParentInfo ( $_POST ['id'], $_POST ['type'] );
|
||||
break;
|
||||
case 'generateNumber' :
|
||||
generateNumber ( $_POST ['stock_id'], $_POST ['date'] );
|
||||
break;
|
||||
case 'generateNumberCorrect' :
|
||||
generateNumberCorrect ();
|
||||
break;
|
||||
case 'searchProducts' :
|
||||
searchProducts ( $_POST ['searchKey'], $_POST ['searchCategory'], $_POST ['searchStock'], $_POST ['searchSort'] );
|
||||
break;
|
||||
case 'getProduct' :
|
||||
getProduct ( $_POST ['id'], $_POST ['pricebook'], $_POST ['account_id'], $_POST ['language'], $_POST ['stock_id'] );
|
||||
break;
|
||||
case 'getItems' :
|
||||
getItems ( $_POST ['record'], $_POST ['type'] );
|
||||
break;
|
||||
case 'getItemsFromWZ' :
|
||||
getItemsFromWZ ( $_POST ['record'], $_POST ['type'] );
|
||||
break;
|
||||
case 'getItemsFromSale' :
|
||||
getItemsFromSale ( $_POST ['record'], $_POST ['type'] );
|
||||
break;
|
||||
case 'getCategoriesList' :
|
||||
getCategoriesList ();
|
||||
break;
|
||||
case 'getTranslation' :
|
||||
getTranslation ( $_POST ['product_id'], $_POST ['language'], $_REQUEST ['unit_id'] );
|
||||
break;
|
||||
case 'getPricesInfo' :
|
||||
getPricesInfo ( $_POST ['product_id'], $_POST ['pricebook_id'], $_POST ['account_id'] );
|
||||
break;
|
||||
case 'getStockArray' :
|
||||
getStockArray ( $_POST ['product_id'] );
|
||||
break;
|
||||
case 'getPurchaseArray' :
|
||||
getPurchaseArray ( $_POST ['product_id'] );
|
||||
break;
|
||||
case 'getAddresses' :
|
||||
getAddresses ( $_POST ['account_id'] );
|
||||
break;
|
||||
case 'getPayers' :
|
||||
getPayers ( $_POST ['account_id'] );
|
||||
break;
|
||||
case 'getPayer' :
|
||||
getPayers ( $_POST ['account_id'] );
|
||||
break;
|
||||
case 'getAddress' :
|
||||
getAddress ( $_POST ['account_id'] );
|
||||
break;
|
||||
case 'SendMail' :
|
||||
SendMail ( $_POST ['id'], $_POST ['modulee'], $_POST ['parent_id'] );
|
||||
break;
|
||||
case 'getNBPCurrencyExchange' :
|
||||
getNBPCurrencyExchange ( $_POST ['c_id'], $_POST ['date'] );
|
||||
break;
|
||||
case 'getCurrencyValues' :
|
||||
getCurrencyValues ( $_POST ['c_id'], $_POST ['date'] );
|
||||
break;
|
||||
case 'getStockState' :
|
||||
getStockState ( $_POST ['id'], $_POST ['stock_id'] );
|
||||
break;
|
||||
case 'calculatePaymentDate' :
|
||||
calculatePaymentDate ( $_POST ['date'], $_POST ['days'] );
|
||||
break;
|
||||
case 'calculateDateDiff' :
|
||||
calculateDateDiff ( $_POST ['date1'], $_POST ['date2'] );
|
||||
break;
|
||||
case 'getBankAccounts' :
|
||||
getBankAccounts ();
|
||||
break;
|
||||
case 'getStockBankAccountId' :
|
||||
getStockBankAccountId ( $_POST ['stock_id'], $_POST ['parent_id'] );
|
||||
break;
|
||||
case 'getDataForAccount' :
|
||||
getDataForAccount ( $_POST ['id'] );
|
||||
break;
|
||||
case 'changePrice' :
|
||||
changePrice ( $_POST ['id'], $_POST ['price'] );
|
||||
break;
|
||||
case 'getVatValues' :
|
||||
getVatValues ();
|
||||
break;
|
||||
}
|
||||
function getVatValues(){
|
||||
$ecmvat = new EcmVat();
|
||||
$ecmvats = $ecmvat->get_full_list ( null, "" );
|
||||
$return_array=[];
|
||||
foreach ($ecmvats as $vat){
|
||||
$tmp=[];
|
||||
$tmp['id']=$vat->id;
|
||||
$tmp['name']=$vat->name;
|
||||
$tmp['value']=$vat->value;
|
||||
$return_array[]=$tmp;
|
||||
}
|
||||
echo json_encode($return_array);
|
||||
return;
|
||||
}
|
||||
function changePrice($id, $price) {
|
||||
$db = $GLOBALS ['db'];
|
||||
if ($id != '' && $price != '') {
|
||||
$query = "update ecminvoiceoutitems set price_purchase='" . $price . "' where id='" . $id . "'";
|
||||
$db->query ( $query );
|
||||
}
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
function getDataForAccount($id) {
|
||||
$a = new Account ();
|
||||
$a->retrieve ( $id );
|
||||
|
||||
$back = array ();
|
||||
$tmp ['email'] = $a->email1;
|
||||
$tmp ['tele'] = $a->phone_office;
|
||||
|
||||
$back [] = $tmp;
|
||||
print json_encode ( $back );
|
||||
}
|
||||
function getStockBankAccountId($stock_id, $parent_id) {
|
||||
global $db;
|
||||
$acc = $db->query ( "SELECT invoice_bank_account FROM accounts WHERE id ='" . $parent_id . "'" );
|
||||
$row_acc = $db->fetchByAssoc ( $acc );
|
||||
if ($row_acc ['invoice_bank_account'] == "") {
|
||||
$re = $db->query ( "SELECT value9 FROM operating_values where id = (SELECT default_bank_id FROM ecmstocks WHERE id='" . $stock_id . "')" );
|
||||
$rowstock = $db->fetchByAssoc ( $re );
|
||||
$Bank_account_number = $rowstock ['value9'];
|
||||
} else {
|
||||
$Bank_account_number = $row_acc ['invoice_bank_account'];
|
||||
}
|
||||
if ($Bank_account_number == "" || $Bank_account_number == NULL) {
|
||||
$Bank_account_number = "49 1050 1025 1000 0090 3129 6339"; // default
|
||||
}
|
||||
print json_encode ( $Bank_account_number );
|
||||
}
|
||||
function getBankAccounts() {
|
||||
require_once ('modules/EcmSysInfos/EcmSysInfo.php');
|
||||
$EcmSysInfo = new EcmSysInfo ();
|
||||
$lista = $EcmSysInfo->getBanks ();
|
||||
echo json_encode ( $lista );
|
||||
return;
|
||||
}
|
||||
function getStockState($id, $stock_id) {
|
||||
echo EcmStockOperation::getStock ( $id, $stock_id );
|
||||
return;
|
||||
}
|
||||
function SendMail($id, $modulee, $parent_id) {
|
||||
global $current_user;
|
||||
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
$uq = $db->query ( "select google_login,CAST(AES_DECRYPT(google_password, 'jakistamhash123') as CHAR)
|
||||
AS google_password FROM users where id='" . $current_user->id . "'" );
|
||||
$rul = $db->fetchByAssoc ( $uq );
|
||||
|
||||
if ($rul ['google_login'] != '' && $rul ['google_password'] != '') {
|
||||
|
||||
require_once ("modules/" . $modulee . "/createPDF.php");
|
||||
require_once ("include/phpmailer/class.phpmailer.php");
|
||||
require_once ("include/phpmailer/class.smtp.php");
|
||||
|
||||
$mailClassS = new PHPMailer ();
|
||||
|
||||
$mailClassS->isSMTP (); // Set mailer to use SMTP
|
||||
|
||||
$mailClassS->Host = 'smtp.gmail.com'; // Specify main and backup server
|
||||
|
||||
$mailClassS->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mailClassS->Username = $rul ['google_login']; // SMTP username
|
||||
$mailClassS->Password = $rul ['google_password']; // SMTP password
|
||||
$mailClassS->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
|
||||
$mailClassS->Port = 587; // Set the SMTP port number - 587 for
|
||||
$mailClassS->addBCC ( $rul ['google_login'], "" );
|
||||
// get email from accounts
|
||||
$sea = new SugarEmailAddress ();
|
||||
// Grab the array of addresses
|
||||
$addresses = $sea->getAddressesByGUID ( $parent_id, 'Accounts' );
|
||||
|
||||
foreach ( $addresses as $address ) {
|
||||
if ($address ['email_address'] != '' && $address ['opt_out'] == 1) {
|
||||
$mailClassS->addAddress ( $address ['email_address'] ); // Add address
|
||||
}
|
||||
}
|
||||
// set sender
|
||||
$mailClassS->Sender = $rul ['google_login'];
|
||||
$mailClassS->From = $rul ['google_login'];
|
||||
$mailClassS->FromName = $current_user->first_name . ' ' . $current_user->last_name;
|
||||
|
||||
$mailClassS->WordWrap = 50; // Set word wrap to 50 characters
|
||||
|
||||
$mailClassS->isHTML ( true ); // Set email format to HTML
|
||||
|
||||
$mailClassS->Subject = 'Dokument od Saas SystemS Sp. z o.o.';
|
||||
$module = substr ( $modulee, 0, strlen ( $modulee ) - 1 );
|
||||
$d = new $module ();
|
||||
$d->retrieve ( $id );
|
||||
|
||||
$mailClassS->Body = 'Witam,<br><br>Przesyłam w załączniku dokument ' . $d->document_no . '.<br>Proszę o potwierdzenie otrzymania wiadomości e-mail z załączona Fakturą VAT.';
|
||||
// załącznik
|
||||
$path = createEcmInvoiceOutPdf ( $id, 'FILE' );
|
||||
|
||||
if (file_exists ( '/var/www/html/crm/' . $path )) {
|
||||
|
||||
$mailClassS->addAttachment ( '/var/www/html/crm/' . $path );
|
||||
}
|
||||
// Read an HTML message body from an external file, convert
|
||||
// referenced images to embedded,
|
||||
// convert HTML into a basic plain-text alternative body
|
||||
// $mailClassS->msgHTML(file_get_contents('contents.html'),
|
||||
// dirname(__FILE__));
|
||||
|
||||
if (count ( $mailClassS->to ) > 0) {
|
||||
|
||||
if (! $mailClassS->send ()) {
|
||||
|
||||
unlink ( $path );
|
||||
echo '-1';
|
||||
} else {
|
||||
unlink ( $path );
|
||||
echo '1';
|
||||
}
|
||||
} else {
|
||||
echo '-1';
|
||||
}
|
||||
} else {
|
||||
echo '-1';
|
||||
}
|
||||
}
|
||||
function calculatePaymentDate($d, $days) {
|
||||
global $timedate;
|
||||
$date = new DateTime ( $d );
|
||||
$date->add ( new DateInterval ( 'P' . $days . 'D' ) );
|
||||
echo json_encode ( $date->format ( 'd.m.Y' ) );
|
||||
return;
|
||||
}
|
||||
function calculateDateDiff($d1, $d2) {
|
||||
$db = $GLOBALS ['db'];
|
||||
global $timedate;
|
||||
$d1 = $timedate->to_db_date ( $d1 );
|
||||
$d2 = $timedate->to_db_date ( $d2 );
|
||||
$ret = $db->fetchByAssoc ( $db->query ( "SELECT TIMESTAMPDIFF(DAY, '$d1','$d2') AS diff;" ) );
|
||||
echo json_encode ( $ret ['diff'] );
|
||||
return;
|
||||
}
|
||||
function getNBPCurrencyExchange($c_id, $d) {
|
||||
global $timedate;
|
||||
$d = explode ( '-', reset ( explode ( " ", $timedate->to_db ( $d ) ) ) );
|
||||
$date = date ( "Y-m-d", @mktime ( 0, 0, 0, $d [1], $d [2], $d [0] ) + 3600 * 24 );
|
||||
|
||||
// what day is it?
|
||||
$dn = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "SELECT DAYNAME('$date') as dayname" ) );
|
||||
|
||||
if ($dn ['dayname'] == 'Sunday') // - 2 days
|
||||
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date = DATE_ADD('$date', INTERVAL -2 DAY)";
|
||||
elseif ($dn ['dayname'] == 'Saturday') // - 1 day
|
||||
$q = "SELECT value FROM currency_nbp_archive WHERE currency_id='$c_id' AND date = DATE_ADD('$date', INTERVAL -1 DAY)";
|
||||
else // any other day - just get exchange
|
||||
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date='$date'";
|
||||
|
||||
$w = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( $q ) );
|
||||
|
||||
$ret = array ();
|
||||
$ret ['value'] = $w ['value'];
|
||||
$ret ['name'] = $w ['nbp_table_name'];
|
||||
|
||||
echo json_encode ( $ret );
|
||||
return;
|
||||
}
|
||||
function getCurrencyValues($c_id, $d) {
|
||||
global $timedate;
|
||||
$d = explode ( '-', reset ( explode ( " ", $timedate->to_db ( $d ) ) ) );
|
||||
$date = date ( "Y-m-d", @mktime ( 0, 0, 0, $d [1], $d [2], $d [0] ) + 3600 * 24 );
|
||||
|
||||
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date < '$date' ORDER BY date DESC LIMIT 0,10";
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
$ret = $db->query ( $q );
|
||||
$result = array ();
|
||||
while ( $row = $db->fetchByAssoc ( $ret ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['value'] = $row ['value'];
|
||||
$tmp ['name'] = $row ['nbp_table_name'];
|
||||
$result [] = $tmp;
|
||||
unset ( $tmp );
|
||||
}
|
||||
|
||||
echo json_encode ( $result );
|
||||
return;
|
||||
}
|
||||
function getAddress($account_id) {
|
||||
$a = new Account ();
|
||||
echo json_encode ( $a->getAddress ( $account_id ) );
|
||||
unset ( $a );
|
||||
return;
|
||||
}
|
||||
function getPayer($account_id) {
|
||||
$a = new Account ();
|
||||
echo json_encode ( $a->getAddress ( $account_id ) );
|
||||
unset ( $a );
|
||||
return;
|
||||
}
|
||||
function getAddresses($account_id) {
|
||||
$a = new Account ();
|
||||
|
||||
echo json_encode ( $a->getAddresses ( $account_id ) );
|
||||
unset ( $a );
|
||||
return;
|
||||
}
|
||||
function getPayers($account_id) {
|
||||
$a = new Account ();
|
||||
|
||||
echo json_encode ( $a->getPayers ( $account_id ) );
|
||||
unset ( $a );
|
||||
return;
|
||||
}
|
||||
function getParentInfo($id, $type) {
|
||||
if (! $id || $id == '')
|
||||
die ( '-1' );
|
||||
if (! $type || $type == '')
|
||||
die ( '-1' );
|
||||
|
||||
if ($type == 'Accounts')
|
||||
$a = new Account ();
|
||||
elseif ($type == 'Leads')
|
||||
$a = new Lead ();
|
||||
else
|
||||
die ( - 1 );
|
||||
|
||||
$a->retrieve ( $id );
|
||||
$data = array ();
|
||||
$data ['name'] = html_entity_decode ( $a->name );
|
||||
$data ['parent_nip'] = $a->to_vatid;
|
||||
$data ['parent_iln'] = $a->iln;
|
||||
$data ['parent_index'] = $a->index_dbf;
|
||||
$data ['parent_address_street'] = $a->register_address_street;
|
||||
$data ['parent_address_postalcode'] = $a->register_address_postalcode;
|
||||
$data ['parent_address_city'] = $a->register_address_city;
|
||||
$data ['parent_address_country'] = $a->register_address_country;
|
||||
$data ['invoice_type'] = $a->invoice_type;
|
||||
$data ['currency_id'] = $a->currency_id;
|
||||
$data ['invoice_bank_account'] = $a->invoice_bank_account;
|
||||
$data ['payment_date_days'] = $a->payment_date_days;
|
||||
$data ['payment_method'] = $a->payment_method;
|
||||
$data ['vat_payer'] = $a->vat_payer;
|
||||
$data ['pdf_text'] = $a->pdf_text;
|
||||
|
||||
if ($a->ecmdeliverycondition_id && $a->ecmdeliverycondition_id != '') {
|
||||
$pc = new EcmdeliveryCondition ();
|
||||
$pc->retrieve ( $a->ecmdeliverycondition_id );
|
||||
$data ['ecmdeliverycondition_id'] = $pc->id;
|
||||
$data ['ecmdeliverycondition_name'] = $pc->name;
|
||||
}
|
||||
|
||||
if ($a->ecmprice_id && $a->ecmprice_id != '') {
|
||||
$pr = new EcmPrice ();
|
||||
$pr->retrieve ( $a->ecmprice_id );
|
||||
$data ['ecmprice_id'] = $pr->id;
|
||||
$data ['ecmprice_name'] = $pr->name;
|
||||
}
|
||||
// get pricebooks, ownership pricebooks
|
||||
$pricebooks = array ();
|
||||
$db = $GLOBALS ['db'];
|
||||
$res = $db->query ( "SELECT id, name FROM ecmpricebooks WHERE account_id IN ('" . $a->id . "','" . $a->parent_id . "') AND active='1' AND deleted='0'" );
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['id'] = $row ['id'];
|
||||
$tmp ['name'] = $row ['name'];
|
||||
$pricebooks [] = $tmp;
|
||||
unset ( $tmp );
|
||||
}
|
||||
$data ['pricebooks'] = $pricebooks;
|
||||
echo json_encode ( $data );
|
||||
unset ( $data );
|
||||
unset ( $a );
|
||||
unset ( $res );
|
||||
return;
|
||||
}
|
||||
function generateNumber($stock_id, $date) {
|
||||
$data = array ();
|
||||
$data ['number'] = EcmInvoiceOut::generateNumber ( $stock_id, $date );
|
||||
$data ['document_no'] = EcmInvoiceOut::formatNumber ( $data ['number'], $stock_id );
|
||||
echo json_encode ( $data );
|
||||
unset ( $data );
|
||||
return;
|
||||
}
|
||||
function generateNumberCorrect() {
|
||||
$data = array ();
|
||||
$data ['number'] = EcmInvoiceOut::generateNumberCorrect ();
|
||||
$data ['document_no'] = EcmInvoiceOut::formatNumberCorrect ( $data ['number'] );
|
||||
echo json_encode ( $data );
|
||||
unset ( $data );
|
||||
return;
|
||||
}
|
||||
function searchProducts($searchKey, $searchCategory, $searchStock, $searchSort) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$q = "SELECT id, code, name FROM ecmproducts WHERE
|
||||
(UPPER(code) LIKE '%$searchKey%' OR
|
||||
UPPER(name) LIKE '%$searchKey%')
|
||||
AND deleted='0' ";
|
||||
if ($searchCategory && $searchCategory != "")
|
||||
$q .= "AND product_category_id='$searchCategory' ";
|
||||
|
||||
if ($searchSort == '1')
|
||||
$q .= "ORDER BY code";
|
||||
else if ($searchSort == '2')
|
||||
$q .= "ORDER BY code DESC";
|
||||
else if ($searchSort == '3')
|
||||
$q .= "ORDER BY name";
|
||||
else if ($searchSort == '4')
|
||||
$q .= "ORDER BY name DESC";
|
||||
|
||||
$q .= " LIMIT 0,50";
|
||||
|
||||
$res = $db->query ( $q );
|
||||
$result = array ();
|
||||
|
||||
if ($searchStock != '1') {
|
||||
// get main stock id
|
||||
$stock_res = $db->fetchByAssoc ( $db->query ( "SELECT id FROM ecmstocks WHERE main='1' LIMIT 0,1" ) );
|
||||
$stock_id = $stock_res ['id'];
|
||||
}
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['id'] = $row ['id'];
|
||||
$tmp ['name'] = $row ['name'];
|
||||
$tmp ['code'] = $row ['code'];
|
||||
|
||||
// get stock if necessary
|
||||
if ($searchStock != '1') {
|
||||
$tmp ['stock_state'] = EcmStockOperation::getStock ( $row ['id'], $stock_id );
|
||||
}
|
||||
|
||||
if ($searchStock == '3' && $tmp ['stock_state'] == 0)
|
||||
continue; // don't show null stock
|
||||
|
||||
$result [] = $tmp;
|
||||
}
|
||||
echo json_encode ( $result );
|
||||
return;
|
||||
}
|
||||
function getProduct($id, $pricebook_id, $account_id, $language, $stock_id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$p = $db->fetchByAssoc ( $db->query ( "SELECT p.id, p.code,p.OO, p.name,p.product_category_id, p.is_consignment, v.id as ecmvat_id, v.name as ecmvat_name, v.value as ecmvat_value,p.ks_group, p.ean, p.ean2, p.unit_id FROM ecmproducts as p INNER JOIN ecmvats as v ON v.id=p.vat_id WHERE p.id='$id'" ) );
|
||||
global $app_list_strings;
|
||||
$p ['unit_name'] = $app_list_strings ['ecmproducts_unit_dom'] [$p ['unit_id']];
|
||||
$p ['unit_precision'] = $app_list_strings ['ecmproducts_unit_dom_precision'] [$p ['unit_id']];
|
||||
if ($stock_id != '') {
|
||||
$p ['stock_state'] = EcmStockOperation::getStock ( $p ['id'], $stock_id );
|
||||
}
|
||||
// try get recipient_code and price from pricebook
|
||||
if ($pricebook_id && $pricebook_id != '') {
|
||||
$pr = $db->fetchByAssoc ( $db->query ( "SELECT price, recipient_code FROM ecmpricebooks_ecmproducts WHERE ecmpricebook_id='$pricebook_id' AND ecmproduct_id='$id' AND deleted='0'" ) );
|
||||
$p ['price_start'] = $pr ['price'];
|
||||
$p ['recipient_code'] = $pr ['recipient_code'];
|
||||
}
|
||||
if (! $p ['price_start'] || floatval ( $p ['price_start'] ) == 0) {
|
||||
// try price from default prices
|
||||
$pr = $db->fetchByAssoc ( $db->query ( "SELECT pp.price FROM ecmprices_ecmproducts AS pp INNER JOIN ecmprices AS p ON pp.ecmprice_id=p.id INNER JOIN accounts AS a ON p.id=a.ecmprice_id WHERE a.id='$account_id' AND pp.ecmproduct_id='$id'" ) );
|
||||
$p ['price_start'] = $pr ['price'];
|
||||
}
|
||||
$a = new Account ();
|
||||
$a->retrieve ( $account_id );
|
||||
|
||||
if ($a->invoice_type == 'U' || $a->invoice_type == 'E') {
|
||||
$p ['ecmvat_id'] = '9b783d21-5548-6653-e1d6-49610eb3f9dd';
|
||||
$p ['ecmvat_name'] = '0%';
|
||||
$p ['ecmvat_value'] = '0';
|
||||
}
|
||||
if ($language == 'en_us') {
|
||||
$r = $db->fetchByAssoc ( $db->query ( "SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='$id' AND language='en'" ) );
|
||||
$p ['name'] = htmlspecialchars_decode ( $r ['short_description'] );
|
||||
|
||||
$lists = return_app_list_strings_language ( $language );
|
||||
if($p ['unit_id']=='1'){
|
||||
$p ['unit_name']='pcs';
|
||||
} else {
|
||||
$p ['unit_name'] = $lists ['ecmproducts_unit_dom'] [$p ['unit_id']];
|
||||
}
|
||||
unset ( $lists );
|
||||
}
|
||||
echo json_encode ( $p );
|
||||
return;
|
||||
}
|
||||
function getItems($record, $type) {
|
||||
$of = new EcmInvoiceOut ();
|
||||
$of->retrieve ( $record );
|
||||
$pl = $of->getPositionList ( true, $type );
|
||||
unset ( $of );
|
||||
echo json_encode ( $pl );
|
||||
return;
|
||||
}
|
||||
function getItemsFromWZ($record, $type) {
|
||||
$lists = explode ( '@', $record );
|
||||
$items = array ();
|
||||
$of = new EcmStockDocOut ();
|
||||
$poz = 0;
|
||||
foreach ( $lists as $list ) {
|
||||
|
||||
$of->retrieve ( $list );
|
||||
$pl = $of->getPositionList ( true );
|
||||
foreach ( $pl as $pls ) {
|
||||
$pls ['position'] = $poz;
|
||||
$items [] = $pls;
|
||||
$poz ++;
|
||||
}
|
||||
}
|
||||
|
||||
unset ( $of );
|
||||
echo json_encode ( $items );
|
||||
return;
|
||||
}
|
||||
function getItemsFromSale($record, $type) {
|
||||
$of = new EcmSale ();
|
||||
$of->retrieve ( $record );
|
||||
$pl = $of->getPositionList ( true );
|
||||
unset ( $of );
|
||||
echo json_encode ( $pl );
|
||||
return;
|
||||
}
|
||||
function getCategoriesList() {
|
||||
$db = $GLOBALS ['db'];
|
||||
$res = $db->query ( "SELECT id, name FROM ecmproductcategories WHERE deleted='0'" );
|
||||
$result = array ();
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['id'] = $row ['id'];
|
||||
$tmp ['name'] = $row ['name'];
|
||||
$result [] = $tmp;
|
||||
}
|
||||
echo json_encode ( $result );
|
||||
return;
|
||||
}
|
||||
function getTranslation($product_id, $language, $unit_id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$result = array ();
|
||||
if ($language == 'en_us') {
|
||||
$r = $db->fetchByAssoc ( $db->query ( "SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='$product_id' AND language='en'" ) );
|
||||
$result ['name'] = htmlspecialchars_decode ( $r ['short_description'] );
|
||||
} else if ($language == 'pl_pl') {
|
||||
$p = new EcmProduct ();
|
||||
$p->retrieve ( $product_id );
|
||||
$result ['name'] = htmlspecialchars_decode ( $p->name );
|
||||
unset ( $p );
|
||||
}
|
||||
$lists = return_app_list_strings_language ( $language );
|
||||
$result ['unit_name'] = $lists ['ecmproducts_unit_dom'] [$unit_id];
|
||||
unset ( $lists );
|
||||
|
||||
echo json_encode ( $result );
|
||||
return;
|
||||
}
|
||||
function getPricesInfo($product_id, $pricebook_id, $account_id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
$result = array ();
|
||||
if ($pricebook_id && $pricebook_id != '') {
|
||||
// try get price from pricebook
|
||||
$res = $db->fetchByAssoc ( $db->query ( "SELECT price FROM ecmpricebooks_ecmproducts WHERE ecmpricebook_id='$pricebook_id' AND ecmproduct_id='$product_id' AND deleted='0'" ) );
|
||||
if ($res ['price'] && $res ['price'] != '' && $res ['price'] != 0) {
|
||||
$tmp = array ();
|
||||
$tmp ['name'] = 'pricebook';
|
||||
$tmp ['price'] = $res ['price'];
|
||||
$result [] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// get from ecmprices
|
||||
$res = $db->query ( "SELECT p.name, pp.price FROM ecmprices_ecmproducts AS pp
|
||||
INNER JOIN ecmprices AS p
|
||||
ON p.id=pp.ecmprice_id
|
||||
WHERE
|
||||
pp.ecmproduct_id='$product_id'
|
||||
AND pp.price!=0" );
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['name'] = $row ['name'];
|
||||
$tmp ['price'] = $row ['price'];
|
||||
$result [] = $tmp;
|
||||
}
|
||||
|
||||
// get last invoice price
|
||||
if ($account_id && $account_id != '') {
|
||||
$res = $db->fetchByAssoc ( $db->query ( "SELECT ii.subprice, i.id, i.document_no FROM ecminvoiceoutitems AS ii
|
||||
INNER JOIN ecminvoiceouts AS i
|
||||
ON ii.ecminvoiceout_id=i.id
|
||||
WHERE ii.ecmproduct_id='$product_id'
|
||||
AND i.parent_id='$account_id'
|
||||
AND ii.deleted='0'
|
||||
AND i.deleted='0'
|
||||
AND i.canceled='0'
|
||||
ORDER BY i.register_date DESC
|
||||
LIMIT 0,1" ) );
|
||||
if ($res && $res ['subprice'] != '') {
|
||||
$tmp = array ();
|
||||
$tmp ['name'] = $res ['document_no'];
|
||||
$tmp ['price'] = $res ['subprice'];
|
||||
$result [] = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode ( $result );
|
||||
return;
|
||||
}
|
||||
function getStockArray($product_id) {
|
||||
$o = new EcmStockOperation ();
|
||||
echo json_encode ( $o->getStockArray ( $product_id ) );
|
||||
unset ( $o );
|
||||
return;
|
||||
}
|
||||
function getPurchaseArray($product_id) {
|
||||
$o = new EcmStockOperation ();
|
||||
echo json_encode ( $o->getPurchaseArray ( $product_id ) );
|
||||
unset ( $o );
|
||||
return;
|
||||
}
|
||||
|
||||
450
modules/EcmInvoiceOuts/language/en_us.lang.php
Executable file
450
modules/EcmInvoiceOuts/language/en_us.lang.php
Executable file
@@ -0,0 +1,450 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
/**
|
||||
* ***************************************************************************
|
||||
*
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
*
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
*
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
*
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
*
|
||||
* either express or implied.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You may:
|
||||
*
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
*
|
||||
* a royalty or other fee.
|
||||
*
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
*
|
||||
* publicly available and document your modifications clearly.
|
||||
*
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
*
|
||||
* obligations for your customers.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You may NOT:
|
||||
*
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
*
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
*
|
||||
* Provider).
|
||||
*
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
*
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
*
|
||||
* involves PHYSICAL media.
|
||||
*
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
*
|
||||
* or License text in the Licensed Software
|
||||
*
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
*
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
*
|
||||
* Licensed Software.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You must:
|
||||
*
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
*
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
*
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
*
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
*
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
*
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
*
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
*
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
*
|
||||
*
|
||||
*
|
||||
* The Original Code is: CommuniCore
|
||||
*
|
||||
* Olavo Farias
|
||||
*
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
*
|
||||
*
|
||||
*
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
*
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* ******************************************************************************
|
||||
*/
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_BANKACCOUNT' => 'Bank account for transfer',
|
||||
'LBL_DAYS' => 'Days',
|
||||
'LBL_PARENT_INDEX' => 'Index',
|
||||
'LBL_BTN_CREATE_ZS' => 'Create ZS',
|
||||
'LBL_ECMPRICE' => 'B2B Prices',
|
||||
'LBL_SEARCH' => 'Search',
|
||||
'LBL_CATEGORY' => 'Category',
|
||||
'LBL_PDF_TEXT' => 'Comments',
|
||||
'LBL_PARENT_NIP' => 'VAT ID',
|
||||
'LBL_PARENT_INDEX_DBF' => 'Index',
|
||||
'LBL_NO_TAX' => 'No tax',
|
||||
'LBL_PDF_DOCUMENT_NAME' => 'Quote',
|
||||
'LBL_SITE' => 'Site',
|
||||
'LBL_SHOW_EAN' => 'Show EAN',
|
||||
'LBL_SHOW_EAN2' => 'Show EAN2',
|
||||
// added 05.02.2009
|
||||
'LBL_QUOTE_XLS' => 'Create XLS',
|
||||
'LBL_QUOTE_XLS_BUTTON_KEY' => 'Show XLS [Alt+X]',
|
||||
'LBL_QUOTE_XLS_BUTTON_TITLE' => 'Show Quote in XLS file.',
|
||||
// added 01.09.2009
|
||||
'LBL_PRICEBOOK' => 'Price Book',
|
||||
// added 05.08.2009
|
||||
'LBL_CURRENCY' => 'Currency',
|
||||
'LBL_CURRENCY_TABLE' => 'Currency NBP table',
|
||||
'LBL_DETAIL_BUTTON' => 'Details',
|
||||
// added 15.07.2009
|
||||
'LBL_EDITTABLE_UNIT' => 'Unit',
|
||||
// added 09.02.2009
|
||||
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images on offers',
|
||||
'LBL_SHOW_RECIPIENT_CODE' => 'Show recipient code',
|
||||
|
||||
// FOR SYSTEM USE
|
||||
|
||||
'LBL_MODULE_NAME' => 'Quotes',
|
||||
|
||||
'LBL_MODULE_TITLE' => 'Quotes: Home',
|
||||
|
||||
'LBL_MODULE_ID' => 'EcmInvoiceOuts',
|
||||
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Quotes Search',
|
||||
|
||||
'LBL_LIST_FORM_TITLE' => 'Quotes List',
|
||||
|
||||
'LBL_NEW_FORM_TITLE' => 'New Quote',
|
||||
|
||||
'LBL_DETAILS' => 'Quote details:',
|
||||
'LBL_CATEGORY'=>'Category:',
|
||||
'LBL_ITEMS' => 'Items included:',
|
||||
|
||||
'LBL_TEXTS' => 'Texts to PDF:',
|
||||
|
||||
'LBL_PREVIEW' => 'Preview PDF:',
|
||||
|
||||
'LBL_EMAIL' => 'Create Email:',
|
||||
|
||||
'LBL_TO_INFORMATIONS' => 'To Informations:',
|
||||
|
||||
'LBL_DETAILS_TAB' => 'Details',
|
||||
|
||||
'LBL_ITEMS_TAB' => 'Items',
|
||||
|
||||
'LBL_TEXTS_TAB' => 'Texts',
|
||||
|
||||
'LBL_PREVIEW_TAB' => 'Preview',
|
||||
|
||||
'LBL_EMAIL_TAB' => 'Email',
|
||||
|
||||
'LBL_ID' => 'Id',
|
||||
|
||||
'LBL_NAME' => 'Name',
|
||||
|
||||
'LBL_DESCRIPTION' => 'Description',
|
||||
|
||||
'LBL_DATE_ENTERED' => 'Date entered',
|
||||
|
||||
'LBL_DATE_MODIFIED' => 'Date modified',
|
||||
|
||||
'LBL_MODIFIED' => 'Last modified',
|
||||
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned to',
|
||||
|
||||
'LBL_ASSIGNED_TO' => 'Assigned to',
|
||||
|
||||
'LBL_CREATED' => 'Created by',
|
||||
|
||||
'LBL_CREATED_BY_USER' => 'Created by',
|
||||
|
||||
'LBL_MODIFIED_BY_USER' => 'Modified by',
|
||||
|
||||
'LBL_ASSIGNED_TO_USER' => 'Assigned to',
|
||||
|
||||
'LBL_DELETED_BY' => 'Deleted by',
|
||||
|
||||
'LBL_NUMBER' => 'Number',
|
||||
|
||||
'LBL_DOCUMENT_NO' => 'Number',
|
||||
|
||||
'LBL_PARENT' => 'To',
|
||||
|
||||
'LBL_PARENT_NAME' => 'Account',
|
||||
|
||||
'LBL_PARENT_ID' => 'Account Id',
|
||||
|
||||
'LBL_TYPE' => 'Type',
|
||||
|
||||
'LBL_ECMQUOTE_ID' => 'Quote Id',
|
||||
|
||||
'LBL_ECMQUOTE_NAME' => 'Quote Name',
|
||||
|
||||
'LBL_STATUS' => 'Status',
|
||||
|
||||
'LBL_REGISTER_DATE' => 'Document date',
|
||||
|
||||
'LBL_SELL_DATE' => 'Sell Date',
|
||||
|
||||
'LBL_PAYMENT_DATE' => 'Payment date',
|
||||
|
||||
'LBL_PARENT_ADDRESS_STREET' => 'Street',
|
||||
|
||||
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
|
||||
|
||||
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
|
||||
|
||||
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
|
||||
|
||||
'LBL_TO_VATID' => 'VAT-ID',
|
||||
|
||||
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
|
||||
|
||||
'LBL_HEADER_TEXT' => 'Header Text',
|
||||
|
||||
'LBL_FOOTER_TEXT' => 'Footer Text',
|
||||
|
||||
'LBL_ADS_TEXT' => 'Ads Text',
|
||||
|
||||
'LBL_SUBTOTAL' => 'Subtotal',
|
||||
|
||||
'LBL_TOTAL' => 'Total',
|
||||
|
||||
'LBL_DISCOUNT' => 'Discount',
|
||||
|
||||
'LBL_VAT' => 'VAT',
|
||||
|
||||
'LBL_ACCEPTED' => 'Accepted',
|
||||
|
||||
'LBL_TEMPLATE_ID' => 'Template Id',
|
||||
|
||||
'LBL_TEMPLATE_NAME' => 'Template',
|
||||
|
||||
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
|
||||
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
|
||||
|
||||
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
|
||||
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
|
||||
|
||||
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
|
||||
|
||||
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
|
||||
|
||||
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
|
||||
|
||||
'LBL_EDITTABLE_NO' => 'Lp.',
|
||||
'LBL_EDITTABLE_CODE' => 'Code',
|
||||
'LBL_EDITTABLE_NAME' => 'Name',
|
||||
'LBL_EDITTABLE_QUANTITY' => 'Quant',
|
||||
'LBL_EDITTABLE_PRICE' => 'Price',
|
||||
'LBL_EDITTABLE_VAT' => 'VAT',
|
||||
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Recipient Code',
|
||||
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
|
||||
'LBL_EDITTABLE_TOTAL' => 'Total',
|
||||
'LBL_EDITTABLE_OPTIONS' => 'Opt',
|
||||
|
||||
'LBL_MOVE_ROW_UP' => 'Move Up',
|
||||
'LBL_MOVE_ROW_DOWN' => 'Move Down',
|
||||
'LBL_INSERT_NEW_ROW' => 'Insert new row',
|
||||
'LBL_DELETE_ROW' => 'Delete row',
|
||||
|
||||
'LBL_VALIDTILL_DATE' => 'Valid Till',
|
||||
|
||||
// FOR MENU LINKS
|
||||
|
||||
'LNK_NEW_ECMQUOTE' => 'Create Quote',
|
||||
|
||||
'LNK_ECMQUOTES_LIST' => 'Quotes List',
|
||||
|
||||
'LBL_IMG_SEARCH' => 'Search',
|
||||
|
||||
'LBL_IMG_NEW' => 'New, add to base',
|
||||
|
||||
'LBL_IMG_EDIT' => 'Edit',
|
||||
|
||||
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this Quote?',
|
||||
|
||||
'LBL_QUOTE_PDF' => 'Show PDF',
|
||||
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
|
||||
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show Quote in PDF file.',
|
||||
|
||||
'LBL_QUOTE_TO_INVOICE' => 'Create Invoice',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Create Invoice [Alt+I]',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Create Invoice.',
|
||||
|
||||
'LBL_QUOTE_TO_SALE' => 'Create Sales Order',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
|
||||
|
||||
'LBL_SEND_TO_CONFIRM' => 'Send To Confirm',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Send To Confirm [Alt+C]',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Send This Quote To Confirm.',
|
||||
|
||||
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
|
||||
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
|
||||
|
||||
// buttons
|
||||
|
||||
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
|
||||
'LBL_SEND_BUTTON_KEY' => 'D',
|
||||
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
|
||||
|
||||
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
|
||||
'LBL_REPAIR_BUTTON_KEY' => 'R',
|
||||
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
|
||||
|
||||
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
|
||||
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
|
||||
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
|
||||
|
||||
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
|
||||
'LBL_REJECT_BUTTON_KEY' => 'R',
|
||||
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
|
||||
|
||||
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to quotes list [Alt+G]',
|
||||
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
|
||||
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
|
||||
|
||||
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
|
||||
|
||||
'LBL_NOT_SAVED' => 'Quote not saved. Please check all fields are correct!',
|
||||
|
||||
'LBL_SAVED' => 'Quote saved successfully.',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla:',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
|
||||
|
||||
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
|
||||
|
||||
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
|
||||
|
||||
'LBL_DASHLET_MY_ECMQUOTES' => 'Quotes',
|
||||
|
||||
'LNK_ECMQUOTES_PDFLANGUAGES' => 'PDF Settings',
|
||||
'LBL_ECMLANGUAGE' => 'Language',
|
||||
'LBL_ECMQUOTES_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
|
||||
|
||||
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Quote is not accepted by Manager!",
|
||||
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Quote to confirm error! Refresh site and try again.",
|
||||
|
||||
'LBL_STATUS_s10_SET_MESSAGE' => "Quote status is set.",
|
||||
'LBL_STATUS_s20_SET_MESSAGE' => "Now Quote is waiting for confimations.",
|
||||
'LBL_STATUS_s30_SET_MESSAGE' => "Quote is confirmed.",
|
||||
'LBL_STATUS_s40_SET_MESSAGE' => "Quote status is set.",
|
||||
'LBL_STATUS_s70_SET_MESSAGE' => "Quote status is set to Lost :(",
|
||||
|
||||
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending Quote to confirm error! Refresh site and try again.",
|
||||
|
||||
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
|
||||
'LBL_LIST_DUPLICATE' => 'Duplicate',
|
||||
'LBL_LIST_PREVIEW_PDF' => 'Preview Quote',
|
||||
'LBL_LIST_REJECT' => 'Reject',
|
||||
'LBL_LIST_ACCEPT' => 'Accept',
|
||||
|
||||
'LBL_MODIFIED_USER' => 'Modified By',
|
||||
|
||||
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
|
||||
|
||||
'LBL_ORDER_ORIGIN' => 'Order Origin',
|
||||
|
||||
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
|
||||
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
|
||||
|
||||
'LBL_CONTACT_NAME' => 'Contact',
|
||||
'LBL_CONTACT_ID' => 'Contact Id',
|
||||
'LBL_PARENT_NAME_COPY' => 'Company Name',
|
||||
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
|
||||
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
|
||||
|
||||
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
|
||||
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
|
||||
'LBL_CREATE_ECMINVOICEOUT_BUTTON_LABEL' => 'Create Invoice',
|
||||
|
||||
'LBL_ECMTEAM_NAME' => 'Team',
|
||||
'LBL_ECMTEAM_ID' => 'Team ID',
|
||||
|
||||
'LBL_IMAGE_SIZE' => 'Images size (%)',
|
||||
|
||||
//mz new labels
|
||||
'LBL_SEARCH' => 'Search',
|
||||
'LBL_CATEGORY' => 'Category',
|
||||
'LBL_SEARCH_STOCK' => 'Stock state',
|
||||
'LBL_SEARCH_STOCK_OPT_ALL' => 'ALL',
|
||||
'LBL_SEARCH_STOCK_OPT_NOT_NULL' => 'Only available',
|
||||
'LBL_SEARCH_SORT' => 'Sort results by',
|
||||
'LBL_SEARCH_SORT_CODE' => 'Code ASC',
|
||||
'LBL_SEARCH_SORT_CODE_DESC' => 'Code DESC',
|
||||
'LBL_SEARCH_SORT_NAME' => 'Name ASC',
|
||||
'LBL_SEARCH_SORT_NAME_DESC' => 'Name DESC',
|
||||
//PDF labels
|
||||
'LBL_PDF_FOOTER_KRS' => 'KRS:',
|
||||
'LBL_PDF_FOOTER_NIP' => 'VATID:',
|
||||
'LBL_PDF_FOOTER_REGON' => 'REGON:',
|
||||
'LBL_PDF_FOOTER_BANK' => 'Bank name:',
|
||||
'LBL_PDF_FOOTER_BANK_ACCOUNT' => 'Bank account:',
|
||||
'LBL_PDF_FOOTER_GIOS' => 'GIOS number:',
|
||||
'LBL_PDF_FOOTER_SWIFT' => 'Bank SWIFT:',
|
||||
'LBL_PDF_CONTENT_QUOTE_FOR' => 'Offer for:',
|
||||
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Register date:',
|
||||
'LBL_PDF_CONTENT_ISSUED_BY' => 'Issued by:',
|
||||
'LBL_PDF_CONTENT_NUMBER' => 'Number:',
|
||||
'LBL_PDF_CONTENT_LIST_POSITION' => 'No.',
|
||||
'LBL_PDF_CONTENT_LIST_IMAGE' => 'Picture',
|
||||
'LBL_PDF_CONTENT_LIST_NAME' => 'Name',
|
||||
'LBL_PDF_CONTENT_LIST_CODE' => 'Index',
|
||||
'LBL_PDF_CONTENT_LIST_QTY' => 'Quantity',
|
||||
'LBL_PDF_CONTENT_LIST_UNIT' => 'Unit',
|
||||
'LBL_PDF_CONTENT_LIST_EAN' => 'Ean',
|
||||
'LBL_PDF_CONTENT_LIST_EAN2' => 'Ean 2',
|
||||
'LBL_PDF_CONTENT_LIST_RECIPIENT_CODE' => 'Recipient Code',
|
||||
'LBL_PDF_CONTENT_LIST_REMARKS' => 'Remarks',
|
||||
'LBL_PDF_CONTENT_LIST_PRICE_START' => 'Start price',
|
||||
'LBL_PDF_CONTENT_LIST_PRICE_NETTO' => 'Price netto',
|
||||
'LBL_PDF_CONTENT_LIST_DISCOUNT' => 'Discount',
|
||||
'LBL_PDF_CONTENT_LIST_TOTAL_NETTO' => 'Total netto',
|
||||
'LBL_PDF_CONTENT_TOTAL_NETTO' => 'Total netto',
|
||||
'LBL_PDF_CONTENT_TOTAL_BRUTTO' => 'Total brutto',
|
||||
|
||||
|
||||
|
||||
)
|
||||
;
|
||||
|
||||
?>
|
||||
424
modules/EcmInvoiceOuts/language/ge_ge.lang.php
Executable file
424
modules/EcmInvoiceOuts/language/ge_ge.lang.php
Executable file
@@ -0,0 +1,424 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
|
||||
* with the License. You may obtain a copy of the License at
|
||||
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
|
||||
* either express or implied.
|
||||
|
||||
*
|
||||
|
||||
* You may:
|
||||
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
|
||||
* a royalty or other fee.
|
||||
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
|
||||
* publicly available and document your modifications clearly.
|
||||
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
|
||||
* obligations for your customers.
|
||||
|
||||
*
|
||||
|
||||
* You may NOT:
|
||||
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
|
||||
* Provider).
|
||||
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
|
||||
* involves PHYSICAL media.
|
||||
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
|
||||
* or License text in the Licensed Software
|
||||
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
|
||||
* Licensed Software.
|
||||
|
||||
*
|
||||
|
||||
* You must:
|
||||
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
|
||||
*
|
||||
|
||||
* The Original Code is: CommuniCore
|
||||
|
||||
* Olavo Farias
|
||||
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
|
||||
*
|
||||
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
|
||||
* All Rights Reserved.
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$mod_strings = array (
|
||||
|
||||
|
||||
|
||||
// FOR SYSTEM USE
|
||||
|
||||
'LBL_MODULE_NAME' => 'Quotes',
|
||||
|
||||
'LBL_MODULE_TITLE' => 'Quotes: Home',
|
||||
|
||||
'LBL_MODULE_ID' => 'EcmInvoiceOuts',
|
||||
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Quotes Search',
|
||||
|
||||
'LBL_LIST_FORM_TITLE' => 'Quotes List',
|
||||
|
||||
'LBL_NEW_FORM_TITLE' => 'New Quote',
|
||||
|
||||
|
||||
|
||||
'LBL_DETAILS' => 'Quote details:',
|
||||
|
||||
'LBL_ITEMS' => 'Items included:',
|
||||
|
||||
'LBL_TEXTS' => 'Texts to PDF:',
|
||||
|
||||
'LBL_PREVIEW' => 'Preview PDF:',
|
||||
|
||||
'LBL_EMAIL' => 'Create Email:',
|
||||
|
||||
'LBL_TO_INFORMATIONS' => 'To Informations:',
|
||||
|
||||
|
||||
|
||||
'LBL_DETAILS_TAB' => 'Details',
|
||||
|
||||
'LBL_ITEMS_TAB' => 'Items',
|
||||
|
||||
'LBL_TEXTS_TAB' => 'Texts',
|
||||
|
||||
'LBL_PREVIEW_TAB' => 'Preview',
|
||||
|
||||
'LBL_EMAIL_TAB' => 'Email',
|
||||
|
||||
|
||||
|
||||
'LBL_ID' => 'Id',
|
||||
|
||||
'LBL_NAME' => 'Name',
|
||||
|
||||
'LBL_DESCRIPTION' => 'Description',
|
||||
|
||||
'LBL_DATE_ENTERED' => 'Date Entered',
|
||||
|
||||
'LBL_DATE_MODIFIED' => 'Date Modified',
|
||||
|
||||
'LBL_MODIFIED' => 'Last Modified',
|
||||
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
|
||||
'LBL_ASSIGNED_TO' => 'Assigned To',
|
||||
|
||||
'LBL_CREATED' => 'Created by',
|
||||
|
||||
'LBL_CREATED_BY_USER' => 'Created by',
|
||||
|
||||
'LBL_MODIFIED_BY_USER' => 'Modified by',
|
||||
|
||||
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
|
||||
|
||||
'LBL_DELETED_BY' => 'Deleted by',
|
||||
|
||||
'LBL_NUMBER' => 'Number',
|
||||
|
||||
'LBL_DOCUMENT_NO' => 'Number',
|
||||
|
||||
'LBL_PARENT' => 'To',
|
||||
|
||||
'LBL_PARENT_NAME' => 'Account',
|
||||
|
||||
'LBL_PARENT_ID' => 'Account Id',
|
||||
|
||||
'LBL_TYPE' => 'Type',
|
||||
|
||||
'LBL_ECMQUOTE_ID' => 'Quote Id',
|
||||
|
||||
'LBL_ECMQUOTE_NAME' => 'Quote Name',
|
||||
|
||||
'LBL_STATUS' => 'Status',
|
||||
|
||||
'LBL_REGISTER_DATE' => 'Document Date',
|
||||
|
||||
'LBL_SELL_DATE' => 'Sell Date',
|
||||
|
||||
'LBL_PAYMENT_DATE' => 'Payment Date',
|
||||
|
||||
'LBL_PARENT_ADDRESS_STREET' => 'Street',
|
||||
|
||||
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
|
||||
|
||||
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
|
||||
|
||||
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
|
||||
|
||||
'LBL_TO_VATID' => 'VAT-ID',
|
||||
|
||||
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
|
||||
|
||||
'LBL_HEADER_TEXT' => 'Header Text',
|
||||
|
||||
'LBL_FOOTER_TEXT' => 'Footer Text',
|
||||
|
||||
'LBL_ADS_TEXT' => 'Ads Text',
|
||||
|
||||
|
||||
|
||||
'LBL_SUBTOTAL' => 'Subtotal',
|
||||
|
||||
'LBL_TOTAL' => 'Total',
|
||||
|
||||
'LBL_DISCOUNT' => 'Discount',
|
||||
|
||||
'LBL_VAT' => 'VAT',
|
||||
|
||||
'LBL_ACCEPTED' => 'Accepted',
|
||||
|
||||
'LBL_TEMPLATE_ID' => 'Template Id',
|
||||
|
||||
'LBL_TEMPLATE_NAME' => 'Template',
|
||||
|
||||
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
|
||||
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
|
||||
|
||||
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
|
||||
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
|
||||
|
||||
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
|
||||
|
||||
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
|
||||
|
||||
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
|
||||
|
||||
'LBL_EDITTABLE_NO' => 'Lp.',
|
||||
'LBL_EDITTABLE_CODE' => 'Code',
|
||||
'LBL_EDITTABLE_NAME' => 'Name',
|
||||
'LBL_EDITTABLE_QUANTITY' => 'Quant',
|
||||
'LBL_EDITTABLE_PRICE' => 'Price',
|
||||
'LBL_EDITTABLE_VAT' => 'VAT',
|
||||
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
|
||||
'LBL_EDITTABLE_TOTAL' => 'Total',
|
||||
'LBL_EDITTABLE_OPTIONS' => 'Opt',
|
||||
|
||||
|
||||
'LBL_MOVE_ROW_UP' => 'Move Up',
|
||||
'LBL_MOVE_ROW_DOWN' => 'Move Down',
|
||||
'LBL_INSERT_NEW_ROW' => 'Insert new row',
|
||||
'LBL_DELETE_ROW' => 'Delete row',
|
||||
|
||||
'LBL_VALIDTILL_DATE' => 'Valid Till',
|
||||
|
||||
// FOR MENU LINKS
|
||||
|
||||
'LNK_NEW_ECMQUOTE' => 'Create Quote',
|
||||
|
||||
'LNK_ECMQUOTES_LIST' => 'Quotes List',
|
||||
|
||||
|
||||
|
||||
'LBL_IMG_SEARCH' => 'Search',
|
||||
|
||||
'LBL_IMG_NEW' => 'New, add to base',
|
||||
|
||||
'LBL_IMG_EDIT' => 'Edit',
|
||||
|
||||
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this Quote?',
|
||||
|
||||
'LBL_QUOTE_PDF' => 'Show PDF',
|
||||
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
|
||||
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show Quote in PDF file.',
|
||||
|
||||
'LBL_QUOTE_TO_INVOICE' => 'Create Invoice',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Create Invoice [Alt+I]',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Create Invoice.',
|
||||
|
||||
'LBL_QUOTE_TO_SALE' => 'Create Sales Order',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
|
||||
|
||||
'LBL_SEND_TO_CONFIRM' => 'Send To Confirm',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Send To Confirm [Alt+C]',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Send This Quote To Confirm.',
|
||||
|
||||
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
|
||||
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
|
||||
|
||||
|
||||
|
||||
//buttons
|
||||
|
||||
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
|
||||
'LBL_SEND_BUTTON_KEY' => 'D',
|
||||
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
|
||||
|
||||
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
|
||||
'LBL_REPAIR_BUTTON_KEY' => 'R',
|
||||
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
|
||||
|
||||
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
|
||||
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
|
||||
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
|
||||
|
||||
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
|
||||
'LBL_REJECT_BUTTON_KEY' => 'R',
|
||||
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
|
||||
|
||||
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to quotes list [Alt+G]',
|
||||
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
|
||||
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
|
||||
|
||||
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
|
||||
|
||||
'LBL_NOT_SAVED' => 'Quote not saved. Please check all fields are correct!',
|
||||
|
||||
'LBL_SAVED' => 'Quote saved successfully.',
|
||||
|
||||
|
||||
|
||||
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
|
||||
|
||||
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
|
||||
|
||||
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
|
||||
|
||||
|
||||
|
||||
'LBL_DASHLET_MY_ECMQUOTES' => 'Quotes',
|
||||
|
||||
|
||||
|
||||
|
||||
'LBL_PDF_LIST_POSITION' => 'Poz.',
|
||||
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
|
||||
'LBL_PDF_LIST_UNIT' => '',
|
||||
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
|
||||
'LBL_PDF_LIST_PRICE' => 'Cena',
|
||||
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
|
||||
'LBL_PDF_LIST_VAT' => 'VAT',
|
||||
'LBL_PDF_LIST_TOTAL' => 'Suma',
|
||||
'LBL_PDF_TOTAL' => 'Suma',
|
||||
'LBL_PDF_DISCOUNT' => 'RABAT',
|
||||
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
|
||||
'LBL_PDF_VAT' => 'VAT',
|
||||
'LBL_PDF_VATID' => 'VAT-ID',
|
||||
'LBL_PDF_NUMBER' => 'Numer',
|
||||
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
|
||||
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
|
||||
'LBL_PDF_OWNER' => 'Wystawil',
|
||||
'LBL_PDF_DOCUMENT_NAME' => 'Oferta',
|
||||
'LBL_PDF_FILENAME' => 'Quote_',
|
||||
'LBL_PDF_CODE' => '',
|
||||
|
||||
'LNK_ECMQUOTES_PDFLANGUAGES' => 'PDF Settings',
|
||||
'LBL_ECMLANGUAGE' => 'Language',
|
||||
'LBL_ECMQUOTES_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
|
||||
|
||||
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Quote is not accepted by Manager!",
|
||||
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Quote to confirm error! Refresh site and try again.",
|
||||
|
||||
'LBL_STATUS_s10_SET_MESSAGE' => "Quote status is set.",
|
||||
'LBL_STATUS_s20_SET_MESSAGE' => "Now Quote is waiting for confimations.",
|
||||
'LBL_STATUS_s30_SET_MESSAGE' => "Quote is confirmed.",
|
||||
'LBL_STATUS_s40_SET_MESSAGE' => "Quote status is set.",
|
||||
|
||||
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending Quote to confirm error! Refresh site and try again.",
|
||||
|
||||
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
|
||||
'LBL_LIST_DUPLICATE' => 'Duplicate',
|
||||
'LBL_LIST_PREVIEW_PDF' => 'Preview Quote',
|
||||
'LBL_LIST_REJECT' => 'Reject',
|
||||
'LBL_LIST_ACCEPT' => 'Accept',
|
||||
|
||||
|
||||
'LBL_MODIFIED_USER' => 'Modified By',
|
||||
|
||||
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
|
||||
|
||||
'LBL_ORDER_ORIGIN' => 'Order Origin',
|
||||
|
||||
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
|
||||
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
|
||||
|
||||
'LBL_CONTACT_NAME' => 'Contact',
|
||||
'LBL_CONTACT_ID' => 'Contact Id',
|
||||
'LBL_PARENT_NAME_COPY' => 'Company Name',
|
||||
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
|
||||
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
|
||||
|
||||
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
|
||||
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
|
||||
|
||||
'LBL_IMAGE_SIZE' => 'Images size (%)',
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
388
modules/EcmInvoiceOuts/language/pl_pl.lang.php
Executable file
388
modules/EcmInvoiceOuts/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
$mod_strings = array (
|
||||
'LBL_BANKACCOUNT' => 'Numer konta dla przelewu',
|
||||
'LBL_DAYS' => 'Dni',
|
||||
'LBL_PARENT_INDEX' => 'Indeks',
|
||||
'LBL_DISCOUNT' => 'Rabat',
|
||||
'LBL_BTN_CREATE_ZS' => 'Utwórz ZS',
|
||||
'LBL_ECMPRICE' => 'Ceny B2B',
|
||||
'LBL_SEARCH' => 'Wyszukaj',
|
||||
'LBL_CATEGORY' => 'Kategoria',
|
||||
'LBL_PDF_TEXT' => 'Uwagi',
|
||||
'LBL_PARENT_NIP' => 'NIP',
|
||||
'LBL_PARENT_INDEX_DBF' => 'Indeks',
|
||||
'LBL_NO_TAX' => 'Bez Vatu',
|
||||
'LBL_SITE' => 'Strona',
|
||||
'LBL_SHOW_EAN' => 'Pokaż EAN1',
|
||||
'LBL_SHOW_EAN2' => 'Pokaż EAN2',
|
||||
// added 01.09.2009
|
||||
'LBL_ECMLANGUAGE' => 'Język',
|
||||
'LBL_PRICEBOOK' => 'Cennik',
|
||||
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Kod Odbiorcy',
|
||||
// added 05.08.2009
|
||||
'LBL_CURRENCY' => 'Waluta',
|
||||
'LBL_PDF_SALE_LABEL'=>'Dotyczy zamówienia lub umowy nr:',
|
||||
'LBL_PDF_CONTENT_SELL_DATE_OTHER'=>'Data zakończenia dostawy/wykonania usług:',
|
||||
'LBL_BEFORE_TABLE'=>'Dane dotyczące umowy/zamówienia dokumentowanej fakturą',
|
||||
'LBL_CURRENCY_TABLE' => 'Tabela kursu NBP',
|
||||
'LBL_OPERATION_TYPE'=>'Operacje magazynowe',
|
||||
'LBL_CORRECT_TITLE'=>'Utwórz korektę',
|
||||
'LBL_CORRECT'=>'Utwórz korektę',
|
||||
'LBL_DETAIL_BUTTON' => 'Szczegóły',
|
||||
// added 15.07.2009
|
||||
'LBL_CURRENCY_VALUE_NBP'=>'Kurs NBP',
|
||||
'LBL_PDF_PAID_RETURN'=>'Do zwrotu',
|
||||
'LBL_PARENT_SHIPPING_ADDRESS'=>'Adres dostawy/usługi',
|
||||
'LBL_TO_PAYMENTS'=>'Płatności',
|
||||
'LBL_TO_PAID'=>'Do zapłaty',
|
||||
'LBL_SEND_MAIL'=>'Wyślij fakturę',
|
||||
'LBL_PDF_CONTENT_INVOICE_FOR'=>'NABYWCA',
|
||||
'LBL_LEFT'=>'Pozostało',
|
||||
'LBL_PREPAID'=>'Przedpłata',
|
||||
'LBL_PREPAID_NR'=>'Numer FK przedpłatowej',
|
||||
'LBL_PAID'=>'Zapłacono',
|
||||
'LBL_PAYMENT_METHOD_PAID'=>'Sposób zapłaty (zapłacono)',
|
||||
'LBL_EDITTABLE_UNIT' => 'J.m.',
|
||||
'LBL_ECMINVOICEOUT_NAME'=>'Faktura do korygowania',
|
||||
'LBL_STOCK_NAME'=>'Magazyn',
|
||||
'LBL_ORDER_NO'=>'Numer zamówienia',
|
||||
'LBL_SUPPLIER_CODE'=>'Kod dostawcy',
|
||||
'LBL_CURRENCY'=>'Waluta',
|
||||
'LBL_PAYMENT_METHOD'=>'Sposób zapłaty:',
|
||||
'LBL_PDF_TYPE'=>'Typ pdf',
|
||||
// added 09.02.2009
|
||||
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Pokaż obrazki w PDFie',
|
||||
'LBL_SHOW_RECIPIENT_CODE' => 'Pokaż kod odbiorcy',
|
||||
'LBL_SENDET'=>'Email',
|
||||
// FOR SYSTEM USE
|
||||
|
||||
'LBL_MODULE_NAME' => 'Oferty',
|
||||
|
||||
'LBL_MODULE_TITLE' => 'Oferty: Strona Główna',
|
||||
|
||||
'LBL_MODULE_ID' => 'EcmInvoiceOuts',
|
||||
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
|
||||
|
||||
'LBL_LIST_FORM_TITLE' => 'Lista Faktur',
|
||||
|
||||
'LBL_NEW_FORM_TITLE' => 'Nowa Oferta',
|
||||
|
||||
'LBL_DETAILS' => 'FK',
|
||||
'LBL_CATEGORY'=>'Kategoria',
|
||||
'LBL_ITEMS' => 'FK',
|
||||
|
||||
'LBL_TEXTS' => 'Teksty do PDFa:',
|
||||
|
||||
'LBL_PREVIEW' => 'Podglad PDFa:',
|
||||
|
||||
'LBL_EMAIL' => 'Stwórz Email:',
|
||||
|
||||
'LBL_TO_INFORMATIONS' => 'Informacje o firmie:',
|
||||
|
||||
'LBL_DETAILS_TAB' => 'Szczególy',
|
||||
|
||||
'LBL_ITEMS_TAB' => 'Produkty',
|
||||
|
||||
'LBL_TEXTS_TAB' => 'Teksty',
|
||||
|
||||
'LBL_PREVIEW_TAB' => 'Podglad',
|
||||
|
||||
'LBL_EMAIL_TAB' => 'Email',
|
||||
|
||||
'LBL_ID' => 'Id',
|
||||
|
||||
'LBL_NAME' => 'Nazwa',
|
||||
|
||||
'LBL_DESCRIPTION' => 'Opis',
|
||||
|
||||
'LBL_DATE_ENTERED' => 'Data dodania',
|
||||
|
||||
'LBL_DATE_MODIFIED' => 'Date modyfikacji',
|
||||
|
||||
'LBL_MODIFIED' => 'Ostatnio modyfikowane',
|
||||
|
||||
'LBL_ASSIGNED_TO_ID' => 'Przypisane do',
|
||||
|
||||
'LBL_ASSIGNED_TO' => 'Przypisane do',
|
||||
|
||||
'LBL_CREATED' => 'Utworzone Przez',
|
||||
|
||||
'LBL_CREATED_BY_USER' => 'Utworzone przez',
|
||||
|
||||
'LBL_MODIFIED_BY_USER' => 'Zmodyfikowane przez',
|
||||
|
||||
'LBL_ASSIGNED_TO_USER' => 'Przypisane do',
|
||||
|
||||
'LBL_DELETED_BY' => 'Usuniete Przez',
|
||||
'LBL_SALE_SUM'=>'Podsumowanie zamówienia',
|
||||
'LBL_PDF_PREPAID_BEFORE'=>'Zestawienie faktur zaliczkowych / Rozliczenie zaliczki wg stawek',
|
||||
'LBL_PDF_PREPAID_NO'=>'Lp.',
|
||||
'LBL_PDF_PREPAID_NUMBER'=>'Numer faktury',
|
||||
'LBL_PDF_PREPAID_DATE'=>'Data',
|
||||
'LBL_PDF_PREPAID_NETTO'=>'Netto',
|
||||
'LBL_PDF_PREPAID_BRUTTO'=>'Brutto',
|
||||
'LBL_PDF_PREPAID_TOTAL'=>'Rozliczenie zaliczki wg stawek',
|
||||
'LBL_NUMBER' => 'Numer',
|
||||
|
||||
'LBL_DOCUMENT_NO' => 'Numer',
|
||||
|
||||
'LBL_PARENT' => 'Do',
|
||||
|
||||
'LBL_PARENT_NAME' => 'Kontrahent',
|
||||
|
||||
'LBL_PARENT_ID' => 'Firma Id',
|
||||
|
||||
'LBL_TYPE' => 'Typ',
|
||||
|
||||
'LBL_ECMQUOTE_ID' => 'Id Oferty',
|
||||
|
||||
'LBL_ECMQUOTE_NAME' => 'Nazwa Oferty',
|
||||
|
||||
'LBL_STATUS' => 'Status',
|
||||
|
||||
'LBL_REGISTER_DATE' => 'Data dokumentu',
|
||||
|
||||
'LBL_SELL_DATE' => 'Data sprzedazy',
|
||||
|
||||
'LBL_PAYMENT_DATE' => 'Termin zapłaty',
|
||||
|
||||
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
|
||||
|
||||
'LBL_PARENT_ADDRESS_CITY' => 'Kod pocztowy / Miasto',
|
||||
|
||||
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Kod pocztowy',
|
||||
|
||||
'LBL_PARENT_ADDRESS_COUNTRY' => 'Panstwo',
|
||||
|
||||
'LBL_TO_VATID' => 'VAT-ID',
|
||||
|
||||
'LBL_TO_IS_VAT_FREE' => 'Czy jest wolne od vatu?',
|
||||
|
||||
'LBL_HEADER_TEXT' => 'Tekst naglówka',
|
||||
|
||||
'LBL_FOOTER_TEXT' => 'Tekst stopki',
|
||||
|
||||
'LBL_ADS_TEXT' => 'Dodatkowy tekst',
|
||||
|
||||
'LBL_SUBTOTAL' => 'Suma',
|
||||
|
||||
'LBL_TOTAL' => 'Suma',
|
||||
|
||||
'LBL_DISCOUNT' => 'Rabat (%)',
|
||||
|
||||
'LBL_VAT' => 'VAT',
|
||||
|
||||
'LBL_ACCEPTED' => 'Zaakceptowane',
|
||||
|
||||
'LBL_TEMPLATE_ID' => 'Id Szablonu',
|
||||
|
||||
'LBL_TEMPLATE_NAME' => 'Szablon',
|
||||
|
||||
'LBL_PAYMENTCONDITION_NAME' => 'Warunki zapłaty',
|
||||
'LBL_PAYMENTCONDITION_VALUE' => 'Termin płatności',
|
||||
'LBL_PAYMENTCONDITION_ID' => 'Warunki Platnosci ID',
|
||||
|
||||
'LBL_DELIVERYCONDITION_NAME' => 'Warunki Dostawy',
|
||||
'LBL_DELIVERYCONDITION_ID' => 'Warunki Dostawy ID',
|
||||
|
||||
'LBL_FORMAT_NUMBER_ERROR' => 'Blad formatu numeru!',
|
||||
|
||||
'LBL_SAVE_FORM_ERROR' => 'Wystepuja bledy na liscie produktów albo w formularzu!',
|
||||
|
||||
'LBL_DISCOUNT_ERROR' => 'Blad formatu upustu',
|
||||
|
||||
'LBL_EDITTABLE_NO' => 'Lp.',
|
||||
'LBL_EDITTABLE_CODE' => 'Kod',
|
||||
'LBL_EDITTABLE_NAME' => 'Nazwa',
|
||||
'LBL_EDITTABLE_QUANTITY' => 'Ilosc',
|
||||
'LBL_EDITTABLE_PRICE' => 'Cena',
|
||||
'LBL_EDITTABLE_VAT' => 'VAT',
|
||||
'LBL_EDITTABLE_DISCOUNT' => 'Upust',
|
||||
'LBL_EDITTABLE_TOTAL' => 'Suma',
|
||||
'LBL_EDITTABLE_OPTIONS' => 'Opcje',
|
||||
|
||||
'LBL_MOVE_ROW_UP' => 'W góre',
|
||||
'LBL_MOVE_ROW_DOWN' => 'W dól',
|
||||
'LBL_INSERT_NEW_ROW' => 'Wstaw nowy wiersz',
|
||||
'LBL_DELETE_ROW' => 'Usun wiersz',
|
||||
|
||||
'LBL_VALIDTILL_DATE' => 'Wazne do',
|
||||
|
||||
// FOR MENU LINKS
|
||||
|
||||
'LNK_NEW_ECMQUOTE' => 'Utwórz Fakturę',
|
||||
|
||||
'LNK_ECMQUOTES_LIST' => 'Lista Faktur',
|
||||
|
||||
'LBL_IMG_SEARCH' => 'Wyszukiwanie',
|
||||
|
||||
'LBL_IMG_NEW' => 'Nowy, dodaj do bazy',
|
||||
|
||||
'LBL_IMG_EDIT' => 'Edycja',
|
||||
|
||||
'LBL_CONFIRM_QUESTION' => 'Chcesz potwierdzic tą Ofertę?',
|
||||
|
||||
'LBL_QUOTE_PDF' => 'Pokaz PDF',
|
||||
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Pokaz PDF [Alt+P]',
|
||||
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Pokaz Ofertę w pliku PDF.',
|
||||
|
||||
'LBL_QUOTE_TO_INVOICE' => 'Stwórz Fakture',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Stwórz Fakture [Alt+I]',
|
||||
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Stwórz Fakture.',
|
||||
|
||||
'LBL_QUOTE_TO_SALE' => 'Stwórz Zamówienie Sprzedazy',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Stwórz Zamówienie Sprzedazy [Alt+O]',
|
||||
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Stwórz Zamówienie Sprzedazy.',
|
||||
|
||||
'LBL_SEND_TO_CONFIRM' => 'Wyslij Do Potwierdzenia',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Wyslij Do Potwierdzenia [Alt+C]',
|
||||
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Wyslij Do Potwierdzenia.',
|
||||
|
||||
'LBL_LIST_TO_INVOICE' => 'Stwórz Fakture.',
|
||||
'LBL_LIST_TO_SALE' => 'Stwórz Zamówienie Sprzedazy.',
|
||||
|
||||
// buttons
|
||||
|
||||
'LBL_SEND_BUTTON_TITLE' => 'Zapisz i Wyslij [Alt+D]',
|
||||
'LBL_SEND_BUTTON_KEY' => 'D',
|
||||
'LBL_SEND_BUTTON_LABEL' => 'Zapisz i Wyslij',
|
||||
|
||||
'LBL_REPAIR_BUTTON_TITLE' => 'Napraw [Alt+R]',
|
||||
'LBL_REPAIR_BUTTON_KEY' => 'R',
|
||||
'LBL_REPAIR_BUTTON_LABEL' => 'Napraw',
|
||||
|
||||
'LBL_ACCEPT_BUTTON_TITLE' => 'Zaakceptuj [Alt+Z]',
|
||||
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
|
||||
'LBL_ACCEPT_BUTTON_LABEL' => 'Zaakceptuj',
|
||||
|
||||
'LBL_REJECT_BUTTON_TITLE' => 'Nie akceptuj [Alt+R]',
|
||||
'LBL_REJECT_BUTTON_KEY' => 'R',
|
||||
'LBL_REJECT_BUTTON_LABEL' => 'Nie akceptuj',
|
||||
// PAYER START
|
||||
'LBL_PARENT_PAYER_ADDRESS'=>'Adres płatnika',
|
||||
// PAYER END
|
||||
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Idz do listy Ofert [Alt+G]',
|
||||
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
|
||||
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Idz do listy',
|
||||
|
||||
'LBL_SENDEMAIL_BUTTON' => 'Wyslij Email',
|
||||
|
||||
'LBL_NOT_SAVED' => 'Oferta nie została zapisana. Sprawdz czy wszytskie pola sa poprawne!',
|
||||
|
||||
'LBL_SAVED' => 'Oferta została zapisana pomyslnie.',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
|
||||
|
||||
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
|
||||
|
||||
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
|
||||
|
||||
'LBL_NOTES_SUBPANEL_TITLE' => 'Notatki',
|
||||
|
||||
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emaile',
|
||||
|
||||
'LBL_DASHLET_MY_ECMQUOTES' => 'Oferty',
|
||||
|
||||
'LNK_ECMQUOTES_PDFLANGUAGES' => 'Ustawienia PDF',
|
||||
'LBL_ECMQUOTES_PDFLANGUAGES_TITLE' => 'Ustawienia jezyków PDFa',
|
||||
|
||||
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Correct Document is not accepted by Manager!",
|
||||
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Correct Document to confirm error! Refresh site and try again.",
|
||||
|
||||
'LBL_STATUS_s10_SET_MESSAGE' => "Status Oferty ustawiony.",
|
||||
'LBL_STATUS_s20_SET_MESSAGE' => "Oferta czeka na potwierdzenie.",
|
||||
'LBL_STATUS_s30_SET_MESSAGE' => "Oferta jest potwierdzony.",
|
||||
'LBL_STATUS_s40_SET_MESSAGE' => "Status Oferty ustawiony.",
|
||||
|
||||
'LBL_STATUS_s20_FAIL_MESSAGE' => "Blad wysylki do potwierdzenia! Odswiez strone i sprobuj ponownie.",
|
||||
|
||||
'LBL_LIST_SEND_TO_CONFIRM' => 'Wyslij do Potwierdzenia',
|
||||
'LBL_LIST_DUPLICATE' => 'Duplikuj',
|
||||
'LBL_LIST_PREVIEW_PDF' => 'Podglad Oferty',
|
||||
'LBL_LIST_REJECT' => 'Nie akceptuj',
|
||||
'LBL_LIST_ACCEPT' => 'Akceptuj',
|
||||
|
||||
'LBL_MODIFIED_USER' => 'Zmodyfikowane Przez',
|
||||
|
||||
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
|
||||
|
||||
'LBL_ORDER_ORIGIN' => 'Zródlo zamówienia',
|
||||
|
||||
'LBL_PREVIEW_HEADER_NAME' => 'Podglad',
|
||||
'LBL_PREVIEW_HEADER_CLOSE' => 'Zamknij',
|
||||
|
||||
'LBL_CONTACT_NAME' => 'Kontakt',
|
||||
'LBL_CONTACT_ID' => 'Id Kontaktu',
|
||||
'LBL_PARENT_NAME_COPY' => 'Nazwa Firmy',
|
||||
'LBL_PARENT_CONTACT_NAME' => 'Osoba Kontaktowa',
|
||||
'LBL_PARENT_CONTACT_TITLE' => 'Tytul Kontaktu',
|
||||
|
||||
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Czy zaladowac domyslne teksty dla tego jezyka?',
|
||||
'LBL_LIST_DOWNLOAD_PDF' => 'Pobierz PDF',
|
||||
|
||||
'LBL_IMAGE_SIZE' => 'Rozmiar obrazków (%)',
|
||||
|
||||
// mz new fields
|
||||
'LBL_SEARCH' => 'Wyszukaj',
|
||||
'LBL_CATEGORY' => 'Kategoria',
|
||||
'LBL_SEARCH_STOCK' => 'Stan magazynowy',
|
||||
'LBL_SEARCH_STOCK_OPT_ALL' => 'Wszystkie',
|
||||
'LBL_SEARCH_STOCK_OPT_NOT_NULL' => 'Dostepne na magazynie',
|
||||
'LBL_SEARCH_SORT' => 'Sortuj wyniki wg.',
|
||||
'LBL_SEARCH_SORT_CODE' => 'Kod rosnąco',
|
||||
'LBL_SEARCH_SORT_CODE_DESC' => 'Kod malejąco',
|
||||
'LBL_SEARCH_SORT_NAME' => 'Nazwa rosnąco',
|
||||
'LBL_SEARCH_SORT_NAME_DESC' => 'Nazwa malejąco',
|
||||
// PDF labels
|
||||
'LBL_PDF_FOOTER_KRS' => 'KRS:',
|
||||
'LBL_PDF_FOOTER_NIP' => 'NIP:',
|
||||
'LBL_PDF_FOOTER_REGON' => 'REGON:',
|
||||
'LBL_PDF_FOOTER_BANK' => 'Bank:',
|
||||
'LBL_PDF_FOOTER_BANK_ACCOUNT' => 'Number konta:',
|
||||
'LBL_PDF_FOOTER_GIOS' => 'Numer GIOS:',
|
||||
'LBL_PDF_CONTENT_QUOTE_FOR' => 'Oferta dla:',
|
||||
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Data wystawienia:',
|
||||
'LBL_PDF_CONTENT_ISSUED_BY' => 'Wystawił:',
|
||||
'LBL_PDF_CONTENT_NUMBER' => 'Numer:',
|
||||
'LBL_SEARCH_NUMBERS'=>'Numeruj',
|
||||
'LBL_SEARCH_NUMBERS_NO'=>'Nie',
|
||||
'LBL_SEARCH_NUMBERS_YES'=>'Tak',
|
||||
'LBL_PDF_CONTENT_LIST_POSITION' => 'Lp.',
|
||||
'LBL_PDF_CONTENT_LIST_IMAGE' => 'Zdjęcie',
|
||||
'LBL_PDF_CONTENT_LIST_NAME' => 'Nazwa',
|
||||
'LBL_PDF_CONTENT_LIST_CODE' => 'Indeks',
|
||||
'LBL_PDF_CONTENT_LIST_QTY' => 'Ilość',
|
||||
'LBL_PDF_CONTENT_LIST_UNIT' => 'j.m.',
|
||||
'LBL_PDF_CONTENT_LIST_EAN' => 'Ean',
|
||||
'LBL_PDF_CONTENT_LIST_EAN2' => 'Ean 2',
|
||||
'LBL_PDF_CONTENT_LIST_RECIPIENT_CODE' => 'Kod odbiorcy',
|
||||
'LBL_PDF_CONTENT_LIST_REMARKS' => 'Uwagi',
|
||||
'LBL_PDF_CONTENT_LIST_PRICE_START' => 'Cena początkowa',
|
||||
'LBL_PDF_CONTENT_LIST_PRICE_NETTO' => 'Cena netto',
|
||||
'LBL_PDF_CONTENT_LIST_DISCOUNT' => 'Rabat',
|
||||
'LBL_PDF_CONTENT_LIST_TOTAL_NETTO' => 'Wartość netto',
|
||||
'LBL_PDF_CONTENT_TOTAL_NETTO' => 'Suma netto',
|
||||
'LBL_PDF_CONTENT_TOTAL_BRUTTO' => 'Suma brutto',
|
||||
'LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'=>'Nr dokumentu WZ',
|
||||
'LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'=>'Nr zamówienia',
|
||||
'LBL_PDF_CONTENT_PARENT_SUPPLIER_CODE'=>'Kod dostawcy',
|
||||
'LBL_PDF_CONTENT_DELIVERY'=>'ODBIORCA',
|
||||
'LBL_PDF_CONTENT_SELL_DATE'=>'Data dokonania lub zakończenia dostawy towarów lub wykonania usługi:',
|
||||
'LBL_PDF_CONTENT_NIP'=>'NIP:',
|
||||
'LBL_PDF_TO_PAY'=>'Do zapłaty:',
|
||||
'LBL_PDF_PAID'=>'Zapłacono:',
|
||||
'LBL_PDF_LEFT_TO_PAID'=>'Pozostało:'
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
78
modules/EcmInvoiceOuts/metadata/SearchFields.php
Executable file
78
modules/EcmInvoiceOuts/metadata/SearchFields.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry)
|
||||
die('Not A Valid Entry Point');
|
||||
/*****************************************************************************
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
* either express or implied.
|
||||
*
|
||||
* You may:
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
* a royalty or other fee.
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
* publicly available and document your modifications clearly.
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
* obligations for your customers.
|
||||
*
|
||||
* You may NOT:
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
* Provider).
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
* involves PHYSICAL media.
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
* or License text in the Licensed Software
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
* Licensed Software.
|
||||
*
|
||||
* You must:
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
*
|
||||
* The Original Code is: CommuniCore
|
||||
* Olavo Farias
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
*
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
$searchFields['EcmInvoiceOuts'] = array(
|
||||
'name' => array(
|
||||
'query_type' => 'default'
|
||||
),
|
||||
'description' => array(
|
||||
'query_type' => 'default'
|
||||
),
|
||||
'current_user_only' => array(
|
||||
'query_type' => 'default',
|
||||
'db_field' => array(
|
||||
'assigned_user_id'
|
||||
),
|
||||
'my_items' => true
|
||||
),
|
||||
'assigned_user_id' => array(
|
||||
'query_type' => 'default'
|
||||
),
|
||||
'status' => array(
|
||||
'query_type' => 'default'
|
||||
),
|
||||
'register_date' => array(
|
||||
'query_type' => 'default'
|
||||
),
|
||||
'parent_name' => array(
|
||||
'query' => 'default'
|
||||
)
|
||||
);
|
||||
?>
|
||||
420
modules/EcmInvoiceOuts/metadata/detailviewdefs.php
Executable file
420
modules/EcmInvoiceOuts/metadata/detailviewdefs.php
Executable file
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
/*********************************************************************************
|
||||
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
|
||||
*
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
|
||||
*
|
||||
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
|
||||
* details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
|
||||
* 02110-1301 USA.
|
||||
|
||||
*
|
||||
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
|
||||
*
|
||||
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
|
||||
*
|
||||
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
|
||||
* "Powered by SugarCRM".
|
||||
|
||||
* *******************************************************************************/
|
||||
global $app_list_strings;
|
||||
|
||||
$viewdefs['EcmInvoiceOuts']['DetailView'] = array(
|
||||
|
||||
'templateMeta' => array(
|
||||
|
||||
'form' => array(
|
||||
|
||||
'buttons' => array(
|
||||
'CANCEL_DOC',
|
||||
|
||||
array(
|
||||
'customCode' => '{if $CAN_EDIT == true} {$editButton}{/if}'
|
||||
),
|
||||
array(
|
||||
'customCode' => '<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmInvoiceOuts\'; this.form.return_action.value=\'DetailView\'; this.form.isDuplicate.value=true; this.form.action.value=\'EditView\'; this.form.return_id.value=\'{$id}\';" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">'
|
||||
),
|
||||
array(
|
||||
'customCode' => "{include_php file='include/ECM/EcmCreatePdfButton.php'}",
|
||||
),
|
||||
array(
|
||||
'customCode' => " {include_php file='include/ECM/EcmSendPdfButton/EcmSendPdfButtonController.php}"
|
||||
),
|
||||
array(
|
||||
'customCode' => ' '
|
||||
),
|
||||
array(
|
||||
'customCode' => '{if $CREATE_COR == true} <input name="create_correct" id="create_correct" title="{$MOD.LBL_CORRECT_TITLE}" class="button" onclick="window.location = \'index.php?module=EcmInvoiceOuts&offset=1&return_module=EcmInvoiceOuts&action=EditView&return_action=index&record={$fields.id.value}&isCorrect=true\';" type="button" value="{$MOD.LBL_CORRECT}">{/if}'
|
||||
),
|
||||
array(
|
||||
'customCode' => '<input title="" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmSales&action=EditView&ecminvoiceout_id={$id}\',\'_blank\'); return;" type="button" name="Create_ZS" value="Utwórz ZS" id="duplicate_button">'
|
||||
),
|
||||
array(
|
||||
'customCode' => '{if $CREATE_KP == true} <input name="create_correct" id="create_correct" title="{$MOD.LBL_CORRECT_TITLE}" class="button" onclick="window.location = \'index.php?module=EcmNewKpkws&action=EditView&return_module=EcmNewKpkws&return_action=DetailView&type=0&parentTab=Kasa&parent_doc_id={$fields.id.value}&parent_doc_type=0\';" type="button" value="Utwórz KP">{/if}'
|
||||
),
|
||||
array(
|
||||
'customCode' => '{if $EDI == true}<input name="edi" id="edi" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&record={$fields.id.value}&action=getEDI&to_pdf=1\');" type="button" value="EDI - wyślij fakturę">{/if}',
|
||||
),
|
||||
),
|
||||
|
||||
'hidden' => array(
|
||||
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'{$fields.vats_summary.value}\'>',
|
||||
'<input type="hidden" id="total_netto" value=\'{$fields.total_netto.value}\'>',
|
||||
'<input type="hidden" id="total_brutto" value=\'{$fields.total_brutto.value}\'>',
|
||||
'<input type="hidden" id="discount" value=\'{$fields.discount.value}\'>',
|
||||
'<input type="hidden" id="no_tax" value=\'{$fields.no_tax.value}\'>'
|
||||
)
|
||||
),
|
||||
|
||||
'maxColumns' => '2',
|
||||
|
||||
'widths' => array(
|
||||
|
||||
array(
|
||||
'label' => '10',
|
||||
'field' => '30'
|
||||
),
|
||||
|
||||
array(
|
||||
'label' => '10',
|
||||
'field' => '30'
|
||||
)
|
||||
),
|
||||
|
||||
'includes' => array(
|
||||
array(
|
||||
'file' => 'include/JSON.js'
|
||||
),
|
||||
array(
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/EcmInvoiceOutsDetail.js'
|
||||
),
|
||||
array(
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/bimit_table8.js'
|
||||
),
|
||||
array(
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/columndefs-detail.js'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'panels' => array(
|
||||
|
||||
'LBL_DETAILS_TAB' => array(
|
||||
|
||||
array(
|
||||
|
||||
'document_no',
|
||||
|
||||
'assigned_user_name'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_name',
|
||||
'tabIndex' => '1'
|
||||
),
|
||||
'category'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'register_date',
|
||||
'tabIndex' => '1',
|
||||
'type' => 'datetime',
|
||||
'displayParams' => array(
|
||||
'showFormats' => true
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' => 'stock_name',
|
||||
'label' => 'LBL_STOCK_NAME'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'sell_date',
|
||||
'tabIndex' => '1',
|
||||
'type' => 'datetime',
|
||||
'displayParams' => array(
|
||||
'showFormats' => true
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' => 'type',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'order_no',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'zs_no',
|
||||
'label' => 'Dokument ZS',
|
||||
'customCode' => '{$zs_no}'
|
||||
),
|
||||
array(
|
||||
'name' => 'wz_no',
|
||||
'label' => 'Dokumenty WZ',
|
||||
'customCode' => '{$wz_no}'
|
||||
)
|
||||
),
|
||||
array()
|
||||
// array (
|
||||
// 'name' => 'currency_id',
|
||||
// 'label' => 'LBL_CURRENCY'
|
||||
// )
|
||||
,
|
||||
array(
|
||||
array(
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_PAYMENTS}</h4>'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'total_brutto',
|
||||
'label' => 'LBL_TO_PAID'
|
||||
),
|
||||
'payment_date'
|
||||
),
|
||||
array(
|
||||
'prepaid',
|
||||
'payment_date_days'
|
||||
),
|
||||
array(
|
||||
'prepaid_nr',
|
||||
'discount'
|
||||
),
|
||||
array(
|
||||
'paid_val',
|
||||
'bankaccount'
|
||||
),
|
||||
array(
|
||||
'payment_method_paid'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'paid_fetf',
|
||||
'label' => 'LBL_LEFT',
|
||||
'customCode' => '<p id="paid_left">{$PAID_LEFT}</p>'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'payment_method'
|
||||
),
|
||||
array(
|
||||
|
||||
array(
|
||||
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
|
||||
'hideLabel' => true,
|
||||
|
||||
'customCode' => '<br><b>{$MOD.LBL_TO_INFORMATIONS}</b>'
|
||||
)
|
||||
),
|
||||
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_name_copy',
|
||||
'customCode' => '{$fields.parent_name.value}'
|
||||
),
|
||||
array(
|
||||
'name' => 'pdf_type',
|
||||
'label' => 'LBL_PDF_TYPE'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_nip',
|
||||
array(
|
||||
'name' => 'currency_id',
|
||||
'label' => 'LBL_CURRENCY'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_address_street',
|
||||
'currency_value_nbp'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_address_city',
|
||||
'tabIndex' => 't',
|
||||
'customCode' => '{$fields.parent_address_postalcode.value} {$fields.parent_address_city.value}'
|
||||
),
|
||||
array(
|
||||
'name' => 'currency_table',
|
||||
'label' => 'LBL_CURRENCY_TABLE'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_address_country',
|
||||
'ecmlanguage',
|
||||
),
|
||||
array(
|
||||
'parent_iln'
|
||||
),
|
||||
array(
|
||||
'pdf_text'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_SHIPPING_ADDRESS}</h4>'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_shipping_address_name'
|
||||
),
|
||||
array(
|
||||
'parent_shipping_nip'
|
||||
),
|
||||
array(
|
||||
'parent_shipping_address_street'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_shipping_address_city',
|
||||
'customCode' => '{$fields.parent_shipping_address_postalcode.value} {$fields.parent_shipping_address_city.value}'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_shipping_address_country'
|
||||
),
|
||||
array(
|
||||
'parent_shipping_iln'
|
||||
),
|
||||
// platnik start
|
||||
array(
|
||||
array(
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_PAYER_ADDRESS}</h4>'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_payer_address_name'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_payer_nip',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_payer_address_street'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_payer_address_city',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<input maxlength="8" type="text" name="parent_payer_address_postalcode" id="parent_payer_address_postalcode" value="{$fields.parent_payer_address_postalcode.value}" style="vertical-align:top;width:80px;" /> <input type="text" name="parent_payer_address_city" id="parent_payer_address_city" value="{$fields.parent_payer_address_city.value}" style="vertical-align:top;width:150px;" />'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'parent_payer_address_country'
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'parent_payer_iln',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
// platnik end
|
||||
array(
|
||||
array(
|
||||
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
|
||||
'hideLabel' => true,
|
||||
|
||||
'customCode' => '<br>'
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'name' => 'date_modified',
|
||||
'label' => 'LBL_DATE_MODIFIED',
|
||||
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$MODIFIED_BY_NAME}'
|
||||
),
|
||||
array(
|
||||
'name' => 'date_entered',
|
||||
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$CREATED_BY_NAME}'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'LBL_ITEMS_TAB' => array(
|
||||
|
||||
array(
|
||||
|
||||
array(
|
||||
'name' => 'items_list_panel',
|
||||
'allCols' => true,
|
||||
|
||||
'hideLabel' => true,
|
||||
|
||||
'customCode' => '<div id="itemsTable"></div>'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
448
modules/EcmInvoiceOuts/metadata/editviewdefs.php
Executable file
448
modules/EcmInvoiceOuts/metadata/editviewdefs.php
Executable file
@@ -0,0 +1,448 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
* *******************************************************************************/
|
||||
global $sugar_config;
|
||||
$viewdefs ['EcmInvoiceOuts'] ['EditView'] = array (
|
||||
'templateMeta' => array (
|
||||
'form' => array (
|
||||
'enctype' => 'multipart/form-data',
|
||||
'buttons' => array (
|
||||
array (
|
||||
'customCode' => '<input class="button primary" type="submit" value="Zapisz" ="button" onclick="this.form.action.value=\'Save\'; return check_form(\'EditView\',event);" accesskey="S" title="Zapisz [Alt+S]">'
|
||||
),
|
||||
'CANCEL'
|
||||
),
|
||||
'hidden' => array (
|
||||
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
|
||||
'<input type="hidden" name="new_number" id="new_number" value=\'{$NEW_NUMBER}\'>',
|
||||
'<input type="hidden" name="is_correct" id="is_correct" value=\'{$IS_CORRECT}\'>',
|
||||
'<input type="hidden" name="is_wz" id="is_wz" value=\'{$IS_WZ}\'>',
|
||||
'<input type="hidden" name="is_sale" id="is_sale" value=\'{$IS_SALE}\'>',
|
||||
'<input type="hidden" name="wz_id" id="wz_id" value=\'{$WZ_ID}\'>',
|
||||
'<input type="hidden" name="wz_name" id="wz_name" value=\'{$WZ_NAME}\'>',
|
||||
'<input type="hidden" name="correctEdit" id="correctEdit" value=\'{$correctEdit}\'>',
|
||||
'<input type="hidden" name="refresh_positions" id="refresh_positions" value=\'{$REFRESHPOSITIONS}\'>',
|
||||
'<input type="hidden" name="so_id" id="so_id" value=\'{$SO_ID}\'>',
|
||||
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'{$fields.vats_summary.value}\'>',
|
||||
'<input type="hidden" id="total_netto" name="total_netto" value=\'{$fields.total_netto.value}\'>',
|
||||
'<input type="hidden" id="total_brutto" name="total_brutto" value=\'{$fields.total_brutto.value}\'>',
|
||||
'<input type="hidden" id="total_vat" name="total_vat" value=\'{$fields.total_vat.value}\'>',
|
||||
'<input type="hidden" id="discount_val" name="discount_val" value=\'{$fields.discount_val.value}\'>',
|
||||
'<input type="hidden" id="endinvoice" name="endinvoice" value=\'{$fields.endinvoice.value}\'>',
|
||||
'<input type="hidden" id="duplicate" name="duplicate" value=\'{$DUPLICATE}\'>',
|
||||
'<input type="hidden" id="type" name="type" value="{$fields.type.value}">' ,
|
||||
'<input type="hidden" id="discount_tmp" name="discount_tmp" value="0">'
|
||||
)
|
||||
),
|
||||
'maxColumns' => '2',
|
||||
'widths' => array (
|
||||
array (
|
||||
'label' => '10',
|
||||
'field' => '30'
|
||||
),
|
||||
array (
|
||||
'label' => '10',
|
||||
'field' => '30'
|
||||
)
|
||||
),
|
||||
'includes' => array (
|
||||
array (
|
||||
'file' => 'include/JSON.js'
|
||||
),
|
||||
|
||||
array (
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/EcmInvoiceOuts4.js'
|
||||
),
|
||||
|
||||
array (
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/bimit_table8.js'
|
||||
),
|
||||
|
||||
array (
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/columndefs.js'
|
||||
),
|
||||
array (
|
||||
'file' => 'include/ECM/EcmDocumentNumberGenerator/EcmDocumentNumberGenerator.js'
|
||||
),
|
||||
array (
|
||||
'file' => 'modules/EcmInvoiceOuts/javascript/Consignments.js'
|
||||
),
|
||||
)
|
||||
),
|
||||
'panels' => array (
|
||||
'LBL_DETAILS_TAB' => array (
|
||||
array (
|
||||
array (
|
||||
'type' => 'tab',
|
||||
'active' => true
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'document_no',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<div id="tst" style="display:none;"></div><input readonly="readonly" type="text" name="document_no" id="document_no" value=\'{$fields.document_no.value}\'>
|
||||
<input type="hidden" name="number" id="number" value=\'{$fields.number.value}\'>'
|
||||
),
|
||||
array (
|
||||
'name' => 'assigned_user_name',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_name',
|
||||
'tabIndex' => '1'
|
||||
),
|
||||
array (
|
||||
'name' => 'category',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'register_date',
|
||||
'tabIndex' => '1',
|
||||
'type' => 'datetime',
|
||||
'displayParams' => array (
|
||||
'showFormats' => true
|
||||
)
|
||||
),
|
||||
array (
|
||||
'name' => 'stock_id',
|
||||
'label' => 'LBL_STOCK_NAME',
|
||||
'customCode' => '{$STOCK}'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'sell_date',
|
||||
'tabIndex' => '1',
|
||||
'type' => 'datetime',
|
||||
'displayParams' => array (
|
||||
'showFormats' => true
|
||||
)
|
||||
),
|
||||
'supplier_code'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'order_no',
|
||||
'tabIndex' => '1'
|
||||
),
|
||||
array (
|
||||
'name' => 'operation_type',
|
||||
'label' => 'LBL_OPERATION_TYPE',
|
||||
'customCode' => '{$OPERATION_TYPE}'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_PAYMENTS}</h4>'
|
||||
)
|
||||
),
|
||||
|
||||
// end payment informations
|
||||
array (
|
||||
array (
|
||||
'name' => 'to_paid',
|
||||
'label' => 'LBL_TO_PAID',
|
||||
'customCode' => '<div id="to_paid"></div>'
|
||||
),
|
||||
'payment_date'
|
||||
),
|
||||
array (
|
||||
'prepaid',
|
||||
array (
|
||||
'name' => 'payment_date_days',
|
||||
'label' => 'LBL_DAYS',
|
||||
'customCode' => '<input type="number" min="0" id="payment_date_days" name="payment_date_days" value="{$fields.payment_date_days.value}"/> '
|
||||
)
|
||||
),
|
||||
array (
|
||||
'prepaid_nr',
|
||||
'discount'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'paid_val',
|
||||
'label' => 'Zapłacono',
|
||||
'customCode' => '<input type="text" tabindex="119" title="" value="{$fields.paid_val.value|number_format:2:",":"."}" maxlength="" size="30" id="paid_val" onclick="$(this).select();" onchange="$(this).val(FormatNumber($(this).val()));" name="paid_val">'
|
||||
),
|
||||
array (
|
||||
'name' => 'bankaccount',
|
||||
'label' => 'LBL_BANKACCOUNT',
|
||||
'customCode' => '<select id="bankaccounts"></select><input type="hidden" id="bankaccount" name="bankaccount" value="{$fields.bankaccount.value}"/>',
|
||||
|
||||
)
|
||||
),
|
||||
array (
|
||||
'payment_method_paid',
|
||||
''
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'left',
|
||||
'label' => 'LBL_LEFT',
|
||||
'customCode' => '<div id="left"></div>'
|
||||
),
|
||||
''
|
||||
),
|
||||
array (
|
||||
'payment_method',
|
||||
''
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_name_copy',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<input type="text" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" readOnly="readonly" size="30" />'
|
||||
),
|
||||
array (
|
||||
'name' => 'pdf_type',
|
||||
'label' => 'LBL_PDF_TYPE'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_index_dbf',
|
||||
'tabIndex' => '1'
|
||||
),
|
||||
array (
|
||||
'name' => 'currency_id',
|
||||
'label' => 'LBL_CURRENCY'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_nip',
|
||||
'tabIndex' => '1'
|
||||
),
|
||||
array (
|
||||
'name' => 'currency_value_nbp',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '
|
||||
<input type="text" id="currency_value_nbp" name="currency_value_nbp"/>
|
||||
<input disabled value="" id="currency_table_tmp" name="currency_table_tmp"/>
|
||||
<input type="hidden" value="" id="currency_table" name="currency_table"/>
|
||||
<img style="cursor: pointer; display: none;" onclick="getCurrencyValues();" src="themes/default/images/id-ff-select.png" id="curr_trigger">
|
||||
<br><div style="position: absolute; background: rgb(246,246,246); border: 1px solid rgb(171,195,215); padding: 2 2 2 2; z-index: 100; display:none" name="cur_values" id="cur_values">
|
||||
</div>
|
||||
'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_address_street',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<textarea tabindex="1" id="parent_address_street" name="parent_address_street" rows="2" cols="30" maxlength="150" >{$fields.parent_address_street.value}</textarea>'
|
||||
),
|
||||
array (
|
||||
'name' => 'ecmlanguage',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_address_city',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<input maxlength="8" type="text" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" style="vertical-align:top;width:80px;" /> <input type="text" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" style="vertical-align:top;width:150px;" />'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_address_country',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_iln',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_SHIPPING_ADDRESS}</h4>'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'address',
|
||||
'customCode' => '<div id=\'addresses\'></div>'
|
||||
),
|
||||
''
|
||||
),
|
||||
|
||||
array (
|
||||
'parent_shipping_address_name'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_shipping_nip',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
'parent_shipping_address_street'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_shipping_address_city',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<input maxlength="8" type="text" name="parent_shipping_address_postalcode" id="parent_shipping_address_postalcode" value="{$fields.parent_shipping_address_postalcode.value}" style="vertical-align:top;width:80px;" /> <input type="text" name="parent_shipping_address_city" id="parent_shipping_address_city" value="{$fields.parent_shipping_address_city.value}" style="vertical-align:top;width:150px;" />'
|
||||
)
|
||||
),
|
||||
array (
|
||||
'parent_shipping_address_country'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_shipping_iln',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
// platnik start
|
||||
array (
|
||||
array (
|
||||
'name' => 'to_informations',
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_PAYER_ADDRESS}</h4>'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'payer',
|
||||
'customCode' => '<div id=\'payer\'></div>'
|
||||
),
|
||||
''
|
||||
),
|
||||
|
||||
array (
|
||||
'parent_payer_address_name'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_payer_nip',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
array (
|
||||
'parent_payer_address_street'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_payer_address_city',
|
||||
'tabIndex' => '1',
|
||||
'customCode' => '<input maxlength="8" type="text" name="parent_payer_address_postalcode" id="parent_payer_address_postalcode" value="{$fields.parent_payer_address_postalcode.value}" style="vertical-align:top;width:80px;" /> <input type="text" name="parent_payer_address_city" id="parent_payer_address_city" value="{$fields.parent_payer_address_city.value}" style="vertical-align:top;width:150px;" />'
|
||||
)
|
||||
),
|
||||
array (
|
||||
'parent_payer_address_country'
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'name' => 'parent_payer_iln',
|
||||
'tabIndex' => '1'
|
||||
)
|
||||
),
|
||||
// platnik end
|
||||
array (
|
||||
array (
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PDF_TEXT}</h4>'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'name' => 'pdf_text'
|
||||
)
|
||||
)
|
||||
),
|
||||
'LBL_ITEMS_TAB' => array (
|
||||
array (
|
||||
array (
|
||||
'type' => 'tab'
|
||||
)
|
||||
),
|
||||
array (
|
||||
array (
|
||||
'allCols' => true,
|
||||
'hideLabel' => true,
|
||||
'customCode' => '
|
||||
<div id="searchProducts" class="edit view search basic">
|
||||
<br>
|
||||
<input type="hidden" id="searchStart" name="searchStart" value="0">
|
||||
<input type="hidden" id="searchCount" name="searchCount" value="">
|
||||
<input type="hidden" id="searchSort" name="searchSort" value="1">
|
||||
{$MOD.LBL_SEARCH}:
|
||||
<input type="text" value="" id="searchProductsInput"/>
|
||||
<img onclick="$(\'#searchProductsInput\').val(\'%\');searchProducts();" src="modules/EcmSales/images/search.gif" style="cursor: pointer;">
|
||||
{$MOD.LBL_CATEGORY}:
|
||||
<select id="productSearchCategory"></select>
|
||||
{$MOD.LBL_SEARCH_STOCK}:
|
||||
<select id="productSearchStock" onchange="searchProducts();">
|
||||
<option value="1">Produkty</option>
|
||||
<option value="4">Magazyn </option>
|
||||
<option value="3">Dostępne</option>
|
||||
</select>
|
||||
|
||||
<button onclick="createProduct();" class="button" type="button"><img src="themes/default/images/id-ff-add.png"></button>
|
||||
<input type="hidden" id="newProductId" value=""/>
|
||||
</div>
|
||||
<div id="searchResultDiv"/></div>
|
||||
<br><br><div id="itemsTable"></div>'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
141
modules/EcmInvoiceOuts/metadata/listviewdefs.php
Executable file
141
modules/EcmInvoiceOuts/metadata/listviewdefs.php
Executable file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
if (!defined('sugarEntry') || !sugarEntry)
|
||||
die('Not A Valid Entry Point');
|
||||
/*****************************************************************************
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
* either express or implied.
|
||||
*
|
||||
* You may:
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
* a royalty or other fee.
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
* publicly available and document your modifications clearly.
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
* obligations for your customers.
|
||||
*
|
||||
* You may NOT:
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
* Provider).
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
* involves PHYSICAL media.
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
* or License text in the Licensed Software
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
* Licensed Software.
|
||||
*
|
||||
* You must:
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
*
|
||||
* The Original Code is: CommuniCore
|
||||
* Olavo Farias
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
*
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
$listViewDefs["EcmInvoiceOuts"] = array(
|
||||
'TYPE' => array(
|
||||
'width' => '1',
|
||||
'label' => 'T',
|
||||
'default' => true
|
||||
),
|
||||
'NUMBER' => array(
|
||||
'width' => '5',
|
||||
'label' => 'LBL_DOCUMENT_NO',
|
||||
'sortable' => true,
|
||||
'link' => false,
|
||||
'default' => true
|
||||
),
|
||||
|
||||
'PARENT_NAME' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_PARENT_NAME',
|
||||
'default' => true
|
||||
),
|
||||
'TOTAL_NETTO' => array(
|
||||
'width' => '3',
|
||||
'label' => 'Wartość Netto',
|
||||
'align' => 'right',
|
||||
'default' => true,
|
||||
'sumType' => 'sum'
|
||||
),
|
||||
'TOTAL_BRUTTO' => array(
|
||||
'width' => '3',
|
||||
'label' => 'Wartość brutto',
|
||||
'align' => 'right',
|
||||
'default' => true,
|
||||
'sumType' => 'sum'
|
||||
),
|
||||
'CURRENCY_ID' => array(
|
||||
'width' => '1',
|
||||
'label' => 'Waluta',
|
||||
'align' => 'right',
|
||||
'default' => true,
|
||||
'sortable' => false
|
||||
),
|
||||
'MODIFIED_BY_NAME' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_MODIFIED_USER',
|
||||
'module' => 'Users',
|
||||
'id' => 'USERS_ID',
|
||||
'default' => false,
|
||||
'sortable' => false,
|
||||
'related_fields' => array(
|
||||
'modified_user_id'
|
||||
)
|
||||
),
|
||||
|
||||
'REGISTER_DATE' => array(
|
||||
'width' => '5',
|
||||
'label' => 'Data dokumentu',
|
||||
'default' => true,
|
||||
|
||||
),
|
||||
'ZS_NO' => array(
|
||||
'width' => '5',
|
||||
'label' => 'Dokument ZS',
|
||||
'default' => true,
|
||||
|
||||
),
|
||||
'WZ_NO' => array(
|
||||
'width' => '5',
|
||||
'label' => 'Dokument WZ',
|
||||
'default' => true,
|
||||
|
||||
),
|
||||
|
||||
'EMAIL' => array(
|
||||
'width' => '2',
|
||||
'label' => 'Email wysłany',
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'align' => 'right'
|
||||
),
|
||||
'OPTIONS' => array(
|
||||
'width' => '2',
|
||||
'label' => 'PDF',
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'align' => 'center'
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
67
modules/EcmInvoiceOuts/metadata/searchdefs.php
Executable file
67
modules/EcmInvoiceOuts/metadata/searchdefs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$searchdefs['EcmInvoiceOuts'] = array(
|
||||
'templateMeta' => array(
|
||||
'maxColumns' => '3',
|
||||
'widths' => array(
|
||||
'label' => '10',
|
||||
'field' => '30'
|
||||
)
|
||||
),
|
||||
'layout' => array(
|
||||
'basic_search' => array(
|
||||
'document_no',
|
||||
'stock_id',
|
||||
'parent_name',
|
||||
'type',
|
||||
array(
|
||||
'name' => 'current_user_only',
|
||||
'label' => 'LBL_CURRENT_USER_FILTER',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'register_date'
|
||||
),
|
||||
'advanced_search' => array(
|
||||
'document_no',
|
||||
'stock_id',
|
||||
'name',
|
||||
'parent_name',
|
||||
'register_date',
|
||||
'type',
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
76
modules/EcmInvoiceOuts/metadata/studio.php
Executable file
76
modules/EcmInvoiceOuts/metadata/studio.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*****************************************************************************
|
||||
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
|
||||
* Version 1.1 ("License"); You may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* http://opensource.org/licenses/rpl.php. Software distributed under the
|
||||
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
|
||||
* either express or implied.
|
||||
*
|
||||
* You may:
|
||||
* a) Use and distribute this code exactly as you received without payment or
|
||||
* a royalty or other fee.
|
||||
* b) Create extensions for this code, provided that you make the extensions
|
||||
* publicly available and document your modifications clearly.
|
||||
* c) Charge for a fee for warranty or support or for accepting liability
|
||||
* obligations for your customers.
|
||||
*
|
||||
* You may NOT:
|
||||
* a) Charge for the use of the original code or extensions, including in
|
||||
* electronic distribution models, such as ASP (Application Service
|
||||
* Provider).
|
||||
* b) Charge for the original source code or your extensions other than a
|
||||
* nominal fee to cover distribution costs where such distribution
|
||||
* involves PHYSICAL media.
|
||||
* c) Modify or delete any pre-existing copyright notices, change notices,
|
||||
* or License text in the Licensed Software
|
||||
* d) Assert any patent claims against the Licensor or Contributors, or
|
||||
* which would in any way restrict the ability of any third party to use the
|
||||
* Licensed Software.
|
||||
*
|
||||
* You must:
|
||||
* a) Document any modifications you make to this code including the nature of
|
||||
* the change, the authors of the change, and the date of the change.
|
||||
* b) Make the source code for any extensions you deploy available via an
|
||||
* Electronic Distribution Mechanism such as FTP or HTTP download.
|
||||
* c) Notify the licensor of the availability of source code to your extensions
|
||||
* and include instructions on how to acquire the source code and updates.
|
||||
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
|
||||
* reproduce, perform, modify, sublicense, and distribute your extensions.
|
||||
*
|
||||
* The Original Code is: CommuniCore
|
||||
* Olavo Farias
|
||||
* 2006-04-7 olavo.farias@gmail.com
|
||||
*
|
||||
* The Initial Developer of the Original Code is CommuniCore.
|
||||
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
|
||||
* All Rights Reserved.
|
||||
********************************************************************************/
|
||||
|
||||
$GLOBALS['studioDefs']['EcmInvoiceOuts'] = array(
|
||||
'LBL_DETAILVIEW'=>array(
|
||||
'template' => 'xtpl',
|
||||
'template_file' => 'modules/EcmInvoiceOuts/DetailView.html',
|
||||
'php_file' => 'modules/EcmInvoiceOuts/DetailView.php',
|
||||
'type' => 'DetailView',
|
||||
),
|
||||
'LBL_EDITVIEW'=>array(
|
||||
'template' => 'xtpl',
|
||||
'template_file' => 'modules/EcmInvoiceOuts/EditView.html',
|
||||
'php_file' => 'modules/EcmInvoiceOuts/EditView.php',
|
||||
'type' => 'EditView',
|
||||
),
|
||||
'LBL_LISTVIEW'=>array(
|
||||
'template' => 'listview',
|
||||
'meta_file' => 'modules/EcmInvoiceOuts/listviewdefs.php',
|
||||
'type' => 'ListView',
|
||||
),
|
||||
'LBL_SEARCHFORM'=>array(
|
||||
'template' => 'xtpl',
|
||||
'template_file' => 'modules/EcmInvoiceOuts/SearchForm.html',
|
||||
'php_file' => 'modules/EcmInvoiceOuts/ListView.php',
|
||||
'type' => 'SearchForm',
|
||||
),
|
||||
|
||||
);
|
||||
115
modules/EcmInvoiceOuts/metadata/subpaneldefs.php
Executable file
115
modules/EcmInvoiceOuts/metadata/subpaneldefs.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/**
|
||||
|
||||
* Layout definition for Accounts
|
||||
|
||||
*
|
||||
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
|
||||
*
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
|
||||
*
|
||||
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
|
||||
* details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
|
||||
* 02110-1301 USA.
|
||||
|
||||
*
|
||||
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
|
||||
*
|
||||
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
|
||||
*
|
||||
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
|
||||
* "Powered by SugarCRM".
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$layout_defs['EcmInvoiceOuts']['subpanel_setup'] = array (
|
||||
|
||||
'documents' => array(
|
||||
'order' => 130,
|
||||
'module' => 'Documents',
|
||||
'subpanel_name' => 'default',
|
||||
'get_subpanel_data' => 'documents',
|
||||
'title_key' => 'Dokumenty',
|
||||
),
|
||||
/*
|
||||
'emails' => array (
|
||||
|
||||
'order' => 15,
|
||||
|
||||
'module' => 'Emails',
|
||||
|
||||
'sort_order' => 'asc',
|
||||
|
||||
'sort_by' => 'date_modified',
|
||||
|
||||
'get_subpanel_data' => 'emails',
|
||||
|
||||
'add_subpanel_data' => 'emails_id',
|
||||
|
||||
'subpanel_name' => 'ForEcmInvoiceOuts',
|
||||
|
||||
'title_key' => 'LBL_EMAILS_SUBPANEL_TITLE',
|
||||
|
||||
'top_buttons' => array(),
|
||||
|
||||
),
|
||||
*/
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
129
modules/EcmInvoiceOuts/metadata/subpanels/ForProduct.php
Executable file
129
modules/EcmInvoiceOuts/metadata/subpanels/ForProduct.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for Contacts
|
||||
*
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
$subpanel_layout = array(
|
||||
|
||||
|
||||
'where' => '',
|
||||
|
||||
|
||||
|
||||
'list_fields' => array (
|
||||
|
||||
/*
|
||||
'number' => array (
|
||||
'name' => 'number',
|
||||
'vname' => 'LBL_NUMBER',
|
||||
'module' => 'EcmSales',
|
||||
'usage' => 'query_only',
|
||||
),
|
||||
*/
|
||||
'document_no' => array (
|
||||
'name' => 'document_no',
|
||||
'vname' => 'LBL_DOCUMENT_NO',
|
||||
'module' => 'EcmSales',
|
||||
'widget_class' => 'SubPanelDetailViewLink',
|
||||
'width' => '5%',
|
||||
),
|
||||
'PARENT_NAME' => array(
|
||||
'width' => '10%',
|
||||
'vname' => 'Kontrahent',
|
||||
'default' => true,
|
||||
),
|
||||
'register_date' => array (
|
||||
'name' => 'register_date',
|
||||
'vname' => 'LBL_REGISTER_DATE',
|
||||
'module' => 'EcmSales',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'QUANTITY' => array (
|
||||
'name' => 'quantity',
|
||||
'vname' => 'Ilość',
|
||||
'align'=>'right',
|
||||
'module' => 'EcmSales',
|
||||
'width' => '5%',
|
||||
),
|
||||
'PRICE_NETTO' => array (
|
||||
'name' => 'price_netto',
|
||||
'vname' => 'Cena netto',
|
||||
'align'=>'right',
|
||||
'module' => 'EcmSales',
|
||||
'width' => '5%',
|
||||
),
|
||||
'TOTAL_NETTO' => array (
|
||||
'name' => 'total_netto',
|
||||
'vname' => 'Wartość netto',
|
||||
'align'=>'right',
|
||||
'module' => 'EcmSales',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'options' => array (
|
||||
'name' => 'options',
|
||||
'label' => ' ',
|
||||
'default' => true,
|
||||
'width' => '5%',
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
'TYPE' => array (
|
||||
'name' => 'status',
|
||||
'vname' => 'Typ',
|
||||
'module' => 'EcmSales',
|
||||
'width' => '60%',
|
||||
),
|
||||
/*
|
||||
'PDF_URL' => array(
|
||||
'width' => '2%',
|
||||
'label' => ' ',
|
||||
'link' => true,
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
'edit_button'=>array(
|
||||
'widget_class' => 'SubPanelEditButton',
|
||||
'width' => '2%',
|
||||
),
|
||||
*/
|
||||
|
||||
),
|
||||
);
|
||||
?>
|
||||
129
modules/EcmInvoiceOuts/metadata/subpanels/default.php
Executable file
129
modules/EcmInvoiceOuts/metadata/subpanels/default.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for Contacts
|
||||
*
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
$subpanel_layout = array(
|
||||
'top_buttons' => array(
|
||||
array('widget_class' => 'SubPanelTopCreateButton'),
|
||||
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmInvoiceOuts'),
|
||||
),
|
||||
|
||||
'where' => '',
|
||||
|
||||
|
||||
|
||||
'list_fields' => array (
|
||||
|
||||
/*
|
||||
'number' => array (
|
||||
'name' => 'number',
|
||||
'vname' => 'LBL_NUMBER',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'usage' => 'query_only',
|
||||
),
|
||||
*/
|
||||
'document_no' => array (
|
||||
'name' => 'document_no',
|
||||
'vname' => 'LBL_DOCUMENT_NO',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'widget_class' => 'SubPanelDetailViewLink',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'register_date' => array (
|
||||
'name' => 'register_date',
|
||||
'vname' => 'LBL_REGISTER_DATE',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'total_netto' => array (
|
||||
'name' => 'total_netto',
|
||||
'vname' => 'Wartość netto',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'width' => '5%',
|
||||
'align' => 'right',
|
||||
),
|
||||
|
||||
'total_brutto' => array (
|
||||
'name' => 'total_brutto',
|
||||
'vname' => 'Wartość brutto',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'width' => '5%',
|
||||
'align' => 'right',
|
||||
),
|
||||
|
||||
'options' => array (
|
||||
'name' => 'options',
|
||||
'label' => '',
|
||||
'default' => true,
|
||||
'width' => '5%',
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
'type' => array (
|
||||
'name' => 'type',
|
||||
'vname' => 'LBL_TYPE',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'settled' => array (
|
||||
'name' => 'settled',
|
||||
'vname' => 'Stan',
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'width' => '70%',
|
||||
),
|
||||
/*
|
||||
'PDF_URL' => array(
|
||||
'width' => '2%',
|
||||
'label' => ' ',
|
||||
'link' => true,
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
),
|
||||
|
||||
'edit_button'=>array(
|
||||
'widget_class' => 'SubPanelEditButton',
|
||||
'width' => '2%',
|
||||
),
|
||||
*/
|
||||
|
||||
),
|
||||
);
|
||||
?>
|
||||
0
modules/EcmInvoiceOuts/metadata/subpanels/forAccounts.php
Executable file
0
modules/EcmInvoiceOuts/metadata/subpanels/forAccounts.php
Executable file
19
modules/EcmInvoiceOuts/repairTransactions.php
Executable file
19
modules/EcmInvoiceOuts/repairTransactions.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
global $current_user;
|
||||
|
||||
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
$inv = $db->query ( "SELECT * FROM ecminvoiceouts where parent_payer_nip!='' and deleted=0" );
|
||||
|
||||
while ( $i = $db->fetchByAssoc($inv) ) {
|
||||
$a = new Account();
|
||||
$a->retrieve_by_string_fields(['to_vatid'=>$i['parent_payer_nip']]);
|
||||
$db->query ( "update ecmtransactions set parent_id='".$a->id."',parent_name='".$a->name."' where record_id='" . $i['id']. "'");
|
||||
// echo '<br>";
|
||||
}
|
||||
|
||||
echo 'e';
|
||||
|
||||
?>
|
||||
57
modules/EcmInvoiceOuts/savefk.php
Executable file
57
modules/EcmInvoiceOuts/savefk.php
Executable file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
$id='84c9b4cd-feb9-3470-d9b5-5655a6b272c6';
|
||||
function calculateCorrectTotals($id) {
|
||||
$vats_summary = '';
|
||||
$total_netto = 0;
|
||||
$total_brutto = 0;
|
||||
$total_vat = 0;
|
||||
$vats=array();
|
||||
$res = $GLOBALS ['db']->query ( "select
|
||||
total_netto,ecmvat_id,ecmvat_value,ecmvat_name
|
||||
from ecminvoiceoutitems n
|
||||
where
|
||||
n.ecminvoiceout_id = '".$id."'" );
|
||||
while ( $cc = $GLOBALS ['db']->fetchByAssoc ( $res ) ) {
|
||||
$vats[$cc['ecmvat_id']]['jest']['total_netto']+=$cc['total_netto'];
|
||||
$vats[$cc['ecmvat_id']]['ecmvat_value']=$cc['ecmvat_value'];
|
||||
$vats[$cc['ecmvat_id']]['ecmvat_name']=$cc['ecmvat_name'];
|
||||
}
|
||||
$res = $GLOBALS ['db']->query (" select
|
||||
n.total_netto,n.ecmvat_id,n.ecmvat_value,n.ecmvat_name
|
||||
from ecminvoiceoutitems n
|
||||
inner join ecminvoiceoutitems o on o.old_ecminvoiceoutitem_id=n.id
|
||||
where
|
||||
o.ecminvoiceout_id = '".$id."'" );
|
||||
|
||||
while ( $cc = $GLOBALS ['db']->fetchByAssoc ( $res ) ) {
|
||||
$vats[$cc['ecmvat_id']]['bylo']['total_netto']+=$cc['total_netto'];
|
||||
$vats[$cc['ecmvat_id']]['ecmvat_value']=$cc['ecmvat_value'];
|
||||
$vats[$cc['ecmvat_id']]['ecmvat_name']=$cc['ecmvat_name'];
|
||||
}
|
||||
$vats_now=array();
|
||||
|
||||
foreach ($vats as $key=>$val){
|
||||
if($vats[$key]['jest']['total_netto']==''){
|
||||
$vats[$key]['jest']['total_netto']=0;
|
||||
}
|
||||
if($vats[$key]['bylo']['total_netto']==''){
|
||||
$vats[$key]['bylo']['total_netto']=0;
|
||||
}
|
||||
$total_netto+=$vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'];
|
||||
$total_vat+=(($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'])*$vats[$key]['ecmvat_value'])/100;
|
||||
$total_brutto+=((($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'])*$vats[$key]['ecmvat_value'])/100)+($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto']);
|
||||
$vats_summary .= $vats[$key]['ecmvat_name'] . ':' .round($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'],2)
|
||||
. ':' . round((($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'])*$vats[$key]['ecmvat_value'])/100,2). ':'
|
||||
. round(((($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto'])*$vats[$key]['ecmvat_value'])/100)+($vats[$key]['jest']['total_netto']-$vats[$key]['bylo']['total_netto']),2) . ',';
|
||||
|
||||
}
|
||||
echo $vats_summary;
|
||||
$res = $GLOBALS ['db']->query ( "update ecminvoiceouts set vats_summary='" . $vats_summary . "',total_netto='" . round($total_netto,2) . "',total_vat='" . round($total_vat,2) . "',
|
||||
total_brutto='" . round($total_brutto,2) . "' where id='" . $id . "'" );
|
||||
return round($total_brutto,2);
|
||||
|
||||
}
|
||||
calculateCorrectTotals($id);
|
||||
|
||||
?>
|
||||
12
modules/EcmInvoiceOuts/sendmail.php
Executable file
12
modules/EcmInvoiceOuts/sendmail.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
$fp = fsockopen("smtp.gmail.com", 465, $errno, $errstr, 20);
|
||||
echo 'Connect?<br>';
|
||||
if($fp){ // Work
|
||||
echo 'ok';
|
||||
}
|
||||
else{
|
||||
echo 'Not work';
|
||||
echo "<br>$errstr ($errno)<br />\n";
|
||||
}
|
||||
18
modules/EcmInvoiceOuts/test.php
Executable file
18
modules/EcmInvoiceOuts/test.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$url='http://damznac.pl/login'; // Specify your url
|
||||
$data= array('username'=>'lol','api_key'=>'val'); // Add parameters in key value
|
||||
$ch = curl_init(); // Initialize cURL
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
|
||||
|
||||
//curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$return= curl_exec($ch);
|
||||
var_dump($return);
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
?>
|
||||
1028
modules/EcmInvoiceOuts/vardefs.php
Executable file
1028
modules/EcmInvoiceOuts/vardefs.php
Executable file
File diff suppressed because it is too large
Load Diff
97
modules/EcmInvoiceOuts/views/DetailView/view.detail.my.php
Executable file
97
modules/EcmInvoiceOuts/views/DetailView/view.detail.my.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
* *******************************************************************************/
|
||||
/*
|
||||
* Created on Apr 13, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
require_once('include/DetailView/DetailView2.php');
|
||||
|
||||
class ViewDetailMy extends SugarView{
|
||||
var $type ='detail';
|
||||
var $dv;
|
||||
var $tplFile = 'include/DetailView/DetailView.tpl';
|
||||
|
||||
function ViewDetailMy(){
|
||||
$this->options['show_subpanels'] = true;
|
||||
parent::SugarView();
|
||||
}
|
||||
|
||||
function preDisplay(){
|
||||
$metadataFile = null;
|
||||
$foundViewDefs = false;
|
||||
if(file_exists('custom/modules/' . $this->module . '/metadata/detailviewdefs.php')){
|
||||
$metadataFile = 'custom/modules/' . $this->module . '/metadata/detailviewdefs.php';
|
||||
$foundViewDefs = true;
|
||||
}else{
|
||||
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
|
||||
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$this->module]['detailviewdefs'])){
|
||||
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
|
||||
require_once('modules/'.$this->module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$this->module]['detailviewdefs'])){
|
||||
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
|
||||
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/detailviewdefs.php')){
|
||||
$metadataFile = 'modules/'.$this->module.'/metadata/detailviewdefs.php';
|
||||
}
|
||||
|
||||
$this->dv = new DetailView2();
|
||||
$this->dv->ss =& $this->ss;
|
||||
$this->dv->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
|
||||
|
||||
}
|
||||
|
||||
function display(){
|
||||
if(empty($this->bean->id)){
|
||||
global $app_strings;
|
||||
sugar_die($app_strings['ERROR_NO_RECORD']);
|
||||
}
|
||||
|
||||
$this->dv->process();
|
||||
echo $this->dv->display();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
186
modules/EcmInvoiceOuts/views/EditView/view.edit.ecminvoiceouts.php
Executable file
186
modules/EcmInvoiceOuts/views/EditView/view.edit.ecminvoiceouts.php
Executable file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
/*********************************************************************************
|
||||
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
|
||||
*
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
|
||||
*
|
||||
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
|
||||
* details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
|
||||
* 02110-1301 USA.
|
||||
|
||||
*
|
||||
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
|
||||
*
|
||||
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
|
||||
*
|
||||
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
|
||||
* "Powered by SugarCRM".
|
||||
|
||||
* *******************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
* Created on Apr 13, 2007
|
||||
|
||||
*
|
||||
|
||||
* To change the template for this generated file go to
|
||||
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
|
||||
*/
|
||||
|
||||
require_once('include/EditView/EditView2.php');
|
||||
|
||||
|
||||
|
||||
class ViewEditEcmInvoiceOuts extends SugarView{
|
||||
|
||||
var $ev;
|
||||
|
||||
var $type ='edit';
|
||||
|
||||
var $useForSubpanel = false; //boolean variable to determine whether view can be used for subpanel creates
|
||||
|
||||
var $showTitle = true;
|
||||
|
||||
var $tplFile = 'include/EditView/EditView.tpl';
|
||||
|
||||
|
||||
|
||||
function ViewEditEcmInvoiceOuts(){
|
||||
|
||||
parent::SugarView();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function preDisplay(){
|
||||
|
||||
$metadataFile = null;
|
||||
|
||||
$foundViewDefs = false;
|
||||
|
||||
if(file_exists('custom/modules/' . $this->module . '/metadata/editviewdefs.php')){
|
||||
|
||||
$metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs.php';
|
||||
|
||||
$foundViewDefs = true;
|
||||
|
||||
}else{
|
||||
|
||||
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
|
||||
|
||||
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
|
||||
|
||||
if(!empty($metafiles[$this->module]['editviewdefs'])){
|
||||
|
||||
$metadataFile = $metafiles[$this->module]['editviewdefs'];
|
||||
|
||||
$foundViewDefs = true;
|
||||
|
||||
}
|
||||
|
||||
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
|
||||
|
||||
require_once('modules/'.$this->module.'/metadata/metafiles.php');
|
||||
|
||||
if(!empty($metafiles[$this->module]['editviewdefs'])){
|
||||
|
||||
$metadataFile = $metafiles[$this->module]['editviewdefs'];
|
||||
|
||||
$foundViewDefs = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
|
||||
|
||||
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/editviewdefs.php')){
|
||||
|
||||
$metadataFile = 'modules/'.$this->module.'/metadata/editviewdefs.php';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->ev = new EditView();
|
||||
|
||||
$this->ev->ss =& $this->ss;
|
||||
|
||||
$this->ev->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function display(){
|
||||
|
||||
$this->ev->process();
|
||||
|
||||
echo $this->ev->display($this->showTitle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
251
modules/EcmInvoiceOuts/views/view.list.php
Executable file
251
modules/EcmInvoiceOuts/views/view.list.php
Executable file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: This file is used to override the default Meta-data EditView behavior
|
||||
* to provide customization specific to the Calls module.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/views/view.list.php');
|
||||
|
||||
class EcmInvoiceOutsViewList extends ViewList{
|
||||
|
||||
function EcmInvoiceOutsViewList(){
|
||||
parent::ViewList();
|
||||
}
|
||||
|
||||
function display(){
|
||||
if(!$this->bean->ACLAccess('list')){
|
||||
ACLController::displayNoAccess();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->module=$module = "EcmInvoiceOuts";
|
||||
$metadataFile = null;
|
||||
$foundViewDefs = false;
|
||||
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
|
||||
$foundViewDefs = true;
|
||||
}else{
|
||||
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
|
||||
}
|
||||
require_once($metadataFile);
|
||||
|
||||
if(!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
|
||||
if(empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query']!='true')) {
|
||||
$this->saved_search = loadBean('SavedSearch');
|
||||
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
|
||||
$this->saved_search->populateRequest();
|
||||
}
|
||||
elseif(!empty($_REQUEST['button'])) { // click the search button, after retrieving from saved_search
|
||||
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
|
||||
unset($_REQUEST['saved_search_select']);
|
||||
unset($_REQUEST['saved_search_select_name']);
|
||||
}
|
||||
}
|
||||
|
||||
$storeQuery = new StoreQuery();
|
||||
if(!isset($_REQUEST['query'])){
|
||||
$storeQuery->loadQuery($this->module);
|
||||
$storeQuery->populateRequest();
|
||||
}else{
|
||||
$storeQuery->saveFromRequest($this->module);
|
||||
}
|
||||
|
||||
$seed = $this->bean;
|
||||
$lv = new ListViewSmarty();
|
||||
$displayColumns = array();
|
||||
if(!empty($_REQUEST['displayColumns'])) {
|
||||
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
|
||||
if(!empty($listViewDefs[$module][$col]))
|
||||
$displayColumns[$col] = $listViewDefs[$module][$col];
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach($listViewDefs[$module] as $col => $params) {
|
||||
if(!empty($params['default']) && $params['default'])
|
||||
$displayColumns[$col] = $params;
|
||||
}
|
||||
}
|
||||
$params = array('massupdate' => true, 'export'=>false);
|
||||
|
||||
$lv->quickViewLinks = false;
|
||||
$lv->export = false;
|
||||
$lv->mergeduplicates = false;
|
||||
|
||||
if(!empty($_REQUEST['orderBy'])) {
|
||||
$params['orderBy'] = $_REQUEST['orderBy'];
|
||||
$params['overrideOrder'] = true;
|
||||
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
|
||||
}
|
||||
|
||||
$lv->displayColumns = $displayColumns;
|
||||
|
||||
$this->seed = $seed;
|
||||
$this->module = $module;
|
||||
|
||||
$searchForm = null;
|
||||
|
||||
//search
|
||||
$view = 'basic_search';
|
||||
if(!empty($_REQUEST['search_form_view']))
|
||||
$view = $_REQUEST['search_form_view'];
|
||||
$headers = true;
|
||||
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only'])
|
||||
$headers = false;
|
||||
elseif(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
|
||||
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
|
||||
$view = 'advanced_search';
|
||||
}else {
|
||||
$view = 'basic_search';
|
||||
}
|
||||
}
|
||||
|
||||
$use_old_search = true;
|
||||
if(file_exists('modules/'.$this->module.'/SearchForm.html')){
|
||||
require_once('include/SearchForm/SearchForm.php');
|
||||
$searchForm = new SearchForm($this->module, $this->seed);
|
||||
}else{
|
||||
$use_old_search = false;
|
||||
require_once('include/SearchForm/SearchForm2.php');
|
||||
|
||||
if(!empty($metafiles[$this->module]['searchdefs']))
|
||||
require_once($metafiles[$this->module]['searchdefs']);
|
||||
elseif(file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
|
||||
if (file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
{
|
||||
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
}
|
||||
elseif (!empty($metafiles[$this->module]['searchdefs']))
|
||||
{
|
||||
require_once($metafiles[$this->module]['searchdefs']);
|
||||
}
|
||||
elseif (file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
{
|
||||
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
}
|
||||
|
||||
if(!empty($metafiles[$this->module]['searchfields']))
|
||||
require_once($metafiles[$this->module]['searchfields']);
|
||||
elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php'))
|
||||
require_once('modules/'.$this->module.'/metadata/SearchFields.php');
|
||||
|
||||
$searchForm = new SearchForm($this->seed, $this->module, $this->action);
|
||||
$searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', $view, $listViewDefs);
|
||||
|
||||
$searchForm->lv = $lv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(isset($this->options['show_title']) && $this->options['show_title'] && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true")) {
|
||||
$moduleName = isset($this->seed->module_dir) ? $this->seed->module_dir : $GLOBALS['mod_strings']['LBL_MODULE_NAME'];
|
||||
|
||||
echo "\n<p>\n";
|
||||
echo get_module_title($moduleName, $GLOBALS['mod_strings']['LBL_MODULE_TITLE'], true);
|
||||
echo "\n</p>\n";
|
||||
|
||||
}
|
||||
|
||||
$where = '';
|
||||
if(isset($_REQUEST['query']))
|
||||
{
|
||||
// we have a query
|
||||
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
|
||||
$searchForm->populateFromArray($storeQuery->query);
|
||||
}
|
||||
else {
|
||||
$searchForm->populateFromRequest();
|
||||
}
|
||||
$where_clauses = $searchForm->generateSearchWhere(true, $this->seed->module_dir);
|
||||
if (count($where_clauses) > 0 )$where = '('. implode(' ) AND ( ', $where_clauses) . ')';
|
||||
$GLOBALS['log']->info("List View Where Clause: $where");
|
||||
}
|
||||
if($use_old_search){
|
||||
switch($view) {
|
||||
case 'basic_search':
|
||||
$searchForm->setup();
|
||||
$searchForm->displayBasic($headers);
|
||||
break;
|
||||
case 'advanced_search':
|
||||
$searchForm->setup();
|
||||
$searchForm->displayAdvanced($headers);
|
||||
break;
|
||||
case 'saved_views':
|
||||
echo $searchForm->displaySavedViews($listViewDefs, $lv, $headers);
|
||||
break;
|
||||
}
|
||||
|
||||
}else{
|
||||
echo $searchForm->display($headers);
|
||||
}
|
||||
if(!$headers)
|
||||
return;
|
||||
|
||||
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
|
||||
// $this->processQuickSearch();
|
||||
$lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where, $params);
|
||||
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
|
||||
echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
|
||||
echo $lv->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user