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,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['MyEcmInvoiceOutsDashlet']['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['MyEcmInvoiceOutsDashlet']['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=EcmInvoiceOuts&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' => 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,46 @@
<?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['MyEcmInvoiceOutsDashlet'] = array('module' => 'EcmInvoiceOuts',
'title' => 'Moje faktury',
'description' => 'A customizable view into Quotes',
'category' => 'Module Views');
?>

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/EcmInvoiceOuts/EcmInvoiceOut.php');
class MyEcmInvoiceOutsDashlet extends DashletGeneric {
function MyEcmInvoiceOutsDashlet($id, $def = null) {
global $current_user, $app_strings;
require('modules/EcmInvoiceOuts/Dashlets/MyEcmInvoiceOutsDashlet/MyEcmInvoiceOutsDashlet.data.php');
parent::DashletGeneric($id, $def);
if(empty($def['title'])) $this->title = 'Faktury';
$this->searchFields = $dashletData['MyEcmInvoiceOutsDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmInvoiceOutsDashlet']['columns'];
$this->seedBean = new EcmInvoiceOut();
$this->lvs->quickViewLinks = false;
}
}
?>

View File

@@ -0,0 +1,168 @@
<?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/EcmInvoiceOuts/EcmInvoiceOut.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 EcmInvoiceOut ();
if (isset ( $_REQUEST ['record'] )) {
$focus->retrieve ( $_REQUEST ['record'] );
$focus->format_all_fields ();
$OPT ['status'] = $focus->status;
}
// move to archive
if (strtotime ( $focus->register_date ) <= strtotime ( "2014-11-02" ))
header ( "Location: index.php?module=EcmInvoiceOutOlds&action=DetailView&record=" . $focus->id );
require_once ('include/MVC/View/SugarView.php');
require_once ('modules/EcmInvoiceOuts/views/DetailView/view.detail.my.php');
// create position list table
$pl = $focus->getPositionList ();
$edit = new ViewDetailMy ();
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmInvoiceOuts';
// add pdf buttons
$btn = '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createPDF&to_pdf=1&show_img=\'+$(\'#pdf_images\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&show_remarks=\'+$(\'#pdf_remarks\').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=EcmInvoiceOuts&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 title="Generuj XLS" class="button" onclick="if($(\'#div_xls\').css(\'display\') == \'none\'){$(\'#div_xls\').show(\'slow\'); } else { $(\'#div_xls\').hide(\'slow\'); }" type="button" name="productxls" id="productxls" value="Generuj XLS">';
$btn .= '<div id="div_xls" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$btn .= 'EAN: <select name="xls_ean" id="xls_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
$btn .= '<input name="cat_xls" id="cat_xls" title="Generuj XLS" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&action=createXLS&to_pdf=1&show_ean=\'+$(\'#xls_ean\').val()+\'&record=' . $_REQUEST ['record'] . '\',\'_blank\');" type="button" value="Pokaż XLS"></div>';
$edit->ss->assign ( "CREATE_XLS", $btn );
$create_cor = false;
if ($focus->type != 'correct') {
$create_cor = true;
}
$can_edit = false;
global $current_user;
if (is_admin ( $current_user )){
$can_edit = true;
}
if($focus->wz_id!=""){
$a = new EcmStockDocOut();
$a->retrieve($focus->wz_id);
$wz_array[] = "<a target='_blank' href='index.php?module=EcmStockDocOuts&action=DetailView&record=$a->id'>".$a->document_no."</a>";
}
if($focus->wz_record_zb!=""){
$wzIds=explode(",",($focus->wz_record_zb));
foreach ($wzIds as $id){
if($id!=""){
$a = new EcmStockDocOut();
$a->retrieve($id);
$wz_array[] = "<a target='_blank' href='index.php?module=EcmStockDocOuts&action=DetailView&record=$a->id'>".$a->document_no."</a>";
}
}
}
$edit->ss->assign("wz_no",implode(',',$wz_array));
$a = new EcmSale();
$a->retrieve($focus->so_id);
$the_array ['ZS_NO'] = "<a target='_blank' href='index.php?module=EcmSales&action=DetailView&record=$a->id'>".$a->document_no."</a>";
$edit->ss->assign("zs_no", $the_array ['ZS_NO']);
$edit->ss->assign ( "CAN_EDIT", $can_edit );
$edit->ss->assign ( "CREATE_COR", $create_cor );
$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
$edit->ss->assign("CAN_CREATE_PZ", $focus->parent_id=='1b9643ca-5b1a-8f9b-b809-586b5619b068' && $focus->type=='normal' && strtotime($focus->register_date) > strtotime("19.01.2023"));
// get corrects or corrected invoices
$db = $GLOBALS['db'];
if ($focus->type == 'correct') {
$ret = $db->query ( "
SELECT distinct o.ecminvoiceout_id
FROM
ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts as i
ON ii.ecminvoiceout_id = i.id
INNER JOIN ecminvoiceoutitems AS o
ON o.id = ii.ecminvoiceoutitem_id
WHERE
ii.ecminvoiceout_id = '$focus->id'" );
$inv = "";
while ($row = $db->fetchByAssoc($ret)) {
$i = $db->fetchByAssoc($db->query("SELECT id, document_no FROM ecminvoiceouts WHERE id ='".$row['ecminvoiceout_id']."'"));
$inv.='<a href="index.php?module=EcmInvoiceOuts&action=DetailView&record='.$i['id'].'" target="new">'.$i['document_no'].'</a>,&nbsp';
}
} else if ($focus->type == 'normal') {
$ret = $db->query( "
SELECT DISTINCT c.document_no, c.id FROM
ecminvoiceoutitems as ic #items from correstc
INNER JOIN ecminvoiceouts AS c #correct
ON c.id = ic.ecminvoiceout_id
WHERE
ic.ecminvoiceoutitem_id IN (
SELECT id FROM ecminvoiceoutitems WHERE
ecminvoiceout_id='".$focus->id."'
)
AND c.deleted='0' AND c.canceled='0';
");
while ($i = $db->fetchByAssoc($ret)) {
$inv.='<a href="index.php?module=EcmInvoiceOuts&action=DetailView&record='.$i['id'].'" target="new">'.$i['document_no'].'</a>,&nbsp';
}
}
$edit->ss->assign ( "INVOICES_INFO", substr($inv,0,-6) );
$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 ecminvoiceouts 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>';
}
// check total
if ($focus->total_netto == 0) {
echo '<h1 style="color: red;">Błąd sumy, skontaktuj się z administratorem! Nie drukuj/publikuj dokumentu!</h1>';
}
// is canceled
if ($focus->canceled == 1) {
echo '<h1 style="color: red;">Faktura anulowana! Nie publikuj dokumentu!</h1>';
}
echo $edit->display ();
require_once ('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles ( $focus, 'EcmInvoiceOuts' );
echo $subpanel->display ();
// loading view
echo '<link rel="stylesheet" type="text/css" href="modules/EcmInvoiceOuts/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,320 @@
<?php
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/EcmInvoiceOuts/EcmInvoiceOut.php');
require_once ('include/time.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>';
$new_number = false;
$is_correct = false;
$is_wz = false;
$is_sale = false;
$focus = new EcmInvoiceOut ();
$db = $GLOBALS ['db'];
if (isset ( $_REQUEST ['record'] ) && $_REQUEST ['isDuplicate'] == "false") {
$focus->retrieve ( $_REQUEST ['record'] );
if (isset ( $focus->id ) && $focus->id != '') {
$focus->format_all_fields ();
}
$so_id=$focus->so_id;
$wz_id=$focus->wz_id;
} else if ($_REQUEST ['isCorrect'] == "true") {
$new_number = true;
$is_correct = true;
// get data
$focus->retrieve ( $_REQUEST ['record'] );
if (isset ( $focus->id ) && $focus->id != '') {
$focus->format_all_fields ();
}
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = date ( "d.m.Y" );
$focus->validtill_date = date ( "d.m.Y" );
$focus->type = 'correct';
// saturn??
$tmp_a = new Account ();
$tmp_a->retrieve ( $focus->parent_id );
if ($tmp_a->parent_id == '1249') {
$a = new Account ();
$a->retrieve ( '1249' );
$focus->parent_payer_address_name = $a->name;
$focus->parent_payer_address_street = $a->shipping_address_street;
$focus->parent_payer_address_postalcode = $a->shipping_address_postalcode;
$focus->parent_payer_address_city = $a->shipping_address_city;
$focus->parent_payer_address_country = $a->shipping_address_country;
$focus->parent_payer_address_nip = $a->to_vatid;
$focus->parent_payer_address_iln = $a->iln;
}
global $current_user;
$focus->assigned_user_id = $current_user->id;
$focus->assigned_user_name = $current_user->full_name;
$focus->prepaid = '0';
} else if ($_REQUEST ['isWZ'] == "true") {
$new_number = true;
$is_wz = true;
// get data
$wz = new EcmStockDocOut ();
$wz->retrieve ( $_REQUEST ['wz_record'] );
if($_REQUEST ['wz_record_zb']!=""){
$wz_zb=$_REQUEST ['wz_record_zb'];
$wz_zb_array=explode(",",$wz_zb);
$wz->retrieve ( $wz_zb_array[0]);
}
$wz_id = $_REQUEST ['wz_record'];
$so_id = $wz->ecmsale_id;
$focus->so_id = $so_id;
$s = new EcmSale ();
$s->retrieve ( $so_id );
$focus->currency_id = $s->currency_id;
$wz_name = $wz->document_no;
// load from zs
$focus->parent_id = $s->parent_id;
$focus->parent_name = $s->parent_name;
$focus->order_no = $s->parent_document_no;
$focus->supplier_code = $s->parent_supplier_code;
// dates
$focus->stock_id = $wz->stock_id;
$focus->stock_name = $wz->stock_name;
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = $wz->register_date;
$focus->validtill_date = date ( "d.m.Y" );
$focus->parent_shipping_address_name = $s->shipping_address_name;
$focus->parent_shipping_address_street = $s->shipping_address_street;
$focus->parent_shipping_address_postalcode = $s->shipping_address_postalcode;
$focus->parent_shipping_address_city = $s->shipping_address_city;
$focus->parent_shipping_address_country = $s->shipping_address_country;
$focus->parent_shipping_address_nip = $s->shipping_nip;
$focus->parent_shipping_address_iln = $s->shipping_iln;
// saturn??
$tmp_a = new Account ();
$tmp_a->retrieve ( $focus->parent_id );
if ($tmp_a->parent_id == '1249') {
$a = new Account ();
$a->retrieve ( '1249' );
$focus->parent_payer_address_name = $a->name;
$focus->parent_payer_address_street = $a->shipping_address_street;
$focus->parent_payer_address_postalcode = $a->shipping_address_postalcode;
$focus->parent_payer_address_city = $a->shipping_address_city;
$focus->parent_payer_address_country = $a->shipping_address_country;
$focus->parent_payer_address_nip = $a->to_vatid;
$focus->parent_payer_address_iln = $a->iln;
}
$pc = new EcmPaymentCondition ();
$pc->retrieve ( $s->ecmpaymentcondition_id );
$focus->ecmpaymentcondition_id = $pc->id;
$focus->ecmpaymentcondition_name = $pc->name;
if ($tmp_a->parent_id != '1249')
$focus->payment_date = $GLOBALS ['timedate']->to_display_date ( date ( "Y-m-d", mktime () + 3600 * 24 * $pc->days ) );
else {
$ss = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "SELECT delivery_date FROM ecmsales WHERE id='" . $r ['ecmsale_id'] . "'" ) );
$d = date ( 'Y-m-t', strtotime ( $ss ['delivery_date'] ) );
$focus->payment_date = $GLOBALS ['timedate']->to_display_date ( date ( "Y-m-d", mktime () + 3600 * 24 * 60 ) );
}
$focus->ecmdeliverycondition_id = $s->ecmdeliverycondition_id;
$focus->ecmdeliverycondition_name = $s->ecmdeliverycondition_name;
// Handle prepaid
if ($s->main_sale_id) {
$prepaids = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select SUM(inv_value) as total, GROUP_CONCAT(document_no, '') as documents FROM ecmprepaymentinvoices WHERE ecmsale_id
='".$s->main_sale_id."' GROUP BY ecmsale_id" ) );
} else {
$prepaids = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select SUM(inv_value) as total, GROUP_CONCAT(document_no, '') as documents FROM ecmprepaymentinvoices WHERE ecmsale_id
='".$s->id."' GROUP BY ecmsale_id" ) );
}
$focus->prepaid = $prepaids['total'];
$focus->prepaid_nr = $prepaids['documents'];
if ($focus->prapaid != '') {
$focus->ecmpaymentcondition_id = 'ec14f1da-09c5-7b99-77ef-4e9fd3cfd67f';
$focus->ecmpaymentcondition_name = 'Przedpłata';
}
} else if ($_REQUEST ['isSALE'] == "true") {
$new_number = true;
$is_sale = true;
// get data
$wz = new EcmSale ();
$wz->retrieve ( $_REQUEST ['record'] );
$so_id = $_REQUEST ['record'];
$wz_name = $wz->document_no;
// load from wz
$focus->parent_id = $wz->parent_id;
$focus->parent_name = $wz->parent_name;
$focus->order_no = $wz->order_no;
$focus->ecmpaymentcondition_name = $wz->ecmpaymentcondition_name;
$focus->ecmpaymentcondition_id = $wz->ecmpaymentcondition_id;
// dates
$focus->stock_id = $wz->stock_id;
$focus->stock_name = $wz->stock_name;
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = $wz->register_date;
$focus->validtill_date = date ( "d.m.Y" );
} elseif ($_REQUEST ['prepaymentinvoice_id']) {
$new_number = true;
$is_sale = true;
// get data
$inv = new EcmPrepaymentInvoice();
$inv->retrieve($_REQUEST ['prepaymentinvoice_id']);
$sale = new EcmSale ();
$sale->retrieve ( $inv->ecmsale_id );
$so_id = $inv->ecmsale_id;
// load from sale
$focus->parent_id = $sale->parent_id;
$focus->parent_name = $sale->parent_name;
$focus->order_no = $sale->order_no;
$focus->ecmpaymentcondition_name = $sale->ecmpaymentcondition_name;
$focus->ecmpaymentcondition_id = $sale->ecmpaymentcondition_id;
// dates
$focus->stock_id = $sale->stock_id;
$focus->stock_name = $sale->stock_name;
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = $sale->register_date;
$focus->validtill_date = date ( "d.m.Y" );
// prepaid
$focus->prepaid = $inv->inv_value;
$focus->prepaid_nr = $inv->document_no;
} elseif ($_REQUEST ['parent_doc_type'] == 'EcmReturn') {
$new_number = true;
$is_return = true;
$return_id = $_REQUEST ['parent_doc_id'];
$sess_id = $_REQUEST ['sess_id'];
$ret = new EcmReturn ();
$ret->retrieve ( $return_id );
$tmp = json_decode ( $_SESSION [$sess_id], true );
// var_dump($tmp[0]);
$focus->parent_id = $ret->parent_id;
$focus->parent_name = $ret->parent_name;
$focus->type = 'correct';
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = date ( "d.m.Y" );
$focus->validtill_date = date ( "d.m.Y" );
$focus->order_no = $ret->name;
} elseif ($_REQUEST ['mdci'] == '1') {
$new_number = true;
$is_multiCorrectDiscountInvoice = true;
$discount = $_REQUEST['discount'];
$inv = $_REQUEST ['invoices'];
$focus->parent_id = $_REQUEST['account_id'];
$focus->parent_name = $_REQUEST['account_name'];
$focus->type = 'correct';
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = date ( "d.m.Y" );
$focus->validtill_date = date ( "d.m.Y" );
$a = new Account();
$a->retrieve($_REQUEST['account_id']);
if ($a->parent_id == '1249') {
$focus->payment_method = 'KOMPENSATA';
$mshp = new Account();
$mshp->retrieve('1249');
$focus->parent_payer_address_name = $mshp->name;
$focus->parent_payer_address_street = $mshp->billing_address_street;
$focus->parent_payer_address_postalcode = $mshp->billing_address_postalcode;
$focus->parent_payer_address_city = $mshp->billing_address_city;
$focus->parent_payer_address_country = $mshp->billing_address_country;
$focus->parent_payer_address_nip = $mshp->to_vatid;
$focus->parent_shipping_address_name = $a->name;
$focus->parent_shipping_address_street = $a->shipping_address_street;
$focus->parent_shipping_address_postalcode = $a->shipping_address_postalcode;
$focus->parent_shipping_address_city = $a->shipping_address_city;
$focus->parent_shipping_address_country = $a->shipping_address_country;
$focus->parent_shipping_address_nip = $a->to_vatid;
}
} else {
$new_number = true;
// dates
$focus->stock_id = $current_user->stock_id;
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = date ( "d.m.Y" );
$focus->validtill_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;
}
}
$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 ) ) {
if ($focus->stock_id != '' && $row ['id'] == $focus->stock_id) {
$s = 'selected';
} else {
$s = '';
}
$stock_body .= '<option value="' . $row ['id'] . '" ' . $s . '>' . $row ['name'] . '</option>';
}
$stock .= $stock_body . '</select><input id="stock_id" name="stock_id" type="hidden" value="' . $focus->stock_id . '"/>';
require_once ('include/MVC/View/SugarView.php');
require_once ('modules/EcmInvoiceOuts/views/EditView/view.edit.ecminvoiceouts.php');
$edit = new ViewEditEcmInvoiceOuts ();
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmInvoiceOuts';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
$edit->preDisplay ();
$edit->ss->assign ( "NEW_NUMBER", $new_number );
$edit->ss->assign ( "IS_CORRECT", $is_correct );
$edit->ss->assign ( "IS_WZ", $is_wz );
$edit->ss->assign ( "IS_SALE", $is_sale );
$edit->ss->assign ( "WZ_ID", $wz_id );
$edit->ss->assign ( "WZ_NAME", $wz_name );
$edit->ss->assign ( "SO_ID", $so_id );
$edit->ss->assign ( "IS_RETURN", $is_return );
$edit->ss->assign ( "wz_record_zb",$wz_zb);
$edit->ss->assign ( "SESS_ID", $sess_id );
$edit->ss->assign ( "RETURN_ID", $return_id );
$edit->ss->assign ( "DUPLICATE", $duplicate );
$edit->ss->assign ( "STOCK", $stock );
$edit->ss->assign ("WZ_ZB_ID",$wz_zb);
$edit->ss->assign("isEditMode", (isset($_REQUEST['isEditMode']) && $_REQUEST['isEditMode'] == 'true') ? 'true' : 'false');
if ($is_multiCorrectDiscountInvoice) {
$edit->ss->assign ( "MULTIDISCOUNTCORRECTINVOICE", true );
$edit->ss->assign ( "MDCI_DISCOUNT", $discount );
$edit->ss->assign ( "MDCI_INV", $inv );
}
echo $edit->display ();
// loading view
echo '<link rel="stylesheet" type="text/css" href="modules/EcmInvoiceOuts/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';

View File

