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

View File

@@ -0,0 +1,164 @@
<?php
if(isset($_REQUEST['ids'])){
$db=$GLOBALS['db'];
global $app_list_strings;
$ids= explode(',', $_REQUEST['ids']);
$query='select i.ecmproduct_id,i.name,i.code,i.quantity,d.document_no from ecmsaleitems i
inner join ecmsales d on d.id=i.ecmsale_id
where i.ecmsale_id in ("'.implode('","',$ids) .'") and i.deleted=0';
$res = $db->query($query);
$orders=[];
$products=[];
$orderNo='';
$orderNr=[];
while($dane = $db->fetchByAssoc($res)){
$tmp = [];
$tmp['ecmproduct_id']=$dane['ecmproduct_id'];
$tmp['quantity']=(float)$dane['quantity'];
$tmp['name']=$dane['name'];
$tmp['code']=$dane['code'];
$orders[$dane['ecmsale_id']][]=$tmp;
$products[]=$dane['ecmproduct_id'];
if($orderNr[$dane['document_no']]==""){
$orderNr[$dane['document_no']]=1;
$orderNo.=' '.$dane['document_no'];
}
}
$products=array_unique($products);
$query="SELECT c.ecmproduct_id,c.ecmcomponent_id,c.code,c.name,c.quantity,p.product_category_name,p.group_ks,p.unit_id FROM ecmproductcomponents c
inner join ecmproducts p on p.id=c.ecmcomponent_id
where c.ecmproduct_id in ('".implode("','",$products)."') and c.deleted=0";
$res = $db->query($query);
$lists = return_app_list_strings_language('pl_pl');
$components=[];
$products_has_components=[];
while($dane = $db->fetchByAssoc($res)){
$products_has_components[$dane['ecmproduct_id']][]=$dane;
}
$total_components=0;
$total_in_stock=0;
$components_list=[];
foreach ($orders as $order){
foreach ($order as $product){
if(isset($products_has_components[$product['ecmproduct_id']])){
foreach ($products_has_components[$product['ecmproduct_id']] as $component){
if($component['group_ks']=='4')continue;
if($component['product_category_name']=='Usługi')continue;
if($components_list[$component['ecmcomponent_id']]){
$components_list[$component['ecmcomponent_id']]['quantity']=bcadd(bcmul($component['quantity'],$product['quantity'],2),$components_list[$component['ecmcomponent_id']]['quantity'],2);
$total_components=bcadd(bcmul($component['quantity'],$product['quantity'],6),$total_components,2);
} else {
$components_list[$component['ecmcomponent_id']]['quantity']=bcmul ($component['quantity'],$product['quantity'],2);
$components_list[$component['ecmcomponent_id']]['code']=$component['code'];
$components_list[$component['ecmcomponent_id']]['name']=$component['name'];
$components_list[$component['ecmcomponent_id']]['product_category_name']=$component['product_category_name'];
$components_list[$component['ecmcomponent_id']]['group_ks_name']=$app_list_strings['ecmproducts_group_ks_dom'][$component['group_ks']];
$components_list[$component['ecmcomponent_id']]['unit_name'] = $lists['ecmproducts_unit_dom'][$component['unit_id']];
$ecmStockOperations = new EcmStockOperation();
$stock=round($ecmStockOperations->getRealStock($component['ecmcomponent_id']),2);
$total_components=bcadd($components_list[$component['ecmcomponent_id']]['quantity'],$total_components,2);
$total_in_stock=bcadd($stock,$total_in_stock,2);
$components_list[$component['ecmcomponent_id']]['stock']=$stock;
}
}
}
}
}
foreach ($products as $key=> $product){
foreach ($products_has_components as $key2=> $product2){
if($product==$key2){
unset($products[$key]);
}
}
}
$query="select p.id,p.code,p.name,p.product_category_name,p.group_ks,i.quantity,p.unit_id from ecmsaleitems i
inner join ecmproducts p on p.id = i.ecmproduct_id
where i.ecmsale_id in ('".implode("','",$ids) ."') and i.deleted=0
and i.ecmproduct_id in ('".implode("','",$products)."')";
$total=0;
$total_in_stock2=0;
$res = $db->query($query);
$products=[];
while($dane = $db->fetchByAssoc($res)){
if($dane['group_ks']=='4')continue;
if($dane['product_category_name']=='Usługi')continue;
$products[$dane['id']]['code']=$dane['code'];
$products[$dane['id']]['name']=$dane['name'];
$products[$dane['id']]['quantity']=$products[$dane['id']]['quantity']+$dane['quantity'];
$products[$dane['id']]['product_category_name']=$dane['product_category_name'];
$products[$dane['id']]['group_ks_name']=$app_list_strings['ecmproducts_group_ks_dom'][$dane['group_ks']];
$products[$dane['id']]['unit_name']= $lists['ecmproducts_unit_dom'][$component['unit_id']];
$ecmStockOperations = new EcmStockOperation();
$stock=$ecmStockOperations->getRealStock($dane['id']);
$total=bcadd($dane['quantity'],$total,2);
$total_in_stock2=bcadd($stock,$total_in_stock2,2);
$products[$dane['id']]['stock']=$stock;
}
$query="select p.id,p.code,p.name,p.product_category_name,p.group_ks,i.quantity,p.pieces_per_carton,p.boxes_per_palette,p.packing_dimensions_1 as a1,p.packing_dimensions_2 as a2,p.packing_dimensions_3 as a3 from ecmsaleitems i
inner join ecmproducts p on p.id = i.ecmproduct_id
where i.ecmsale_id in ('".implode("','",$ids) ."') and i.deleted=0 ";
$res = $db->query($query);
$packing=[];
while($dane = $db->fetchByAssoc($res)){
if($dane['group_ks']=='4')continue;
if($dane['product_category_name']=='Usługi')continue;
$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['name']=$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3'];
$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['box']=$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['box']+ceil($dane['quantity']/$dane['pieces_per_carton']);
$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['palet']=$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['palet']+ ceil(($dane['quantity']/$dane['pieces_per_carton'])/$dane['boxes_per_palette']);
$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['product_category_name']=$dane['product_category_name'];
$packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['group_ks_name']=$app_list_strings['ecmproducts_group_ks_dom'][$dane['group_ks']];
$total_box=bcadd($packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['box'],$total_box,2);
$total_palet=bcadd($packing[$dane['a1'].'x'.$dane['a2'].'x'.$dane['a3']]['palet'],$total_palet,2);
}
$ss = new Sugar_Smarty ();
global $mod_strings;
$ss->assign ( "total_box", ceil($total_box));
$ss->assign ( "total_total", $total_total);
$ss->assign ( "total_palet", ceil($total_palet));
$ss->assign ( "packing", $packing);
$ss->assign ( "orderNo", $orderNo);
$ss->assign ( "total_components", $total_components);
$ss->assign ( "total_in_stock", $total_in_stock);
$ss->assign ( "total", $total);
$ss->assign ( "total_in_stock2", $total_in_stock2);
$ss->assign ( "products", $products );
$ss->assign ( "components_list", $components_list);
$ss->assign ( 'MOD', $mod_strings);
$ss-> display('modules/EcmSales/tpls/ComponentsList.html'); //4
}
?>

View File

@@ -0,0 +1,117 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
global $current_user;
$dashletData['MyEcmSalesDashlet']['searchFields'] = array('name' => array('default' => ''),
'date_entered' => array('default' => ''),
'status' => array('default' => ''),
'assigned_user_id' => array('type' => 'assigned_user_name',
'default' => $current_user->name));
$dashletData['MyEcmSalesDashlet']['columns'] = array(
'STATUS' => array(
'width' => '1',
'label' => '&nbsp;',
'default' => true,
),
'DOCUMENT_NO' => array(
'width' => '8',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true,
),
'NAME' => array(
'width' => '15',
'label' => 'LBL_NAME',
'sortable' => true,
'link' => false,
//'customCode' => '<a href="index.php?module=EcmSales&action=EditView&record={$ID}">{$NAME}</a>',
'default' => true,
),
'REGISTER_DATE'=>array(
'width'=>15,
'label'=>'LBL_REGISTER_DATE',
'default'=>true,
'sortable'=>true,
),
'PARENT_ID'=>array(
'width'=>0,
'label'=>'&nbsp;',
'customCode'=>'&nbsp;',
'default'=>true,
'sortable'=>false,
),
'PARENT_NAME' => array(
'width' => '15',
'label' => 'LBL_PARENT_NAME',
'default' => true,
'id'=>'PARENT_ID',
'module'=>'Accounts',
'link'=>true,
),
'TOTAL_BRUTTO' => array(
'width' => '10',
'label' => 'LBL_TOTAL',
'default' => true,
'align' => 'left',
),
'ASSIGNED_USER_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true
),
'OPTIONS' => array(
'width' => '5',
'label' => '&nbsp;',
'link' => false,
'default' => true,
'sortable' => false,
'align' => 'right',
),
'date_entered' => array('width' => '15',
'label' => 'LBL_DATE_ENTERED'),
);
k
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
global $app_strings;
$dashletMeta['MyEcmSalesDashlet'] = array('module' => 'EcmSales',
'title' => 'Moja sprzedaż',
'description' => 'A customizable view into Quotes',
'category' => 'Module Views',
'hidden' => true);
?>

View File

@@ -0,0 +1,61 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
require_once('include/Dashlets/DashletGeneric.php');
require_once('modules/EcmSales/EcmSale.php');
class MyEcmSalesDashlet extends DashletGeneric {
function MyEcmSalesDashlet($id, $def = null) {
global $current_user, $app_strings;
require('modules/EcmSales/Dashlets/MyEcmSalesDashlet/MyEcmSalesDashlet.data.php');
parent::DashletGeneric($id, $def);
if(empty($def['title'])) $this->title = 'Moja sprzedaż';
$this->searchFields = $dashletData['MyEcmSalesDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmSalesDashlet']['columns'];
$this->seedBean = new EcmSale();
$this->lvs->quickViewLinks = false;
}
}
?>

View File

@@ -0,0 +1,114 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once ('modules/EcmSales/EcmSale.php');
require_once ('include/time.php');
require_once ('include/json_config.php');
//add jquery
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-2.1.0.min.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
$json_config = new json_config ();
$focus = new EcmSale ();
if (isset ( $_REQUEST ['record'] )) {
$focus->retrieve ( $_REQUEST ['record'] );
$focus->format_all_fields ();
$OPT ['status'] = $focus->status;
}
require_once ('include/MVC/View/SugarView.php');
require_once ('modules/EcmSales/views/DetailView/view.detail.my.php');
//create position list table
$pl = $focus->getPositionList();
$edit = new ViewDetailMy ();
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmSales';
//add pdf buttons
$btn ='<input title="Generuj PDF" class="button" onclick="if($(\'#div_pdf\').css(\'display\') == \'none\'){$(\'#div_pdf\').show(\'slow\'); } else { $(\'#div_pdf\').hide(\'slow\'); }" type="button" name="productcard" id="productcard" value="Generuj PDF">';
$btn .= '<div id="div_pdf" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$btn .= 'Typ: <select name="pdf_images" id="pdf_type"><option value="1">Zamówienie sprzedaży</option><option value="2">Proforma</option></select><br /><br />';
$btn .= 'EAN: <select name="pdf_ean" id="pdf_ean"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
$btn .= 'EAN2: <select name="pdf_ean2" id="pdf_ean2"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
$btn .= 'Kod odbiorcy: <select name="pdf_recipient_code" id="pdf_recipient_code"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
$btn .= '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmSales&action=createPDF&to_pdf=1&show_img=no&pdf_type=\'+$(\'#pdf_type\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
$edit->ss->assign("CREATE_PDF",$btn);
$btn ='<input title="Generuj Katalog" class="button" onclick="if($(\'#div_cat\').css(\'display\') == \'none\'){$(\'#div_cat\').show(\'slow\'); } else { $(\'#div_cat\').hide(\'slow\'); }" type="button" name="productcat" id="productcat" value="Generuj Katalog">';
$btn .= '<div id="div_cat" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$btn .= 'EAN: <select name="cat_ean" id="cat_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
$btn .= '<input name="cat_pdf" id="cat_pdf" title="Show Cat" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmSales&action=createCatalogue&to_pdf=1&show_ean=\'+$(\'#cat_ean\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż Katalog"></div>';
$edit->ss->assign("CATALOGUE",$btn);
$btn = '<input name="quote_xls" id="quote_xls" title="Show XLS" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmSales&action=createXLS&to_pdf=1&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż XLS"></div>';
$edit->ss->assign("CREATE_XLS",$btn);
$can_edit = false;
global $current_user;
if (
$focus->created_by == $current_user->id ||
is_admin($current_user) ||
$focus->assigned_user_id == $current_user->id ||
$current_user->id=='be5b7acb-cb35-186b-7229-523818723665' ||
(strlen($focus->assigned_user_id) == 0 && strlen($focus->edi_zs_id) > 0)){
$can_edit = true;
}$db = $GLOBALS ['db'];
$rows = $db->query ("select id from ecmstockdocouts where ecmsale_id='".$focus->id."' and deleted='0'");
$r = $db->fetchByAssoc ( $rows );
if($r['id']!='')$can_edit=false;
$edit->ss->assign("CAN_EDIT", $can_edit);
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);
$a = new EcmStockDocOut();
$a->retrieve_by_string_fields(['ecmsale_id'=>$focus->id]);
$the_array ['WZ'] = "<a target='_blank' href='index.php?module=EcmStockDocOuts&action=DetailView&record=$a->id'>".$a->document_no."</a>";
$edit->ss->assign("wz_no", $the_array ['WZ']);
$a = new EcmInvoiceOut();
$a->retrieve_by_string_fields(['so_id'=>$focus->id]);
$the_array ['FV'] = "<a target='_blank' href='index.php?module=EcmInvoiceOuts&action=DetailView&record=$a->id'>".$a->document_no."</a>";
$edit->ss->assign("fk_no", $the_array ['FV']);
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
$edit->preDisplay ();
//check number
$db = $GLOBALS['db'];
$res = $db->query("SELECT id FROM ecmsales WHERE document_no='$focus->document_no' AND deleted='0'");
if ($res->num_rows > 1) {
echo '<h1 style="color: red;">Błąd numeracji, skontaktuj się z administratorem! Nie drukuj/publikuj dokumentu!</h1>';
}
echo $edit->display ();
require_once ('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles ( $focus, 'EcmSales' );
echo $subpanel->display ();
//loading view
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
?>

1162
modules/EcmSales/EcmSale.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
<?php
ini_set('display_errors',1);
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'NotAValidEntryPoint' );
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
require_once ('modules/EcmSales/EcmSale.php');
require_once ('modules/EcmSales/readXML.php');
require_once ('include/time.php');
$db = $GLOBALS['db'];
//add jquery
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-2.1.0.min.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
// $cq=$current_user->getPreference('confirm_quotes');
$new_number = false;
$duplicate = false;
$focus = new EcmSale ();
if (isset ( $_REQUEST ['record'] ) && $_REQUEST['isDuplicate']=="false" ) {
$focus->retrieve ( $_REQUEST ['record'] );
if (isset ( $focus->id ) && $focus->id != '') {
$focus->format_all_fields ();
}
}
else if ($_REQUEST['isDuplicate']=="true") {
$new_number=true;
$duplicate=true;
//get data
$focus->retrieve($_REQUEST['return_id']);
$focus->id = null;
$focus->register_date = date("d.m.Y");
$focus->payment_date = date("d.m.Y", strtotime($Date.' + '.$focus->payment_date_days.' days'));
$focus->delivery_date = null;
$focus->send_date = null;
$focus->assigned_user_name=$current_user->full_name;
$focus->assigned_user_id=$current_user->id;
$focus->status = 's10';
}else if ($_REQUEST['ecmquote_id']) {
$new_number=true;
$ecmquote_id =$_REQUEST['ecmquote_id'];
$ecmquote =true;
$q= new EcmQuote();
//get data
$q->retrieve($_REQUEST['ecmquote_id']);
$focus->parent_id=$q->parent_id;
$focus->parent_name=$q->parent_name;
$focus->register_date=date("d.m.Y");
$focus->position_list= $q->getPositionList(true);
}else if ($_REQUEST['upload'] && $_REQUEST['file']) {
$new_number=true;
$reader=New readXML();
// wczytaj plik
//$file=$reader->UploadXMLFile();
if($_REQUEST['file']!=''){
// załaduj dane z pliku do readera
$reader->loadXMLFile($_REQUEST['file']);
// załaduj dane do klasy
$reader->loader($focus);
$focus->edi_file = $_REQUEST['file'];
}
unset($reader);
}
else {
$new_number=true;
//dates
$focus->register_date = date("d.m.Y");
$focus->delivery_date = date("d.m.Y");
//$focus->send_date = date("d.m.Y");
//for subpanels??
if (isset ( $_REQUEST ['contact_id'] ) && $_REQUEST ['contact_id'] != '' && isset ( $_REQUEST ['contact_name'] ) && $_REQUEST ['contact_name'] != '') {
$_REQUEST ['parent_type'] = 'Contacts';
$_REQUEST ['parent_name'] = $_REQUEST ['contact_name'];
$_REQUEST ['parent_id'] = $_REQUEST ['contact_id'];
$OPT ['check_parent_id'] = false;
}
if (isset ( $_REQUEST ['account_id'] ) && $_REQUEST ['account_id'] != '' && isset ( $_REQUEST ['account_name'] ) && $_REQUEST ['account_name'] != '') {
$_REQUEST ['parent_type'] = 'Accounts';
$_REQUEST ['parent_name'] = $_REQUEST ['account_name'];
$_REQUEST ['parent_id'] = $_REQUEST ['account_id'];
$OPT ['check_parent_id'] = false;
}
$focus->status = 's30';
}
$res = $db->query("SELECT id, name FROM ecmstocks WHERE deleted = '0' ORDER BY name");
$stock = '<select id="stock" name="stock"><option value=""></option>';
$stock_body = '';
while ($row = $db->fetchByAssoc($res))
$stock_body.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
$stock.=$stock_body.'</select><input id="stock_id" name="stock_id" type="hidden"/>';
require_once ('include/MVC/View/SugarView.php');
require_once ('modules/EcmSales/views/EditView/view.edit.ecmsales.php');
$edit = new ViewEditEcmSales ();
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmSales';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
$edit->preDisplay ();
$edit->ss->assign ( "NEW_NUMBER", $new_number );
$edit->ss->assign("STOCK", $stock);
$edit->ss->assign ( "ECMQUOTE_ID", $ecmquote_id );
$edit->ss->assign ( "ECMQUOTE", $ecmquote );
$edit->ss->assign ( "EDI_FILE", $focus->edi_file);
$edit->ss->assign("DUPLICATE", $duplicate);
echo $edit->display ();
//loading view
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';

View File

@@ -0,0 +1,60 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
// require_once('modules/EcmGroupSales/HeaderMenu.php');
ini_set('max_execution_time', 9999999999);
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once ('include/time.php');
require_once ('include/json_config.php');
// add jquery
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/css/style.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-lastes.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jQuery.tablesorter/jquery.tablesorter.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery.tablesorter.pager.js"></script>';
echo '<script type="text/javascript"
src="modules/EcmSales/javascript/ListNewSales.js"></script>';
$json_config = new json_config ();
$focus = new EcmSale ();
if($_GET['submit']){
$position_list=$focus->GetArrayResultFromQuery($focus->CreateQueryFromPost($_GET));
}
if($_GET['gets']){
$position_list=$focus->GetArrayResultFromQuery($focus->CreateQueryFromPost($_GET));
$link=$focus->CreateMultiPDF($_GET['selectedid']);
}
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmSales';
$currencies = [
'PLN'=>'PLN',
'3c8d317e-513b-9a9b-d0e6-511e2abee625'=>"GBP",
'98b2b752-b0be-37c2-d2eb-511e29f81cab'=>'USD',
'6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'=>'EUR'
];
$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
$edit->ss->assign ( 'FOCUS', $focus);
$edit->ss->assign ( 'POST', $_GET);
$edit->ss->assign ( 'LINK', $link);
$edit->ss->assign ( "CURRENCIES", $currencies);
$edit->ss->assign('POSITION_LIST',$position_list);
$edit->ss->assign('POSITION_LIST_C',$position_list_c);
$edit->ss->assign ( 'MOD', $mod_strings);
$edit->ss-> display('modules/EcmSales/tpls/ListNewSales.tpl'); //4
// loading view
//echo '<link rel="stylesheet" type="text/css" href="modules/EcmInsideOrders/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
?>

View File

