Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View 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("&quot;", '\"', $json->encode($arr));
}
}
?>

View 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".
*/
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'),
);
?>

View File

@@ -0,0 +1,47 @@
<?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');
?>

View File

@@ -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);
}
}
?>

View 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();
?>

View File

@@ -0,0 +1,666 @@
<?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() {
$doc_name=array('EcmStockDocInsideIns'=>'PW','EcmStockDocMoves'=>'MM','EcmStockDocCorrects'=>'KS','EcmStockDocIns'=>'PZ','EcmStockDocOuts'=>'WZ','EcmStockDocInsideOuts'=>'RW','EcmInvoiceOuts'=>'FK');
global $current_language;
$db=$GLOBALS['db'];
$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,part_no,part_no2,part_no3,part_no4,part_no5,type from ecmstockoperations where id='" . $this->id . "'"));
$mod=substr($this->parent_type, 0, -1);
$nr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select counter from ecmstockoperations where id='".$this->id."'"));
$res=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("
select
sum(CASE
WHEN (type=0)
then @t :=+quantity
else @t :=-quantity
end) as tt
from ecmstockoperations where product_id='".$this->product_id."' and stock_id='".$this->stock_id."' and counter <= '".$nr['counter']."'"));
$n= new $mod();
$n->retrieve($this->parent_id);
$the_array['DOCUMENT_NAME'] = $doc_name[$this->parent_type].' '.$n->document_no;
$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['COUNTER']=$this->date_modified;
$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;
$p = new EcmProduct ();
$p->retrieve ( $this->product_id );
$the_array ['QUANTITY'] = number_format($this->quantity,$app_list_strings['ecmproducts_unit_dom_precision'] [$p->unit_id],',','');
$the_array['STATE']= number_format($res['tt'],$app_list_strings['ecmproducts_unit_dom_precision'] [$p->unit_id],',','');
$the_array['TYPE']=$this->type==1 ? '<span style="color:red;">Wyjście</span>' : '<span style="color:green;">Wejście</span>';
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) {
$id = parent::save($check_notify);
$class_name = substr($this->parent_type, 0, -1);
$obj = new $class_name;
$obj->retrieve($this->parent_id);
$queryupdate = 'UPDATE ecmstockoperations SET date_entered = "' . date("Y-m-d", strtotime($obj->register_date)) .' 00:00:03" WHERE id = "' . $this->id . '"';
$this->db->query($queryupdate);
return $id;
}
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);
}
static function saveProductReservation($product_id, $stock_id, $doc_id, $doc_type, $item_id, $quantity) {
global $current_user;
$db = $GLOBALS['db'];
//check params
if (strlen($stock_id)!='36' ||
strlen($product_id)!='36' ||
strlen($doc_id)!='36' ||
strlen($item_id)!='36' ||
$doc_id == "" ||
floatval($quantity) == 0) return false;
//save reservation
$query = "
INSERT INTO ecmreservations VALUES (
'".create_guid()."',
'$product_id',
'$stock_id',
'$doc_id',
'$doc_type',
'$item_id',
'".floatval($quantity)."',
'".$current_user->id."',
'".date("Y-m-d H:i:s")."')";
return $db->query($query);
}
static function deleteDocumentReservation($doc_id, $doc_type) {
return $GLOBALS['db']->query("DELETE FROM ecmreservations WHERE document_id='$doc_id' AND document_type='$doc_type'");
}
static function getDocumentItemReservation($doc_id, $doc_type, $item_id) {
$db = $GLOBALS['db'];
$res = $db->fetchByAssoc($db->query("SELECT quantity FROM ecmreservations WHERE document_id='$doc_id' AND document_type='$doc_type' AND document_item_id='$item_id'"));
return floatval($res['quantity']);
}
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($doc_id) {
global $db;
return $db->query("DELETE FROM ecmreservations WHERE doc_id='" . $doc_id . "'");
}
function removeTempDocumentReservations($temp_doc_id) {
global $db;
return $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 getProductReservations($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 = "",$part_id="") {
global $db;
if ($stock_id!='')
$stock = " and stock_id='" . $stock_id . "'";
else
$stock = "";
if ($part_id!='')
$part = " and part_id='" . $part_id . "'";
else
$part = "and part_id is null";
$rquery = "SELECT quantity FROM ecmstockstates WHERE product_id='" . $product_id ."'". $stock." ".$part;
//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 getAllQuantity($product_id) {
global $db;
$r = $db->fetchByAssoc($db->query("
SELECT
CASE WHEN (SELECT sum(quantity) FROM ecmreservations WHERE ecmproduct_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 ecmproduct_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;">&nbsp;</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.='&nbsp;<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;">&nbsp;</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.='&nbsp;<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;
}
}
?>

View 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));
}
}
?>