@@ -0,0 +1,97 @@
<?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 ('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/EcmInvoiceOuts/javascript/ListSales.js"></script>';
$json_config = new json_config ();
$db=$GLOBALS['db'];
$where=false;
$where_c=array();
if($_POST['year']!=''){
$where_c[]='YEAR(faktura.register_date)="'.$_POST['year'].'"';
}
if($_POST['code']!=''){
$where_c[]='pozycja.code like "%'.$_POST['code'].'%"';
}
if($_POST['quantity']!=''){
$where_c[]='pozycja.quantity="'.$_POST['quantity'].'"';
}
if($_POST['price']!=''){
$_POST['price']=str_replace(',','.',$_POST['price']);
$where_c[]='pozycja.price_netto="'.$_POST['price'].'"';
}
if($_POST['account_id']!=''){
$where_c[]='faktura.parent_id="'.$_POST['account_id'].'"';
}
$where_string='';
if(count($where_c)>0){
$where_string.=' where ';
$where_string.=implode(' and ',$where_c);
}
echo $_POST['account_name'];
if($_POST['submit']){
$zap=$db->query("select
pozycja.id,
pozycja.code,
pozycja.name,
pozycja.quantity,
pozycja.price_netto,
faktura.document_no,
faktura.id as fk_id,
faktura.register_date,
faktura.number,
faktura.parent_shipping_address_name,
faktura.parent_name
from
ecminvoiceoutitems pozycja
JOIN
ecminvoiceouts faktura ON pozycja.ecminvoiceout_id = faktura.id
JOIN
ecmproducts produkt ON pozycja.ecmproduct_id = produkt.id
".$where_string);
$position_list=array();
while($dane=$db->fetchByAssoc($zap)){
//if ($dane['parent_shipping_address_name'] && $dane['parent_shipping_address_name']!='' &&
// $dane['parent_shipping_address_name'] != $dane['parent_name'])
$dane['document_no'].='<br>'.$dane['parent_shipping_address_name'];
$position_list[]=$dane;
}
}
//$focus = new EcmInvoiceOut ();
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmInvoiceOuts';
//$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('POSITION_LIST',$position_list);
$edit->ss->assign ( 'MOD', $mod_strings);
$edit->ss-> display('modules/EcmInvoiceOuts/tpls/ListSales.tpl'); //4
?>

View File

@@ -0,0 +1,29 @@
<?php
//Skrypt poprawia korekty kwartalne dla MSHP
$db = $GLOBALS['db'];
$query;
//---------------------------------------
$query = "
select i.document_no, i.id, i.total_netto from ecminvoiceouts as i
inner join accounts as a
on a.id = i.parent_id
where
i.register_date like '2014-10%'
and a.parent_id = '1249'
and i.purchase_price = 0
and i.paid_val IS NULL
order by i.date_entered desc;
";
$inv = $db->query($query);
$sum = 0;
while ($i = $db->fetchByAssoc($inv)) {
$sum+=$i['total_netto'];
}
echo $sum;
?>

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('EcmInvoiceOuts', "edit", true)) $module_menu [] = Array("index.php?module=".'EcmInvoiceOuts'."&action=EditView&return_module=".'EcmInvoiceOuts'."&return_action=DetailView", translate('LNK_NEW_'.'ECMQUOTE', 'EcmInvoiceOuts'),"CreateEcmInvoiceOuts", 'EcmInvoiceOuts');
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=index&return_module=EcmInvoiceOuts&return_action=DetailView", translate('LNK_ECMQUOTES_LIST','EcmInvoiceOuts'),"EcmInvoiceOuts", 'EcmInvoiceOuts');
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=ListSales", translate('LBL_LIST_SALES_RAP','EcmInvoiceOuts'),"EcmInvoiceOuts", 'EcmInvoiceOuts');
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=indexDecree&return_module=EcmInvoiceOutOlds&return_action=DetailView", "Dekret","EcmInvoiceOuts", 'EcmInvoiceOuts');
if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=multiDiscountCorrectInvoice", "Zbiorcza korekta rabatowa","EcmInvoiceOuts", 'EcmInvoiceOuts');
// if(ACLController::checkAccess('EcmInvoiceOuts', "list", true)) $module_menu [] = Array("index.php?module=EcmInvoiceOuts&action=Report_INTRASTAT", "Raport INTRASTAT","EcmInvoiceOuts", 'EcmInvoiceOuts');
?>

View File

@@ -0,0 +1,223 @@
<?php
class ModuleFieldsParser {
var $modules;
var $name;
function ModuleFieldsParser($name = 'mfp') {
$this->modules = Array();
if(file_exists('modules/EcmInvoiceOuts/ModuleFieldsParser/config.php')) {
require_once('modules/EcmInvoiceOuts/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(
'EcmInvoiceOuts' => array(
'name' => $app_list_strings['moduleList']['EcmInvoiceOuts'],
'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,447 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%">';
if($focus->parent_payer_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_CONTENT_PAYER'].'</b>';
}$content.= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
$content.=', '.$focus->parent_payer_address_country;
$content.='
</td>
<td style="text-align: right">
</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->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_payer_address_nip;
$nip = true;
}
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_payer_iln;
}
$content.='</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
if ($focus->type == 'correct')
$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] = 'Numer zwrotu:';
if($focus->ecminvoiceout_name!=''){
$corl=$labels['LBL_PDF_CORRECT_TO'];
$focus2=new EcmInvoiceOut();
$focus2->retrieve($focus->ecminvoiceout_id);
$data=$focus2->register_date;
$data= date('d.m.Y',strtotime($data));
$korekta='<br><b>' . $focus->ecminvoiceout_name . '</b>, z dnia ' . $data;
}
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
<td style="text-align: left;" width="35%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b>'.$korekta.'</td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
if($focus->wz_name!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
}
if($focus->order_no!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
}
if($focus->supplier_code!=''){
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
}
if($focus->payment_date!=''){
$content.=$labels['LBL_PAYMENT_DATE_PDF'].':<br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.=$labels['LBL_PAYMENT_METHOD_PDF'].':<br>';
}
$pay=new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
if($focus->wz_name!=''){
$content.='<b>' . $focus->wz_name.'</b><br>';
}
if($focus->order_no!=''){
$content.='<b>' . $focus->order_no.'</b><br>';
}
if($focus->supplier_code!=''){
$content.='<b>' . $focus->supplier_code.'</b><br>';
}
if($focus->payment_date!=''){
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='<b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method].'</b><br>';
}
$content.='</td></tr></table><br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa<br>Indeks',
'align' => 'left'
);
if($recipient_code==1){
$columns ['recipient_code'] = array (
'field' => array (
'recipient_code'
),
'label' => 'Kod Tow.',
'align' => 'center'
);
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość<br>J.m.',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena netto',
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => 'Wartość<br>netto',
'align' => 'right'
);
$columns ['ecmvat_name'] = array (
'field' => array (
'ecmvat_name'
),
'label' => 'VAT<br>(%)',
'align' => 'center'
);
$columns ['total_vat'] = array (
'field' => array (
'total_vat'
),
'label' => 'Wartość<br>VAT',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość<br>brutto',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
if($recipient_code==1){
$columns ['recipient_code'] ['width'] = '10';
}
$columns ['qty'] ['width'] = '10';
$columns ['price_netto'] ['width'] = '10';
$columns ['total_netto'] ['width'] = '10';
$columns ['ecmvat_name'] ['width'] = '4';
$columns ['total_vat'] ['width'] = '10';
$columns ['total_brutto'] ['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; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
if($focus->type=='normal'){
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 (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
} else {
foreach ( $positions as $pos ) {
$content .= '<tr>';
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['old_ecminvoiceoutitem_id']), $focus );
$pos2['name']='było';
$pos2['position']='';
$pos2['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos2 [$f] || $pos2 [$f] == '')
$pos2 [$f] = '-';
$content .= $pos2 [$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>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
<b>VAT (%)</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość netto</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość VAT</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
<b>Wartość brutto</b>
</td>';
$content.='</tr>
';
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v){
if($v=='')continue;
$v2 = explode(":", $v);
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
'.$v2[0].'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
'.format_number($v2[1]).'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
'.format_number($v2[2]).'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
'.format_number($v2[3]).'
</td></tr>';
}
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_netto).'</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_vat).'</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_brutto).'</b>
</td></tr>';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
$content .= '
</table>
<table style="font-size: 7pt;">
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->paid_val!=''){
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
$content .= '<tr><td>'.$labels['LBL_PDF_PAID'].'</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
}
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
$content .= '<tr><td>'.$labels['LBL_PDF_LEFT_TO_PAID'].'</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
</table><br><br>';
die($focus->currency_id);
if ($focus->currency_id!='PLN') {
//get currency date
$dd = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT date FROM currency_nbp_archive WHERE currency_id='".$focus->currency_id."' AND nbp_table_name='".$focus->currency_table."' "));
$content.="Wartość VAT w zł: ".($focus->total_vat*$focus->currency_nbp_value)." przeliczowo wg. kursu NBP (".$focus->currency_table.", ".number_format($focus->currency_value,2).") z dnia ".$dd['date'];
}
$content.='<br><br>
<p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
<br><br>
' . $focus->pdf_text . '
';
//echo $content; die();

View File

@@ -0,0 +1,38 @@
<?php
function formatPDFPositions($positions, $focus) {
$result = array();
foreach ($positions as $pos) {
$pos['quantity'] = intval($pos['quantity']);
$pos['old_quantity'] = intval($pos['old_quantity']);
$pos['position'] = intval($pos['position'])+1;
$pos['price_netto']=format_number($pos['price_netto']);
$pos['total_vat']=format_number($pos['total_vat']);
$pos['ecmvat_value']=format_number($pos['ecmvat_value']);
$pos['total_brutto']=format_number($pos['total_brutto']);
$pos['total_netto']=format_number($pos['total_netto']);
$pos['old_total_netto']=format_number($pos['old_total_netto']);
$pos['old_total_brutto']=format_number($pos['old_total_brutto']);
$pos['old_total_vat']=format_number($pos['old_total_vat']);
$pos['old_price_netto']=format_number($pos['old_price_netto']);
$result[] = $pos;
}
return $result;
}
function mysql_escape_gpc($dirty)
{
if (ini_get('magic_quotes_gpc'))
{
return $dirty;
}
else
{
return mysql_real_escape_string($dirty);
}
}

View File

@@ -0,0 +1,381 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>NABYWCA / BUYER</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>DOSTAWA / DELIVERY</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%">';
if($focus->parent_payer_address_name!=''){
$content.= '<b>PŁATNIK / PAYER</b>';
}$content.= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
$content.=', '.$focus->parent_payer_address_country;
$content.='
</td>
<td style="text-align: right">
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.='NIP/Vat ID: '.$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->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
}
$content.='</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
if($focus->ecminvoiceout_name!=''){
$corl='Korekta do / Correct to:<br>';
}
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
<tr><td width="25%" style="text-align: left;">Data wystawienia / '.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>Miejsce wystawienia / Place of register:<br>Data sprzedaży / Selling date:<br>'.$corl.'</td>
<td style="text-align: left;" width="40%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b></td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
if($focus->wz_name!=''){
$content.='Dokument WZ / WZ Document:<br>';
}
if($focus->order_no!=''){
$content.='Nr zamówienia / Order No:<br>';
}
if($focus->supplier_code!=''){
$content.='Kod dostawcy / Supplier code:<br>';
}
if($focus->payment_date!=''){
$content.='Termin płatności / Payment date:<br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='Metoda płatności / Payment method:<br>';
}
$pay=new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
if($focus->wz_name!=''){
$content.='<b>' . $focus->wz_name.'</b><br>';
}
if($focus->order_no!=''){
$content.='<b>' . $focus->order_no.'</b><br>';
}
if($focus->supplier_code!=''){
$content.='<b>' . $focus->supplier_code.'</b><br>';
}
if($focus->payment_date!=''){
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
}
$content.='</td></tr></table><br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp. / Pos.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa / Name<br>Indeks / Index ',
'align' => 'left'
);
if($recipient_code==1){
$columns ['recipient_code'] = array (
'field' => array (
'recipient_code'
),
'label' => 'Kod Tow. / Recipient Code',
'align' => 'center'
);
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość / Qantity<br>J.m. / Unit',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena / Price',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość / Value',
'align' => 'right'
);
// set widths
$totals = array ();
if($recipient_code==1){
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
$columns ['recipient_code'] ['width'] = '12';
$columns ['qty'] ['width'] = '12';
$columns ['price_netto'] ['width'] = '12';
$columns ['total_brutto'] ['width'] = '12';
} else {
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '51';
$columns ['qty'] ['width'] = '14';
$columns ['price_netto'] ['width'] = '14';
$columns ['total_brutto'] ['width'] = '14';
}
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
if($focus->type=='normal'){
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 (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
} else {
foreach ( $positions as $pos ) {
$content .= '<tr>';
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['ecminvoiceoutitem_id']), $focus );
$pos2['name']='było / was';
$pos2['position']='';
$pos2['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos2 [$f] || $pos2 [$f] == '')
$pos2 [$f] = '-';
$content .= $pos2 [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
}
$content .= '
</tbody></table>
';
// summary table
// get currency symbol
$c = new Currency ();
$c->retrieve ( $focus->currency_id );
$symbol = $c->name;
unset ( $c );
$content .= '
<br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content.='</tr>
';
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem / Total</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_brutto).' '.$symbol.'</b>
</td></tr></table>';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
if($focus->type=='correct'){
$content .= '<table style="font-size: 7pt;"><tr><td >Do zwrotu / To paid back:</td><td style="text-align: right;">
<b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr></table>';
} else {
$content .= '
<table style="font-size: 7pt;">
<tr><td>Do zapłaty / To pay:</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->paid_val!=''){
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
$content .= '<tr><td>Zapłacono / Paid:</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
}
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
$content .= '<tr><td>Pozostało do zapłaty / Left to paid:</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
</table>';}
$default= "Dla wszystkich pozycji faktury zastosowano stawkę VAT 0%
<br>VAT is 0% for all invoice items
<br>(Zgodnie z art. 41 ust. 3 ustawy o podatku VAT)";
if($focus->pdf_export!=""){
$focus->pdf_export =str_replace("\r\n","<br>",$focus->pdf_export);
} else {
$focus->pdf_export = $default;
}
$content .= '<br><br><br><br>'.$focus->pdf_export.'<p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
<br><br>
' . $focus->pdf_text . '
';
//echo $content; die();

View File

@@ -0,0 +1,407 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$db = $GLOBALS['db'];
$ret = $db->query("
SELECT distinct o.ecminvoiceout_id
FROM
ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts as i
ON ii.ecminvoiceout_id = i.id
INNER JOIN ecminvoiceoutitems AS o
ON o.id = ii.ecminvoiceoutitem_id
WHERE
ii.ecminvoiceout_id = '$focus->id'");
if ($ret->num_rows > 1) $multi_correct = true;
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>NABYWCA / BUYER</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>DOSTAWA / DELIVERY</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%">';
if($focus->parent_payer_address_name!=''){
$content.= '<b>PŁATNIK / PAYER</b>';
}$content.= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
$content.=', '.$focus->parent_payer_address_country;
$content.='
</td>
<td style="text-align: right">
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.='NIP/Vat ID: '.$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->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content.='NIP/Vat ID: '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_shipping_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content.='NIP/Vat ID: '.$focus->parent_payer_address_nip;
$nip = true;
}
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
if ($nip) $content.'<br>'; $nip = false;
$content.=$labels['LBL_PDF_CONTENT_ILN'].' '.$focus->parent_payer_iln;
}
$content.='</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
if($focus->type=='correct'){
$corl='Korekta do / Correct to:';
$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] = "Numer zwrotu / Return number";
}
$labels['LBL_PLACE_PDF'] = 'Miejsce wystawienia / Place of register:';
$labels['LBL_PDF_CONTENT_SELL_DATE'] = 'Data sprzedaży / Sell date:';
if (!$multi_correct) {
$inv = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT register_date FROM ecminvoiceouts WHERE id='".$focus->ecminvoiceout_id."'"));
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="25%" >Data wystawienia / Register date<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
<td style="text-align: left;" width="40%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b>, '.$inv['register_date'].'</td>
<td rowspan="2" style="text-align: left;vertical-align:top; width: 25%;">';
} else {
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="25%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br></td>
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b></b></td>
<td rowspan="2" style="text-align: left;vertical-align:top; width: 25%">';
}
if($focus->wz_name!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
}
if($focus->order_no!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
}
if($focus->supplier_code!=''){
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
}
if($focus->payment_date!=''){
$content.='Data płatności / Payment date:<br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='Metoda płatności / Payment method:<br>';
}
$pay=new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
if($focus->wz_name!=''){
$content.='<b>' . $focus->wz_name.'</b><br>';
}
if($focus->order_no!=''){
$content.='<b>' . $focus->order_no.'</b><br>';
}
if($focus->supplier_code!=''){
$content.='<b>' . $focus->supplier_code.'</b><br>';
}
if($focus->payment_date!=''){
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
}
$content.='</td></tr></table><br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp. / Pos.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa / Name<br>Indeks / Index ',
'align' => 'left'
);
if($recipient_code==1){
$columns ['recipient_code'] = array (
'field' => array (
'recipient_code'
),
'label' => 'Kod Tow. / Recipient Code',
'align' => 'center'
);
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość / Qantity<br>J.m. / Unit',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena /Price',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość / Value',
'align' => 'right'
);
// set widths
// set widths
$totals = array ();
if($recipient_code==1){
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
$columns ['recipient_code'] ['width'] = '12';
$columns ['qty'] ['width'] = '12';
$columns ['price_netto'] ['width'] = '12';
$columns ['total_brutto'] ['width'] = '12';
} else {
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '51';
$columns ['qty'] ['width'] = '14';
$columns ['price_netto'] ['width'] = '14';
$columns ['total_brutto'] ['width'] = '14';
}
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.5 solid black; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
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 ((! $pos [$f] || $pos [$f] == '') && $f!='quantity')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
$pos['name'] = 'było';
if ($multi_correct) {
// get invoice
$c = $db->fetchByAssoc ( $db->query ( "
SELECT i.document_no, i.order_no, register_date FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems as ii
ON i.id=ii.ecminvoiceout_id
WHERE ii.id = '" . $pos ['ecminvoiceoutitem_id'] . "'
" ) );
if ($c['order_no'] && $c['order_no']!='')
$pos['name'] .= '<br>' . $corl . ' ' . $c ['document_no'] .' - '.$c['register_date'].'<br>' .
$mod_strings ['LBL_PDF_ORDER_NO'].' '.$c['order_no'];
else
$pos['name'] .= '<br>' . $corl .' '.$c ['document_no'] .' - '.$c['register_date'];
unset ( $c );
}
$pos['total_netto'] = $pos['old_total_netto'];
$pos['total_brutto'] = $pos['old_total_brutto'];
$pos['total_vat'] = $pos['old_total_vat'];
$pos['price_netto'] = $pos['old_price_netto'];
$pos['quantity'] = $pos['old_quantity'];
$pos['position']='';
$pos['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
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->iso4217;
unset ( $c );
$content .= '
<br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość / Value</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_brutto).'</b>
</td>
';
$content.='</tr>
';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
if ($focus->total_brutto > 0)
$labels['LBL_PDF_TO_PAY'] = 'Do zapłaty / To paid: ';
else
$labels['LBL_PDF_TO_PAY'] = 'Do zwrotu / To paid back: ';
$total_brutto = abs($focus->total_brutto);
$content .= '
</table>
<table style="font-size: 7pt;">
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
if (!$focus->pdf_text || $focus->pdf_text=="")
$focus->pdf_text = "Przyczyna korekty: Zwrot towaru.<br>Correct reason: Products return.";
$content .= '
</table><br><p style="font-size: 7pt;">Wystawił / Issued by <b>'.$user->full_name.'</b></p>
<br><br>
' . $focus->pdf_text . '
';

View File

@@ -0,0 +1,419 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>' . $labels['LBL_PDF_CONTENT_INVOICE_FOR'] . '</b>
</td>
<td style="width: ' . $w3 . '%">';
if ($focus->parent_shipping_address_name != '') {
$content .= '<b>' . $labels['LBL_PDF_CONTENT_DELIVERY'] . '</b>';
}
$content .= '</td>
<td style="width: ' . $w2 . '%">';
if ($focus->parent_payer_address_name != '') {
$content .= '<b>' . $labels['LBL_PDF_CONTENT_PAYER'] . '</b>';
}
$content .= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_name . '
</td>
<td style="width: ' . $w2 . '%">' . $focus->parent_payer_address_name . '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country != '')
$content .= ', ' . $focus->parent_shipping_address_country;
$content .= '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country != '')
$content .= ', ' . $focus->parent_payer_address_country;
$content .= '
</td>
<td style="text-align: right">
</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 .= 'ILN: ' . $focus->parent_iln;
}
$content .= '
</td>';
$content .= '
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content .= '<br>';
$nip = false;
$content .= 'ILN: ' . $focus->parent_shipping_iln;
}
$content .= '
</td>';
$content .= '
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_payer_address_nip;
$nip = true;
}
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
if ($nip) $content .= '<br>';
$nip = false;
$content .= 'ILN: ' . $focus->parent_payer_iln;
}
$content .= '</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content .= '
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="18%" >' . $labels['LBL_PDF_CONTENT_REGISTER_DATE'] . '<br>' . $labels['LBL_PLACE_PDF'] . '<br>' . $labels['LBL_PDF_CONTENT_SELL_DATE'] . '<br>' . $corl . '</td>
<td style="text-align: left;" width="35%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b>' . $korekta . '</td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
if ($focus->wz_name != '') {
$content .= $labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'] . ':<br>';
}
if ($focus->order_no != '') {
$content .= $labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] . ':<br>';
}
if ($focus->supplier_code != '') {
$content .= $labels['LBL_SUPPLIER_CODE'] . ':<br>';
}
if ($focus->payment_date != '') {
$content .= $labels['LBL_PAYMENT_DATE_PDF'] . ':<br>';
}
if ($focus->ecmpaymentcondition_id != '') {
$content .= $labels['LBL_PAYMENT_METHOD_PDF'] . ':<br>';
}
$pay = new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content .= '</td>
<td rowspan="2" style="vertical-align:top;">';
if ($focus->wz_name != '') {
$content .= '<b>' . $focus->wz_name . '</b><br>';
}
if ($focus->order_no != '') {
$content .= '<b>' . $focus->order_no . '</b><br>';
}
if ($focus->supplier_code != '') {
$content .= '<b>' . $focus->supplier_code . '</b><br>';
}
if ($focus->payment_date != '') {
$content .= '<b>' . date('d.m.Y', strtotime($focus->payment_date)) . '</b><br>';
}
if ($focus->ecmpaymentcondition_id != '') {
$content .= '<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method] . '</b><br>';
}
$content .= '</td></tr></table><br>';
// start items table
$columns = array();
$columns['position'] = array(
'field' => array(
'position'
),
'label' => 'Lp.',
'align' => 'center'
);
$columns['name'] = array(
'field' => array(
'name',
'product_code'
),
'label' => 'Nazwa<br>Indeks',
'align' => 'left'
);
if ($recipient_code == 1) {
$columns['recipient_code'] = array(
'field' => array(
'recipient_code'
),
'label' => 'Kod Tow.',
'align' => 'center'
);
}
$columns['qty'] = array(
'field' => array(
'quantity',
'unit_name'
),
'label' => 'Ilość<br>J.m.',
'align' => 'right'
);
$columns['price_netto'] = array(
'field' => array(
'price_netto'
),
'label' => 'Cena netto',
'align' => 'right'
);
$columns['total_netto'] = array(
'field' => array(
'total_netto'
),
'label' => 'Wartość<br>netto',
'align' => 'right'
);
$columns['ecmvat_name'] = array(
'field' => array(
'ecmvat_name'
),
'label' => 'VAT<br>(%)',
'align' => 'center'
);
$columns['total_vat'] = array(
'field' => array(
'total_vat'
),
'label' => 'Wartość<br>VAT',
'align' => 'right'
);
$columns['total_brutto'] = array(
'field' => array(
'total_brutto'
),
'label' => 'Wartość<br>brutto',
'align' => 'right'
);
// set widths
$totals = array();
$columns['position']['width'] = '5';
$columns['name']['width'] = '41';
if ($recipient_code == 1) {
$columns['recipient_code']['width'] = '10';
}
$columns['qty']['width'] = '10';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
$columns['ecmvat_name']['width'] = '4';
$columns['total_vat']['width'] = '10';
$columns['total_brutto']['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; width: ' . $col['width'] . '%;background-color: #E9E9E9;">' . $col['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter = 1;
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 (!$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>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
<b>VAT (%)</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość netto</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość VAT</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
<b>Wartość brutto</b>
</td>';
$content .= '</tr>
';
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v) {
if ($v == '') continue;
$v2 = explode(":", $v);
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
' . $v2[0] . '
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
' . format_number($v2[1]) . '
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
' . format_number($v2[2]) . '
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
' . format_number($v2[3]) . '
</td></tr>';
}
$total_paid_vat = 0;
$total_paid_netto = 0;
if ($focus->prepaid != '') {
$vat_value = substr($k,0,-1)+'';
if (strlen($vat_value) == 1) $vat_value = '0'.$vat_value;
$paid_netto = round($focus->prepaid / 1.23,2);
$paid_vat = $focus->prepaid - $paid_netto;
$total_paid_netto += $paid_netto;
$total_paid_vat += $paid_vat;
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
23%
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
-' .format_number($paid_netto). '
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
-' .format_number($paid_vat). '
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
-' . format_number($focus->prepaid) . '
</td></tr>';
}
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>' . format_number($focus->total_netto-$total_paid_netto) . '</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>' . format_number($focus->total_vat-$total_paid_vat) . '</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>' . format_number($focus->total_brutto-$focus->prepaid) . '</b>
</td></tr>';
$left_to_paid = $focus->total_brutto - $focus->paid_val - $focus->prepaid;
$content .= '
</table>
<table style="font-size: 7pt;">';
if ($focus->prepaid != '') {
$content .= '<tr><td>FV przedpłatowa:</td><td style="text-align: right;"><b>' . $focus->prepaid_nr . '</b></td><td style="text-align:left;"></td></tr>';
}
$content .= '<tr><td>' . $labels['LBL_PDF_TO_PAY'] . '</td><td style="text-align: right;"><b>' . format_number($focus->total_brutto) . ' ' . $symbol . '</b></td><td></td></tr>';
if ($focus->prepaid != '') {
$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>' . format_number($focus->prepaid) . ' ' . $symbol . '</b></td><td style="text-align:left;"></td></tr>';
}
if ($focus->paid_val != '') {
if ($focus->paid_val != 0) $pay_text = $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
$content .= '<tr><td>' . $labels['LBL_PDF_PAID'] . '</td><td style="text-align: right;"><b>' . format_number($focus->paid_val) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $pay_text . '</td></tr>';
}
if ($focus->ecmpaymentcondition_id != '') {
$q = $db->query("select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'");
$r = $db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if ($focus->payment_date != '') {
$dni = (strtotime($focus->payment_date) - strtotime($focus->sell_date)) / (3600 * 24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
$content .= '<tr><td>' . $labels['LBL_PDF_LEFT_TO_PAID'] . '</td><td style="text-align: right;"><b>' . format_number($left_to_paid) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $paid_text . '</td></tr>
</table>';
if ($focus->currency_id != 'PLN') {
//get currency date
$dd = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT date, value FROM currency_nbp_archive WHERE currency_id='" . $focus->currency_id . "' AND nbp_table_name='" . $focus->currency_table . "' "));
$content .= "<p style='font-size: 7pt;'>Wartość VAT w zł: " . format_number(($focus->total_vat * $dd['value'])) . ". Przeliczowo wg. kursu NBP (" . $focus->currency_table . ": " . format_number($dd['value'], 4, 4) . " zł) z dnia " . $dd['date'] . '</p>';
}
$content .= '<p style="font-size: 7pt;">' . $labels['LBL_PDF_CONTENT_ISSUED_BY'] . ' <b>' . $user->full_name . '</b></p>
<br><br>
' . $focus->pdf_text . '
';

View File

@@ -0,0 +1,462 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$db = $GLOBALS['db'];
$ret = $db->query("
SELECT distinct o.ecminvoiceout_id
FROM
ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts as i
ON ii.ecminvoiceout_id = i.id
INNER JOIN ecminvoiceoutitems AS o
ON o.id = ii.ecminvoiceoutitem_id
WHERE
ii.ecminvoiceout_id = '$focus->id'");
if ($ret->num_rows > 1) $multi_correct = true;
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_CONTENT_INVOICE_FOR'].'</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_CONTENT_DELIVERY'].'</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%">';
if($focus->parent_payer_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_CONTENT_PAYER'].'</b>';
}$content.= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
$content.=', '.$focus->parent_payer_address_country;
$content.='
</td>
<td style="text-align: right">
</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.='ILN: '.$focus->parent_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.='ILN: '.$focus->parent_shipping_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content.=$labels['LBL_PDF_CONTENT_NIP'].' '.$focus->parent_payer_address_nip;
$nip = true;
}
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.='ILN: '.$focus->parent_payer_iln;
}
$content.='</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
if($focus->type=='correct'){
$corl=$labels['LBL_PDF_CORRECT_TO'];
$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'] = "Numer zwrotu";
}
if (!$multi_correct) {
$inv = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT register_date FROM ecminvoiceouts WHERE id='".$focus->ecminvoiceout_id."'"));
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br>'.$corl.'</td>
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b>, z dnia '.$inv['register_date'].'</td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
} else {
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
<tr><td width="18%" >'.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>'.$labels['LBL_PLACE_PDF'].'<br>'.$labels['LBL_PDF_CONTENT_SELL_DATE'].'<br></td>
<td style="text-align: left;" width="50%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b></b></td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
}
if($focus->wz_name!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'].':<br>';
}
if($focus->order_no!=''){
$content.=$labels['LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'].':<br>';
}
if($focus->supplier_code!=''){
$content.=$labels['LBL_SUPPLIER_CODE'].':<br>';
}
if($focus->payment_date!=''){
$content.=$labels['LBL_PAYMENT_DATE_PDF'].':<br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.=$labels['LBL_PAYMENT_METHOD_PDF'].':<br>';
}
$pay=new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
if($focus->wz_name!=''){
$content.='<b>' . $focus->wz_name.'</b><br>';
}
if($focus->order_no!=''){
$content.='<b>' . $focus->order_no.'</b><br>';
}
if($focus->supplier_code!=''){
$content.='<b>' . $focus->supplier_code.'</b><br>';
}
if($focus->payment_date!=''){
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='<b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method].'</b><br>';
}
$content.='</td></tr></table><br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa<br>Indeks',
'align' => 'left'
);
if($recipient_code==1){
$columns ['recipient_code'] = array (
'field' => array (
'recipient_code'
),
'label' => 'Kod Tow.',
'align' => 'center'
);
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość<br>J.m.',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena netto',
'align' => 'right'
);
$columns ['total_netto'] = array (
'field' => array (
'total_netto'
),
'label' => 'Wartość<br>netto',
'align' => 'right'
);
$columns ['ecmvat_name'] = array (
'field' => array (
'ecmvat_name'
),
'label' => 'VAT<br>(%)',
'align' => 'center'
);
$columns ['total_vat'] = array (
'field' => array (
'total_vat'
),
'label' => 'Wartość<br>VAT',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość<br>brutto',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
if($recipient_code==1){
$columns ['recipient_code'] ['width'] = '10';
}
$columns ['qty'] ['width'] = '10';
$columns ['price_netto'] ['width'] = '10';
$columns ['total_netto'] ['width'] = '10';
$columns ['ecmvat_name'] ['width'] = '4';
$columns ['total_vat'] ['width'] = '10';
$columns ['total_brutto'] ['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; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
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 ((! $pos [$f] || $pos [$f] == '') && $f!='quantity')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
$pos['name'] = 'było';
if ($multi_correct) {
// get invoice
$c = $db->fetchByAssoc ( $db->query ( "
SELECT i.document_no, i.order_no, register_date FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems as ii
ON i.id=ii.ecminvoiceout_id
WHERE ii.id = '" . $pos ['ecminvoiceoutitem_id'] . "'
" ) );
if ($c['order_no'] && $c['order_no']!='')
$pos['name'] .= '<br>' . $corl . ' ' . $c ['document_no'] .' - '.$c['register_date'].'<br>' .
$mod_strings ['LBL_PDF_ORDER_NO'].' '.$c['order_no'];
else
$pos['name'] .= '<br>' . $corl .' '.$c ['document_no'] .' - '.$c['register_date'];
unset ( $c );
}
$pos['total_netto'] = $pos['old_total_netto'];
$pos['total_brutto'] = $pos['old_total_brutto'];
$pos['total_vat'] = $pos['old_total_vat'];
$pos['price_netto'] = $pos['old_price_netto'];
$pos['quantity'] = $pos['old_quantity'];
$pos['position']='';
$pos['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
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>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
<b>VAT (%)</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość netto</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
<b>Wartość VAT</b>
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
<b>Wartość brutto</b>
</td>';
$content.='</tr>
';
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v){
if($v=='')continue;
$v2 = explode(":", $v);
$content .= '
<tr>
<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
'.$v2[0].'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
'.format_number($v2[1]).'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
'.format_number($v2[2]).'
</td>
<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
'.format_number($v2[3]).'
</td></tr>';
}
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_netto).'</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_vat).'</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_brutto).'</b>
</td></tr>';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
if ($focus->total_brutto > 0)
$labels['LBL_PDF_TO_PAY'] = 'Do zapłaty: ';
else
$labels['LBL_PDF_TO_PAY'] = 'Do zwrotu: ';
$total_brutto = abs($focus->total_brutto);
$content .= '
</table>
<table style="font-size: 7pt;">
<tr><td>'.$labels['LBL_PDF_TO_PAY'].'</td><td style="text-align: right;"><b>'.format_number($total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
if (!$focus->pdf_text || $focus->pdf_text=="")
$focus->pdf_text = "Przyczyna korekty: Zwrot towaru.";
$content .= '
</table><br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
<br><br>
' . $focus->pdf_text . '
';

View File

@@ -0,0 +1,366 @@
<?php
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%">
<b>'.$labels['LBL_PDF_UE_BUYER_TITLE'].'</b>
</td>
<td style="width: ' . $w3 . '%">';
if($focus->parent_shipping_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_UE_DELIVERY_TITLE'].'</b>';
}
$content.= '</td>
<td style="width: ' . $w2 . '%">';
if($focus->parent_payer_address_name!=''){
$content.= '<b>'.$labels['LBL_PDF_UE_PAYER_TITLE'].'</b>';
}$content.= '</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_name . '
</td>
<td style="width: ' . $w3 . '%">
'.$focus->parent_shipping_address_name.'
</td>
<td style="width: ' . $w2 . '%">'.$focus->parent_payer_address_name.'</td>
<td style="text-align: right"></td>
</tr>
<tr>
<td style="width: ' . $w . '%">
' . $focus->parent_address_street . '
</td>
<td style="width: ' . $w3 . '%">
' . $focus->parent_shipping_address_street . '
</td>
<td style="width: ' . $w2 . '%">
' . $focus->parent_payer_address_street . '
</td>
<td style="text-align: right">
</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->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country!='')
$content.=', '.$focus->parent_shipping_address_country;
$content.='
</td>
<td style="width: ' . $w2 . '%">
'. $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country!='')
$content.=', '.$focus->parent_payer_address_country;
$content.='
</td>
<td style="text-align: right">
</td>
</tr>';
$content.='
<tr>
<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_nip;
$nip = true;
}
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.='ILN: '.$focus->parent_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_shipping_address_nip) && $focus->parent_shipping_address_nip) {
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.='ILN: '.$focus->parent_shipping_iln;
}
$content.='
</td>';
$content.='
<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_address_nip) && $focus->parent_payer_address_nip) {
$content.=$labels['LBL_PDF_UE_NIP'].' '.$focus->parent_shipping_address_nip;
$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
if ($nip) $content.='<br>'; $nip = false;
$content.='ILN: '.$focus->parent_shipping_iln;
}
$content.='</td>
<td colspan="0" valign="top" style="text-align: right">
</td>
</tr>';
$content.='
</table>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
if($focus->ecminvoiceout_name!=''){
$corl='Korekta do / Correct to:<br>';
}
$content .= '<br><table width="100%" style="font-size: 7pt;text-align:right;vertical-align:top;">
<tr><td width="44%" >Data wystawienia / '.$labels['LBL_PDF_CONTENT_REGISTER_DATE'].'<br>Miejsce wystawienia / Place of register:<br>Data sprzedaży / Selling date:<br>'.$corl.'</td>
<td style="text-align: left;" width="20%"><b>' . $focus->register_date . '</b><br><b>Warszawa</b><br><b>' . $focus->sell_date . '</b><br><b>' . $focus->ecminvoiceout_name . '</b></td>
<td rowspan="2" style="text-align: left;vertical-align:top;">';
if($focus->wz_name!=''){
$content.='Dokument WZ / WZ Document:<br>';
}
if($focus->order_no!=''){
$content.='Nr zamówienia / Order No:<br>';
}
if($focus->supplier_code!=''){
$content.='Kod dostawcy / Supplier code:<br>';
}
if($focus->payment_date!=''){
$content.='Termin płatności / Payment date:<br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='Metoda płatności / Payment method:<br>';
}
$pay=new EcmPaymentCondition();
$pay->retrieve($focus->ecmpaymentcondition_id);
$content.='</td>
<td rowspan="2" style="vertical-align:top;">';
if($focus->wz_name!=''){
$content.='<b>' . $focus->wz_name.'</b><br>';
}
if($focus->order_no!=''){
$content.='<b>' . $focus->order_no.'</b><br>';
}
if($focus->supplier_code!=''){
$content.='<b>' . $focus->supplier_code.'</b><br>';
}
if($focus->payment_date!=''){
$content.='<b>' . date('d.m.Y',strtotime($focus->payment_date)).'</b><br>';
}
if($focus->ecmpaymentcondition_id!=''){
$content.='<b>' . $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$pay->payment_method].'</b><br>';
}
$content.='</td></tr></table><br>';
// start items table
$columns = array ();
$columns ['position'] = array (
'field' => array (
'position'
),
'label' => 'Lp. / Pos.',
'align' => 'center'
);
$columns ['name'] = array (
'field' => array (
'name',
'product_code'
),
'label' => 'Nazwa / Name<br>Indeks / Index ',
'align' => 'left'
);
if($recipient_code==1){
$columns ['recipient_code'] = array (
'field' => array (
'recipient_code'
),
'label' => 'Kod Tow. / Recipient Code',
'align' => 'center'
);
}
$columns ['qty'] = array (
'field' => array (
'quantity',
'unit_name'
),
'label' => 'Ilość / Qantity<br>J.m. / Unit',
'align' => 'right'
);
$columns ['price_netto'] = array (
'field' => array (
'price_netto'
),
'label' => 'Cena / Price',
'align' => 'right'
);
$columns ['total_brutto'] = array (
'field' => array (
'total_brutto'
),
'label' => 'Wartość / Value',
'align' => 'right'
);
// set widths
$totals = array ();
$columns ['position'] ['width'] = '5';
$columns ['name'] ['width'] = '41';
if($recipient_code==1){
$columns ['recipient_code'] ['width'] = '10';
}
$columns ['qty'] ['width'] = '10';
$columns ['price_netto'] ['width'] = '10';
$columns ['total_brutto'] ['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; width: ' . $col ['width'] . '%;background-color: #E9E9E9;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$counter=1;
if($focus->type=='normal'){
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 (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
} else {
foreach ( $positions as $pos ) {
$content .= '<tr>';
$pos2= formatPDFPositionsCorrect ($focus->getCorrectedPosition($pos['ecminvoiceoutitem_id']), $focus );
$pos2['name']='było / was';
$pos2['position']='';
$pos2['product_code']=' ';
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos [$f] || $pos [$f] == '')
$pos [$f] = '-';
$content .= $pos [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr><tr>';
// old correct item
foreach ( $columns as $col ) {
$content .= '<td style="border: 0.5 solid black; text-align: ' . $col ['align'] . ';">';
foreach ( $col ['field'] as $f ) {
if (! $pos2 [$f] || $pos2 [$f] == '')
$pos2 [$f] = '-';
$content .= $pos2 [$f] . '<br>';
}
$content .= '</td>';
}
$content .= '</tr>';
}
}
$content .= '
</tbody></table>
';
// summary table
// get currency symbol
$c = new Currency ();
$c->retrieve ( $focus->currency_id );
$symbol = $c->name;
unset ( $c );
$content .= '
<br>
<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';
$content.='</tr>
';
// totals
$content .= '
<tr>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
<b>Razem / Total</b>
</td>
<td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
<b>'.format_number($focus->total_brutto).' '.$symbol.'</b>
</td></tr></table>';
$left_to_paid=$focus->total_brutto-$focus->paid_val;
if($focus->type=='correct'){
$content .= '<table style="font-size: 7pt;"><tr><td >Do zwrotu / To paid back:</td><td style="text-align: right;">
<b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr></table>';
} else {
$content .= '
<table style="font-size: 7pt;">
<tr><td>Do zapłaty / To pay:</td><td style="text-align: right;"><b>'.format_number($focus->total_brutto).' '.$symbol.'</b></td><td></td></tr>';
if($focus->paid_val!=''){
if($focus->paid_val!=0)$pay_text=$GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
$content .= '<tr><td>Zapłacono / Paid:</td><td style="text-align: right;"><b>'.format_number($focus->paid_val).' '.$symbol.'</b></td><td style="text-align:left;">'.$pay_text.'</td></tr>';
}
if($focus->ecmpaymentcondition_id!=''){
$q= $db->query ( "select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'" );
$r=$db->fetchByAssoc($q);
//$paid_text='w Terminie <b>'.$r['name'].'</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
if($focus->payment_date!=''){
$dni=(strtotime($focus->payment_date)-strtotime($focus->sell_date))/(3600*24);
//$paid_text='w Terminie <b>'.$dni.' dni</b> do <b>'.date('d.m.Y',strtotime($focus->payment_date)).'</b> '.$GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
}
}
$content .= '<tr><td>Pozostało do zapłaty / Left to paid:</td><td style="text-align: right;"><b>'.format_number($left_to_paid).' '.$symbol.'</b></td><td style="text-align:left;">'.$paid_text.'</td></tr>
</table>';}$content .= '<br><b>Dla wszystkich pozycji faktury zastosowano stawkę VAT 0%
<br>VAT is 0% for all invoice items
<br>(Zgodnie z art. 41 ust. 3 ustawy o podatku VAT)</b><br><p style="font-size: 7pt;">'.$labels['LBL_PDF_CONTENT_ISSUED_BY'].' <b>'.$user->full_name.'</b></p>
<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 ($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';
}
if ($focus->parent_id=='75de804b-4dad-854f-5e6f-533e81e6289c'){
// usd
$ba_number = 'PL 48 1160 2244 7107 0000 0000 3020';
$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,93 @@
<?php
$w = "62"; //first column width
$w2 = "12"; //second column width
//get bank information
$a = new Account();
$a->retrieve($focus->parent_id);
$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">
PL525273990
</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,23 @@
<?php
if($focus->type=='normal')$text='Faktura nr';
if($focus->type=='correct')$text='Faktura korygująca nr';
$header = '
<table style="font-size: 8pt; width: 100%"><tr>
<td width="35%" style="text-align: left; vertical-align: top;">
<b>SPRZEDAWCA</b><br />
e5 Polska Sp. z o. o.<br />
ul. Wąwozowa 11<br />
02-796 Warszawa<br />
NIP: 5252173990<br>
BDO: 000036962
</td>
<td style="text-align: left; vertical-align: middle;"><p style="text-align: center;font-size: 12pt;"><b>'.$text.' '.$focus->document_no.'</b></p>
</td>
<td width="15%">
<img style="width: 70px;" src="modules/EcmDocumentTemplates/files/13899e0f-321c-229a-aa3e-48be4a1532c1.png"/>
</td>
</tr></table>
<hr>
';

View File

@@ -0,0 +1,25 @@
<?php
if($focus->type=='normal')$text='Faktura/Invoice';
if($focus->type=='correct')$text='Faktura korygująca nr/Correct Invoice';
$header = '
<table style="font-size: 8pt; width: 100%"><tr>
<td width="35%" style="text-align: left; vertical-align: top;">
<b>SPRZEDAWCA / SELLER
</b><br />
e5 Polska Sp. z o. o.<br />
ul. Wąwozowa 11<br />
02-796 Warszawa<br />
NIP: PL5252173990<br>
BDO: 000036962
</td>
</td>
<td style="text-align: left; vertical-align: middle;"><p style="text-align: center;font-size: 12pt;"><b>'.$text.' '.$focus->document_no.'</b></p>
</td>
<td width="15%">
<img style="width: 70px;" src="modules/EcmDocumentTemplates/files/13899e0f-321c-229a-aa3e-48be4a1532c1.png"/>
</td>
</tr></table>
<hr>
';

View File

@@ -0,0 +1,144 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once ('include/time.php');
require_once ('include/json_config.php');
$json_config = new json_config ();
$db = $GLOBALS['db'];
$process = false;
$edit->ss = new Sugar_Smarty ();
if ($_POST['process']) {
$where = "YEAR(i.register_date)=".$_POST['year']." AND MONTH(i.register_date)=".$_POST['month']."
AND i.pdf_type='U' AND i.deleted=0 AND i.canceled=0";
$process = true;
$invoices = getInvoices($db, $where);
$badProducts = getBadProducts($db, $where);
$data = getData($db, $where);
$edit->ss->assign("data", $data );
$edit->ss->assign("invoices", $invoices);
$edit->ss->assign("badProducts", $badProducts);
}
if ($_POST['xml']) {
$month = $_POST['xml_month'];
if (strlen($month) == 1) {
$month = '0'.$month;
}
$where = "YEAR(i.register_date)=".$_POST['xml_year']." AND MONTH(i.register_date)=".$_POST['xml_month']."
AND i.pdf_type='U' AND i.deleted=0 AND i.canceled=0";
ob_end_clean();
header_remove();
header("Content-type: text/xml");
header('Content-Disposition: attachment; filename="01'.$month.''.$_POST['xml_year'].'TWIN.xml"');
$data = getData($db, $where);
$edit->ss->assign("month", $month);
$edit->ss->assign("year", $_POST['xml_year']);
$edit->ss->assign("today", date("Y").'-'.date("m").'-'.date('d'));
$edit->ss->assign("data", $data );
$edit->ss->assign("total", array_reduce($data, "sum"));
$edit->ss-> display('modules/EcmInvoiceOuts/tpls/Report_INTRASTAT_XML.tpl');
exit();
} else {
$edit->ss->assign("process", $process);
if ($_POST['process']) {
$edit->ss->assign("year", $_POST['year']);
$edit->ss->assign("month", $_POST['month']);
} else {
$edit->ss->assign("year", date("Y"));
$edit->ss->assign("month", date("m"));
}
$edit->module = 'EcmInvoiceOuts';
$edit->ss-> display('modules/EcmInvoiceOuts/tpls/Report_INTRASTAT.tpl');
}
function sum($carry, $item) {
$carry += $item['total'];
return $carry;
}
function getData($db, $where) {
$data = [];
echo "SELECT i.document_no, i.parent_id, i.parent_nip as nip,
REPLACE(SUBSTRING(p.pkwiu, 3),' ','') as pkwiu, ROUND(SUM(ii.quantity * p.qty_per_unit)) as qty_intrastat,SUBSTRING(i.parent_nip, 1, 2) as country,
ROUND(SUM(p.product_brutto_weight * ii.quantity)) as weight, ROUND(SUM(ii.total_netto * i.currency_value_nbp)) as total
FROM ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts AS i ON i.id = ii.ecminvoiceout_id
INNER JOIN accounts AS a ON a.id=i.parent_id
INNER JOIN ecmproducts as p ON p.id = ii.ecmproduct_id
WHERE ".$where."
AND p.ks_group <> 3
GROUP BY i.parent_nip, p.pkwiu
ORDER BY i.register_date;";
$res = $db->query("SELECT i.document_no, i.parent_id, i.parent_nip as nip,
REPLACE(SUBSTRING(p.pkwiu, 3),' ','') as pkwiu, ROUND(SUM(ii.quantity * p.qty_per_unit)) as qty_intrastat,SUBSTRING(i.parent_nip, 1, 2) as country,
ROUND(SUM(p.product_brutto_weight * ii.quantity)) as weight, ROUND(SUM(ii.total_netto * i.currency_value_nbp)) as total
FROM ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts AS i ON i.id = ii.ecminvoiceout_id
INNER JOIN accounts AS a ON a.id=i.parent_id
INNER JOIN ecmproducts as p ON p.id = ii.ecmproduct_id
WHERE ".$where."
AND p.ks_group <> 3
GROUP BY i.parent_nip, p.pkwiu
ORDER BY i.register_date;");
print_r($res);
global $app_list_strings;
$intrastat_codes = $app_list_strings['intrastat_codes_list'];
$position = 1;
while($r = $db->fetchByAssoc ( $res )) {
$item = array();
$item['position'] = $position;
$item['pkwiu'] = $r['pkwiu'];
$item['description'] = $intrastat_codes[$r['pkwiu']];
$item['nip'] = $r['nip'];
$item['country'] = $r['country'];
$item['weight'] = $r['weight'];
$item['total'] = $r['total'];
$item['qty_intrastat'] = $r['qty_intrastat'];
array_push($data, $item);
$position++;
}
return $data;
}
function getInvoices($db, $where) {
$invoices = [];
$invoicesRes = $db->query("SELECT id, document_no FROM ecminvoiceouts as i WHERE ".$where." ORDER BY i.register_date");
while ($r = $db->fetchByAssoc($invoicesRes)) {
$item = array();
$item['id'] = $r['id'];
$item['document_no'] = $r['document_no'];
array_push($invoices, $item);
}
return $invoices;
}
function getBadProducts($db, $where) {
$badProducts = [];
$productsRes = $db->query("SELECT p.id as id, p.code as code, p.name as name, p.pkwiu as pkwiu, p.product_brutto_weight as weight
FROM ecminvoiceoutitems as ii
INNER JOIN ecmproducts as p ON p.id = ii.ecmproduct_id
INNER JOIN ecminvoiceouts as i ON i.id = ii.ecminvoiceout_id
WHERE ".$where."
AND (p.ks_group = 1 OR p.ks_group = 2)
AND (p.pkwiu IS NULL OR p.pkwiu = '' OR p.product_brutto_weight IS NULL OR p.product_brutto_weight = '')
GROUP BY p.code ORDER BY p.code");
while ($r = $db->fetchByAssoc($productsRes)) {
$item = array();
$item['id'] = $r['id'];
$item['code'] = $r['code'];
$item['name'] = $r['name'];
$item['pkwiu'] = $r['pkwiu'];
$item['weight'] = $r['weight'];
array_push($badProducts, $item);
}
return $badProducts;
}
?>

View File

@@ -0,0 +1,139 @@
<?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/EcmInvoiceOuts/EcmInvoiceOut.php");
require_once('include/formbase.php');
$focus = new EcmInvoiceOut();
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;
}
}
$focus->position_list = $json->decode(htmlspecialchars_decode($_POST['position_list']));
// die(var_dump( $focus->position_list));
$focus->save($check_notify);
$return_id = $focus->id;
echo $return_id;
handleRedirect($return_id,'EcmInvoiceOuts');
?>

View File

@@ -0,0 +1,27 @@
<?php
ini_set ( "soap.wsdl_cache_enabled", "0" );
require_once ("nusoap/nusoap.php");
ini_set('display_errors',1);
$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'] != '') {
$this->session_id = $login_result ['id'];
}
?>

View File

@@ -0,0 +1,89 @@
<?php
class autoCreateInvoiceFromWZ {
private $wz_id;
private $account_id;
private $db;
private $inv;
public function autoCreateInvoiceFromWZ($wz_id) {
$this->wz_id = $wz_id;
$this->db = $GLOBALS ['db'];
$this->account_id = $this->db->fetchByAssoc ( $this->db->query ( "SELECT parent_id FROM ecmstockdocouts WHERE id='$this->wz_id'" ) )['parent_id'];
$inv = new EcmInvoiceOut ();
}
public function fillInvoice() {
$wz = new EcmStockDocOut ();
$wz->retrieve ( $this->wz_id );
$wz_id = $this->wz_id;
$so_id = $wz->ecmsale_id;
$s = new EcmSale ();
$s->retrieve ( $so_id );
$focus = $this->inv;
$focus->currency_id = $s->currency_id;
$wz_name = $wz->document_no;
// load from zs
$focus->parent_id = $s->parent_id;
$focus->parent_name = $s->parent_name;
$focus->order_no = $s->parent_document_no;
$focus->supplier_code = $s->parent_supplier_code;
// dates
$focus->stock_id = $wz->stock_id;
$focus->stock_name = $wz->stock_name;
$focus->register_date = date ( "d.m.Y" );
$focus->sell_date = $wz->register_date;
$focus->validtill_date = date ( "d.m.Y" );
$focus->parent_shipping_address_name = $s->shipping_address_name;
$focus->parent_shipping_address_street = $s->shipping_address_street;
$focus->parent_shipping_address_postalcode = $s->shipping_address_postalcode;
$focus->parent_shipping_address_city = $s->shipping_address_city;
$focus->parent_shipping_address_country = $s->shipping_address_country;
$focus->parent_shipping_address_nip = $s->shipping_nip;
$focus->parent_shipping_address_iln = $s->shipping_iln;
// saturn??
$tmp_a = new Account ();
$tmp_a->retrieve ( $focus->parent_id );
if ($tmp_a->parent_id == '1249') {
$a = new Account ();
$a->retrieve ( '1249' );
$focus->parent_payer_address_name = $a->name;
$focus->parent_payer_address_street = $a->shipping_address_street;
$focus->parent_payer_address_postalcode = $a->shipping_address_postalcode;
$focus->parent_payer_address_city = $a->shipping_address_city;
$focus->parent_payer_address_country = $a->shipping_address_country;
$focus->parent_payer_address_nip = $a->to_vatid;
$focus->parent_payer_address_iln = $a->iln;
}
$pc = new EcmPaymentCondition ();
$pc->retrieve ( $s->ecmpaymentcondition_id );
$focus->ecmpaymentcondition_id = $pc->id;
$focus->ecmpaymentcondition_name = $pc->name;
if ($tmp_a->parent_id != '1249')
$focus->payment_date = $GLOBALS ['timedate']->to_display_date ( date ( "Y-m-d", mktime () + 3600 * 24 * $pc->days ) );
else {
$ss = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "SELECT delivery_date FROM ecmsales WHERE id='" . $r ['ecmsale_id'] . "'" ) );
$d = date ( 'Y-m-t', strtotime ( $ss ['delivery_date'] ) );
$focus->payment_date = $GLOBALS ['timedate']->to_display_date ( date ( "Y-m-d", mktime () + 3600 * 24 * 60 ) );
}
//position list && calculate totals
$pl = $wz->getPositionList(true);
$positions = array();
foreach ($pl as $p) {
$tmp = $p;
$tmp['price_netto'] = $p['price_start'];
$tmp['total_netto'] = round($p['quantity'] * $p['price_start'],2);
$tmp['total_vat'] = round(($tmp['total_netto']*$p['ecmvat_value'])/100,2);
$tmp['total_brutto'] = round($tmp['total_netto']+$tmp['total_vat'],2);
$tmp['price_brutto'] = round($tmp['total_brutto'] / $tmp['quantity'],2);
$positions[] = $tmp;
}
echo '<pre>';
var_dump($positions);
echo '</pre>';
//$focus->position_list = $wz->getPositionList(true);
//$this->inv = $focus;
}
}
?>

View File

@@ -0,0 +1,16 @@
<?php
$db = $GLOBALS['db'];
$res = $db->query("SELECT id FROM ecminvoiceouts WHERE document_no = 'FVKOR 1387/14'");
while ($row = $db->fetchByAssoc($res)) {
$i = new EcmInvoiceOut();
$i->retrieve($row['id']);
$i->CalculatePurchasePrices();
unset($i);
}
echo 'koniec';
?>

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 ecminvoiceouts as q on q.currency_id=c.id where q.id='".$_REQUEST['record']."'"));
$symbol=$rr['s'];
$db = $GLOBALS['db'];
$focus = new EcmInvoiceOut();
$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 ecminvoiceoutitems WHERE ecminvoiceout_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'], "EcmInvoiceOuts");
}
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,96 @@
<?php
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '')
die ( 'Brak rekordu' );
else
$record = $_REQUEST ['record'];
include_once ("modules/EcmInvoiceOuts/PDFTemplate/helper.php");
$focus = new EcmInvoiceOut ();
$focus->retrieve ( $record );
$user = new User ();
$user->retrieve ( $focus->assigned_user_id );
$labels = return_module_language($focus->ecmlanguage, 'EcmInvoiceOuts');
include_once ("include/MPDF57/mpdf.php");
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 30, 45, 5, 5 );
$mpdf->mirrorMargins = 1;
$db = $GLOBALS ['db'];
// document pdf
// document already exist?
$recipient_code=0;
foreach ($focus->getPositionList ( true ) as $k=>$v){
if($v['recipient_code']!=''){
$recipient_code=1;
}
}
$recipient_code;
$res = $db->query ( "SELECT footer, content, header FROM ecminvoiceout_pdf WHERE id='$record'" );
// get prepaid invoices
/*
$result = $GLOBALS ['db']->query ( "select SUM(inv_value) as total, ecmvat_name FROM ecmprepaymentinvoices WHERE ecmsale_id
='".$focus->so_id."' GROUP BY ecmvat_name" );
$prepaids = array();
while ( $row = $GLOBALS['db']->fetchByAssoc ( $result ) ) {
$prepaids[$row['ecmvat_name']] = $row['total'];
}
*/
if ($res->num_rows == 0) {
// create and save document
$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
foreach ($positions as &$v){
if (strlen($v['product_ean']) > 0) {
$v['product_code'] = $v['product_code'].', EAN '.$v['product_ean'];
}
if (!empty($focus->wz_id)) {
$wzItem = $db->fetchByAssoc($db->query("SELECT part_no FROM ecmstockdocoutitems WHERE id='".$v['product_parent_doc_item_id']."'"));
if (!empty($wzItem['part_no'])) {
if ($focus->pdf_type=='K') {
$v['product_code'] = $v['product_code'].'<br>Numer partii '.$wzItem['part_no'];
} else {
$v['product_code'] = $v['product_code'].'<br>Part no. '.$wzItem['part_no'];
}
}
}
}
$header = '';
$footer = '';
$content = '';
if($focus->pdf_type=='K'){
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/header.php");
if ($focus->type == 'normal')
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k.php");
if ($focus->type == 'correct')
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/content_k_correct.php");
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-pl_pl.php");
} else {
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/header_en.php");
if ($focus->type == 'normal')
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en.php");
if ($focus->type == 'correct')
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/content_en_correct.php");
include_once ("modules/EcmInvoiceOuts/PDFTemplate/tpl/footer-en_us.php");
}
global $current_user,$app_list_strings;
$db->query ( "INSERT INTO ecminvoiceout_pdf VALUES ('$record','$current_user->id', NOW(),'" . urlencode ( $footer ) . "', '" . urlencode( $content ) . "', '" . urlencode( $header ) . "')" );
} else {
$row = $db->fetchByAssoc ( $res );
$footer = urldecode ( $row ['footer'] );
$header = urldecode ( $row ['header'] );
$content = urldecode ( $row ['content'] );
}
$p->SetHTMLHeader ( $header );
$p->SetHTMLFooter($footer);
$p->WriteHTML ( $content );
//echo $content;
//return;
// draw PDF
$filename = str_replace(" ","_", str_replace("/", "_", $focus->document_no));
$p->Output ($filename.'.pdf', 'I');