@@ -0,0 +1,222 @@
<?php
//error_reporting(E_ALL);
if(!$_REQUEST['printed'])$_REQUEST['printed']="no";
if($_REQUEST['zip'] || $_REQUEST['status']){
if($_REQUEST['type']=="zip"){
require_once('include/pclzip/pclzip.lib.php');
$zf='modules/EcmSales/upload_xml/archive'.time().'.zip';
$archive = new PclZip($zf);
if(count($_REQUEST['check'])>0){
foreach($_REQUEST['check'] as $c){
if($c)$files[]='/home/mz/edi/infinite-salesorders/orders/'.$c;
}
}
$list=$archive->create($files,PCLZIP_OPT_REMOVE_ALL_PATH);
//echo $archive->errorInfo(true);die();
chmod($zf,0777);
//header("Content-type: application/octet-stream");
//header("Content-disposition: attachment; filename=archive.zip");
//readfile($zf);
header("Location: ".$zf);
}
else{
if(count($_REQUEST['check'])>0){
foreach($_REQUEST['check'] as $c){
$tmp=$GLOBALS['db']->query("select id from infinite_files where file like '".$c."'");
if ($tmp->num_rows==0) {
$GLOBALS['db']->query("insert into infinite_files set status='print',id='".create_guid()."',file='".$c."'");
}
else{
$GLOBALS['db']->query("update infinite_files set status='print' where file='".$c."'");
}
}
}
header("Location: index.php?module=EcmSales&action=ListOrders");
}
}
$tds1='<td valign="top" class="listViewThS1" style="vertical-align:top;">';
$trs='<tr>';
$tre='</tr>';
$tds='<td valign="top" class="oddListRowS1" style="vertical-align:top;">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
function sortableColumn($title,$order_by,$sorder){
if($sorder=="asc")$sorder="desc";
else $sorder="asc";
return '<a href="index.php?module=EcmSales&action=ListOrders&order_by='.$order_by.'&sorder='.$sorder.'">'.$title.'</a>';
}
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="themes/Sugar/images/EcmSales.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmSales" width="16" border="0" height="16"></td>
<td width="544"><h2>Zamówienia sprzedaży: Skrzynka zleceń sprzedaży</h2></td></tr></table><br />
<ul class="tablist">
<li>
<a class="current" href="#">Podstawowe wyszukiwanie</a>
</li>
</ul>
<form action="index.php" method="get">
<input type="hidden" name="module" value="EcmSales" />
<input type="hidden" name="action" value="ListOrders" />
<table style="border-top: 0px none; margin-bottom: 4px;" class="tabForm" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="10%" nowrap="nowrap">
Wydrukowane</td>
<td class="dataField" width="40%" nowrap="nowrap">
<select name="printed">
<option value="all"<? if($_REQUEST['printed']=="all")echo " selected";?>>All</option>
<option value="yes"<? if($_REQUEST['printed']=="yes")echo " selected";?>>Yes</option>
<option value="no"<? if($_REQUEST['printed']=="no")echo " selected";?>>No</option>
</select>
</td>
<td class="dataLabel" width="10%" nowrap="nowrap">
Data </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>
<td class="dataLabel" width="10%" nowrap="nowrap">
Kontrahenci </td>
<td class="dataField" width="40%" nowrap="nowrap">
<select name="account_id">
<option value="">Wszyscy</option>
<?php
$w=$GLOBALS['db']->query("select id,name from accounts where deleted='0' and (parent_id=242 or parent_id=134) order by name asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
echo '<option value="'.$r['id'].'"';
if($_REQUEST['account_id']==$r['id'])echo ' selected';
echo '>'.$r['name'].'</option>';
}
?>
</select>
</td>
</tr>
</table>
<input class="button" name="submit" value="Search" type="submit">&nbsp;
<input class="button" name="clear" value="Clear" type="button" onclick="location.href='index.php?module=EcmSales&action=ListOrders';">
</form>
<table class="h3Row" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td nowrap="nowrap">
<h3>Lista zamówień</h3>
</td>
<td width="100%">
<img src="include/images/blank.gif" alt="" width="1" height="1">
</td>
</tr>
</tbody>
</table>
<?php
$d="/home/mz/edi/infinite-salesorders/orders/";
echo '<form method="post" action="index.php?module=EcmSales&action=ListOrders&to_pdf=1"><input type="hidden" value="zip" id="type" name="type" />'.$tbs;
echo $tdr;
echo $tds1.sortableColumn("Plik","file",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Nr zamówienia","document_no",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Status","status",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Kontrahent","account_name",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Data","date",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Data dostawy","delivery_date",$_REQUEST['sorder']).$tde;
echo $tds1.sortableColumn("Razem","total",$_REQUEST['sorder']).$tde;
echo $tds1."&nbsp;".$tde;
echo $tds1."&nbsp;".$tde;
echo $tre;
require_once("include/ECM/EcmXml2Array/class.xml2array.php");
require_once("modules/EcmProducts/EcmProduct.php");
if(is_dir($d)) {
if ($dh = opendir($d)) {
while (($entry = readdir($dh)) !== false) {
if($entry!="." && $entry!=".." && $entry!="invoice" && $entry!="orders" && !is_dir($d.$entry)){
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select status from infinite_files where file like '".$entry."'"));
if($r['status'])$status="Printed";
else $status="";
if($_REQUEST['printed']=="yes"){
if($status=="")continue;
}
if($_REQUEST['printed']=="no"){
if($status=="Printed")continue;
}
$xml_data = file_get_contents($d.$entry);
$xmlObj = new XmlToArray($xml_data);
$ad = $xmlObj->createArray();
$racc=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,id from accounts where iln='".$ad['Document-Order']['Order-Parties'][0]['DeliveryPoint'][0]['ILN']."'"));
if($_REQUEST['account_id'] && $_REQUEST['account_id']!=$racc['id'])continue;
$pr=$ad['Document-Order']['Order-Lines'][0]['Line'];
$total=0;
foreach($pr as $prod){
//if($ad['Document-Order']['Order-Header'][0]['OrderDate']!=$date)continue;
$product_id="";
$wwww=$GLOBALS['db']->query("select ecmproduct_language.ecmproduct_id from ecmproduct_language inner join ecmproducts on ecmproducts.id=ecmproduct_language.ecmproduct_id where ecmproduct_language.ean='".$prod['Line-Item'][0]['EAN']."' and ecmproducts.deleted='0' and ecmproduct_language.deleted='0' and ecmproducts.code NOT LIKE '%_w' and ecmproducts.code NOT LIKE '%_z' and ecmproducts.code NOT LIKE '%_W' and ecmproducts.code NOT LIKE '%_Z'");
$rrrr=$GLOBALS['db']->fetchByAssoc($wwww);
$product_id=$rrrr['ecmproduct_id'];
$ecmp=new EcmProduct();
$ecmp->retrieve($product_id);
$product_code=$ecmp->code;
$product_name=$ecmp->name;
$vat_id=$ecmp->vat_id;
$vat_name=$ecmp->vat_name;
$vat_value=$ecmp->vat_value;
if(eregi("Real",$racc['name'])){
$rrr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select p.price from ecmpricebooks_ecmproducts as p inner join ecmpricebooks as e on e.id=p.ecmpricebook_id where e.id='b8c8cb50-4b60-5b02-5969-4b955880554a' and p.ecmproduct_id='".$product_id."'"));
$prod['Line-Item'][0]['OrderedUnitNetPrice']=$rrr['price'];
}
$total+=$prod['Line-Item'][0]['OrderedQuantity']*$prod['Line-Item'][0]['OrderedUnitNetPrice']*(1+$vat_value/100);
}
$row[]=array(
"status"=>$status,
"account_name"=>$racc['name'],
"account_id"=>$racc['id'],
"file"=>$entry,
"document_no"=>$ad['Document-Order']['Order-Header'][0]['OrderNumber'],
"date"=>$ad['Document-Order']['Order-Header'][0]['OrderDate'],
"delivery_date"=>$ad['Document-Order']['Order-Header'][0]['ExpectedDeliveryDate'],
"total"=>$total,
);
}
}
}
}
include_once('modules/EcmCharts/chartHelper.php');
if(!$_REQUEST['order_by'])$order_by="date";
else $order_by=$_REQUEST['order_by'];
if(!$_REQUEST['sorder'])$sorder="desc";
else $sorder=$_REQUEST['sorder'];
$row=multisort($row,array(array('key'=>$order_by,'sort'=>$sorder)));
if(count($row)>0){
foreach($row as $r){
echo $trs.$tds.$r['file'].$tde;
echo $tds.$r['document_no'].$tde;
echo $tds.$r['status'].$tde;
echo $tds.'<a href="index.php?module=Accounts&action=DetailView&record='.$r['account_id'].'">'.$r['account_name'].'</a>'.$tde;
echo $tds.$timedate->to_display_date($r['date']).$tde;
echo $tds.$timedate->to_display_date($r['delivery_date']).$tde;
echo $tds.number_format($r['total'],2,",",".").$tde;
echo $tds.'<a href="infinite-salesorders/orders/'.$r['file'].'">pokaż</a>'.$tde;
echo $tds.'<input type="checkbox" value="'.$r['file'].'" name="check[]" />'.$tde.$tdr;
}
}
echo $tbe.'<input type="submit" name="zip" onclick="document.getElementById(\'type\').value=\'zip\';" value="Utwórz ZIP" class="button" />&nbsp;<input type="submit" name="status" onclick="document.getElementById(\'type\').value=\'status\';" value="Wydrukowane" class="button" />&nbsp;<input type="submit" name="status" onclick="document.getElementById(\'type\').value=\'status_realisaed\';" value="Nie zrealizowane" class="button" /></form>';
?>

110
modules/EcmSales/Menu.php Normal file
View File

@@ -0,0 +1,110 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
global $mod_strings, $current_user;
if(ACLController::checkAccess('EcmSales', "edit", true)) $module_menu [] = Array("index.php?module=".'EcmSales'."&action=EditView&return_module=".'EcmSales'."&return_action=DetailView", translate('LNK_NEW_'.'ECMSALE', 'EcmSales'),"CreateEcmSales", 'EcmSales');
if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmSales&action=index&return_module=EcmSales&return_action=DetailView&query=true&searchFormTab=basic", translate('LNK_ECMSALES_LIST','EcmSales'),"EcmSales", 'EcmSales');
if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmSales&action=ListNewSales", translate('LNL_NEW_RAPORT','EcmSales'),"EcmSales", 'EcmSales');
//if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmSales&action=ListOrders&return_module=EcmSales&return_action=DetailView", "Inbox","EcmSales", 'EcmSales');
if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmSales&action=importXML&return_module=EcmSales&return_action=DetailView", "Import XML","EcmSales", 'EcmSales');
if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmReports&action=RaportZamowien&return_module=EcmSales&return_action=DetailView", "Raport zamówień","EcmSales", 'EcmSales');
if(ACLController::checkAccess('EcmSales', "list", true)) $module_menu [] = Array("index.php?module=EcmSales&action=Report_ProductsBySales&return_module=EcmSales&return_action=DetailView", "Produkty na zamówieniach","EcmSales", 'EcmSales');
?>

View File

@@ -0,0 +1,223 @@
<?php
class ModuleFieldsParser {
var $modules;
var $name;
function ModuleFieldsParser($name = 'mfp') {
$this->modules = Array();
if(file_exists('modules/EcmSales/ModuleFieldsParser/config.php')) {
require_once('modules/EcmSales/ModuleFieldsParser/config.php');
$this->modules = $mfp_modules;
}
$this->name = $name;
}
function getModulesSelectOptions($fieldRealNames = false) {
global $app_list_strings;
$arr = array();
if(count($this->modules)>0) {
foreach($this->modules as $key => $value) {
if(isset($value['name']) && $value['name'] != '')
if(isset($app_list_strings['moduleList'][$value['name']]) && $app_list_strings['moduleList'][$value['name']] != '')
$value['name'] = $app_list_strings['moduleList'][$value['name']];
$arr[$key]['name'] = $value['name'];
$arr[$key]['fields'] = $this->getModuleFieldsSelectOptions($key,$fieldRealNames);
}
}
return $arr;
}
function getModuleFieldsSelectOptions($module,$fieldRealNames = false) {
global $beanList, $current_language, $GLOBALS;
$dict = null;
$file = 'cache/modules/'.$module.'/'.$beanList[$module].'vardefs.php';
if(file_exists($file)) {
include($file);
$dict = $GLOBALS['dictionary'][$beanList[$module]]['fields'];
}
else {
$file = 'modules/'.$module.'/vardefs.php';
if(file_exists($file)) { include($file); $dict = $dictionary[$beanList[$module]]['fields']; }
}
if($dict) {
$mod = return_module_language($current_language, $module);
$arr = array();
foreach($dict as $key => $value) {
$tmp = '$'.$this->modules[$module]['prefix'].$value['name'];
if(!$fieldRealNames)
$arr[$tmp] = ((isset($mod[$value['vname']]) && $mod[$value['vname']] != '') ? $mod[$value['vname']] : $value['name']);
else
$arr[$tmp] = $value['name'];
}
return $arr;
}
return array();
}
function getJS() {
$json = getJSONobj();
$js = '<script language="javascript">';
$js .= 'var '.$this->name.'_data = '.$json->encode($this->getModulesSelectOptions()).';';
$js .= 'function '.$this->name.'_loadModules() { var ms = document.getElementById("'.$this->name.'_module"); for(x in '.$this->name.'_data) { ms.options[ms.options.length] = new Option('.$this->name.'_data[x]["name"],x,false); }; }';
$js .= 'function '.$this->name.'_loadFields() { var ms = document.getElementById("'.$this->name.'_module"); var fs = document.getElementById("'.$this->name.'_fields"); while(fs.options.length>0) fs.remove(0); var fields = '.$this->name.'_data[ms.value]["fields"]; for(x in fields) fs.options[fs.options.length] = new Option(fields[x],x,false); fs.onchange(); };';
$js .= 'function '.$this->name.'_loadField() { var fs = document.getElementById("'.$this->name.'_fields"); var fe = document.getElementById("'.$this->name.'_field"); fe.value = fs.value; };';
$js .= $this->name.'_loadModules(); '.$this->name.'_loadFields(); '.$this->name.'_loadField();';
$js .= '</script>';
return $js;
}
function getFormHTML($smarty = false, $name = '') {
if($name != '') $this->name = $name;
$html = '
<span>
<select id="'.$this->name.'_module" name="'.$this->name.'_module" onChange="'.$this->name.'_loadFields();"></select>&nbsp;
<select id="'.$this->name.'_fields" name="'.$this->name.'_fields" onChange="'.$this->name.'_loadField()"></select>&nbsp;
<input id="'.$this->name.'_field" name="'.$this->name.'_field" value="" size="40">'
.($smarty ? '{literal}' : '').$this->getJS().($smarty ? '{/literal}' : '').
'</span>';
return $html;
}
function fillFocusToModules() {
foreach($this->modules as $key => $value) {
if((!isset($value['focus']) || $value['focus'] == '') && (isset($value['id']) && $value['id'] != '')) {
global $beanFiles, $beanList;
$path = $beanFiles[$beanList[$key]];
if(file_exists($path)) {
require_once($path);
$this->modules[$key]['focus'] = new $beanList[$key]();
$this->modules[$key]['focus']->format_all_fields();
}
}
}
}
function parseText($text) {
$this->fillFocusToModules();
$temp = $this->getModulesSelectOptions(true);
foreach($this->modules as $module => $arr) {
if(isset($arr['focus']) && $arr['focus']!='') {
foreach($temp[$module]['fields'] as $field => $value) {
//$text = str_replace($field,((isset($this->modules[$module]['focus']->$value) && $this->modules[$module]['focus']->$value != '')?$this->modules[$module]['focus']->$value:''),$text);
}
}
}
return $text;
}
};
?>

View File

@@ -0,0 +1,75 @@
<?php
global $app_list_strings;
$mfp_modules = Array(
'EcmSales' => array(
'name' => $app_list_strings['moduleList']['EcmSales'],
'prefix' => 'off_',
'id' => '',
'focus' => ''
),
'EcmDocumentTemplates' => array(
'name' => $app_list_strings['moduleList']['EcmDocumentTemplates'],
'prefix' => 'dt_',
'id' => '',
'focus' => ''
),
'Accounts' => array(
'name' => $app_list_strings['moduleList']['Accounts'],
'prefix' => 'acc_',
'id' => '',
'focus' => ''
),
'Contacts' => array(
'name' => $app_list_strings['moduleList']['Contacts'],
'prefix' => 'con_',
'id' => '',
'focus' => ''
),
'Users' => array(
'name' => $app_list_strings['moduleList']['Users'],
'prefix' => 'us_',
'id' => '',
'focus' => ''
),
);
?>

View File

@@ -0,0 +1,57 @@
<?php
function showDiscount($record) {
$db = $GLOBALS['db'];
$res = $db->fetchByAssoc($db->query("SELECT count(distinct discount) AS c FROM ecmsaleitems WHERE
ecmsale_id='$record'
AND discount!=0"));
if (isset($res['c']) && $res['c']>0)
return true;
else
return false;
}
function formatPDFPositions($positions, $focus) {
$result = array();
foreach ($positions as $pos) {
$pos['position'] = intval($pos['position'])+1;
$p = new EcmProduct();
$p -> retrieve($pos['product_id']);
$pos['ean'] = $p->ean;
$pos['ean2'] = $p->ean2;
$pos['image'] = $p->product_picture;
unset($p);
$c = new Currency();
$c->retrieve($focus->currency_id);
$pos['price_start']=format_number($pos['price_start']).' '.$c->symbol;
$pos['price_netto']=format_number($pos['price_netto']).' '.$c->symbol;
$pos['total_netto']=format_number($pos['total_netto']).' '.$c->symbol;
unset($c);
/*
if ($focus->ecmlanguage=='en_ussss') {
//get names
$db = $GLOBALS['db'];
$r = $db->fetchByAssoc($db->query("SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='".$pos['product_id']."' AND language='en'"));
$pos['name'] = $r['short_description'];
$lists = return_app_list_strings_language($focus->ecmlanguage);
$pos['unit_name'] = $lists['ecmproducts_unit_dom'][$pos['unit_id']];
unset($lists);
}
*/
$pos['discount'].='%';
$result[] = $pos;
}
return $result;
}

View File

@@ -0,0 +1,389 @@
<?php
$w = "30"; // first column width
$w3 = "30";
$w2 = "20"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_CONTENT_SALE_FOR'].'</b>
</td>
<td style="width: ' . $w3 . '%">
<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_NUMBER'].'
</td>
<td style="text-align: right">
<b>' . $focus->document_no . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'
</td>
<td style="text-align: right">
<b>' . $focus->register_date . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_DELIVERY_DATE'].'
</td>
<td style="text-align: right">
<b>' . $focus->delivery_date . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
$content.=', '.$focus->parent_address_country;
$content.='
</td>
<td style="width: ' . $w3 . '%">
'. $focus->shipping_address_postalcode . ' ' . $focus->shipping_address_city;
if (!is_null($focus->shipping_address_country) & $focus->shipping_address_country!='')
$content.=', '.$focus->shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].'
</td>
<td style="text-align: right">
<b>' . $user->full_name . '</b>
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
$nip = true;
}
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->shipping_nip) && $focus->shipping_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->shipping_nip;
$nip = true;
}
if (!is_null($focus->shipping_iln) && $focus->shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->shipping_iln;
}
$content.='
</td>
<td valign="top" style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].'
</td>
<td colspan="0" valign="top" style="text-align: right">
<b>' . $focus->parent_document_no . '</b>
</td>
</tr>';
$content.='
</table><br>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_POSITION'],
'align' => 'center'
);
if ($_REQUEST['show_img']=='1') {
$columns ['image'] = array (
'field' => array (
'image'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_IMAGE'],
'align' => 'center'
);
}
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_NAME'].'<br>'.$labels['LBL_PDF_CONTENT_LIST_CODE'],
'align' => 'left'
);
if ($_REQUEST ['show_ean'] == '1' || $_REQUEST ['show_ean2'] == '1' || $_REQUEST ['show_recipient_code'] == '1') {
$columns ['codes'] = array (
'align' => 'center'
);
$columns ['codes'] ['label'] = '';
if ($_REQUEST ['show_ean']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_EAN'].'<br>';
$columns ['codes'] ['field'] [] = 'ean';
}
if ($_REQUEST ['show_ean2']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_EAN2'].'<br>';
$columns ['codes'] ['field'] [] = 'ean2';
}
if ($_REQUEST ['show_recipient_code']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_RECIPIENT_CODE'];
$columns ['codes'] ['field'] [] = 'recipient_code';
}
$codes = true;
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_QTY'].'<br>'.$labels['LBL_PDF_CONTENT_LIST_UNIT'],
'align' => 'right'
);
if (showDiscount ( $record ) == true) {
$columns ['price_start'] = array (
'field' => array (
'price_start'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_START'],
'align' => 'right'
);
$columns ['discount'] = array (
'field' => array (
'discount'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_DISCOUNT'],
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_NETTO'],
'align' => 'right'
);
$discounts = true;
} else
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_NETTO'],
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_TOTAL_NETTO'],
'align' => 'right'
);
//set widths
$totals = array();
//1: no picture, no codes, no discounts
if ($_REQUEST['show_img']=='0' && $codes==false && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '45';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '20';
$columns['total_netto']['width'] = '20';
}
//2: no picture, codes, no discounts
else if ($_REQUEST['show_img']=='0' && $codes==true && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '40';
$columns['codes']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '15';
$columns['total_netto']['width'] = '15';
}
//3: no picture, no codes, discounts
else if ($_REQUEST['show_img']=='0' && $codes==false && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '40';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '12.5';
$columns['price_start']['width'] = '12.5';
$columns['discount']['width'] = '12.5';
$columns['total_netto']['width'] = '12.5';
}
//4: no picture, codes, discounts
else if ($_REQUEST['show_img']=='0' && $codes==true && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '30';
$columns['codes']['width'] = '15';
$columns['qty']['width'] = '7';
$columns['price_netto']['width'] = '8';
$columns['price_start']['width'] = '10';
$columns['discount']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//5: picture, no codes, no discounts
else if ($_REQUEST['show_img']=='1' && $codes==false && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '45';
$columns['image']['width'] = '20';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//6: picture, codes, no discounts
else if ($_REQUEST['show_img']=='1' && $codes==true && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '35';
$columns['codes']['width'] = '15';
$columns['image']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//7: pictures, codes, discounts
else if ($_REQUEST['show_img']=='1' && $codes==true && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '35';
$columns['codes']['width'] = '15';
$columns['image']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_start']['width'] = '10';
$columns['discount']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.5 solid black; background: rgb(233,233,233); width: '.$col['width'].'%;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
foreach ( $positions as $pos ) {
$content .= '<tr>';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if ($f == 'image') {
$content.='<img width="40px" src="modules/EcmProducts/upload/images/'.$pos['image'].'"/>';
} else {
if (!$pos[$f] || $pos[$f]=='') $pos[$f]='-';
$content .= $pos [$f] . '<br>';
}
}
$content .= '</td>';
}
$content .= '</tr>';
}
$content .= '
</tbody></table>
';
//summary table
//get currency symbol
$c = new Currency();
$c->retrieve($focus->currency_id);
$symbol = $c->symbol;
unset($c);
$content.='
<br><br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 215px; margin-left: 70%">
';
$content.='
<tr>
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
'.$labels['LBL_PDF_CONTENT_TOTAL_NETTO'].'
</td>
<td style="border: 0.5 solid black; text-align: right;">
'.format_number($focus->total_netto).' '.$symbol.'
</td>
</tr>
';
if ($focus->no_tax=='0') {
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v) {
$vats2 = explode(":", $v);
if ($vats2[0]=='') continue;
$content.='
<tr>
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
'.$vats2[0].'
</td>
<td style="border: 0.5 solid black; text-align: right;">
'.format_number($vats2[1]).' '.$symbol.'
</td>
</tr>
';
}
$content.='
<tr>
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
'.$labels['LBL_PDF_CONTENT_TOTAL_BRUTTO'].'
</td>
<td style="border: 0.5 solid black; text-align: right;">
'.format_number($focus->total_brutto).' '.$symbol.'
</td>
</tr>
';
}
$focus->pdf_text = str_replace(PHP_EOL, "<br>", $focus->pdf_text);
$content.='
</table>
<br><br>
'.$focus->pdf_text.'
';
//echo $content; die();

View File

@@ -0,0 +1,110 @@
<?php
$w = "62"; //first column width
$w2 = "12"; //second column width
//get bank information
$a = new Account();
$a->retrieve($focus->parent_id);
if ($a->document_bank_account == 'mbank') {
$ba_number = 'PL96114010100000548212001002';
$ba_name = 'MBANK';
$ba_swift = 'BREXPLPW';
} else {
if ($focus->currency_id=='6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'){
// eur
$ba_number = 'PL 36 1160 2202 0000 0000 6408 0587';
$ba_name = 'BANK MILLENIUM';
$ba_swift = 'BIGBPLPW';
}
if ($focus->currency_id=='98b2b752-b0be-37c2-d2eb-511e29f81cab'){
// usd
$ba_number = 'PL 49 1160 2202 0000 0000 6408 0741';
$ba_name = 'BANK MILLENIUM';
$ba_swift = 'BIGBPLPW';
}
}
unset($a);
$footer = '
<hr>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: '.$w.'%">
e5 Polska Sp. z o.o
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
</td>
<td style="text-align: right">
28207
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
ul. Wąwozowa 11
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
</td>
<td style="text-align: right">
PL 525-21-73-990
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
02-796 Warszawa
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
</td>
<td style="text-align: right">
016280234
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Tel: +48 (22) 228 20 90
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
</td>
<td style="text-align: right">
'.$ba_name.'
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Fax: +48 (56) 674 60 47
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
</td>
<td style="text-align: right">
'.$ba_number.'
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
'.$user->email1.'
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_SWIFT'].'</b>
</td>
<td style="text-align: right">
'.$ba_swift.'
</td>
</tr>
</table>
<br>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: 50%;">
{PAGENO}/{nb}
</td>
<td style="width: 50%; text-align: right">
<b>'.$focus->document_no.'</b>
</td>
</tr>
</table>
';

View File

@@ -0,0 +1,96 @@
<?php
$w = "62"; //first column width
$w2 = "12"; //second column width
//get bank information
$a = new Account();
$a->retrieve($focus->parent_id);
if ($a->document_bank_account == 'mbank') {
$ba_number = '26 1140 1010 0000 5482 1200 1001';
$ba_name = 'MBANK';
} else {
$ba_number = '35 1160 2202 0000 0000 6408 0411';
$ba_name = 'BANK MILLENIUM';
}
unset($a);
$footer = '
<hr>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: '.$w.'%">
e5 Polska Sp. z o.o
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_KRS'].'</b>
</td>
<td style="text-align: right">
28207
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
ul. Wąwozowa 11
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_NIP'].'</b>
</td>
<td style="text-align: right">
PL 525-21-73-990
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
02-796 Warszawa
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_REGON'].'</b>
</td>
<td style="text-align: right">
016280234
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Tel: +48 (22) 228 20 90
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK'].'</b>
</td>
<td style="text-align: right">
'.$ba_name.'
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
Fax: +48 (56) 674 60 47
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_BANK_ACCOUNT'].'</b>
</td>
<td style="text-align: right">
'.$ba_number.'
</td>
</tr>
<tr>
<td style="width: '.$w.'%">
'.$user->email1.'
</td>
<td style="width: '.$w2.'%">
<b>'.$labels['LBL_PDF_FOOTER_GIOS'].'</b>
</td>
<td style="text-align: right">
E0006254W
</td>
</tr>
</table>
<br>
<table style="width: 100%; font-size: 7pt;">
<tr>
<td style="width: 50%;">
{PAGENO}/{nb}
</td>
<td style="width: 50%; text-align: right">
<b>'.$focus->document_no.'</b>
</td>
</tr>
</table>
';

View File

@@ -0,0 +1,12 @@
<?php
$header = '
<table style="font-size: 7pt; width: 100%"><tr>
<td>
<img style="width: 150px;" src="modules/EcmSales/PDFTemplate/logo.png"/>
</td>
<td style="text-align: right; vertical-align: bottom;">
www.e5.pl
</td>
</tr></table>
<hr>
';

View File

@@ -0,0 +1,379 @@
<?php
$w = "30"; // first column width
$w3 = "30";
$w2 = "20"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td cellspan = "4" style="text-align: center">
<h2>Proforma</h2>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_CONTENT_SALE_FOR'].'</b>
</td>
<td style="width: ' . $w3 . '%">
<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_NUMBER'].'
</td>
<td style="text-align: right">
<b>' . $focus->document_no . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'
</td>
<td style="text-align: right">
<b>' . $focus->register_date . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_DELIVERY_DATE'].'
</td>
<td style="text-align: right">
<b>' . $focus->delivery_date . '</b>
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
'. $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
if (!is_null($focus->parent_address_country) & $focus->parent_address_country!='')
$content.=', '.$focus->parent_address_country;
$content.='
</td>
<td style="width: ' . $w3 . '%">
'. $focus->shipping_address_postalcode . ' ' . $focus->shipping_address_city;
if (!is_null($focus->shipping_address_country) & $focus->shipping_address_country!='')
$content.=', '.$focus->shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].'
</td>
<td style="text-align: right">
<b>' . $user->full_name . '</b>
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_nip;
$nip = true;
}
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->shipping_nip) && $focus->shipping_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->shipping_nip;
$nip = true;
}
if (!is_null($focus->shipping_iln) && $focus->shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->shipping_iln;
}
$content.='
</td>
<td valign="top" style="width: ' . $w2 . '%">
'.$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].'
</td>
<td colspan="0" valign="top" style="text-align: right">
<b>' . $focus->parent_document_no . '</b>
</td>
</tr>';
$content.='
</table><br>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_POSITION'],
'align' => 'center'
);
if ($_REQUEST['show_img']=='1') {
$columns ['image'] = array (
'field' => array (
'image'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_IMAGE'],
'align' => 'center'
);
}
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_NAME'].'<br>'.$labels['LBL_PDF_CONTENT_LIST_CODE'],
'align' => 'left'
);
if ($_REQUEST ['show_ean'] == '1' || $_REQUEST ['show_ean2'] == '1' || $_REQUEST ['show_recipient_code'] == '1') {
$columns ['codes'] = array (
'align' => 'center'
);
$columns ['codes'] ['label'] = '';
if ($_REQUEST ['show_ean']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_EAN'].'<br>';
$columns ['codes'] ['field'] [] = 'ean';
}
if ($_REQUEST ['show_ean2']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_EAN2'].'<br>';
$columns ['codes'] ['field'] [] = 'ean2';
}
if ($_REQUEST ['show_recipient_code']) {
$columns ['codes'] ['label'] .= $labels['LBL_PDF_CONTENT_LIST_RECIPIENT_CODE'];
$columns ['codes'] ['field'] [] = 'recipient_code';
}
$codes = true;
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_QTY'].'<br>'.$labels['LBL_PDF_CONTENT_LIST_UNIT'],
'align' => 'right'
);
if (showDiscount ( $record ) == true) {
$columns ['price_start'] = array (
'field' => array (
'price_start'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_START'],
'align' => 'right'
);
$columns ['discount'] = array (
'field' => array (
'discount'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_DISCOUNT'],
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_NETTO'],
'align' => 'right'
);
$discounts = true;
} else
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_PRICE_NETTO'],
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => $labels['LBL_PDF_CONTENT_LIST_TOTAL_NETTO'],
'align' => 'right'
);
//set widths
$totals = array();
//1: no picture, no codes, no discounts
if ($_REQUEST['show_img']=='0' && $codes==false && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '45';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '20';
$columns['total_netto']['width'] = '20';
}
//2: no picture, codes, no discounts
else if ($_REQUEST['show_img']=='0' && $codes==true && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '40';
$columns['codes']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '15';
$columns['total_netto']['width'] = '15';
}
//3: no picture, no codes, discounts
else if ($_REQUEST['show_img']=='0' && $codes==false && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '40';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '12.5';
$columns['price_start']['width'] = '12.5';
$columns['discount']['width'] = '12.5';
$columns['total_netto']['width'] = '12.5';
}
//4: no picture, codes, discounts
else if ($_REQUEST['show_img']=='0' && $codes==true && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '30';
$columns['codes']['width'] = '15';
$columns['qty']['width'] = '7';
$columns['price_netto']['width'] = '8';
$columns['price_start']['width'] = '10';
$columns['discount']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//5: picture, no codes, no discounts
else if ($_REQUEST['show_img']=='1' && $codes==false && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '45';
$columns['image']['width'] = '20';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//6: picture, codes, no discounts
else if ($_REQUEST['show_img']=='1' && $codes==true && $discounts==false) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '35';
$columns['codes']['width'] = '15';
$columns['image']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
//7: pictures, codes, discounts
else if ($_REQUEST['show_img']=='1' && $codes==true && $discounts==true) {
$columns['position']['width'] = '5';
$columns['name']['width'] = '35';
$columns['codes']['width'] = '15';
$columns['image']['width'] = '15';
$columns['qty']['width'] = '10';
$columns['price_start']['width'] = '10';
$columns['discount']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
}
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.5 solid black; background: rgb(233,233,233); width: '.$col['width'].'%;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
foreach ( $positions as $pos ) {
$content .= '<tr>';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if ($f == 'image') {
$content.='<img width="40px" src="modules/EcmProducts/upload/images/'.$pos['image'].'"/>';
} else {
if (!$pos[$f] || $pos[$f]=='') $pos[$f]='-';
$content .= $pos [$f] . '<br>';
}
}
$content .= '</td>';
}
$content .= '</tr>';
}
$content .= '
</tbody></table>
';
//summary table
//get currency symbol
$c = new Currency();
$c->retrieve($focus->currency_id);
$symbol = $c->symbol;
unset($c);
$content.='
<br><br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 215px; margin-left: 70%">
';
$content.='
<tr>
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
'.$labels['LBL_PDF_CONTENT_TOTAL_NETTO'].'
</td>
<td style="border: 0.5 solid black; text-align: right;">
'.format_number($focus->total_netto).' '.$symbol.'
</td>
</tr>
';
if ($focus->no_tax=='0') {
$content.='
<tr>
<td style="background: rgb(233,233,233); border: 0.5 solid black; width: 50%;">
'.$labels['LBL_PDF_CONTENT_TOTAL_BRUTTO'].'
</td>
<td style="border: 0.5 solid black; text-align: right;">
'.format_number($focus->total_brutto).' '.$symbol.'
</td>
</tr>
';
}
$focus->pdf_text = str_replace(PHP_EOL, "<br>", $focus->pdf_text);
$content.='
</table>
<br><br>
'.$focus->pdf_text.'
';
//echo $content; die();

View File

@@ -0,0 +1,120 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
// require_once('modules/EcmGroupSales/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once ('modules/EcmInsideOrders/EcmInsideOrder.php');
require_once ('include/time.php');
require_once ('include/json_config.php');
// add jquery
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/css/style.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-lastes.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery.tablesorter.pager.js"></script>';
echo '<script type="text/javascript"
src="modules/EcmSales/javascript/ProductSummary.js"></script>';
$json_config = new json_config ();
$focus = new EcmSale ();
$db = $GLOBALS ['db'];
$data = array();
$categoryArray=array();
$id_array= explode(",", $_GET['ids']) ;
//var_dump($id_array);
$where="and doc.id IN ('".implode("','",$id_array)."')";
if($_GET['product_group']=='1')$where.=" and pr.group_ks=1";
if($_GET['product_group']=='2')$where.=" and pr.group_ks=2";
if($_GET['product_group']=='3')$where.=" and pr.group_ks=3";
$query= "SELECT
pr.id,
item.code,
item.name,
ROUND(sum(item.quantity),0) AS quantity,
ROUND(ifnull(x.stock, 0),0) AS stock,
pr.group_ks,
pr.product_category_name,
pr.product_category_id
FROM
ecmsaleitems as item
INNER JOIN
ecmsales as doc ON doc.id=item.ecmsale_id
INNER JOIN
ecmproducts as pr ON pr.id=item.ecmproduct_id
LEFT JOIN
(SELECT sum(quantity) as stock ,product_id
FROM
ecmstockstates
GROUP BY product_id) x ON x.product_id=item.ecmproduct_id
WHERE doc.deleted='0' and doc.status!='s10' " . $where;
$query.=" AND NOT EXISTS
(
SELECT NULL
FROM ecmstockdocouts t1
WHERE t1.ecmsale_id = doc.id
) GROUP by item.ecmproduct_id
ORDER BY pr.group_ks DESC";
$rows = $db->query ($query);
while($r = $db->fetchByAssoc ( $rows ))
{
$row = array();
$row["id"] = $r["id"];
$row["code"] = $r["code"];
$row["name"] = $r["name"];
$row["quantity"] = $r["quantity"];
$row["stock"] = $r["stock"];
$row["product_category_name"]=$r["product_category_name"];
$row["group_ks"] = $r["group_ks"];
if($r["group_ks"]=='1')$daj='TH';
if($r["group_ks"]=='2')$daj='WG';
if($r["group_ks"]=='3')$daj='S';
$row["group_ks_name"] = $daj;
// get stock addresses
$result = $db->query("SELECT stock_address, is_not_full FROM ecmproducts_stock_addresses WHERE ecmproduct_id='".$r['id']."';");
$stock_addresses = "";
while($addr=$db->fetchByAssoc($result)) {
if ($addr['is_not_full'] == '1') {
$stock_addresses .= " <span style='color: red;'>".$addr['stock_address']."</span>";
} else {
$stock_addresses .= " ".$addr['stock_address'];
}
}
$row['stock_addresses'] = $stock_addresses;
array_push($row, $r);
$data [] = $row;
$total+=$r['quantity'];
$stock+=$r['stock'];
}
$data['quantity']=$total;
$data['stock']=$stock;
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmSales';
$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
$edit->ss->assign ( 'FOCUS', $focus);
$edit->ss->assign ( 'POST', $_POST);
$edit->ss->assign ( 'LINK', $link);
$edit->ss->assign ( 'IDS', $_GET['ids']);
$edit->ss->assign('POSITION_LIST',$data);
$edit->ss->assign ( 'MOD', $mod_strings);
$edit->ss-> display('modules/EcmSales/tpls/ProductSummary.tpl'); //4
// loading view
//echo '<link rel="stylesheet" type="text/css" href="modules/EcmInsideOrders/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
?>

View File

@@ -0,0 +1,66 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
global $app_list_strings;
ini_set('max_execution_time', 9999999999);
$months = array (
'01' => "Sty",
'02' => "Lut",
'03' => "Mar",
'04' => "Kwi",
'05' => "Maj",
'06' => "Cze",
'07' => "Lip",
'08' => "Sie",
'09' => "Wrz",
'10' => "Paź",
'11' => "Lis",
'12' => "Gru"
);
require_once ('include/time.php');
require_once ('include/json_config.php');
$json_config = new json_config ();
$db = $GLOBALS['db'];
$res = $db->query("SELECT
si.id as positionId, si.name as pName, si.code as pCode, si.quantity, si.total_netto, si.brand_label, si.description,
s.document_no, s.register_date, s.send_date, s.parent_name, s.status,
p.part_no as pSize, p.vendor_part_no as pKind /* <- :( */, p.brand
FROM ecmsaleitems as si
INNER JOIN ecmsales AS s on s.id = si.ecmsale_id
INNER JOIN ecmproducts AS p ON p.id = si.ecmproduct_id
WHERE s.status='s30' AND s.deleted=0");
$data = array();
while($r = $db->fetchByAssoc ( $res )) {
$item = array();
$item['documentNo'] = $r['document_no'];
$item['documentDate'] = $r['register_date'];
$item['sendDate'] = $r['send_date'];
$item['sendMonth'] = $months[date("m",strtotime($r['send_date']))];
$item['pName'] = $r['pName'];
$item['pCode'] = $r['pCode'];
$item['quantity'] = format_number($r['quantity']);
$item['totalNetto'] = format_number($r['total_netto']);
$item['description'] = $r['description'];
$item['aName'] = $r['parent_name'];
$item['status'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
$item['pSize'] = $r['pSize'];
$item['pKind'] = $r['pKind'];
$item['pBrand'] = $r['brand'];
$item['pLabel'] = $r['brand_label'];
$item['positionId'] = $r['positionId'];
$item['description'] = $r['description'];
array_push($data, $item);
}
$edit->ss = new Sugar_Smarty ();
$edit->ss->assign ( "data", $data );
$edit->module = 'EcmSales';
$edit->ss-> display('modules/EcmSales/tpls/Report_ProductsBySales.tpl');

146
modules/EcmSales/Save.php Normal file
View File

@@ -0,0 +1,146 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$json = getJSONobj();
require_once("modules/EcmSales/EcmSale.php");
require_once('include/formbase.php');
$focus = new EcmSale();
if(isset($_POST['record']) && $_POST['record'] != '') {
$focus->retrieve($_POST['record']);
}
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$check_notify = FALSE;
foreach($focus->column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
foreach($focus->additional_column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
//move edi filr
if ($focus->edi_file && $focus->edi_file!='') {
$dir = '/home/mz/edi/files/orders/';
if (file_exists($dir.$focus->edi_file)) //if exist
rename($dir.$focus->edi_file, $dir.'archive/'.$focus->edi_file); //move to archive
}
$focus->position_list = $json->decode(htmlspecialchars_decode($_POST['position_list']));
$focus->save($check_notify);
$return_id = $focus->id;
echo $return_id;
handleRedirect($return_id,'EcmSales');
?>

View File

@@ -0,0 +1,171 @@
<?php
require_once('modules/EcmSales/EcmSale.php');
$path = "/var/edi/e5/orders";
$folders = array('imported', 'temp', 'failed');
$allFiles = scandir($path);
if (is_array($allFiles)) {
foreach ($allFiles as $file) {
if (!is_dir($file) && !in_array($file, $folders) && substr($file, -3) == 'xml') {
try {
importSale($path . '/' . $file);
rename($path . '/' . $file, $path . '/imported/' . $file);
echo 'Import finished: ' . $file . PHP_EOL;
} catch (Exception $e) {
echo 'Import error ' . $e->getMessage(), PHP_EOL;
}
}
}
return;
}
function importSale($file)
{
$db = $GLOBALS['db'];
$xml = simplexml_load_file($file);
if (!$xml) {
throw new Exception("Can't load (or parse) XML");
}
$sale = new EcmSale();
// AUCHAN
$buyerILN = $xml->{'Order-Parties'}->Buyer->ILN;
if ($xml->{'Order-Parties'}->BuyerHeadquaters->ILN == '5900014000001') {
$buyerILN = $xml->{'Order-Parties'}->BuyerHeadquaters->ILN;
}
$buyer = $db->fetchByAssoc($db->query("
SELECT to_vatid, register_address_street, register_address_city, register_address_postalcode,
register_address_country, id, assigned_user_id, name,parent_id,
supplier_code, ecmpaymentcondition_id, ecmpaymentcondition_name, payment_date_days,
assigned_user_id, parent_id, payment_date_days, supplier_code
FROM accounts where iln like '" . $buyerILN . "' AND deleted=0"));
$isCarrefour = false;
if ($xml->{'Order-Parties'}->BuyerHeadquaters->ILN == '5900000930015') {
$isCarrefour = true;
}
$isMM = false;
if ($buyer['parent_id'] == '1249') {
$isMM = true;
}
$sale->parent_id = $buyer['id'];
$sale->parent_name = $buyer['name'];
$sale->parent_iln = $xml->{'Order-Parties'}->Buyer->ILN;
$sale->parent_nip = $buyer['to_vatid'];
$sale->parent_address_street = $buyer['register_address_street'];
$sale->parent_address_city = $buyer['register_address_city'];
$sale->parent_address_postalcode = $buyer['register_address_postalcode'];
$sale->parent_address_country = $buyer['register_address_country'];
$sale->parent_document_no = $xml->{'Order-Header'}->OrderNumber;
if ($isMM) {
$address = $db->fetchByAssoc(
$db->query(
"SELECT * FROM account_addresses WHERE account_id='$sale->parent_id' AND deleted='0' ORDER BY position LIMIT 1"
)
);
$sale->shipping_address_name = $address['name'];
$sale->shipping_addresses = $address['name'];
$sale->shipping_address_street = $address['street'];
$sale->shipping_address_city = $address['city'];
$sale->shipping_address_postalcode = $address['postalcode'];
$sale->shipping_address_country = $address['country'];
$sale->shipping_iln = $xml->{'Order-Parties'}->DeliveryPoint->ILN;
$sale->shipping_nip = "";
if ($buyer['payment_date_days'])
$sale->payment_date_days = $buyer['payment_date_days'];
if ($buyer['supplier_code'])
$sale->supplier_code = $buyer['supplier_code'];
} else {
$delivery = $db->fetchByAssoc($db->query("
SELECT to_vatid, register_address_street, register_address_city, register_address_postalcode,
register_address_country, id, assigned_user_id, name,parent_id,
supplier_code, ecmpaymentcondition_id, ecmpaymentcondition_name, payment_date_days
FROM accounts where iln like '" . $xml->{'Order-Parties'}->DeliveryPoint->ILN . "' AND deleted=0"));
$sale->shipping_address_name = $delivery['name'];
$sale->shipping_addresses = $delivery['name'];
$sale->shipping_address_street = $delivery['register_address_street'];
$sale->shipping_address_city = $delivery['register_address_city'];
$sale->shipping_address_postalcode = $delivery['register_address_postalcode'];
$sale->shipping_address_country = $delivery['register_address_country'];
$sale->shipping_iln = $xml->{'Order-Parties'}->DeliveryPoint->ILN;
$sale->shipping_nip = $delivery['to_vatid'];
if ($delivery['payment_date_days'])
$sale->payment_date_days = $delivery['payment_date_days'];
if ($delivery['supplier_code'])
$sale->supplier_code = $delivery['supplier_code'];
}
$sale->register_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->OrderDate));
$sale->delivery_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->ExpectedDeliveryDate));
$date = new DateTime(date("d.m.Y", strtotime($xml->{'Order-Header'}->OrderDate)));
if ($sale->payment_date_days != "") {
$date->modify("+" . $sale->payment_date_days . " day");
}
$sale->payment_date = $date->format("d.m.Y");
$sale->assigned_user_id = $buyer['assigned_user_id'];
$sale->edi_file = $file;
$sale->type = 'sales_order';
$sale->status = 's30';
$sale->ecmlanguage = 'pl_pl';
$sale->position_list = loadProducts($xml->{'Order-Lines'}->Line, $isCarrefour);
$sum_netto = 0;
$sum_brutto = 0;
foreach ($sale->position_list as $p) {
$sum_netto += $p['total_netto'];
$sum_brutto += $p['total_brutto'];
}
$sale->total_netto = $sum_netto;
$sale->total_brutto = $sum_brutto;
//$sale->save(false);
}
function loadProducts($products, $isCarrefour = false)
{
$db = $GLOBALS['db'];
$counter = 0;
foreach ($products as $prod) {
if ($isCarrefour) {
$pId = $db->fetchByAssoc($db->query("select p.id from ecmproducts as p where TRIM(p.ean2)='" . trim($prod->{'Line-Item'}->EAN) . "' and p.deleted='0'"));
} else {
$pId = $db->fetchByAssoc($db->query("select p.id from ecmproducts as p where (TRIM(p.ean)='" . trim($prod->{'Line-Item'}->EAN) . "' OR TRIM(p.ean2)='" . trim($prod->{'Line-Item'}->EAN) . "') and p.deleted='0'"));
}
$p = new EcmProduct();
$p->retrieve($pId['id']);
$response[$counter]['product_id'] = $p->id;
$response[$counter]['position'] = (string) $prod->{'Line-Item'}->LineNumber;
$response[$counter]['product_code'] = $p->code;
$response[$counter]['name'] = $p->name;
$response[$counter]['quantity'] = (string) $prod->{'Line-Item'}->OrderedQuantity;
$response[$counter]['price_start'] = (string) $prod->{'Line-Item'}->OrderedUnitNetPrice;
$response[$counter]['price_netto'] = (string) $prod->{'Line-Item'}->OrderedUnitNetPrice;
$response[$counter]['discount'] = 0;
$response[$counter]['total_netto'] = (string) $prod->{'Line-Item'}->OrderedUnitNetPrice * $prod->{'Line-Item'}->OrderedQuantity;
$response[$counter]['unit_id'] = 1;
$response[$counter]['unit_name'] = 'szt.';
$response[$counter]['ecmvat_id'] = $p->vat_id;
$response[$counter]['ecmvat_name'] = $p->vat_name;
$response[$counter]['ecmvat_value'] = $p->vat_value;
$response[$counter]['recipient_code'] = (string) $prod->{'Line-Item'}->BuyerItemCode;
$response[$counter]['product_ean'] = (string) trim($prod->{'Line-Item'}->EAN);
$counter++;
}
return $response;
}
function brecho($msg)
{
echo '<br><br>';
var_dump($msg);
echo '<br><br>';
}

View File

@@ -0,0 +1,34 @@
<H2>Masowa zmiana statusu dokumentów </H2>
<form method="post" action="index.php">
<input type="hidden" value="change_status" name="action">
<input type="hidden" value="EcmSales" name="module">
<?php
global $app_list_strings;
if(count($_REQUEST['mass'])>0){
foreach ($_REQUEST['mass'] as $id){
?>
<input value="<?php echo $id;?>" type="hidden" name="selected[]">
<?php
}
}
?>
Wybierz status: <select name="status">
<?php
foreach ($app_list_strings['ecmsales_status_dom'] as $key=>$value){
?>
<option value="<?php echo $key;?>"><?php echo $value;?></option>
<?php
}
?>
<input type="submit" value="Zmień status">
</select>
</form>
<?php
if(count($_REQUEST['selected'])>0){
$db=$GLOBALS['db'];
foreach ($_REQUEST['selected'] as $id){
$db->query("update ecmsales set status='".$_POST['status']."' where id='".$id."'");
}
header("Location: index.php?module=EcmSales&action=index");
}
?>

View File

@@ -0,0 +1,35 @@
<?php
error_reporting(0);
set_time_limit (99999999);
ini_set('memory_limit', '-1');
include_once("modules/EcmProducts/productCardUltraNew.php");
include_once("include/MPDF57/mpdf.php");
$p=new mPDF('utf-8','A4-L', null, 'helvetica');
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select c.iso4217 as s from currencies as c inner join ecmsales as q on q.currency_id=c.id where q.id='".$_REQUEST['record']."'"));
$symbol=$rr['s'];
$db = $GLOBALS['db'];
$focus = new EcmSale();
$focus->retrieve($_REQUEST['record']);
if ($focus->ecmlanguage=='pl_pl')
$lang = "pl";
if ($focus->ecmlanguage=='en_us')
$lang = "en";
$products = $db->query("SELECT id,ecmproduct_id FROM ecmsaleitems WHERE ecmsale_id='".$_REQUEST['record']."' AND deleted='0' ORDER BY position");
while ($prod = $db->fetchByAssoc($products)) {
$p=productCardNew($p,$prod['ecmproduct_id'],$lang,true,true,"",$symbol,true, $_REQUEST['show_ean'], $prod['id'], "EcmSales");
}
if($_REQUEST['create_img']==1){
$guid=create_guid();
$type="F";
$file="cache/upload/Catalogue".$guid.".pdf";
}
else{
$type="D";
$file="Catalogue".date("YmdHi").".pdf";
}
$p->Output($file,$type);

View File

@@ -0,0 +1,74 @@
<?php
// changed mz 2014-12-13
// auto create PDF only when action=createPDF are not empty
// otherise wait from function call
$type = isset($_REQUEST['file'])?'FILE':'BROSWER';
if ($_REQUEST['action']=='createPDF')
createEcmSalePdf($_REQUEST['record'], $type);
// outputtype:
// BROSWER - open doc in broswer - return true if OK
// FILE - save in uploads \
// EMAIL - save in emails temp dir > return file path if OK
// MULTIPDF - save in MultiPdf temp dir /
function createEcmSalePdf($record, $outputtype) {
include_once("modules/EcmSales/PDFTemplate/helper.php");
$focus = new EcmSale();
$focus -> retrieve($record);
$positions = formatPDFPositions($focus->getPositionList(true), $focus);
$user = new User();
$user -> retrieve($focus->assigned_user_id);
include_once("include/MPDF57/mpdf.php");
$p=new mPDF('','A4', null, 'helvetica', 10,10,30,45,5,5);
$p->mirrorMargins = 1;
//get languages
$labels = return_module_language($focus->ecmlanguage, 'EcmSales');
//get header
$header = '';
include("modules/EcmSales/PDFTemplate/tpl/header.php");
$p->SetHTMLHeader($header);
//get footer
$footer = '';
include("modules/EcmSales/PDFTemplate/tpl/footer-".$focus->ecmlanguage.".php");
$p->SetHTMLFooter($footer);
//get content
$content = '';
if ($_REQUEST['pdf_type']=='2')
include("modules/EcmSales/PDFTemplate/tpl/proforma-content.php");
else
include("modules/EcmSales/PDFTemplate/tpl/content.php");
//$p->WriteHTML($style);
$p->WriteHTML($content);
switch ($outputtype) {
case "BROSWER" :
$p->Output ();
return true;
case "FILE" :
$path = 'upload/zs_' . $focus->number . '.pdf';
break;
case "EMAIL" :
include_once 'include/ECM/EcmSendMail/EcmSendMail.inc';
$path = EcmSendMail::TEMP_DIR . 'ZS_' . $focus->number . '.pdf';
break;
case "MULTIPDF" :
include_once 'include/ECM/EcmMultiPdf/EcmMultiPdf.inc';
$path = EcmMultiPdf::TEMP_DIR . 'EcmSales_' . $focus->id. '_' . create_guid() . '.pdf';
break;
};
echo $p->Output ($path, "F" );
return $path;
}

View File

@@ -0,0 +1,205 @@
<?php
error_reporting(E_ALL);
set_time_limit(999999);
include_once("modules/EcmSales/EcmSale.php");
include_once("modules/EcmDocumentTemplates/EcmDocumentTemplate.php");
$q=new EcmSale();
$q->retrieve($_REQUEST['record']);
require_once('modules/EcmTexts/EcmText.php');
if(isset($q->ecmlanguage) && $q->ecmlanguage != '') {
$data = EcmText::LoadText(null,null,"EcmSales",$q->ecmlanguage);
if(isset($data[0]) && isset($data[0]['data']) && isset($data[0]['data']['labels'])) {
$data = $data[0]['data']['labels'];
foreach($data as $key => $value) {
$mod_strings[$value['label']] = $value['translation'];
}
}
}
$t=new EcmDocumentTemplate();
$t=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$q->template_id."'"));
set_include_path('include/PHPExcel/');
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("E5 CRM");
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
$objPHPExcel->getProperties()->setTitle("Office 2007 QUOTE");
$objPHPExcel->getProperties()->setSubject("Office 2007 QUOTE");
$objPHPExcel->getProperties()->setDescription("QUOTE");
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$t->footer_text=str_replace("/$dt_account_name",$t['account_name'],$t['footer_text']);
$ftt=explode("
",$t['footer_text']);
foreach($ftt as $ft){
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ft);
}
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A1',$t['account_name']);
$i+=2;
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_QUOTE_FOR']);
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_NUMBER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$q->parent_name);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->document_no);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_DATE_REGISTER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->register_date);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_OWNER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->assigned_user_name);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setSize(24);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$q->name);
$i+=2;
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"A".$i.":G".$i
);
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('B'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('D'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('E'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_LIST_POSITION']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$mod_strings['LBL_PDF_LIST_CODE']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$mod_strings['LBL_PDF_LIST_DESCRIPTION']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$mod_strings['LBL_PDF_LIST_QUANTITY']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$mod_strings['LBL_PDF_LIST_UNIT']);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_LIST_PRICE']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_LIST_TOTAL']);
$ii++;
$i++;
//$lv=return_app_list_strings_language($this->ecmlanguage);
$ww=$GLOBALS['db']->query("select * from ecmsaleitems where ecmsale_id='".$q->id."' and deleted='0'");
while($p=$GLOBALS['db']->fetchByAssoc($ww)){
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position='0'");
if(mysql_num_rows($w)>0){
$r=$GLOBALS['db']->fetchByAssoc($w);
$p_name=$r['name'];
$p_code=$r['code'];
}
else {
$p_name=$p['name'];
$p_code=$p['code'];
}
$total_netto+=$p['price']*$p['quantity'];
$total_vat+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
$vats[$p['ecmvat_value']]+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
if($q->show_ean)$p_code.='
'.$p['ean'];
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ii);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$p_code);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$p_name);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$p['quantity']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$p['dd_unit_id']]);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$p['price']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$p['total']);
if($p['ecmproduct_id']){
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position>0 order by name asc");
if(mysql_num_rows($w)>0){
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,"+");
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$r['code']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$r['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$r['quantity']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$r['dd_unit_id']]);
}
$i++;
}
}
$i++;
$ii++;
}
$sumary_start=$i;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_TOTAL']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$total_netto);
foreach($vats as $k=>$v){
$i++;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_VAT']." (".$k."%)");
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$v);
}
$i++;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_END_TOTAL']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,($total_netto+$total_vat));
$summary_end=$i;
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"F".$sumary_start.":G".$summary_end
);
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
chmod("cache/upload",0777);
$microtime=str_replace(".","",str_replace(" ","",microtime()));
$name="cache/upload/Quote".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,16 @@
<?php
$db=$GLOBALS['db'];
global $current_user;
if($current_user->fetched_row['delete_zs']==1){
if($_REQUEST['mass']){
foreach ($_REQUEST['mass'] as $id){
$db->query("update ecmsales set deleted=1 where id='".$id."'");
}
}
}
header("Location index.php?module=EcmSales&action=index");
?>