View 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 () {};
?>

View File

@@ -0,0 +1,41 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/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();
?>

View File

@@ -0,0 +1,54 @@
<?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');
?>

View File

@@ -0,0 +1,287 @@
<?php
function getDocOperations($module, $id) {
$db = $GLOBALS['db'];
$doc = $db->fetchByAssoc($db->query("SELECT * FROM ".strtolower($module)." WHERE id='$id'"));
//die("SELECT * FROM ".strtolower($module)." WHERE id='$id'");
$q="
SELECT o.product_name, o.product_code, o.quantity, o.price, i.dd_unit_id, i.dd_unit_name, o.type, i.position, o.part_no, o.in_id
FROM ecmstockoperations as o
INNER JOIN ".strtolower(substr($module,0,-1))."items as i
ON o.documentitem_id = i.id
WHERE
o.parent_type='$module' AND
o.parent_id='$id'
ORDER BY i.position";
//die($q);
$positions = $db->query($q);
$u = new User();
$u->retrieve($doc['created_by']);
$user = $u->full_name;
unset($u);
if ($module!='EcmStockDocMoves') {
$s = new EcmStock();
$s->retrieve($doc['stock_id']);
$stock = $s->name;
unset($s);
} else {
$s = new EcmStock();
$s->retrieve($doc['stock_in_id']);
$stock_in = $s->name;
unset($s);
$s = new EcmStock();
$s->retrieve($doc['stock_out_id']);
$stock_out = $s->name;
unset($s);
}
global $app_list_strings;
$title = 'Lista przychodowo/rozchodowa';
$doc['document_no'] = $app_list_strings['moduleList'][$module].' '.$doc['document_no'];
if ($module == 'EcmStockDocOuts' ||
$module == 'EcmStockDocInsideOuts')
$title = 'Lista rozchodowa';
else if ($module == 'EcmInvoiceOuts') {
$inv_t = $db->fetchByAssoc($db->query("SELECT type FROM ecminvoiceouts WHERE id='$id'"));
if ($inv_t['type']=='normal') {
$doc['document_no'] = 'FV '.$doc['document_no'];
$title = 'Lista rozchodowa';
} else if ($inv_t['type']=='correct') {
$doc['document_no'] = 'FVKOR '.$doc['document_no'];
$title = 'Lista przychodowa';
}
}
$w = "80"; // first column width
$w2 = "15"; // second column width
$content .= '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b><h1>'.$title.'</h1></b>
</td>
<td style="width: ' . $w2 . '%">
Dla dokumentu:
</td>
<td style="text-align: right">
<b>' . $doc['document_no'] . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
</b>Data wystawienia:</b>
</td>
<td style="text-align: right">
<b>' . $doc['register_date'] . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Wystawił:
</td>
<td style="text-align: right">
<b>' . $user . '</b>
</td>
</tr>';
if ($module!='EcmStockDocMoves') {
$content.='
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Magazyn:
</td>
<td style="text-align: right">
<b>' . $stock . '</b>
</td>
</tr>';
} else {
$content.='
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Z magazynu:
</td>
<td style="text-align: right">
<b>' . $stock_out . '</b>
</td>
</tr>';
$content.='
<tr>
<td style="width: ' . $w . '%">
&nbsp;
</td>
<td style="width: ' . $w2 . '%">
Na magazyn:
</td>
<td style="text-align: right">
<b>' . $stock_in . '</b>
</td>
</tr>';
}
$content.='
</table><br>
';
$content .= '<br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'product_name',
'product_code'
),
'label' => 'Nazwa<br>Indeks',
'align' => 'left'
);
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość<br>J.m.',
'align' => 'right'
);
$columns ['price'] = array (
'field' => array (
'price'
),
'label' => 'Cena',
'align' => 'right'
);
$columns ['total'] = array (
'field' => array (
'total'
),
'label' => 'Wartość',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '45';
$columns ['qty'] ['width'] = '10';
$columns ['price'] ['width'] = '20';
$columns ['total'] ['width'] = '20';
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter = 1;
$app_list_strings;
$sum_in = 0;
$sum_out = 0;
while ($pos = $db->fetchByAssoc($positions)) {
$pos['position'] +=1;
$pos['unit_name'] = $pos['dd_unit_name'];
$pos['total'] = $pos['quantity'] * $pos['price'];
if ($pos['type']=='0')
$sum_in+=$pos['total'];
else
$sum_out += $pos['total'];
$pos['total'] = format_number($pos['total'],2,2);
$pos['price'] = format_number($pos['price'],2,2);
$precision = $app_list_strings ['ecmproducts_unit_dom_precision'] [$pos ['dd_unit_id']];
$pos['quantity'] = format_number($pos['quantity'], $precision, $precision);
if ($module == 'EcmStockDocCorrects' || $module == 'EcmStockDocMoves') {
if ($pos['type'] == 0)
$pos['quantity'] = '(+) '.$pos['quantity'];
if ($pos['type'] == 1)
$pos['quantity'] = '(-) '.$pos['quantity'];
}
if ($pos['part_no'] && $pos['part_no']!="")
$pos['product_code'].='<br>'.$pos['part_no'];
if ($module == 'EcmInvoiceOuts')
if ($inv_t['type'] == 'normal') {
$in_doc = $db->fetchByAssoc($db->query("SELECT parent_name, parent_type FROM ecmstockoperations WHERE id='".$pos['in_id']."'"));
$pos['price'].='<br>Dokument wejścia: '.$app_list_strings['moduleList'][$in_doc['parent_type']].' '.$in_doc['parent_name'];
} else if ($inv_t['type'] == 'correct') {
$ecminvoiceoutitem_id = $db->fetchByAssoc($db->query("SELECT ecminvoiceoutitem_id as i FROM ecminvoiceouts WHERE id='".$pos['id']."'"));
$in_doc = $db->fetchByAssoc($db->query("SELECT parent_name, parent_type FROM ecmstockoperations WHERE id = (SELECT in_id FROM ecmstockoperations WHERE documentitem_id='".$ecminvoiceoutitem_id['i']."')"));
$pos['price'].='<br>Dokument wejścia: '.$app_list_strings['moduleList'][$in_doc['parent_type']].' '.$in_doc['parent_name'];
}
$content .= '<tr>';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if ($f == 'position') {
$counter ++;
}
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
$content .= '
</tbody></table>
';
$content .= '
<br><br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 285px; margin-left: 60%">
';
if ($sum_in <> 0 )
$content .= '
<tr>
<td style="border: 0.5 solid black; width: 50%;">
Suma operacji wejścia
</td>
<td style="border: 0.5 solid black; text-align: right;">
' . format_number ( $sum_in,2,2 ) . '
</td>
</tr>
';
if ($sum_out <> 0)
$content .= '
<tr>
<td style="border: 0.5 solid black; width: 50%;">
Suma operacji wyjścia
</td>
<td style="border: 0.5 solid black; text-align: right;">
' . format_number ( $sum_out,2,2 ) . '
</td>
</tr>
';
$content .= '
</table>
';
return $content;
}
?>

View 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;
?>

View 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']."'");
}
?>