View File

@@ -0,0 +1,205 @@
<?php
error_reporting(E_ALL);
set_time_limit(999999);
include_once("modules/EcmInvoiceOuts/EcmInvoiceOut.php");
include_once("modules/EcmDocumentTemplates/EcmDocumentTemplate.php");
$q=new EcmInvoiceOut();
$q->retrieve($_REQUEST['record']);
require_once('modules/EcmTexts/EcmText.php');
if(isset($q->ecmlanguage) && $q->ecmlanguage != '') {
$data = EcmText::LoadText(null,null,"EcmInvoiceOuts",$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 ecminvoiceoutitems where ecminvoiceout_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,17 @@
<?
include_once("modules/EcmInvoiceOuts/maksymaXML.php");
$mXML = new maksymaXML($_GET['date']);
$mXML->getInvoices();
$mXML->getCorrectInfoices();
$mXML->getXML();
header('Content-type: application/xml');
die();
header('Content-type: application/xml');
header('Content-Disposition: attachment; filename="decree.xml"');
$file="cache/upload/decree".str_replace(" ","_",str_replace(".","_",microtime())).".xml";
fopen($file);
file_put_contents($file,createDecree($exp[0],$exp[1]));
chmod($file,0777);
header("Location: ".$file);
?>

View File

@@ -0,0 +1,16 @@
<?php
if (!$_REQUEST['record'])
die('Brak rekordu');
$invoice = new EcmInvoiceOut();
$invoice->retrieve($_REQUEST['record']);
if ($invoice->parent_id == '134') {
require_once('modules/EcmInvoiceOuts/invoiceEdiXML.php');
$xml = new invoiceEdiXML($_REQUEST['record']);
$xml->getXML();
echo 'Plik został wygenerowany sprawdź poprawność wysyłki.';
} else {
echo "Odbiorca nie wspierany.";
}
?>

View File

@@ -0,0 +1,136 @@
<?php
$db = $GLOBALS['db'];
$invoices = $db -> query("SELECT * FROM ecminvoiceoutolds WHERE id ='66d9450c-0d62-6f19-9aa2-52721d0a433e' ORDER BY date_entered DESC");
while ($inv = $db->fetchByAssoc($invoices)) {
echo $inv['document_no'].'<br>';
//add invoice
$q = "
INSERT INTO ecminvoiceouts (
id,
date_entered,
date_modified,
modified_user_id,
assigned_user_id,
created_by,
deleted,
number,
document_no,
parent_name,
parent_id,
type,
register_date,
total_netto,
total_brutto,
canceled,
currency_id,
currency_value_nbp
) VALUES (
'".$inv['id']."',
'".$inv['date_entered']."',
'".$inv['date_modified']."',
'".$inv['modified_user_id']."',
'".$inv['assigned_user_id']."',
'".$inv['created_by']."',
'".$inv['deleted']."',
'".$inv['number']."',
'".$inv['document_no']."',
'".$inv['parent_name']."',
'".$inv['parent_id']."',
'".$inv['type']."',
'".$inv['register_date']."',
'".$inv['subtotal']."',
'".$inv['total']."',
'".$inv['canceled']."',
'".$inv['currency_id']."',
'".$inv['currency_value_nbp']."'
);
";
//items
$db->query($q);
$items = $db->query("SELECT * FROM ecminvoiceoutolditems WHERE ecminvoiceoutold_id = '".$inv['id']."'");
while ($i = $db->fetchByAssoc($items)) {
$qi = "
INSERT INTO ecminvoiceoutitems (
id,
date_entered,
date_modified,
modified_user_id,
assigned_user_id,
created_by,
ecminvoiceout_id,
ecmproduct_id,
position,
code,
name,
quantity,
price_start,
price_netto,
price_brutto,
discount,
total_netto,
total_brutto,
dd_unit_id,
dd_unit_name,
ecmvat_id,
ecmvat_name,
ecmvat_value,
ecmproductcategory_id,
recipient_code,
ecminvoiceoutitem_id,
old_ecminvoiceoutitem_id,
old_total_netto,
old_quantity,
old_total_brutto,
price_purchase,
total_netto_corrected,
quantity_corrected,
total_brutto_corrected
) VALUES (
'".$i['id']."',
'".$i['date_entered']."',
'".$i['date_modified']."',
'".$i['modified_user_id']."',
'".$i['assigned_user_id']."',
'".$i['created_by']."',
'".$i['ecminvoiceoutold_id']."',
'".$i['ecmproduct_id']."',
'".$i['position']."',
'".$i['code']."',
'".$i['name']."',
'".$i['quantity']."',
'".$i['startprice']."',
'".$i['subprice']."',
'".$i['price']."',
'".$i['discount']."',
'".$i['subtotal']."',
'".$i['total']."',
'".$i['dd_unit_id']."',
'".$i['dd_unit_name']."',
'".$i['ecmvat_id']."',
'".$i['ecmvat_name']."',
'".$i['ecmvat_value']."',
'".$i['ecmproductcategory_id']."',
'".$i['recipient_code']."',
'".$i['ecminvoiceoutolditem_id']."',
'".$i['old_ecminvoiceoutolditem_id']."',
'".$i['old_subtotal']."',
'".$i['old_quantity']."',
'".$i['old_total']."',
'".$i['purchase_price']."',
'".$i['subtotal_corrected']."',
'".$i['quantity_corrected']."',
'".$i['total_corrected']."'
);
";
//echo $qi.'<br><br>';
$db -> query($qi);
}
}
?>

View File

@@ -0,0 +1 @@
Wybierz miesiąc do dekretu <input type="date" value="<? echo date("Y-m");?>" name="date_decree" id="date_decree" /><input class="button" type="button" value="Utwórz dekret" onclick="window.open('index.php?module=EcmInvoiceOuts&to_pdf=1&action=downloadDecree&date='+document.getElementById('date_decree').value,'_blank');" target="_blank" />

View File

@@ -0,0 +1,510 @@
<?php
class invoiceEdiXML
{
private $xml;
private $id;
private $i;
private $ediInvoicesPath = '/var/edi/e5/invoices/';
function invoiceEdiXML ($id)
{
$this->id = $id;
$this->i = new EcmInvoiceOut();
$this->i->retrieve($this->id);
}
public function getXML () {
$i = $this->i;
if ($i->type == 'normal')
$this->xml = $this->createInvoiceXML();
elseif ($i->type == 'correct')
$this->xml = $this->createCorrectInvoiceXML();
$this->xml->flush();
}
private function createInvoiceXML () {
global $timedate;
$db = $GLOBALS['db'];
$i = $this->i;
// get data
// get WZ && Sale info
$wz = $db->fetchByAssoc(
$db->query(
"SELECT shipping_iln,parent_id, document_no, register_date, ecmsale_id FROM ecmstockdocouts WHERE id ='$i->wz_id'"));
$sale = $db->fetchByAssoc(
$db->query(
"SELECT document_no, register_date, parent_document_no FROM ecmsales WHERE id = '" .
$wz['ecmsale_id'] . "'"));
// get ILNs
$shipping_iln = $db->fetchByAssoc($db->query("SELECT iln FROM "));
$xml = new XMLWriter();
$name = str_replace('/', '_', $i->document_no);
$name = str_replace(' ', '', $name);
$name = str_replace('FV', '', $name);
$xml->openURI($this->ediInvoicesPath . $name . '.xml');
// $this->p->openMemory();
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('Document-Invoice');
$xml->startElement('Invoice-Header');
$xml->writeElement('InvoiceNumber', $i->document_no);
$xml->writeElement('InvoiceDate',
$timedate->to_db_date($i->register_date));
$xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
$c = new Currency();
$c->retrieve($i->currency_id);
$xml->writeElement('InvoiceCurrency', $c->iso4217);
unset($c);
$xml->writeElement('InvoicePaymentDueDate',
$timedate->to_db_date($i->payment_date));
$pc = new EcmPaymentCondition();
$pc->retrieve($i->ecmpaymentcondition_id);
$xml->writeElement('InvoicePaymentTerms', $pc->days);
unset($pc);
$xml->writeElement('InvoicePostDate',
$timedate->to_db_date($i->register_date));
$xml->writeElement('DocumentFunctionCode', 'O');
$xml->startElement('Order');
$xml->writeElement('BuyerOrderNumber', $sale['parent_document_no']);
$xml->writeElement('BuyerOrderDate', $sale['register_date']);
$xml->endElement(); // </Line-Order>
$xml->startElement('Delivery');
$xml->writeElement('DeliveryLocationNumber', $wz['shipping_iln']);
$xml->writeElement('DespatchNumber', $wz['document_no']);
$xml->writeElement('DeliveryDate', $wz['register_date']);
$xml->endElement(); // </Line-Delivery>
$xml->endElement(); // </Invoice-Header>
$xml->startElement('Invoice-Parties');
$xml->startElement('Buyer');
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', $i->parent_name);
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
$xml->endElement(); // </Buyer>
$xml->startElement('Invoicee');
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', $i->parent_name);
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
$xml->endElement(); // </Invoicee>
$xml->startElement('Payer');
if ($i->parent_payer_address_name && $i->parent_payer_address_name != "") {
$iln = $db->fetchByAssoc(
$db->query(
"SELECT iln, to_vatid FROM accounts WHERE name = '" .
$i->parent_payer_address_name . "'"));
$xml->writeElement('ILN', $iln['iln']);
$xml->writeElement('TaxID', $iln['to_vatid']);
$xml->writeElement('Name', 'Carrefour Polska Sp z o.o.');
$xml->writeElement('StreetAndNumber',
$i->parent_payer_address_street);
$xml->writeElement('CityName', $i->parent_payer_address_city);
$xml->writeElement('PostalCode',
$i->parent_payer_address_postalcode);
$xml->writeElement('Country', 'PL');
} else {
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', 'Carrefour Polska Sp z o.o.');
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
}
$xml->endElement(); // </Payer>
$e5_info = array(
'Seller',
'Payee',
'SellerHeadquarters'
);
foreach ($e5_info as $val) {
$xml->startElement($val);
$xml->writeElement('ILN', '5909000035836');
if ($val != 'SellerHeadquarters')
$xml->writeElement('TaxID', '5252173990');
$xml->writeElement('Name', 'e5 Polska Sp. z o.o.');
$xml->writeElement('StreetAndNumber', 'Wąwozowa 11');
$xml->writeElement('CityName', 'Warszawa');
$xml->writeElement('PostalCode', '02-796');
$xml->writeElement('Country', 'PL');
if ($val == 'Seller')
$xml->writeElement('CodeByBuyer', '23862');
$xml->endElement();
}
$xml->endElement(); // </Invoice-Parties>
$xml->startElement('Invoice-Lines');
$pl = $i->getPositionList(true);
foreach ($pl as $p) {
$xml->startElement('Line');
$xml->startElement('Line-Item');
$xml->writeElement('LineNumber', $p['position'] + 1);
$xml->writeElement('BuyerItemCode', $p['recipient_code']);
$xml->writeElement('EAN', $p['product_ean']);
$xml->writeElement('SupplierItemCode', $p['product_code']);
// prepare name
if (strlen($p['name']) > 70){
mb_internal_encoding("UTF-8");
$p['name'] = mb_substr($p['name'], 0, 67, "utf-8") . '...';
}
$xml->writeElement('ItemDescription', $p['name']);
$xml->writeElement('ItemType', 'CU');
$xml->writeElement('InvoiceQuantity', $p['quantity']);
$xml->writeElement('UnitOfMeasure', 'PCE');
$xml->writeElement('InvoiceUnitPacksize', '1');
$xml->writeElement('PackItemUnitOfMeasure', 'PCE');
$xml->writeElement('InvoiceUnitNetPrice', $p['price_netto']);
$xml->writeElement('TaxRate', $p['ecmvat_value']);
$xml->writeElement('TaxCategoryCode', 'S');
$xml->writeElement('TaxAmount', $p['total_vat']);
$xml->writeElement('NetAmount', $p['total_netto']);
$xml->endElement(); // </Line>
$xml->endElement(); // </Line-Item>
}
$xml->endElement(); // </Invoice-Lines>
$xml->startElement('Invoice-Summary');
$xml->writeElement('TotalLines', sizeof($pl));
$xml->writeElement('TotalNetAmount', $i->total_netto);
$xml->writeElement('TotalTaxableBasis', $i->total_netto);
$xml->writeElement('TotalTaxAmount', $i->total_vat);
$xml->writeElement('TotalGrossAmount', $i->total_brutto);
$xml->startElement('Tax-Summary');
$vats = explode(',', $i->vats_summary);
array_pop($vats);
foreach ($vats as $v) {
$vat = explode(':',$v);
$xml->startElement('Tax-Summary-Line');
$xml->writeElement('TaxRate', explode('%', $vat[0])[0]);
$xml->writeElement('TaxCategoryCode', 'S');
$xml->writeElement('TaxAmount', $vat[2]);
$xml->writeElement('TaxableBasis', $vat[1]);
$xml->writeElement('TaxableAmount', $vat[1]);
$xml->writeElement('GrossAmount', $vat[3]);
$xml->endElement(); // </Tax-Summary-Line>
}
$xml->endElement(); // </Tax-Summary>
$xml->endElement(); // </Invoice-Summary>
$xml->endElement(); // </Document-Invoice>
return $xml;
}
private function createCorrectInvoiceXML () {
global $timedate;
$db = $GLOBALS['db'];
$i = $this->i;
$oldInvoice = $db->fetchByAssoc($db->query("
SELECT total_netto, total_brutto, total_vat, vats_summary, document_no, register_date
FROM ecminvoiceouts WHERE id='".$i->ecminvoiceout_id."'"));
$xml = new XMLWriter();
$name = str_replace('/', '_', $i->document_no);
$name = str_replace(' ', '', $name);
$name = str_replace('FV', '', $name);
$xml->openURI($this->ediInvoicesPath . $name . '.xml');
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('Document-Invoice');
$xml->startElement('Invoice-Header');
// FIX $xml->writeElement('InvoiceNumber', $i->document_no);
$xml->writeElement('InvoiceNumber', 'FVKOR 04/TEST/23');
// FIX $xml->writeElement('InvoiceDate',
// $timedate->to_db_date($i->register_date));
$xml->writeElement('InvoiceDate', '2023-08-01');
// FIX $xml->writeElement('SalesDate', $timedate->to_db_date($i->sell_date));
$xml->writeElement('SalesDate', '2023-08-01');
$c = new Currency();
$c->retrieve($i->currency_id);
$xml->writeElement('InvoiceCurrency', $c->iso4217);
unset($c);
$xml->writeElement('InvoicePaymentDueDate',
$timedate->to_db_date($i->payment_date));
$pc = new EcmPaymentCondition();
$pc->retrieve($i->ecmpaymentcondition_id);
$xml->writeElement('InvoicePaymentTerms', $pc->days);
unset($pc);
$xml->writeElement('InvoicePostDate',
$timedate->to_db_date($i->register_date));
$xml->writeElement('DocumentFunctionCode', 'C');
$xml->writeElement('CorrectionReason', 'zgł. rekl.030/19/P320');
$xml->startElement('Order');
$xml->writeElement('BuyerOrderNumber', end(explode(' ', $i->order_no)));
// FIX $xml->writeElement('BuyerOrderDate', $timedate->to_db_date($i->register_date));
$xml->writeElement('BuyerOrderDate', '2023-08-01');
$xml->endElement(); // </Line-Order>
$xml->startElement('Reference');
$xml->writeElement('InvoiceReferenceNumber', $oldInvoice['document_no']);
$xml->writeElement('InvoiceReferenceDate', $timedate->to_db_date($oldInvoice['register_date']));
$xml->endElement(); // </Reference>
$xml->startElement('Delivery');
$xml->writeElement('DeliveryLocationNumber', $i->parent_shipping_address_iln);
$xml->writeElement('DespatchNumber', $i->document_no);
$xml->writeElement('DeliveryDate', $timedate->to_db_date($i->register_date));
$xml->endElement(); // </Line-Delivery>
$xml->endElement(); // </Invoice-Header>
$xml->startElement('Invoice-Parties');
$xml->startElement('Buyer');
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', $i->parent_name);
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
$xml->endElement(); // </Buyer>
$xml->startElement('Invoicee');
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', $i->parent_name);
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
$xml->endElement(); // </Invoicee>
$xml->startElement('Payer');
if ($i->parent_payer_address_name && $i->parent_payer_address_name != "") {
$iln = $db->fetchByAssoc(
$db->query(
"SELECT iln, to_vatid FROM accounts WHERE name = '" .
$i->parent_payer_address_name . "'"));
$xml->writeElement('ILN', $iln['iln']);
$xml->writeElement('TaxID', $iln['to_vatid']);
$xml->writeElement('Name', 'Carrefour Polska Sp z o.o.');
$xml->writeElement('StreetAndNumber',
$i->parent_payer_address_street);
$xml->writeElement('CityName', $i->parent_payer_address_city);
$xml->writeElement('PostalCode',
$i->parent_payer_address_postalcode);
$xml->writeElement('Country', 'PL');
} else {
$a = new Account();
$a->retrieve($i->parent_id);
if (! $i->parent_iln || $i->parent_iln == '')
$i->parent_iln = $a->iln;
unset($a);
$xml->writeElement('ILN', $i->parent_iln);
$xml->writeElement('TaxID', $i->parent_nip);
$xml->writeElement('Name', 'Carrefour Polska Sp z o.o.');
$xml->writeElement('StreetAndNumber', $i->parent_address_street);
$xml->writeElement('CityName', $i->parent_address_city);
$xml->writeElement('PostalCode', $i->parent_address_postalcode);
$xml->writeElement('Country', 'PL');
}
$xml->endElement(); // </Payer>
$e5_info = array(
'Seller',
'Payee',
'SellerHeadquarters'
);
foreach ($e5_info as $val) {
$xml->startElement($val);
// FIX $xml->writeElement('ILN', '5909000035836');
$xml->writeElement('ILN', '5909000896239');
if ($val != 'SellerHeadquarters')
// FIX $xml->writeElement('TaxID', '5252173990');
$xml->writeElement('TaxID', '8792676609');
// FIX $xml->writeElement('Name', 'e5 Polska Sp. z o.o.');
$xml->writeElement('Name', 'Twinpol Sp. z o.o.');
// FIX $xml->writeElement('StreetAndNumber', 'Wąwozowa 11');
$xml->writeElement('StreetAndNumber', 'Al. Lipowa 48');
// FIX $xml->writeElement('CityName', 'Warszawa');
$xml->writeElement('CityName', 'Obrowo');
// FIX $xml->writeElement('PostalCode', '02-796');
$xml->writeElement('PostalCode', '87-126');
$xml->writeElement('Country', 'PL');
if ($val == 'Seller')
// FIX $xml->writeElement('CodeByBuyer', '23862');
$xml->writeElement('CodeByBuyer', '017776');
$xml->endElement();
}
$xml->endElement(); // </Invoice-Parties>
$xml->startElement('Invoice-Lines');
$products = $db->query("
SELECT i.code, i.position, i.recipient_code, i.ean, i.name,
i.quantity, i.price_netto, i.total_netto, i.total_vat, i.total_brutto, i.ecmvat_value,
c.quantity as c_quantity, c.price_netto as c_price_netto,
c.total_netto as c_total_netto, c.total_vat as c_total_vat,
c.total_brutto as c_total_brutto, c.ecmvat_value as c_ecmvat_value
FROM ecminvoiceoutitems as i
LEFT JOIN ecminvoiceoutitems as c ON i.id = c.ecminvoiceoutitem_id
WHERE i.ecminvoiceout_id = '".$i->ecminvoiceout_id."'
");
$sum = Array();
$sum['total_netto'] = 0;
$sum['total_vat'] = 0;
$sum['total_brutto'] = 0;
$sum['c_total_netto'] = 0;
$sum['c_total_vat'] = 0;
$sum['c_total_brutto'] = 0;
$sum['vats'] = array();
while ($p = $db->fetchByAssoc($products)) {
$xml->startElement('Line');
$xml->startElement('Line-Item');
$xml->writeElement('LineNumber', $p['position'] + 1);
$xml->writeElement('BuyerItemCode', $p['recipient_code']);
$xml->writeElement('EAN', $p['ean']);
$xml->writeElement('SupplierItemCode', $p['code']);
// prepare name
if (strlen($p['name']) > 70){
mb_internal_encoding("UTF-8");
$p['name'] = mb_substr($p['name'], 0, 67, "utf-8") . '...';
}
$xml->writeElement('ItemDescription', $p['name']);
$xml->writeElement('ItemType', 'CU');
$xml->writeElement('UnitOfMeasure', 'PCE');
$xml->writeElement('InvoiceUnitPacksize', '1');
$xml->writeElement('PackItemUnitOfMeasure', 'PCE');
if ($p['c_quantity'] == null) {
$p['c_quantity'] = $p['quantity'];
$p['c_price_netto'] = $p['price_netto'];
$p['c_total_netto'] = $p['total_netto'];
$p['c_total_vat'] = $p['total_vat'];
$p['c_total_brutto'] = $p['total_brutto'];
$p['c_ecmvat_value'] = $p['ecmvat_value'];
}
$xml->writeElement('InvoiceQuantity', $p['c_quantity']);
$xml->writeElement('InvoiceUnitNetPrice', $p['c_price_netto']);
$xml->writeElement('TaxRate', $p['c_ecmvat_value']);
$xml->writeElement('TaxCategoryCode', 'S');
$xml->writeElement('TaxAmount', $p['c_total_vat']);
$xml->writeElement('NetAmount', $p['c_total_netto']);
$xml->writeElement('PreviousInvoiceQuantity', $p['quantity']);
$xml->writeElement('PreviousInvoiceUnitNetPrice', $p['price_netto']);
// $xml->writeElement('PreviousTaxRate', $p['total_vat']);
$xml->writeElement('PreviousTaxCategoryCode', 'S');
$xml->writeElement('PreviousTaxRate', $p['ecmvat_value']);
$xml->writeElement('PreviousTaxAmount', $p['total_vat']);
$xml->writeElement('PreviousNetAmount', $p['total_netto']);
$xml->writeElement('CorrectionInvoiceQuantity', round($p['c_quantity'] - $p['quantity'],2));
$xml->writeElement('CorrectionInvoiceUnitNetPrice', round($p['c_price_netto'] - $p['price_netto'],2));
$xml->writeElement('CorrectionTaxAmount', round($p['c_total_vat'] - $p['total_vat'],2));
$xml->writeElement('CorrectionNetAmount', round($p['c_total_netto'] - $p['total_netto'],2));
$xml->endElement(); // </Line>
$xml->endElement(); // </Line-Item>
$sum['total_netto'] += $p['total_netto'];
$sum['c_total_netto'] += $p['c_total_netto'];
$sum['total_vat'] += $p['total_vat'];
$sum['c_total_vat'] += $p['c_total_vat'];
$sum['total_brutto'] += $p['total_brutto'];
$sum['c_total_brutto'] += $p['c_total_brutto'];
if ($sum['vats'][$p['ecmvat_value']] == null) {
$sum['vats'][$p['ecmvat_value']]['netto'] = $p['total_netto'];
$sum['vats'][$p['ecmvat_value']]['vat'] = $p['total_vat'];
$sum['vats'][$p['ecmvat_value']]['brutto'] = $p['total_brutto'];
$sum['vats'][$p['ecmvat_value']]['c_netto'] = 0;
$sum['vats'][$p['ecmvat_value']]['c_netto'] = 0;
$sum['vats'][$p['ecmvat_value']]['c_netto'] = 0;
} else {
$sum['vats'][$p['ecmvat_value']]['netto'] += $p['total_netto'];
$sum['vats'][$p['ecmvat_value']]['vat'] += $p['total_vat'];
$sum['vats'][$p['ecmvat_value']]['brutto'] += $p['total_brutto'];
}
if ($sum['vats'][$p['c_ecmvat_value']] == null) {
$sum['vats'][$p['c_ecmvat_value']]['c_netto'] = $p['c_total_netto'];
$sum['vats'][$p['c_ecmvat_value']]['c_vat'] = $p['c_total_vat'];
$sum['vats'][$p['c_ecmvat_value']]['c_brutto'] = $p['c_total_brutto'];
$sum['vats'][$p['c_ecmvat_value']]['netto'] = 0;
$sum['vats'][$p['c_ecmvat_value']]['netto'] = 0;
$sum['vats'][$p['c_ecmvat_value']]['netto'] = 0;
} else {
$sum['vats'][$p['c_ecmvat_value']]['c_netto'] += $p['c_total_netto'];
$sum['vats'][$p['c_ecmvat_value']]['c_vat'] += $p['c_total_vat'];
$sum['vats'][$p['c_ecmvat_value']]['c_brutto'] += $p['c_total_brutto'];
}
}
$xml->endElement(); // </Invoice-Lines>
$xml->startElement('Invoice-Summary');
$xml->writeElement('TotalLines', $products->num_rows);
$xml->writeElement('TotalNetAmount', $sum['c_total_netto']);
$xml->writeElement('TotalTaxableBasis', $sum['c_total_netto']);
$xml->writeElement('TotalTaxAmount', $sum['c_total_vat']);
$xml->writeElement('TotalGrossAmount', $sum['c_total_brutto']);
$xml->writeElement('PreviousTotalNetAmount', $sum['total_netto']);
$xml->writeElement('PreviousTotalTaxableBasis', $sum['total_netto']);
$xml->writeElement('PreviousTotalTaxAmount', $sum['total_vat']);
$xml->writeElement('PreviousTotalGrossAmount', $sum['total_brutto']);
$xml->writeElement('CorrectionTotalNetAmount', round($sum['c_total_netto'] - $sum['total_netto'],2));
$xml->writeElement('CorrectionTotalTaxableBasis', round($sum['c_total_netto'] - $sum['total_netto'],2));
$xml->writeElement('CorrectionTotalTaxAmount', round($sum['c_total_vat'] - $sum['total_vat'],2));
$xml->writeElement('CorrectionTotalGrossAmount', round($sum['c_total_brutto'] - $sum['total_brutto'],2));
$xml->startElement('Tax-Summary');
// checking
if ($i->total_netto != round($sum['c_total_netto'] - $sum['total_netto'],2)) {
die("Błąd sumy podczas generowania pliku XML. Skontaktuj się z administratorem.");
}
foreach ($sum['vats'] as $k=>$v) {
$xml->startElement('Tax-Summary-Line');
$xml->writeElement('TaxRate', $k);
$xml->writeElement('TaxCategoryCode', 'S');
$xml->writeElement('TaxAmount', $v['c_vat']);
$xml->writeElement('TaxableAmount', $v['c_netto']);
$xml->writeElement('PreviousTaxRate', $k);
$xml->writeElement('PreviousTaxCategoryCode', 'S');
$xml->writeElement('PreviousTaxAmount', $v['vat']);
$xml->writeElement('PreviousTaxableAmount', $v['netto']);
$xml->writeElement('CorrectionTaxAmount', round($v['c_vat'] - $v['vat'],2));
$xml->writeElement('CorrectionTaxableAmount', round($v['c_netto'] - $v['netto'],2));
$xml->endElement(); // </Tax-Summary-Line>
}
$xml->endElement(); // </Tax-Summary>
$xml->endElement(); // </Invoice-Summary>
$xml->endElement(); // </Document-Invoice>
return $xml;
}
}
?>

View File

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

View File

@@ -0,0 +1,196 @@
//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(), 'Accounts');
}, 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);
});
$("#type").change(function() {
if ($("#type :selected").val() == 'normal') {
if($('#new_number').val()==1){
generateNumber();
}
} else {
generateNumberCorrect();
}
});
$("#currency_id").change(function() {
getNBPCurrencyExchange($("#currency_id :selected").val());
});
var previousVal;
var pollInterval = setInterval(function() {
var val = $('#sell_date').val();
if (val !== previousVal) {
getNBPCurrencyExchange($("#currency_id :selected").val());
}
previousVal = val;
}, 500);
$("#ecmlanguage").change(
function() {
if ($("#pdf_type :selected").val() == 'U'
|| $("#pdf_type :selected").val() == 'E') {
changeVat();
calculateTotal();
}
});
$("#pdf_type").change(
function() {
if ($("#pdf_type :selected").val() == 'U'
|| $("#pdf_type :selected").val() == 'E') {
changeVat();
calculateTotal();
}
});
$("#ecmpaymentcondition_id").on('inputchange', function() {
$(".loading_panel").css("display", "block");
setTimeout(function() {
calculatePaymentDate($("#ecmpaymentcondition_id").val());
$(".loading_panel").css("display", "none");
}, 1000);
});
$('#paid_val').change(function() {
calculateTotal();
});
$('#prepaid').change(function() {
calculateTotal();
});
// searchProductInput change
$('#searchProductsInput').keyup(function() {
searchProducts();
});
DrawHeaders();
if (($("#new_number").val() == true)
&& ($("#is_correct").val() != true)
&& ($("#is_wz").val() != true)
&& ($("#is_sale").val() != true)
&& ($("#multiDiscountCorrectInvoice").val() != true)
&& ($("#is_return").val() != true)) {
generateNumber($("#stock :selected").val());
} else if (($("#new_number").val() == true)
&& ($("#is_correct").val() == true)) {
$('#searchProducts').hide();
generateNumberCorrect();
getParentInfo($("#parent_id").val(), 'Accounts');
getItems();
} else if (($("#new_number").val() == true)
&& ($("#is_wz").val() == true)) {
generateNumber($("#stock :selected").val());
getParentInfo($("#parent_id").val(), 'Accounts');
if($("#wz_zb_id").val()!=""){
getItemsZBFromWZ();
} else {
getItemsFromWZ();
}
} else if (($("#new_number").val() == true)
&& ($("#is_sale").val() == true)) {
generateNumber($("#stock :selected").val());
getParentInfo($("#parent_id").val(), 'Accounts');
getItemsFromSale();
if ($("#ecmpaymentcondition_id").val() != '')
calculatePaymentDate($("#ecmpaymentcondition_id").val());
} else if (($("#new_number").val() == true)
&& ($("#is_return").val() == true)) {
generateNumberCorrect();
getParentInfo($("#parent_id").val(), 'Accounts');
getItemsFromReturn();
} else if (($("#new_number").val() == true)
&& ($("#multiDiscountCorrectInvoice").val() == true)) {
generateNumberCorrect();
getParentInfo($("#parent_id").val(), 'Accounts');
getItemsFromMDCI();
} else {
$('#document_no').prop("readonly",false);
getParentInfo($("#parent_id").val(), 'Accounts');
getItems();
}
$(".loading_panel").css("display", "none");
// 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) {
window.onbeforeunload = null;
if (items.length == 0) {
alert("Brak produktów");
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);
//total_vat must be != 0 if its country correct
if ($('#pdf_type').val()=='K' && items[index].ecmvat_name=='0%' && items[index].product_corrected != 'true') {
alert("Niedopuszczalna, zerowa stawka VAT na fakturze krajowej.");
$(".loading_panel").css("display", "none");
return false;
}
}
$("#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) {
console.log('check_form error');
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,127 @@
$(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
},
1: {
sorter: 'rangesort'
},
4: {
sorter: 'rangesorttotav'
},
5: {
sorter: 'rangesorttotan'
},
6: {
sorter: 'rangesorttotai'
}
}
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
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'][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' : 'quantity',
'label' : 'Ilość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {'name' : '', '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,239 @@
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'][2] = {
'name' : 'item_id',
'type' : 'hidden'
};
columns[1]['content'][3] = {
'name' : 'itemold_id',
'type' : 'hidden'
};
columns[1]['content'][4] = {
'name' : 'link',
'type' : 'text',
'readonly' : true
};
columns[1]['content'][5] = {
'name' : 'parent_doc_id',
'type' : 'hidden'
};
columns[1]['content'][6] = {
'name' : 'parent_doc_type',
'type' : 'hidden'
};
columns[1]['content'][7] = {
'name' : 'parent_doc_item_id',
'type' : 'hidden'
};
columns[1]['content'][8] = {
'name' : 'corrected',
'type' : 'hidden'
};
columns[1]['content'][9] = {
'name' : 'ean',
'type' : 'hidden',
};
// end: codes
// 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' : 'quantity',
'label' : 'Ilość',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[3]['content'][0] = {
'name' : '',
'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_',
'label' : 'Cena<br>po upuście',
'width' : 5,
'content' : new Array(),
'align' : 'right',
};
columns[7]['content'][0] = {
'name' : 'netto',
'type' : 'text',
'isNumber' : true,
'readonly' : true
};
columns[7]['content'][1] = {
'name' : 'brutto',
'type' : 'hidden'
};
// 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'
};
columns[8]['content'][3] = {
'name' : 'alter_id',
'type' : 'hidden'
};
columns[8]['content'][4] = {
'name' : 'alter_value',
'type' : 'hidden'
};
columns[8]['content'][5] = {
'name' : 'alter_name',
'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
};
columns[9]['content'][1] = {
'name' : 'brutto',
'type' : 'hidden'
};
columns[9]['content'][2] = {
'name' : 'vat',
'type' : 'hidden'
}
// 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,595 @@
<?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 ( $_POST ['stock_id'] );
break;
case 'generateNumberCorrect' :
generateNumberCorrect ();
break;
case 'searchProducts' :
searchProducts ( $_POST ['searchKey'], $_POST ['searchCategory'], $_POST ['searchStock'], $_POST ['searchSort'] );
break;
case 'getProduct' :
getProduct ( $_POST ['id'], $_POST ['pricebook'], $_POST ['account_id'], $_POST ['language'] );
break;
case 'getItems' :
getItems ( $_POST ['record'], $_POST ['type'] );
break;
case 'getItemsFromWZ' :
getItemsFromWZ ( $_POST ['record'], $_POST ['type'] );
break;
case 'getItemsFromSale' :
getItemsFromSale ( $_POST ['record'], $_POST ['type'] );
break;
case 'getItemsFromReturn' :
getItemsFromReturn ( $_POST ['sess_id'] );
break;
case 'getItemsFromMDCI' :
getItemsFromMDCI ( $_POST ['discount'], $_POST['inv'] );
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 'getAddresses' :
getAddresses ( $_POST ['account_id'] );
break;
case 'getPayers' :
getPayers ( $_POST ['account_id'] );
break;
case 'getPayer' :
getPayer ( $_POST ['account_id'] );
break;
case 'getAddress' :
getAddress ( $_POST ['account_id'] );
break;
case 'getNBPCurrencyExchange' :
getNBPCurrencyExchange ( $_POST ['c_id'], $_POST ['date'] );
break;
case 'calculatePaymentDate' :
calculatePaymentDate ( $_POST ['pid'], $_POST ['date'] );
break;
case 'getWzPositions' :
getWzPositions( $_POST ['id']);
break;
}
function getWzPositions($record) {
$lists=explode(',',$record);
$items=array();
$of = new EcmStockDocOut();
$poz=0;
$total=0;
foreach ($lists as $list){
$of->retrieve($list);
$pl = $of->getPositionList(true);
foreach ($pl as $pls){
$total=$total+$pls['quantity'];
if($items[$pls['product_id']]['quantity']!=""){
$pls['quantity']=$pls['quantity']+$items[$pls['product_id']]['quantity'];
}
$items[$pls['product_id']]=$pls;
$poz++;
}
}
$return=[];
foreach ($items as $item){
$item['position']=$poz;
$return[]=$item;
$poz++;
}
// echo $total;
unset($of);
echo json_encode($return);
return;
}
function getItemsFromMDCI($discount, $inv) {
$inv = str_replace('|', "','", $inv);
$q = "SELECT ii.* FROM ecminvoiceoutitems AS ii
INNER JOIN ecminvoiceouts AS i
on i.id = ii.ecminvoiceout_id
WHERE
i.id IN ('$inv') AND
ii.deleted='0'
ORDER BY i.date_entered DESC, ii.position";
$db = $GLOBALS['db'];
$res = $db->query($q);
global $app_list_strings;
$position_list = array();
$i = 0;
while ($position = $db->fetchByAssoc($res)) {
$pos = array ();
$pos ['product_id'] = $position ['id'];
$pos ['position'] = $i; $i++;
$pos ['product_code'] = $position ['code'];
$pos ['name'] = $position ['name'];
$pos ['quantity'] = $position ['quantity'];
$pos ['price_start'] = floatval($position['price_netto']) - (floatval($position['price_netto']* (floatval($discount)/100)));
$pos ['price_netto'] = floatval($position['price_netto']) - (floatval($position['price_netto']* (floatval($discount)/100)));
$pos ['discount'] = '0';//$discount;
$pos ['unit_id'] = $position ['dd_unit_id'];
$pos ['unit_name'] = $app_list_strings ['ecmproducts_unit_dom'][$pos['unit_id']];
$pos ['ecmvat_id'] = $position ['ecmvat_id'];
$pos ['ecmvat_name'] = $position ['ecmvat_name'];
$pos ['ecmvat_value'] = $position ['ecmvat_value'];
$pos ['recipient_code'] = $position ['recipient_code'];
$pos ['remarks'] = $position ['remarks'];
$pos ['product_itemold_id'] = $position['id'];
$pos ['product_item_id'] = $position['id'];
$pos ['old_total_netto'] = $position ['total_netto'];
$pos ['old_total_brutto'] = $position ['total_brutto'];
$pos ['old_quantity'] = $position ['quantity'];
$pos ['old_total_vat'] = $position ['total_vat'];
$pos ['ecminvoiceoutitem_id'] = $position ['id'];
$pos ['product_corrected'] = 'false';
$position_list[] = $pos;
//corrected item
$pos = array ();
$pos ['product_id'] = $position ['id'];
$pos ['position'] = $i; $i++;
$pos ['product_code'] = $position ['code'];
$pos ['name'] = $position ['name'];
$pos ['quantity'] = $position ['quantity'];
$pos ['price_start'] = $position ['price_netto'];
$pos ['price_netto'] = $position ['price_netto'];
$pos ['discount'] = '0';
$pos ['unit_id'] = $position ['dd_unit_id'];
$pos ['unit_name'] = $app_list_strings ['ecmproducts_unit_dom'][$pos['unit_id']];
$pos ['ecmvat_id'] = $position ['ecmvat_id'];
$pos ['ecmvat_name'] = $position ['ecmvat_name'];
$pos ['ecmvat_value'] = $position ['ecmvat_value'];
$pos ['recipient_code'] = $position ['recipient_code'];
$pos ['remarks'] = $position ['remarks'];
$pos ['old_ecminvoiceoutitem_id'] = $position ['id'];
$pos ['old_total_netto'] = $position ['total_netto'];
$pos ['old_total_brutto'] = $position ['total_brutto'];
$pos ['old_quantity'] = $position ['quantity'];
$pos ['old_total_vat'] = $position ['total_vat'];
$pos ['ecminvoiceoutitem_id'] = $position ['id'];
$pos ['product_corrected'] = 'true';
$position_list[] = $pos;
}
echo json_encode($position_list);
return;
}
function getItemsFromReturn($sess_id) {
$items = json_decode ( $_SESSION [$sess_id] , true);
$position_list = array ();
$i = 0;
global $app_list_strings;
foreach ( $items as $position ) {
$pos = array ();
$pos ['product_id'] = $position ['id'];
$pos ['position'] = $i; $i++;
$pos ['product_code'] = $position ['code'];
$pos ['name'] = $position ['name'];
$pos ['quantity'] = $position ['quantity'];
$pos ['price_start'] = $position ['price_netto'];
$pos ['price_netto'] = $position ['price_netto'];
$pos ['discount'] = '0';
$pos ['total_netto'] = $position ['total_netto'];
$pos ['unit_id'] = $position ['unit_id'];
$pos ['unit_name'] = $app_list_strings ['ecmproducts_unit_dom'][$pos['unit_id']];
$pos ['ecmvat_id'] = $position ['vat_id'];
$pos ['ecmvat_name'] = $position ['vat_name'];
$pos ['ecmvat_value'] = $position ['vat_value'];
$pos ['recipient_code'] = $position ['recipient_code'];
$pos ['remarks'] = $position ['remarks'];
$pos ['product_itemold_id'] = $position['old_ecminvoiceoutitem_id'];
$pos ['product_item_id'] = $position['item_id'];
$pos ['old_total_netto'] = $position ['total_netto'];
$pos ['old_total_brutto'] = $position ['total_brutto'];
$pos ['old_quantity'] = $position ['old_qty'];
$pos ['old_total_vat'] = $position ['total_vat'];
$pos ['ecminvoiceoutitem_id'] = $position ['ecminvoiceoutitem_id'];
$pos ['total_vat'] = $position ['total_vat'];
$pos ['total_brutto'] = $position ['total_brutto'];
$pos ['product_corrected'] = 'false';
$position_list[] = $pos;
//corrected item
$pos = array ();
$pos ['product_id'] = $position ['id'];
$pos ['position'] = $i; $i++;
$pos ['product_code'] = $position ['code'];
$pos ['name'] = $position ['name'];
$pos ['quantity'] = $position ['old_qty'];
$pos ['price_start'] = $position ['price_netto'];
$pos ['price_netto'] = $position ['price_netto'];
$pos ['discount'] = '0';
$pos ['total_netto'] = $position ['total_netto'];
$pos ['unit_id'] = $position ['unit_id'];
$pos ['unit_name'] = $app_list_strings ['ecmproducts_unit_dom'][$pos['unit_id']];
$pos ['ecmvat_id'] = $position ['vat_id'];
$pos ['ecmvat_name'] = $position ['vat_name'];
$pos ['ecmvat_value'] = $position ['vat_value'];
$pos ['recipient_code'] = $position ['recipient_code'];
$pos ['remarks'] = $position ['remarks'];
$pos ['old_ecminvoiceoutitem_id'] = $position ['old_ecminvoiceoutitem_id'];
$pos ['old_total_netto'] = $position ['old_total_netto'];
$pos ['old_total_brutto'] = $position ['old_total_brutto'];
$pos ['old_quantity'] = $position ['old_quantity'];
$pos ['old_total_vat'] = $position ['old_total_vat'];
$pos ['ecminvoiceoutitem_id'] = $position ['ecminvoiceoutitem_id'];
$pos ['total_vat'] = $position ['total_vat'];
$pos ['total_brutto'] = $position ['total_brutto'];
$pos ['product_corrected'] = 'true';
$position_list[] = $pos;
}
echo json_encode($position_list);
return;
}
function calculatePaymentDate($pid, $d) {
global $timedate;
$w = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "select days from ecmpaymentconditions where id='" . $pid . "'" ) );
$date = new DateTime ( $d );
$date->add ( new DateInterval ( 'P' . $w ['days'] . 'D' ) );
echo json_encode ( $date->format ( 'd.m.Y' ) );
return;
}
function getNBPCurrencyExchange($c_id, $d) {
global $timedate;
$d = explode ( '-', reset ( explode ( " ", $timedate->to_db ( $d ) ) ) );
$date = date ( "Y-m-d", @mktime ( 0, 0, 0, $d [1], $d [2], $d [0] ) + 3600 * 24 );
// what day is it?
$dn = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( "SELECT DAYNAME('$date') as dayname" ) );
if ($dn ['dayname'] == 'Sunday') // - 2 days
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date = DATE_ADD('$date', INTERVAL -2 DAY)";
elseif ($dn ['dayname'] == 'Saturday') // - 1 day
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date = DATE_ADD('$date', INTERVAL -1 DAY)";
else // any other day - just get exchange
$q = "SELECT value, nbp_table_name FROM currency_nbp_archive WHERE currency_id='$c_id' AND date='$date'";
$w = $GLOBALS ['db']->fetchByAssoc ( $GLOBALS ['db']->query ( $q ) );
$tmp = array();
if(round ( $w ['value'], 2 )!=0){
$tmp['value'] = round ( $w ['value'], 2 );
} else {
$tmp['value'] = null;
}
$tmp['name'] = $w['nbp_table_name'];
echo json_encode($tmp);
unset($tmp);
return;
}
function getAddress($account_id) {
$a = new Account ();
echo json_encode ( $a->getAddress ( $account_id ) );
unset ( $a );
return;
}
function getPayer($account_id) {
$a = new Account ();
echo json_encode ( $a->getAddress ( $account_id ) );
unset ( $a );
return;
}
function getAddresses($account_id) {
$a = new Account ();
echo json_encode ( $a->getAddresses ( $account_id ) );
unset ( $a );
return;
}
function getPayers($account_id) {
$a = new Account ();
echo json_encode ( $a->getPayers ( $account_id ) );
unset ( $a );
return;
}
function getParentInfo($id, $type) {
if (! $id || $id == '')
die ( '-1' );
if (! $type || $type == '')
die ( '-1' );
if ($type == 'Accounts')
$a = new Account ();
elseif ($type == 'Leads')
$a = new Lead ();
else
die ( - 1 );
$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 ['parent_iln'] = $a->iln;
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;
echo json_encode ( $data );
unset ( $data );
unset ( $a );
unset ( $res );
return;
}
function generateNumber($stock_id) {
$data = array ();
$data ['number'] = EcmInvoiceOut::generateNumber ( );
$data ['document_no'] = EcmInvoiceOut::formatNumber ( $data ['number'] );
echo json_encode ( $data );
unset ( $data );
return;
}
function generateNumberCorrect() {
$data = array ();
$data ['number'] = EcmInvoiceOut::generateNumberCorrect ();
$data ['document_no'] = EcmInvoiceOut::formatNumberCorrect ( $data ['number'] );
echo json_encode ( $data );
unset ( $data );
return;
}
function searchProducts($searchKey, $searchCategory, $searchStock, $searchSort) {
$db = $GLOBALS ['db'];
$q = "SELECT id, code, name FROM ecmproducts WHERE
(UPPER(code) LIKE '%$searchKey%' OR
UPPER(name) 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') {
$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 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'];
}
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']];
$p ['ecmvat_alter_id'] = $p ['ecmvat_id'];
$p ['ecmvat_alter_name'] = $p ['ecmvat_name'];
$p ['ecmvat_alter_value'] = $p ['ecmvat_value'];
$p ['ecmvat_id'] = '9b783d21-5548-6653-e1d6-49610eb3f9dd';
$p ['ecmvat_name'] = '0%';
$p ['ecmvat_value'] = '0';
unset ( $lists );
}
echo json_encode ( $p );
return;
}
function getItems($record, $type) {
$of = new EcmInvoiceOut ();
$of->retrieve ( $record );
$pl = $of->getPositionList ( true, $type );
unset ( $of );
echo json_encode ( $pl );
return;
}
function getItemsFromWZ($record, $type) {
$of = new EcmStockDocOut ();
$of->retrieve ( $record );
$pl = $of->getPositionList ( true );
unset ( $of );
echo json_encode ( $pl );
return;
}
function getItemsFromSale($record, $type) {
$of = new EcmSale ();
$of->retrieve ( $record );
$pl = $of->getPositionList ( true );
unset ( $of );
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;
}