180
modules/EcmSales/import.php Normal file
View File

@@ -0,0 +1,180 @@
<?php
mysql_connect('localhost','root','5z#JaL');
mysql_select_db('crm');
// compare tables
$db = $GLOBALS['db'];
$query=$db->query("describe ecmsaleitems");
$fields=array();
while($r = $db->fetchByAssoc($query)){
$fields[]=$r;
}
var_dump($fields);
$query2=$db->query("describe ecmsaleitems");
$fields2=array();
while($r = $db->fetchByAssoc($query2)){
$fields2[]=$r;
}
echo "<table><tr><td>Nazwa pola1</td><td>Nazwa pola2</td>";
for($i=0;$i<count($fields2);$i++){
echo "<tr><td>".$fields[$i]['Field']."</td><td>".$fields2[$i]['Field']."</td></tr>";
}
echo "</table>";
// dodawanie itemkow
$query2=$db->query("select items.*,doc.currency_id,doc.currency_value from ecmsaleitems as items
join ecmsales as doc on doc.id=items.ecmsale_id");
$fields2=array();
global $app_list_strings;
while($r = $db->fetchByAssoc($query2)){
if($r['currency_id']!='PLN'){
$r['price_brutto']=$r['price'];
$r['total_brutto']=$r['total'];
} else {
$r['price_brutto']=round($r['price']+($r['price']*($r['ecmvat_value']/100)),2);
$r['total_brutto']=round($r['total']+($r['total']*($r['ecmvat_value']/100)),2);
}
$db->query("INSERT INTO ecmsaleitems VALUES(
'".$r['id']."'
,'".$r['date_entered']."'
,'".$r['date_modified']."'
,'".$r['modified_user_id']."'
,'".$r['assigned_user_id']."'
,'".$r['created_by']."'
,'".$r['deleted']."'
,'".$r['ecmsale_id']."'
,'".$r['ecmproduct_id']."'
,'".$r['position']."'
,'".$r['code']."'
,'".$r['name']."'
,'".$r['quantity']."'
,'".$r['price']."'
,'".$r['price']."'
,'".$r['price_brutto']."'
,'".$r['discount']."'
,'".$r['total']."'
,'".$r['total_brutto']."'
,'".$r['dd_unit_id']."'
,'".$r['dd_unit_name']."'
,'".$r['ecmvat_id']."'
,'".$r['ecmvat_name']."'
,'".$r['ecmvat_value']."'
,'".$r['ecmproductcategory_id']."'
,'".$r['recipient_code']."')");
}
$db = $GLOBALS['db'];
$query=$db->query("describe ecmsales");
$fields=array();
while($r = $db->fetchByAssoc($query)){
$fields[]=$r;
}
// var_dump($fields);
$query2=$db->query("describe ecmsales");
$fields2=array();
while($r = $db->fetchByAssoc($query2)){
$fields2[]=$r;
}
echo "<table><tr><td>Nazwa pola1</td><td>Nazwa pola2</td>";
for($i=0;$i<count($fields2);$i++){
echo "<tr><td>".$fields[$i]['Field']."</td><td>".$fields2[$i]['Field']."</td></tr>";
}
echo "</table>";
$query2=$db->query("select * from ecmsales");
$fields2=array();
$po = new EcmSale();
echo "<pre>";
while($r = $db->fetchByAssoc($query2)){
$po->retrieve($r['id']);
// echo $r['id'];
$position_list=$po->getPositionList(true);
$vat=$po->calculate($position_list);
$vats_summary='';
foreach($vat as $key=>$v){
if($key=='vats'){
foreach($v as $k2=>$v2){
$vv=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name,value from ecmvats where id='".$k2."'"));
echo $k2;
$vats_summary.=$vv['name'].':'.$v2.',';
}
}
if($key=='total'){
$r['total']=$v;
}
if($key=='subtotal'){
$r['subtotal']=$v;
}
}
if($r['currency_id']!='PLN'){
$r['total']=$r['subtotal'];
}
// var_dump($vat);
if($r['end_date']=='')$r['end_date']=null;
$db->query("INSERT INTO ecmsales VALUES(
'".$r['id']."'
,'".$r['name']."'
,'".$r['description']."'
,'".$r['date_entered']."'
,'".$r['date_modified']."'
,'".$r['modified_user_id']."'
,'".$r['assigned_user_id']."'
,'".$r['created_by']."'
,'".$r['deleted']."'
,'".$r['number']."'
,'".$r['document_no']."'
,'".$r['parent_type']."'
,'".$r['parent_name']."'
,'".$r['parent_id']."'
,'".$r['type']."'
,'".$r['status']."'
,'".$r['register_date']."'
,'".$r['validtill_date']."'
,'".$r['parent_address_street']."'
,'".$r['parent_address_city']."'
,'".$r['parent_address_postalcode']."'
,'".$r['parent_address_country']."'
,'".$r['subtotal']."'
,'".$r['total']."'
,'".$r['discount']."'
,'".$vats_summary."'
,'".$r['to_vatid']."'
,'".$r['to_vatid']."'
,'".$r['ecmlanguage']."'
,'".$r['to_is_vat_free']."'
,'".$r['footer_text']."'
,'".$r['contact_id']."'
,'".$r['ecmpaymentcondition_id']."'
,'".$r['ecmpaymentcondition_text']."'
,'".$r['ecmdeliverycondition_id']."'
,'".$r['ecmdeliverycondition_text']."'
,'".$r['ecmpricebook_id']."'
,'".$r['currency_id']."'
,'".$r['parent_document_no']."'
,'".$r['delivery_date']."'
,''
,'".$r['parent_shipping_address_name']."'
,'".$r['parent_shipping_address_street']."'
,'".$r['parent_shipping_address_city']."'
,'".$r['parent_shipping_address_postalcode']."'
,'".$r['parent_shipping_address_country']."'
,'')");
}
?>

View File

@@ -0,0 +1,39 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
require_once ('modules/EcmSales/readXML.php');
$smarty = new Sugar_Smarty ();
$smarty->module = 'EcmSales';
global $mod_strings;
//get orders
$folders = array('archive', 'temp', 'confirm');
$edi_orders = array();
$dir="/home/mz/edi/files/orders";
if(is_dir($dir)){
if($dh=opendir($dir)){
while (($file = readdir($dh))!==false){
if(!is_dir($file) && !in_array($file, $folders)) {
$reader = new readXML();
$tmp = array();
$tmp['file'] = $file;
$tmp['name'] = $reader->loadAccount($file);
$edi_orders[] = $tmp;
unset($tmp);
unset($reader);
}
}
closedir($dh);
}
}
$smarty->assign('EDI_ORDERS', $edi_orders);
$smarty->assign ( 'MOD', $mod_strings);
$smarty-> display('modules/EcmSales/tpls/importXML.tpl');
?>

View File

@@ -0,0 +1 @@
<?php require_once('modules/EcmSales/javascript/helper.php');

View File

@@ -0,0 +1,169 @@
//START:
$(document).ready(
function() {
// confirm exit
window.onbeforeunload = confirmExit;
// prevent submit by enter press
lockEnter();
// parent info
$('#parent_id').on(
'inputchange',
function() {
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), $(
"#parent_type :selected").val());
}, 1000);
});
// categories
getCategoriesList();
// its vat free change
$("#no_tax").change(function() {
// calculate totals
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 -
// thead row
for (var index = 0; index != count; index++)
calculateRow(index);
});
$("#delivery_date").on('inputchange', function() {
calculateDate($("#delivery_date").val());
});
if ($("#type").val() == 'interval_order') {
addToValidate('EditView', 'sale_date_interval', 'id', 'true',
'');
}
$("#type")
.change(
function() {
if ($("#type").val() == 'interval_order') {
addToValidate('EditView',
'sale_date_interval', 'id', 'true',
'');
} else {
removeFromValidate('EditView',
'sale_date_interval');
}
});
// language channge
$("#ecmlanguage").change(function() {
changeLanguage();
});
$("#stock").change(function() {
$("#stock_id").val(($("#stock :selected").val()));
});
// searchProductInput change
$('#searchProductsInput').keyup(function(e) {
if (e.keyCode == 13) {
searchProducts();
}
});
DrawHeaders();
if (($("#new_number").val() == true)
&& ($("#duplicate").val() != true)
&& ($("#ecmquote").val() != true)) {
generateNumber();
// set stock "Magazyn główny
$("#stock option[value=c7afd71a-4c3a-bde4-138d-4acaee1644e4]")
.attr('selected', 'selected');
$("#stock_id").val("c7afd71a-4c3a-bde4-138d-4acaee1644e4");
// remove empty stock
$("#stock option[value='']").remove();
// sale from subpanel??
if ($("#parent_id").val() != '') {
$(".loading_panel").css("display", "block");
setTimeout(function() {
getParentInfo($("#parent_id").val(), $(
"#parent_type :selected").val());
}, 1000);
if ($("#edi_file").val() != '') {
getItemsFromEdi();
}
}
} else if (($("#new_number").val() == true)
&& ($("#duplicate").val() == true)) {
generateNumber();
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
} else if (($("#new_number").val() == true)
&& ($("#ecmquote").val() == true)) {
console.log('asdas');
generateNumber();
getParentInfo($("#parent_id").val(), 'Accounts');
getItemsFromQuote();
} else {
getParentInfo($("#parent_id").val(),
$("#parent_type :selected").val());
getItems();
}
// handle setItems
setITEMS = function() {
var formname = 'EditView';
if (check_form_(formname) == true) {
SetTab('ITEMS');
}
};
});
// handle save
var check_form_ = check_form;
check_form = function(formname) {
if (new Date().getFullYear() != $("#register_date").val().slice(-4)) {
alert("Data dokumentu musi zawierać aktualny rok.");
}
window.onbeforeunload = null;
if (items.length == 0) {
alert("Brak produktów");
return false;
}
if (items.length == 0) {
result = validateDate();
if (result == true) {
alert("Data wysyłki nie może być późniejsza niż data dostawy!");
return false;
}
}
$(".loading_panel").css("display", "block");
// calculate totals
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
for (var index = 0; index != count; index++) {
calculateRow(index);
if (validation.recipient_code == true)
console.log('Sprawdzić kody trzeba');
}
$("#total_netto").val($("#t_netto").val());
$("#total_brutto").val($("#t_brutto").val());
$("#discount").val($("#disc").val());
$("#position_list").val(JSON.stringifyNoSecurity(items));
if (check_form_(formname) == false) {
window.onbeforeunload = confirmExit;
$(".loading_panel").css("display", "none");
return false;
} else {
return true;
}
};
function confirmExit() {
return "";
}
function lockEnter() {
// prevent default
$(window).keydown(function(event) {
if (event.keyCode == 13 && $(":focus").prop('tagName') != 'TEXTAREA') {
event.preventDefault();
return false;
}
});
}

View File

@@ -0,0 +1,7 @@
//START:
$(document).ready(
function() {
DrawHeaders();
getItems(false);
});

View File

@@ -0,0 +1,198 @@
function createMultiPdf() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
'font-weight': 'bold',
'font-size': '16px',
color: '#fff',
},
message: "Trwa generowanie pliku..."
});
var docs = new Array();
jQuery.each(sel, function(key, val) {
tmp = {};
tmp['module'] = 'EcmSales';
tmp['record'] = val;
docs.push(tmp);
});
EcmMultiPdf_create(docs);
}
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
if($('#idss').val()!=""){
window.open('index.php?module=EcmSales&action=ProductSummary&ids='+$('#idss').val());
} else {
alert("Proszę zaznaczyć chociaż jedną pozycje!");
}
}
function getList2() {
if($('#idss').val()!=""){
window.open('index.php?module=EcmSales&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
} else {
alert("Proszę zaznaczyć chociaż jedną pozycje!");
}
}
function getList3() {
if($('#idss').val()!=""){
window.open('index.php?module=EcmSales&action=ComponentsList&ids='+$('#idss').val());
} else {
alert("Proszę zaznaczyć chociaż jedną pozycje!");
}
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
/*
$('.tablesorter').tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
2: {
sorter: 'rangesort'
},
3: {
// disable it by setting the property sorter to false
sorter: false
},
7: {
sorter: 'rangesorttota'
},
8: {
sorter: 'rangesorttotav'
},
9: {
sorter: 'rangesorttotan'
},
10: {
sorter: 'rangesorttotai'
}
}
});
*/
});

View File

