init
This commit is contained in:
139
modules/EcmStockOperations/AjaxSearchQuery.php
Executable file
139
modules/EcmStockOperations/AjaxSearchQuery.php
Executable file
@@ -0,0 +1,139 @@
|
||||
<?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']);
|
||||
$stock_id = $_REQUEST['stock_id'];
|
||||
$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`.`index_dbf`";
|
||||
$query .= ", `pr`.`unit_name` as unit_name";
|
||||
$query .= ", `pr`.`name`";
|
||||
$query .= ", `pr`.`selling_price`";
|
||||
$query .= ", `pr`.`purchase_price`";
|
||||
$query .= ", `pr`.`srp_price`";
|
||||
$query .= ", `pr`.`fob_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`";
|
||||
$query .= ", `pr`.`type` as `type`";
|
||||
|
||||
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 .= " RIGHT 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' LIMIT 0,25";
|
||||
|
||||
$result = $GLOBALS['db']->query($query);
|
||||
|
||||
global $sugar_config;
|
||||
global $app_list_strings;
|
||||
$defaultCurrency = $sugar_config['default_currency_symbol'];
|
||||
$currencies = array ( -99 => $defaultCurrency );
|
||||
|
||||
$arr = array();
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
if($result)
|
||||
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
|
||||
//$row['unit_id']=$row['unit_name'];
|
||||
$lv=return_app_list_strings_language($_REQUEST['ecmlanguage']);
|
||||
$row['unit_name']=$row['unit_name'];
|
||||
$row['stock'] = $op->getStock($row['id'], $stock_id);
|
||||
$row['temp_item_id']=create_guid();
|
||||
$row['temp_date']=date("Y-m-d H:i:s");
|
||||
$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['short_description']), $AS_INPUTSEARCH) !== false)
|
||||
$row['name'] = $row['short_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['short_description']) && $row['short_description'] != '')
|
||||
$row['name'] = $row['short_description'];
|
||||
else
|
||||
if(isset($row['short_description']) && $row['short_description'] != '')
|
||||
$row['name'] = $row['short_description'];
|
||||
}
|
||||
unset($row['short_description'], $row['short_description']);
|
||||
}
|
||||
*/
|
||||
$row['code'] = $row['index_dbf'];
|
||||
|
||||
$arr[] = $row;
|
||||
|
||||
}
|
||||
|
||||
if(count($arr) > 0) {
|
||||
$json = getJSONobj();
|
||||
echo str_replace(""", '\"', $json->encode($arr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $current_user;
|
||||
|
||||
$dashletData['MyEcmStockOperationsDashlet']['searchFields'] = array('priority' => array('default' => ''),
|
||||
'status' => array('default' => array('Assigned', 'New', 'Pending')),
|
||||
'found_in_release' => array('default' => ''),
|
||||
'fixed_in_release' => array('default' => ''),
|
||||
'type' => array('default' => ''),
|
||||
'' => array('default' => ''),
|
||||
'date_entered' => array('default' => ''),
|
||||
'date_modified' => array('default' => ''),
|
||||
|
||||
|
||||
|
||||
'assigned_user_id' => array('type' => 'assigned_user_name',
|
||||
'default' => $current_user->name));
|
||||
$dashletData['MyEcmStockOperationsDashlet']['columns'] = array('ecmstockoperation_number' => array('width' => '5',
|
||||
'label' => 'LBL_NUMBER',
|
||||
'default' => true),
|
||||
'name' => array('width' => '40',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'link' => true,
|
||||
'default' => true),
|
||||
'priority' => array('width' => '10',
|
||||
'label' => 'LBL_PRIORITY',
|
||||
'default' => true),
|
||||
'status' => array('width' => '10',
|
||||
'label' => 'LBL_STATUS',
|
||||
'default' => true),
|
||||
'resolution' => array('width' => '15',
|
||||
'label' => 'LBL_RESOLUTION'),
|
||||
'release_name' => array('width' => '15',
|
||||
'label' => 'LBL_FOUND_IN_RELEASE',
|
||||
'related_fields' => array('found_in_release')),
|
||||
'type' => array('width' => '15',
|
||||
'label' => 'LBL_TYPE'),
|
||||
'fixed_in_release_name' => array('width' => '15',
|
||||
'label' => 'LBL_FIXED_IN_RELEASE'),
|
||||
'source' => array('width' => '15',
|
||||
'label' => 'LBL_SOURCE'),
|
||||
'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'),
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings;
|
||||
|
||||
$dashletMeta['MyEcmStockOperationsDashlet'] = array('module' => 'EcmStockOperations',
|
||||
'title' => translate('LBL_LIST_MY_ECMSTOCKOPERATIONS', 'EcmStockOperations'),
|
||||
'description' => 'A customizable view into EcmStockOperations',
|
||||
'icon' => 'themes/default/images/EcmStockOperationsDashlet.gif',
|
||||
'category' => 'Module Views',
|
||||
'hidden' => true);
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGeneric.php');
|
||||
require_once('modules/EcmStockOperations/EcmStockOperation.php');
|
||||
|
||||
class MyEcmStockOperationsDashlet extends DashletGeneric {
|
||||
function MyEcmStockOperationsDashlet($id, $def = null) {
|
||||
global $current_user, $app_strings;
|
||||
require('modules/EcmStockOperations/Dashlets/MyEcmStockOperationsDashlet/MyEcmStockOperationsDashlet.data.php');
|
||||
|
||||
parent::DashletGeneric($id, $def);
|
||||
|
||||
$this->searchFields = $dashletData['MyEcmStockOperationsDashlet']['searchFields'];
|
||||
$this->columns = $dashletData['MyEcmStockOperationsDashlet']['columns'];
|
||||
|
||||
if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_ECMSTOCKOPERATIONS', 'EcmStockOperations');
|
||||
$this->seedBean = new EcmStockOperation();
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
require_once('modules/Releases/Release.php');
|
||||
$this->processDisplayOptions();
|
||||
|
||||
$seedRelease = new Release();
|
||||
|
||||
$this->currentSearchFields['fixed_in_release']['input'] = '<select multiple="true" size="3" name="fixed_in_release[]">'
|
||||
. get_select_options_with_id($seedRelease->get_releases(false, "Active"), (empty($this->filters['fixed_in_release']) ? '' : $this->filters['fixed_in_release']))
|
||||
. '</select>';
|
||||
$this->currentSearchFields['found_in_release']['input'] = '<select multiple="true" size="3" name="found_in_release[]">'
|
||||
. get_select_options_with_id($seedRelease->get_releases(false, "Active"), (empty($this->filters['found_in_release']) ? '' : $this->filters['found_in_release']))
|
||||
. '</select>';
|
||||
|
||||
$this->configureSS->assign('searchFields', $this->currentSearchFields);
|
||||
return $this->configureSS->fetch($this->configureTpl);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
36
modules/EcmStockOperations/DetailView.php
Executable file
36
modules/EcmStockOperations/DetailView.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
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;
|
||||
|
||||
require_once('modules/EcmStockOperations/EcmStockOperation.php');
|
||||
require_once('modules/EcmStockOperations/Forms.php');
|
||||
require_once ('include/time.php');
|
||||
require_once('include/json_config.php');
|
||||
|
||||
$json_config = new json_config();
|
||||
|
||||
$focus = new EcmStockOperation();
|
||||
|
||||
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
if(file_exists('modules/EcmStockOperations/views/view.detail.php')) {
|
||||
require_once('modules/EcmStockOperations/views/view.detail.php');
|
||||
$detail = new EcmStockOperation();
|
||||
}
|
||||
else{
|
||||
require_once('include/MVC/View/views/view.detail.php');
|
||||
$detail = new ViewDetail();
|
||||
$detail->ss = new Sugar_Smarty();
|
||||
$detail->module = 'EcmStockOperations';
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
$detail->bean = $focus;
|
||||
$detail->preDisplay();
|
||||
|
||||
echo $detail->display();
|
||||
?>
|
||||
614
modules/EcmStockOperations/EcmStockOperation.php
Executable file
614
modules/EcmStockOperations/EcmStockOperation.php
Executable file
@@ -0,0 +1,614 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
/*
|
||||
* ******************************************************************************* SugarCRM is a customer relationship management program developed by SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with the addition of the following permission added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices, as required under Section 5 of the GNU General Public License version 3. In accordance with Section 7(b) of the GNU General Public License version 3, these Appropriate Legal Notices must retain the display of the "Powered by SugarCRM" logo. If the display of the logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices must display the words "Powered by SugarCRM". ******************************************************************************
|
||||
*/
|
||||
/* * *******************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
* ****************************************************************************** */
|
||||
|
||||
require_once ('data/SugarBean.php');
|
||||
require_once ('include/utils.php');
|
||||
class EcmStockOperation extends SugarBean {
|
||||
var $field_name_map = array ();
|
||||
var $id;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $modified_user_id;
|
||||
var $assigned_user_id;
|
||||
var $name;
|
||||
var $product_name;
|
||||
var $product_code;
|
||||
var $product_id;
|
||||
var $stock_name;
|
||||
var $stock_id;
|
||||
var $quantity;
|
||||
var $price;
|
||||
var $parent_type;
|
||||
var $parent_name;
|
||||
var $parent_id;
|
||||
var $in_id;
|
||||
var $documentitem_id;
|
||||
var $type;
|
||||
var $module_dir = 'EcmStockOperations';
|
||||
var $table_name = "ecmstockoperations";
|
||||
var $object_name = "EcmStockOperation";
|
||||
var $new_schema = true;
|
||||
var $additional_column_fields = array (
|
||||
'assigned_user_name',
|
||||
'assigned_user_id'
|
||||
);
|
||||
function EcmStockOperation() {
|
||||
parent::SugarBean ();
|
||||
$this->setupCustomFields ( 'EcmStockOperations' );
|
||||
foreach ( $this->field_defs as $field ) {
|
||||
$this->field_name_map [$field ['name']] = $field;
|
||||
}
|
||||
}
|
||||
function get_summary_text() {
|
||||
return $this->name;
|
||||
}
|
||||
function create_list_query($order_by, $where, $show_deleted = 0) {
|
||||
$custom_join = $this->custom_fields->getJOIN ();
|
||||
$query = "SELECT ";
|
||||
$query .= "ecmstockoperations.*,users.user_name as assigned_user_name";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['select'];
|
||||
$query .= " FROM ecmstockoperations ";
|
||||
$query .= "LEFT JOIN users ON ecmstockoperations.assigned_user_id=users.id";
|
||||
$query .= " ";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['join'];
|
||||
$where_auto = '1=1';
|
||||
if ($show_deleted == 0)
|
||||
$where_auto = " $this->table_name.deleted=0 ";
|
||||
elseif ($show_deleted == 1)
|
||||
$where_auto = " $this->table_name.deleted=1 ";
|
||||
if ($where != "")
|
||||
$query .= "where $where AND " . $where_auto;
|
||||
else
|
||||
$query .= "where " . $where_auto;
|
||||
if (substr_count ( $order_by, '.' ) > 0)
|
||||
$query .= " ORDER BY $order_by";
|
||||
elseif ($order_by != "")
|
||||
$query .= " ORDER BY $order_by";
|
||||
else
|
||||
$query .= " ORDER BY ecmstockoperations.name";
|
||||
return $query;
|
||||
}
|
||||
function create_export_query($order_by, $where) {
|
||||
$custom_join = $this->custom_fields->getJOIN ();
|
||||
$query = "SELECT ";
|
||||
$query .= "ecmstockoperations.*,users.user_name as assigned_user_name";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['select'];
|
||||
$query .= " FROM ecmstockoperations ";
|
||||
$query .= "LEFT JOIN users ON ecmstockoperations.assigned_user_id=users.id";
|
||||
$query .= " ";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['join'];
|
||||
$where_auto = '1=1';
|
||||
if ($show_deleted == 0)
|
||||
$where_auto = " $this->table_name.deleted=0 ";
|
||||
elseif ($show_deleted == 1)
|
||||
$where_auto = " $this->table_name.deleted=1 ";
|
||||
if ($where != "")
|
||||
$query .= "where $where AND " . $where_auto;
|
||||
else
|
||||
$query .= "where " . $where_auto;
|
||||
if (substr_count ( $order_by, '.' ) > 0)
|
||||
$query .= " ORDER BY $order_by";
|
||||
elseif ($order_by != "")
|
||||
$query .= " ORDER BY $order_by";
|
||||
else
|
||||
$query .= " ORDER BY ecmstockoperations.name";
|
||||
return $query;
|
||||
|
||||
|
||||
}
|
||||
function fill_in_additional_list_fields() {
|
||||
}
|
||||
function fill_in_additional_detail_fields() {
|
||||
parent::fill_in_additional_detail_fields ();
|
||||
}
|
||||
function get_list_view_data() {
|
||||
global $current_language;
|
||||
$the_array = parent::get_list_view_data ();
|
||||
$app_list_strings = return_app_list_strings_language ( $current_language );
|
||||
$mod_strings = return_module_language ( $current_language, 'EcmStockOperations' );
|
||||
|
||||
$this->retrieve ( $this->id );
|
||||
|
||||
$mod_strings_doc = return_module_language ( $current_language, $this->parent_type );
|
||||
|
||||
$the_array ['PARENT_TYPE'] = $this->parent_type;
|
||||
$the_array ['PARENT_TYPE_NAME'] = $mod_strings_doc ['LBL_MODULE_NAME'];
|
||||
$the_array ['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
|
||||
$r = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select parent_name,parent_id,parent_type from ecmstockoperations where id='" . $this->id . "'" ) );
|
||||
$the_array ['DOCUMENT_NAME'] = $r ['parent_name'];
|
||||
$the_array ['PREVIEW_PDF'] = '<img src="modules/EcmStockDocIns/images/pdf.gif" onclick="EcmPreviewPDF(\'index.php?module=' . $r ['parent_type'] . '&action=previewPDF&method=I&record=' . $r ['parent_id'] . '&to_pdf=1\',{zoom:75,toolbar:1});" style="cursor: pointer;" border="0">';
|
||||
|
||||
|
||||
$the_array ['STOCK_NAME'] = '<a href="index.php?module=EcmStockOperations&action=&query=true&searchFormTab=basic_search&stock_id_basic=' . $this->stock_id . '&stock_name_basic=' . $this->stock_name . '">' . $this->stock_name . '</a>';
|
||||
$the_array ['ENCODED_NAME'] = $this->name;
|
||||
$db = $GLOBALS['db'];
|
||||
$r = $db->fetchByAssoc($db->query("SELECT quantity FROM ecmstockoperations WHERE id='$this->id'"));
|
||||
$the_array['QUANTITY'] = $r['quantity'];
|
||||
return $the_array;
|
||||
}
|
||||
function build_generic_where_clause($the_query_string) {
|
||||
$where_clauses = array ();
|
||||
$the_query_string = PearDatabase::quote ( from_html ( $the_query_string ) );
|
||||
array_push ( $where_clauses, "ecmstockoperations.name like '$the_query_string%'" );
|
||||
|
||||
$the_where = "";
|
||||
foreach ( $where_clauses as $clause ) {
|
||||
if ($the_where != "")
|
||||
$the_where .= " or ";
|
||||
$the_where .= $clause;
|
||||
}
|
||||
return $the_where;
|
||||
}
|
||||
function set_notification_body($xtpl, $ecmstockoperation) {
|
||||
global $mod_strings, $app_list_strings;
|
||||
$xtpl->assign ( "ECMSTOCKOPERATION_SUBJECT", $ecmstockoperation->name );
|
||||
return $xtpl;
|
||||
}
|
||||
function bean_implements($interface) {
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function save($check_notify = FALSE) {
|
||||
return parent::save ( $check_notify );
|
||||
}
|
||||
function deleteProducts($p, $id, $itemid, $stock_id, $date) {
|
||||
$arr = array ();
|
||||
$w = $GLOBALS ['db']->query ( "select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and used=0 and in_id IS NULL and stock_id='" . $stock_id . "' and product_id='" . $p ['id'] . "'" );
|
||||
while ( $rrr = $GLOBALS ['db']->fetchByAssoc ( $w ) ) {
|
||||
$ww = $GLOBALS ['db']->query ( "select quantity from ecmstockoperations where in_id='" . $rrr ['id'] . "' and type='1' and in_id IS NOT NULL and stock_id='" . $stock_id . "' and product_id='" . $p ['id'] . "' and deleted='0'" );
|
||||
$rqty = 0;
|
||||
while ( $rrp = $GLOBALS ['db']->fetchByAssoc ( $ww ) ) {
|
||||
$rqty += $rrp ['quantity'];
|
||||
}
|
||||
$qty = $rrr ['qty'] - $rqty;
|
||||
if ($qty > 0) {
|
||||
$arr [] = array (
|
||||
"qty" => $qty,
|
||||
"id" => $rrr ['id'],
|
||||
"price" => $rrr ['price']
|
||||
);
|
||||
}
|
||||
}
|
||||
$rr = array ();
|
||||
$used_qty = 0;
|
||||
$stop = 0;
|
||||
foreach ( $arr as $value ) {
|
||||
if ($p ['quantity'] - $used_qty <= $value ['qty']) {
|
||||
$rr [] = array (
|
||||
"id" => $value ['id'],
|
||||
"qty" => $p ['quantity'] - $used_qty,
|
||||
"price" => $value ['price']
|
||||
);
|
||||
$stop = 1;
|
||||
} else {
|
||||
$rr [] = array (
|
||||
"id" => $value ['id'],
|
||||
"qty" => $value ['qty'],
|
||||
"price" => $value ['price']
|
||||
);
|
||||
$used_qty += $value ['qty'];
|
||||
}
|
||||
if ($stop) {
|
||||
$stop = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$qq = 0;
|
||||
$pp = 0;
|
||||
$avg_pq = 0;
|
||||
$avg_q = 0;
|
||||
foreach ( $rr as $r ) {
|
||||
$this->addDeleteOperation ( $r ['id'], $p ['id'], $r ['qty'], $r ['price'], $date, $id, $stock_id, $itemid );
|
||||
$avg_pq += $r ['qty'] * $r ['price'];
|
||||
$avg_q += $r ['qty'];
|
||||
}
|
||||
$GLOBALS ['db']->query ( "update ecmstockdocoutitems set price='" . ($avg_pq / $avg_q) . "' where id='" . $itemid . "'" );
|
||||
}
|
||||
function addDeleteOperation($stock_in_id, $product_id, $quantity, $price, $date, $wz_id, $stock_id, $itemid) {
|
||||
require_once ("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$o = new EcmStockOperation ();
|
||||
$o->unformat_all_fields ();
|
||||
|
||||
require_once ("modules/EcmProducts/EcmProduct.php");
|
||||
$o->product_id = $product_id;
|
||||
$p = new EcmProduct ();
|
||||
$p->retrieve ( $product_id );
|
||||
$o->product_code = $p->code;
|
||||
$o->product_name = $p->name;
|
||||
|
||||
require_once ("modules/EcmStocks/EcmStock.php");
|
||||
$o->stock_id = $stock_id;
|
||||
$s = new EcmStock ();
|
||||
$s->retrieve ( $stock_id );
|
||||
$o->stock_name = $s->name;
|
||||
|
||||
$o->parent_id = $wz_id;
|
||||
$r = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select document_no from ecmstockdocouts where id='" . $wz_id . "'" ) );
|
||||
$o->parent_name = $r ['document_no'];
|
||||
$o->parent_type = "EcmStockDocOuts";
|
||||
|
||||
$o->quantity = $quantity;
|
||||
$o->price = $price;
|
||||
$o->in_id = $stock_in_id;
|
||||
$o->documentitem_id = $itemid;
|
||||
$o->type = 1;
|
||||
$o->save ();
|
||||
|
||||
require_once ("modules/EcmStockStates/EcmStockState.php");
|
||||
$ss = new EcmStockState ();
|
||||
$ss->UpdateStockState ( $o->stock_id, $o->product_id );
|
||||
}
|
||||
function saveReservation($stock_id, $product_id, $temp_doc_id, $temp_item_id, $quantity, $doc_type) {
|
||||
global $db, $current_user;
|
||||
// get session
|
||||
session_start ();
|
||||
$sid = session_id ();
|
||||
|
||||
$q = "select count(*) as cnt from ecmreservations where temp_item_id='" . $temp_item_id . "'";
|
||||
// var_dump($q);
|
||||
|
||||
$r = $db->fetchByAssoc ( $db->query ( $q ) );
|
||||
|
||||
// var_dump($r);
|
||||
|
||||
if ($r ['cnt'] > 0) {
|
||||
$updateQuery = '
|
||||
UPDATE
|
||||
ecmreservations
|
||||
SET
|
||||
quantity = \'' . $quantity . '\'
|
||||
WHERE
|
||||
temp_item_id = \'' . $temp_item_id . '\'
|
||||
;';
|
||||
|
||||
$result = $db->query ( $updateQuery );
|
||||
} else {
|
||||
$insertQuery = '
|
||||
INSERT INTO
|
||||
ecmreservations
|
||||
SET
|
||||
date_modified = \'' . date ( "Y-m-d H:i:s" ) . '\',
|
||||
date_entered = \'' . date ( "Y-m-d H:i:s" ) . '\',
|
||||
modified_user_id = \'' . $_SESSION ['authenticated_user_id'] . '\',
|
||||
created_by = \'' . $_SESSION ['authenticated_user_id'] . '\',
|
||||
id = \'' . create_guid () . '\',
|
||||
temp_doc_id = \'' . $temp_doc_id . '\',
|
||||
temp_item_id = \'' . $temp_item_id . '\',
|
||||
product_id = \'' . $product_id . '\',
|
||||
quantity = \'' . $quantity . '\',
|
||||
session_id = \'' . $sid . '\',
|
||||
stock_id = \'' . $stock_id . '\',
|
||||
doc_type = \'' . $doc_type . '\'
|
||||
;';
|
||||
|
||||
$result = $db->query ( $insertQuery );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
function saveParentReservation($stock_id, $product_id, $doc_id, $item_id, $quantity, $doc_type) {
|
||||
global $db, $current_user;
|
||||
|
||||
session_start ();
|
||||
|
||||
$q = "select count(*) as cnt from ecmreservations where item_id='$item_id' and doc_id='$doc_id'";
|
||||
|
||||
$r = $db->fetchByAssoc ( $db->query ( $q ) );
|
||||
|
||||
if ($r ['cnt'] > 0) {
|
||||
$updateQuery = '
|
||||
UPDATE
|
||||
ecmreservations
|
||||
SET
|
||||
quantity = \'' . $quantity . '\'
|
||||
WHERE
|
||||
item_id = \'' . $item_id . '\'
|
||||
;';
|
||||
|
||||
$result = $db->query ( $updateQuery );
|
||||
} else {
|
||||
$insertQuery = '
|
||||
INSERT INTO
|
||||
ecmreservations
|
||||
SET
|
||||
date_modified = \'' . date ( "Y-m-d H:i:s" ) . '\',
|
||||
date_entered = \'' . date ( "Y-m-d H:i:s" ) . '\',
|
||||
modified_user_id = \'' . $_SESSION ['authenticated_user_id'] . '\',
|
||||
created_by = \'' . $_SESSION ['authenticated_user_id'] . '\',
|
||||
id = \'' . create_guid () . '\',
|
||||
doc_id = \'' . $doc_id . '\',
|
||||
item_id = \'' . $item_id . '\',
|
||||
product_id = \'' . $product_id . '\',
|
||||
quantity = \'' . $quantity . '\',
|
||||
stock_id = \'' . $stock_id . '\',
|
||||
doc_type = \'' . $doc_type . '\'
|
||||
;';
|
||||
|
||||
$result = $db->query ( $insertQuery );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
function updateReservation($doc_id, $item_id, $quantity) {
|
||||
global $db;
|
||||
if ($quantity < 0) {
|
||||
$q = $db->fetchByAssoc ( $db->query ( "SELECT quantity FROM ecmreservations WHERE doc_id='$doc_id' and item_id='$item_id'" ) );
|
||||
|
||||
if (! $q || $q ['quantity'] == '')
|
||||
return;
|
||||
|
||||
if ($q ['quantity'] + $quantity <= 0)
|
||||
$db->query ( "DELETE from ecmreservations WHERE doc_id='$doc_id' AND item_id='$item_id'" );
|
||||
else
|
||||
$db->query ( "UPDATE ecmreservations SET quantity=quantity+$quantity WHERE doc_id='$doc_id' AND item_id='$item_id'" );
|
||||
}
|
||||
/*
|
||||
* else { $q = $db->fetchByAssoc($db->query("SELECT quantity FROM ecmreservations WHERE doc_id='$doc_id' and item_id='$item_id'")); if (!$q || $q['quantity']='') { } }
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Save document reservations.
|
||||
*/
|
||||
function saveDocumentReservations($temp_doc_id) {
|
||||
global $db;
|
||||
|
||||
$query = '
|
||||
UPDATE
|
||||
`ecmreservations` AS r
|
||||
SET
|
||||
r.`session_id` = NULL,
|
||||
r.`doc_id` = r.`temp_doc_id`,
|
||||
r.`item_id` = r.`temp_item_id`,
|
||||
r.`temp_doc_id` = NULL,
|
||||
r.`temp_item_id` = NULL
|
||||
WHERE
|
||||
r.`temp_doc_id` = \'' . $temp_doc_id . '\'
|
||||
;';
|
||||
|
||||
echo $query;
|
||||
|
||||
$result = $db->query ( $query );
|
||||
return $result;
|
||||
}
|
||||
function removeReservation($temp_item_id) {
|
||||
global $db;
|
||||
$db->query ( "DELETE FROM ecmreservations WHERE temp_item_id='" . $temp_item_id . "'" );
|
||||
}
|
||||
function removeDocumentReservations($temp_doc_id) {
|
||||
global $db;
|
||||
$db->query ( "DELETE FROM ecmreservations WHERE temp_doc_id='" . $temp_doc_id . "'" );
|
||||
}
|
||||
function removeSaleProductReservations($item_id) {
|
||||
global $db;
|
||||
$db->query ( "DELETE FROM ecmreservations WHERE item_id='" . $item_id . "'" );
|
||||
}
|
||||
function removeSaleReservations($sale_id) {
|
||||
global $db;
|
||||
$db->query ( "DELETE FROM ecmreservations WHERE doc_id='" . $sale_id . "'" );
|
||||
}
|
||||
function getSaleReservations($ecmsale_id, $item_id) {
|
||||
global $db;
|
||||
$res = $db->fetchByAssoc ( $db->query ( "SELECT quantity as res FROM ecmreservations WHERE doc_id='" . $ecmsale_id . "' AND item_id='" . $item_id . "'" ) );
|
||||
|
||||
return $res ['res'];
|
||||
}
|
||||
function getStockR($product_id, $stock_id = "", $item_id = "") {
|
||||
global $db;
|
||||
|
||||
if ($stock_id != '')
|
||||
$stock = " and stock_id='" . $stock_id . "'";
|
||||
else
|
||||
$stock = "";
|
||||
$z = "select sum(quantity) as q from ecmreservations where product_id='" . $product_id . "'" . $stock;
|
||||
|
||||
$q = $db->query ( $z );
|
||||
$row = $db->fetchByAssoc ( $q );
|
||||
return ( int ) $row ['q'];
|
||||
}
|
||||
|
||||
// stock without reservations
|
||||
function getRealStock($product_id, $stock_id = "") {
|
||||
global $db;
|
||||
|
||||
if ($stock_id != '')
|
||||
$stock = " and stock_id='" . $stock_id . "'";
|
||||
else
|
||||
$stock = "";
|
||||
|
||||
$rquery = "SELECT sum(quantity) as quantity FROM ecmstockstates WHERE product_id='" . $product_id . "'" . $stock;
|
||||
|
||||
// get stockstates quantity
|
||||
$r = $db->fetchByAssoc ( $db->query ( $rquery ) );
|
||||
|
||||
if (! $r ['quantity'])
|
||||
$r ['quantity'] = 0;
|
||||
|
||||
return $r ['quantity'];
|
||||
}
|
||||
function getStock($product_id, $stock_id = "") {
|
||||
global $db;
|
||||
|
||||
if ($stock_id != '')
|
||||
$stock = " and stock_id='" . $stock_id . "'";
|
||||
else
|
||||
$stock = "";
|
||||
|
||||
$rquery = "SELECT quantity FROM ecmstockstates WHERE product_id='" . $product_id . "'" . $stock;
|
||||
|
||||
// get stockstates quantity
|
||||
$r = $db->fetchByAssoc ( $db->query ( $rquery ) );
|
||||
|
||||
$rrquery = "SELECT sum(quantity) as res FROM ecmreservations WHERE product_id='" . $product_id . "'" . $stock;
|
||||
|
||||
// get reservations
|
||||
$rr = $db->fetchByAssoc ( $db->query ( $rrquery ) );
|
||||
|
||||
if (! is_array ( $rr ))
|
||||
$rr ['res'] = 0;
|
||||
|
||||
return $r ['quantity'] - $rr ['res'];
|
||||
}
|
||||
function getStockArray($product_id) {
|
||||
if (! $product_id)
|
||||
return '';
|
||||
|
||||
global $db;
|
||||
|
||||
$res = $db->query ( "SELECT id, name FROM ecmstocks WHERE deleted='0'" );
|
||||
$ret = array ();
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$qty = $this->getStock ( $product_id, $row ['id'] );
|
||||
if ($qty > 0)
|
||||
$ret [$row ['name']] = $qty;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
function getPurchaseArray($product_id) {
|
||||
if (! $product_id)
|
||||
return '';
|
||||
|
||||
global $db;
|
||||
|
||||
$res = $db->query("SELECT parent_name, parent_id, quantity, price FROM ecmstockoperaions WHERE product_id='$product_id' AND type='1' AND used='0' AND deleted='0'");
|
||||
return "SELECT parent_name, parent_id, quantity, price FROM ecmstockoperaions WHERE product_id='$product_id' AND type='1' AND used='0' AND deleted='0'";
|
||||
|
||||
}
|
||||
function getAllQuantity($product_id) {
|
||||
global $db;
|
||||
|
||||
$r = $db->fetchByAssoc ( $db->query ( "
|
||||
SELECT
|
||||
CASE WHEN (SELECT sum(quantity) FROM ecmreservations WHERE product_id='$product_id') IS NULL
|
||||
THEN
|
||||
(SELECT sum(quantity) FROM ecmstockstates WHERE product_id='$product_id')
|
||||
ELSE
|
||||
((SELECT sum(quantity) FROM ecmstockstates WHERE product_id='$product_id')-(SELECT sum(quantity) FROM ecmreservations WHERE product_id='$product_id'))
|
||||
END
|
||||
as qty
|
||||
" ) );
|
||||
|
||||
return $r ['qty'];
|
||||
}
|
||||
function checkStock($p, $stock_id) {
|
||||
global $db;
|
||||
$p = base64_decode ( $p );
|
||||
print_r ( $_REQUEST );
|
||||
require_once ('include/json_config.php');
|
||||
$json_config = new json_config ();
|
||||
$json = getJSONobj ();
|
||||
$pll = array ();
|
||||
$exp = explode ( "||||", $p );
|
||||
foreach ( $exp as $ep ) {
|
||||
if ($ep) {
|
||||
$pll [] = $json->decode ( htmlspecialchars_decode ( $ep ) );
|
||||
}
|
||||
}
|
||||
$p = $pll;
|
||||
foreach ( $p as $rr ) {
|
||||
$products [] = array (
|
||||
"product_name" => $rr ['name'],
|
||||
"product_id" => $rr ['id'],
|
||||
"quantity" => $rr ['quantity'],
|
||||
"item_id" => $rr ['item_id']
|
||||
);
|
||||
}
|
||||
// print_r($products);echo "mmmmmmmmmm";
|
||||
$str .= '<div style="text-align:center">';
|
||||
$str .= '<span style="font-family:Geneva,Arial;font-size: 12px;font-weight:bold;">Sprawdzanie stanów magazynowych</span>';
|
||||
$str .= '<table align="center" style="padding:3px;border:1px solid #ccc"><tr><td style="background:#999;color:white;font-weight:bold;padding:3px;">Produkt</td><td style="background:#999;color:white;font-weight:bold;padding:3px;">Ilość</td><td style="background:#999;color:white;font-weight:bold;padding:3px;">Magazyn</td><td style="background:#999;color:white;font-weight:bold;padding:3px;"> </td></tr>';
|
||||
if (count ( $products ) > 0) {
|
||||
foreach ( $products as $p ) {
|
||||
if (! $p ['product_id'])
|
||||
continue;
|
||||
$qty = self::getStock ( $p ['product_id'], $stock_id, $p ['item_id'] );
|
||||
$str .= '<tr><td style="padding:3px;">' . $p ['product_name'] . '</td><td style="padding:3px;">' . $p ['quantity'] . '</td><td style="padding:3px;">' . $qty . '</td><td style="padding:3px;">';
|
||||
if ($p ['quantity'] > $qty) {
|
||||
$no = true;
|
||||
$str .= '<span style="color:red">' . "błąd" . '</span>';
|
||||
} else
|
||||
$str .= '<span style="color:green">' . "ok" . '</span>';
|
||||
$str .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
$str .= '</table><br>';
|
||||
if ($no) {
|
||||
$str .= '<span style="font-family:Geneva,Arial;font-size: 12px;font-weight:bold;">' . "Brakuje produktów na magazynie" . '</span>';
|
||||
$str .= ' <input type="button" class="button" onclick="document.getElementById(\'check_stock\').style.display=\'none\';" value="' . "Popraw" . '">';
|
||||
} else {
|
||||
$str .= '<input type="submit" name="save" class="button" value="Zapisz" onclick="executingPostBack=1;saveItems(true);this.form.action.value=\'Save\';" />';
|
||||
}
|
||||
$str .= '</div>';
|
||||
return $str;
|
||||
}
|
||||
function checkStockSales($p, $stock_id) {
|
||||
global $db;
|
||||
require_once ('include/json_config.php');
|
||||
$json_config = new json_config ();
|
||||
$json = getJSONobj ();
|
||||
$pll = array ();
|
||||
$exp = explode ( "||||", $p );
|
||||
foreach ( $exp as $ep ) {
|
||||
if ($ep) {
|
||||
$pll [] = $json->decode ( htmlspecialchars_decode ( $ep ) );
|
||||
}
|
||||
}
|
||||
$p = $pll;
|
||||
foreach ( $p as $rr ) {
|
||||
$products [] = array (
|
||||
"product_name" => $rr ['name'],
|
||||
"product_id" => $rr ['id'],
|
||||
"quantity" => $rr ['quantity'],
|
||||
"reservation" => $rr ['reservation'],
|
||||
"rq" => $rr ['rq']
|
||||
);
|
||||
}
|
||||
$str .= '<div style="text-align:center">';
|
||||
$str .= '<span style="font-family:Geneva,Arial;font-size: 12px;font-weight:bold;">Sprawdzanie stanów magazynowych</span>';
|
||||
$str .= '<table align="center" style="padding:3px;border:1px solid #ccc"><tr><td style="background:#999;color:white;font-weight:bold;padding:3px;">Produkt</td><td style="background:#999;color:white;font-weight:bold;padding:3px;">Ilość</td><td style="background:#999;color:white;font-weight:bold;padding:3px;">Ilość do rezerwacji</td><td style="background:#999;color:white;font-weight:bold;padding:3px;">Magazyn</td><td style="background:#999;color:white;font-weight:bold;padding:3px;"> </td></tr>';
|
||||
if (count ( $products ) > 0) {
|
||||
foreach ( $products as $p ) {
|
||||
if (! $p ['product_id'] || ! $p ['reservation'])
|
||||
continue;
|
||||
$qty = self::getStock ( $p ['product_id'], $stock_id );
|
||||
$str .= '<tr><td style="padding:3px;">' . $p ['product_name'] . '</td><td style="padding:3px;">' . $p ['quantity'] . '</td><td style="padding:3px;">' . $p ['rq'] . '</td><td style="padding:3px;">' . $qty . '</td><td style="padding:3px;">';
|
||||
if ($p ['rq'] > $qty || $p ['rq'] > $p ['quantity']) {
|
||||
$no = true;
|
||||
$str .= '<span style="color:red">' . "błąd" . '</span>';
|
||||
} else
|
||||
$str .= '<span style="color:green">' . "ok" . '</span>';
|
||||
$str .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
$str .= '</table><br>';
|
||||
if ($no) {
|
||||
$str .= '<span style="font-family:Geneva,Arial;font-size: 12px;font-weight:bold;">' . "Brakuje produktów na magazynie lub wpisałeś za dużą ilość produktów do zarezerwowania" . '</span>';
|
||||
$str .= ' <input type="button" class="button" onclick="document.getElementById(\'check_stock\').style.display=\'none\';" value="' . "Popraw" . '">';
|
||||
} else {
|
||||
$str .= '<input type="submit" name="save" class="button" value="Zapisz" onclick="executingPostBack=1;saveItems(true);this.form.action.value=\'Save\';" />';
|
||||
}
|
||||
$str .= '</div>';
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
73
modules/EcmStockOperations/EcmStockOperationsQuickCreate.php
Executable file
73
modules/EcmStockOperations/EcmStockOperationsQuickCreate.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/EditView/QuickCreate.php');
|
||||
require_once('modules/EcmStockOperations/EcmStockOperation.php');
|
||||
require_once('include/javascript/javascript.php');
|
||||
|
||||
class EcmStockOperationsQuickCreate extends QuickCreate {
|
||||
|
||||
var $javascript;
|
||||
|
||||
function process() {
|
||||
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, 'EcmStockOperations');
|
||||
|
||||
parent::process();
|
||||
|
||||
$this->ss->assign("PRIORITY_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockoperation_priority_dom'], $app_list_strings['ecmstockoperation_priority_default_key']));
|
||||
$this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockoperation_status_dom'], $app_list_strings['ecmstockoperation_status_default_key']));
|
||||
$this->ss->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockoperation_type_dom'],$app_list_strings['ecmstockoperation_type_default_key']));
|
||||
|
||||
if($this->viaAJAX) { // override for ajax call
|
||||
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmstockoperationsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmstockoperations\"); else return false;'");
|
||||
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmstockoperations\")';");
|
||||
}
|
||||
|
||||
$this->ss->assign('viaAJAX', $this->viaAJAX);
|
||||
|
||||
$this->javascript = new javascript();
|
||||
$this->javascript->setFormName('ecmstockoperationsQuickCreate');
|
||||
|
||||
$focus = new EcmStockOperation();
|
||||
$this->javascript->setSugarBean($focus);
|
||||
$this->javascript->addAllFields('');
|
||||
|
||||
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
|
||||
}
|
||||
}
|
||||
?>
|
||||
39
modules/EcmStockOperations/Forms.php
Executable file
39
modules/EcmStockOperations/Forms.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*********************************************************************************/
|
||||
//require_once('include/EditView/SideQuickCreate.php');
|
||||
//function get_new_record_form () {};
|
||||
?>
|
||||
41
modules/EcmStockOperations/ListView.php
Executable file
41
modules/EcmStockOperations/ListView.php
Executable 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/EcmStockOperations/EcmStockOperation.php');
|
||||
require_once('modules/EcmStockOperations/Forms.php');
|
||||
require_once ('include/time.php');
|
||||
require_once('include/json_config.php');
|
||||
|
||||
$json_config = new json_config();
|
||||
|
||||
$focus = new EcmStockOperation();
|
||||
|
||||
if(isset($_REQUEST['record'])) {
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
}
|
||||
else {}
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
if(file_exists('modules/EcmStockOperations/views/view.list.php')) {
|
||||
require_once('modules/EcmStockOperations/views/view.list.php');
|
||||
$list = new EcmStockOperationsViewList();
|
||||
}
|
||||
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');
|
||||
|
||||
$_REQUEST['quantity_from_basic']=1;
|
||||
$_REQUEST['quantity_from']=1;
|
||||
|
||||
$list->preDisplay();
|
||||
$list->display();
|
||||
|
||||
?>
|
||||
57
modules/EcmStockOperations/Menu.php
Executable file
57
modules/EcmStockOperations/Menu.php
Executable file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
global $mod_strings;
|
||||
/*
|
||||
if(ACLController::checkAccess('EcmStockOperations', 'edit', true))
|
||||
$module_menu[] =array("index.php?module=EcmStockOperations&action=EditView&return_module=EcmStockOperations&return_action=DetailView", $mod_strings['LNK_NEW_ECMSTOCKOPERATION'],"CreateEcmStockOperations", 'EcmStockOperations');*/
|
||||
if(ACLController::checkAccess('EcmStockOperations', 'list', true))
|
||||
$module_menu[]=array("index.php?module=EcmStockOperations&action=index&return_module=EcmStockOperations&return_action=DetailView", $mod_strings['LNK_ECMSTOCKOPERATION_LIST'],"EcmStockOperations", 'EcmStockOperations');
|
||||
|
||||
$module_menu[]=array("index.php?module=EcmStockOperations&action=summary_report&return_module=EcmStockOperations&return_action=DetailView", "Raport operacji","EcmStockOperations", 'EcmStockOperations');
|
||||
$module_menu[]=array("index.php?module=EcmStockOperations&action=reports_form&return_module=EcmStockOperations&return_action=DetailView", $mod_strings['LBL_ECMSTOCKOPERATION_RAPORT'],"EcmStockOperations", 'EcmStockOperations');
|
||||
$module_menu[]=array("index.php?module=EcmStockOperations&action=maksyma", "Maksyma","EcmStockOperations", 'EcmStockOperations');
|
||||
|
||||
|
||||
?>
|
||||
33
modules/EcmStockOperations/calculateTrans.php
Normal file
33
modules/EcmStockOperations/calculateTrans.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
$db=$GLOBALS['db'];
|
||||
|
||||
ini_set('memory_limit',-1);
|
||||
ini_set('max_execution_timee',-1);
|
||||
|
||||
|
||||
$query="select id,product_id,quantity from ecmstockoperations where deleted=0 and parent_type='EcmStockDocInsideIns'";
|
||||
|
||||
$res = $db->query($query);
|
||||
$koszt=15.4;
|
||||
while($dane= $db->fetchByAssoc($res)){
|
||||
|
||||
$query2="select c.quantity from ecmproductcomponents c
|
||||
inner join ecmproducts p on p.id=c.ecmcomponent_id
|
||||
inner join ecmproductcategories_bean c2 on c2.bean_id=c.ecmcomponent_id
|
||||
where c.deleted=0 and c.ecmproduct_id='".$dane['product_id']."' and c2.ecmproductcategory_id='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1'";
|
||||
|
||||
$res2=$db->query($query2);
|
||||
$total_koszt=0;
|
||||
while($dane2=$db->fetchByAssoc($res2)){
|
||||
$total_koszt=$total_koszt+($dane['quantity']*$dane2['quantity']*$koszt);
|
||||
}
|
||||
|
||||
$query3="update ecmstockoperations set work_price=$total_koszt where id='".$dane['id']."'";
|
||||
|
||||
$db->query($query3);
|
||||
|
||||
}
|
||||
*/
|
||||
?>
|
||||
28
modules/EcmStockOperations/checkTempReservations.php
Normal file
28
modules/EcmStockOperations/checkTempReservations.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
//get all sessions id
|
||||
$sessions = array();
|
||||
|
||||
$path = realpath(session_save_path());
|
||||
$files = array_diff(scandir($path), array('.', '..'));
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
//$sessions[$file] = unserialize(file_get_contents($path . '/' . $file));
|
||||
$s = explode("_", $file);
|
||||
$sessions[$s[1]] = true;
|
||||
}
|
||||
//get sessions from ecmreservations
|
||||
include_once("/var/www/crm/config.php");
|
||||
$db = new mysqli($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],
|
||||
$sugar_config['dbconfig']['db_password'], $sugar_config['dbconfig']['db_name']);
|
||||
|
||||
|
||||
$res = $db->query("SELECT distinct session_id as sid FROM ecmreservations");
|
||||
|
||||
|
||||
while ($row=$res->fetch_assoc()) {
|
||||
if (!isset($sessions[$row['sid']]))
|
||||
$db->query("DELETE FROM ecmreservations WHERE session_id='".$row['sid']."'");
|
||||
}
|
||||
return true;
|
||||
?>
|
||||
9
modules/EcmStockOperations/check_empty_prices.php
Executable file
9
modules/EcmStockOperations/check_empty_prices.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$w=$GLOBALS['db']->query("select id,product_code,date_entered,type,parent_type,product_id from ecmstockoperations where price=0 and deleted='0'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
echo $r['product_code']." ".$r['date_entered']." ".$r['type']."<br>";
|
||||
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select price from ecmstockoperations where product_id='".$r['product_id']."' and price!=0 and deleted='0' order by date_entered desc"));
|
||||
echo $rr['price'].'<br>';
|
||||
$GLOBALS['db']->query("update ecmstockoperations set price='".$rr['price']."' where id='".$r['id']."'");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
echo $op->removeDocumentReservations($_GET['temp_doc_id']);
|
||||
return;
|
||||
?>
|
||||
5
modules/EcmStockOperations/deleteReservation.php
Normal file
5
modules/EcmStockOperations/deleteReservation.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
$op->removeReservation($_GET['temp_item_id']);
|
||||
?>
|
||||
23
modules/EcmStockOperations/deleteSessionReservations.php
Normal file
23
modules/EcmStockOperations/deleteSessionReservations.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
//get all sessions id
|
||||
$sessions = array();
|
||||
|
||||
$path = realpath(session_save_path());
|
||||
$files = array_diff(scandir($path), array('.', '..'));
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
//$sessions[$file] = unserialize(file_get_contents($path . '/' . $file));
|
||||
$s = explode("_", $file);
|
||||
$sessions[$s[1]] = true;
|
||||
}
|
||||
//get sessions from ecmreservations
|
||||
global $db;
|
||||
$res = $db->query("SELECT distinct session_id as sid FROM ecmreservations");
|
||||
while ($row=$db->fetchByAssoc($res)) {
|
||||
echo $row['sid'].'<br>';
|
||||
if (!isset($sessions[$row['sid']])) {
|
||||
$db->query("DELETE FROM ecmreservations WHERE session_id='".$row['sid']."'");
|
||||
}
|
||||
return true;
|
||||
?>
|
||||
89
modules/EcmStockOperations/field_arrays.php
Executable file
89
modules/EcmStockOperations/field_arrays.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Contains field arrays that are used for caching
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
$fields_array['EcmStockOperation']=array(
|
||||
'column_fields'=>array(
|
||||
"id",
|
||||
"date_entered",
|
||||
"date_modified",
|
||||
"modified_user_id",
|
||||
"assigned_user_id",
|
||||
"name",
|
||||
"product_name",
|
||||
"product_code",
|
||||
"product_id",
|
||||
"stock_name",
|
||||
"stock_id",
|
||||
"quantity",
|
||||
"price",
|
||||
"parent_type",
|
||||
"parent_name",
|
||||
"parent_id",
|
||||
"in_id",
|
||||
"documentitem_id",
|
||||
"type"
|
||||
),
|
||||
'list_fields'=>array(
|
||||
"id",
|
||||
"date_entered",
|
||||
"date_modified",
|
||||
"modified_user_id",
|
||||
"assigned_user_id",
|
||||
"name",
|
||||
"product_name",
|
||||
"product_code",
|
||||
"product_id",
|
||||
"stock_name",
|
||||
"stock_id",
|
||||
"quantity",
|
||||
"price",
|
||||
"parent_type",
|
||||
"parent_name",
|
||||
"parent_id",
|
||||
"in_id",
|
||||
"documentitem_id",
|
||||
"type"
|
||||
),
|
||||
'required_fields' => array('name'=>1),
|
||||
);
|
||||
?>
|
||||
3
modules/EcmStockOperations/getGUID.php
Normal file
3
modules/EcmStockOperations/getGUID.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo create_guid(); return;
|
||||
?>
|
||||
6
modules/EcmStockOperations/getProductQuantity.php
Normal file
6
modules/EcmStockOperations/getProductQuantity.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
if ($_GET['stock_id']) $stock_id = $_GET['stock_id'];
|
||||
print $op->getStock($_GET['product_id'], $stock_id);
|
||||
?>
|
||||
6
modules/EcmStockOperations/index.php
Executable file
6
modules/EcmStockOperations/index.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
require_once('modules/EcmStockOperations/ListView.php');
|
||||
|
||||
?>
|
||||
95
modules/EcmStockOperations/language/en_us.lang.php
Executable file
95
modules/EcmStockOperations/language/en_us.lang.php
Executable file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
$mod_strings = array (
|
||||
'LBL_PRODUCT_CODE' => 'Index',
|
||||
'LBL_LIST_PRODUCT_CODE' => 'Index',
|
||||
'LBL_PRODUCT_NAME' => 'Product',
|
||||
'LBL_STOCK_NAME' => 'Inventory',
|
||||
'LBL_DATE' => 'Date',
|
||||
'LBL_PRICE' => 'Price',
|
||||
'LBL_TYPE' => 'Type',
|
||||
'LBL_LIST_PRODUCT_NAME' => 'Product',
|
||||
'LBL_LIST_STOCK_NAME' => 'Inventory',
|
||||
'LBL_LIST_DATE' => 'Date',
|
||||
'LBL_LIST_PRICE' => 'Price',
|
||||
'LBL_LIST_TYPE' => 'Type',
|
||||
'LBL_LIST_QUANTITY' => 'Quantity',
|
||||
'LBL_LIST_DOCUMENT_NAME' => 'Document',
|
||||
'LBL_LIST_PARENT_TYPE' => 'Document type',
|
||||
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
'LBL_MODULE_NAME' => 'Inventory Operations',
|
||||
'LBL_MODULE_TITLE' => 'Inventory Operations: Home',
|
||||
'LBL_MODULE_ID' => 'Inventory Operations',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Inventory Operations Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Inventory Operations List',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Inventory Operation',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_ECMSTOCKOPERATION' => 'Inventory Operation:',
|
||||
'LBL_ECMSTOCKOPERATION_SUBJECT' => 'Inventory Operation Subject:',
|
||||
'LBL_LIST_SUBJECT' => 'Name',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
|
||||
'LNK_NEW_ECMSTOCKOPERATION' => 'Create Inventory Operation',
|
||||
'LNK_ECMSTOCKOPERATION_LIST' => 'Inventory Operations',
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
|
||||
'LBL_LIST_MY_ECMSTOCKOPERATIONS' => 'My Assigned Inventory Operations',
|
||||
|
||||
'LBL_CREATED_BY' => 'Created by:',
|
||||
'LBL_DATE_CREATED' => 'Create Date:',
|
||||
'LBL_MODIFIED_BY' => 'Last Modified by:',
|
||||
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
|
||||
|
||||
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Inventory Operations',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
|
||||
'LBL_LIST_VALUE' => 'Value',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
|
||||
'LBL_ECMSTOCKOPERATION_RAPORT' => 'Stock report',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
79
modules/EcmStockOperations/language/ge_ge.lang.php
Executable file
79
modules/EcmStockOperations/language/ge_ge.lang.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
$mod_strings = array (
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
'LBL_VALUE' => 'Value',
|
||||
'LBL_MODULE_NAME' => 'Vat',
|
||||
'LBL_MODULE_TITLE' => 'Vat: Home',
|
||||
'LBL_MODULE_ID' => 'Vat',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Vat Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Vat List',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Vat',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_ECMSTOCKOPERATION' => 'Vat:',
|
||||
'LBL_ECMSTOCKOPERATION_SUBJECT' => 'Vat Subject:',
|
||||
'LBL_LIST_SUBJECT' => 'Name',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
|
||||
'LNK_NEW_ECMSTOCKOPERATION' => 'Create Vat',
|
||||
'LNK_ECMSTOCKOPERATION_LIST' => 'Vat',
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
|
||||
'LBL_LIST_MY_ECMSTOCKOPERATIONS' => 'My Assigned Vat',
|
||||
|
||||
'LBL_CREATED_BY' => 'Created by:',
|
||||
'LBL_DATE_CREATED' => 'Create Date:',
|
||||
'LBL_MODIFIED_BY' => 'Last Modified by:',
|
||||
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
|
||||
|
||||
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Vat',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
|
||||
'LBL_LIST_VALUE' => 'Value',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
92
modules/EcmStockOperations/language/pl_pl.lang.php
Executable file
92
modules/EcmStockOperations/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
$mod_strings = array (
|
||||
'LBL_PRODUCT_CODE' => 'Indeks',
|
||||
'LBL_LIST_PRODUCT_CODE' => 'Indeks',
|
||||
'LBL_PRODUCT_NAME' => 'Produkt',
|
||||
'LBL_STOCK_NAME' => 'Magazyn',
|
||||
'LBL_DATE' => 'Data',
|
||||
'LBL_PRICE' => 'Cena',
|
||||
'LBL_TYPE' => 'Typ',
|
||||
'LBL_LIST_PRODUCT_NAME' => 'Produkt',
|
||||
'LBL_LIST_STOCK_NAME' => 'Magazyn',
|
||||
'LBL_LIST_DATE' => 'Data',
|
||||
'LBL_LIST_PRICE' => 'Cena',
|
||||
'LBL_LIST_TYPE' => 'Typ',
|
||||
'LBL_LIST_QUANTITY' => 'Ilosc',
|
||||
'LBL_LIST_DOCUMENT_NAME' => 'Dokument',
|
||||
'LBL_LIST_PARENT_TYPE' => 'Typ Dokumentu',
|
||||
|
||||
'LBL_ASSIGNED_TO_ID' => 'Przypisany Do',
|
||||
'LBL_MODULE_NAME' => 'Operacje Magazynowe',
|
||||
'LBL_MODULE_TITLE' => 'Operacje Magazynowe: Strona Glówna',
|
||||
'LBL_MODULE_ID' => 'Operacje Magazynowe',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
|
||||
'LBL_LIST_FORM_TITLE' => 'Lista Operacji Magazynowych',
|
||||
'LBL_NEW_FORM_TITLE' => 'Nowa Operacja Magazynowa',
|
||||
'LBL_SUBJECT' => 'Tytul:',
|
||||
'LBL_ECMSTOCKOPERATION' => 'Operacja Magazynowa:',
|
||||
'LBL_ECMSTOCKOPERATION_SUBJECT' => 'Tytul Operacji Magazynowej:',
|
||||
'LBL_LIST_SUBJECT' => 'Nazwa',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Ostatnio Modyfikowane',
|
||||
'LNK_NEW_ECMSTOCKOPERATION' => 'Utwórz Operacje Magazynowa',
|
||||
'LNK_ECMSTOCKOPERATION_LIST' => 'Operacje Magazynowe',
|
||||
'LBL_LIST_MY_ECMSTOCKOPERATIONS' => 'Moje Przypisane Operacje Magazynowe',
|
||||
|
||||
'LBL_CREATED_BY' => 'Utworzeone Przez:',
|
||||
'LBL_DATE_CREATED' => 'Data Utworzenia:',
|
||||
'LBL_MODIFIED_BY' => 'Ostatnio Modyfikowane Przez:',
|
||||
'LBL_DATE_LAST_MODIFIED' => 'Data Modyfikacji:',
|
||||
|
||||
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Operacje Magazynowe',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Przypisany Uzytkownik',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Przypisane Do',
|
||||
'LBL_ECMSTOCKOPERATION_RAPORT' => 'Raport magazynowy',
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
1275
modules/EcmStockOperations/maksyma.php
Normal file
1275
modules/EcmStockOperations/maksyma.php
Normal file
File diff suppressed because it is too large
Load Diff
48
modules/EcmStockOperations/metadata/SearchFields.php
Executable file
48
modules/EcmStockOperations/metadata/SearchFields.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$searchFields['EcmStockOperations'] =
|
||||
array (
|
||||
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true),
|
||||
'assigned_user_id'=> array('query_type'=>'default'),
|
||||
'product_code'=> array('query_type'=>'default'),
|
||||
'product_name'=> array('query_type'=>'default'),
|
||||
'stock_name'=> array('query_type'=>'default'),
|
||||
'date_entered'=> array('query_type'=>'default'),
|
||||
'price'=> array('query_type'=>'default'),
|
||||
'type'=> array('query_type'=>'default'),
|
||||
);
|
||||
?>
|
||||
64
modules/EcmStockOperations/metadata/additionalDetails.php
Executable file
64
modules/EcmStockOperations/metadata/additionalDetails.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*********************************************************************************/
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
function additionalDetailsEcmStockOperation($fields) {
|
||||
static $mod_strings;
|
||||
global $app_strings;
|
||||
if(empty($mod_strings)) {
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, 'EcmStockOperations');
|
||||
}
|
||||
|
||||
$overlib_string = '';
|
||||
|
||||
if(!empty($fields['DATE_ENTERED']))
|
||||
$overlib_string .= '<b>'. $app_strings['LBL_DATE_ENTERED'] . '</b> ' . $fields['DATE_ENTERED'] . '<br>';
|
||||
if(!empty($fields['NAME']))
|
||||
$overlib_string .= '<b>'. $mod_strings['LBL_NAME'] . '</b> ' . $fields['NAME'] . '<br>';
|
||||
|
||||
return array('fieldToAddTo' => 'NAME',
|
||||
'string' => $overlib_string,
|
||||
'editLink' => "index.php?action=EditView&module=EcmStockOperations&return_module=EcmStockOperations&record={$fields['ID']}",
|
||||
'viewLink' => "index.php?action=DetailView&module=EcmStockOperations&return_module=EcmStockOperations&record={$fields['ID']}");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
67
modules/EcmStockOperations/metadata/detailviewdefs.php
Executable file
67
modules/EcmStockOperations/metadata/detailviewdefs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$viewdefs['EcmStockOperations']['DetailView'] = array(
|
||||
'templateMeta'=>array(
|
||||
'form'=>array(
|
||||
'buttons'=>array(
|
||||
'EDIT',
|
||||
'DUPLICATE',
|
||||
'DELETE',
|
||||
)
|
||||
),
|
||||
'maxColumns'=>'2',
|
||||
'widths'=>array(
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field' =>'30'
|
||||
),
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field'=>'30'
|
||||
)
|
||||
),
|
||||
),
|
||||
'panels'=>array(
|
||||
array(
|
||||
'name',
|
||||
'assigned_user_name',
|
||||
),
|
||||
array(
|
||||
'value',
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
52
modules/EcmStockOperations/metadata/editviewdefs.php
Executable file
52
modules/EcmStockOperations/metadata/editviewdefs.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?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['EcmStockOperations']['EditView'] = array(
|
||||
'templateMeta'=>array(
|
||||
'form' => array('buttons'=>array('SAVE', 'CANCEL')),
|
||||
'maxColumns'=>'2',
|
||||
'widths'=>array(
|
||||
array('label'=>'10','field'=>'30'),
|
||||
array('label'=>'10','field'=>'30'),
|
||||
),
|
||||
),
|
||||
'panels'=>array(
|
||||
'default'=>array(
|
||||
array('name','assigned_user_name'),
|
||||
array('value'),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
126
modules/EcmStockOperations/metadata/listviewdefs.php
Executable file
126
modules/EcmStockOperations/metadata/listviewdefs.php
Executable file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$listViewDefs['EcmStockOperations'] = array(
|
||||
'PRODUCT_ID' => array(
|
||||
'width'=>'1',
|
||||
'sortable'=>false,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
),
|
||||
'PRODUCT_CODE' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_PRODUCT_CODE',
|
||||
'default' => true),
|
||||
'PRODUCT_NAME' => array(
|
||||
'width' => '30',
|
||||
'label' => 'LBL_LIST_PRODUCT_NAME',
|
||||
'module'=>'EcmProducts',
|
||||
'id'=>'PRODUCT_ID',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'STOCK_NAME' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_STOCK_NAME',
|
||||
'default' => true,
|
||||
),
|
||||
'PARENT_ID' => array(
|
||||
'width'=>'1',
|
||||
'sortable'=>false,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
),
|
||||
'DOCUMENT_NAME' => array(
|
||||
'width'=>'1',
|
||||
'sortable'=>false,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
),
|
||||
|
||||
'PARENT_NAME' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_LIST_DOCUMENT_NAME',
|
||||
//'id'=>'PARENT_ID',
|
||||
'customCode'=>'<a href="index.php?module={$PARENT_TYPE}&action=DetailView&record={$PARENT_ID}">{$DOCUMENT_NAME}</a>',
|
||||
'default' => true,
|
||||
//'link' => true
|
||||
),
|
||||
'DATE_ENTERED' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_LIST_DATE',
|
||||
'default' => true),
|
||||
'PRICE' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_PRICE',
|
||||
'default' => true),
|
||||
'TYPE' => array(
|
||||
'width' => '5',
|
||||
'label' => 'LBL_LIST_TYPE',
|
||||
'default' => true),
|
||||
'QUANTITY' => array(
|
||||
'width' => '5',
|
||||
'label' => 'LBL_LIST_QUANTITY',
|
||||
'default' => true),
|
||||
'PARENT_TYPE_NAME' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_LIST_PARENT_TYPE',
|
||||
'default' => true),
|
||||
'PREVIEW_PDF' => array(
|
||||
'width' => '1',
|
||||
'label' => ' ',
|
||||
'sortable'=>false,
|
||||
'default' => true),
|
||||
'PART_NO' => array(
|
||||
'width'=>'10',
|
||||
'sortable'=>false,
|
||||
'label'=>'Nr parti',
|
||||
'default'=>true,
|
||||
),
|
||||
'PART_DATE' => array(
|
||||
'width'=>'10',
|
||||
'sortable'=>false,
|
||||
'label'=>'Data ważności',
|
||||
'default'=>true,
|
||||
),
|
||||
);
|
||||
?>
|
||||
51
modules/EcmStockOperations/metadata/metafiles.php
Executable file
51
modules/EcmStockOperations/metadata/metafiles.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Jun 1, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$metafiles['EcmStockOperations'] = array(
|
||||
'detailviewdefs' => 'modules/EcmStockOperations/metadata/detailviewdefs.php',
|
||||
'editviewdefs' => 'modules/EcmStockOperations/metadata/editviewdefs.php',
|
||||
'listviewdefs' => 'modules/EcmStockOperations/metadata/listviewdefs.php',
|
||||
'searchdefs' => 'modules/EcmStockOperations/metadata/searchdefs.php',
|
||||
'popupdefs' => 'modules/EcmStockOperations/metadata/popupdefs.php',
|
||||
'searchfields' => 'modules/EcmStockOperations/metadata/SearchFields.php',
|
||||
|
||||
);
|
||||
?>
|
||||
67
modules/EcmStockOperations/metadata/popupdefs.php
Executable file
67
modules/EcmStockOperations/metadata/popupdefs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
$popupMeta = array('moduleMain' => 'EcmStockOperation',
|
||||
'varName' => 'ECMSTOCKOPERATION',
|
||||
'orderBy' => 'ecmstockoperations.name',
|
||||
'whereClauses' =>
|
||||
array('name' => 'ecmstockoperations.name'),
|
||||
'listviewdefs' => array(
|
||||
'NAME' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'VALUE' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_VALUE',
|
||||
'default' => true),
|
||||
'ASSIGNED_USER_NAME' => array(
|
||||
'width' => '9',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER',
|
||||
'default' => true)
|
||||
|
||||
),
|
||||
'searchdefs' => array(
|
||||
'name',
|
||||
'value',
|
||||
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
68
modules/EcmStockOperations/metadata/searchdefs.php
Executable file
68
modules/EcmStockOperations/metadata/searchdefs.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on May 29, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$searchdefs['EcmStockOperations'] = array(
|
||||
'templateMeta' => array(
|
||||
'maxColumns' => '3',
|
||||
'widths' => array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
'layout' => array(
|
||||
'basic_search' => array(
|
||||
'product_code',
|
||||
'product_name',
|
||||
'stock_id',
|
||||
'parent_name',
|
||||
'date_entered',
|
||||
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
|
||||
),
|
||||
'advanced_search' => array(
|
||||
'product_code',
|
||||
'product_name',
|
||||
'stock_id',
|
||||
'parent_name',
|
||||
'date_entered',
|
||||
'price',
|
||||
'type',
|
||||
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
71
modules/EcmStockOperations/metadata/sidecreateviewdefs.php
Executable file
71
modules/EcmStockOperations/metadata/sidecreateviewdefs.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*********************************************************************************/
|
||||
$viewdefs['EcmStockOperations']['SideQuickCreate'] = array(
|
||||
'templateMeta' => array('form'=>array('buttons'=>array('SAVE'),
|
||||
'button_location'=>'bottom',
|
||||
'headerTpl'=>'include/EditView/header.tpl',
|
||||
'footerTpl'=>'include/EditView/footer.tpl',
|
||||
),
|
||||
'maxColumns' => '1',
|
||||
'panelClass'=>'none',
|
||||
|
||||
'labelsOnTop'=>true,
|
||||
'widths' => array(
|
||||
array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
),
|
||||
'panels' =>array (
|
||||
'DEFAULT' =>
|
||||
array (
|
||||
array (
|
||||
array('name'=>'name', 'displayParams'=>array('size'=>20, 'required'=>true)),
|
||||
),
|
||||
array(
|
||||
array('name'=>'value', 'displayParams'=>array('size'=>20)),
|
||||
),
|
||||
array (
|
||||
array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)),
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
65
modules/EcmStockOperations/metadata/studio.php
Executable file
65
modules/EcmStockOperations/metadata/studio.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$GLOBALS['studioDefs']['EcmStockOperations'] = array(
|
||||
'LBL_DETAILVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockOperations/DetailView.html',
|
||||
'php_file'=>'modules/EcmStockOperations/DetailView.php',
|
||||
'type'=>'DetailView',
|
||||
),
|
||||
'LBL_EDITVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockOperations/EditView.html',
|
||||
'php_file'=>'modules/EcmStockOperations/EditView.php',
|
||||
'type'=>'EditView',
|
||||
),
|
||||
'LBL_LISTVIEW'=>array(
|
||||
'template'=>'listview',
|
||||
'meta_file'=>'modules/EcmStockOperations/listviewdefs.php',
|
||||
'type'=>'ListView',
|
||||
),
|
||||
'LBL_SEARCHFORM'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockOperations/SearchForm.html',
|
||||
'php_file'=>'modules/EcmStockOperations/ListView.php',
|
||||
'type'=>'SearchForm',
|
||||
),
|
||||
|
||||
);
|
||||
42
modules/EcmStockOperations/metadata/subpaneldefs.php
Executable file
42
modules/EcmStockOperations/metadata/subpaneldefs.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Layout definition for EcmStockOperations
|
||||
*
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
$layout_defs['EcmStockOperations']['subpanel_setup'] = array(
|
||||
);
|
||||
?>
|
||||
91
modules/EcmStockOperations/metadata/subpanels/default.php
Executable file
91
modules/EcmStockOperations/metadata/subpanels/default.php
Executable file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for EcmStockOperations
|
||||
*
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
$subpanel_layout = array(
|
||||
'top_buttons' => array(
|
||||
array('widget_class' => 'SubPanelTopCreateButton'),
|
||||
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmStockOperations'),
|
||||
),
|
||||
|
||||
'where' => '',
|
||||
|
||||
|
||||
|
||||
'list_fields' => array(
|
||||
'ecmstockoperation_number'=>array(
|
||||
'vname' => 'LBL_LIST_NUMBER',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'name'=>array(
|
||||
'vname' => 'LBL_LIST_SUBJECT',
|
||||
'widget_class' => 'SubPanelDetailViewLink',
|
||||
'width' => '50%',
|
||||
),
|
||||
'status'=>array(
|
||||
'vname' => 'LBL_LIST_STATUS',
|
||||
'width' => '15%',
|
||||
),
|
||||
'type'=>array(
|
||||
'vname' => 'LBL_LIST_TYPE',
|
||||
'width' => '15%',
|
||||
),
|
||||
'priority'=>array(
|
||||
'vname' => 'LBL_LIST_PRIORITY',
|
||||
'width' => '11%',
|
||||
),
|
||||
'assigned_user_name' => array (
|
||||
'name' => 'assigned_user_name',
|
||||
'vname' => 'LBL_LIST_ASSIGNED_TO_NAME',
|
||||
),
|
||||
'edit_button'=>array(
|
||||
'widget_class' => 'SubPanelEditButton',
|
||||
'module' => 'EcmStockOperations',
|
||||
'width' => '4%',
|
||||
),
|
||||
'remove_button'=>array(
|
||||
'widget_class' => 'SubPanelRemoveButton',
|
||||
'module' => 'EcmStockOperations',
|
||||
'width' => '5%',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for EcmStockOperations
|
||||
*
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
$subpanel_layout = array(
|
||||
|
||||
'list_fields' => array(
|
||||
/*
|
||||
'doc_id'=>array(
|
||||
'vname' => 'Nazwa dokumentu',
|
||||
'width' => '50%',
|
||||
),
|
||||
*/
|
||||
'quantity'=>array(
|
||||
'vname' => 'Ilość',
|
||||
'width' => '50%',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
22
modules/EcmStockOperations/reports_form.php
Normal file
22
modules/EcmStockOperations/reports_form.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<table cellspacing="0" cellpadding="0" border="0"><tr><td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td><td><h2>Inventory Reports</h2></td></tr></table><br />
|
||||
<ul class="tablist" style="width:1130px;">
|
||||
<li>
|
||||
<a class="current" href="#">Settings</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="index.php" method="get" name="inventory_reports">
|
||||
<input type="hidden" name="module" value="EcmStockOperations" />
|
||||
<input type="hidden" name="action" value="reports_process" />
|
||||
<table style="border-top: 0px none; margin-bottom: 4px;width:1130px;" class="tabForm" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="dataLabel" width="20%" nowrap="nowrap">Data:</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<input id="date" name="date" type="text" value="<?php echo date("Y-m");?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="submit" class="button" value="Generuj"/>
|
||||
</form><br />
|
||||
|
||||
190
modules/EcmStockOperations/reports_process.php
Normal file
190
modules/EcmStockOperations/reports_process.php
Normal file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
$date = $_REQUEST['date'];
|
||||
//KS
|
||||
function getTotalKS($id){
|
||||
$res = ($GLOBALS['db']->query("select p.group_ks,sum(ks.price*ks.quantity) as s from ecmstockdoccorrectitems as ks inner join ecmproducts as p on ks.ecmproduct_id=p.id where ks.ecmstockdoccorrect_id='".$id."' and ks.deleted='0' group by p.group_ks"));
|
||||
$result = array();
|
||||
$result['sum'] = 0;
|
||||
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
|
||||
$result[$row['group_ks']] = $row['s'];
|
||||
$result['sum']+=$row['s'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
$z="select ks.id,ks.document_no,ks.total,ks.register_date, ks.name as ks_name, s.name from ecmstockdoccorrects as ks inner join ecmstocks as s on ks.stock_id=s.id
|
||||
where ks.deleted='0' and ks.register_date like '".$date."%' order by ks.register_date asc";
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
$t='Numer,Data rejestracji,Wartość,Wartość TH,Wartość WG,Wartość PP,Magazyn,Opis
|
||||
';
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total = getTotalKS($r['id']);
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.round($total['sum'],2).',';
|
||||
if (isset($total['1'])) $t.=round($total['1'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['2'])) $t.=round($total['2'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['3'])) $t.=round($total['3'],2); else $t.='0.00'; $t.=',';
|
||||
$t.=$r['name'].','.$r['ks_name'].'
|
||||
';
|
||||
}
|
||||
$filename = "ks.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
//PZ
|
||||
function getTotalPz($id){
|
||||
$res = ($GLOBALS['db']->query("select p.group_ks,sum(pz.price*pz.quantity) as s from ecmstockdocinitems as pz inner join ecmproducts as p on pz.ecmproduct_id=p.id where pz.ecmstockdocin_id='".$id."' and pz.deleted='0' group by p.group_ks"));
|
||||
$result = array();
|
||||
$result['sum'] = 0;
|
||||
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
|
||||
$result[$row['group_ks']] = $row['s'];
|
||||
$result['sum']+=$row['s'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
$z="select pz.id,pz.document_no,pz.total,pz.register_date, pz.name as pz_name, s.name from ecmstockdocins as pz inner join ecmstocks as s on pz.stock_id=s.id
|
||||
where pz.deleted='0' and pz.status='accepted' and pz.register_date like '".$date."%' order by pz.register_date asc";
|
||||
|
||||
global $app_list_strings;
|
||||
$t='Numer,Data rejestracji,Wartość,Wartość TH,Wartość WG,Wartość PP,Magazyn,Opis
|
||||
';
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total = getTotalPz($r['id']);
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.round($total['sum'],2).',';
|
||||
if (isset($total['1'])) $t.=round($total['1'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['2'])) $t.=round($total['2'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['3'])) $t.=round($total['3'],2); else $t.='0.00'; $t.=',';
|
||||
$t.=$r['name'].','.$r['pz_name'].'
|
||||
';
|
||||
}
|
||||
$filename = "pz.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
//MM
|
||||
function getTotalMM($id){
|
||||
$res = ($GLOBALS['db']->query("select p.group_ks,sum(pz.price*pz.quantity) as s from ecmstockdocmoveitems as pz inner join ecmproducts as p on pz.ecmproduct_id=p.id where pz.ecmstockdocmove_id='".$id."' and pz.deleted='0' group by p.group_ks"));
|
||||
$result = array();
|
||||
$result['sum'] = 0;
|
||||
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
|
||||
$result[$row['group_ks']] = $row['s'];
|
||||
$result['sum']+=$row['s'];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
$z="select mm.id,mm.document_no,mm.total,mm.register_date, st.name as too, sf.name as fromm from ecmstockdocmoves as mm inner join ecmstocks as sf on sf.id=mm.stock_out_id inner join ecmstocks as st on st.id=mm.stock_in_id
|
||||
where mm.deleted='0' and mm.register_date like '".$date."%' order by register_date asc";
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
$t='Numer,Data rejestracji,Wartość,Wartość TH,Wartość WG,Wartość PP,Z magazynu,Na magazyn
|
||||
';
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total = getTotalMM($r['id']);
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.round($total['sum'],2).',';
|
||||
if (isset($total['1'])) $t.=round($total['1'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['2'])) $t.=round($total['2'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['3'])) $t.=round($total['3'],2); else $t.='0.00'; $t.=',';
|
||||
$t.=$r['fromm'].','.$r['too'].'
|
||||
';
|
||||
}
|
||||
$filename = "mm.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
//RW
|
||||
function getTotalRW($id){
|
||||
$res=$GLOBALS['db']->query("select p.group_ks, sum(rwi.price*rwi.quantity) as s from ecmstockdocinsideoutitems as rwi inner join ecmproducts as p on (rwi.ecmproduct_id=p.id and p.product_category_id!='d7f876b0-1a3d-43a1-7c9b-511ba40df3d1') where rwi.ecmstockdocinsideout_id='".$id."' and rwi.deleted='0' group by p.group_ks");
|
||||
$result = array();
|
||||
$result['sum'] = 0;
|
||||
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
|
||||
$result[$row['group_ks']] = $row['s'];
|
||||
$result['sum']+=$row['s'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
$z="select rw.id,rw.document_no,rw.total,rw.register_date, s.name, rw.name as rw_name from ecmstockdocinsideouts as rw inner join ecmstocks as s on rw.stock_id=s.id
|
||||
where rw.deleted='0' and rw.status='accepted' and rw.register_date like '".$date."%' order by rw.register_date asc";
|
||||
global $app_list_strings;
|
||||
$t='Numer,Data rejestracji,Wartość,Wartość TH,Wartość WG,Wartość PP,Magazyn,Opis
|
||||
';
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total = getTotalRW($r['id']);
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.round($total['sum'],2).',';
|
||||
if (isset($total['1'])) $t.=round($total['1'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['2'])) $t.=round($total['2'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['3'])) $t.=round($total['3'],2); else $t.='0.00'; $t.=',';
|
||||
$t.=$r['name'].','.$r['rw_name'].'
|
||||
';
|
||||
}
|
||||
$filename = "rw.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
//PW
|
||||
function getTotalPw($id){
|
||||
$res=$GLOBALS['db']->query("select p.group_ks, sum(pw.price*pw.quantity) as s from ecmstockdocinsideinitems as pw inner join ecmproducts as p on pw.ecmproduct_id=p.id where pw.ecmstockdocinsidein_id='".$id."' and pw.deleted='0' group by p.group_ks");
|
||||
|
||||
|
||||
$result = array();
|
||||
$result['sum'] = 0;
|
||||
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
|
||||
$result[$row['group_ks']] = $row['s'];
|
||||
$result['sum']+=$row['s'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
$z="select pw.id,pw.document_no,pw.total,pw.register_date, s.name, pw.name as pw_name from ecmstockdocinsideins as pw inner join ecmstocks as s on pw.stock_id=s.id
|
||||
where pw.deleted='0' and pw.register_date like '".$date."%' order by pw.register_date asc";
|
||||
|
||||
global $app_list_strings;
|
||||
$t='Numer,Data rejestracji,Wartość,Wartość TH,Wartość WG,Wartość PP,Magazyn,Opis
|
||||
';
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$total = getTotalPw($r['id']);
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.round($total['sum'],2).',';
|
||||
if (isset($total['1'])) $t.=round($total['1'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['2'])) $t.=round($total['2'],2); else $t.='0.00'; $t.=',';
|
||||
if (isset($total['3'])) $t.=round($total['3'],2); else $t.='0.00'; $t.=',';
|
||||
$t.=$r['name'].','.$r['pw_name'].'
|
||||
';
|
||||
}
|
||||
$filename = "pw.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
?>
|
||||
<h2>Wygenerowane raporty</h2></br>
|
||||
<table width="30%" border="1">
|
||||
<tr>
|
||||
<td width="50%">KS</td>
|
||||
<td><a href="./ks.csv">ks.csv</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">PZ</td>
|
||||
<td><a href="./pz.csv">pz.csv</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">MM</td>
|
||||
<td><a href="./mm.csv">mm.csv</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">RW</td>
|
||||
<td><a href="./rw.csv">rw.csv</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">PW</td>
|
||||
<td><a href="./pw.csv">pw.csv</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
5
modules/EcmStockOperations/saveDocumentReservations.php
Normal file
5
modules/EcmStockOperations/saveDocumentReservations.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
$op->saveDocumentReservations($_GET['temp_id']);
|
||||
?>
|
||||
5
modules/EcmStockOperations/saveParentReservation.php
Normal file
5
modules/EcmStockOperations/saveParentReservation.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
$op->saveParentReservation($_GET['stock_id'],$_GET['product_id'],$_GET['doc_id'],$_GET['item_id'],$_GET['quantity'], $_GET['doc_type']);
|
||||
?>
|
||||
5
modules/EcmStockOperations/saveReservation.php
Normal file
5
modules/EcmStockOperations/saveReservation.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
$op->saveReservation($_GET['stock_id'],$_GET['product_id'],$_GET['temp_doc_id'],$_GET['temp_item_id'],$_GET['quantity'], $_GET['doc_type']);
|
||||
?>
|
||||
142
modules/EcmStockOperations/summary_report.php
Normal file
142
modules/EcmStockOperations/summary_report.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
if(!$_GET['date_from'])$date_from=date("Y-m-d");
|
||||
else $date_from=$GLOBALS['timedate']->to_db_date($_GET['date_from']);
|
||||
$exp=explode("-",$date_from);
|
||||
$date_from=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+24*3600);
|
||||
if(!$date_from)$date_from=date("Y-m-d");
|
||||
|
||||
if(!$_GET['date_to'])$date_to=date("Y-m-d");
|
||||
else $date_to=$GLOBALS['timedate']->to_db_date($_GET['date_to']);
|
||||
$exp=explode("-",$date_to);
|
||||
$date_to=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+24*3600);
|
||||
if(!$date_to)$date_to=date("Y-m-d");
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" border="0"><tr><td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="" width="16" border="0" height="16"></td><td><h2>Raport operacji magazynowych</h2></td></tr></table><br />
|
||||
<ul class="tablist" style="width:100%;">
|
||||
<li>
|
||||
<a class="current" href="#">Opcje</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="index.php" method="get" name="search_reports">
|
||||
<input type="hidden" name="module" value="EcmStockOperations" />
|
||||
<input type="hidden" name="action" value="summary_report" />
|
||||
<input type="hidden" name="process" value="1" />
|
||||
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="dataLabel" width="5%" nowrap="nowrap">
|
||||
Od daty </td>
|
||||
<td class="dataField" width="20%" nowrap="nowrap">
|
||||
<input autocomplete="off" name="date_from" id="date_from" value="<? echo $GLOBALS['timedate']->to_display_date($date_from);?>" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_from_trigger" align="absmiddle" border="0">
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_from",
|
||||
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
|
||||
button : "date_from_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td class="dataLabel" width="5%" nowrap="nowrap">
|
||||
Do daty</td>
|
||||
<td class="dataField" width="20%" nowrap="nowrap">
|
||||
<input autocomplete="off" name="date_to" id="date_to" value="<? echo $GLOBALS['timedate']->to_display_date($date_to);?>" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_to",
|
||||
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
|
||||
button : "date_to_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<input class="button" name="submit" value="Wykonaj" type="submit">
|
||||
<input class="button" name="clear" value="Wyczyść" type="button" onclick="location.href='index.php?module=EcmReports&action=index6';">
|
||||
|
||||
<?php
|
||||
if ($_REQUEST['process']!='1') return;
|
||||
if (!$_REQUEST['date_from']) return;
|
||||
if (!$_REQUEST['date_to']) return;
|
||||
|
||||
$date_from=$GLOBALS['timedate']->to_db_date($_GET['date_from']);
|
||||
$date_to=$GLOBALS['timedate']->to_db_date($_GET['date_to']);
|
||||
|
||||
global $db;
|
||||
//get groups
|
||||
$groups = array();
|
||||
$res=$db->query("SELECT DISTINCT group_ks FROM ecmproducts ORDER BY group_ks");
|
||||
while ($row=$db->fetchByAssoc($res)) $groups[] = $row['group_ks'];
|
||||
|
||||
//get operations
|
||||
$query = "
|
||||
SELECT
|
||||
(CASE so.type
|
||||
WHEN '1' THEN so.price*so.quantity*-1
|
||||
WHEN '0' THEN so.price*so.quantity
|
||||
END) as val,
|
||||
so.type, so.parent_type as type, p.group_ks as group_ks FROM ecmstockoperations as so LEFT JOIN ecmproducts as p ON p.id=so.product_id WHERE so.date_entered BETWEEN '$date_from' AND '$date_to' GROUP BY so.parent_type, p.group_ks ORDER BY so.parent_type";
|
||||
echo $query;
|
||||
$res = $db->query($query);
|
||||
$operations = array();
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
if (!is_array($operations[$row['type']])) $operations[$row['type']] = array();
|
||||
$operations[$row['type']][$row['group_ks']] = $row['val'];
|
||||
}
|
||||
//doc_map
|
||||
$map = array(
|
||||
'EcmInvoiceOuts' => 'FV',
|
||||
'EcmStockDocIns' => 'PZ',
|
||||
'EcmStockDocOuts' => 'WZ',
|
||||
'EcmStockDocInsideIns' => 'PW',
|
||||
'EcmStockDocInsideOuts' => 'RW',
|
||||
'EcmStockDocMoves' => 'MM',
|
||||
'EcmStockDocCorrects' => 'KS',
|
||||
);
|
||||
|
||||
//draw results
|
||||
$table = '<br><br><table border="1" cellspacing="0" cellpadding="0" border="0" style="">';
|
||||
//header
|
||||
$table.='<tr style="background-color: #f6f6f6;"><td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">Typ dokumentu</td>';
|
||||
foreach ($groups as $g) $table.='<td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">'.$g.'</td>';
|
||||
$table.='<td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">Razem</td></tr>';
|
||||
//results
|
||||
$group_sum = array();
|
||||
$sum_rows = 0;
|
||||
foreach ($operations as $type=>$row) {
|
||||
$row_sum = 0;
|
||||
$table.='<tr><td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.$map[$type].'</td>';
|
||||
foreach ($groups as $g) {
|
||||
if (!$group_sum[$g]) $group_sum[$g] = 0;
|
||||
if ($row[$g]) $val = $row[$g]; else $val = 0;
|
||||
$table.='<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($val).'</td>';
|
||||
$row_sum+=$val;
|
||||
$group_sum[$g] += $val;
|
||||
}
|
||||
$table.='<td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">'.format_number($row_sum).'</td></tr>';
|
||||
$sum_rows +=$row_sum;
|
||||
}
|
||||
//group summary
|
||||
$table.='<tr><td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">Razem</td>';
|
||||
$sum_group = 0;
|
||||
foreach ($groups as $g) {
|
||||
if ($group_sum[$g]) $val = $group_sum[$g]; else $val = 0;
|
||||
$table.='<td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">'.format_number($val).'</td>';
|
||||
$sum_group+=$val;
|
||||
}
|
||||
$table.='<td class="listViewThS1" height:48px;"="" "width:250px;="" style="text-align:center;">'.$sum_group.'</td></tr></table>';
|
||||
//echo '<br>sum_group= '.$sum_group;
|
||||
//echo '<br>sum_row= '.$sum_rows;
|
||||
|
||||
echo $table;
|
||||
?>
|
||||
28
modules/EcmStockOperations/testa.php
Normal file
28
modules/EcmStockOperations/testa.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$db = $GLOBALS['db'];
|
||||
$r=$db->query("select * from ecmstockoperations where
|
||||
product_id='582'
|
||||
and stock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4'
|
||||
and in_id is null and used=0 and type=0");
|
||||
$docs=array();
|
||||
$l=0;
|
||||
while($tmp=$db->fetchByAssoc($r)){
|
||||
|
||||
$ii=$db->query("select * from ecmstockoperations where in_id='".$tmp['id']."' and type=1");
|
||||
if($ii->num_rows>0){
|
||||
$quantity_tmp=$tmp['quantity'];
|
||||
while($tmp2=$db->fetchByAssoc($ii)){
|
||||
|
||||
$quantity_tmp-=$tmp2['quantity'];
|
||||
}
|
||||
$doc['quantity']=$quantity_tmp;
|
||||
$doc['parent_name']=$tmp['parent_name'];
|
||||
$docs[]=$doc;
|
||||
} else {
|
||||
$doc['quantity']=$tmp['quantity'];
|
||||
$doc['parent_name']=$tmp['parent_name'];
|
||||
$docs[]=$doc;
|
||||
}
|
||||
}
|
||||
var_dump($docs);
|
||||
?>
|
||||
95
modules/EcmStockOperations/tpls/QuickCreate.tpl
Executable file
95
modules/EcmStockOperations/tpls/QuickCreate.tpl
Executable file
@@ -0,0 +1,95 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<form name="ecmstockoperationsQuickCreate" id="ecmstockoperationsQuickCreate" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="EcmStockOperations">
|
||||
<input type="hidden" name="email_id" value="{$REQUEST.email_id}">
|
||||
<input type="hidden" name="account_id" value="{$REQUEST.account_id}">
|
||||
<input type="hidden" name="case_id" value="{$REQUEST.acase_id}">
|
||||
<input type="hidden" name="contact_id" value="{$REQUEST.contact_id}">
|
||||
<input type="hidden" name="return_action" value="{$REQUEST.return_action}">
|
||||
<input type="hidden" name="return_module" value="{$REQUEST.return_module}">
|
||||
<input type="hidden" name="return_id" value="{$REQUEST.return_id}">
|
||||
<input type="hidden" name="action" value='Save'>
|
||||
<input type="hidden" name="duplicate_parent_id" value="{$REQUEST.duplicate_parent_id}">
|
||||
<input type="hidden" name="to_pdf" value='1'>
|
||||
<input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{$ASSIGNED_USER_ID}" />
|
||||
|
||||
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 2px;">
|
||||
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" type="submit" name="button" {$saveOnclick|default:"onclick=\"return check_form('EcmStockOperationsQuickCreate');\""} value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
|
||||
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" type="submit" name="button" {$cancelOnclick|default:"onclick=\"this.form.action.value='$RETURN_ACTION'; this.form.module.value='$RETURN_MODULE'; this.form.record.value='$RETURN_ID'\""} value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
|
||||
<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" type="submit" name="button" onclick="this.form.to_pdf.value='0';this.form.action.value='EditView'; this.form.module.value='EcmStockOperations';" value=" {$APP.LBL_FULL_FORM_BUTTON_LABEL} "></td>
|
||||
<td align="right" nowrap><span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}</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>
|
||||
<th align="left" class="dataLabel" colspan="4"><h4 class="dataLabel"><slot>{$MOD.LBL_ECMSTOCKOPERATION_INFORMATION}</slot></h4></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="dataLabel" width="15%"><slot>{$MOD.LBL_SUBJECT} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td width="35%"><slot><textarea name='name' cols="40" tabindex='1' rows="1">{$NAME}</textarea></slot></td>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_TYPE}</slot></td>
|
||||
<td width="35%"><slot><select tabindex='2' name='type'>{$TYPE_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="dataLabel" rowspan="2" width="15%"><slot>{$MOD.LBL_DESCRIPTION}</slot></td>
|
||||
<td rowspan="2" width="35%"><slot><textarea name='description' tabindex='1' cols="40" rows="4">{$DESCRIPTION}</textarea></slot></td>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_PRIORITY}</slot></td>
|
||||
<td class="dataField" nowrap width="35%"><slot><select tabindex='2' name='priority'>{$PRIORITY_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_STATUS}</slot></td>
|
||||
<td width="35%"><slot><select tabindex='2' name='status'>{$STATUS_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
{$additionalScripts}
|
||||
</script>
|
||||
5
modules/EcmStockOperations/updateReservation.php
Normal file
5
modules/EcmStockOperations/updateReservation.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
$op->updateReservation($_GET['doc_id'],$_GET['item_id'],$_GET['quantity']);
|
||||
?>
|
||||
14
modules/EcmStockOperations/used.php
Executable file
14
modules/EcmStockOperations/used.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
include("../../config.php");
|
||||
$sql=mysql_connect("localhost","e5crm.more7.com","5z#JaL");
|
||||
mysql_select_db("e5crm_more7_com");
|
||||
$w=$GLOBALS['db']->query("select id,product_code,quantity,price,parent_name from ecmstockoperations where (used=0 or used is null) and type=0 and deleted='0'");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){;
|
||||
$qty=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select sum(quantity) as qty from ecmstockoperations where type=1 and in_id='".$r['id']."' and deleted='0'"));
|
||||
if($qty['qty']>=$r['quantity']){
|
||||
echo $r['product_code']." ".$r['parent_name']." ".$r['quantity']." ".$qty['qty']."\n";
|
||||
$GLOBALS['db']->query("update ecmstockoperations set used=1 where id='".$r['id']."'");
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
30
modules/EcmStockOperations/used_qty.php
Executable file
30
modules/EcmStockOperations/used_qty.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
$start=microtime();
|
||||
include("../../config.php");
|
||||
$sql=mysql_connect("localhost","e5crm.more7.com","5z#JaL");
|
||||
mysql_select_db("e5crm_more7_com");
|
||||
$q1=0;
|
||||
$pid="450";
|
||||
$w=$GLOBALS['db']->query("select quantity as qty,id,price,product_code from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL and stock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4' and product_id='".$pid."' and (used=0 or used is null)");
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$ww=$GLOBALS['db']->query("select quantity from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL and stock_id='c7afd71a-4c3a-bde4-138d-4acaee1644e4' and product_id='".$pid."' and deleted='0'");
|
||||
$rqty=0;
|
||||
while($rrp=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$rqty+=$rrp['quantity'];
|
||||
}
|
||||
$qty=$rrr['qty']-$rqty;
|
||||
if($qty>0){
|
||||
$arr[]=array("qty"=>$qty,"id"=>$rrr['id'],"price"=>$rrr['price']);
|
||||
}
|
||||
}
|
||||
|
||||
if(count($arr)>0){
|
||||
foreach($arr as $v){
|
||||
$q1+=$v['qty'];
|
||||
$pp1+=$v['qty']*$v['price'];
|
||||
}
|
||||
}
|
||||
|
||||
print $rrr['product_code']." ".$q1." ".(microtime()-$start)."\n";
|
||||
mysql_close($sql);
|
||||
?>
|
||||
243
modules/EcmStockOperations/vardefs.php
Executable file
243
modules/EcmStockOperations/vardefs.php
Executable file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$dictionary['EcmStockOperation']=array(
|
||||
'table'=>'ecmstockoperations',
|
||||
'audited'=>true,
|
||||
'comment'=>'EcmStockOperations',
|
||||
'duplicate_merge'=>true ,
|
||||
'unified_search'=>true,
|
||||
'fields'=>array(
|
||||
|
||||
'stock_name' => array(
|
||||
'name'=> 'stock_name',
|
||||
'id_name'=>'stock_id',
|
||||
'vname'=>'LBL_STOCK_NAME',
|
||||
'type'=>'relate',
|
||||
'group'=>'stock_name',
|
||||
'dbtype' => 'varchar',
|
||||
'len' => '255',
|
||||
'module' => 'EcmStocks',
|
||||
'table'=>'ecmstocks',
|
||||
'options'=>'ecmstocks_list_dom',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'stock_id' => array (
|
||||
'name' => 'stock_id',
|
||||
'type' => 'enum',
|
||||
'module' => 'EcmStocks',
|
||||
'table'=>'ecmstocks',
|
||||
'vname' => 'LBL_STOCK_NAME',
|
||||
'group'=>'stock_name',
|
||||
'required' => true,
|
||||
'options'=>'ecmstocks_list_dom',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
|
||||
/*
|
||||
'stock_id' => array (
|
||||
'name' => 'stock_id',
|
||||
'vname' => 'LBL_STOCK_NAME',
|
||||
'type' => 'enum',
|
||||
'size' => '3',
|
||||
'options' => 'ecmstocks_list_dom',
|
||||
'massupdate' => false,
|
||||
), */
|
||||
'product_code' => array(
|
||||
'name'=> 'product_code',
|
||||
'vname'=>'LBL_PRODUCT_CODE',
|
||||
'type'=>'varchar',
|
||||
'len' => '255',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'product_name' => array(
|
||||
'name'=> 'product_name',
|
||||
'id_name'=>'product_id',
|
||||
'vname'=>'LBL_PRODUCT_NAME',
|
||||
'type'=>'relate',
|
||||
'group'=>'product_name',
|
||||
'dbtype' => 'varchar',
|
||||
'len' => '255',
|
||||
'module' => 'EcmProducts',
|
||||
'table'=>'ecmproducts',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'product_id' => array (
|
||||
'name' => 'product_id',
|
||||
'type' => 'id',
|
||||
'module' => 'EcmProducts',
|
||||
'table'=>'ecmproducts',
|
||||
'vname' => 'LBL_PRODUCT_ID',
|
||||
'group'=>'product_name',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'quantity' => array (
|
||||
'name' => 'quantity',
|
||||
'vname' => 'LBL_QUANTITY',
|
||||
'type' => 'decimal',
|
||||
'len' => '15,4',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'work_price' => array (
|
||||
'name' => 'work_price',
|
||||
'vname' => 'LBL_QUANTITY',
|
||||
'type' => 'decimal',
|
||||
'len' => '15,4',
|
||||
'required' => false,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'sn' => array (
|
||||
'name' => 'sn',
|
||||
'vname' => 'LBL_SERIAL_NO',
|
||||
'type' => 'varchar',
|
||||
'len' => '50',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'date' => array (
|
||||
'name' => 'date',
|
||||
'vname' => 'LBL_DATE',
|
||||
'type' => 'datetime',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'price' => array (
|
||||
'name' => 'price',
|
||||
'vname' => 'LBL_PRICE',
|
||||
'type' => 'decimal',
|
||||
'len' => '15,2',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'parent_type'=>array(
|
||||
'name'=>'parent_type',
|
||||
'vname'=>'LBL_PARENT_TYPE',
|
||||
'type'=>'varchar',
|
||||
'group'=>'parent_name',
|
||||
'len'=>25,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
|
||||
'parent_name'=>array(
|
||||
'name'=> 'parent_name',
|
||||
'parent_type'=>'record_type_display' ,
|
||||
'type_name'=>'parent_type',
|
||||
'id_name'=>'parent_id',
|
||||
'vname'=>'LBL_PARENT_NAME',
|
||||
'type'=>'parent',
|
||||
'group'=>'parent_name',
|
||||
'options'=> 'ecmstockoperations_document_dom',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'parent_id'=>array(
|
||||
'name'=>'parent_id',
|
||||
'vname'=>'LBL_PARENT_ID',
|
||||
'type'=>'id',
|
||||
'group'=>'parent_name',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'in_id' => array (
|
||||
'name' => 'in_id',
|
||||
'type' => 'id',
|
||||
'vname' => 'LBL_IN_ID',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'documentitem_id' => array (
|
||||
'name' => 'documentitem_id',
|
||||
'type' => 'id',
|
||||
'vname' => 'LBL_DOCUMENTITEM_ID',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'part_no' => array (
|
||||
'name' => 'part_no',
|
||||
'type' => 'id',
|
||||
'vname' => 'Nr parti',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'part_date' => array (
|
||||
'name' => 'part_date',
|
||||
'type' => 'date',
|
||||
'vname' => 'Data ważności',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'type' => array (
|
||||
'name' => 'type',
|
||||
'vname' => 'LBL_TYPE',
|
||||
'type' => 'enum',
|
||||
'size' => '3',
|
||||
'options' => 'ecmstockoperations_type_dom',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
),
|
||||
'indices'=>array(
|
||||
array('name'=>'idx_ecmstockoperation_id_del','type'=>'index','fields'=>array('id','deleted')),
|
||||
array('name'=>'idx_ecmstockoperation_assigned_del','type'=>'index','fields'=>array( 'deleted', 'assigned_user_id')),
|
||||
),
|
||||
'relationships'=>array(
|
||||
'ecmstockoperations_assigned_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockOperations',
|
||||
'rhs_table'=>'ecmstockoperations',
|
||||
'rhs_key'=>'assigned_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmstockoperations_modified_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockOperations',
|
||||
'rhs_table'=>'ecmstockoperations',
|
||||
'rhs_key'=>'modified_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmstockoperations_created_by'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockOperations',
|
||||
'rhs_table'=>'ecmstockoperations',
|
||||
'rhs_key'=>'created_by',
|
||||
'relationship_type'=>'one-to-many'
|
||||
)
|
||||
),
|
||||
'optimistic_locking'=>true,
|
||||
);
|
||||
require_once('include/SugarObjects/VardefManager.php');
|
||||
VardefManager::createVardef('EcmStockOperations','EcmStockOperation', array('default','assignable'));
|
||||
?>
|
||||
251
modules/EcmStockOperations/views/view.list.php
Executable file
251
modules/EcmStockOperations/views/view.list.php
Executable file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: This file is used to override the default Meta-data EditView behavior
|
||||
* to provide customization specific to the Calls module.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/views/view.list.php');
|
||||
|
||||
class EcmStockOperationsViewList extends ViewList{
|
||||
|
||||
function EcmStockOperationsViewList(){
|
||||
parent::ViewList();
|
||||
}
|
||||
|
||||
function display(){
|
||||
if(!$this->bean->ACLAccess('list')){
|
||||
ACLController::displayNoAccess();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->module=$module = "EcmStockOperations";
|
||||
$metadataFile = null;
|
||||
$foundViewDefs = false;
|
||||
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
|
||||
$foundViewDefs = true;
|
||||
}else{
|
||||
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
|
||||
require_once('modules/'.$module.'/metadata/metafiles.php');
|
||||
if(!empty($metafiles[$module]['listviewdefs'])){
|
||||
$metadataFile = $metafiles[$module]['listviewdefs'];
|
||||
$foundViewDefs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
|
||||
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
|
||||
}
|
||||
require_once($metadataFile);
|
||||
|
||||
if(!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
|
||||
if(empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query']!='true')) {
|
||||
$this->saved_search = loadBean('SavedSearch');
|
||||
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
|
||||
$this->saved_search->populateRequest();
|
||||
}
|
||||
elseif(!empty($_REQUEST['button'])) { // click the search button, after retrieving from saved_search
|
||||
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
|
||||
unset($_REQUEST['saved_search_select']);
|
||||
unset($_REQUEST['saved_search_select_name']);
|
||||
}
|
||||
}
|
||||
|
||||
$storeQuery = new StoreQuery();
|
||||
if(!isset($_REQUEST['query'])){
|
||||
$storeQuery->loadQuery($this->module);
|
||||
$storeQuery->populateRequest();
|
||||
}else{
|
||||
$storeQuery->saveFromRequest($this->module);
|
||||
}
|
||||
|
||||
$seed = $this->bean;
|
||||
$lv = new ListViewSmarty();
|
||||
$displayColumns = array();
|
||||
if(!empty($_REQUEST['displayColumns'])) {
|
||||
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
|
||||
if(!empty($listViewDefs[$module][$col]))
|
||||
$displayColumns[$col] = $listViewDefs[$module][$col];
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach($listViewDefs[$module] as $col => $params) {
|
||||
if(!empty($params['default']) && $params['default'])
|
||||
$displayColumns[$col] = $params;
|
||||
}
|
||||
}
|
||||
$params = array('massupdate' => true, 'export'=>false);
|
||||
|
||||
$lv->quickViewLinks = false;
|
||||
$lv->export = false;
|
||||
$lv->mergeduplicates = false;
|
||||
|
||||
if(!empty($_REQUEST['orderBy'])) {
|
||||
$params['orderBy'] = $_REQUEST['orderBy'];
|
||||
$params['overrideOrder'] = true;
|
||||
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
|
||||
}
|
||||
|
||||
$lv->displayColumns = $displayColumns;
|
||||
|
||||
$this->seed = $seed;
|
||||
$this->module = $module;
|
||||
|
||||
$searchForm = null;
|
||||
|
||||
//search
|
||||
$view = 'basic_search';
|
||||
if(!empty($_REQUEST['search_form_view']))
|
||||
$view = $_REQUEST['search_form_view'];
|
||||
$headers = true;
|
||||
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only'])
|
||||
$headers = false;
|
||||
elseif(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
|
||||
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
|
||||
$view = 'advanced_search';
|
||||
}else {
|
||||
$view = 'basic_search';
|
||||
}
|
||||
}
|
||||
|
||||
$use_old_search = true;
|
||||
if(file_exists('modules/'.$this->module.'/SearchForm.html')){
|
||||
require_once('include/SearchForm/SearchForm.php');
|
||||
$searchForm = new SearchForm($this->module, $this->seed);
|
||||
}else{
|
||||
$use_old_search = false;
|
||||
require_once('include/SearchForm/SearchForm2.php');
|
||||
|
||||
if(!empty($metafiles[$this->module]['searchdefs']))
|
||||
require_once($metafiles[$this->module]['searchdefs']);
|
||||
elseif(file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
|
||||
if (file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
{
|
||||
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
}
|
||||
elseif (!empty($metafiles[$this->module]['searchdefs']))
|
||||
{
|
||||
require_once($metafiles[$this->module]['searchdefs']);
|
||||
}
|
||||
elseif (file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
|
||||
{
|
||||
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
|
||||
}
|
||||
|
||||
if(!empty($metafiles[$this->module]['searchfields']))
|
||||
require_once($metafiles[$this->module]['searchfields']);
|
||||
elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php'))
|
||||
require_once('modules/'.$this->module.'/metadata/SearchFields.php');
|
||||
|
||||
$searchForm = new SearchForm($this->seed, $this->module, $this->action);
|
||||
$searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', $view, $listViewDefs);
|
||||
|
||||
$searchForm->lv = $lv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(isset($this->options['show_title']) && $this->options['show_title'] && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true")) {
|
||||
$moduleName = isset($this->seed->module_dir) ? $this->seed->module_dir : $GLOBALS['mod_strings']['LBL_MODULE_NAME'];
|
||||
|
||||
echo "\n<p>\n";
|
||||
echo get_module_title($moduleName, $GLOBALS['mod_strings']['LBL_MODULE_TITLE'], true);
|
||||
echo "\n</p>\n";
|
||||
|
||||
}
|
||||
|
||||
$where = '';
|
||||
if(isset($_REQUEST['query']))
|
||||
{
|
||||
// we have a query
|
||||
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
|
||||
$searchForm->populateFromArray($storeQuery->query);
|
||||
}
|
||||
else {
|
||||
$searchForm->populateFromRequest();
|
||||
}
|
||||
$where_clauses = $searchForm->generateSearchWhere(true, $this->seed->module_dir);
|
||||
if (count($where_clauses) > 0 )$where = '('. implode(' ) AND ( ', $where_clauses) . ')';
|
||||
$GLOBALS['log']->info("List View Where Clause: $where");
|
||||
}
|
||||
if($use_old_search){
|
||||
switch($view) {
|
||||
case 'basic_search':
|
||||
$searchForm->setup();
|
||||
$searchForm->displayBasic($headers);
|
||||
break;
|
||||
case 'advanced_search':
|
||||
$searchForm->setup();
|
||||
$searchForm->displayAdvanced($headers);
|
||||
break;
|
||||
case 'saved_views':
|
||||
echo $searchForm->displaySavedViews($listViewDefs, $lv, $headers);
|
||||
break;
|
||||
}
|
||||
|
||||
}else{
|
||||
echo $searchForm->display($headers);
|
||||
}
|
||||
if(!$headers)
|
||||
return;
|
||||
|
||||
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
|
||||
// $this->processQuickSearch();
|
||||
$lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where, $params);
|
||||
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
|
||||
echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
|
||||
echo $lv->display();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user