View File

@@ -0,0 +1,53 @@
$(document).ready(function() {
//load number functions if they are not loaded yet
if (typeof window["FormatNumber"] === 'undefined') {
$.ajax({
async : false,
url : "include/ECM/EcmNumberFunctions.js",
dataType : "script"
});
}
$('#invSelectAll').click(function(event) { //on click
if(this.checked) { // check select status
$('.invcheckbox').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
calculate();
});
}else{
$('.invcheckbox').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
calculate();
});
}
});
$('#discount').on('blur', function() {
calculate();
});
});
var calculate = function() {
var discount = UnformatNumber($('#discount').val())/100;
$('#discount').val(FormatNumber(UnformatNumber($('#discount').val())));
console.log(discount);
var sum_disc = 0;
$('#invTable tr').each(function (i, row) {
if (i == 0 || i == $('#invTable tr').lenght) return;
if ($(row).find('.invcheckbox').is(':checked') == false) return;
var val = parseFloat($(row).find('.netto').html());
sum_disc += val * discount;
});
$('#total_info').html('-'+FormatNumber(sum_disc));
}
var prepareData = function() {
var inv = "";
$('.invcheckbox:checked').each(function (){
inv+=this.value+'|';
});
inv = inv.slice(0,-1);
var link = "index.php?module=EcmInvoiceOuts&action=EditView&mdci=1&account_id="+$('#account_id').val();
link +="&account_name="+$('#account_name').val()+'&invoices='+inv+'&discount='+UnformatNumber($('#discount').val());
window.location = link;
}