@@ -0,0 +1,171 @@
function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmSales&amp;action=productsSummaryList&amp;to_pdf=1&amp;ids='+$('#idss').val());
}
$(document).ready(function()
{
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall2').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall3').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
$("#myTable").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable2").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
$("#myTable3").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Kod',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][1] = {'name' : 'brand_label', 'type': 'hidden',};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : '',
'label' : 'Ilość<br>Na magazynie',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : 'quantity', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[3]['content'][1] = {'name' : 'stock_state','style':'color:blue;text-align: right; font-style: italic;', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>początkowa',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total
//begin: recipient_code
columns[10] = {
'name' : 'recipient_code',
'label' : 'Kod Odbiorcy',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[10]['content'][0] = {'name' : '', 'type': 'text'};
//end: recipient_code

View File

@@ -0,0 +1,124 @@
columns = new Array();
//define columns
//begin: number
columns[0] = {
'name' : 'number',
'label' : 'Lp.',
'width' : 4,
'content' : new Array(),
};
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
//end: number
//begin: code
columns[1] = {
'name' : 'product_',
'label' : 'Kod',
'width' : 6,
'content' : new Array(),
};
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
columns[1]['content'][1] = {'name' : 'brand_label', 'type': 'hidden',};
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
//end: code
//begin: name
columns[2] = {
'name' : 'name',
'label' : 'Nazwa',
'width' : 20,
'content' : new Array(),
};
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
//end: name
//begin: quantity
columns[3] = {
'name' : '',
'label' : 'Ilość<br>Na magazynie',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : 'quantity', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[3]['content'][1] = {'name' : 'reservation', 'type': 'text', 'readonly':true,'style':'text-align:right;color:blue; font-style: italic','isNumber' : true, 'onChange' : 'checkReservation($(this).parent(\'td\').parent(\'tr\').index()); calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: quantity
//begin: unit
columns[4] = {
'name' : 'unit_',
'label' : 'J.M.',
'width' : 5,
'content' : new Array(),
'align' : 'center',
};
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
//end: unit
//begin: price_start
columns[5] = {
'name' : 'price_start',
'label' : 'Cena<br>początkowa',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
//end: price_start
//begin: discount
columns[6] = {
'name' : 'discount',
'label' : 'Upust (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
//end: discount
//begin: price_netto
columns[7] = {
'name' : 'price_netto',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: price_start
//begin: ecmvat
columns[8] = {
'name' : 'ecmvat_',
'label' : 'VAT (%)',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
//end: ecmvat
//begin: total
columns[9] = {
'name' : 'total_',
'label' : 'Wartość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
//end: total
//begin: recipient_code
columns[10] = {
'name' : 'recipient_code',
'label' : 'Kod Odbiorcy',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[10]['content'][0] = {'name' : '', 'type': 'text'};
//end: recipient_code
//begin: options
columns[11] = {
'name' : 'options',
'label' : 'Opcje',
'width' : 3,
'content' : new Array(),
};

View File

@@ -0,0 +1,354 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('-1');
if (!$_POST['job'] || $_POST['job']=='') die ('-1');
switch ($_POST['job']) {
case 'getParentInfo': getParentInfo($_POST['id'], $_POST['type']); break;
case 'generateNumber': generateNumber(); break;
case 'searchProducts': searchProducts($_POST['searchKey'], $_POST['searchCategory'], $_POST['searchStock'], $_POST['searchSort'], $_POST['searchStockId']); break;
case 'getProduct': getProduct($_POST['id'], $_POST['pricebook'], $_POST['account_id'], $_POST['language']); break;
case 'getItems': getItems($_POST['record']); break;
case 'getItemsFromEdi': getItemsFromEdi($_POST['record']); break;
case 'getItemsFromQuote': getItemsFromQuote($_POST['record']); break;
case 'getCategoriesList': getCategoriesList(); break;
case 'getTranslation': getTranslation($_POST['product_id'], $_POST['language'], $_REQUEST['unit_id']); break;
case 'getPricesInfo': getPricesInfo($_POST['product_id'], $_POST['pricebook_id'], $_POST['account_id']); break;
case 'getStockArray' : getStockArray($_POST['product_id']); break;
case 'getPurchaseArray' : getPurchaseArray($_POST['product_id']); break;
case 'calculateDate' : calculateDate($_POST['date']); break;
case 'validateDate' : validateDate($_POST['date'],$_POST['date2']); break;
case 'saveSaleItemDescription' : saveSaleItemDescription($_POST['saleItemId'], $_POST['description']); break;
}
function calculateDate($date){
$date = new Datetime($date);
$date->modify('-1 day');
$tmp['date']=$date->format("d.m.Y");
echo json_encode($tmp);
return '';
}
function validateDate($date,$date2){
$date = new Datetime($date);
$date2= new Datetime($date2);
if($date>$date2){
echo json_encode(['error'=>true]);
} else {
echo json_encode(['error'=>false]);
}
return '';
}
function getParentInfo($id, $type) {
if (!$id || $id == '') die('-1');
$a = new Account();
$a->retrieve($id);
$data = array();
$data['name'] = $a->name;
$data['parent_nip'] = $a->to_vatid;
$data['parent_address_street'] = $a->billing_address_street;
$data['parent_address_postalcode'] = $a->billing_address_postalcode;
$data['parent_address_city'] = $a->billing_address_city;
$data['parent_address_country'] = $a->billing_address_country;
$data['invoice_type'] = $a->invoice_type;
$data['currency_id'] = $a->currency_id;
$data['iln'] = $a->iln;
$data['parent_supplier_code'] = $a->supplier_code;
if ($a->ecmpaymentcondition_id && $a->ecmpaymentcondition_id!='') {
$pc = new EcmPaymentCondition();
$pc->retrieve($a->ecmpaymentcondition_id);
$data['ecmpaymentcondition_id'] = $pc->id;
$data['ecmpaymentcondition_name'] = $pc->name;
}
if ($a->ecmdeliverycondition_id && $a->ecmdeliverycondition_id!='') {
$pc = new EcmdeliveryCondition();
$pc->retrieve($a->ecmdeliverycondition_id);
$data['ecmdeliverycondition_id'] = $pc->id;
$data['ecmdeliverycondition_name'] = $pc->name;
}
if ($a->ecmprice_id && $a->ecmprice_id!='') {
$pr = new EcmPrice();
$pr->retrieve($a->ecmprice_id);
$data['ecmprice_id'] = $pr->id;
$data['ecmprice_name'] = $pr->name;
}
//get pricebooks, ownership pricebooks
$pricebooks = array();
$db=$GLOBALS['db'];
$res = $db->query("SELECT id, name FROM ecmpricebooks WHERE account_id IN ('".$a->id."','".$a->parent_id."') AND active='1' AND deleted='0'");
while ($row = $db->fetchByAssoc($res)) {
$tmp = array();
$tmp['id'] = $row['id'];
$tmp['name'] = $row['name'];
$pricebooks[] = $tmp;
unset($tmp);
}
$data['pricebooks'] = $pricebooks;
//document validation fields
$data['document_recipient_code'] = $a->document_recipient_code;
$data['document_parent_order_no'] = $a->document_parent_order_no;
$data['document_delivery_address'] = $a->document_delivery_address;
$data['document_parent_iln'] = $a->document_parent_iln;
$data['document_shipping_iln'] = $a->document_shipping_iln;
$data['document_parent_nip'] = $a->document_parent_nip;
$data['document_shipping_nip'] = $a->document_shipping_nip;
//delivery addresses && ownership addresses
$addresses = array();
//delivery
$delivery = $a->getPositionList(true);
foreach ($delivery as $d) {
$address = array();
$address['name'] = $d['name'];
$address['street'] = $d['street'];
$address['postalcode'] = $d['postalcode'];
$address['city'] = $d['city'];
$address['country'] = $d['country'];
$addresses[] = $address;
unset($address);
}
//ownership
$res = $db->query("SELECT name, shipping_address_street, shipping_address_postalcode, shipping_address_city, shipping_address_country, iln, to_vatid FROM accounts WHERE parent_id='$a->id'");
while ($r = $db->fetchByAssoc($res)) {
$address = array();
$address['name'] = $r['name'];
$address['street'] = $r['shipping_address_street'];
$address['postalcode'] = $r['shipping_address_postalcode'];
$address['city'] = $r['shipping_address_city'];
$address['country'] = $r['shipping_address_country'];
$address['iln'] = $r['iln'];
$address['nip'] = $r['to_vatid'];
$addresses[] = $address;
unset($address);
}
$data['addresses'] = $addresses;
unset($addresses);
echo json_encode($data);
unset($data);
unset($a);
unset($res);
return;
}
function generateNumber() {
$data = array();
$data['number'] = EcmSale::generateNumber();
$data['document_no'] = EcmSale::formatNumber($data['number']);
echo json_encode($data);
unset($data);
return;
}
function searchProducts($searchKey, $searchCategory, $searchStock, $searchSort,$stockid) {
$db = $GLOBALS['db'];
$q = "SELECT id, code, name FROM ecmproducts WHERE
(UPPER(code) LIKE '%$searchKey%' OR
UPPER(name) LIKE '%$searchKey%' OR
ean LIKE '%$searchKey%' OR
ean2 LIKE '%$searchKey%')
AND deleted='0' ";
if ($searchCategory && $searchCategory!="")
$q.="AND product_category_id='$searchCategory' ";
if ($searchSort=='1')
$q.="ORDER BY code";
else if ($searchSort=='2')
$q.="ORDER BY code DESC";
else if ($searchSort=='3')
$q.="ORDER BY name";
else if ($searchSort=='4')
$q.="ORDER BY name DESC";
$q.=" LIMIT 0,50";
$res = $db->query($q);
$result = array();
if ($searchStock!='1') {
//get main stock id
$stock_res = $db->fetchByAssoc($db->query("SELECT id FROM ecmstocks WHERE main='1' LIMIT 0,1"));
$stock_id = $stock_res['id'];
}
while ($row = $db->fetchByAssoc($res)) {
$tmp = array();
$tmp['id'] = $row['id'];
$tmp['name'] = $row['name'];
$tmp['code'] = $row['code'];
//get stock if necessary
if ($searchStock!='1') {
if($stockid!='')$stock_id=$stockid;
$tmp['stock_state'] = EcmStockOperation::getStock($row['id'], $stock_id);
}
if ($searchStock=='3' && $tmp['stock_state']==0) continue; //don't show null stock
$result[] = $tmp;
}
echo json_encode($result);
return;
}
function getProduct($id, $pricebook_id, $account_id, $language) {
$db = $GLOBALS['db'];
$p = $db->fetchByAssoc($db->query("SELECT p.id, p.code, p.name, v.id as ecmvat_id, v.name as ecmvat_name, v.value as ecmvat_value, p.ean, p.ean2, p.unit_id, p.brand_label FROM ecmproducts as p INNER JOIN ecmvats as v ON v.id=p.vat_id WHERE p.id='$id'"));
global $app_list_strings;
$p['unit_name'] = $app_list_strings['ecmproducts_unit_dom'][$p['unit_id']];
//try get recipient_code and price from pricebook
if ($pricebook_id && $pricebook_id!='') {
$pr = $db->fetchByAssoc($db->query("SELECT price, recipient_code FROM ecmpricebooks_ecmproducts WHERE ecmpricebook_id='$pricebook_id' AND ecmproduct_id='$id' AND deleted='0'"));
$p['price_start'] = $pr['price'];
$p['recipient_code'] = $pr['recipient_code'];
}
if (!$p['price_start'] || floatval($p['price_start'])==0) {
//try price from default prices
$pr = $db->fetchByAssoc($db->query("SELECT pp.price FROM ecmprices_ecmproducts AS pp INNER JOIN ecmprices AS p ON pp.ecmprice_id=p.id INNER JOIN accounts AS a ON p.id=a.ecmprice_id WHERE a.id='$account_id' AND pp.ecmproduct_id='$id'"));
$p['price_start'] = $pr['price'];
}
$ecmStockOperations = new EcmStockOperation();
$p['reservation']=($ecmStockOperations->getRealStock($p ['id']));
if ($language=='en_us') {
$r = $db->fetchByAssoc($db->query("SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='$id' AND language='en'"));
$p['name'] = htmlspecialchars_decode($r['short_description']);
$lists = return_app_list_strings_language($language);
$p['unit_name'] = $lists['ecmproducts_unit_dom'][$p['unit_id']];
unset($lists);
}
echo json_encode($p);
return;
}
function getItems($record) {
$of = new EcmSale();
$of->retrieve($record);
$pl = $of->getPositionList(true);
unset($of);
echo json_encode($pl);
return;
}
function getItemsFromEdi($record) {
require_once ('modules/EcmSales/readXML.php');
$reader=New readXML();
$reader->loadXMLFile($record);
$pl = $reader->getPositionList(true);
unset($reader);
echo json_encode($pl);
return;
}
function getItemsFromQuote($record) {
$s = new EcmQuote();
$s->retrieve($record);
$pl = $s->getPositionList(true);
unset($s);
echo json_encode($pl);
return;
}
function getCategoriesList() {
$db = $GLOBALS['db'];
$res = $db->query("SELECT id, name FROM ecmproductcategories WHERE deleted='0'");
$result = array();
while ($row = $db->fetchByAssoc($res)) {
$tmp = array();
$tmp['id'] = $row['id'];
$tmp['name'] = $row['name'];
$result[] = $tmp;
}
echo json_encode($result);
return;
}
function getTranslation($product_id, $language, $unit_id) {
$db = $GLOBALS['db'];
$result = array();
if ($language=='en_us') {
$r = $db->fetchByAssoc($db->query("SELECT short_description FROM ecmproduct_language WHERE ecmproduct_id='$product_id' AND language='en'"));
$result['name'] = htmlspecialchars_decode($r['short_description']);
} else if ($language=='pl_pl') {
$p = new EcmProduct();
$p->retrieve($product_id);
$result['name'] = htmlspecialchars_decode($p->name);
unset($p);
}
$lists = return_app_list_strings_language($language);
$result['unit_name'] = $lists['ecmproducts_unit_dom'][$unit_id];
unset($lists);
echo json_encode($result);
return;
}
function getPricesInfo($product_id, $pricebook_id, $account_id) {
$db = $GLOBALS['db'];
$result = array();
if ($pricebook_id && $pricebook_id!='') {
//try get price from pricebook
$res = $db->fetchByAssoc($db->query("SELECT price FROM ecmpricebooks_ecmproducts WHERE ecmpricebook_id='$pricebook_id' AND ecmproduct_id='$product_id' AND deleted='0'"));
if ($res['price'] && $res['price']!='' && $res['price']!=0) {
$tmp = array();
$tmp['name'] = 'pricebook';
$tmp['price'] = $res['price'];
$result[] = $tmp;
}
}
//get from ecmprices
$res = $db->query("SELECT p.name, pp.price FROM ecmprices_ecmproducts AS pp
INNER JOIN ecmprices AS p
ON p.id=pp.ecmprice_id
WHERE
pp.ecmproduct_id='$product_id'
AND pp.price!=0");
while ($row = $db->fetchByAssoc($res)) {
$tmp = array();
$tmp['name'] = $row['name'];
$tmp['price'] = $row['price'];
$result[] = $tmp;
}
//get last invoice price
if ($account_id && $account_id!='') {
$res = $db->fetchByAssoc($db->query("SELECT ii.subprice, i.id, i.document_no FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
ON ii.ecminvoiceout_id=i.id
WHERE ii.ecmproduct_id='$product_id'
AND i.parent_id='$account_id'
AND ii.deleted='0'
AND i.deleted='0'
AND i.canceled='0'
ORDER BY i.register_date DESC
LIMIT 0,1"));
if ($res && $res['subprice']!='') {
$tmp = array();
$tmp['name'] = $res['document_no'];
$tmp['price'] = $res['subprice'];
$result[] = $tmp;
}
}
echo json_encode($result);
return;
}
function getStockArray($product_id) {
$o = new EcmStockOperation();
echo json_encode($o->getStockArray($product_id));
unset($o);
return;
}
function getPurchaseArray($product_id) {
$o = new EcmStockOperation();
echo json_encode($o->getPurchaseArray($product_id));
unset($o);
return;
}
function saveSaleItemDescription($saleItemId, $description) {
$db=$GLOBALS['db'];
$description = mysql_escape_string($description);
$db->query("UPDATE ecmsaleitems SET description='$description' WHERE id='$saleItemId'");
echo "OK";
return;
}

View File

@@ -0,0 +1,454 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* ***************************************************************************
*
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
*
* Version 1.1 ("License"); You may not use this file except in compliance
*
* with the License. You may obtain a copy of the License at
*
* http://opensource.org/licenses/rpl.php. Software distributed under the
*
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
*
* either express or implied.
*
*
*
* You may:
*
* a) Use and distribute this code exactly as you received without payment or
*
* a royalty or other fee.
*
* b) Create extensions for this code, provided that you make the extensions
*
* publicly available and document your modifications clearly.
*
* c) Charge for a fee for warranty or support or for accepting liability
*
* obligations for your customers.
*
*
*
* You may NOT:
*
* a) Charge for the use of the original code or extensions, including in
*
* electronic distribution models, such as ASP (Application Service
*
* Provider).
*
* b) Charge for the original source code or your extensions other than a
*
* nominal fee to cover distribution costs where such distribution
*
* involves PHYSICAL media.
*
* c) Modify or delete any pre-existing copyright notices, change notices,
*
* or License text in the Licensed Software
*
* d) Assert any patent claims against the Licensor or Contributors, or
*
* which would in any way restrict the ability of any third party to use the
*
* Licensed Software.
*
*
*
* You must:
*
* a) Document any modifications you make to this code including the nature of
*
* the change, the authors of the change, and the date of the change.
*
* b) Make the source code for any extensions you deploy available via an
*
* Electronic Distribution Mechanism such as FTP or HTTP download.
*
* c) Notify the licensor of the availability of source code to your extensions
*
* and include instructions on how to acquire the source code and updates.
*
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
*
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
*
*
* The Original Code is: CommuniCore
*
* Olavo Farias
*
* 2006-04-7 olavo.farias@gmail.com
*
*
*
* The Initial Developer of the Original Code is CommuniCore.
*
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
*
* All Rights Reserved.
*
* ******************************************************************************
*/
$mod_strings = array (
'LBL_IMPORT_EDI' => 'Import EDI oder',
'LBL_IMPORT' => 'Import',
'LBL_SHIPPING_ADDRESS' => 'Shipping address',
'LBL_SHIPPING_ADDRESS_NAME' => 'Name',
'LBL_PARENT_ILN' => 'ILN number',
'LBL_PARENT_SUPPLIER_CODE' => 'Supplier code',
'LBL_PARENT_DOCUMENT_NO' => 'Customer order number',
'LBL_DELIVERY_DATE' => 'Delivery date',
'LBL_ECMPRICE' => 'B2B Prices',
'LBL_SEARCH' => 'Search',
'LBL_CATEGORY' => 'Category',
'LBL_PDF_TEXT' => 'PDF Text',
'LBL_PARENT_NIP' => 'VAT ID',
'LBL_NO_TAX' => 'No tax',
'LBL_PDF_DOCUMENT_NAME' => 'Quote',
'LBL_SITE' => 'Site',
'LBL_SHOW_EAN' => 'Show EAN',
'LBL_SHOW_EAN2' => 'Show EAN2',
// added 05.02.2009
'LBL_QUOTE_XLS' => 'Create XLS',
'LBL_QUOTE_XLS_BUTTON_KEY' => 'Show XLS [Alt+X]',
'LBL_QUOTE_XLS_BUTTON_TITLE' => 'Show Quote in XLS file.',
// added 01.09.2009
'LBL_PRICEBOOK' => 'Price Book',
// added 05.08.2009
'LBL_CURRENCY' => 'Currency',
'LBL_DETAIL_BUTTON' => 'Details',
// added 15.07.2009
'LBL_EDITTABLE_UNIT' => 'Unit',
// added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images on offers',
'LBL_SHOW_RECIPIENT_CODE' => 'Show recipient code',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Quotes',
'LBL_MODULE_TITLE' => 'Quotes: Home',
'LBL_MODULE_ID' => 'EcmSales',
'LBL_SEARCH_FORM_TITLE' => 'Quotes Search',
'LBL_LIST_FORM_TITLE' => 'Quotes List',
'LBL_NEW_FORM_TITLE' => 'New Quote',
'LBL_DETAILS' => 'Quote details:',
'LBL_ITEMS' => 'Items included:',
'LBL_TEXTS' => 'Texts to PDF:',
'LBL_PREVIEW' => 'Preview PDF:',
'LBL_EMAIL' => 'Create Email:',
'LBL_TO_INFORMATIONS' => 'To Informations:',
'LBL_DETAILS_TAB' => 'Details',
'LBL_ITEMS_TAB' => 'Items',
'LBL_TEXTS_TAB' => 'Texts',
'LBL_PREVIEW_TAB' => 'Preview',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Name',
'LBL_DESCRIPTION' => 'Description',
'LBL_DATE_ENTERED' => 'Date Entered',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Last Modified',
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_ASSIGNED_TO' => 'Assigned To',
'LBL_CREATED' => 'Created by',
'LBL_CREATED_BY_USER' => 'Created by',
'LBL_MODIFIED_BY_USER' => 'Modified by',
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
'LBL_DELETED_BY' => 'Deleted by',
'LBL_NUMBER' => 'Number',
'LBL_DOCUMENT_NO' => 'Number',
'LBL_PARENT' => 'To',
'LBL_PARENT_NAME' => 'Account',
'LBL_PARENT_ID' => 'Account Id',
'LBL_TYPE' => 'Type',
'LBL_ECMNEWSALE_ID' => 'Quote Id',
'LBL_ECMNEWSALE_NAME' => 'Quote Name',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Document Date',
'LBL_SELL_DATE' => 'Sell Date',
'LBL_PAYMENT_DATE' => 'Payment Date',
'LBL_PARENT_ADDRESS_STREET' => 'Street',
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
'LBL_HEADER_TEXT' => 'Header Text',
'LBL_FOOTER_TEXT' => 'Footer Text',
'LBL_ADS_TEXT' => 'Ads Text',
'LBL_SUBTOTAL' => 'Subtotal',
'LBL_TOTAL' => 'Total',
'LBL_DISCOUNT' => 'Discount',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Accepted',
'LBL_TEMPLATE_ID' => 'Template Id',
'LBL_TEMPLATE_NAME' => 'Template',
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Code',
'LBL_EDITTABLE_NAME' => 'Name',
'LBL_EDITTABLE_QUANTITY' => 'Quant',
'LBL_EDITTABLE_PRICE' => 'Price',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Recipient Code',
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
'LBL_EDITTABLE_TOTAL' => 'Total',
'LBL_EDITTABLE_OPTIONS' => 'Opt',
'LBL_MOVE_ROW_UP' => 'Move Up',
'LBL_MOVE_ROW_DOWN' => 'Move Down',
'LBL_INSERT_NEW_ROW' => 'Insert new row',
'LBL_DELETE_ROW' => 'Delete row',
'LBL_VALIDTILL_DATE' => 'Valid Till',
// FOR MENU LINKS
'LNK_NEW_ECMNEWSALE' => 'Create Quote',
'LNK_ECMNEWSALES_LIST' => 'Quotes List',
'LBL_IMG_SEARCH' => 'Search',
'LBL_IMG_NEW' => 'New, add to base',
'LBL_IMG_EDIT' => 'Edit',
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this Quote?',
'LBL_QUOTE_PDF' => 'Show PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show Quote in PDF file.',
'LBL_QUOTE_TO_INVOICE' => 'Create Invoice',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Create Invoice [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Create Invoice.',
'LBL_QUOTE_TO_SALE' => 'Create Sales Order',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
'LBL_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Send To Confirm [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Send This Quote To Confirm.',
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
// buttons
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to quotes list [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
'LBL_NOT_SAVED' => 'Quote not saved. Please check all fields are correct!',
'LBL_SAVED' => 'Quote saved successfully.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla:',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
'LBL_DASHLET_MY_ECMNEWSALES' => 'Quotes',
'LNK_ECMNEWSALES_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMNEWSALES_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Quote is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Quote to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "Quote status is set.",
'LBL_STATUS_s20_SET_MESSAGE' => "Now Quote is waiting for confimations.",
'LBL_STATUS_s30_SET_MESSAGE' => "Quote is confirmed.",
'LBL_STATUS_s40_SET_MESSAGE' => "Quote status is set.",
'LBL_STATUS_s70_SET_MESSAGE' => "Quote status is set to Lost :(",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending Quote to confirm error! Refresh site and try again.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_LIST_DUPLICATE' => 'Duplicate',
'LBL_LIST_PREVIEW_PDF' => 'Preview Quote',
'LBL_LIST_REJECT' => 'Reject',
'LBL_LIST_ACCEPT' => 'Accept',
'LBL_MODIFIED_USER' => 'Modified By',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Order Origin',
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
'LBL_CONTACT_NAME' => 'Contact',
'LBL_CONTACT_ID' => 'Contact Id',
'LBL_PARENT_NAME_COPY' => 'Company Name',
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
'LBL_CREATE_ECMINVOICEOUT_BUTTON_LABEL' => 'Create Invoice',
'LBL_ECMTEAM_NAME' => 'Team',
'LBL_ECMTEAM_ID' => 'Team ID',
'LBL_IMAGE_SIZE' => 'Images size (%)',
//mz new labels
'LBL_SEARCH' => 'Search',
'LBL_CATEGORY' => 'Category',
'LBL_SEARCH_STOCK' => 'Show stock states',
'LBL_SEARCH_STOCK_OPT_NO' => 'Don\'t show stock states',
'LBL_SEARCH_STOCK_OPT_YES' => 'Show stock states',
'LBL_SEARCH_STOCK_OPT_NOT_NULL' => 'Only products on stock',
'LBL_SEARCH_SORT' => 'Sort results by',
'LBL_SEARCH_SORT_CODE' => 'Code ASC',
'LBL_SEARCH_SORT_CODE_DESC' => 'Code DESC',
'LBL_SEARCH_SORT_NAME' => 'Name ASC',
'LBL_SEARCH_SORT_NAME_DESC' => 'Name DESC',
//PDF labels
'LBL_PDF_FOOTER_KRS' => 'KRS:',
'LBL_PDF_FOOTER_NIP' => 'VATID:',
'LBL_PDF_FOOTER_REGON' => 'REGON:',
'LBL_PDF_FOOTER_BANK' => 'Bank name:',
'LBL_PDF_FOOTER_BANK_ACCOUNT' => 'Bank account:',
'LBL_PDF_FOOTER_GIOS' => 'GIOS number:',
'LBL_PDF_FOOTER_SWIFT' => 'Bank SWIFT:',
'LBL_PDF_CONTENT_SALE_FOR' => 'Offer for:',
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Register date:',
'LBL_PDF_CONTENT_DELIVERY_DATE' => 'Delivery date:',
'LBL_PDF_CONTENT_ISSUED_BY' => 'Issued by:',
'LBL_PDF_CONTENT_DELIVERY' => 'Delivery to:',
'LBL_PDF_CONTENT_ILN' => 'ILN:',
'LBL_PDF_CONTENT_NIP' => 'VATID:',
'LBL_PDF_CONTENT_PARENT_DOCUMENT_NO' => 'Buyer order numer:',
'LBL_PDF_CONTENT_NUMBER' => 'Number:',
'LBL_PDF_CONTENT_LIST_POSITION' => 'No.',
'LBL_PDF_CONTENT_LIST_IMAGE' => 'Picture',
'LBL_PDF_CONTENT_LIST_NAME' => 'Name',
'LBL_PDF_CONTENT_LIST_CODE' => 'Index',
'LBL_PDF_CONTENT_LIST_QTY' => 'Quantity',
'LBL_PDF_CONTENT_LIST_UNIT' => 'Unit',
'LBL_PDF_CONTENT_LIST_EAN' => 'Ean',
'LBL_PDF_CONTENT_LIST_EAN2' => 'Ean 2',
'LBL_PDF_CONTENT_LIST_RECIPIENT_CODE' => 'Recipient Code',
'LBL_PDF_CONTENT_LIST_PRICE_START' => 'Start price',
'LBL_PDF_CONTENT_LIST_PRICE_NETTO' => 'Price netto',
'LBL_PDF_CONTENT_LIST_DISCOUNT' => 'Discount',
'LBL_PDF_CONTENT_LIST_TOTAL_NETTO' => 'Total netto',
'LBL_PDF_CONTENT_TOTAL_NETTO' => 'Total netto',
'LBL_PDF_CONTENT_TOTAL_BRUTTO' => 'Total brutto',
)
;
?>

View File

@@ -0,0 +1,424 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$mod_strings = array (
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Quotes',
'LBL_MODULE_TITLE' => 'Quotes: Home',
'LBL_MODULE_ID' => 'EcmSales',
'LBL_SEARCH_FORM_TITLE' => 'Quotes Search',
'LBL_LIST_FORM_TITLE' => 'Quotes List',
'LBL_NEW_FORM_TITLE' => 'New Quote',
'LBL_DETAILS' => 'Quote details:',
'LBL_ITEMS' => 'Items included:',
'LBL_TEXTS' => 'Texts to PDF:',
'LBL_PREVIEW' => 'Preview PDF:',
'LBL_EMAIL' => 'Create Email:',
'LBL_TO_INFORMATIONS' => 'To Informations:',
'LBL_DETAILS_TAB' => 'Details',
'LBL_ITEMS_TAB' => 'Items',
'LBL_TEXTS_TAB' => 'Texts',
'LBL_PREVIEW_TAB' => 'Preview',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Name',
'LBL_DESCRIPTION' => 'Description',
'LBL_DATE_ENTERED' => 'Date Entered',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Last Modified',
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_ASSIGNED_TO' => 'Assigned To',
'LBL_CREATED' => 'Created by',
'LBL_CREATED_BY_USER' => 'Created by',
'LBL_MODIFIED_BY_USER' => 'Modified by',
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
'LBL_DELETED_BY' => 'Deleted by',
'LBL_NUMBER' => 'Number',
'LBL_DOCUMENT_NO' => 'Number',
'LBL_PARENT' => 'To',
'LBL_PARENT_NAME' => 'Account',
'LBL_PARENT_ID' => 'Account Id',
'LBL_TYPE' => 'Type',
'LBL_ECMNEWSALE_ID' => 'Quote Id',
'LBL_ECMNEWSALE_NAME' => 'Quote Name',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Document Date',
'LBL_SELL_DATE' => 'Sell Date',
'LBL_PAYMENT_DATE' => 'Payment Date',
'LBL_PARENT_ADDRESS_STREET' => 'Street',
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
'LBL_HEADER_TEXT' => 'Header Text',
'LBL_FOOTER_TEXT' => 'Footer Text',
'LBL_ADS_TEXT' => 'Ads Text',
'LBL_SUBTOTAL' => 'Subtotal',
'LBL_TOTAL' => 'Total',
'LBL_DISCOUNT' => 'Discount',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Accepted',
'LBL_TEMPLATE_ID' => 'Template Id',
'LBL_TEMPLATE_NAME' => 'Template',
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Code',
'LBL_EDITTABLE_NAME' => 'Name',
'LBL_EDITTABLE_QUANTITY' => 'Quant',
'LBL_EDITTABLE_PRICE' => 'Price',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
'LBL_EDITTABLE_TOTAL' => 'Total',
'LBL_EDITTABLE_OPTIONS' => 'Opt',
'LBL_MOVE_ROW_UP' => 'Move Up',
'LBL_MOVE_ROW_DOWN' => 'Move Down',
'LBL_INSERT_NEW_ROW' => 'Insert new row',
'LBL_DELETE_ROW' => 'Delete row',
'LBL_VALIDTILL_DATE' => 'Valid Till',
// FOR MENU LINKS
'LNK_NEW_ECMNEWSALE' => 'Create Quote',
'LNK_ECMNEWSALES_LIST' => 'Quotes List',
'LBL_IMG_SEARCH' => 'Search',
'LBL_IMG_NEW' => 'New, add to base',
'LBL_IMG_EDIT' => 'Edit',
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this Quote?',
'LBL_QUOTE_PDF' => 'Show PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show Quote in PDF file.',
'LBL_QUOTE_TO_INVOICE' => 'Create Invoice',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Create Invoice [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Create Invoice.',
'LBL_QUOTE_TO_SALE' => 'Create Sales Order',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
'LBL_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Send To Confirm [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Send This Quote To Confirm.',
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
//buttons
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to quotes list [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
'LBL_NOT_SAVED' => 'Quote not saved. Please check all fields are correct!',
'LBL_SAVED' => 'Quote saved successfully.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
'LBL_DASHLET_MY_ECMNEWSALES' => 'Quotes',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_TOTAL' => 'Suma',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
'LBL_PDF_OWNER' => 'Wystawil',
'LBL_PDF_DOCUMENT_NAME' => 'Oferta',
'LBL_PDF_FILENAME' => 'Quote_',
'LBL_PDF_CODE' => '',
'LNK_ECMNEWSALES_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMNEWSALES_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Quote is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Quote to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "Quote status is set.",
'LBL_STATUS_s20_SET_MESSAGE' => "Now Quote is waiting for confimations.",
'LBL_STATUS_s30_SET_MESSAGE' => "Quote is confirmed.",
'LBL_STATUS_s40_SET_MESSAGE' => "Quote status is set.",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending Quote to confirm error! Refresh site and try again.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_LIST_DUPLICATE' => 'Duplicate',
'LBL_LIST_PREVIEW_PDF' => 'Preview Quote',
'LBL_LIST_REJECT' => 'Reject',
'LBL_LIST_ACCEPT' => 'Accept',
'LBL_MODIFIED_USER' => 'Modified By',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Order Origin',
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
'LBL_CONTACT_NAME' => 'Contact',
'LBL_CONTACT_ID' => 'Contact Id',
'LBL_PARENT_NAME_COPY' => 'Company Name',
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
'LBL_IMAGE_SIZE' => 'Images size (%)',
);
?>

View File

@@ -0,0 +1,485 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* ***************************************************************************
*
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
*
* Version 1.1 ("License"); You may not use this file except in compliance
*
* with the License. You may obtain a copy of the License at
*
* http://opensource.org/licenses/rpl.php. Software distributed under the
*
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
*
* either express or implied.
*
*
*
* You may:
*
* a) Use and distribute this code exactly as you received without payment or
*
* a royalty or other fee.
*
* b) Create extensions for this code, provided that you make the extensions
*
* publicly available and document your modifications clearly.
*
* c) Charge for a fee for warranty or support or for accepting liability
*
* obligations for your customers.
*
*
*
* You may NOT:
*
* a) Charge for the use of the original code or extensions, including in
*
* electronic distribution models, such as ASP (Application Service
*
* Provider).
*
* b) Charge for the original source code or your extensions other than a
*
* nominal fee to cover distribution costs where such distribution
*
* involves PHYSICAL media.
*
* c) Modify or delete any pre-existing copyright notices, change notices,
*
* or License text in the Licensed Software
*
* d) Assert any patent claims against the Licensor or Contributors, or
*
* which would in any way restrict the ability of any third party to use the
*
* Licensed Software.
*
*
*
* You must:
*
* a) Document any modifications you make to this code including the nature of
*
* the change, the authors of the change, and the date of the change.
*
* b) Make the source code for any extensions you deploy available via an
*
* Electronic Distribution Mechanism such as FTP or HTTP download.
*
* c) Notify the licensor of the availability of source code to your extensions
*
* and include instructions on how to acquire the source code and updates.
*
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
*
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
*
*
* The Original Code is: CommuniCore
*
* Olavo Farias
*
* 2006-04-7 olavo.farias@gmail.com
*
*
*
* The Initial Developer of the Original Code is CommuniCore.
*
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
*
* All Rights Reserved.
*
* ******************************************************************************
*/
$mod_strings = array (
'LBL_WZ_NAME'=>'Numer WZ',
'LBL_IMPORT_EDI' => 'Import zamówienia EDI',
'LBL_IMPORT' => 'Importuj',
'LBL_SHIPPING_ADDRESS' => 'Adres dostawy',
'LBL_SHIPPING_ADDRESS_NAME' => 'Nazwa',
'LBL_PARENT_ILN' => 'Numer ILN',
'LBL_PARENT_SUPPLIER_CODE' => 'Kod dostawcy',
'LBL_PARENT_DOCUMENT_NO' => 'Numer zamówienia klienta',
'LBL_DELIVERY_DATE' => 'Data dostawy',
'LBL_ECMPRICE' => 'Ceny B2B',
'LBL_SEARCH' => 'Wyszukaj',
'LBL_CATEGORY' => 'Kategoria',
'LBL_PDF_TEXT' => 'Tekst na PDFie',
'LBL_PARENT_NIP' => 'NIP',
'LBL_NO_TAX' => 'Bez Vatu',
'LBL_SITE' => 'Strona',
'LBL_SHOW_EAN' => 'Pokaż EAN1',
'LBL_SHOW_EAN2' => 'Pokaż EAN2',
'LNK_ECMSALES_LIST'=>'Lista Zamówień sprzedaży',
'LNK_NEW_'.'ECMSALE'=>'Utwórz Zamówienie sprzedaży',
'LNL_NEW_RAPORT'=>'Lista realizacyjna',
// added 01.09.2009
'LBL_ECMLANGUAGE' => 'Język',
'LBL_PRICEBOOK' => 'Cennik',
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Kod Odbiorcy',
// added 05.08.2009
'LBL_CURRENCY' => 'Waluta',
'LBL_DETAIL_BUTTON' => 'Szczegóły',
// added 15.07.2009
'LBL_EDITTABLE_UNIT' => 'J.m.',
// added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Pokaż obrazki w PDFie',
'LBL_SHOW_RECIPIENT_CODE' => 'Pokaż kod odbiorcy',
// RAPORT NOWY listnewsales
'LBL_LISTNEWSALES_NAME'=>'Zamówienia sprzedaży: Lista realizacyjna',
'LBL_SEARCH'=>'Wyszukiwanie',
'LBL_LISTNEWSALES_DATE_START'=>'Data od',
'LBL_LISTNEWSALES_DATE_END'=>'do',
'LBL_LISTNEWSALES_PRODUCT_SUMMARY'=>'Lista zbiorcza produktów',
'LBL_LISTNEWSALES_ACCOUNT_NAME'=>'Kontrahent',
'LBL_LISTNEWSALES_DOCUMENT_CREATE_DATE_START'=>'Data utwórzenia od',
'LBL_LISTNEWSALES_NOT_ASSIGNED'=>'Bez Dokumentu WZ',
'LBL_LISTNEWSALES_ORDER_NO'=>'Nr. Zamówienia klienta',
'LBL_LISTNEWSALES_ORDER_TYPE'=>'Typ zamówienia',
'LBL_LISTNEWSALES_POST'=>'Szukaj',
'LBL_LISTNEWSALES_CLEAR'=>'Wyczyść',
'LBL_LISTNEWSALES_POS'=>'Pos.',
'LBL_LISTNEWSALES_DESCRIPTION'=>'Opis',
'LBL_LISTNEWSALES_PARENT_NAME'=>'Kontrahent',
'LBL_LISTNEWSALES_DELIVERY_DATE'=>'Data dostawy',
'LBL_LISTNEWSALES_QUANTITY'=>"Ilość",
'LBL_LISTNEWSALES_TOTAL_NETTO'=>'Razem netto',
'LBL_LISTNEWSALES_TOTAL_BRUTTO'=>'Razem brutto',
'LBL_LISTNEWSALES_TOTAL_VAT'=>'Razem VAT',
'LBL_LISTNEWSALES_TOTAL_INVOICE'=>'Razem faktura',
'LBL_LISTNEWSALES_PERCENT'=>'%',
'LBL_LISTNEWSALES_PRINTED'=>'Wydrukowane',
'LBL_LISTNEWSALES_NUMBER'=>'Number',
'LBL_LISTNEWSALES_SUMMARY'=>'Razem',
'LBL_LISTNEWSALES_CREATEWZ'=>'Stwórz WZ',
'LBL_LISTNEWSALES_CREATE_PDFS'=>'Utwórz PDFy',
'LBL_LISTNEWSALES_PRODUCTCODE'=>'Kod produku',
'LBL_LISTNEWSALES_PRODUCTNAME'=>'Nazwa produktu',
'LBL_LISTNEWSALES_STOCK'=>'Na magazynie',
'LBL_LISTNEWSALES_GROUP_KS_1'=>'Towar handlowy',
'LBL_LISTNEWSALES_GROUP_KS_2'=>'Wyrób gotowy',
'LBL_LISTNEWSALES_GROUP_KS_3'=>'Surowiec',
'LBL_LISTNEWSALES_GROUP_KS'=>'Grupa KS',
'LBL_LISTNEWSALES_GROUP_PR'=>'Sortuj po',
'LBL_LISTNEWSALES_CATEGORY'=>'Kategoria',
'LBL_LISTNEWSALES_CURRENCY'=>'Waluta',
'LBL_STOCK_NAME'=>'Magazyn',
// RAPORT end
// FOR SYSTEM USE
'LBL_DASHLET_MY_ECMSALES'=>"Zamówienia sprzedaży",
'LBL_MODULE_NAME' => 'Zamówienia sprzedaży',
'LBL_MODULE_TITLE' => 'Zamówienia sprzedaży: Strona Główna',
'LBL_MODULE_ID' => 'EcmSales',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
'LBL_LIST_FORM_TITLE' => 'Lista Zamówień sprzedaży',
'LBL_NEW_FORM_TITLE' => 'Nowe zamówienie sprzedaży',
'LBL_DETAILS' => 'Szczegóły zamówieniay',
'LBL_ITEMS' => 'Załączone Produkty:',
'LBL_TEXTS' => 'Teksty do PDFa:',
'LBL_PREVIEW' => 'Podgląd PDFa:',
'LBL_EMAIL' => 'Stwórz Email:',
'LBL_TO_INFORMATIONS' => 'Informacje o firmie:',
'LBL_DETAILS_TAB' => 'Szczegóły',
'LBL_ITEMS_TAB' => 'Produkty',
'LBL_TEXTS_TAB' => 'Teksty',
'LBL_PREVIEW_TAB' => 'Podglad',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Nazwa',
'LBL_DESCRIPTION' => 'Opis',
'LBL_DATE_ENTERED' => 'Data dodania',
'LBL_DATE_MODIFIED' => 'Data modyfikacji',
'LBL_MODIFIED' => 'Ostatnio modyfikowane',
'LBL_ASSIGNED_TO_ID' => 'Przypisane Do',
'LBL_ASSIGNED_TO' => 'Przypisane Do',
'LBL_CREATED' => 'Utworzone Przez',
'LBL_CREATED_BY_USER' => 'Utworzone Przez',
'LBL_MODIFIED_BY_USER' => 'Zmodyfikowane Przez',
'LBL_ASSIGNED_TO_USER' => 'Przypisane Do',
'LBL_DELETED_BY' => 'Usuniete Przez',
'LBL_NUMBER' => 'Numer',
'LBL_DOCUMENT_NO' => 'Numer',
'LBL_PARENT' => 'Do',
'LBL_PARENT_NAME' => 'Firma',
'LBL_PARENT_ID' => 'Firma Id',
'LBL_TYPE' => 'Typ',
'LBL_ECMNEWSALE_ID' => 'Id Oferty',
'LBL_ECMNEWSALE_NAME' => 'Nazwa Zamówienia',
'LBL_LISTNEWSALES_CREATERW'=>'Utwórz RW',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Data Dokumentu',
'LBL_SELL_DATE' => 'Data Sprzedaży',
'LBL_PAYMENT_DATE' => 'Data Płatności',
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
'LBL_PARENT_ADDRESS_CITY' => 'Kod pocztowy / Miasto',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Kod pocztowy',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Państwo',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Czy jest wolne od vatu?',
'LBL_HEADER_TEXT' => 'Tekst nagłówka',
'LBL_FOOTER_TEXT' => 'Tekst stopki',
'LBL_ADS_TEXT' => 'Dodatkowy tekst',
'LBL_SUBTOTAL' => 'Suma',
'LBL_TOTAL' => 'Suma',
'LBL_DISCOUNT' => 'Upust',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Zaakceptowane',
'LBL_TEMPLATE_ID' => 'Id Szablonu',
'LBL_TEMPLATE_NAME' => 'Szablon',
'LBL_PAYMENTCONDITION_NAME' => 'Warunki Płatnosci',
'LBL_PAYMENTCONDITION_ID' => 'Warunki Płatnosci ID',
'LBL_DELIVERYCONDITION_NAME' => 'Warunki Dostawy',
'LBL_DELIVERYCONDITION_ID' => 'Warunki Dostawy ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Błąd formatu numeru!',
'LBL_SAVE_FORM_ERROR' => 'Wystepują błędy na liście produktów albo w formularzu!',
'LBL_DISCOUNT_ERROR' => 'Błąd formatu upustu',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Kod',
'LBL_EDITTABLE_NAME' => 'Nazwa',
'LBL_EDITTABLE_QUANTITY' => 'Ilość',
'LBL_EDITTABLE_PRICE' => 'Cena',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_DISCOUNT' => 'Upust',
'LBL_EDITTABLE_TOTAL' => 'Suma',
'LBL_EDITTABLE_OPTIONS' => 'Opcje',
'LBL_MOVE_ROW_UP' => 'W góre',
'LBL_MOVE_ROW_DOWN' => 'W dół',
'LBL_INSERT_NEW_ROW' => 'Wstaw nowy wiersz',
'LBL_DELETE_ROW' => 'Usuń wiersz',
'LBL_VALIDTILL_DATE' => 'Ważne do',
// FOR MENU LINKS
'LNK_NEW_ECMNEWSALE' => 'Utwórz Zamówienie sprzedaży',
'LNK_ECMNEWSALES_LIST' => 'Lista Zamówień sprzedaży',
'LBL_IMG_SEARCH' => 'Wyszukiwanie',
'LBL_IMG_NEW' => 'Nowy, dodaj do bazy',
'LBL_IMG_EDIT' => 'Edycja',
'LBL_CONFIRM_QUESTION' => 'Chcesz potwierdzic to zamówienie?',
'LBL_QUOTE_PDF' => 'Pokaz PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Pokaz PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Pokaz Zamówienie w pliku PDF.',
'LBL_QUOTE_TO_INVOICE' => 'Stwórz Fakture',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Stwórz Fakture [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Stwórz Fakture.',
'LBL_QUOTE_TO_SALE' => 'Stwórz Zamówienie Sprzedaży',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Stwórz Zamówienie Sprzedaży [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Stwórz Zamówienie Sprzedaży.',
'LBL_SEND_TO_CONFIRM' => 'Wyślij Do Potwierdzenia',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Wyślij Do Potwierdzenia [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Wyślij Do Potwierdzenia.',
'LBL_LIST_TO_INVOICE' => 'Stwórz Fakturę.',
'LBL_LIST_TO_SALE' => 'Stwórz Zamówienie Sprzedaży.',
// buttons
'LBL_SEND_BUTTON_TITLE' => 'Zapisz i Wyślij [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Zapisz i Wyślij',
'LBL_REPAIR_BUTTON_TITLE' => 'Napraw [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Napraw',
'LBL_ACCEPT_BUTTON_TITLE' => 'Zaakceptuj [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Zaakceptuj',
'LBL_REJECT_BUTTON_TITLE' => 'Nie akceptuj [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Nie akceptuj',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Idz do listy Ofert [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Idz do listy',
'LBL_SENDEMAIL_BUTTON' => 'Wyslij Email',
'LBL_NOT_SAVED' => 'Oferta nie została zapisana. Sprawdz czy wszytskie pola sa poprawne!',
'LBL_SAVED' => 'Oferta została zapisana pomyslnie.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notatki',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emaile',
'LBL_DASHLET_MY_ECMNEWSALES' => 'Oferty',
'LNK_ECMNEWSALES_PDFLANGUAGES' => 'Ustawienia PDF',
'LBL_ECMNEWSALES_PDFLANGUAGES_TITLE' => 'Ustawienia jezyków PDFa',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Correct Document is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Correct Document to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "Status Oferty ustawiony.",
'LBL_STATUS_s20_SET_MESSAGE' => "Oferta czeka na potwierdzenie.",
'LBL_STATUS_s30_SET_MESSAGE' => "Oferta jest potwierdzony.",
'LBL_STATUS_s40_SET_MESSAGE' => "Status Oferty ustawiony.",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Błąd wysylki do potwierdzenia! Odswiez strone i sprobuj ponownie.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Wyslij do Potwierdzenia',
'LBL_LIST_DUPLICATE' => 'Duplikuj',
'LBL_LIST_PREVIEW_PDF' => 'Podglad Oferty',
'LBL_LIST_REJECT' => 'Nie akceptuj',
'LBL_LIST_ACCEPT' => 'Akceptuj',
'LBL_MODIFIED_USER' => 'Zmodyfikowane Przez',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Zródlo zamówienia',
'LBL_PREVIEW_HEADER_NAME' => 'Podglad',
'LBL_PREVIEW_HEADER_CLOSE' => 'Zamknij',
'LBL_CONTACT_NAME' => 'Kontakt',
'LBL_CONTACT_ID' => 'Id Kontaktu',
'LBL_PARENT_NAME_COPY' => 'Nazwa Firmy',
'LBL_PARENT_CONTACT_NAME' => 'Osoba Kontaktowa',
'LBL_PARENT_CONTACT_TITLE' => 'Tytul Kontaktu',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Czy zaladowac domyslne teksty dla tego jezyka?',
'LBL_LIST_DOWNLOAD_PDF' => 'Pobierz PDF',
'LBL_IMAGE_SIZE' => 'Rozmiar obrazków (%)',
// mz new fields
'LBL_SEARCH' => 'Wyszukaj',
'LBL_CATEGORY' => 'Kategoria',
'LBL_SEARCH_STOCK' => 'Stan magazynowy',
'LBL_SEARCH_STOCK_OPT_NO' => 'Nie pokazuj',
'LBL_SEARCH_STOCK_OPT_YES' => 'Pokaż',
'LBL_SEARCH_STOCK_OPT_NOT_NULL' => 'Tylko produkty dostępne',
'LBL_SEARCH_SORT' => 'Sortuj wyniki wg.',
'LBL_SEARCH_SORT_CODE' => 'Kod rosnąco',
'LBL_SEARCH_SORT_CODE_DESC' => 'Kod malejąco',
'LBL_SEARCH_SORT_NAME' => 'Nazwa rosnąco',
'LBL_SEARCH_SORT_NAME_DESC' => 'Nazwa malejąco',
// PDF labels
'LBL_PDF_FOOTER_KRS' => 'KRS:',
'LBL_PDF_FOOTER_NIP' => 'NIP:',
'LBL_PDF_FOOTER_REGON' => 'REGON:',
'LBL_PDF_FOOTER_BANK' => 'Bank:',
'LBL_PDF_FOOTER_BANK_ACCOUNT' => 'Number konta:',
'LBL_PDF_FOOTER_GIOS' => 'Numer GIOS:',
'LBL_PDF_CONTENT_SALE_FOR' => 'Zamówienie dla:',
'LBL_PDF_CONTENT_ILN' => 'ILN:',
'LBL_PDF_CONTENT_NIP' => 'NIP:',
'LBL_PDF_CONTENT_PARENT_DOCUMENT_NO' => 'Numer zamówienia klienta:',
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Data wystawienia:',
'LBL_PDF_CONTENT_DELIVERY_DATE' => 'Data dostawy:',
'LBL_PDF_CONTENT_ISSUED_BY' => 'Wystawił:',
'LBL_PDF_CONTENT_DELIVERY' => 'Dostawa do:',
'LBL_PDF_CONTENT_NUMBER' => 'Numer:',
'LBL_PDF_CONTENT_LIST_POSITION' => 'Lp.',
'LBL_PDF_CONTENT_LIST_IMAGE' => 'Zdjęcie',
'LBL_PDF_CONTENT_LIST_NAME' => 'Nazwa',
'LBL_PDF_CONTENT_LIST_CODE' => 'Indeks',
'LBL_PDF_CONTENT_LIST_QTY' => 'Ilość',
'LBL_PDF_CONTENT_LIST_UNIT' => 'j.m.',
'LBL_PDF_CONTENT_LIST_EAN' => 'Ean',
'LBL_PDF_CONTENT_LIST_EAN2' => 'Ean 2',
'LBL_PDF_CONTENT_LIST_RECIPIENT_CODE' => 'Kod odbiorcy',
'LBL_PDF_CONTENT_LIST_PRICE_START' => 'Cena początkowa',
'LBL_PDF_CONTENT_LIST_PRICE_NETTO' => 'Cena netto',
'LBL_PDF_CONTENT_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_CONTENT_LIST_TOTAL_NETTO' => 'Wartość netto',
'LBL_PDF_CONTENT_TOTAL_NETTO' => 'Suma netto',
'LBL_PDF_CONTENT_TOTAL_BRUTTO' => 'Suma brutto'
);
?>

View File

@@ -0,0 +1,20 @@
<?php
if (count ( $_REQUEST ['mass'] )) {
require_once('modules/EcmSales/createPDF.php');
$files = [];
foreach ($_REQUEST['mass'] as &$id) {
$files [] = createEcmSalePdf ( $id, 'FILE', '1' );
}
include 'PDFMerger.php';
if (count ( $files ) > 0) {
$pdf = new PDFMerger ();
foreach ( $files as $file ) {
$pdf->addPDF ( $file );
}
try {
$pdf->merge ( "file", 'zs.pdf' );
} catch ( Exception $e ) {
}
header ( "Location: zs.pdf" );
}
}

View File

@@ -0,0 +1,129 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$searchFields['EcmSales'] = array (
'name' => array ( 'query_type' => 'default' ),
'description' => array ( 'query_type' => 'default' ),
'current_user_only' => array ( 'query_type' => 'default', 'db_field' => array ( 'assigned_user_id' ), 'my_items' => true ),
'assigned_user_id' => array ( 'query_type' => 'default' ),
'status' => array ( 'query_type' => 'default' ),
'register_date' => array ( 'query_type' => 'default' ),
'parent_name' => array( 'query' => 'default' ),
'delivery_date' => array ('query_type' => 'default'),
'send_date' => array ('query_type' => 'default')
);
?>

View File

@@ -0,0 +1,358 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* *******************************************************************************/
global $app_list_strings;
$viewdefs ['EcmSales'] ['DetailView'] = array (
'templateMeta' => array (
'form' => array (
'buttons' => array (
array (
'customCode' => '{if $CAN_EDIT == true} <input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmSales\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\';" type="submit" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}"> {/if}'
),
array (
'customCode' => '<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmSales\'; this.form.return_action.value=\'DetailView\'; this.form.isDuplicate.value=true; this.form.action.value=\'EditView\'; this.form.return_id.value=\'{$id}\';" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">'
),
array (
'customCode' => '{$CREATE_PDF}'
),
array (
'customCode' => '<input class="button" onclick="window.location.href=\'index.php?module=EcmPrepaymentInvoices&action=EditView&ecmsale_id={$id}\'" type="button" value="Utwórz Fakturę zaliczkową">'
),
),
'hidden' => array (
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'{$fields.vats_summary.value}\'>',
'<input type="hidden" id="total_netto" value=\'{$fields.total_netto.value}\'>',
'<input type="hidden" id="total_brutto" value=\'{$fields.total_brutto.value}\'>',
'<input type="hidden" id="discount" value=\'{$fields.discount.value}\'>',
'<input type="hidden" id="no_tax" value=\'{$fields.no_tax.value}\'>'
)
),
'maxColumns' => '2',
'widths' => array (
array (
'label' => '10',
'field' => '30'
),
array (
'label' => '10',
'field' => '30'
)
),
'includes' => array (
array (
'file' => 'include/JSON.js'
),
array (
'file' => 'modules/EcmSales/javascript/EcmSalesDetail.js'
),
array (
'file' => 'modules/EcmSales/javascript/bimit_table6.js'
),
array (
'file' => 'modules/EcmSales/javascript/columndefs-detail3.js'
)
)
),
'panels' => array (
'LBL_DETAILS_TAB' => array (
array (
'document_no',
'assigned_user_name'
),
array (
array (
'name' => 'parent_name',
'customCode' => '<a href="index.php?module=Accounts&action=DetailView&record={$fields.parent_id.value}">{$fields.parent_name.value}</a>'
),
array (
'name' => 'ecmpaymentcondition_name',
'customCode' => '{$fields.ecmpaymentcondition_name.value}'
)
),
array (
'type',
array (
'name' => 'ecmdeliverycondition_name',
'customCode' => '{$fields.ecmdeliverycondition_name.value}'
)
),
array (
'status',
'stock_name',
),
array (
'name',
'parent_document_no'
),
array (
'send_date',
'register_date'
),
array(
'delivery_date',
'send_accepted'
),
array (
'wz_name',
array (
'name' => 'fk_no',
'label' => 'Dokument FK',
'customCode'=>'{$fk_no}'
)
),
array (
'main_sale_number'
),
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br><b>{$MOD.LBL_TO_INFORMATIONS}</b>'
)
),
array (
array (
'name' => 'parent_name_copy',
'customCode' => '{$fields.parent_name.value}'
),
'ecmlanguage'
),
array (
'parent_nip',
array (
'name' => 'currency_id',
'label' => 'LBL_CURRENCY'
)
),
array (
'parent_address_street',
),
array (
array (
'name' => 'parent_address_city',
'tabIndex' => 't',
'customCode' => '{$fields.parent_address_postalcode.value}&nbsp;&nbsp;{$fields.parent_address_city.value}'
)
),
array (
'parent_address_country'
),
array (
array (
'name' => 'parent_iln',
'tabIndex' => '1'
),
),
array (
array (
'name' => 'parent_supplier_code',
'tabIndex' => '1'
),
),
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br><b>{$MOD.LBL_SHIPPING_ADDRESS}</b>'
)
),
array (
array (
'name' => 'shipping_address_name',
'customCode' => '{$fields.shipping_address_name.value}'
),
),
array (
'shipping_address_street'
),
array (
array (
'name' => 'shipping_address_city',
'tabIndex' => 't',
'customCode' => '{$fields.shipping_address_postalcode.value}&nbsp;&nbsp;{$fields.shipping_address_city.value}'
)
),
array (
'shipping_address_country'
),
array (
array (
'name' => 'shipping_iln',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'shipping_nip',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br>'
)
),
array (
'pdf_text'
),
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br>'
)
),
array (
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$MODIFIED_BY_NAME}'
),
array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$CREATED_BY_NAME}'
),
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>Ustawienia zamówienia okresowego</h4>'
)
),
array (
'sale_date_interval'
)
),
'LBL_ITEMS_TAB' => array (
array (
array (
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div id="itemsTable"></div>'
)
)
)
)
);
?>