View File

@@ -0,0 +1,6 @@
<?php
include_once("modules/EcmStockOperations/EcmStockOperation.php");
$op=new EcmStockOperation();
echo $op->removeDocumentReservations($_GET['temp_doc_id']);
return;
?>

View File

@@ -0,0 +1,5 @@
<?php
include_once("modules/EcmStockOperations/EcmStockOperation.php");
$op=new EcmStockOperation();
$op->removeReservation($_GET['temp_item_id']);
?>

View 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;
?>

View 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),
);
?>

View File

@@ -0,0 +1,3 @@
<?php
echo create_guid(); return;
?>

View 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);
?>

View File

@@ -0,0 +1,6 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/EcmStockOperations/ListView.php');
?>

View File

@@ -0,0 +1,94 @@
<?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',
);
?>

View 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',
);
?>

View 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',
);
?>

View 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'),
);
?>

View 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']}");
}
?>

View 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',
),
)
);
?>

View 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'),
),
),
);
?>

View File

@@ -0,0 +1,117 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$listViewDefs['EcmStockOperations'] = array(
'PRODUCT_ID' => array(
'width'=>'1',
'sortable'=>false,
'label'=>'&nbsp;',
'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'=>'&nbsp;',
'customCode'=>' ',
'default'=>true,
),
'DOCUMENT_NAME' => array(
'width'=>'1',
'sortable'=>false,
'label'=>'&nbsp;',
'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
),
'COUNTER' => array(
'width' => '15',
'label' => 'LBL_LIST_DATE',
'default' => true),
'PART_NO' => array(
'width' => '5',
'label' => 'Nr partii',
'align' => 'right',
'default' => true),
'PRICE' => array(
'width' => '10',
'label' => 'LBL_LIST_PRICE',
'align' => 'right',
'default' => true),
'TYPE' => array(
'width' => '5',
'label' => 'LBL_LIST_TYPE',
'default' => true),
'QUANTITY' => array(
'width' => '5',
'label' => 'LBL_LIST_QUANTITY',
'align' => 'right',
'default' => true),
'STATE' => array(
'width' => '5',
'label' => 'Stan po',
'align' => 'right',
'default' => true),
);
?>