View File

@@ -0,0 +1,453 @@
<?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_CURRENCY_TABLE' => 'NBP currency table',
'LBL_BTN_CREATE_ZS' => 'Create ZS',
'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_PDF_CONTENT_PAYER'=>"PAYER",
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images on offers',
'LBL_SHOW_RECIPIENT_CODE' => 'Show recipient code',
// FOR SYSTEM USE
'LBL_PAYMENT_DATE_PDF'=>'Payment date:',
'LBL_MODULE_NAME' => 'Quotes',
'LBL_PDF_CORRECT_TO'=>"Correct to:",
'LBL_MODULE_TITLE' => 'Quotes: Home',
'LBL_MODULE_ID' => 'EcmInvoiceOuts',
'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_PARENT_ILN'=>'ILN',
'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_ECMQUOTE_ID' => 'Quote Id',
'LBL_ECMQUOTE_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_ECMQUOTE' => 'Create Quote',
'LNK_ECMQUOTES_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_ECMQUOTES' => 'Quotes',
'LNK_ECMQUOTES_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMQUOTES_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_QUOTE_FOR' => 'Offer for:',
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Register date:',
'LBL_PDF_CONTENT_ISSUED_BY' => 'Issued by:',
'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_REMARKS' => 'Remarks',
'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',
// pdf labels UE
'LBL_PDF_UE_DELIVERY_TITLE'=>'DOSTAWA / DELIVERY',
'LBL_PDF_UE_BUYER_TITLE'=>'NABYWCA / BUYER',
'LBL_PDF_UE_PAYER_TITLE'=>'PŁATNIK / PAYER',
'LBL_PDF_UE_NIP'=>'NIP/Vat ID:',
'LBL_PDF_UE_ILN'=>'ILN:'
)
;
?>

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' => 'EcmInvoiceOuts',
'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_ECMQUOTE_ID' => 'Quote Id',
'LBL_ECMQUOTE_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_ECMQUOTE' => 'Create Quote',
'LNK_ECMQUOTES_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_ECMQUOTES' => '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_ECMQUOTES_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMQUOTES_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,483 @@
<?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_CURRENCY_TABLE' => 'Tabela kursu NBP',
'LBL_BTN_CREATE_ZS' => 'Utwórz ZS',
'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',
'LBL_LISTSALES_CODE'=>'Kod',
'LBL_LISTSALES_QTY'=>'Ilość',
'LBL_LISTSALES_PRICE'=>'Cena',
'LBL_LISTSALES_PARENT_NAME'=>'Kontrahent',
'LBL_LISTSALES_SEARCH'=>'Szukaj',
'LBL_LISTSALES_CLEAR'=>'Wyczyść',
'LBL_LISTSALES_REGISTER_DATE'=>'Data rejestracji',
'LBL_LISTSALES_DOCUMENT_NO'=>'Nr dokumentu',
'LBL_LISTSALES_NAME_POS'=>'Nazwa',
// added 01.09.2009
'LBL_ECMLANGUAGE' => 'Język',
'LBL_PDF_CONTENT_PAYER'=>"PŁATNIK",
'LBL_PRICEBOOK' => 'Cennik',
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Kod odbiorcy',
// added 05.08.2009
'LBL_CURRENCY' => 'Waluta',
'LBL_CORRECT_TITLE'=>'Utwórz korektę',
'LBL_CORRECT'=>'Utwórz korektę',
'LBL_DETAIL_BUTTON' => 'Szczegóły',
// added 15.07.2009
'LBL_CURRENCY_VALUE_NBP'=>'Kurs NBP',
'LBL_CURRENCY_VALUE'=>'Kurs waluty',
'LBL_PARENT_SHIPPING_ADDRESS'=>'Adres wysyłki',
'LBL_PAYMENT_METHOD_PDF'=>'Metoda płatności',
'LBL_TO_PAYMENTS'=>'Płatności',
'LBL_TO_PAID'=>'Do zapłaty',
'LBL_PDF_CONTENT_INVOICE_FOR'=>'NABYWCA',
'LBL_LEFT'=>'Pozostało',
'LBL_PREPAID'=>'Przedpłata',
'LBL_PREPAID_NR'=>'Numer FK przedpłatowej',
'LBL_PAID'=>'Zapłacono',
'LBL_PARENT_ILN'=>'ILN',
'LBL_PAYMENT_METHOD_PAID'=>'Sposób zapłaty (zapłacono)',
'LBL_EDITTABLE_UNIT' => 'J.m.',
'LBL_PDF_CORRECT_TO'=>"Korekta do:",
'LBL_ECMINVOICEOUT_NAME'=>'Faktura do korygowania',
'LBL_STOCK_NAME'=>'Magazyn',
'LBL_ORDER_NO'=>'Numer zamówienia',
'LBL_SUPPLIER_CODE'=>'Kod dostawcy',
'LBL_PLACE_PDF'=>'Miejsce wystawienia:',
'LBL_PAYMENT_DATE_PDF'=>'Termin płatności',
'LBL_CURRENCY'=>'Waluta',
'LBL_PAYMENT_METHOD'=>'Sposób zapłaty',
'LBL_PDF_TYPE'=>'Typ pdf',
// added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Pokaż obrazki w PDFie',
'LBL_SHOW_RECIPIENT_CODE' => 'Pokaż kod odbiorcy',
'LBL_LISTSALES_NAME'=>'Raport: Produkty na fakturach',
'LBL_LIST_SALES_RAP'=>'Produkty na fakturach',
'LBL_SEARCH'=>'Wyszukaj',
'LBL_LISTSALES_YEAR'=>'Rok',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Faktury',
'LBL_MODULE_TITLE' => 'Faktury: Strona Główna',
'LBL_MODULE_ID' => 'EcmInvoiceOuts',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
'LBL_LIST_FORM_TITLE' => 'Lista Faktur',
'LBL_NEW_FORM_TITLE' => 'Nowa Faktura',
'LBL_DETAILS' => 'Szczególy Faktury',
'LBL_ITEMS' => 'Zalaczone Produkty:',
'LBL_TEXTS' => 'Teksty do PDFa:',
'LBL_PREVIEW' => 'Podglad PDFa:',
'LBL_EMAIL' => 'Stwórz Email:',
'LBL_TO_INFORMATIONS' => 'Informacje o firmie:',
'LBL_DETAILS_TAB' => 'Szczególy',
'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' => 'Date 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_ECMQUOTE_ID' => 'Id Oferty',
'LBL_ECMQUOTE_NAME' => 'Nazwa Oferty',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Data dokumentu',
'LBL_SELL_DATE' => 'Data sprzedazy',
'LBL_PAYMENT_DATE' => 'Data platnosci',
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
'LBL_PARENT_ADDRESS_CITY' => 'Kod pocztowy / Miasto',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Kod pocztowy',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Panstwo',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Czy jest wolne od vatu?',
'LBL_HEADER_TEXT' => 'Tekst nagló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łatności',
'LBL_PAYMENTCONDITION_VALUE' => 'Termin płatności',
'LBL_PAYMENTCONDITION_ID' => 'Warunki Platnosci ID',
'LBL_DELIVERYCONDITION_NAME' => 'Warunki Dostawy',
'LBL_DELIVERYCONDITION_ID' => 'Warunki Dostawy ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Blad formatu numeru!',
'LBL_SAVE_FORM_ERROR' => 'Wystepuja bledy na liscie produktów albo w formularzu!',
'LBL_DISCOUNT_ERROR' => 'Blad formatu upustu',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Kod',
'LBL_EDITTABLE_NAME' => 'Nazwa',
'LBL_EDITTABLE_QUANTITY' => 'Ilosc',
'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ól',
'LBL_INSERT_NEW_ROW' => 'Wstaw nowy wiersz',
'LBL_DELETE_ROW' => 'Usun wiersz',
'LBL_VALIDTILL_DATE' => 'Wazne do',
// FOR MENU LINKS
'LNK_NEW_ECMQUOTE' => 'Utwórz Fakturę',
'LNK_ECMQUOTES_LIST' => 'Lista Faktur',
'LBL_IMG_SEARCH' => 'Wyszukiwanie',
'LBL_IMG_NEW' => 'Nowy, dodaj do bazy',
'LBL_IMG_EDIT' => 'Edycja',
'LBL_CONFIRM_QUESTION' => 'Chcesz potwierdzic tą Ofertę?',
'LBL_QUOTE_PDF' => 'Pokaz PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Pokaz PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Pokaz Ofertę 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 Sprzedazy',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Stwórz Zamówienie Sprzedazy [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Stwórz Zamówienie Sprzedazy.',
'LBL_SEND_TO_CONFIRM' => 'Wyslij Do Potwierdzenia',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Wyslij Do Potwierdzenia [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Wyslij Do Potwierdzenia.',
'LBL_LIST_TO_INVOICE' => 'Stwórz Fakture.',
'LBL_LIST_TO_SALE' => 'Stwórz Zamówienie Sprzedazy.',
// buttons
'LBL_SEND_BUTTON_TITLE' => 'Zapisz i Wyslij [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Zapisz i Wyslij',
'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',
// PAYER START
'LBL_PARENT_PAYER_ADDRESS'=>'Adres płatnika',
// PAYER END
'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_ECMQUOTES' => 'Oferty',
'LNK_ECMQUOTES_PDFLANGUAGES' => 'Ustawienia PDF',
'LBL_ECMQUOTES_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' => "Blad 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 UE:',
'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_QUOTE_FOR' => 'Oferta dla:',
'LBL_PDF_CONTENT_REGISTER_DATE' => 'Data wystawienia:',
'LBL_PDF_CONTENT_ISSUED_BY' => 'Wystawił:',
'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_REMARKS' => 'Uwagi',
'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',
'LBL_PDF_CONTENT_PARENT_DOCUMENT_WZ'=>'Nr dokumentu WZ',
'LBL_PDF_CONTENT_PARENT_DOCUMENT_NO'=>'Nr zamówienia',
'LBL_PDF_CONTENT_PARENT_SUPPLIER_CODE'=>'Kod dostawcy',
'LBL_PDF_CONTENT_DELIVERY'=>'DOSTAWA DO',
'LBL_PDF_CONTENT_SELL_DATE'=>'Data sprzedaży:',
'LBL_PDF_CONTENT_NIP'=>'NIP:',
'LBL_PDF_TO_PAY'=>'Do zapłaty:',
'LBL_PDF_PAID'=>'Zapłacono:',
'LBL_PDF_LEFT_TO_PAID'=>'Pozostało:'
);
?>

View File

@@ -0,0 +1,361 @@
<?php
class maksymaXML {
private $p; // paczka
private $date;
function maksymaXML($date) {
$this->date = $date;
$this->p = new XMLWriter ();
$this->p->openURI ( 'php://output' );
// $this->p->openMemory();
$this->p->startDocument ( '1.0', 'UTF-8' );
$this->p->startElement ( 'paczka' );
$this->p->writeAttribute ( 'firma', 'E5 Polska sp z o.o.' );
$this->p->writeAttribute ( 'wersja', '1' );
$this->p->writeAttribute ( 'miesiac', substr($this->date,5,6));
}
function getInvoices() {
// co z anulowanymi?? :(
$db = $GLOBALS ['db'];
$invoices = $db->query ( "SELECT * FROM ecminvoiceouts WHERE deleted='0' AND type='normal' AND register_date LIKE '$this->date%'" );
while ( $i = $db->fetchByAssoc ( $invoices ) ) {
$this->p->startElement ( 'dokument' );
$this->p->writeAttribute ( 'rodzaj', ($i['canceled']=='1'?'!':'').'FVS' . $i ['pdf_type'] );
$this->p->writeAttribute ( 'id', $i['id'] );
$this->p->writeElement ( 'data', $i ['register_date'] );
// dataOperacji = Data WZ? co jeśli WZ jest więcej
$this->p->writeElement ( 'dataOperacji', $i ['register_date'] );
// same story
$this->p->writeElement ( 'dataDostawy', $i ['register_date'] );
$this->p->writeElement ( 'dataWplywu', $i ['register_date'] );
$this->p->writeElement ( 'numer', $i ['document_no'] );
//platnosc
$this->p->startElement('platnosc');
$this->p->writeElement('kwota', $i['total_brutto']);
$this->p->writeElement('data', $i['payment_date']);
$this->p->endElement(); //</platnosc>
//kontrahent
$this->p->startElement ( 'kontrahent' );
$this->p->writeAttribute ( 'id', $i ['parent_id'] );
$this->p->writeElement('NIP', e(str_replace ( "-", "", $i ['parent_nip'] )));
$this->p->writeElement('nazwa', htmlspecialchars($i['parent_name']));
$this->p->writeElement('adres', htmlspecialchars($i['parent_address_street']));
//jaki numer??
$this->p->writeElement('kodPocztowy', htmlspecialchars($i['parent_address_postalcode']));
$this->p->writeElement('miasto', htmlspecialchars($i['parent_address_city']));
$this->p->writeElement('kraj', htmlspecialchars($i['parent_address_country']));
$this->p->endElement (); // </kontrahent>
//WZ
//co dalej z wz
$wz = $db->fetchByAssoc($db->query("SELECT id, document_no, total, register_date, ecmsale_id FROM ecmstockdocouts WHERE id = '".$i['wz_id']."'"));
$this->p->startElement('dokumentyPowiazane');
$this->p->startElement('dokumentPowiazany');
$this->p->writeAttribute('rodzaj', 'WZ');
$this->p->writeAttribute ( 'id', $wz['id'] );
$this->p->writeElement('numer', $wz['document_no']);
$this->p->writeElement('data', $wz['register_date']);
$this->p->writeElement('wartoscNetto', $wz['total']);
$this->p->endElement(); // </dokumentPowiazany>
$this->p->endElement(); //</dokumentyPowiazane>
//pozycje dokumentu
$pozycje = $db->query("
select sum(i.total_netto) as total_netto, p.group_ks, sum(i.quantity) as qty from ecminvoiceoutitems as i
inner join ecmproducts as p
on p.id=i.ecmproduct_id
where i.ecminvoiceout_id='".$i['id']."'
group by p.group_ks;
");
$pp = 0;
global $app_list_strings;
$this->p->startElement('pozycjeDokumentu');
while ($poz = $db->fetchByAssoc($pozycje)) {
$pp++;
if ($poz['group_ks']=='1') {
$rodzaj = 'T';
$tresc = 'TH';
} elseif ($poz['group_ks']=='2') {
$rodzaj = 'P';
$tresc = 'WG';
}
elseif (($poz['group_ks']=='3')) {
$rodzaj = 'S';
$tresc = 'SU';
}
$this->p->startElement('pozycjaDokumentu');
$this->p->writeElement('tresc', $tresc);
$this->p->writeElement('wartoscNetto', round($poz['total_netto'],2));
$this->p->endElement(); // </pozycjaDokumentu>
}
$this->p->endElement(); // </pozycjeDokumentu>
//rozbicie
$this->p->startElement('rejestr');
$rozbicie = $db->query("
select sum(i.total_netto) as total_netto, sum(i.total_brutto) as total_brutto, sum(i.total_vat) as total_vat, v.name, v.value from ecminvoiceoutitems as i
inner join ecmvats as v
on v.id = i.ecmvat_id
where
i.ecminvoiceout_id='".$i['id']."'
group by v.id;
");
while ($roz = $db->fetchByAssoc($rozbicie)) {
$this->p->startElement('rozbicie');
$this->p->writeAttribute('stawka', $roz['name']);
$this->p->writeElement('netto', round($roz['total_netto'],2));
$this->p->writeElement('brutto', round($roz['total_brutto'],2));
$this->p->writeElement('VAT', round ($roz['total_vat'], 2 ));
$this->p->endElement(); // </rozbicie>
}
$this->p->endElement(); // </rejestr>
if ($i['pdf_type']=='K') {
$this->p->writeElement('sumaNetto', round($i['total_netto'],2));
$this->p->writeElement('sumaBrutto', round($i['total_brutto'],2));
$this->p->writeElement('sumaVat', round($i['total_vat'],2));
} else {
$this->p->writeElement('sumaNetto', round($i['total_netto']*$i['currency_value'],2));
$this->p->writeElement('sumaBrutto', round($i['total_brutto']*$i['currency_value'],2));
$this->p->writeElement('sumaVat', round(($i['total_vat'])*$i['currency_value'],2));
$this->p->writeElement('sumaWalNetto', round($i['total_netto'],2));
$this->p->writeElement('sumaWalBrutto', round($i['total_brutto'],2));
$this->p->writeElement('sumaWalVat', round($i['total_vat'],2));
//kursy
$this->p->startElement('kursy');
//data dostawy
$cur = $db->fetchByAssoc($db->query("
SELECT * FROM currency_nbp_archive
WHERE currency_id = '".$i['currency_id']."'
AND date < DATE_SUB((SELECT delivery_date FROM ecmsales WHERE id='".$wz['so_id']."'), INTERVAL 1 DAY)
ORDER BY date DESC
LIMIT 0,1;
"));
if ($cur['value'] && $cur['value']!= "") {
$this->p->startElement('kurs');
$this->p->writeElement('waluta', $cur['currency_name']);
$this->p->writeAttribute('zastosowanie', 'dataDostawy');
$this->p->writeElement('rodzaj', 'NBP');
$this->p->writeElement('naDzien', $cur['date']);
$this->p->writeElement('wartosc', $cur['value']);
$this->p->endElement(); // </kurs>
}
//data transakcji
$cur = $db->fetchByAssoc($db->query("
SELECT * FROM currency_nbp_archive
WHERE currency_id = '".$i['currency_id']."'
AND date < DATE_SUB('".$i['register_date']."', INTERVAL 1 DAY)
ORDER BY date DESC
LIMIT 0,1;
"));
$this->p->startElement('kurs');
$this->p->writeElement('waluta', e($cur['currency_name']));
$this->p->writeAttribute('zastosowanie', 'dataTransakcji');
$this->p->writeElement('rodzaj', 'NBP');
$this->p->writeElement('naDzien', e($cur['date']));
$this->p->writeElement('wartosc', e($cur['value']));
$this->p->endElement(); // </kurs>
$this->p->endElement(); // </kursy>
}
$this->p->endElement (); // </dokument>
}
}
function getCorrectInfoices() {
$db = $GLOBALS ['db'];
$invoices = $db->query ( "SELECT * FROM ecminvoiceouts WHERE deleted='0' AND type='correct' AND register_date LIKE '$this->date%'" );
while ( $i = $db->fetchByAssoc ( $invoices ) ) {
$this->p->startElement ( 'dokument' );
$this->p->writeAttribute ( 'rodzaj', ($i['canceled']=='1'?'!':'').'FKS' . $i ['pdf_type'] );
$this->p->writeAttribute ( 'id', $i['id'] );
$this->p->writeElement ( 'data', $i ['register_date'] );
// dataOperacji = Data WZ? co jeśli WZ jest więcej
$this->p->writeElement ( 'dataOperacji', $i ['register_date'] );
// same story
$this->p->writeElement ( 'dataDostawy', $i ['register_date'] );
$this->p->writeElement ( 'dataWplywu', $i ['register_date'] );
$this->p->writeElement ( 'numer', $i ['document_no'] );
//kontrahent
$this->p->startElement ( 'kontrahent' );
$this->p->writeAttribute ( 'id', $i ['parent_id'] );
$this->p->writeElement('NIP', e(str_replace ( "-", "", $i ['parent_nip'] )));
$this->p->writeElement('nazwa', htmlspecialchars($i['parent_name']));
$this->p->writeElement('adres', htmlspecialchars($i['parent_address_street']));
//jaki numer??
$this->p->writeElement('kodPocztowy', htmlspecialchars($i['parent_address_postalcode']));
$this->p->writeElement('miasto', htmlspecialchars($i['parent_address_city']));
$this->p->writeElement('kraj', htmlspecialchars($i['parent_address_country']));
$this->p->endElement (); // </kontrahent>
//platnosc
$this->p->startElement('platnosc');
$this->p->writeElement('kwota', $i['total_brutto']);
$this->p->writeElement('data', $i['payment_date']);
$this->p->endElement(); //</platnosc>
//multi correct?
$multi = $db->query ( "
SELECT distinct o.ecminvoiceout_id
FROM
ecminvoiceoutitems as ii
INNER JOIN ecminvoiceouts as i
ON ii.ecminvoiceout_id = i.id
INNER JOIN ecminvoiceoutitems AS o
ON o.id = ii.ecminvoiceoutitem_id
WHERE
ii.ecminvoiceout_id = '".$i['id']."'");
$multi_correct = false;
if ($multi->num_rows > 1) $multi_correct = true;
if (!$multi_correct) {
//normal correct
$inv_id = $i['ecminvoiceout_id'];
$inv_nr = $db->fetchByAssoc($db->query("SELECT id, document_no, register_date FROM ecminvoiceouts WHERE id='".$inv_id."'"));
$this->p->startElement('dokumentKorygowany');
$this->p->writeAttribute('rodzaj', 'FVS');
$this->p->writeAttribute ( 'id', $inv_nr['id'] );
$this->p->writeElement('numer', $inv_nr['document_no']);
$this->p->writeElement('data', $inv_nr['register_date']);
$this->p->endElement(); //</dokumentKorygowany>
} else {
//multi correct
$this->p->startElement('dokumentyPowiazane');
while ($inv_id = $db->fetchByAssoc($multi)) {
$inv_nr = $db->fetchByAssoc($db->query("SELECT id, document_no, register_date FROM ecminvoiceouts WHERE id='".$inv_id['ecminvoiceout_id']."'"));
$this->p->startElement('dokumentPowiazany');
$this->p->writeAttribute('rodzaj', 'FVS');
$this->p->writeAttribute ( 'id', $inv_nr['id'] );
$this->p->writeElement('numer', $inv_nr['document_no']);
$this->p->writeElement('data', $inv_nr['register_date']);
$this->p->endElement(); // </dokumentPowiazany>
}
$this->p->endElement(); //<dokumentyPowiazane>
}
//pozycje dokumentu
$this->p->startElement('pozycjeDokumentu');
$pozycje = $db->query("
select sum(i.total_netto_corrected) as total_netto, p.group_ks, sum(i.quantity_corrected) as qty from ecminvoiceoutitems as i
inner join ecmproducts as p
on p.id=i.ecmproduct_id
where i.ecminvoiceout_id='".$i['id']."'
group by p.group_ks;
");
$pp = 0;
global $app_list_strings;
while ($poz = $db->fetchByAssoc($pozycje)) {
$pp++;
if ($poz['group_ks']=='1') {
$rodzaj = 'T';
$tresc = 'TH';
} elseif ($poz['group_ks']=='2') {
$rodzaj = 'P';
$tresc = 'WG';
}
elseif (($poz['group_ks']=='3')) {
$rodzaj = 'S';
$tresc = 'SU';
}
$this->p->startElement('pozycjaDokumentu');
$this->p->writeElement('tresc', $tresc);
$this->p->writeElement('wartoscNetto', round($poz['total_netto'],2));
$this->p->endElement(); // </pozycjaDokumentu>
}
$this->p->endElement(); // </pozycjeDokumentu>
//rozbicie
$this->p->startElement('rejestr');
$rozbicie = $db->query("
select sum(i.total_netto_corrected) as total_netto, sum(i.total_brutto_corrected) as total_brutto, v.name, v.value from ecminvoiceoutitems as i
inner join ecmvats as v
on v.id = i.ecmvat_id
where
i.ecminvoiceout_id='".$i['id']."'
group by v.id;
");
while ($roz = $db->fetchByAssoc($rozbicie)) {
$this->p->startElement('rozbicie');
$this->p->writeAttribute('stawka', $roz['name']);
$this->p->writeElement('netto', round($roz['total_netto'],2));
$this->p->writeElement('brutto', round($roz['total_brutto'],2));
$this->p->writeElement('VAT', round ($roz['total_brutto'] - $roz['total_netto'], 2 ));
$this->p->endElement(); // </rozbicie>
}
$this->p->endElement(); // </rejestr>
if ($i['pdf_type']=='K') {
$this->p->writeElement('sumaNetto', round($i['total_netto'],2));
$this->p->writeElement('sumaBrutto', round($i['total_brutto'],2));
$this->p->writeElement('sumaVat', round($i['total_vat'],2));
} else {
$this->p->writeElement('sumaNetto', round($i['total_netto']*$i['currency_value'],2));
$this->p->writeElement('sumaBrutto', round($i['total_brutto']*$i['currency_value'],2));
$this->p->writeElement('sumaVat', round(($i['total_vat'])*$i['currency_value'],2));
$this->p->writeElement('sumaWalNetto', round($i['total_netto'],2));
$this->p->writeElement('sumaWalBrutto', round($i['total_brutto'],2));
$this->p->writeElement('sumaWalVat', round($i['total_vat'],2));
//kursy
$this->p->startElement('kursy');
//data dostawy
$cur = $db->fetchByAssoc($db->query("
SELECT * FROM currency_nbp_archive
WHERE currency_id = '".$i['currency_id']."'
AND date < DATE_SUB((SELECT delivery_date FROM ecmsales WHERE id='".$wz['so_id']."'), INTERVAL 1 DAY)
ORDER BY date DESC
LIMIT 0,1;
"));
if ($cur['value'] && $cur['value']!= "") {
$this->p->startElement('kurs');
$this->p->writeElement('waluta', $cur['currency_name']);
$this->p->writeAttribute('zastosowanie', 'dataDostawy');
$this->p->writeElement('rodzaj', 'NBP');
$this->p->writeElement('naDzien', $cur['date']);
$this->p->writeElement('wartosc', $cur['value']);
$this->p->endElement(); // </kurs>
}
//data transakcji
$cur = $db->fetchByAssoc($db->query("
SELECT * FROM currency_nbp_archive
WHERE currency_id = '".$i['currency_id']."'
AND date < DATE_SUB('".$i['register_date']."', INTERVAL 1 DAY)
ORDER BY date DESC
LIMIT 0,1;
"));
$this->p->startElement('kurs');
$this->p->writeElement('waluta', $cur['currency_name']);
$this->p->writeElement('zastosowanie', 'dataTransakcji');
$this->p->writeElement('rodzaj', 'NBP');
$this->p->writeElement('naDzien',$cur['date']);
$this->p->writeElement('wartosc', $cur['value']);
$this->p->endElement(); // </kurs>
$this->p->endElement(); // </kursy>
}
$this->p->endElement (); // </dokument>
}
}
function getXML() {
$this->p->endElement (); // </paczka>
$this->p->flush ();
}
}
function e($value) {
if (!is_null($value) && $value!='')
return $value;
else
return ' ';
}
?>

View File

@@ -0,0 +1,125 @@
<?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['EcmInvoiceOuts'] = 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' ),
);
?>

View File

@@ -0,0 +1,406 @@
<?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 ['EcmInvoiceOuts'] ['DetailView'] = array (
'templateMeta' => array (
'form' => array (
'buttons' => array (
array (
'customCode' => '{$CREATE_PDF}'
),
array (
'customCode' => '{if $CREATE_COR == true} <input name="create_correct" id="create_correct" title="{$MOD.LBL_CORRECT_TITLE}" class="button" onclick="window.location = \'index.php?module=EcmInvoiceOuts&offset=1&return_module=EcmInvoiceOuts&action=EditView&return_action=index&record={$fields.id.value}&isCorrect=true\';" type="button" value="{$MOD.LBL_CORRECT}">{/if}'
),
array (
'customCode' => '{if $CAN_EDIT == true} <input name="edit" id="edit" class="button" onclick="window.location = \'index.php?module=EcmInvoiceOuts&action=EditView&return_action=index&record={$fields.id.value}&isDuplicate=false&isEditMode=true\';" type="button" value="Edytuj">{/if}'
),
array (
'customCode' => '<input name="edi" id="edi" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&record={$fields.id.value}&action=getEDI&to_pdf=1\');" type="button" value="EDI - wyślij fakturę">',
) ,
array (
'customCode' => '{if $CAN_CREATE_PZ == true} <input name="twinpolPZ" id="twinpolPZ" class="button" onclick="window.open(\'https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=createPzFromInvoice&record={$fields.id.value}\');" type="button" value="Utwórz PZ w Twinpol"> {/if}'
)
)
,
'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/EcmInvoiceOuts/javascript/EcmInvoiceOutsDetail.js'
),
array (
'file' => 'modules/EcmInvoiceOuts/javascript/bimit_table.js'
),
array (
'file' => 'modules/EcmInvoiceOuts/javascript/columndefs-detail.js'
)
)
),
'panels' => array (
'LBL_DETAILS_TAB' => array (
array (
'document_no',
'assigned_user_name'
),
array (
array (
'name' => 'parent_name',
'tabIndex' => '1'
),
array (
'name' => 'type',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
),
array (
'name' => 'ecminvoiceout_name',
'tabIndex' => '1',
'customCode' => '{$INVOICES_INFO}',
)
),
array (
array (
'name' => 'sell_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
),
array (
'name' => 'stock_name',
'label' => 'LBL_STOCK_NAME'
)
),
array (
array (
'name' => 'name',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'order_no',
'tabIndex' => '1'
),
array (
'name' => 'supplier_code',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'zs_no',
'label' => 'Dokument ZS',
'customCode'=>'{$zs_no}'
),
array (
'name' => 'wz_no',
'label' => 'Dokumenty WZ',
'customCode'=>'{$wz_no}'
),
),
array (
array (
'name' => 'to_informations',
'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_PAYMENTS}</h4>'
)
),
array (
array (
'name' => 'to_paid',
'label' => 'LBL_TO_PAID',
'customCode' => '{$fields.total_brutto.value}'
)
,
'ecmpaymentcondition_name'
),
array (
'prepaid',
'payment_date'
),
array (
'prepaid_nr',
'payment_method'
),
array (
'paid_val',
'payment_method_paid'
),
array (
array (
'name' => 'total_brutto',
'label' => 'LBL_LEFT',
'customCode'=>'{assign var="left_to_paid" value=$fields.total_brutto.value-$fields.paid_val.value-$fields.prepaid.value}{$left_to_paid|number_format:2:".":","}'
)
),
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 (
'name' => 'pdf_type',
'label' => 'LBL_PDF_TYPE'
)
),
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',
'currency_value_nbp'
),
array (
'parent_iln',
'currency_value'
),
array (
'pdf_text',
'currency_table'
),
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_SHIPPING_ADDRESS}</h4>'
)
),
array (
'parent_shipping_address_name'
),
array (
'parent_shipping_address_street'
),
array (
array (
'name' => 'parent_shipping_address_city',
'customCode' => '{$fields.parent_shipping_address_postalcode.value} {$fields.parent_shipping_address_city.value}'
)
),
array (
'parent_shipping_address_country'
),
array (
'parent_shipping_address_iln'
),
// platnik start
array (
array (
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_PAYER_ADDRESS}</h4>'
)
),
array (
'parent_payer_address_name'
),
array (
'parent_payer_address_street'
),
array (
array (
'name' => 'parent_payer_address_city',
'tabIndex' => '1',
'customCode' => '{$fields.parent_payer_address_postalcode.value} {$fields.parent_payer_address_city.value}'
)
),
array (
'parent_payer_address_country'
),
array (
'parent_payer_address_iln'
),
// platnik end
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}'
)
)
),
'LBL_ITEMS_TAB' => array (
array (
array (
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div id="itemsTable"></div>'
)
)
)
)
);
?>

View File

@@ -0,0 +1,382 @@
<?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 ['EcmInvoiceOuts'] ['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="is_correct" id="is_correct" value=\'{$IS_CORRECT}\'>',
'<input type="hidden" name="is_wz" id="is_wz" value=\'{$IS_WZ}\'>',
'<input type="hidden" name="is_sale" id="is_sale" value=\'{$IS_SALE}\'>',
'<input type="hidden" name="wz_id" id="wz_id" value=\'{$WZ_ID}\'>',
'<input type="hidden" name="wz_zb_id" id="wz_zb_id" value=\'{$WZ_ZB_ID}\'>',
'<input type="hidden" name="wz_record_zb" id="wz_record_zb" value=\'{$wz_record_zb}\'>',
'<input type="hidden" name="wz_name" id="wz_name" value=\'{$WZ_NAME}\'>',
'<input type="hidden" name="so_id" id="so_id" value=\'{$SO_ID}\'>',
'<input type="hidden" name="is_return" id="is_return" value=\'{$IS_RETURN}\'>',
'<input type="hidden" name="return_id" id="return_id" value=\'{$RETURN_ID}\'>',
'<input type="hidden" name="sess_id" id="sess_id" value=\'{$SESS_ID}\'>',
'<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="total_vat" name="total_vat" value=\'{$fields.total_vat.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="multiDiscountCorrectInvoice" name="multiDiscountCorrectInvoice" value=\'{$MULTIDISCOUNTCORRECTINVOICE}\'>',
'<input type="hidden" id="mdci_discount" name="mdci_discount" value=\'{$MDCI_DISCOUNT}\'>',
'<input type="hidden" id="mdci_inv" name="mdci_inv" value=\'{$MDCI_INV}\'>',
'<input type="hidden" id="isEditMode" name="isEditMode" value=\'{$isEditMode}\'>',
)
),
'maxColumns' => '2',
'widths' => array (
array (
'label' => '10',
'field' => '30'
),
array (
'label' => '10',
'field' => '30'
)
),
'includes' => array (
array (
'file' => 'include/JSON.js'
),
array (
'file' => 'modules/EcmInvoiceOuts/javascript/EcmInvoiceOuts3.js'
),
array (
'file' => 'modules/EcmInvoiceOuts/javascript/bimit_table.js'
),
array (
'file' => 'modules/EcmInvoiceOuts/javascript/columndefs.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' => 'type',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
), array (
'name' => 'ecminvoiceout_name',
'tabIndex' => '1'
)
),
array (
array (
'name' => 'sell_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array (
'showFormats' => true
)
), array (
'name' => 'stock_id',
'label' => 'LBL_STOCK_NAME',
'customCode' => '{$STOCK}'
)
),
array (
array (
'name' => 'name',
'tabIndex' => '1'
),
),
array (
array (
'name' => 'order_no',
'tabIndex' => '1'
),
array (
'name' => 'supplier_code',
'tabIndex' => '1'
),
),
array(
array(
'name' => 'to_informations',
'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_PAYMENTS}</h4>'
),
),
//end payment informations
array(
array(
'name' => 'to_paid',
'label'=> 'LBL_TO_PAID',
'customCode' => '<div id="to_paid"></div>',
),
'ecmpaymentcondition_name',
),
array(
'prepaid',
'payment_date',
),
array(
'prepaid_nr',
'payment_method',
),
array(
'paid_val',
'payment_method_paid'
),
array(
array(
'name' => 'left',
'label' => 'LBL_LEFT',
'customCode' => '<div id="left"></div>',
),
),
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'=>'currency_id','label'=>'LBL_CURRENCY'),
),
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' => 'pdf_type',
'label' => 'LBL_PDF_TYPE'
)
),
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 ('name'=>'currency_value_nbp','tabIndex' => '1',),
),
array (
array (
'name' => 'parent_address_country',
'tabIndex' => '1'
),
array ('name'=>'currency_value','tabIndex' => '1',),
),
array (
array (
'name' => 'parent_iln',
'tabIndex' => '1'
),
'currency_table',
),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_SHIPPING_ADDRESS}</h4>'
),
),
array(
array(
'name' => 'address',
'customCode' => '<div id=\'addresses\'></div>',
), '',
),
array('parent_shipping_address_name'),
array('parent_shipping_address_street'),
array (
array(
'name' => 'parent_shipping_address_city',
'tabIndex' => '1',
'customCode' => '<input maxlength="8" type="text" name="parent_shipping_address_postalcode" id="parent_shipping_address_postalcode" value="{$fields.parent_shipping_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="parent_shipping_address_city" id="parent_shipping_address_city" value="{$fields.parent_shipping_address_city.value}" style="vertical-align:top;width:150px;" />'
),
),
array('parent_shipping_address_country'),
array('parent_shipping_address_nip'),
array('parent_shipping_address_iln'),
// platnik start
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_PARENT_PAYER_ADDRESS}</h4>'
),
),
array(
array(
'name' => 'payer',
'customCode' => '<div id=\'payer\'></div>',
), '',
),
array('parent_payer_address_name'),
array('parent_payer_address_street'),
array (
array(
'name' => 'parent_payer_address_city',
'tabIndex' => '1',
'customCode' => '<input maxlength="8" type="text" name="parent_payer_address_postalcode" id="parent_payer_address_postalcode" value="{$fields.parent_payer_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="parent_payer_address_city" id="parent_payer_address_city" value="{$fields.parent_payer_address_city.value}" style="vertical-align:top;width:150px;" />'
),
),
array('parent_payer_address_country'),
array('parent_payer_address_nip'),
array('parent_payer_address_iln'),
// platnik end
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 (
'label'=>'Uwagi pod fakturą',
'name' => 'pdf_text'
),
array (
'label' => 'Informacja o VAT ( faktura UE oraz eksport)',
'name' => 'pdf_export'
)
)
),
'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"/>
<img onclick="searchAllProducts();" src="modules/EcmSales/images/search.gif" style="cursor: pointer;">
{$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,118 @@
<?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["EcmInvoiceOuts"] = array(
'DOCUMENT_NO' => array(
'width' => '5',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true,
),
'PARENT_NAME' => array(
'width' => '15',
'label' => 'LBL_PARENT_NAME',
'default' => true,
),
'TOTAL_BRUTTO' => array(
'width' => '10',
'label' => 'Wartość brutto',
'align' => 'right',
'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' => '3',
'label' => 'LBL_REGISTER_DATE',
'default' => true,
'sortable' => true,
),
'ZS' => array(
'width' => '3',
'label' => 'Dokument ZS',
'default' => true,
'sortable'=>false,
'align'=>'left',
'link' => false,
),
'WZ' => array(
'width' => '3',
'label' => 'Dokument WZ',
'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,122 @@
<?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['EcmInvoiceOuts'] = array (
'templateMeta' => array (
'maxColumns' => '2',
'widths' => array (
'label' => '10',
'field' => '30'
),
),
'layout' => array (
'basic_search' => array (
'document_no',
'name',
'order_no',
'type',
'status',
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
'advanced_search' => array (
'document_no',
'name',
'order_no',
'type',
'status',
'parent_name',
'register_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']['EcmInvoiceOuts'] = array(
'LBL_DETAILVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmInvoiceOuts/DetailView.html',
'php_file' => 'modules/EcmInvoiceOuts/DetailView.php',
'type' => 'DetailView',
),
'LBL_EDITVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmInvoiceOuts/EditView.html',
'php_file' => 'modules/EcmInvoiceOuts/EditView.php',
'type' => 'EditView',
),
'LBL_LISTVIEW'=>array(
'template' => 'listview',
'meta_file' => 'modules/EcmInvoiceOuts/listviewdefs.php',
'type' => 'ListView',
),
'LBL_SEARCHFORM'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmInvoiceOuts/SearchForm.html',
'php_file' => 'modules/EcmInvoiceOuts/ListView.php',
'type' => 'SearchForm',
),
);

View File

@@ -0,0 +1,148 @@
<?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['EcmInvoiceOuts']['subpanel_setup'] = array (
'notes' => array(
'order' => 30,
'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',
),
'ecmsales' => array (
'order' => 10,
'module' => 'EcmSales',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmsales',
'add_subpanel_data' => 'so_id',
'subpanel_name' => 'default',
'title_key' => 'Zamówienie sprzedaży',
),
'ecmstockdocouts' => array (
'order' => 20,
'module' => 'EcmStockDocOuts',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmstockdocouts',
'add_subpanel_data' => 'wz_id',
'subpanel_name' => 'default',
'title_key' => 'Dokument WZ',
),
/*
'emails' => array (
'order' => 15,
'module' => 'Emails',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'emails',
'add_subpanel_data' => 'emails_id',
'subpanel_name' => 'ForEcmInvoiceOuts',
'title_key' => 'LBL_EMAILS_SUBPANEL_TITLE',
'top_buttons' => array(),
),
*/
);
?>

View File

@@ -0,0 +1,128 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Subpanel Layout definition for Contacts
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
//array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmStockDocIns'),
),
'where' => '',
'list_fields' => array (
/*
'number' => array (
'name' => 'number',
'vname' => 'LBL_NUMBER',
'module' => 'EcmStockDocIns',
'usage' => 'query_only',
),
*/
'document_no' => array (
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'module' => 'EcmStockDocIns',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '10%',
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'QUANTITY' => array (
'name' => 'quantity',
'vname' => 'Ilość',
'align'=>'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'PRICE_NETTO' => array (
'name' => 'price_netto',
'vname' => 'Cena netto',
'align'=>'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'TOTAL_NETTO' => array (
'name' => 'total_netto',
'vname' => 'Wartość netto',
'align'=>'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'options' => array (
'name' => 'options',
'label' => '&nbsp;',
'default' => true,
'width' => '10%',
'sortable' => false,
),
'TYPE' => array (
'name' => 'status',
'vname' => 'Typ',
'module' => 'EcmStockDocIns',
'width' => '40%',
),
/*
'PDF_URL' => array(
'width' => '2%',
'label' => '&nbsp;',
'link' => true,
'default' => true,
'sortable' => false,
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'width' => '2%',
),
*/
),
);
?>

View File

@@ -0,0 +1,124 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Subpanel Layout definition for Contacts
*
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
*/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmInvoiceOuts'),
),
'where' => '',
'list_fields' => array (
'status' => array (
'name' => 'status',
'vname' => 'LBL_STATUS',
'module' => 'EcmInvoiceOuts',
'width' => '5%',
),
/*
'number' => array (
'name' => 'number',
'vname' => 'LBL_NUMBER',
'module' => 'EcmInvoiceOuts',
'usage' => 'query_only',
),
*/
'document_no' => array (
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'module' => 'EcmInvoiceOuts',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '15%',
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_NAME',
'module' => 'EcmInvoiceOuts',
'width' => '40%'
),
'total' => array (
'name' => 'total',
'vname' => 'LBL_TOTAL',
'module' => 'EcmInvoiceOuts',
'width' => '15%',
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'module' => 'EcmInvoiceOuts',
'width' => '10%',
),
'price' => array (
'name' => 'price',
'vname' => 'Cena',
'module' => 'EcmStockDocIns',
'width' => '5%',
),
'options' => array (
'name' => 'options',
'label' => '&nbsp;',
'default' => true,
'width' => '2%',
'sortable' => false,
),
/*
'PDF_URL' => array(
'width' => '2%',
'label' => '&nbsp;',
'link' => true,
'default' => true,
'sortable' => false,
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'width' => '2%',
),
*/
),
);
?>