View File

@@ -0,0 +1,374 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* *******************************************************************************/
global $sugar_config;
$viewdefs ['EcmSales'] ['EditView'] = array (
'templateMeta' => array (
'form' => array (
'enctype' => 'multipart/form-data',
'buttons' => array (
'SAVE',
'CANCEL'
),
'hidden' => array (
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
'<input type="hidden" name="new_number" id="new_number" value=\'{$NEW_NUMBER}\'>',
'<input type="hidden" name="vats_summary" id="vats_summary" value=\'\'>',
'<input type="hidden" id="total_netto" name="total_netto" value=\'{$fields.total_netto.value}\'>',
'<input type="hidden" id="total_brutto" name="total_brutto" value=\'{$fields.total_brutto.value}\'>',
'<input type="hidden" id="discount" name="discount" value=\'{$fields.discount.value}\'>',
'<input type="hidden" id="duplicate" name="duplicate" value=\'{$DUPLICATE}\'>',
'<input type="hidden" id="ecmquote_id" name="ecmquote_id" value=\'{$ECMQUOTE_ID}\'>',
'<input type="hidden" id="ecmquote" name="ecmquote" value=\'{$ECMQUOTE}\'>',
'<input type="hidden" id="ecmsale_id" name="ecmsale_id" value=\'{$ECMSALE_ID}\'>',
'<input type="hidden" id="edi_file" name="edi_file" value=\'{$EDI_FILE}\'>'
)
),
'maxColumns' => '2',
'widths' => array (
array (
'label' => '10',
'field' => '30'
),
array (
'label' => '10',
'field' => '30'
)
),
'includes' => array (
array (
'file' => 'include/JSON.js'
),
array (
'file' => 'modules/EcmSales/javascript/EcmSales6.js'
),
array (
'file' => 'modules/EcmSales/javascript/bimit_table6.js'
),
array (
'file' => 'modules/EcmSales/javascript/columndefs3.js'
)
)
),
'panels' => array (
'LBL_DETAILS_TAB' => array (
array (
array (
'type' => 'tab',
'active' => true
)
),
array (
array (
'name' => 'document_no',
'tabIndex' => '1',
'customCode' => '<div id="tst" style="display:none;"></div><input readonly="readonly" type="text" name="document_no" id="document_no" value=\'{$fields.document_no.value}\'>
<input type="hidden" name="number" id="number" value=\'{$fields.number.value}\'>'
),
array (
'name' => 'assigned_user_name',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'parent_name',
'tabIndex' => '1'
),
array (
'name' => 'ecmpaymentcondition_name',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'type',
'tabIndex' => '1'
),
array (
'name' => 'ecmdeliverycondition_name',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'status',
'tabIndex' => '1'
),
array (
'name' => 'stock_id',
'label' => 'LBL_STOCK_NAME',
'customCode' => '{$STOCK}'
)
),
array (
'name',
array (
'name' => 'parent_document_no',
'label' => 'LBL_PARENT_DOCUMENT_NO'
)
),
array (
array (
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
),
''
),
array (
'send_date',
array (
'name' => 'ecmprice_name',
'label' => 'LBL_ECMPRICE'
)
),
array (
array (
'name' => 'delivery_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
),
array (
'label' => 'LBL_PRICEBOOK',
'name' => 'pricebook',
'customCode' => ' <div id=\'pricebooks\'></div>'
)
),
array (
'send_accepted' ,
'wz_name'
),
array (
array (
'name' => 'main_sale_number',
'tabIndex' => '1'
),
''
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
)
),
array (
array (
'name' => 'parent_name_copy',
'tabIndex' => '1',
'customCode' => '<input type="text" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" readOnly="readonly" size="30" />'
),
array (
'name' => 'ecmlanguage',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'parent_nip',
'tabIndex' => '1'
),
array (
'name' => 'no_tax',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'parent_address_street',
'tabIndex' => '1',
'customCode' => '<textarea tabindex="1" id="parent_address_street" name="parent_address_street" rows="2" cols="30" maxlength="150" >{$fields.parent_address_street.value}</textarea>'
),
array (
'name' => 'currency_id',
'label' => 'LBL_CURRENCY'
)
),
array (
array (
'name' => 'parent_address_city',
'tabIndex' => '1',
'customCode' => '<input maxlength="8" type="text" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" style="vertical-align:top;width:150px;" />'
),
''
),
array (
array (
'name' => 'parent_address_country',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'parent_iln',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'parent_supplier_code',
'tabIndex' => '1'
)
),
// shipping address section
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_SHIPPING_ADDRESS}</h4>'
)
),
array (
array (
'name' => 'shipping_address',
'customCode' => '&nbsp<div id=\'addresses\'></div>'
),
''
),
array (
array (
'name' => 'shipping_address_name',
'tabIndex' => '1',
'customCode' => '<input type="text" name="shipping_address_name" id="shipping_address_name" value="{$fields.shipping_address_name.value}" size="30" />'
)
),
array (
array (
'name' => 'shipping_address_street',
'tabIndex' => '1',
'customCode' => '<textarea tabindex="1" id="shipping_address_street" name="shipping_address_street" rows="2" cols="30" maxlength="150" >{$fields.shipping_address_street.value}</textarea>'
)
),
array (
array (
'name' => 'shipping_address_city',
'tabIndex' => '1',
'customCode' => '<input maxlength="8" type="text" name="shipping_address_postalcode" id="shipping_address_postalcode" value="{$fields.shipping_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="shipping_address_city" id="shipping_address_city" value="{$fields.shipping_address_city.value}" style="vertical-align:top;width:150px;" />'
)
),
array (
array (
'name' => 'shipping_address_country',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'shipping_iln',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'shipping_nip',
'tabIndex' => '1'
)
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>Ustawienia zamówienia okresowego</h4>'
)
),
array (
array (
'name' => 'sale_date_interval',
'label' => 'Powtarzaj co',
'customCode' => '<input type="number" min="1" value="{$fields.sale_date_interval.value}" max="12" id="sale_date_interval" name="sale_date_interval"/> Miesięcy'
)
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PDF_TEXT}</h4>'
)
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'name' => 'pdf_text'
)
)
),
'LBL_ITEMS_TAB' => array (
array (
array (
'type' => 'tab'
)
),
array (
array (
'allCols' => true,
'hideLabel' => true,
'customCode' => '
<div id="searchProducts" class="edit view search basic">
<br>
{$MOD.LBL_SEARCH}:&nbsp;&nbsp;
<input type="text" value="" id="searchProductsInput"/>
{$MOD.LBL_CATEGORY}:&nbsp;&nbsp;
<select id="productSearchCategory"></select>
{$MOD.LBL_SEARCH_STOCK}:&nbsp;&nbsp;
<select id="productSearchStock">
<option value="1">{$MOD.LBL_SEARCH_STOCK_OPT_NO}</option>
<option value="2">{$MOD.LBL_SEARCH_STOCK_OPT_YES}</option>
<option value="3">{$MOD.LBL_SEARCH_STOCK_OPT_NOT_NULL}</option>
</select>
{$MOD.LBL_SEARCH_SORT}:&nbsp;&nbsp;
<select id="productSearchSort">
<option value="1">{$MOD.LBL_SEARCH_SORT_CODE}</option>
<option value="2">{$MOD.LBL_SEARCH_SORT_CODE_DESC}</option>
<option value="3">{$MOD.LBL_SEARCH_SORT_NAME}</option>
<option value="4">{$MOD.LBL_SEARCH_SORT_NAME_DESC}</option>
</select>
</div>
<div id="searchResultDiv"/></div>
<br><br><div id="itemsTable"></div>'
)
)
)
)
);

