[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.uipricebook.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.uipricebook.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 16:57:55 -0000 |
Update of /property
Modified Files:
Branch:
class.uipricebook.php
date: 2004/04/23 21:26:34; author: sigurdne; state: Exp; lines: +1346 -1346
Log Message:
no message
=====================================================================
Index: property/class.uipricebook.php
diff -u property/class.uipricebook.php:1.1.1.2
property/class.uipricebook.php:1.1.1.3
--- property/class.uipricebook.php:1.1.1.2 Fri Apr 23 20:26:47 2004
+++ property/class.uipricebook.php Fri Apr 23 21:26:34 2004
@@ -1,1346 +1,1346 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by the
*
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
-
- class property_uipricebook
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'activity' => True,
- 'index' => True,
- 'agreement' => True,
- 'edit_agreement' => True,
- 'edit_activity' => True,
- 'activity_vendor' => True,
- 'prizing' => True,
- 'delete' => True,
- 'excel' => True,
- 'excel_2' => True
- );
-
- function property_uipricebook()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-
- $this->bo =
CreateObject($this->currentapp.'_bopricebook',True);
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->menu =
CreateObject($this->currentapp.'_menu');
- $this->contacts =
CreateObject('phpgwapi_contacts');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- $this->acl2 =
$GLOBALS['phpgw']->acl;
- $this->acl2_location = '.pricebook';
- $this->acl_read =
$this->acl2->check('.pricebook',1);
- $this->acl_add =
$this->acl2->check('.pricebook',2);
- $this->acl_edit =
$this->acl2->check('.pricebook',4);
- $this->acl_delete =
$this->acl2->check('.pricebook',8);
- $this->acl_manage =
$this->acl2->check('.pricebook',16);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='pricebook';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
-
- function excel()
- {
-
- $list = $this->bo->read();
-
- $name =
array('num','branch','vendor_id','m_cost','w_cost','total_cost','this_index','unit','descr','index_count');
- $descr = array(lang('Activity Num'),
-
lang('Branch'),
-
lang('Vendor'),
-
lang('Material cost'),
-
lang('Labour cost'),
-
lang('Total Cost'),
-
lang('Last index'),
-
lang('Unit'),
-
lang('Description'),
-
lang('Index Count')
- );
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$this->fm_session->appsession('referer',$this->currentapp,'');
-
- $this->bocommon->xsl_add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('price_vendor');
-
- $values =
get_var('values',array('POST'));
- $values['date'] = get_var('date',array('POST'));
-
-//html_print_r($values);
- if($values['submit_update'])
- {
- $receipt=$this->bo->update_pricebook($values);
- }
-
-
- $pricebook_list = $this->bo->read();
-
- $i=0;
- if (isSet($pricebook_list) AND
is_array($pricebook_list))
- {
- foreach($pricebook_list as $pricebook)
- {
- if($this->acl_manage)
- {
- $link_edit
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id']);
- $link_prizing
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']
.'&cat_id=' .$this->cat_id);
- $lang_edit_statustext
= lang('edit the pricebook');
- $lang_prizing_statustext
= lang('view or edit prizing history of this element');
- $text_edit
= lang('edit');
- $text_prizing
= lang('prizing');
- }
-
- $content[] = array
- (
- 'counter'
=> $i,
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'vendor_id'
=> $pricebook['vendor_id'],
- 'm_cost'
=> $pricebook['m_cost'],
- 'w_cost'
=> $pricebook['w_cost'],
- 'total_cost'
=> $pricebook['total_cost'],
- 'this_index'
=> $pricebook['this_index'],
- 'unit'
=> $pricebook['unit'],
- 'descr'
=> $pricebook['descr'],
- 'index_count'
=> $pricebook['index_count'],
- 'link_edit'
=> $link_edit,
- 'link_prizing'
=> $link_prizing,
- 'lang_edit_statustext'
=> $lang_edit_statustext,
- 'lang_prizing_statustext'
=> $lang_prizing_statustext,
- 'text_edit'
=> $text_edit,
- 'text_prizing'
=> $text_prizing
- );
-
- $i++;
- }
- }
-
- $table_header[] = array
- (
- 'sort_num' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_index_count' => lang('Index Count'),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_select' => lang('Select'),
- 'lang_total_cost' => lang('Total Cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_last_index' => lang('Last index'),
- 'lang_descr' => lang('Description'),
- 'lang_m_cost' => lang('Material
cost'),
- 'lang_w_cost' => lang('Labour cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_unit' => lang('Unit'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'sort_total_cost' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'total_cost',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
))
- );
-
-
- if($this->acl_manage)
- {
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_new_index'
=> lang('New index'),
- 'lang_new_index_statustext' =>
lang('Enter a new index'),
- 'lang_date_statustext' =>
lang('Select the date for the update'),
- 'lang_update'
=> lang('Update'),
- 'lang_update_statustext' =>
lang('update selected investments')
- );
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_excel = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'allrows'
=>$this->allrows,
- 'start' =>$this->start
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the pricebook belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->get_vendor_list('filter',$this->cat_id),
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.index')
);
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list pricebook per vendor');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list' => $data);
- }
-
- function agreement()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$this->fm_session->appsession('referer',$this->currentapp,'');
-
- $this->bocommon->xsl_add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('agreement');
-
- $agreement_list = $this->bo->read_agreement();
-
- while (is_array($agreement_list) && list(,$agreement) =
each($agreement_list))
- {
- $content[] = array
- (
- 'agreement_id'
=> $agreement['agreement_id'],
- 'num'
=> $agreement['num'],
- 'status'
=> lang($agreement['status']),
- 'descr'
=> $agreement['descr'],
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_agreement&agreement_id='
. $agreement['agreement_id']),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=agreement&agreement_id='
. $agreement['agreement_id'] .'&start=' . $this->start),
- 'lang_edit_statustext' =>
lang('edit the agreement'),
- 'lang_delete_statustext' =>
lang('Delete this agreement'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'lang_id' => lang('ID'),
- 'sort_num' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_delete' => lang('Delete'),
- 'lang_descr' => lang('Description'),
- 'lang_edit' => lang('edit')
- );
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add an
activity'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_agreement')
- );
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $data = array
- (
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($agreement_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'cat_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->cat_id),
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_agreement' =>
$table_header,
- 'values_agreement'
=> $content,
- 'table_add'
=> $table_add,
- 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.agreement')
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list agreement');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('agreement' => $data);
- }
-
- function edit_agreement()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $agreement_id =
get_var('agreement_id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
-
- if(!$values['cat_id'])
- {
- $values['cat_id'] = $agreement;
- }
-
- $this->bocommon->xsl_add_file(array('pricebook'));
-
- if ($values['save'])
- {
- if(!$values['num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an agreement code !'));
- $error_id=true;
- }
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
-
-
- if($values['num'] && !$agreement_id)
- {
-
if($this->bo->check_agreement_num($values['num']))
- {
-
$receipt['error'][]=array('msg'=>lang('This agreement code is already
registered!') . '[ '.$values['num'] .' ]');
- $error_id=true;
- }
- }
-
- if($agreement_id)
- {
- $action='edit';
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_agreement($values,$action);
- if(!$agreement_id)
- {
-
$agreement_id=$receipt['agreement_id'];
- }
-
- }
-
- if($agreement_id)
- {
- $values['agreement_id']=$agreement_id;
- $action='edit';
- }
- else
- {
- $agreement_id = $values['agreement_id'];
- }
- }
- else
- {
- $values['agreement_id']= $agreement_id;
- if($agreement_id)
- {
- $values =
$this->bo->read_single_agreement($agreement_id);
- }
- }
-
-//html_print_r($values);
- if ($agreement_id)
- {
- $function_msg = lang('edit agreement');
- }
- else
- {
- $function_msg = lang('add agreement');
- }
-
- if ($values['cat_id'] > 0)
- {
- $this->cat_id = $values['cat_id'];
- }
-
- if($error_id)
- {
- unset($values['num']);
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.edit_agreement',
- 'agreement_id' => $agreement_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.agreement'),
- 'lang_agreement_id'
=> lang('Agreement ID'),
- 'lang_num'
=> lang('Agreement code'),
- 'lang_status'
=> lang('Status'),
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'select_status_name' =>
'values[status]',
- 'lang_no_status'
=> lang('Select status'),
-
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'value_agreement_id' =>
$values['agreement_id'],
- 'value_num'
=> $values['num'],
- 'value_descr'
=> $values['descr'],
- 'lang_num_statustext' =>
lang('A unique code for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
- 'lang_descr_statustext' =>
lang('Enter the description for this activity')
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('edit_agreement' => $data);
- }
-
-
- function prizing()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $this->bocommon->xsl_add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links();
-
- $cat_id =
get_var('cat_id',array('GET'));
- $activity_id =
get_var('activity_id',array('GET'));
- $vendor_id =
get_var('vendor_id',array('GET'));
- $values =
get_var('values',array('POST'));
- $values['date'] = get_var('date',array('POST'));
-
-
- $referer =
$this->fm_session->appsession('referer',$this->currentapp);
- if(!$referer)
- {
- $referer =
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ?
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
- $referer = $referer . '&cat_id=' . $cat_id;
-
$this->fm_session->appsession('referer',$this->currentapp,$referer);
- }
-
- if($values['submit_update'])
- {
- if(!$values['date'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
- }
-
- if(!$values['new_index'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please enter a new index for calkulating next value(s)!'));
- }
-
- if(!$receipt['error'])
- {
-
$receipt=$this->bo->update_pricebook($values);
- }
- }
-
- if($values['submit_add'])
- {
- if(!$values['date'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
- }
-
- if(!$values['m_cost'] && !$values['w_cost'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please enter a value for either material cost, labour cost
or both !'));
- }
-
- if(!$receipt['error'])
- {
-
$receipt=$this->bo->add_activity_first_prize($values);
- }
- }
-
-
- $pricebook_list =
$this->bo->read_activity_prize($activity_id,$vendor_id);
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- if (isSet($pricebook_list) AND
is_array($pricebook_list))
- {
- foreach($pricebook_list as $pricebook)
- {
-
- if($pricebook['current_index'])
- {
- $link_delete =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=prize&activity_id='
. $activity_id .'&vendor_id=' . $vendor_id .'&index_count=' .
$pricebook['index_count']);
- $value_m_cost =
$pricebook['m_cost'];
- $value_w_cost =
$pricebook['w_cost'];
- $value_total_cost =
$pricebook['total_cost'];
- }
-
- $content[] = array
- (
- 'm_cost'
=> $pricebook['m_cost'],
- 'w_cost'
=> $pricebook['w_cost'],
- 'total_cost'
=> $pricebook['total_cost'],
- 'this_index'
=> $pricebook['this_index'],
- 'date'
=>
$GLOBALS['phpgw']->common->show_date($pricebook['date'],$dateformat),
- 'current_index'
=> $pricebook['current_index'],
- 'index_count'
=> $pricebook['index_count'],
- 'link_delete'
=> $link_delete,
- 'lang_delete_statustext'
=> lang('Delete this entry'),
- 'text_delete'
=> lang('delete'),
- );
- }
- }
-
-//html_print_r($content);
- $table_header[] = array
- (
- 'lang_index_count' => lang('Index Count'),
- 'lang_total_cost' => lang('Total Cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_last_index' => lang('Last index'),
- 'lang_m_cost' => lang('Material
cost'),
- 'lang_w_cost' => lang('Labour cost'),
- 'lang_date' => lang('Date'),
- 'lang_delete' => lang('Delete')
- );
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'jsDateFormat' =>
$jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle' =>
lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
- $table_first_entry[] = array
- (
- 'jsDateFormat' =>
$jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle' =>
lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_m_cost' =>
lang('Material cost'),
- 'lang_m_cost_statustext' => lang('Enter
a value for the material cost'),
- 'lang_w_cost' =>
lang('Labour cost'),
- 'lang_w_cost_statustext' => lang('Enter
a value for the labour cost'),
- 'lang_date'
=> lang('Date'),
- 'lang_date_statustext' => lang('Select
the date for the first value'),
- 'lang_add' =>
lang('Add'),
- 'lang_add_statustext' => lang('Add first
value for this prizing')
- );
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.prizing',
- 'activity_id' =>$activity_id,
- 'vendor_id'
=>$vendor_id
- );
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $num_records = count($pricebook_list);
-
-
- $vendor_data =
$this->contacts->read_single_entry($vendor_id,array('org_name'=>'org_name'));
- $activity =
$this->bo->read_single_activity($activity_id);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action'
=> $referer,
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> $num_records,
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_vendor'
=> lang('Vendor'),
- 'lang_activity'
=> lang('Activity'),
-
- 'value_vendor_name'
=> $vendor_data[0]['org_name'],
- 'value_activity_id'
=> $activity_id,
- 'value_activity_code' =>
$activity['num'],
- 'value_vendor_id'
=> $vendor_id,
- 'value_m_cost'
=> $value_m_cost,
- 'value_w_cost'
=> $value_w_cost,
- 'value_total_cost'
=> $value_total_cost,
- 'table_header_prizing' =>
$table_header,
- 'values_prizing'
=> $content,
- 'table_update'
=> $table_update,
- 'table_first_entry'
=> $table_first_entry,
- 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $activity_id . '&vendor_id=' . $vendor_id)
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('edit pricing');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('prizing' => $data);
- }
-
-
- function excel_2()
- {
-
- $list = $this->bo->read_activities_pr_aggreement();
-
- $name = array(
- 'activity_id',
- 'base_descr',
- 'num',
- 'descr',
- // 'branch',
- // 'dim_d',
- 'ns3420',
- 'unit',
- );
-
- $descr = array(
- 'ID',
- lang('Base'),
- lang('Activity Num'),
- lang('Description'),
- // lang('Branch'),
- // lang('Dim d'),
- lang('NS3420'),
- lang('Unit'),
- );
-
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function activity()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $this->bocommon->xsl_add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('activity');
-
- $pricebook_list =
$this->bo->read_activities_pr_aggreement();
-//html_print_r($pricebook_list);
- while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
- {
- $content[] = array
- (
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'base_descr'
=> $pricebook['base_descr'],
- 'dim_d'
=> $pricebook['dim_d'],
- 'ns3420'
=> $pricebook['ns3420'],
- 'unit'
=> $pricebook['unit'],
- 'descr'
=> $pricebook['descr'],
- 'link_vendor'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity_vendor&activity_id='
. $pricebook['activity_id'].'&agreement=' . $this->cat_id),
- 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id'].'&agreement=' . $this->cat_id),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=activity&activity_id='
. $pricebook['activity_id']),
- 'lang_vendor_statustext' =>
lang('view the vendor(s) for this activity'),
- 'lang_edit_statustext' =>
lang('edit this activity'),
- 'lang_delete_statustext' =>
lang('delete this activity'),
- 'text_vendor'
=> lang('vendor'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'sort_num' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_descr' => lang('Description'),
- 'lang_base_descr' => lang('Base'),
- 'lang_dim_d' => lang('Dim d'),
- 'lang_ns3420' => lang('NS3420'),
- 'lang_unit' => lang('Unit'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete')
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add an
activity'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&agreement='
. $this->cat_id)
- );
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_excel = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.excel_2',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'allrows'
=>$this->allrows,
- 'start' =>$this->start
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_no_cat'
=> lang('select agreement'),
- 'lang_cat_statustext' =>
lang('Select the agreement the pricebook belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->get_agreement_list('filter',$this->cat_id),
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_activities' =>
$table_header,
- 'values_activities'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list activities per agreement');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list_activities' => $data);
- }
-
- function activity_vendor()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$this->fm_session->appsession('referer',$this->currentapp,'');
-
- $this->bocommon->xsl_add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('activity');
-
- $activity_id =
get_var('activity_id',array('GET'));
- $values =
get_var('values',array('POST'));
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
-
- if($values['add'])
- {
- if(!$values['vendor_id'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select a vendor!'));
- }
- else
- {
- $receipt =
$this->bo->add_activity_vendor($values);
- }
- }
-
- $pricebook_list =
$this->bo->read_vendor_pr_activity($activity_id);
-
- while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
- {
- $content[] = array
- (
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'vendor_name'
=> $pricebook['vendor_name'],
- 'link_prizing'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
- 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=activity_vendor&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
- 'lang_prizing_statustext' =>
lang('view edit the prize for this activity'),
- 'lang_delete_statustext' =>
lang('delete this vendor from this activity'),
- 'text_prizing'
=> lang('Prizing'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'sort_vendor' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'org_name',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
-
'cat_id'
=>$this->cat_id,
-
'activity_id'
=>$activity_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_delete' => lang('delete')
- );
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
- 'sort' =>
$this->sort,
- 'order' =>
$this->order,
- 'cat_id' =>
$this->cat_id,
- 'filter' =>
$this->filter,
- 'query' =>
$this->query,
- 'activity_id' => $activity_id
- );
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' => ''));
-
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'activity_id'
=> $activity_id,
- 'vendor_data'
=> $vendor_data,
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_no_cat'
=> lang('select agreement'),
- 'lang_cat_statustext' =>
lang('Select the agreement the pricebook belongs to. To do not use a category
select NO CATEGORY'),
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_activity_vendor' =>
$table_header,
- 'values_activity_vendor' =>
$content,
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Add this vendor to this activity'),
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list vendors per activity');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list_activity_vendor' => $data);
- }
-
- function edit_activity()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $activity_id =
get_var('activity_id',array('POST','GET'));
- $agreement = get_var('agreement',array('GET'));
- $values =
get_var('values',array('POST','GET'));
- $values['ns3420_id']=
get_var('ns3420_id',array('POST','GET'));
-
- if(!$values['cat_id'])
- {
- $values['cat_id'] = $agreement;
- }
-
- $this->bocommon->xsl_add_file(array('pricebook'));
-
- if ($values['save'])
- {
- if(!$values['num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an activity code !'));
- $error_id=true;
- }
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select an agreement !'));
- }
-
- if(!$values['branch_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a branch !'));
- }
-
- if($values['num'] && !$activity_id)
- {
-
if($this->bo->check_activity_num($values['num'],$values['cat_id']))
- {
-
$receipt['error'][]=array('msg'=>lang('This activity code is already
registered!') . '[ '.$values['num'] .' ]');
- $error_id=true;
- }
- }
-
- if($activity_id)
- {
- $values['activity_id']=$activity_id;
- $action='edit';
- }
- else
- {
- $activity_id = $values['activity_id'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_activity($values,$action);
- $activity_id= $receipt['activity_id'];
- $values['activity_id']= $activity_id;
- }
-
- }
- else
- {
- $values['activity_id']= $activity_id;
- if($activity_id)
- {
- $values =
$this->bo->read_single_activity($activity_id);
- }
- }
-
-//html_print_r($values);
- if ($activity_id)
- {
- $function_msg = lang('edit activity');
- }
- else
- {
- $function_msg = lang('add activity');
- }
-
- if ($values['cat_id'] > 0)
- {
- $this->cat_id = $values['cat_id'];
- }
-
- if($error_id)
- {
- unset($values['num']);
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.edit_activity',
- 'activity_id' => $activity_id,
- 'agreement' => $agreement
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
- 'lang_activity_id'
=> lang('Activity ID'),
- 'lang_num'
=> lang('Activity code'),
- 'lang_category'
=> lang('Agreement'),
- 'lang_unit'
=> lang('Unit'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'lang_base_descr'
=> lang('Base description'),
- 'value_activity_id'
=> $values['activity_id'],
- 'value_num'
=> $values['num'],
- 'value_general_address' =>
$values['general_address'],
- 'value_access'
=> $values['access'],
- 'value_descr'
=> $values['descr'],
- 'value_base_descr'
=> $values['base_descr'],
- 'lang_num_statustext' =>
lang('A unique code for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
- 'lang_no_cat'
=> lang('Select agreement'),
- 'lang_cat_statustext' =>
lang('Select the agreement this activity belongs to.'),
- 'select_name'
=> 'values[cat_id]',
- 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
- 'lang_base_descr_statustext' => lang('Enter
a description for prerequisitions for this activity - if any'),
- 'cat_list'
=> $this->bo->get_agreement_list('select',$values['cat_id']),
-
- 'lang_dim_d'
=> lang('Dim D'),
- 'dim_d_list'
=> $this->bo->get_dim_d_list($values['dim_d']),
- 'select_dim_d'
=> 'values[dim_d]',
- 'lang_no_dim_d'
=> lang('No Dim D'),
- 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
-
- 'lang_unit'
=> lang('Unit'),
- 'unit_list'
=> $this->bo->get_unit_list($values['unit']),
- 'select_unit'
=> 'values[unit]',
- 'lang_no_unit'
=> lang('Select Unit'),
- 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
-
- 'lang_branch'
=> lang('Branch'),
- 'branch_list'
=> $this->bo->get_branch_list($values['branch_id']),
- 'select_branch'
=> 'values[branch_id]',
- 'lang_no_branch'
=> lang('Select branch'),
- 'lang_branch_statustext' =>
lang('Select the branch for this activity.'),
-
- 'ns3420_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uilookup.ns3420'),
- 'lang_ns3420'
=> lang('NS3420'),
- 'value_ns3420_id'
=> $values['ns3420_id'],
- 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('edit_activity' => $data);
- }
-
- function delete()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $method =
get_var('method',array('GET'));
- $activity_id = get_var('activity_id',array('GET'));
- $vendor_id =
get_var('vendor_id',array('GET'));
- $index_count = get_var('index_count',array('GET'));
- $agreement_id = get_var('agreement_id',array('GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- if($method=='activity_vendor')
- {
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
- 'activity_id' => $activity_id
- );
-
- $function_msg =lang('delete vendor activity');
- $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_activity_vendor($activity_id,$vendor_id);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
- }
- elseif($method=='activity')
- {
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity'
- );
-
- $function_msg =lang('delete activity');
- $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_activity($activity_id);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
- }
- elseif($method=='prize')
- {
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.prizing',
- 'activity_id' => $activity_id,
- 'vendor_id' => $vendor_id
- );
-
- $function_msg =lang('delete prize-index');
- $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id .
'&index_count=' . $index_count);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_prize_index($activity_id,$vendor_id,$index_count);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
- }
- elseif($method=='agreement')
- {
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
- 'start' => $this->start
- );
-
- $function_msg =lang('Delete agreement and all
the activities associated with it!');
- $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&agreement_id=' . $agreement_id . '&start=' . $this->start);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_agreement($agreement_id);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
- }
-
- $this->bocommon->xsl_add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
- 'delete_action' =>
$delete_action,
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('delete' => $data);
- }
-
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ class property_uipricebook
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'activity' => True,
+ 'index' => True,
+ 'agreement' => True,
+ 'edit_agreement' => True,
+ 'edit_activity' => True,
+ 'activity_vendor' => True,
+ 'prizing' => True,
+ 'delete' => True,
+ 'excel' => True,
+ 'excel_2' => True
+ );
+
+ function property_uipricebook()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+
+ $this->bo =
CreateObject($this->currentapp.'_bopricebook',True);
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->menu =
CreateObject($this->currentapp.'_menu');
+ $this->contacts =
CreateObject('phpgwapi_contacts');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ $this->acl2 =
$GLOBALS['phpgw']->acl;
+ $this->acl2_location = '.pricebook';
+ $this->acl_read =
$this->acl2->check('.pricebook',1);
+ $this->acl_add =
$this->acl2->check('.pricebook',2);
+ $this->acl_edit =
$this->acl2->check('.pricebook',4);
+ $this->acl_delete =
$this->acl2->check('.pricebook',8);
+ $this->acl_manage =
$this->acl2->check('.pricebook',16);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='pricebook';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+
+ function excel()
+ {
+
+ $list = $this->bo->read();
+
+ $name =
array('num','branch','vendor_id','m_cost','w_cost','total_cost','this_index','unit','descr','index_count');
+ $descr = array(lang('Activity Num'),
+
lang('Branch'),
+
lang('Vendor'),
+
lang('Material cost'),
+
lang('Labour cost'),
+
lang('Total Cost'),
+
lang('Last index'),
+
lang('Unit'),
+
lang('Description'),
+
lang('Index Count')
+ );
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$this->fm_session->appsession('referer',$this->currentapp,'');
+
+ $this->bocommon->xsl_add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('price_vendor');
+
+ $values =
get_var('values',array('POST'));
+ $values['date'] = get_var('date',array('POST'));
+
+//html_print_r($values);
+ if($values['submit_update'])
+ {
+ $receipt=$this->bo->update_pricebook($values);
+ }
+
+
+ $pricebook_list = $this->bo->read();
+
+ $i=0;
+ if (isSet($pricebook_list) AND
is_array($pricebook_list))
+ {
+ foreach($pricebook_list as $pricebook)
+ {
+ if($this->acl_manage)
+ {
+ $link_edit
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id']);
+ $link_prizing
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']
.'&cat_id=' .$this->cat_id);
+ $lang_edit_statustext
= lang('edit the pricebook');
+ $lang_prizing_statustext
= lang('view or edit prizing history of this element');
+ $text_edit
= lang('edit');
+ $text_prizing
= lang('prizing');
+ }
+
+ $content[] = array
+ (
+ 'counter'
=> $i,
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'vendor_id'
=> $pricebook['vendor_id'],
+ 'm_cost'
=> $pricebook['m_cost'],
+ 'w_cost'
=> $pricebook['w_cost'],
+ 'total_cost'
=> $pricebook['total_cost'],
+ 'this_index'
=> $pricebook['this_index'],
+ 'unit'
=> $pricebook['unit'],
+ 'descr'
=> $pricebook['descr'],
+ 'index_count'
=> $pricebook['index_count'],
+ 'link_edit'
=> $link_edit,
+ 'link_prizing'
=> $link_prizing,
+ 'lang_edit_statustext'
=> $lang_edit_statustext,
+ 'lang_prizing_statustext'
=> $lang_prizing_statustext,
+ 'text_edit'
=> $text_edit,
+ 'text_prizing'
=> $text_prizing
+ );
+
+ $i++;
+ }
+ }
+
+ $table_header[] = array
+ (
+ 'sort_num' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_index_count' => lang('Index Count'),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_select' => lang('Select'),
+ 'lang_total_cost' => lang('Total Cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_last_index' => lang('Last index'),
+ 'lang_descr' => lang('Description'),
+ 'lang_m_cost' => lang('Material
cost'),
+ 'lang_w_cost' => lang('Labour cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'sort_total_cost' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'total_cost',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
))
+ );
+
+
+ if($this->acl_manage)
+ {
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_new_index'
=> lang('New index'),
+ 'lang_new_index_statustext' =>
lang('Enter a new index'),
+ 'lang_date_statustext' =>
lang('Select the date for the update'),
+ 'lang_update'
=> lang('Update'),
+ 'lang_update_statustext' =>
lang('update selected investments')
+ );
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_excel = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'allrows'
=>$this->allrows,
+ 'start' =>$this->start
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the pricebook belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->get_vendor_list('filter',$this->cat_id),
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.index')
);
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list pricebook per vendor');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list' => $data);
+ }
+
+ function agreement()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$this->fm_session->appsession('referer',$this->currentapp,'');
+
+ $this->bocommon->xsl_add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('agreement');
+
+ $agreement_list = $this->bo->read_agreement();
+
+ while (is_array($agreement_list) && list(,$agreement) =
each($agreement_list))
+ {
+ $content[] = array
+ (
+ 'agreement_id'
=> $agreement['agreement_id'],
+ 'num'
=> $agreement['num'],
+ 'status'
=> lang($agreement['status']),
+ 'descr'
=> $agreement['descr'],
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_agreement&agreement_id='
. $agreement['agreement_id']),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=agreement&agreement_id='
. $agreement['agreement_id'] .'&start=' . $this->start),
+ 'lang_edit_statustext' =>
lang('edit the agreement'),
+ 'lang_delete_statustext' =>
lang('Delete this agreement'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'lang_id' => lang('ID'),
+ 'sort_num' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_delete' => lang('Delete'),
+ 'lang_descr' => lang('Description'),
+ 'lang_edit' => lang('edit')
+ );
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add an
activity'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_agreement')
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($agreement_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'cat_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->cat_id),
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_agreement' =>
$table_header,
+ 'values_agreement'
=> $content,
+ 'table_add'
=> $table_add,
+ 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.agreement')
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list agreement');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('agreement' => $data);
+ }
+
+ function edit_agreement()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $agreement_id =
get_var('agreement_id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+
+ if(!$values['cat_id'])
+ {
+ $values['cat_id'] = $agreement;
+ }
+
+ $this->bocommon->xsl_add_file(array('pricebook'));
+
+ if ($values['save'])
+ {
+ if(!$values['num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an agreement code !'));
+ $error_id=true;
+ }
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+
+
+ if($values['num'] && !$agreement_id)
+ {
+
if($this->bo->check_agreement_num($values['num']))
+ {
+
$receipt['error'][]=array('msg'=>lang('This agreement code is already
registered!') . '[ '.$values['num'] .' ]');
+ $error_id=true;
+ }
+ }
+
+ if($agreement_id)
+ {
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_agreement($values,$action);
+ if(!$agreement_id)
+ {
+
$agreement_id=$receipt['agreement_id'];
+ }
+
+ }
+
+ if($agreement_id)
+ {
+ $values['agreement_id']=$agreement_id;
+ $action='edit';
+ }
+ else
+ {
+ $agreement_id = $values['agreement_id'];
+ }
+ }
+ else
+ {
+ $values['agreement_id']= $agreement_id;
+ if($agreement_id)
+ {
+ $values =
$this->bo->read_single_agreement($agreement_id);
+ }
+ }
+
+//html_print_r($values);
+ if ($agreement_id)
+ {
+ $function_msg = lang('edit agreement');
+ }
+ else
+ {
+ $function_msg = lang('add agreement');
+ }
+
+ if ($values['cat_id'] > 0)
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ if($error_id)
+ {
+ unset($values['num']);
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.edit_agreement',
+ 'agreement_id' => $agreement_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.agreement'),
+ 'lang_agreement_id'
=> lang('Agreement ID'),
+ 'lang_num'
=> lang('Agreement code'),
+ 'lang_status'
=> lang('Status'),
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'select_status_name' =>
'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'value_agreement_id' =>
$values['agreement_id'],
+ 'value_num'
=> $values['num'],
+ 'value_descr'
=> $values['descr'],
+ 'lang_num_statustext' =>
lang('A unique code for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity')
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit_agreement' => $data);
+ }
+
+
+ function prizing()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $this->bocommon->xsl_add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links();
+
+ $cat_id =
get_var('cat_id',array('GET'));
+ $activity_id =
get_var('activity_id',array('GET'));
+ $vendor_id =
get_var('vendor_id',array('GET'));
+ $values =
get_var('values',array('POST'));
+ $values['date'] = get_var('date',array('POST'));
+
+
+ $referer =
$this->fm_session->appsession('referer',$this->currentapp);
+ if(!$referer)
+ {
+ $referer =
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ?
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
+ $referer = $referer . '&cat_id=' . $cat_id;
+
$this->fm_session->appsession('referer',$this->currentapp,$referer);
+ }
+
+ if($values['submit_update'])
+ {
+ if(!$values['date'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
+ }
+
+ if(!$values['new_index'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please enter a new index for calkulating next value(s)!'));
+ }
+
+ if(!$receipt['error'])
+ {
+
$receipt=$this->bo->update_pricebook($values);
+ }
+ }
+
+ if($values['submit_add'])
+ {
+ if(!$values['date'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
+ }
+
+ if(!$values['m_cost'] && !$values['w_cost'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please enter a value for either material cost, labour cost
or both !'));
+ }
+
+ if(!$receipt['error'])
+ {
+
$receipt=$this->bo->add_activity_first_prize($values);
+ }
+ }
+
+
+ $pricebook_list =
$this->bo->read_activity_prize($activity_id,$vendor_id);
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ if (isSet($pricebook_list) AND
is_array($pricebook_list))
+ {
+ foreach($pricebook_list as $pricebook)
+ {
+
+ if($pricebook['current_index'])
+ {
+ $link_delete =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=prize&activity_id='
. $activity_id .'&vendor_id=' . $vendor_id .'&index_count=' .
$pricebook['index_count']);
+ $value_m_cost =
$pricebook['m_cost'];
+ $value_w_cost =
$pricebook['w_cost'];
+ $value_total_cost =
$pricebook['total_cost'];
+ }
+
+ $content[] = array
+ (
+ 'm_cost'
=> $pricebook['m_cost'],
+ 'w_cost'
=> $pricebook['w_cost'],
+ 'total_cost'
=> $pricebook['total_cost'],
+ 'this_index'
=> $pricebook['this_index'],
+ 'date'
=>
$GLOBALS['phpgw']->common->show_date($pricebook['date'],$dateformat),
+ 'current_index'
=> $pricebook['current_index'],
+ 'index_count'
=> $pricebook['index_count'],
+ 'link_delete'
=> $link_delete,
+ 'lang_delete_statustext'
=> lang('Delete this entry'),
+ 'text_delete'
=> lang('delete'),
+ );
+ }
+ }
+
+//html_print_r($content);
+ $table_header[] = array
+ (
+ 'lang_index_count' => lang('Index Count'),
+ 'lang_total_cost' => lang('Total Cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_last_index' => lang('Last index'),
+ 'lang_m_cost' => lang('Material
cost'),
+ 'lang_w_cost' => lang('Labour cost'),
+ 'lang_date' => lang('Date'),
+ 'lang_delete' => lang('Delete')
+ );
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'jsDateFormat' =>
$jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle' =>
lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+ $table_first_entry[] = array
+ (
+ 'jsDateFormat' =>
$jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle' =>
lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_m_cost' =>
lang('Material cost'),
+ 'lang_m_cost_statustext' => lang('Enter
a value for the material cost'),
+ 'lang_w_cost' =>
lang('Labour cost'),
+ 'lang_w_cost_statustext' => lang('Enter
a value for the labour cost'),
+ 'lang_date'
=> lang('Date'),
+ 'lang_date_statustext' => lang('Select
the date for the first value'),
+ 'lang_add' =>
lang('Add'),
+ 'lang_add_statustext' => lang('Add first
value for this prizing')
+ );
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.prizing',
+ 'activity_id' =>$activity_id,
+ 'vendor_id'
=>$vendor_id
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $num_records = count($pricebook_list);
+
+
+ $vendor_data =
$this->contacts->read_single_entry($vendor_id,array('org_name'=>'org_name'));
+ $activity =
$this->bo->read_single_activity($activity_id);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'done_action'
=> $referer,
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> $num_records,
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_vendor'
=> lang('Vendor'),
+ 'lang_activity'
=> lang('Activity'),
+
+ 'value_vendor_name'
=> $vendor_data[0]['org_name'],
+ 'value_activity_id'
=> $activity_id,
+ 'value_activity_code' =>
$activity['num'],
+ 'value_vendor_id'
=> $vendor_id,
+ 'value_m_cost'
=> $value_m_cost,
+ 'value_w_cost'
=> $value_w_cost,
+ 'value_total_cost'
=> $value_total_cost,
+ 'table_header_prizing' =>
$table_header,
+ 'values_prizing'
=> $content,
+ 'table_update'
=> $table_update,
+ 'table_first_entry'
=> $table_first_entry,
+ 'update_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $activity_id . '&vendor_id=' . $vendor_id)
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('edit pricing');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('prizing' => $data);
+ }
+
+
+ function excel_2()
+ {
+
+ $list = $this->bo->read_activities_pr_aggreement();
+
+ $name = array(
+ 'activity_id',
+ 'base_descr',
+ 'num',
+ 'descr',
+ // 'branch',
+ // 'dim_d',
+ 'ns3420',
+ 'unit',
+ );
+
+ $descr = array(
+ 'ID',
+ lang('Base'),
+ lang('Activity Num'),
+ lang('Description'),
+ // lang('Branch'),
+ // lang('Dim d'),
+ lang('NS3420'),
+ lang('Unit'),
+ );
+
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function activity()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $this->bocommon->xsl_add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('activity');
+
+ $pricebook_list =
$this->bo->read_activities_pr_aggreement();
+//html_print_r($pricebook_list);
+ while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
+ {
+ $content[] = array
+ (
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'base_descr'
=> $pricebook['base_descr'],
+ 'dim_d'
=> $pricebook['dim_d'],
+ 'ns3420'
=> $pricebook['ns3420'],
+ 'unit'
=> $pricebook['unit'],
+ 'descr'
=> $pricebook['descr'],
+ 'link_vendor'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity_vendor&activity_id='
. $pricebook['activity_id'].'&agreement=' . $this->cat_id),
+ 'link_edit'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id'].'&agreement=' . $this->cat_id),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=activity&activity_id='
. $pricebook['activity_id']),
+ 'lang_vendor_statustext' =>
lang('view the vendor(s) for this activity'),
+ 'lang_edit_statustext' =>
lang('edit this activity'),
+ 'lang_delete_statustext' =>
lang('delete this activity'),
+ 'text_vendor'
=> lang('vendor'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_num' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_descr' => lang('Description'),
+ 'lang_base_descr' => lang('Base'),
+ 'lang_dim_d' => lang('Dim d'),
+ 'lang_ns3420' => lang('NS3420'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete')
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add an
activity'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.edit_activity&agreement='
. $this->cat_id)
+ );
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_excel = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.excel_2',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'allrows'
=>$this->allrows,
+ 'start' =>$this->start
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_no_cat'
=> lang('select agreement'),
+ 'lang_cat_statustext' =>
lang('Select the agreement the pricebook belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->get_agreement_list('filter',$this->cat_id),
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'filter_list'
=> $this->bocommon->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_activities' =>
$table_header,
+ 'values_activities'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list activities per agreement');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list_activities' => $data);
+ }
+
+ function activity_vendor()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$this->fm_session->appsession('referer',$this->currentapp,'');
+
+ $this->bocommon->xsl_add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('activity');
+
+ $activity_id =
get_var('activity_id',array('GET'));
+ $values =
get_var('values',array('POST'));
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+
+ if($values['add'])
+ {
+ if(!$values['vendor_id'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select a vendor!'));
+ }
+ else
+ {
+ $receipt =
$this->bo->add_activity_vendor($values);
+ }
+ }
+
+ $pricebook_list =
$this->bo->read_vendor_pr_activity($activity_id);
+
+ while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
+ {
+ $content[] = array
+ (
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'vendor_name'
=> $pricebook['vendor_name'],
+ 'link_prizing'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
+ 'link_delete'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method=activity_vendor&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
+ 'lang_prizing_statustext' =>
lang('view edit the prize for this activity'),
+ 'lang_delete_statustext' =>
lang('delete this vendor from this activity'),
+ 'text_prizing'
=> lang('Prizing'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_vendor' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'org_name',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
+
'cat_id'
=>$this->cat_id,
+
'activity_id'
=>$activity_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_delete' => lang('delete')
+ );
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
+ 'sort' =>
$this->sort,
+ 'order' =>
$this->order,
+ 'cat_id' =>
$this->cat_id,
+ 'filter' =>
$this->filter,
+ 'query' =>
$this->query,
+ 'activity_id' => $activity_id
+ );
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' => ''));
+
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'activity_id'
=> $activity_id,
+ 'vendor_data'
=> $vendor_data,
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_no_cat'
=> lang('select agreement'),
+ 'lang_cat_statustext' =>
lang('Select the agreement the pricebook belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_activity_vendor' =>
$table_header,
+ 'values_activity_vendor' =>
$content,
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Add this vendor to this activity'),
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list vendors per activity');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list_activity_vendor' => $data);
+ }
+
+ function edit_activity()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $activity_id =
get_var('activity_id',array('POST','GET'));
+ $agreement = get_var('agreement',array('GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $values['ns3420_id']=
get_var('ns3420_id',array('POST','GET'));
+
+ if(!$values['cat_id'])
+ {
+ $values['cat_id'] = $agreement;
+ }
+
+ $this->bocommon->xsl_add_file(array('pricebook'));
+
+ if ($values['save'])
+ {
+ if(!$values['num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an activity code !'));
+ $error_id=true;
+ }
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select an agreement !'));
+ }
+
+ if(!$values['branch_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a branch !'));
+ }
+
+ if($values['num'] && !$activity_id)
+ {
+
if($this->bo->check_activity_num($values['num'],$values['cat_id']))
+ {
+
$receipt['error'][]=array('msg'=>lang('This activity code is already
registered!') . '[ '.$values['num'] .' ]');
+ $error_id=true;
+ }
+ }
+
+ if($activity_id)
+ {
+ $values['activity_id']=$activity_id;
+ $action='edit';
+ }
+ else
+ {
+ $activity_id = $values['activity_id'];
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_activity($values,$action);
+ $activity_id= $receipt['activity_id'];
+ $values['activity_id']= $activity_id;
+ }
+
+ }
+ else
+ {
+ $values['activity_id']= $activity_id;
+ if($activity_id)
+ {
+ $values =
$this->bo->read_single_activity($activity_id);
+ }
+ }
+
+//html_print_r($values);
+ if ($activity_id)
+ {
+ $function_msg = lang('edit activity');
+ }
+ else
+ {
+ $function_msg = lang('add activity');
+ }
+
+ if ($values['cat_id'] > 0)
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ if($error_id)
+ {
+ unset($values['num']);
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.edit_activity',
+ 'activity_id' => $activity_id,
+ 'agreement' => $agreement
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
+ 'lang_activity_id'
=> lang('Activity ID'),
+ 'lang_num'
=> lang('Activity code'),
+ 'lang_category'
=> lang('Agreement'),
+ 'lang_unit'
=> lang('Unit'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'lang_base_descr'
=> lang('Base description'),
+ 'value_activity_id'
=> $values['activity_id'],
+ 'value_num'
=> $values['num'],
+ 'value_general_address' =>
$values['general_address'],
+ 'value_access'
=> $values['access'],
+ 'value_descr'
=> $values['descr'],
+ 'value_base_descr'
=> $values['base_descr'],
+ 'lang_num_statustext' =>
lang('A unique code for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+ 'lang_no_cat'
=> lang('Select agreement'),
+ 'lang_cat_statustext' =>
lang('Select the agreement this activity belongs to.'),
+ 'select_name'
=> 'values[cat_id]',
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
+ 'lang_base_descr_statustext' => lang('Enter
a description for prerequisitions for this activity - if any'),
+ 'cat_list'
=> $this->bo->get_agreement_list('select',$values['cat_id']),
+
+ 'lang_dim_d'
=> lang('Dim D'),
+ 'dim_d_list'
=> $this->bo->get_dim_d_list($values['dim_d']),
+ 'select_dim_d'
=> 'values[dim_d]',
+ 'lang_no_dim_d'
=> lang('No Dim D'),
+ 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
+
+ 'lang_unit'
=> lang('Unit'),
+ 'unit_list'
=> $this->bo->get_unit_list($values['unit']),
+ 'select_unit'
=> 'values[unit]',
+ 'lang_no_unit'
=> lang('Select Unit'),
+ 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
+
+ 'lang_branch'
=> lang('Branch'),
+ 'branch_list'
=> $this->bo->get_branch_list($values['branch_id']),
+ 'select_branch'
=> 'values[branch_id]',
+ 'lang_no_branch'
=> lang('Select branch'),
+ 'lang_branch_statustext' =>
lang('Select the branch for this activity.'),
+
+ 'ns3420_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uilookup.ns3420'),
+ 'lang_ns3420'
=> lang('NS3420'),
+ 'value_ns3420_id'
=> $values['ns3420_id'],
+ 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit_activity' => $data);
+ }
+
+ function delete()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $method =
get_var('method',array('GET'));
+ $activity_id = get_var('activity_id',array('GET'));
+ $vendor_id =
get_var('vendor_id',array('GET'));
+ $index_count = get_var('index_count',array('GET'));
+ $agreement_id = get_var('agreement_id',array('GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ if($method=='activity_vendor')
+ {
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity_vendor',
+ 'activity_id' => $activity_id
+ );
+
+ $function_msg =lang('delete vendor activity');
+ $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_activity_vendor($activity_id,$vendor_id);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='activity')
+ {
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.activity'
+ );
+
+ $function_msg =lang('delete activity');
+ $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_activity($activity_id);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='prize')
+ {
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.prizing',
+ 'activity_id' => $activity_id,
+ 'vendor_id' => $vendor_id
+ );
+
+ $function_msg =lang('delete prize-index');
+ $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id .
'&index_count=' . $index_count);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_prize_index($activity_id,$vendor_id,$index_count);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='agreement')
+ {
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uipricebook.agreement',
+ 'start' => $this->start
+ );
+
+ $function_msg =lang('Delete agreement and all
the activities associated with it!');
+ $delete_action =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&agreement_id=' . $agreement_id . '&start=' . $this->start);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_agreement($agreement_id);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+ }
+
+ $this->bocommon->xsl_add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
+ 'delete_action' =>
$delete_action,
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('delete' => $data);
+ }
+
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.uipricebook.php, 1.1.1.3,
nomail <=