View File

@@ -0,0 +1,36 @@
<?php
$ss = new Sugar_Smarty ();
global $mod_strings;
$ss -> assign( "MOD", $mod_strings );
$Calendar_daFormat = str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));
$ss -> assign("dateFormat", $Calendar_daFormat);
if ($_REQUEST['process'] == '1') {
$date_from = $_REQUEST['date_from'];
$ss->assign('date_from', $date_from);
$date_to = $_REQUEST['date_to'];
$ss->assign('date_to', $date_to);
$parent_id = $_REQUEST['account_id'];
$ss->assign('contractorId', $parent_id);
$parent_name = $_REQUEST['account_name'];
$ss->assign('contractorName', $_REQUEST['account_name']);
$date_from = substr($date_from, 6,4).'-'.substr($date_from, 3,2).'-'.substr($date_from, 0,2);
$date_to = substr($date_to, 6,4).'-'.substr($date_to, 3,2).'-'.substr($date_to, 0,2);
$db = $GLOBALS['db'];
$res = $db->query("SELECT id, document_no, register_date, total_netto FROM ecminvoiceouts WHERE
(register_date BETWEEN '$date_from' AND '$date_to') AND deleted='0' AND canceled='0'
AND parent_id='$parent_id' AND type='normal' order by register_date");
$invoices = array();
while ($row = $db->fetchByAssoc($res)) {
$invoices[] = $row;
}
$ss->assign('PROCESS', '1');
$ss->assign('INVOICES', $invoices);
}
echo $ss->display ( 'modules/EcmInvoiceOuts/tpls/multiDiscountCorrectInvoice.tpl' );
?>

View File

@@ -0,0 +1,22 @@
<?php
$db = $GLOBALS['db'];
$cor_res = $db->query("select * from ecminvoiceouts where wz_id is not null and date_entered>= '2018-01-01'");
while ($cor_row = $db->fetchByAssoc($cor_res)) {
$pos = $db->query("select * from ecminvoiceoutitems where ecminvoiceout_id='".$cor_row['id']."'");
while ($pos_row = $db->fetchByAssoc($pos)) {
$q3 = $db->query("select * from ecmstockdocoutitems where ecmstockdocout_id='".$cor_row['wz_id']."' and ecmproduct_id='".$pos_row['ecmproduct_id']."' and quantity=".$pos_row['quantity']."");
$pos_row2 = $db->fetchByAssoc($q3);
if($pos_row!==null && $pos_row2['id']!=""){
$qu = "update ecminvoiceoutitems set parent_doc_id='".$cor_row['wz_id']."', parent_doc_type='EcmStockDocOut',parent_doc_item_id='".$pos_row2['id']."' where id='".$pos_row['id']."'";
echo $qu.";<br>";
}
}
}
?>

View File

@@ -0,0 +1,83 @@
<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_LISTSALES_NAME}</h2></td>
</tr>
</table>
<br />
<form action="index.php?module=EcmInvoiceOuts&action=ListSales" method="post" name="SearchFormListSales"><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_LISTSALES_YEAR}:
</td>
<td width="30%" nowrap="" >
<input type='text' id='year' name='year' value='{$POST.year}' maxlength="4"/>
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTSALES_CODE}:
</td>
<td width="30%" nowrap="" >
<input type='text' id='code' name='code' value='{$POST.code}'/>
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTSALES_QTY}:
</td>
<td width="30%" nowrap="" >
<input type='text' id='quantity' name='quantity' value='{$POST.quantity}'/>
</td>
<td width="5%" nowrap="" >
{$MOD.LBL_LISTSALES_PRICE}:
</td>
<td width="30%" nowrap="" >
<input type='text' id='price' name='price' value='{$POST.price}'/>
</td>
<td width="10%" nowrap="nowrap" class="dataLabel">{$MOD.LBL_LISTSALES_PARENT_NAME}:</td>
<td nowrap="nowrap" class="dataField">
<input type="text" title="" size="" id="account_name" tabindex="" name="account_name" value='{$POST.account_name}'>
<input type="hidden" id="account_id" name="account_id" value='{$POST.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;SearchFormListSales&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="Wybierz [Alt+T]" tabindex="" name="btn_account_name"></td>
</tr>
</table>
<input class="button" type="submit" value="{$MOD.LBL_LISTSALES_SEARCH}" name="submit">
<input class="button" type="button" onclick="location.href='index.php?module=EcmInvoiceOuts&action=ListSales';" value="{$MOD.LBL_LISTSALES_CLEAR}" name="clear">
</form>
<br>
{if !empty($POSITION_LIST)}
<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_LISTSALES_CODE}</th>
<th >{$MOD.LBL_LISTSALES_NAME_POS}</th>
<th >{$MOD.LBL_LISTSALES_QTY}</th>
<th >{$MOD.LBL_LISTSALES_PRICE}</th>
<th >{$MOD.LBL_LISTSALES_DOCUMENT_NO}</th>
<th >{$MOD.LBL_LISTSALES_REGISTER_DATE}</th>
</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 style="text-align: right">{$item.quantity}</td>
<td data-total="{$item.price_netto}" style="text-align: right">{$item.price_netto|number_format:2:".":","}</td>
<td data-total="{$item.number}"style="text-align: right"><a href="index.php?module=EcmInvoiceOuts&action=DetailView&record={$item.fk_id}">{$item.document_no}</a></td>
<td data-total="{$item.register_date|date_format:"%Y%m%d"}"style="text-align: center">{$item.register_date|date_format:"%d.%m.%Y"}</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
{/if}