View File

@@ -0,0 +1,171 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* ***************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License.
* You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
* ******************************************************************************
*/
$listViewDefs ["EcmSales"] = array (
'STATUS' => array (
'width' => '5',
'label' => 'LBL_STATUS',
'default' => true,
'sortable' => true
),
'DATE_ENTERED' => array (
'width' => '12',
'label' => 'Czas wprowadzenia',
'default' => true,
'sortable' => true
),
'DOCUMENT_NO' => array (
'width' => '5',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true
),
'NAME' => array (
'width' => '12',
'label' => 'LBL_NAME',
'default' => false,
'sortable' => true
),
'PARENT_NAME' => array (
'width' => '15',
'label' => 'LBL_PARENT_NAME',
'default' => true
),
'TOTAL_NETTO' => array (
'width' => '10',
'label' => 'LBL_TOTAL',
'align' => 'right',
'sumType' => 'sum',
'default' => true
),
'TYPE' => array (
'width' => '7',
'label' => 'Typ',
'default' => true
),
'MODIFIED_BY_NAME' => array (
'width' => '10',
'label' => 'LBL_MODIFIED_USER',
'module' => 'Users',
'id' => 'USERS_ID',
'default' => false,
'sortable' => false,
'related_fields' => array (
'modified_user_id'
)
),
'REGISTER_DATE' => array (
'width' => '5',
'label' => 'LBL_REGISTER_DATE',
'default' => true,
'sortable' => true
),
'DELIVERY_DATE' => array (
'width' => '5',
'label' => 'LBL_DELIVERY_DATE',
'default' => true,
'sortable' => true
),
'SHOP_NUMBER' => array (
'width' => '3',
'label' => 'Nr sklepu',
'default' => true,
'sortable' => false
),
'WZ' => array(
'width' => '3',
'label' => 'Dokument WZ',
'default' => true,
'sortable'=>false,
'align'=>'left',
'link' => false,
),
'FV' => array(
'width' => '3',
'label' => 'Faktura',
'default' => true,
'sortable'=>false,
'align'=>'left',
'link' => false,
),
'ZS' => array(
'width' => '3',
'label' => 'ZS Twinpol',
'default' => true,
'sortable'=>false,
'align'=>'left',
'link' => false,
),
'OPTIONS' => array (
'width' => '2',
'label' => 'PDF',
'default' => true,
'sortable' => false,
'align' => 'center'
)
);
?>

View File

@@ -0,0 +1,124 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchdefs['EcmSales'] = array (
'templateMeta' => array (
'maxColumns' => '2',
'widths' => array (
'label' => '10',
'field' => '30'
),
),
'layout' => array (
'basic_search' => array (
'document_no',
'name',
'parent_document_no',
'status',
'wz_name',
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
'advanced_search' => array (
'document_no',
'name',
'status',
'parent_name',
'parent_document_no',
'register_date',
'delivery_date',
'send_date',
),
),
);
?>

View File

@@ -0,0 +1,76 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
$GLOBALS['studioDefs']['EcmSales'] = array(
'LBL_DETAILVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmSales/DetailView.html',
'php_file' => 'modules/EcmSales/DetailView.php',
'type' => 'DetailView',
),
'LBL_EDITVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmSales/EditView.html',
'php_file' => 'modules/EcmSales/EditView.php',
'type' => 'EditView',
),
'LBL_LISTVIEW'=>array(
'template' => 'listview',
'meta_file' => 'modules/EcmSales/listviewdefs.php',
'type' => 'ListView',
),
'LBL_SEARCHFORM'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmSales/SearchForm.html',
'php_file' => 'modules/EcmSales/ListView.php',
'type' => 'SearchForm',
),
);

View File

@@ -0,0 +1,128 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Layout definition for Accounts
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$layout_defs['EcmSales']['subpanel_setup'] = array (
'notes' => array(
'order' => 10,
'module' => 'Notes',
'sort_order' => 'asc',
'sort_by' => 'date_entered',
'subpanel_name' => 'default',
'get_subpanel_data' => 'notes',
'add_subpanel_data' => 'note_id',
'title_key' => 'LBL_NOTES_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
),
),
'documents' => array(
'order' => 130,
'module' => 'Documents',
'subpanel_name' => 'default',
'get_subpanel_data' => 'documents',
'title_key' => 'Dokumenty',
),
/*
'emails' => array (
'order' => 15,
'module' => 'Emails',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'emails',
'add_subpanel_data' => 'emails_id',
'subpanel_name' => 'ForEcmSales',
'title_key' => 'LBL_EMAILS_SUBPANEL_TITLE',
'top_buttons' => array(),
),
*/
);
?>

View File

@@ -0,0 +1,20 @@
<?php
error_reporting(LC_ALL);
ini_set('display_errors', '1');
$documents = array (
array (
'module' => 'EcmSales',
'record' => '182405e7-e32c-f557-fda4-54afa0faf6d9'
),
array (
'module' => 'EcmSales',
'record' => '162607da-db41-b7b4-16b4-54aea4b3d480'
),
);
require_once 'include/ECM/EcmMultiPdf/EcmMultiPdf.inc';
$mp = new EcmMultiPdf ( $documents, 'multi.pdf', 'broswer' );
$mp->process ();
$r = $mp->getStatus ();
echo 'E: '.$r;
echo'koniec';

View File

@@ -0,0 +1,14 @@
<?php
$ids = explode(',',$_REQUEST['ids']);
$db = $GLOBALS['db'];
$res = $db->query("SELECT code, name, SUM(quantity) AS qty FROM ecmsaleitems WHERE ecmsale_id IN ('".implode("','", $ids)."') GROUP BY ecmproduct_id ORDER BY code");
$t = '<table style="border: 1px solid black; border-collapse: collapse;"><tr><td><b>Kod</b></td><td><b>Nazwa</b></td><td><b>Ilość</b></td></tr>';
while ($r = $db->fetchByAssoc($res))
$t.='<tr><td style="border: 1px solid black;">'.$r['code'].'</td><td style="border: 1px solid black;">'.$r['name'].'</td><td style="border: 1px solid black;">'.$r['qty'].'</td></tr>';
$t.='</table>';
echo $t;
?>

View File

@@ -0,0 +1,224 @@
<?php
ini_set ( 'display_errors', 1 );
/*
* Wgrywanie i czytanie plików XML do obiektu Autor: Dominik 'DranZi' Brzóska
*/
define ( "FILE_DIR", "/var/edi/e5/orders/" ); // ścieżka do katalogu z xml'kami
class readXML {
private $db;
private $file_name; // nazwa wgranego pliku
private $content; // zaladowany plik xml
private $nodes; // załadowane elementy
public $parent_iln;
public $parent_nip;
public $parent_id;
public $parent_name;
public $ecmpaymentcondition_id;
public $ecmpaymentcondition_name;
public $supplier_code;
public $register_date;
public $delivery_date;
public $assigned_user_id;
public $parent_document_no;
public $shipping_addresses;
public $parent_address_street;
public $parent_address_country;
public $parent_address_postalcode;
public $parent_address_city;
public $shipping_address_name;
public $shipping_address_street;
public $shipping_address_country;
public $shipping_address_postalcode;
public $shipping_address_city;
public $shipping_nip;
public $shipping_iln;
public $position_list;
private $c;
/*
* Wgrywa plik na serwer
*/
function UploadXMLFile() {
$allowedExts = array (
"xml"
);
$temp = explode ( ".", $_FILES ["file"] ["name"] );
$extension = end ( $temp );
$this->file_name = date ( "Y_d_m" ) . str_replace ( " ", "", str_replace ( "_", "", str_replace ( ".", "", microtime () ) ) ) . '.' . $extension;
if ($_FILES ["file"] ["error"] > 0) {
return '0';
} else {
if (file_exists ( FILE_DIR . $_FILES ["file"] ["name"] )) {
return '0';
} else {
move_uploaded_file ( $_FILES ["file"] ["tmp_name"], FILE_DIR . $this->file_name );
return $this->file_name;
}
}
}
//add mz 2014-10-15
//Pobiera jedynie nazwę składającego zamówienie
function loadAccount($file) {
$this->db = $GLOBALS ['db'];
if ($file == '')
$file = $this->file_name;
else
$this->file_name = $file;
$this->content = file_get_contents ( FILE_DIR . $this->file_name );
$this->nodes = new SimpleXMLElement ( $this->content );
$result = $this->db->fetchByAssoc ( $this->db->query ( "select name from accounts where iln like '" . $this->nodes->{'Order-Parties'}->Buyer->ILN . "'" ) );
return $result['name'];
}
/*
* Otwiera plik XML :)
*/
function loadXMLFile($file) {
$this->db = $GLOBALS ['db'];
if ($file == '')
$file = $this->file_name;
else
$this->file_name = $file;
$this->content = file_get_contents ( FILE_DIR . $this->file_name );
$this->nodes = new SimpleXMLElement ( $this->content );
// pobierz dane z klienta
$result = $this->db->fetchByAssoc ( $this->db->query ( "select to_vatid,billing_address_street,billing_address_city,billing_address_postalcode,billing_address_country,id,assigned_user_id,name,parent_id,supplier_code,ecmpaymentcondition_id,ecmpaymentcondition_name from accounts where iln like '" . $this->nodes->{'Order-Parties'}->Buyer->ILN . "'" ) );
$this->parent_id = $result ['id'];
$this->parent_name = $result ['name'];
$this->parent_iln = $this->nodes->{'Order-Parties'}->Buyer->ILN;
$this->parent_nip = $result ['to_vatid'];
$this->parent_address_street = $result ['billing_address_street'];
$this->parent_address_city = $result ['billing_address_city'];
$this->parent_address_postalcode = $result ['billing_address_postalcode'];
$this->parent_address_country = $result ['billing_address_country'];
$this->parent_document_no = $this->nodes->{'Order-Header'}->OrderNumber;
$this->shop_number = $this->nodes->{'Order-Header'}->Remarks;
$this->edi_zs_id = $this->nodes->{'Order-Header'}->OrderZsId;
$this->edi_zs_document_no = $this->nodes->{'Order-Header'}->OrderZsNumber;
// adres dostawy
// pobierz dane z klienta
$result3 = $this->db->fetchByAssoc ( $this->db->query ( "select to_vatid,shipping_address_street,shipping_address_city,shipping_address_postalcode,shipping_address_country,id,assigned_user_id,name,parent_id,supplier_code,ecmpaymentcondition_id,ecmpaymentcondition_name from accounts where iln like '" . $this->nodes->{'Order-Parties'}->DeliveryPoint->ILN . "'" ) );
$this->shipping_address_name = $result3 ['name'];
$this->shipping_addresses = $result3 ['name'];
$this->shipping_address_street = $result3 ['shipping_address_street'];
$this->shipping_address_city = $result3 ['shipping_address_city'];
$this->shipping_address_postalcode = $result3 ['shipping_address_postalcode'];
$this->shipping_address_country = $result3 ['shipping_address_country'];
$this->shipping_iln = $this->nodes->{'Order-Parties'}->DeliveryPoint->ILN;
$this->shipping_nip = $result3 ['to_vatid'];
if ($result ['ecmpaymentcondition_id'])
$this->ecmpaymentcondition_id = $result ['ecmpaymentcondition_id'];
if ($result ['supplier_code'])
$this->supplier_code = $result ['supplier_code'];
$result2 = $this->db->fetchByAssoc ( $this->db->query ( "select supplier_code,ecmpaymentcondition_id,ecmpaymentcondition_name from accounts where id='" . $result ['parent_id'] . "'" ) );
if ($result2 ['ecmpaymentcondition_id'])
$this->ecmpaymentcondition_id = $result2 ['ecmpaymentcondition_id'];
if ($result2 ['supplier_code'])
$this->supplier_code = $result2 ['supplier_code'];
if (isset ( $this->ecmpaymentcondition_id ) && $this->ecmpaymentcondition_id != '') {
$pc = new EcmPaymentCondition ();
$pc->retrieve ( $this->ecmpaymentcondition_id );
$this->ecmpaymentcondition_name = $pc->name;
unset ( $pc );
}
$this->register_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->OrderDate ) );
$this->delivery_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->ExpectedDeliveryDate ) );
$this->assigned_user_id = $_SESSION ['authenticated_user_id'];
$this->position_list = array ();
}
function checkProducts($position_list) {
$xmlSize = count($this->nodes->{'Order-Lines'}->Line);
$plSize = count($position_list);
$missedProducts = [];
if ($xmlSize == $plSize) {
return $missedProducts; // Everything is fine
}
// If there are some missed products we have to find them!
$i = 0;
foreach ( $this->nodes->{'Order-Lines'}->Line as $prod ) {
$i++;
$ean = ( string ) trim ( $prod->{'Line-Item'}->EAN );
if ($i == 5) $ean.='TEST';
$fromPl = array_map(function ($prod) { return $prod['product_ean']; }, $position_list);
if (!in_array($ean, $fromPl)) {
array_push($missedProducts, $ean);
}
}
return $missedProducts;
}
/*
* Pobiera produkty z xml
*/
function getPositionList($array = false) {
$this->c = 0;
foreach ( $this->nodes->{'Order-Lines'}->Line as $prod ) {
$w = $this->db->query ( "select p.id from ecmproducts as p where (TRIM(p.ean)='" . trim ( $prod->{'Line-Item'}->EAN ) . "' OR TRIM(p.ean2)='" . trim ( $prod->{'Line-Item'}->EAN ) . "') and p.deleted='0'" );
$r = $GLOBALS ['db']->fetchByAssoc ( $w );
$ecmp = new EcmProduct ();
$ecmp->retrieve ( $r ['id'] );
if($this->parent_id=='1b9643ca-5b1a-8f9b-b809-586b5619b068'){
$w2 = $this->db->query ( "select price,recipient_code from ecmpricebooks_ecmproducts where ecmpricebook_id='13b29aa1-48f0-de58-7630-59c22756c5e4' and ecmproduct_id='".$ecmp->id."' and deleted=0" );
$r2 = $GLOBALS ['db']->fetchByAssoc ( $w2 );
$this->position_list [$this->c] ['product_id'] = $ecmp->id;
$this->position_list [$this->c] ['position'] = ( string ) $prod->{'Line-Item'}->LineNumber;
$this->position_list [$this->c] ['product_code'] = $ecmp->code;
$this->position_list [$this->c] ['name'] = $ecmp->name;
$this->position_list [$this->c] ['quantity'] = ( string ) $prod->{'Line-Item'}->OrderedQuantity;
$this->position_list [$this->c] ['price_start'] = ( string ) $r2['price'];
$this->position_list [$this->c] ['price_netto'] = ( string ) $r2['price'];
$this->position_list [$this->c] ['discount'] = 0;
$this->position_list [$this->c] ['total_netto'] = ( string ) $r2['price'] * $prod->{'Line-Item'}->OrderedQuantity;
$this->position_list [$this->c] ['unit_id'] = 1;
$this->position_list [$this->c] ['unit_name'] = 'szt.';
$this->position_list [$this->c] ['ecmvat_id'] = $ecmp->vat_id;
$this->position_list [$this->c] ['ecmvat_name'] = $ecmp->vat_name;
$this->position_list [$this->c] ['ecmvat_value'] = $ecmp->vat_value;
$this->position_list [$this->c] ['recipient_code'] = ( string )$r2['recipient_code'];
$this->position_list [$this->c] ['product_ean'] = ( string ) trim ( $prod->{'Line-Item'}->EAN );
} else {
$this->position_list [$this->c] ['product_id'] = $ecmp->id;
$this->position_list [$this->c] ['position'] = ( string ) $prod->{'Line-Item'}->LineNumber;
$this->position_list [$this->c] ['product_code'] = $ecmp->code;
$this->position_list [$this->c] ['name'] = $ecmp->name;
$this->position_list [$this->c] ['quantity'] = ( string ) $prod->{'Line-Item'}->OrderedQuantity;
$this->position_list [$this->c] ['price_start'] = ( string ) $prod->{'Line-Item'}->OrderedUnitNetPrice;
$this->position_list [$this->c] ['price_netto'] = ( string ) $prod->{'Line-Item'}->OrderedUnitNetPrice;
$this->position_list [$this->c] ['discount'] = 0;
$this->position_list [$this->c] ['total_netto'] = ( string ) $prod->{'Line-Item'}->OrderedUnitNetPrice * $prod->{'Line-Item'}->OrderedQuantity;
$this->position_list [$this->c] ['unit_id'] = 1;
$this->position_list [$this->c] ['unit_name'] = 'szt.';
$this->position_list [$this->c] ['ecmvat_id'] = $ecmp->vat_id;
$this->position_list [$this->c] ['ecmvat_name'] = $ecmp->vat_name;
$this->position_list [$this->c] ['ecmvat_value'] = $ecmp->vat_value;
$this->position_list [$this->c] ['recipient_code'] = ( string ) $prod->{'Line-Item'}->BuyerItemCode;
$this->position_list [$this->c] ['product_ean'] = ( string ) trim ( $prod->{'Line-Item'}->EAN );
}
$this->c ++;
}
$json = getJSONobj ();
return $array ? $this->position_list : $json->encode ( $this->position_list );
}
/*
* załaduj dane do zewnętrznej klasy
*/
function loader($klasa) {
foreach ( $this as $key => $value ) {
$rp = new ReflectionProperty ( $this, $key );
if ($rp->isPrivate () == 1)
continue;
$klasa->$key = $this->$key;
}
}
}
?>

122
modules/EcmSales/test.php Normal file
View File

@@ -0,0 +1,122 @@
<?php
ini_set ( "soap.wsdl_cache_enabled", "0" );
require_once ("nusoap/nusoap.php");
$soapUrl = 'http://system.saas-systems.pl/soap.php?wsdl';
$soapUser = 'admin';
$soapPassword = 'rudemodz123';
$client = new nusoap_client ( $soapUrl, 'wsdl' );
$login_parameters = array (
'user_auth' => array (
'user_name' => $soapUser,
'password' => md5 ( $soapPassword ),
'version' => '1'
),
'application_name' => 'SoapTest',
'name_value_list' => array ()
);
$login_result = $client->call ( 'login', $login_parameters );
if ($login_result ['id'] != '') {
$session_id = $login_result ['id'];
$sdi = new EcmInvoiceOut();
$sdi->retrieve('471275d4-c5e5-f599-a83d-59bb88f30660');
$sdi_fields = array ();
$sdi_fields [] = array (
"name" => 'parent_id',
"value" => 'f084e64a-4e63-a3d1-6417-58cbf730df3f'
);
$sdi_fields [] = array (
"name" => 'parent_name',
"value" => 'E5 Polska Sp. z o.o.'
);
$sdi_fields [] = array (
"name" => 'parent_address_street',
"value" => 'ul. Wąwozowa 11'
);
$sdi_fields [] = array (
"name" => 'parent_address_postalcode',
"value" => '02-796'
);
$sdi_fields [] = array (
"name" => 'parent_address_city',
"value" => 'Warszawa'
);
$sdi_fields [] = array (
"name" => 'parent_address_country',
"value" => 'Polska '
);
$sdi_fields [] = array (
"name" => 'parent_nip',
"value" => '525-21-73-990'
);
$sdi_fields [] = array (
"name" => 'kind',
"value" => 'other'
);
$sdi_fields [] = array (
"name" => 'stock_id',
"value" => '754a59d6-979f-7006-a202-57c96a3eb06b'
);
$sdi_fields [] = array (
"name" => 'name',
"value" => $sdi->document_no
);
$sdi_fields [] = array (
"name" => 'id',
"value" => $sdi->id
);
$sdi_fields [] = array (
"name" => 'total_netto',
"value" => format_number($sdi->total_netto)
);
$sdi_fields [] = array (
"name" => 'date_fk',
"value" => date("d.m.Y")
);
$sdi_fields [] = array (
"name" => 'register_date',
"value" => date("d.m.Y")
);
$sdi_fields [] = array (
"name" => 'new_with_id',
"value" => true
);
$sdi_fields [] = array (
"name" => 'position_list',
"value" => serialize ( $sdi->getPositionList ( true ) )
);
$set_entry_parameters = array (
// session id
"session" => $session_id,
// The name of the module from which to retrieve records.
"module_name" => "EcmStockDocIns",
// Record attributes
"name_value_list" => $sdi_fields
)
;
$set_entry_result = $client->call ( "set_entry", $set_entry_parameters );
}
?>

View File