View 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',
);
?>

View 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))),
)
);
?>

View File

@@ -0,0 +1,58 @@
<?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',
'part_no'
),
),
);
?>

View 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)),
),
),
)
);
?>

View 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',
),
);

View 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(
);
?>

View 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%',
),
),
);
?>

View File

@@ -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%',
),
),
);
?>

View File

@@ -0,0 +1,5 @@
<?php
include_once("modules/EcmStockOperations/EcmStockOperation.php");
$op=new EcmStockOperation();
$op->saveDocumentReservations($_GET['temp_id']);
?>

View 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']);
?>

View 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']);
?>

View File

@@ -0,0 +1,10 @@
<?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");
while($tmp=$db->fetchByAssoc($r)){
var_dump($tmp);
}
?>

View 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";
$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;
?>

View File

@@ -0,0 +1,10 @@
<?php
include_once 'modules/EcmStockOperations/EcmStockOperation.php';
//$t = EcmStockOperation::saveProductReservation('9666055a-6cd2-6e17-a5e2-542016cffc8b','3da5fb18-fdfe-f878-b7e5-53ce0d41c4b9','232b13cd-d955-12d5-77f8-54a132b75640','EcmSales','9db6e1e1-09de-3773-0384-54c612f5e1d4', 5);
$t = EcmStockOperation::getDocumentItemReservation('232b13cd-d955-12d5-77f8-54a132b75640','EcmSales','9db6e1e1-09de-3773-0384-54c612f5e1d4');
var_dump($t);
$t = EcmStockOperation::deleteDocumentReservation('232b13cd-d955-12d5-77f8-54a132b75640','EcmSales');
var_dump($t);
$t = EcmStockOperation::getDocumentItemReservation('232b13cd-d955-12d5-77f8-54a132b75640','EcmSales','9db6e1e1-09de-3773-0384-54c612f5e1d4');
var_dump($t);
?>

View 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']);
?>

View 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);
?>

View 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);
?>

View File

@@ -0,0 +1,259 @@
<?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,
),
// serial numbers
'part_no' => array (
'name' => 'part_no',
'vname' => 'Numer partii',
'type' => 'varchar',
'len' => '50',
'massupdate' => false
),
'part_no2' => array (
'name' => 'part_no2',
'vname' => 'LBL_PART_NO',
'type' => 'varchar',
'len' => '50',
'massupdate' => false
),
'part_no3' => array (
'name' => 'part_no3',
'vname' => 'LBL_PART_NO',
'type' => 'varchar',
'len' => '50',
'massupdate' => false
),
'part_no4' => array (
'name' => 'part_no4',
'vname' => 'LBL_PART_NO',
'type' => 'varchar',
'len' => '50',
'massupdate' => false
),
'part_no5' => array (
'name' => 'part_no5',
'vname' => 'LBL_PART_NO',
'type' => 'varchar',
'len' => '50',
'massupdate' => false
),
'counter' => array (
'name' => 'counter',
'vname' => 'counter',
'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,
),
'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'));
?>

View 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();
}
}
}
?>