View File

@@ -0,0 +1,137 @@
Raport w trakcie budowy - Michał Zieliński<br>
<form action="index.php?module=EcmInvoiceOuts&action=Report_INTRASTAT" method="POST">
<div id="report_settings" class="edit view search basic" style="width: 97vw;">
<table cellspacing="0" cellpadding="0" style="width: 100%">
<tbody>
<tr>
<td>
<input type="number" size="4" maxlength="4" value="{$year}" name="year"/>
<input type="number" size="2" maxlength="2" value="{$month}" name="month"/>
<input type="hidden" name="process" value="1"/>
<input class="button" type="submit" value="Generuj"/>
</td>
</tr>
</tbody>
</table>
</div>
</form>
{if $process}
<form action="index.php?module=EcmInvoiceOuts&action=Report_INTRASTAT" method="POST">
<input type="hidden" name="xml" value="1"/>
<input type="hidden" value="{$year}" name="xml_year"/>
<input type="hidden" value="{$month}" name="xml_month"/>
<input class="button" type="submit" value="XML"/>
</form>
<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: [[ 0, "asc" ]],
columnDefs: [
{ targets: [3,4,5,6,7, 8], className: 'dt-right'}
]
});
$('#products').DataTable({
pageLength: 200,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.24/i18n/Polish.json'
},
columnDefs: [
{ targets: [2,3], className: 'dt-right'}
],
lengthMenu: [
[50, 100, 200, 500, -1],
[50, 100, 200, 500, "Wszystkie"]
],
scrollX: true,
scrollY: "60vh",
scrollCollapse: true,
order: [[ 0, "asc" ]],
});
});
{/literal}
</script>
<style>
{literal}
div.dataTables_wrapper {
width: 95vw;
max-height: 50vw;
margin: 0 auto;
}
{/literal}
</style>
Raport wygenerowany na podstawie dokumentów:
{foreach from=$invoices item="item"}
<a target="new" href="index.php?module=EcmInvoiceOuts&action=DetailView&record={$item.id}">{$item.document_no}</a>&nbsp;
{/foreach}
<br><br>
<table id="report" class="display nowrap hover" style="width:100%">
<thead>
<tr>
<th>Numer pozycji</th>
<th>Kod towarowy</th>
<th>Opis towaru</th>
<th>Rodzaj transakcji</th>
<th>Kraj przeznaczenia</th>
<th>Identyfikator kontrahenta zagranicznego</th>
<th>Wartość fakturowa PLN</th>
<th>Waga brutto</th>
<th>Ilość intrastat</th>
</tr>
</thead>
<tbody>
{foreach from=$data item="item"}
<tr>
<td>{$item.position}</td>
<td>{$item.pkwiu}</td>
<td>{$item.description|truncate:75}</td>
<td>11</td>
<td>{$item.country}</td>
<td>{$item.nip}</td>
<td>{$item.total}</td>
<td>{$item.weight}</td>
<td>{if $item.qty_intrastat > 0}{$item.qty_intrastat}{/if}</td>
</tr>
{/foreach}
</tbody>
</table>
{if $badProducts|@count>0}
<hr>
<h3>Niepoprawnie uzupełnione produkty</h3><br>
<table id="products" class="display nowrap hover" style="width:100%">
<thead>
<tr>
<th>Kod</th>
<th>Nazwa</th>
<th>PKWiU</th>
<th>Waga brutto</th>
</tr>
</thead>
<tbody>
{foreach from=$badProducts item="item"}
<tr>
<td>
<a target="new" href="index.php?module=EcmProducts&action=DetailView&record={$item.id}">{$item.code}</a>
</td>
<td>{$item.name}</td>
<td>{$item.pkwiu}</td>
<td>{$item.weight}</td>
</tr>
{/foreach}
</tbody>
</table>
{/if}
{/if}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<ns1:IST xmlns:ns1="http://www.mf.gov.pl/xsd/Intrastat/IST.xsd" xmlns:ns2="http://www.mf.gov.pl/xsd/aesais/typy"
xmlns:ns3="http://www.w3.org/2000/09/xmldsig#">
<ns1:Deklaracja Data="{$today}" LacznaLiczbaPozycji="{$data|@count}" LacznaWartoscFaktur="{$total}" Miejscowosc="Toruń"
Miesiac="{$month}" NrWlasny="01{$month}{$year}TWIN" Numer="1" Rodzaj="D" Rok="{$year}" Typ="W" UC="420000" Wersja="1">
<ns1:PodmiotZobowiazany KodPocztowy="87-126" Miejscowosc="Obrowo" Nazwa="Twinpol sp. z o.o."
Nip="8792676609" Regon="36022300800000" UlicaNumer="Al. Lipowa 48" />
{foreach from=$data item="item"}
<ns1:Towar IdKontrahenta="{$item.nip}" KodTowarowy="{$item.pkwiu}" KrajPochodzenia="PL" {if $item.qty_intrastat}IloscUzupelniajacaJm="{$item.qty_intrastat}" {/if}KrajPrzeznaczeniaWysylki="{$item.country}" MasaNetto="{$item.weight}" OpisTowaru="{$item.description}" PozId="{$item.position}" RodzajTransakcji="11" WartoscFaktury="{$item.total}" />
{/foreach}
<ns1:Wypelniajacy Email="katarzynagorniak@twojedoradztwo.pl" NazwiskoImie="Katarzyna Górniak"
Telefon="506429209" />
</ns1:Deklaracja>
</ns1:IST>