@@ -0,0 +1,366 @@
<!-- Tablesorter -->
<script type="text/javascript" src="include/jQuery/jquery-ui-lite/jquery-1.12.4.js"></script>
<link class="theme" rel="stylesheet" href="include/jQuery/jquery-ui-lite/jquery-ui.css">
<script type="text/javascript" src="include/jQuery/jquery-ui-lite/jquery-ui.js"></script>
<script src="modules/EcmReports/TableSorterNew/js/jquery.tablesorter.js"></script>
<script src="modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets.js"></script>
<link class="theme" rel="stylesheet" href="modules/EcmReports/TableSorterNew/css/theme.blue.css">
<script type="text/javascript" src="modules/EcmReports/javascript/RaportZamowien.js"></script>
<style type="text/css">
{literal}
thead, tfoot {font-weight: bold;}
.additionalColumn {
background-color: #87CCED;
border-top: 1px solid black;
}
.groupActive {
border-top: 1px solid black;
border-bottom: 1px solid black;
border-left: 1px solid black;
background-color: #87CCED;
}
.sumRow {
background-color: #BDC7B5;
}
.sumAll td{
background-color: #BDC7B5;
}
table.tablesorter tbody tr:hover td {
background: #E8E8E8;
color: #343432;
}
/* Extra selectors needed to override the default styling */
table.tablesorter tbody tr.normal-row td {
background: #EFEFF1;
color: #343432;
}
table.tablesorter tbody tr.alt-row td {
background: #FFF;
color: #343432;
}
/* Extra selectors needed to override the default styling */
table.tablesorter tbody tr.normal-row:hover td {
background: #E8E8E8;
color: #343432;
}
table.tablesorter tbody tr.alt-row:hover td {
background: #E8E8E8;
color: #343432;
}
table.tablesorter tbody tr.sumAll td {
background: #EBEBED;
color: black;
}
table.tablesorter tbody tr.sumAll:hover td {
background: #E0E0E2;
color: black;
font-weight: bold;
}
table.tablesorter .sumRow, .oddListRowS1 {
text-align: right;
}
table.tablesorter .alignLeft {
text-align: left;
}
table.tablesorter .subcategory .alignLeft {
padding-left: 20px;
}
table.tablesorter .contractor .alignLeft {
padding-left: 40px;
}
.plusStyle {
color: #abc3d7;
text-decoration: none;
cursor: pointer;
}
.green-text{
color:#2E8B57;
}
.fix {
position: absolute;
margin-left: -50px;
width: 100px;
}
.outer {
position: relative;
}
.inner {
overflow-x: scroll;
overflow-y: visible;
width: auto;
margin-left: 100px;
}
@media screen and (max-width: 1920px) {
.inner {
overflow-x: scroll;
overflow-y: visible;
width: 1720px;
margin-left: 100px;
}
}
@media screen and (max-width: 1680px) {
.inner {
overflow-x: scroll;
overflow-y: visible;
width: 1520px;
margin-left: 100px;
}
}
@media screen and (max-width: 1600px) {
.inner {
overflow-x: scroll;
overflow-y: visible;
width: 1460px;
margin-left: 100px;
}
}
@media screen and (max-width: 1440px) {
.inner {
overflow-x: scroll;
overflow-y: visible;
width: 1220px;
margin-left: 100px;
}
}
{/literal}
</style>
<script>
// call the tablesorter plugin
{literal}
$(document).ready(function(){
$("table").tablesorter({
// extra css class applied to the table row containing the filters & the inputs within that row
filter_cssFilter : '',
// If there are child rows in the table (rows with class name from "cssChildRow" option)
// and this option is true and a match is found anywhere in the child row, then it will make that row
// visible; default is false
filter_childRows : false,
// if true, filters are collapsed initially, but can be revealed by hovering over the grey bar immediately
// below the header row. Additionally, tabbing through the document will open the filter row when an input gets focus
filter_hideFilters : false,
// Set this option to false to make the searches case sensitive
filter_ignoreCase : true,
// jQuery selector string of an element used to reset the filters
filter_reset : '.reset',
// Use the $.tablesorter.storage utility to save the most recent filters
filter_saveFilters : true,
// Delay in milliseconds before the filter widget starts searching; This option prevents searching for
// every character while typing and should make searching large tables faster.
filter_searchDelay : 300,
// Set this option to true to use the filter to find text from the start of the column
// So typing in "a" will find "albert" but not "frank", both have a's; default is false
filter_startsWith : false,
// if false, filters are collapsed initially, but can be revealed by hovering over the grey bar immediately
// below the header row. Additionally, tabbing through the document will open the filter row when an input gets focus
filter_hideFilters : false,
theme: 'blue',
// initialize zebra striping of the table
widthFixed : false,
// initialize zebra striping of the table
widgets: ['zebra','stickyHeaders'],
// change the default striping class names
// updated in v2.1 to use widgetOptions.zebra = ["even", "odd"]
// widgetZebra: { css: [ "normal-row", "alt-row" ] } still works
widgetOptions : {
zebra : [ "normal-row", "alt-row" ]
},
headers : {
6 : { sorter: 'number' },
7 : { sorter: 'number' },
},
sortList: [[0,0]]
});
});
$( function() {
$( document ).tooltip({
items: "[title]",
content: function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
return element.attr( "title" );
}
}});
} );
{/literal}
</script>
<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>Specyfikacja do zamówień: {$orderNo}</h2></td>
</tr>
</table>
<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>Zamówienie sprzedaży: Lista komponentów</h2></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th width="5%"><input type="checkbox" name="selectall" id="selectall"></th>
<th width="10%">{$MOD.LBL_LISTNEWSALES_PRODUCTCODE}</th>
<th width="25%">{$MOD.LBL_LISTNEWSALES_PRODUCTNAME}</th>
<th width="15%">{$MOD.LBL_LISTNEWSALES_CATEGORY}</th>
<th width="5%">{$MOD.LBL_LISTNEWSALES_GROUP_KS}</th>
<th width="5%">J.M.</th>
<th width="12%">{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th width="12%">{$MOD.LBL_LISTNEWSALES_STOCK}</th></tr>
</thead>
<tbody>
{foreach from=$components_list key="key" item="item" name="components"}
<tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td >{$item.code}</td>
<td >{$item.name}</td>
<td>{$item.product_category_name}</td>
<td >{$item.group_ks_name}</td>
<td>{$item.unit_name}</td>
{if $item.quantity>$item.stock}
<td style="text-align: right;color:red;" data-value="{$item.quantity}">{$item.quantity|number_format:2:".":""}</td>
<td style="text-align: right;color:red;" data-value="{$item.stock}">{$item.stock|number_format:2:".":""}</td>
{else}
<td style="text-align: right;" data-value="{$item.quantity}">{$item.quantity|number_format:2:".":""}</td>
<td style="text-align: right;" data-value="{$item.stock}">{$item.stock|number_format:2:".":""}</td>
{/if}
</tr>
{/foreach}
</tbody><tr>
<td widtd="5%"></td>
<td widtd="20%"></td>
<td widtd="20%"></td>
<td widtd="40%" style="text-align: right;"><b>{$MOD.LBL_LISTNEWSALES_SUMMARY}</b></td>
<td widtd="5%"></td>
<td widtd="5%"></td>
<td widtd="15%" style="text-align: right;"><b>{$total_components|number_format:2:".":""}</b></td>
<td widtd="15%" style="text-align: right;"><b>{$total_in_stock|number_format:2:".":""}</b></td></tr></table>
<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>Zamówienie sprzedaży: Lista produktów bez komponentów</h2></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th width="5%"><input type="checkbox" name="selectall" id="selectall"></th>
<th width="10%">{$MOD.LBL_LISTNEWSALES_PRODUCTCODE}</th>
<th width="35%">{$MOD.LBL_LISTNEWSALES_PRODUCTNAME}</th>
<th width="15%">{$MOD.LBL_LISTNEWSALES_CATEGORY}</th>
<th width="5%">{$MOD.LBL_LISTNEWSALES_GROUP_KS}</th>
<th width="5%">J.M.</th>
<th width="12%">{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th width="12%">{$MOD.LBL_LISTNEWSALES_STOCK}</th></tr>
</thead>
<tbody>
{foreach from=$products key="key" item="item" name="components"}
<tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td >{$item.code}</td>
<td >{$item.name}</td>
<td>{$item.product_category_name}</td>
<td >{$item.group_ks_name}</td>
<td>{$item.unit_name}</td>
{if $item.quantity>$item.stock}
<td style="text-align: right;color:red;" data-value="{$item.quantity}">{$item.quantity|number_format:2:".":""}</td>
<td style="text-align: right;color:red;" data-value="{$item.stock}">{$item.stock|number_format:2:".":""}</td>
{else}
<td style="text-align: right;" data-value="{$item.quantity}">{$item.quantity|number_format:2:".":""}</td>
<td style="text-align: right;" data-value="{$item.stock}">{$item.stock|number_format:2:".":""}</td>
{/if}
</tr>
{/foreach}
</tbody><tr>
<td widtd="5%"></td>
<td widtd="20%"></td>
<td widtd="20%"></td>
<td widtd="40%" style="text-align: right;"><b>{$MOD.LBL_LISTNEWSALES_SUMMARY}</b></td>
<td widtd="5%"></td>
<td widtd="5%"></td>
<td widtd="15%" style="text-align: right;"><b>{$total|number_format:2:".":""}</b></td>
<td widtd="15%" style="text-align: right;"><b>{$total_in_stock2|number_format:2:".":""}</b></td></tr></table>
<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>Zamówienie sprzedaży: Lista potrzebnych kartonów i palet</h2></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th width="5%"><input type="checkbox" name="selectall" id="selectall"></th>
<th width="40%">Karton</th>
<th width="5%">{$MOD.LBL_LISTNEWSALES_GROUP_KS}</th>
<th width="12%">Ilość kartonów</th>
<th width="12%">Ilość palet</th></tr>
</thead>
<tbody>
{foreach from=$packing key="key" item="item" name="components"}
<tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td >{$item.name}</td>
<td >{$item.group_ks_name}</td>
<td style="text-align: right;" data-value="{$item.box}">{$item.box|ceil}</td>
<td style="text-align: right;" data-value="{$item.palet}">{$item.palet|ceil}</td>
</tr>
{/foreach}
</tbody><tr>
<td widtd="5%"></td>
<td widtd="20%"></td>
<td widtd="5%"></td>
<td widtd="15%" style="text-align: right;"><b>{$total_box|number_format:2:".":""}</b></td>
<td widtd="15%" style="text-align: right;"><b>{$total_palet|number_format:2:".":""}</b></td></tr></table>

View File

@@ -0,0 +1,320 @@
<script type="text/javascript"
src="include/ECM/EcmMultiPdf/EcmMultiPdf.js"></script>
<script type="text/javascript"
src="include/jQuery/jquery.blockUI.js"></script>
<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>{$MOD.LBL_LISTNEWSALES_NAME}</h2></td>
</tr>
</table>
<br />
<form action="index.php?module=EcmSales&action=ListNewSales" method="get" name="SearchFormListNewSales"><ul class="tablist" style="width:100%;">
<input type="hidden" name="module" value="EcmSales">
<input type="hidden" name="action" value="ListNewSales">
<li>
<a class="current" href="#">{$MOD.LBL_SEARCH}</a>
</li>
</ul>
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_DATE_START}:
</td>
<td width="30%" nowrap="" >
<input type="text" maxlength="10" size="11" tabindex="" title="" value="{if $POST.date_from!=''}{$POST.date_from}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}" id="date_from" name="date_from" autocomplete="off">
<img align="absmiddle" border="0" id="date_from_trigger" name="date_from_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "date_from",
daFormat : "%d.%m.%Y",
button : "date_from_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" maxlength="10" size="11" tabindex="" title="" value="{if $POST.date_to!=''}{$POST.date_to}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}" id="date_to" name="date_to" autocomplete="off">
<img align="absmiddle" border="0" id="date_to_trigger" name="date_to_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "date_to",
daFormat : "%d.%m.%Y",
button : "date_to_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_ACCOUNT_NAME}:
</td>
<td width="5%" nowrap="" >
<input type="text" title="" value="{if $POST.account_name!=''}{$POST.account_name}{/if}" size="" id="account_name" tabindex="" name="account_name">
<input type="hidden" value="{if $POST.account_id!=''}{$POST.account_id}{/if}" id="account_id" name="account_id">
<input type="button" onclick="{literal}open_popup(&quot;Accounts&quot;, 600, 400, &quot;&quot;, true, false, {&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;SearchFormListNewSales&quot;,&quot;field_to_name_array&quot;:{&quot;id&quot;:&quot;account_id&quot;,&quot;name&quot;:&quot;account_name&quot;}}, &quot;single&quot;, true);{/literal}" value="Wybierz" class="button" accesskey="T" title="Select [Alt+T]" tabindex="" name="btn_account_name">
<button value="Wyczyść" onclick="this.form.account_name.value = ''; this.form.account_id.value = '';" class="button lastChild" accesskey="C" title="Wyczyść[Alt+C]" tabindex="" name="btn_clr_parent_name_basic" type="button"><img src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_DOCUMENT_CREATE_DATE_START}:
</td>
<td width="30%" nowrap="" >
<input type="text" value="{if $POST.time_from!=''}{$POST.time_from}{/if}" id="time_from" name="time_from">
<img align="absmiddle" border="0" id="time_from_trigger" name="time_from_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "time_from",
daFormat : "%d.%m.%Y",
button : "time_from_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" value="{if $POST.time_to!=''}{$POST.time_to}{/if}" id="time_to" name="time_to">
<img align="absmiddle" border="0" id="time_to_trigger" name="time_to_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "time_to",
daFormat : "%d.%m.%Y",
button : "time_to_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_NOT_ASSIGNED}:
</td>
<td width="5%" nowrap="" >
<input type="checkbox" name="wz" value="1" {if $POST.wz=='1'}checked{/if}>
</td>
</tr>
<tr>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_ORDER_NO}:
</td>
<td width="5%" nowrap="" >
<input type="text" value="{if $POST.parent_order_no!=''}{$POST.parent_order_no}{/if}" name="parent_order_no">
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTNEWSALES_ORDER_TYPE}:
</td>
<td width="30%" nowrap="nowrap" class="dataField"><select id="sale_type" name="sale_type">
<option selected="" value="all" {if $POST.sale_type=='all'}selected{/if}>Wszystkie</option>
<option value="sale" {if $POST.sale_type=='sale'}selected{/if}>Zamówienie</option>
<option value="gratis" {if $POST.sale_type=='gratis'}selected{/if}>Próbki</option>
</select></td>
<td width="5%" nowrap="" >
Data wysyłki od
</td>
<td width="30%" nowrap="" >
<input type="text" maxlength="10" size="11" tabindex="" title="" value="{if $POST.date_send_from!=''}{$POST.date_send_from}{else}{/if}" id="date_send_from" name="date_send_from" autocomplete="off">
<img align="absmiddle" border="0" id="date_send_from_trigger" name="date_send_from_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "date_send_from",
daFormat : "%d.%m.%Y",
button : "date_send_from_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" maxlength="10" size="11" tabindex="" title="" value="{if $POST.date_send_to!=''}{$POST.date_send_to}{else}{/if}" id="date_send_to" name="date_send_to" autocomplete="off">
<img align="absmiddle" border="0" id="date_send_to_trigger" name="date_send_to_trigger" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup ({
inputField : "date_send_to",
daFormat : "%d.%m.%Y",
button : "date_send_to_trigger",
singleClick : true,
dateStr : "",
step : 1,
weekNumbers:false
}
);
{/literal}
</script>
</td>
</tr>
</table>
<h3 style="color:red">{if $POST.date_send_from!='' && $POST.date_from!=''}Proszę wybrać date dostawy lub datę wysyłki{/if}</h3>
<input type="hidden" id="idss" value="">
<input type="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button">
<input type="button" onclick="location.href='index.php?module=EcmSales&amp;action=ListNewSales';" value="{$MOD.LBL_LISTNEWSALES_CLEAR}" name="clear" class="button">
<input type="button" id="gets" class="button" name="gets" value="{$MOD.LBL_LISTNEWSALES_CREATE_PDFS}" onclick="createMultiPdf()">
<input type="button" id="products_list" class="button" name="products_list" value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY}" onclick="getSelected(); getList();">
<input type="button" id="products_list" class="button" name="products_list" value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY} 2" onclick="getSelected(); getList2();">
<input type="button" id="products_list" class="button" name="products_list" value="Lista komponentów" onclick="getSelected(); getList3();">
<br>{if $LINK!=''}<a href="https://95.50.148.50/crm/pdftmp/{$LINK}">{$LINK}</a>{/if}
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th ><input type="checkbox" name="selectall" id="selectall"></th>
<th >{$MOD.LBL_LISTNEWSALES_POS}</th>
<th >{$MOD.LBL_LISTNEWSALES_NUMBER}</th>
<th >{$MOD.LBL_LISTNEWSALES_DESCRIPTION}</th>
<th >{$MOD.LBL_LISTNEWSALES_PARENT_NAME}</th>
<th >{$MOD.LBL_LISTNEWSALES_DELIVERY_DATE}</th>
<th ></th>
<th >Termin wysyłki</th>
<th >{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th >{$MOD.LBL_LISTNEWSALES_TOTAL_NETTO}</th>
<th >{$MOD.LBL_LISTNEWSALES_TOTAL_VAT}</th>
<th >{$MOD.LBL_LISTNEWSALES_TOTAL_BRUTTO}</th>
<th >{$MOD.LBL_LISTNEWSALES_TOTAL_INVOICE}</th>
<th >{$MOD.LBL_LISTNEWSALES_PERCENT}</th>
<th >{$MOD.LBL_LISTNEWSALES_CURRENCY}</th>
<th >{$MOD.LBL_LISTNEWSALES_PRINTED}</th>
<td >&nbsp;</td></tr>
</thead>
<tbody>
{foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''}
<tr style="vertical-align:top;">
<td ><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td >{$item.position}</td>
<td data-price="{$item.number}"><a href="index.php?module=EcmSales&action=DetailView&record={$item.id}">{$item.document_no}</a></td>
<td ></td>
<td ><a href="index.php?module=Accounts&action=DetailView&record={$item.parent_id}">{$item.parent_name}</a></td>
<td >{$item.delivery_date}</td>
<td><input type="checkbox" {if $item.send_accepted==true}checked="checked" {/if} disabled="disabled"></td>
<td >{$item.send_date} </td>
<td style="text-align: right">{$item.quantity}</td>
<td data-total="{$item.total_netto}" style="text-align: right">{$item.total_netto|number_format:2:".":","}</td>
<td data-total="{$item.total_vat}" style="text-align: right">{$item.total_vat|number_format:2:".":","}</td>
<td data-total="{$item.total_brutto}" style="text-align: right">{$item.total_brutto|number_format:2:".":","}</td>
<td data-total="{$item.total_invoice}" style="text-align: right">{$item.total_invoice|number_format:2:".":","}</td>
<td style="text-align: right">{$item.percent}<a style="cursor:pointer;" onclick="{literal}if(document.getElementById('div{/literal}{$item.id}{literal}').style.display=='none'){document.getElementById('div{/literal}{$item.id}{literal}').style.display='block';}else{document.getElementById('{/literal}div{$item.id}{literal}').style.display='none';}{/literal} "><img border="0" src="modules/EcmQuotes/images/search.gif"></a>
<div style="display:none; border: 1px solid #cccccc;background-color:#e6e6e6;padding:3px;"
id="div{$item.id}">
<table cellspacing="0" cellpadding="3" border="0">
<tbody><tr><td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td><td><strong>WZ</strong></td>
<td><strong>ETA</strong></td></tr>
{foreach from=$item.products key="ki" item="va" name="products"}
{if $va.code!=''}
<tr style="color:black;">
<td style="color:black;"><a href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a></td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td></tr>
{/if}
{/foreach}
<tr style="color:black;font-weight:bold"><td>Total</td>
<td>{$item.products.order_total|number_format:2:".":","}</td><td>{$item.products.wz_total|number_format:2:".":","}</td></tr><tr><td></td><td></td>
<td><span style="color:red;font-weight:bold">{$item.products.minus|number_format:2:".":","}</span></td></tr>
<tr><td></td><td></td><td><span style="color:green;font-weight:bold">{$item.products.plus|number_format:2:".":","}</span></td></tr></tbody></table></div>
</td>
<td style="text-align: right">{$CURRENCIES[$item.currency]}</td>
<td></td>
<td>
{if $item.type!='gratis'}
{if $item.fv_switch=='yes'}<img border="0" id="convert_to_invoice_{$item.id}" src="modules/EcmSales/images/convert_disabled.gif" title="{$item.fv_name}" style="cursor:pointer;" onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=DetailView&record={/literal}{$item.fv_id}{literal}','_newtab');{/literal} " />'{/if}
{if $item.fv_switch=='no'}<img border="0" id="convert_to_invoice_{$item.id}" src="modules/EcmSales/images/convert_enabled.gif" title="Create Invoice" onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=EditView&isWZ=true&wz_record={/literal}{$item.fv_id}{literal}','_newtab');{/literal}" style="cursor:pointer;" />{/if}
{if $item.wz_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif" title="{$item.wz_name}" onclick="{literal}window.open('index.php?module=EcmStockDocOuts&action=DetailView&record={/literal}{$item.wz_id}{literal}','_newtab');{/literal}" style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.wz_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif" title="{$MOD.LBL_LISTNEWSALES_CREATEWZ}" onclick="{literal}javascript:window.open('index.php?module=EcmStockDocOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}" style="cursor: pointer;" border="0">{/if}
{else}
{if $item.rw_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif" title="{$item.rw_name}" onclick="{literal}window.open('index.php?module=EcmStockDocInsideOuts&action=DetailView&record={/literal}{$item.rw_id}{literal}','_newtab');{/literal}" style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.rw_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif" title="{$MOD.LBL_LISTNEWSALES_CREATERW}" onclick="{literal}javascript:window.open('index.php?module=EcmStockDocInsideOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}" style="cursor: pointer;" border="0">{/if}
{/if}
<img src="modules/EcmSales/images/pdf.gif" title="Preview Sale" onclick="{literal}EcmPreviewPDF('index.php?module=EcmSales&action=previewPDF&method=I&record={$item.id}&to_pdf=1',{zoom:75,toolbar:1});{/literal}" style="cursor: pointer;" border="0">
</td></tr>
{/if}
{/foreach}
</tbody>
<tr style="vertical-align:top;">
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td>{$MOD.LBL_LISTNEWSALES_SUMMARY}:</td>
<td style="text-align: right">{$POSITION_LIST.total_quantity}</td>
<td style="text-align: right">{$POSITION_LIST.total_netto|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_vat|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_brutto|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_invoice|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_percent|string_format:"%.2f"}%<a style="cursor:pointer;" onclick="{literal}if(document.getElementById('div_all').style.display=='none'){document.getElementById('div_all').style.display='block';}else{document.getElementById('div_all').style.display='none';}{/literal}"><img border="0" src="modules/EcmQuotes/images/search.gif"></a>
<div style="display:none; border: 1px solid #cccccc;background-color:#e6e6e6;padding:3px;" id="div_all">
<table cellspacing="0" cellpadding="3" border="0"><tbody>
<tr><td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td>
<td><strong>WZ</strong></td>
<td><strong>ETA</strong></td>
{foreach from=$POSITION_LIST.total_product key="ki" item="va" name="products"}
{if $va.code!=''}
<tr style="color:black;">
<td style="color:black;"><a href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a></td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td></tr>
{/if}
{/foreach}
<tr style="color:black;font-weight:bold"><td>Total</td>
<td>{$POSITION_LIST.total_product.order_total|number_format:2:".":","}</td><td>{$POSITION_LIST.total_product.wz_total|number_format:2:".":","}</td></tr><tr><td></td><td></td>
<td><span style="color:red;font-weight:bold">{$POSITION_LIST.total_product.minus|number_format:2:".":","}</span></td></tr>
<tr><td></td><td></td><td><span style="color:green;font-weight:bold">{$POSITION_LIST.total_product.plus|number_format:2:".":","}</span></td></tr></tbody></table></div>
</table>

View File

@@ -0,0 +1,218 @@
<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>{$MOD.LBL_LISTNEWSALES_NAME}</h2>
</td>
</tr>
</table>
<br />
<form style="display:none;" action="index.php?module=EcmSales&action=ProductSummary" method="post"
name="SearchFormListNewSales">
<ul class="tablist" style="width:100%;">
<li>
<a class="current" href="#">{$MOD.LBL_SEARCH}</a>
</li>
</ul>
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_DATE_START}:
</td>
<td width="30%" nowrap="">
<input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_from!=''}{$POST.date_from}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
id="date_from" name="date_from" autocomplete="off">
<img align="absmiddle" border="0" id="date_from_trigger" name="date_from_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_from",
daFormat: "%d.%m.%Y",
button: "date_from_trigger",
singleClick: true,
dateStr: "",
step: 1,
weekNumbers: false
});
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_to!=''}{$POST.date_to}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
id="date_to" name="date_to" autocomplete="off">
<img align="absmiddle" border="0" id="date_to_trigger" name="date_to_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_to",
daFormat: "%d.%m.%Y",
button: "date_to_trigger",
singleClick: true,
dateStr: "",
step: 1,
weekNumbers: false
});
{/literal}
</script>
</td>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_ACCOUNT_NAME}:
</td>
<td width="5%" nowrap="">
<input type="text" title="" value="{if $POST.account_name!=''}{$POST.account_name}{/if}" size=""
id="account_name" tabindex="" name="account_name">
<input type="hidden" value="{if $POST.account_id!=''}{$POST.account_id}{/if}" id="account_id"
name="account_id">
<input type="button"
onclick="{literal}open_popup(&quot;Accounts&quot;, 600, 400, &quot;&quot;, true, false, {&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;SearchFormListNewSales&quot;,&quot;field_to_name_array&quot;:{&quot;id&quot;:&quot;account_id&quot;,&quot;name&quot;:&quot;account_name&quot;}}, &quot;single&quot;, true);{/literal}"
value="Wybierz" class="button" accesskey="T" title="Select [Alt+T]" tabindex=""
name="btn_account_name">
<button value="Wyczyść" onclick="this.form.account_name.value = ''; this.form.account_id.value = '';"
class="button lastChild" accesskey="C" title="Wyczyść[Alt+C]" tabindex=""
name="btn_clr_parent_name_basic" type="button"><img
src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
</td>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_DOCUMENT_CREATE_DATE_START}:
</td>
<td width="30%" nowrap="">
<input type="text" value="{if $POST.time_from!=''}{$POST.time_from}{/if}" id="time_from"
name="time_from">
<img align="absmiddle" border="0" id="time_from_trigger" name="time_from_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "time_from",
daFormat: "%d.%m.%Y",
button: "time_from_trigger",
singleClick: true,
dateStr: "",
step: 1,
weekNumbers: false
});
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" value="{if $POST.time_to!=''}{$POST.time_to}{/if}" id="time_to" name="time_to">
<img align="absmiddle" border="0" id="time_to_trigger" name="time_to_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "time_to",
daFormat: "%d.%m.%Y",
button: "time_to_trigger",
singleClick: true,
dateStr: "",
step: 1,
weekNumbers: false
});
{/literal}
</script>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_NOT_ASSIGNED}:
</td>
<td width="5%" nowrap="">
<input type="checkbox" name="wz" value="1" {if $POST.wz=='1'}checked{/if}>
</td>
</tr>
<tr>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_ORDER_NO}:
</td>
<td width="5%" nowrap="">
<input type="text" value="{if $POST.parent_order_no!=''}{$POST.parent_order_no}{/if}"
name="parent_order_no">
</td>
<td width="5%" nowrap="">
{$MOD.LBL_LISTNEWSALES_ORDER_TYPE}:
</td>
<td width="30%" nowrap="nowrap" class="dataField"><select id="sale_type" name="sale_type">
<option selected="" value="all" {if $POST.sale_type=='all'}selected{/if}>Wszystkie</option>
<option value="sale" {if $POST.sale_type=='sale'}selected{/if}>Zamówienie</option>
<option value="gratis" {if $POST.sale_type=='gratis'}selected{/if}>Próbki</option>
</select></td>
</tr>
</table>
<input type="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button">
<input type="button" onclick="location.href='index.php?module=EcmSales&amp;action=ListNewSales';"
value="{$MOD.LBL_LISTNEWSALES_CLEAR}" name="clear" class="button">
</form>
<form action="index.php?module=EcmSales&action=ProductSummary" method="get" name="SearchFormListNewSales">
{$MOD.LBL_LISTNEWSALES_GROUP_KS}: <select id="product_group" name="product_group">
<option selected="" value="all" {if $GET.product_group=='all'}selected{/if}>Wszystkie</option>
<option value="1" {if $GET.product_group=='1'}selected{/if}>{$MOD.LBL_LISTNEWSALES_GROUP_KS_1}</option>
<option value="2" {if $GET.product_group=='2'}selected{/if}>{$MOD.LBL_LISTNEWSALES_GROUP_KS_2}</option>
<option value="3" {if $GET.product_group=='3'}selected{/if}>{$MOD.LBL_LISTNEWSALES_GROUP_KS_3}</option>
</select>
<input type="hidden" value="EcmSales" name='module' id='module'>
<input type="hidden" value="ProductSummary" name='action' id='action'>
<input type="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button">
<input type="hidden" value="{$IDS}" name='ids' id='ids'>
</form>
<table cellspacing="0" cellpadding="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th width="5%"><input type="checkbox" name="selectall" id="selectall"></th>
<th width="8%">{$MOD.LBL_LISTNEWSALES_PRODUCTCODE}</th>
<th width="35%">{$MOD.LBL_LISTNEWSALES_PRODUCTNAME}</th>
<th width="12%">{$MOD.LBL_LISTNEWSALES_CATEGORY}</th>
<th width="4%">{$MOD.LBL_LISTNEWSALES_GROUP_KS}</th>
<th width="10%">{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th width="10%">{$MOD.LBL_LISTNEWSALES_STOCK}</th>
<th width="15">Adres magazynowy</th>
</tr>
</thead>
<tbody>
{foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''}
<tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf"
id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td>{$item.code}</td>
<td>{$item.name}</td>
<td>{$item.product_category_name}</td>
<td>{$item.group_ks_name}</td>
{if $item.quantity>$item.stock}
<td style="text-align: right;color:red;">{$item.quantity|number_format:2:".":","}</td>
<td style="text-align: right;color:red;">{$item.stock|number_format:2:".":","}</td>
{else}
<td style="text-align: right;">{$item.quantity|number_format:2:".":","}</td>
<td style="text-align: right;">{$item.stock|number_format:2:".":","}</td>
{/if}
<td>{$item.stock_addresses}</td>
</tr>
{/if}
{/foreach}
</tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><b>{$MOD.LBL_LISTNEWSALES_SUMMARY}:</b></td>
<td style="text-align: right;"><b>{$POSITION_LIST.quantity|number_format:2:".":","}</b></td>
<td style="text-align: right;"><b>{$POSITION_LIST.stock|number_format:2:".":","}</b></td>
<td></td>
</tr>
</table>
7

View File

@@ -0,0 +1,111 @@
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.24/datatables.min.css" />
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.24/datatables.min.js"></script>
<script>
{literal}
$(document).ready(function() {
$('#report').DataTable({
lengthMenu: [
[50, 100, 200, 500, -1],
[50, 100, 200, 500, "Wszystkie"]
],
pageLength: 200,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.24/i18n/Polish.json'
},
scrollX: true,
scrollY: "60vh",
scrollCollapse: true,
order: [[ 8, "desc" ]]
});
});
{/literal}
</script>
<style>
{literal}
div.dataTables_wrapper {
width: 95vw;
height: 50vw;
margin: 0 auto;
}
{/literal}
</style>
<br />
<table id="report" class="display nowrap hover" style="width:100%">
<thead>
<tr>
<th>Data zamówienia</th>
<th>Indeks produktu</th>
<th>Nazwa</th>
<th>Rozmiar</th>
<th>Rodzaj</th>
<th>Marka</th>
<th>Etykieta</th>
<th>Klient</th>
<th>Numer ZS</th>
<th>Ilość</th>
<th>Termin realizacji</th>
<th>Miesiąc</th>
<th>Status</th>
<th>Wartość</th>
<th>Uwagi</th>
</tr>
</thead>
<tbody>
{foreach from=$data key="key" item="item" name="components"}
<tr>
<td>{$item.documentDate}</td>
<td>{$item.pCode}</td>
<td>{$item.pName}</td>
<td>{$item.pSize}</td>
<td>{$item.pKind}</td>
<td>{$item.pBrand}</td>
<td>{$item.pLabel}</td>
<td>{$item.aName}</td>
<td>{$item.documentNo}</td>
<td>{$item.quantity}</td>
<td>{$item.sendDate}</td>
<td>{$item.sendMonth}</td>
<td>{$item.status}</td>
<td>{$item.totalNetto}</td>
<td>
<span id="edit-{$item.positionId}" class="ui-icon ui-icon-pencil"
onclick="editComment('{$item.positionId}')" style="display: inline-block;"></span>
<span id="save-{$item.positionId}" class="ui-icon ui-icon-check"
onclick="saveComment('{$item.positionId}')" style="display: none;"></span>
<span id="description-{$item.positionId}" style="display: inline-block; width: 300px;">{$item.description}</span>
<input id="descriptionInput-{$item.positionId}" type="text" value="{$item.description}"
style="width: 300px; display: none;" />
</td>
</tr>
{/foreach}
</tbody>
</table>
<script>
{literal}
function editComment(positionId) {
$("#edit-" + positionId).css("display", "none");
$("#description-" + positionId).css("display", "none");
$("#descriptionInput-" + positionId).css("display", "inline-block");
$("#descriptionInput-" + positionId).select();
$("#save-" + positionId).css("display", "inline-block");
}
function saveComment(positionId) {
$("#edit-" + positionId).css("display", "inline-block");
$("#description-" + positionId).css("display", "inline-block");
$("#descriptionInput-" + positionId).css("display", "none");
$("#save-" + positionId).css("display", "none");
$.ajax({
type : "POST",
url : "index.php?module=EcmSales&action=javahelper&to_pdf=1",
data : {
job: "saveSaleItemDescription",
saleItemId: positionId,
description: $("#descriptionInput-" + positionId).val()
},
success : function(data) {
$("#description-" + positionId).html($("#descriptionInput-" + positionId).val());
},
});
}
{/literal}
</script>

View File

@@ -0,0 +1,15 @@
<h2 style="display: inline;">{$MOD.LBL_IMPORT_EDI}</h2><br /><br />
<form action="index.php?module=EcmSales&action=EditView" method="post">
<input type="hidden" value="1" name="upload" id="upload"/>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabForm">
<tr>
<td style="padding-bottom: 2px;">
<select id="file" name="file">
{foreach from=$EDI_ORDERS key="key" item="item"}
<option value="{$item.file}">{$item.name}</option>
{/foreach}
</select>
</td>
</tr>
</table>
<input class="button" type="submit" value="{$MOD.LBL_IMPORT}" />

View File

@@ -0,0 +1,5 @@
<?php
$db = new mysqli('localhost', 'root', '5z#JaL', 'crm');
$db->query("UPDATE ecmsales set wz_name='brak' where wz_name not like brak and (wz_name='' or wz_name is null)");
$db->query("UPDATE ecmsales as s inner join ecmstockdocouts as w on w.ecmsale_id=s.id set s.wz_name=w.document_no");
?>

View File

