Add php files
This commit is contained in:
214
modules/EcmStockStates/CreateXLS.php
Executable file
214
modules/EcmStockStates/CreateXLS.php
Executable file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
if(!$_GET['date'])$date=date("Y-m-d");
|
||||
else $date=$GLOBALS['timedate']->to_db_date($_GET['date']);
|
||||
$exp=explode("-",$date);
|
||||
$date=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+24*3600);
|
||||
if(!$date)$date=date("Y-m-d");
|
||||
include_once("modules/EcmProductReports/vtigerConnector.php");
|
||||
include_once('modules/EcmCharts/chartHelper.php');
|
||||
$vc=new vtigerConnector();
|
||||
set_include_path('include/PHPExcel/');
|
||||
|
||||
include 'PHPExcel.php';
|
||||
//include 'PHPExcel/Writer/Excel2007.php';
|
||||
include 'PHPExcel/Writer/Excel5.php';
|
||||
include 'PHPExcel/IOFactory.php';
|
||||
|
||||
$objPHPExcel = new PHPExcel();
|
||||
$objPHPExcel->getProperties()->setCreator("E5 CRM");
|
||||
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
|
||||
$objPHPExcel->getProperties()->setTitle("Office 2007 STATES");
|
||||
$objPHPExcel->getProperties()->setSubject("Office 2007 STATES");
|
||||
$objPHPExcel->getProperties()->setDescription("STATES");
|
||||
|
||||
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Simple');
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
if($date==date("Y-m-d",mktime()+24*3600))$dat=date("Y-m-d H:i:s");
|
||||
else $dat=$date." 23:59:59";
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("A1","Inventory states: ".$dat);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("A2","Index");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("B2","Name");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("C2","Category");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("D2","Quantity");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("E2","Price");
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("F2","Value");
|
||||
|
||||
$i=3;
|
||||
|
||||
//$wh[]="product_active='1'";
|
||||
foreach($_REQUEST['check'] as $ch){
|
||||
$whk[]="id='".$ch."'";
|
||||
}
|
||||
if(count($whk)>0)$wh[]="(".implode(" or ",$whk).")";
|
||||
|
||||
$wh[]="deleted='0'";
|
||||
if($_REQUEST['category_id'])$wh[]="product_category_id='".$_REQUEST['category_id']."'";
|
||||
if($_REQUEST['active']=="active")$wh[]="product_active='1'";
|
||||
if($_REQUEST['active']=="inactive")$wh[]="product_active='0'";
|
||||
|
||||
$who[]="deleted='0'";
|
||||
if($date)$who[]="date_entered<='".$date." 23:59:59'";
|
||||
if($_REQUEST['stock_id'])$who[]="stock_id='".$_REQUEST['stock_id']."'";
|
||||
|
||||
$where=implode(" and ",$wh);
|
||||
|
||||
$z="select id,name,code,product_category_name from ecmproducts where ".$where." order by code asc, name asc";
|
||||
//echo $z;
|
||||
$w=mysql_query($z);
|
||||
echo mysql_error();
|
||||
$sum_qty=0;
|
||||
$sum_price=0;
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$value=0;
|
||||
$qty=0;
|
||||
$price=0;
|
||||
if($date!=date("Y-m-d",mktime()+24*3600)){
|
||||
$arr=array();
|
||||
$pp1=0;
|
||||
$q1=0;
|
||||
$ww=$GLOBALS['db']->query("select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL and product_id='".$r['id']."' and (".implode(" and ",$who).")");
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$www=$GLOBALS['db']->query("select quantity from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL and product_id='".$r['id']."' and (".implode(" and ",$who).") and deleted='0'");
|
||||
$rqty=0;
|
||||
while($rrp=$GLOBALS['db']->fetchByAssoc($www)){
|
||||
$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'];
|
||||
}
|
||||
}
|
||||
$qty=$q1;
|
||||
$value=$pp1;
|
||||
|
||||
@$price=$value/$qty;
|
||||
}
|
||||
else{
|
||||
$whs=array();
|
||||
$whs[]="deleted='0'";
|
||||
$whs[]="product_id='".$r['id']."'";
|
||||
if($_GET['stock_id'])$whs[]="stock_id='".$_GET['stock_id']."'";
|
||||
$whes=implode(" and ",$whs);
|
||||
$wss=mysql_query("select quantity,price from ecmstockstates where ".$whes);
|
||||
while($rss=mysql_fetch_array($wss)){
|
||||
$qty+=$rss['quantity'];
|
||||
@$value+=$rss['quantity']*$rss['price'];
|
||||
|
||||
}
|
||||
@$price=$value/$qty;
|
||||
}
|
||||
$r['qty']=$qty;
|
||||
$r['price']=$price;
|
||||
$r['value']=$value;
|
||||
$arr[]=array(
|
||||
"id"=>$r['id'],
|
||||
"qty"=>$qty,
|
||||
"code"=>$r['code'],
|
||||
"name"=>$r['name'],
|
||||
"product_category_id"=>$r['product_category_id'],
|
||||
"product_category_name"=>$r['product_category_name'],
|
||||
"price"=>$price,
|
||||
"value"=>$value,
|
||||
);
|
||||
//}
|
||||
|
||||
//if(!$_REQUEST['order_by'])$_REQUEST['order_by']="code";
|
||||
//if(!$_REQUEST['sorder'])$_REQUEST['sorder']="asc";
|
||||
//$arr=multisort($arr,array(array('key'=>$_REQUEST['order_by'],'sort'=>$_REQUEST['sorder'])));
|
||||
|
||||
//if(count($arr)>0){
|
||||
//foreach($arr as $r){
|
||||
if($_REQUEST['empty']=="yes" && $qty==0)continue;
|
||||
if($_REQUEST['empty']=="no" && $qty!=0)continue;
|
||||
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("A".$i,$r['code']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("B".$i,$r['name']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("C".$i,$r['product_category_name']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("D".$i,$r['qty']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("E".$i,$r['price']);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("F".$i,$r['value']);
|
||||
|
||||
|
||||
$sum_qty+=$r['qty'];
|
||||
$sum_price+=$r['value'];
|
||||
|
||||
$i++;
|
||||
//}
|
||||
}
|
||||
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("D".$i,$sum_qty);
|
||||
@$objPHPExcel->getActiveSheet()->SetCellValue("E".$i,$sum_price/$sum_qty);
|
||||
$objPHPExcel->getActiveSheet()->SetCellValue("F".$i,$sum_price);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
|
||||
array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('argb' => 'F0F0F0')
|
||||
),
|
||||
'borders' => array(
|
||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
||||
)
|
||||
),
|
||||
"A1:F1"
|
||||
);
|
||||
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
|
||||
array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('argb' => 'F0F0F0')
|
||||
),
|
||||
'borders' => array(
|
||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
||||
)
|
||||
),
|
||||
"A2:F2"
|
||||
);
|
||||
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
|
||||
array(
|
||||
'fill' => array(
|
||||
'type' => PHPExcel_Style_Fill::FILL_SOLID,
|
||||
'color' => array('argb' => 'F0F0F0')
|
||||
),
|
||||
'borders' => array(
|
||||
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
|
||||
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
|
||||
)
|
||||
),
|
||||
"A".($i).":F".($i)
|
||||
);
|
||||
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
//$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
|
||||
chmod("cache/upload",0777);
|
||||
$microtime=str_replace(".","",str_replace(" ","",microtime()));
|
||||
$name="cache/upload/States".$microtime.".xls";
|
||||
$objWriter->save($name);
|
||||
chmod($name,0777);
|
||||
|
||||
header("Location: ".$name);
|
||||
?>
|
||||
@@ -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['MyEcmStockStatesDashlet']['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['MyEcmStockStatesDashlet']['columns'] = array('ecmstockstate_number' => array('width' => '5',
|
||||
'label' => 'LBL_NUMBER',
|
||||
'default' => true),
|
||||
'name' => array('width' => '40',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'link' => true,
|
||||
'default' => true),
|
||||
'priority' => array('width' => '10',
|
||||
'label' => 'LBL_PRIORITY',
|
||||
'default' => true),
|
||||
'status' => array('width' => '10',
|
||||
'label' => 'LBL_STATUS',
|
||||
'default' => true),
|
||||
'resolution' => array('width' => '15',
|
||||
'label' => 'LBL_RESOLUTION'),
|
||||
'release_name' => array('width' => '15',
|
||||
'label' => 'LBL_FOUND_IN_RELEASE',
|
||||
'related_fields' => array('found_in_release')),
|
||||
'type' => array('width' => '15',
|
||||
'label' => 'LBL_TYPE'),
|
||||
'fixed_in_release_name' => array('width' => '15',
|
||||
'label' => 'LBL_FIXED_IN_RELEASE'),
|
||||
'source' => array('width' => '15',
|
||||
'label' => 'LBL_SOURCE'),
|
||||
'date_entered' => array('width' => '15',
|
||||
'label' => 'LBL_DATE_ENTERED'),
|
||||
'date_modified' => array('width' => '15',
|
||||
'label' => 'LBL_DATE_MODIFIED'),
|
||||
'created_by' => array('width' => '8',
|
||||
'label' => 'LBL_CREATED'),
|
||||
'assigned_user_name' => array('width' => '8',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER'),
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,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['MyEcmStockStatesDashlet'] = array('module' => 'EcmStockStates',
|
||||
'title' => translate('LBL_LIST_MY_ECMSTOCKSTATES', 'EcmStockStates'),
|
||||
'description' => 'A customizable view into EcmStockStates',
|
||||
'icon' => 'themes/default/images/EcmStockStates.gif',
|
||||
'category' => 'Module Views');
|
||||
?>
|
||||
@@ -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/EcmStockStates/EcmStockState.php');
|
||||
|
||||
class MyEcmStockStatesDashlet extends DashletGeneric {
|
||||
function MyEcmStockStatesDashlet($id, $def = null) {
|
||||
global $current_user, $app_strings;
|
||||
require('modules/EcmStockStates/Dashlets/MyEcmStockStatesDashlet/MyEcmStockStatesDashlet.data.php');
|
||||
|
||||
parent::DashletGeneric($id, $def);
|
||||
|
||||
$this->searchFields = $dashletData['MyEcmStockStatesDashlet']['searchFields'];
|
||||
$this->columns = $dashletData['MyEcmStockStatesDashlet']['columns'];
|
||||
|
||||
if(empty($def['title'])) $this->title = translate('LBL_LIST_MY_ECMSTOCKSTATES', 'EcmStockStates');
|
||||
$this->seedBean = new EcmStockState();
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
require_once('modules/Releases/Release.php');
|
||||
$this->processDisplayOptions();
|
||||
|
||||
$seedRelease = new Release();
|
||||
|
||||
$this->currentSearchFields['fixed_in_release']['input'] = '<select multiple="true" size="3" name="fixed_in_release[]">'
|
||||
. get_select_options_with_id($seedRelease->get_releases(false, "Active"), (empty($this->filters['fixed_in_release']) ? '' : $this->filters['fixed_in_release']))
|
||||
. '</select>';
|
||||
$this->currentSearchFields['found_in_release']['input'] = '<select multiple="true" size="3" name="found_in_release[]">'
|
||||
. get_select_options_with_id($seedRelease->get_releases(false, "Active"), (empty($this->filters['found_in_release']) ? '' : $this->filters['found_in_release']))
|
||||
. '</select>';
|
||||
|
||||
$this->configureSS->assign('searchFields', $this->currentSearchFields);
|
||||
return $this->configureSS->fetch($this->configureTpl);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
36
modules/EcmStockStates/DetailView.php
Executable file
36
modules/EcmStockStates/DetailView.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
|
||||
|
||||
require_once('modules/EcmStockStates/EcmStockState.php');
|
||||
require_once('modules/EcmStockStates/Forms.php');
|
||||
require_once ('include/time.php');
|
||||
require_once('include/json_config.php');
|
||||
|
||||
$json_config = new json_config();
|
||||
|
||||
$focus = new EcmStockState();
|
||||
|
||||
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
if(file_exists('modules/EcmStockStates/views/view.detail.php')) {
|
||||
require_once('modules/EcmStockStates/views/view.detail.php');
|
||||
$detail = new EcmStockState();
|
||||
}
|
||||
else{
|
||||
require_once('include/MVC/View/views/view.detail.php');
|
||||
$detail = new ViewDetail();
|
||||
$detail->ss = new Sugar_Smarty();
|
||||
$detail->module = 'EcmStockStates';
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
$detail->bean = $focus;
|
||||
$detail->preDisplay();
|
||||
|
||||
echo $detail->display();
|
||||
?>
|
||||
322
modules/EcmStockStates/EcmStockState.php
Executable file
322
modules/EcmStockStates/EcmStockState.php
Executable file
@@ -0,0 +1,322 @@
|
||||
<?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 EcmStockState 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 $stock_name;
|
||||
var $stock_id;
|
||||
var $product_code;
|
||||
var $product_name;
|
||||
var $product_id;
|
||||
var $quantity;
|
||||
// var $part_id;
|
||||
var $module_dir = 'EcmStockStates';
|
||||
var $table_name = "ecmstockstates";
|
||||
var $object_name = "EcmStockState";
|
||||
var $new_schema = true;
|
||||
var $additional_column_fields = array (
|
||||
'assigned_user_name',
|
||||
'assigned_user_id'
|
||||
);
|
||||
function EcmStockState() {
|
||||
parent::SugarBean ();
|
||||
$this->setupCustomFields ( 'EcmStockStates' );
|
||||
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 .= "ecmstockstates.*,users.user_name as assigned_user_name";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['select'];
|
||||
$query .= " FROM ecmstockstates ";
|
||||
$query .= "LEFT JOIN users ON ecmstockstates.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 ecmstockstates.name";
|
||||
return $query;
|
||||
}
|
||||
function create_export_query($order_by, $where) {
|
||||
$custom_join = $this->custom_fields->getJOIN ();
|
||||
$query = "SELECT ";
|
||||
$query .= "ecmstockstates.*,users.user_name as assigned_user_name";
|
||||
if ($custom_join)
|
||||
$query .= $custom_join ['select'];
|
||||
$query .= " FROM ecmstockstates ";
|
||||
$query .= "LEFT JOIN users ON ecmstockstates.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 ecmstockstates.name";
|
||||
return $query;
|
||||
}
|
||||
function fill_in_additional_list_fields() {
|
||||
}
|
||||
function fill_in_additional_detail_fields() {
|
||||
parent::fill_in_additional_detail_fields ();
|
||||
}
|
||||
function UpdateStockState($stock_id, $product_id) {
|
||||
$q = 0;
|
||||
$p = 0;
|
||||
$i = 0;
|
||||
$pp = 0;
|
||||
$qq = 0;
|
||||
|
||||
$w = $GLOBALS ['db']->query ( "select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL and stock_id='" . $stock_id . "' and product_id='" . $product_id . "'" );
|
||||
while ( $rrr = $GLOBALS ['db']->fetchByAssoc ( $w ) ) {
|
||||
$rrp = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select sum(quantity) as s from ecmstockoperations where in_id='" . $rrr ['id'] . "' and type='1' and in_id IS NOT NULL and stock_id='" . $stock_id . "' and product_id='" . $product_id . "' and deleted='0'" ) );
|
||||
$rqty = $rrp ['s'];
|
||||
|
||||
$qty = $rrr ['qty'] - $rqty;
|
||||
if ($qty > 0) {
|
||||
$arr [] = array (
|
||||
"qty" => $qty,
|
||||
"id" => $rrr ['id'],
|
||||
"price" => $rrr ['price']
|
||||
);
|
||||
$GLOBALS ['db']->query ( "UPDATE ecmstockoperations SET used='0' WHERE id='" . $rrr ['id'] . "'" );
|
||||
} else if ($qty == 0) {
|
||||
// set used = 1
|
||||
$GLOBALS ['db']->query ( "UPDATE ecmstockoperations SET used='1' WHERE id='" . $rrr ['id'] . "'" );
|
||||
}
|
||||
}
|
||||
|
||||
if (count ( $arr ) > 0) {
|
||||
foreach ( $arr as $v ) {
|
||||
$q1 += $v ['qty'];
|
||||
$pp1 += $v ['qty'] * $v ['price'];
|
||||
}
|
||||
}
|
||||
$GLOBALS ['db']->query ( "delete from ecmstockstates where stock_id='" . $stock_id . "' and product_id='" . $product_id . "' and deleted='0'" );
|
||||
|
||||
require_once ("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$o = new EcmStockState ();
|
||||
$o->unformat_all_fields ();
|
||||
|
||||
require_once ("modules/EcmProducts/EcmProduct.php");
|
||||
$o->product_id = $product_id;
|
||||
$p = new EcmProduct ();
|
||||
$p->retrieve ( $product_id );
|
||||
$o->product_name = $p->name;
|
||||
$o->product_code = $p->code;
|
||||
$o->product_id = $p->id;
|
||||
|
||||
require_once ("modules/EcmStocks/EcmStock.php");
|
||||
$o->stock_id = $stock_id;
|
||||
$s = new EcmStock ();
|
||||
$s->retrieve ( $stock_id );
|
||||
$o->stock_name = $s->name;
|
||||
$o->quantity = $q1;
|
||||
if ($q1 > 0)
|
||||
$o->price = $pp1 / $q1;
|
||||
if($o->price==''){
|
||||
$o->empty=0;
|
||||
} else {
|
||||
$o->empty=1;
|
||||
}
|
||||
if ($p->id) {
|
||||
//echo 'Robie save<br>';
|
||||
$oid = $o->save ();
|
||||
}
|
||||
if ($q1 > 0)
|
||||
$GLOBALS ['db']->query ( "update ecmstockstates set price='" . ($pp1 / $q1) . "' where id='" . $oid . "'" );
|
||||
unset($o);
|
||||
// add mz
|
||||
// update ems_price
|
||||
$GLOBALS ['db']->query ( "UPDATE ecmproducts as p
|
||||
INNER JOIN (
|
||||
SELECT round(sum(quantity*price)/sum(quantity),2) as avg_price, product_id FROM ecmstockstates GROUP BY product_id
|
||||
) s ON p.id=s.product_id
|
||||
SET p.ems_price = s.avg_price
|
||||
WHERE p.id='$product_id'" );
|
||||
}
|
||||
|
||||
function opList(){
|
||||
$link='window.open("https://crm.twinpol.com/index.php?module=EcmProducts&action=infomag&product_id='.$this->product_id.'&stock_id='.$this->stock_id.'&to_pdf=1&type=0", "", "width=800,height=600,scrollbars=1")';
|
||||
$link2='window.open("https://crm.twinpol.com/index.php?module=EcmProducts&action=infomag&product_id='.$this->product_id.'&stock_id='.$this->stock_id.'&to_pdf=1&type=1", "", "width=800,height=600,scrollbars=1")';
|
||||
|
||||
$ii.="
|
||||
<img title='Struktura zapasu' alt='Struktura zapasu' src='modules/EcmSales/images/search.gif' onclick='".$link."'>
|
||||
<img title='Operacje magazynowe' alt='Operacje magazynowe' src='modules/EcmSales/images/search.gif' onclick='".$link2."'>
|
||||
";
|
||||
return $ii;
|
||||
}
|
||||
|
||||
function get_list_view_data() {
|
||||
global $current_language;
|
||||
$the_array = parent::get_list_view_data ();
|
||||
$app_list_strings = return_app_list_strings_language ( $current_language );
|
||||
$mod_strings = return_module_language ( $current_language, 'EcmStockStates' );
|
||||
|
||||
$the_array ['NAME'] = (($this->name == "") ? "<em>blank</em>" : $this->name);
|
||||
//$the_array ['QUANTITY'] = format_number($this->quntity,4);
|
||||
$p = new EcmProduct ();
|
||||
$p->retrieve ( $this->product_id );
|
||||
|
||||
global $app_list_strings;
|
||||
//$op = '<a href="index.php?module=EcmInvoiceOuts&action=createPDF&pdf_type=0&to_pdf=1&show_img=1&show_ean=0&show_ean2=0&show_recipient_code=0&record=' . $this->id . '" target="new"/><img src="modules/EcmInvoiceOuts/images/pdf.gif"/></a>';
|
||||
$the_array ['OPTIONS'] = $this->opList();
|
||||
$the_array ['PART_ID'] = $app_list_strings ['ecmproducts_unit_dom'] [$p->unit_id];
|
||||
$the_array ['QUANTITY'] = number_format($this->quantity,$app_list_strings['ecmproducts_unit_dom_precision'] [$p->unit_id],',','');
|
||||
|
||||
$the_array ['ENCODED_NAME'] = $this->name;
|
||||
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, "ecmstockstates.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, $ecmstockstate) {
|
||||
global $mod_strings, $app_list_strings;
|
||||
// $xtpl->assign ( "ECMSTOCKSTATE_SUBJECT", $ecmstockstate->name );
|
||||
return $xtpl;
|
||||
}
|
||||
function bean_implements($interface) {
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function save($check_notify = FALSE) {
|
||||
return parent::save ( $check_notify );
|
||||
}
|
||||
function getParts($stock_id, $product_id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$q = "SELECT parent_name,parent_id,quantity,price,part_no,part_no2,part_no3,part_no4,part_no5,id from ecmstockoperations where product_id = '" . $product_id . "' and stock_id = '" . $stock_id . "' and deleted = '0' and used = '0' AND
|
||||
(part_no IS NOT NULL
|
||||
OR part_no2 IS NOT NULL
|
||||
OR part_no3 IS NOT NULL
|
||||
OR part_no4 IS NOT NULL
|
||||
OR part_no5 IS NOT NULL
|
||||
);";
|
||||
|
||||
$res = $db->query ( $q );
|
||||
if ($res->num_rows == 0)
|
||||
return 0;
|
||||
|
||||
$parts = array ();
|
||||
// first element - no parts
|
||||
$tmp ['part_id'] = null;
|
||||
// get product quantity
|
||||
$ss = new EcmStockOperation ();
|
||||
$tmp ['part_quantity'] = $ss->getStock ( $product_id, $stock_id );
|
||||
unset ( $ss );
|
||||
$tmp ['part_name'] = '-';
|
||||
$parts [] = $tmp;
|
||||
while ( $row = $db->fetchByAssoc ( $res ) ) {
|
||||
$tmp = array ();
|
||||
$tmp ['part_id'] = $row ['id'];
|
||||
$tmp ['part_name'] = $row ['part_no'] . ' - ' . $row ['part_no2'] . ' - ' . $row ['part_no3'] . ' - ' . $row ['part_no4'] . ' - ' . $row ['part_no5'];
|
||||
// is this part used?
|
||||
$r = $db->fetchByAssoc ( $db->query ( "SELECT sum(quantity) as qty FROM ecmstockoperations WHERE in_id='" . $row ['id'] . "'" ) );
|
||||
if ($r && $r ['quantity'] > 0)
|
||||
$tmp ['part_quantity'] = $row ['quantity'] - $r ['qty'];
|
||||
else
|
||||
$tmp ['part_quantity'] = $row ['quantity'];
|
||||
$parts [] = $tmp;
|
||||
}
|
||||
|
||||
return json_encode ( $parts );
|
||||
}
|
||||
}
|
||||
?>
|
||||
73
modules/EcmStockStates/EcmStockStatesQuickCreate.php
Executable file
73
modules/EcmStockStates/EcmStockStatesQuickCreate.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/EditView/QuickCreate.php');
|
||||
require_once('modules/EcmStockStates/EcmStockState.php');
|
||||
require_once('include/javascript/javascript.php');
|
||||
|
||||
class EcmStockStatesQuickCreate extends QuickCreate {
|
||||
|
||||
var $javascript;
|
||||
|
||||
function process() {
|
||||
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, 'EcmStockStates');
|
||||
|
||||
parent::process();
|
||||
|
||||
$this->ss->assign("PRIORITY_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockstate_priority_dom'], $app_list_strings['ecmstockstate_priority_default_key']));
|
||||
$this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockstate_status_dom'], $app_list_strings['ecmstockstate_status_default_key']));
|
||||
$this->ss->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['ecmstockstate_type_dom'],$app_list_strings['ecmstockstate_type_default_key']));
|
||||
|
||||
if($this->viaAJAX) { // override for ajax call
|
||||
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmstockstatesQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmstockstates\"); else return false;'");
|
||||
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmstockstates\")';");
|
||||
}
|
||||
|
||||
$this->ss->assign('viaAJAX', $this->viaAJAX);
|
||||
|
||||
$this->javascript = new javascript();
|
||||
$this->javascript->setFormName('ecmstockstatesQuickCreate');
|
||||
|
||||
$focus = new EcmStockState();
|
||||
$this->javascript->setSugarBean($focus);
|
||||
$this->javascript->addAllFields('');
|
||||
|
||||
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
|
||||
}
|
||||
}
|
||||
?>
|
||||
38
modules/EcmStockStates/Forms.php
Executable file
38
modules/EcmStockStates/Forms.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?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');
|
||||
?>
|
||||
264
modules/EcmStockStates/ListStates.php
Executable file
264
modules/EcmStockStates/ListStates.php
Executable file
@@ -0,0 +1,264 @@
|
||||
<?
|
||||
if(!$_GET['date'])$date=date("Y-m-d");
|
||||
else $date=$GLOBALS['timedate']->to_db_date($_GET['date']);
|
||||
$exp=explode("-",$date);
|
||||
$date=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+24*3600);
|
||||
if(!$date)$date=date("Y-m-d");
|
||||
include_once("modules/EcmProductReports/vtigerConnector.php");
|
||||
include_once('modules/EcmCharts/chartHelper.php');
|
||||
$vc=new vtigerConnector();
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="0" border="0"><tr><td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"></td><td><h2>Inventory States:</h2></td></tr></table><br />
|
||||
<ul class="tablist" style="width:100%;">
|
||||
<li>
|
||||
<a class="current" href="#">Basic Search</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="index.php" method="get">
|
||||
<input type="hidden" name="module" value="EcmStockStates" />
|
||||
<input type="hidden" name="action" value="ListStates" />
|
||||
<input type="hidden" name="order_by" value="<?php echo $_REQUEST['order_by'];?>" />
|
||||
<input type="hidden" name="sorder" value="<?php echo $_REQUEST['sorder'];?>" />
|
||||
<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="10%" nowrap="nowrap">
|
||||
Inventory</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<select name="stock_id">
|
||||
<option value="">select</option>
|
||||
<?php
|
||||
$w=$GLOBALS['db']->query("select id,name from ecmstocks where deleted='0' order by name asc");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
echo '<option value="'.$r['id'].'"';
|
||||
if($r['id']==$_GET['stock_id'])echo ' selected';
|
||||
echo '>'.$r['name'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select> </td>
|
||||
<td class="dataLabel" width="10%" nowrap="nowrap">
|
||||
Category</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<select name="category_id">
|
||||
<option value="">select</option>
|
||||
<?php
|
||||
$w=$GLOBALS['db']->query("select id,name from ecmproductcategories where deleted='0' order by name asc");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
echo '<option value="'.$r['id'].'"';
|
||||
if($r['id']==$_GET['category_id'])echo ' selected';
|
||||
echo '>'.$r['name'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select> </td>
|
||||
<td class="dataLabel" width="10%" nowrap="nowrap">
|
||||
Date</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<input autocomplete="off" name="date" id="date" value="<? echo $GLOBALS['timedate']->to_display_date($date);?>" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_trigger" align="absmiddle" border="0">
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date",
|
||||
daFormat : "<? echo str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));?>",
|
||||
button : "date_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
}
|
||||
);
|
||||
</script> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dataLabel" width="10%" nowrap="nowrap">
|
||||
Active</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<select name="active">
|
||||
<option value="">All</option>
|
||||
<option value="active" <?php if($_REQUEST['active']=="active")echo "selected";?>>Yes</option>
|
||||
<option value="inactive" <?php if($_REQUEST['active']=="inactive")echo "selected";?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="dataLabel" width="10%" nowrap="nowrap">
|
||||
Not empty states only</td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap">
|
||||
<select name="empty">
|
||||
<option value="">All</option>
|
||||
<option value="yes" <?php if($_REQUEST['empty']=="yes")echo "selected";?>>Yes</option>
|
||||
<option value="no" <?php if($_REQUEST['empty']=="no")echo "selected";?>>No</option>
|
||||
</select> </td>
|
||||
<td class="dataLabel" width="10%" nowrap="nowrap"> </td>
|
||||
<td class="dataField" width="30%" nowrap="nowrap"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input class="button" name="submit" value="Search" type="submit" onclick="this.form.action.value='ListStates';">
|
||||
<input class="button" name="clear" value="Clear" type="button" onclick="location.href='index.php?module=EcmStockStates&action=ListStates';">
|
||||
<input type="submit" class="button" name="CreateXLS" value="Create XLS" onclick="this.form.action.value='CreateXLS';">
|
||||
<br />
|
||||
<?php
|
||||
|
||||
$tds1='<td class="listViewThS1">';
|
||||
|
||||
$trs='<tr>';
|
||||
$tre='</tr>';
|
||||
|
||||
$tds='<td class="oddListRowS1">';
|
||||
$tde='</td>';
|
||||
|
||||
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
|
||||
$tbe='</table>';
|
||||
|
||||
$t.=$tbs;
|
||||
$t.=$trs;
|
||||
$t.=$tds1;
|
||||
$t.=" ";
|
||||
$t.=$tde;
|
||||
$t.=$vc->sortableColumn("Index","code",$_GET['sorder'],15,"index");
|
||||
$t.=$vc->sortableColumn("Name","name",$_GET['sorder'],30,"index");
|
||||
$t.=$vc->sortableColumn("Category","product_category_name",$_GET['sorder'],20,"index");
|
||||
$t.=$vc->sortableColumn("Quantity","qty",$_GET['sorder'],10,"index");
|
||||
$t.=$vc->sortableColumn("Price","price",$_GET['sorder'],15,"index");
|
||||
$t.=$vc->sortableColumn("Value","value",$_GET['sorder'],15,"index");
|
||||
$t.=$tre;
|
||||
$i=1;
|
||||
|
||||
$wh[]="deleted='0'";
|
||||
if($_GET['category_id'])$wh[]="product_category_id='".$_GET['category_id']."'";
|
||||
if($_GET['active']=="active")$wh[]="product_active='1'";
|
||||
if($_GET['active']=="inactive")$wh[]="product_active='0'";
|
||||
|
||||
$who[]="deleted='0'";
|
||||
if($date)$who[]="date_entered<='".$date." 23:59:59'";
|
||||
if($_GET['stock_id'])$who[]="stock_id='".$_GET['stock_id']."'";
|
||||
|
||||
$where=implode(" and ",$wh);
|
||||
$z="select id,name,code,product_category_name,product_category_id from ecmproducts where ".$where." order by code asc, name asc";
|
||||
$w=$GLOBALS['db']->query($z);
|
||||
echo mysql_error();
|
||||
$sum_qty=0;
|
||||
$sum_price=0;
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$value=0;
|
||||
$qty=0;
|
||||
$price=0;
|
||||
|
||||
if($date!=date("Y-m-d",mktime()+24*3600)){
|
||||
$arr=array();
|
||||
$pp1=0;
|
||||
$q1=0;
|
||||
$ww=$GLOBALS['db']->query("select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and (in_id IS NULL or in_id='') and product_id='".$r['id']."' and (".implode(" and ",$who).")");
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($ww)){
|
||||
$www=$GLOBALS['db']->query("select quantity from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL and in_id!='' and product_id='".$r['id']."' and (".implode(" and ",$who).") and deleted='0'");
|
||||
$rqty=0;
|
||||
while($rrp=$GLOBALS['db']->fetchByAssoc($www)){
|
||||
$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'];
|
||||
}
|
||||
}
|
||||
$qty=$q1;
|
||||
$value=$pp1;
|
||||
|
||||
@$price=$value/$qty;
|
||||
}
|
||||
else{
|
||||
$whs=array();
|
||||
$whs[]="deleted='0'";
|
||||
$whs[]="product_id='".$r['id']."'";
|
||||
if($_GET['stock_id'])$whs[]="stock_id='".$_GET['stock_id']."'";
|
||||
$whes=implode(" and ",$whs);
|
||||
$wss=mysql_query("select quantity,price from ecmstockstates where ".$whes);
|
||||
while($rss=mysql_fetch_array($wss)){
|
||||
$qty+=$rss['quantity'];
|
||||
@$value+=$rss['quantity']*$rss['price'];
|
||||
}
|
||||
@$price=$value/$qty;
|
||||
}
|
||||
$arr1[]=array(
|
||||
"id"=>$r['id'],
|
||||
"qty"=>round($qty),
|
||||
"code"=>$r['code'],
|
||||
"name"=>$r['name'],
|
||||
"product_category_id"=>$r['product_category_id'],
|
||||
"product_category_name"=>$r['product_category_name'],
|
||||
"price"=>$price,
|
||||
"value"=>$value,
|
||||
);
|
||||
}
|
||||
if(!$_GET['order_by'])$_GET['order_by']="code";
|
||||
if(!$_GET['sorder'])$_GET['sorder']="asc";
|
||||
$arr1=multisort($arr1,array(array('key'=>$_GET['order_by'],'sort'=>$_GET['sorder'])));
|
||||
|
||||
if(count($arr1)>0){
|
||||
foreach($arr1 as $r){
|
||||
if($_REQUEST['empty']=="yes" && ($r['qty']==0 || $r['qty']==""))continue;
|
||||
if($_REQUEST['empty']=="no" && $r['qty']!=0 && $r['qty']!="")continue;
|
||||
$t.=$trs;
|
||||
$t.=$tds;
|
||||
$t.='<input type="checkbox" value="'.$r['id'].'" name="check[]">';
|
||||
$t.=$tde;
|
||||
$t.=$tds;
|
||||
$t.=$r['code'];
|
||||
$t.=$tde;
|
||||
$t.=$tds;
|
||||
$t.='<a href="index.php?module=EcmProducts&action=DetailView&record='.$r['id'].'">'.$r['name'].'</a>';
|
||||
$t.=$tde;
|
||||
$t.=$tds;
|
||||
$t.='<a href="index.php?module=EcmProductCategories&action=DetailView&record='.$r['product_category_id'].'">'.$r['product_category_name'].'</a>';
|
||||
$t.=$tde;
|
||||
|
||||
$t.=$tds;
|
||||
$t.=number_format($r['qty'],0,"","");
|
||||
$t.=$tde;
|
||||
$t.=$tds;
|
||||
$t.=number_format($r['price'],2,",",".");
|
||||
$t.=$tde;
|
||||
$t.=$tds;
|
||||
$t.=number_format($r['value'],2,",",".");
|
||||
$t.=$tde;
|
||||
$t.=$tre;
|
||||
|
||||
$sum_qty+=$r['qty'];
|
||||
$sum_price+=$r['value'];
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$t.=$trs;
|
||||
$t.=$tds1;
|
||||
$t.=" ";
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=" ";
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=" ";
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=" ";
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=number_format($sum_qty,0,"","");
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=@number_format($sum_price/$sum_qty,2,",",".");
|
||||
$t.=$tde;
|
||||
$t.=$tds1;
|
||||
$t.=number_format($sum_price,2,",",".");
|
||||
$t.=$tde;
|
||||
$t.=$tre;
|
||||
|
||||
$t.=$tbe;
|
||||
echo $t;
|
||||
?>
|
||||
</form>
|
||||
54
modules/EcmStockStates/Menu.php
Executable file
54
modules/EcmStockStates/Menu.php
Executable 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('EcmStockStates', 'edit', true))
|
||||
$module_menu[] =array("index.php?module=EcmStockStates&action=EditView&return_module=EcmStockStates&return_action=DetailView", $mod_strings['LNK_NEW_ECMSTOCKSTATE'],"CreateEcmStockStates", 'EcmStockStates');*/
|
||||
if(ACLController::checkAccess('EcmStockStates', 'list', true))
|
||||
$module_menu[]=array("index.php?module=EcmStockStates&action=index&return_module=EcmStockStates&return_action=DetailView", $mod_strings['LNK_ECMSTOCKSTATE_LIST'],"EcmStockStates", 'EcmStockStates');
|
||||
//if(ACLController::checkAccess('EcmStockStates', 'list', true))$module_menu[]=array("index.php?module=EcmStockStates&action=ListStates&return_module=EcmStockStates&return_action=DetailView", "Summary","EcmStockStates", 'EcmStockStates');
|
||||
if(ACLController::checkAccess('EcmStockStates','list', true)) $module_menu[]=array('#', '<span style="display: none">wp_shortcut_fill_0</span>', '');
|
||||
|
||||
?>
|
||||
22
modules/EcmStockStates/UpdateStateTest.php
Executable file
22
modules/EcmStockStates/UpdateStateTest.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockStates/EcmStockState.php");
|
||||
$op=new EcmStockState();
|
||||
/*
|
||||
$array['partia']='mm';
|
||||
|
||||
//$array['id']='e1280579-0bf6-b6c5-81b9-52cfaf9006e5';
|
||||
//$array['save_ins']=1;
|
||||
$array['part_mm']=1;
|
||||
|
||||
$array['part_no']='y';
|
||||
$array['part_no2']='y';
|
||||
$array['part_no3']='y';
|
||||
$array['part_no4']='y';
|
||||
$array['part_no5']='y';
|
||||
//$array=0; */
|
||||
$array['partia']=2;
|
||||
$array['part_mm']=0;
|
||||
$array['in_id']='1d7dee54-523e-4fa2-7bb1-52cfea55e990';
|
||||
$op->UpdateStockState('6b7eed18-9853-ae66-a8a7-4acaef3ba98a','a1877601-019e-d38c-5e8d-52a5cd8ec638',$array);
|
||||
//print $op->getStock($_GET['product_id'], $_GET['stock_id'],$_GET['part_id']);
|
||||
?>
|
||||
55
modules/EcmStockStates/add_invoices_payments.php
Executable file
55
modules/EcmStockStates/add_invoices_payments.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?
|
||||
/*$w=mysql_query("select id,total,register_date,document_no,parent_id from ecminvoiceouts where register_date>'2009-12-31' and deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
echo "insert into ecmpayments_ecminvoiceouts(id,ecminvoiceout_id,date_entered,date_modified,modified_user_id,deleted,paid,total,document_no,account_id,register_date,payment_date) values('".create_guid()."','".$r['id']."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1','0','0','".$r['total']."','".$r['document_no']."','".$r['parent_id']."','".$r['register_date']."','');<br>";
|
||||
}*/
|
||||
/*$w=mysql_query("select register_date,id,ecminvoiceout_id,document_no from ecmpayments_ecminvoiceouts where document_no like '%/10' order by document_no asc");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$rr=mysql_fetch_array(mysql_query("select ecmpaymentcondition_id from ecminvoiceouts where id='".$r['ecminvoiceout_id']."'"));
|
||||
$rr=mysql_fetch_array(mysql_query("select days from ecmpaymentconditions where id='".$rr['ecmpaymentcondition_id']."'"));
|
||||
$exp=explode("-",$r['register_date']);
|
||||
$date=date("Y-m-d",mktime(0,0,0,$exp[1],$exp[2],$exp[0])+3600*24*$rr['days']);
|
||||
echo "update ecmpayments_ecminvoiceouts set document_no='".$r['document_no']."',register_date='".$date."' where id='".$r['id']."';";
|
||||
}*/
|
||||
include_once("modules/EcmStockStates/class.dbf.php");
|
||||
//include_once("modules/EcmStockStates/helper.php");
|
||||
?>
|
||||
<textarea style="width:900px;height:600px;">
|
||||
<?
|
||||
/*
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where dir is null and deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$dbf = new dbf_class('modules/EcmStockStates/klk/'.$r['dir'].'/_wn.dbf');
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
$row=$dbf->getRowAssoc($i);
|
||||
if($row['DATA_DOK']>'20091231')continue;
|
||||
if($row['ROZL']=="T")$paid=1;
|
||||
else $paid=0;
|
||||
echo "update ecmpayments_ecminvoiceouts set paid='".$paid."' where document_no='".$row['SYM_DOK']." ".$row['NR_DOK']."';";
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
$w=mysql_query("select * from contacts where created_by='1633fa7a-fd76-08dc-ef31-4b544bbb5932' and date_entered like '2010-01-25%'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
echo "insert into accounts set id='".create_guid()."',date_entered='".date("Y-m-d H:i:s")."',date_modified='".date("Y-m-d H:i:s")."',assigned_user_id='1633fa7a-fd76-08dc-ef31-4b544bbb5932',modified_user_id='1633fa7a-fd76-08dc-ef31-4b544bbb5932',created_by='1633fa7a-fd76-08dc-ef31-4b544bbb5932',name='".$r['last_name']."',phone_office='".$r['phone_work']."',billing_address_street='".$r['primary_address_street']."',billing_address_city='".$r['primary_address_city']."',billing_address_postalcode='".$r['primary_address_postalcode']."';
|
||||
";
|
||||
$ids[$r['id']]=$r['id'];
|
||||
}
|
||||
foreach($ids as $id){
|
||||
echo "update contacts set deleted='1' where id='".$id."';
|
||||
";
|
||||
}*/
|
||||
$ww=mysql_query("select id from ecminvoiceouts where register_date='2010-01-26'");
|
||||
while($rr=mysql_fetch_array($ww)){
|
||||
$total=0;
|
||||
$w=mysql_query("select p.price,p.quantity,p.ecmvat_value from ecminvoiceoutitems as p where p.ecminvoiceout_id='".$rr['id']."'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$total+=$r['quantity']*$r['price']*(1+$r['ecmvat_value']/100);
|
||||
}
|
||||
echo "update ecmpayments_ecminvoiceouts set total='".$total."' where ecminvoiceout_id='".$rr['id']."';
|
||||
";
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
43
modules/EcmStockStates/checkProduct.php
Executable file
43
modules/EcmStockStates/checkProduct.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$q = "SELECT id FROM ecmstockoperations WHERE parent_id='c7880a7a-e5aa-5907-2b68-4efdcc7fa21d' AND product_id='c95743ea-a965-425c-2850-4acdefdbb52e'";
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$res = $db->query($q);
|
||||
|
||||
$docs = array();
|
||||
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
echo $row['id'].'<br><br>';
|
||||
|
||||
$q = "SELECT parent_id, quantity, parent_type FROM ecmstockoperations WHERE in_id='".$row['id']."'";
|
||||
$ress = $db->query($q);
|
||||
while ($roww=$db->fetchByAssoc($ress)) {
|
||||
$q = "SELECT quantity, document_no, d.id as id FROM ".strtolower(substr($roww['parent_type'],0,strlen($roww['parent_type'])-1))."items as i INNER JOIN ".strtolower($roww['parent_type'])." as d ON i.".strtolower(substr($roww['parent_type'],0,strlen($roww['parent_type'])-1))."_id=d.id WHERE ".strtolower(substr($roww['parent_type'],0,strlen($roww['parent_type'])-1))."_id='".$roww['parent_id']."' AND ecmproduct_id='c95743ea-a965-425c-2850-4acdefdbb52e'";
|
||||
|
||||
$doc_res = $db->query($q);
|
||||
$doc_row = $db->fetchByAssoc($doc_res);
|
||||
|
||||
$tmp = array();
|
||||
$tmp['quantity'] = $doc_row['quantity'];
|
||||
$tmp['document_no'] = $doc_row['document_no'];
|
||||
|
||||
$docs[$doc_row['id']] = $tmp;
|
||||
}
|
||||
}
|
||||
$sum = 0;
|
||||
foreach ($docs as $id=>$v) {
|
||||
echo $v['document_no'].': '.$v['quantity'].'<br>';
|
||||
$sum+=$v['quantity'];
|
||||
|
||||
$q = "SELECT sum(quantity) as s FROM ecmstockoperations WHERE parent_id='$id' AND product_id='c95743ea-a965-425c-2850-4acdefdbb52e' AND in_id!='212419f3-aab6-7809-91dc-4fe9b3bcc980'";
|
||||
echo $q.'<br>';
|
||||
$res = $db->query($q);
|
||||
$row = $db->fetchByAssoc($res);
|
||||
echo 'Stock Operation: '.$row['s'].'<br>--------------------------------<br>';
|
||||
}
|
||||
echo '<br><br>Suma: '.$sum.'<br>';
|
||||
?>
|
||||
30
modules/EcmStockStates/check_products.php
Executable file
30
modules/EcmStockStates/check_products.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
|
||||
//$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
//while($r=mysql_fetch_array($w)){
|
||||
$dbf = new dbf_class("klk/".$r['dir']."/_stany.dbf");
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
$n=0;
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
$row = $dbf->getRowAssoc($i);
|
||||
$index=iconv("CP852","UTF-8",$row['INDEKS']);
|
||||
$nazwa=$row['NAZWA'];
|
||||
|
||||
if(mysql_num_rows(mysql_query("select name from ecmproducts where code like '".$index."' and deleted='0'"))==0){
|
||||
echo $index." ".$nazwa."\n";
|
||||
addProduct($index,$nazwa);
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
echo $n;
|
||||
//}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
120
modules/EcmStockStates/class.dbf.php
Executable file
120
modules/EcmStockStates/class.dbf.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
class dbf_class {
|
||||
|
||||
var $dbf_num_rec; //Number of records in the file
|
||||
var $dbf_num_field; //Number of columns in each row
|
||||
var $dbf_names = array(); //Information on each column ['name'],['len'],['type']
|
||||
//These are private....
|
||||
var $_raw; //The raw input file
|
||||
var $_rowsize; //Length of each row
|
||||
var $_hdrsize; //Length of the header information (offset to 1st record)
|
||||
var $_memos; //The raw memo file (if there is one).
|
||||
|
||||
function dbf_class($filename) {
|
||||
if ( !file_exists($filename)) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
$tail=substr($filename,-4);
|
||||
if (strcasecmp($tail, '.dbf')!=0) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
|
||||
//Read the File
|
||||
$handle = fopen($filename, "r");
|
||||
if (!$handle) { echo "Cannot read DBF file"; exit; }
|
||||
$filesize = filesize($filename);
|
||||
$this->_raw = fread ($handle, $filesize);
|
||||
fclose ($handle);
|
||||
//Make sure that we indeed have a dbf file...
|
||||
if(!(ord($this->_raw[0]) == 3 || ord($this->_raw[0]) == 131) && ord($this->_raw[$filesize]) != 26) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
// 3= file without DBT memo file; 131 ($83)= file with a DBT.
|
||||
$arrHeaderHex = array();
|
||||
for($i=0; $i<32; $i++){
|
||||
$arrHeaderHex[$i] = str_pad(dechex(ord($this->_raw[$i]) ), 2, "0", STR_PAD_LEFT);
|
||||
}
|
||||
//Initial information
|
||||
$line = 32;//Header Size
|
||||
//Number of records
|
||||
$this->dbf_num_rec= hexdec($arrHeaderHex[7].$arrHeaderHex[6].$arrHeaderHex[5].$arrHeaderHex[4]);
|
||||
$this->_hdrsize= hexdec($arrHeaderHex[9].$arrHeaderHex[8]);//Header Size+Field Descriptor
|
||||
//Number of fields
|
||||
$this->_rowsize = hexdec($arrHeaderHex[11].$arrHeaderHex[10]);
|
||||
$this->dbf_num_field = floor(($this->_hdrsize - $line ) / $line ) ;//Number of Fields
|
||||
|
||||
//Field properties retrieval looping
|
||||
for($j=0; $j<$this->dbf_num_field; $j++){
|
||||
$name = '';
|
||||
$beg = $j*$line+$line;
|
||||
for($k=$beg; $k<$beg+11; $k++){
|
||||
if(ord($this->_raw[$k])!=0){
|
||||
$name .= $this->_raw[$k];
|
||||
}
|
||||
}
|
||||
$this->dbf_names[$j]['name']= $name;//Name of the Field
|
||||
$this->dbf_names[$j]['len']= ord($this->_raw[$beg+16]);//Length of the field
|
||||
$this->dbf_names[$j]['type']= $this->_raw[$beg+11];
|
||||
}
|
||||
if (ord($this->_raw[0])==131) { //See if this has a memo file with it...
|
||||
//Read the File
|
||||
$tail=substr($tail,-1,1); //Get the last character...
|
||||
if ($tail=='F'){ //See if upper or lower case
|
||||
$tail='T'; //Keep the case the same
|
||||
} else {
|
||||
$tail='t';
|
||||
}
|
||||
$memoname = substr($filename,0,strlen($filename)-1).$tail;
|
||||
$handle = fopen($memoname, "r");
|
||||
if (!$handle) { echo "Cannot read DBT file"; exit; }
|
||||
$filesize = filesize($memoname);
|
||||
$this->_memos = fread ($handle, $filesize);
|
||||
fclose ($handle);
|
||||
}
|
||||
}
|
||||
|
||||
function getRow($recnum) {
|
||||
$memoeot = chr(26).chr(26);
|
||||
$rawrow = substr($this->_raw,$recnum*$this->_rowsize+$this->_hdrsize,$this->_rowsize);
|
||||
$rowrecs = array();
|
||||
$beg=1;
|
||||
if (ord($rawrow[0])==42) {
|
||||
return false; //Record is deleted...
|
||||
}
|
||||
for ($i=0; $i<$this->dbf_num_field; $i++) {
|
||||
$col=trim(substr($rawrow,$beg,$this->dbf_names[$i]['len']));
|
||||
if ($this->dbf_names[$i]['type']!='M') {
|
||||
|
||||
$rowrecs[]=$col;
|
||||
} else {
|
||||
$memobeg=$col*512; //Find start of the memo block (0=header so it works)
|
||||
$memoend=strpos($this->_memos,$memoeot,$memobeg); //Find the end of the memo
|
||||
$rowrecs[]=substr($this->_memos,$memobeg,$memoend-$memobeg);
|
||||
}
|
||||
$beg+=$this->dbf_names[$i]['len'];
|
||||
}
|
||||
return $rowrecs;
|
||||
}
|
||||
|
||||
function getRowAssoc($recnum) {
|
||||
$rawrow = substr($this->_raw,$recnum*$this->_rowsize+$this->_hdrsize,$this->_rowsize);
|
||||
$rowrecs = array();
|
||||
$beg=1;
|
||||
if (ord($rawrow[0])==42) {
|
||||
return false; //Record is deleted...
|
||||
}
|
||||
for ($i=0; $i<$this->dbf_num_field; $i++) {
|
||||
$col=trim(substr($rawrow,$beg,$this->dbf_names[$i]['len']));
|
||||
if ($this->dbf_names[$i]['type']!='M') {
|
||||
$rowrecs[$this->dbf_names[$i]['name']]=$col;
|
||||
} else {
|
||||
$memobeg=$col*512; //Find start of the memo block (0=header so it works)
|
||||
$memoend=strpos($this->_memos,$memoeot,$memobeg); //Find the end of the memo
|
||||
$rowrecs[$this->dbf_names[$i]['name']]=substr($this->_memos,$memobeg,$memoend-$memobeg);
|
||||
}
|
||||
$beg+=$this->dbf_names[$i]['len'];
|
||||
}
|
||||
return $rowrecs;
|
||||
}
|
||||
}
|
||||
?>
|
||||
12
modules/EcmStockStates/clearInvoices.php
Executable file
12
modules/EcmStockStates/clearInvoices.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?
|
||||
set_time_limit(999999);
|
||||
$w=mysql_query("select distinct ecminvoiceout_id from ecminvoiceoutitems");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
echo $r['ecminvoiceout_id'];
|
||||
if(mysql_num_rows(mysql_query("select id from ecminvoiceouts where id='".$r['ecminvoiceout_id']."'"))==0){
|
||||
mysql_query("delete from ecminvoiceoutitems where ecminvoiceout_id='".$r['ecminvoiceout_id']."'");
|
||||
echo ' ok';
|
||||
}
|
||||
echo '<br>';
|
||||
}
|
||||
?>
|
||||
76
modules/EcmStockStates/field_arrays.php
Executable file
76
modules/EcmStockStates/field_arrays.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?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['EcmStockState']=array(
|
||||
'column_fields'=>array(
|
||||
"id",
|
||||
"name",
|
||||
"date_entered",
|
||||
"date_modified",
|
||||
"modified_user_id",
|
||||
"assigned_user_id",
|
||||
"stock_name",
|
||||
"stock_id",
|
||||
"product_code",
|
||||
"product_name",
|
||||
"product_id",
|
||||
"quantity",
|
||||
"price",
|
||||
),
|
||||
'list_fields'=>array(
|
||||
"id",
|
||||
"name",
|
||||
"date_entered",
|
||||
"date_modified",
|
||||
"modified_user_id",
|
||||
"assigned_user_id",
|
||||
"stock_name",
|
||||
"stock_id",
|
||||
"product_code",
|
||||
"product_name",
|
||||
"product_id",
|
||||
"quantity",
|
||||
),
|
||||
'required_fields' => array('name'=>1),
|
||||
);
|
||||
?>
|
||||
168
modules/EcmStockStates/fk.php
Executable file
168
modules/EcmStockStates/fk.php
Executable file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
mysql_query("truncate table ecminvoiceouts");
|
||||
mysql_query("truncate table ecmsinvoiceoutitems");
|
||||
|
||||
|
||||
function addFk($row,$i,$stock_id){
|
||||
$r=mysql_fetch_array(mysql_query("select id from accounts where name like '%".$row['PLATNIK']."%' and deleted='0'"));
|
||||
$parent_id=$r['id'];
|
||||
$rd=$row['DATA'];
|
||||
$sd=$row['DATA_SPRZ'];
|
||||
$a1=explode(" ",$row['ADRES1']);
|
||||
$r=mysql_fetch_array(mysql_query("select id from ecminvoiceouts where name like 'FK ".$row['KOR_DO_FK']."' and deleted='0'"));
|
||||
$correct_id=$r['id'];
|
||||
if($correct_id)$pre="FKKOR";
|
||||
else $pre="FK";
|
||||
$id=create_guid();
|
||||
$arr=array(
|
||||
"id"=>$id,
|
||||
"name"=>$pre." ".$row['NR_FK'],
|
||||
"description"=>" ",
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"deleted"=>0,
|
||||
"number"=>($i+1),
|
||||
"document_no"=>$pre." ".$row['NR_FK'],
|
||||
"parent_type"=>"Accounts",
|
||||
"parent_name"=>ch(str_replace("'","",$row['PLATNIK'])),
|
||||
"parent_id"=>$parent_id,
|
||||
"type"=>" ",
|
||||
"ecminvoiceout_id"=>"",
|
||||
"ecminvoiceout_name"=>"",
|
||||
"status"=>"accepted",
|
||||
"register_date"=>$rd[0].$rd[1].$rd[2].$rd[3]."-".$rd[4].$rd[5]."-".$rd[6].$rd[7],
|
||||
"sell_date"=>$sd[0].$sd[1].$sd[2].$sd[3]."-".$sd[4].$sd[5]."-".$sd[6].$sd[7],
|
||||
"payment_date"=>$rd[0].$rd[1].$rd[2].$rd[3]."-".$rd[4].$rd[5]."-".$rd[6].$rd[7],
|
||||
"parent_address_street"=>ch(str_replace("'","",$row['ADRES2'])),
|
||||
"parent_address_city"=>ch($r1,$r2,$a1[1]),
|
||||
"parent_address_postalcode"=>$a1[0],
|
||||
"to_nip"=>"",
|
||||
"subtotal"=>($row['WARTOSC']-$row['PODATEK']),
|
||||
"total"=>$row['WARTOSC'],
|
||||
"discount"=>0,
|
||||
"to_vatid"=>"",
|
||||
"to_is_vat_free"=>"",
|
||||
"header_text"=>"",
|
||||
"footer_text"=>"",
|
||||
"ads_text"=>"",
|
||||
"template_id"=>"1d178dc6-0904-3fa3-f51b-4a4b4698a173",
|
||||
"template_name"=>"E5 Polska Sp. z o. o.",
|
||||
"accepted"=>"",
|
||||
"email_id"=>"",
|
||||
"ecmlanguage"=>"pl_pl",
|
||||
"ecmpaymentcondition_id"=>"",
|
||||
"ecmpaymentcondition_text"=>"",
|
||||
"wz_id"=>"",
|
||||
"parent_contact_name"=>"",
|
||||
"parent_contact_title"=>"",
|
||||
"contact_id"=>"",
|
||||
"correct_id"=>"",
|
||||
"currency_id"=>"PLN",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecminvoiceouts set ".implode(",",$in));
|
||||
return $id;
|
||||
}
|
||||
|
||||
function addProductLine($id,$i,$r){
|
||||
$vats=array(
|
||||
0=>"9b783d21-5548-6653-e1d6-49610eb3f9dd",
|
||||
22=>"9c592a4a-2de0-1fa3-e082-494aeceb122c",
|
||||
7=>"bf3a5fec-435f-af22-024a-4958b51863c8",
|
||||
);
|
||||
$rr=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$r['INDEKS']."' and deleted='0'"));
|
||||
$pid=$rr['id'];
|
||||
if($pid==""){
|
||||
$pid=addProduct($r['INDEKS'],$r['NAZWA']);
|
||||
}
|
||||
$iid=create_guid();
|
||||
|
||||
$arr=array(
|
||||
"id"=>$iid,
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"deleted"=>0,
|
||||
"ecminvoiceout_id"=>$id,
|
||||
"ecmproduct_id"=>$pid,
|
||||
"position"=>$i,
|
||||
"code"=>ch(str_replace("'","",$r['INDEKS'])),
|
||||
"name"=>ch(str_replace("'","",$r['NAZWA'])),
|
||||
"quantity"=>$r['ILOSC'],
|
||||
"price"=>$r['CENA_SPRZ'],
|
||||
"discount"=>$r['RABAT'],
|
||||
"total"=>$r['WARTOSC'],
|
||||
"dd_unit_name"=>$r['NAZWA_J_M'],
|
||||
"dd_unit_id"=>1,
|
||||
"ecmvat_id"=>$vats[$r['VAT']],
|
||||
"ecmvat_value"=>$r['VAT'],
|
||||
"ecmvat_name"=>$r['VAT']."%",
|
||||
"ecmproductcategory_id"=>"",
|
||||
"currency_id"=>"PLN",
|
||||
"currency_name"=>"PLN",
|
||||
"tax_code"=>"",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecminvoiceoutitems set ".implode(",",$in));
|
||||
if(mysql_error()){
|
||||
echo mysql_error()."\n".implode(",",$in);
|
||||
}
|
||||
return $iid;
|
||||
}
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$dbfp = new dbf_class('klk/'.$r['dir'].'/_fk_list.dbf');
|
||||
$num_recp=$dbfp->dbf_num_rec;
|
||||
//$num_recp=10000;
|
||||
$unset_arr=array("INDEKS","NAZWA","CENA_SPRZ","ILOSC","RABAT","WARTOSC","NAZWA_J_M","VAT","NR_SYSTEM");
|
||||
for($i=0;$i<$num_recp;$i++){
|
||||
echo "products ".$i."/".$num_recp."\n";
|
||||
$rowp=$dbfp->getRowAssoc($i);
|
||||
foreach($rowp as $k=>$v){
|
||||
if(!in_array($k,$unset_arr))unset($rowp[$k]);
|
||||
}
|
||||
$products[$rowp['NR_SYSTEM']][]=$rowp;
|
||||
}
|
||||
|
||||
$dbf = new dbf_class('klk/'.$r['dir'].'/_fk.dbf');
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
//$num_rec=1000;
|
||||
$unset_arr=array("NR_FK","PLATNIK","PODATEK","WARTOSC","ADRES2","ANULOWANA","NR_SYSTEM","DATA","DATA_SPRZ","KOR_DO_WZ");
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
echo "docs ".$i."/".$num_rec."\n";
|
||||
$docs[$i]=$dbf->getRowAssoc($i);
|
||||
foreach($docs[$i] as $k=>$v){
|
||||
if(!in_array($k,$unset_arr))unset($docs[$i][$k]);
|
||||
}
|
||||
}
|
||||
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
echo $i."/".$num_rec."\n";
|
||||
if($docs[$i]['ANULOWANA']!="F")continue;
|
||||
$id=addWz($docs[$i],$i,$r['id']);
|
||||
$j=1;
|
||||
foreach($products[$docs[$i]['NR_SYSTEM']] as $prod){
|
||||
addProductLine($id,$j,$prod);
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
8
modules/EcmStockStates/getParts.php
Executable file
8
modules/EcmStockStates/getParts.php
Executable file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$ss=new EcmStockState();
|
||||
if ($_GET['product_id'] && $_GET['stock_id']) {
|
||||
$account_id = $_GET['stock_id'];
|
||||
$product_id = $_GET['product_id'];
|
||||
echo $ss->getParts($account_id, $product_id);
|
||||
} else echo 0;
|
||||
?>
|
||||
5
modules/EcmStockStates/getProductQuantity.php
Executable file
5
modules/EcmStockStates/getProductQuantity.php
Executable file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
include_once("modules/EcmStockOperations/EcmStockOperation.php");
|
||||
$op=new EcmStockOperation();
|
||||
print $op->getStock($_GET['product_id'], $_GET['stock_id'],$_GET['part_id']);
|
||||
?>
|
||||
199
modules/EcmStockStates/helper.php
Executable file
199
modules/EcmStockStates/helper.php
Executable file
@@ -0,0 +1,199 @@
|
||||
<?
|
||||
function create_guid()
|
||||
{
|
||||
$microTime = microtime();
|
||||
list($a_dec, $a_sec) = explode(" ", $microTime);
|
||||
|
||||
$dec_hex = sprintf("%x", $a_dec* 1000000);
|
||||
$sec_hex = sprintf("%x", $a_sec);
|
||||
|
||||
ensure_length($dec_hex, 5);
|
||||
ensure_length($sec_hex, 6);
|
||||
|
||||
$guid = "";
|
||||
$guid .= $dec_hex;
|
||||
$guid .= create_guid_section(3);
|
||||
$guid .= '-';
|
||||
$guid .= create_guid_section(4);
|
||||
$guid .= '-';
|
||||
$guid .= create_guid_section(4);
|
||||
$guid .= '-';
|
||||
$guid .= create_guid_section(4);
|
||||
$guid .= '-';
|
||||
$guid .= $sec_hex;
|
||||
$guid .= create_guid_section(6);
|
||||
|
||||
return $guid;
|
||||
|
||||
}
|
||||
|
||||
function create_guid_section($characters)
|
||||
{
|
||||
$return = "";
|
||||
for($i=0; $i<$characters; $i++)
|
||||
{
|
||||
$return .= sprintf("%x", mt_rand(0,15));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function ensure_length(&$string, $length)
|
||||
{
|
||||
$strlen = strlen($string);
|
||||
if($strlen < $length)
|
||||
{
|
||||
$string = str_pad($string,$length,"0");
|
||||
}
|
||||
else if($strlen > $length)
|
||||
{
|
||||
$string = substr($string, 0, $length);
|
||||
}
|
||||
}
|
||||
function ch($str){
|
||||
return iconv("CP852","UTF-8",$str);
|
||||
}
|
||||
function addPzBilans($name,$stock_id){
|
||||
|
||||
$id="bilans_otwarcia".$stock_id;
|
||||
$arr=array(
|
||||
"id"=>$id,
|
||||
"name"=>"Bilans otwarcia",
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"document_no"=>$name,
|
||||
"number"=>1,
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
//"parent_name"=>"E5 Polska Sp. z o. o.",
|
||||
"parent_id"=>36,
|
||||
"status"=>"accepted",
|
||||
"register_date"=>"2009-10-06",
|
||||
"parent_address_street"=>"Wąwozowa 11",
|
||||
"parent_address_city"=>"Warszawa",
|
||||
"parent_address_postalcode"=>"02-796",
|
||||
"subtotal"=>0,
|
||||
"total"=>0,
|
||||
"discount"=>0,
|
||||
"ecmlanguage"=>"pl_pl",
|
||||
"template_id"=>"1d178dc6-0904-3fa3-f51b-4a4b4698a173",
|
||||
"template_name"=>"E5 Polska Sp. z o. o.",
|
||||
"stock_id"=>$stock_id,
|
||||
"currency_id"=>"PLN",
|
||||
"correct_id"=>"",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocins set ".implode(",",$in));
|
||||
//echo $i." [".$row['NR_PZ']."]\n";
|
||||
if(mysql_error())echo mysql_error();
|
||||
return $id;
|
||||
}
|
||||
function addProductLinePZ($id,$i,$r,$index,$name){
|
||||
$vats=array(
|
||||
0=>"9b783d21-5548-6653-e1d6-49610eb3f9dd",
|
||||
22=>"9c592a4a-2de0-1fa3-e082-494aeceb122c",
|
||||
7=>"bf3a5fec-435f-af22-024a-4958b51863c8",
|
||||
);
|
||||
$rr=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$index."' and deleted='0'"));
|
||||
$pid=$rr['id'];
|
||||
if($pid==""){
|
||||
$pid=addProduct($index,$name);
|
||||
}
|
||||
$iid=create_guid();
|
||||
$arr=array(
|
||||
"id"=>$iid,
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"deleted"=>0,
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"ecmstockdocin_id"=>$id,
|
||||
"ecmproduct_id"=>$pid,
|
||||
"position"=>$i,
|
||||
"code"=>str_replace("'",""",$index),
|
||||
"name"=>str_replace("'",""",$name),
|
||||
"quantity"=>round($r['ILOSC'],2),
|
||||
"price"=>$r['CENA_ZAK'],
|
||||
"discount"=>$r['RABAT'],
|
||||
"total"=>$r['CENA_ZAK']*$r['ILOSC'],
|
||||
"dd_unit_name"=>$r['NAZWA_J_M'],
|
||||
"dd_unit_id"=>1,
|
||||
"ecmvat_id"=>$vats[$r['VAT']],
|
||||
"ecmvat_value"=>$r['VAT'],
|
||||
"ecmvat_name"=>$r['VAT']."%",
|
||||
"currency_id"=>"PLN",
|
||||
"currency_name"=>"PLN",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocinitems set ".implode(",",$in));
|
||||
if(mysql_error())echo mysql_error()."\n";
|
||||
return $iid;
|
||||
}
|
||||
function checkCharset($testString, $targetString){
|
||||
$out=false;
|
||||
$encoding=array("ASCII","ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-7","ISO-8859-9","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","KOI8-R","KOI8-U","KOI8-RU","CP1250","CP1251","CP1252","CP1253","CP1254","CP1257","CP850","CP866","Mac Roman","Mac CentralEurope","Mac Iceland","Mac Croatian","Mac Romania","Mac Cyrillic","Mac Ukraine","Mac Greek","Mac Turkish", "Macintosh","ISO-8859-6","ISO-8859-8", "CP1255","CP1256", "CP862","Mac Hebrew","Mac Arabic","EUC-JP", "SHIFT_JIS", "CP932", "ISO-2022-JP", "ISO-2022-JP-2", "ISO-2022-JP-1","EUC-CN","HZ","GBK","GB18030","EUC-TW","BIG5","CP950","BIG5-HKSCS","ISO-2022-CN","ISO-2022-CN-EXT","EUC-KR","CP949","ISO-2022-KR","JOHAB","ARMSCII-8","Georgian-Academy","Georgian-PS","KOI8-T","TIS-620","CP874","MacThai","MuleLao-1","CP1133","VISCII","TCVN","CP1258","HP-ROMAN8","NEXTSTEP","UTF-8","UCS-2","UCS-2BE","UCS-2LE","UCS-4","UCS-4BE","UCS-4LE","UTF-16","UTF-16BE","UTF-16LE","UTF-32","UTF-32BE","UTF-32LE","UTF-7","C99","JAVA","UCS-2-INTERNAL","UCS-4-INTERNAL","CP437","CP737","CP775","CP852","CP853","CP855","CP857","CP858","CP860","CP861","CP863","CP865","CP869","CP1125","CP864","EUC-JISX0213","Shift_JISX0213","ISO-2022-JP-3","TDS565","RISCOS-LATIN1");
|
||||
foreach($encoding as $v){
|
||||
if(iconv($v, "utf-8", $testString) === $targetString){$out=$v;}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
function addProduct($code,$name){
|
||||
$id=create_guid();
|
||||
if(!$name)$name=$code;
|
||||
$arr=array(
|
||||
"id"=>$id,
|
||||
"name"=>str_replace("'",""",$name),
|
||||
"code"=>str_replace("'",""",$code),
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"assigned_user_id"=>1,
|
||||
"modified_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmproducts set ".implode(",",$in));
|
||||
return $id;
|
||||
}
|
||||
function addOperation($doc_id,$doc_name,$doc_type,$item_id,$index,$name,$qty,$price,$type,$stock_id,$stock_name){
|
||||
$rr=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$index."' and deleted='0'"));
|
||||
$pid=$rr['id'];
|
||||
if($pid==""){
|
||||
$pid=addProduct($index,$name);
|
||||
}
|
||||
$oid=create_guid();
|
||||
|
||||
$arr=array(
|
||||
"id"=>$oid,
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"deleted"=>0,
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"stock_id"=>$stock_id,
|
||||
"stock_name"=>$stock_name,
|
||||
"product_id"=>$pid,
|
||||
"product_name"=>str_replace("'",""",$name),
|
||||
"product_code"=>str_replace("'",""",$index),
|
||||
"quantity"=>abs($qty),
|
||||
"price"=>$price,
|
||||
"parent_type"=>$doc_type,
|
||||
"parent_name"=>str_replace("'",""",$doc_name),
|
||||
"parent_id"=>$doc_id,
|
||||
"documentitem_id"=>$item_id,
|
||||
"type"=>$type,
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockoperations set ".implode(",",$in));
|
||||
return $oid;
|
||||
}
|
||||
?>
|
||||
6
modules/EcmStockStates/index.php
Executable file
6
modules/EcmStockStates/index.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
require_once('modules/EcmStockStates/ListView.php');
|
||||
|
||||
?>
|
||||
101
modules/EcmStockStates/inventory_value_report.php
Executable file
101
modules/EcmStockStates/inventory_value_report.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
//get out
|
||||
$out_query = "
|
||||
select
|
||||
sum(so.quantity) as qty,
|
||||
sum(so.quantity*price) as total,
|
||||
so.stock_id,
|
||||
p.group_ks
|
||||
from
|
||||
ecmstockoperations as so
|
||||
inner join
|
||||
ecmproducts as p on p.id=so.product_id
|
||||
where
|
||||
so.type = 1
|
||||
group by
|
||||
so.stock_id, p.group_ks;
|
||||
";
|
||||
|
||||
$res_out = $db->query($out_query);
|
||||
|
||||
|
||||
$in_query = "
|
||||
select
|
||||
sum(so.quantity) as qty,
|
||||
sum(so.quantity*price) as total,
|
||||
so.stock_id,
|
||||
p.group_ks
|
||||
from
|
||||
ecmstockoperations as so
|
||||
inner join
|
||||
ecmproducts as p on p.id=so.product_id
|
||||
where
|
||||
so.type = 0
|
||||
group by
|
||||
so.stock_id, p.group_ks;
|
||||
";
|
||||
|
||||
$res = $db->query($in_query);
|
||||
|
||||
|
||||
$rd = array(); //report data
|
||||
|
||||
$total = 0;
|
||||
$total_qty = 0;
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
if (!$rd[$row['stock_id']])
|
||||
$rd[$row['stock_id']] = array();
|
||||
if (!$rd[$row['stock_id']][$row['group_ks']])
|
||||
$rd[$row['stock_id']][$row['group_ks']] = array();
|
||||
$rd[$row['stock_id']][$row['group_ks']]['qty'] = $row['qty'];
|
||||
$rd[$row['stock_id']][$row['group_ks']]['total'] = $row['total'];
|
||||
$total+=$row['total'];
|
||||
$total_qty+=$row['qty'];
|
||||
}
|
||||
|
||||
while ($row = $db->fetchByAssoc($res_out)) {
|
||||
$rd[$row['stock_id']][$row['group_ks']]['qty'] -= $row['qty'];
|
||||
$rd[$row['stock_id']][$row['group_ks']]['total'] -= $row['total'];
|
||||
$total-=$row['total'];
|
||||
$total_qty-=$row['qty'];
|
||||
}
|
||||
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" style=""><tr><td class="listViewThS1" style=text-align:center; "width:250px; height:48px;">Ilość całkowita</td><td class="listViewThS1" style=text-align:center; "width:250px; height:48px;">Wartość całkowita</td></tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.$total_qty.'</td>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($total).'</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
foreach ($rd as $stock_id=>$stock_data) {
|
||||
$s = $db->fetchByAssoc($db->query("SELECT name FROM ecmstocks WHERE id='$stock_id'"));
|
||||
echo '<br><br><h2>'.$s['name'].'</h2><br><br>';
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" style=""><tr><td class="listViewThS1" style=text-align:center; "width:250px; height:48px;">Grupa KS</td><td class="listViewThS1" style=text-align:center; "width:250px; height:48px;">Ilość</td><td class="listViewThS1" style=text-align:center; "width:250px; height:48px;">Wartość</td></tr>';
|
||||
|
||||
$stock_total = 0;
|
||||
$stock_qty = 0;
|
||||
foreach ($stock_data as $group_ks=>$value) {
|
||||
echo '<tr>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.$group_ks.'</td>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($value['qty']).'</td>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($value['total']).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$stock_total+=$value['total'];
|
||||
$stock_qty+=$value['qty'];
|
||||
}
|
||||
|
||||
//total row
|
||||
echo '<tr>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">Suma</td>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($stock_qty).'</td>';
|
||||
echo '<td class="oddListRowS1" style="text-align:center; width:250px; border-bottom: 1px solid #cccccc;">'.format_number($stock_total).'</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
?>
|
||||
94
modules/EcmStockStates/language/en_us.lang.php
Executable file
94
modules/EcmStockStates/language/en_us.lang.php
Executable 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_QUANTITY' => 'Quantity',
|
||||
'LBL_LIST_PRODUCT_CODE'=>'Index',
|
||||
'LBL_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_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
'LBL_MODULE_NAME' => 'Inventory States',
|
||||
'LBL_MODULE_TITLE' => 'Inventory States: Home',
|
||||
'LBL_MODULE_ID' => 'Inventory States',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Inventory States Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Inventory States List',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Inventory State',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_ECMSTOCKSTATE' => 'Inventory State:',
|
||||
'LBL_ECMSTOCKSTATE_SUBJECT' => 'Inventory State Subject:',
|
||||
'LBL_LIST_SUBJECT' => 'Name',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
|
||||
'LNK_NEW_ECMSTOCKSTATE' => 'Create Inventory State',
|
||||
'LNK_ECMSTOCKSTATE_LIST' => 'Inventory States',
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
|
||||
'LBL_LIST_MY_ECMSTOCKSTATES' => 'My Assigned Inventory States',
|
||||
|
||||
'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 States',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
|
||||
'LBL_LIST_VALUE' => 'Value',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
79
modules/EcmStockStates/language/ge_ge.lang.php
Executable file
79
modules/EcmStockStates/language/ge_ge.lang.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
$mod_strings = array (
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
'LBL_VALUE' => 'Value',
|
||||
'LBL_MODULE_NAME' => 'Vat',
|
||||
'LBL_MODULE_TITLE' => 'Vat: Home',
|
||||
'LBL_MODULE_ID' => 'Vat',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Vat Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Vat List',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Vat',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_ECMSTOCKSTATE' => 'Vat:',
|
||||
'LBL_ECMSTOCKSTATE_SUBJECT' => 'Vat Subject:',
|
||||
'LBL_LIST_SUBJECT' => 'Name',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
|
||||
'LNK_NEW_ECMSTOCKSTATE' => 'Create Vat',
|
||||
'LNK_ECMSTOCKSTATE_LIST' => 'Vat',
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
|
||||
'LBL_LIST_MY_ECMSTOCKSTATES' => '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',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
93
modules/EcmStockStates/language/pl_pl.lang.php
Executable file
93
modules/EcmStockStates/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?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_QUANTITY'=>'Ilosc',
|
||||
'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' => 'Stany Magazynowe',
|
||||
'LBL_MODULE_TITLE' => 'Stany Magazynowe: Strona Glówna',
|
||||
'LBL_MODULE_ID' => 'Stany Magazynowe',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
|
||||
'LBL_LIST_FORM_TITLE' => 'Lista Stanów Magazynowych',
|
||||
'LBL_NEW_FORM_TITLE' => 'Nowa Operacja Magazynowa',
|
||||
'LBL_SUBJECT' => 'Tytul:',
|
||||
'LBL_ECMSTOCKSTATE' => 'Operacja Magazynowa:',
|
||||
'LBL_ECMSTOCKSTATE_SUBJECT' => 'Tytul Stanu Magazynowego:',
|
||||
'LBL_LIST_SUBJECT' => 'Nazwa',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Ostatnio Modyfikowane',
|
||||
'LNK_NEW_ECMSTOCKSTATE' => 'Utwórz Stan Magazynowy',
|
||||
'LNK_ECMSTOCKSTATE_LIST' => 'Stany Magazynowe',
|
||||
'LBL_LIST_MY_ECMSTOCKSTATES' => 'Moje Przypisane Stany 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' => 'Stany Magazynowe',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Przypisany Uzytkownik',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Przypisane Do',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
42
modules/EcmStockStates/metadata/SearchFields.php
Executable file
42
modules/EcmStockStates/metadata/SearchFields.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?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['EcmStockStates'] =
|
||||
array (
|
||||
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true),
|
||||
'assigned_user_id'=> array('query_type'=>'default'),
|
||||
);
|
||||
?>
|
||||
64
modules/EcmStockStates/metadata/additionalDetails.php
Executable file
64
modules/EcmStockStates/metadata/additionalDetails.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*********************************************************************************/
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
function additionalDetailsEcmStockState($fields) {
|
||||
static $mod_strings;
|
||||
global $app_strings;
|
||||
if(empty($mod_strings)) {
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, 'EcmStockStates');
|
||||
}
|
||||
|
||||
$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=EcmStockStates&return_module=EcmStockStates&record={$fields['ID']}",
|
||||
'viewLink' => "index.php?action=DetailView&module=EcmStockStates&return_module=EcmStockStates&record={$fields['ID']}");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
67
modules/EcmStockStates/metadata/detailviewdefs.php
Executable file
67
modules/EcmStockStates/metadata/detailviewdefs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$viewdefs['EcmStockStates']['DetailView'] = array(
|
||||
'templateMeta'=>array(
|
||||
'form'=>array(
|
||||
'buttons'=>array(
|
||||
'EDIT',
|
||||
'DUPLICATE',
|
||||
'DELETE',
|
||||
)
|
||||
),
|
||||
'maxColumns'=>'2',
|
||||
'widths'=>array(
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field' =>'30'
|
||||
),
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field'=>'30'
|
||||
)
|
||||
),
|
||||
),
|
||||
'panels'=>array(
|
||||
array(
|
||||
'name',
|
||||
'assigned_user_name',
|
||||
),
|
||||
array(
|
||||
'value',
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
52
modules/EcmStockStates/metadata/editviewdefs.php
Executable file
52
modules/EcmStockStates/metadata/editviewdefs.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$viewdefs['EcmStockStates']['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'),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
99
modules/EcmStockStates/metadata/listviewdefs.php
Executable file
99
modules/EcmStockStates/metadata/listviewdefs.php
Executable file
@@ -0,0 +1,99 @@
|
||||
<?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['EcmStockStates'] = array(
|
||||
'PRODUCT_ID' => array(
|
||||
'width'=>'1',
|
||||
'sortable'=>false,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
),
|
||||
'PRODUCT_CODE' => array(
|
||||
'width'=>'10',
|
||||
'label'=>'LBL_LIST_PRODUCT_CODE',
|
||||
'default'=>true,
|
||||
),
|
||||
'PRODUCT_NAME' => array(
|
||||
'width' => '30',
|
||||
'label' => 'LBL_LIST_PRODUCT_NAME',
|
||||
'module'=>'EcmProducts',
|
||||
'id'=>'PRODUCT_ID',
|
||||
//'customCode'=>'<a href="index.php?module=EcmStockOperations&action=&query=true&searchFormTab=basic_search&product_id_basic={$PRODUCT_ID}&product_name_basic={$PRODUCT_NAME}&stock_id_basic={$STOCK_ID}&stock_name_basic={$STOCK_NAME}">{$PRODUCT_NAME}</a>',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'STOCK_ID' => array(
|
||||
'width'=>'1',
|
||||
'sortable'=>false,
|
||||
'label'=>' ',
|
||||
'customCode'=>' ',
|
||||
'default'=>true,
|
||||
),
|
||||
'STOCK_NAME' => array(
|
||||
'width' => '15',
|
||||
'label' => 'LBL_LIST_STOCK_NAME',
|
||||
'module'=>'EcmStocks',
|
||||
'id'=>'STOCK_ID',
|
||||
'customCode'=>'<a href="index.php?module=EcmStockStates&action=&query=true&searchFormTab=basic_search&stock_id1_basic={$STOCK_ID}&stock_name_basic={$STOCK_NAME}">{$STOCK_NAME}</a>',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'DATE_ENTERED' => array(
|
||||
'width' => '15',
|
||||
'label' => 'Data ostatniej operacji',
|
||||
'default' => true),
|
||||
'QUANTITY' => array(
|
||||
'width' => '5',
|
||||
'align'=>'right',
|
||||
'label' => 'Stan',
|
||||
'default' => true),
|
||||
'PART_ID' => array(
|
||||
'width' => '10',
|
||||
'label' => 'Jednostka miary',
|
||||
'default' => true),
|
||||
'OPTIONS' => array(
|
||||
'width' => '2',
|
||||
'label' => 'Więcej',
|
||||
'default' => true,
|
||||
'sortable' => false,
|
||||
'align' => 'center'
|
||||
)
|
||||
|
||||
);
|
||||
?>
|
||||
51
modules/EcmStockStates/metadata/metafiles.php
Executable file
51
modules/EcmStockStates/metadata/metafiles.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Jun 1, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$metafiles['EcmStockStates'] = array(
|
||||
'detailviewdefs' => 'modules/EcmStockStates/metadata/detailviewdefs.php',
|
||||
'editviewdefs' => 'modules/EcmStockStates/metadata/editviewdefs.php',
|
||||
'listviewdefs' => 'modules/EcmStockStates/metadata/listviewdefs.php',
|
||||
'searchdefs' => 'modules/EcmStockStates/metadata/searchdefs.php',
|
||||
'popupdefs' => 'modules/EcmStockStates/metadata/popupdefs.php',
|
||||
'searchfields' => 'modules/EcmStockStates/metadata/SearchFields.php',
|
||||
|
||||
);
|
||||
?>
|
||||
67
modules/EcmStockStates/metadata/popupdefs.php
Executable file
67
modules/EcmStockStates/metadata/popupdefs.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
$popupMeta = array('moduleMain' => 'EcmStockState',
|
||||
'varName' => 'ECMSTOCKSTATE',
|
||||
'orderBy' => 'ecmstockstates.name',
|
||||
'whereClauses' =>
|
||||
array('name' => 'ecmstockstates.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))),
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
76
modules/EcmStockStates/metadata/searchdefs.php
Executable file
76
modules/EcmStockStates/metadata/searchdefs.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?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['EcmStockStates'] = array(
|
||||
'templateMeta' => array(
|
||||
'maxColumns' => '3',
|
||||
'widths' => array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
'layout' => array(
|
||||
'basic_search' => array(
|
||||
'product_code',
|
||||
array(
|
||||
'name'=>'product_name',
|
||||
'displayParams' =>
|
||||
array (
|
||||
'hideButtons' => true,
|
||||
'useIdSearch' => true,
|
||||
'readOnly' => true,
|
||||
),
|
||||
),
|
||||
'stock_id',
|
||||
array(
|
||||
'name' => 'empty',
|
||||
'label' => 'Ukryj puste',
|
||||
'type' => 'bool'
|
||||
),
|
||||
),
|
||||
'advanced_search' => array(
|
||||
'product_code',
|
||||
'product_name',
|
||||
'stock_id',
|
||||
'price',
|
||||
'date_entered',
|
||||
'quantity',
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
71
modules/EcmStockStates/metadata/sidecreateviewdefs.php
Executable file
71
modules/EcmStockStates/metadata/sidecreateviewdefs.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*********************************************************************************/
|
||||
$viewdefs['EcmStockStates']['SideQuickCreate'] = array(
|
||||
'templateMeta' => array('form'=>array('buttons'=>array('SAVE'),
|
||||
'button_location'=>'bottom',
|
||||
'headerTpl'=>'include/EditView/header.tpl',
|
||||
'footerTpl'=>'include/EditView/footer.tpl',
|
||||
),
|
||||
'maxColumns' => '1',
|
||||
'panelClass'=>'none',
|
||||
|
||||
'labelsOnTop'=>true,
|
||||
'widths' => array(
|
||||
array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
),
|
||||
'panels' =>array (
|
||||
'DEFAULT' =>
|
||||
array (
|
||||
array (
|
||||
array('name'=>'name', 'displayParams'=>array('size'=>20, 'required'=>true)),
|
||||
),
|
||||
array(
|
||||
array('name'=>'value', 'displayParams'=>array('size'=>20)),
|
||||
),
|
||||
array (
|
||||
array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)),
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
65
modules/EcmStockStates/metadata/studio.php
Executable file
65
modules/EcmStockStates/metadata/studio.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$GLOBALS['studioDefs']['EcmStockStates'] = array(
|
||||
'LBL_DETAILVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockStates/DetailView.html',
|
||||
'php_file'=>'modules/EcmStockStates/DetailView.php',
|
||||
'type'=>'DetailView',
|
||||
),
|
||||
'LBL_EDITVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockStates/EditView.html',
|
||||
'php_file'=>'modules/EcmStockStates/EditView.php',
|
||||
'type'=>'EditView',
|
||||
),
|
||||
'LBL_LISTVIEW'=>array(
|
||||
'template'=>'listview',
|
||||
'meta_file'=>'modules/EcmStockStates/listviewdefs.php',
|
||||
'type'=>'ListView',
|
||||
),
|
||||
'LBL_SEARCHFORM'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmStockStates/SearchForm.html',
|
||||
'php_file'=>'modules/EcmStockStates/ListView.php',
|
||||
'type'=>'SearchForm',
|
||||
),
|
||||
|
||||
);
|
||||
42
modules/EcmStockStates/metadata/subpaneldefs.php
Executable file
42
modules/EcmStockStates/metadata/subpaneldefs.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Layout definition for EcmStockStates
|
||||
*
|
||||
* 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['EcmStockStates']['subpanel_setup'] = array(
|
||||
);
|
||||
?>
|
||||
91
modules/EcmStockStates/metadata/subpanels/default.php
Executable file
91
modules/EcmStockStates/metadata/subpanels/default.php
Executable file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for EcmStockStates
|
||||
*
|
||||
* 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' => 'EcmStockStates'),
|
||||
),
|
||||
|
||||
'where' => '',
|
||||
|
||||
|
||||
|
||||
'list_fields' => array(
|
||||
'ecmstockstate_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' => 'EcmStockStates',
|
||||
'width' => '4%',
|
||||
),
|
||||
'remove_button'=>array(
|
||||
'widget_class' => 'SubPanelRemoveButton',
|
||||
'module' => 'EcmStockStates',
|
||||
'width' => '5%',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
60
modules/EcmStockStates/op.php
Executable file
60
modules/EcmStockStates/op.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
mysql_query("truncate table ecmstockoperations");
|
||||
mysql_query("truncate table ecmstockdocins");
|
||||
mysql_query("truncate table ecmstockdocinitems");
|
||||
|
||||
$re="RE00018";
|
||||
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
addPzBilans("PZ 20091006001",$r['id']);
|
||||
|
||||
$dbf = new dbf_class("klk/".$r['dir']."/_stany.dbf");
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
|
||||
$dbfp = new dbf_class("klk/".$r['dir']."/_struk.dbf");
|
||||
$num_recp=$dbfp->dbf_num_rec;
|
||||
$products=array();
|
||||
for($j=0;$j<$num_recp;$j++){
|
||||
$rowp = $dbfp->getRowAssoc($j);
|
||||
$products[$rowp['NR_SYSTEM']][]=$rowp;
|
||||
}
|
||||
|
||||
$n=1;
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
$row = $dbf->getRowAssoc($i);
|
||||
//if($re!=$row['INDEKS'])continue;
|
||||
$scena=$row['CENA'];
|
||||
$silosc=$row['STAN'];
|
||||
$index=$row['INDEKS'];
|
||||
$rr=mysql_fetch_array(mysql_query("select name from ecmproducts where code like '".ch($index)."' and deleted='0'"));
|
||||
$name=$rr['name'];
|
||||
$cena=0;
|
||||
$ilosc=0;
|
||||
if(count($products[$row['NR_SYSTEM']])>0){
|
||||
foreach($products[$row['NR_SYSTEM']] as $prod){
|
||||
if($prod['ILOSC']>0){
|
||||
addOperation("bilans_otwarcia".$r['id'],"PZ 20091006001","EcmStockDocIn",1,ch($index),ch($name),$prod['ILOSC'],$prod['CENA_ZAK'],0,$r['id'],$r['name']);
|
||||
addProductLinePZ("bilans_otwarcia".$r['id'],$n,$prod,ch($index),ch($name));
|
||||
$n++;
|
||||
$cena+=(int)$prod['ILOSC']*$prod['CENA_ZAK'];
|
||||
$ilosc+=(int)$prod['ILOSC'];
|
||||
$sum+=$ilosc*$cena;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $i."/".$num_rec." ".$r['dir']." ".$ilosc." = ".round($silosc,0)."\n";
|
||||
}
|
||||
mysql_query("update ecmstockdocins set total='".$sum."',subtotal='".$sum."'");
|
||||
}
|
||||
//echo round(($cena/$ilosc),2)." = ".$scena."\n".$ilosc." = ".$silosc;
|
||||
mysql_close($sql);
|
||||
?>
|
||||
133
modules/EcmStockStates/pz.php
Executable file
133
modules/EcmStockStates/pz.php
Executable file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
mysql_query("truncate table ecmstockdocins");
|
||||
mysql_query("truncate table ecmstockdocinitems");
|
||||
|
||||
function addPz($row,$i,$stock_id){
|
||||
$r=mysql_fetch_array(mysql_query("select id from accounts where name like '%".$row['PLATNIK']."%' and deleted='0'"));
|
||||
$parent_id=$r['id'];
|
||||
$rd=$row['DATA'];
|
||||
$a1=explode(" ",$row['ADRES1']);
|
||||
$r=mysql_fetch_array(mysql_query("select id from ecmstockdocins where name like 'PZ ".$row['KOR_DO_WZ']."' and deleted='0'"));
|
||||
$correct_id=$r['id'];
|
||||
if($correct_id)$pre="PZKOR";
|
||||
else $pre="PZ";
|
||||
$id=create_guid();
|
||||
$arr=array(
|
||||
"id"=>$id,
|
||||
"name"=>$pre." ".$row['NR_PZ'],
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"document_no"=>"PZ ".$row['NR_PZ'],
|
||||
"number"=>($i+1),
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"parent_name"=>$row['DOSTAWCA'],
|
||||
"parent_id"=>$parent_id,
|
||||
"status"=>"accepted",
|
||||
"register_date"=>$rd[0].$rd[1].$rd[2].$rd[3]."-".$rd[4].$rd[5]."-".$rd[6].$rd[7],
|
||||
"parent_address_street"=>$row['ADRES2'],
|
||||
"parent_address_city"=>$a1[1],
|
||||
"parent_address_postalcode"=>$a1[0],
|
||||
"subtotal"=>($row['WARTOSC_ZAK']),
|
||||
"total"=>$row['WARTOSC_ZAK'],
|
||||
"discount"=>0,
|
||||
"ecmlanguage"=>"pl_pl",
|
||||
"template_id"=>"1d178dc6-0904-3fa3-f51b-4a4b4698a173",
|
||||
"template_name"=>"E5 Polska Sp. z o. o.",
|
||||
"stock_id"=>$stock_id,
|
||||
"currency_id"=>"PLN",
|
||||
"correct_id"=>$correct_id,
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocins set ".implode(",",$in));
|
||||
return $id;
|
||||
}
|
||||
|
||||
function addProductLine($id,$i,$r){
|
||||
$vats=array(
|
||||
0=>"9b783d21-5548-6653-e1d6-49610eb3f9dd",
|
||||
22=>"9c592a4a-2de0-1fa3-e082-494aeceb122c",
|
||||
7=>"bf3a5fec-435f-af22-024a-4958b51863c8",
|
||||
);
|
||||
$rr=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$r['INDEKS']."' and deleted='0'"));
|
||||
$pid=$rr['id'];
|
||||
if($pid==""){
|
||||
$pid=addProduct($r['INDEKS'],$r['NAZWA']);
|
||||
}
|
||||
$iid=create_guid();
|
||||
if(!$r['RABAT'])$rabat=0;
|
||||
else $rabat=$r['RABAT'];
|
||||
$arr=array(
|
||||
"id"=>$iid,
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"deleted"=>0,
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"ecmstockdocin_id"=>$id,
|
||||
"ecmproduct_id"=>$pid,
|
||||
"position"=>$i,
|
||||
"code"=>$r['INDEKS'],
|
||||
"name"=>str_replace("'","",$r['NAZWA']),
|
||||
"quantity"=>$r['ILOSC'],
|
||||
"price"=>$r['CENA_ZAK'],
|
||||
"discount"=>$rabat,
|
||||
"total"=>$r['WART_ZAK'],
|
||||
"dd_unit_name"=>$r['NAZWA_J_M'],
|
||||
"dd_unit_id"=>1,
|
||||
"ecmvat_id"=>$vats[$r['VAT']],
|
||||
"ecmvat_value"=>$r['VAT'],
|
||||
"ecmvat_name"=>$r['VAT']."%",
|
||||
"currency_id"=>"PLN",
|
||||
"currency_name"=>"PLN",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocinitems set ".implode(",",$in));
|
||||
if(mysql_error()){
|
||||
echo mysql_error()."\n".implode(",",$in);
|
||||
}
|
||||
return $iid;
|
||||
}
|
||||
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
|
||||
$dbf = new dbf_class('klk/'.$r['dir'].'/_pz.dbf');
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
|
||||
$dbfp = new dbf_class('klk/'.$r['dir'].'/_pz_list.dbf');
|
||||
$num_recp=$dbfp->dbf_num_rec;
|
||||
|
||||
$n=0;
|
||||
for($i=0; $i<$num_rec; $i++){
|
||||
$row = $dbf->getRowAssoc($i);
|
||||
$id=addPz($row,$i,$r['id']);
|
||||
|
||||
echo $i."/".$num_rec." ".$r['dir']." [".$row['NR_PZ']."]\n";
|
||||
|
||||
for($j=$n; $j<$num_recp; $j++){
|
||||
$rowp = $dbfp->getRowAssoc($j);
|
||||
if($row['NR_SYSTEM']==$rowp['NR_SYSTEM']){
|
||||
$lid=addProductLine($id,$j,$rowp);
|
||||
$n++;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
32
modules/EcmStockStates/rebuildState.php
Executable file
32
modules/EcmStockStates/rebuildState.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
require_once("modules/EcmStockStates/EcmStockState.php");
|
||||
$ss = new EcmStockState();
|
||||
|
||||
set_time_limit(1000000);
|
||||
|
||||
if (!isset($_GET['code'])) {
|
||||
die("A kody produktów to kto ma podać? AI?");
|
||||
}
|
||||
|
||||
$codes = explode(",", $_GET['code']);
|
||||
var_dump($codes);
|
||||
$db = $GLOBALS['db'];
|
||||
foreach ($codes as $code) {
|
||||
|
||||
if ($code == "") continue;
|
||||
$p = $db->fetchByAssoc($db->query("select id from ecmproducts where code like '%" . $code . "' and deleted='0'"));
|
||||
|
||||
echo $p['id'];
|
||||
$w = $db->query("select id from ecmstocks where deleted='0'");
|
||||
while ($r = $db->fetchByAssoc($w)) {
|
||||
|
||||
$ss->UpdateStockState($r['id'], $p['id']);
|
||||
}
|
||||
$w = $db->query("select quantity,stock_name,price,product_code from ecmstockstates where product_id='" . $p['id'] . "' and deleted='0'");
|
||||
while ($s = $db->fetchByAssoc($w)) {
|
||||
echo $s['product_code'] . " " . $s['stock_name'] . " " . $s['quantity'] . " " . $s['price'] . "<br>";
|
||||
}
|
||||
}
|
||||
20
modules/EcmStockStates/rebuildStates.php
Executable file
20
modules/EcmStockStates/rebuildStates.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?
|
||||
//return;
|
||||
|
||||
require_once("modules/EcmStockStates/EcmStockState.php");
|
||||
$ss=new EcmStockState();
|
||||
set_time_limit(1000000);
|
||||
|
||||
$sarr=array();
|
||||
$parr=array();
|
||||
$w=$GLOBALS['db']->query("select stock_id,product_id from ecmstockoperations order by date_entered");
|
||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
if(!in_array($r['stock_id'],$sarr))$sarr[]=$r['stock_id'];
|
||||
if(!in_array($r['product_id'],$parr))$parr[]=$r['product_id'];
|
||||
}
|
||||
for($i=0;$i<count($parr);$i++){
|
||||
for($j=0;$j<count($sarr);$j++){
|
||||
if($parr[$j] && $sarr[$j])$ss->UpdateStockState($sarr[$j],$parr[$i]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
13
modules/EcmStockStates/st.php
Executable file
13
modules/EcmStockStates/st.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<?
|
||||
include_once("class.dbf.php");
|
||||
|
||||
$dbf=new dbf_class("klk/_stany.dbf");
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
$row=$dbf->getRowAssoc($i);
|
||||
$w[$row['INDEKS']]++;
|
||||
}
|
||||
foreach($w as $k=>$v){
|
||||
if($v>0)echo $v." = ".$k."\n";
|
||||
}
|
||||
?>
|
||||
191
modules/EcmStockStates/stany.php
Executable file
191
modules/EcmStockStates/stany.php
Executable file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
require_once("config.php");
|
||||
$sql1=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
|
||||
class dbf_class {
|
||||
|
||||
var $dbf_num_rec; //Number of records in the file
|
||||
var $dbf_num_field; //Number of columns in each row
|
||||
var $dbf_names = array(); //Information on each column ['name'],['len'],['type']
|
||||
//These are private....
|
||||
var $_raw; //The raw input file
|
||||
var $_rowsize; //Length of each row
|
||||
var $_hdrsize; //Length of the header information (offset to 1st record)
|
||||
var $_memos; //The raw memo file (if there is one).
|
||||
|
||||
function dbf_class($filename) {
|
||||
if ( !file_exists($filename)) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
$tail=substr($filename,-4);
|
||||
if (strcasecmp($tail, '.dbf')!=0) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
|
||||
//Read the File
|
||||
$handle = fopen($filename, "r");
|
||||
if (!$handle) { echo "Cannot read DBF file"; exit; }
|
||||
$filesize = filesize($filename);
|
||||
$this->_raw = fread ($handle, $filesize);
|
||||
fclose ($handle);
|
||||
//Make sure that we indeed have a dbf file...
|
||||
if(!(ord($this->_raw[0]) == 3 || ord($this->_raw[0]) == 131) && ord($this->_raw[$filesize]) != 26) {
|
||||
echo 'Not a valid DBF file !!!'; exit;
|
||||
}
|
||||
// 3= file without DBT memo file; 131 ($83)= file with a DBT.
|
||||
$arrHeaderHex = array();
|
||||
for($i=0; $i<32; $i++){
|
||||
$arrHeaderHex[$i] = str_pad(dechex(ord($this->_raw[$i]) ), 2, "0", STR_PAD_LEFT);
|
||||
}
|
||||
//Initial information
|
||||
$line = 32;//Header Size
|
||||
//Number of records
|
||||
$this->dbf_num_rec= hexdec($arrHeaderHex[7].$arrHeaderHex[6].$arrHeaderHex[5].$arrHeaderHex[4]);
|
||||
$this->_hdrsize= hexdec($arrHeaderHex[9].$arrHeaderHex[8]);//Header Size+Field Descriptor
|
||||
//Number of fields
|
||||
$this->_rowsize = hexdec($arrHeaderHex[11].$arrHeaderHex[10]);
|
||||
$this->dbf_num_field = floor(($this->_hdrsize - $line ) / $line ) ;//Number of Fields
|
||||
|
||||
//Field properties retrieval looping
|
||||
for($j=0; $j<$this->dbf_num_field; $j++){
|
||||
$name = '';
|
||||
$beg = $j*$line+$line;
|
||||
for($k=$beg; $k<$beg+11; $k++){
|
||||
if(ord($this->_raw[$k])!=0){
|
||||
$name .= $this->_raw[$k];
|
||||
}
|
||||
}
|
||||
$this->dbf_names[$j]['name']= $name;//Name of the Field
|
||||
$this->dbf_names[$j]['len']= ord($this->_raw[$beg+16]);//Length of the field
|
||||
$this->dbf_names[$j]['type']= $this->_raw[$beg+11];
|
||||
}
|
||||
if (ord($this->_raw[0])==131) { //See if this has a memo file with it...
|
||||
//Read the File
|
||||
$tail=substr($tail,-1,1); //Get the last character...
|
||||
if ($tail=='F'){ //See if upper or lower case
|
||||
$tail='T'; //Keep the case the same
|
||||
} else {
|
||||
$tail='t';
|
||||
}
|
||||
$memoname = substr($filename,0,strlen($filename)-1).$tail;
|
||||
$handle = fopen($memoname, "r");
|
||||
if (!$handle) { echo "Cannot read DBT file"; exit; }
|
||||
$filesize = filesize($memoname);
|
||||
$this->_memos = fread ($handle, $filesize);
|
||||
fclose ($handle);
|
||||
}
|
||||
}
|
||||
|
||||
function getRow($recnum) {
|
||||
$memoeot = chr(26).chr(26);
|
||||
$rawrow = substr($this->_raw,$recnum*$this->_rowsize+$this->_hdrsize,$this->_rowsize);
|
||||
$rowrecs = array();
|
||||
$beg=1;
|
||||
if (ord($rawrow[0])==42) {
|
||||
return false; //Record is deleted...
|
||||
}
|
||||
for ($i=0; $i<$this->dbf_num_field; $i++) {
|
||||
$col=trim(substr($rawrow,$beg,$this->dbf_names[$i]['len']));
|
||||
if ($this->dbf_names[$i]['type']!='M') {
|
||||
|
||||
$rowrecs[]=$col;
|
||||
} else {
|
||||
$memobeg=$col*512; //Find start of the memo block (0=header so it works)
|
||||
$memoend=strpos($this->_memos,$memoeot,$memobeg); //Find the end of the memo
|
||||
$rowrecs[]=substr($this->_memos,$memobeg,$memoend-$memobeg);
|
||||
}
|
||||
$beg+=$this->dbf_names[$i]['len'];
|
||||
}
|
||||
return $rowrecs;
|
||||
}
|
||||
|
||||
function getRowAssoc($recnum) {
|
||||
$rawrow = substr($this->_raw,$recnum*$this->_rowsize+$this->_hdrsize,$this->_rowsize);
|
||||
$rowrecs = array();
|
||||
$beg=1;
|
||||
if (ord($rawrow[0])==42) {
|
||||
return false; //Record is deleted...
|
||||
}
|
||||
for ($i=0; $i<$this->dbf_num_field; $i++) {
|
||||
$col=trim(substr($rawrow,$beg,$this->dbf_names[$i]['len']));
|
||||
if ($this->dbf_names[$i]['type']!='M') {
|
||||
$rowrecs[$this->dbf_names[$i]['name']]=$col;
|
||||
} else {
|
||||
$memobeg=$col*512; //Find start of the memo block (0=header so it works)
|
||||
$memoend=strpos($this->_memos,$memoeot,$memobeg); //Find the end of the memo
|
||||
$rowrecs[$this->dbf_names[$i]['name']]=substr($this->_memos,$memobeg,$memoend-$memobeg);
|
||||
}
|
||||
$beg+=$this->dbf_names[$i]['len'];
|
||||
}
|
||||
return $rowrecs;
|
||||
}
|
||||
}//End of Class
|
||||
|
||||
$dbf = new dbf_class('_stany.dbf');
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
$num_field=$dbf->dbf_num_field;
|
||||
mysql_query("truncate table ecmstockstates");
|
||||
mysql_query("truncate table ecmstockoperations");
|
||||
mysql_query("truncate table ecmstockdocins");
|
||||
mysql_query("truncate table ecmstockdocinitems");
|
||||
include_once("modules/EcmProducts/EcmProduct.php");
|
||||
include_once("modules/EcmStockDocIns/EcmStockDocIn.php");
|
||||
$esdi=new EcmStockDocIn();
|
||||
$esdi->format_all_fields();
|
||||
$esdi->name="Bilans otwarcia";
|
||||
$esdi->status="accepted";
|
||||
$esdi->parent_id=36;
|
||||
$esdi->register_date="17.09.2009";
|
||||
$esdi->ecmlanguage="pl_pl";
|
||||
$esdi->currency_id="PLN";
|
||||
$esdi->assigned_user_id=1;
|
||||
$esdi->modified_user_id=1;
|
||||
$esdi->stock_id="9758747e-5a0e-8b62-04a7-48a923cb3b9a";
|
||||
$esdi->stock_name="Stock 1";
|
||||
$tw=mysql_query("select id from ecmdocumenttemplates where account_id='36'");
|
||||
while($tr=mysql_fetch_array($tw))$tid=$tr['id'];
|
||||
$esdi->template_id=$tid;
|
||||
$esdi->template_name="E5 Polska Sp. z o. o.";
|
||||
$esdi->number=$esdi->generateNumber();
|
||||
$esdi->document_no=$esdi->formatNumber();
|
||||
|
||||
$esdiid=$esdi->save();
|
||||
for($i=0; $i<$num_rec; $i++){
|
||||
$row = $dbf->getRow($i);
|
||||
|
||||
$stan=$row[8];
|
||||
$cena=$row[13];
|
||||
$zamowione=$row[17];
|
||||
$pw=mysql_query("select name,id,code,vat_id,vat_name,vat_value from ecmproducts where code like '".$row[0]."' and deleted='0'");
|
||||
$r=mysql_fetch_array($pw);
|
||||
$name=$r['name'];
|
||||
$code=$r['code'];
|
||||
$pid=$r['id'];
|
||||
echo "[".$name." ".$code." ".mysql_num_rows($pw)."]<br>";
|
||||
if(mysql_num_rows($pw)<=0){
|
||||
$prod=new EcmProduct();
|
||||
$prod->code=$row[0];
|
||||
$code=$row[0];
|
||||
$prod->name=$row[1];
|
||||
$name=$row[1];
|
||||
$pid=$prod->save();
|
||||
echo "[dodano produkt: ".$name." ".$code."]<br>";
|
||||
}
|
||||
|
||||
if($stan>0){
|
||||
if(mysql_query("insert into ecmstockdocinitems values('".create_guid()."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1','1','1','0','".$esdiid."','".$pid."','".$k."','".$code."','".$name."','".$stan."','".$cena."','0','".($cena*$stan)."','1','szt.','".$r['vat_id']."','".$r['vat_name']."','".$r['vat_value']."','1','1','PLN')"))echo "items ok<br>";
|
||||
else echo "items no<br>";
|
||||
|
||||
if(mysql_query("insert into ecmstockstates values('".create_guid()."','name','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1','1','opis','0','1','Stock 1','9758747e-5a0e-8b62-04a7-48a923cb3b9a','".$name."','".$pid."','".$stan."','".$cena."','".$row[0]."');"))echo "states ok<br>";
|
||||
else echo "states no<br>";
|
||||
|
||||
if(mysql_query("insert into ecmstockoperations values('".create_guid()."','name','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1','1','opis','0','1','9758747e-5a0e-8b62-04a7-48a923cb3b9a','".$pid."','".$stan."','".date("Y-m-d H:i:s")."','".$cena."','EcmStockDocIns','".$esdiid."',NULL,'".$esdiid."','0','Stock 1','".$name."','".$esdi->document_no."','".$code."');"))echo "ops ok<br>";
|
||||
else echo "ops no<br>";
|
||||
}
|
||||
|
||||
echo mysql_error();
|
||||
$k++;
|
||||
}
|
||||
mysql_close($sql1);
|
||||
?>
|
||||
38
modules/EcmStockStates/summary.php
Executable file
38
modules/EcmStockStates/summary.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$db=$GLOBALS['db'];
|
||||
|
||||
$query="select * from ecmstockoperations where deleted=0 and type=0";
|
||||
|
||||
$res=$db->query($query);
|
||||
$items=array();
|
||||
while($dane=$db->fetchByAssoc($res)){
|
||||
$query2="select sum(quantity) as a from ecmstockoperations where deleted=0 and type=1 and in_id='".$dane['id']."'";
|
||||
$res2=$db->query($query2);
|
||||
$d2=$db->fetchByAssoc($res2);
|
||||
|
||||
$dane['q2']=$d2['a'];
|
||||
$dane['quantity']=$dane['quantity']-$dane['q2'];
|
||||
$items[]=$dane;
|
||||
}
|
||||
|
||||
echo "<pre>";
|
||||
$text="";
|
||||
foreach ($items as $k=>$item){
|
||||
if($item['quantity']>0){
|
||||
|
||||
|
||||
$text.='"=""'.$item['product_name'].'""";';
|
||||
$text.='"=""'.$item['product_code'].'""";';
|
||||
$text.='"=""'.$item['stock_name'].'""";';
|
||||
$text.='"=""'.str_replace(".",",",number_format($item['quantity'], 2, '.', '')).'""";';
|
||||
$text.='"=""'.str_replace(".",",",number_format($item['price'], 2, '.', '')).'""";';
|
||||
$text.='"=""'.$item['part_no'].'""";';
|
||||
$text.="".PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$text=iconv('UTF-8//IGNORE','windows-1250',$text);
|
||||
|
||||
file_put_contents("stan.csv",$text );
|
||||
?>
|
||||
36
modules/EcmStockStates/summarypz.php
Executable file
36
modules/EcmStockStates/summarypz.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
mysql_connect('127.0.0.1', 'e5crm', '5z#JaL');
|
||||
mysql_query('use e5crm');
|
||||
$date = '2013-01';
|
||||
function getTotal($id){
|
||||
$r=mysql_fetch_array(mysql_query("select sum(price*quantity) as s from ecmstockdoccorrectitems where ecmstockdoccorrect_id='".$id."' and deleted='0'"));
|
||||
return $r['s'];
|
||||
}
|
||||
$z="select id,document_no,total,register_date from ecmstockdoccorrects
|
||||
where deleted='0' and status='accepted' and register_date like '".$date."%' order by register_date asc";
|
||||
|
||||
$w=mysql_query($z);
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.getTotal($r['id']).',
|
||||
';
|
||||
}
|
||||
$filename = "ks.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
$t="";
|
||||
fclose($handle);
|
||||
function getTotalPZ($id){
|
||||
$r=mysql_fetch_array(mysql_query("select sum(price*quantity) as s from ecmstockdocinitems where ecmstockdocin_id='".$id."' and deleted='0'"));
|
||||
return $r['s'];
|
||||
}
|
||||
$z="select id,document_no,total,register_date from ecmstockdocins where deleted='0' and status='accepted' and register_date like '".$date."%' order by register_date asc";
|
||||
$w=mysql_query($z);
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$t.=$r['document_no'].','.$r['register_date'].','.getTotalPZ($r['id']).',
|
||||
';
|
||||
}
|
||||
$filename = "pz.csv";
|
||||
$handle = fopen($filename, "wb");
|
||||
$numbytes = fwrite($handle,$t);
|
||||
fclose($handle);
|
||||
?>
|
||||
91
modules/EcmStockStates/testState.php
Executable file
91
modules/EcmStockStates/testState.php
Executable file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
function state1($stock_id,$product_id){
|
||||
echo date("Y-m-d H:i:s")."<br>";
|
||||
$q=0;
|
||||
$p=0;
|
||||
$i=0;
|
||||
$pp=0;
|
||||
$qq=0;
|
||||
|
||||
|
||||
$w=mysql_query("select quantity as qty,id,price from ecmstockoperations where deleted='0' and type='0' and in_id IS NULL and stock_id='".$stock_id."' and product_id='".$product_id."'");
|
||||
while($rrr=mysql_fetch_array($w)){
|
||||
$ww=mysql_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='".$product_id."' and deleted='0'");
|
||||
$rqty=0;
|
||||
while($rrp=mysql_fetch_array($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'];
|
||||
}
|
||||
}
|
||||
echo $q1." ".$pp1."<br>".date("Y-m-d H:i:s")."<br><br>";
|
||||
}
|
||||
function state2($stock_id,$product_id){
|
||||
echo date("Y-m-d H:i:s")."<br>";
|
||||
$q=0;
|
||||
$p=0;
|
||||
$i=0;
|
||||
$pp=0;
|
||||
$qq=0;
|
||||
|
||||
/*$w=$GLOBALS['db']->query("
|
||||
select
|
||||
(o.quantity-oo.quantity) as qty,
|
||||
o.id,
|
||||
o.price
|
||||
from ecmstockoperations as o
|
||||
right outer join ecmstockoperations as oo on o.id=oo.in_id
|
||||
where
|
||||
oo.type='1' and
|
||||
oo.deleted='0' and
|
||||
o.deleted='0' and
|
||||
o.type='0' and
|
||||
o.in_id is null and
|
||||
o.stock_id='".$stock_id."' and
|
||||
o.product_id='".$product_id."'");*/
|
||||
$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='".$product_id."'");
|
||||
while($rrr=$GLOBALS['db']->fetchByAssoc($w)){
|
||||
$rrp=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select sum(quantity) as s from ecmstockoperations where in_id='".$rrr['id']."' and type='1' and in_id IS NOT NULL and stock_id='".$stock_id."' and product_id='".$product_id."' and deleted='0'"));
|
||||
$rqty=$rrp['s'];
|
||||
$qty=$rrr['qty']-$rqty;
|
||||
//$qty=$rrr['qty'];
|
||||
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'];
|
||||
}
|
||||
}
|
||||
echo $q1." ".$pp1."<br>".date("Y-m-d H:i:s")."<br>";
|
||||
}
|
||||
function sales1(){
|
||||
// if(i.ecminvoiceoutitem_id is not null,sum(i.price*i.quantity-ii.price*ii.quantity),sum(i.price*i.quantity)) a
|
||||
$w=$GLOBALS['db']->query("select
|
||||
sum(i.price*i.quantity-ii.price*ii.quantity) as sum
|
||||
from ecminvoiceouts as e
|
||||
inner join (
|
||||
ecminvoiceoutitems as i on e.id=i.ecminvoiceout_id
|
||||
left join ecminvoiceoutitems as ii on ii.id=i.ecminvoiceoutitem_id
|
||||
)
|
||||
where
|
||||
e.register_date like '2010%'");
|
||||
$r=$GLOBALS['db']->fetchByAssoc($w);
|
||||
echo $r['sum'];
|
||||
}
|
||||
//state1("c7afd71a-4c3a-bde4-138d-4acaee1644e4",450);
|
||||
//state2("c7afd71a-4c3a-bde4-138d-4acaee1644e4","3e84b9b5-1d1f-8ff4-e187-496bc6ac51e8");
|
||||
sales1();
|
||||
?>
|
||||
68
modules/EcmStockStates/us.php
Executable file
68
modules/EcmStockStates/us.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?
|
||||
set_time_limit(9999999999);
|
||||
|
||||
$re="RE01439";
|
||||
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
include_once("helper.php");
|
||||
mysql_query("truncate table ecmstockstates");
|
||||
mysql_query("set names utf8");
|
||||
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$stock_id=$r['id'];
|
||||
$ww=mysql_query("select id,code,name from ecmproducts where deleted='0'");
|
||||
while($rr=mysql_fetch_array($ww)){
|
||||
$product_id=$rr['id'];
|
||||
$product_name=$rr['name'];
|
||||
$product_code=$rr['code'];
|
||||
//if($product_code!=$re)continue;
|
||||
$w=mysql_query("select quantity,price,type from ecmstockoperations where stock_id='".$stock_id."' and product_id='".$product_id."' and deleted='0'");
|
||||
$q=0;
|
||||
$p=0;
|
||||
$i=0;
|
||||
$pp=0;
|
||||
$qq=0;
|
||||
while($r=mysql_fetch_array($w)){
|
||||
if($r['type']==0){
|
||||
$q+=$r['quantity'];
|
||||
$pp+=$r['quantity']*$r['price'];
|
||||
$i++;
|
||||
}
|
||||
elseif($r['type']==1){
|
||||
$q-=$r['quantity'];
|
||||
$pp-=$r['quantity']*$r['price'];
|
||||
}
|
||||
}
|
||||
mysql_query("delete from ecmstockstates where stock_id='".$stock_id."' and product_id='".$product_id."' and deleted='0'");
|
||||
|
||||
$rrr=mysql_fetch_array(mysql_query("select name from ecmstocks where id='".$stock_id."'"));
|
||||
$stock_name=$rrr['name'];
|
||||
if($q>0)$avg_price=($pp/$q);
|
||||
else $avg_price=0;
|
||||
$arr=array(
|
||||
'id'=>create_guid(),
|
||||
'name'=>'',
|
||||
'date_entered'=>date("Y-m-d H:i:s"),
|
||||
'date_modified'=>date("Y-m-d H:i:s"),
|
||||
'created_by'=>1,
|
||||
'assigned_user_id'=>1,
|
||||
'product_id'=>$product_id,
|
||||
'product_name'=>$product_name,
|
||||
'product_code'=>$product_code,
|
||||
'stock_id'=>$stock_id,
|
||||
'stock_name'=>$stock_name,
|
||||
'quantity'=>$q,
|
||||
'price'=>$avg_price,
|
||||
);
|
||||
$se=array();
|
||||
foreach($arr as $k=>$v){
|
||||
$se[]=$k."='".$v."'";
|
||||
}
|
||||
echo $product_code." ".$q." ".$avg_price."\n";
|
||||
mysql_query("insert into ecmstockstates set ".implode(",",$se));
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
167
modules/EcmStockStates/vardefs.php
Executable file
167
modules/EcmStockStates/vardefs.php
Executable file
@@ -0,0 +1,167 @@
|
||||
<?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['EcmStockState']=array(
|
||||
'table'=>'ecmstockstates',
|
||||
'audited'=>true,
|
||||
'comment'=>'EcmStockStates',
|
||||
'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',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'stock_id' => array (
|
||||
'name' => 'stock_id',
|
||||
'type' => 'enum',
|
||||
'module' => 'EcmStocks',
|
||||
'table'=>'ecmstocks',
|
||||
'vname' => 'LBL_STOCK_NAME',
|
||||
'group'=>'stock_name',
|
||||
'options'=>'ecmstocks_list_dom',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'product_code' => array(
|
||||
'name'=> 'product_code',
|
||||
'vname'=>'LBL_PRODUCT_CODE',
|
||||
'type'=>'varchar',
|
||||
'len' => '255',
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'empty' => array (
|
||||
'name' => 'empty',
|
||||
'vname' => 'Ukryj puste',
|
||||
'type' => 'bool',
|
||||
'required' => true,
|
||||
|
||||
'reportable' => false,
|
||||
'comment' => 'Record deletion indicator'
|
||||
),
|
||||
'product_name' => array(
|
||||
'name'=> 'product_name',
|
||||
'id_name'=>'product_id',
|
||||
'vname'=>'Nazwa',
|
||||
'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,2',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'part_id' => array (
|
||||
'name' => 'part_id',
|
||||
'vname' => 'LBL_QUANTITY',
|
||||
'type' => 'varchar',
|
||||
'len' => '45',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
'price' => array (
|
||||
'name' => 'price',
|
||||
'vname' => 'LBL_PRICE',
|
||||
'type' => 'decimal',
|
||||
'len' => '15,2',
|
||||
'required' => true,
|
||||
'massupdate'=>false,
|
||||
),
|
||||
),
|
||||
'indices'=>array(
|
||||
array('name'=>'idx_ecmstockstate_id_del','type'=>'index','fields'=>array('id','deleted')),
|
||||
array('name'=>'idx_ecmstockstate_assigned_del','type'=>'index','fields'=>array( 'deleted', 'assigned_user_id')),
|
||||
),
|
||||
'relationships'=>array(
|
||||
'ecmstockstates_assigned_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockStates',
|
||||
'rhs_table'=>'ecmstockstates',
|
||||
'rhs_key'=>'assigned_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmstockstates_modified_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockStates',
|
||||
'rhs_table'=>'ecmstockstates',
|
||||
'rhs_key'=>'modified_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmstockstates_created_by'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmStockStates',
|
||||
'rhs_table'=>'ecmstockstates',
|
||||
'rhs_key'=>'created_by',
|
||||
'relationship_type'=>'one-to-many'
|
||||
)
|
||||
),
|
||||
'optimistic_locking'=>true,
|
||||
);
|
||||
require_once('include/SugarObjects/VardefManager.php');
|
||||
VardefManager::createVardef('EcmStockStates','EcmStockState', array('default','assignable'));
|
||||
?>
|
||||
0
modules/EcmStockStates/views/EcmStockState.php
Executable file
0
modules/EcmStockStates/views/EcmStockState.php
Executable file
251
modules/EcmStockStates/views/view.list.php
Executable file
251
modules/EcmStockStates/views/view.list.php
Executable file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: This file is used to override the default Meta-data EditView behavior
|
||||
* to provide customization specific to the Calls module.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/MVC/View/views/view.list.php');
|
||||
|
||||
class EcmStockStatesViewList extends ViewList{
|
||||
|
||||
function EcmStockStatesViewList(){
|
||||
parent::ViewList();
|
||||
}
|
||||
|
||||
function display(){
|
||||
if(!$this->bean->ACLAccess('list')){
|
||||
ACLController::displayNoAccess();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->module=$module = "EcmStockStates";
|
||||
$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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
146
modules/EcmStockStates/wz.php
Executable file
146
modules/EcmStockStates/wz.php
Executable file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
mysql_query("truncate table ecmstockdocouts");
|
||||
mysql_query("truncate table ecmstockdocoutitems");
|
||||
|
||||
|
||||
function addWz($row,$i,$stock_id){
|
||||
$r=mysql_fetch_array(mysql_query("select id from accounts where name like '%".$row['PLATNIK']."%' and deleted='0'"));
|
||||
$parent_id=$r['id'];
|
||||
$rd=$row['DATA'];
|
||||
$a1=explode(" ",$row['ADRES1']);
|
||||
$r=mysql_fetch_array(mysql_query("select id from ecmstockdocouts where name like 'WZ ".$row['KOR_DO_WZ']."' and deleted='0'"));
|
||||
$correct_id=$r['id'];
|
||||
if($correct_id)$pre="WZKOR";
|
||||
else $pre="WZ";
|
||||
$id=create_guid();
|
||||
$arr=array(
|
||||
"id"=>$id,
|
||||
"name"=>$pre." ".$row['NR_WZ'],
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"document_no"=>$pre." ".$row['NR_WZ'],
|
||||
"number"=>($i+1),
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"parent_type"=>"Accounts",
|
||||
"parent_name"=>ch(str_replace("'","",$row['PLATNIK'])),
|
||||
"parent_id"=>$parent_id,
|
||||
"status"=>"accepted",
|
||||
"register_date"=>$rd[0].$rd[1].$rd[2].$rd[3]."-".$rd[4].$rd[5]."-".$rd[6].$rd[7],
|
||||
"validtill_date"=>$rd[0].$rd[1].$rd[2].$rd[3]."-".$rd[4].$rd[5]."-".$rd[6].$rd[7],
|
||||
"parent_address_street"=>ch(str_replace("'","",$row['ADRES2'])),
|
||||
"parent_address_city"=>ch($r1,$r2,$a1[1]),
|
||||
"parent_address_postalcode"=>$a1[0],
|
||||
"subtotal"=>($row['WARTOSC']-$row['PODATEK']),
|
||||
"total"=>$row['WARTOSC'],
|
||||
"discount"=>0,
|
||||
"ecmlanguage"=>"pl_pl",
|
||||
"template_id"=>"1d178dc6-0904-3fa3-f51b-4a4b4698a173",
|
||||
"template_name"=>"E5 Polska Sp. z o. o.",
|
||||
"stock_id"=>$stock_id,
|
||||
"currency_id"=>"PLN",
|
||||
"correct_id"=>$correct_id,
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocouts set ".implode(",",$in));
|
||||
return $id;
|
||||
}
|
||||
|
||||
function addProductLine($id,$i,$r){
|
||||
$vats=array(
|
||||
0=>"9b783d21-5548-6653-e1d6-49610eb3f9dd",
|
||||
22=>"9c592a4a-2de0-1fa3-e082-494aeceb122c",
|
||||
7=>"bf3a5fec-435f-af22-024a-4958b51863c8",
|
||||
);
|
||||
$rr=mysql_fetch_array(mysql_query("select id from ecmproducts where code like '".$r['INDEKS']."' and deleted='0'"));
|
||||
$pid=$rr['id'];
|
||||
if($pid==""){
|
||||
$pid=addProduct($r['INDEKS'],$r['NAZWA']);
|
||||
}
|
||||
$iid=create_guid();
|
||||
|
||||
$arr=array(
|
||||
"id"=>$iid,
|
||||
"date_entered"=>date("Y-m-d H:i:s"),
|
||||
"date_modified"=>date("Y-m-d H:i:s"),
|
||||
"deleted"=>0,
|
||||
"modified_user_id"=>1,
|
||||
"assigned_user_id"=>1,
|
||||
"created_by"=>1,
|
||||
"ecmstockdocout_id"=>$id,
|
||||
"ecmproduct_id"=>$pid,
|
||||
"position"=>$i,
|
||||
"code"=>ch(str_replace("'","",$r['INDEKS'])),
|
||||
"name"=>ch(str_replace("'","",$r['NAZWA'])),
|
||||
"quantity"=>$r['ILOSC'],
|
||||
"price"=>$r['CENA_SPRZ'],
|
||||
"discount"=>$r['RABAT'],
|
||||
"total"=>$r['WARTOSC'],
|
||||
"dd_unit_name"=>$r['NAZWA_J_M'],
|
||||
"dd_unit_id"=>1,
|
||||
"ecmvat_id"=>$vats[$r['VAT']],
|
||||
"ecmvat_value"=>$r['VAT'],
|
||||
"ecmvat_name"=>$r['VAT']."%",
|
||||
"currency_id"=>"PLN",
|
||||
"currency_name"=>"PLN",
|
||||
);
|
||||
foreach($arr as $k=>$v){
|
||||
$in[]=$k."='".$v."'";
|
||||
}
|
||||
mysql_query("insert into ecmstockdocoutitems set ".implode(",",$in));
|
||||
if(mysql_error()){
|
||||
echo mysql_error()."\n".implode(",",$in);
|
||||
}
|
||||
return $iid;
|
||||
}
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
|
||||
while($r=mysql_fetch_array($w)){
|
||||
$dbfp = new dbf_class('klk/'.$r['dir'].'/_wz_list.dbf');
|
||||
$num_recp=$dbfp->dbf_num_rec;
|
||||
//$num_recp=10000;
|
||||
$unset_arr=array("INDEKS","NAZWA","CENA_SPRZ","ILOSC","RABAT","WARTOSC","NAZWA_J_M","VAT","NR_SYSTEM");
|
||||
for($i=0;$i<$num_recp;$i++){
|
||||
echo "products ".$i."/".$num_recp."\n";
|
||||
$rowp=$dbfp->getRowAssoc($i);
|
||||
foreach($rowp as $k=>$v){
|
||||
if(!in_array($k,$unset_arr))unset($rowp[$k]);
|
||||
}
|
||||
$products[$rowp['NR_SYSTEM']][]=$rowp;
|
||||
}
|
||||
|
||||
$dbf = new dbf_class('klk/'.$r['dir'].'/_wz.dbf');
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
//$num_rec=1000;
|
||||
$unset_arr=array("NR_WZ","PLATNIK","PODATEK","WARTOSC","ADRES2","ANULOWANA","NR_SYSTEM","DATA","KOR_DO_WZ");
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
echo "docs ".$i."/".$num_rec."\n";
|
||||
$docs[$i]=$dbf->getRowAssoc($i);
|
||||
foreach($docs[$i] as $k=>$v){
|
||||
if(!in_array($k,$unset_arr))unset($docs[$i][$k]);
|
||||
}
|
||||
}
|
||||
|
||||
for($i=0;$i<$num_rec;$i++){
|
||||
echo $i."/".$num_rec."\n";
|
||||
if($docs[$i]['ANULOWANA']!="F")continue;
|
||||
$id=addWz($docs[$i],$i,$r['id']);
|
||||
$j=1;
|
||||
foreach($products[$docs[$i]['NR_SYSTEM']] as $prod){
|
||||
addProductLine($id,$j,$prod);
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
mysql_close($sql);
|
||||
?>
|
||||
107
modules/EcmStockStates/zest.php
Executable file
107
modules/EcmStockStates/zest.php
Executable file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
set_time_limit(9999999999);
|
||||
|
||||
include_once("class.dbf.php");
|
||||
include_once("helper.php");
|
||||
|
||||
$sql=mysql_connect("localhost","root","");
|
||||
mysql_select_db("saascrm");
|
||||
mysql_query("set names utf8");
|
||||
|
||||
$dbf = new dbf_class("klk/_fk.dbf");
|
||||
$num_rec=$dbf->dbf_num_rec;
|
||||
|
||||
$dbfp = new dbf_class("klk/_fk_list.dbf");
|
||||
$num_recp=$dbfp->dbf_num_rec;
|
||||
$n=0;
|
||||
$k=0;
|
||||
for($i=420000;$i<$num_recp;$i++){
|
||||
$rowt = $dbfp->getRowAssoc($i);
|
||||
if($rowt['DATA']>20081231){
|
||||
$rowp[$k]=$rowt;
|
||||
$k++;
|
||||
}
|
||||
echo $i."/".$num_recp."\n";
|
||||
}
|
||||
$k=0;
|
||||
for($i=35000;$i<$num_rec;$i++){
|
||||
$rowt = $dbf->getRowAssoc($i);
|
||||
if($rowt['DATA']>20081231){
|
||||
$row[$k]=$rowt;
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$k=0;
|
||||
echo count($row)." ";
|
||||
echo count($rowp)."\n";
|
||||
for($i=0;$i<count($row);$i++){
|
||||
$nn=$n;
|
||||
for($j=$nn;$j<$nn+200;$j++){
|
||||
if($row[$i]['NR_SYSTEM']==$rowp[$j]['NR_SYSTEM']){
|
||||
/*$d[$k]['name']=$rowp[$j]['NAZWA'];
|
||||
$d[$k]['code']=$rowp[$j]['INDEKS'];
|
||||
$d[$k]['qty']=$rowp[$j]['ILOSC'];
|
||||
$d[$k]['date']=$row[$i]['DATA'];
|
||||
$d[$k]['price']=$rowp[$j]['CENA_SPRZ'];
|
||||
$d[$k]['value']=$rowp[$j]['ILOSC']*$rowp[$j]['CENA_SPRZ'];
|
||||
$d[$k]['client']=$row[$i]['PLATNIK'];
|
||||
|
||||
*/
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['name']=$rowp[$j]['NAZWA'];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['code']=$rowp[$j]['INDEKS'];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['qty']+=$rowp[$j]['ILOSC'];
|
||||
$qty[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]+=$rowp[$j]['ILOSC'];
|
||||
$aq[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]+=$rowp[$j]['ILOSC']*$rowp[$j]['CENA_SPRZ'];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['date']=$row[$i]['DATA'];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['price']=$aq[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]/$qty[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['value']=$aq[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']];
|
||||
$d1[$row[$i]['PLATNIK']."_".$rowp[$j]['INDEKS']]['client']=$row[$i]['PLATNIK'];
|
||||
|
||||
$n++;
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
echo $i."/".count($row)." p\n";
|
||||
}
|
||||
unset($row);
|
||||
unset($rowp);
|
||||
mysql_close($sql);
|
||||
|
||||
$dc=count($d);
|
||||
$h=";";
|
||||
$csv="";
|
||||
|
||||
$r1=array("ť","—","¨","˝","¤","ŕ");
|
||||
$r2=array("Ł","Ś","Ę","Ż","Ą","Ó");
|
||||
/*for($i=0;$i<$dc;$i++){
|
||||
$csv.=str_replace($r1,$r2,$d[$i]['name']).$h;
|
||||
$csv.=$d[$i]['code'].$h;
|
||||
$csv.=$d[$i]['qty'].$h;
|
||||
$csv.=$d[$i]['price'].$h;
|
||||
$csv.=$d[$i]['value'].$h;
|
||||
$csv.=str_replace($r1,$r2,$d[$i]['client']).$h;
|
||||
$csv.=$d[$i]['date'].$h."\n";
|
||||
echo "xls ".$i."/".$dc."\n";
|
||||
}*/
|
||||
foreach($d1 as $dd){
|
||||
$csv.=str_replace($r1,$r2,$dd['name']).$h;
|
||||
$csv.=$dd['code'].$h;
|
||||
$csv.=$dd['qty'].$h;
|
||||
$csv.=$dd['price'].$h;
|
||||
$csv.=$dd['value'].$h;
|
||||
$csv.=str_replace($r1,$r2,$dd['client']).$h."\n";
|
||||
//$csv.=$dd['date'].$h."\n";
|
||||
}
|
||||
|
||||
chmod("d:/www/saas1/cache/upload",0777);
|
||||
$microtime=str_replace(".","",str_replace(" ","",microtime()));
|
||||
$name="d:/www/saas1/cache/upload/Products".$microtime.".csv";
|
||||
|
||||
$file = $name;
|
||||
$fp = fopen($file, "w");
|
||||
flock($fp, 2);
|
||||
fwrite($fp, $csv);
|
||||
flock($fp, 3);
|
||||
fclose($fp);
|
||||
chmod($name,0777);
|
||||
?>
|
||||
Reference in New Issue
Block a user