View File

@@ -0,0 +1,79 @@
<script type="text/javascript" src="modules/EcmInvoiceOuts/javascript/multiDiscountCorrectInvoice.js"></script>
<ul class="tablist" style="width:100%;">
<li>
<a class="current" href="#">Podstawowe wyszukiwanie</a>
</li>
</ul>
<form action="index.php" method="get" name="searchInvoices">
<input type="hidden" name="module" value="EcmInvoiceOuts" />
<input type="hidden" name="action" value="multiDiscountCorrectInvoice" />
<input type="hidden" name="process" value="1" />
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
<tr>
{* Search by date_from *}
<td class="dataLabel" width="5%" nowrap="nowrap"> Data od </td>
<td class="dataField" width="10%" nowrap="nowrap">
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title="" value="{$date_from}" autocomplete="off">
<img id="date_from_trigger" border="0" align="absmiddle" alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script language="JavaScript" type="text/javascript">
Calendar.setup ({ldelim}
inputField : "date_from",
daFormat : "{$dateFormat}",
button : "date_from_trigger",
singleClick : true,
dateStr : "",
step : 1
{rdelim}
);
</script>
</td>
</td>
{* Search by date_to *}
<td class="dataLabel" width="5%" nowrap="nowrap">Data do</td>
<td class="dataField" width="10%" nowrap="nowrap">
<input autocomplete="off" name="date_to" id="date_to" value="{$date_to}" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
<script language="JavaScript" type="text/javascript">
Calendar.setup ({ldelim}
inputField : "date_to",
daFormat : "{$dateFormat}",
button : "date_to_trigger",
singleClick : true,
dateStr : "",
step : 1
{rdelim}
);
</script>
</td>
<td class="dataLabel" width="10%" nowrap="nowrap">{$MOD.LBL_CONTRACTOR}</td>
<td class="dataField" width="30%" nowrap="nowrap">
<input id="account_name" type="text" title="" value="{$contractorName}" size="" tabindex="" name="account_name">
<input id="account_id" type="hidden" value="{$contractorId}" name="account_id">
<input class="button" type="button" value="Wybierz" accesskey="T" title="Select [Alt+T]" tabindex="" value="{$contractorName}" name="btn_account_name" onClick="{literal}open_popup( 'Accounts', 600, 400, '', true, false, {'call_back_function':'set_return','form_name':'searchInvoices','field_to_name_array':{'id':'account_id','name':'account_name'}}, 'single', true );{/literal}">
</td>
</tr>
</tbody>
</table>
<input class="button" name="submit" value="Szukaj" type="submit">
<input class="button" name="clear" value="Wyczyść" type="button" onclick="location.href='index.php?module=EcmInvoiceOuts&action=multiDiscountCorrectInvoice';">
</form>
{if $PROCESS=='1'}
<table class="list view" id="invTable">
<tbody>
<tr><th><input type="checkbox" id="invSelectAll"/></th><th>Numer faktury</th><th>Data rejestracji</th><th>Wartość netto</th></tr>
{foreach from=$INVOICES item=I}
<tr class="oddListRowS1">
<td><input type="checkbox" class="invcheckbox" name="inv[]" value="{$I.id}" style="text-align: center;"></td>
<td><a href="index.php?module=EcmInvoiceOuts&action=DetailView&record={$I.id}" target="new">{$I.document_no}</a></td>
<td>{$I.register_date}</td>
<td class="netto">{$I.total_netto}</td>
</tr>
{/foreach}
</tbody>
</table>
<br>
Obniż cenę jednostkową netto o:&nbsp<input value="0" id="discount" name="discount"/>&nbsp%.<br>
Przybliżona wartość korekty <p style="display:inline" id="total_info">0</p> zł.<br>
<input type="button" class="button" onClick="prepareData();" value="Przejdź do korekty"/>
{/if}

View File

@@ -0,0 +1,997 @@
<?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 ['EcmInvoiceOut'] = array (
'table' => "ecminvoiceouts",
'comment' => 'EcmInvoiceOuts',
'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'
),
'wz_id' => array (
'name' => 'wz_id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => false,
'reportable' => false,
'comment' => 'Unique identifier'
),
'so_id' => array (
'name' => 'so_id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => false,
'reportable' => false,
'comment' => 'Unique identifier'
),
'wz_name' => array (
'name' => 'wz_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'
),
'description' => array (
'type' => 'text',
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'comment' => 'Description',
'unified_search' => true
// 'required' => true,
),
'wz_record_zb' => array (
'type' => 'text',
'name' => 'wz_record_zb',
'vname' => 'wz_record_zb',
'comment' => 'wz_record_zb',
'unified_search' => false,
'required' => false,
),
'date_entered' => array (
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'required' => true,
'comment' => 'Date record created'
),
'ecmproduct_id' => array(
'name' => 'ecmproduct_id',
'vname' => 'produkt',
'type' => 'varchar',
'source' => 'non-db',
),
'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'
),
'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' => 'ecminvoiceouts' . '_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' => 'ecminvoiceouts' . '_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' => 'ecminvoiceouts' . '_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'
),
'canceled' => array (
'name' => 'canceled',
'type' => 'bool',
'vname' => '',
),
// NEW FIELDS SECTION
'currency_table' => array (
'name' => 'currency_table',
'vname' => 'LBL_CURRENCY_TABLE',
'type' => 'varchar',
'len' => '50'
),
'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'
),
'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' => 'ecminvoiceouts_type_dom',
'massupdate' => false
),
'ecminvoiceout_id' => array (
'name' => 'ecminvoiceout_id',
'type' => 'id',
'vname' => 'LBL_ECMINVOICEOUT_ID',
'group' => 'ecminvoiceout_name',
'reportable' => false
),
'ecminvoiceout_name' => array (
'name' => 'ecminvoiceout_name',
'rname' => 'document_no',
// 'db_concat_fields'=> array(0=>'name'),
// 'source' => 'non-db',
'dbType' => 'varchar',
'len' => '255',
'group' => 'ecminvoiceout_name',
'vname' => 'LBL_ECMINVOICEOUT_NAME',
'reportable' => false,
'id_name' => 'ecminvoiceout_id',
'join_name' => 'ecminvoiceouts',
'type' => 'relate',
'module' => 'EcmInvoiceOuts',
'link' => 'ecminvoiceouts'
),
'sell_date' => array (
'name' => 'sell_date',
'vname' => 'LBL_SELL_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => true
),
'stock_name' =>
array (
'name' => 'stock_name',
'vname' => 'LBL_STOCK_NAME',
'type' => 'relate',
'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,
),
'order_no' => array (
'name' => 'order_no',
'vname' => 'LBL_ORDER_NO',
'type' => 'varchar',
'len' => 255
),
'supplier_code' => array (
'name' => 'supplier_code',
'vname' => 'LBL_SUPPLIER_CODE',
'type' => 'varchar',
'len' => 255
),
'documents' => array (
'name' => 'documents',
'type' => 'link',
'relationship' => 'ecminvoiceout_documents',
'source' => 'non-db',
'vname' => 'LBL_NOTES'
),
'status' => array (
'name' => 'status',
'vname' => 'LBL_STATUS',
'type' => 'enum',
'size' => '3',
'options' => 'ecminvoiceouts_status_dom',
'massupdate' => false
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_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'
),
'total_netto' => array (
'name' => 'total_netto',
'vname' => 'LBL_SUBTOTAL',
'type' => 'decimal',
'len' => '15,2',
),
'total_vat' => array (
'name' => 'total_vat',
'vname' => 'LBL_VAT',
'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,
),
'parent_iln' =>
array (
'name' => 'parent_iln',
'vname' => 'LBL_PARENT_ILN',
'type' => 'varchar',
'len' => 15,
),
'parent_payer_address_iln' =>
array (
'name' => 'parent_payer_address_iln',
'vname' => 'LBL_PARENT_ILN',
'type' => 'varchar',
'len' => 15,
),
'parent_shipping_address_iln' =>
array (
'name' => 'parent_shipping_address_iln',
'vname' => 'LBL_PARENT_ILN',
'type' => 'varchar',
'len' => 15,
),
'parent_nip_unformated' =>
array (
'name' => 'parent_nip_unformated',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => 15,
),
'ecmlanguage' => array (
'name' => 'ecmlanguage',
'vname' => 'LBL_ECMLANGUAGE',
'type' => 'enum',
'options' => 'ecmlanguages_dom',
'required' => true,
'len' => 35,
'massupdate' => false
),
'no_tax' =>
array (
'massupdate' => false,
'name' => 'no_tax',
'vname' => 'LBL_NO_TAX',
'type' => 'bool',
'default' => '0',
),
'pdf_text' => array (
'name' => 'pdf_text',
'vname' => 'LBL_PDF_TEXT',
'type' => 'text'
),
'pdf_export' => array (
'name' => 'pdf_export',
'vname' => 'LBL_PDF_TEXT',
'type' => 'text',
'default'=>"Dla wszystkich pozycji faktury zastosowano stawkę VAT 0%\nVAT is 0% for all invoice items\n(Zgodnie z art. 41 ust. 3 ustawy o podatku VAT)",
),
//prices
'ecmprice_id' => array(
'name' => 'ecmprice_id',
'type' => 'varchar',
'len' => '36',
'vname' => 'LBL_PRICE',
'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
'contact_id' => array (
'name' => 'contact_id',
'rname' => 'name',
'id_name' => 'contact_id',
'vname' => 'LBL_CONTACT_ID',
'group' => 'contact_name',
'type' => 'relate',
'table' => 'contacts',
'reportable' => true,
'Importable' => false,
'isnull' => 'false',
'dbType' => 'id',
'audited' => false,
'duplicate_merge' => 'disabled',
'massupdate' => false
),
'contact_name' => array (
'name' => 'contact_name',
'vname' => 'LBL_CONTACT_NAME',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'contacts',
'id_name' => 'contact_id',
'module' => 'Contacts',
'duplicate_merge' => 'disabled',
'massupdate' => false,
'other_data' => array (
'from_relation' => array (
'module' => 'Accounts',
'rel_name' => 'contacts',
'rel_bean_name' => 'Contact',
'field_id_name' => 'parent_id',
'field_name' => 'parent_name',
'field_id_value' => ''
)
),
'initial_filter_fields' => array (
'account_name' => 'parent_name'
)
),
'currency_id' => array (
'name' => 'currency_id',
'type' => 'enum',
'options' => 'currency_dom',
'label' => 'LBL_CURRENCY'
),
'currency_value' => array (
'name' => 'currency_value',
'type' => 'varchar',
'len' => '5,4',
'vname' => 'LBL_CURRENCY_VALUE',
'reportable' => false,
'required' => false
),
'currency_value_nbp' => array (
'name' => 'currency_value_nbp',
'type' => 'varchar',
'len' => '5,4',
'vname' => 'LBL_CURRENCY_VALUE_NBP',
'reportable' => false,
'required' => false
),
'pdf_type' => array (
'name' => 'pdf_type',
'type' => 'enum',
'options' => 'account_invoice_type_dom',
'label' => 'LBL_PDF_TYPE'
),
'parent_shipping_address_name' => array (
'name' => 'parent_shipping_address_name',
'vname' => 'LBL_PARENT_NAME',
'type' => 'varchar',
'len' => '100'
),
'parent_shipping_address_street' => array (
'name' => 'parent_shipping_address_street',
'vname' => 'LBL_PARENT_ADDRESS_STREET',
'type' => 'varchar',
'len' => '100'
),
'parent_shipping_address_city' => array (
'name' => 'parent_shipping_address_city',
'vname' => 'LBL_PARENT_ADDRESS_CITY',
'type' => 'varchar',
'len' => '100'
),
'parent_shipping_address_postalcode' => array (
'name' => 'parent_shipping_address_id',
'vname' => 'LBL_PARENT_ADDRESS_POSTALCODE',
'type' => 'varchar',
'len' => '100'
),
'parent_shipping_address_country' => array (
'name' => 'parent_shipping_address_country',
'vname' => 'LBL_PARENT_ADDRESS_COUNTRY',
'type' => 'varchar',
'len' => '100'
),
'parent_shipping_address_nip' => array (
'name' => 'parent_shipping_address_nip',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_name' => array (
'name' => 'parent_payer_address_name',
'vname' => 'LBL_PARENT_NAME',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_nip' => array (
'name' => 'parent_payer_address_nip',
'vname' => 'LBL_PARENT_NIP',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_street' => array (
'name' => 'parent_payer_address_street',
'vname' => 'LBL_PARENT_ADDRESS_STREET',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_city' => array (
'name' => 'parent_payer_address_city',
'vname' => 'LBL_PARENT_ADDRESS_CITY',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_postalcode' => array (
'name' => 'parent_payer_address_id',
'vname' => 'LBL_PARENT_ADDRESS_POSTALCODE',
'type' => 'varchar',
'len' => '100'
),
'parent_payer_address_country' => array (
'name' => 'parent_payer_address_country',
'vname' => 'LBL_PARENT_ADDRESS_COUNTRY',
'type' => 'varchar',
'len' => '100'
),
'paid_val' => array (
'name' => 'paid_val',
'vname' => 'LBL_PAID',
'type' => 'decimal',
'len' => '15,2',
'required' => false
),
'prepaid' => array (
'name' => 'prepaid',
'vname' => 'LBL_PREPAID',
'type' => 'decimal',
'len' => '15,2',
'required' => false
),
'prepaid_nr' => array (
'name' => 'prepaid_nr',
'vname' => 'LBL_PREPAID_NR',
'type' => 'varchar',
'len' => 100
),
'payment_date_d' => array (
'name' => 'payment_date_d',
'vname' => 'LBL_DAYS',
'type' => 'varchar',
'len' => 5
),
'payment_method' => array (
'name' => 'payment_method',
'vname' => 'LBL_PAYMENT_METHOD',
'type' => 'enum',
'options' => 'payment_method_dom'
),
'payment_method_paid' => array (
'name' => 'payment_method_paid',
'vname' => 'LBL_PAYMENT_METHOD_PAID',
'type' => 'enum',
'options' => 'ecmpaymentconditions_payment_method_dom',
'massupdate' => false
),
'payment_date' => array (
'name' => 'payment_date',
'vname' => 'LBL_PAYMENT_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => false
),
'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
),
'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'
),
'preview_panel' => array (
'name' => 'preview_panel',
'vname' => 'LBL_PREVIEW',
'type' => 'text',
'source' => 'non-db'
),
// FOR SUBPANELS
'account' => array (
'name' => 'account',
'type' => 'link',
'relationship' => 'ecminvoiceouts_account',
'source' => 'non-db',
'vname' => 'LBL_ACCOUNTS'
),
'contact' => array (
'name' => 'contact',
'type' => 'link',
'relationship' => 'ecminvoiceouts_contact',
'source' => 'non-db',
'vname' => 'LBL_CONTACTS'
),
'bugs' => array (
'name' => 'bugs',
'type' => 'link',
'relationship' => 'ecminvoiceouts_bug',
'source' => 'non-db',
'vname' => 'LBL_BUGS'
),
'notes' => array (
'name' => 'notes',
'type' => 'link',
'relationship' => 'ecminvoiceouts_notes',
'source' => 'non-db',
'vname' => 'LBL_NOTES'
),
'emails' => array (
'name' => 'emails',
'type' => 'link',
'relationship' => 'ecminvoiceouts_emails',
'source' => 'non-db',
'vname' => 'LBL_EMAILS'
),
'tasks' => array (
'name' => 'tasks',
'type' => 'link',
'relationship' => 'ecminvoiceouts_task',
'source' => 'non-db',
'vname' => 'LBL_TASKS'
),
'ecmsales' => array (
'name' => 'ecmsales',
'type' => 'link',
'relationship' => 'ecminvoiceout_ecmsales',
'source'=>'non-db',
'vname'=>'LBL_ECMSALES',
),
'ecmstockdocouts' => array (
'name' => 'ecmstockdocouts',
'type' => 'link',
'relationship' => 'ecminvoiceout_ecmstockdocouts',
'source'=>'non-db',
'vname'=>'LBL_ECMSALES',
),
),
// INDICES SECTION
'indices' => array (
array (
'name' => 'ecminvoiceouts' . 'pk',
'type' => 'primary',
'fields' => array (
'id'
)
),
array (
'name' => 'idx_' . 'ecminvoiceouts' . '_document_no',
'type' => 'index',
'fields' => array (
'document_no'
)
)
),
// RELATIONSHIPS SECTION
'relationships' => array (
'ecminvoiceout_ecmsales' => array(
'lhs_module'=> 'EcmSales', 'lhs_table'=> 'ecmsales', 'lhs_key' => 'id',
'rhs_module'=> 'EcmInvoiceOuts', 'rhs_table'=> 'ecminvoiceouts', 'rhs_key' => 'so_id',
'relationship_type'=>'one-to-many'),
'ecminvoiceout_ecmstockdocouts' => array(
'lhs_module'=> 'EcmStockDocOuts', 'lhs_table'=> 'ecmstockdocouts', 'lhs_key' => 'id',
'rhs_module'=> 'EcmInvoiceOuts', 'rhs_table'=> 'ecminvoiceouts', 'rhs_key' => 'wz_id',
'relationship_type'=>'one-to-many'),
'ecminvoiceouts' . '_assigned_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'assigned_user_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceout_documents' => array(
'lhs_module' => 'EcmInvoiceOuts',
'lhs_table' => 'ecminvoiceouts',
'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',
),
'ecminvoiceouts' . '_modified_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_created_by' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_account' => array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_contact' => array (
'lhs_module' => 'Contacts',
'lhs_table' => 'contacts',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'contact_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_project' => array (
'lhs_module' => 'Project',
'lhs_table' => 'project',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_bug' => array (
'lhs_module' => 'Bugs',
'lhs_table' => 'bugs',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts_notes' => array (
'lhs_module' => 'EcmInvoiceOuts',
'lhs_table' => 'ecminvoiceouts',
'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' => 'EcmInvoiceOuts'
),
'ecminvoiceouts' . '_case' => array (
'lhs_module' => 'Cases',
'lhs_table' => 'cases',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecminvoiceouts' . '_task' => array (
'lhs_module' => 'Tasks',
'lhs_table' => 'tasks',
'lhs_key' => 'id',
'rhs_module' => 'EcmInvoiceOuts',
'rhs_table' => 'ecminvoiceouts',
'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 ViewEditEcmInvoiceOuts 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 ViewEditEcmInvoiceOuts(){
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,251 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Calls module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class EcmInvoiceOutsViewList extends ViewList{
function EcmInvoiceOutsViewList(){
parent::ViewList();
}
function display(){
if(!$this->bean->ACLAccess('list')){
ACLController::displayNoAccess();
return;
}
$this->module=$module = "EcmInvoiceOuts";
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
require_once('modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}
}
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
}
require_once($metadataFile);
if(!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
if(empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query']!='true')) {
$this->saved_search = loadBean('SavedSearch');
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
$this->saved_search->populateRequest();
}
elseif(!empty($_REQUEST['button'])) { // click the search button, after retrieving from saved_search
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
unset($_REQUEST['saved_search_select']);
unset($_REQUEST['saved_search_select_name']);
}
}
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery($this->module);
$storeQuery->populateRequest();
}else{
$storeQuery->saveFromRequest($this->module);
}
$seed = $this->bean;
$lv = new ListViewSmarty();
$displayColumns = array();
if(!empty($_REQUEST['displayColumns'])) {
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if(!empty($listViewDefs[$module][$col]))
$displayColumns[$col] = $listViewDefs[$module][$col];
}
}
else {
foreach($listViewDefs[$module] as $col => $params) {
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
}
$params = array('massupdate' => true, 'export'=>false);
$lv->quickViewLinks = false;
$lv->export = false;
$lv->mergeduplicates = false;
if(!empty($_REQUEST['orderBy'])) {
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$lv->displayColumns = $displayColumns;
$this->seed = $seed;
$this->module = $module;
$searchForm = null;
//search
$view = 'basic_search';
if(!empty($_REQUEST['search_form_view']))
$view = $_REQUEST['search_form_view'];
$headers = true;
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only'])
$headers = false;
elseif(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$view = 'advanced_search';
}else {
$view = 'basic_search';
}
}
$use_old_search = true;
if(file_exists('modules/'.$this->module.'/SearchForm.html')){
require_once('include/SearchForm/SearchForm.php');
$searchForm = new SearchForm($this->module, $this->seed);
}else{
$use_old_search = false;
require_once('include/SearchForm/SearchForm2.php');
if(!empty($metafiles[$this->module]['searchdefs']))
require_once($metafiles[$this->module]['searchdefs']);
elseif(file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
if (file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
}
elseif (!empty($metafiles[$this->module]['searchdefs']))
{
require_once($metafiles[$this->module]['searchdefs']);
}
elseif (file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
}
if(!empty($metafiles[$this->module]['searchfields']))
require_once($metafiles[$this->module]['searchfields']);
elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php'))
require_once('modules/'.$this->module.'/metadata/SearchFields.php');
$searchForm = new SearchForm($this->seed, $this->module, $this->action);
$searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', $view, $listViewDefs);
$searchForm->lv = $lv;
}
if(isset($this->options['show_title']) && $this->options['show_title'] && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true")) {
$moduleName = isset($this->seed->module_dir) ? $this->seed->module_dir : $GLOBALS['mod_strings']['LBL_MODULE_NAME'];
echo "\n<p>\n";
echo get_module_title($moduleName, $GLOBALS['mod_strings']['LBL_MODULE_TITLE'], true);
echo "\n</p>\n";
}
$where = '';
if(isset($_REQUEST['query']))
{
// we have a query
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
$searchForm->populateFromArray($storeQuery->query);
}
else {
$searchForm->populateFromRequest();
}
$where_clauses = $searchForm->generateSearchWhere(true, $this->seed->module_dir);
if (count($where_clauses) > 0 )$where = '('. implode(' ) AND ( ', $where_clauses) . ')';
$GLOBALS['log']->info("List View Where Clause: $where");
}
if($use_old_search){
switch($view) {
case 'basic_search':
$searchForm->setup();
$searchForm->displayBasic($headers);
break;
case 'advanced_search':
$searchForm->setup();
$searchForm->displayAdvanced($headers);
break;
case 'saved_views':
echo $searchForm->displaySavedViews($listViewDefs, $lv, $headers);
break;
}
}else{
echo $searchForm->display($headers);
}
if(!$headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
// $this->processQuickSearch();
$lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where, $params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
echo $lv->display();
}
}
}
?>