@@ -0,0 +1,864 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* ***************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License.
* You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
* ******************************************************************************
*/
$dictionary ['EcmSale'] = array (
'table' => "ecmsales",
'comment' => 'EcmSales',
'duplicate_merge' => true,
'unified_search' => true,
// FIELDS SECTION
'fields' => array (
// STANDARD FIELDS SECTION
'id' => array (
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => true,
'reportable' => false,
'comment' => 'Unique identifier'
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_NAME',
'type' => 'name',
'required' => false,
'dbType' => 'varchar',
'len' => 255,
'unified_search' => true,
'comment' => 'The short description of the record contents',
'massupdate' => true,
'merge_filter' => 'selected'
),
'sale_date_interval' => array (
'name' => 'invoice_date_interval',
'vname' => 'Powtarzaj co',
'type' => 'varchar',
'len' => 5
),
'description' => array (
'type' => 'text',
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'comment' => 'Description',
'unified_search' => true
// 'required' => true,
),
'date_entered' => array (
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'required' => true,
'comment' => 'Date record created'
),
'stock_name' =>
array (
'name' => 'stock_name',
'vname' => 'LBL_STOCK_NAME',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'ecmstocks',
'id_name' => 'stock_id',
'module' => 'EcmStocks',
'group'=>'stock_name',
'massupdate' => false,
'required' => 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' => false,
'massupdate'=>false,
),
'status' => array (
'name' => 'status',
'vname' => 'LBL_STATUS',
'type' => 'enum',
'size' => '3',
'options' => 'ecmsales_status_dom',
'massupdate' => false,
),
'date_modified' => array (
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'required' => true,
'comment' => 'Date record last modified'
),
'modified_user_id' => array (
'name' => 'modified_user_id',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_MODIFIED',
'type' => 'assigned_user_name',
'table' => 'modified_user_id_users',
'isnull' => 'false',
'dbType' => 'varchar',
'len' => 36,
'required' => true,
'reportable' => true,
'comment' => 'User who last modified record'
),
'documents' => array (
'name' => 'documents',
'type' => 'link',
'relationship' => 'ecmsale_documents',
'source' => 'non-db',
'vname' => 'LBL_NOTES'
),
'assigned_user_id' => array (
'name' => 'assigned_user_id',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'vname' => 'LBL_ASSIGNED_TO_ID',
'group' => 'assigned_user_name',
'type' => 'relate',
'table' => 'users',
'reportable' => true,
'Importable' => false,
'isnull' => 'false',
'dbType' => 'id',
'audited' => true,
'comment' => 'User ID assigned to record',
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'assigned_user_name' => array (
'name' => 'assigned_user_name',
'vname' => 'LBL_ASSIGNED_TO',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'users',
'id_name' => 'assigned_user_id',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'created_by' => array (
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'created_by',
'vname' => 'LBL_CREATED',
'type' => 'assigned_user_name',
'table' => 'created_by_users',
'isnull' => 'false',
'dbType' => 'varchar',
'len' => 36,
'comment' => 'User that created the record'
),
'created_by_link' => array (
'name' => 'created_by_link',
'type' => 'link',
'relationship' => 'ecmsales' . '_created_by',
'vname' => 'LBL_CREATED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db'
),
'modified_user_link' => array (
'name' => 'modified_user_link',
'type' => 'link',
'relationship' => 'ecmsales' . '_modified_user',
'vname' => 'LBL_MODIFIED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db'
),
'assigned_user_link' => array (
'name' => 'assigned_user_link',
'type' => 'link',
'relationship' => 'ecmsales' . '_assigned_user',
'vname' => 'LBL_ASSIGNED_TO_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
'duplicate_merge' => 'enabled',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'table' => 'users'
),
'deleted' => array (
'name' => 'deleted',
'vname' => 'LBL_DELETED_BY',
'type' => 'bool',
'required' => true,
'reportable' => false,
'comment' => 'Record deletion indicator'
),
// NEW FIELDS SECTION
'number' => array (
'name' => 'number',
'vname' => 'LBL_NUMBER',
'type' => 'varchar',
'required_option' => true,
'unified_search' => true,
'required' => true,
'len' => '20'
),
'document_no' => array (
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'type' => 'varchar',
'required_option' => true,
'unified_search' => true,
'required' => true,
'len' => '30'
),
'wz_name' => array (
'name' => 'wz_name',
'vname' => 'LBL_WZ_NAME',
'type' => 'varchar',
'unified_search' => true,
'len' => '30'
),
'parent_document_no' => array (
'name' => 'parent_document_no',
'vname' => 'LBL_PARENT_DOCUMENT_NO',
'type' => 'varchar',
'len' => '50'
),
'parent_name' => array (
'name' => 'parent_name',
'id_name' => 'parent_id',
'vname' => 'LBL_PARENT_NAME',
'type' => 'relate',
'group' => 'parent_name',
'dbtype' => 'varchar',
'len' => '255',
'module' => 'Accounts',
'massupdate' => false,
'required' => true
),
'parent_id' => array (
'name' => 'parent_id',
'type' => 'id',
'module' => 'Accounts',
'vname' => 'LBL_PARENT_ID',
'group' => 'parent_name',
'massupdate' => false,
'reportable' => false,
'required' => true
),
'type' => array (
'name' => 'type',
'vname' => 'LBL_TYPE',
'required' => true,
'type' => 'enum',
'options' => 'ecmsales_type_dom',
'massupdate' => false
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => true
),
'send_date' => array (
'name' => 'send_date',
'vname' => 'Data wysyłki',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => true
),
'send_accepted' =>
array (
'massupdate' => false,
'name' => 'send_accepted',
'vname' => 'Termin niepotwierdzony',
'type' => 'bool',
'default' => '0',
),
'delivery_date' => array (
'name' => 'delivery_date',
'vname' => 'LBL_DELIVERY_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => true,
),
'parent_name_copy' => array (
'name' => 'parent_name_copy',
'vname' => 'LBL_PARENT_NAME_COPY',
'type' => 'varchar',
'source' => 'non-db'
),
'parent_address_street' => array (
'name' => 'parent_address_street',
'vname' => 'LBL_PARENT_ADDRESS_STREET',
'type' => 'varchar',
'len' => '150',
'comment' => 'The street address used for parent address',
'group' => 'parent_address',
'merge_filter' => 'enabled'
),
'parent_address_city' => array (
'name' => 'parent_address_city',
'vname' => 'LBL_PARENT_ADDRESS_CITY',
'type' => 'varchar',
'len' => '100',
'comment' => 'The city used for parent address',
'group' => 'parent_address',
'merge_filter' => 'enabled'
),
'parent_address_postalcode' => array (
'name' => 'parent_address_postalcode',
'vname' => 'LBL_PARENT_ADDRESS_POSTALCODE',
'type' => 'varchar',
'len' => '20',
'group' => 'parent_address',
'comment' => 'The postal code used for parent address',
'merge_filter' => 'enabled'
),
'parent_address_country' => array (
'name' => 'parent_address_country',
'vname' => 'LBL_PARENT_ADDRESS_COUNTRY',
'type' => 'varchar',
'group' => 'parent_address',
'comment' => 'The country used for the parent address',
'merge_filter' => 'enabled'
),
'parent_iln' => array (
'name' => 'parent_iln',
'vname' => 'LBL_PARENT_ILN',
'type' => 'varchar',
'group' => 'parent_address',
),
'parent_supplier_code' => array (
'name' => 'parent_supplier_code',
'vname' => 'LBL_PARENT_SUPPLIER_CODE',
'type' => 'varchar',
'group' => 'parent_address',
),
'shipping_address_name' => array (
'name' => 'parent_address_name',
'vname' => 'LBL_SHIPPING_ADDRESS_NAME',
'type' => 'varchar',
'len' => '150',
'group' => 'shipping_address',
'merge_filter' => 'enabled'
),
'shipping_address_street' => array (
'name' => 'shipping_address_street',
'vname' => 'LBL_PARENT_ADDRESS_STREET',
'type' => 'varchar',
'len' => '150',
'group' => 'shipping_address',
'merge_filter' => 'enabled'
),
'shipping_address_city' => array (
'name' => 'shipping_address_city',
'vname' => 'LBL_PARENT_ADDRESS_CITY',
'type' => 'varchar',
'len' => '100',
'group' => 'shipping_address',
'merge_filter' => 'enabled'
),
'shipping_address_postalcode' => array (
'name' => 'shipping_address_postalcode',
'vname' => 'LBL_PARENT_ADDRESS_POSTALCODE',
'type' => 'varchar',
'len' => '20',
'group' => 'shipping_address',
'merge_filter' => 'enabled'
),
'shipping_address_country' => array (
'name' => 'shipping_address_country',
'vname' => 'LBL_PARENT_ADDRESS_COUNTRY',
'type' => 'varchar',
'group' => 'shipping_address',
'merge_filter' => 'enabled'
),
'shipping_iln' => array (
'name' => 'shipping_iln',
'vname' => 'LBL_PARENT_ILN',
'type' => 'varchar',
'group' => 'parent_address',
),
//enc shipping address
'total_netto' => array (
'name' => 'total_netto',
'vname' => 'LBL_SUBTOTAL',
'type' => 'decimal',
'len' => '15,2',
),
'total_brutto' =>
array (
'name' => 'total_brutto',
'vname' => 'LBL_TOTAL',
'type' => 'decimal',
'len' => '15,2',
),
'discount' =>
array (
'name' => 'discount',
'type' => 'decimal',
'len' => '15,2',
),
'vats_summary' =>
array (
'name' => 'vats_summary',
'type' => 'varchar',
'len' => '200',
),
'parent_nip' =>
array (
'name' => 'parent_nip',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => 15,
),
'shipping_nip' =>
array (
'name' => 'shipping_nip',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => 15,
),
'parent_nip_unformated' =>
array (
'name' => 'parent_nip_unformated',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => 15,
),
'pdf_text' => array (
'name' => 'pdf_text',
'vname' => 'LBL_PDF_TEXT',
'type' => 'text'
),
//prices
'ecmprice_id' => array(
'name' => 'ecmprice_id',
'type' => 'varchar',
'len' => '36',
'vname' => 'LBL_PRICE',
'source' => 'non_db'
),
'ecmproduct_id' => array(
'name' => 'ecmproduct_id',
'vname' => 'produkt',
'type' => 'varchar',
'source' => 'non-db',
),
'ecmprice_name' => array(
'name' => 'ecmprice_name',
'type' => 'relate',
'id_name' => 'ecmprice_id',
'module' => 'EcmPrices',
'len' => '30',
'vname' => 'LBL_PRICE',
'source' => 'non-db',
'rname' => 'name'
),
//end prices
'no_tax' =>
array (
'massupdate' => false,
'name' => 'no_tax',
'vname' => 'LBL_NO_TAX',
'type' => 'bool',
'default' => '0',
),
'currency_id' => array (
'name' => 'currency_id',
'type' => 'enum',
'options' => 'currency_dom',
'label' => 'LBL_CURRENCY'
),
'ecmpaymentcondition_id' => array (
'name' => 'ecmpaymentcondition_id',
'rname' => 'name',
'id_name' => 'ecmpaymentcondition_id',
'vname' => 'LBL_PAYMENTCONDITION_ID',
'group' => 'ecmpaymentcondition_name',
'type' => 'relate',
'table' => 'ecmpaymentconditions',
'reportable' => true,
'Importable' => false,
'isnull' => 'false',
'dbType' => 'id',
'audited' => true,
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'ecmpaymentcondition_name' => array (
'name' => 'ecmpaymentcondition_name',
'vname' => 'LBL_PAYMENTCONDITION_NAME',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'ecmpaymentcondition',
'id_name' => 'ecmpaymentcondition_id',
'module' => 'EcmPaymentConditions',
'duplicate_merge' => 'disabled',
'massupdate' => false,
'required' => false,
),
'ecmpaymentcondition_text' => array (
'name' => 'ecmpaymentcondition_text',
'vname' => 'LBL_PAYMENTCONDITION_TEXT',
'type' => 'text',
'reportable' => false,
'module' => 'EcmPaymentConditions',
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'ecmdeliverycondition_id' => array (
'name' => 'ecmdeliverycondition_id',
'rname' => 'name',
'id_name' => 'ecmdeliverycondition_id',
'vname' => 'LBL_DELIVERYCONDITION_ID',
'group' => 'ecmdeliverycondition_name',
'type' => 'relate',
'table' => 'ecmdeliveryconditions',
'reportable' => true,
'Importable' => false,
'isnull' => 'false',
'dbType' => 'id',
'audited' => true,
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'ecmdeliverycondition_name' => array (
'name' => 'ecmdeliverycondition_name',
'vname' => 'LBL_DELIVERYCONDITION_NAME',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'ecmdeliverycondition',
'id_name' => 'ecmdeliverycondition_id',
'module' => 'EcmDeliveryConditions',
'duplicate_merge' => 'disabled',
'massupdate' => false,
'required' => false,
),
'ecmdeliverycondition_text' => array (
'name' => 'ecmdeliverycondition_text',
'vname' => 'LBL_DELIVERYCONDITION_TEXT',
'type' => 'text',
'reportable' => false,
'module' => 'EcmDeliveryConditions',
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'pricebook_id' => array (
'name' => 'pricebook_id',
'vname' => 'LBL_PRICEBOOK_NAME',
'type' => 'id',
'source' => 'non-db',
),
'to_informations' => array (
'name' => 'to_informations',
'vname' => 'LBL_TO_INFORMATIONS',
'type' => 'text',
'source' => 'non-db'
),
'items_list_panel' => array (
'name' => 'items_list_panel',
'vname' => 'LBL_ITEMS',
'type' => 'text',
'source' => 'non-db'
),
'ecmlanguage' =>
array(
'name' => 'ecmlanguage',
'vname' => 'LBL_ECMLANGUAGE',
'type' => 'enum',
'options' => 'ecmlanguages_dom',
'len' => 35,
'massupdate' => false,
),
'edi_file' => array (
'name' => 'edi_file',
'vname' => '',
'type' => 'varchar',
'len' => 255,
),
'edi_zs_id' => array (
'name' => 'edi_zs_id',
'vname' => '',
'type' => 'varchar',
'len' => 255,
),
'edi_zs_document_no' => array (
'name' => 'edi_zs_document_no',
'vname' => '',
'type' => 'varchar',
'len' => 255,
),
'shop_number' => array (
'name' => 'shop_number',
'vname' => '',
'type' => 'varchar',
'len' => 45,
),
// Main sale, add mz@bim-it.pl 12.04.2022
'main_sale_number' => array (
'name' => 'main_sale_number',
'id_name' => 'main_sale_id',
'vname' => 'Zamówienie główne',
'type' => 'relate',
'group' => 'main_sale_number',
'dbtype' => 'varchar',
'len' => '50',
'module' => 'EcmSales',
'massupdate' => false,
'required' => false
),
'main_sale_id' => array (
'name' => 'main_sale_id',
'type' => 'id',
'module' => 'EcmSales',
//'vname' => 'LBL_PARENT_ID',
'group' => 'main_sale_number',
'massupdate' => false,
'reportable' => false,
'required' => false
),
// FOR SUBPANELS
'account' => array (
'name' => 'account',
'type' => 'link',
'relationship' => 'ecmsales_account',
'source' => 'non-db',
'vname' => 'LBL_ACCOUNTS'
),
'contact' => array (
'name' => 'contact',
'type' => 'link',
'relationship' => 'ecmsales_contact',
'source' => 'non-db',
'vname' => 'LBL_CONTACTS'
),
'bugs' => array (
'name' => 'bugs',
'type' => 'link',
'relationship' => 'ecmsales_bug',
'source' => 'non-db',
'vname' => 'LBL_BUGS'
),
'notes' => array (
'name' => 'notes',
'type' => 'link',
'relationship' => 'ecmsales_notes',
'source' => 'non-db',
'vname' => 'LBL_NOTES'
),
'emails' => array (
'name' => 'emails',
'type' => 'link',
'relationship' => 'ecmsales_emails',
'source' => 'non-db',
'vname' => 'LBL_EMAILS'
),
'tasks' => array (
'name' => 'tasks',
'type' => 'link',
'relationship' => 'ecmsales_task',
'source' => 'non-db',
'vname' => 'LBL_TASKS'
)
),
// INDICES SECTION
'indices' => array (
array (
'name' => 'ecmsales' . 'pk',
'type' => 'primary',
'fields' => array (
'id'
)
),
array (
'name' => 'idx_' . 'ecmsales' . '_document_no',
'type' => 'index',
'fields' => array (
'document_no'
)
)
),
// RELATIONSHIPS SECTION
'relationships' => array (
'ecmsales' . '_assigned_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'assigned_user_id',
'relationship_type' => 'one-to-many'
),
'ecmsale_documents' => array(
'lhs_module' => 'EcmSales',
'lhs_table' => 'ecmsales',
'lhs_key' => 'id',
'rhs_module' => 'Documents',
'rhs_table' => 'documents',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'documents_accounts',
'join_key_lhs' => 'parent_id',
'join_key_rhs' => 'document_id',
),
'ecmsales' . '_modified_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_created_by' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_account' => array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_ecmsales' => array (
'lhs_module' => 'EcmSales',
'lhs_table' => 'ecmsales',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_contact' => array (
'lhs_module' => 'Contacts',
'lhs_table' => 'contacts',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'contact_id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_project' => array (
'lhs_module' => 'Project',
'lhs_table' => 'project',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_bug' => array (
'lhs_module' => 'Bugs',
'lhs_table' => 'bugs',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmsales_notes' => array (
'lhs_module' => 'EcmSales',
'lhs_table' => 'ecmsales',
'lhs_key' => 'id',
'rhs_module' => 'Notes',
'rhs_table' => 'notes',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many',
'relationship_role_column' => 'parent_type',
'relationship_role_column_value' => 'EcmSales'
),
'ecmsales' . '_case' => array (
'lhs_module' => 'Cases',
'lhs_table' => 'cases',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmsales' . '_task' => array (
'lhs_module' => 'Tasks',
'lhs_table' => 'tasks',
'lhs_key' => 'id',
'rhs_module' => 'EcmSales',
'rhs_table' => 'ecmsales',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
)
),
// THIS FLAG ENABLES OPTIMISTIC LOCKING FOR SAVES FROM EDITVIEW
'optimistic_locking' => true
);

View File

@@ -0,0 +1,355 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
{{include file="modules/EcmOfferes/views/DetailView/header.tpl"}}
{sugar_include include=$includes}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
<table width='100%' border='0' style="border-bottom:0px;" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{$PAGINATION}
</table>
{{/if}}
{literal}
<script language="javascript">
var SelectedTab = "";
function SetTab(tab_name) {
var TabMenu = document.getElementById('groupTabsPanels');
var tabs = TabMenu.getElementsByTagName('li');
for(i=0;i<tabs.length;i++) {
if((tab_name+'_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="subpanelTablist" style="margin-top:10px;" id="groupTabsPanels">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
{{if $label=='EMAIL'}}
{{else}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="panel_{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} { {/literal} SetTab('panel_{{$label}}'); {literal} }; {/literal}
{{if $panel[0][0].field.active}}SelectedTab="panel_{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{else}}other{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/if}}
{{/foreach}}
<li class="" id="panel_EMAIL_menu">
<a class="" href="javascript:{$EMAIL_LINK}">{sugar_translate label='LBL_EMAIL_TAB' module='EcmOfferes'}</a>
</li>
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" print=false start=0 assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{assign var='panel_id' value=$panelCount}}
<div {{if $panel[0][0].field.active == false}}style="display:none"{{/if}} id='panel_{{$label}}'>
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Print out the panel title if one exists*}}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<!--
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<h4 class="dataLabel">{sugar_translate label='{{$label}}' module='{{$module}}'}</h4><br>
{{/if}}
-->
{{* Print out the table data *}}
<table width='100%' border='0' style="border-top:0px" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{{if $panelCount == 0}}
{{counter name="panelCount" print=false}}
{{/if}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{if $colData.field.allCols == false}}
<td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class='tabDetailViewDL' NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}}
{capture name="label" assign="label"}
{{$colData.field.label}}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label"}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label"}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{else}}
&nbsp;
{{/if}}
</td>
{{/if}}
<td width='{{if $colData.field.allCols == true}}100{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabDetailViewDF' {{if $colData.field.allCols == true}}colspan='4'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}}>
{{if $colData.field.customCode || $colData.field.assign}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field colData=$colData}}
{{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$tabIndex vardef=$fields[$subField] displayType='detailView'}}&nbsp;
{{else}}
{counter name="panelFieldCount"}
{{$subField}}
{{/if}}
{{/foreach}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='detailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}}
{{/if}}
&nbsp;
</td>
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("panel_{{$panel_id}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file="modules/EcmOfferes/views/DetailView/footer.tpl"}}

View File

@@ -0,0 +1,37 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
</form>

View File

@@ -0,0 +1,105 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
{{* Add the preForm code if it is defined (used for vcards) *}}
{{if $preForm}}
{{$preForm}}
{{/if}}
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td style="padding-bottom: 2px;" align="left" NOWRAP>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="{$module}">
<input type="hidden" name="record" value="{$fields.id.value}">
<input type="hidden" name="return_action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_id">
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="offset" value="{$offset}">
<input type="hidden" name="action" value="EditView">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if !isset($form.buttons)}}
<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$id}'; this.form.action.value='EditView'" type="submit" name="Edit" id='edit_button' value=" {$APP.LBL_EDIT_BUTTON_LABEL} ">
<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'" type="submit" name="Duplicate" value=" {$APP.LBL_DUPLICATE_BUTTON_LABEL} " id='duplicate_button'>
<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='ListView'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value=" {$APP.LBL_DELETE_BUTTON_LABEL} " >
{{else}}
{{counter assign="num_buttons" start=0 print=false}}
{{foreach from=$form.buttons key=val item=button}}
{{if !is_array($button) && in_array($button, $built_in_buttons)}}
{{counter print=false}}
{{sugar_button module="$module" id="$button" view="EditView"}}
{{/if}}
{{/foreach}}
{{if isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if count($form.buttons) > $num_buttons}}
{{foreach from=$form.buttons key=val item=button}}
{{if is_array($button) && $button.customCode}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="$button" view="EditView"}}
</td>
{{/if}}
{{/foreach}}
{{/if}}
{{/if}}
{{if !isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="Audit" view="EditView"}}
</td>
{{/if}}
<td align="right" width="100%">{$ADMIN_EDIT}</td>
{{* Add $form.links if they are defined *}}
{{if !empty($form) && isset($form.links)}}
<td align="right" width="10%">&nbsp;</td>
<td align="right" width="100%" NOWRAP>
{{foreach from=$form.links item=link}}
{{$link}}&nbsp;
{{/foreach}}
</td>
{{/if}}
</tr>
</table>

View File

@@ -0,0 +1,95 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* *******************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/DetailView/DetailView2.php');
class ViewDetailMy extends SugarView{
var $type ='detail';
var $dv;
var $tplFile = 'include/DetailView/DetailView.tpl';
function ViewDetailMy(){
$this->options['show_subpanels'] = true;
parent::SugarView();
}
function preDisplay(){
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $this->module . '/metadata/detailviewdefs.php')){
$metadataFile = 'custom/modules/' . $this->module . '/metadata/detailviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['detailviewdefs'])){
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
require_once('modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['detailviewdefs'])){
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/detailviewdefs.php')){
$metadataFile = 'modules/'.$this->module.'/metadata/detailviewdefs.php';
}
$this->dv = new DetailView2();
$this->dv->ss =& $this->ss;
$this->dv->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display(){
if(empty($this->bean->id)){
global $app_strings;
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$this->dv->process();
echo $this->dv->display();
}
}

View File

@@ -0,0 +1,424 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
{literal}
<style type="text/css">
.dataLabel { padding: 2px; }
.dataField { padding: 2px; }
.tabEditViewDF { padding: 2px; }
td .dataLabel { padding: 2px; }
td .dataField { padding: 2px; }
td .tabEditViewDF { padding: 2px; }
.tabForm { border-top:none; }
</style>
{/literal}
{{include file='modules/EcmOfferes/views/EditView/header.tpl'}}
{sugar_include include=$includes}
<table width="100%" cellspacing="0" cellpadding="0" class='tabDetailView' id='tabFormPagination'>
{{if $panelCount == 0}}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
{$PAGINATION}
{{/if}}
{{/if}}
</table>
{literal}
<script language="javascript">
var SelectedTab = "";
var TabsMainBlock = false;
function SetTab(tab_name) {
if(TabsMainBlock) return;
var TabMenu = document.getElementById('groupTabs');
var tabs = TabMenu.getElementsByTagName('li');
for(i=0;i<tabs.length;i++) {
if((tab_name+'_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="tabList" style="margin-top:10px;" id="groupTabs">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} { {/literal} SetTab('{{$label}}'); {literal} }; {/literal}
{{if $panel[0][0].field.active}}SelectedTab="{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/foreach}}
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" start=-1 print=false assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{counter name="panelCount" print=false}}
{{* Print out the table data *}}
<div id="{{$label}}" style="display:{{if !$panel[0][0].field.active}}none{{/if}};">
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="{$def.templateMeta.panelClass|default:tabForm}">
{{* Only show header if it is not default or an int value *}}
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<th class="dataLabel" align="left" colspan="8">
<h4>{sugar_translate label='LBL_{{$label}}' module='{{$module}}'}</h4>
</th>
{{/if}}
{{assign var='rowCount' value=0}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{* Loop through each column and display *}}
{{counter name="colCount" start=0 print=false assign="colCount"}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{counter name="colCount" print=false}}
{{math assign="tabIndex" equation="$panelCount * $maxColumns + $colCount"}}
{{if count($rowData) == $colCount}}
{{assign var="colCount" value=0}}
{{/if}}
{{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
<td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class="dataLabel" NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
</td>
{{/if}}
<td valign="top" width='{{if $colData.field.allCols}}100%{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabEditViewDF' {{if $colData.field.allCols}}colspan='8'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}} NOWRAP>
{{if !empty($def.templateMeta.labelsOnTop)}}
{{if isset($colData.field.label)}}
{{if !empty($colData.field.label)}}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:
{{/if}}
{{elseif isset($fields[$colData.field.name])}}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
{{if !isset($colData.field.label) || !empty($colData.field.label)}}
<br>
{{/if}}
{{/if}}
{{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$subField.name] displayType='editView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
{{/if}}
{{/foreach}}
{{elseif !empty($colData.field.customCode)}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$colData.field.tabindex}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{$colData.displayParams}}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$colData.field.name] displayType='editView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}}
{{/if}}
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("{{$label}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file='modules/EcmOfferes/views/EditView/footer.tpl'}}

View File

@@ -0,0 +1,61 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
{{if empty($form.button_location) || $form.button_location == 'bottom'}}
<div style="padding-top: 2px">
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{sugar_button module="$module" id="Audit" view="$view"}}
</div>
{{/if}}
</form>
{{if $externalJSFile}}
require_once("'".$externalJSFile."'");
{{/if}}
{$set_focus_block}
{{if isset($scriptBlocks)}}
<!-- Begin Meta-Data Javascript -->
{{$scriptBlocks}}
<!-- End Meta-Data Javascript -->
{{/if}}

View File

@@ -0,0 +1,79 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<form action="index.php" method="POST" name="{$form_name}" id="{$form_id}" {$enctype}>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-bottom: 2px;">
<input type="hidden" name="module" value="{$module}">
{if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}
<input type="hidden" name="record" value="">
{else}
<input type="hidden" name="record" value="{$fields.id.value}">
{/if}
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$smarty.request.return_module}">
<input type="hidden" name="return_action" value="{$smarty.request.return_action}">
<input type="hidden" name="return_id" value="{$smarty.request.return_id}">
<input type="hidden" name="contact_role">
{if !empty($smarty.request.return_module)}
<input type="hidden" name="relate_to" value="{$smarty.request.return_module}">
<input type="hidden" name="relate_id" value="{$smarty.request.return_id}">
{/if}
<input type="hidden" name="offset" value="{$offset}">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if empty($form.button_location) || $form.button_location == 'top'}}
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
{{sugar_button module="$module" id="Audit" view="$view"}}
{{/if}}
{{/if}}
</td>
<td align='right'>{{$ADMIN_EDIT}}</td>
</tr>
</table>

View File

@@ -0,0 +1,186 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* *******************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/EditView/EditView2.php');
class ViewEditEcmSales extends SugarView{
var $ev;
var $type ='edit';
var $useForSubpanel = false; //boolean variable to determine whether view can be used for subpanel creates
var $showTitle = true;
var $tplFile = 'include/EditView/EditView.tpl';
function ViewEditEcmSales(){
parent::SugarView();
}
function preDisplay(){
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $this->module . '/metadata/editviewdefs.php')){
$metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['editviewdefs'])){
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
require_once('modules/'.$this->module.'/metadata/metafiles.php');
if(!empty($metafiles[$this->module]['editviewdefs'])){
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=". $metadataFile);
if(!$foundViewDefs && file_exists('modules/'.$this->module.'/metadata/editviewdefs.php')){
$metadataFile = 'modules/'.$this->module.'/metadata/editviewdefs.php';
}
$this->ev = new EditView();
$this->ev->ss =& $this->ss;
$this->ev->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display(){
$this->ev->process();
echo $this->ev->display($this->showTitle);
}
}
?>

View File

@@ -0,0 +1,32 @@
<input type="hidden" name="position_list" id="position_list" value='{$POSITION_LIST}'/>
<input type="hidden" name="temp_id" id="temp_id" value='{$TEMP_ID}'/>
<input type="hidden" name="parent_doc_type" id="parent_doc_type" value='EcmOfferes'/>
<table id="searchTable' cellspacing="0" cellpadding="0" border="0"><tr><td width="19"><img src="modules/EcmPurchaseOrders/images/EcmOfferes.gif" style="margin-top: 3px; margin-right: 3px;" width="16" border="0" height="16"></td>
<td width="402"><h2>Wystaw fakture</h2></td></tr></table>
<input type="button" class="button" onClick="createEcmInvoiceOut();" value="Dalej"/>
<br />
{literal}
<script type="text/javascript" src="modules/EcmOfferes/MyTable.js"></script>
<script type="text/javascript" src="modules/EcmOfferes/CreateInvoice.js"></script>
<script type="text/javascript" src="include/JSON.js"></script>
{/literal}
<link rel="stylesheet" type="text/css" href="modules/EcmPurchaseOrders/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmOfferes/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV">
<table class="positions" style="width:100%;" id="itemsTable">
<thead id="head">
<tr id="tr">
<td width="2%"><input type="checkbox" onClick="select_all(this);"name="select_all" value="0"></td>
<td width="2%">Poz.</td>
<td width="8%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="15%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">Ilość</td>
<td width="5%">Numer zamówienia</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>

View File

@@ -0,0 +1,257 @@
<?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 EcmSalesViewList extends ViewList{
function EcmSalesViewList(){
parent::ViewList();
}
function display(){
if(!$this->bean->ACLAccess('list')){
ACLController::displayNoAccess();
return;
}
if(empty($_REQUEST['orderBy'])) {
$_REQUEST['orderBy'] = 'date_entered';
$_REQUEST['sortOrder'] = 'desc';
}
$this->module=$module = "EcmSales";
$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();
// echo $where;
$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();
}
}
}
?>