[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.uiinvoice.inc.php, 1.6
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.uiinvoice.inc.php, 1.6 |
Date: |
Thu, 12 Aug 2004 20:56:22 +0200 |
Update of /property/inc
Modified Files:
Branch:
class.uiinvoice.inc.php
date: 2004/08/12 18:56:22; author: sigurdne; state: Exp; lines: +194 -25
Log Message:
no message
=====================================================================
Index: property/inc/class.uiinvoice.inc.php
diff -u property/inc/class.uiinvoice.inc.php:1.5
property/inc/class.uiinvoice.inc.php:1.6
--- property/inc/class.uiinvoice.inc.php:1.5 Fri Jul 30 13:16:59 2004
+++ property/inc/class.uiinvoice.inc.php Thu Aug 12 18:56:22 2004
@@ -36,7 +36,9 @@
'consume' => True,
'remark' => True,
'delete' => True,
- 'add' => True
+ 'add' => True,
+ 'debug' => True,
+ 'view_order' => True
);
function uiinvoice()
@@ -59,7 +61,7 @@
$this->user_lid =
$this->bo->user_lid;
$this->allrows =
$this->bo->allrows;
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
$this->acl2_location = '.invoice';
$this->acl_read =
$this->acl2->check('.invoice',1);
$this->acl_add =
$this->acl2->check('.invoice',2);
@@ -400,7 +402,7 @@
$content[$i]['lang_remark']
= lang('Remark');
$content[$i]['link_remark']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.remark');
$content[$i]['lang_remark_help']
= lang('Klick this link to view the remark');
- $content[$i]['link_workorder']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&no_email=true&show_cost=true');
+ $content[$i]['link_order']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.view_order');
$i++;
}
}
@@ -841,11 +843,9 @@
$values['janitor'] =
get_var('janitor',array('POST','GET'));
$values['supervisor'] =
get_var('supervisor',array('POST','GET'));
$values['budget_responsible']=
get_var('budget_responsible',array('POST','GET'));
- $invoice_date =
urldecode(get_var('invoice_date',array('POST','GET')));
+ $values['invoice_date'] =
urldecode(get_var('invoice_date',array('POST','GET')));
$values['num_days'] =
get_var('num_days',array('POST','GET'));
- $payment_date =
urldecode(get_var('payment_date',array('POST','GET')));
- $values['cancel'] =
get_var('cancel',array('POST','GET'));
- $values['convert'] =
get_var('convert',array('POST','GET'));
+ $values['payment_date'] =
urldecode(get_var('payment_date',array('POST','GET')));
$values['sday'] =
get_var('sday',array('POST','GET'));
$values['smonth'] =
get_var('smonth',array('POST','GET'));
$values['syear'] =
get_var('syear',array('POST','GET'));
@@ -854,17 +854,26 @@
$values['eyear'] =
get_var('eyear',array('POST','GET'));
$values['auto_tax'] =
get_var('auto_tax',array('POST','GET'));
$values['merknad'] =
get_var('merknad',array('POST','GET'));
- $values['b_account_id'] =
get_var('b_account_id',array('POST'));
- $values['b_account_name'] =
get_var('b_account_name',array('POST'));
- $values['amount'] =
get_var('amount',array('POST'));
- $values['order'] =
get_var('order',array('POST'));
- $add =
get_var('add',array('POST','GET'));
+ $values['b_account_id'] =
get_var('b_account_id',array('POST','GET'));
+ $values['b_account_name'] =
get_var('b_account_name',array('POST','GET'));
+ $values['amount'] =
get_var('amount',array('POST','GET'));
+ $values['order'] =
get_var('order',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $debug =
get_var('debug',array('POST','GET'));
+ $add_invoice =
get_var('add_invoice',array('POST','GET'));
$links = $this->menu->links('add_inv');
- if($add)
+ if($location_code)
+ {
+ $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+ }
+
+
+
+ if($add_invoice)
{
$insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
@@ -889,11 +898,16 @@
$values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
- if($values['order'] &&
!ctype_digit($values['order']))
+ if($values['order'] &&
!ctype_digit($values['order'])):
{
$receipt['error'][]=array('msg'=>lang('Please enter an integer for order!'));
unset($values['order']);
}
+ elseif($values['order']):
+ {
+ $order=True;
+ }
+ endif;
if (!$values['amount'])
{
@@ -903,7 +917,7 @@
{
$receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
}
- if (!$values['vendor_id'])
+ if (!$values['vendor_id'] && !$order)
{
$receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
}
@@ -913,16 +927,16 @@
$receipt['error'][] =
array('msg'=>lang('Please - select type order!'));
}
- if (!$values['budget_responsible'])
+ if (!$values['budget_responsible'] && !$order)
{
$receipt['error'][] =
array('msg'=>lang('Please - select budget responsible!'));
}
- if
(!$this->bo->check_vendor($values['vendor_id']))
+ if
(!$this->bo->check_vendor($values['vendor_id']) && !$order)
{
$receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' .
$values['vendor_id']);
}
- if (!$payment_date && !$values['num_days'])
+ if (!$values['payment_date'] &&
!$values['num_days'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select either payment date or number of days from
invoice date !'));
}
@@ -938,14 +952,14 @@
$d=strpos($dateformat,'d');
$m=strpos($dateformat,'m');
- if($invoice_date)
+ if($values['invoice_date'])
{
- $dateparts = explode('/',
$invoice_date);
+ $dateparts = explode('/',
$values['invoice_date']);
$values['sday'] =
$dateparts[$d];
$values['smonth'] =
$dateparts[$m];
$values['syear'] =
$dateparts[$y];
- $dateparts = explode('/',
$payment_date);
+ $dateparts = explode('/',
$values['payment_date']);
$values['eday'] =
$dateparts[$d];
$values['emonth'] =
$dateparts[$m];
$values['eyear'] =
$dateparts[$y];
@@ -954,7 +968,12 @@
$values['bilagsnr'] =
$this->bo->next_bilagsnr();
$values['regtid'] =
date($this->bocommon->datetimeformat);
- $receipt = $this->bo->add($values);
+ $receipt =
$this->bo->add($values,$debug);
+ if($debug)
+ {
+ $this->debug($receipt);
+ return;
+ }
unset($values);
$GLOBALS['phpgw']->session->appsession('session_data','add_receipt',$receipt);
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.add');
@@ -986,7 +1005,8 @@
$link_data = array
(
- 'menuaction' =>
$this->currentapp.'.uiinvoice.add'
+ 'menuaction' =>
$this->currentapp.'.uiinvoice.add',
+ 'debug' => True
);
$dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
@@ -1044,8 +1064,8 @@
'lang_vendor_name_statustext' => lang('Select
the vendor by klicking the button'),
'lang_select_vendor_statustext' => lang('Select
the vendor by klicking this button'),
- 'value_invoice_date' =>
$invoice_date,
- 'value_payment_date' =>
$payment_date,
+ 'value_invoice_date' =>
$values['invoice_date'],
+ 'value_payment_date' =>
$values['payment_date'],
'value_belop'
=> $values['belop'],
'value_vendor_id'
=> $values['vendor_id'],
'value_vendor_name'
=> $values['vendor_name'],
@@ -1118,5 +1138,154 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
}
+ function debug($values)
+ {
+// _debug_array($values);
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu','table_header'));
+
+
+ $link_data_add = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvoice.add',
+ 'add_invoice' => True
+ );
+
+ $link_data_cancel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvoice.add'
+ );
+
+ $post_data = array
+ (
+ 'location_code' =>
$values[0]['location_code'],
+ 'art' =>
$values[0]['art'],
+ 'type' =>
$values[0]['type'],
+ 'dim_b' =>
$values[0]['dim_b'],
+ 'invoice_num' =>
$values[0]['invoice_num'],
+ 'kid_nr' =>
$values[0]['kid_nr'],
+ 'vendor_id' =>
$values[0]['spvend_code'],
+ 'vendor_name' =>
$values[0]['vendor_name'],
+ 'janitor' =>
$values[0]['janitor'],
+ 'supervisor' =>
$values[0]['supervisor'],
+ 'budget_responsible'=>
$values[0]['budget_responsible'],
+ 'invoice_date' =>
urlencode($values[0]['invoice_date']),
+ 'num_days' =>
$values[0]['num_days'],
+ 'payment_date' =>
urlencode($values[0]['payment_date']),
+ 'sday' =>
$values[0]['sday'],
+ 'smonth' =>
$values[0]['smonth'],
+ 'syear' =>
$values[0]['syear'],
+ 'eday' =>
$values[0]['eday'],
+ 'emonth' =>
$values[0]['emonth'],
+ 'eyear' =>
$values[0]['eyear'],
+ 'auto_tax' =>
$values[0]['auto_tax'],
+ 'merknad' =>
$values[0]['merknad'],
+ 'b_account_id' =>
$values[0]['spbudact_code'],
+ 'b_account_name' =>
$values[0]['b_account_name'],
+ 'amount' =>
$values[0]['amount'],
+ 'order' =>
$values[0]['order'],
+ );
+
+ $link_data_add = $link_data_add +
$post_data;
+ $link_data_cancel = $link_data_cancel
+ $post_data;
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('Add'),
+ 'lang_add_statustext' => lang('Add this
invoice'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_add),
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_cancel_statustext'=> lang('Do not add
this invoice'),
+ 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
+ );
+
+
+ $import = array(
+ 'Bestilling' => 'pmwrkord_code',
+ 'Fakt. Nr' => 'fakturanr',
+ 'Konto' => 'spbudact_code',
+ 'Objekt' => 'dima',
+ 'Fag/Timer/Matr' => 'dimd',
+ 'MVA' => 'mvakode',
+ 'Beløp [kr]' => 'belop'
+ );
+
+ $header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Beløp [kr]');
+
+ for ($i=0;$i<count($header);$i++)
+ {
+ $table_header[$i]['header'] = $header[$i];
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] =
'center';
+ }
+ // $sum=0;
+
+ $import_count = count($import);
+ $values_count = count($values);
+ for ($i=0; $i<$values_count; $i++)
+ {
+ for ($k=0; $k<$import_count; $k++)
+ {
+ $content[$i]['row'][$k]['value']
= $values[$i][$import[$header[$k]]];
+ if ($import[$header[$k]]=='belop')
+ {
+
$content[$i]['row'][$k]['align'] = 'right';
+ //
$sum=$sum+$values[$i][$import[$header[$k]]];
+
$content[$i]['row'][$k]['value'] =
number_format($values[$i][$import[$header[$k]]], 2, ',', '');
+ }
+ }
+ }
+
+
+
+ $data = array
+ (
+ 'artid'
=> $values[0]['artid'],
+ 'lang_type'
=> lang('Type'),
+ 'lang_bilagsnr'
=> lang('bilagsnr'),
+ 'bilagsnr'
=> $values[0]['bilagsnr'],
+ 'lang_vendor'
=> lang('Vendor'),
+ 'vendor_name'
=> $values[0]['vendor_name'],
+ 'spvend_code'
=> $values[0]['spvend_code'],
+ 'lang_fakturadato'
=> lang('invoice date'),
+ 'fakturadato'
=> $values[0]['fakturadato'],
+ 'lang_forfallsdato'
=> lang('Payment date'),
+ 'forfallsdato'
=> $values[0]['forfallsdato'],
+ 'lang_janitor'
=> lang('Janitor'),
+ 'oppsynsmannid'
=> $values[0]['oppsynsmannid'],
+ 'lang_supervisor'
=> lang('Supervisor'),
+ 'saksbehandlerid'
=> $values[0]['saksbehandlerid'],
+ 'lang_budget_responsible' =>
lang('Budget Responsible'),
+ 'budsjettansvarligid' =>
$values[0]['budsjettansvarligid'],
+ 'lang_sum'
=> lang('Sum'),
+ 'sum'
=> number_format($values[0]['amount'], 2, ',', ''),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+//_debug_array($data);
+ $appname
= lang('Invoice');
+ $function_msg =
lang('Add invoice: Debug');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('debug' => $data));
+ }
+
+ function view_order()
+ {
+ $order_id =
get_var('order_id',array('POST','GET'));
+ $soXport =
CreateObject($this->currentapp.'.soXport');
+
+ $order_type = $soXport->check_order(intval($order_id));
+ switch($order_type)
+ {
+ case 'workorder':
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&no_email=true&show_cost=true&workorder_id='
. $order_id);
+ break;
+ case 's_agreement':
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.view&id='
. $order_id);
+ break;
+ }
+ }
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.uiinvoice.inc.php, 1.6,
nomail <=