This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,402 @@
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function setSelectionRange(obj) {
if(obj && typeof(obj) == "object" && (obj.type == "text" || obj.type == "textarea")) {
if(obj.createTextRange) {
var range = obj.createTextRange();
range.moveStart("character", 0);
range.moveEnd("character", obj.value.lengh-1);
range.select();
} else {
if(obj.setSelectionRange) {
obj.setSelectionRange(0,obj.value.length);
}
}
obj.focus();
}
if(obj && typeof(obj) == "object" && obj.options) { obj.focus(); }
}
var AjaxSearchItems;
function AjaxSearch(div,displayNone) {
//fields
this.parentDIV = div; //pole w ktorym zawiera sie pole wyszukiwania
this.div; //pole glowne wyszukiwania
this.inputSearch; //input wyszukiwania
this.timeout; //wskaznik zwracany przez setTimeout przy wcisnieciu klawisza
this.searchDelay = 800; //opoznienie wyszukiwania
this.divList; //pole w ktorym wyswietlana bedzie lista znalezionnych elementow
this.ajaxSearchItem; //unikalny identyfikator;
this.module = 'EcmProducts';
this.inputCode;
this.positionSelected;
//functions
this.setInputCode = function(input) {
this.inputCode = input;
this.inputCode.previousCode = this.inputCode.value;
}
this.inputSearchOnKeyDown = function(e,other) {
var keynum;
if(typeof(e) == "number")
keynum = e;
else {
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
}
if(keynum == 38) { this.selectPreviousPosition(); return false; }
if(keynum == 40) { this.selectNextPosition(); return false; }
if(keynum == 13 || keynum == 9) { this.inputSearchEnterPressed(other); return false; }
if(keynum == 27) { this.div.style.display = 'none'; }
if(this.timeout) { clearTimeout(this.timeout); this.timeout = null; }
this.timeout = setTimeout("document.getElementById('"+this.div.id+"').AjaxSearch.search();", 500);
}
this.inputSearchEnterPressed = function(other) {
if(this.positionSelected) {
var row;
if(N.selectedRow) {
N.selectedRow.setData(this.positionSelected.positionData);
row = N.selectedRow;
}
else {
row = N.addRow().setData(this.positionSelected.positionData);
}
row.calculateTotal();
if((other && other == "clear") || OPT['quick_product_item_adding']==0) {
this.clearList();
this.div.style.display = 'none';
if(OPT['quick_product_item_adding'] == 0) if(N.selectedCell && N.selectedCell.index == 1) N.selectedCell.selectNext();
} else {
row.noHideASP = true;
if(N.selectedRow) row = row.myTable.addRow(row.index+1);
row.select();
row.cells.item(0).select();
setSelectionRange(this.inputSearch);
}
}
else if(N.selectedRow) {
if(this.inputSearch.value != this.inputCode.previousCode || this.inputCode.previousCode == '') {
var data = new Object();
N.selectedRow.setData(data);
N.selectedRow.cells.item(1).select();
}
}
//N.addRow();
}
this.selectNextPosition = function() {
if(this.positionSelected) {
if(this.positionSelected.nextSibling) {
this.positionSelect(this.positionSelected.nextSibling);
return;
}
}
this.positionSelect(this.divList.lastChild);
}
this.selectPreviousPosition = function() {
if(this.positionSelected) {
if(this.positionSelected.previousSibling) {
this.positionSelect(this.positionSelected.previousSibling);
return;
}
}
this.positionSelect(this.divList.firstChild);
}
this.search = function() {
if(this.inputSearch.value == '') { this.clearList(); return; }
var _ajax_search_process_search_ = this;
this.Display = function(result) { _ajax_search_process_search_.processSearch(result.responseText); }
this.Fail = function(result) { alert(result.responseText); }
YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},'module='+this.module+'&action=AjaxSearchQuery&to_pdf=1&as_inputSearch='+this.inputSearch.value); //+'&ecmlanguage='+document.forms.EditView.ecmlanguage.value);
}
this.processSearch = function(result) {
this.clearList();
var list = eval(result);
if(typeof(list) != "object") return;
this.fillList(list);
}
this.clearList = function() {
this.divList.innerHTML = '';
this.divList.style.height = '';
this.positionDeselect();
}
this.fillList = function(list) {
for(x in list) {
this.addPosition(list[x]);
}
this.positionSelect();
this.setScrolls();
}
this.setScrolls = function() {
var clientH = -1;
if(window.innerHeight && window.innerHeight > 0) clientH = window.innerHeight;
else if(document.documentElement && document.documentElement.clientHeight > 0) clientH = document.documentElement.clientHeight;
else if(document.body && document.body.clientHeight > 0) clientH = document.body.clientHeight;
var XY = YAHOO.util.Dom.getXY(this.div);
var divTop = (XY[1]+this.div.offsetHeight);
if((divTop - (clientH+document.body.scrollTop)) > 0) {
var newPos = divTop-clientH;
document.body.scrollTop = newPos;
}
}
this.positionSelect = function(div,noScroll) {
if(!div) {
if(!this.positionSelected) {
if(this.divList.firstChild) this.positionSelect(this.divList.firstChild);
}
return;
}
this.positionDeselect();
div.className = 'AjaxSearchPositionDivSelected';
this.positionSelected = div;
if(!noScroll) this.divList.scrollTop = div.offsetTop;
}
this.positionDeselect = function() {
if(this.positionSelected) {
this.positionSelected.className = '';
this.positionSelected = null;
}
}
this.addPosition = function(list) {
if(typeof(list.code) == "undefined") return;
var position = document.createElement('div');
position.positionData = list;
position.onclick = function() { this.parentNode.AjaxSearch.inputSearchEnterPressed(this); }
position.onmouseover = function() { this.parentNode.AjaxSearch.positionSelect(this,true); };
position.innerHTML = '<table width="100%" class="AjaxSearchPositionTable"><tr><td class="AjaxSearchPositionTableCode">'+this.markElement(list['code'])+'</td><td align="right" class="AjaxSearchPositionTablePrice">'+list['purchase_price']+' '+list['currency_symbol']+'<span style="color:black"> - </span><b>'+list['selling_price']+' '+list['currency_symbol']+'</b></td></tr><tr><td colspan="2" class="AjaxSearchPositionTableName">'+this.markElement(list['name'])+'</td></tr></table>';
this.divList.appendChild(position);
if((position.offsetTop+position.offsetHeight) > 300) this.divList.style.height = '300px'; else this.divList.style.height = '';
}
this.markElement = function(str) {
var s = "("+this.inputSearch.value+")";
var regExp = new RegExp(s,'gi');
return str.replace(regExp,"<b>$1</b>");
}
this.AjaxSearchFrozen = false;
this.AjaxSearchGetSettings = function () {
var AjaxSearchToReq = this;
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php',
{
success: function(response) {
if(response.responseText) {
var str = response.responseText;
var obj = eval(str);
if(obj && obj[0]) {
obj = obj[0];
//if(obj.frozen) {
AjaxSearchToReq.div.style.left = obj.pos_left;
AjaxSearchToReq.div.style.top = obj.pos_top;
AjaxSearchToReq.AjaxSearchFrozen = !(obj.frozen == "true" ? true : false);
AjaxSearchToReq.AjaxSearchFreezePosition(true);
//}
}
}
},
failure: function(response) {}
},
'module=Home&action=EcmAjaxSearchSettings&function=GetSettings&to_pdf=1&from_module='+this.module
);
}
this.AjaxSearchSaveSettings = function () {
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php',
{
success: function(response) {},
failure: function(response) {}
},
'module=Home&action=EcmAjaxSearchSettings&function=SaveSettings&to_pdf=1&from_module='+this.module+'&pos_top='+this.div.style.top+'&pos_left='+this.div.style.left+'&frozen='+this.AjaxSearchFrozen
);
}
this.AjaxSearchFreezePosition = function (dontSave) {
var img = document.getElementById('AjaxSearchPin');
if(this.AjaxSearchFrozen) {
img.src='modules/'+this.module+'/AjaxSearch/AjaxSearchPinOff.gif';
this.AjaxSearchFrozen = false;
} else {
img.src='modules/'+this.module+'/AjaxSearch/AjaxSearchPinOn.gif';
this.AjaxSearchFrozen = true;
}
if(!dontSave) this.AjaxSearchSaveSettings();
}
this.createForm = function() {
/*
var div = document.createElement('div');
div.className = 'AjaxSearch';
div.AjaxSearch = this;
*/
var tmp = document.createElement('div');
var div = "<div></div>";
tmp.innerHTML = div;
div = tmp.firstChild;
div.className = 'AjaxSearch';
div.AjaxSearch = this;
div.onMouseMoveEvent = function(ev) {
if(!this.isOnMouseDown) return;
ev = ev || window.event;
var x = 0; var y = 0;
if(ev.pageX || ev.pageY) {
x = ev.pageX;
y = ev.pageY;
} else {
x = ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y = ev.clientY + document.body.scrollTop - document.body.clientTop
}
this.style.left = x-this.MouseX;
this.style.top = y-this.MouseY;
}
div.onMouseDownEvent = function(ev) {
if(this.noDrag) { this.noDrag = false; return; }
ev = ev || window.event;
var x = 0; var y = 0;
if(ev.pageX || ev.pageY) {
x = ev.pageX;
y = ev.pageY;
} else {
x = ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y = ev.clientY + document.body.scrollTop - document.body.clientTop
}
this.MouseX = x-this.offsetLeft;
this.MouseY = y-this.offsetTop;
this.isOnMouseDown = true;
this.style.cursor = 'move';
}
div.onmouseup = function() {
this.isOnMouseDown = false;
this.style.cursor = '';
//this.AjaxSearch.AjaxSearchSaveSettings();
}
//div.onmouseout = function() { this.onmouseup(); }
ddiv = document.createElement('div');
ddiv.id = 'AjaxSearch_ddiv';
ddiv.className = 'AjaxSearch_ddiv';
ddiv.appendChild(document.createTextNode('Search Product:'));
ddiv.appendChild(document.createElement('br'));
div.appendChild(ddiv);
/*
var inputSearch = document.createElement('input');
inputSearch.type = 'text';
inputSearch.id = 'as_inputSearch';
inputSearch.className = 'AjaxSearchInputSearch';
inputSearch.AjaxSearch = this;
inputSearch.onkeydown = this.inputSearchOnKeyDown;
this.inputSearch = inputSearch;
div.appendChild(inputSearch);
*/
var img = '<img src="modules/'+this.module+'/AjaxSearch/AjaxSearchPinOff.gif" id="AjaxSearchPin" class="AjaxSearchPin" onclick="this.parentNode.AjaxSearch.AjaxSearchFreezePosition();" />';
img += '<img src="modules/'+this.module+'/AjaxSearch/AjaxSearchCloseIcon.gif" class="AjaxSearchCloseIcon" onclick="this.parentNode.AjaxSearch.inputSearchOnKeyDown(27);" />';
div.innerHTML += img;
var inputSearch = '<input type="text" id="as_inputSearch" class="AjaxSearchInputSearch" onKeyDown="return this.AjaxSearch.inputSearchOnKeyDown(event);">';
div.innerHTML = div.innerHTML + inputSearch;
this.inputSearch = div.lastChild;
this.inputSearch.AjaxSearch = this;
this.inputSearch.onmousedown = function() { this.parentNode.noDrag = true; }
div.appendChild(document.createElement('br'));
div.appendChild(document.createElement('br'));
/*
div.appendChild(document.createTextNode('List:'));
var separator = document.createElement('hr');
separator.className = 'AjaxSearchSeparator';
div.appendChild(separator);
*/
var divList = document.createElement('div');
divList.id = 'as_divList';
divList.className = 'AjaxSearchDivList';
divList.AjaxSearch = this;
this.divList = divList;
divList.onmousedown = function() { this.parentNode.noDrag = true; }
div.appendChild(divList);
var tmpDiv = document.createElement('div');
tmpDiv.style.height = '10px';
div.appendChild(tmpDiv);
this.parentDIV.appendChild(div);
this.div = div;
}
this.KeyDown = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
}
//constructor
if(AjaxSearchItems) {
if(typeof(AjaxSearchItems) == "number")
AjaxSearchItem++;
else
AjaxSearchItem = 0;
this.ajaxSearchItem = AjaxSearchItem;
}
this.createForm();
this.div.AjaxSearch = this;
this.div.id = 'AjaxSearch_'+this.AjaxSearchItem;
var AjaxSearch_draganddrop = new YAHOO.util.DD(this.div.id);
AjaxSearch_draganddrop.AjaxSearch = this;
AjaxSearch_draganddrop.endDrag = function(e) {
this.AjaxSearch.AjaxSearchSaveSettings();
};
AjaxSearch_draganddrop.setHandleElId("AjaxSearch_ddiv");
this.div.style.left = (screen.availWidth - this.div.offsetWidth) / 2;
this.div.style.top = (screen.availHeight - this.div.offsetHeight) / 2;
if(displayNone == true) this.div.style.display = 'none';
this.AjaxSearchGetSettings();
};

View File

@@ -0,0 +1,8 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
?>

View File

@@ -0,0 +1,126 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if(isset($_REQUEST['as_inputSearch']) && $_REQUEST['as_inputSearch'] != '') {
$AS_INPUTSEARCH = strtoupper($_REQUEST['as_inputSearch']);
$language_translate = array(
'en_us' => 'en',
'ge_ge' => 'de',
'pl_pl' => 'pl'
);
if(isset($_REQUEST['ecmlanguage']) && $_REQUEST['ecmlanguage'] != '') {
if(isset($language_translate[$_REQUEST['ecmlanguage']]) && $language_translate[$_REQUEST['ecmlanguage']] != '') {
$use_language = $language_translate[$_REQUEST['ecmlanguage']];
}
}
$query = "SELECT DISTINCT";
$query .= " `pr`.`id`";
$query .= ", `pr`.`code`";
$query .= ", `pr`.`name`";
$query .= ", `pr`.`selling_price`";
$query .= ", `pr`.`purchase_price`";
$query .= ", `pr`.`vat_id`";
$query .= ", `pr`.`vat_name`";
$query .= ", `pr`.`vat_value`";
$query .= ", `pr`.`exchange_rate_id` as `currency_id`";
$query .= ", `pr`.`product_category_id` as `category_id`";
$query .= ", `pr`.`usage_unit_id` as `unit_id`";
if(isset($use_language)) {
$query .= ", `pr_lang`.`short_description`";
$query .= ", `pr_lang`.`long_description`";
}
$query .= " FROM";
$query .= " `ecmproducts` as `pr`";
if(isset($use_language))
$query .= " LEFT JOIN `ecmproduct_language_".$use_language."_view` as `pr_lang` ON `pr`.`id` = `pr_lang`.`ecmproduct_id`";
$query .= " WHERE";
$query .= " (";
$query .= "UPPER(`pr`.`code`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`code`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`code`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`name`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH%'";
if(isset($use_language)) {
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '$AS_INPUTSEARCH%'";
}
$query .= ")";
$query .= " AND `pr`.`deleted`='0'";
$result = $GLOBALS['db']->query($query);
//print $query;
global $sugar_config;
$defaultCurrency = $sugar_config['default_currency_symbol'];
$currencies = array ( -99 => $defaultCurrency );
$arr = array();
if($result)
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
$row['price'] = $row['selling_price'];
$row['purchase_price'] = format_number($row['purchase_price']);
$row['selling_price'] = format_number($row['selling_price']);
if(array_key_exists($row['currency_id'],$currencies))
$row['currency_symbol'] = $currencies[$row['currency_id']];
else {
$query = "SELECT symbol FROM currencies WHERE id='".$row['currency_id']."' AND deleted=0;";
$result2 = $GLOBALS['db']->query($query);
if($result2) {
$row2 = $GLOBALS['db']->fetchByAssoc($result2);
if($row2) {
$currencies[$id] = $row2['symbol'];
$row['currency_symbol'] = $row2['symbol'];
} else $row['currency_symbol'] = '';
} else $row['currency_symbol'] = '';
}
if(isset($use_language)) {
if(strpos(strtoupper($row['long_description']), $AS_INPUTSEARCH) !== false)
$row['name'] = $row['long_description'];
else
if(strpos(strtoupper($row['short_description']), $AS_INPUTSEARCH) !== false)
$row['name'] = $row['short_description'];
else
if(strpos(strtoupper($row['name']), $AS_INPUTSEARCH) === false || strpos(strtoupper($row['code']), $AS_INPUTSEARCH) !== false) {
if(isset($row['long_description']) && $row['long_description'] != '')
$row['name'] = $row['long_description'];
else
if(isset($row['short_description']) && $row['short_description'] != '')
$row['name'] = $row['short_description'];
}
unset($row['long_description'], $row['short_description']);
}
$arr[] = $row;
}
if(count($arr) > 0) {
$json = getJSONobj();
echo str_replace("&quot;", '\"', $json->encode($arr));
}
}
?>

View File

@@ -0,0 +1,55 @@
$(document).ready(function () {
$("#allTable").tablesorter({
sortList: [[1, 1]],
theme: 'blue',
widthFixed: true,
widgets: ['filter', 'zebra', 'stickyHeaders'],
fixedWidth: true,
widgetOptions: {
filter_formatter: {
0: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
4: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
5: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
6: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
7: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
}
}
});
$("#allTable").bind('filterEnd', function (event, config) {
calculatreCount();
});
});
function calculatreCount() {
var count = 0;
var sum = 0;
$("#allTable").find("tr").each(function (index) {
if (index >= 2 && $(this).css('display') === 'table-row' && $(this).find("td").length > 3) {
count++;
}
});
$("#allDataCount").html(count);
}
function updateColumns() {
console.log($("#display_tabs").val());
}

View File

@@ -0,0 +1,54 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
$db = $GLOBALS['db'];
global $app_list_strings;
//config
$allFields = array('name','code','qty','group_ks', );
$showFields = array('name', 'qty', 'code', 'group_ks', 'ean', 'brand', 'shape','group', 'status', 'category');
// get data
$allQuery = "
SELECT p.* FROM ecmproducts as p
WHERE p.deleted=0 ORDER BY code ASC";
$rows = $db->query($allQuery);
$statesRes = $db->query("
SELECT SUM(quantity) as qty, product_id FROM ecmstockstates
GROUP BY product_id");
$states = array();
while( $r = $db->fetchByAssoc ( $statesRes )) {
$states[$r['product_id']] = round($r['qty']);
}
$allData = array();
while( $r = $db->fetchByAssoc ( $rows )) {
$row = array();
$row['id'] = $r['id'];
$row['name'] = $r['name'];
$row['code'] = $r['code'];
$row['qty'] = $states[$r['id']] ? $states[$r['id']] : 0;
$row['group_ks'] = $app_list_strings['ecmproducts_group_ks_dom'][$r['group_ks']];
$row['group'] = $app_list_strings['ecmproducts_group_dom'][$r['product_group']];
$row['category'] = $app_list_strings['ecmproducts_category_dom'][$r['category']];
$row['ean'] = $r['ean'];
$row['brand'] = $app_list_strings['ecmproducts_brand_dom'][$r['brand']];
$row['status'] = $app_list_strings['ecmproducts_status_dom'][$r['status']];
$row['shape'] = $app_list_strings['ecmproducts_shape_dom'][$r['shape']];
$allData[] = $row;
}
echo "Products: ".count($allData)."<br>";
// prepare template
$smarty = new Sugar_Smarty ();
$smarty->assign("allDataCount", count($allData));
$smarty->assign("allData", $allData);
$smarty->assign("allFields", $allFields);
$smarty->assign("showFields", $showFields);
echo $smarty->display ( 'modules/EcmProducts/BimIT-ListView/productsListView.tpl' );

View File

@@ -0,0 +1,273 @@
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
</script>
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
<script type="text/javascript" src="modules/EcmProducts/BimIT-ListView/productsListView.js"></script>
<!-- HEADER -->
<table id="tableMenu" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
height="16">
</td>
<td>
<h2>Produkty</h2>
</td>
</tr>
</table>
<!-- CUSTOMIZATION-->
<!--
<input type="button" id="show_customization_panel" value="Edycja widoku">
<form>
<div style="" class="edit view search basic">
<div style="" id="inlineSavedSearch">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
style="border-top: 0px none; margin-bottom: 4px">
<tbody>
<tr valign="top">
<td width="34%" align="left" rowspan="4" colspan="2">
<input id="displayColumnsDef" type="hidden" name="displayColumns">
<input id="hideTabsDef" type="hidden" name="hideTabs">
<div id="edit_tabs" style="">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td>&nbsp;</td>
<td scope="row" id="chooser_display_tabs_text" align="center">
<nobr>Wyświetl kolumny</nobr>
</td>
<td>&nbsp;</td>
<td scope="row" id="chooser_hide_tabs" align="center">
<nobr>Ukryj kolumny</nobr>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center"><a
onclick="SUGAR.tabChooser.up('display_tabs','display_tabs','hide_tabs'); updateColumns();"><img
src="themes/Sugar5/images/uparrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="13" height="13" border="0" style="margin-bottom: 1px;"
alt="Sortuj"></a><br>
<a
onclick="SUGAR.tabChooser.down('display_tabs','display_tabs','hide_tabs'); updateColumns();"><img
src="themes/Sugar5/images/downarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-top: 1px;"
alt="Sortuj"></a>
</td>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td id="display_tabs_td" align="center"><select size="7"
name="display_tabs[]" multiple="" id="display_tabs">
<option value="NAME">
Nazwa
</option>
<option value="STOCK_QTY">Na stanie</option>
<option value="PRODUCT_CATEGORY_NAME">Kategoria
</option>
<option value="STAN">Aktualny</option>
</select></td>
</tr>
</tbody>
</table>
</td>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center"><a
onclick="SUGAR.tabChooser.right_to_left('display_tabs','hide_tabs', '7', '7', ''); updateColumns();"><img
src="themes/Sugar5/images/leftarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-right: 1px;"
alt="Sortuj"></a><a
onclick="SUGAR.tabChooser.left_to_right('display_tabs','hide_tabs', '7', '7'); updateColumns();"><img
src="themes/Sugar5/images/rightarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-left: 1px;"
alt="Sortuj"></a></td>
<td id="hide_tabs_td" align="center"><select size="7" name="hide_tabs[]"
multiple="">
<option value="GROUP_KS">Grupa księgowa</option>
<option value="ORDERED">Ilość</option>
<option value="PIECES_PER_CARTON">Ppc</option>
<option value="SALE_QTY">Średnia cena sprzedaży</option>
<option value="SALE_AVG_PRICE">Średnia cena zakupu</option>
<option value="EDIT_BTN">&nbsp;</option>
<option value="CODE">Indeks Produktu</option>
</select></td>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center">
<script>
var object_refs = new Object();
object_refs['hide_tabs'] = document.getElementById('hide_tabs');
</script>
<script>
object_refs['display_tabs'] = document.getElementById(
'display_tabs');
</script>
</td>
</tr>
</tbody>
</table>
<br>
</div>
</td>
<td scope="row" align="left" width="10%">
Porządkuj po kolumnie
</td>
<td width="23%">
<select name="orderBy" id="orderBySelectt">
</select>
</td>
<td scope="row" width="10%">
Kierunek
</td>
<td width="23%">
<input id="sort_order_desc_radio" type="radio" name="sortOrder" value="DESC"> <span
onclick="document.getElementById(&quot;sort_order_desc_radio&quot;).checked = true"
style="cursor: pointer; cursor: hand">Malejąco</span><br>
<input id="sort_order_asc_radio" type="radio" name="sortOrder" value="ASC" checked=""> <span
onclick="document.getElementById(&quot;sort_order_asc_radio&quot;).checked = true"
style="cursor: pointer; cursor: hand">Rosnąco</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
-->
<!-- DATA -->
<table id="allTable">
<thead>
<tr>
{if in_array('status', $showFields)}
<th>Status</th>
{/if}
{if in_array('code', $showFields)}
<th>Indeks</th>
{/if}
{if in_array('name', $showFields)}
<th>Nazwa</th>
{/if}
{if in_array('qty', $showFields)}
<th>Stan</th>
{/if}
{if in_array('category', $showFields)}
<th>Kategoria</th>
{/if}
{if in_array('group', $showFields)}
<th>Grupa produktowa</th>
{/if}
{if in_array('brand', $showFields)}
<th>Marka</th>
{/if}
{if in_array('shape', $showFields)}
<th>Forma</th>
{/if}
{if in_array('group_ks', $showFields)}
<th>Grupa księgowa</th>
{/if}
{if in_array('ean', $showFields)}
<th>EAN</th>
{/if}
</tr>
</thead>
<br><br>
<b>Ilość produktów:&nbsp;<div id="allDataCount">{$allDataCount}</div></b>
<tbody aria-live="polite" aria-relevant="all">
{foreach from=$allData item=ROW name=loop}
{if $smarty.foreach.loop.index % 2 == 1}
<tr>
{else}
<tr style="background-color: #e6e6e6;" role="row">
{/if}
{if in_array('status', $showFields)}
<td>
{$ROW.status}
</td>
{/if}
{if in_array('code', $showFields)}
<td>
<a target="_blank" href="index.php?module=EcmProducts&action=DetailView&record={$ROW.id}">
{$ROW.code}
</a>
</td>
{/if}
{if in_array('name', $showFields)}
<td>
{$ROW.name}
</td>
{/if}
{if in_array('qty', $showFields)}
<td>
{$ROW.qty}
</td>
{/if}
{if in_array('category', $showFields)}
<td>
{$ROW.category}
</td>
{/if}
{if in_array('group', $showFields)}
<td style="white-space: nowrap;">
{$ROW.group}
</td>
{/if}
{if in_array('brand', $showFields)}
<td>
{$ROW.brand}
</td>
{/if}
{if in_array('shape', $showFields)}
<td>
{$ROW.shape}
</td>
{/if}
{if in_array('group_ks', $showFields)}
<td style="white-space: nowrap;">
{$ROW.group_ks}
</td>
{/if}
{if in_array('ean', $showFields)}
<td>
{$ROW.ean}
</td>
{/if}
</tr>
{/foreach}
</tbody>
</table>

View File

@@ -0,0 +1,204 @@
//categories
function saveItems3(){
document.getElementById('position_list3').value = ItemsList3(true);
}
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
var tbody_;
var ItemListSave3;
var ItemListClear3;
var ItemListFil3;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable3 = new paramsMT('itemsTable3');
paramsTable3.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
refreshPositionIndex = function() {
for(var i=0; i<paramsTable3.rowCount(); i++) {
var data = paramsTable3.row(i).getData();
data.position = i+1;
paramsTable3.row(i).setData(data);
}
}
paramsTable3.onCreateCell = function(cell) {
var i = cell.index;
if(i == 0) {
cell.setData = function(data) {
if(data.ecmproductcategory_name) {
cell.firstChild.value = data.ecmproductcategory_name;
cell.getElementsByTagName('input')[1].value = data.ecmproductcategory_id;
if (data.id)
cell.getElementsByTagName('input')[2].value = data.id;
}
};
cell.getData = function(data) {
data.ecmproductcategory_name = cell.firstChild.value;
data.ecmproductcategory_id = cell.getElementsByTagName('input')[1].value;
data.id = cell.getElementsByTagName('input')[2].value;
}
cell.onSelect = function() {
var cn = this.getElementsByTagName('input');
cn[0].name = 'name_p';
cn[0].id = 'name_p';
cn[1].name = 'id_p';
cn[1].id = 'id_p';
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.product_group = data.product_group;
this.setData(data);
}
var cn = this.getElementsByTagName('input');
cn[0].name = '';
cn[0].id = '';
cn[1].name = '';
cn[1].id = '';
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_IMG_SEARCH']);
img.setAttribute('src','modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
var ecmpopup = open_popup( "EcmProductCategories", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"id_p","name":"name_p"}}, "single", true );
setTimeout(function(){ecmpopup.focus();},200);
}
cell.appendChild(img);
}
if(i == 1) {
var img;
cell.style.padding="auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index+1);
refreshPositionIndex();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_DELETE_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.deleteRow(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src','modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveUp(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
//move down
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_DOWN']);
img.setAttribute('src','modules/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveDown();refreshPositionIndex(); }
cell.appendChild(img);
}
}
ItemsList3 = function(json) {
var data = '';
for(var i=0; i<paramsTable3.rowCount(); i++) {
var tmp = paramsTable3.row(i).getData();
tmp['position'] = i;
console.log(tmp);
data = data + '||||' + JSON.stringifyNoSecurity(tmp);
}
return data;
}
if(paramsTable3.rowCount() == 0) {paramsTable3.addRow();};
paramsTable3.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListFill3 = function() {
var pl;
pl = document.getElementById('position_list3').value;
console.log(pl);
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x]; if (pl_row.template=='') continue; paramsTable3.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
}
ItemListClear3 = function(noNew,save) {
if(typeof(save)=="string") ItemListSave3(null,save);
while(paramsTable3.rowCount()>0) paramsTable3.row(0).deleteRow(noNew);
}
ItemListClear3();
ItemListFill3();
}
);

View File

@@ -0,0 +1,287 @@
<?php
set_time_limit(999999);
$mn=explode(",",$_REQUEST['uid']);
//$mn=$_REQUEST['mass'];
if(!$_REQUEST['uid'])$mn=$_REQUEST['mass'];
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 PRICEBOOK");
$objPHPExcel->getProperties()->setSubject("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setDescription("PRICEBOOK");
$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)
)
),
"A1:AG1"
);
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('R')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('S')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('T')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('U')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('V')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('W')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('X')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Y')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('Z')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AA')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AB')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AC')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AD')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AE')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AF')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AG')->setWidth(20);
$objPHPExcel->getActiveSheet()->SetCellValue('A1','Product');
$objPHPExcel->getActiveSheet()->SetCellValue('B1','Code');
$objPHPExcel->getActiveSheet()->SetCellValue('C1','Category');
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Inventory');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','Ordered');
$objPHPExcel->getActiveSheet()->SetCellValue('F1','EMS price');
$objPHPExcel->getActiveSheet()->SetCellValue('G1','Unit price');
$objPHPExcel->getActiveSheet()->SetCellValue('H1','Inv value');
$objPHPExcel->getActiveSheet()->SetCellValue('I1','Ppc');
$objPHPExcel->getActiveSheet()->SetCellValue('J1','CBM stock');
$objPHPExcel->getActiveSheet()->SetCellValue('K1','CBM ordered');
$objPHPExcel->getActiveSheet()->SetCellValue('L1','Qty 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('M1','Avg price 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('N1','Qty this m');
$objPHPExcel->getActiveSheet()->SetCellValue('O1','Avg price this m');
$objPHPExcel->getActiveSheet()->SetCellValue('P1','Stock m');
$objPHPExcel->getActiveSheet()->SetCellValue('Q1','Pricebook');
$objPHPExcel->getActiveSheet()->SetCellValue('R1','MOQ');
$objPHPExcel->getActiveSheet()->SetCellValue('S1','Pieces per carton');
$objPHPExcel->getActiveSheet()->SetCellValue('T1','Carton dimensions (m)');
$objPHPExcel->getActiveSheet()->SetCellValue('U1','Carton netto weight');
$objPHPExcel->getActiveSheet()->SetCellValue('V1','Carton brutto weight');
$objPHPExcel->getActiveSheet()->SetCellValue('W1','Product netto weight');
$objPHPExcel->getActiveSheet()->SetCellValue('X1','Product brutto weight');
$objPHPExcel->getActiveSheet()->SetCellValue('Y1','Packing dimensions');
$objPHPExcel->getActiveSheet()->SetCellValue('Z1','Carton volume');
$objPHPExcel->getActiveSheet()->SetCellValue('AA1','EAN');
$objPHPExcel->getActiveSheet()->SetCellValue('AB1','Short description');
$objPHPExcel->getActiveSheet()->SetCellValue('AC1','Long description');
$objPHPExcel->getActiveSheet()->SetCellValue('AD1','FOB price');
$objPHPExcel->getActiveSheet()->SetCellValue('AE1','SRP price');
$objPHPExcel->getActiveSheet()->SetCellValue('AF1','Custom duty rate');
$objPHPExcel->getActiveSheet()->SetCellValue('AG1','Commission rate');
/*
$objPHPExcel->getActiveSheet()->SetCellValue('O1','Pieces per carton');
$objPHPExcel->getActiveSheet()->SetCellValue('P1','Carton dimensions');
$objPHPExcel->getActiveSheet()->SetCellValue('Q1','Packing dimensions');
$objPHPExcel->getActiveSheet()->SetCellValue('R1','Carton volume');*/
$j=0;
if(count($mn)>0){
foreach($mn as $mm){
$mmm[]="id='".$mm."'";
}
}
if(count($mmm)<=0){
if($_SESSION['EcmProductsForXLSwhere']=="")$_SESSION['EcmProductsForXLSwhere']="1=1";
$where="where (".$_SESSION['EcmProductsForXLSwhere'].") and deleted='0'";
//$_SESSION['EcmProductsForXLSwhere']="";
}
else $where="where (".implode(" or ",$mmm).") and deleted='0'";
$ww=$GLOBALS['db']->query("select * from ecmproducts ".$where);
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$rr['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($j+2),$rr['code']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),$rr['product_category_name']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$rr['ems_qty_in_stock']);
$ems_qty_in_stock_sum+=$rr['ems_qty_in_stock'];
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$rr['ordered']);
$ordered_sum+=$rr['ordered'];
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),$rr['ems_price']);
$ems_price_sum+=$rr['ems_price'];
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),$rr['purchase_price']);
$purchase_price_sum+=$rr['purchase_price'];
$SALE_AVG_PRICE90=0;
$sale0=0;
$sale30=0;
$sale90=0;
$sale180=0;
$qty0=0;
$qty30=0;
$qty90=0;
$qty180=0;
$ddate=date("Y-m-d",mktime()-200*24*3600);
$w=$GLOBALS['db']->query("select ecminvoiceoutitems.price as price,ecminvoiceoutitems.quantity as quantity,ecminvoiceouts.register_date as date from ecminvoiceoutitems inner join ecminvoiceouts on ecminvoiceoutitems.ecminvoiceout_id=ecminvoiceouts.id where ecminvoiceoutitems.ecmproduct_id='".$rr['id']."' and ecminvoiceouts.type!='correct' and ecminvoiceouts.register_date>'".$ddate."'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$sale+=$r['price']*$r['quantity'];
$qty+=$r['quantity'];
$aq[$r['no']]+=$r['quantity'];
$date=date("Y-m");
$m=(int)date("m");
$date1=date("Y-m",mktime(0,0,0,($m-1),1,date("Y")));
$date2=date("Y-m",mktime(0,0,0,($m-2),1,date("Y")));
$date3=date("Y-m",mktime(0,0,0,($m-3),1,date("Y")));
$date4=date("Y-m",mktime(0,0,0,($m-4),1,date("Y")));
$date5=date("Y-m",mktime(0,0,0,($m-5),1,date("Y")));
$date6=date("Y-m",mktime(0,0,0,($m-6),1,date("Y")));
$d=explode("-",$r['date']);
$dd=$d[0]."-".$d[1];
if($dd==$date){
$sale0+=$r['price']*$r['quantity'];
$qty0+=$r['quantity'];
$aq0[$r['no']]+=$r['quantity'];
}
if($dd==$date1){
$sale30+=$r['price']*$r['quantity'];
$qty30+=$r['quantity'];
$aq30[$r['no']]+=$r['quantity'];
}
if($dd==$date1 || $dd==$date2 || $dd==$date3){
$sale90+=$r['price']*$r['quantity'];
$qty90+=$r['quantity'];
$aq90[$r['no']]+=$r['quantity'];
}
if($dd==$date1 || $dd==$date2 || $dd==$date3 || $dd==$date4 || $dd==$date5 || $dd==$date6){
$sale180+=$r['price']*$r['quantity'];
$qty180+=$r['quantity'];
$aq180[$r['no']]+=$r['quantity'];
}
}
$SALE_QTY=$qty;
$SALE_QTY0=$qty0;
$SALE_QTY30=$qty30;
$SALE_QTY90=($qty90/3);
$SALE_QTY180=$qty180;
$SALE_SALE=$sale;
$SALE_SALE0=$sale0;
$SALE_SALE30=$sale30;
$SALE_SALE90=$sale90;
$SALE_SALE80=$sale180;
if($qty>0)$SALE_AVG_PRICE=round($sale/$qty,2);
if($qty0>0)$SALE_AVG_PRICE0=round($sale0/$qty0,2);
if($qty30>0)$SALE_AVG_PRICE30=round($sale30/$qty30,2);
if($qty90>0)$SALE_AVG_PRICE90=round($sale90/$qty90,2);
if($qty180>0)$SALE_AVG_PRICE180=round($sale180/$qty180,2);
if($rr['pieces_per_carton'])$cbm=(($rr['ems_qty_in_stock']*$rr['carton_volume_meter'])/$rr['pieces_per_carton']);
if($rr['pieces_per_carton'])$cbm_ordered=(($rr['ordered']*$rr['carton_volume_meter'])/$rr['pieces_per_carton']);
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),($rr['ems_price']*$rr['ems_qty_in_stock']));
$stock_value_sum+=($rr['ems_price']*$rr['ems_qty_in_stock']);
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),$rr['pieces_per_carton']);
$pieces_per_carton_sum+=$rr['pieces_per_carton'];
$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),$cbm);
$cbm_sum+=$cbm;
$objPHPExcel->getActiveSheet()->SetCellValue('K'.($j+2),$cbm_ordered);
$cbm_ordered_sum+=$cbm_ordered;
$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),$SALE_QTY90);
$sale_qty90_sum+=$SALE_QTY90;
$objPHPExcel->getActiveSheet()->SetCellValue('M'.($j+2),$SALE_AVG_PRICE90);
$sale_avg_price90_sum+=$SALE_AVG_PRICE90;
$objPHPExcel->getActiveSheet()->SetCellValue('N'.($j+2),$SALE_QTY0);
$sale_qty0_sum+=$SALE_QTY0;
$objPHPExcel->getActiveSheet()->SetCellValue('O'.($j+2),$SALE_AVG_PRICE0);
$sale_avg_price0_sum+=$SALE_AVG_PRICE0;
$objPHPExcel->getActiveSheet()->SetCellValue('P'.($j+2),($rr['ems_qty_in_stock']/($SALE_QTY90)));
//pricebook
$accounts=array("Auchan","Carrefour","Euro","Real");
$dig=array();
foreach($accounts as $account){
$www=$GLOBALS['db']->query("select p.id from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where p.ecmproduct_id='".$rr['id']."' and e.name='".$account."' and e.deleted='0' and p.deleted='0'");
if(mysql_num_rows($www)>0)$dig[]=$account[0];
}
$objPHPExcel->getActiveSheet()->SetCellValue('Q'.($j+2),implode(",",$dig));
$objPHPExcel->getActiveSheet()->SetCellValue('R'.($j+2),$rr['moq']);
$objPHPExcel->getActiveSheet()->SetCellValue('S'.($j+2),$rr['pieces_per_carton']);
$objPHPExcel->getActiveSheet()->SetCellValue('T'.($j+2),$rr['carton_dimensions_1']." x ".$rr['carton_dimensions_2']." x ".$rr['carton_dimensions_3']);
$objPHPExcel->getActiveSheet()->SetCellValue('U'.($j+2),$rr['carton_netto_weight']);
$objPHPExcel->getActiveSheet()->SetCellValue('V'.($j+2),$rr['carton_brutto_weight']);
$objPHPExcel->getActiveSheet()->SetCellValue('W'.($j+2),$rr['product_netto_weight']);
$objPHPExcel->getActiveSheet()->SetCellValue('X'.($j+2),$rr['product_brutto_weight']);
$objPHPExcel->getActiveSheet()->SetCellValue('Y'.($j+2),$rr['packing_dimensions_1']." x ".$rr['packing_dimensions_2']." x ".$rr['packing_dimensions_3']);
$objPHPExcel->getActiveSheet()->SetCellValue('Z'.($j+2),$rr['carton_volume_meter']);
$rl=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmproduct_language where ecmproduct_id='".$rr['id']."' and language='pl'"));
$objPHPExcel->getActiveSheet()->SetCellValue('AA'.($j+2),$rl['ean']);
if($rl['short_description'])$sd="yes";
else $sd="no";
if($rl['long_description'])$ld="yes";
else $ld="no";
$objPHPExcel->getActiveSheet()->SetCellValue('AB'.($j+2),$sd);
$objPHPExcel->getActiveSheet()->SetCellValue('AC'.($j+2),$ld);
$objPHPExcel->getActiveSheet()->SetCellValue('AD'.($j+2),$rr['fob_price']);
$objPHPExcel->getActiveSheet()->SetCellValue('AE'.($j+2),$rr['srp_price']);
$objPHPExcel->getActiveSheet()->SetCellValue('AF'.($j+2),$rr['custom_duty_rate']);
$objPHPExcel->getActiveSheet()->SetCellValue('AG'.($j+2),$rr['commission_rate']);
$j++;
}
$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".($j+2).":AG".($j+2)
);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$ems_qty_in_stock_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$ordered_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),($ems_price_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),($purchase_price_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),($stock_value_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),($pieces_per_carton_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),$cbm_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('K'.($j+2),$cbm_ordered_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),($sale_qty90_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('M'.($j+2),($sale_avg_price90_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('N'.($j+2),($sale_qty0_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('O'.($j+2),($sale_avg_price0_sum/$j));
$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/Products".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

175
modules/EcmProducts/CreateXLS.php Executable file
View File

@@ -0,0 +1,175 @@
<?php
set_time_limit(999999);
$mn=explode(",",$_REQUEST['uid']);
//$mn=$_REQUEST['mass'];
if(!$_REQUEST['uid'])$mn=$_REQUEST['mass'];
include_once("modules/EcmProducts/EcmProduct.php");
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 PRICEBOOK");
$objPHPExcel->getProperties()->setSubject("Office 2007 PRICEBOOK");
$objPHPExcel->getProperties()->setDescription("PRICEBOOK");
$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)
)
),
"A1:AG1"
);
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('P')->setWidth(20);
$objPHPExcel->getActiveSheet()->SetCellValue('A1','Code');
$objPHPExcel->getActiveSheet()->SetCellValue('B1','Product');
$objPHPExcel->getActiveSheet()->SetCellValue('C1','Category');
$objPHPExcel->getActiveSheet()->SetCellValue('D1','Inv');
$objPHPExcel->getActiveSheet()->SetCellValue('E1','Ord');
$objPHPExcel->getActiveSheet()->SetCellValue('F1','EMS price');
$objPHPExcel->getActiveSheet()->SetCellValue('G1','Inv value');
$objPHPExcel->getActiveSheet()->SetCellValue('H1','Ppc');
$objPHPExcel->getActiveSheet()->SetCellValue('I1','Qty this m');
$objPHPExcel->getActiveSheet()->SetCellValue('J1','Sale this m');
$objPHPExcel->getActiveSheet()->SetCellValue('K1','Margin this m');
$objPHPExcel->getActiveSheet()->SetCellValue('L1','Qty 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('M1','Sale 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('N1','Margin 3 m');
$objPHPExcel->getActiveSheet()->SetCellValue('O1','Inv+ord m');
$objPHPExcel->getActiveSheet()->SetCellValue('P1','Pricebook');
$j=0;
if(count($mn)>0){
foreach($mn as $mm){
$mmm[]="id='".$mm."'";
}
}
if(count($mmm)<=0){
if($_SESSION['EcmProductsForXLSwhere']=="")$_SESSION['EcmProductsForXLSwhere']="1=1";
$where="where (".$_SESSION['EcmProductsForXLSwhere'].") and deleted='0'";
//$_SESSION['EcmProductsForXLSwhere']="";
}
else $where="where (".implode(" or ",$mmm).") and deleted='0'";
//echo $where;die();
$ww=$GLOBALS['db']->query("select * from ecmproducts ".$where);
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
/*$s0=$ecmp->getSale(array(date("Y-m")));
$s3=$ecmp->getSale(array(date("Y-m",mktime()-1*30*24*3600),date("Y-m",mktime()-2*30*24*3600),date("Y-m",mktime()-3*30*24*3600)));
$GLOBALS['db']->query("update ecmproducts set q0='".$s0['quantity']."',p0='".($s0['sale']-$s0['purchase'])."',s0='".$s0['sale']."',q3='".($s3['quantity']/3)."',p3='".(($s3['sale']-$s3['purchase'])/3)."',s3='".($s3['sale']/3)."',stock_month='".$stock_month."',stock_value='".$stock_value."' where id='".$rr['id']."'");
*/
$objPHPExcel->getActiveSheet()->SetCellValue('A'.($j+2),$rr['code']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.($j+2),$rr['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.($j+2),$rr['product_category_name']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$rr['ems_qty_in_stock']);
$ems_qty_in_stock_sum+=$rr['ems_qty_in_stock'];
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$rr['ordered']);
$ordered_sum+=$rr['ordered'];
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),$rr['ems_price']);
$ems_price_sum+=$rr['ems_price'];
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),$rr['ems_price']*$rr['ems_qty_in_stock']);
$stock_value_sum+=$rr['ems_price']*$rr['ems_qty_in_stock'];
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),$rr['pieces_per_carton']);
$pieces_per_carton_sum+=$rr['pieces_per_carton'];
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),$rr['q0']);
$q0_sum+=$rr['q0'];
$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),$rr['s0']);
$s0_sum+=$rr['s0'];
$objPHPExcel->getActiveSheet()->SetCellValue('K'.($j+2),$rr['p0']);
$p0_sum+=$rr['p0'];
$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),$rr['q3']);
$q3_sum+=$rr['q3'];
$objPHPExcel->getActiveSheet()->SetCellValue('M'.($j+2),$rr['s3']);
$s3_sum+=$rr['s3'];
$objPHPExcel->getActiveSheet()->SetCellValue('N'.($j+2),$rr['p3']);
$p3_sum+=$rr['p3'];
if(round(($rr['s3']))!=0)$stock_month=(($rr['ems_qty_in_stock']+$rr['ordered'])/round(($rr['s3'])));
else $stock_month=0;
$objPHPExcel->getActiveSheet()->SetCellValue('O'.($j+2),$stock_month);
$stock_month_sum+=$rr['stock_month'];
//pricebook
$accounts=array("Auchan","Carrefour","Euro","Real");
$dig=array();
foreach($accounts as $account){
$www=$GLOBALS['db']->query("select p.id from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where p.ecmproduct_id='".$rr['id']."' and e.name='".$account."' and e.deleted='0' and p.deleted='0'");
if(mysql_num_rows($www)>0)$dig[]=$account[0];
}
$objPHPExcel->getActiveSheet()->SetCellValue('P'.($j+2),implode(",",$dig));
$j++;
}
$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".($j+2).":AG".($j+2)
);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.($j+2),$ems_qty_in_stock_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.($j+2),$ordered_sum);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.($j+2),($ems_price_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('G'.($j+2),($stock_value_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('H'.($j+2),($pieces_per_carton_sum/$j));
$objPHPExcel->getActiveSheet()->SetCellValue('I'.($j+2),($q0_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('J'.($j+2),($s0_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('K'.($j+2),($p0_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('L'.($j+2),($q3_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('M'.($j+2),($s3_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('N'.($j+2),($p3_sum));
$objPHPExcel->getActiveSheet()->SetCellValue('O'.($j+2),($stock_month_sum/$j));
$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/Products".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,12 @@
<?php
header('Content-type: application/xml');
header('Content-Disposition: attachment; filename="product.xml"');
error_reporting(0);
include_once("modules/EcmProducts/xml_template.php");
$xml=xml($_REQUEST['record']);
$file="cache/upload/product_xml_".str_replace(" ","_",str_replace(".","_",microtime())).".xml";
fopen($file);
file_put_contents($file,$xml);
chmod($file,0777);
header("Location: ".$file);
?>

View File

@@ -0,0 +1,14 @@
<?php
set_time_limit(999999);
include 'modules/EcmProducts/merlinXML.php';
$mn=explode(",",$_REQUEST['uid']);
//$mn=$_REQUEST['mass'];
if(!$_REQUEST['uid'])$mn=$_REQUEST['mass'];
var_dump($mn);
echo "<pre>";
$x=new merlinXML('a');
foreach($mn as $k){
$x->addProduct($k);
}
$x->getXML();
header("Location: cache/file.xml");

View 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.
* ******************************************************************************
*/
global $current_user;
$dashletData ['EcmProductSellDashlet'] ['searchFields'] = array ();
$dashletData ['EcmProductSellDashlet'] ['columns'] = array (
'name' => array (
'width' => '30',
'label' => 'LBL_LIST_NAME',
'link' => true,
'default' => true
) ,
'this_month_val' => array (
'label' => 'LBL_THIS_MONTH_VAL',
'width' => '30',
'default' => true
),
'this_month_qty' => array (
'label' => 'LBL_THIS_MONTH_QTY',
'width' => '30',
'default' => true
),
)
;
?>

View File

@@ -0,0 +1,58 @@
<?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 $app_strings;
$dashletMeta['EcmProductSellDashlet'] = array(
'title' => "Sprzedaż produktów",
'icon' => 'modules/EcmProducts/images/EcmProducts.gif',
'category' => 'Module Views',
'hidden' => true);
?>

View File

@@ -0,0 +1,75 @@
<?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.
********************************************************************************/
require_once('include/Dashlets/DashletGeneric.php');
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Dashlets/EcmProductSellDashlet/EcmProductSellDashlet.data.php');
class EcmProductSellDashlet extends DashletGeneric {
function EcmProductSellDashlet($id, $def = null) {
global $current_user, $app_strings, $dashletData;
parent::DashletGeneric($id, $def);
$this->searchFields = $dashletData['EcmProductSellDashlet']['searchFields'];
$this->columns = $dashletData['EcmProductSellDashlet']['columns'];
if(empty($def['title']))
$this->title = "Sprzedaż produktów";
$this->seedBean = new EcmProduct();
}
function displayOptions() {
$this->processDisplayOptions();
$this->configureSS->assign('searchFields', $this->currentSearchFields);
return $this->configureSS->fetch($this->configureTpl);
}
}
?>

View File

@@ -0,0 +1,79 @@
<?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 $current_user;
$dashletData['MyEcmProductsDashlet']['searchFields'] = array(
'date_entered' => array('default' => ''),
'date_modified' => array('default' => ''),
'assigned_user_id' => array('type' => 'assigned_user_name',
'default' => $current_user->name)
);
$dashletData['MyEcmProductsDashlet']['columns'] = array(
'name' => array(
'width' => '40',
'label' => 'LBL_LIST_NAME',
'link' => true,
'default' => true),
'date_entered' => array(
'width' => '15',
'label' => 'LBL_DATE_ENTERED'),
'date_modified' => array(
'width' => '15',
'label' => 'LBL_DATE_MODIFIED'),
'created_by' => array(
'width' => '8',
'label' => 'LBL_CREATED'),
'assigned_user_name' => array(
'width' => '8',
'label' => 'LBL_LIST_ASSIGNED_USER'),
);
?>

View File

@@ -0,0 +1,59 @@
<?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 $app_strings;
$dashletMeta['MyEcmProductsDashlet'] = array(
'title' => translate('LBL_LIST_MY_ECMPRODUCTS', 'EcmProducts'),
'icon' => 'modules/EcmProducts/images/EcmProducts.gif',
'description' => 'A customizable view into EcmProducts',
'category' => 'Module Views',
'hidden' => true);
?>

View File

@@ -0,0 +1,75 @@
<?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.
********************************************************************************/
require_once('include/Dashlets/DashletGeneric.php');
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Dashlets/MyEcmProductsDashlets/MyEcmProductsDashlet.data.php');
class MyEcmProductsDashlet extends DashletGeneric {
function MyEcmProductsDashlet($id, $def = null) {
global $current_user, $app_strings, $dashletData;
parent::DashletGeneric($id, $def);
$this->searchFields = $dashletData['MyEcmProductsDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmProductsDashlet']['columns'];
if(empty($def['title']))
$this->title = translate('LBL_LIST_MY_ECMPRODUCTS', 'EcmProducts');
$this->seedBean = new EcmProduct();
}
function displayOptions() {
$this->processDisplayOptions();
$this->configureSS->assign('searchFields', $this->currentSearchFields);
return $this->configureSS->fetch($this->configureTpl);
}
}
?>

69
modules/EcmProducts/Delete.php Executable file
View File

@@ -0,0 +1,69 @@
<?php
/*****************************************************************************
* 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.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/EcmProducts/EcmProduct.php');
$focus = new EcmProduct();
//TODO: nie pozwolić usunąć produktu, na którym była jakieś operacje magazynowe
// PERFORM THE DELETE IF GIVEN A RECORD TO DELETE
if(!isset($_REQUEST['record']))
sugar_die("A record number must be specified to delete the record.");
$focus->retrieve($_REQUEST['record']);
if(!$focus->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->mark_deleted($_REQUEST['record']);
// NOW THAT THE DELETE HAS BEEN PERFORMED, RETURN TO GIVEN LOCATION
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
?>

View File

@@ -0,0 +1,323 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings, $db;
$app_list_strings['ecmproducts_parent_dom'] = array (
'Accounts' => $app_list_strings['moduleList']['Accounts'],
'Leads' => $app_list_strings['moduleList']['Leads'],
);
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])){
$focus->retrieve($_REQUEST['record']);
//if(isset($focus->id) && $focus->id != '')$focus->format_all_fields();
}
$json = getJSONobj();
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmProducts/views/DetailView/view.detail.ecmproducts.php');
$detail = new ViewDetailEcmProducts();
$detail->ss = new Sugar_Smarty();
$detail->bean = $focus;
$detail->preDisplay();
$uunit_array = array();
$uunit='';
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$uunit.='<option value="'.$row['id'].'"';
if($focus->usage_unit_id==$row['id'])$uunit.=' selected';
$uunit.='>'.$row['name'].'</option>';
$uunit_array[$row['id']] = $row['name'];
}
$detail->ss->assign("USAGE_UNIT_ID",$uunit);
$tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$tax.='<option value="'.$row['id'].'"';
if($focus->vat_id==$row['id'])$tax.=' selected';
$tax.='>'.$row['name'].'</option>';
}
$detail->ss->assign("VAT_ID",$tax);
$fbas='';
$result = $db->query("select id,name from ecmproductbasis order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$fbas.='<option value="'.$row['id'].'"';
if($focus->fob_basis_id==$row['id'])$fbas.=' selected';
$fbas.='>'.$row['name'].'</option>';
}
$detail->ss->assign("FOB_BASIS_ID",$fbas);
$pack='';
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$pack.='<option value="'.$row['id'].'"';
if($focus->packing_type_id==$row['id'])$pack.=' selected';
$pack.='>'.$row['name'].'</option>';
}
$detail->ss->assign("PACKING_TYPE_ID",$pack);
//load currencies
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
$currency_list = $currency->get_full_list('name');
$currency->retrieve('-99');
if(is_array($currency_list))
{
$currency_list = array_merge(Array($currency), $currency_list);
}
else
{
$currency_list = Array($currency);
}
$arr = array();
foreach($currency_list as $key=>$value)
{
$arr[$value->id] = $value->name;
}
$detail->ss->assign("EXCHANGE_RATE_NAME", $arr[$focus->exchange_rate_id]);
function show_image($img, $big)
{
if(is_file($img))
{
$obraz=@GetImageSize($img);
$obig = @GetImageSize($big);
if($obraz[0]>=180)
{
$szerokosc=180;
$wysokosc=$obraz[1]*$szerokosc/$obraz[0];
}
else
{
$szerokosc=$obraz[0];
$wysokosc=$obraz[1];
}
$height=$obig[1]+20;
$width=$obig[0]+20;
return '<a style="cursor:pointer;" onclick="window.open(\''.$big.'\',\'Image\',\'height='.$height.',width='.$width.'\');"><img src="pic.php?p='.$img.'&w='.$szerokosc.'&h='.$wysokosc.'"></a>';
}
}
$detail->ss->assign("PRODUCT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->product_picture,"modules/EcmProducts/upload/images/big/".$focus->product_picture));
$detail->ss->assign("PACKING_FRONT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->packing_front_picture,"modules/EcmProducts/upload/images/big/".$focus->packing_front_picture));
$detail->ss->assign("DRIVER_1", $focus->driver_1);
if($focus->driver_1)$detail->ss->assign("DRIVER_1_DOWNLOAD",'<a href="modules/EcmProducts/upload/'.$focus->driver_1.'">Download</a>');
$detail->ss->assign("DRIVER_2", $focus->driver_2);
if($focus->driver_2)$detail->ss->assign("DRIVER_2_DOWNLOAD",'<a href="modules/EcmProducts/upload/'.$focus->driver_2.'">Download</a>');
//add mz
$pl3 = $this->bean->showPositions3();
$detail->ss->assign('POSITIONS3', $pl3);
$pl4 = $this->bean->showPrices();
$detail->ss->assign('POSITIONS4', $pl4);
$ii='<table cellspacing="0" cellpadding="0" border="0" width="400">
<tr>
<td><b>'.$mod_strings['LBL_II_STOCK'].'</b></td>
<td><b>'.$mod_strings['LBL_II_QTY'].'</b></td>
<td><b>'.$mod_strings['LBL_II_PRICE'].'</b></td>
</tr>';
$w=$GLOBALS['db']->query("select ecmstocks.name as sname,ecmstocks.id as sid,sum(ecmstockstates.quantity) as q,avg(ecmstockstates.price) as p from ecmstockstates inner join ecmstocks on ecmstocks.id=ecmstockstates.stock_id where ecmstockstates.deleted='0' and ecmstockstates.product_id='".$focus->id."' group by ecmstockstates.stock_id order by ecmstocks.name asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
if($r['q']>0)$ii.='<tr><td><a href="index.php?query=true&module=EcmStockOperations&action=&searchFormTab=basic_search&product_id_basic='.$_REQUEST['record'].'&product_name_basic='.$focus->name.'&stock_id_basic='.$r['sid'].'&stock_name_basic='.$r['sname'].'">'.$r['sname']."</a></td><td>".$r['q']."</td><td>".number_format($r['p'],2,$GLOBALS['sugar_config']['default_decimal_seperator'],$GLOBALS['sugar_config']['default_number_grouping_seperator'])."</td></tr>";
}
// get stock addresses
$result = $GLOBALS['db']->query("SELECT stock_address, is_not_full FROM ecmproducts_stock_addresses WHERE ecmproduct_id='$focus->id';");
$stock_addresses = "";
while($row=$GLOBALS['db']->fetchByAssoc($result)) {
if ($row['is_not_full'] == '1') {
$stock_addresses .= " <span style='color: red;'>".$row['stock_address']."</span>";
} else {
$stock_addresses .= " ".$row['stock_address'];
}
}
$focus->stock_addresses = $stock_addresses;
$ii.='</table>';
$detail->ss->assign("INVENTORY_INFORMATION",$ii);
$rp_app=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select sum(p.product_quantity) as s from ecmproducts_ecmpurchaseorders as p inner join ecmpurchaseorders as e on e.id=p.ecmpurchaseorder_id where p.ecmproduct_id='".$focus->id."' and p.deleted='0' and e.status='accepted'"));
$rp_cr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select sum(p.product_quantity) as s from ecmproducts_ecmpurchaseorders as p inner join ecmpurchaseorders as e on e.id=p.ecmpurchaseorder_id where p.ecmproduct_id='".$focus->id."' and p.deleted='0' and e.status='registered'"));
$detail->ss->assign("ORDERED",$rp_app['s']+$rp_cr['s']);
$detail->ss->assign("CARTON_DIMENSIONS_1",format_number($focus->carton_dimensions_1,2));
$detail->ss->assign("CARTON_DIMENSIONS_2",format_number($focus->carton_dimensions_2,2));
$detail->ss->assign("CARTON_DIMENSIONS_3",format_number($focus->carton_dimensions_3,2));
$detail->ss->assign("PACKING_DIMENSIONS_1",$focus->packing_dimensions_1);
$detail->ss->assign("PACKING_DIMENSIONS_2",$focus->packing_dimensions_2);
$detail->ss->assign("PACKING_DIMENSIONS_3",$focus->packing_dimensions_3);
if($focus->product_picture)$detail->ss->assign("PRODUCT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->packing_front_picture)$detail->ss->assign("PACKING_FRONT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->driver_1)$detail->ss->assign("DRIVER_1_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->driver_2)$detail->ss->assign("DRIVER_2_UPLOAD",$mod_strings['LBL_UPLOADED']);
$result = $GLOBALS['db']->query("select ean,remarks,short_description,long_description,language,price from ecmproduct_language where ecmproduct_id='".$_REQUEST['record']."'");
while($row=$GLOBALS['db']->fetchByAssoc($result))
{
$detail->ss->assign("EAN_".$row['language'],$row['ean']);
$detail->ss->assign("REMARKS_".$row['language'],$row['remarks']);
$detail->ss->assign("SHORT_DESCRIPTION_".$row['language'],$row['short_description']);
$detail->ss->assign("LONG_DESCRIPTION_".$row['language'],str_replace("&lt;","<",str_replace("&gt;",">",$row['long_description'])));
$detail->ss->assign("PRICE_".$row['language'],number_format($row['price'],2,",","."));
}
$send_xml=true;
if(!file_exists("modules/EcmProducts/upload/images/big/".$focus->product_picture))$send_xml=false;
if(!file_exists("modules/EcmProducts/upload/images/big/".$focus->packing_front_picture))$send_xml=false;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean,remarks,short_description,long_description,language,price from ecmproduct_language where language='pl' and ecmproduct_id='".$_REQUEST['record']."'"));
if(!$r['ean'] || !$r['short_description'] || !$r['long_description'] || !$r['price'])$send_xml=false;
if($send_xml)$detail->ss->assign("SEND_XML",1);
else $detail->ss->assign("SEND_XML",0);
//add mz 2014-12-09
//QR CODE
require_once 'phpqrcode/phpqrcode.php';
QRcode::png($this->bean->code.', '.$this->bean->name.' ['.$this->bean->id.']', 'modules/EcmProducts/QRcodes/'.$this->bean->id.'.png', QR_ECLEVEL_L, 4,10);
$detail->ss->assign("QRCODE", '<img src="modules/EcmProducts/QRcodes/'.$this->bean->id.'.png"/>');
//end mz
/*
$desc='';
$desc.='<input title="Product Card" class="button" onclick="if(document.getElementById(\'div_desc\').style.display==\'none\')document.getElementById(\'div_desc\').style.display=\'block\';else document.getElementById(\'div_desc\').style.display=\'none\';" type="button" name="productcard" id="productcard" value="Create Catalogue">';
$desc.='<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$desc.='Show header: <select name="show_header" id="show_header"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='Show content: <select name="show_content" id="show_content"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='To image: <select name="image" id="image"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='Title page: <select name="title" id="title"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='Show price: <select name="show_price" id="show_price"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='Extra info: <select name="extra" id="extra"><option value="1">Yes</option><option value="0" selected>No</option></select><br /><br />';
$desc.='Price: <select name="price" id="price"><option value="srp_price">SRP Price</option></select><br /><br />';
$desc.='Language: <select name="language" id="language"><option value="pl">pl</option><option value="en">en</option></select><br /><br />';
$desc.='EAN: <select name="ean" id="ean"><option value="1">1</option><option value="2">2</option></select><br /><br />';
$desc.='<input type="button" class="button" name="generate" id="generate" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=generateProductCardsFromProduct&record='.$_REQUEST['record'].'&to_pdf=1&price=\'+document.getElementById(\'price\').value+\'&header=\'+document.getElementById(\'show_header\').value+\'&content=\'+document.getElementById(\'show_content\').value+\'&extra=\'+document.getElementById(\'extra\').value+\'&create_img=\'+document.getElementById(\'image\').value+\'&show_price=\'+document.getElementById(\'show_price\').value+\'&title=\'+document.getElementById(\'title\').value+\'&language=\'+document.getElementById(\'language\').value+\'&ean=\'+document.getElementById(\'ean\').value);"></div>';
$detail->ss->assign("CATALOGUE",$desc);
*/
//add mz - nowa karta produktu
global $mod_strings;
$desc='';
$desc.='<input title="Product Card" class="button" onclick="if(document.getElementById(\'div_desc2\').style.display==\'none\')document.getElementById(\'div_desc2\').style.display=\'block\';else document.getElementById(\'div_desc2\').style.display=\'none\';" type="button" name="productcard" id="productcard" value="'.$mod_strings['LBL_PRODUCT_CARD'].'">';
$desc.='<div id="div_desc2" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$desc.='Zdjęcie: <select name="new_image" id="new_image"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
$desc.='Pokaż cene: <select name="new_show_price" id="new_show_price"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
$desc.='Cena: <select name="new_price" id="new_price"><option value="srp_price">SRP Price</option>';
$res = $GLOBALS['db']->query("SELECT p.name, p.id FROM ecmprices_ecmproducts AS pp
INNER JOIN ecmprices AS p
ON pp.ecmprice_id = p.id
WHERE pp.ecmproduct_id='".$focus->id."'
AND pp.price!=0");
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
$desc.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
$desc.='</select><br /><br />';
$desc.='Język: <select name="new_language" id="new_language"><option value="pl">pl</option><option value="en">en</option></select><br /><br />';
$desc.='EAN: <select name="new_ean" id="new_ean"><option value="1">1</option><option value="2">2</option></select><br /><br />';
$desc.='<input type="button" class="button" name="generate" id="generate" value="Generuj" onclick="window.open(\'index.php?module=EcmProducts&action=generateCard&record='.$_REQUEST['record'].'&to_pdf=1&price=\'+document.getElementById(\'new_price\').value+\'&create_img=\'+document.getElementById(\'new_image\').value+\'&show_price=\'+document.getElementById(\'new_show_price\').value+\'&language=\'+document.getElementById(\'new_language\').value+\'&ean=\'+document.getElementById(\'new_ean\').value);"></div>';
$detail->ss->assign("CATALOGUE_NEW",$desc);
$desc='<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$desc.='<input type="checkbox" name="show_characteristic" id="show_characteristic" value="1" checked">Show attributes<br />';
$desc.='<input type="checkbox" name="show_description" id="show_description" value="1" checked">Show description<br />';
$desc.='<input type="checkbox" name="show_specification" id="show_specification" value="1" checked">Show specification<br />';
$desc.='<input type="checkbox" name="print_version" id="print_version" value="1" checked">Print version<br />';
$desc.='Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
$desc.='<input type="button" class="button" name="generate" id="generate" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record='.$_REQUEST['record'].'&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic\').checked+\'&show_specification=\'+document.getElementById(\'show_specification\').checked+\'&show_description=\'+document.getElementById(\'show_description\').checked+\'&print_version=\'+document.getElementById(\'print_version\').checked+\'&language=\'+document.getElementById(\'language\').value);"></div>';
$detail->ss->assign("DIV_DESC",$desc);
$desc='<div id="div_desc_card" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$desc.='<input type="checkbox" name="show_characteristic_card" id="show_characteristic_card" value="1" checked">Show attributes<br />';
$desc.='<input type="checkbox" name="show_description_card" id="show_description_card" value="1" checked">Show description<br />';
$desc.='<input type="checkbox" name="show_specification_card" id="show_specification_card" value="1" checked">Show specification<br />';
$desc.='Language: <select name="language" id="language"><option value="">pl</option><option value="en">en</option></select><br /><br />';
$desc.='<input type="button" class="button" name="generate_card" id="generate_card" value="Generate" onclick="window.open(\'index.php?module=EcmProducts&action=productCard&record='.$_REQUEST['record'].'&to_pdf=1&show_characteristic=\'+document.getElementById(\'show_characteristic_card\').checked+\'&show_specification=\'+document.getElementById(\'show_specification_card\').checked+\'&show_description=\'+document.getElementById(\'show_description_card\').checked+\'&html=1\'+\'&language=\'+document.getElementById(\'language\').value,\'create_html\',\'location=0,status=0,scrollbars=0,width=640,height=500\');"></div>';
$detail->ss->assign("DIV_DESC_CARD",$desc);
//Added for Graduated Prices - Begin
/* require_once('modules/EcmProducts/EcmProductGraduatedPrices.php');
$epgp = new EcmProductGraduatedPrices($focus->graduated_prices);
$detail->ss->assign("PRODUCT_GRADUATED_PRICES_HTML", $epgp->getHtmlDetail());*/
//Added for Graduated Prices - End
//Added for Components
$detail->ss->assign("POSITION_LIST", $focus->getPositionList());
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::loadSettings();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
global $current_user;
$tmp = $current_user->getPreference('num_grp_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = "1";
$OPT['default_vat'] = "19.00";
$OPT['default_category'] = "";
$OPT['default_currency'] = "-99";
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$uunit='';
foreach($app_list_strings['ecmproducts_unit_dom'] as $key=>$value){
$uunit.='<option value="'.$key.'"';
if($focus->usage_unit_id==$key)$uunit.=' selected';
$uunit.='>'.$value.'</option>';
}
$OPT['ecmproduct_usage_units_options'] =$app_list_strings['ecmproducts_unit_dom'];
$scriptOpt = '
<script language="javascript">
var VAT = '.str_replace('&quot;','\"',$json->encode($VAT)).';
var OPT = '.str_replace('&quot;','\"',$json->encode($OPT)).';
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
var N;
</script>';
echo $scriptOpt;
$detail->ss->assign("OPT", $OPT);
//Added for Components
global $current_user;
$detail->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
echo $detail->display();
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, "EcmProducts");
echo $subpanel->display();
?>

View File

@@ -0,0 +1,462 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<script language="javascript" src="modules/EcmProducts/mintajax.js"></script>
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<script>
function select_lang(value)
{
document.getElementById('row0en').style.display="none";
document.getElementById('row0de').style.display="none";
document.getElementById('row0pl').style.display="none";
document.getElementById('row1en').style.display="none";
document.getElementById('row1de').style.display="none";
document.getElementById('row1pl').style.display="none";
document.getElementById('row2en').style.display="none";
document.getElementById('row2de').style.display="none";
document.getElementById('row2pl').style.display="none";
document.getElementById('row0'+value).style.display="table-row";
document.getElementById('row1'+value).style.display="table-row";
document.getElementById('row2'+value).style.display="table-row";
}
</script>
<form action="index.php" method="post" name="DetailView" id="form">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<input type="hidden" name="module" value="EcmProducts">
<input type="hidden" name="record" value="{ID}">
<input type="hidden" name="isDuplicate" value=false>
<input type="hidden" name="action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_action">
<input type="hidden" name="return_id" >
<tr>
<td style="padding-bottom: 2px;">
<input title="{APP.LBL_EDIT_BUTTON_TITLE}"
accessKey="{APP.LBL_EDIT_BUTTON_KEY}"
class="button"
onclick="this.form.return_module.value='EcmProducts'; this.form.return_action.value='DetailView'; this.form.return_id.value='{ID}'; this.form.action.value='EditView'"
type="submit"
name="Edit"
value=" {APP.LBL_EDIT_BUTTON_LABEL} ">
<input title="{APP.LBL_DUPLICATE_BUTTON_TITLE}"
accessKey="{APP.LBL_DUPLICATE_BUTTON_KEY}"
class="button"
onclick="this.form.return_module.value='EcmProducts'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'"
type="submit"
name="Duplicate"
value=" {APP.LBL_DUPLICATE_BUTTON_LABEL} ">
<input title="{APP.LBL_DELETE_BUTTON_TITLE}"
accessKey="{APP.LBL_DELETE_BUTTON_KEY}"
class="button"
onclick="this.form.return_module.value='EcmProducts'; this.form.return_action.value='ListView'; this.form.action.value='Delete'; return confirm('{APP.NTC_DELETE_CONFIRMATION}')"
type="submit"
name="Delete"
value=" {APP.LBL_DELETE_BUTTON_LABEL} ">
{FIND_DUPES_MERGE_BUTTON}
</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
{PAGINATION1}
<tr>
<td colspan="4" align="left"><strong>{MOD.LBL_PRODUCT_INFORMATION}</strong></td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" class="tabDetailViewDF">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL"><span sugar='slot1'>{MOD.LBL_NAME}</span sugar='slot'></td>
<td width="25%" class="tabDetailViewDF"><span sugar='slot1b'>{NAME}&nbsp;</span sugar='slot'></td>
<td valign="top" class="tabDetailViewDL"><span sugar='slot2'>{APP.LBL_ASSIGNED_TO}</span sugar='slot'></td>
<td valign="top" class="tabDetailViewDF"><span sugar='slot2b'>{ASSIGNED_TO}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot3'>{MOD.LBL_PRODUCT_INDEX}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot3b'>{CODE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot15'>{MOD.LBL_PRODUCT_ACTIVE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot15b'>
<input name='product_active' class="checkbox" type="checkbox" disabled="disabled" {PRODUCT_ACTIVE} />
</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot5'>{MOD.LBL_PRODUCT_CATEGORY}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot5b'><a href="index.php?module=EcmProductCategories&action=DetailView&record={PRODUCT_CATEGORY_ID}">{PRODUCT_CATEGORY}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot16'>{MOD.LBL_SALES_START_DATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot16b'>{SALES_START_DATE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot7'>{MOD.LBL_PRODUCT_LINE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot7b'><a href="index.php?module=EcmProductLines&amp;action=DetailView&amp;record={PRODUCT_LINE_ID}">{PRODUCT_LINE}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot17'>{MOD.LBL_SALES_END_DATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot17b'>{SALES_END_DATE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot9'>{MOD.LBL_MANUFACTURER}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot9b'><a href="index.php?module=EcmproductManufacturers&amp;action=DetailView&amp;record={MANUFACTURER_ID}">{MANUFACTURER}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL">{PARENT_TYPE}</td>
<td width="25%" valign="top" class="tabDetailViewDF"><a href="index.php?module={PARENT_TYPE}&amp;action=DetailView&amp;record={PARENT_ID}">{PARENT_NAME}</a></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot11'>{MOD.LBL_CONTACT_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot11b'><a href="index.php?module=Contacts&amp;action=DetailView&amp;record={CONTACT_ID}">{CONTACT_NAME}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot21'>{MOD.LBL_WEBSITE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot21b'>{WEBSITE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot13'>{MOD.LBL_VENDOR_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot13b'><a href="index.php?module=EcmVendors&amp;action=DetailView&amp;record={VENDOR_ID}">{VENDOR_NAME}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot22'>{MOD.LBL_PART_NO}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot22b'>{PART_NO}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot14'>{MOD.LBL_VENDOR_PART_NO}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot14b'>{VENDOR_PART_NO}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot23'>{MOD.LBL_SERIAL_NO}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot23b'>{SERIAL_NO}</span sugar='slot'></td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td colspan="4" align="left"><strong>{MOD.LBL_PRICING_INFORMATION}</strong></td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" class="tabDetailViewDF">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot25'>{MOD.LBL_EXCHANGE_RATE_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot25b'>{CURRENCY}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot30'>{MOD.LBL_CUSTOM_DUTY_RATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot30b'>{CUSTOM_DUTY_RATE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot26'>{MOD.LBL_FOB_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot26b'>{FOB_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot31'>{MOD.LBL_SRP_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot31b'>{SRP_PRICE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot27'>{MOD.LBL_UNIT_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot27b'>{PURCHASE_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot32'>{MOD.LBL_SRP_PROMO_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot32b'>{SRP_PROMO_PRICE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot28'>{MOD.LBL_EMS_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot28b'>{EMS_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot30'>{MOD.LBL_VAT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot34b'>{TAX_CLASS_NAME}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot29'>{MOD.LBL_COMMISSION_RATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot29b'>{COMMISSION_RATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot30'>{MOD.LBL_SELLING_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF">{SELLING_PRICE}</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td colspan="4" align="left"><strong>{MOD.LBL_STOCK_INFORMATION}</strong></td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" class="tabDetailViewDF">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot36'>{MOD.LBL_USAGE_UNIT_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot36b'>{USAGE_UNIT_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot41'>{MOD.LBL_QTY_PER_UNIT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot41b'>{QTY_PER_UNIT}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_QTY_IN_STOCK}</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_REORDER_LEVEL}</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot37'>{MOD.LBL_EMS_QTY_IN_STOCK}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><span sugar='slot37b'>{EMS_QTY_IN_STOCK}</span sugar='slot'></td>
<td><select id="stock_info" name="stock_info" onchange="mintajaxget('index.php?to_pdf=1&module=EcmProducts&action=getStockInfo&record={ID}&stock_id='+document.getElementById('stock_info').value,'stock_div');"><option>select</option>{STOCK_INFO}</select></td>
<td><div id="stock_div"></div></td>
</tr>
</table>
</td>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_QTY_IN_DEMAND}</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot37'>{MOD.LBL_EMS_ORDERED}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF">{EMS_ORDERED}</td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot42'>{MOD.LBL_AVERAGE_SALE_3_MONTHS}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot42b'>{AVERAGE_SALE_3_MONTHS}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot38'>{MOD.LBL_SALES_LAST_MONTH_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot38b'>{SALES_LAST_MONTH_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot43'>{MOD.LBL_SALES_PLUS_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot43b'>{SALES_PLUS_1}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot39'>{MOD.LBL_SALES_LAST_MONTH}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot39b'>{SALES_LAST_MONTH}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot44'>{MOD.LBL_SALES_PLUS_2}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot44b'>{SALES_PLUS_2}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot40'>{MOD.LBL_SALES_THIS_MONTH}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot40b'>{SALES_THIS_MONTH}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot45'>{MOD.LBL_SALES_PLUS_3}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot45b'>{SALES_PLUS_3}</span sugar='slot'></td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td colspan="4" align="left"><strong>{MOD.LBL_DRIVERS_IMAGES}</strong></td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" class="tabDetailViewDF">&nbsp;</td>
<td valign="top" class="tabDetailViewDL">&nbsp;</td>
<td valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="tabDetailViewDL"><span sugar='slot46'>{MOD.LBL_PRODUCT_PICTURE}</span sugar='slot'></td>
<td valign="top" class="tabDetailViewDF"><span sugar='slot46b'>{PRODUCT_PICTURE}</span sugar='slot'></td>
<td valign="top" class="tabDetailViewDL"><span sugar='slot47'>{MOD.LBL_PACKING_FRONT_PICTURE}</span sugar='slot'></td>
<td valign="top" class="tabDetailViewDF"><span sugar='slot47b'>{PACKING_FRONT_PICTURE}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot48'>{MOD.LBL_DRIVER_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot48b'>{DRIVER_1_DOWNLOAD}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot49'>{MOD.LBL_DRIVER_2}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot49b'>{DRIVER_2_DOWNLOAD}</span sugar='slot'></td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td colspan="4" align="left"><strong>{MOD.LBL_LOGISTIC_INFORMATION}</strong></td>
</tr>
<tr>
<td width="25%" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" class="tabDetailViewDF">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot50'>{MOD.LBL_MOQ}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot50b'>{MOQ}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot63'>{MOD.LBL_CARTON_DIMENSIONS_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot63b'>{CARTON_DIMENSIONS_1} x {CARTON_DIMENSIONS_2} x {CARTON_DIMENSIONS_3}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot52'>{MOD.LBL_FOB_BASIS_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot52b'><a href="index.php?module=EcmProductBasis&amp;action=DetailView&amp;record={FOB_BASIS_ID}">{FOB_BASIS_NAME}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot66'>{MOD.LBL_CARTON_NETTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot66b'>{CARTON_NETTO_WEIGHT}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot53'>{MOD.LBL_DELIVERY_TIME_FOB}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot53b'>{DELIVERY_TIME_FOB}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot67'>{MOD.LBL_CARTON_BRUTTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot67b'>{CARTON_BRUTTO_WEIGHT}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot54'>{MOD.LBL_PIECES_PER_CARTON}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot54b'>{PIECES_PER_CARTON}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot68'>{MOD.LBL_CARTON_VOLUME_METER}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot68b'>{CARTON_VOLUME_METER}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot55'>{MOD.LBL_PRODUCT_NETTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot55b'>{PRODUCT_NETTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot69'>{MOD.LBL_CARTON_VOLUME_FEET}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot69b'>{CARTON_VOLUME_FEET}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot56'>{MOD.LBL_PRODUCT_BRUTTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot56b'>{PRODUCT_BRUTTO_WEIGHT}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot70'>{MOD.LBL_COUNTRY_OF_ORIGIN}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot70b'>{COUNTRY_OF_ORIGIN}</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot58'>{MOD.LBL_PACKING_TYPE_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot58b'><a href="index.php?module=EcmProductPackingTypes&amp;action=DetailView&amp;record={PACKING_TYPE_ID}">{PACKING_TYPE_NAME}</a></span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot71'>{MOD.LBL_CERTIFICATE_OF_ORIGIN}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot71b'>
<input name='certificate_of_origin2222' class="checkbox" type="checkbox" disabled="disabled" {CERTIFICATE_OF_ORIGIN} />
</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot59'>{MOD.LBL_PACKING_DIMENSIONS_1}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot59b'>{PACKING_DIMENSIONS_1} x {PACKING_DIMENSIONS_2} x {PACKING_DIMENSIONS_3}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot72'>{MOD.LBL_FORM_A}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot72b'>
<input name='form_a2222' class="checkbox" type="checkbox" disabled="disabled" {FORM_A} />
</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="tabDetailViewDL"><span sugar='slot62'>{MOD.LBL_RMA}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDF"><span sugar='slot62b'>{RMA}</span sugar='slot'></td>
<td width="25%" valign="top" class="tabDetailViewDL">&nbsp;</td>
<td width="25%" valign="top" class="tabDetailViewDF">&nbsp;</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td width="25%"><strong>{MOD.LBL_LOCALIZED_INFORMATION}</strong></td>
<td width="25%"><select name="slang" id="slang" onchange="select_lang(this.value);">
<option value="pl">pl</option>
<option value="en">en</option>
<option value="de">de</option>
</select>
</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr id="row0en" style="display:none;">
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr id="row1en" style="display:none;">
<td valign="top" class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</td>
<td valign="top" class="tabDetailViewDF">{EAN_en}</td>
<td valign="top" class="tabDetailViewDL">{MOD.LBL_REMARKS}</td>
<td valign="top" class="tabDetailViewDF">{REMARKS_en}</td>
</tr>
<tr id="row2en" style="display:none;">
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{SHORT_DESCRIPTION_en}</td>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{LONG_DESCRIPTION_en}</td>
</tr>
<tr id="row0de" style="display:none;">
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr id="row1de" style="display:none;">
<td valign="top" class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</td>
<td valign="top" class="tabDetailViewDF">{EAN_de}</td>
<td valign="top" class="tabDetailViewDL">{MOD.LBL_REMARKS}</td>
<td valign="top" class="tabDetailViewDF">{REMARKS_de}</td>
</tr>
<tr id="row2de" style="display:none;">
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{SHORT_DESCRIPTION_de}</td>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{LONG_DESCRIPTION_de}</td>
</tr>
<tr id="row0pl" style="display:table-row;">
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
<td class="tabDetailViewDL">&nbsp;</td>
<td class="tabDetailViewDF">&nbsp;</td>
</tr>
<tr id="row1pl" style="display:table-row;">
<td valign="top" class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</td>
<td valign="top" class="tabDetailViewDF">{EAN_pl}</td>
<td valign="top" class="tabDetailViewDL">{MOD.LBL_REMARKS}</td>
<td valign="top" class="tabDetailViewDF">{REMARKS_pl}</td>
</tr>
<tr id="row2pl" style="display:table-row;">
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{SHORT_DESCRIPTION_pl}</td>
<td width="25%" valign="top" class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</td>
<td width="25%" valign="top" class="tabDetailViewDF">{LONG_DESCRIPTION_pl}</td>
</tr>
</table>
<!-- END: main -->
<!-- BEGIN: subpanel -->
<span sugar='slot23'> {SUBPANEL}</span sugar='slot'>
<!-- END: subpanel -->

View File

@@ -0,0 +1,277 @@
<?php
/*****************************************************************************
* 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.
********************************************************************************/
include("modules/EcmProducts/moduleMenu.php");
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
function show_image($img)
{
if(is_file($img))
{
$obraz=@GetImageSize($img);
if($obraz[0]>=180)
{
$szerokosc=180;
$wysokosc=$obraz[1]*$szerokosc/$obraz[0];
}
else
{
$szerokosc=$obraz[0];
$wysokosc=$obraz[1];
}
$height=$obraz[1]+20;
$width=$obraz[0]+20;
return '<a style="cursor:pointer;" onclick="window.open(\''.$img.'\',\'Image\',\'height='.$height.',width='.$width.'\');"><img src="pic.php?p='.$img.'&w='.$szerokosc.'&h='.$wysokosc.'"></a>';
}
}
require_once('XTemplate/xtpl.php');
require_once('data/Tracker.php');
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once('include/DetailView/DetailView.php');
global $mod_strings;
global $app_strings;
$focus = new EcmProduct();
$detailView = new DetailView();
$offset = 0;
// ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
// A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
$result = $detailView->processSugarBean("ECMPRODUCTS", $focus, $offset);
if($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$focus = $result;
}else{
header("Location: index.php?module={EcmProducts}&action=index");
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once($theme_path.'layout_utils.php');
$GLOBALS['log']->info("EcmProducts detail view");
$focus->format_all_fields();
$xtpl=new XTemplate ('modules/EcmProducts/DetailView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("THEME", $theme);
$xtpl->assign("GRIDLINE", $gridline);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("ASSIGNED_TO", $focus->assigned_user_name);
$xtpl->assign("NAME", $focus->name);
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("CODE", $focus->code);
$xtpl->assign("PRODUCT_CATEGORY_ID", $focus->product_category_id);
$xtpl->assign("PRODUCT_CATEGORY", $focus->product_category);
$xtpl->assign("PRODUCT_LINE_ID", $focus->product_line_id);
$xtpl->assign("PRODUCT_LINE", $focus->product_line);
$xtpl->assign("MANUFACTURER_ID", $focus->manufacturer_id);
$xtpl->assign("MANUFACTURER", $focus->manufacturer);
$xtpl->assign("CONTACT_ID", $focus->contact_id);
$xtpl->assign("CONTACT_NAME", $focus->contact_name);
$xtpl->assign("VENDOR_ID", $focus->vendor_id);
$xtpl->assign("VENDOR_NAME", $focus->vendor_name);
$xtpl->assign("VENDOR_PART_NO", $focus->vendor_part_no);
if ($focus->product_active == '1') $xtpl->assign('PRODUCT_ACTIVE', "checked");
$xtpl->assign("SALES_START_DATE", $focus->sales_start_date);
$xtpl->assign("SALES_END_DATE", $focus->sales_end_date);
$xtpl->assign("PARENT_TYPE", $focus->parent_type);
$xtpl->assign("PARENT_ID", $focus->parent_id);
$xtpl->assign("PARENT_NAME", $focus->parent_name);
$xtpl->assign("WEBSITE", $focus->website);
$xtpl->assign("PART_NO", $focus->part_no);
$xtpl->assign("SERIAL_NO", $focus->serial_no);
$xtpl->assign("EXCHANGE_RATE_ID", $focus->exchange_rate_id);
$xtpl->assign("EXCHANGE_RATE_NAME", $focus->exchange_rate_name);
$xtpl->assign("FOB_PRICE", $focus->fob_price);
$xtpl->assign("PURCHASE_PRICE", $focus->purchase_price);
$xtpl->assign("SELLING_PRICE", $focus->selling_price);
$xtpl->assign("EMS_PRICE", $focus->ems_price);
$xtpl->assign("COMMISSION_RATE", $focus->commission_rate);
$xtpl->assign("CUSTOM_DUTY_RATE", $focus->custom_duty_rate);
$xtpl->assign("SRP_PRICE", $focus->srp_price);
$xtpl->assign("SRP_PROMO_PRICE", $focus->srp_promo_price);
$xtpl->assign("TAX_CLASS_ID", $focus->vat_id);
$xtpl->assign("TAX_CLASS_NAME", $focus->vat_name);
$xtpl->assign("USAGE_UNIT_ID", $focus->usage_unit_id);
$xtpl->assign("USAGE_UNIT_NAME", $focus->usage_unit_name);
$xtpl->assign("EMS_QTY_IN_STOCK", $focus->ems_qty_in_stock);
$xtpl->assign("SALES_LAST_MONTH_1", $focus->sales_last_month_1);
$xtpl->assign("SALES_LAST_MONTH", $focus->sales_last_month);
$xtpl->assign("SALES_THIS_MONTH", $focus->sales_this_month);
$xtpl->assign("QTY_PER_UNIT", $focus->qty_per_unit);
$xtpl->assign("AVERAGE_SALE_3_MONTHS", $focus->average_sale_3_months);
$xtpl->assign("SALES_PLUS_1", $focus->sales_plus_1);
$xtpl->assign("SALES_PLUS_2", $focus->sales_plus_2);
$xtpl->assign("SALES_PLUS_3", $focus->sales_plus_3);
$xtpl->assign("PRODUCT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->product_picture));
$xtpl->assign("PACKING_FRONT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->packing_front_picture));
$xtpl->assign("DRIVER_1", $focus->driver_1);
if($focus->driver_1)$xtpl->assign("DRIVER_1_DOWNLOAD",'<a href="modules/EcmProducts/upload/'.$focus->driver_1.'">Download</a>');
$xtpl->assign("DRIVER_2", $focus->driver_2);
if($focus->driver_2)$xtpl->assign("DRIVER_2_DOWNLOAD",'<a href="modules/EcmProducts/upload/'.$focus->driver_2.'">Download</a>');
$xtpl->assign("MOQ", $focus->moq);
$xtpl->assign("FOB_BASIS_ID", $focus->fob_basis_id);
$xtpl->assign("FOB_BASIS_NAME", $focus->fob_basis_name);
$xtpl->assign("DELIVERY_TIME_FOB", $focus->delivery_time_fob);
$xtpl->assign("PIECES_PER_CARTON", $focus->pieces_per_carton);
$xtpl->assign("PRODUCT_NETTO_WEIGHT", $focus->product_netto_weight);
$xtpl->assign("PRODUCT_BRUTTO_WEIGHT", $focus->product_brutto_weight);
$xtpl->assign("PACKING_TYPE_ID", $focus->packing_type_id);
$xtpl->assign("PACKING_TYPE_NAME", $focus->packing_type_name);
$xtpl->assign("PACKING_DIMENSIONS_1", $focus->packing_dimensions_1);
$xtpl->assign("PACKING_DIMENSIONS_2", $focus->packing_dimensions_2);
$xtpl->assign("PACKING_DIMENSIONS_3", $focus->packing_dimensions_3);
$xtpl->assign("RMA", $focus->rma);
$xtpl->assign("CARTON_DIMENSIONS_1", $focus->carton_dimensions_1);
$xtpl->assign("CARTON_DIMENSIONS_2", $focus->carton_dimensions_2);
$xtpl->assign("CARTON_DIMENSIONS_3", $focus->carton_dimensions_3);
$xtpl->assign("CARTON_NETTO_WEIGHT", $focus->carton_netto_weight);
$xtpl->assign("CARTON_BRUTTO_WEIGHT", $focus->carton_brutto_weight);
$xtpl->assign("CARTON_VOLUME_METER", $focus->carton_volume_meter);
$xtpl->assign("CARTON_VOLUME_FEET", $focus->carton_volume_feet);
$xtpl->assign("COUNTRY_OF_ORIGIN", $focus->country_of_origin);
$xtpl->assign("EMS_ORDERED", $focus->ems_ordered);
$st='';
$w=$GLOBALS['db']->query("select id,name from ecmstocks where deleted='0' order by name asc");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$st.='<option value="'.$r['id'].'">'.$r['name'].'</option>';
}
$xtpl->assign("STOCK_INFO", $st);
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
if(isset($focus->exchange_rate_id) && !empty($focus->exchange_rate_id))
{
$currency->retrieve($focus->exchange_rate_id);
if( $currency->deleted != 1){
$xtpl->assign("CURRENCY", $currency->iso4217 .' '.$currency->symbol );
}else $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}else{
$xtpl->assign("CURRENCY", $currency->getDefaultISO4217() .' '.$currency->getDefaultCurrencySymbol() );
}
include("modules/EcmDocs/Pagination.php");
$xtpl->assign("PAGINATION1",getPagination("ecmproducts","EcmProducts",$_REQUEST['record']));
if ($focus->certificate_of_origin == '1') $xtpl->assign('CERTIFICATE_OF_ORIGIN', "checked");
if ($focus->form_a == '1') $xtpl->assign('FORM_A', "checked");
global $db;
$result = $GLOBALS['db']->query("select ean,remarks,short_description,long_description,language from ecmproduct_language where ecmproduct_id='".$_REQUEST['record']."'");
while($row=$GLOBALS['db']->fetchByAssoc($result))
{
$xtpl->assign("EAN_".$row['language'],$row['ean']);
$xtpl->assign("REMARKS_".$row['language'],$row['remarks']);
$xtpl->assign("SHORT_DESCRIPTION_".$row['language'],$row['short_description']);
$xtpl->assign("LONG_DESCRIPTION_".$row['language'],$row['long_description']);
}
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$_REQUEST['record']. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
$detailView->processListNavigation($xtpl, "ECMPRODUCTS", $offset, $focus->is_AuditEnabled());
// ADDING CUSTOM FIELDS:
require_once('modules/DynamicFields/templates/Files/DetailView.php');
if(!empty($focus->id)) {
$merge_button = <<<EOQ
<input title="{$app_strings['LBL_DUP_MERGE']}" accessKey="M" class="button" onclick="this.form.return_module.value='EcmProducts'; this.form.return_action.value='DetailView';this.form.return_id.value='{$focus->id}'; this.form.action.value='Step1'; this.form.module.value='MergeRecords';" type="submit" name="Merge" value=" {$app_strings['LBL_DUP_MERGE']} "/>
EOQ;
$xtpl->assign("FIND_DUPES_MERGE_BUTTON", $merge_button);
}
$xtpl->parse("main");
$xtpl->out("main");
$sub_xtpl = $xtpl;
$old_contents = ob_get_contents();
ob_end_clean();
ob_start();
echo $old_contents;
require_once('modules/SavedSearch/SavedSearch.php');
$savedSearch = new SavedSearch();
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmProducts')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, "EcmProducts");
echo $subpanel->display();
?>

View File

@@ -0,0 +1,20 @@
<?
require_once("config.php");
$sql1=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);
$sql2=mysql_connect("83.13.113.250","e5crm","e52005pkr");
mysql_select_db("e5crm");
$q=$GLOBALS['db']->query("select code,id from ecmproducts",$sql1);
while($r=$GLOBALS['db']->fetchByAssoc($q))
{
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select stan,cena,zamowione from stany where indeks='".$r['code']."'",$sql2));
$stan=$rr['stan'];
$cena=$rr['cena'];
$zamowione=$rr['zamowione'];
print "produkt: ".$r['code'].", stan: ".$stan.", cena: ".$cena.", zamowione: ".$zamowione;
if($GLOBALS['db']->query("update ecmproducts set ems_ordered='".$zamowione."',ems_price='".$cena."',ems_qty_in_stock='".$stan."' where code='".$r['code']."'",$sql1))print "zapisano<br>";
else print "nie zapisano<br>";
}
mysql_close($sql2);
mysql_close($sql1);
?>

1130
modules/EcmProducts/EcmProduct.php Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
<?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.
********************************************************************************/
require_once('include/EditView/QuickCreate.php');
require_once('modules/EcmProducts/EcmProduct.php');
require_once('include/javascript/javascript.php');
class EcmProductsQuickCreate extends QuickCreate {
var $javascript;
function process() {
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'EcmProducts');
parent::process();
//BUILDER:START dropdowns setup
//BUILDER:END dropdowns setup
if($this->viaAJAX) { // OVERRIDE FOR AJAX CALL
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmproductsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmproducts\"); else return false;'");
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmproducts\")';");
}
$this->ss->assign('viaAJAX', $this->viaAJAX);
$this->javascript = new javascript();
$this->javascript->setFormName('ecmproductsQuickCreate');
$focus = new EcmProduct();
$this->javascript->setSugarBean($focus);
$this->javascript->addAllFields('');
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
$json = getJSONobj();
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'ecmproductsQuickCreate',
'field_to_name_array' => array(
'id' => 'account_id',
'name' => 'account_name',
),
);
$encoded_popup_request_data = $json->encode($popup_request_data);
$this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);
}
}
?>

266
modules/EcmProducts/EditView.php Executable file
View File

@@ -0,0 +1,266 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings, $db;
$app_list_strings['ecmproducts_parent_dom'] = array (
'Accounts' => $app_list_strings['moduleList']['Accounts'],
'Leads' => $app_list_strings['moduleList']['Leads'],
);
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once('include/time.php');
require_once('include/json_config.php');
//add jquery
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-2.1.0.min.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])){
$focus->retrieve($_REQUEST['record']);
//if(isset($focus->id) && $focus->id != '')$focus->format_all_fields();
}
$json = getJSONobj();
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmProducts/views/EditView/view.edit.ecmproducts.php');
$edit = new ViewEditEcmProducts();
$edit->ss = new Sugar_Smarty();
$edit->bean = $focus;
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
$focus->simplemodule_number = "";
$edit->bean_id= "";
}
$edit->preDisplay();
$uunit='';
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$uunit.='<option value="'.$row['id'].'"';
if($focus->usage_unit_id==$row['id'])$uunit.=' selected';
$uunit.='>'.$row['name'].'</option>';
}
$edit->ss->assign("USAGE_UNIT_ID",$uunit);
$tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by value desc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$tax.='<option value="'.$row['id'].'"';
if($focus->vat_id==$row['id'])$tax.=' selected';
$tax.='>'.$row['name'].'</option>';
}
$edit->ss->assign("VAT_ID",$tax);
$fbas='';
$result = $db->query("select id,name from ecmproductbasis order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$fbas.='<option value="'.$row['id'].'"';
if($focus->fob_basis_id==$row['id'])$fbas.=' selected';
$fbas.='>'.$row['name'].'</option>';
}
$edit->ss->assign("FOB_BASIS_ID",$fbas);
$pack='';
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$pack.='<option value="'.$row['id'].'"';
if($focus->packing_type_id==$row['id'])$pack.=' selected';
$pack.='>'.$row['name'].'</option>';
}
$edit->ss->assign("PACKING_TYPE_ID",$pack);
//load currencies
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
$currency_list = $currency->get_full_list('name');
$currency->retrieve('-99');
if(is_array($currency_list))
{
$currency_list = array_merge(Array($currency), $currency_list);
}
else
{
$currency_list = Array($currency);
}
$arr = array();
foreach($currency_list as $key=>$value)
{
$arr[$value->id] = $value->name;
}
$edit->ss->assign("EXCHANGE_RATE_ID", get_select_options_with_id($arr, $focus->exchange_rate_id));
$arr=unserialize(base64_decode($focus->models));
$result = $GLOBALS['db']->query("select * from ecmproductmodels where deleted='0' and parent_id='".$focus->product_subcategory_id."'");
$sm='<div id="models_div"><select name="models[]" multiple id="models" sieze="6">';
while($row=$GLOBALS['db']->fetchByAssoc($result)){
$sm.='<option value="'.$row['id'].'"';
if(@in_array($row['id'],$arr))$sm.=' selected';
$sm.='>'.$row['name'].'</option>';
}
$sm.='</select></div>';
$edit->ss->assign("SM", $sm);
$result = $GLOBALS['db']->query("select * from ecmproduct_language where ecmproduct_id='".$_REQUEST['record']."'");
while($row=$GLOBALS['db']->fetchByAssoc($result))
{
$edit->ss->assign("EAN_".$row['language'],$row['ean']);
$edit->ss->assign("REMARKS_".$row['language'],$row['remarks']);
$edit->ss->assign("SHORT_DESCRIPTION_".$row['language'],$row['short_description']);
$edit->ss->assign("LONG_DESCRIPTION_".$row['language'],$row['long_description']);
$edit->ss->assign("PRICE_".$row['language'],number_format($row['price'],2,",","."));
}
$re=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean, ean2 from ecmproducts where id='".$_REQUEST['record']."'"));
$edit->ss->assign("EAN",$re['ean']);
$edit->ss->assign("EAN2",$re['ean2']);
$edit->ss->assign("CARTON_DIMENSIONS_1",number_format($focus->carton_dimensions_1,3,",","."));
$edit->ss->assign("CARTON_DIMENSIONS_2",number_format($focus->carton_dimensions_2,2,",","."));
$edit->ss->assign("CARTON_DIMENSIONS_3",number_format($focus->carton_dimensions_3,2,",","."));
$edit->ss->assign("PACKING_DIMENSIONS_1",number_format($focus->packing_dimensions_1,2,",","."));
$edit->ss->assign("PACKING_DIMENSIONS_2",number_format($focus->packing_dimensions_2,2,",","."));
$edit->ss->assign("PACKING_DIMENSIONS_3",number_format($focus->packing_dimensions_3,2,",","."));
$pl3 = $this->bean->getPositionList3();
global $current_user;
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$ac=json_decode($pl3,true);
$ac[0]['bean_id']="";
$ac[0]['id']="";
$pl3=json_encode($ac[0]);
$pl3='['.$pl3.']';
}
$edit->ss->assign('POSITION_LIST3', $pl3);
$pl4 = $this->bean->getPricesList();
$edit->ss->assign('POSITION_LIST4', $pl4);
if($focus->product_picture)$edit->ss->assign("PRODUCT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->packing_front_picture)$edit->ss->assign("PACKING_FRONT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->driver_1)$edit->ss->assign("DRIVER_1_UPLOAD",$mod_strings['LBL_UPLOADED']);
if($focus->driver_2)$edit->ss->assign("DRIVER_2_UPLOAD",$mod_strings['LBL_UPLOADED']);
//Added for Graduated Prices - Begin
/* require_once('modules/EcmProducts/EcmProductGraduatedPrices.php');
$epgp = new EcmProductGraduatedPrices($focus->graduated_prices);
$edit->ss->assign("PRODUCT_GRADUATED_PRICES_HTML", $epgp->getHtmlEdit());*/
//Added for Graduated Prices - End
//Added for Components
$edit->ss->assign("POSITION_LIST", $focus->getPositionList());
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::loadSettings();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
global $current_user;
$tmp = $current_user->getPreference('num_grp_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = "1";
$OPT['default_vat'] = "19.00";
$OPT['default_category'] = "";
$OPT['default_currency'] = "-99";
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$uunit='';
foreach($app_list_strings['ecmproducts_unit_dom'] as $key=>$value){
$uunit.='<option value="'.$key.'"';
if($focus->usage_unit_id==$key)$uunit.=' selected';
$uunit.='>'.$value.'</option>';
}
$OPT['ecmproduct_usage_units_options'] = $uunit;
//var_dump($focus->getPositionList());
$tmp = explode("_", $focus->code);
if (sizeof($tmp)>1) $OPT['base_code'] = $tmp[0];
$scriptOpt = '
<script language="javascript">
var VAT = '.str_replace('&quot;','\"',$json->encode($VAT)).';
var OPT = '.str_replace('&quot;','\"',$json->encode($OPT)).';
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
var N;
</script>';
echo $scriptOpt;
$edit->ss->assign("OPT", $OPT);
//Added for Components
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
echo $edit->display();
echo '<script language="javascript" src="modules/EcmProducts/helper.js"></script>';
//echo '<script language="javascript" src="modules/EcmProducts/mintajax.js"></script>';
// var sb=document.getElementById("product_subcategory_name");
// sb.onclick=function(){
// setTimeout(function(){mintajaxget("index.php?to_pdf=1&module=EcmProducts&action=getModelsBySubCategory&id="+document.getElementById("product_subcategory_id").value,"models_div");},1000);
// }
echo '<script language="javascript">
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest(\'POST\',where,{success:this.Display,failure:this.Fail},post);
}
function generateEAN(nr) {
if (document.getElementById(\'ean\').value != \'\') {
if (confirm("'.$mod_strings['LBL_EAN_EXISTS'].'")) {
doRequest(\'index.php\',\'module=EcmProducts&action=generateEAN&to_pdf=1&ean=\'+document.getElementById(\'ean\').value+\'&ean2=\'+document.getElementById(\'ean2\').value+\'&fromEdit=1\', function(result) {
document.getElementById(\'ean\').value = result;
});
document.getElementById(\'newEan\').value=\'1\'
}
} else {
doRequest(\'index.php\',\'module=EcmProducts&action=generateEAN&to_pdf=1&ean=\'+document.getElementById(\'ean\').value+\'&ean2=\'+document.getElementById(\'ean2\').value+\'&fromEdit=1\', function(result) {
document.getElementById(\'ean\').value = result;
});
document.getElementById(\'newEan\').value=\'1\'
}
}
function generateEAN2(nr) {
if (document.getElementById(\'ean2\').value != \'\') {
if (confirm("'.$mod_strings['LBL_EAN_EXISTS'].'")) {
doRequest(\'index.php\',\'module=EcmProducts&action=generateEAN&to_pdf=1&ean=\'+document.getElementById(\'ean\').value+\'&ean2=\'+document.getElementById(\'ean2\').value+\'&fromEdit=1\', function(result) {
document.getElementById(\'ean2\').value = result;
});
document.getElementById(\'newEan2\').value=\'1\' }
} else {
doRequest(\'index.php\',\'module=EcmProducts&action=generateEAN&to_pdf=1&ean=\'+document.getElementById(\'ean\').value+\'&ean2=\'+document.getElementById(\'ean2\').value+\'&fromEdit=1\', function(result) {
document.getElementById(\'ean2\').value = result;
});
document.getElementById(\'newEan2\').value=\'1\'
}
}
</script>';
?>

View File

@@ -0,0 +1,656 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script>
function select_lang(value)
{
document.getElementById('row0en').style.display="none";
document.getElementById('row0de').style.display="none";
document.getElementById('row0pl').style.display="none";
document.getElementById('row1en').style.display="none";
document.getElementById('row1de').style.display="none";
document.getElementById('row1pl').style.display="none";
document.getElementById('row2en').style.display="none";
document.getElementById('row2de').style.display="none";
document.getElementById('row2pl').style.display="none";
document.getElementById('row0'+value).style.display="table-row";
document.getElementById('row1'+value).style.display="table-row";
document.getElementById('row2'+value).style.display="table-row";
}
function gosave()
{
if(document.getElementById('index_id').value=='' || document.getElementById('index_id').value==document.getElementById('record').value)return true;
else
{
alert("Product Index duplicate - please choose other one");
return false;
}
}
</script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<form onSubmit="return gosave();" name="EditView" method="POST" enctype="multipart/form-data" action="index.php">
<input type="hidden" name="module" value="EcmProducts">
<input type="hidden" name="record" id="record" value="{ID}">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" name="contact_id" value="{CONTACT_ID}">
<input type="hidden" name="email_id" value="{EMAIL_ID}">
<input type="hidden" name="account_id" value="{ACCOUNT_ID}">
<input type="hidden" name="case_id" value="{CASE_ID}">
<!--// InboundEmail support //-->
<input type="hidden" name="inbound_email_id" value="{INBOUND_EMAIL_ID}">
<input type="hidden" name="start" value="{START}">
<input type="hidden" name="type" value="{TYPE}">
<td style="padding-bottom: 2px;">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button"
onclick="this.form.action.value='Save';return check_form('EditView');"
type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button"
onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'"
type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<p>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_PRODUCT_INFORMATION}</strong></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="dataLabel"><span sugar='slot1'>{MOD.LBL_NAME} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span></span sugar='slot'></td>
<td width="25%" class="dataField"><span sugar='slot1b'>
<input name='name' type="text" tabindex='1' maxlength='50' value="{NAME}" />
</span sugar='slot'></td>
<td class="dataLabel" ><span sugar='slot2'>{APP.LBL_ASSIGNED_TO}</span sugar='slot'></td>
<td class="dataField"> <span sugar='slot2b'>
<input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{ASSIGNED_USER_ID}" />
<input class="sqsEnabled" tabindex="2" autocomplete="off" id="assigned_user_name" name='assigned_user_name' type="text" value="{ASSIGNED_USER_NAME}">
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name=btn1
onclick='open_popup("Users", 600, 400, "", true, false, {encoded_users_popup_request_data});' />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot3'>{MOD.LBL_PRODUCT_INDEX}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot3b'>
<input type="hidden" id="index_id" name="index_id" /><input ondblclick="if(document.getElementById('index_id').value!=''){window.open('index.php?module=EcmProducts&action=DetailView&record='+document.getElementById('index_id').value,'Product','resizable=yes,scrollbars=yes,status=no,height=600,width=800').focus();}" class="sqsEnabled" autocomplete="off" name='code' id='code' title="Product index" type="text" tabindex='3' maxlength='40' value="{CODE}" />
</span sugar='slot'> </td>
<td class="dataLabel"><span sugar='slot15'>{MOD.LBL_PRODUCT_ACTIVE}</span sugar='slot'></td>
<td class="dataField"><span sugar='slot15b'>
<input id="product_active" title="Product active" type="checkbox" name="product_active" {PRODUCT_ACTIVE}/>
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot5'>{MOD.LBL_PRODUCT_CATEGORY}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot5b'>
<input id='product_category_id' name='product_category_id' type="hidden" value="{PRODUCT_CATEGORY_ID}" />
<input class="sqsEnabled" autocomplete="off" id='product_category' name='product_category' title="Product category" type="text" tabindex='5' maxlength='40' value="{PRODUCT_CATEGORY}" />
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup("EcmProductCategorys", 600, 400, "index.php?module=EcmProductCategorys&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_ecmproductcategorys_popup_request_data});' />
</span sugar='slot'> </td>
<td class="dataLabel"><span sugar='slot16'>{MOD.LBL_SALES_START_DATE} </span sugar='slot'></td>
<td class="dataField"><span sugar='slot16b'>
<input name='sales_start_date'
onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');"
id='jscal_fieldsales_start_date'
type="text"
title="Sales start date"
tabindex='16'
size='11'
maxlength='10'
value="{SALES_START_DATE}" />
<img src="themes/default/images/jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="jscal_triggersales_start_date" align="absmiddle" /> <span class="dateFormat">{USER_DATEFORMAT}</span>
<script>
Calendar.setup ({inputField : 'jscal_fieldsales_start_date', ifFormat : '{CALENDAR_DATEFORMAT}', showsTime : false, button : 'jscal_triggersales_start_date', singleClick : true, step : 1});addToValidate('EditView', 'sales_start_date', 'date', false,'sales_start_date' );
</script>
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot7'>{MOD.LBL_PRODUCT_LINE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot7b'>
<input id='product_line_id' name='product_line_id' type="hidden" value="{PRODUCT_LINE_ID}" />
<input class="sqsEnabled" autocomplete="off" id='product_line' name='product_line' title="Product line" type="text" tabindex='7' maxlength='40' value="{PRODUCT_LINE}" />
</span sugar='slot'> <input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup("EcmProductLines", 600, 400, "index.php?module=EcmProductLines&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_ecmproductlines_popup_request_data});' /></td>
<td class="dataLabel"><span sugar='slot17'>{MOD.LBL_SALES_END_DATE} </span sugar='slot'></td>
<td class="dataField"><span sugar='slot17b'>
<input name='sales_end_date'
onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');"
id='jscal_fieldsales_end_date'
type="text"
title="Sales end date"
tabindex='17'
size='11'
maxlength='10'
value="{SALES_END_DATE}" />
<img src="themes/default/images/jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="jscal_triggersales_end_date" align="absmiddle" /> <span class="dateFormat">{USER_DATEFORMAT}</span>
<script>
Calendar.setup ({inputField : 'jscal_fieldsales_end_date', ifFormat : '{CALENDAR_DATEFORMAT}', showsTime : false, button : 'jscal_triggersales_end_date', singleClick : true, step : 1});addToValidate('EditView', 'sales_end_date', 'date', false,'sales_end_date' );
</script>
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot9'>{MOD.LBL_MANUFACTURER}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot9b'>
<input id='manufacturer_id' name='manufacturer_id' type="hidden" value="{MANUFACTURER_ID}" />
<input class="sqsEnabled" autocomplete="off" id='manufacturer' name='manufacturer' title="Manufacturer" type="text" tabindex='9' maxlength='40' value="{MANUFACTURER}" />
</span sugar='slot'> <input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup("EcmProductManufacturers", 600, 400, "index.php?module=EcmProductManufacturers&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_ecmproductmanufacturers_popup_request_data});' /></td>
<td valign="top" class="dataLabel"><select name="parent_type" id="parent_type">
{PARENT_TYPE}
</select></td>
<td valign="top" class="dataField"><span sugar='slot20b'>
<input name='parent_id' type="hidden" value="{PARENT_ID}" />
<input name='parent_name' title="Parent name" type="text" tabindex='20' maxlength='50' value="{PARENT_NAME}" />
</span sugar='slot'>
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup(document.getElementById("parent_type").value, 600, 400, "index.php?module="+document.getElementById("parent_type").value+"&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_parent_popup_request_data});' /></td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot11'>{MOD.LBL_CONTACT_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot11b'>
<input id='contact_id' name='contact_id' type="hidden" value="{CONTACT_ID}" />
<input class="sqsEnabled" autocomplete="off" id='contact_name' name='contact_name' title="Contact name" type="text" tabindex='11' maxlength='40' value="{CONTACT_NAME}" />
</span sugar='slot'> <input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup("Contacts", 600, 400, "index.php?module=Contacts&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_contacts_popup_request_data});' /></td>
<td valign="top" class="dataLabel"><span sugar='slot21'>{MOD.LBL_WEBSITE}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot21b'>
<input name='website' title="Website" type="text" tabindex='21' maxlength='255' value="{WEBSITE}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot13'>{MOD.LBL_VENDOR_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot13b'>
<input id='vendor_id' name='vendor_id' type="hidden" value="{VENDOR_ID}" />
<input class="sqsEnabled" id='vendor_name' name='vendor_name' title="Vendor name" type="text" tabindex='13' maxlength='40' value="{VENDOR_NAME}" />
</span sugar='slot'> <input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1"
onclick='open_popup("EcmVendors", 600, 400, "index.php?module=EcmVendors&action=Popup&mode=single&create=true&metadata=undefined", true, false, {encoded_ecmvendors_popup_request_data});' /></td>
<td valign="top" class="dataLabel"><span sugar='slot22'>{MOD.LBL_PART_NO}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot22b'>
<input name='part_no' title="Part no" type="text" tabindex='22' maxlength='200' value="{PART_NO}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot14'>{MOD.LBL_VENDOR_PART_NO}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot14b'>
<input name='vendor_part_no' title="Vendor part no" type="text" tabindex='14' maxlength='200' value="{VENDOR_PART_NO}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot23'>{MOD.LBL_SERIAL_NO}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot23b'>
<input name='serial_no' title="Serial no" type="text" tabindex='23' maxlength='200' value="{SERIAL_NO}" />
</span sugar='slot'> </td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_PRICING_INFORMATION}</strong></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel">&nbsp;</td>
<td width="25%" valign="top" class="dataField">&nbsp;</td>
<td width="25%" valign="top" class="dataLabel">&nbsp;</td>
<td width="25%" valign="top" class="dataField">&nbsp;</td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot25'>{MOD.LBL_EXCHANGE_RATE_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot25b'>
<select name="exchange_rate_id" id="exchange_rate_id">
{EXCHANGE_RATE_ID}
</select>
</span sugar='slot'></td>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot30'>{MOD.LBL_CUSTOM_DUTY_RATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot30b'>
<input name='custom_duty_rate' title="Custom duty rate" tabindex='30' maxlength='25' type="text" value="{CUSTOM_DUTY_RATE}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot26'>{MOD.LBL_FOB_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot26b'>
<input name='fob_price' title="FOB price" tabindex='26' maxlength='25' type="text" value="{FOB_PRICE}" />
</span sugar='slot'> </td>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot31'>{MOD.LBL_SRP_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot31b'>
<input name='srp_price' title="SRP price" tabindex='31' maxlength='25' type="text" value="{SRP_PRICE}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot27'>{MOD.LBL_UNIT_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot27b'>
<input name='purchase_price' title="Purchase price" tabindex='27' maxlength='25' type="text" value="{PURCHASE_PRICE}" />
</span sugar='slot'> </td>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot32'>{MOD.LBL_SRP_PROMO_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot32b'>
<input name='srp_promo_price' title="SRP promo price" tabindex='32' maxlength='25' type="text" value="{SRP_PROMO_PRICE}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot28'>{MOD.LBL_EMS_PRICE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot28b'>
<input name='ems_price' title="EMS price" tabindex='28' maxlength='25' type="text" value="{EMS_PRICE}" />
</span sugar='slot'> </td>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot34'>{MOD.LBL_TAX_CLASS_NAME}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot34b'>
<select id='vat_id' name='vat_id'>
{VAT_ID}
</select>
</span sugar='slot'></td>
</tr>
<tr>
<td width="25%" valign="top" class="dataLabel"><span sugar='slot29'>{MOD.LBL_COMMISSION_RATE}</span sugar='slot'></td>
<td width="25%" valign="top" class="dataField"><span sugar='slot29b'>
<input name='commission_rate' title="Commission rate" tabindex='29' maxlength='25' type="text" value="{COMMISSION_RATE}" />
</span sugar='slot'> </td>
<td width="25%"><span class="dataLabel"><span sugar='slot34'>{MOD.LBL_SELLING_PRICE}</span sugar='slot'></span></td>
<td width="25%"><span class="dataField"><span sugar='slot27b'>
<input name='selling_price' title="Selling price" tabindex='27' maxlength='25' type="text" value="{SELLING_PRICE}" />
</span sugar='slot'></span></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_STOCK_INFORMATION}</strong></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot36'>{MOD.LBL_USAGE_UNIT_NAME}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot36b'>
<select id='usage_unit_id' name='usage_unit_id'>
{USAGE_UNIT_ID}
</select>
</span sugar='slot'></td>
<td valign="top" class="dataLabel"><span sugar='slot41'>{MOD.LBL_QTY_PER_UNIT}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot41b'>
<input name='qty_per_unit' title="Qty per unit" tabindex='41' maxlength='25' type="text" value="{QTY_PER_UNIT}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot36'>{MOD.LBL_QTY_IN_STOCK}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot37b'>
<input name='qty_in_stock' readonly title="Qty in stock" type="text" tabindex='37' maxlength='40' value="{QTY_IN_STOCK}" />
</span sugar='slot'> </td>
<td class="dataLabel"><span sugar='slot36'>{MOD.LBL_REORDER_LEVEL}</span sugar='slot'></td>
<td class="dataField"><input name='reorder_level' title="Reorder level" type="text" tabindex='37' maxlength='40' value="{REORDER_LEVEL}" /></td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot37'>{MOD.LBL_EMS_QTY_IN_STOCK}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot37b'>
<input name='ems_qty_in_stock' readonly title="EMS qty in stock" type="text" tabindex='37' maxlength='40' value="{EMS_QTY_IN_STOCK}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot36'>{MOD.LBL_QTY_IN_DEMAND}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot37b'>
<input name='qty_in_demand' title="Qty in demand" type="text" tabindex='37' maxlength='40' value="{QTY_IN_DEMAND}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td class="dataLabel"><span sugar='slot37'>{MOD.LBL_EMS_ORDERED}</span sugar='slot'></td>
<td class="dataField"><span sugar='slot37b'>
<input name='ems_ordered' type="text" readonly tabindex='37' maxlength='40' value="{EMS_ORDERED}" />
</span sugar='slot'></td>
<td valign="top" class="dataLabel"><span sugar='slot42'>{MOD.LBL_AVERAGE_SALE_3_MONTHS}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot42b'>
<input name='average_sale_3_months' title="Average sale 3 months" tabindex='42' maxlength='25' type="text" value="{AVERAGE_SALE_3_MONTHS}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot38'>{MOD.LBL_SALES_LAST_MONTH_1}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot38b'>
<input name='sales_last_month_1' title="Sales last month -1" tabindex='38' maxlength='25' type="text" value="{SALES_LAST_MONTH_1}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot43'>{MOD.LBL_SALES_PLUS_1}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot43b'>
<input name='sales_plus_1' title="Sales plus 1" tabindex='43' maxlength='25' type="text" value="{SALES_PLUS_1}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot39'>{MOD.LBL_SALES_LAST_MONTH}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot39b'>
<input name='sales_last_month' title="Sales last month" tabindex='39' maxlength='25' type="text" value="{SALES_LAST_MONTH}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot44'>{MOD.LBL_SALES_PLUS_2}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot44b'>
<input name='sales_plus_2' title="Sales plus 2" tabindex='44' maxlength='25' type="text" value="{SALES_PLUS_2}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot40'>{MOD.LBL_SALES_THIS_MONTH}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot40b'>
<input name='sales_this_month' title="Sales this month" tabindex='40' maxlength='25' type="text" value="{SALES_THIS_MONTH}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot45'>{MOD.LBL_SALES_PLUS_3}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot45b'>
<input name='sales_plus_3' title="Sales plus 3" tabindex='45' maxlength='25' type="text" value="{SALES_PLUS_3}" />
</span sugar='slot'> </td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_DRIVERS_IMAGES}</strong></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot46'>{MOD.LBL_PRODUCT_PICTURE}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot46b'>
<input name='product_picture' title="Product picture" type="file" tabindex='46' maxlength='255' value="{PRODUCT_PICTURE}" />
{PRODUCT_PICTURE_UPLOAD} </span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot47'>{MOD.LBL_PACKING_FRONT_PICTURE}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot47b'>
<input name='packing_front_picture' title="Packing front picture" type="file" tabindex='47' maxlength='255' value="{PACKING_FRONT_PICTURE}" />
</span sugar='slot'> {PACKING_FRONT_PICTURE_UPLOAD}</td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot48'>{MOD.LBL_DRIVER_1}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot48b'>
<input name='driver_1' title="Driver 1" type="file" tabindex='48' maxlength='255' value="{DRIVER_1}" />
{DRIVER_1_UPLOAD}
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot49'>{MOD.LBL_DRIVER_2}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot49b'>
<input name='driver_2' title="Driver 2" type="file" tabindex='49' maxlength='255' value="{DRIVER_2}" />
</span sugar='slot'> {DRIVER_2_UPLOAD}</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_LOGISTIC_INFORMATION}</strong></td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
<td width="25%" class="dataLabel">&nbsp;</td>
<td width="25%" class="dataField">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot50'>{MOD.LBL_MOQ}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot50b'>
<input name='moq' title="MOQ" tabindex='50' maxlength='25' type="text" value="{MOQ}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot63'>{MOD.LBL_CARTON_DIMENSIONS_1}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot63b'>
<input name='carton_dimensions_1' title="Carton dimensions (m)" tabindex='63' size='3' maxlength='25' type="text" value="{CARTON_DIMENSIONS_1}" />
</span sugar='slot'> x
<input name='carton_dimensions_2' title="Carton dimensions (m)" tabindex='64' size='3' maxlength='25' type="text" value="{CARTON_DIMENSIONS_2}" />
x
<input name='carton_dimensions_3' title="Carton dimensions (m)" tabindex='65' size='3' maxlength='25' type="text" value="{CARTON_DIMENSIONS_3}" /></td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot52'>{MOD.LBL_FOB_BASIS_NAME}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot52b'>
<select id='fob_basis_id' name='fob_basis_id'>
{FOB_BASIS_ID}
</select></span sugar='slot'></td>
<td valign="top" class="dataLabel"><span sugar='slot66'>{MOD.LBL_CARTON_NETTO_WEIGHT}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot66b'>
<input name='carton_netto_weight' title="Carton netto weight" tabindex='66' maxlength='25' type="text" value="{CARTON_NETTO_WEIGHT}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot53'>{MOD.LBL_DELIVERY_TIME_FOB}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot53b'>
<input name='delivery_time_fob' title="Delivery time FOB" tabindex='53' maxlength='25' type="text" value="{DELIVERY_TIME_FOB}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot67'>{MOD.LBL_CARTON_BRUTTO_WEIGHT}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot67b'>
<input name='carton_brutto_weight' title="Carton brutto weight" tabindex='67' maxlength='25' type="text" value="{CARTON_BRUTTO_WEIGHT}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot54'>{MOD.LBL_PIECES_PER_CARTON}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot54b'>
<input name='pieces_per_carton' title="Pieces per carton" tabindex='54' maxlength='25' type="text" value="{PIECES_PER_CARTON}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot68'>{MOD.LBL_CARTON_VOLUME_METER}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot68b'>
<input name='carton_volume_meter' title="Carton volume (cubic meter)" tabindex='68' maxlength='25' type="text" value="{CARTON_VOLUME_METER}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot55'>{MOD.LBL_PRODUCT_NETTO_WEIGHT}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot55b'>
<input name='product_netto_weight' title="Product netto weight (kg)" tabindex='55' maxlength='25' type="text" value="{PRODUCT_NETTO_WEIGHT}" />
</span sugar='slot'> </td>
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot56'>{MOD.LBL_PRODUCT_BRUTTO_WEIGHT}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot56b'>
<input name='product_brutto_weight' title="Product brutto weight (kg)" tabindex='56' maxlength='25' type="text" value="{PRODUCT_BRUTTO_WEIGHT}" />
</span sugar='slot'> </td>
<td valign="top" class="dataLabel"><span sugar='slot70'>{MOD.LBL_COUNTRY_OF_ORIGIN}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot70b'>
<input name='country_of_origin' title="Country of origin" type="text" tabindex='70' maxlength='255' value="{COUNTRY_OF_ORIGIN}" />
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot58'>{MOD.LBL_PACKING_TYPE_NAME}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot58b'>
<select id='packing_type_id' name='packing_type_id'>
{PACKING_TYPE_ID}
</select>
</span sugar='slot'></td>
<td class="dataLabel"><span sugar='slot71'>{MOD.LBL_CERTIFICATE_OF_ORIGIN}</span sugar='slot'></td>
<td class="dataField"><span sugar='slot71b'>
<input id="certificate_of_origin" title="Certificate of origin" type="checkbox" title="{CERTIFICATE_OF_ORIGIN_HELP}" name="certificate_of_origin" {CERTIFICATE_OF_ORIGIN}/>
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot59'>{MOD.LBL_PACKING_DIMENSIONS_1}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot59b'>
<input name='packing_dimensions_1' title="Packing dimensions (cm)" tabindex='59' size='3' maxlength='25' type="text" value="{PACKING_DIMENSIONS_1}" />
</span sugar='slot'> x
<input name='packing_dimensions_2' title="Packing dimensions (cm)" tabindex='60' size='3' maxlength='25' type="text" value="{PACKING_DIMENSIONS_2}" />
x
<input name='carton_dimensions_32' title="Carton dimensions (m)" tabindex='65' size='3' maxlength='25' type="text" value="{CARTON_DIMENSIONS_3}" /></td>
<td class="dataLabel"><span sugar='slot72'>{MOD.LBL_FORM_A}</span sugar='slot'></td>
<td class="dataField"><span sugar='slot72b'>
<input id="form_a" title="Form A" type="checkbox" title="{FORM_A_HELP}" name="form_a" {FORM_A}/>
</span sugar='slot'> </td>
</tr>
<tr>
<td valign="top" class="dataLabel"><span sugar='slot62'>{MOD.LBL_RMA}</span sugar='slot'></td>
<td valign="top" class="dataField"><span sugar='slot62b'>
<input name='rma' title="RMA (%)" tabindex='62' maxlength='25' type="text" value="{RMA}" />
</span sugar='slot'> </td>
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><strong>{MOD.LBL_LOCALIZED_INFORMATION}</strong></td>
<td width="25%">
<select name="slang" id="slang" onchange="select_lang(this.value);">
<option value="pl">pl</option>
<option value="en">en</option>
<option value="de">de</option>
</select>
</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr id="row0en" style="display:none;">
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
</tr>
<tr id="row1en" style="display:none;">
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</span></td>
<td valign="top" class="dataField"><input name="ean_en" type="text" id="ean_en" value="{EAN_en}" /></td>
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_REMARKS}</span></td>
<td valign="top" class="dataField"><input name="remarks_en" type="text" id="remarks_en" value="{REMARKS_en}" /></td>
</tr>
<tr id="row2en" style="display:none;">
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="short_description_en" rows="5" id="short_description_en">{SHORT_DESCRIPTION_en}</textarea></td>
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="long_description_en" rows="5" id="long_description_en">{LONG_DESCRIPTION_en}</textarea></td>
</tr>
<tr id="row0de" style="display:none;">
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
</tr>
<tr id="row1de" style="display:none;">
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</span></td>
<td valign="top" class="dataField"><input name="ean_de" type="text" id="ean_de" value="{EAN_de}" /></td>
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_REMARKS}</span></td>
<td valign="top" class="dataField"><input name="remarks_de" type="text" id="remarks_de" value="{REMARKS_de}" /></td>
</tr>
<tr id="row2de" style="display:none;">
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="short_description_de" rows="5" id="short_description_de">{SHORT_DESCRIPTION_de}</textarea></td>
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="long_description_de" rows="5" id="long_description_de">{LONG_DESCRIPTION_de}</textarea></td>
</tr>
<tr id="row0pl" style="display:table-row;">
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
<td class="dataLabel">&nbsp;</td>
<td class="dataField">&nbsp;</td>
</tr>
<tr id="row1pl" style="display:table-row;">
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LOCAL_EAN}</span></td>
<td valign="top" class="dataField"><input name="ean_pl" type="text" id="ean_pl" value="{EAN_pl}" /></td>
<td valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_REMARKS}</span></td>
<td valign="top" class="dataField"><input name="remarks_pl" type="text" id="remarks_pl" value="{REMARKS_pl}" /></td>
</tr>
<tr id="row2pl" style="display:table-row;">
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_SHORT_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="short_description_pl" rows="5" id="short_description_pl">{SHORT_DESCRIPTION_pl}</textarea></td>
<td width="25%" valign="top" class="dataLabel"><span class="tabDetailViewDL">{MOD.LBL_LONG_DESCRIPTION}</span></td>
<td width="25%" valign="top" class="dataField"><textarea name="long_description_pl" rows="5" id="long_description_pl">{LONG_DESCRIPTION_pl}</textarea></td>
</tr>
</table>
</td>
</tr>
</table>
</p>
<div style="padding-top: 2px">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save';return check_form('EditView');" type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</div>
</form>
{JAVASCRIPT}
<!-- END: main -->

831
modules/EcmProducts/EditView1.php Executable file
View File

@@ -0,0 +1,831 @@
<?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.
********************************************************************************/
include("modules/EcmProducts/moduleMenu.php");
// INCLUDE SUPPPORT MODULES
require_once('XTemplate/xtpl.php');
require_once('data/Tracker.php');
// INCLUDE MODULE OBJECT AND FORMS
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
global $app_strings;
global $mod_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config;
global $db;
// INSTANTIATES THE MODULE CLASSES
$focus = new EcmProduct();
// IF PROCESSING AN EXISTING RECORD, RETRIEVE IT
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
$focus->format_all_fields();
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
$focus->simplemodule_number = "";
}
$prefillArray = array(
'priority' => 'priority',
'name' => 'name',
'description' => 'description',
'status' => 'status',
'type' => 'type',
);
foreach($prefillArray as $requestKey => $focusVar) {
if (isset($_REQUEST[$requestKey]) && is_null($focus->$focusVar)) {
$focus->$focusVar = urldecode($_REQUEST[$requestKey]);
}
}
// BUILD MODULE TITLE LINE
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'].": ".$focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once ($theme_path.'layout_utils.php');
$GLOBALS['log']->info("EcmProducts detail view");
// ASSIGN XTEMPLATE
$xtpl = new XTemplate ('modules/EcmProducts/EditView.html');
// FILL XTEMPLATE MODULE & APPLICATION LANGUAGE STRINGS
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action'])) $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
if (empty($_REQUEST['return_id'])) {
$xtpl->assign("RETURN_ACTION", 'index');
}
///////////////////////////////////////
// SETUP POPUPS START
// Users Popup
$json = getJSONobj();
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'assigned_user_id',
'user_name' => 'assigned_user_name',
),
);
$xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'product_category_id',
'name' => 'product_category',
),
);
$xtpl->assign('encoded_ecmproductcategories_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'product_line_id',
'name' => 'product_line',
),
);
$xtpl->assign('encoded_ecmproductlines_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'exchange_rate_id',
'name' => 'exchange_rate_name',
),
);
$xtpl->assign('encoded_ecmproductexchangerates_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'vat_id',
'name' => 'vat_name',
),
);
$xtpl->assign('encoded_ecmvats_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'usage_unit_id',
'name' => 'usage_unit_name',
),
);
$xtpl->assign('encoded_ecmproductusageunits_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'manufacturer_id',
'name' => 'manufacturer',
),
);
$xtpl->assign('encoded_ecmproductmanufacturers_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'fob_basis_id',
'name' => 'fob_basis_name',
),
);
$xtpl->assign('encoded_ecmproductbasis_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'packing_type_id',
'name' => 'packing_type_name',
),
);
$xtpl->assign('encoded_ecmproductpackingtypes_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'contact_id',
'name' => 'contact_name',
),
);
$xtpl->assign('encoded_contacts_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'parent_id',
'name' => 'parent_name',
),
);
$xtpl->assign('encoded_parent_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'vendor_id',
'name' => 'vendor_name',
),
);
$xtpl->assign('encoded_ecmvendors_popup_request_data', $json->encode($popup_request_data));
//
////////////////////////////////////////////////////////////////////////////////
// ACCOUNT_ID WILL BE SET WHEN USER CHOOSES TO CREATE A NEW SIMPLEMODULE FROM ACCOUNT DETAIL VIEW.
if (isset($_REQUEST['account_id'])) $xtpl->assign("ACCOUNT_ID", $_REQUEST['account_id']);
if (isset($_REQUEST['contact_id'])) $xtpl->assign("CONTACT_ID", $_REQUEST['contact_id']);
// SET THE CASE_ID, IF SET.
// WITH NEW CONCEPT OF SUBPANELS IT,
// WHEN THE SUBPANEL IS DISPLAYED IT PULLS FROM THE CLASS NAME WHICH IN THE SITUATION OF CASES IS ACASE SO THE FORM IS GENERATED
// WITH ACASE_ID INSTEAD OF CASE_ID, SO I HAVE DONE THE MAPPING HERE
if (isset($_REQUEST['acase_id'])) $xtpl->assign("CASE_ID",$_REQUEST['acase_id']);
else if(isset($_REQUEST['case_id'])) $xtpl->assign("CASE_ID",$_REQUEST['case_id']);
////////////////////////////////////////////////////////////////////////////////
// QUICK SEARCH SETUP
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$sqs_objects = array(
'assigned_user_name' => $qsd->getQSUser(),
'product_category' => array(
'method' => 'query',
'modules' => array('EcmProductCategories'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('product_category', 'product_category_id'),
'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'product_line' => array(
'method' => 'query',
'modules' => array('EcmProductLines'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('product_line', 'product_line_id'),
'conditions' => array(array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'exchange_rate_name' => array(
'method' => 'query',
'modules' => array('EcmProductExchangeRates'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('exchange_rate_name', 'exchange_rate_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'vat_name' => array(
'method' => 'query',
'modules' => array('EcmVats'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('vat_name', 'vat_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'manufacturer' => array(
'method' => 'query',
'modules' => array('EcmProductManufacturers'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('manufacturer', 'manufacturer_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'fob_basis_name' => array(
'method' => 'query',
'modules' => array('EcmProductBasis'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('fob_basis_name', 'fob_basis_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'packing_type_name' => array(
'method' => 'query',
'modules' => array('EcmProductPackingTypes'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('packing_type_name', 'packing_type_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'contact_name' => array(
'method' => 'query',
'modules' => array('Contacts'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('contact_name', 'contact_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'vendor_name' => array(
'method' => 'query',
'modules' => array('EcmVendors'),
'group' => 'or',
'field_list' => array('name', 'id'),
'populate_list' => array('vendor_name', 'vendor_id'),
'conditions' => array(
array('name'=>'name','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'name',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
'product_index' => array(
'method' => 'query',
'modules' => array('EcmProducts'),
'group' => 'or',
'field_list' => array('product_index', 'id'),
'populate_list' => array('product_index', 'index_id'),
'conditions' => array(
array('name'=>'product_index','op'=>'like_custom','end'=>'%','value'=>'')
),
'order' => 'product_index',
'limit' => '30',
'no_match_text' => $app_strings['ERR_SQS_NO_MATCH']
),
);
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
// QUICK SEARCH SETUP
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// ASSIGN GLOBAL VARIABLES
$ptype='<option value="Accounts"';
if($focus->parent_type=="Accounts")$ptype.=" selected";
$ptype.='>Accounts</option><option value="Leads"';
if($focus->parent_type=="Leads")$ptype.=" selected";
$ptype.='>Leads</option>';
$focus->parent_type=$ptype;
$uunit='';
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$uunit.='<option value="'.$row['id'].'"';
if($focus->usage_unit_id==$row['id'])$uunit.=' selected';
$uunit.='>'.$row['name'].'</option>';
}
$focus->usage_unit_id=$uunit;
$tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$tax.='<option value="'.$row['id'].'"';
if($focus->vat_id==$row['id'])$tax.=' selected';
$tax.='>'.$row['name'].'</option>';
}
$focus->vat_id=$tax;
$fbas='';
$result = $db->query("select id,name from ecmproductbasis order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$fbas.='<option value="'.$row['id'].'"';
if($focus->fob_basis_id==$row['id'])$fbas.=' selected';
$fbas.='>'.$row['name'].'</option>';
}
$focus->fob_basis_id=$fbas;
$pack='';
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$pack.='<option value="'.$row['id'].'"';
if($focus->packing_type_id==$row['id'])$pack.=' selected';
$pack.='>'.$row['name'].'</option>';
}
$focus->packing_type_id=$pack;
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$xtpl->assign("JAVASCRIPT", get_set_focus_js().get_validate_record_js(). $quicksearch_js);
$xtpl->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
// ASSIGN GLOBAL VARIABLES
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// ASSIGN MODULE DEFAULT VARIABLES
$xtpl->assign("ID", $focus->id);
if (!empty($focus->name))
$xtpl->assign("NAME", $focus->name);
else $xtpl->assign("NAME", "");
$xtpl->assign("DATE_ENTERED", $focus->date_entered);
$xtpl->assign("DATE_MODIFIED", $focus->date_modified);
$xtpl->assign("CREATED_BY", $focus->created_by_name);
$xtpl->assign("MODIFIED_BY", $focus->modified_by_name);
if (empty($focus->assigned_user_id) && empty($focus->id)) $focus->assigned_user_id = $current_user->id;
if (empty($focus->assigned_name) && empty($focus->id)) $focus->assigned_user_name = $current_user->user_name;
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id );
// ASSIGN MODULE SPECIFIC VARIABLES
$xtpl->assign("PARENT_TYPE",$ptype);
$xtpl->assign("CODE", $focus->code);
$xtpl->assign("PRODUCT_CATEGORY_ID", $focus->product_category_id);
$xtpl->assign("PRODUCT_CATEGORY", $focus->product_category);
$xtpl->assign("PRODUCT_LINE_ID", $focus->product_line_id);
$xtpl->assign("PRODUCT_LINE", $focus->product_line);
$xtpl->assign("MANUFACTURER_ID", $focus->manufacturer_id);
$xtpl->assign("MANUFACTURER", $focus->manufacturer);
$xtpl->assign("CONTACT_ID", $focus->contact_id);
$xtpl->assign("CONTACT_NAME", $focus->contact_name);
$xtpl->assign("VENDOR_ID", $focus->vendor_id);
$xtpl->assign("VENDOR_NAME", $focus->vendor_name);
$xtpl->assign("VENDOR_PART_NO", $focus->vendor_part_no);
if (!empty($_REQUEST['product_active'])) {
$xtpl->assign("PRODUCT_ACTIVE", "checked");
}
if ($focus->product_active == '1') $xtpl->assign("PRODUCT_ACTIVE", "checked");
$xtpl->assign("SALES_START_DATE", $focus->sales_start_date);
$xtpl->assign("SALES_END_DATE", $focus->sales_end_date);
$xtpl->assign("PARENT_TYPE", $focus->parent_type);
$xtpl->assign("PARENT_ID", $focus->parent_id);
$xtpl->assign("PARENT_NAME", $focus->parent_name);
$xtpl->assign("WEBSITE", $focus->website);
$xtpl->assign("PART_NO", $focus->part_no);
$xtpl->assign("SERIAL_NO", $focus->serial_no);
$xtpl->assign("EXCHANGE_RATE_ID", $focus->exchange_rate_id);
$xtpl->assign("EXCHANGE_RATE_NAME", $focus->exchange_rate_name);
$xtpl->assign("FOB_PRICE", $focus->fob_price);
$xtpl->assign("PURCHASE_PRICE", $focus->purchase_price);
$xtpl->assign("SELLING_PRICE", $focus->selling_price);
$xtpl->assign("EMS_ORDERED", $focus->ems_ordered);
$xtpl->assign("EMS_PRICE", $focus->ems_price);
$xtpl->assign("COMMISSION_RATE", $focus->commission_rate);
$xtpl->assign("CUSTOM_DUTY_RATE", $focus->custom_duty_rate);
$xtpl->assign("SRP_PRICE", $focus->srp_price);
$xtpl->assign("SRP_PROMO_PRICE", $focus->srp_promo_price);
$xtpl->assign("VAT_ID", $focus->vat_id);
$xtpl->assign("TAX_CLASS_NAME", $focus->tax_class_name);
$xtpl->assign("USAGE_UNIT_ID", $focus->usage_unit_id);
$xtpl->assign("USAGE_UNIT_NAME", $focus->usage_unit_name);
$xtpl->assign("QTY_IN_STOCK", $focus->qty_in_stock);
$xtpl->assign("QTY_IN_DEMAND", $focus->qty_in_demand);
$xtpl->assign("EMS_QTY_IN_STOCK", $focus->ems_qty_in_stock);
$xtpl->assign("REORDER_LEVEL", $focus->reorder_level);
$xtpl->assign("SALES_LAST_MONTH_1", $focus->sales_last_month_1);
$xtpl->assign("SALES_LAST_MONTH", $focus->sales_last_month);
$xtpl->assign("SALES_THIS_MONTH", $focus->sales_this_month);
$xtpl->assign("QTY_PER_UNIT", $focus->qty_per_unit);
$xtpl->assign("AVERAGE_SALE_3_MONTHS", $focus->average_sale_3_months);
$xtpl->assign("SALES_PLUS_1", $focus->sales_plus_1);
$xtpl->assign("SALES_PLUS_2", $focus->sales_plus_2);
$xtpl->assign("SALES_PLUS_3", $focus->sales_plus_3);
$xtpl->assign("PRODUCT_PICTURE", $focus->product_picture);
if($focus->product_picture)$xtpl->assign("PRODUCT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
$xtpl->assign("PACKING_FRONT_PICTURE", $focus->packing_front_picture);
if($focus->packing_front_picture)$xtpl->assign("PACKING_FRONT_PICTURE_UPLOAD",$mod_strings['LBL_UPLOADED']);
$xtpl->assign("DRIVER_1", $focus->driver_1);
if($focus->driver_1)$xtpl->assign("DRIVER_1_UPLOAD",$mod_strings['LBL_UPLOADED']);
$xtpl->assign("DRIVER_2", $focus->driver_2);
if($focus->driver_2)$xtpl->assign("DRIVER_2_UPLOAD",$mod_strings['LBL_UPLOADED']);
$xtpl->assign("MOQ", $focus->moq);
$xtpl->assign("FOB_BASIS_ID", $focus->fob_basis_id);
$xtpl->assign("FOB_BASIS_NAME", $focus->fob_basis_name);
$xtpl->assign("DELIVERY_TIME_FOB", $focus->delivery_time_fob);
$xtpl->assign("PIECES_PER_CARTON", $focus->pieces_per_carton);
$xtpl->assign("PRODUCT_NETTO_WEIGHT", $focus->product_netto_weight);
$xtpl->assign("PRODUCT_BRUTTO_WEIGHT", $focus->product_brutto_weight);
$xtpl->assign("PACKING_TYPE_ID", $focus->packing_type_id);
$xtpl->assign("PACKING_TYPE_NAME", $focus->packing_type_name);
$xtpl->assign("PACKING_DIMENSIONS_1", $focus->packing_dimensions_1);
$xtpl->assign("PACKING_DIMENSIONS_2", $focus->packing_dimensions_2);
$xtpl->assign("PACKING_DIMENSIONS_3", $focus->packing_dimensions_3);
$xtpl->assign("RMA", $focus->rma);
$xtpl->assign("CARTON_DIMENSIONS_1", $focus->carton_dimensions_1);
$xtpl->assign("CARTON_DIMENSIONS_2", $focus->carton_dimensions_2);
$xtpl->assign("CARTON_DIMENSIONS_3", $focus->carton_dimensions_3);
$xtpl->assign("CARTON_NETTO_WEIGHT", $focus->carton_netto_weight);
$xtpl->assign("CARTON_BRUTTO_WEIGHT", $focus->carton_brutto_weight);
$xtpl->assign("CARTON_VOLUME_METER", $focus->carton_volume_meter);
$xtpl->assign("CARTON_VOLUME_FEET", $focus->carton_volume_feet);
$xtpl->assign("COUNTRY_OF_ORIGIN", $focus->country_of_origin);
if (!empty($_REQUEST['certificate_of_origin'])) {
$xtpl->assign("CERTIFICATE_OF_ORIGIN", "checked");
}
$xtpl->assign("TAX_CLASS_ID",get_select_options_with_id($app_list_strings['ecmproducts_vat_dom'], $focus->vat_id));
//load currencies
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
$currency_list = $currency->get_full_list('name');
$currency->retrieve('-99');
if(is_array($currency_list))
{
$currency_list = array_merge(Array($currency), $currency_list);
}
else
{
$currency_list = Array($currency);
}
$arr = array();
foreach($currency_list as $key=>$value)
{
$arr[$value->id] = $value->name;
}
$xtpl->assign("EXCHANGE_RATE_ID", get_select_options_with_id($arr, $focus->exchange_rate_id));
if ($focus->certificate_of_origin == '1') $xtpl->assign("CERTIFICATE_OF_ORIGIN", "checked");
if (!empty($_REQUEST['form_a'])) {
$xtpl->assign("FORM_A", "checked");
}
if ($focus->form_a == '1') $xtpl->assign("FORM_A", "checked");
// ASSIGN MODULE DROPDOWNS WITH DEFAULT KEY
// ASSIGN MODULE VARIABLES AFFECTED BY DUPLICATE ACTION
if(!isset($_REQUEST['isDuplicate'])) {
$focus->id = "";
}
$result = $db->query("select ean,remarks,short_description,long_description,language from ecmproduct_language where ecmproduct_id='".$_REQUEST['record']."'");
while(($row=$db->fetchByAssoc($result))!=null)
{
$xtpl->assign("EAN_".strtolower($row['language']),$row['ean']);
$xtpl->assign("REMARKS_".strtolower($row['language']),$row['remarks']);
$xtpl->assign("SHORT_DESCRIPTION_".strtolower($row['language']),$row['short_description']);
$xtpl->assign("LONG_DESCRIPTION_".strtolower($row['language']),$row['long_description']);
}
// ASSIGN MODULE DROPDOWNS WITHOUT DEFAULT KEY
//BUILDER:END of xtpl
// ADD CUSTOM FIELDS
require_once('modules/DynamicFields/templates/Files/EditView.php');
////////////////////////////////////////////////////////////////////////////////
// USER ASSIGNMENT
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$record = '';
// USER ASSIGNMENT
////////////////////////////////////////////////////////////////////////////////
if(!empty($_REQUEST['record'])){
$record = $_REQUEST['record'];
}
$xtpl->assign("ADMIN_EDIT","<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
$xtpl->parse("main");
$xtpl->out("main");
require_once('include/javascript/javascript.php');
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
//BUILDER:START Pro only
// $javascript->addFieldGeneric( 'team_name', 'varchar', $app_strings['LBL_TEAM'] ,'true');
// $javascript->addToValidateBinaryDependency('team_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_TEAM'], 'false', '', 'team_id');
//BUILDER:END Pro only
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();
////////////////////////////////////////////////////////////////////////////////
/// SELECT CHANGES TEXT INPUT FIELD
/*
$prob_array = $json->encode($app_list_strings['sales_probability_dom']);
$prePopProb = '';
if(empty($focus->id)) $prePopProb = 'document.getElementsByName(\'sales_stage\')[0].onchange();';
echo <<<EOQ
<script>
prob_array = $prob_array;
document.getElementsByName('sales_stage')[0].onchange = function() {
if(typeof(document.getElementsByName('sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('sales_stage')[0].value]) {
document.getElementsByName('probability')[0].value = prob_array[document.getElementsByName('sales_stage')[0].value];
}
};
$prePopProb
</script>
EOQ;
*/
//
/// SELECT CHANGES TEXT INPUT FIELD
////////////////////////////////////////////////////////////////////////////////
require_once('modules/SavedSearch/SavedSearch.php');
$savedSearch = new SavedSearch();
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmProducts')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
?>

111
modules/EcmProducts/Forms.php Executable file
View File

@@ -0,0 +1,111 @@
<?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.
********************************************************************************/
/*******************************************************************************
* CREATE JAVASCRIPT TO VALIDATE THE DATA ENTERED INTO A RECORD.
*******************************************************************************/
function get_validate_record_js () {
}
/*******************************************************************************
* CREATE FORM FOR MENU RAPID CREATE
*******************************************************************************/
function get_new_record_form () {
if(!ACLController::checkAccess('EcmProducts', 'edit', true)){
return '';
}
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $theme;
global $current_user;
$lbl_subject = $mod_strings['LBL_SUBJECT'];
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
$user_id = $current_user->id;
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
$the_form .= <<<EOQ
<form name="EcmProductSave" onSubmit="return check_form('EcmProductsSave')" method="POST" action="index.php">
<input type="hidden" name="module" value="EcmProducts">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value='${user_id}'>
<input type="hidden" name="action" value="Save">
${lbl_subject}&nbsp;<span class="required">${lbl_required_symbol}</span><br>
<p><input name='name' type="text" size='20' maxlength="255"value=""><br>
</p>
<p>
<input title="${lbl_save_button_title}" accessKey="${lbl_save_button_key}" class="button" type="submit" name="button" value=" ${lbl_save_button_label} " >
</p>
</form>
EOQ;
require_once('include/javascript/javascript.php');
require_once('modules/EcmProducts/EcmProduct.php');
$javascript = new javascript();
$javascript->setFormName('EcmProductsSave}');
$javascript->setSugarBean(new EcmProduct());
$javascript->addRequiredFields('');
$the_form .= $javascript->getScript();
$the_form .= get_left_form_footer();
return $the_form;
}
?>

View File

@@ -0,0 +1,41 @@
<?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/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
else {
}
require_once('include/MVC/View/SugarView.php');
if(file_exists('modules/EcmProducts/views/view.list.php')) {
require_once('modules/EcmProducts/views/view.list.php');
$list = new EcmProductsViewList();
}
else {
require_once('include/MVC/View/views/view.list.php');
$list = new ViewList();
}
$list->bean = $focus;
// if(!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true") require_once('modules/EcmGroupSales/HeaderMenu.php');
$list->preDisplay();
$list->display();
?>

View File

@@ -0,0 +1,140 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<script language="javascript">
function check_all_prod(){
var pl=document.getElementById("list_prod");
var ch=pl.getElementsByTagName("input");
for(var i=0;i<ch.length;i++){
if(ch[i].type=="checkbox"){
ch[i].checked=true;
}
}
}
</script>
<form name="AddToPriceBook" method="post" action="index.php">
<input type="hidden" name="to_pdf" value="1">
<input type="hidden" name="module" value="EcmPriceBooks">
<input type="hidden" name="action" value="AddToPriceBook">
<input class="button" type="submit" value="Update"><br><br>
<div id="list_prod">
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20">
<td scope="col" width="1%" class="listViewThS1" NOWRAP><input type="checkbox" name="check_all" onclick="check_all_prod();"/></td>
<td scope="col" width="32%" class="listViewThS1" NOWRAP><slot><a href="{ORDER_BY}name" class="listViewThLinkS1">{MOD.LBL_LIST_NAME}{arrow_start}{name_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}code" class="listViewThLinkS1">{MOD.LBL_LIST_CODE}{arrow_start}{code_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}commission_rate" class="listViewThLinkS1">{MOD.LBL_LIST_COMMISSION_RATE}{arrow_start}{commission_rate_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}qty_per_unit" class="listViewThLinkS1">{MOD.LBL_LIST_QTY_PER_UNIT}{arrow_start}{qty_per_unit_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}purchase_price" class="listViewThLinkS1">{MOD.LBL_LIST_UNIT_PRICE}{arrow_start}{purchase_price_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" NOWRAP><slot><a href="{ORDER_BY}users.user_name" class="listViewThLinkS1">{APP.LBL_LIST_ASSIGNED_USER}{arrow_start}{users_user_name_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="1%" class="listViewThS1" NOWRAP><slot>&nbsp;</slot></td>
<td scope="col" width="1%" class="listViewThS1" NOWRAP><slot>&nbsp;</slot></td>
<td scope="col" width="1%" class="listViewThS1" NOWRAP><slot>&nbsp;</slot></td>
<td scope="col" width="1%" class="listViewThS1" NOWRAP><slot>&nbsp;</slot></td>
<td scope="col" width="1%" class="listViewThS1" NOWRAP><slot>&nbsp;</slot></td>
</tr>
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{ECMPRODUCT.NAME}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{ECMPRODUCT.NAME}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{ECMPRODUCT.NAME}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td scope='row' valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}"><input type="hidden" name="product_id[]" value="{ECMPRODUCT.ID}"><input onclick="getPrice('{ECMPRODUCT.ID}','up');ShowHideBlock('price_block2_{ECMPRODUCT.ID}');ShowHideBlock('price_block3_{ECMPRODUCT.ID}');" type="checkbox" name="check[]" value="{ECMPRODUCT.ID}"></td>
<td scope='row' valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">
<slot>
<{TAG.MAIN} href="{URL_PREFIX}index.php?action=DetailView&module=EcmProducts&record={ECMPRODUCT.ID}&offset={ECMPRODUCT.OFFSET}&stamp={ECMPRODUCT.STAMP}" class="listViewTdLinkS1">{ECMPRODUCT.NAME}</{TAG.MAIN}> </slot> </td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.CODE}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.COMMISSION_RATE}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.QTY_PER_UNIT}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>PLN: {ECMPRODUCT.PURCHASE_PRICE}</slot></td>
<!-- BEGIN: pro -->
<!-- END: pro -->
<!-- BEGIN: open_source -->
<!-- END: open_source -->
<td valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap><slot>{ECMPRODUCT.ASSIGNED_USER_NAME}</slot></td>
<td valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap>
<div id="price_block1_{ECMPRODUCT.ID}" style="display:none;">
<input onchange="getPrice('{ECMPRODUCT.ID}','down');" onclick="getPrice('{ECMPRODUCT.ID}','up');" name="purchase_price_{ECMPRODUCT.ID}" type="hidden" id="purchase_price_{ECMPRODUCT.ID}" value="{ECMPRODUCT.PURCHASE_PRICE}" size="5" />
</div>
<td>
<div id="price_block2_{ECMPRODUCT.ID}" style="display:none;">
<input onchange="getPrice('{ECMPRODUCT.ID}','down');" onclick="getPrice('{ECMPRODUCT.ID}','up');" name="margin_rate_{ECMPRODUCT.ID}" type="text" id="margin_rate_{ECMPRODUCT.ID}" value="20" size="2" />
</td>
<td>
<div id="price_block3_{ECMPRODUCT.ID}" style="display:none;">
<input onchange="getPrice('{ECMPRODUCT.ID}','down');" onclick="getPrice('{ECMPRODUCT.ID}','up');" name="list_price_{ECMPRODUCT.ID}" type="text" id="list_price_{ECMPRODUCT.ID}" value="" size="6" />
<script>getPrice('{ECMPRODUCT.ID}','up');</script>
</div>
</td>
<td valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap><a href="index.php?module=EcmProducts&action=EditView&record={ECMPRODUCT.ID}"><img src="themes/Sugar/images/edit_inline.gif" border="0" title="Edit"/></a></td>
<!--<td valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap><a href="#" onclick="if(confirm('Are You sure?')){location.href='index.php?module=EcmProducts&action=Delete&record={ECMPRODUCT.ID};'}"><img src="themes/Sugar/images/delete_inline.gif" border="0" title="Delete"/></a></td>-->
</tr>
<tr><td colspan="23" class="listViewHRS1"></td></tr>
<!-- END: row -->
{PAGINATION}
</table>
</div>
<script>
document.forms.search_form.action.value="ListViewAddToPriceBook";
</script>
<!-- END: main -->

View File

@@ -0,0 +1,39 @@
<?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/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
else {}
require_once('include/MVC/View/SugarView.php');
if(file_exists('modules/EcmProducts/views/view.list.php')) {
require_once('modules/EcmProducts/views/view.list.php');
$list = new EcmProductsViewList();
}
else {
require_once('include/MVC/View/views/view.list.php');
$list = new ViewList();
}
$list->bean = $focus;
// if(!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true") require_once('modules/EcmGroupSales/HeaderMenu.php');
$list->preDisplay();
$list->display();
?>

View File

@@ -0,0 +1,294 @@
<?php
/*****************************************************************************
* 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.
********************************************************************************/
if($_GET['end_of_line_advanced']==0 && $_GET['end_of_line_advanced']!="")$_GET['end_of_line_advanced']="no";
if($_GET['production_advanced']==0 && $_GET['production_advanced']!="")$_GET['production_advanced']="no";
if($_GET['flag_advanced']==0 && $_GET['flag_advanced']!="")$_GET['flag_advanced']="no";
if($_GET['end_of_line_basic']==0 && $_GET['end_of_line_basic']!="")$_GET['end_of_line_basic']="no";
if($_GET['production_basic']==0 && $_GET['production_basic']!="")$_GET['production_basic']="no";
if($_GET['flag_basic']==0 && $_GET['flag_basic']!="")$_GET['flag_basic']="no";
$_REQUEST['clear_query']=true;
$_GET['clear_query']=true;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select user_name from users where id='".$_SESSION['authenticated_user_id']."'"));
$user_name=$r['user_name'];
$arr_fields=array("name","code","product_category_name","product_category_id","flag","manufacturer_name","manufacturer_id","product_active","commission_rate","qty_per_unit","purchase_price","sales_start_date","sales_end_date","end_of_line","production");
/*if(!$_REQUEST['EcmProducts_ECMPRODUCT_offset'] && !$_REQUEST['EcmProducts_ECMPRODUCT_ORDER_BY']){
foreach($arr_fields as $a){
if($_REQUEST['searchFormTab']=="advanced_search")$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_advanced']=$_REQUEST[$a.'_advanced']=$_GET[$a.'_advanced'];
if($_REQUEST['searchFormTab']=="basic_search")$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_basic']=$_REQUEST[$a.'_basic']=$_GET[$a.'_basic'];
}
}
else{
foreach($arr_fields as $a){
if($_REQUEST['searchFormTab']=="advanced_search"){
$_REQUEST[$a.'_advanced']=$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_advanced'];
$_GET[$a.'_advanced']=$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_advanced'];
}
if($_REQUEST['searchFormTab']=="basic_search"){
$_REQUEST[$a.'_basic']=$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_basic'];
$_GET[$a.'_basic']=$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$a.'_basic'];
}
}
}*/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if($_REQUEST['pricebook_id'])$_SESSION['add_to_pricebook_id']=$_REQUEST['pricebook_id'];
require_once ('XTemplate/xtpl.php');
require_once ("data/Tracker.php");
require_once ('modules/EcmProducts/EcmProduct.php');
require_once ('themes/'.$theme.'/layout_utils.php');
require_once ('log4php/LoggerManager.php');
require_once('include/ListView/ListViewSmarty.php');
require_once('include/ListView/ListView.php');
require_once('modules/Currencies/Currency.php');
if(file_exists('custom/modules/EcmProducts/metadata/listviewdefs.php')){
require_once('custom/modules/EcmProducts/metadata/listviewdefs.php');
}
else{
require_once('modules/EcmProducts/metadata/listviewdefs.php');
}
require_once('modules/SavedSearch/SavedSearch.php');
require_once('include/SearchForm/SearchForm.php');
$header_text = '';
global $app_strings;
global $mod_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'EcmProducts');
global $urlPrefix;
global $currentModule;
global $theme;
global $current_user;
global $focus_list;
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$currentModule="EcmProducts";
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'], true);
echo "\n</p>\n";
if(!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true')$current_user->setPreference('ListViewDisplayColumns', array(), 0, $currentModule);
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', $currentModule);
$json = getJSONobj();
$seedEcmProduct = new EcmProduct();
$searchForm = new SearchForm('EcmProducts', $seedEcmProduct,"ListViewAddToPricebook");
$lv = new ListViewSmarty();
$displayColumns = array();
foreach($listViewDefs['EcmProducts'] as $col => $params) {
if(!empty($params['default']) && $params['default'])$displayColumns[$col] = $params;
}
$params = array('massupdate' => true);
$params['action']="ListViewAddToPriceBook";
if(!empty($_REQUEST['orderBy'])) {
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$lv->displayColumns = $displayColumns;
if (!isset($where)) $where = "";
require_once('modules/MySettings/StoreQuery.php');
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
}
else{
$storeQuery->saveFromRequest($currentModule);
}
if(isset($_REQUEST['query'])){
$current_user->setPreference('ListViewDisplayColumns', $displayColumns, 0, $currentModule);
$searchForm->populateFromRequest();
foreach($searchForm->searchFields as $k=>$v){
$searchForm->searchFields[$k]['value']=$_SESSION[$user_name."_PREFERENCES"]['global']['EcmProductsQ'][$k.'_advanced'];
}
$where_clauses = $searchForm->generateSearchWhere(true, "EcmProduct");
if (count($where_clauses) > 0 ){
foreach($where_clauses as $wh){
if(!eregi("ecmproducts.assigned_user_id",$wh) && !eregi("ecmproducts.product_category_name",$wh) && !eregi("ecmproducts.product_active",$wh) && !eregi("ecmproducts.end_of_line",$wh))$wwh[]=$wh;
}
$where_clauses=array();
$where_clauses=$wwh;
}
if(count($searchForm->searchFields['assigned_user_id']['value'])>0){
$w_clauses=array();
foreach($searchForm->searchFields['assigned_user_id']['value'] as $auid){
$w_clauses[]="ecmproducts.assigned_user_id='".$auid."'";
}
$where_clauses[]="(".implode(" or ",$w_clauses).")";
}
if($_REQUEST['searchFormTab']=="advanced_search"){
if($_GET['end_of_line_advanced']!="" && ($_GET['end_of_line_advanced']==1 || $_GET['end_of_line_advanced']=="no")){
if($_GET['end_of_line_advanced']=="no")$where_clauses[]="ecmproducts.end_of_line='0'";
else $where_clauses[]="ecmproducts.end_of_line='1'";
}
if($_GET['flag_advanced']!="" && ($_GET['flag_advanced']==1 || $_GET['flag_advanced']=="no")){
if($_GET['flag_advanced']=="no")$where_clauses[]="ecmproducts.flag='0'";
else $where_clauses[]="ecmproducts.flag='1'";
}
if($_GET['production_advanced']!="" && ($_GET['production_advanced']==1 || $_GET['production_advanced']=="no")){
if($_GET['production_advanced']=="no")$where_clauses[]="ecmproducts.production='0'";
else $where_clauses[]="ecmproducts.production='1'";
}
if($_GET['manufacturer_id_advanced'])$where_clauses[]="ecmproducts.manufacturer_id='".$_GET['manufacturer_id_advanced']."'";
if($_GET['product_category_id_advanced'])$where_clauses[]="ecmproducts.product_category_id='".$_GET['product_category_id_advanced']."'";
if($_GET['product_category_name_advanced'])$where_clauses[]="ecmproducts.product_category_name like '".$_GET['product_category_name_advanced']."%'";
if($_GET['product_active_advanced']==0 && $_GET['product_active_advanced']!="")$where_clauses[]="ecmproducts.product_active='0'";
if($_GET['product_active_advanced']==1 && $_GET['product_active_advanced']!="")$where_clauses[]="ecmproducts.product_active='1'";
if($_GET['code_advanced'])$where_clauses[]="ecmproducts.code like '%".$_GET['code_advanced']."%'";
if($_GET['name_advanced'])$where_clauses[]="ecmproducts.name like '%".$_GET['name_advanced']."%'";
}
if($_REQUEST['searchFormTab']=="basic_search"){
if($_GET['flag_basic']!="" && ($_GET['flag_basic']==1 || $_GET['flag_basic']=="no")){
if($_GET['flag_basic']=="no")$where_clauses[]="ecmproducts.flag='0'";
else $where_clauses[]="ecmproducts.flag='1'";
}
if($_GET['production_basic']!="" && ($_GET['production_basic']==1 || $_GET['production_basic']==0))$where_clauses[]="ecmproducts.production='".$_GET['production_basic']."'";
if($_GET['manufacturer_id_basic'])$where_clauses[]="ecmproducts.manufacturer_id='".$_GET['manufacturer_id_basic']."'";
if($_GET['product_category_id_basic'])$where_clauses[]="ecmproducts.product_category_id='".$_GET['product_category_id_basic']."'";
if($_GET['product_category_name_basic'])$where_clauses[]="ecmproducts.product_category_name like '".$_GET['product_category_name_basic']."%'";
if($_GET['product_active_basic']==0 && $_GET['product_active_basic']!="")$where_clauses[]="ecmproducts.product_active='0'";
if($_GET['product_active_basic']==1 && $_GET['product_active_basic']!="")$where_clauses[]="ecmproducts.product_active='1'";
if($_GET['code_basic'])$where_clauses[]="ecmproducts.code like '%".$_GET['code_basic']."%'";
if($_GET['name_basic'])$where_clauses[]="ecmproducts.name like '%".$_GET['name_basic']."%'";
}
if($_SESSION['add_to_pricebook_id']){
$w=$GLOBALS['db']->query("select ecmproduct_id from ecmpricebooks_ecmproducts where ecmpricebook_id='".$_SESSION['add_to_pricebook_id']."' and deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$where_clauses[]="ecmproducts.id!='".$r['ecmproduct_id']."'";
}
}
if (count($where_clauses) > 0 )$where = implode(' and ', $where_clauses);
$GLOBALS['log']->info("Here is the where clause for the list view: $where");
}
$searchForm->lv=$lv;
if(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
$searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', "advanced", $listViewDefs);
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$searchForm->displayAdvanced(true);
}
elseif(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'saved_views'){
$searchForm->displaySavedViews($listViewDefs, $lv);
}
else {
$searchForm->displayBasic(true);
}
}
//print_r($searchForm->searchFields);
echo $qsd->GetQSScripts();
$ListView = new ListView();
$ListView->show_mass_update = false;
$ListView->show_mass_update_form = false;
$ListView->multiSelect=false;
$ListView->show_export_button = false;
$ListView->show_delete_button = false;
$ListView->show_select_menu = false;
$ListView->initNewXTemplate('modules/EcmProducts/ListView1.html',$current_module_strings);
$ListView->setHeaderTitle($current_module_strings['LBL_LIST_FORM_TITLE']);
$ListView->setQuery($where, "", "ecmproducts.name asc", "ECMPRODUCT");
$ListView->processListView($seedEcmProduct, "main", "ECMPRODUCT");
$savedSearch = new SavedSearch();
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmProducts')));
$str = "<script>YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);</script>";
echo '<input type="hidden" name="pricebook_id" value="'.$_REQUEST['pricebook_id'].'">';
echo '</form>';
if(!$_REQUEST['searchFormTab'])$sft="basic_search";
else $sft=$_REQUEST['searchFormTab'];
echo '<script language="javascript">selectTabCSS(\'EcmProducts|'.$sft.'\');';echo '</script>';
echo '<script>setTimeout(function(){';
foreach($arr_fields as $v){
if($_REQUEST['searchFormTab']=="advanced_search"){
if(!in_array($v,array("end_of_line","product_active","flag","production")))echo 'if(document.getElementById("'.$v.'_advanced"))document.getElementById("'.$v.'_advanced").value="'.$_REQUEST[$v.'_advanced'].'";
';
elseif(in_array($v,array("end_of_line","product_active","flag","production")) && $_GET[$v.'_advanced']=="no")echo 'if(document.getElementById("'.$v.'_advanced"))document.getElementById("'.$v.'_advanced")[1].selected="1";
';
elseif(in_array($v,array("end_of_line","product_active","flag","production")) && $_REQUEST[$v.'_advanced']==1)echo 'if(document.getElementById("'.$v.'_advanced"))document.getElementById("'.$v.'_advanced")[2].selected="1";
';
//else echo 'if(document.getElementById("'.$v.'_advanced"))document.getElementById("'.$v.'_advanced").value="'.$_REQUEST[$v.'_advanced'].'";';
}
if($_REQUEST['searchFormTab']=="basic_search"){
if(!in_array($v,array("end_of_line","product_active","flag","production")))echo 'if(document.getElementById("'.$v.'_basic"))document.getElementById("'.$v.'_basic").value="'.$_REQUEST[$v.'_basic'].'";
';
if(in_array($v,array("end_of_line","product_active","flag","production")) && $_GET[$v.'_basic']=="no")echo 'if(document.getElementById("'.$v.'_basic"))document.getElementById("'.$v.'_basic")[1].selected="1";
';
if(in_array($v,array("end_of_line","product_active","flag","production")) && $_REQUEST[$v.'_basic']==1)echo 'if(document.getElementById("'.$v.'_basic"))document.getElementById("'.$v.'_basic")[2].selected="1";
';
//else echo 'if(document.getElementById("'.$v.'_basic"))document.getElementById("'.$v.'_basic").value="'.$_REQUEST[$v.'_basic'].'";';
}
}
echo '},1700);</script>';
echo $str;
?>

View File

@@ -0,0 +1,41 @@
<?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/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
else {
}
require_once('include/MVC/View/SugarView.php');
if(file_exists('modules/EcmProducts/views/view.list.pricebook.php')) {
require_once('modules/EcmProducts/views/view.list.pricebook.php');
$list = new EcmProductsViewList();
}
else {
require_once('include/MVC/View/views/view.list.php');
$list = new ViewList();
}
$list->bean = $focus;
// if(!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true") require_once('modules/EcmGroupSales/HeaderMenu.php');
$list->preDisplay();
$list->display();
?>

View File

@@ -0,0 +1,104 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<input type="submit" name="addtopricebook" class="button" value="Add to pricebook" onclick="this.form.action.value='AddToPriceBook';this.form.module.value='EcmPriceBooks';"/>
<br />
<br />
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20">
<td scope="col" width="1%" class="listViewThS1" NOWRAP>{CHECKALL}</td>
<td scope="col" width="32%" class="listViewThS1" NOWRAP><slot><a href="{ORDER_BY}name" class="listViewThLinkS1">Product name{arrow_start}{name_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}product_index" class="listViewThLinkS1">Product code{arrow_start}{product_index_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}commission_rate_index" class="listViewThLinkS1">Commission rate {arrow_start}{commission_rate_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}qty_per_unit_index" class="listViewThLinkS1">Qty per unit{arrow_start}{qty_per_unit_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" nowrap="nowrap"><slot><a href="{ORDER_BY}unit_price" class="listViewThLinkS1">Unit price {arrow_start}{unit_price_arrow}{arrow_end}</a></slot></td>
<td scope="col" width="9%" class="listViewThS1" NOWRAP><slot><a href="{ORDER_BY}users.user_name" class="listViewThLinkS1"></a></slot></td>
</tr>
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{ECMPRODUCT.NAME}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{ECMPRODUCT.NAME}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{ECMPRODUCT.NAME}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" valign='top'>{PREROW}</td>
<td scope='row' valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">
<slot>
<{TAG.MAIN} href="{URL_PREFIX}index.php?action=DetailView&module=EcmProducts&record={ECMPRODUCT.ID}&offset={ECMPRODUCT.OFFSET}&stamp={ECMPRODUCT.STAMP}" class="listViewTdLinkS1">{ECMPRODUCT.NAME}</{TAG.MAIN}> </slot> </td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.PRODUCT_INDEX}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.COMMISSION_RATE}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>{ECMPRODUCT.QTY_PER_UNIT}</slot></td>
<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap="nowrap"><slot>PLN: {ECMPRODUCT.UNIT_PRICE}</slot></td>
<!-- BEGIN: pro -->
<!-- END: pro -->
<!-- BEGIN: open_source -->
<!-- END: open_source -->
<td valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" nowrap><slot>
<div id="price_block_{ECMPRODUCT.ID}" style="display:block;">
<input name="unit_price_{ECMPRODUCT.ID}" type="text" id="unit_price_{ECMPRODUCT.ID}" value="{ECMPRODUCT.UNIT_PRICE}" size="2" onblur="getPrice('{ECMPRODUCT.ID}','down')" onchange="getPrice('{ECMPRODUCT.ID}','down')" onclick="getPrice('{ECMPRODUCT.ID}','down')" onkeydown="getPrice('{ECMPRODUCT.ID}','down')" />
<input name="margin_rate_{ECMPRODUCT.ID}" type="text" id="margin_rate_{ECMPRODUCT.ID}" value="20" size="2" onblur="getPrice('{ECMPRODUCT.ID}','down')" onchange="getPrice('{ECMPRODUCT.ID}','down')" onclick="getPrice('{ECMPRODUCT.ID}','down')" onkeydown="getPrice('{ECMPRODUCT.ID}','down')" />
<input name="list_price_{ECMPRODUCT.ID}" type="text" id="list_price_{ECMPRODUCT.ID}" value="" size="2" onblur="getPrice('{ECMPRODUCT.ID}','down')" onchange="getPrice('{ECMPRODUCT.ID}','down')" onclick="getPrice('{ECMPRODUCT.ID}','down')" onkeydown="getPrice('{ECMPRODUCT.ID}','down')" />
</slot><script>getPrice('{ECMPRODUCT.ID}','down');</script></div></td>
</tr>
<tr><td colspan="22" class="listViewHRS1"></td></tr>
<!-- END: row -->
{PAGINATION}
</table>
<!-- END: main -->

View File

@@ -0,0 +1,200 @@
<?php
/*****************************************************************************
* 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.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
include("modules/EcmProducts/moduleMenu.php");
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_TITLE'], true);
echo "\n</p>\n";
require_once ('XTemplate/xtpl.php');
require_once ("data/Tracker.php");
require_once ('modules/EcmProducts/EcmProduct.php');
require_once ('themes/'.$theme.'/layout_utils.php');
require_once ('log4php/LoggerManager.php');
require_once('include/ListView/ListViewSmarty.php');
require_once('include/ListView/ListView.php');
require_once('modules/Currencies/Currency.php');
if(file_exists('custom/modules/EcmProducts/metadata/listviewdefs.php')){
require_once('custom/modules/EcmProducts/metadata/listviewdefs.php');
}else{
require_once('modules/EcmProducts/metadata/listviewdefs.php');
}
require_once('modules/SavedSearch/SavedSearch.php');
require_once('include/SearchForm/SearchForm.php');
$header_text = '';
global $app_strings;
global $mod_strings;
global $app_list_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'EcmProducts');
global $urlPrefix;
global $currentModule;
global $theme;
global $current_user;
// FOCUS_LIST IS THE MEANS OF PASSING DATA TO A LISTVIEW.
global $focus_list;
// SETUP QUICKSEARCH
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
// CLEAR THE DISPLAY COLUMNS BACK TO DEFAULT WHEN CLEAR QUERY IS CALLED
if(!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true')
$current_user->setPreference('ListViewDisplayColumns', array(), 0, $currentModule);
$savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', $currentModule); // GET USER DEFINED DISPLAY COLUMNS
$json = getJSONobj();
$seedEcmProduct = new EcmProduct(); // SEED BEAN
$searchForm = new SearchForm('EcmProducts', $seedEcmProduct); // NEW SEARCHFORM INSTANCE
// SETUP LISTVIEW SMARTY
$lv = new ListViewSmarty();
$displayColumns = array();
// CHECK $_REQUEST IF NEW DISPLAY COLUMNS FROM POST
if (!empty($_REQUEST['displayColumns'])) {
foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if (!empty($listViewDefs['EcmProducts'][$col]))
$displayColumns[$col] = $listViewDefs['EcmProducts'][$col];
}
}elseif(!empty($savedDisplayColumns)) { // USE USER DEFINED DISPLAY COLUMNS FROM PREFERENCES
$displayColumns = $savedDisplayColumns;
}else { // USE COLUMNS DEFINED IN LISTVIEWDEFS FOR DEFAULT DISPLAY COLUMNS
foreach($listViewDefs['EcmProducts'] as $col => $params) {
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
}
$params = array('massupdate' => true); // SETUP LISTVIEWSMARTY PARAMS
if(!empty($_REQUEST['orderBy'])) { // ORDER BY COMING FROM $_REQUEST
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$lv->displayColumns = $displayColumns;
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) { // HANDLE AJAX REQUESTS FOR SEARCH FORMS ONLY
switch($_REQUEST['search_form_view']) {
case 'basic_search':
$searchForm->setup();
$searchForm->displayBasic(false);
break;
case 'advanced_search':
$searchForm->setup();
$searchForm->displayAdvanced(false);
break;
case 'saved_views':
echo $searchForm->displaySavedViews($listViewDefs, $lv, false);
break;
}
return;
}
// USE THE STORED QUERY IF THERE IS ONE
if (!isset($where)) $where = "";
require_once('modules/MySettings/StoreQuery.php');
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery($currentModule);
$storeQuery->populateRequest();
}else{
$storeQuery->saveFromGet($currentModule);
}
if(isset($_REQUEST['query'])){
// WE HAVE A QUERY
// FIRST SAVE COLUMNS
$current_user->setPreference('ListViewDisplayColumns', $displayColumns, 0, $currentModule);
$searchForm->populateFromRequest(); // GATHERS SEARCH FIELD INPUTS FROM $_REQUEST
$where_clauses = $searchForm->generateSearchWhere(true, "EcmProduct"); // BUILDS THE WHERE CLAUSE FROM SEARCH FIELD INPUTS
if (count($where_clauses) > 0 )$where = implode(' and ', $where_clauses);
$GLOBALS['log']->info("Here is the where clause for the list view: $where");
}
// START DISPLAY
// WHICH TAB OF SEARCH FORM TO DISPLAY
if(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
$searchForm->setup();
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$searchForm->displayAdvanced();
}elseif(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'saved_views'){
$searchForm->displaySavedViews($listViewDefs, $lv);
}else {
$searchForm->displayBasic();
}
}
echo $qsd->GetQSScripts();
/*
$lv->setup($seedEcmProduct, 'include/ListView/ListViewGeneric.tpl', $where, $params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
echo $lv->display();
*/
$ListView = new ListView();
$ListView->initNewXTemplate('modules/EcmProducts/ListViewForPriceBooks.html',$current_module_strings);
$ListView->setHeaderTitle($current_module_strings['LBL_LIST_FORM_TITLE']);
$ListView->setQuery($where, "", "name asc", "ECMPRODUCT");
$ListView->processListView($seedEcmProduct, "main", "ECMPRODUCT");
$_SESSION['pricebook_id']=$_REQUEST['pricebook_id'];
$savedSearch = new SavedSearch();
$json = getJSONobj();
// FILLS IN SAVED VIEWS SELECT BOX ON SHORTCUT MENU
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('EcmProducts')));
$str = "<script>
YAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, $savedSearchSelects);
</script>";
echo $str;
?>

68
modules/EcmProducts/Log.php Executable file
View File

@@ -0,0 +1,68 @@
<?php
$tds1='<td class="listViewThS1">';
$trs='<tr>';
$tre='</tr>';
$tds='<td class="oddListRowS1">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
$t.=$tbs;
$t.=$trs;
$t.=$tds1;
$t.="Product";
$t.=$tde;
$t.=$tds1;
$t.="Index";
$t.=$tde;
$t.=$tds1;
$t.="Time";
$t.=$tde;
$t.=$tds1;
$t.="Log";
$t.=$tde;
$t.=$tds1;
$t.="Send";
$t.=$tde;
$t.=$tre;
$z="select * from ecmproducts_log where sent is null order by date_entered desc limit 100";
$w=$GLOBALS['db']->query($z);
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,code from ecmproducts where id='".$r['ecmproduct_id']."'"));
if($r['type']=="images")$type="Please upload images";
elseif($r['type']=="images_and_description")$type="Please fill localized informations and upload images";
elseif($r['type']=="description")$type="Please fill localized informations";
else $type="All required informations added";
if($r['type']=="ok")$link='<a href="index.php?module=EcmProducts&action=SendXML&record='.$r['ecmproduct_id'].'">Send XML</a>';
else $link='';
$t.=$trs;
$t.=$tds;
$t.='<a href="index.php?module=EcmProducts&action=DetailView&record='.$r['ecmproduct_id'].'">'.$rr['name'].'</a>';
$t.=$tde;
$t.=$tds;
$t.=$rr['code'];
$t.=$tde;
$t.=$tds;
$t.=$r['date_entered'];
$t.=$tde;
$t.=$tds;
$t.=$type;
$t.=$tde;
$t.=$tds;
$t.=$link;
$t.=$tde;
$t.=$tre;
$i++;
}
$t.=$tbe;
echo $t;
?>

60
modules/EcmProducts/Menu.php Executable file
View File

@@ -0,0 +1,60 @@
<?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;
$module="EcmProducts";
if(ACLController::checkAccess($module, 'edit', true))$module_menu [] = Array("index.php?module=".$module."&action=EditView&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_NEW_'.strtoupper($module)],"Create".$module, $module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=index&return_module=".$module."&return_action=DetailView", $mod_strings['LNK_'.strtoupper($module).'_LIST'],$module, $module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=newListView", "Nowa lista produktów",$module, $module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=ean&return_module=".$module."&return_action=DetailView", "Index by EAN",$module, $module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=Log&return_module=".$module."&return_action=DetailView", "Log",$module, $module);
if(ACLController::checkAccess($module, 'list', true))$module_menu [] = Array("index.php?module=".$module."&action=stockAddress&return_module=".$module."&return_action=DetailView", "Adresy magazynowe",$module, $module);
?>

View File

@@ -0,0 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MenuMaker produced NavBar</title>
</head>
<body bgcolor="#ffffff" text="BLACK">
<script src="xaramenu.js"></script><script menumaker src="ecmproducts.js"></script>
</body></html>

View File

@@ -0,0 +1,98 @@
//<2F>Xara Ltd
if(typeof(loc)=="undefined"||loc==""){var loc="";if(document.body&&document.body.innerHTML){var tt=document.body.innerHTML;var ml=tt.match(/["']([^'"]*)ecmproducts.js["']/i);if(ml && ml.length > 1) loc=ml[1];}}
var bd=1
document.write("<style type=\"text/css\">");
document.write("\n<!--\n");
document.write(".ecmproducts_menu {z-index:999;border-color:#adc6d6;border-style:solid;border-width:"+bd+"px "+bd+"px "+bd+"px "+bd+"px;background-color:#f7f7f7;position:absolute;left:0px;top:0px;visibility:hidden;}");
document.write(".ecmproducts_plain, a.ecmproducts_plain:link, a.ecmproducts_plain:visited{text-align:left;background-color:#f7f7f7;color:#000000;text-decoration:none;border-color:#adc6d6;border-style:solid;border-width:"+bd+"px "+bd+"px "+bd+"px "+bd+"px;padding:2px 2px 2px 2px;cursor:hand;display:block;font-size:8pt;font-weight:bold;font-family:Arial, Helvetica, sans-serif;}");
document.write("a.ecmproducts_plain:hover, a.ecmproducts_plain:active{background-color:#adc6d6;color:#ffffff;text-decoration:bolder;border-color:#adc6d6;border-style:solid;border-width:"+bd+"px "+bd+"px "+bd+"px "+bd+"px;padding:2px 2px 2px 2px;cursor:hand;display:block;font-size:8pt;font-weight:bold;font-family:Arial, Helvetica, sans-serif;}");
document.write("a.ecmproducts_l:link, a.ecmproducts_l:visited{text-align:left;background:#f7f7f7 url("+loc+"ecmproducts_l.png) no-repeat right;color:#000000;text-decoration:none;border-color:#adc6d6;border-style:solid;border-width:"+bd+"px "+bd+"px "+bd+"px "+bd+"px;padding:2px 2px 2px 2px;cursor:hand;display:block;font-size:8pt;font-weight:bold;font-family:Arial, Helvetica, sans-serif;}");
document.write("a.ecmproducts_l:hover, a.ecmproducts_l:active{background:#adc6d6 url("+loc+"ecmproducts_l2.png) no-repeat right;color: #ffffff;text-decoration:none;border-color:#adc6d6;border-style:solid;border-width:"+bd+"px "+bd+"px "+bd+"px "+bd+"px;padding:2px 2px 2px 2px;cursor:hand;display:block;font-size:8pt;font-weight:bold;font-family:Arial, Helvetica, sans-serif;}");
document.write("\n-->\n");
document.write("</style>");
var fc=0x000000;
var bc=0xadc6d6;
if(typeof(frames)=="undefined"){var frames=0;}
startMainMenu("",0,0,2,0,0)
mainMenuItem("ecmproducts_b1",".png",23,117,loc+"../../../index.php?module=EcmProducts&action=index","","Products",2,2,"ecmproducts_plain");
mainMenuItem("ecmproducts_b2",".png",23,117,loc+"../../../index.php?module=EcmVendors&action=index","","Vendors",2,2,"ecmproducts_plain");
mainMenuItem("ecmproducts_b3",".png",23,117,loc+"../../../index.php?module=EcmPriceBooks&action=index","","Price Books",2,2,"ecmproducts_plain");
mainMenuItem("ecmproducts_b4",".png",23,117,loc+"../../../index.php?module=EcmProductCategorys&action=index","","Product Category",2,2,"ecmproducts_plain");
mainMenuItem("ecmproducts_b5",".png",23,117,loc+"../../../index.php?module=EcmProductExchangeRates&action=index","","Exchange Rate",2,2,"ecmproducts_plain");
mainMenuItem("ecmproducts_b6",".png",23,117,"javascript:;","","Additional Information",2,2,"ecmproducts_plain");
endMainMenu("",0,0);
startSubmenu("ecmproducts_b6_7","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmGlAccounts&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmGlAccounts&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_7");
startSubmenu("ecmproducts_b6_6","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductUsageUnits&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductUsageUnits&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_6");
startSubmenu("ecmproducts_b6_5","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductPackingTypes&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductPackingTypes&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_5");
startSubmenu("ecmproducts_b6_4","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductBasiss&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductBasis&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_4");
startSubmenu("ecmproducts_b6_3","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductLines&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductLines&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_3");
startSubmenu("ecmproducts_b6_2","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductTaxs&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductTaxs&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_2");
startSubmenu("ecmproducts_b6_1","ecmproducts_menu",44);
submenuItem("Create",loc+"../../../index.php?module=EcmProductManufacturers&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductManufacturers&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b6_1");
startSubmenu("ecmproducts_b6","ecmproducts_menu",117);
mainMenuItem("ecmproducts_b6_1","Manufacturers",0,0,loc+"../../../index.php?module=EcmProductManufacturers&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_2","Tax Rate",0,0,loc+"../../../index.php?module=EcmProductTaxs&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_3","Product Lines",0,0,loc+"../../../index.php?module=EcmProductLines&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_4","FOB Basis",0,0,loc+"../../../index.php?module=EcmProductBasis&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_5","Packing Type",0,0,loc+"../../../index.php?module=EcmProductPackingTypes&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_6","Usage Unit",0,0,loc+"../../../index.php?module=EcmProductUsageUnits&action=index","","",1,1,"ecmproducts_l");
mainMenuItem("ecmproducts_b6_7","GL Accounts",0,0,loc+"../../../index.php?module=EcmGlAccounts&action=index","","",1,1,"ecmproducts_l");
endSubmenu("ecmproducts_b6");
startSubmenu("ecmproducts_b5","ecmproducts_menu",117);
submenuItem("Create",loc+"../../../index.php?module=EcmProductExchangeRates&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductExchangeRates&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b5");
startSubmenu("ecmproducts_b4","ecmproducts_menu",117);
submenuItem("Create",loc+"../../../index.php?module=EcmProductCategorys&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProductCategorys&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b4");
startSubmenu("ecmproducts_b3","ecmproducts_menu",117);
submenuItem("Create",loc+"../../../index.php?module=EcmProducts&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProducts&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b3");
startSubmenu("ecmproducts_b2","ecmproducts_menu",117);
submenuItem("Create",loc+"../../../index.php?module=EcmVendors&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmVendors&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b2");
startSubmenu("ecmproducts_b1","ecmproducts_menu",117);
submenuItem("Create",loc+"../../../index.php?module=EcmProducts&action=EditView","","ecmproducts_plain");
submenuItem("List",loc+"../../../index.php?module=EcmProducts&action=index","","ecmproducts_plain");
endSubmenu("ecmproducts_b1");
loc="";

File diff suppressed because one or more lines are too long

122
modules/EcmProducts/Popup1.html Executable file
View File

@@ -0,0 +1,122 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<!-- BEGIN: SearchHeader -->
{SET_RETURN_JS}
<script type="text/javascript">
function toggleDisplay(id){
if(this.document.getElementById( id).style.display=='none'){
this.document.getElementById( id).style.display='inline'
if(this.document.getElementById(id+"link") != undefined){
this.document.getElementById(id+"link").style.display='none';
}
}else{
this.document.getElementById( id).style.display='none'
if(this.document.getElementById(id+"link") != undefined){
this.document.getElementById(id+"link").style.display='inline';
}
}
}
</script>
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="tabForm">
<tr>
<td>
<div id='divsearchform' style='display:inline'>
<form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="dataLabel" nowrap="nowrap" width="40%">{MOD.LBL_NAME}&nbsp;&nbsp;<input type="text" size="20" name="name" class="dataField" value="{NAME}" /></td>
<td width="10%" align="right">
<input type="hidden" name="action" value="Popup" />
<input type="hidden" name="query" value="true"/>
<input type="hidden" name="module" value="{MODULE_NAME}" />
<input type="hidden" name="parent_id" value="{parent_id}" />
<input type="hidden" name="parent_name" value="{parent_name}" />
<input type="submit" name="button" class="button"
title="{APP.LBL_SEARCH_BUTTON_TITLE}"
accesskey="{APP.LBL_SEARCH_BUTTON_KEY}"
value="{APP.LBL_SEARCH_BUTTON_LABEL}" />
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
<!-- END: SearchHeader -->
<!-- BEGIN: SearchHeaderEnd -->
<!-- END: SearchHeaderEnd -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="listView">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20">
<td scope="col" width="65%" class="listViewThS1"><a href="{ORDER_BY}name" class="listViewThLinkS1">{MOD.LBL_LIST_NAME}{arrow_start}{name_arrow}{arrow_end}</a>mmmmmmmm</td>
<td scope="col" width="35%" class="listViewThS1"><a href="{ORDER_BY}assigned_user_name" class="listViewThLinkS1">{MOD.LBL_LIST_ASSIGNED_USER_ID}{arrow_start}{assigned_user_name_arrow}{arrow_end}</a></td>
</tr>
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{ecmproducts.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout ="setPointer(this, '{ecmproducts.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{ecmproducts.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td scope='row' class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}"><a href="#" onclick="set_return('{.ID}', '{ecmproducts.NAME}'); window.close();" class="listViewTdLinkS1">{ecmproducts.NAME}</a></td>
<td class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{ecmproducts.ASSIGNED_USER_NAME}</td>
</tr>
<tr>
<td colspan="20" class="listViewHRS1"></td>
</tr>
<!-- END: row -->
</table>
<!-- END: main -->

57
modules/EcmProducts/Popup1.php Executable file
View File

@@ -0,0 +1,57 @@
<?php
/*****************************************************************************
* 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.
********************************************************************************/
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/Popup/Popup_picker.php');
$popup = new Popup_Picker();
echo $popup->process_page();
?>

View File

@@ -0,0 +1,162 @@
<?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 $theme;
require_once('modules/EcmProducts/EcmProduct.php');
require_once('themes/'.$theme.'/layout_utils.php');
require_once('log4php/LoggerManager.php');
require_once('XTemplate/xtpl.php');
require_once('include/ListView/ListView.php');
$image_path = 'themes/'.$theme.'/images/';
class Popup_Picker{
function Popup_Picker(){
;
}
function _get_where_clause(){
$where = '';
if(isset($_REQUEST['query'])){
$where_clauses = array();
append_where_clause($where_clauses, "name", "ecmproducts.name");
append_where_clause($where_clauses, "code", "ecmproducts.code");
append_where_clause($where_clauses, "product_category", "ecmproducts.product_category_id");
$where = generate_where_statement($where_clauses);
}
return $where;
}
function process_page(){
global $theme;
global $mod_strings;
global $app_strings;
global $currentModule;
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$image_path = 'themes/'.$theme.'/images/';
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$code = empty($_REQUEST['code']) ? '' : $_REQUEST['code'];
$product_category = empty($_REQUEST['product_category']) ? '' : $_REQUEST['product_category'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if(!$hide_clear_button){
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CLEAR_BUTTON_KEY'] ."' value=' "
.$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CANCEL_BUTTON_KEY'] ."' value=' "
.$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n";
$button .= "</form>\n";
$form = new XTemplate('modules/EcmProducts/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('NAME', $name);
$form->assign('request_data', $request_data);
$form->assign('CODE', $code);
$www=$GLOBALS['db']->query("select id,name from ecmproductcategories where deleted='0' order by name");
$pc='<option value="">select</option>';
while($r=$GLOBALS['db']->fetchByAssoc($www)){
$pc.='<option value="'.$r['id'].'"';
if($product_category==$r['id'])$pc.=' selected';
$pc.='>'.$r['name'].'</option>';
}
$form->assign('PRODUCT_CATEGORY', $pc);
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
$output_html .= get_form_footer();
// RESET THE SECTIONS THAT ARE ALREADY IN THE PAGE SO THAT THEY DO NOT PRINT AGAIN LATER.
$form->reset('main.SearchHeader');
// CREATE THE LISTVIEW
$seed_bean = new EcmProduct();
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'name', 'ECMPRODUCT');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'ECMPRODUCT');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
} // end of class Popup_Picker
?>

View File

@@ -0,0 +1,149 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<!-- BEGIN: SearchHeader -->
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/popup_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="tabForm">
<tr>
<td>
<form action="index.php" method="post" name="popup_query_form" id="the_form">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="dataLabel" nowrap="nowrap">{MOD.LBL_NAME}&nbsp;&nbsp;</td>
<td class="dataLabel" nowrap="nowrap"><input type="text" name="name" size="20" class="dataField" value="{NAME}" /></td>
<td class="dataLabel" nowrap="nowrap">{MOD.LBL_CODE}&nbsp;&nbsp; </td>
<td class="dataLabel" nowrap="nowrap"><input name="code" type="text" class="dataField" id="code" value="{CODE}" size="20" /></td>
<td width="20%" align="right">
<input type="hidden" name="module" value="{MODULE_NAME}" />
<input type="hidden" name="action" value="Popup" />
<input type="hidden" name="query" value="true" />
<input type="hidden" name="request_data" value="{request_data}" />
<input type="hidden" name="record_id" value="" />
<input type="hidden" name="mode" value="{MULTI_SELECT}" />
</td>
</tr>
<tr>
<td nowrap="nowrap" class="dataLabel">{MOD.LBL_PRODUCT_CATEGORY}&nbsp;&nbsp; </td>
<td nowrap="nowrap" class="dataLabel"><select name="product_category" id="select">
{PRODUCT_CATEGORY}
</select></td>
<td nowrap="nowrap" class="dataLabel">&nbsp;</td>
<td nowrap="nowrap" class="dataLabel">&nbsp;</td>
<td align="right"><input type="submit" name="button" class="button"
title="{APP.LBL_SEARCH_BUTTON_TITLE}"
accesskey="{APP.LBL_SEARCH_BUTTON_KEY}"
value="{APP.LBL_SEARCH_BUTTON_LABEL}" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
/* initialize the popup request from the parent */
if(window.document.forms['popup_query_form'].request_data.value == "")
{
window.document.forms['popup_query_form'].request_data.value
= JSON.stringify(window.opener.get_popup_request_data());
}
-->
</script>
<!-- END: SearchHeader -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="listView">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20" class="listViewThS1">
<td scope="col" width="5%" class="listViewThS1" NOWRAP>{CHECKALL}</td>
<td scope="col" width="15%" class="listViewThS1" NOWRAP>&nbsp;</td>
<td scope="col" width="15%" class="listViewThS1" NOWRAP>
<a href="{ORDER_BY}code" class="listViewThLinkS1">{MOD.LBL_CODE}{arrow_start}{code_arrow}{arrow_end}</a>
</td>
<td scope="col" width="35%" class="listViewThS1" NOWRAP>
<a href="{ORDER_BY}name" class="listViewThLinkS1">{MOD.LBL_NAME}{arrow_start}{name_arrow}{arrow_end}</a>
</td>
<td scope="col" width="35%" class="listViewThS1" NOWRAP>
<a href="{ORDER_BY}product_category" class="listViewThLinkS1">{MOD.LBL_PRODUCT_CATEGORY}{arrow_start}{product_category_arrow}{arrow_end}</a>
</td>
</tr>
<!-- BEGIN: row -->
<tr height="20"
onmouseover="setPointer(this, '{ECMPRODUCT.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{ECMPRODUCT.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{ECMPRODUCT.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}" valign='top'>{PREROW}</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{ECMPRODUCT.IMAGE}</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{ECMPRODUCT.CODE}</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">
<a href="#"
onclick="send_back('EcmProduct','{ECMPRODUCT.ID}');"
class="listViewTdLinkS1">{ECMPRODUCT.NAME}</a>
</td>
<td scope="row" valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{ECMPRODUCT.PRODUCT_CATEGORY}</td>
</tr>
<tr>
<td colspan="20" class="listViewHRS1"></td>
</tr>
<!-- END: row -->
</table>
{ASSOCIATED_JAVASCRIPT_DATA}
<!-- END: main -->

View File

@@ -0,0 +1,146 @@
//categories
function saveItems4(){
document.getElementById('position_list4').value = ItemsList4(true);
}
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
var tbody_;
var ItemListSave4;
var ItemListClear4;
var ItemListFil4;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable4 = new paramsMT('itemsTable4');
paramsTable4.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
refreshPositionIndex = function() {
for(var i=0; i<paramsTable4.rowCount(); i++) {
var data = paramsTable4.row(i).getData();
data.position = i+1;
paramsTable4.row(i).setData(data);
}
}
paramsTable4.onCreateCell = function(cell) {
var i = cell.index;
if(i == 0) {
cell.setData = function(data) {
if(data.pricebook_name) {
cell.firstChild.value = data.pricebook_name;
cell.getElementsByTagName('input')[1].value = data.pricebook_id;
}
};
cell.getData = function(data) {
data.ecmpricebook_name = cell.firstChild.value;
data.ecmpricebook_id = cell.getElementsByTagName('input')[1].value;
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if(i == 1) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.price = UserFormatNumberToNumber(cn[0].value);
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
cn[0].value = ((data.price)?NumberToUserFormatNumber(data.price):NumberToUserFormatNumber(0));
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.price = data.price;
this.setData(data);
}
}
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
}
}
ItemsList4 = function(json) {
var data = '';
for(var i=0; i<paramsTable4.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable4.row(i).getData());
}
return data;
}
//if(paramsTable4.rowCount() == 0) {paramsTable4.addRow();};
paramsTable4.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListFill4 = function() {
var pl;
pl = document.getElementById('position_list4').value;
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x];if (pl_row.pricebook_name=='') continue; paramsTable4.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
}
ItemListClear4 = function(noNew,save) {
if(typeof(save)=="string") ItemListSave4(null,save);
while(paramsTable4.rowCount()>0) paramsTable4.row(0).deleteRow(noNew);
}
ItemListClear4();
ItemListFill4();
}
);

View File

@@ -0,0 +1,237 @@
<?php
switch ($_REQUEST ['job']) {
case 'searchComponents' :
searchComponents ( $_REQUEST ['searchText'] );
break;
case 'getItemsComponents' :
getItemsComponents ( $_REQUEST ['prod_id'] );
break;
case 'saveItemsComponents' :
saveItemsComponents ( $_REQUEST ['items'], $_REQUEST ['prod_id'] );
break;
case 'searchActions' :
searchActions ( $_REQUEST ['searchText'] );
break;
case 'getItemsActions' :
getItemsActions ( $_REQUEST ['prod_id'] );
break;
case 'saveItemsActions' :
saveItemsActions ( $_REQUEST ['items'], $_REQUEST ['prod_id'] );
break;
case 'searchProduct' :
searchProduct ( $_REQUEST ['searchText'] );
break;
}
function saveItemsComponents($items, $prod_id) {
$items = json_decode ( base64_decode ( $items ) );
$db = $GLOBALS ['db'];
global $current_user;
// delete old positions
$db->query ( "DELETE FROM ecmproductcomponents WHERE ecmproduct_id='$prod_id'" );
// save new positions
$res = array ();
$pos = 0;
foreach ( $items as $i ) {
$q = "INSERT INTO ecmproductcomponents VALUES (
'" . create_guid () . "',
NOW(),
NOW(),
'" . $current_user->id . "',
'" . $current_user->id . "',
'" . $current_user->id . "',
'0',
'$prod_id',
'" . $i->product_id . "',
'$pos',
'" . $i->product_code . "',
'" . $i->name . "',
'" . $i->quantity . "',
'',
'" . $i->divider. "',
'" . $i->quantity_recipe. "'
);";
$pos ++;
echo $q;
$db->query ( $q );
}
return true;
}
function getItemsComponents($prod_id) {
$db = $GLOBALS ['db'];
global $app_list_strings;
$res = $db->query ( "SELECT ecmcomponent_id, quantity,divider,quantity_recipe FROM ecmproductcomponents WHERE ecmproduct_id='$prod_id' AND deleted='0' order by position" );
$result = array ();
while ( $row = $db->fetchByAssoc ( $res ) ) {
// get component info
$p = $db->fetchByAssoc ( $db->query ( "SELECT code, name, unit_id, ems_price FROM ecmproducts WHERE id='" . $row ['ecmcomponent_id'] . "'" ) );
$tmp = array ();
$tmp ['product_id'] = $row ['ecmcomponent_id'];
$tmp ['product_code'] = $p ['code'];
$tmp ['quantity'] = $row ['quantity'];
$tmp ['divider'] = $row ['divider'];
$tmp ['quantity_recipe'] = $row ['quantity_recipe'];
$tmp ['name'] = $p ['name'];
$tmp ['product_link'] = '<a href="index.php?module=EcmProducts&action=DetailView&record=' . $row ['ecmcomponent_id'] . '" target="new">' . $p ['code'] . '</a>';
$tmp ['unit'] = $app_list_strings ['ecmproducts_unit_dom'] [$p ['unit_id']];
// get avg purchase price
// get ems price
$tmp ['purchase_price'] = $p ['ems_price'];
if (! $p || $p ['ems_price'] == 0) {
$pz = $db->fetchByAssoc ( $db->query ( "
SELECT price, parent_name FROM ecmstockoperations WHERE
product_id= '" . $tmp ['product_id'] . "' AND
parent_type = 'EcmStockDocIns'
ORDER BY date_entered DESC
LIMIT 0,1
" ) );
$tmp ['purchase_price'] = $pz['parent_name'];//$pz ['price'];
$tmp['purchase_price_document'] = $pz['parent_name'];
}
//var_dump($tmp);
$tmp['total'] = $tmp['purchase_price'] * $tmp['quantity'];
$result [] = $tmp;
}
echo json_encode ( $result );
return;
}
function searchComponents($st) {
$db = $GLOBALS ['db'];
$res = $db->query ( "
SELECT id, code, name, unit_id, ems_price FROM ecmproducts WHERE
(code LIKE '%$st%' OR
name LIKE '%$st%')
AND deleted='0'
" );
$result = array ();
global $app_list_strings;
while ( $row = $db->fetchByAssoc ( $res ) ) {
$item = array ();
$item ['value'] = "<b>" . $row ['code'] . "</b>&nbsp;&nbsp;&nbsp;" . $row ['name'];
$tmp = array ();
$tmp ['product_code'] = $row ['code'];
$tmp ['product_link'] = '<a href="index.php?module=EcmProducts&action=DetailView&record=' . $row ['id'] . '" target="new">' . $row ['code'] . '</a>';
$tmp ['name'] = $row ['name'];
$tmp ['product_id'] = $row ['id'];
$tmp ['unit'] = $app_list_strings ['ecmproducts_unit_dom'] [$row ['unit_id']];
$tmp ['quantity'] = 1;
$tmp ['divider'] = 1;
$tmp ['quantity_recipe'] =1;
// get avg purchase price
// get ems price
$tmp ['purchase_price'] = $row ['ems_price'];
if (! $row ['ems_price'] || $row ['ems_price'] == 0) {
$pz = $db->fetchByAssoc ( $db->query ( "
SELECT price FROM ecmstockoperations WHERE
product_id= '" . $tmp ['product_id'] . "' AND
parent_type = 'EcmStockDocIns'
ORDER BY date_entered DESC
LIMIT 0,1
" ) );
$tmp ['purchase_price'] = $pz ['price'];
}
$item ['fields'] = json_encode ( $tmp );
$result [] = $item;
}
echo json_encode ( $result );
return;
}
function saveItemsActions($items, $prod_id) {
$items = json_decode ( base64_decode ( $items ) );
$db = $GLOBALS ['db'];
global $current_user;
// delete old positions
$db->query ( "DELETE FROM ecmproductactions WHERE ecmproduct_id='$prod_id'" );
// save new positions
$res = array ();
$pos = 0;
foreach ( $items as $i ) {
$q = "INSERT INTO ecmproductactions VALUES (
'" . create_guid () . "',
'" . $current_user->id . "',
NOW(),
'$prod_id',
'" . $i->action_id . "',
'" . $i->quantity . "',
'$pos'
);";
$pos ++;
$db->query ( $q );
}
return true;
}
function getItemsActions($prod_id) {
$db = $GLOBALS ['db'];
global $app_list_strings;
$res = $db->query ( "SELECT ecmaction_id, quantity FROM ecmproductactions WHERE ecmproduct_id='$prod_id' order by position" );
$result = array ();
while ( $row = $db->fetchByAssoc ( $res ) ) {
// get action info
$p = $db->fetchByAssoc ( $db->query ( "SELECT indeks, name, cost_action, cost_other FROM ecmactions WHERE id='" . $row ['ecmaction_id'] . "'" ) );
$tmp = array ();
$tmp ['action_id'] = $row ['ecmaction_id'];
$tmp ['action_code'] = $p ['indeks'];
$tmp ['quantity'] = $row ['quantity'];
$tmp ['name'] = $p ['name'];
$tmp ['action_link'] = '<a href="index.php?module=EcmActions&action=DetailView&record=' . $row ['ecmaction_id'] . '" target="new">' . $p ['indeks'] . '</a>';
$tmp ['price_netto'] = $p ['cost_other'];
$tmp ['price_brutto'] = $p ['cost_action'];
$tmp['total_netto'] = $tmp['quantity'] * $tmp['price_netto'];
$tmp['total_brutto'] = $tmp['quantity'] * $tmp['price_brutto'];
$result [] = $tmp;
}
echo json_encode ( $result );
return;
}
function searchActions($st) {
$db = $GLOBALS ['db'];
$res = $db->query ( "
SELECT id, indeks, name, time, cost_action, cost_other FROM ecmactions WHERE
(indeks LIKE '%$st%' OR
name LIKE '%$st%')
AND deleted='0'
" );
$result = array ();
global $app_list_strings;
while ( $row = $db->fetchByAssoc ( $res ) ) {
$item = array ();
$item ['value'] = "<b>" . $row ['indeks'] . "</b>&nbsp;&nbsp;&nbsp;" . $row ['name'].' ('.$row['cost_other'].')';
$tmp = array ();
$tmp ['action_code'] = $row ['indeks'];
$tmp ['action_link'] = '<a href="index.php?module=EcmActions&action=DetailView&record=' . $row ['id'] . '" target="new">' . $row ['indeks'] . '</a>';
$tmp ['name'] = $row ['name'];
$tmp ['action_id'] = $row ['id'];
$tmp ['quantity'] = 1;
$tmp ['price_brutto'] = $row ['cost_action'];
$tmp ['price_netto'] = $row ['cost_other'];
$item ['fields'] = json_encode ( $tmp );
$result [] = $item;
}
echo json_encode ( $result );
return;
}
function searchProduct($st) {
$db = $GLOBALS ['db'];
$res = $db->query ( "
SELECT id, code FROM ecmproducts WHERE
(code LIKE '%$st%' OR
name LIKE '%$st%')
AND deleted='0'
" );
$result = array ();
global $app_list_strings;
while ( $row = $db->fetchByAssoc ( $res ) ) {
$item = array ();
$item ['value'] = "<b>" . $row ['code'] . "</b>";
$tmp = array ();
$tmp ['product_code'] = $row ['code'];
$tmp ['product_id'] = $row['id'];
$item ['fields'] = json_encode ( $tmp );
$result [] = $item;
}
echo json_encode ( $result );
return;
}

View File

@@ -0,0 +1,332 @@
<?
function generateNumber($template_id,$date,$table,$date_field,$prefix,$show_number)
{
global $timedate;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$template_id."'"));
//print mysql_error();
$per=$r['documents_per'];
$format=$r['document_number_format_id'];
$date=$timedate->to_display($date, $timedate->get_date_format(), "Y-m-d");
$exp=explode("-",$date);
if($per=="day")$daten=$date;
if($per=="month")$daten=$exp[0]."-".$exp[1];
if($per=="year")$daten=$exp[0];
$z="select number from ".$table." where ".$date_field." like '".$daten."%' order by number desc limit 1";
print $z;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query($z));
print mysql_error();
$no=$r['number']+1;
//$number=$_GET['prefix']."/".$no."/".$exp[1]."/".$exp[0];
if($format[1]=="/")$sep="/";
elseif($format[1]==".")$sep=".";
elseif($format[1]=="-")$sep="-";
else $sep="";
if($per=="month")
{
$format=str_replace("D "," ",$format);
$format=str_replace("D-","",$format);
$format=str_replace("D/","",$format);
$format=str_replace("D.","",$format);
}
if($per=="year")
{
$format=str_replace("D "," ",$format);
$format=str_replace("D-","",$format);
$format=str_replace("M-","",$format);
$format=str_replace("D/","",$format);
$format=str_replace("M/","",$format);
$format=str_replace("D.","",$format);
$format=str_replace("M.","",$format);
}
$format=str_replace("Y",$exp[0],$format);
$format=str_replace("M",$exp[1],$format);
$format=str_replace("D",$exp[2],$format);
$format=str_replace("NR",$no,$format);
$number=$prefix.$sep.$format;
if($show_number)return $number;
else return $no;
}
function addToBooking($pl,$stock_in_id)
{
/*$quantity=$pl['quantity'];
$z="select quantity,order_id,id from ecmstockbookings where product_id='".$pl['id']."' and ecmstockin_id='' order by date_entered asc";
$w=$GLOBALS['db']->query($z);
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
if($quantity>0)
{
if($r['quantity']<=$quantity)
{
$qty=$r['quantity'];
$all=1;
}
else
{
$qty=$quantity;
$need=$r['quantity']-$quantity;
$all=0;
}
$quantity-=$qty;
$data[]=array("stock_in_id"=>$stock_in_id,"qty"=>$qty,"product_id"=>$pl['id']);
if($all==0)$data[]=array("stock_in_id"=>"","qty"=>$need,"product_id"=>$pl['id']);
if($all==1)
{
//print "jest";
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id from acl_roles where name like 'manager'"));
addInfoToReminder($r['order_id'],"EcmSales","Products Available","There are available products in stock for Your sales order",$rr['id']);
}
addToDbBookedProducts($data,$r['order_id']);
$GLOBALS['db']->query("delete from ecmstockbookings where id='".$r['id']."'");
}
}*/
}
function addInfoToReminder($parent_id,$parent_module,$name,$description,$role_id,$time="")
{
/*if($time=="")$time=date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"))-7200);
else
{
$texp=explode(" ",$time);
$dtexp=explode("-",$texp[0]);
$ttexp=explode(":",$texp[1]);
$time=date("Y-m-d H:i:s",mktime($ttexp[0],$ttexp[1],$ttexp[2],$dtexp[1],$dtexp[2],$dtexp[0])-7200);
}
$z="insert into ecmreminders(id,name,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id,date_start,status,reminder_time,parent_id,parent_module,role_id) values('".create_guid()."','".$name."','".$time."','".$time."','".$_SESSION['authenticated_user_id']."','".$_SESSION['authenticated_user_id']."','".$desciption."','0','".$_SESSION['authenticated_user_id']."','".$time."','Planned','3600','".$parent_id."','".$parent_module."','".$role_id."')";
$GLOBALS['db']->query($z);*/
}
function insertProductsToStock($pl,$return_id,$stock_id)
{
$guid=create_guid();
$z="insert into ecmstockins(id,assigned_user_id,modified_user_id,date_entered,date_modified,created_by,product_id,pz_id,stock_id,quantity_in,quantity_out,price_in,date_in) values('".$guid."','".$_SESSION['authenticated_user_id']."','".$_SESSION['authenticated_user_id']."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_SESSION['authenticated_user_id']."','".$pl['id']."','".$return_id."','".$stock_id."','".$pl['quantity']."','0','".$pl['price']."','".date("Y-m-d H:i:s")."')";
$GLOBALS['db']->query($z);
addRelationPurchaseOrderStockIn($return_id,$guid);
//addToBooking($pl,$guid);
}
function getStatus($pl,$stock_id)
{
$status="products in stock";
for($i=0; $i<count($pl); $i++)
{
$w=$GLOBALS['db']->query("select * from ecmstockins where product_id='".$pl[$i]['id']."' and stock_id='".$stock_id."'");
if(mysql_num_rows($w)==0)$status="registered";
else
{
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
if($r['quantity_in']-$r['quantity_out']<$pl[$i]['quantity'])
{
$status="registered";
break;
}
}
}
if($status=="registered")break;
}
return $status;
}
function bookProducts($pl,$stock_id,$order_id)
{
/*$data="";
for($i=0; $i<count($pl); $i++)
{
$qty=$pl[$i]['quantity'];
$w=$GLOBALS['db']->query("select * from ecmstockins where product_id='".$pl[$i]['id']."' and stock_id='".$stock_id."' and (quantity_in-quantity_out)>0 order by date_entered asc");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$quantity=$r['quantity_in']-$r['quantity_out'];
$ww=$GLOBALS['db']->query("select * from ecmstockbookings where ecmstockin_id='".$r['id']."' and used='0'");
$used_qty=0;
while($rr=$GLOBALS['db']->fetchByAssoc($ww))$used_qty+=$rr['quantity'];
if($quantity>=$qty+$used_qty)
{
$data[]=array(
"stock_in_id"=>$r['id'],
"qty"=>$qty,
"product_id"=>$pl[$i]['id']
);
$qty=0;
break;
}
elseif($quantity<$qty+$used_qty)
{
if($quantity-$used_qty>0)
{
$data[]=array(
"stock_in_id"=>$r['id'],
"qty"=>$quantity-$used_qty,
"product_id"=>$pl[$i]['id']
);
$qty-=$quantity-$used_qty;
}
}
}
if($qty>0)$data[]=array("stock_in_id"=>"","qty"=>$qty,"product_id"=>$pl[$i]['id']);
//print_r($data);
addToDbBookedProducts($data,$order_id);
$data=array();
}*/
}
function deleteProductFromStockIn($stock_in_id,$product_id,$qty)
{
$GLOBALS['db']->query("update ecmstockins set quantity_out=quantity_out+".$qty." where id='".$stock_in_id."' and product_id='".$product_id."'");
}
function addProductToStockOut($stock_in_id,$product_id,$quantity,$price,$date,$wz_id,$stock_id)
{
$z="insert into
ecmstockouts(
id,
assigned_user_id,
modified_user_id,
date_entered,
date_modified,
created_by,
product_id,
quantity_out,
price_out,
date_out,
wz_id,
stock_id,
ecmstockin_id,
deleted,
name
) values(
'".create_guid()."',
'".$_SESSION['authenticated_user_id']."',
'".$_SESSION['authenticated_user_id']."',
'".date("Y-m-d H:i:s")."',
'".date("Y-m-d H:i:s")."',
'".$_SESSION['authenticated_user_id']."',
'".$product_id."',
'".$quantity."',
'".$price."',
'".$date."',
'".$wz_id."',
'".$stock_id."',
'".$stock_in_id."',
'0',
'out')";
//print $z;
$GLOBALS['db']->query($z);
//print mysql_error();
}
function addToDbBookedProducts($data,$order_id)
{
/*$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select booking_time from ecmstocksettings"));
$time=$r['booking_time'];
foreach($data as $row)
{
$GLOBALS['db']->query("insert into ecmstockbookings(id,assigned_user_id,modified_user_id,date_entered,date_modified,created_by,product_id,order_id,ecmstockin_id,valid_date,quantity,used) values('".create_guid()."','".$_SESSION['authenticated_user_id']."','".$_SESSION['authenticated_user_id']."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_SESSION['authenticated_user_id']."','".$row['product_id']."','".$order_id."','".$row['stock_in_id']."','".date("Y-m-d H:i:s",time()+$time)."','".$row['qty']."','0')");
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select pz_id from ecmstockins where id='".$row['stock_in_id']."'"));
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select po_id from ecmpzdocuments where id='".$r['pz_id']."'"));
$GLOBALS['db']->query("insert into
ecmsales_ecmstockins
(id,date_modified,so_id,ecmstockin_id,deleted)
values
('".create_guid()."','".date("Y-m-d H:i:s")."','".$order_id."','".$row['stock_in_id']."','0')");
$GLOBALS['db']->query("insert into
ecmsales_ecmpurchaseorders
(id,date_modified,so_id,po_id,deleted)
values
('".create_guid()."','".date("Y-m-d H:i:s")."','".$order_id."','".$rr['po_id']."','0')");
$GLOBALS['db']->query("insert into
ecmsales_ecmpzdocuments
(id,date_modified,so_id,pz_id,deleted)
values
('".create_guid()."','".date("Y-m-d H:i:s")."','".$order_id."','".$r['pz_id']."','0')");
}*/
}
function addRelationPurchaseOrderStockIn($pz_id,$stock_in_id)
{
$w=$GLOBALS['db']->query("select po_id from ecmpzdocuments where id='".$pz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecmpurchaseorders_ecmstockins(id,date_modified,po_id,ecmstockin_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$r['po_id']."','".$stock_in_id."','0')");
}
}
function addRelationWzDocumentStockIn($so_id,$wz_id)
{
$w=$GLOBALS['db']->query("select ecmstockin_id from ecmsales_ecmstockins where so_id='".$so_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecmwzdocuments_ecmstockins(id,date_modified,wz_id,ecmstockin_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$wz_id."','".$r['ecmstockin_id']."','0')");
}
}
function addRelationWzDocumentPzDocument($so_id,$wz_id)
{
$w=$GLOBALS['db']->query("select pz_id from ecmsales_ecmpzdocuments where so_id='".$so_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecmwzdocuments_ecmpzdocuments(id,date_modified,wz_id,pz_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$wz_id."','".$r['pz_id']."','0')");
}
}
function addRelationWzDocumentPurchaseOrder($so_id,$wz_id)
{
$w=$GLOBALS['db']->query("select po_id from ecmsales_ecmpurchaseorders where so_id='".$so_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecmwzdocuments_ecmpurchaseorders(id,date_modified,wz_id,po_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$wz_id."','".$r['po_id']."','0')");
}
}
function addRelationInvoicePurchaseOrder($wz_id,$ecminvoiceout_id)
{
$w=$GLOBALS['db']->query("select po_id from ecmwzdocuments_ecmpurchaseorders where wz_id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecminvoiceouts_ecmpurchaseorders(id,date_modified,ecminvoiceout_id,po_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$ecminvoiceout_id."','".$r['po_id']."','0')");
}
}
function addRelationInvoicePzDocument($wz_id,$ecminvoiceout_id)
{
$w=$GLOBALS['db']->query("select pz_id from ecmwzdocuments_ecmpzdocuments where wz_id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecminvoiceouts_ecmpzdocuments(id,date_modified,ecminvoiceout_id,pz_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$ecminvoiceout_id."','".$r['pz_id']."','0')");
}
}
function addRelationInvoiceSalesOrder($wz_id,$ecminvoiceout_id)
{
$w=$GLOBALS['db']->query("select so_id from ecmwzdocuments where id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecminvoiceouts_ecmsales(id,date_modified,ecminvoiceout_id,so_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$ecminvoiceout_id."','".$r['so_id']."','0')");
}
}
function addRelationDeliveryNoteSalesOrder($wz_id,$dn_id)
{
$w=$GLOBALS['db']->query("select so_id from ecmwzdocuments where id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecmdeliverynotes_ecmsales(id,date_modified,dn_id,so_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$dn_id."','".$r['so_id']."','0')");
}
}
function addRelationInvoiceStock($wz_id,$ecminvoiceout_id)
{
$w=$GLOBALS['db']->query("select ecmstockin_id from ecmwzdocuments_ecmstockins where wz_id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
//print "ok<br>";
$GLOBALS['db']->query("insert into ecminvoiceouts_ecmstockins(id,date_modified,ecminvoiceout_id,ecmstockin_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$ecminvoiceout_id."','".$r['ecmstockin_id']."','0')");
}
//print mysql_error();
}
function addRelationDeliveryNoteInvoice($wz_id,$dn_id)
{
$w=$GLOBALS['db']->query("select so_id from ecmwzdocuments where wz_id='".$wz_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ecminvoiceouts_ecmsales(id,date_modified,ecminvoiceout_id,so_id,deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$ecminvoiceout_id."','".$r['so_id']."','0')");
}
}
function addRelation($r_field,$r_relation,$r_id,$r_value,$l_field,$l_relation,$l_value)
{
$z="select ".$r_field." from ".$r_relation." where ".$r_id."='".$r_value."'";
print $z."<br>";
$w=$GLOBALS['db']->query($z);
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
$GLOBALS['db']->query("insert into ".$l_relation."(id,date_modified,".$l_field.",".$r_field.",deleted) values('".create_guid()."','".date("Y-m-d H:i:s")."','".$l_value."','".$r[$r_field]."','0')");
print mysql_error();
}
}
?>

View File

@@ -0,0 +1,11 @@
<?php
function ProductToOrder($focus, $field, $value, $view) {
$db = $focus->db;
$query = "SELECT q3, ems_qty_in_stock from ecmproducts WHERE id='".$focus->id."';";
$result = $db->query($query);
$row = $db->fetchByAssoc($result);
$q3 = $row['q3'];
$stock = $row['ems_qty_in_stock'];
if ( intval($stock) < 3 * intval($q3)) return 1; else return 0;
}
?>

263
modules/EcmProducts/Save.php Executable file
View File

@@ -0,0 +1,263 @@
<?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.
********************************************************************************/
require_once('modules/EcmProducts/EcmProduct.php');
require_once('include/formbase.php');
require_once('include/Upload.php');
function addLocalizedInformation($id)
{
global $db;
$lang=array("en","de","pl","fr","it","es");
foreach($lang as $l)
{
if (!$_REQUEST['short_description_'.$l] || $_REQUEST['short_description_'.$l]=='')
$_REQUEST['short_description_'.$l] = '&nbsp';
$result=$GLOBALS['db']->query("select ecmproduct_id from ecmproduct_language where ecmproduct_id='".$id."' and language like '".$l."'");
if($result->num_rows>0)
{
$GLOBALS['db']->query("update ecmproduct_language set ean='".$_REQUEST['ean']."',remarks='".$_REQUEST['remarks_'.$l]."',short_description='".$_REQUEST['short_description_'.$l]."',long_description='".$_REQUEST['long_description_'.$l]."',modified_user_id='".$_SESSION['authenticated_user_id']."',date_modified='".date("Y-m-d H:i:s")."',price='".$_REQUEST['price_'.$l]."' where ecmproduct_id='".$id."' and language='".strtolower($l)."'");
}
else
{
$GLOBALS['db']->query("insert into ecmproduct_language set id='".create_guid()."',created_by='".$_SESSION['authenticated_user_id']."',modified_user_id='".$_SESSION['authenticated_user_id']."',date_entered='".date("Y-m-d H:i:s")."',date_modified='".date("Y-m-d H:i:s")."',deleted='0',ean='".$_REQUEST['ean']."',remarks='".$_REQUEST['remarks_'.$l]."',short_description='".$_REQUEST['short_description_'.$l]."',long_description='".$_REQUEST['long_description_'.$l]."',language='".strtolower($l)."',ecmproduct_id='".$id."',price='".$_REQUEST['price_'.$l]."'");
}
}
}
$focus = new EcmProduct();
$focus->retrieve($_POST['record']);
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
//add mz 2012-04-10
//check ean
//include("/modules/EcmProducts/generateEAN.php");
//if ($_POST['newEan']=="1") $focus->ean=generateEAN();
//if ($_POST['newEan2']=="1") $focus->ean2=generateEAN();
//$_REQUEST['name']="test";
//categories
$pll = array();
$json = getJSONobj();
$exp=explode("||||",$_POST['position_list3']);
foreach($exp as $ep){
if($ep){
$pll[] = $json->decode(htmlspecialchars_decode($ep));
}
}
$_POST['position_list3'] = $pll;
//prices
$pll = array();
$json = getJSONobj();
$exp=explode("||||",$_POST['position_list4']);
foreach($exp as $ep){
if($ep){
$pll[] = $json->decode(htmlspecialchars_decode($ep));
}
}
$_POST['position_list4'] = $pll;
include('modules/EcmProducts/SimpleImage.php');
if($_FILES['product_picture']['name']){
$_POST['product_picture']=upload_file("product_picture","modules/EcmProducts/upload/images/");
$img="modules/EcmProducts/upload/images/".$_POST['product_picture'];
copy($img,"modules/EcmProducts/upload/images/big/".$_POST['product_picture']);
chmod("modules/EcmProducts/upload/images/big/".$_POST['product_picture'],0777);
$size=getSize($img,125);
$image = new SimpleImage();
$image->load($img);
$image->resize($size[0],$size[1]);
$image->save($img);
}
chmod($img,0777);
if($_FILES['packing_front_picture']['name']){
$_POST['packing_front_picture']=upload_file("packing_front_picture","modules/EcmProducts/upload/images/");
$img="modules/EcmProducts/upload/images/".$_POST['packing_front_picture'];
copy($img,"modules/EcmProducts/upload/images/big/".$_POST['packing_front_picture']);
chmod("modules/EcmProducts/upload/images/big/".$_POST['packing_front_picture'],0777);
$size=getSize($img,125);
$image = new SimpleImage();
$image->load($img);
$image->resize($size[0],$size[1]);
$image->save($img);
}
chmod($img,0777);
if($_FILES['driver_1']['name'])$_POST['driver_1']=upload_file("driver_1","modules/EcmProducts/upload/");
if($_FILES['driver_2']['name'])$_POST['driver_2']=upload_file("driver_2","modules/EcmProducts/upload/");
chmod("modules/EcmProducts/upload/".$_POST['driver_1'],0777);
chmod("modules/EcmProducts/upload/".$_POST['driver_2'],0777);
if($_REQUEST['delete_product_picture']){
$_POST['product_picture']=$_REQUEST['product_picture']="";
}
if($_REQUEST['delete_packing_front_picture']){
$_POST['packing_front_picture']=$_REQUEST['packing_front_picture']="";
}
if (!empty($_POST['assigned_user_id']) && ($focus->assigned_user_id != $_POST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
$check_notify = TRUE;
}else{
$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;
}
}
if (!isset($_POST[product_active])) {
$focus->product_active = '0';
}else{
$focus->product_active = '1';
}
if (!isset($_POST[certificate_of_origin])) {
$focus->certificate_of_origin = '0';
}else{
$focus->certificate_of_origin = '1';
}
if (!isset($_POST[form_a])) {
$focus->form_a = '0';
}else{
$focus->form_a = '1';
}
//Added for Graduated Prices - Begin
/*require_once('modules/EcmProducts/EcmProductGraduatedPrices.php');
$epgp = new EcmProductGraduatedPrices();
$epgp->setFromPost();
$focus->graduated_prices = $epgp->toString();*/
//Added for Graduated Prices - End
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
$currency_list = $currency->get_full_list('conversion_rate');
$currency->retrieve('-99');
if(is_array($currency_list))$currency_list = array_merge(Array($currency), $currency_list);
else $currency_list = Array($currency);
$arr = array();
foreach($currency_list as $key=>$value)$arr[$value->id] = $value->conversion_rate;
$erv=$arr[$_REQUEST['exchange_rate_id']];
$focus->unformat_all_fields();
if (!$focus->carton_volume_meter || $focus->carton_volume_meter=='' || round($focus->carton_volume_meter,0)==0)
$focus->carton_volume_meter=
unformat_number($focus->carton_dimensions_1)*
unformat_number($focus->carton_dimensions_2)*
unformat_number($focus->carton_dimensions_3);
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select local_transportation,abroad_transportation from ecmproductcategories where id='".$_REQUEST['product_category_id']."'"));
$lt=$r['local_transportation'];
$at=$r['abroad_transportation'];
if($focus->pieces_per_carton!=0)$pcscbm=$focus->carton_volume_meter/$focus->pieces_per_carton;
else $pcscbm=1;
if(!$_REQUEST['purchase_price']){
$customduty=($focus->fob_price+$at*$pcscbm)*($erv*$focus->custom_duty_rate/100);
$focus->purchase_price=$focus->fob_price*$erv+$customduty+$lt*$pcscbm;
}
if(!$_REQUEST['commission_rate']){
$rv=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select value from ecmvats where id='".$_REQUEST['vat_id']."'"));
$focus->commission_rate=100*(($focus->srp_price/(1+$rv['value']/100)-$focus->purchase_price)/($focus->srp_price/(1+$rv['value']/100)));
}
$rpp=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ems_price from ecmproducts where id='".$focus->id."'"));
$focus->save($check_notify);
$GLOBALS['db']->query("update ecmproducts set ems_price='".$rpp['ems_price']."' where id='".$focus->id."'");
$return_id = $focus->id;
if(isset($_POST['vat_id'])){
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select value,name from ecmvats where id='".$_POST['vat_id']."'"));
$GLOBALS['db']->query("update ecmproducts set ean='".$_REQUEST['ean']."',vat_value='".$r['value']."',vat_name='".$r['name']."',product_active='".$_REQUEST['product_active']."',status='".$_REQUEST['status']."' where id='".$return_id."'");
}
$models=base64_encode(serialize($_REQUEST['models']));
$GLOBALS['db']->query("update ecmproducts set models='".$models."',status='".$_REQUEST['status']."' where id='".$return_id."'");
addLocalizedInformation($return_id);
$image=true;
$desc=true;
if(!file_exists("modules/EcmProducts/upload/images/big/".$focus->product_picture) || !$focus->product_picture)$image=false;
if(!file_exists("modules/EcmProducts/upload/images/big/".$focus->packing_front_picture) || !$focus->packing_front_picture)$image=false;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select ean,remarks,short_description,long_description,language,price from ecmproduct_language where language='pl' and ecmproduct_id='".$return_id."'"));
if(!$r['ean'] || !$r['short_description'] || !$r['long_description'] || !$r['price'])$desc=false;
if(!$image && !$desc)$type="images_and_description";
elseif(!$image && $desc)$type="images";
elseif($image && !$desc)$type="description";
else $type="ok";
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select type from ecmproducts_log where ecmproduct_id='".$return_id."' and sent is null order by date_entered desc limit 1"));
if($r['type']!=$type){
$GLOBALS['db']->query("insert into ecmproducts_log(id,date_modified,date_entered,created_by,modified_user_id,ecmproduct_id,type) values('".create_guid()."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_SESSION['authenticated_user_id']."','".$_SESSION['authenticated_user_id']."','".$return_id."','".$type."');");
}
handleRedirect($return_id,'EcmProducts');
?>

View File

@@ -0,0 +1,154 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-top: 0px none; margin-bottom: 4px" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%" valign="top" noWrap class="dataLabel">
<span sugar='slot1'>{MOD.LBL_NAME}</span sugar='slot'> </td>
<td width="20%" valign="top" class="dataField">
<span sugar='slot1b'>
<input type=text name="name_basic" class=dataField value="{NAME}" />
</span sugar='slot'> </td>
<td width="10%" valign="top" class="dataLabel"><span sugar='slot2'>{MOD.LBL_CODE}</span sugar='slot'></td>
<td width="20%" valign="top" class="dataField"><input name='code_basic' type="text" tabindex='2' title="Product index" value="{PRODUCT_INDEX}" maxlength='40' /></td>
<td width="15%" valign="top" class="dataLabel">{APP.LBL_CURRENT_USER_FILTER}&nbsp;&nbsp;</td>
<td width="15%" valign="top" class="dataField"><input name='current_user_only_basic' onchange='this.form.submit();' class="checkbox" type="checkbox" {current_user_only} /></td>
</tr>
<tr><td width="10%" valign="top" class="dataLabel">{MOD.LBL_MANUFACTURER}</td>
<td width="20%" valign="top" class="dataField"><select style="width:121px;" name="manufacturer_basic">{MANUFACTURER}</select></td>
<td width="20%" valign="top" class="dataLabel">{MOD.LBL_PRODUCT_CATEGORY}</td>
<td width="20%" valign="top" class="dataField"><select style="width:121px;" name="product_category_basic">{PRODUCT_CATEGORY}</select></td>
<td width="10%" valign="top" class="dataLabel">{MOD.LBL_UNIT_PRICE}</td>
<td width="20%" valign="top" class="dataField"><input name='unit_price_basic' type="text" tabindex='2' value="{UNIT_PRICE}" maxlength='40' /></td>
</tr>
<tr>
</table>
</td>
</tr>
</table>
<!-- END: main -->
<!-- BEGIN: advanced -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-top: 0px none; margin-bottom: 4px" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="10%" valign="top" class="dataLabel"><span sugar='slot1'>{MOD.LBL_NAME}</span sugar='slot'></td>
<td width="20%" valign="top" class="dataField"><span sugar='slot1b'><input name='name' type="text" tabindex='1' maxlength='50' value="{NAME}">
</span sugar='slot'></td>
<td width="10%" valign="top" class="dataLabel"><span sugar='slot`3`'>{MOD.LBL_CODE}</span sugar='slot'></td>
<td width="20%" valign="top" class="dataField"><span sugar='slot`3`b'>
<input name='code' type="text" tabindex='`3`' title="Product index" value="{PRODUCT_INDEX}" maxlength='40' />
</span sugar='slot'> </td>
<td width="15%" valign="top" class="dataField"><span class="dataLabel"><span sugar='slot2'>{APP.LBL_ASSIGNED_TO}</span sugar='slot'></span></td>
<td width="15%" valign="top" class="dataField"><span sugar='slot2b'>
<select tabindex='1' style="width: 150px" size='3' name='assigned_user_id[]' multiple="multiple">{USER_FILTER}</select></span sugar='slot'></td>
<tr>
<td valign="top" class="dataLabel">{MOD.LBL_MANUFACTURER}</td>
<td valign="top" class="dataField"><select style="width:121px;" name="manufacturer">
{MANUFACTURER}
</select></td>
<td valign="top" class="dataLabel">{MOD.LBL_PRODUCT_CATEGORY}</td>
<td valign="top" class="dataField"><select style="width:121px;" name="product_category">
{PRODUCT_CATEGORY}
</select></td>
<td valign="top" class="dataLabel">&nbsp;</td>
<td valign="top" class="dataField">&nbsp;</td>
</tr>
<tr>
<td valign="top" class="dataLabel">{MOD.LBL_COMMISSION_RATE}</td>
<td valign="top" class="dataField"><input name='commission_rate' type="text" id="commission_rate" tabindex='1' value="{COMMISSION_RATE}" maxlength='50' /></td>
<td valign="top" class="dataLabel">{MOD.LBL_QTYUNIT}</td>
<td valign="top" class="dataField"><input name='qty_per_unit' type="text" id="qty_per_unit" tabindex='1' value="{QTY_PER_UNIT}" maxlength='50' /></td>
<td valign="top" class="dataLabel">{MOD.LBL_UNIT_PRICE} </td>
<td valign="top" class="dataField"><input name='unit_price' type="text" tabindex='2' value="{UNIT_PRICE}" maxlength='40' /></td>
</tr>
<tr>
<td valign="top" class="dataLabel">{MOD.LBL_START_DATE}</td>
<td valign="top" class="dataField"><input name='sales_start_date'
onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');"
id='jscal_fieldsales_start_date'
type="text"
tabindex='10'
size='11'
maxlength='10'
value="{SALES_START_DATE}" />
<img src="themes/default/images/jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="jscal_triggersales_start_date" align="absmiddle" />
<script>Calendar.setup ({inputField : 'jscal_fieldsales_start_date', ifFormat : '{CALENDAR_DATEFORMAT}', showsTime : false, button : 'jscal_triggersales_start_date', singleClick : true, step : 1});
</script></td>
<td valign="top" class="dataLabel">{MOD.LBL_END_DATE}</td>
<td valign="top" class="dataField"><input name='sales_end_date'
onblur="parseDate(this, '{CALENDAR_DATEFORMAT}');"
id='jscal_fieldsales_end_date'
type="text"
tabindex='10'
size='11'
maxlength='10'
value="{SALES_END_DATE}" />
<img src="themes/default/images/jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="jscal_triggersales_end_date" align="absmiddle" />
<script>Calendar.setup ({inputField : 'jscal_fieldsales_end_date', ifFormat : '{CALENDAR_DATEFORMAT}', showsTime : false, button : 'jscal_triggersales_end_date', singleClick : true, step : 1});
</script></td>
<td valign="top" class="dataLabel">{MOD.LBL_PRODUCT_ACTIVE}</td>
<td valign="top" class="dataField"><input name='product_active' onchange='this.form.submit();' class="checkbox" type="checkbox" value="1" {PRODUCT_ACTIVE} /></td>
</tr>
<tr> </tr>
</table>
</td>
</tr>
</table>
<!-- END: advanced -->

24
modules/EcmProducts/SendXML.php Executable file
View File

@@ -0,0 +1,24 @@
<?php
error_reporting(0);
include_once("modules/EcmProducts/xml_template.php");
$xml=xml($_REQUEST['record']);
$file="cache/upload/product_xml_".str_replace(" ","_",str_replace(".","_",microtime())).".xml";
fopen($file);
file_put_contents($file,$xml);
chmod($file,0777);
$remote_file="/xml_products/".$r['code']."_".date("YmdHis").".xml";
$conn_id = ftp_connect("www.leobite.com");
$login_result = ftp_login($conn_id, "ftpleobite.leobite.com", "wrT%I9g");
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
//echo "successfully uploaded $file\n";
} else {
//echo "There was a problem while uploading $file\n";
}
ftp_chmod($conn_id, 0755, $remote_file);
$GLOBALS['db']->query("update ecmproducts_log set sent='1' where date_entered<='".date("Y-m-d H:i:s")."' and ecmproduct_id='".$_REQUEST['record']."'");
//header("Location: ".$file);
header("Location: index.php?module=EcmProducts&action=DetailView&record=".$_REQUEST['record']);
?>

View File

@@ -0,0 +1,84 @@
<?
class SimpleImage {
var $image;
var $image_type;
function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if( $this->image_type == IMAGETYPE_JPEG ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == IMAGETYPE_GIF ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == IMAGETYPE_PNG ) {
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image,$filename);
}
if( $permissions != null) {
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image);
}
}
function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}
function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width,$height);
}
function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width,$height);
}
function scale($scale) {
$width = $this->getWidth() * $scale/100;
$height = $this->getheight() * $scale/100;
$this->resize($width,$height);
}
function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
}
function getSize($img,$width)
{
if(is_file($img))
{
$im=@GetImageSize($img);
if($im[0]>=$width)
{
$wi=180;
$he=$im[1]*$wi/$im[0];
}
else
{
$wi=$im[0];
$he=$im[1];
}
}
return array($wi,$he);
}
?>

View File

@@ -0,0 +1,89 @@
<!--
/*****************************************************************************
* 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.
********************************************************************************/
-->
<!-- BEGIN: main -->
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView">
<tr height="20" >
<td scope="col" width="5%" class="listViewThS1"><slot>{MOD.LBL_LIST_NUMBER}</slot></td>
<td scope="col" width="50%" class="listViewThS1"><slot>{MOD.LBL_LIST_SUBJECT}</slot></td>
<td scope="col" width="15%" class="listViewThS1"><slot>{MOD.LBL_LIST_STATUS}</slot></td>
<td scope="col" width="5%" class="listViewThS1"><slot>&nbsp;</slot></td>
<td scope="col" width="50%" class="listViewThS1"><slot>{MOD.LBL_LIST_NAME}</slot></td>
</tr>
<!-- BEGIN: row -->
<tr height="20" onmouseover="setPointer(this, '{ECMPRODUCTS.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmouseout="setPointer(this, '{ECMPRODUCTS.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');"
onmousedown="setPointer(this, '{ECMPRODUCTS.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td scope='row' valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" ><slot>{ECMPRODUCTS.NUMBER}</slot></td>
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" ><slot>
<a href="{URL_PREFIX}index.php?action=DetailView&module=EcmProducts&record={ECMPRODUCTS.ID}" class="listViewTdLinkS1">{ECMPRODUCTS.NAME}</a></slot>
</td>
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" ><slot>{ECMPRODUCTS.STATUS}</slot></td>
<td nowrap align="center" valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" >
<slot>
<a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module=EcmProducts&record={ECMPRODUCTS.ID}{RETURN_URL}">{EDIT_INLINE_PNG}</a>&nbsp;
<a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module=EcmProducts&record={ECMPRODUCTS.ID}{RETURN_URL}">{APP.LNK_EDIT}</a>
</slot>
</td>
<td scope='row' valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" ><slot>{ECMPRODUCTS.NAME}</slot></td>
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1" >
<slot>
<a href="{URL_PREFIX}index.php?action=DetailView&module=EcmProducts&record={ECMPRODUCTS.ID}" class="listViewTdLinkS1">{ECMPRODUCTS.NAME}</a>
</slot>
</td>
</tr>
<tr>
<td colspan="20" class="listViewHRS1"></td>
</tr>
<!-- END: row -->
</table>
<!-- END: main -->

View File

@@ -0,0 +1,130 @@
<?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.
********************************************************************************/
require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
require_once("include/ListView/ListView.php");
global $app_strings;
global $current_language;
$current_module_strings = return_module_language($current_language, 'EcmProducts');
$header_text = '';
global $currentModule;
global $theme;
global $focus;
global $action;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
///////////////////////////////////////
/// SETUP PARENT POPUP
$popup_request_data = array(
'call_back_function' => 'set_return_and_save',
'form_name' => 'DetailView',
'field_to_name_array' => array(
'id' => 'ecmproduct_id',
),
);
$json = getJSONobj();
$encoded_popup_request_data = $json->encode($popup_request_data);
///
///////////////////////////////////////
// FOCUS_LIST IS THE MEANS OF PASSING DATA TO A SUBPANELVIEW.
global $focus_list;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
$button .= "<input type='hidden' name='module' value='EcmProducts'>\n";
if ($currentModule == 'Accounts') {
$button .= "<input type='hidden' name='account_id' value='$focus->id'>\n";
$button .= "<input type='hidden' name='account_name' value='$focus->name'>\n";
}elseif ($currentModule == 'Contacts') {
$button .= "<input type='hidden' name='account_id' value='$focus->account_id'>\n";
$button .= "<input type='hidden' name='account_name' value='$focus->account_name'>\n";
$button .= "<input type='hidden' name='contact_id' value='$focus->id'>\n";
}elseif ($currentModule == 'Cases') {
$button .= "<input type='hidden' name='case_id' value='$focus->id'>\n";
}
$button .= "<input type='hidden' name='return_module' value='".$currentModule."'>\n";
$button .= "<input type='hidden' name='return_action' value='".$action."'>\n";
$button .= "<input type='hidden' name='return_id' value='".$focus->id."'>\n";
$button .= "<input type='hidden' name='action'>\n";
$button .= "<input title='".$app_strings['LBL_NEW_BUTTON_TITLE']
."' accessKey='".$app_strings['LBL_NEW_BUTTON_KEY']
."' class='button' onclick=\"this.form.action.value='EditView'\" type='submit' name='New' value=' "
.$app_strings['LBL_NEW_BUTTON_LABEL']." '>\n";
$button .= "<input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."' accessKey='"
.$app_strings['LBL_SELECT_BUTTON_KEY']."' type='button' class='button' value=' "
.$app_strings['LBL_SELECT_BUTTON_LABEL']
." ' name='button' onclick='open_popup(\"EcmProducts\", 600, 400, \"\", false, true, {$encoded_popup_request_data});'>\n";
$button .= "</form>\n";
$ListView = new ListView();
$ListView->initNewXTemplate( 'modules/EcmProducts/SubPanelView.html',$current_module_strings);
$ListView->xTemplateAssign("RETURN_URL", "&return_module=".$currentModule."&return_action=DetailView&return_id={$_REQUEST['record']}");
$ListView->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path.'edit_inline', 'align="absmiddle" alt="'.$app_strings['LNK_EDIT'] .'" border="0"'));
$ListView->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path.'delete_inline','align="absmiddle" alt="'.$app_strings['LNK_REMOVE'].'" border="0"'));
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=SubPanelView&from_module=EcmProducts&record="
.$_REQUEST['record']."'>"
.get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")
."</a>";
}
$ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME'] . $header_text );
$ListView->setHeaderText($button);
$ListView->processListView($focus_list, "main", "ECMPRODUCT");
?>

View File

@@ -0,0 +1,88 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '') {
die ( 'Error!' );
}
$p = new EcmProduct ();
$p->retrieve ( $_REQUEST ['record'] );
// send files with SFTP
$code = preg_replace ( '/[^a-zA-Z0-9-_\.]/', '', $p->code );
$pic1 = "/var/www/html/crm/modules/EcmProducts/upload/images/big/" . $p->product_picture;
$pic2 = "/var/www/html/crm/modules/EcmProducts/upload/images/big/" . $p->packing_front_picture;
$remote_pic1 = "/var/www/html/e5.pl/www/allegro/products/" . $code . strrchr ( $p->product_picture, '.' );
$remote_pic2 = "/var/www/html/e5.pl/www/allegro/products/" . $code . "2" . strrchr ( $p->packing_front_picture, '.' );
$conn = ssh2_connect ( '192.168.1.205', 22 );
if (! ssh2_auth_password ( $conn, 'mz', '3x4z8123' )) {
echo 'Błąd połaczenia SSH';
}
$pictures = 0;
$img=array();
if(file_exists ( $pic1 )==false){
$pic1 = "/var/www/html/crm/modules/EcmProducts/upload/images/" . $p->product_picture;
}
if(file_exists ( $pic2 )==false){
$pic2 = "/var/www/html/crm/modules/EcmProducts/upload/images/" . $p->packing_front_picture;
}
if (file_exists ( $pic1 ) && $p->product_picture!='') {
ssh2_scp_send ( $conn, $pic1, $remote_pic1, 0644 );
$img[0] = '<img id="prod-image" src="http://e5.pl/allegro/products/'.$code . strrchr ( $p->product_picture, '.' ).'"/>';
}
if (file_exists ( $pic2 && $p->packing_front_picture!='')) {
ssh2_scp_send ( $conn, $pic2, $remote_pic2, 0644 );
$img[1]= '<img id="prod-image" src="http://e5.pl/allegro/products/'.$code .'2'. strrchr ( $p->product_picture, '.' ).'"/>';
}
ssh2_exec ( $conn, 'exit' );
//opis
$db=$GLOBALS['db'];
$tmp = $db->fetchByAssoc($db->query("SELECT long_description as ld FROM ecmproduct_language WHERE language='pl' AND ecmproduct_id='$p->id'"));
//echo "SELECT long_description FROM ecmproduct_language WHERE language='pl' AND ecmproduct_id='$p->id'";
$ld = $tmp['ld'];
$tmp = explode('
', $ld);
$description_label = "Opis produktu";
$specification_label = "Specyfikacja";
$description = '';
$paste = false;
foreach ($tmp as $line) {
if ($paste && strpos($line,'strong')!=false) break;
if ($paste) $description.=$line;
if (strpos($line, trim($description_label))) $paste = true;
}
//var_dump($ld);
$specification = '';
$paste = false;
foreach ($tmp as $line) {
if ($paste && strpos($line,'strong')!=false) break;
if ($paste) $specification.=$line;
if (strpos($line, trim($specification_label))) $paste = true;
}
//rysujemy ekran
echo '<div style="width: 50%; border: 2px solid black;">';
// create template
$ss = new Sugar_Smarty ();
$ss->assign('name', $p->name);
$ss->assign('pictures', $img);
$ss->assign('specification', html_entity_decode($specification));
$ss->assign('description', html_entity_decode($description));
$content = $ss->fetch ( 'modules/EcmProducts/tpls/allegroTemplate.tpl' );
echo $content;
//koniec ekranu
echo '</div>';
//html do skopiowania
echo '<br><textarea rows="50" cols="200">'.$content.'</textarea>';
?>

View File

@@ -0,0 +1,12 @@
<?php
$db = $GLOBALS['db'];
$products = $db->query("SELECT id, code, name FROM ecmproducts WHERE product_active='1'");
while ($product = $db->fetchByAssoc($products)) {
$price = $db->fetchByAssoc($db->query("
select (sum(price*quantity)/sum(quantity)) as avg_price from ecmstockstates
where product_id='".$product['id']."'"));
echo $product['code'].' '.$product['name'].' '.round($price['avg_price'],2).'<br><br>';
}

View File

@@ -0,0 +1,676 @@
<?php
$db = new mysqli('localhost', 'root', '5z#JaL', 'crm');
$products = $db->query("SELECT id,code FROM ecmproducts WHERE deleted='0' AND product_active='1'");
$i = 0;
while ($p = $products->fetch_object()) {
$i++;
echo $i.': '.$p->code.PHP_EOL;
//last year
$lyr = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y")-1)."'
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
GROUP BY ii.ecmproduct_id
");
$ly = $lyr->fetch_object();
//update
$margin = 0;
if ($ly->sales > 0)
$margin = (($ly->sales - $ly->cost) / $ly->sales)*100;
$db->query("UPDATE ecmproducts SET last_year_margin='$margin', last_year_qty='".$ly->qty."', last_year_val='".$ly->sales."', last_year_cost='".$ly->cost."' WHERE id='".$p->id."'");
//this year sale
$tyr = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
ii.quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$ty = $tyr->fetch_object();
//update
$margin = 0;
if ($ty->sales > 0)
$margin = (($ty->sales - $ty->cost) / $ty->sales)*100;
$db->query("UPDATE ecmproducts SET this_year_margin='$margin', this_year_qty='".$ty->qty."', this_year_val='".$ty->sales."', this_year_cost='".$ty->cost."' WHERE id='".$p->id."'");
//q1
$q1r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) IN ('1', '2', '3')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$q1 = $q1r->fetch_object();
//update
$margin = 0;
if ($q1->sales > 0)
$margin = (($q1->sales - $q1->cost) / $q1->sales)*100;
$db->query("UPDATE ecmproducts SET q1_margin='$margin', q1_qty='".$q1->qty."', q1_val='".$q1->sales."', q1_cost='".$q1->cost."' WHERE id='".$p->id."'");
//q2
$q2r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) IN ('4', '5', '6')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$q2 = $q2r->fetch_object();
//update
$margin = 0;
if ($q2->sales > 0)
$margin = (($q2->sales - $q2->cost) / $q2->sales)*100;
$db->query("UPDATE ecmproducts SET q2_margin='$margin', q2_qty='".$q2->qty."', q2_val='".$q2->sales."', q2_cost='".$q2->cost."' WHERE id='".$p->id."'");
//q3
$q3r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) IN ('7', '8', '9')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$q3 = $q3r->fetch_object();
//update
$margin = 0;
if ($q3->sales > 0)
$margin = (($q3->sales - $q3->cost) / $q3->sales)*100;
$db->query("UPDATE ecmproducts SET q3_margin='$margin', q3_qty='".$q3->qty."', q3_val='".$q3->sales."', q3_cost='".$q3->cost."' WHERE id='".$p->id."'");
//q4
$q4r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) IN ('10', '11', '12')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$q4 = $q4r->fetch_object();
//update
$margin = 0;
if ($q4->sales > 0)
$margin = (($q4->sales - $q4->cost) / $q4->sales)*100;
$db->query("UPDATE ecmproducts SET q4_margin='$margin', q4_qty='".$q4->qty."', q4_val='".$q4->sales."', q4_cost='".$q4->cost."' WHERE id='".$p->id."'");
//this month
$tmr = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) = '".(date('m'))."'
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$tm = $tmr->fetch_object();
//update
$margin = 0;
if ($tm->sales > 0)
$margin = (($tm->sales - $tm->cost) / $tm->sales)*100;
$db->query("UPDATE ecmproducts SET this_month_margin='$margin', this_month_qty='".$tm->qty."', this_month_val='".$tm->sales."', this_month_cost='".$tm->cost."' WHERE id='".$p->id."'");
//last month
$last_month = date("m")-1;
if ($last_month == 0) $last_month=12;
$lmr = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y"))."'
AND MONTH(i.register_date) = '$last_month'
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$lm = $lmr->fetch_object();
//update
$margin=0;
if ($lm->cost>0)
$margin = (($lm->sales - $lm->cost) / $lm->sales);
$db->query("UPDATE ecmproducts SET last_month_margin = '$margin', last_month_qty='".$lm->qty."', last_month_val='".$lm->sales."', last_month_cost='".$lm->cost."' WHERE id='".$p->id."'");
//laaast
//q1
$last_q1r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y")-1)."'
AND MONTH(i.register_date) IN ('1', '2', '3')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$last_q1 = $last_q1r->fetch_object();
//update
$margin = 0;
if ($last_q1->sales > 0)
$margin = (($last_q1->sales - $last_q1->cost) / $last_q1->sales)*100;
$db->query("UPDATE ecmproducts SET last_q1_margin='$margin', last_q1_qty='".$last_q1->qty."', last_q1_val='".$last_q1->sales."', last_q1_cost='".$last_q1->cost."' WHERE id='".$p->id."'");
//last_q2
$last_q2r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y")-1)."'
AND MONTH(i.register_date) IN ('4', '5', '6')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$last_q2 = $last_q2r->fetch_object();
//update
$margin = 0;
if ($last_q2->sales > 0)
$margin = (($last_q2->sales - $last_q2->cost) / $last_q2->sales)*100;
$db->query("UPDATE ecmproducts SET last_q2_margin='$margin', last_q2_qty='".$last_q2->qty."', last_q2_val='".$last_q2->sales."', last_q2_cost='".$last_q2->cost."' WHERE id='".$p->id."'");
//last_q3
$last_q3r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y")-1)."'
AND MONTH(i.register_date) IN ('7', '8', '9')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$last_q3 = $last_q3r->fetch_object();
//update
$margin = 0;
if ($last_q3->sales > 0)
$margin = (($last_q3->sales - $last_q3->cost) / $last_q3->sales)*100;
$db->query("UPDATE ecmproducts SET last_q3_margin='$margin', last_q3_qty='".$last_q3->qty."', last_q3_val='".$last_q3->sales."', last_q3_cost='".$last_q3->cost."' WHERE id='".$p->id."'");
//last_q4
$last_q4r = $db->query("
SELECT
sum(
CASE WHEN i.type!='correct'
THEN
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto
ELSE
ii.total_netto*i.currency_value
END
ELSE
CASE WHEN i.currency_value is null or i.currency_value='' or i.currency_value=0
THEN
ii.total_netto-ii.old_total_netto
ELSE
(ii.total_netto-ii.old_total_netto)*i.currency_value
END
END
) as sales,
sum(
CASE WHEN i.type!='correct'
THEN
ii.quantity
ELSE
quantity_corrected
END
) as qty,
sum(
CASE WHEN i.type!='correct'
THEN
ii.price_purchase*quantity
ELSE
ii.price_purchase*quantity_corrected
END
) as cost
FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON i.id=ii.ecminvoiceout_id
WHERE
YEAR(i.register_date) = '".(date("Y")-1)."'
AND MONTH(i.register_date) IN ('10', '11', '12')
AND i.deleted=0
AND i.canceled=0
AND ii.deleted='0'
AND ii.ecmproduct_id = '".$p->id."'
");
$last_q4 = $last_q4r->fetch_object();
//update
$margin = 0;
if ($last_q4->sales > 0)
$margin = (($last_q4->sales - $last_q4->cost) / $last_q4->sales)*100;
$db->query("UPDATE ecmproducts SET last_q4_margin='$margin', last_q4_qty='".$last_q4->qty."', last_q4_val='".$last_q4->sales."', last_q4_cost='".$last_q4->cost."' WHERE id='".$p->id."'");
}
?>

9
modules/EcmProducts/cd.php Executable file
View File

@@ -0,0 +1,9 @@
<?php
if($_REQUEST['set']!="" && $_REQUEST['record']!=""){
echo "?";
$w=$GLOBALS['db']->query("update ecmproducts set active='".$_REQUEST['set']."' where id='".$_REQUEST['record']."'");
}
header("Location: index.php?action=index&module=EcmProducts");
?>

View File

@@ -0,0 +1,45 @@
<?php
$code = trim($_REQUEST['code']);
$db = $GLOBALS['db'];
if (strlen($code)<7) {
echo '0';
return;
}
$res = $db->fetchByAssoc($db->query("SELECT count(id) as c FROM ecmproducts WHERE UPPER(code)='".strtoupper($code)."'"));
if (intval($res['c'])!=0) {
echo '0';
return;
}
//pod podobny
$res = $db->fetchByAssoc($db->query("SELECT count(id) as c FROM ecmproducts WHERE UPPER(code) LIKE '".strtoupper($code)."%'"));
if (intval($res['c'])!=0) {
echo '2';
return;
}
$type = substr($code,0,2);
$res = $db->fetchByAssoc($db->query("
select code_number from ecmproducts where code like '$type%'
and deleted='0'
and product_active = '1'
order by code_number desc limit 0,1;
"));
$number = intval($res['code_number'])+1;
$c_number = intval(substr($code, -5));
if ($c_number > $number) {
echo '0';
return;
}
echo '1';
return;
?>

View File

24
modules/EcmProducts/ean.php Executable file
View File

@@ -0,0 +1,24 @@
<?php
$tds1='<td valign="top" class="listViewThS1" style="vertical-align:top;">';
$trs='<tr onmouseover="this.style.backgroundColor=\'#cccccc\';" onmouseout="this.style.backgroundColor=\'#ffffff\';">';
$tre='</tr>';
$tds='<td valign="top" class="oddListRowS1" style="border-bottom:1px solid #cccccc;vertical-align:top;">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
echo $tbs;
echo $trs.$tds1.'<b>Indeks</b>'.$tde.$tds1.'<b>Nazwa</b>'.$tde.$tds1.'<b>Kategoria</b>'.$tde.$tds1.'<b>EAN</b>'.$tde.$tre;
$w=$GLOBALS['db']->query("select name,code,id,product_category_name,product_category_id from ecmproducts where product_active='1' and code!='' and code is not null order by code asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$ean="";
$eans=array();
$ww=$GLOBALS['db']->query("select ean from ecmproduct_language where ean!='' and ean is not null and ecmproduct_id='".$r['id']."'");
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
if($rr['ean'])$eans[$rr['ean']]=$rr['ean'];
}
$ean=implode("<br>",$eans);
echo $trs.$tds.$r['code'].$tde.$tds.'<a href="index.php?module=EcmProducts&action=DetailView&record='.$r['id'].'">'.$r['name'].'</a>'.$tde.$tds.'<a href="index.php?module=EcmProductCategories&action=DetailView&record='.$r['product_category_id'].'">'.$r['product_category_name'].'</a>'.$tde.$tds.$ean.'&nbsp;'.$tde.$tre;
}
echo $tbe;
?>

View File

@@ -0,0 +1,265 @@
<?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.
********************************************************************************/
$fields_array['EcmProduct'] = array (
'column_fields' => Array(
"id",
"name",
"date_entered",
"date_modified",
"modified_user_id",
"assigned_user_id",
"created_by",
//NEW COLUMN FIELDS
"code",
"product_category_id",
"product_category_name",
"product_subcategory_id",
"product_subcategory_name",
"product_line_id",
"product_line_name",
"manufacturer_id",
"manufacturer_name",
"contact_id",
"contact_name",
"vendor_id",
"vendor_name",
"vendor_part_no",
"product_active",
"sales_start_date",
"sales_end_date",
"parent_type",
"parent_id",
"parent_name",
"website",
"part_no",
"serial_no",
"exchange_rate_id",
"exchange_rate_name",
"fob_price",
"purchase_price",
"ems_price",
"commission_rate",
"custom_duty_rate",
"srp_price",
"srp_price_eur",
"srp_promo_price",
"tax_class_id",
"tax_class_name",
"usage_unit_id",
"usage_unit_name",
"qty_in_stock",
"qty_in_demand",
"ems_qty_in_stock",
"reorder_level",
"sales_last_month_1",
"sales_last_month",
"sales_this_month",
"qty_per_unit",
"average_sale_3_months",
"sales_plus_1",
"sales_plus_2",
"sales_plus_3",
"product_picture",
"packing_front_picture",
"driver_1",
"driver_2",
"moq",
"fob_basis_id",
"fob_basis_name",
"delivery_time_fob",
"pieces_per_carton",
"product_netto_weight",
"product_brutto_weight",
"packing_type_id",
"packing_type_name",
"packing_dimensions_1",
"packing_dimensions_2",
"packing_dimensions_3",
"rma",
"carton_dimensions_1",
"carton_dimensions_2",
"carton_dimensions_3",
"carton_netto_weight",
"carton_brutto_weight",
"carton_volume_meter",
"carton_volume_feet",
"country_of_origin",
"certificate_of_origin",
"form_a",
"vat_id",
"vat_value",
"vat_name",
"selling_price",
"ems_ordered",
"stock_month",
"lead_time",
"production",
"description_card",
"characteristic_card",
"specification_card",
"used_to_card",
"image_card",
"end_of_line",
"status",
"flag",
"add_status",
"description",
"th",
"ean"
),
'list_fields' => Array(
'id',
'name',
'assigned_user_name',
'assigned_user_id',
//NEW LIST_FIELDS
'code',
'product_category_id',
'product_category_name',
'product_subcategory_id',
'product_subcategory_name',
'product_line_id',
'product_line_name',
'manufacturer_id',
'manufacturer_name',
'contact_id',
'contact_name',
'vendor_id',
'vendor_name',
'vendor_part_no',
'product_active',
'sales_start_date',
'sales_end_date',
'parent_type',
'parent_id',
'parent_name',
'website',
'part_no',
'serial_no',
'exchange_rate_id',
'exchange_rate_name',
'fob_price',
'purchase_price',
'ems_price',
'commission_rate',
'custom_duty_rate',
'srp_price',
'srp_price_eur',
'srp_promo_price',
'tax_class_id',
'tax_class_name',
'usage_unit_id',
'usage_unit_name',
'qty_in_stock',
'qty_in_demand',
'ems_qty_in_stock',
'reorder_level',
'sales_last_month_1',
'sales_last_month',
'sales_this_month',
'qty_per_unit',
'average_sale_3_months',
'sales_plus_1',
'sales_plus_2',
'sales_plus_3',
'product_picture',
'packing_front_picture',
'driver_1',
'driver_2',
'moq',
'fob_basis_id',
'fob_basis_name',
'delivery_time_fob',
'pieces_per_carton',
'product_netto_weight',
'product_brutto_weight',
'packing_type_id',
'packing_type_name',
'packing_dimensions_1',
'packing_dimensions_2',
'packing_dimensions_3',
'rma',
'carton_dimensions_1',
'carton_dimensions_2',
'carton_dimensions_3',
'carton_netto_weight',
'carton_brutto_weight',
'carton_volume_meter',
'carton_volume_feet',
'country_of_origin',
'certificate_of_origin',
'form_a',
'vat_id',
'vat_value',
'vat_name',
'selling_price',
'ems_ordered',
'stock_month',
'lead_time',
'production',
"description_card",
"characteristic_card",
"specification_card",
"used_to_card",
"image_card",
"end_of_line",
"status",
"flag",
"add_status",
"description",
"th",
"ean"
),
'required_fields' => array(
'name'=>1
),
);
?>

View File

@@ -0,0 +1,25 @@
<?php
$w=$GLOBALS['db']->query("select
l.long_description,
p.name,
p.code,
p.product_category_name
from ecmproducts as p inner join ecmproduct_language as l on l.ecmproduct_id=p.id
where
p.deleted='0' and
(l.long_description!='' or l.long_description is not null) and
(l.language='PL' or l.language='pl') and
p.product_active='1' and
p.production!=1 and
p.end_of_line!=1
order by p.product_category_name asc,p.code asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
echo "<div>
".$r['code']."<br>
".$r['name']."<br>
".$r['product_category_name']."<br>
".str_replace("&lt;","<",str_replace("&gt;",">",$r['long_description']))."
</div>
<br>";
}
?>

View File

@@ -0,0 +1,335 @@
<?php
$module = $_REQUEST['module'];
$cM = $_REQUEST['createModule'];
$lA = $_REQUEST['loaderAction'];
$fN = $_REQUEST['loaderFieldName'];
$record = $_REQUEST['record'];
if($lA == "EditView") {
ob_start();
$_REQUEST['module'] = $cM;
$_REQUEST['action'] = "EditView";
$_REQUEST['record'] = $record;
$_POST['module'] = $cM;
$_POST['action'] = "EditView";
$_POST['record'] = $record;
$_GET['record'] = $record;
include('index.php');
$out = ob_get_contents();
ob_end_clean();
echo $out;
return;
}
if($lA == "get_module_fields") {
global $beanList, $beanFiles;
$file = 'cache/modules/'.$cM.'/'.$beanList[$cM].'vardefs.php';
if(file_exists($file)) {
include($file);
$dict = $GLOBALS['dictionary'][$beanList[$cM]]['fields'];
}
else {
$file = 'modules/'.$cM.'/vardefs.php';
if(file_exists($file)) { include($file); $dict = $dictionary[$beanList[$cM]]['fields']; } else return;
}
$file = $beanFiles[$beanList[$cM]];
if(file_exists($file)) {
require_once($file);
$bean = new $beanList[$cM]();
$bean->retrieve($record);
if(isset($bean->id) && $bean->id != '') {
$arr = array();
foreach($dict as $key => $value) {
if(isset($bean->$value['name']) && (is_string($bean->$value['name']) || is_float($bean->$value['name']) || is_int($bean->$value['name']) || is_bool($bean->$value['name'])))
$arr[$value['name']] = $bean->$value['name'];
}
$json = getJSONobj();
echo '['.str_replace('&quot;','\"',$json->encode($arr)).']';
} else return;
}
return;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<title></title>
<script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s=5.0.0c&c="></script>
</head>
<body>
<div id="hidder" style="position:absolute;left:0;top:0;width:105%;height:100%;background-color:white;visibility:visible;text-align:center;padding:40px;"><img src="themes/default/images/loading.gif"/></div>
<script language="javascript">
function doRequest(where,post,success,error) {
this.Display = function(result) { success(result.responseText); }
this.Fail = function(result){ if(error) error(result); }
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function iframeLoad() {
var frame = document.getElementById("input_create");
var doc = frame.contentDocument;
if(typeof(doc) == "undefined" || !doc)
doc = frame.contentWindow.document;
//alert(doc.forms.DetailView);
if(doc && doc.forms && ((doc.forms.EditView || doc.forms.DetailView || doc.forms.Save) || doc.return_module_fields)) {
if(doc.forms.EditView) {
} else
if(doc.forms.DetailView) {
var record = doc.forms.DetailView.record;
if(record && record.value != "") {
doRequest(
"index.php",
"module="+module+"&action=formloader&loaderAction=get_module_fields&createModule="+cM+"&to_pdf=1&record="+record.value,
function(result) {
if(result == '')
window.close();
else {
var obj = eval(result);
if(obj) {
obj = obj[0];
eval('window.opener.'+fN+'.responseData(obj)');
}
window.close();
}
},
function(result) {
window.close();
}
);
} else window.close();
} else
if(doc.forms.Save) {
}
} else { window.close(); return; }
var main = doc.getElementById('main');
if(main) {
var dd = doc.createElement('div');
dd.innerHTML = '<table style="width:100%;"><tr id="main2"></tr></table>';
doc.body.insertBefore(dd,doc.body.firstChild);
doc.getElementById('main2').appendChild(main);
main.style.position = 'absolute';
main.style.left = 0;
main.style.top = 0;
for(var i=1; i<doc.body.childNodes.length; i++) if(doc.body.childNodes[i] !== main && doc.body.childNodes[i].style) {
doc.body.childNodes[i].style.visibility = 'hidden';
}
if(doc && doc.forms && !doc.forms.DetailView) doc.body.FormLoader = true;
}
}
var oldLocation = '';
setInterval(function(){
var frame = document.getElementById("input_create");
if(frame) {
var doc = frame.contentDocument;
if(doc == undefined || doc == null)
doc = frame.contentWindow.document;
if(doc && doc.body && doc.body.FormLoader) {
if(hidder.style.visibility = "visible") hidder.style.visibility = "hidden";
} else {
if(hidder.style.visibility = "hidden") hidder.style.visibility = "visible"
}
}
},60);
</script>
<?php
if($lA == "ViewForm") {
echo '<script language="javascript">
var module = "'.$module.'";
var cM = "'.$cM.'";
var lA = "'.$lA.'";
var fN = "'.$fN.'";
</script>';
$data = '';
foreach($_REQUEST as $key=>$value) {
if(strpos($key,"fl_") === 0) {
$data .= "&".substr($key,3)."=".$value;
}
}
echo "<iframe onload='iframeLoad();' frameborder='no' width='100%' height='100%' id='input_create' name='input_create' src='index.php?module=$module&action=formloader&to_pdf=1&loaderAction=EditView&createModule=$cM".$data."'></iframe>";
}
?>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<?php
$type = substr($_REQUEST['code'], 0,2);
$type = strtoupper($type);
echo $type."<br><br>";
$db = $GLOBALS['db'];
for ($i=0; $i<10000; $i++) {
$s = (string) $i;
while (strlen($s) < 5)
$s = '0'.$s;
$res = $db->query("SELECT id FROM ecmproducts WHERE code='".$type.$s."'");
$e = '';
if ($res->num_rows==0) {
$ress = $db->query("SELECT code FROM ecmproducts WHERE code LIKE '".$type.$s."%'");
while ($rr = $db->fetchByAssoc($ress))
$e.=$rr['code'].'&nbsp;&nbsp;&nbsp;';
if ($ress->num_rows>0)
$e = '&nbsp;&nbsp;&nbsp;('.$e.')';
echo $type.$s.$e.'<br>';
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
include_once("modules/EcmProducts/productCardUltraNew.php");
include_once("include/MPDF57/mpdf.php");
$p=new mPDF('utf-8','A4-L', null, 'helvetica');
if ($_REQUEST['price']=='srp_price')
$price = "";
else
$price = $_REQUEST['price'];
$p=productCardNew($p,$_REQUEST['record'],$_GET['language'],true,true,$price,"",$_REQUEST['show_price'], $_REQUEST['ean'], $_REQUEST['simage']);
$p->Output();
return;
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);
if($_REQUEST['create_img']==1){
exec("convert -density 120 -quality 100 /var/www/html/crm/".$file." /var/www/html/crm/".str_replace(".pdf",".jpg",$file));
chmod(str_replace(".pdf",".jpg",$file),0777);
header("Location: index.php?module=EcmProducts&action=showProductsCardImages&to_pdf=1&guid=".$guid);
}
?>

View File

@@ -0,0 +1,8 @@
<?php
include_once("modules/EcmProducts/productCardNew.php");
include_once("include/html2fpdf/html2fpdf.php");
$p=new HTML2FPDF();
$p->SetAutoPageBreak(10);
$p=contentView($p,$_GET['category_id'],$_GET['lang'],$_GET['record']);
$p->Output(str_replace(" ","_",$_GET['category_name'])."-".$_GET['lang'].".pdf","D");
?>

View File

@@ -0,0 +1,69 @@
<?php
if ($_REQUEST['fromEdit']==1) generateEAN();
function generateEAN($validate = 0) {
$country_code = '590';
$company_code = '0488';
$res = $GLOBALS['db']->query("SELECT ean, ean2 FROM ecmproducts;");
$used_ean = array();
while ($r = $GLOBALS['db']->fetchByAssoc($res)) {
if ((strlen($r['ean'])==13) && (intval($r['ean'])!=0)) $used_ean[] = substr($r['ean'],7,5);
if ((strlen($r['ean2'])==13) && (intval($r['ean'])!=0)) $used_ean[] = SUBSTR($r['ean2'],7,5);
}
//if validate !=0 don't add current values to $used_ean
if ($validate==0) {
if (strlen($_REQUEST['ean'])==13) $used_ean[] = substr($_REQUEST['ean'],7,5);
if (strlen($_REQUEST['ean2'])==13) $used_ean[] = substr($_REQUEST['ean2'],7,5);
}
if ($validate==2)
if (strlen($_REQUEST['ean'])==13) $used_ean[] = substr($_REQUEST['ean'],7,5);
//find max of last eans
$max=0;
foreach ($used_ean as $ue)
if ($ue>$max) $max=$ue;
//echo $max;
$new=$max+1;
//new_ean
$ne = array();
//country code
$ne[0]=5;
$ne[1]=9;
$ne[2]=0;
//company code
$ne[3]=0;
$ne[4]=4;
$ne[5]=8;
$ne[6]=8;
//new product code
$ne[7]=intval(substr($new,0,1));
$ne[8]=intval(substr($new,1,1));
$ne[9]=intval(substr($new,2,1));
$ne[10]=intval(substr($new,3,1));
$ne[11]=intval(substr($new,4,1));
//calculate check sum value
$h1 = $ne[11]+$ne[9]+$ne[7]+$ne[5]+$ne[3]+$ne[1];
$h2 = $h1*3;
$h3 = $ne[10]+$ne[8]+$ne[6]+$ne[4]+$ne[2]+$ne[0];
$h4 = $h2+$h3;
$h5=$h4;
//ZAOKR.GÓRA :)
if ($h5 % 10 != 0)
while ($h5 % 10 != 0) {
$h5++;
}
$ne[12]=$h5-$h4;
$ean ='';
foreach ($ne as $v)
$ean.=$v;
echo $ean;
return $ean;
}
?>

View File

@@ -0,0 +1,12 @@
<?php
include_once("modules/EcmProducts/productCardNew.php");
include_once("include/html2fpdf/html2fpdf.php");
$p=new HTML2FPDF("L");
$p->SetAutoPageBreak(10);
$w=$GLOBALS['db']->query("select p.id as id from ecmproducts as p inner join ecmpricebooks_ecmproducts as c on c.ecmproduct_id=p.id where p.product_active=1 and c.ecmpricebook_id='5a7c1379-a50b-3ce6-f96b-4ce4e7a9496a' and (p.product_category_name like '".$_GET['cat']."%') and p.deleted='0' and c.deleted='0' order by p.product_category_name asc,p.code asc,p.name asc");
//$w=$GLOBALS['db']->query("select id from ecmproducts where product_category_name like '".$_GET['cat']."%' and deleted='0' and product_active='1'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$p=productCardNew($p,$r['id'],$_GET['lang']);
}
$p->Output(str_replace(" ","_",$_GET['cat'])."-".$_GET['lang'].".pdf","D");
?>

View File

@@ -0,0 +1,134 @@
<?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 ecmpricebooks as q on q.exchange_rate_id=c.id where q.id='".$_REQUEST['record']."'"));
$symbol=$rr['s'];
$result = $GLOBALS['db']->query("select * from ecmpricebooks_customview where id='".$_GET['customview_id']."'");
$row=$GLOBALS['db']->fetchByAssoc($result);
$c=explode("||",$row['columns']);
$t=explode("||",$row['titles']);
$o=explode("||",$row['orders']);
if($_COOKIE['customview_id']!=$_GET['customview_id'] || $_SESSION['customview_id']=="" || !$_GET['order_by'])
{
$pbo=array();
for($i=0;$i<=8;$i++)
{
if($o[$i])
{
$exp=explode(" ",$o[$i]);
$adesc=$exp[1];
$ord=$exp[0];
if($ord=="list_price")$pbo[]="ecmpricebooks_ecmproducts.price ".$adesc;
else $pbo[]="ecmproducts.".$ord." ".$adesc;
}
}
$_SESSION['pricebook_order']=implode(",",$pbo);
}
setcookie('customview_id',$_GET['customview_id'],time()+60*24*60*3600);
$order=$_SESSION['pricebook_order'];
$order=str_replace("ecmproducts.margin_rate","margin_rate",$order);
if($_REQUEST['order_by']){
$order=str_replace($_REQUEST['order_by']." desc",$_REQUEST['order_by']." ".$_REQUEST['sorder'],$order);
$order=str_replace($_REQUEST['order_by']." asc",$_REQUEST['order_by']." ".$_REQUEST['sorder'],$order);
}
$_SESSION['pricebook_order']=$order;
if($_REQUEST['order_by'] && $_REQUEST['sorder'])$_SESSION['pricebook_order']=$_REQUEST['order_by']." ".$_REQUEST['sorder'];
$where="i.deleted='0' and";
if(count($_SESSION['pricebook_check'][$_SESSION['pricebook_id']])>0)
{
foreach($_SESSION['pricebook_check'][$_SESSION['pricebook_id']] as $key=>$value){
if($_SESSION['pricebook_check'][$_SESSION['pricebook_id']][$key]!="true" && $_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']=="true"){
$where_clauses[]="i.id!='".$key."'";
$orand=' and ';
}
elseif($_SESSION['pricebook_check'][$_SESSION['pricebook_id']][$key]=="true" && $_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']!="true"){
$where_clauses[]="i.id='".$key."'";
$orand=' or ';
}
}
if(count($where_clauses)>0)$where="(".implode($orand,$where_clauses).") and ";
elseif($_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']!="true" && count($where_clauses)==0)$where="ecmpricebooks_ecmproducts.id='9999999999999999' and ";
}
else $where="i.id='9999999999999999' and ";
if($_SESSION['pricebook_order'])$order=" order by ".$_SESSION['pricebook_order'];
$z="select distinct i.ecmproduct_id,i.price,p.product_category_id,p.th from ecmpricebooks_ecmproducts as i inner join ecmproducts as p on p.id=i.ecmproduct_id inner join ecmpricebooks_ecmproducts_categories_sort as c on c.category_id=p.product_category_id where ".$where." i.ecmpricebook_id='".$_REQUEST['record']."' and i.deleted='0' order by c.position asc,i.position asc";
$num=mysql_num_rows($GLOBALS['db']->query($z));
$w=$GLOBALS['db']->query($z);
$cat="";
$i=0;
if($_REQUEST['header']==1){
$rwt=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query($z));
$p=catalogueHeader($p,$rwt['th']);
}
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$id=$r['ecmproduct_id'];
if($_GET['price']=="srp_price")$r['price']="";
/*
if(($cat!=$r['product_category_id'] || $cat=="") && $_REQUEST['title']==1){
if($_REQUEST['extra']==1 && $cat!=""){
if(categoryExtra($p,$cat,$th)){
$p->AddPage();
$p->Image("modules/EcmProducts/".categoryExtra($p,$cat,$th),5,0,283);
}
}
$p->AddPage();
$p=categoryTitle($p,$r['product_category_id'],$r['th']);
}
$cat=$r['product_category_id'];
$th=$r['th'];
*/
//add mz 05-12-201
//exchange price if EUR
if ($_REQUEST['price']=="srp_price") {
$srp_price_result = $GLOBALS['db']->query("SELECT srp_price FROM ecmproducts WHERE id ='".$r['ecmproduct_id']."'");
$srp_price_row = $GLOBALS['db']->fetchByAssoc($srp_price_result);
//$price = $srp_price_row['srp_price'];
} else {
$price =number_format($r['price'], 2, ',', ' ');}
$exchange_result = $GLOBALS['db']->query("SELECT exchange_rate_id, currency_value FROM ecmpricebooks WHERE id='".$_SESSION['pricebook_id']."'");
$exchange_row=$GLOBALS['db']->fetchByAssoc($exchange_result);
if ($exchange_row['exchange_rate_id']=="5e72f103-1989-8b1f-dc9a-493fe7c7449f")
$price = $price * (1 / $exchange_row['currency_value']);
//$i++;
//if ($i<202) continue;
$p=productCardNew($p,$id,$_GET['language'],true,true,$_REQUEST['price'],$symbol,$_REQUEST['show_price'], $_REQUEST['ean']);
}
/*
if($_REQUEST['extra']==1){
if(categoryExtra($p,$cat,$th)){
$p->AddPage();
$p->Image("modules/EcmProducts/".categoryExtra($p,$cat,$th),5,0,283);
}
}
*/
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);
if($_REQUEST['create_img']==1){
exec("convert -density 120 -quality 100 /var/www/html/crm/".$file." /var/www/html/crm/".str_replace(".pdf",".jpg",$file));
chmod(str_replace(".pdf",".jpg",$file),0777);
header("Location: index.php?module=EcmProducts&action=showProductsCardImages&to_pdf=1&guid=".$guid);
}
?>

View File

@@ -0,0 +1,43 @@
<?php
include_once("modules/EcmProducts/productCardNew.php");
include_once("include/html2fpdf/html2fpdf.php");
$p=new HTML2FPDF("L");
$p->SetAutoPageBreak(10);
$rcat=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select product_category_id,th from ecmproducts where id='".$_REQUEST['record']."'"));
if($_REQUEST['header']==1){
$p=catalogueHeader($p,$rcat['th']);
}
if($_REQUEST['content']==1){
$p=catalogueContent($p);
}
if($_REQUEST['title']==1){
$p->AddPage();$p=categoryTitle($p,$rcat['product_category_id'],$rcat['th']);
}
$p=productCardNew($p,$_REQUEST['record'],$_GET['language'],true,true,"","",$_REQUEST['show_price'], $_REQUEST['ean']);
if($_REQUEST['extra']==1){
if(categoryExtra($p,$rcat['product_category_id'],$rcat['th'])){
$p->AddPage();
$p->Image("modules/EcmProducts/".categoryExtra($p,$rcat['product_category_id'],$rcat['th']),5,0,283);
}
}
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);
if($_REQUEST['create_img']==1){
echo "convert -density 120 -quality 100 /var/www/html/crm/".$file." /var/www/html/crm/".str_replace(".pdf",".jpg",$file);
exec("convert -density 120 -quality 100 /var/www/html/crm/".$file." /var/www/html/crm/".str_replace(".pdf",".jpg",$file));
chmod(str_replace(".pdf",".jpg",$file),0777);
//header("Location: index.php?module=EcmProducts&action=showProductsCardImages&to_pdf=1&guid=".$guid);
}
?>

View File

@@ -0,0 +1,60 @@
<?php
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 ecmquotes as q on q.currency_id=c.id where q.id='".$_REQUEST['record']."'"));
$symbol=$rr['s'];
$w=$GLOBALS['db']->query("select i.ecmproduct_id,i.price,p.product_category_id,p.th from ecmquoteitems as i inner join ecmproducts as p on p.id=i.ecmproduct_id where i.ecmquote_id='".$_REQUEST['record']."' and i.deleted='0' order by i.position asc");
$cat="";
if($_REQUEST['header']==1){
$rwt=$GLOBALS['db']->fetchByAssoc($wt);
$p=catalogueHeader($p,$rwt['th']);
}
echo 'lol';
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$id=$r['ecmproduct_id'];
if($_GET['price']=="srp_price")$r['price']="";
/*
if(($cat!=$r['product_category_id'] || $cat=="") && $_REQUEST['title']==1){
if($_REQUEST['extra']==1 && $cat!=""){
if(categoryExtra($p,$cat,$th)){
$p->AddPage();
$p->Image("modules/EcmProducts/".categoryExtra($p,$cat,$th),5,0,283);
}
}
$p->AddPage();
$p=categoryTitle($p,$r['product_category_id'],$r['th']);
}
*/
$cat=$r['product_category_id'];
$th=$r['th'];
$p=productCardNew($p,$id,$_GET['language'],true,true,$r['price'],$symbol,$_GET['show_price']);
}
if($_REQUEST['extra']==1){
if(categoryExtra($p,$cat,$th)){
$p->AddPage();
$p->Image("modules/EcmProducts/".categoryExtra($p,$cat,$th),5,0,283);
}
}
if($_REQUEST['create_img']==1){
$guid=create_guid();
$type="F";
$file="cache/upload/Catalogue".$guid.".pdf";
}
else{
$type="D";
$file="Catalogue.pdf";
}
$p->Output($file,$type);
if($_REQUEST['create_img']==1){
exec("convert -density 120 -quality 100 /var/www/html/e5crm/".$file." /var/www/html/e5crm/".str_replace(".pdf",".jpg",$file));
chmod(str_replace(".pdf",".jpg",$file),0777);
header("Location: index.php?module=EcmProducts&action=showProductsCardImages&to_pdf=1&guid=".$guid);
}
?>

View File

@@ -0,0 +1,12 @@
<?php
if (!$_REQUEST['product_code']) {echo '0'; return;}
$db = $GLOBALS['db'];
//get id
$pid = $db->fetchByAssoc($db->query("SELECT id FROM ecmproducts WHERE code='".$_REQUEST['product_code']."' AND deleted='0'"));
include('modules/EcmProduct.php');
$p = new EcmProduct();
$p->retrieve($pid['id']);
echo $p->getPositionList(false);
return;
?>

View File

@@ -0,0 +1,13 @@
<?php
$w=$GLOBALS['db']->query("select long_description,ecmproduct_id from ecmproduct_language where language='en' and deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id,code,name,product_active,status from ecmproducts where id='".$r['ecmproduct_id']."'"));
$s=str_replace("&lt;","<",$r['long_description']);
$s=str_replace("&gt;",">",$s);
$p=explode("<p>",$s);
$p=explode("</p>",$p[1]);
$p=$p[0];
if(eregi("
",$p) && $rr['product_active'] && $rr['status']!="end_of_line")echo '<a href="index.php?module=EcmProducts&action=EditView&record='.$rr['id'].'">'.$rr['code']." ".$rr['name']."</a><br>";
}
?>

View File

@@ -0,0 +1,9 @@
<?php
$result = $GLOBALS['db']->query("select * from ecmproductmodels where deleted='0' and parent_id='".$_REQUEST['id']."'");
$sm='<select name="models[]" multiple id="models" sieze="6">';
while($row=$GLOBALS['db']->fetchByAssoc($result)){
$sm.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
$sm.='</select>';
echo $sm;
?>

View File

@@ -0,0 +1,12 @@
<?php
if (!$_REQUEST['product_id'] || !$_REQUEST['product_id']) {echo 'error'; return;}
require_once('modules/EcmProducts/EcmProduct.php');
$prod = new EcmProduct();
$info = $prod->getProductResInfo($_REQUEST['product_id'], $_REQUEST['stock_id']);
$json = getJSONobj();
echo '['.$json->encode($info).']';
?>

View File

@@ -0,0 +1,12 @@
<?
$q=0;
$w=$GLOBALS['db']->query("select quantity_in,quantity_out from ecmstockins where product_id='".$_REQUEST['record']."' and stock_id='".$_REQUEST['stock_id']."'");
//print mysql_error();
while($r=$GLOBALS['db']->fetchByAssoc($w))
{
//print $r['quantity_in']." ".$r['quantity_out']."<BR>";
$qty=$r['quantity_in']-$r['quantity_out'];
$q+=$qty;
}
print $q;
?>

235
modules/EcmProducts/helper.js Executable file
View File

@@ -0,0 +1,235 @@
function insert_selected(U){
//alert(parent.opener.document.PositionList);
var arr=new Array();
var ajs=new Array();
var lv=document.getElementById('list_view');
var is=lv.getElementsByTagName('input');
var l=0;
var id;
for(var i=0;i<is.length;i++) {
if(is[i].type=='checkbox' && is[i].name=='mass[]' && is[i].checked==true) {
arr[l]=is[i].value;
id=associated_javascript_data[is[i].value];
ajs[l]=associated_javascript_data[is[i].value];
ajs[l].code=id['CODE'];
ajs[l].name=id['NAME'];
ajs[l].price=id['SELLING_PRICE'];
ajs[l].unit_id=id['UNIT_ID'];
ajs[l].vat_value=23;
ajs[l].ecmvat_value=23;
ajs[l].vat_name='23%';
ajs[l].ecmvat_name='23%';
ajs[l].vat_id='28079566-b825-e38f-9993-4ccc7b781de5';
ajs[l].ecmvat_id='28079566-b825-e38f-9993-4ccc7b781de5';
ajs[l].total=id['SELLING_PRICE'];
ajs[l].id=is[i].value;
l++;
}
}
var pl = ajs;
if(pl && pl != '') {
pl = eval(pl);
for(x in pl) {
var pl_row = pl[x];
// if(pl_row.vat_id)
U.addRow().setData(pl_row);
}
}
if(U.rowCount() == 0) U.addRow();
window.close();
}
function showdescription(id,title,desc,minus,object)
{
if(!minus)minus=0;
var sum=17-minus;
document.getElementById("desc").style.display="inline";
document.getElementById("desc-title").innerHTML=title;
document.getElementById("desc-desc").innerHTML=desc;
posy=findPosY(object)+sum;
posx=findPosX(object);
moveDiv(document.getElementById("desc"),posy,posx);
}
function hidedescription()
{
document.getElementById("desc").style.display="none";
}
function mintajaxget(url,tag)
{
var req=mint.Request();
req.Set('timeout',10000000);
req.Set('retryNum',0);
req.OnLoading=function(){$(tag).innerHTML='<img src="themes/default/images/loading.gif" border="0">';}
req.OnSuccess = function(){if($(tag).type=='text'){if(this.responseText!="")$(tag).value=this.responseText;}else{if(this.responseText!="")$(tag).innerHTML=this.responseText;}}
req.Send(url,tag);
}
function mintajaxpost(url,tag,form)
{
var req=mint.Request();
req.OnSuccess=function(){$(tag).innerHTML=this.responseText;}
req.OnLoading=function(){$(tag).innerHTML='<img src="themes/default/images/loading.gif" border="0">';}
req.SendForm(form);
}
function moveDiv(obj, mvTop, mvLeft) {
obj.style.position = "absolute";
obj.style.top = mvTop;
obj.style.left = mvLeft;
}
function getPos(inputElement) {
var coords = new Object();
coords.x = 0;
coords.y = 0;
try {
targetElement = inputElement;
if(targetElement.x && targetElement.y) {
coords.x = targetElement.x;
coords.y = targetElement.y;
} else {
if(targetElement.offsetParent) {
coords.x += targetElement.offsetLeft;
coords.y += targetElement.offsetTop;
while(targetElement = targetElement.offsetParent) {
coords.x += targetElement.offsetLeft;
coords.y += targetElement.offsetTop;
}
} else {
//alert("Could not find any reference for coordinate positioning.");
}
}
return coords;
} catch(error) {
//alert(error.msg);
return coords;
}
}
function findPosX(obj)
{
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
//return getPos(obj).x;
}
function findPosY(obj)
{
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
//return getPos(obj).y;
}
function showdiv(id,div,minusy,minusx)
{
document.getElementById(div).style.display="inline";
posy=findPosY(document.getElementById(id))-minusy;
posx=findPosX(document.getElementById(id))-minusx;
moveDiv(document.getElementById(div),posy,posx);
}
function hidediv(div)
{
document.getElementById(div).style.display="none";
}
function showprice(id,price,purchase_price,margin,remarks_pl,remarks_en,remarks_de,order_by,sorder,recipient_code)
{
document.getElementById('price').value=price;
document.getElementById('purchase_price').value=purchase_price;
document.getElementById('margin').value=margin;
document.getElementById('recipient_code').value=recipient_code;
document.getElementById('remarks_pl').value=remarks_pl;
document.getElementById('remarks_en').value=remarks_en;
document.getElementById('remarks_de').value=remarks_de;
document.getElementById('product_id').value=id;
document.getElementById('order_by').value=order_by;
document.getElementById('sorder').value=sorder;
document.getElementById('price-block').style.display="block";
}
function getPrice(id,type)
{
var purchase_price=document.getElementById('purchase_price_'+id).value;
var margin_rate=document.getElementById('margin_rate_'+id).value;
var list_price;
list_price=parseFloat(purchase_price)/(1-parseFloat(margin_rate)/100);
if(!isNaN(list_price))document.getElementById('list_price_'+id).value=roundNumber(list_price,2);
}
function getPricePricebook()
{
var purchase_price=document.getElementById('purchase_price').value;
var margin_rate=document.getElementById('margin').value;
var list_price;
margin_rate=margin_rate.replace(".","");
margin_rate=margin_rate.replace(",",".");
purchase_price=purchase_price.replace(".","");
purchase_price=purchase_price.replace(",",".");
list_price=parseFloat(purchase_price)/(1-parseFloat(margin_rate)/100);
if(!isNaN(list_price))document.getElementById('price').value=CurrencyFormatted(list_price);
}
function CurrencyFormatted(amount)
{
var i = parseFloat(amount);
if(isNaN(i)) { i = 0.00; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if(s.indexOf('.') < 0) { s += ',00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
s=s.replace(".",",");
return s;
}
function roundN(rnum,rlength)
{
var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
return newnumber;
}
function roundNumber(num, dec)
{
if(!isNaN(num))return CurrencyFormatted(roundN(parseFloat(num),dec));
else return "";
}
function ShowHideBlock(id)
{
if(document.getElementById(id).style.display=="block")
{
document.getElementById(id).style.display="none"
}
else
{
document.getElementById(id).style.display="block"
}
}
function generateEAN() {
alert('Coming soon! :)');
}

View File

@@ -0,0 +1 @@
<img src="index.php?module=EcmProducts&action=productCard&to_pdf=1" border="0" />

View File

@@ -0,0 +1,27 @@
<?
$w=$GLOBALS['db']->query("select * from productcf");
//426 ean, 414 long, 412 short, 500 remarks
//a:4:{s:2:"PL";s:99:"Lexmark 3100/ Z12/ Z22/ Z32/ Z705/ Z708/ Z710/ Z715/ P704/ P706/ P707/ P3120/ P3150/ P3150M
//Czarny";s:2:"DE";s:0:"";s:2:"EN";s:0:"";s:2:"RU";s:0:"";}
function gv($l,$txt){
$t=explode('"'.$l.'";s:',$txt);
$tt=explode(':"',$t[1]);
$ttt=explode('"',$tt[1]);
return $ttt[0];
}
$u=$_SESSION['authenticated_user_id'];
$d=date("Y-m-d H:i:s");
$arr=array("EN","PL","DE");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
foreach($arr as $a){
$sd[$a]=gv($a,$r['cf_412']);
$ld[$a]=gv($a,$r['cf_414']);
$re[$a]=gv($a,$r['cf_500']);
$ea[$a]=gv($a,$r['cf_426']);
print "insert into ecmproduct_language values('".create_guid()."','".$u."','".$u."','".$d."','".$d."','0','".$r['productid']."','".$a."','".$ea[$a]."','".$sd[$a]."','".$ld[$a]."','".$re[$a]."');<br>";
}
}
?>

36
modules/EcmProducts/index.php Executable file
View File

@@ -0,0 +1,36 @@
<?php
die('eee');
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
echo '
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<script language="javascript">
function showDiv(obj,value,inv_id){
var div=document.getElementById("div_desc");
document.getElementById("desc").value="";
document.getElementById("desc").value=document.getElementById("desc"+inv_id).value;
document.getElementById("inv_id").value=inv_id;
div.style.display="";
var x=findPosX(obj);
var y=findPosY(obj);
moveDiv(div,y,(x+10));
}
</script>';
echo '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;text-align:center;position:absolute;display:none;">';
echo '<textarea id="desc1" name="desc1" style="display:none;"></textarea><br />';
echo '<textarea id="desc" name="desc"></textarea><br />';
echo '<div id="result" style="display:none;"></div>';
echo '<input type="hidden" id="inv_id" />';
echo '<input type="button" class="button" value="Save" onclick="mintajaxget(\'index.php?to_pdf=1&module=EcmProducts&action=saveDesc&id=\'+document.getElementById(\'inv_id\').value+\'&desc=\'+document.getElementById(\'desc\').value,\'desc\'+document.getElementById(\'inv_id\').value);" />&nbsp;';
echo '<input type="button" class="button" value="Close" onclick="document.getElementById(\'div_desc\').style.display=\'none\';" />';
echo '</div>';
echo '<script type="text/javascript" src="cache/jsLanguage/EcmCalls/'.$current_language.'.js"></script>';
echo '<img id="EcmCalls_image_assign" src="modules/EcmCalls/images/assign_call.gif" style="display:none;" />';
echo '<img id="EcmCalls_image_search" src="modules/EcmCalls/images/search_call.gif" style="display:none;" />';
echo '<script type="text/javascript" src="include/JSON.js"></script>';
echo '<script type="text/javascript" src="modules/EcmCalls/Hint.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/DoCall.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/ListView.js"></script>';
echo '<link rel="stylesheet" type="text/css" href="modules/EcmCalls/Hint.css" />';
require_once('modules/EcmProducts/ListView.php');
?>

36
modules/EcmProducts/index1.php Executable file
View File

@@ -0,0 +1,36 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
echo '
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<script language="javascript">
function showDiv(obj,value,inv_id){
var div=document.getElementById("div_desc");
document.getElementById("desc").value="";
document.getElementById("desc").value=document.getElementById("desc"+inv_id).value;
document.getElementById("inv_id").value=inv_id;
div.style.display="";
var x=findPosX(obj);
var y=findPosY(obj);
moveDiv(div,y,(x+10));
}
</script>';
echo '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;text-align:center;position:absolute;display:none;">';
echo '<textarea id="desc1" name="desc1" style="display:none;"></textarea><br />';
echo '<textarea id="desc" name="desc"></textarea><br />';
echo '<div id="result" style="display:none;"></div>';
echo '<input type="hidden" id="inv_id" />';
echo '<input type="button" class="button" value="Save" onclick="mintajaxget(\'index.php?to_pdf=1&module=EcmProducts&action=saveDesc&id=\'+document.getElementById(\'inv_id\').value+\'&desc=\'+document.getElementById(\'desc\').value,\'desc\'+document.getElementById(\'inv_id\').value);" />&nbsp;';
echo '<input type="button" class="button" value="Close" onclick="document.getElementById(\'div_desc\').style.display=\'none\';" />';
echo '</div>';
echo '<script type="text/javascript" src="cache/jsLanguage/EcmCalls/'.$current_language.'.js"></script>';
echo '<img id="EcmCalls_image_assign" src="modules/EcmCalls/images/assign_call.gif" style="display:none;" />';
echo '<img id="EcmCalls_image_search" src="modules/EcmCalls/images/search_call.gif" style="display:none;" />';
echo '<script type="text/javascript" src="include/JSON.js"></script>';
echo '<script type="text/javascript" src="modules/EcmCalls/Hint.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/DoCall.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/ListView.js"></script>';
echo '<link rel="stylesheet" type="text/css" href="modules/EcmCalls/Hint.css" />';
require_once('modules/EcmProducts/ListView.php');
?>

View File

@@ -0,0 +1,476 @@
function searchCode(start_from) {
url='index.php?module=EcmProducts&action=searchCode&start='+start_from+'&to_pdf=1';
var req=mint.Request();
req.OnSuccess = function() {
document.getElementById("code").value = this.responseText;
};
req.Send(url);
}
function checkCode(code) {
if (document.forms.EditView.record.value!="") return;
url='index.php?module=EcmProducts&action=checkCode&code='+code+'&to_pdf=1';
var req=mint.Request();
req.OnSuccess = function() {
if (this.responseText=='0') alert(MOD.LBL_CODE_ERROR);
if (this.responseText=='2') alert('Istnieje kod typu: '+code+'_-----');
};
req.Send(url);
}
function freeCodes(code) {
window.open("index.php?module=EcmProducts&action=freeCodes&code="+code, "_blank");
}
function getBaseComponents(type) {
if (type == 1)
var code = OPT.base_code;
if (type == 2)
var code = document.getElementById("components_code").value;
url='index.php?module=EcmProducts&action=getBaseComponents&product_code='+code+'&to_pdf=1';
var req=mint.Request();
req.OnSuccess = function() {
ItemListClear();
OPT.base_code = null;
try {
pl = eval(this.responseText);
for(x in pl) { var pl_row = pl[x]; if(!pl[x].code || pl[x].code == '') {} else N.addRow().setData(pl_row); }
} catch(err) { pl = null; };
};
req.Send(url);
}
function SetTabIndexs() {
var main = document.getElementById('main');
var td = main.getElementsByTagName('td');
var selectedTable = null;
//var selectingColor = 'red';
//var selectingCellTable = 'green';
var TableIndex = 0;
for(var i=0; i<td.length; i++) {
if(td[i].className == 'tabEditViewDF') {
var TI = 0;
if(td[i].parentNode.cells.item(1) == td[i]) TI = 101+TableIndex; else TI = 102+TableIndex;
var nodes = td[i].getElementsByTagName('input');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('select');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('textarea');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
if(td[i].parentNode.parentNode.parentNode !== selectedTable) {
//if(selectingColor == 'red') selectingColor = 'blue'; else selectingColor = 'red';
selectedTable = td[i].parentNode.parentNode.parentNode;
TableIndex++;
}
}
}
}
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function set_focus() { document.getElementById('name').focus(); }
function my_popup(module, field_array, met, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 900, 700, met, true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function findPos(obj) {
var nleft = 0;
var ntop = 0;
if (obj.offsetParent) {
nleft = obj.offsetLeft
ntop = obj.offsetTop
while (obj = obj.offsetParent) {
nleft += obj.offsetLeft
ntop += obj.offsetTop
}
}
return [nleft,ntop];
}
function cursorEOT(isField) {
isRange = isField.createTextRange();
isRange.move('textedit');
isRange.select();
testOverflow = isField.scrollTop;
if (testOverflow != 0){return true}
else {return false}
}
function adjustRows(isField) {
while (cursorEOT(isField)){isField.rows++}
}
function insertText(isField,isText) {
isField.value = testText;
isField.focus();
}
function changer() {
this.list = new Object();
this.add = function(object,type,do_function,start_value) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) return;
this.list[object.id] = new Object();
this.list[object.id].object = object;
this.list[object.id].type = type;
this.list[object.id].do_function = do_function;
this.list[object.id].start_value = start_value;
this.list[object.id].value = '';
}
this.getValue = function(element) {
var value = null;
if(element.object) {
if(element.type == "innerHTML") value = element.object.innerHTML;
if(element.type == "value") value = element.object.value;
if(element.type == "checked") value = element.object.checked;
}
return value;
}
this.interval = 1000;
this.timer = null;
this.startTimer = function() {
var cc = this;
this.timer = setInterval(
function(){
var list = cc.list;
for(x in list) {
if(list[x].start_value) {
list[x].value = cc.getValue(list[x]);
list[x].start_value = false;
}
else {
var value = cc.getValue(list[x]);
if(list[x].value !== value)
if(list[x].do_function)
list[x].do_function(list[x].object);
list[x].value = value;
}
}
},
this.interval
);
}
this.stopTimer = function () {
clearInterval(this.timer);
this.timer = null;
}
}
var ERROR = false;
var ItemListSave = function(json) { }
function ShowLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(!slv) {
slv = document.createElement('div');
slv.id = 'ShowLoadingView';
slv.className = 'transparent_class_loading';
slv.style.width = '100%';
slv.style.height = '500%';
var sli = document.createElement('img');
sli.className = 'transparent_class_loading_image';
sli.src = 'themes/default/images/loading.gif';
slv.appendChild(sli);
document.body.appendChild(slv);
}
slv.style.display = '';
}
function HideLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(slv) slv.style.display = 'none';
}
function SaveForm() {
ShowLoadingView();
setTimeout( function() {
if(OPT['checkbox_demo'] == 1 && document.forms.EditView.record.value == '') { alert(MOD.LBL_DEMO_VERSION_INFORMATION); return; }
ERROR = false;
//document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert(MOD['LBL_SAVE_FORM_ERROR']); HideLoadingView(); return false; }
document.forms.EditView.action.value = 'Save';
if(check_form('EditView')) {
var result = confirm(MOD.LBL_CONFIRM_QUESTION);
if(result) document.forms.EditView.status.value = (OPT['auto_commiting']?'s30':'s20');
doRequest('index.php',getFormPost('Save'),function(result){
document.forms.EditView.record.value = result.substring(result.length-36);
alert(MOD['LBL_SAVED']);
if(OPT['setEmailTab']) setEMAIL(true); else window.location = 'index.php?module='+document.forms.EditView.module.value+'&action=DetailView&record='+document.forms.EditView.record.value;
},
MOD['LBL_NOT_SAVED']
);
} else { alert(MOD['LBL_NOT_SAVED']); HideLoadingView(); return false; }
},200);
}
function ItemListClear() {
while(N.rowCount()>0) N.row(0).deleteRow();
}
function getFormPost(action) {
if(!action) action = 'previewPDF';
var pd = 'to_pdf=1'+'&module=EcmQuotes&action='+action+'&record='+document.forms.EditView.record.value;
pd += '&cache=fromJava'+ItemListSave(true);
var pd2 = new Object();
pd2['module'] = 'EcmQuotes';
pd2['action'] = action;
pd2['record'] = document.forms.EditView.record.value;
pd2['to_pdf'] = '1';
pd2['cache'] = 'fromJava';
document.forms.EditView.position_list.value = '';
document.forms["EditView"].action.value = action;
var tmp;
for(var i=0; i<document.forms["EditView"].elements.length; i++) {
tmp = document.forms["EditView"].elements[i];
if(tmp.name != '') {
if(tmp.type == "checkbox")
pd2[document.forms["EditView"].elements[i].name] =(document.forms["EditView"].elements[i].checked ? '1' : '0');
else
pd2[document.forms["EditView"].elements[i].name] = document.forms["EditView"].elements[i].value;
}
}
pd += '&otherFormData='+JSON.stringifyNoSecurity(pd2);
return pd;
}
/*
function sendFormPostToPdf() {
ShowLoadingView();
setTimeout( function() {
ERROR = false;
//document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); HideLoadingView(); return false; }
doRequest("index.php",getFormPost(),function(result){
HideLoadingView();
SetTab('PREVIEW');
EcmPreviewPDF('index.php?module=EcmQuotes&action=previewPDF&to_pdf=1&from=EcmQuotes',{zoom:75});
}
);
}, 200);
}*/
function sendFormPostToPdf() {
ERROR = false;
document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); return false; }
doRequest("index.php",getFormPost(),function(result){
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
//SetTab('PREVIEW');
EcmPreviewPDF('index.php?module=EcmQuotes&action=previewPDF&to_pdf=1&from=EcmQuotes',{zoom:75});
}
else{
SetTab('PREVIEW');
document.getElementById('previewPDF').innerHTML = "<iframe style='border:none;width:100%;height:1200px;' frameborder='no' src='index.php?module=EcmQuotes&action=previewPDF&to_pdf=1&from=EcmQuotes#zoom=75'>Yours browser not accept iframes!</iframe>";
}
}
);
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_quotes) {
alert('This option is disabled for You.');
document.forms.EditView.status.value = ((OPT.old_status)?OPT.old_status:'');
}
OPT.old_status = document.forms.EditView.status.value;
}
function CheckDiscount(noAlert) {
var discount = 0;
var tmp = UserFormatNumberToNumber(document.getElementById('discount').value);
if(tmp == -1) {
if(!noAlert)
alert(MOD['LBL_DISCOUNT_ERROR']+' ('+document.getElementById('discount').value+')');
discount = -1;
document.getElementById('discount').style.color = 'red';
} else {
discount = tmp;
document.getElementById('discount').value = NumberToUserFormatNumber(discount);
document.getElementById('discount').style.color = 'black';
}
return discount;
}
//document.getElementById('previewPDF').innerHTML = "<iframe style='border:0px; width:100%; height:100%;' src='index.php?module=EcmInvoiceOuts&action=InvoicePDFPreview&to_pdf=1'>Yours browser not accept iframes!</iframe>";
//ProductListSave();
//YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},this.postData());
var AjaxSearchProducts;
var parentFL;
var productFL;
var contactFL;
addEvent(
window,
'load',
function () {
var CHANGER = new changer();
CHANGER.interval = 500;
set_focus();
//initialize table
//N = new MyTable('itemsTable');
//N.divParent = document.getElementById('itemsTableDIV');
var from_popup_return = false;
function returnedData(popup_reply_data) {
from_popup_return = true;
var form_name = popup_reply_data.form_name;
var name_to_value_array = popup_reply_data.name_to_value_array;
for (var the_key in name_to_value_array) {
if(the_key == 'toJSON'){}
else {
var displayValue=name_to_value_array[the_key].replace(/&amp;/gi,'&').replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/&#039;/gi,'\'').replace(/&quot;/gi,'"');;
var e = document.getElementById(the_key);
if(e) { e.value = displayValue; }
}
}
//if(N.selectedRow) N.selectedRow.calculateTotal();
};
var itd = document.getElementById('itemsTableDIV');
itd.onscroll = function() {
if(!AjaxSearchProducts.AjaxSearchFrozen)
if(N.selectedCell && N.selectedCell.LeftPosition && N.selectedCell.TopPosition) {
var top = N.selectedCell.TopPosition+N.selectedCell.offsetHeight;
if(((N.selectedCell.offsetTop+N.selectedCell.offsetHeight-this.scrollTop) > (this.offsetHeight+5)) || ((N.selectedCell.offsetTop-this.scrollTop) < (-10)))
AjaxSearchProducts.div.style.display = 'none';
else
AjaxSearchProducts.div.style.display = '';
AjaxSearchProducts.div.style.top = top - this.scrollTop;
}
}
ItemListSave = function(json) {
//if(CheckDiscount() == -1) { ERROR = true; return false; }
//calculateTotal();
var data = new Object();
for(var i=0; i<N.rowCount(); i++) {
data[i.toString()] = N.row(i).getData();
}
return json ? JSON.stringifyNoSecurity(data) : data;
}
var sqs_objects = [];
sqs_objects["code_p"] = {
"method":"get_product_array",
"modules":["EcmProducts"],
"field_list":["date_entered", "code", "id", "encoded_unit_id", "vat_id", "encoded_category_id", "name", "selling_price", "currency_id"],
"populate_list":["code_p", "code_p", "id_p", "unit_id_p", "vat_id_p", "category_id_p", "name_p", "price_p", "currency_id_p"],
"conditions":[{"name":"code","op":"like_custom","end":"%","value":""}],
"limit":"30",
"order":"code",
"no_match_text":"No Match"
};
sqs_objects["name_p"] = {
"method":"get_product_array",
"modules":["EcmProducts"],
"field_list":["date_entered", "name", "id", "encoded_unit_id", "vat_id", "encoded_category_id", "code", "selling_price", "currency_id"],
"populate_list":["name_p", "name_p", "id_p", "unit_id_p", "vat_id_p", "category_id_p", "code_p", "price_p", "currency_id_p"],
"conditions":[{"name":"name","op":"like_custom","end":"%","value":""}],
"limit":"30",
"order":"name",
"no_match_text":"No Match"
};
function generateNumber() {
if(document.getElementById('template_id').value == '') { alert('There are no DocumentTemplates in data base!'); return;}
doRequest(
'index.php',
'to_pdf=1&generate=1&module=EcmQuotes&action=generateNumber&type=normal&template_id='+document.getElementById('template_id').value+'&record='+document.forms.EditView.record.value,
function(result){
var arr = eval(result)[0];
document.getElementById('number').value = arr.number;
document.getElementById('document_no').value = arr.document_no;
},
''
);
};
//create Product
productFL = new FormLoader();
productFL.load('EcmQuotes','Parents','productFL');
productFL.onResponseData = function(data) {
data.price = data.selling_price;
data.quantity = '1';
N.selectedRow.setData(data);
N.selectedRow.calculateTotal();
};
CHANGER.startTimer();
var check_form_ = check_form;
check_form = function(formname) {
CTABLE.saveItems();
ATABLE.saveItems();
// return false;
if ((document.getElementById('group_ks').value)=='0') {
alert('Grupa księgowa nie może być pusta!');
return false;
}
//document.forms.EditView.position_list.value = ItemListSave(true);
saveItems3();
saveItems4();
return check_form_(formname);
}
}
);

View File

@@ -0,0 +1,213 @@
function addEvent(object, eventName, do_function) {
if (typeof (object) == "string") object = document.getElementById(object);
if (!object) { alert('No object in function addEvent!'); return; }
if (object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on' + eventName, do_function);
}
}
function findPos(obj) {
var nleft = 0;
var ntop = 0;
if (obj.offsetParent) {
nleft = obj.offsetLeft
ntop = obj.offsetTop
while (obj = obj.offsetParent) {
nleft += obj.offsetLeft
ntop += obj.offsetTop
}
}
return [nleft, ntop];
}
function cursorEOT(isField) {
isRange = isField.createTextRange();
isRange.move('textedit');
isRange.select();
testOverflow = isField.scrollTop;
if (testOverflow != 0) { return true }
else { return false }
}
function adjustRows(isField) {
while (cursorEOT(isField)) { isField.rows++ }
}
function insertText(isField, isText) {
isField.value = testText;
isField.focus();
}
var ERROR = false;
var ItemListSave = function (json) { }
function ItemListClear() {
while (N.rowCount() > 0) N.row(0).deleteRow();
}
var AjaxSearchProducts;
var parentFL;
var productFL;
var contactFL;
addEvent(
window,
'load',
function () {
/*
N.onCreateCell = function (cell) {
var i = cell.index;
cell.change = function (select) { };
cell.style.height = OPT['row_item_height'];
cell.noSelect = true;
if (i == 0) {
cell.setData = function (data) {
if (data.index) cell.firstChild.value = data.index;
};
cell.getData = function (data) {
data.index = cell.firstChild.value;
}
cell.select = function () { this.selectNext(); }
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('readOnly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 1) {
cell.getData = function (data) {
var cn = this.getElementsByTagName('input');
data.code = cn[0].value;
data.id = cn[1].value;
data.unit_id = cn[2].value;
data.vat_id = cn[3].value;
data.category_id = cn[4].value;
}
cell.setData = function (data) {
var cn = this.getElementsByTagName('input');
if (data.code) cn[0].value = data.code;
if (data.id) cn[1].value = data.id;
if (data.unit_id) cn[2].value = data.unit_id;
if (data.vat_id) cn[3].value = data.vat_id;
if (data.category_id) cn[4].value = data.category_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" autocomplete="off" >';
cell.innerHTML = edit;
cell.align = 'right';
var id = document.createElement('input');
id.setAttribute('type', 'hidden');
cell.appendChild(id);
var unit_id = document.createElement('input');
unit_id.setAttribute('type', 'hidden');
unit_id.setAttribute('value', OPT['default_unit']);
cell.appendChild(unit_id);
var vat_id = document.createElement('input');
vat_id.setAttribute('type', 'hidden');
vat_id.setAttribute('value', OPT['default_vat']);
cell.appendChild(vat_id);
var category_id = document.createElement('input');
category_id.setAttribute('type', 'hidden');
category_id.setAttribute('value', OPT['default_category']);
cell.appendChild(category_id);
var img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_IMG_SEARCH']);
img.setAttribute('src', 'modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
window.open("index.php?module=EcmProducts&action=DetailView&record=" + cell.getElementsByTagName('input')[1].value);
};
cell.appendChild(img);
calculateTotal = function () {
var product_total = 0;
var work_total = 0;
var total = 0;
var red = false;
for (var i = 0; i < N.rowCount(); i++) {
var data = N.row(i).getData();
if (data.ems_price > 0) {
var t = data.quantity * data.ems_price;
if (data.category_id == 'd7f876b0-1a3d-43a1-7c9b-511ba40df3d1')
work_total += t;
else
product_total += t;
total += t;
}
else red = true;
}
document.getElementById('total_all').value = NumberToUserFormatNumber(total);
document.getElementById('total_products').value = NumberToUserFormatNumber(product_total);
document.getElementById('total_work').value = NumberToUserFormatNumber(work_total);
if (red) document.getElementById('subtotal').style.color = 'red';
}
calculateTotal();
}
}
*/
}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
getCopyElements = function() {
PTABLE = new EcmJsTable(pcolumns, $('#copyProduct'), 'EditView');
PTABLE.customQuickSearch = function(search) {
// clear previous data
this.items = new Array();
// AJAX call
var a = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'searchProduct',
searchText : search,
},
dataType : 'json',
async : false,
});
return $.parseJSON(a.responseText);
}
PTABLE.setItems(new Array());
PTABLE.getHeaders();
PTABLE.fillTable();
// create butons
var b = $('<input></input>');
b.addClass('button');
b.attr('type', 'button');
b.css('width', '100%');
b.val('Komponenty');
b
.click(function() {
var prod = PTABLE.getItems();
if (prod.length == 0 || !prod[0].product_id
|| prod[0].product_id == "") {
alert('Wybierz produkt źródłowy');
return;
}
if (CTABLE.getItemsCount() > 0)
var keepitems = confirm("Zachować aktualne komponenty?");
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsComponents',
prod_id : prod[0].product_id,
},
dataType : 'json',
async : false,
});
var response = $.parseJSON(i.responseText);
if (response.length==0) {alert('Brak komponentów dla '+prod[0].product_code); return;}
if (keepitems) {
var items = CTABLE.getItems();
$.each(response, function(c, i) {
items.push(i)
});
} else
var items = response;
CTABLE.setItems(items);
CTABLE.fillTable();
});
$('#copyButtons').append(b);
$('#copyButtons').append('<br>');
//czynności
var b = $('<input></input>');
b.addClass('button');
b.attr('type', 'button');
b.css('width', '100%');
b.val('Czynności');
b
.click(function() {
var prod = PTABLE.getItems();
if (prod.length == 0 || !prod[0].product_id
|| prod[0].product_id == "") {
alert('Wybierz produkt źródłowy');
return;
}
if (ATABLE.getItemsCount() > 0)
var keepitems = confirm("Zachować aktualne komponenty?");
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsActions',
prod_id : prod[0].product_id,
},
dataType : 'json',
async : false,
});
var response = $.parseJSON(i.responseText);
if (response.length==0) {alert('Brak czynności dla '+prod[0].product_code); return;}
if (keepitems) {
var items = ATABLE.getItems();
$.each(response, function(c, i) {
items.push(i)
});
} else
var items = response;
ATABLE.setItems(items);
ATABLE.fillTable();
});
$('#copyButtons').append(b);
}
var pcolumns = new Array();
// end: number
// begin: code
pcolumns[0] = {
'name' : 'product_',
'label' : 'Kopiuj elementy z: ',
'searchTrigger' : true,
'width' : 100, // %
'content' : new Array(),
};
pcolumns[0]['content'][0] = {
'name' : 'id',
'attr' : {
'type' : 'hidden',
}
};
pcolumns[0]['content'][1] = {
'name' : 'code',
'css' : {
'text-align' : 'left',
}
};

View File

@@ -0,0 +1,77 @@
getProductionSummary = function() {
STABLE = new EcmJsTable(columns, $('#summaryTable'),
'DetailView');
//calculate summary
var comp = 0;
var act_n = 0;
var act_b = 0;
var total_n = 0;
var total_b = 0;
var components = CTABLE.getItems();
$.each(components, function(i, c) {
comp+=c.quantity*c.purchase_price;
});
var actions = ATABLE.getItems();
$.each(actions, function(i, a) {
act_n+=a.quantity*a.price_netto;
act_b+=a.quantity*a.price_brutto;
});
total_n = comp + act_n;
total_b = comp + act_b;
var items = new Array();
items[0] = new Array();
items[0]['name'] = 'Wartość komponentów';
items[0]['value'] = comp;
items[1] = new Array();
items[1]['name'] = 'Wartość czynności - netto';
items[1]['value'] = act_n
items[2] = new Array();
items[2]['name'] = 'Wartość czynności - brutto';
items[2]['value'] = act_b;
items[3] = new Array();
items[3]['name'] = 'Suma netto';
items[3]['value'] = total_n;
items[4] = new Array();
items[4]['name'] = 'Suma brutto';
items[4]['value'] = total_b;
STABLE.setItems(items);
STABLE.getHeaders();
STABLE.fillTable();
//hide table header
STABLE.container.find('#EcmJsItemsTable > thead').remove();
//set align right
STABLE.container.find('#itemsTableDIV').attr('align', 'right');
}
var columns = new Array();
//end: number
//begin: code
columns[0] = {
'name' : 'name',
'label' : '',
'width' : 50, // %
'content' : new Array(),
};
columns[0]['content'][0] = {
'name' : '',
'css' : {
'text-align' : 'left',
'background-color' : 'rgb(224,240,255)',
}
};
columns[1] = {
'name' : 'value',
'label' : '',
'width' : 50, // %
'content' : new Array(),
};
columns[1]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 4,
'css' : {
'text-align' : 'right',
}
};

View File

@@ -0,0 +1,536 @@
$(document)
.ready(
function() {
// get EcmJsTable class if it isn't loaded yet.
if (typeof window["EcmJsTable"] === 'undefined') {
$.ajax({
async : false,
url : "include/ECM/EcmJsTable/EcmJsTable.class.js",
dataType : "script"
});
}
// get number functions if it isn't loaded yet.
if (typeof window["FormatNumber"] === 'undefined') {
$.ajax({
async : false,
url : "include/ECM/EcmNumberFunctions.js",
dataType : "script"
});
}
// is Detail or Edit View??
if ($('form[name="EditView"]').length == 1)
var type = 'EditView';
else
var type = 'DetailView';
// setup components table
CTABLE = new EcmJsTable(ccolumns, $('#componentsTable'),
type);
CTABLE.updateItems = function(){
}
CTABLE.customQuickSearch = function(search) {
// AJAX call
var a = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'searchComponents',
searchText : search,
},
dataType : 'json',
async : false,
});
return $.parseJSON(a.responseText);
}
// create save function
CTABLE.customSave = function(items, prod_id) {
// AJAX call
jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'saveItemsComponents',
items : items,
prod_id : prod_id
},
dataType : 'json',
async : false,
});
}
// get components
CTABLE.getComponents = function(row_index) {
var prod = CTABLE.getItems();
product_id = prod[row_index].product_id;
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsComponents',
prod_id : product_id,
},
dataType : 'json',
async : false,
});
var response = $.parseJSON(i.responseText);
if (response.length == 0) {
alert('Brak komponentów dla '
+ prod[row_index].product_code);
return;
}
prod.splice(row_index, 1);
var newItems = insertArrayAt(prod, row_index, response);
CTABLE.setItems(newItems);
CTABLE.fillTable();
}
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsComponents',
prod_id : $('[name=record]').val(),
},
dataType : 'json',
async : false,
});
CTABLE.setItems($.parseJSON(i.responseText));
CTABLE.getHeaders();
CTABLE.fillTable();
// setup actions table
ATABLE = new EcmJsTable(acolumns, $('#actionsTable'), type);
ATABLE.customQuickSearch = function(search) {
// AJAX call
var a = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'searchActions',
searchText : search,
},
dataType : 'json',
async : false,
});
return $.parseJSON(a.responseText);
}
// create save function
ATABLE.customSave = function(items, prod_id) {
// AJAX call
jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'saveItemsActions',
items : items,
prod_id : prod_id
},
dataType : 'json',
async : false,
});
}
// get components
ATABLE.getComponents = function(row_index) {
var prod = ATABLE.getItems();
console.log(prod[row_index]);
action_id = prod[row_index].action_id;
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsActions',
prod_id : action_id,
},
dataType : 'json',
async : false,
});
var response = $.parseJSON(i.responseText);
console.log(response);
if (response.length == 0) {
alert('Brak komponentów dla '
+ prod[row_index].action_code);
return;
}
prod.splice(row_index, 1);
var newItems = insertArrayAt(prod, row_index, response);
CTABLE.setItems(newItems);
CTABLE.fillTable();
}
var i = jQuery
.ajax({
type : 'POST',
url : 'index.php?module=EcmProducts&action=ProductionTablesHelper&to_pdf=1',
data : {
job : 'getItemsActions',
prod_id : $('[name=record]').val(),
},
dataType : 'json',
async : false,
});
ATABLE.setItems($.parseJSON(i.responseText));
ATABLE.getHeaders();
ATABLE.fillTable();
if (type == 'DetailView')
getProductionSummary(); // in ProductionSummary.js
if (type == 'EditView')
getCopyElements(); // in ProductionCopyElements.js
});
// helper
function insertArrayAt(array, index, arrayToInsert) {
Array.prototype.splice.apply(array, [ index, 0 ].concat(arrayToInsert));
return array;
}
// components table columns
var ccolumns = new Array();
// define columns
// begin: number
ccolumns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 5, // %
'content' : new Array(),
};
ccolumns[0]['content'][0] = {
'name' : '',
'type' : 'text',
'readonly' : true
};
// end: number
// begin: code
ccolumns[1] = {
'name' : 'product_',
'label' : 'Indeks',
'width' : 14, // %
'searchTrigger' : true,
'content' : new Array(),
};
ccolumns[1]['content'][0] = {
'name' : 'code',
'attr' : {
'type' : 'hidden',
}
};
ccolumns[1]['content'][1] = {
'name' : 'id',
'attr' : {
'type' : 'hidden',
}
};
ccolumns[1]['content'][2] = {
'name' : 'link',
'readonly' : true,
'css' : {
'text-align' : 'left'
}
};
ccolumns[1]['content'][3] = {
'name' : 'custom',
'customCodeEdit' : '<img src="modules/EcmSales/images/add_position.gif" onClick="CTABLE.getComponents({{row_index}});" style="cursor:pointer"/>',
};
ccolumns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'searchTrigger' : true,
'width' : 40, // %
'content' : new Array(),
};
ccolumns[2]['content'][0] = {
'name' : '',
'readonly' : true,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'left',
}
};
ccolumns[3] = {
'name' : 'unit',
'label' : 'J.M.',
'width' : 3, // %
'content' : new Array(),
};
ccolumns[3]['content'][0] = {
'name' : '',
'readonly' : true,
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'left'
}
};
ccolumns[4] = {
'name' : 'quantity_recipe',
'label' : 'Ilość receptura',
'width' : 9, // %
'content' : new Array(),
};
ccolumns[4]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 6,
'quantity':true,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'right'
},
'onChange': '$(this).val(QuantityFormat($(this).val(),6));CTABLE.setRowDate(this,$(this).parent(\'td\').parent(\'tr\').index());'
};
ccolumns[5] = {
'name' : 'divider',
'label' : 'Dzielnik',
'width' : 9, // %
'content' : new Array(),
};
ccolumns[5]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 6,
'quantity':true,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'right'
},
'onChange': '$(this).val(QuantityFormat($(this).val(),6));CTABLE.setRowDate(this,$(this).parent(\'td\').parent(\'tr\').index());'
};
ccolumns[6] = {
'name' : 'quantity',
'label' : 'Ilość',
'width' : 9, // %
'content' : new Array(),
};
ccolumns[6]['content'][0] = {
'name' : '',
'dataType' : 'number',
'quantity':true,
'precision' : 6,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'right'
},
'readonly':true
};
ccolumns[7] = {
'name' : 'purchase_price',
'label' : 'Sr. cena zakupu',
'width' : 9, // %
'content' : new Array(),
};
ccolumns[7]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 2,
'readonly' : true,
'attr' : {
'type' : 'text',
'hint' : 'test'
},
'css' : {
'text-align' : 'right'
},
};
ccolumns[7]['content'][1] = {
'name' : '_document',
'readonly' : true,
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
},
};
ccolumns[8] = {
'showIn' : 'DetailView',
'name' : 'total',
'label' : 'Wartość',
'width' : 9, // %
'content' : new Array(),
};
ccolumns[8]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 6,
'readonly' : true,
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
}
};
ccolumns[9] = {
'name' : 'options',
'label' : 'Opcje',
'width' : 5, // %
'content' : new Array(),
};
var acolumns = new Array();
// define columns
// begin: number
acolumns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 5, // %
'content' : new Array(),
};
acolumns[0]['content'][0] = {
'name' : '',
'type' : 'text',
'readonly' : true
};
// end: number
// begin: code
acolumns[1] = {
'name' : 'action_',
'label' : 'Indeks',
'width' : 14, // %
'searchTrigger' : true,
'content' : new Array(),
};
acolumns[1]['content'][0] = {
'name' : 'code',
'attr' : {
'type' : 'hidden',
}
};
acolumns[1]['content'][1] = {
'name' : 'id',
'attr' : {
'type' : 'hidden',
}
};
acolumns[1]['content'][2] = {
'name' : 'link',
'readonly' : true,
'css' : {
'text-align' : 'left'
}
};
acolumns[1]['content'][3] = {
'name' : 'custom',
'customCodeEdit' : '<img src="modules/EcmSales/images/add_position.gif" onClick="ATABLE.getComponents({{row_index}});" style="cursor:pointer"/>',
};
acolumns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'searchTrigger' : true,
'width' : 40, // %
'content' : new Array(),
};
acolumns[2]['content'][0] = {
'name' : '',
'readonly' : true,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'left',
}
};
acolumns[3] = {
'name' : 'quantity',
'label' : 'Ilość',
'width' : 9, // %
'content' : new Array(),
};
acolumns[3]['content'][0] = {
'name' : '',
'dataType' : 'number',
'precision' : 2,
'attr' : {
'type' : 'text'
},
'css' : {
'text-align' : 'right'
}
};
acolumns[4] = {
'name' : 'price_netto',
'label' : 'Cena netto',
'width' : 9, // %
'content' : new Array(),
};
acolumns[4]['content'][0] = {
'name' : '',
'readonly' : true,
'dataType' : 'number',
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
}
};
acolumns[5] = {
'name' : 'price_brutto',
'label' : 'Cena brutto',
'width' : 9, // %
'content' : new Array(),
};
acolumns[5]['content'][0] = {
'name' : '',
'readonly' : true,
'dataType' : 'number',
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
}
};
acolumns[6] = {
'showIn' : 'DetailView',
'name' : 'total_netto',
'label' : 'Wartość netto',
'width' : 9, // %
'content' : new Array(),
};
acolumns[6]['content'][0] = {
'name' : '',
'readonly' : true,
'dataType' : 'number',
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
}
};
acolumns[7] = {
'showIn' : 'DetailView',
'name' : 'total_brutto',
'label' : 'Wartość brutto',
'width' : 9, // %
'content' : new Array(),
};
acolumns[7]['content'][0] = {
'name' : '',
'readonly' : true,
'dataType' : 'number',
'attr' : {
'type' : 'text',
},
'css' : {
'text-align' : 'right'
}
};
acolumns[8] = {
'name' : 'options',
'label' : 'Opt',
'width' : 5, // %
'content' : new Array(),
};

View File

@@ -0,0 +1,164 @@
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 900, 700, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function FormLoader() {
this.module;
this.createModule;
this.fieldName;
this.buttonName = 'FormLoaderButton';
this.load = function(module,createModule,fieldName) {
this.module = module;
this.createModule = createModule;
this.fieldName = fieldName;
}
this.createButton = function() {
var b = document.createElement('input');
b.type = 'button';
b.className = 'button';
b.name = this.buttonName;
b.value = 'Create';
b.FL = this;
b.onclick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onButtonClick) var data = this.FL.onButtonClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
return b;
}
this.setEditDblClick = function(edit) { edit.FL=this; edit.ondblclick=this.editDblClick; }
this.editDblClick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onEditDblClick) var data = this.FL.onEditDblClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
this.responseData = function(data) {
if(this.onResponseData) this.onResponseData(data);
}
this.onResponseData;
this.addPostData = function() {
if(this.onAddPostData)
return this.onAddPostData();
else
return '';
}
this.onAddPostData;
this.onButtonClick;
}

View File

@@ -0,0 +1,200 @@
function openProductCard(productId) {
window.open(`index.php?module=EcmProducts&action=DetailView&record=${productId}`).focus();
}
function searchByIndex(index) {
$("#index").val(index);
$("#productId").val(CODES.find(x => x.code === $("#index").val())?.id);
$("#searchByIndexForm").submit();
}
function addProductToAddress() {
if (!isProductValid("#addProductInput")) {
return;
}
if (!isAddressValid("#address")) {
return;
}
const productId = CODES.find(x => x.code === $("#addProductInput").val())?.id;
$("#loader").show();
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=addAddress&to_pdf=1&productId=" + productId + "&address=" + $("#address").val(),
}).done(function (data) {
$("#loader").hide();
var res = JSON.parse(data);
if (res.status === 'Error') {
alert('Błąd: ' + res.msg);
} else {
$("#searchByAddressForm").submit();
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.');
});
}
function removeProductFromAddress() {
if (!isAddressValid("#address")) {
return;
}
$("#loader").show();
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=removeAddress&to_pdf=1&address=" + $("#address").val(),
}).done(function (data) {
$("#loader").hide();
var res = JSON.parse(data);
if (res.status === 'Error') {
alert('Błąd: ' + res.msg);
} else {
$("#searchByAddressForm").submit();
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.')
});
}
function removeAddressFromProduct(address) {
$("#loader").show();
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=removeAddress&to_pdf=1&address=" + address,
}).done(function (data) {
$("#loader").hide();
var res = JSON.parse(data);
if (res.status === 'Error') {
alert('Błąd: ' + res.msg);
} else {
$("#searchByIndexTrigger").click();
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.');
});
}
function addAddressToProduct() {
if (!isProductValid("#index")) {
return;
}
const productId = CODES.find(x => x.code === $("#index").val())?.id;
if (!isAddressValid("#newAddress")) {
return;
}
const isNotFull = $("#isNotFull").is(':checked') ? 1 : 0;
$("#loader").show();
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=addAddress&to_pdf=1&productId=" + productId + "&address=" + $("#newAddress").val() + "&isNotFull=" + isNotFull,
}).done(function (data) {
$("#loader").hide();
var res = JSON.parse(data);
if (res.status === 'Error') {
alert('Błąd: ' + res.msg);
} else {
$("#searchByIndexTrigger").click();
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.')
});
}
function setAddressIsNotFull(address, checkbox) {
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=setIsNotFull&to_pdf=1&address=" + address + "&isNotFull=" + $(checkbox).is(':checked'),
}).done(function (data) {
$("#loader").hide();
var res = JSON.parse(data);
console.log(res);
if (res.status === 'Error') {
alert('Błąd: ' + res.msg);
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.')
});
}
function isAddressValid(id) {
if (!id) { id = "#address"; }
if ($(id).val().length < 9) {
$(id + "Error").html("Błędny format [ __.__._._ ]");
return false;
}
const segments = $(id).val().split(".");
if (parseInt(segments[0]) > 17) {
$(id + "Error").html("Błąd pierwszego segmentu [zakres 01-20]");
return false;
}
if (parseInt(segments[1]) > 15) {
$(id + "Error").html("Błąd drugiego segmentu [zakres 01-15]");
return false;
}
return true;
}
function isProductValid(id) {
if (!id) { id = "#index"; }
const index = $(id).val();
if (CODES.find(x => x.code === index)) {
return true;
} else {
$(id + "Error").html("Niepoprawny indeks produktu [Produkt musi być aktywny]");
return false;
}
}
$(document).ready(function () {
$("#address").mask("AB.CD.E.F", {
placeholder: "__.__._._",
translation: {
A: { pattern: /[0-2]/ },
B: { pattern: /[0-9]/ },
C: { pattern: /[0-1]/ },
D: { pattern: /[0-9]/ },
E: { pattern: /[1-5]/ },
F: { pattern: /[0-5]/ },
}
});
if ($("#newAddress")) {
$("#newAddress").mask("AB.CD.E.F", {
placeholder: "__.__._._",
translation: {
A: { pattern: /[0-2]/ },
B: { pattern: /[0-9]/ },
C: { pattern: /[0-1]/ },
D: { pattern: /[0-9]/ },
E: { pattern: /[1-5]/ },
F: { pattern: /[0-5]/ },
}
});
$("#newAddress").focus(() => $("#newAddressError").html(""));
$("#newAddress").blur(() => isAddressValid("#newAddress"));
}
$("#address").focus(() => $("#addressError").html(""));
$("#index").focus(() => $("#indexError").html(""));
$("#index").autocomplete({
source: CODES.map(x => x.code),
minLength: 4,
max: 20,
scroll: true
});
if ($("#addProductInput")) {
$("#addProductInput").autocomplete({
source: CODES.map(x => x.code),
minLength: 4,
max: 20,
scroll: true
});
$("#addProductInput").focus(() => $("#addProductInputError").html(""));
}
$("#searchByAddressTrigger").click(() => {
if (isAddressValid()) {
$("#searchByAddressForm").submit();
}
});
$("#searchByIndexTrigger").click(() => {
if (isProductValid()) {
$("#productId").val(CODES.find(x => x.code === $("#index").val())?.id);
$("#searchByIndexForm").submit();
}
});
$('[name^="showAddress').click((event) => {
$("#address").val(event.target.name.split('-')[1]);
if (isAddressValid()) {
$("#searchByAddressForm").submit();
}
});
//bind buttons
});

View File

@@ -0,0 +1,508 @@
<?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_PRODUCTION_PANEL' => 'Production elements',
'LBL_ACTIONS' => 'Actions',
'LBL_QRCODE' => 'QR',
'LBL_SELLING_Q1_INFORMATION' => 'Selling Q1',
'LBL_SELLING_LAST_Q1_INFORMATION' => 'Selling Q1 (last)',
'LBL_SELLING_Q2_INFORMATION' => 'Selling Q2',
'LBL_SELLING_LAST_Q2_INFORMATION' => 'Selling Q2 (last)',
'LBL_SELLING_Q3_INFORMATION' => 'Selling Q3',
'LBL_SELLING_LAST_Q3_INFORMATION' => 'Selling Q3 (last)',
'LBL_SELLING_Q4_INFORMATION' => 'Selling Q4',
'LBL_SELLING_LAST_Q4_INFORMATION' => 'Selling Q4 (last)',
'LBL_SELLING_THIS_MONTH_INFORMATION' => 'Selling this month',
'LBL_SELLING_THIS_YEAR_INFORMATION' => 'Selling this year',
'LBL_SELLING_LAST_YEAR_INFORMATION' => 'Selling last year',
'LBL_SELLING_LAST_MONTH_INFORMATION' => 'Selling last month',
'LBL_SELL_VALUE' => 'Value',
'LBL_SELL_QUANTITY' => 'Qunaity',
'LBL_SELL_COST' => 'Cost',
'LBL_SELL_MARGIN' => 'Margin',
'LBL_ALLEGRO' => 'Allegro Template',
'LBL_IS_MAINPRODUCT' => 'Is mainproduct',
'LBL_SEARCH_CODE' => 'Search Code',
'LBL_CHECK_CODE' => 'Check Code',
'LBL_FREE_CODES' => 'Free codes list',
'LBL_CODE_ERROR' => 'Wrong code',
'LBL_CODE_OK' => 'Code OK',
'LBL_MAINPRODUCT' => 'Main product',
'LBL_MAINPRODUCT_SUBPANEL' => 'Main product for',
'LBL_PANEL_PRICES' => 'Prices',
'LBL_PRICE_NAME' => 'Name',
'LBL_PRICE_VALUE' => 'Value',
'LBL_GROUP_KS' => 'Accountant group',
'LBL_WWW_PANEL' => 'WWW Settings',
'LBL_WWW_MANUAL_UPDATE' => 'Manual update',
'LBL_WWW_AVAILABLE' => 'Available',
'LBL_WWW_PRICE_PLN' => 'Price (PLN)',
'LBL_WWW_PRICE_EUR' => 'Price (EUR)',
'LBL_WWW_POPULAR' => 'Popular',
'LBL_WWW_STATE' => 'Stock state',
'LBL_WWW_STATE_DESC_PL' => 'Comming Soon Msg (PL)',
'LBL_WWW_STATE_DESC_EN' => 'Comming Soon Msg (EN)',
'LBL_PRODUCT_CARD' => 'Product Card',
'LBL_PRODUCTION' => 'Production',
'LBL_SRP_PRICE_EUR' => 'SRP Price EUR',
'LBL_LEAD_TIME' => 'Lead Time',
'LBL_PRICE' => 'Price',
'LBL_PANEL_CATEGORIES' => 'Categories',
'LBL_EAN_EXISTS' => 'Code exists, generate new?',
//add mz 2012-03-29
'LBL_BOXES_PER_LAYER' => 'Boxes per layer',
'LBL_NUMBER_OF_LAYERS' => 'Number of layers',
'LBL_BOXES_PER_PALETTE' => 'Boxes per palette',
'LBL_PIECES_PER_PALETTE' => 'Pieces per palette',
'LBL_PALETTE_WEIGHT_BRUTTO' => 'Palette weight brutto',
//emd mz
'LBL_TH' => 'TH',
'LBL_PRODUCT_SUBCATEGORY_ID' => 'Subategory id',
'LBL_PRODUCT_SUBCATEGORY' => 'Subategory',
'LBL_LIST_PRODUCT_SUBCATEGORY_ID' => 'Subategory id',
'LBL_LIST_PRODUCT_SUBCATEGORY' => 'Subategory',
//added 05.10.2010
'LBL_FLAG'=>'Show marked',
'LBL_ADD_STATUS'=>'Additional status',
//added 30.09.2010
'LBL_STATUS'=>'Status',
'LBL_UNIT_NAME'=>'Unit',
//added 25.06.2010
'LBL_END_OF_LINE'=>'End of line',
//added 22.06.2010
'LBL_IMAGE_CARD'=>'Select image',
'LBL_DESCRIPTION_CARD'=>'Description',
'LBL_SPECIFICATION_CARD'=>'Specification',
'LBL_CHARACTERISTIC_CARD'=>'Characteristic',
'LBL_USED_TO_CARD'=>'Used To',
'LBL_CARD_INFORMATION'=>'Card informations',
//added 02.06.2010
'LBL_PRODUCTION'=>'Production',
//added 25.05.2010
'LBL_LEAD_TIME'=>'Lead time',
//added 27.11.2009
'LBL_EDITTABLE_NO'=>'No',
'LBL_EDITTABLE_CODE'=>'Index',
'LBL_EDITTABLE_NAME'=>'Name',
'LBL_EDITTABLE_UNIT'=>'Unit',
'LBL_EDITTABLE_QUANTITY'=>'Quantity',
'LBL_EDITTABLE_OPTIONS'=>'Opt',
'LBL_EDITTABLE_NO'=>'No',
'LBL_PRICE'=>'Price',
'LBL_COMPONENTS'=>'Components',
'LBL_ITEMS'=>'Items',
'LBL_LIST_PIECES_PER_CARTON'=>'Ppc',
'LBL_LIST_CBM'=>'CBM stock',
'LBL_LIST_CBM_ORDERED'=>'CBM ord',
'LBL_LIST_QTY_3M'=>'Qty 3 m',
'LBL_LIST_QTY_THIS_M'=>'Qty this m',
'LBL_LIST_AVG_PRICE_3'=>'Avg price 3 m',
'LBL_LIST_AVG_PRICE_THIS'=>'Avg price this m',
'LBL_LIST_SALE_3_M'=>'Sale 3 m',
//added 27.11.2009
'LBL_STOCK_NAME'=>'Inventory',
'LBL_LIST_ORDERED'=>'Ordered',
'LBL_LIST_STOCK_MONTH'=>'Stock m',
'LBL_LIST_INVENTORY'=>'Inv',
//added 03.02.2009
'LBL_VAT_NAME' => 'Vat',
//added 20.01.2009
'LBL_DEFAULT_REMARKS_PL' => 'Default remarks pl',
'LBL_DEFAULT_REMARKS_EN' => 'Default remarks en',
'LBL_DEFAULT_REMARKS_DE' => 'Default remarks de',
//added 13.01.2009
'LBL_EAN_PL' => 'EAN pl',
'LBL_SHORT_DESCRIPTION_PL' => 'Short description pl',
'LBL_LONG_DESCRIPTION_PL' => 'Long description pl',
'LBL_REMARKS_PL' => 'Remarks pl',
'LBL_EAN_EN' => 'EAN en',
'LBL_SHORT_DESCRIPTION_EN' => 'Short description en',
'LBL_LONG_DESCRIPTION_EN' => 'Long description en',
'LBL_REMARKS_EN' => 'Remarks en',
'LBL_EAN_DE' => 'EAN de',
'LBL_SHORT_DESCRIPTION_DE' => 'Short description de',
'LBL_LONG_DESCRIPTION_DE' => 'Long description de',
'LBL_REMARKS_DE' => 'Remarks de',
//added 12.01.2009
'LBL_RECIPIENT_CODE'=>'Recipient Code',
// added 17.12.2008
'LBL_MARGIN'=>'Margin',
'LBL_PRODUCT_NAME'=>'Name',
'LBL_LIST_PRICE'=>'List price',
// added 02.12.2008
'LBL_EMS_ORDERED' => 'Ordered',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
// added 25.11.2008
'LBL_END_DATE' => 'End Date',
'LBL_START_DATE' => 'Start Date',
'LBL_QTYUNIT' => 'Qty/Unit',
'LBL_COMMISSION_RATE' => 'Commission Rate',
'LBL_CODE' => 'Code',
'LBL_MANUFACTURER' => 'Manufacturer',
'LBL_PRODUCT_CATEGORY' => 'Category',
'LBL_UNIT_PRICE' => 'Unit Price',
'LBL_LIST_CODE' => 'Code',
'LBL_LIST_COMMISSION_RATE' => 'Commission Rate',
'LBL_LIST_QTY_PER_UNIT' => 'Qty Per Unit',
'LBL_LIST_UNIT_PRICE' => 'Unit Price',
'LBL_UPLOADED' => '[uploaded]',
'LBL_QTY_IN_STOCK' => 'Qty In Stock',
'LBL_QTY_IN_DEMAND' => 'Qty In Demand',
'LBL_REORDER_LEVEL' => 'Stock min.',
'LBL_VAT' => 'Vat',
'LBL_SELLING_PRICE' => 'Selling Price',
'LBL_LOCAL_EAN' => 'Local EAN',
'LBL_REMARKS' => 'Remarks',
'LBL_SHORT_DESCRIPTION' => 'Short Description',
'LBL_LONG_DESCRIPTION' => 'Long Description',
'LBL_LOCALIZED_INFORMATION' => 'Localized Information',
'LBL_LOGISTIC_INFORMATION' => 'Logistic Information',
'LBL_DRIVERS_IMAGES' => 'Drivers & Images',
'LBL_STOCK_INFORMATION' => 'Stock Information',
'LBL_PRICING_INFORMATION' => 'Pricing Information',
'LBL_PRODUCT_INFORMATION' => 'Product Information',
// Added
'LBL_ECMPZDOCUMENTS_SUBPANEL_TITLE' => 'PZ Documents',
'LBL_ECMWZDOCUMENTS_SUBPANEL_TITLE' => 'WZ Documents',
'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE' => 'Delivery Notes',
'LBL_ECMSALES_SUBPANEL_TITLE' => 'Sales',
'LBL_ECMPURCHASEORDERS_SUBPANEL_TITLE' => 'Purchase Orders',
'LBL_QTY_IN_STOCK' => 'Qty in stock',
'LBL_QTY_IN_DEMAND' => 'Qty in demand',
'LBL_ECMSTOCKINS_SUBPANEL_TITLE' => 'Stock In',
'LBL_ECMSTOCKOUTS_SUBPANEL_TITLE' => 'Stock Out',
'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE' => 'Invoices',
'LBL_ECMQUOTES_SUBPANEL_TITLE' => 'Quotes',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Products',
'LBL_MODULE_TITLE' => 'Products: Home',
'LBL_MODULE_ID' => 'Products',
'LBL_SEARCH_FORM_TITLE' => 'Products Search',
'LBL_LIST_FORM_TITLE' => 'Products List',
'LBL_NEW_FORM_TITLE' => 'New Products',
'LBL_ECMPRODUCTS' => 'Products:',
'LBL_ECMPRODUCTS_SUBJECT' => 'Products Subject:',
'LBL_SYSTEM_ID' => 'System ID',
// FOR LIST VIEW
'LBL_LIST_NAME' => 'Product Name',
'LBL_LIST_SUBJECT' => 'Subject',
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
'LBL_LIST_MY_ECMPRODUCTS' => 'My Assigned Products',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
'LBL_LIST_PRODUCT_INDEX' => 'Index',
'LBL_LIST_PRODUCT_CATEGORY_ID' => 'Category id',
'LBL_LIST_PRODUCT_CATEGORY' => 'Category',
'LBL_LIST_PRODUCT_LINE_ID' => 'Product line id',
'LBL_LIST_PRODUCT_LINE' => 'Line',
'LBL_LIST_MANUFACTURER_ID' => 'Manufacturer id',
'LBL_LIST_MANUFACTURER' => 'Manufacturer',
'LBL_LIST_CONTACT_ID' => 'Contact id',
'LBL_LIST_CONTACT_NAME' => 'Contact name',
'LBL_LIST_VENDOR_ID' => 'Vendor id',
'LBL_LIST_VENDOR_NAME' => 'Vendor name',
'LBL_LIST_VENDOR_PART_NO' => 'Vendor part no',
'LBL_LIST_PRODUCT_ACTIVE' => 'Product active',
'LBL_LIST_SALES_START_DATE' => 'Sales start date',
'LBL_LIST_SALES_END_DATE' => 'Sales end date',
'LBL_LIST_PARENT_TYPE' => 'Parent type',
'LBL_LIST_PARENT_ID' => 'Parent id',
'LBL_LIST_PARENT_NAME' => 'Parent name',
'LBL_LIST_WEBSITE' => 'Website',
'LBL_LIST_PART_NO' => 'Part no',
'LBL_LIST_SERIAL_NO' => 'Serial no',
'LBL_LIST_EXCHANGE_RATE_ID' => 'Exchange rate id',
'LBL_LIST_EXCHANGE_RATE_NAME' => 'Exchange rate name',
'LBL_LIST_FOB_PRICE' => 'FOB price',
'LBL_LIST_UNIT_PRICE' => 'Unit price',
'LBL_LIST_EMS_PRICE' => 'AVG purchase price',
'LBL_LIST_COMMISSION_RATE' => 'Commission rate',
'LBL_LIST_CUSTOM_DUTY_RATE' => 'Custom duty rate',
'LBL_LIST_SRP_PRICE' => 'SRP price',
'LBL_LIST_SRP_PRICE_EUR' => 'SRP price eur',
'LBL_LIST_SRP_PROMO_PRICE' => 'SRP promo price',
'LBL_LIST_TAX_CLASS_ID' => 'Tax class id',
'LBL_LIST_TAX_CLASS_NAME' => 'Tax class name',
'LBL_LIST_USAGE_UNIT_ID' => 'Usage unit id',
'LBL_LIST_USAGE_UNIT_NAME' => 'Usage unit name',
'LBL_LIST_QTY_IN_STOCK' => 'Qty in stock',
'LBL_LIST_QTY_IN_DEMAND' => 'Qty in demand',
'LBL_LIST_EMS_QTY_IN_STOCK' => 'EMS qty in stock',
'LBL_LIST_REORDER_LEVEL' => 'Reorder level',
'LBL_LIST_SALES_LAST_MONTH_1' => 'Sales last month -1',
'LBL_LIST_SALES_LAST_MONTH' => 'Sales last month',
'LBL_LIST_SALES_THIS_MONTH' => 'Sales this month',
'LBL_LIST_QTY_PER_UNIT' => 'Qty per unit',
'LBL_LIST_AVERAGE_SALE_3_MONTHS' => 'Average sale 3 months',
'LBL_LIST_SALES_PLUS_1' => 'Sales plus 1',
'LBL_LIST_SALES_PLUS_2' => 'Sales plus 2',
'LBL_LIST_SALES_PLUS_3' => 'Sales plus 3',
'LBL_LIST_PRODUCT_PICTURE' => 'Product picture',
'LBL_LIST_PACKING_FRONT_PICTURE' => 'Packing front picture',
'LBL_LIST_DRIVER_1' => 'Driver 1',
'LBL_LIST_DRIVER_2' => 'Driver 2',
'LBL_LIST_MOQ' => 'MOQ',
'LBL_LIST_FOB_BASIS_ID' => 'FOB basis id',
'LBL_LIST_FOB_BASIS_NAME' => 'FOB basis name',
'LBL_LIST_DELIVERY_TIME_FOB' => 'Delivery time FOB',
'LBL_LIST_PIECES_PER_CARTON' => 'Pieces per carton',
'LBL_LIST_PRODUCT_NETTO_WEIGHT' => 'Product netto weight (kg)',
'LBL_LIST_PRODUCT_BRUTTO_WEIGHT' => 'Product bruto weight (kg)',
'LBL_LIST_PACKING_TYPE_ID' => 'Packing type id',
'LBL_LIST_PACKING_TYPE_NAME' => 'Packing type',
'LBL_LIST_PACKING_DIMENSIONS_1' => 'Packing dimensions (cm)',
'LBL_LIST_PACKING_DIMENSIONS_2' => 'Packing dimensions (cm)',
'LBL_LIST_PACKING_DIMENSIONS_3' => 'Packing dimensions (cm)',
'LBL_LIST_RMA' => 'RMA (%)',
'LBL_LIST_CARTON_DIMENSIONS_1' => 'Carton dimensions (m)',
'LBL_LIST_CARTON_DIMENSIONS_2' => 'Carton dimensions (m)',
'LBL_LIST_CARTON_DIMENSIONS_3' => 'Carton dimensions (m)',
'LBL_LIST_CARTON_NETTO_WEIGHT' => 'Carton netto weight',
'LBL_LIST_CARTON_BRUTTO_WEIGHT' => 'Carton brutto weight',
'LBL_LIST_CARTON_VOLUME_METER' => 'Carton volume (cubic meter)',
'LBL_LIST_CARTON_VOLUME_FEET' => 'Carton volume (cubic feet)',
'LBL_LIST_COUNTRY_OF_ORIGIN' => 'Country of origin',
'LBL_LIST_CERTIFICATE_OF_ORIGIN' => 'Certificate of origin',
'LBL_LIST_FORM_A' => 'Form A',
// FOR NOTIFICATION POPUPS
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to remove this ecmproduct from this Product?',
'NTC_REMOVE_INVITEE' => 'Are you sure you want to remove this contact from the Product?',
'NTC_REMOVE_ACCOUNT_CONFIRMATION' => 'Are you sure you want to remove this ecmproduct from this account?',
'ERR_DELETE_RECORD' => 'A record number must be specified to delete the ecmproduct.',
// FOR DEFAULT FIELDS
'LBL_NAME' => 'Name:',
'LBL_SUBJECT' => 'Name:',
'LBL_CREATED_BY' => 'Created by:',
'LBL_CREATED' => 'Created by:',
'LBL_ASSIGNED_TO' => 'Assigned to:',
'LBL_ASSIGNED_USER_ID' => 'Assigned To:',
'LBL_DATE_ENTERED' => 'Date Created:',
'LBL_DATE_CREATED' => 'Create Date:',
'LBL_DATE_MODIFIED' => 'Last Modified',
'LBL_MODIFIED_BY' => 'Last Modified by:',
'LBL_MODIFIED' => 'Modified by:',
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
// FOR NEW FIELDS
'LBL_PRODUCT_INDEX' => 'Index',
'LBL_PRODUCT_CATEGORY_ID' => 'Category id',
'LBL_PRODUCT_CATEGORY' => 'Category',
'LBL_PRODUCT_LINE_ID' => 'Product line id',
'LBL_PRODUCT_LINE' => 'Product line',
'LBL_MANUFACTURER_ID' => 'Manufacturer id',
'LBL_MANUFACTURER' => 'Manufacturer',
'LBL_CONTACT_ID' => 'Contact id',
'LBL_CONTACT_NAME' => 'Contact name',
'LBL_VENDOR_ID' => 'Vendor id',
'LBL_VENDOR_NAME' => 'Vendor name',
'LBL_VENDOR_PART_NO' => 'Vendor part no',
'LBL_PRODUCT_ACTIVE' => 'Product active',
'LBL_SALES_START_DATE' => 'Sales start date',
'LBL_SALES_END_DATE' => 'Sales end date',
'LBL_PARENT_TYPE' => 'Parent type',
'LBL_PARENT_ID' => 'Parent id',
'LBL_PARENT_NAME' => 'Parent name',
'LBL_WEBSITE' => 'Website',
'LBL_PART_NO' => 'Part no',
'LBL_SERIAL_NO' => 'Serial no',
'LBL_EXCHANGE_RATE_ID' => 'Exchange rate id',
'LBL_EXCHANGE_RATE_NAME' => 'Exchange rate name',
'LBL_FOB_PRICE' => 'FOB price',
'LBL_UNIT_PRICE' => 'Unit price',
'LBL_EMS_PRICE' => 'AVG purchase price',
'LBL_COMMISSION_RATE' => 'Commission rate',
'LBL_CUSTOM_DUTY_RATE' => 'Custom duty rate',
'LBL_SRP_PRICE' => 'SRP price',
'LBL_SRP_PRICE_EUR' => 'SRP price eur',
'LBL_SRP_PROMO_PRICE' => 'SRP promo price',
'LBL_TAX_CLASS_ID' => 'Tax class id',
'LBL_TAX_CLASS_NAME' => 'Tax class name',
'LBL_USAGE_UNIT_ID' => 'Usage unit id',
'LBL_USAGE_UNIT_NAME' => 'Usage unit name',
'LBL_EMS_QTY_IN_STOCK' => 'EMS qty in stock',
'LBL_SALES_LAST_MONTH_1' => 'Sales last month -1',
'LBL_SALES_LAST_MONTH' => 'Sales last month',
'LBL_SALES_THIS_MONTH' => 'Sales this month',
'LBL_QTY_PER_UNIT' => 'Qty per unit',
'LBL_AVERAGE_SALE_3_MONTHS' => 'Average sale 3 months',
'LBL_SALES_PLUS_1' => 'Sales plus 1',
'LBL_SALES_PLUS_2' => 'Sales plus 2',
'LBL_SALES_PLUS_3' => 'Sales plus 3',
'LBL_PRODUCT_PICTURE' => 'Product picture',
'LBL_PACKING_FRONT_PICTURE' => 'Packing front picture',
'LBL_DRIVER_1' => 'Driver 1',
'LBL_DRIVER_2' => 'Driver 2',
'LBL_MOQ' => 'MOQ',
'LBL_FOB_BASIS_ID' => 'FOB basis id',
'LBL_FOB_BASIS_NAME' => 'FOB basis name',
'LBL_DELIVERY_TIME_FOB' => 'Delivery time FOB',
'LBL_PIECES_PER_CARTON' => 'Pieces per carton',
'LBL_PRODUCT_NETTO_WEIGHT' => 'Product netto weight (kg)',
'LBL_PRODUCT_BRUTTO_WEIGHT' => 'Product bruto weight (kg)',
'LBL_PACKING_TYPE_ID' => 'Packing type id',
'LBL_PACKING_TYPE_NAME' => 'Packing type',
'LBL_PACKING_DIMENSIONS_1' => 'Packing dimensions (cm)',
'LBL_PACKING_DIMENSIONS_2' => 'Packing dimensions (cm)',
'LBL_PACKING_DIMENSIONS_3' => 'Packing dimensions (cm)',
'LBL_RMA' => 'RMA (%)',
'LBL_CARTON_DIMENSIONS_1' => 'Carton dimensions (m)',
'LBL_CARTON_DIMENSIONS_2' => 'Carton dimensions (m)',
'LBL_CARTON_DIMENSIONS_3' => 'Carton dimensions (m)',
'LBL_CARTON_NETTO_WEIGHT' => 'Carton netto weight',
'LBL_CARTON_BRUTTO_WEIGHT' => 'Carton brutto weight',
'LBL_CARTON_VOLUME_METER' => 'Carton volume (cubic meter)',
'LBL_CARTON_VOLUME_FEET' => 'Carton volume (cubic feet)',
'LBL_COUNTRY_OF_ORIGIN' => 'Country of origin',
'LBL_CERTIFICATE_OF_ORIGIN' => 'Certificate of origin',
'LBL_FORM_A' => 'Form A',
// FOR GROUPS
'LBL_GROUP_MASTER' => 'PRODUCT INFORMATION',
'LBL_GROUP_PRODUCT_INDEX' => '',
'LBL_GROUP_PRODUCT_CATEGORY_ID' => '',
'LBL_GROUP_PRODUCT_CATEGORY' => '',
'LBL_GROUP_PRODUCT_LINE_ID' => '',
'LBL_GROUP_PRODUCT_LINE' => '',
'LBL_GROUP_MANUFACTURER_ID' => '',
'LBL_GROUP_MANUFACTURER' => '',
'LBL_GROUP_CONTACT_ID' => '',
'LBL_GROUP_CONTACT_NAME' => '',
'LBL_GROUP_VENDOR_ID' => '',
'LBL_GROUP_VENDOR_NAME' => '',
'LBL_GROUP_VENDOR_PART_NO' => '',
'LBL_GROUP_PRODUCT_ACTIVE' => '',
'LBL_GROUP_SALES_START_DATE' => '',
'LBL_GROUP_SALES_END_DATE' => '',
'LBL_GROUP_PARENT_TYPE' => '',
'LBL_GROUP_PARENT_ID' => '',
'LBL_GROUP_PARENT_NAME' => '',
'LBL_GROUP_WEBSITE' => '',
'LBL_GROUP_PART_NO' => '',
'LBL_GROUP_SERIAL_NO' => '',
'LBL_GROUP_EXCHANGE_RATE_ID' => '',
'LBL_GROUP_EXCHANGE_RATE_NAME' => '',
'LBL_GROUP_FOB_PRICE' => '',
'LBL_GROUP_UNIT_PRICE' => '',
'LBL_GROUP_EMS_PRICE' => '',
'LBL_GROUP_COMMISSION_RATE' => '',
'LBL_GROUP_CUSTOM_DUTY_RATE' => '',
'LBL_GROUP_SRP_PRICE' => '',
'LBL_GROUP_SRP_PROMO_PRICE' => '',
'LBL_GROUP_TAX_CLASS_ID' => '',
'LBL_GROUP_TAX_CLASS_NAME' => '',
'LBL_GROUP_USAGE_UNIT_ID' => '',
'LBL_GROUP_USAGE_UNIT_NAME' => '',
'LBL_GROUP_EMS_QTY_IN_STOCK' => '',
'LBL_GROUP_SALES_LAST_MONTH_1' => '',
'LBL_GROUP_SALES_LAST_MONTH' => '',
'LBL_GROUP_SALES_THIS_MONTH' => '',
'LBL_GROUP_QTY_PER_UNIT' => '',
'LBL_GROUP_AVERAGE_SALE_3_MONTHS' => '',
'LBL_GROUP_SALES_PLUS_1' => '',
'LBL_GROUP_SALES_PLUS_2' => '',
'LBL_GROUP_SALES_PLUS_3' => '',
'LBL_GROUP_PRODUCT_PICTURE' => '',
'LBL_GROUP_PACKING_FRONT_PICTURE' => '',
'LBL_GROUP_DRIVER_1' => '',
'LBL_GROUP_DRIVER_2' => '',
'LBL_GROUP_MOQ' => '',
'LBL_GROUP_FOB_BASIS_ID' => '',
'LBL_GROUP_FOB_BASIS_NAME' => '',
'LBL_GROUP_DELIVERY_TIME_FOB' => '',
'LBL_GROUP_PIECES_PER_CARTON' => '',
'LBL_GROUP_PRODUCT_NETTO_WEIGHT' => '',
'LBL_GROUP_PRODUCT_BRUTTO_WEIGHT' => '',
'LBL_GROUP_PACKING_TYPE_ID' => '',
'LBL_GROUP_PACKING_TYPE_NAME' => '',
'LBL_GROUP_PACKING_DIMENSIONS_1' => '',
'LBL_GROUP_PACKING_DIMENSIONS_2' => '',
'LBL_GROUP_PACKING_DIMENSIONS_3' => '',
'LBL_GROUP_RMA' => '',
'LBL_GROUP_CARTON_DIMENSIONS_1' => '',
'LBL_GROUP_CARTON_DIMENSIONS_2' => '',
'LBL_GROUP_CARTON_DIMENSIONS_3' => '',
'LBL_GROUP_CARTON_NETTO_WEIGHT' => '',
'LBL_GROUP_CARTON_BRUTTO_WEIGHT' => '',
'LBL_GROUP_CARTON_VOLUME_METER' => '',
'LBL_GROUP_CARTON_VOLUME_FEET' => '',
'LBL_GROUP_COUNTRY_OF_ORIGIN' => '',
'LBL_GROUP_CERTIFICATE_OF_ORIGIN' => '',
'LBL_GROUP_FORM_A' => '',
// FOR SUBPANELS
'LBL_ECMPRODUCTS_SUBPANEL_TITLE' => 'Products',
'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Activities',
'LBL_HISTORY_SUBPANEL_TITLE' => 'History',
'LBL_ECMPRODUCTS' => 'Products',
// FOR MENU LABELS
'LNK_NEW_ECMPRODUCTS' => 'Create Product',
'LNK_LIST_ECMPRODUCT' => 'Products List',
// FOR MENU LINKS
'LNK_NEW_ECMPRODUCT' => 'Create Product',
'LNK_ECMPRODUCTS_LIST' => 'Products',
'LNK_ECMPRODUCTS_REPORTS' => 'Products Reports',
// FOR ADDITIONAL MENUS
// FOR DASHLETS
'LBL_LIST_ECMPRODUCTS' => 'Products',
//mz 12.10.2011
'LBL_EAN2' => 'EAN 2',
'LBL_EAN' => 'EAN',
'LBL_GENERATE_EAN' => 'Generate',
);
?>

View File

@@ -0,0 +1,509 @@
<?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_BRAND' => 'Marka',
'LBL_BRAND_LABEL' => 'Indeks etykiety',
'LBL_PRODUCTION_PANEL' => 'Elementy produkcji',
'LBL_ACTIONS' => 'Czynności',
'LBL_QRODE' => 'QR',
'LBL_SELLING_Q1_INFORMATION' => 'Sprzedaż Q1',
'LBL_SELLING_LAST_Q1_INFORMATION' => 'Sprzedaż Q1 (poprzedni)',
'LBL_SELLING_Q2_INFORMATION' => 'Sprzedaż Q2',
'LBL_SELLING_LAST_Q2_INFORMATION' => 'Sprzedaż Q2 (poprzedni)',
'LBL_SELLING_Q3_INFORMATION' => 'Sprzedaż Q3',
'LBL_SELLING_LAST_Q3_INFORMATION' => 'Sprzedaż Q3 (poprzedni)',
'LBL_SELLING_Q4_INFORMATION' => 'Sprzedaż Q4',
'LBL_SELLING_LAST_Q4_INFORMATION' => 'Sprzedaż Q4 (poprzedni)',
'LBL_SELLING_THIS_MONTH_INFORMATION' => 'Sprzedaż w aktualnym miesiącu',
'LBL_SELLING_THIS_YEAR_INFORMATION' => 'Sprzedaż w aktualnym roku',
'LBL_SELLING_LAST_YEAR_INFORMATION' => 'Sprzedaż w poprzednim roku',
'LBL_SELLING_LAST_MONTH_INFORMATION' => 'Sprzedaż w poprzednim miesiącu',
'LBL_SELL_VALUE' => 'Wartość',
'LBL_SELL_QUANTITY' => 'Ilośc',
'LBL_SELL_COST' => 'Koszt',
'LBL_SELL_MARGIN' => 'Marża',
'LBL_ALLEGRO' => 'Szablon Allegro',
'LBL_IS_MAINPRODUCT' => 'Jest produktem głównym',
'LBL_SEARCH_CODE' => 'Szukaj kodu',
'LBL_CHECK_CODE' => 'Sprawdź poprawność',
'LBL_FREE_CODES' => 'Lista nieużywanych kodów',
'LBL_CODE_ERROR' => 'Błędny kod (istnieje, lub spoza zakresu)',
'LBL_CODE_OK' => 'Kod poprawny',
'LBL_MAINPRODUCT' => 'Produkt główny',
'LBL_MAINPRODUCT_SUBPANEL' => 'Produkt główny dla',
'LBL_PANEL_PRICES' => 'Ceny',
'LBL_PRICE_NAME' => 'Nazwa',
'LBL_PRICE_VALUE' => 'Wartość',
'LBL_GROUP_KS' => 'Grupa księgowa',
'LBL_WWW_PANEL' => 'Ustawienia WWW',
'LBL_WWW_MANUAL_UPDATE' => 'Ręczna aktualizacja',
'LBL_WWW_AVAILABLE' => 'Dostepny',
'LBL_WWW_PRICE_PLN' => 'Cena (PLN)',
'LBL_WWW_PRICE_EUR' => 'Cena (EUR)',
'LBL_WWW_POPULAR' => 'Polecany',
'LBL_WWW_STATE' => 'Stan magazynowy',
'LBL_WWW_STATE_DESC_PL' => 'Wkrótce dostępne, opis PL',
'LBL_WWW_STATE_DESC_EN' => 'Wkrótce dostępne, opis EN',
'LBL_PRODUCT_CARD' => 'Karta Produktu',
'LBL_PRODUCTION' => 'Produkcja',
'LBL_SRP_PRICE_EUR' => 'Cena SRP EUR',
'LBL_LEAD_TIME' => 'Czas Realizacji',
'LBL_PRICE' => 'Cena',
'LBL_PANEL_CATEGORIES' => 'Kategorie',
'LBL_EAN_EXISTS' => 'Kod istnieje, wygenerować nowy?',
//add mz 2012-03-29
'LBL_BOXES_PER_LAYER' => 'Ilośc kartonów w warstwie',
'LBL_NUMBER_OF_LAYERS' => 'Ilośc warstw',
'LBL_BOXES_PER_PALETTE' => 'Ilośc kartonów na palecie',
'LBL_PIECES_PER_PALETTE' => 'Ilośc sztuk na palecie',
'LBL_PALETTE_WEIGHT_BRUTTO' => 'Waga brutto palety',
'LBL_MAGAZINE' => 'Na stanie',
//emd mz
//added 27.11.2009
'LBL_LIST_PIECES_PER_CARTON'=>'Ppc',
'LBL_LIST_CBM'=>'CBM mag',
'LBL_LIST_CBM_ORDERED'=>'CBM zam',
'LBL_LIST_QTY_3M'=>'Ilość 3 m',
'LBL_LIST_QTY_THIS_M'=>'Ilość w tym m',
'LBL_LIST_AVG_PRICE_3'=>'Średnia cena 3 m',
'LBL_LIST_AVG_PRICE_THIS'=>'Średnia cena ten m',
'LBL_LIST_SALE_3_M'=>'Sprzedaż 3 m',
//added 27.11.2009
'LBL_STOCK_NAME'=>'Magazyn',
'LBL_LIST_ORDERED'=>'Zamówione',
'LBL_LIST_STOCK_MONTH'=>'Magazyn m',
'LBL_LIST_INVENTORY'=>'Mag',
//added 20.07.2009
'LBL_ECMSTOCKDOCMOVES_SUBPANEL_TITLE' => 'Dokumenty MM',
'LBL_ECMSTOCKDOCINSIDEINS_SUBPANEL_TITLE' => 'Dokumenty PW',
'LBL_ECMSTOCKDOCINSIDEOUTS_SUBPANEL_TITLE' => 'Dokumenty RW',
'LBL_ASSIGNED_TO_ID'=>'Przypisane Do',
'LBL_STOCK_ID'=>'Magazyn',
//added 15.07.2009
'LBL_ORDERED'=>'Zamówione',
'LBL_UNIT_ID'=>'Jednostka miary',
'LBL_UNIT_NAME'=>'Jednostka miary',
//added 27.04.2009
'LBL_STOCK_NAME'=>'Magazyn',
//added 02.04.2009
'LBL_II_STOCK'=>'Magazyn',
'LBL_II_QTY'=>'Ilosc',
'LBL_II_PRICE'=>'Sredia Cena',
'LBL_LIST_INVENTORY'=>'Magazyn',
'LBL_INVENTORY_INFORMATION' => 'Informacje o Magazynie',
//added 03.02.2009
'LBL_VAT_NAME' => 'Vat',
//added 20.01.2009
'LBL_DEFAULT_REMARKS_PL' => 'Domyslne uwagi pl',
'LBL_DEFAULT_REMARKS_EN' => 'Domyslne uwagi en',
'LBL_DEFAULT_REMARKS_DE' => 'Domyslne uwagi de',
//added 13.01.2009
'LBL_EAN_PL' => 'EAN pl',
'LBL_SHORT_DESCRIPTION_PL' => 'Krótki opis pl',
'LBL_LONG_DESCRIPTION_PL' => 'Dlugi opis pl',
'LBL_REMARKS_PL' => 'Uwagi pl',
'LBL_EAN_EN' => 'EAN en',
'LBL_SHORT_DESCRIPTION_EN' => 'Krótki opis en',
'LBL_LONG_DESCRIPTION_EN' => 'Dlugi opis en',
'LBL_REMARKS_EN' => 'Uwagi en',
'LBL_EAN_DE' => 'EAN de',
'LBL_SHORT_DESCRIPTION_DE' => 'Krótki opis de',
'LBL_LONG_DESCRIPTION_DE' => 'Dlugi opis de',
'LBL_REMARKS_DE' => 'Uwagi de',
//added 12.01.2009
'LBL_RECIPIENT_CODE'=>'Kod Odbiorcy',
// added 17.12.2008
'LBL_MARGIN'=>'Marza',
'LBL_PRODUCT_NAME'=>'Nazwa Produktu',
'LBL_LIST_PRICE'=>'Cena',
// added 02.12.2008
'LBL_EMS_ORDERED' => 'Zamówien',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notatki',
// added 25.11.2008
'LBL_END_DATE' => 'Data Koncowa',
'LBL_START_DATE' => 'Data Poczatkowa',
'LBL_QTYUNIT' => 'Ilosc/Sztuk',
'LBL_COMMISSION_RATE' => 'Prowizja',
'LBL_CODE' => 'Kod',
'LBL_MANUFACTURER' => 'Wytwórca',
'LBL_PRODUCT_VATEGORY' => 'Kategoria',
'LBL_UNIT_PRICE' => 'Cena Zakupu',
'LBL_LIST_CODE' => 'Kod',
'LBL_LIST_COMMISSION_RATE' => 'Prowizja',
'LBL_LIST_QTY_PER_UNIT' => 'Ilosc w Szt.',
'LBL_LIST_UNIT_PRICE' => 'Cena Zakupu',
'LBL_UPLOADED' => '[zaladowane]',
'LBL_QTY_IN_STOCK' => 'Ilosc w Magazynie',
'LBL_QTY_IN_DEMAND' => 'Potrzebna ilosc',
'LBL_REORDER_LEVEL' => 'Stan minimalny',
'LBL_VAT' => 'Vat',
'LBL_SELLING_PRICE' => 'Cena Sprzedazy',
'LBL_LOCAL_EAN' => 'Kod EAN',
'LBL_REMARKS' => 'Uwagi',
'LBL_SHORT_DESCRIPTION' => 'Krótki Opis',
'LBL_LONG_DESCRIPTION' => 'Dlugi Opis',
'LBL_LOCALIZED_INFORMATION' => 'Informacje w Jezykach',
'LBL_LOGISTIC_INFORMATION' => 'Informacje Logistyczne',
'LBL_DRIVERS_IMAGES' => 'Linki (zdjecia, sterowniki, www)',
'LBL_STOCK_INFORMATION' => 'Informacje Magazynowe',
'LBL_PRICING_INFORMATION' => 'Informacje o Cenie',
'LBL_PRODUCT_INFORMATION' => 'Opis produktu',
// Added
'LBL_ECMSTOCKDOCINS_SUBPANEL_TITLE' => 'Dokumenty PZ',
'LBL_ECMSTOCKDOCOUTS_SUBPANEL_TITLE' => 'Dokumenty WZ',
'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE' => 'Dokumenty Przewozowe',
'LBL_ECMSALES_SUBPANEL_TITLE' => 'Zamówienia Sprzedazy',
'LBL_ECMPURCHASEORDERS_SUBPANEL_TITLE' => 'Zamówienia Kupna',
'LBL_QTY_IN_STOCK' => 'Ilosc na Magazynie',
'LBL_QTY_IN_DEMAND' => 'Potrzebna Ilosc',
'LBL_ECMSTOCKINS_SUBPANEL_TITLE' => 'Stock In',
'LBL_ECMSTOCKOUTS_SUBPANEL_TITLE' => 'Stock Out',
'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE' => 'Faktury',
'LBL_ECMQUOTES_SUBPANEL_TITLE' => 'Oferty',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Produkty',
'LBL_MODULE_TITLE' => 'Produkty: Strona Glówna',
'LBL_MODULE_ID' => 'Produkty',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
'LBL_LIST_FORM_TITLE' => 'Lista Produktów',
'LBL_NEW_FORM_TITLE' => 'Nowy Produkt',
'LBL_ECMPRODUCTS' => 'Produkty:',
'LBL_ECMPRODUCTS_SUBJECT' => 'Tytul Produktu:',
'LBL_SYSTEM_ID' => 'System ID',
// FOR LIST VIEW
'LBL_LIST_NAME' => 'Nazwa Produktu',
'LBL_LIST_SUBJECT' => 'Tytul',
'LBL_LIST_LAST_MODIFIED' => 'Ostatnio Modyfikowane',
'LBL_LIST_MY_ECMPRODUCTS' => 'Moje Przypisane Produkty',
'LBL_LIST_ASSIGNED_TO_NAME' => 'Przypisany Uzytkownik',
'LBL_LIST_PRODUCT_INDEX' => 'Index Produktu',
'LBL_LIST_PRODUCT_CATEGORY_ID' => 'Kategoria',
'LBL_LIST_PRODUCT_CATEGORY' => 'Kategoria',
'LBL_LIST_PRODUCT_LINE_ID' => 'Linia Produktowa',
'LBL_LIST_PRODUCT_LINE' => 'Linia Produktowa',
'LBL_LIST_MANUFACTURER_ID' => 'Wytwórca',
'LBL_LIST_MANUFACTURER' => 'Wytwórca',
'LBL_LIST_CONTACT_ID' => 'Kontakt',
'LBL_LIST_CONTACT_NAME' => 'Kontakt',
'LBL_LIST_VENDOR_ID' => 'Dostawca',
'LBL_LIST_VENDOR_NAME' => 'Dostawca',
'LBL_LIST_VENDOR_PART_NO' => 'Rodzaj',
'LBL_LIST_PRODUCT_ACTIVE' => 'Aktywny',
'LBL_LIST_SALES_START_DATE' => 'Data Rozpoczecia Sprzedazy',
'LBL_LIST_SALES_END_DATE' => 'Data Zakonczenia Sprzedazy',
'LBL_LIST_PARENT_TYPE' => 'Typ Przypisanie',
'LBL_LIST_PARENT_ID' => 'Przypisane Do',
'LBL_LIST_PARENT_NAME' => 'Przypisane Do',
'LBL_LIST_WEBSITE' => 'Strona Internetowa',
'LBL_LIST_PART_NO' => 'Rozmiar',
'LBL_LIST_SERIAL_NO' => 'Numer',
'LBL_LIST_EXCHANGE_RATE_ID' => 'Waluta',
'LBL_LIST_EXCHANGE_RATE_NAME' => 'Waluta',
'LBL_LIST_FOB_PRICE' => 'Cena FOB',
'LBL_LIST_UNIT_PRICE' => 'Cena Zakupu',
'LBL_LIST_EMS_PRICE' => 'Średnia cena zakupu',
'LBL_LIST_COMMISSION_RATE' => 'Prowizja',
'LBL_LIST_CUSTOM_DUTY_RATE' => 'Poziom Cla',
'LBL_LIST_SRP_PRICE' => 'Cena SRP',
'LBL_LIST_SRP_PROMO_PRICE' => 'Cena SRP Promo',
'LBL_LIST_TAX_CLASS_ID' => 'Vat',
'LBL_LIST_TAX_CLASS_NAME' => 'Vat',
'LBL_LIST_USAGE_UNIT_ID' => 'Opakowanie',
'LBL_LIST_USAGE_UNIT_NAME' => 'Opakowanie',
'LBL_LIST_QTY_IN_STOCK' => 'Ilosc na Magazynie',
'LBL_LIST_QTY_IN_DEMAND' => 'Potrzebna Ilosc',
'LBL_LIST_EMS_QTY_IN_STOCK' => 'Ilosc na Magazynie EMS',
'LBL_LIST_REORDER_LEVEL' => 'Poziom Zamówienia',
'LBL_LIST_SALES_LAST_MONTH_1' => 'Sprzedaz w Ostatnim Miesiacu -1',
'LBL_LIST_SALES_LAST_MONTH' => 'Sprzedaz w Ostatnim Miesiacu',
'LBL_LIST_SALES_THIS_MONTH' => 'Sprzedaz w Tym Miesiacu',
'LBL_LIST_QTY_PER_UNIT' => 'Ilosc na Szt.',
'LBL_LIST_AVERAGE_SALE_3_MONTHS' => 'Srednia Sprzedaz w Ostatnich 3 Miesiacach',
'LBL_LIST_SALES_PLUS_1' => 'Sprzedaz plus 1',
'LBL_LIST_SALES_PLUS_2' => 'Sprzedaz plus 2',
'LBL_LIST_SALES_PLUS_3' => 'Sprzedaz plus 3',
'LBL_LIST_PRODUCT_PICTURE' => 'Obrazek',
'LBL_LIST_PACKING_FRONT_PICTURE' => 'Obrazek Opakowania',
'LBL_LIST_DRIVER_1' => 'Sterownik 1',
'LBL_LIST_DRIVER_2' => 'Sterownik 2',
'LBL_LIST_MOQ' => 'MOQ',
'LBL_LIST_FOB_BASIS_ID' => 'Baza FOB',
'LBL_LIST_FOB_BASIS_NAME' => 'Baza FOB',
'LBL_LIST_DELIVERY_TIME_FOB' => 'Czas Dostarczenia FOB',
'LBL_LIST_PIECES_PER_CARTON' => 'Sztuk w Kartonie',
'LBL_LIST_PRODUCT_NETTO_WEIGHT' => 'Waga Produktu Netto (kg)',
'LBL_LIST_PRODUCT_BRUTTO_WEIGHT' => 'Waga Produktu Brutto (kg)',
'LBL_LIST_PACKING_TYPE_ID' => 'Typ Opakowania',
'LBL_LIST_PACKING_TYPE_NAME' => 'Typ Opakowania',
'LBL_LIST_PACKING_DIMENSIONS_1' => 'Rzmiar opakowania (cm)',
'LBL_LIST_PACKING_DIMENSIONS_2' => 'Rzmiar opakowania (cm)',
'LBL_LIST_PACKING_DIMENSIONS_3' => 'Rzmiar opakowania (cm)',
'LBL_LIST_RMA' => 'RMA (%)',
'LBL_LIST_CARTON_DIMENSIONS_1' => 'Rzmiar kartonu (m)',
'LBL_LIST_CARTON_DIMENSIONS_2' => 'Rzmiar kartonu (m)',
'LBL_LIST_CARTON_DIMENSIONS_3' => 'Rzmiar kartonu (m)',
'LBL_LIST_CARTON_NETTO_WEIGHT' => 'Waga Kartonu Netto',
'LBL_LIST_CARTON_BRUTTO_WEIGHT' => 'Waga Kartonu Brutto',
'LBL_LIST_CARTON_VOLUME_METER' => 'Objetosc Kartonu (cubic meter)',
'LBL_LIST_CARTON_VOLUME_FEET' => 'Objetosc Kartonu (cubic feet)',
'LBL_LIST_COUNTRY_OF_ORIGIN' => 'Panstwo Pochodzenia',
'LBL_LIST_CERTIFICATE_OF_ORIGIN' => 'Certyfikat',
'LBL_LIST_FORM_A' => 'Form A',
// FOR NOTIFICATION POPUPS
'NTC_DELETE_CONFIRMATION' => 'Czy na pewno chcesz usunac ten produkt?',
'NTC_REMOVE_INVITEE' => 'Czy na pewno chcesz usunac kontakt z produktu?',
'NTC_REMOVE_ACCOUNT_CONFIRMATION' => 'Czy na pewno chcesz usunac ten produkt z firmy?',
'ERR_DELETE_RECORD' => 'Podaj numer rekordu aby usunac produkt.',
// FOR DEFAULT FIELDS
'LBL_NAME' => 'Nazwa:',
'LBL_SUBJECT' => 'Nazwa:',
'LBL_CREATED_BY' => 'Utworzone przez:',
'LBL_CREATED' => 'Utworzone przez:',
'LBL_ASSIGNED_TO' => 'Przypisane do:',
'LBL_ASSIGNED_USER_ID' => 'Przypisane do:',
'LBL_DATE_ENTERED' => 'Data Utworzenia:',
'LBL_DATE_CREATED' => 'Data Utworzenia:',
'LBL_DATE_MODIFIED' => 'Ostatnio Modyfikowane',
'LBL_MODIFIED_BY' => 'Ostatnio Modyfikowane przez:',
'LBL_MODIFIED' => 'Modifikowane przez:',
'LBL_DATE_LAST_MODIFIED' => 'Data Modyfikacji:',
// FOR NEW FIELDS
'LBL_PRODUCT_INDEX' => 'Indeks Produktu',
'LBL_PRODUCT_CATEGORY_ID' => 'Kategoria',
'LBL_PRODUCT_CATEGORY' => 'Kategoria',
'LBL_PRODUCT_LINE_ID' => 'Linia Produktowa',
'LBL_PRODUCT_LINE' => 'Linia Produktowa',
'LBL_MANUFACTURER_ID' => 'Wytwórca',
'LBL_MANUFACTURER' => 'Wytwórca',
'LBL_CONTACT_ID' => 'Kontakt',
'LBL_CONTACT_NAME' => 'Kontakt',
'LBL_VENDOR_ID' => 'Dostawca',
'LBL_VENDOR_NAME' => 'Dostawca',
'LBL_VENDOR_PART_NO' => 'Rodzaj',
'LBL_PRODUCT_ACTIVE' => 'Aktywny',
'LBL_SALES_START_DATE' => 'Data Poczatku Sprzedazy',
'LBL_SALES_END_DATE' => 'Data Zakonczenia Sprzedazy',
'LBL_PARENT_TYPE' => 'Typ Przypisania',
'LBL_PARENT_ID' => 'Przypisanie Do',
'LBL_PARENT_NAME' => 'Przypisanie Do',
'LBL_WEBSITE' => 'Strona Internetowa',
'LBL_PART_NO' => 'Rozmiar',
'LBL_SERIAL_NO' => 'Numer',
'LBL_EXCHANGE_RATE_ID' => 'Waluta',
'LBL_EXCHANGE_RATE_NAME' => 'Waluta',
'LBL_FOB_PRICE' => 'Cena FOB',
'LBL_UNIT_PRICE' => 'Cena Zakupu',
'LBL_EMS_PRICE' => 'Średnia cena zakupu',
'LBL_COMMISSION_RATE' => 'Prowizja',
'LBL_CUSTOM_DUTY_RATE' => 'Poziom Cla',
'LBL_SRP_PRICE' => 'Cena SRP',
'LBL_SRP_PROMO_PRICE' => 'Cena SRP Promo',
'LBL_TAX_CLASS_ID' => 'Vat',
'LBL_TAX_CLASS_NAME' => 'Vat',
'LBL_USAGE_UNIT_ID' => 'Opakowanie',
'LBL_USAGE_UNIT_NAME' => 'Opakowanie',
'LBL_EMS_QTY_IN_STOCK' => 'Ilosc na Magazynie EMS',
'LBL_SALES_LAST_MONTH_1' => 'Sprzedaz w Ostatnim Miesiacu -1',
'LBL_SALES_LAST_MONTH' => 'Sprzedaz w Ostatnim Miesiacu',
'LBL_SALES_THIS_MONTH' => 'Sprzedaz w Tym Miesiacu',
'LBL_QTY_PER_UNIT' => 'Ilosc na Szt.',
'LBL_AVERAGE_SALE_3_MONTHS' => 'Srednia Sprzedaz w Ostatnich 3 Miesiacach',
'LBL_SALES_PLUS_1' => 'Sprzedaz plus 1',
'LBL_SALES_PLUS_2' => 'Sprzedaz plus 2',
'LBL_SALES_PLUS_3' => 'Sprzedaz plus 3',
'LBL_PRODUCT_PICTURE' => 'Obrazek',
'LBL_PACKING_FRONT_PICTURE' => 'Obrazek Opakowania',
'LBL_DRIVER_1' => 'Sterownik 1',
'LBL_DRIVER_2' => 'Sterownik 2',
'LBL_MOQ' => 'MOQ',
'LBL_FOB_BASIS_ID' => 'Baza FOB',
'LBL_FOB_BASIS_NAME' => 'Baza FOB',
'LBL_DELIVERY_TIME_FOB' => 'Czas Dostarczenia FOB',
'LBL_PIECES_PER_CARTON' => 'Sztuk w Kartonie',
'LBL_PRODUCT_NETTO_WEIGHT' => 'Waga Produktu Netto (kg)',
'LBL_PRODUCT_BRUTTO_WEIGHT' => 'Waga Produktu Brutto (kg)',
'LBL_PACKING_TYPE_ID' => 'Typ Opakowania',
'LBL_PACKING_TYPE_NAME' => 'Typ Opakowania',
'LBL_PACKING_DIMENSIONS_1' => 'Rozmiar Opakowania (cm)',
'LBL_PACKING_DIMENSIONS_2' => 'Rozmiar Opakowania (cm)',
'LBL_PACKING_DIMENSIONS_3' => 'Rozmiar Opakowania (cm)',
'LBL_RMA' => 'RMA (%)',
'LBL_CARTON_DIMENSIONS_1' => 'Rozmiar Kartonu (m)',
'LBL_CARTON_DIMENSIONS_2' => 'Rozmiar Kartonu (m)',
'LBL_CARTON_DIMENSIONS_3' => 'Rozmiar Kartonu (m)',
'LBL_CARTON_NETTO_WEIGHT' => 'Waga Kartonu Netto',
'LBL_CARTON_BRUTTO_WEIGHT' => 'Waga Kartonu Brutto',
'LBL_CARTON_VOLUME_METER' => 'Objetosc Kartonu (cubic meter)',
'LBL_CARTON_VOLUME_FEET' => 'Objetosc Kartonu (cubic feet)',
'LBL_COUNTRY_OF_ORIGIN' => 'Kraj Pochodzenia',
'LBL_CERTIFICATE_OF_ORIGIN' => 'Certyfikat',
'LBL_FORM_A' => 'Form A',
// FOR GROUPS
'LBL_GROUP_MASTER' => 'INFORMACJE O PRODUKCIE',
'LBL_GROUP_PRODUCT_INDEX' => '',
'LBL_GROUP_PRODUCT_CATEGORY_ID' => '',
'LBL_GROUP_PRODUCT_CATEGORY' => '',
'LBL_GROUP_PRODUCT_LINE_ID' => '',
'LBL_GROUP_PRODUCT_LINE' => '',
'LBL_GROUP_MANUFACTURER_ID' => '',
'LBL_GROUP_MANUFACTURER' => '',
'LBL_GROUP_CONTACT_ID' => '',
'LBL_GROUP_CONTACT_NAME' => '',
'LBL_GROUP_VENDOR_ID' => '',
'LBL_GROUP_VENDOR_NAME' => '',
'LBL_GROUP_VENDOR_PART_NO' => '',
'LBL_GROUP_PRODUCT_ACTIVE' => '',
'LBL_GROUP_SALES_START_DATE' => '',
'LBL_GROUP_SALES_END_DATE' => '',
'LBL_GROUP_PARENT_TYPE' => '',
'LBL_GROUP_PARENT_ID' => '',
'LBL_GROUP_PARENT_NAME' => '',
'LBL_GROUP_WEBSITE' => '',
'LBL_GROUP_PART_NO' => '',
'LBL_GROUP_SERIAL_NO' => '',
'LBL_GROUP_EXCHANGE_RATE_ID' => '',
'LBL_GROUP_EXCHANGE_RATE_NAME' => '',
'LBL_GROUP_FOB_PRICE' => '',
'LBL_GROUP_UNIT_PRICE' => '',
'LBL_GROUP_EMS_PRICE' => '',
'LBL_GROUP_COMMISSION_RATE' => '',
'LBL_GROUP_CUSTOM_DUTY_RATE' => '',
'LBL_GROUP_SRP_PRICE' => '',
'LBL_GROUP_SRP_PROMO_PRICE' => '',
'LBL_GROUP_TAX_CLASS_ID' => '',
'LBL_GROUP_TAX_CLASS_NAME' => '',
'LBL_GROUP_USAGE_UNIT_ID' => '',
'LBL_GROUP_USAGE_UNIT_NAME' => '',
'LBL_GROUP_EMS_QTY_IN_STOCK' => '',
'LBL_GROUP_SALES_LAST_MONTH_1' => '',
'LBL_GROUP_SALES_LAST_MONTH' => '',
'LBL_GROUP_SALES_THIS_MONTH' => '',
'LBL_GROUP_QTY_PER_UNIT' => '',
'LBL_GROUP_AVERAGE_SALE_3_MONTHS' => '',
'LBL_GROUP_SALES_PLUS_1' => '',
'LBL_GROUP_SALES_PLUS_2' => '',
'LBL_GROUP_SALES_PLUS_3' => '',
'LBL_GROUP_PRODUCT_PICTURE' => '',
'LBL_GROUP_PACKING_FRONT_PICTURE' => '',
'LBL_GROUP_DRIVER_1' => '',
'LBL_GROUP_DRIVER_2' => '',
'LBL_GROUP_MOQ' => '',
'LBL_GROUP_FOB_BASIS_ID' => '',
'LBL_GROUP_FOB_BASIS_NAME' => '',
'LBL_GROUP_DELIVERY_TIME_FOB' => '',
'LBL_GROUP_PIECES_PER_CARTON' => '',
'LBL_GROUP_PRODUCT_NETTO_WEIGHT' => '',
'LBL_GROUP_PRODUCT_BRUTTO_WEIGHT' => '',
'LBL_GROUP_PACKING_TYPE_ID' => '',
'LBL_GROUP_PACKING_TYPE_NAME' => '',
'LBL_GROUP_PACKING_DIMENSIONS_1' => '',
'LBL_GROUP_PACKING_DIMENSIONS_2' => '',
'LBL_GROUP_PACKING_DIMENSIONS_3' => '',
'LBL_GROUP_RMA' => '',
'LBL_GROUP_CARTON_DIMENSIONS_1' => '',
'LBL_GROUP_CARTON_DIMENSIONS_2' => '',
'LBL_GROUP_CARTON_DIMENSIONS_3' => '',
'LBL_GROUP_CARTON_NETTO_WEIGHT' => '',
'LBL_GROUP_CARTON_BRUTTO_WEIGHT' => '',
'LBL_GROUP_CARTON_VOLUME_METER' => '',
'LBL_GROUP_CARTON_VOLUME_FEET' => '',
'LBL_GROUP_COUNTRY_OF_ORIGIN' => '',
'LBL_GROUP_CERTIFICATE_OF_ORIGIN' => '',
'LBL_GROUP_FORM_A' => '',
// FOR SUBPANELS
'LBL_ECMPRODUCTS_SUBPANEL_TITLE' => 'Produkty',
'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Aktywnosci',
'LBL_HISTORY_SUBPANEL_TITLE' => 'Historia',
'LBL_ECMPRODUCTS' => 'Produkty',
// FOR MENU LABELS
'LNK_NEW_ECMPRODUCTS' => 'Utwórz Produkt',
'LNK_LIST_ECMPRODUCT' => 'Lista Produktów',
// FOR MENU LINKS
'LNK_NEW_ECMPRODUCT' => 'Utwórz Produkt',
'LNK_ECMPRODUCTS_LIST' => 'Produkty',
'LNK_ECMPRODUCTS_REPORTS' => 'Raport Produktów',
// FOR ADDITIONAL MENUS
// FOR DASHLETS
'LBL_LIST_ECMPRODUCTS' => 'Produkty',
'LBL_COMPONENTS' => 'Komponenty',
'LBL_ITEMS' => 'Komponenty',
'LBL_EDITTABLE_NO' => 'Nr.',
'LBL_EDITTABLE_CODE' => 'Kod',
'LBL_EDITTABLE_NAME' => 'Nazwa',
'LBL_EDITTABLE_UNIT' => 'Szt.',
'LBL_EDITTABLE_QUANTITY' => 'Ilosc',
'LBL_EDITTABLE_OPTIONS' => 'Opc.',
'LBL_GRADUATED_PRICES' => 'Ceny wg. ilości sztuk',
'LBL_PRODUCT_GRADUATED_COUNT' => 'Liczba',
'LBL_PRODUCT_GRADUATED_PRICE' => 'Price',
'LBL_PRODUCT_GRADUATED_ADD' => 'Dodaj',
'LBL_PRODUCT_GRADUATED_REMOVE' => 'Usuń',
'LBL_CATEGORY_NAME' => 'Nazwa kategori',
//mz 12.10.2011
'LBL_EAN2' => 'EAN 2',
'LBL_EAN' => 'EAN',
'LBL_GENERATE_EAN' => 'Wygeneruj',
);
?>

View File

@@ -0,0 +1,117 @@
<?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.
********************************************************************************/
$smarty->debugging = true;
$smarty->debugging_ctrl=($_SERVER['SERVER_NAME']=='localhost:8080')?'URL':'NONE';
$layout_defs['EcmProducts'] = array(
//LIST OF WHAT SUBPANELS TO SHOW IN THE DETAILVIEW
'subpanel_setup' => array(
'ecmstockdocins' => array (
'order' => 10,
'module' => 'EcmStockDocIns',
'sort_order' => 'asc',
'get_subpanel_data' => 'ecmstockdocins',
'add_subpanel_data' => 'product_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSTOCKINS_SUBPANEL_TITLE',
),
'ecmstockdocouts' => array (
'order' => 20,
'module' => 'EcmStockDocOuts',
'sort_order' => 'asc',
'get_subpanel_data' => 'ecmstockdocouts',
'add_subpanel_data' => 'product_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSTOCKDOCOUTS_SUBPANEL_TITLE',
),
'ecmpurchaseorders' => array (
'order' => 30,
'module' => 'EcmPurchaseOrders',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmpurchaseorders',
'add_subpanel_data' => 'product_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMPURCHASEORDERS_SUBPANEL_TITLE',
),
'ecmquotes' => array (
'order' => 40,
'module' => 'EcmQuotes',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmquotes',
'add_subpanel_data' => 'product_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMQUOTES_SUBPANEL_TITLE',
),
'ecmsales' => array (
'order' => 50,
'module' => 'EcmSales',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmsales',
'add_subpanel_data' => 'product_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSALES_SUBPANEL_TITLE',
),
'notes' => array (
'order' => 110,
'module' => 'Notes',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'notes',
'add_subpanel_data' => 'parent_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_NOTES_SUBPANEL_TITLE',
),
),
);
?>

View File

@@ -0,0 +1,121 @@
<?php
class merlinXML {
private $p; // paczka
private $date;
function merlinXML($date) {
$this->date = $date;
$this->p = new XMLWriter ();
$this->p->openURI ( 'cache/file.xml' );
// $this->p->openMemory();
$this->p->startDocument ( '1.0', 'UTF-8' );
$this->p->startElement ( 'PRODUCTS' );
if($date!=''){
$this->p->writeAttribute('create-date', date(DATE_ATOM));
}
$this->p->writeAttribute('currency-code', 'PLN');
}
function addProduct($id){
$db = $GLOBALS ['db'];
$product = $db->query ("select * from ecmproducts where id='".$id."'");
$i = $db->fetchByAssoc ( $product );
$this->p->startElement ( 'PRODUCT' );
$this->p->writeAttribute('group-id', '???');
$this->p->writeAttribute('group-property', '???');
$this->p->writeAttribute('availability', '???');
$this->p->writeElement( 'ID',$i['id'] );
$this->p->startElement('NAME');
$this->p->writeCData(html_entity_decode($i['name']));
$this->p->endElement();
$this->p->writeElement( 'EAN',$i['ean'] );
$this->p->writeElement( 'PRICE','???' ); // cena zakupu merlin
$this->p->writeElement( 'MARKET_PRICE','???' ); // cena detaliczna brutto
//vat
$v = new EcmVat;
$v->retrieve($i['vat_id']);
$vat=substr($v->name, 0, -1);
$this->p->writeElement( 'VAT',$vat );
$this->p->writeElement( 'DISCOUNT','???' ); // UPUST jesli istnieje
//opis
$desc = $db->query ("select * from ecmproduct_language_pl_view where ecmproduct_id='".$id."'");
$opis = $db->fetchByAssoc ( $desc );
$this->p->startElement('DESCRIPTION');
$this->p->writeCData( html_entity_decode($opis['long_description']));
$this->p->endElement();
$this->p->writeElement( 'DATE',date('Y-m-d',strtotime($i['date_entered'])) ); // data utworzenia produktu
//kategorie
$catq = $db->query ("select c.name,c.id from ecmproductcategories_bean as b
join ecmproductcategories as c on b.ecmproductcategory_id=c.id
where b.bean_id='".$id."'");
$this->p->startElement ( 'CATEGORIES' );
while($cat = $db->fetchByAssoc ( $catq )){
$this->p->startElement ( 'CATEGORY');
$this->p->writeAttribute ( 'id', $cat['id'] );
$this->p->text($cat['name']);
$this->p->endElement();
}
$this->p->endElement();
//firma
$this->p->startElement ( 'FIRMS' );
$this->p->startElement ( 'FIRM');
$this->p->writeAttribute ( 'role', 'producent' );
$this->p->writeCData('E5 Polska Sp. z o.o.');
$this->p->endElement();
$this->p->endElement();
// opakowanie
$this->p->startElement ( 'PACKAGE' );
$this->p->startElement ( 'DIMENSIONS');
$this->p->writeAttribute ( 'height', $i['packing_dimensions_1'] );
$this->p->writeAttribute ( 'width', $i['packing_dimensions_2'] );
$this->p->writeAttribute ( 'depth', $i['packing_dimensions_3'] );
$this->p->writeAttribute ( 'unit', 'cm' );
$this->p->endElement ();
$this->p->endElement ();
//stany magazynowe
$this->p->startElement ( 'STOCK' );
$this->p->text('???'); // REALNE, T czy N
$this->p->endElement ();
//zdjecia
$this->p->startElement ( 'IMAGES' );
$this->p->startElement ( 'IMAGE');
$this->p->writeAttribute ( 'name', 'zdjęcie' );
$this->p->writeCData('http://???.??/????.jpg');
$this->p->endElement();
$this->p->endElement();
//url
$this->p->startElement ( 'URL_PRODUCT' );
$this->p->writeCData('http://???.??/????.jpg');
$this->p->endElement();
$this->p->endElement ();
}
function getXML() {
$this->p->endElement (); // </produkty>
$this->p->flush ();
}
}
function e($value) {
if (!is_null($value) && $value!='')
return $value;
else
return ' ';
}
?>

View File

@@ -0,0 +1,66 @@
<?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['EcmProducts'] =
array (
'name' => 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',
'my_items' => true),
'product_active' => array('query_type' => 'default'),
'end_of_line' => array('query_type' => 'default'),
'production' => array('query_type' => 'default'),
'status' => array('query_type' => 'default', 'options' => 'ecmproducts_status_dom', 'template_var' => 'STATUS'),
'manufacturer_name'=> array('query_type'=>'default', 'options' => 'ecmproductmanufacturers_name_dom', 'template_var' => 'MANUFACTURER'),
'product_category_name'=> array('query_type'=>'default'),
);
?>

View File

@@ -0,0 +1,79 @@
<?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.
********************************************************************************/
require_once('include/utils.php');
function additionalDetailsEcmProduct($fields) {
static $mod_strings;
global $app_strings;
if(empty($mod_strings)) {
global $current_language;
$mod_strings = return_module_language($current_language, 'EcmProducts');
}
$overlib_string = '';
//BUILDER:START overlibstring
if(!empty($fields['PRODUCT_INDEX'])){
$overlib_string .= '<b>'. $mod_strings['LBL_PRODUCT_INDEX'] . '</b> <BR>' . substr($fields['PRODUCT_INDEX'], 0, 300);
if(strlen($fields['PRODUCT_INDEX']) > 300) $overlib_string .= '...';
$overlib_string .= '<br>';
}
//BUILDER:END overlibstring
return array(
'fieldToAddTo' => 'NAME',
'string' => $overlib_string,
'editLink' => "index.php?action=EditView&module=EcmProducts&return_module=EcmProducts&record={$fields['ID']}",
'viewLink' => "index.php?action=DetailView&module=EcmProducts&return_module=EcmProducts&record={$fields['ID']}");
}
?>

View File

@@ -0,0 +1,587 @@
<?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".
********************************************************************************/
$viewdefs ['EcmProducts'] ['DetailView'] = array (
'templateMeta' => array (
'form' => array (
'buttons' => array (
'EDIT',
'DUPLICATE',
'DELETE',
'FIND_DUPLICATES',
array (
'customCode' => '{$CATALOGUE_NEW}'
),
array (
'customCode' => '<input class="button" type="submit" value="{$MOD.LBL_ALLEGRO}" onClick="this.form.action.value=\'allegroTemplate\';">'
)
),
'hidden' => array (
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>'
)
),
'maxColumns' => '2',
'widths' => array (
array (
'label' => '10',
'field' => '30'
),
array (
'label' => '10',
'field' => '30'
)
),
'includes' => array (
array (
'file' => 'include/JSON.js'
),
// array('file'=>'include/javascript/quicksearch.js'),
// array('file'=>'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js'),
array (
'file' => 'modules/EcmProducts/AjaxSearch/AjaxSearch.js'
),
array (
'file' => 'modules/EcmProducts/javascript/formloader.js'
),
array (
// 'file' => 'modules/EcmProducts/javascript/MyTable.js'
),
array (
// 'file' => 'modules/EcmProducts/javascript/EcmProductDetailView.js'
),
array (
'file' => 'modules/EcmProducts/javascript/ProductionTables.js'
),
array (
'file' => 'modules/EcmProducts/javascript/ProductionSummary.js'
)
)
),
// array('file'=>'modules/EcmQuotes/CreateItem.js'),
// array('file'=>'modules/EcmProducts/mintajax.js'),
// array('file'=>'modules/EcmProducts/helper.js'),
'panels' => array (
'LBL_PRODUCT_INFORMATION' => array (
array (
'name',
'assigned_user_name'
),
array (
'code',
'product_active'
),
array (
'ean',
'ean2'
),
array (
'vendor_name',
'part_no'
),
array (
'vendor_part_no',
'serial_no'
),
array (
'brand',
'brand_label'
),
array (
'production',
'status'
),
// array('product_category_name','product_subcategory_name'),
// array('product_line_name'),
// array('sales_start_date','sales_end_date'),
// array('manufacturer_name','parent_name'),
// array('contact_name','website'),
// array('vendor_name','part_no'),
// array('vendor_part_no','serial_no'),
array (
'group_ks',
'mainproduct_name'
),
array (
'active',
'is_mainproduct'
),
array (
'group_name',
),
),
'LBL_PRICING_INFORMATION' => array (
array (
array (
'customCode' => '{$EXCHANGE_RATE_NAME}',
'label' => 'LBL_EXCHANGE_RATE_NAME'
),
'custom_duty_rate'
),
array (
'vat_name',
'commission_rate'
),
array (
'purchase_price',
'srp_price'
),
array (
'selling_price',
'srp_price_eur'
),
array (
'fob_price',
'srp_promo_price'
),
array (
'ems_price'
)
),
'LBL_STOCK_INFORMATION' => array (
array (
array (
'customCode' => '{$ORDERED}',
'label' => 'Zamówień'
),
'qty_per_unit'
),
array (
'qty_in_stock',
'reorder_level'
),
array (
'ems_qty_in_stock',
'qty_in_demand'
),
array (
array (
'customCode' => '{$INVENTORY_INFORMATION}',
'label' => 'Inventory informations'
),
'lead_time'
),
array (
'stock_addresses'
)
),
/*
'LBL_SELLING_THIS_MONTH_INFORMATION' => array (
array (
'this_month_val',
'this_month_qty'
),
array (
'this_month_cost',
'this_month_margin'
)
),
'LBL_SELLING_LAST_MONTH_INFORMATION' => array (
array (
'last_month_val',
'last_month_qty'
),
array (
'last_month_cost',
'last_month_margin'
)
),
'LBL_SELLING_Q1_INFORMATION' => array (
array (
'q1_val',
'q1_qty'
),
array (
'q1_cost',
'q1_margin'
)
),
'LBL_SELLING_LAST_Q1_INFORMATION' => array (
array (
'last_q1_val',
'last_q1_qty'
),
array (
'last_q1_cost',
'last_q1_margin'
)
),
'LBL_SELLING_Q2_INFORMATION' => array (
array (
'q2_val',
'q2_qty'
),
array (
'q2_cost',
'q2_margin'
)
),
'LBL_SELLING_LAST_Q2_INFORMATION' => array (
array (
'last_q2_val',
'last_q2_qty'
),
array (
'last_q2_cost',
'last_q2_margin'
)
),
'LBL_SELLING_Q3_INFORMATION' => array (
array (
'q3_val',
'q3_qty'
),
array (
'q3_cost',
'q3_margin'
)
),
'LBL_SELLING_LAST_Q3_INFORMATION' => array (
array (
'last_q3_val',
'last_q3_qty'
),
array (
'last_q3_cost',
'last_q3_margin'
)
),
'LBL_SELLING_Q4_INFORMATION' => array (
array (
'q4_val',
'q4_qty'
),
array (
'q4_cost',
'q4_margin'
)
),
'LBL_SELLING_LAST_Q4_INFORMATION' => array (
array (
'last_q4_val',
'last_q4_qty'
),
array (
'last_q4_cost',
'last_q4_margin'
)
),
'LBL_SELLING_THIS_YEAR_INFORMATION' => array (
array (
'this_year_val',
'this_year_qty'
),
array (
'this_year_cost',
'this_year_margin'
)
),
'LBL_SELLING_LAST_YEAR_INFORMATION' => array (
array (
'last_year_val',
'last_year_qty'
),
array (
'last_year_cost',
'last_year_margin'
)
), */
'LBL_WWW_PANEL' => array (
array (
'www_available',
'www_popular'
),
array (
'www_price_pln',
'www_price_eur'
),
array (
'www_state',
'www_manual_update'
),
array (
'www_state_desc_pl',
'www_state_desc_en'
)
),
'LBL_DRIVERS_IMAGES' => array (
array (
array (
'label' => 'LBL_PRODUCT_PICTURE',
'customCode' => '{$PRODUCT_PICTURE}'
),
array (
'label' => 'LBL_PACKING_FRONT_PICTURE',
'customCode' => '{$PACKING_FRONT_PICTURE}'
)
),
array (
array (
'label' => 'LBL_DRIVER_1',
'customCode' => '{$DRIVER_1_DOWNLOAD}'
),
array (
'label' => 'LBL_DRIVER_2',
'customCode' => '{$DRIVER_2_DOWNLOAD}'
)
)
),
'LBL_QRCODE' => array (
array (
array (
'label' => '',
'customCode' => '{$QRCODE}'
)
)
),
'LBL_LOGISTIC_INFORMATION' => array (
array (
'',
array (
'label' => 'LBL_CARTON_DIMENSIONS_1',
'customCode' => '{$CARTON_DIMENSIONS_1} x {$CARTON_DIMENSIONS_2} x {$CARTON_DIMENSIONS_3}'
)
),
array (
'fob_basis_name',
'carton_netto_weight'
),
array (
'',
'carton_brutto_weight'
),
array (
'pieces_per_carton',
'carton_volume_meter'
),
array (
'product_netto_weight',
'unit_id'
),
array (
'product_brutto_weight',
'country_of_origin'
),
array (
'packing_type_name',
''
),
array (
array (
'label' => 'LBL_PACKING_DIMENSIONS_1',
'customCode' => '{$PACKING_DIMENSIONS_1} x {$PACKING_DIMENSIONS_2} x {$PACKING_DIMENSIONS_3}'
),
''
),
array (
'rma'
),
array (
'boxes_per_layer',
'number_of_layers'
),
array (
'boxes_per_palette',
'pieces_per_palette'
),
array (
'palette_weight_brutto',
''
)
),
'LBL_LOCALIZED_INFORMATION' => array (
array (
array (
'hideLabel' => true,
'customCode' => '
<script>
{literal}
function select_lang(value)
{
document.getElementById("remarks_pl").style.display="none";
document.getElementById("short_description_pl").style.display="none";
document.getElementById("long_description_pl").style.display="none";
document.getElementById("price_pl").style.display="none";
document.getElementById("remarks_en").style.display="none";
document.getElementById("short_description_en").style.display="none";
document.getElementById("long_description_en").style.display="none";
document.getElementById("price_en").style.display="none";
document.getElementById("remarks_de").style.display="none";
document.getElementById("short_description_de").style.display="none";
document.getElementById("long_description_de").style.display="none";
document.getElementById("price_de").style.display="none";
document.getElementById("remarks_fr").style.display="none";
document.getElementById("short_description_fr").style.display="none";
document.getElementById("long_description_fr").style.display="none";
document.getElementById("price_fr").style.display="none";
document.getElementById("remarks_it").style.display="none";
document.getElementById("short_description_it").style.display="none";
document.getElementById("long_description_it").style.display="none";
document.getElementById("price_it").style.display="none";
document.getElementById("remarks_es").style.display="none";
document.getElementById("short_description_es").style.display="none";
document.getElementById("long_description_es").style.display="none";
document.getElementById("price_es").style.display="none";
document.getElementById("remarks_"+value).style.display="block";
document.getElementById("short_description_"+value).style.display="block";
document.getElementById("long_description_"+value).style.display="block";
document.getElementById("price_"+value).style.display="block";
}
{/literal}
</script>
<select name="slang" id="slang" onchange="select_lang(this.value);">
<option value="pl">pl</option>
<option value="en">en</option>
<option value="de">de</option>
<option value="fr">fr</option>
<option value="it">it</option>
<option value="es">es</option>
</select>'
)
),
array (
array (
''
),
array (
'label' => 'LBL_REMARKS',
'customCode' => '
<div id="remarks_pl">{$REMARKS_pl}</div>
<div style="display:none;" id="remarks_en">{$REMARKS_en}</div>
<div style="display:none;" id="remarks_de">{$REMARKS_de}</div>
<div style="display:none;" id="remarks_fr">{$REMARKS_fr}</div>
<div style="display:none;" id="remarks_it">{$REMARKS_it}</div>
<div style="display:none;" id="remarks_es">{$REMARKS_es}</div>'
)
),
array (
array (
'label' => 'LBL_SHORT_DESCRIPTION',
'customCode' => '
<div id="short_description_pl">{$SHORT_DESCRIPTION_pl}</div>
<div style="display:none;" id="short_description_en">{$SHORT_DESCRIPTION_en}</div>
<div style="display:none;" id="short_description_de">{$SHORT_DESCRIPTION_de}</div>
<div style="display:none;" id="short_description_fr">{$SHORT_DESCRIPTION_fr}</div>
<div style="display:none;" id="short_description_it">{$SHORT_DESCRIPTION_it}</div>
<div style="display:none;" id="short_description_es">{$SHORT_DESCRIPTION_es}</div>'
),
array (
'label' => 'LBL_LONG_DESCRIPTION',
'customCode' => '
<div id="long_description_pl">{$LONG_DESCRIPTION_pl}</div>
<div style="display:none;" id="long_description_en">{$LONG_DESCRIPTION_en}</div>
<div style="display:none;" id="long_description_de">{$LONG_DESCRIPTION_de}</div>
<div style="display:none;" id="long_description_fr">{$LONG_DESCRIPTION_fr}</div>
<div style="display:none;" id="long_description_it">{$LONG_DESCRIPTION_it}</div>
<div style="display:none;" id="long_description_es">{$LONG_DESCRIPTION_es}</div>'
)
),
array (
array (
'label' => 'LBL_PRICE',
'customCode' => '
<div id="price_pl">{$PRICE_pl}</div>
<div style="display:none;" id="price_en">{$PRICE_en}</div>
<div style="display:none;" id="price_de">{$PRICE_de}</div>
<div style="display:none;" id="price_fr">{$PRICE_fr}</div>
<div style="display:none;" id="price_it">{$PRICE_it}</div>
<div style="display:none;" id="price_es">{$PRICE_es}</div>'
)
)
),
'LBL_PANEL_CATEGORIES' => array (
0 => array (
0 => array (
'name' => 'items_list_panel3',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$POSITIONS3}'
)
)
),
'LBL_PANEL_PRICES' => array (
0 => array (
0 => array (
'name' => 'items_list_panel4',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$POSITIONS4}'
)
)
),
'LBL_PRODUCTION_PANEL' => array (
array (
array (
'name' => 'production_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div>
<br><br><div id="summaryTable" style="width: 50%; padding-right: 0px;">Podsumowanie</div>'
)
)
),
'LBL_PANEL_ASSIGNMENT' => array (
array (
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO'
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}'
)
),
array (
array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}'
)
)
)
)
);
?>

View File

@@ -0,0 +1,575 @@
<?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".
********************************************************************************/
$viewdefs['EcmProducts']['EditView'] = array(
'templateMeta' => array(
'form' => array(
'buttons' => array(
'SAVE',
'CANCEL'
),
'enctype' => 'multipart/form-data',
'hidden' => array(
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>'
)
),
'maxColumns' => '2',
'widths' => array(
array(
'label' => '10',
'field' => '30'
),
array(
'label' => '10',
'field' => '30'
)
),
'includes' => array(
array(
'file' => 'include/JSON.js'
),
// array('file'=>'include/javascript/quicksearch.js'),
// array('file'=>'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js'),
array(
'file' => 'modules/EcmProducts/AjaxSearch/AjaxSearch.js'
),
array(
'file' => 'modules/EcmProducts/javascript/formloader.js'
),
array(
'file' => 'modules/EcmProducts/javascript/MyTable.js'
),
array(
'file' => 'modules/EcmProducts/javascript/EcmProduct.js'
),
// array('file'=>'modules/EcmQuotes/CreateItem.js'),
// array('file'=>'modules/EcmProducts/mintajax.js'),
// array('file'=>'modules/EcmProducts/helper.js'),
array(
'file' => 'modules/EcmProducts/Categories.js'
),
array(
'file' => 'modules/EcmProducts/Prices.js'
),
array(
'file' => 'modules/EcmProducts/paramsMT.js'
),
array(
'file' => 'modules/EcmProducts/javascript/ProductionTables.js'
),
array(
'file' => 'modules/EcmProducts/javascript/ProductionCopyElements.js'
)
)
),
'panels' => array(
'LBL_PRODUCT_INFORMATION' => array(
array(
'code',
array(
'name' => 'created_by_link',
'customCode' => '{$CREATED_BY_NAME}'
),
),
array(
array (
'name' => 'name',
'customCode' => '<textarea tabindex="1" name="name" id="name" rows="3" style="width: 100%;">{$fields.name.value}</textarea>'
),
'date_entered'
),
array(
'status',
array(
'name' => 'ean',
'label' => 'LBL_EAN',
'customCode' => '
<input name="ean" id="ean" value="{$EAN}">
<input type="button" class="button" onClick="generateEAN();" value="{$MOD.LBL_GENERATE_EAN}"/>
<input type="hidden" name="newEan" id="newEan" value="0"/><input type="hidden" name="website_update" id="website_update" value="1"/>'
),
),
array(
'category',
array(
'name' => 'ean2',
'label' => 'LBL_EAN2',
'customCode' => '
<input name="ean2" id="ean2" value="{$EAN2}">
<input type="button" class="button" onClick="generateEAN2(); alert(document.getElementById(\'newEan2\').value)" value="{$MOD.LBL_GENERATE_EAN}"/>
<input type="hidden" name="newEan2" id="newEan2" value="0"/>'
)
),
array(
'product_group',
'number'
),
array(
'brand',
'ufi'
),
array(
'attribute',
''
),
array(
'shape',
''
),
array(
'group_ks',
''
),
),
'LBL_DRIVERS_IMAGES' => array(
array(
'url1',
'url2'
),
array(
'url3',
'url4'
),
array(
'url5',
'url6'
),
array(
'url7',
'url8'
),
array(
'url9',
''
),
),
/*
'LBL_PRODUCT_INFORMATION' => array (
array (
array (
'name' => 'code',
'customCode' => '<input name="code" id="code" value="{$fields.code.value}" onBlur="checkCode(document.getElementById(\'code\').value);">
<br><a href="#" onclick="searchCode(document.getElementById(\'code\').value);">{$MOD.LBL_SEARCH_CODE}</a>
<br><a href="#" onclick="freeCodes(document.getElementById(\'code\').value);">{$MOD.LBL_FREE_CODES}</a>'
),
'product_active'
),
array (
array (
'name' => 'ean',
'label' => 'LBL_EAN',
'customCode' => '<input name="ean" id="ean" value="{$EAN}">
<input type="button" class="button" onClick="generateEAN();" value="{$MOD.LBL_GENERATE_EAN}"/>
<input type="hidden" name="newEan" id="newEan" value="0"/><input type="hidden" name="website_update" id="website_update" value="1"/>
'
),
array (
'name' => 'ean2',
'label' => 'LBL_EAN2',
'customCode' => '<input name="ean2" id="ean2" value="{$EAN2}">
<input type="button" class="button" onClick="generateEAN2(); alert(document.getElementById(\'newEan2\').value)" value="{$MOD.LBL_GENERATE_EAN}"/>
<input type="hidden" name="newEan2" id="newEan2" value="0"/>
'
)
),
array (
'vendor_name',
'part_no'
),
array (
'vendor_part_no',
'serial_no'
),
array (
'brand',
'brand_label'
),
array (
'production',
'status'
),
array (
'group_ks',
'mainproduct_name'
),
array (
'active',
'is_mainproduct'
),
array (
'group_name',
),
),
*/
'LBL_PRICING_INFORMATION' => array(
array(
array(
'label' => 'LBL_EXCHANGE_RATE_NAME',
'customCode' => '<select tabindex="e" id="exchange_rate_id" name="exchange_rate_id">{$EXCHANGE_RATE_ID}</select>'
),
'custom_duty_rate'
),
array(
array(
'label' => 'LBL_TAX_CLASS_NAME',
'customCode' => '<select tabindex="v" id="vat_id" name="vat_id">{$VAT_ID}</select>'
),
'commission_rate'
),
array(
'purchase_price',
'srp_price'
),
array(
'selling_price',
'srp_price_eur'
),
array(
'fob_price',
'srp_promo_price'
)
),
'LBL_STOCK_INFORMATION' => array(
array(
'ems_ordered',
'qty_per_unit'
),
array(
'qty_in_stock',
'reorder_level'
),
array(
'',
'qty_in_demand'
),
array(
'lead_time'
)
),
'LBL_WWW_PANEL' => array(
array(
'www_available',
'www_popular'
),
array(
'www_price_pln',
'www_price_eur'
),
array(
'www_state',
'www_manual_update'
),
array(
'www_state_desc_pl',
'www_state_desc_en'
)
),
/*
'LBL_DRIVERS_IMAGES' => array(
array(
array(
'label' => 'LBL_PRODUCT_PICTURE',
'customCode' => '<input name="product_picture" type="file" maxlength="255" value="" />{$PRODUCT_PICTURE_UPLOAD}'
),
array(
'label' => 'LBL_PACKING_FRONT_PICTURE',
'customCode' => '<input name="packing_front_picture" type="file" maxlength="255" value="" />{$PACKING_FRONT_PICTURE_UPLOAD}'
)
),
array(
array(
'label' => 'Usuń zdjęcie',
'customCode' => '<input name="delete_product_picture" type="checkbox" maxlength="255" value="1" />'
),
array(
'label' => 'Usuń zdjęcie',
'customCode' => '<input name="delete_packing_front_picture" type="checkbox" maxlength="255" value="1" />'
)
),
array(
array(
'label' => 'LBL_DRIVER_1',
'customCode' => '<input name="driver_1" type="file" maxlength="255" value="" />{$DRIVER_1_UPLOAD}'
),
array(
'label' => 'LBL_DRIVER_2',
'customCode' => '<input name="driver_2" type="file" maxlength="255" value="" />{$DRIVER_2_UPLOAD}'
)
)
),
*/
'LBL_LOGISTIC_INFORMATION' => array(
array(
'moq',
array(
'label' => 'LBL_CARTON_DIMENSIONS_1',
'customCode' => '<input name="carton_dimensions_1" size="3" maxlength="25" type="text" value="{$CARTON_DIMENSIONS_1}" /> x
<input name="carton_dimensions_2" size="3" maxlength="25" type="text" value="{$CARTON_DIMENSIONS_2}" /> x
<input name="carton_dimensions_3" size="3" maxlength="25" type="text" value="{$CARTON_DIMENSIONS_3}" />'
)
),
array(
array(
'label' => 'LBL_FOB_BASIS_NAME',
'customCode' => '<select id="fob_basis_id" name="fob_basis_id">{$FOB_BASIS_ID}</select>'
),
'carton_netto_weight'
),
array(
'delivery_time_fob',
'carton_brutto_weight'
),
array(
'pieces_per_carton',
'carton_volume_meter'
),
array(
'product_netto_weight',
'unit_id'
),
array(
'product_brutto_weight',
'country_of_origin'
),
array(
array(
'label' => 'LBL_PACKING_TYPE_NAME',
'customCode' => '<select id="packing_type_id" name="packing_type_id">{$PACKING_TYPE_ID}</select>'
),
'certificate_of_origin'
),
array(
array(
'label' => 'LBL_PACKING_DIMENSIONS_1',
'customCode' => '<input name="packing_dimensions_1" size="3" maxlength="25" type="text" value="{$PACKING_DIMENSIONS_1}" /> x
<input name="packing_dimensions_2" size="3" maxlength="25" type="text" value="{$PACKING_DIMENSIONS_2}" /> x
<input name="packing_dimensions_3" size="3" maxlength="25" type="text" value="{$PACKING_DIMENSIONS_3}" />'
),
'form_a'
),
array(
'rma'
),
array(
'boxes_per_layer',
'number_of_layers'
),
array(
'boxes_per_palette',
'pieces_per_palette'
),
array(
'palette_weight_brutto',
''
)
),
'LBL_LOCALIZED_INFORMATION' => array(
array(
array(
'hideLabel' => true,
'customCode' => '
<script>
{literal}
function select_lang(value)
{
document.getElementById("remarks_pl").style.display="none";
document.getElementById("short_description_pl").style.display="none";
document.getElementById("long_description_pl").style.display="none";
document.getElementById("price_pl").style.display="none";
document.getElementById("remarks_en").style.display="none";
document.getElementById("short_description_en").style.display="none";
document.getElementById("long_description_en").style.display="none";
document.getElementById("price_en").style.display="none";
document.getElementById("remarks_de").style.display="none";
document.getElementById("short_description_de").style.display="none";
document.getElementById("long_description_de").style.display="none";
document.getElementById("price_de").style.display="none";
document.getElementById("remarks_fr").style.display="none";
document.getElementById("short_description_fr").style.display="none";
document.getElementById("long_description_fr").style.display="none";
document.getElementById("price_fr").style.display="none";
document.getElementById("remarks_it").style.display="none";
document.getElementById("short_description_it").style.display="none";
document.getElementById("long_description_it").style.display="none";
document.getElementById("price_it").style.display="none";
document.getElementById("remarks_es").style.display="none";
document.getElementById("short_description_es").style.display="none";
document.getElementById("long_description_es").style.display="none";
document.getElementById("price_es").style.display="none";
document.getElementById("remarks_"+value).style.display="block";
document.getElementById("short_description_"+value).style.display="block";
document.getElementById("long_description_"+value).style.display="block";
document.getElementById("price_"+value).style.display="block";
}
{/literal}
</script>
<select name="slang" id="slang" onchange="select_lang(this.value);">
<option value="pl">pl</option>
<option value="en">en</option>
<option value="de">de</option>
<option value="fr">fr</option>
<option value="it">it</option>
<option value="es">es</option>
</select>'
)
),
array(
array(
''
),
array(
'label' => 'LBL_REMARKS',
'customCode' => '
<input name="remarks_pl" type="text" id="remarks_pl" value="{$REMARKS_pl}" />
<input style="display:none;" name="remarks_en" type="text" id="remarks_en" value="{$REMARKS_en}" />
<input style="display:none;" name="remarks_de" type="text" id="remarks_de" value="{$REMARKS_de}" />
<input style="display:none;" name="remarks_fr" type="text" id="remarks_fr" value="{$REMARKS_fr}" />
<input style="display:none;" name="remarks_it" type="text" id="remarks_it" value="{$REMARKS_it}" />
<input style="display:none;" name="remarks_es" type="text" id="remarks_es" value="{$REMARKS_es}" />'
)
),
array(
array(
'label' => 'LBL_SHORT_DESCRIPTION',
'customCode' => '
<textarea cols="80" rows="20" name="short_description_pl" type="text" id="short_description_pl">{$SHORT_DESCRIPTION_pl}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="short_description_en" type="text" id="short_description_en">{$SHORT_DESCRIPTION_en}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="short_description_de" type="text" id="short_description_de">{$SHORT_DESCRIPTION_de}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="short_description_fr" type="text" id="short_description_fr">{$SHORT_DESCRIPTION_fr}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="short_description_it" type="text" id="short_description_it">{$SHORT_DESCRIPTION_it}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="short_description_es" type="text" id="short_description_es">{$SHORT_DESCRIPTION_es}</textarea>'
),
array(
'label' => 'LBL_LONG_DESCRIPTION',
'customCode' => '
<textarea name="long_description_pl" cols="80" rows="20" type="text" id="long_description_pl">{$LONG_DESCRIPTION_pl}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="long_description_en" type="text" id="long_description_en">{$LONG_DESCRIPTION_en}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="long_description_de" type="text" id="long_description_de">{$LONG_DESCRIPTION_de}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="long_description_fr" type="text" id="long_description_fr">{$LONG_DESCRIPTION_fr}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="long_description_it" type="text" id="long_description_it">{$LONG_DESCRIPTION_it}</textarea>
<textarea cols="80" rows="20" style="display:none;" name="long_description_es" type="text" id="long_description_es">{$LONG_DESCRIPTION_es}</textarea>'
)
),
array(
array(
'label' => 'LBL_PRICE',
'customCode' => '
<input name="price_pl" type="text" id="price_pl" value="{$PRICE_pl}" />
<input style="display:none;" name="price_en" type="text" id="price_en" value="{$PRICE_en}" />
<input style="display:none;" name="price_de" type="text" id="price_de" value="{$PRICE_de}" />
<input style="display:none;" name="price_fr" type="text" id="price_fr" value="{$PRICE_fr}" />
<input style="display:none;" name="price_it" type="text" id="price_it" value="{$PRICE_it}" />
<input style="display:none;" name="price_es" type="text" id="price_es" value="{$PRICE_es}" />'
)
)
),
'LBL_PANEL_CATEGORIES' => array(
array(
array(
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '
<input type="hidden" name="position_list3" id="position_list3" value=\'{$POSITION_LIST3}\'>
<link rel="stylesheet" type="text/css" href="modules/Accounts/MyTable.css" />
<div style="width:30%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV3">
<table class="positions" style="width:100%;" id="itemsTable3">
<thead id="head">
<tr id="tr">
<td width="80%">{$MOD.LBL_CATEGORY_NAME}</td>
<td width="20%"></td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div><br>'
)
),
array(
'part_no',
'vendor_part_no',
),
),
'LBL_PANEL_PRICES' => array(
array(
array(
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '
<input type="hidden" name="position_list4" id="position_list4" value=\'{$POSITION_LIST4}\'>
<link rel="stylesheet" type="text/css" href="modules/Accounts/MyTable.css" />
<div style="width:30%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV">
<table class="positions" style="width:100%;" id="itemsTable4">
<thead id="head">
<tr id="tr">
<td width="70%">{$MOD.LBL_PRICE_NAME}</td>
<td width="30%">{$MOD.LBL_PRICE_VALUE}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div><br>'
)
)
),
'LBL_PRODUCTION_PANEL' => array(
array(
array(
'name' => 'production_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div>
<br><br><div style="width: 17%;" id="copyProduct"></div><div style="width: 17%" id="copyButtons"></div>'
)
)
),
)
);

View File

@@ -0,0 +1,455 @@
<?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 ['EcmProducts'] = array (
'STAN' => array (
'width' => '1',
'default' => true,
'sortable' => false,
'label' => 'Aktualny'
),
'CODE' => array (
'width' => '1',
'default' => true,
'label' => 'LBL_PRODUCT_INDEX'
),
'NAME' => array (
'width' => 200,
'label' => 'Nazwa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
'default' => true,
'link' => true
),
// 'TO_ORDER' => array(
// 'width' => '5',
// 'default' => true,
// 'label' => 'test',
// 'customCode' => 'w',
// ),
'PRODUCT_CATEGORY_NAME' => array (
'width' => '150',
'label' => 'LBL_PRODUCT_CATEGORY',
'module' => 'EcmProductCategories',
'id' => 'PRODUC_CATEGORY_ID',
'default' => true
),
'GROUP_KS' => array (
'width' => '50',
'label' => 'LBL_GROUP_KS',
'default' => true
),
'STOCK_QTY' => array (
'width' => '20',
'sortable' => false,
'label' => 'LBL_MAGAZINE',
'align' =>'right',
'default' => true
),
/*
'QTY_PER_UNIT' => array(
'width' => '1',
'default' => true,
'label' => 'LBL_QTY_PER_UNIT'),
'EMS_QTY_IN_STOCK' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'LBL_LIST_INVENTORY',
),*/
'ORDERED' => array (
'width' => '1',
'default' => true,
'sortable' => true,
'label' => 'Ilość'
),
/*
'ORD_APPROVED' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Ilo uznanych',
),
'ORD_CREATED' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Ilo stw.',
),
'EMS_PRICE' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'LBL_EMS_PRICE',
),
'STOCK_VALUE' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Cena',
), */
'PIECES_PER_CARTON' => array (
'width' => '1',
'default' => true,
'sortable' => false,
'label' => 'Ppc'
),/*
'Q0' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Ilo w m',
),
'S0'=>array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Spr w m',
),
'P0'=>array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Marg w m %',
),
'Q3' => array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Średnia ilość w 3 m',
),
'S3'=>array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Spr w 3 m',
),
'P3'=>array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Marg w 3 m %',
),
/*'CBM' => array(
'width'=>'1',
'default'=>true,
'sortable'=>false,
'label'=>'LBL_LIST_CBM',
),
'CBM_ORDERED' => array(
'width'=>'1',
'default'=>true,
'sortable'=>false,
'label'=>'LBL_LIST_CBM_ORDERED',
),*/
'SALE_QTY' => array (
'width' => '10',
'default' => true,
'sortable' => false,
'label' => 'Średnia cena sprzedaży'
), /*
'SALE_QTY30' => array(
'width'=>'10',
'default'=>true,
'sortable'=>false,
'label'=>'Qty in last m',
),
'SALE_AVG_PRICE90' => array(
'width'=>'1',
'default'=>true,
'sortable'=>false,
'label'=>'LBL_LIST_AVG_PRICE_3',
),
'SALE_QTY180' => array(
'width'=>'10',
'default'=>true,
'sortable'=>false,
'label'=>'Qty in last 6 m',
), */
'SALE_AVG_PRICE' => array (
'width' => '10',
'default' => true,
'sortable' => false,
'label' => 'Średnia cena zakupu'
), /*
'SALE_AVG_PRICE30' => array(
'width'=>'10',
'default'=>true,
'sortable'=>false,
'label'=>'Avg price in last m',
),
'SALE_AVG_PRICE0' => array(
'width'=>'1',
'default'=>true,
'sortable'=>false,
'label'=>'LBL_LIST_AVG_PRICE_THIS',
),
'STOCK_MONTH'=>array(
'width'=>'1',
'default'=>true,
'sortable'=>true,
'label'=>'Inw + zam w m',
),
'HINT'=>array(
'width' => '1',
'sortable'=>false,
'default' => true,
'label' => '&nbsp;'),
'SALE_AVG_PRICE180' => array(
'width'=>'10',
'default'=>true,
'sortable'=>false,
'label'=>'Avg price in last 6 m',
),
'DATE_ENTERED' => array(
'width' => '10',
'label' => 'LBL_DATE_ENTERED'),
'DATE_MODIFIED' => array(
'width' => '10',
'label' => 'LBL_DATE_MODIFIED'),
'ASSIGNED_USER_NAME' => array(
'width' => '10',
'label' => 'LBL_ASSIGNED_TO'),
'CREATED_BY' => array(
'width' => '10',
'label' => 'LBL_CREATED'),
'PRODUCT_LINE_NAME' => array(
'width' => '10',
'label' => 'LBL_PRODUCT_LINE'),
'MANUFACTURER_NAME' => array(
'width' => '10',
'label' => 'LBL_MANUFACTURER'),
'CONTACT_NAME' => array(
'width' => '10',
'label' => 'LBL_CONTACT'),
'VENDOR_NAME' => array(
'width' => '10',
'label' => 'LBL_VENDOR_NAME'),
'VENDOR_PART_NO' => array(
'width' => '10',
'label' => 'LBL_VENDOR_PART_NO'),
'SALES_START_DATE' => array(
'width' => '10',
'label' => 'LBL_SALES_START_DATE'),
'SALES_END_DATE' => array(
'width' => '10',
'label' => 'LBL_SALES_END_DATE'),
'PARENT_NAME' => array(
'width' => '10',
'label' => 'LBL_PARENT_NAME'),
'WEBSITE' => array(
'width' => '10',
'label' => 'LBL_WEBSITE'),
'PART_NO' => array(
'width' => '10',
'label' => 'LBL_PART_NO'),
'SERIAL_NO' => array(
'width' => '10',
'label' => 'LBL_SERIAL_NO'),
'EXCHANGE_RATE_NAME' => array(
'width' => '10',
'label' => 'LBL_EXCHANGE_RATE_NAME'),
'FOB_PRICE' => array(
'width' => '10',
'label' => 'LBL_FOB_PRICE'),
'PURCHASE_PRICE' => array(
'width' => '10',
'label' => 'LBL_UNIT_PRICE'),
/*'EMS_PRICE' => array(
'width' => '10',
'label' => 'LBL_EMS_PRICE'),
'COMMISSION_RATE' => array(
'width' => '10',
'label' => 'LBL_COMMISSION_RATE'),
'CUSTOM_DUTY_RATE' => array(
'width' => '10',
'label' => 'LBL_CUSTOM_DUTY_RATE'),
'SRP_PRICE' => array(
'width' => '10',
'label' => 'LBL_SRP_PRICE'),
'SRP_PROMO_PRICE' => array(
'width' => '10',
'label' => 'LBL_SRP_PROMO_PRICE'),
'USAGE_UNIT_NAME' => array(
'width' => '10',
'label' => 'LBL_USAGE_UNIT_NAME'),
'QTY_IN_STOCK' => array(
'width' => '10',
'label' => 'LBL_QTY_IN_STOCK'),
'QTY_IN_DEMAND' => array(
'width' => '10',
'label' => 'LBL_QTY_IN_DEMAND'),
'REORDER_LEVEL' => array(
'width' => '10',
'label' => 'LBL_REORDER_LEVEL'),
'SALES_LAST_MONTH_1' => array(
'width' => '10',
'label' => 'LBL_SALES_LAST_MONTH_1'),
'SALES_LAST_MONTH' => array(
'width' => '10',
'label' => 'LBL_SALES_LAST_MONTH'),
'SALES_THIS_MONTH' => array(
'width' => '10',
'label' => 'LBL_SALES_THIS_MONTH'),
'QTY_PER_UNIT' => array(
'width' => '10',
'label' => 'LBL_QTY_PER_UNIT'),
'AVERAGE_SALE_3_MONTHS' => array(
'width' => '10',
'label' => 'LBL_AVERAGE_SALE_3_MONTHS'),
'SALES_PLUS_1' => array(
'width' => '10',
'label' => 'LBL_SALES_PLUS_1'),
'SALES_PLUS_2' => array(
'width' => '10',
'label' => 'LBL_SALES_PLUS_2'),
'SALES_PLUS_3' => array(
'width' => '10',
'label' => 'LBL_SALES_PLUS_3'),
'MOQ' => array(
'width' => '10',
'label' => 'LBL_MOQ'),
'FOB_BASIS_NAME' => array(
'width' => '10',
'label' => 'LBL_FOB_BASIS_NAME'),
'DELIVERY_TIME_FOB' => array(
'width' => '10',
'label' => 'LBL_DELIVERY_TIME_FOB'),
'PIECES_PER_CARTON' => array(
'width' => '10',
'label' => 'LBL_PIECES_PER_CARTON'),
'PRODUCT_NETTO_WEIGHT' => array(
'width' => '10',
'label' => 'LBL_PRODUCT_NETTO_WEIGHT'),
'PRODUCT_BRUTTO_WEIGHT' => array(
'width' => '10',
'label' => 'LBL_PRODUCT_BRUTTO_WEIGHT'),
'PACKING_TYPE_NAME' => array(
'width' => '10',
'label' => 'LBL_PACKING_TYPE_NAME'),
'PACKING_DIMENSIONS_1' => array(
'width' => '10',
'label' => 'LBL_PACKING_DIMENSIONS_1'),
'PACKING_DIMENSIONS_2' => array(
'width' => '10',
'label' => 'LBL_PACKING_DIMENSIONS_2'),
'PACKING_DIMENSIONS_3' => array(
'width' => '10',
'label' => 'LBL_PACKING_DIMENSIONS_3'),
'CARTON_DIMENSIONS_1' => array(
'width' => '10',
'label' => 'LBL_CARTON_DIMENSIONS_1'),
'CARTON_DIMENSIONS_2' => array(
'width' => '10',
'label' => 'LBL_CARTON_DIMENSIONS_2'),
'CARTON_DIMENSIONS_3' => array(
'width' => '10',
'label' => 'LBL_CARTON_DIMENSIONS_3'),
'RMA' => array(
'width' => '10',
'label' => 'LBL_RMA'),
'CARTON_NETTO_WEIGHT' => array(
'width' => '10',
'label' => 'LBL_CARTON_NETTO_WEIGHT'),
'CARTON_BRUTTO_WEIGHT' => array(
'width' => '10',
'label' => 'LBL_CARTON_BRUTTO_WEIGHT'),
'CARTON_VOLUME_METER' => array(
'width' => '10',
'label' => 'LBL_CARTON_VOLUME_METER'),
'CARTON_VOLUME_FEET' => array(
'width' => '10',
'label' => 'LBL_CARTON_VOLUME_FEET'),
'COUNTRY_OF_ORIGIN' => array(
'width' => '10',
'label' => 'LBL_COUNTRY_OF_ORIGIN'),
'CERTIFICATE_OF_ORIGIN' => array(
'width' => '10',
'label' => 'LBL_CERTIFICATE_OF_ORIGIN'),
'FORM_A' => array(
'width' => '10',
'label' => 'LBL_FORM_A'),
'VAT_NAME' => array(
'width' => '10',
'label' => 'LBL_VAT_NAME'),
'SELLING_PRICE' => array(
'width' => '10',
'label' => 'LBL_SELLING_PRICE'),
'EMS_ORDERED' => array(
'width' => '10',
'label' => 'LBL_EMS_ORDERED'),
'TO_ORDER' => array(
'width' => '1',
'default' => false,
'label' => 'T'),
*/
'EDIT_BTN' => array (
'width' => '1',
'default' => true,
'sortable' => false,
'label' => '&nbsp;'
)
);
?>

View File

@@ -0,0 +1,52 @@
<?php
/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero 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 Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero 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 Jun 1, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$metafiles['EcmProducts'] = array(
'detailviewdefs' => 'modules/EcmProducts/metadata/detailviewdefs.php',
'editviewdefs' => 'modules/EcmProducts/metadata/editviewdefs.php',
'listviewdefs' => 'modules/EcmProducts/metadata/listviewdefs.php',
'searchdefs' => 'modules/EcmProducts/metadata/searchdefs.php',
'popupdefs' => 'modules/EcmProducts/metadata/popupdefs.php',
'searchfields' => 'modules/EcmProducts/metadata/SearchFields.php',
);
?>

Some files were not shown because too many files have changed in this diff Show More