[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10749] Merge 10735:10748 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10749] Merge 10735:10748 from trunk |
Date: |
Tue, 05 Feb 2013 07:40:26 +0000 |
Revision: 10749
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10749
Author: sigurdne
Date: 2013-02-05 07:40:24 +0000 (Tue, 05 Feb 2013)
Log Message:
-----------
Merge 10735:10748 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.boproject.inc.php
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.sotts.inc.php
branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
branches/Version-1_0-branch/property/inc/hook_config.inc.php
branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
branches/Version-1_0-branch/property/setup/phpgw_no.lang
branches/Version-1_0-branch/property/templates/base/config.tpl
branches/Version-1_0-branch/property/templates/base/project.xsl
branches/Version-1_0-branch/property/templates/base/status_select.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748
Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -888,5 +888,8 @@
return $approve;
}
-
+ public function get_auto_generated_invoice_num($vendor_id)
+ {
+ return
$this->so->get_auto_generated_invoice_num($vendor_id);
+ }
}
Modified: branches/Version-1_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boproject.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.boproject.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -69,10 +69,10 @@
$this->use_session = true;
}
-
-
+
+
$default_filter_year =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_filter_year'])
&&
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_filter_year']
== 'current_year' ? date('Y') : 'all';
-
+
$start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
$query =
phpgw::get_var('query');
$sort =
phpgw::get_var('sort');
@@ -242,7 +242,7 @@
'id' => 3,
'name' => lang('buffer')
),
-
+
);
return $this->bocommon->select_list($selected, $values);
}
@@ -429,7 +429,7 @@
else
{
return $criteria;
- }
+ }
}
function select_key_location_list($selected='')
@@ -517,7 +517,7 @@
)
),
'text'
=> $origin[0]['data'][0]['id'],
- 'statustext' =>
$origin[0]['data'][0]['statustext'],
+ 'statustext' =>
$origin[0]['data'][0]['statustext'],
);
}
}
@@ -527,13 +527,6 @@
function read_single($project_id = 0, $values = array(), $view
= false)
{
- $contacts = CreateObject('property.sogeneric');
- $contacts->get_location_info('vendor',false);
-
- $config =
CreateObject('phpgwapi.config','property');
- $config->read();
- $tax =
1+(isset($config->config_data['fm_tax'])?$config->config_data['fm_tax']:0)/100;
-
$values['attributes'] = $this->custom->find('property',
'.project', 0, '', 'ASC', 'attrib_sort', true, true);
if($project_id)
{
@@ -550,71 +543,7 @@
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$values['start_date'] =
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
$values['end_date'] =
isset($values['end_date']) && $values['end_date'] ?
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat) : '';
- $workorder_data =
$this->so->project_workorder_data($project_id);
- $sum_deviation = 0;
-//combined_cost
-//diff
-
- for ($i=0;$i<count($workorder_data);$i++)
- {
- $sum_deviation+=
$workorder_data[$i]['deviation'];
-
-/*
- $_cost = (float)number_format(0, 2, ',', '');
- if(abs($workorder_data[$i]['contract_sum']) > 0)
- {
- $_cost =
(float)number_format($workorder_data[$i]['contract_sum'] *
(1+(((int)$workorder_data[$i]['addition_percentage'])/100)), 2, ',', '');
- }
- else if(abs($workorder_data[$i]['calculation'])
> 0)
- {
- $_cost =
(float)number_format($workorder_data[$i]['calculation'] * $tax, 2, ',', '');
- }
- else if(abs($workorder_data[$i]['budget']) > 0)
- {
- $_cost =
(float)number_format($workorder_data[$i]['budget'] * $tax, 2, ',', '');
- }
-*/
- $values['workorder_budget'][$i]['cost'] =
$workorder_data[$i]['combined_cost'];
- $values['workorder_budget'][$i]['actual_cost']
= $workorder_data[$i]['actual_cost'];
-
-
$values['workorder_budget'][$i]['title']=htmlspecialchars_decode($workorder_data[$i]['title']);
-
$values['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
- //
$values['workorder_budget'][$i]['contract_sum']=(float)number_format($workorder_data[$i]['contract_sum']
* (1+(((int)$workorder_data[$i]['addition_percentage'])/100)), 2, ',', '');
- $values['workorder_budget'][$i]['budget']=
$workorder_data[$i]['budget'];
- //
$values['workorder_budget'][$i]['calculation']=(float)number_format($workorder_data[$i]['calculation']*$tax,
2, ',', '');
-
$values['workorder_budget'][$i]['charge_tenant'] =
$workorder_data[$i]['charge_tenant'];
- $values['workorder_budget'][$i]['status'] =
$workorder_data[$i]['status'];
- // $values['workorder_budget'][$i]['actual_cost']
= (float)number_format($workorder_data[$i]['actual_cost'] ?
$workorder_data[$i]['actual_cost'] : 0, 2, ',', '');
- $values['workorder_budget'][$i]['b_account_id']
= $workorder_data[$i]['b_account_id'];
-// $values['workorder_budget'][$i]['paid_percent']
= (int)$workorder_data[$i]['paid_percent'];
-
$values['workorder_budget'][$i]['addition_percentage'] =
$workorder_data[$i]['addition_percentage'];
-
- $values['workorder_budget'][$i]['obligation'] =
$workorder_data[$i]['obligation'];
-
-//
$values['workorder_budget'][$i]['combined_cost'] =
$workorder_data[$i]['closed'] ? 0 : ($_cost -
$workorder_data[$i]['actual_cost']);
- $values['workorder_budget'][$i]['diff'] =
$workorder_data[$i]['diff'];
-
- if(isset($workorder_data[$i]['vendor_id']) &&
$workorder_data[$i]['vendor_id'])
- {
- $vendor['attributes'] =
$this->custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true,
true);
-
- $vendor =
$contacts->read_single(array('id' => $workorder_data[$i]['vendor_id']),
$vendor);
- foreach($vendor['attributes'] as
$attribute)
- {
-
if($attribute['name']=='org_name')
- {
-
$values['workorder_budget'][$i]['vendor_name']=$attribute['value'];
- break;
- }
- }
- }
- }
- if($workorder_data)
- {
- $values['deviation']= $sum_deviation;
- }
-
if($values['location_code'])
{
$values['location_data'] =
execMethod('property.solocation.read_single', $values['location_code']);
@@ -654,6 +583,48 @@
return $values;
}
+ public function get_orders($data)
+ {
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
+
+ static $vendor_name = array();
+ $values = $this->so->project_workorder_data($data);
+
+ $sum_deviation = 0;
+ foreach ($values as &$entry)
+ {
+ $sum_deviation+= $entry['deviation'];
+
+ $entry['cost'] = $entry['combined_cost'];
+
$entry['title']=htmlspecialchars_decode($entry['title']);
+
+ if(isset($entry['vendor_id']) &&
$entry['vendor_id'])
+ {
+
if(isset($vendor_name[$entry['vendor_id']]) &&
$vendor_name[$entry['vendor_id']])
+ {
+ $entry['vendor_name'] =
$vendor_name[$entry['vendor_id']];
+ }
+ else
+ {
+ $vendor['attributes'] =
$this->custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true,
true);
+
+ $vendor =
$contacts->read_single(array('id' => $entry['vendor_id']), $vendor);
+ foreach($vendor['attributes']
as $attribute)
+ {
+
if($attribute['name']=='org_name')
+ {
+
$entry['vendor_name'] = $attribute['value'];
+
$vendor_name[$entry['vendor_id']] = $attribute['value'];
+ break;
+ }
+ }
+ }
+ }
+ }
+ return $values;
+ }
+
function read_single_mini($project_id)
{
if($project = $this->so->read_single($project_id))
@@ -694,7 +665,7 @@
$historylog =
CreateObject('property.historylog','project');
$history_array =
$historylog->return_array(array('O'),array(),'','',$id);
$i=0;
- foreach ($history_array as $value)
+ foreach ($history_array as $value)
{
$record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
@@ -938,4 +909,10 @@
$values = $this->so->get_filter_year_list();
return $this->bocommon->select_list($selected, $values);
}
+
+ public function get_order_time_span($id)
+ {
+ $values = $this->so->get_order_time_span($id);
+ return $this->bocommon->select_list(date('Y'), $values);
+ }
}
Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -323,7 +323,7 @@
$invoice[$i]['period']
= $this->db->f('periode');
$invoice[$i]['periodization']
= $this->db->f('periodization');
$invoice[$i]['periodization_start']
= $this->db->f('periodization_start');
-
+
$invoice[$i]['type']
= $art_list[$this->db->f('artid')];
$invoice[$i]['kidnr']
= $this->db->f('kidnr');
$invoice[$i]['kreditnota']
= $this->db->f('kreditnota');
@@ -395,7 +395,7 @@
$ordermethod = " ORDER BY godkjentbelop
$sort";
break;
default:
- $ordermethod = ' ORDER BY pmwrkord_code
DESC, id DESC';
+ $ordermethod = ' ORDER BY pmwrkord_code
DESC, id DESC';
}
$filtermethod = '';
@@ -564,7 +564,7 @@
$groupmethod = "GROUP BY
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,"
. "
currency,budsjettansvarligid,org_name,periode";
-
+
$sql = "SELECT DISTINCT
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,sum(belop) as belop,
sum(godkjentbelop) as godkjentbelop,"
. "
currency,budsjettansvarligid,org_name,periode"
. " FROM $table"
@@ -718,7 +718,7 @@
'period' =>
$this->db->f('periode'),
'district_id' =>
$this->db->f('district_id'),
'account_class' =>
$b_account_class ? $b_account_class : $this->db->f('b_account_class')
- );
+ );
}
return $consume;
@@ -907,7 +907,7 @@
foreach ($update_paid_percent as $workorder_id
=> $paid_percent)
{
$paid_percent = (int) $paid_percent;
- $GLOBALS['phpgw']->db->query("UPDATE
fm_workorder set paid_percent={$paid_percent} WHERE id= '$workorder_id'");
+ $GLOBALS['phpgw']->db->query("UPDATE
fm_workorder set paid_percent={$paid_percent} WHERE id= '$workorder_id'");
$this->db->query("SELECT type FROM
fm_orders WHERE id='{$workorder_id}'",__LINE__,__FILE__);
$this->db->next_record();
@@ -949,7 +949,7 @@
$value_set['budsjettsigndato']
= null;
break;
}
-
+
switch ( $values['approve'] )
{
case 'is_janitor':
@@ -972,7 +972,7 @@
// $bilagsnr = (int)$this->db->f('bilagsnr');
// $value_set =
$this->db->validate_update($value_set);
// $this->db->query("UPDATE {$table} SET
$value_set WHERE bilagsnr= {$bilagsnr}" ,__LINE__,__FILE__);
-
+
if(isset($value_set['budsjettansvarligid']) &&
!$value_set['budsjettansvarligid'])
{
phpgwapi_cache::message_set( 'Mangler
anviser','error');
@@ -992,8 +992,8 @@
'process_log' =>
$this->db->db_addslashes($values['process_log']),
'process_code' => $values['process_code'],
);
-
+
$value_set =
$this->db->validate_update($value_set);
$this->db->query("UPDATE {$table} SET $value_set WHERE
id= {$id}" ,__LINE__,__FILE__);
@@ -1089,7 +1089,7 @@
$this->db->query("SELECT user_id FROM
fm_ecodimb_role_user WHERE user_id = {$this->account_id} AND role_id IN (3)
{$filter_dimb} AND expired_on IS NULL AND active_from < " . time(). ' AND
(active_to > ' . time() . ' OR active_to = 0)');
$this->db->next_record();
$this->role['is_budget_responsible'] =
!!$this->db->f('user_id');
-
+
}
else
{
@@ -1121,8 +1121,8 @@
default:
$role_filter = "role_id = {$role_id}";
}
-
+
$sql = "SELECT DISTINCT account_lid,account_lastname,
account_firstname FROM fm_ecodimb_role_user"
. " {$this->db->join} phpgw_accounts ON
fm_ecodimb_role_user.user_id = phpgw_accounts.account_id"
. " WHERE {$role_filter} {$filter_dimb} AND expired_on
IS NULL"
@@ -1197,7 +1197,7 @@
{
$receipt = array();
$this->db->transaction_begin();
-
+
if($periodization)
{
$value = "'{$periodization}'";
@@ -1335,7 +1335,7 @@
if($id == $selected)
{
$selected_found = true;
- }
+ }
$dimb_list[] = array
(
@@ -1423,7 +1423,7 @@
else
{
return array();
- }
+ }
$sql = "SELECT {$table}.*,fm_workorder_status.descr as
status, fm_workorder.charge_tenant,org_name,"
. " fm_workorder.claim_issued,
fm_workorder.continuous, fm_workorder_status.closed FROM {$table}"
@@ -1757,7 +1757,7 @@
if ($this->db->f('budsjettsigndato'))
{
$allow_transfer=true;
- }
+ }
}
else
{
@@ -1806,7 +1806,7 @@
{
$sql = "SELECT DISTINCT periode FROM fm_ecobilagoverf
ORDER BY periode DESC";
$this->db->query($sql,__LINE__,__FILE__);
-
+
$values = array();
while ($this->db->next_record())
{
@@ -1840,13 +1840,13 @@
{
return array();
}
-
+
$filter = 'WHERE periode IN(' . implode(',', $data) .
')';
// $filter .= ' AND manual_record IS NULL';
$sql = "SELECT * FROM fm_ecobilagoverf {$filter} ORDER
BY periode DESC, id ASC";
$this->db->query($sql,__LINE__,__FILE__);
-
+
$values = array();
while ($this->db->next_record())
{
@@ -1873,7 +1873,7 @@
. " {$this->join} fm_ecobilag ON (fm_workorder.id =
fm_ecobilag.pmwrkord_code)"
. " GROUP BY art, kostnadssted, project_group, currency
ORDER BY kostnadssted,project_group, art, currency ASC";
$this->db->query($sql,__LINE__,__FILE__);
-
+
$values = array();
while ($this->db->next_record())
{
@@ -1900,7 +1900,7 @@
$condition = 'WHERE bilagsnr =' . (int)
$data['voucher_id'];
$global_check = true;
}
-
+
$receipt = array();
$local_error= false;
if($condition)
@@ -1951,7 +1951,7 @@
// end check
$value_set = array();
-
+
foreach ($data['forward'] as $role => $user_lid)
{
$value_set[$role] = $user_lid;
@@ -1971,7 +1971,7 @@
$value_set['budsjettsigndato'] = null;
break;
}
-
+
switch ( $data['approve'] )
{
case 'is_janitor':
@@ -2017,7 +2017,7 @@
$order_info['order_exist'] = true;
}
if ($this->db->f('location_code'))
- {
+ {
$parts =
explode('-',$this->db->f('location_code'));
$order_info['dima'] = implode('', $parts);
$order_info['loc1'] = $parts[0];
@@ -2027,7 +2027,7 @@
$order_info['spbudact_code'] =
$this->db->f('account_id');
$order_info['dimb']
= $this->db->f('ecodimb');
$order_info['dime']
= $this->db->f('category');
- $order_info['title'] =
$this->db->f('title',true);
+ $order_info['title'] =
$this->db->f('title',true);
$janitor_user_id
= $this->db->f('user_id');
$order_info['janitor'] =
$GLOBALS['phpgw']->accounts->get($janitor_user_id)->lid;
@@ -2095,19 +2095,19 @@
{
if($this->update_voucher_by_changed_order($data['line_id'], $data['order_id']))
{
-
phpgwapi_cache::message_set(lang('voucher info updated from order'),
'message');
+
phpgwapi_cache::message_set(lang('voucher info updated from order'), 'message');
return true;
}
else
{
phpgwapi_cache::message_set(lang('something went wrong'), 'error');
- return false;
+ return false;
}
}
$GLOBALS['phpgw']->db->transaction_begin();
$value_set = array();
-
+
$value_set['periode'] = $data['period'];
$value_set['periodization'] = $data['periodization'];
$value_set['periodization_start'] =
$data['periodization_start'];
@@ -2173,7 +2173,7 @@
{
continue;
}
-
+
$split_amount =
str_replace(array(' ', ','),array('','.'),$split_amount);
if(!is_numeric($split_amount ))
@@ -2187,7 +2187,7 @@
$this->db->query("SELECT belop FROM
{$table} WHERE id={$id}",__LINE__,__FILE__);
$this->db->next_record();
$amount = $this->db->f('belop');
-
+
if($amount > 0)
{
if(($amount - $split_amount) <=
0)
@@ -2258,7 +2258,7 @@
'user_id' =>
$this->account_id,
'entry_date' => time(),
'modified_date' => time()
- );
+ );
$sql = "SELECT id FROM fm_ecobilag_process_log
WHERE bilagsnr = '{$data['voucher_id']}'";
$this->db->query($sql,__LINE__,__FILE__);
@@ -2347,12 +2347,12 @@
$query = (int) $data['query'];
$querymethod = " $where
(bilagsnr = {$query} OR bilagsnr_ut = {$query})";
break;
-
+
case 'invoice_id':
$query = $data['query'];
$querymethod = " $where
fakturanr = '{$query}'";
break;
-
+
case 'order_id':
$query = $data['query'];
$querymethod = " $where
pmwrkord_code = '{$query}'";
@@ -2375,7 +2375,7 @@
default:
}
-
+
$where = 'AND';
}
@@ -2392,7 +2392,7 @@
$lang_type = lang('type');
$lang_approved_amount = lang('approved amount');
$lang_payment_date = lang('payment date');
-
+
$this->db->query($sql,__LINE__,__FILE__);
$values = array();
@@ -2429,17 +2429,17 @@
{
$status = 1;
}
-
+
$values[$bilagsnr]['status'][] = $status;
}
-
+
$voucers = array();
foreach ($values as $bilagsnr => $entry)
{
$payment_date =
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($entry['payment_date']));
$status = $entry['status'];
sort($status);
-
+
$voucher_id = $entry['bilagsnr_ut'] ?
$entry['bilagsnr_ut'] : $bilagsnr;
$name = sprintf("{$lang_payment_date}: % 10s |
{$lang_voucer}:% 8s | {$lang_vendor}: % 50s | {$lang_currency}: % 3s |
{$lang_parked}: % 1s | {$lang_type}: % 12s | {$lang_approved_amount}: % 19s |
Status: % 1s",
$payment_date,
@@ -2461,4 +2461,14 @@
return $voucers;
}
+
+ public function get_auto_generated_invoice_num($vendor_id)
+ {
+ $vendor_id = (int) $vendor_id;
+ $sql = "SELECT max(cast(fakturanr as int)) as
invoice_num FROM fm_ecobilagoverf WHERE spvend_code = {$vendor_id}";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+ $invoice_num = $this->db->f('invoice_num') +1;
+ return $invoice_num;
+ }
}
Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -710,7 +710,7 @@
*/
- $_get_accounting = false;
+ $_get_accounting = true;
if($_get_accounting)
{
@@ -958,15 +958,27 @@
return $this->db->f('power_meter');
}
- function project_workorder_data($project_id = 0)
+ function project_workorder_data($data = array())
{
- $project_id = (int) $project_id;
+ $project_id = (int) $data['project_id'];
+ $year = (int) $data['year'];
$values = array();
- $this->db->query("SELECT fm_workorder.title,
fm_workorder.actual_cost, fm_workorder.id as
workorder_id,fm_workorder.contract_sum,"
+
+ $filter_year = '';
+ if($year)
+ {
+// $start_date = mktime(0, 0, 0, 1, 1, $year)
+// $end_date = mktime(23, 59, 59, 12, 31, $year)
+ $filter_year = "AND fm_workorder_budget.year =
{$year}";
+ }
+
+ $this->db->query("SELECT DISTINCT fm_workorder.title,
fm_workorder.actual_cost, fm_workorder.id as
workorder_id,fm_workorder.contract_sum,"
. " fm_workorder.vendor_id,
fm_workorder.calculation,fm_workorder.rig_addition,fm_workorder.addition,fm_workorder.deviation,fm_workorder.charge_tenant,"
. " fm_workorder_status.descr as status,
fm_workorder_status.closed, fm_workorder.account_id as b_account_id"
- . " FROM fm_workorder {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
- . " WHERE
project_id={$project_id}",__LINE__,__FILE__);
+ . " FROM fm_workorder"
+ . " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
+ . " {$this->join} fm_workorder_budget ON
fm_workorder.id = fm_workorder_budget.order_id"
+ . " WHERE project_id={$project_id}
{$filter_year}",__LINE__,__FILE__);
$_orders = array();
@@ -2270,6 +2282,7 @@
'sum_orders' =>
array_sum($_sum_orders),
'sum_oblications' =>
array_sum($_sum_oblications),
'actual_cost' =>
$_actual_cost,
+ 'deviation_acc' => 0
);
$sort_period[] = $period;
@@ -2331,6 +2344,7 @@
'sum_orders' =>
array_sum($_sum_orders),
'sum_oblications' =>
array_sum($_sum_oblications),
'actual_cost' =>
$_actual_cost,
+ 'deviation_acc' => 0
);
$sort_period[] = $period;
@@ -2342,6 +2356,8 @@
}
+ $deviation_acc = 0;
+ $budget_acc = 0;
foreach ($values as &$entry)
{
$entry['year'] = substr( $entry['period'], 0, 4
);
@@ -2359,14 +2375,15 @@
$_deviation = $entry['budget'] -
$entry['actual_cost'];
$deviation = abs($entry['actual_cost']) > 0 ?
$_deviation : 0;
$entry['deviation_period'] = $deviation;
- $entry['deviation_acc'] += $deviation;
+ $budget_acc +=$entry['budget'];
+ $deviation_acc += $deviation;
+ $entry['deviation_acc'] = abs($deviation) > 0 ?
$deviation_acc : 0;
$entry['deviation_percent_period'] =
$deviation/$entry['budget'] * 100;
- $entry['deviation_percent_acc'] =
$entry['deviation_acc']/$entry['budget'] * 100;
+ $entry['deviation_percent_acc'] =
$entry['deviation_acc']/$budget_acc * 100;
$entry['closed'] =
$closed_period[$entry['period']];
$entry['active'] =
$active_period[$entry['period']];
}
-//_debug_array( $values);die();
return $values;
}
@@ -2586,26 +2603,47 @@
$id = (int) $id;
$year = (int) $year;
+ $latest_year = (int)$budget['latest_year'];
$this->db->query("SELECT periodization_id,
project_type_id FROM fm_project WHERE id = {$id}",__LINE__,__FILE__);
$this->db->next_record();
$periodization_id = $this->db->f('periodization_id');
$project_type_id = $this->db->f('project_type_id');
- if(abs($budget['obligation']) > 0)
+ if($project_type_id == 2) // investment
{
- $transferred = $this->update_budget($id,
$budget['latest_year'], $periodization_id, $budget['obligation'], false,
'subtract');
+ // total budget
+ $this->db->query("SELECT sum(budget) FROM
fm_project_budget WHERE project_id = {$id} AND year =
{$latest_year}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $last_budget = $this->db->f('budget');
+ if(!$last_budget)
+ {
+ throw new
Exception('property_soproject::transfer_budget() - no budget to transfer for
this investment project: ' . $id);
+ }
+
+ //paid last year
+ $this->db->query("SELECT sum(amount) as paid
FROM fm_project"
+ . " {$this->join} fm_workorder ON fm_project.id
= fm_workorder.project_id"
+ . " {$this->join}
fm_orders_paid_or_pending_view ON fm_workorder.id =
fm_orders_paid_or_pending_view.order_id"
+ . " WHERE periode > {$latest_year}00 AND
periode < {$latest_year}13 AND fm_project.id = {$id}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $paid_last_year = $this->db->f('paid');
+
+ $subtract = $last_budget - $paid_last_year;
+//_debug_array($subtract);die();
+ $transferred = $this->update_budget($id,
$latest_year, $periodization_id, $subtract, false, 'subtract');
+
+ $new_budget = $last_budget - $paid_last_year;
+ $this->update_budget($id, $year,
$periodization_id, $new_budget, true, 'update', true);
}
-
- if($project_type_id == 1)//operation
+ else if($project_type_id == 1)//operation
{
+ if($budget['budget_amount'])
+ {
+ $this->update_budget($id, $year,
$periodization_id, (int)$budget['budget_amount'], true, 'update', true);
+ }
$this->db->query("UPDATE fm_project_budget SET
active = 0 WHERE project_id = {$id}",__LINE__,__FILE__);
- }
+ }
- if($budget['budget_amount'])
- {
- $this->update_budget($id, $year,
$periodization_id, (int)$budget['budget_amount'], true, 'update', true);
- }
-
$this->db->transaction_commit();
}
@@ -2614,7 +2652,8 @@
{
if($transfer_budget_year && $execute && $new_budget)
{
- echo "<H1> Overføre budsjett for valgte
prosjekt/bestillinger til år {$transfer_budget} </H1>";
+ echo "<H1> Overføre budsjett for valgte
prosjekt/bestillinger til år {$transfer_budget_year} </H1>";
+ $soworkorder =
CreateObject('property.soworkorder');
foreach($ids as $_id)
{
@@ -2628,7 +2667,7 @@
$this->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
break;
case 'workorder':
- _debug_array(
$new_budget[$_id]);
+
$soworkorder->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
break;
default:
throw new
Exception('property_soproject::bulk_update_status() - not a valid type');
@@ -2668,13 +2707,12 @@
}
}
- $sql_budget = "SELECT DISTINCT year, active,
sum(budget) as budget FROM fm_{$type}_budget WHERE ";
-
switch($type)
{
case 'project':
- $sql_budget .= 'project_id = %d GROUP
BY year, active ORDER BY year';
+ $sql_budget = "SELECT DISTINCT year,
month, active, sum(budget) as amount FROM fm_project_budget WHERE ";
+ $sql_budget .= 'project_id = %d GROUP
BY year, month, active ORDER BY year';
if($closed_orders)
{
@@ -2695,7 +2733,8 @@
break;
case 'workorder':
- $sql_budget .= 'order_id = %d GROUP BY
year, active ORDER BY year';
+ $sql_budget = "SELECT DISTINCT year,
month, active, sum(combined_cost) as amount FROM fm_workorder_budget WHERE ";
+ $sql_budget .= 'order_id = %d GROUP BY
year, month, active ORDER BY year';
$table = 'fm_workorder';
$status_table = 'fm_workorder_status';
@@ -2757,17 +2796,31 @@
$this->db->query($sql,__LINE__,__FILE__);
$budget = array();
+ $_budget = array();
$_year = 0;
+ $_active_amount = array();
while ($this->db->next_record())
{
$_year = $this->db->f('year');
+ $_amount = $this->db->f('amount');
$_active = $this->db->f('active') ? X :
0;
- $_budget =
number_format((int)$this->db->f('budget'), 0, ',', '.');
- $budget[] = $_year . " [{$_active}/
{$_budget}]";
+ if($_active)
+ {
+ $_active_amount[$_year] +=
$_amount;
+ }
+
+ $_budget[$_year] += $_amount;
}
+
+ foreach ($_budget as $__year => $__budget)
+ {
+ $budget[] = $__year . ' [' .
number_format((int)$_active_amount[$__year], 0, ',', '.') . '/' .
number_format((int)$__budget, 0, ',', '.') . ']';
+ }
+
$entry['budget'] = implode(' ;', $budget);
$entry['latest_year'] = $_year;
+ $entry['active_amount'] =
array_sum($_active_amount);
}
return $values;
@@ -3003,4 +3056,30 @@
return $year_list;
}
+
+ public function get_order_time_span($id)
+ {
+ if(!$id)
+ {
+ return array();
+ }
+ $year_list = array();
+ $sql = 'SELECT min(start_date) AS start_date,
max(end_date) AS end_date FROM fm_workorder WHERE project_id = ' . (int) $id;
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->next_record())
+ {
+ $start_year = $this->db->f('start_date') ?
date('Y',$this->db->f('start_date')) : date('Y');
+ $end_year = $this->db->f('end_date') ?
date('Y',$this->db->f('end_date')) : date('Y');
+
+ for ($i=$start_year;$i< ($end_year+1) ;$i++)
+ {
+ $year_list[] = array
+ (
+ 'id' => $i,
+ 'name' => $i
+ );
+ }
+ }
+ return $year_list;
+ }
}
Modified: branches/Version-1_0-branch/property/inc/class.sotts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sotts.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.sotts.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -353,7 +353,10 @@
$filtermethod .= " {$where}
(assignedto={$user_id}";
$where = 'AND';
- $membership =
$GLOBALS['phpgw']->accounts->membership($user_id);
+ if(!$membership =
$GLOBALS['phpgw']->accounts->membership($user_id))
+ {
+ $membership = array(-1 => 0);
+ }
$filtermethod .= ' OR (assignedto IS NULL AND
group_id IN (' . implode(',',array_keys($membership)) . ')))';
}
Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -521,7 +521,7 @@
if($status_id == 'open')
{
- $filtermethod .= " $where
fm_workorder_status.closed IS NULL";
+ $filtermethod .= " $where
fm_workorder_status.closed IS NULL";
/* $_status_filter = array();
$this->db->query("SELECT * FROM
fm_workorder_status WHERE closed IS NULL");
@@ -530,7 +530,7 @@
{
$_status_filter[] =
$this->db->f('id');
}
- $filtermethod .= " $where
fm_workorder.status IN ('" . implode("','", $_status_filter) . "')";
+ $filtermethod .= " $where
fm_workorder.status IN ('" . implode("','", $_status_filter) . "')";
*/
}
else
@@ -793,7 +793,7 @@
$_paid_filter = " AND (periode >
{$filter_year}00 AND periode < {$filter_year}13 OR periode IS NULL)";
}
- $_get_accounting = false;
+ $_get_accounting = true;
if($_get_accounting)
{
$this->db->query($sql_cost,__LINE__,__FILE__);
@@ -1029,9 +1029,9 @@
}
}
- $this->db->query("SELECT budget, reserve FROM
fm_project WHERE id={$project_id}");
- $this->db->next_record();
- $project_sum = $this->db->f('budget') +
$this->db->f('reserve');
+ $this->db->query("SELECT budget, reserve FROM
fm_project WHERE id={$project_id}");
+ $this->db->next_record();
+ $project_sum = $this->db->f('budget') +
$this->db->f('reserve');
$project_planned_cost = round($project_sum -
$orded_or_paid);
@@ -1895,7 +1895,7 @@
$sort_period[] = $period;
}
-
+
if($values)
{
array_multisort($sort_period, SORT_ASC,
$values);
@@ -2176,7 +2176,88 @@
*/
}
+
+
/**
+ * Transfer budget and cost from one year to the next
+ *
+ **/
+
+ public function transfer_budget($id, $budget, $year)
+ {
+//_debug_array($budget);die();
+ $this->db->transaction_begin();
+
+ $id = (int) $id;
+ $year = (int) $year;
+ $latest_year = (int)$budget['latest_year'];
+
+ $sql = "SELECT periodization_id, project_type_id,
continuous"
+ . " FROM fm_workorder"
+ . " {$this->join} fm_project ON fm_workorder.project_id
= fm_project.id"
+ . " WHERE fm_workorder.id = {$id}";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+
+ $periodization_id = $this->db->f('periodization_id');
+ $project_type_id = $this->db->f('project_type_id');
+ $continuous = $this->db->f('continuous');
+
+//~ * Løpende bestillinger settes til null via masseoppdatering, evt at nytt
budsjett tastes inn i masseoppdatering (siste er ønskelig).
+//~ * For Driftsbestillinger settes Betalt til null, Budsjett settes til
restforpliktelse (budsjett tidligere trekkes ned med restforpliktelse)
+//~ * For Investeringsbestillinger skal disse ikke se på år
+
+
+ if($continuous)
+ {
+ $this->db->query("UPDATE fm_workorder_budget
SET active = 0 WHERE order_id = {$id} AND year =
{$latest_year}",__LINE__,__FILE__);
+ if($budget['budget_amount'])
+ {
+ $this->_update_order_budget($id, $year,
$periodization_id, (int)$budget['budget_amount'],
(int)$budget['budget_amount'], (int)$budget['budget_amount'], $action =
'update', true);
+ }
+ }
+ else if($project_type_id == 1)//operation
+ {
+ if(abs($budget['obligation']) > 0)
+ {
+ $transferred =
$this->_update_order_budget($id, $latest_year, $periodization_id,
$budget['obligation'], $contract_sum, $combined_cost = 0, $action = 'subtract',
$activate = 0);
+ }
+
+ $this->_update_order_budget($id, $year,
$periodization_id, (int)$budget['budget_amount'],
(int)$budget['budget_amount'], (int)$budget['budget_amount'], $action =
'update', true);
+
+ $this->db->query("UPDATE fm_workorder_budget
SET active = 0 WHERE order_id = {$id} AND year =
{$latest_year}",__LINE__,__FILE__);
+ }
+ else if($project_type_id == 2)//investment
+ {
+ // total budget
+ $this->db->query("SELECT sum(combined_cost) AS
budget FROM fm_workorder_budget WHERE order_id = {$id} AND year =
{$latest_year}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $last_budget = $this->db->f('budget');
+ if(!$last_budget)
+ {
+ throw new
Exception('property_workorder::transfer_budget() - no budget to transfer for
this investment order: ' . $id);
+ }
+
+ //paid last year
+ $this->db->query("SELECT sum(amount) as paid
FROM fm_workorder"
+ . " {$this->join}
fm_orders_paid_or_pending_view ON fm_workorder.id =
fm_orders_paid_or_pending_view.order_id"
+ . " WHERE periode > {$latest_year}00 AND
periode < {$latest_year}13 AND fm_project.id = {$id}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $paid_last_year = $this->db->f('paid');
+
+ $subtract = $last_budget - $paid_last_year;
+//_debug_array($subtract);die();
+ $transferred = $this->_update_order_budget($id,
$latest_year, $periodization_id, $subtract, $subtract, $subtract, $action =
'subtract');
+
+ $new_budget = $last_budget - $paid_last_year;
+ $this->_update_order_budget($id, $year,
$periodization_id, $new_budget, $new_budget, $new_budget, $action = 'update',
true);
+ }
+
+ $this->db->transaction_commit();
+ }
+
+ /**
* Maintain correct periodizing in relation to current project
(in case the order is moved)
*
**/
@@ -2200,10 +2281,85 @@
}
}
- public function _update_order_budget($order_id, $year,
$periodization_id, $budget, $contract_sum, $combined_cost = 0)
+ public function _update_order_budget($order_id, $year,
$periodization_id, $budget, $contract_sum, $combined_cost = 0, $action =
'update', $activate = 0)
{
$year = $year ? (int) $year : date('Y');
+//_debug_array($year);
+ if($action == 'subtract')
+ {
+ $incoming_budget = $budget;
+ $acc_partial = 0;
+ $orig_budget = $this->get_budget($order_id);
+//_debug_array($orig_budget);
+ $hit = false;
+ foreach ($orig_budget as $entry)
+ {
+ if($entry['year'] == $year &&
$entry['active'])
+ {
+ $partial_budget = 0;
+ $month =
(int)substr($entry['period'],-2);
+ $hit = true; // found at least
one.
+ if($entry['sum_orders'] >= 0)
+ {
+ if($entry['diff'] > 0)
+ {
+
if($entry['diff'] < $budget)
+ {
+
+
$partial_budget = $entry['diff'];
+ $budget
-= $partial_budget;
+ }
+ else
+ {
+
$partial_budget = $budget;
+
$partial_budget = $partial_budget > 0 ? $partial_budget : 0;
+ $budget
= 0;
+ }
+ }
+ }
+ else if($entry['sum_orders'] <
0)
+ {
+ if($entry['diff'] < 0)
+ {
+
if($entry['diff'] > $budget)
+ {
+
$partial_budget = $entry['diff'];
+ $budget
-= $partial_budget;
+ }
+ else
+ {
+
$partial_budget = $budget;
+
$partial_budget = $partial_budget < 0 ? $partial_budget : 0;
+ $budget
= 0;
+ }
+ }
+ }
+ if($partial_budget)
+ {
+ $acc_partial +=
$partial_budget;
+
$this->_update_budget($order_id, $year, $month, $partial_budget,
$partial_budget, $partial_budget, $action);
+ }
+ }
+ }
+//_debug_array($budget);
+//die();
+ if($hit && $budget) // still some left to go -
place it on the last one
+ {
+
+ $acc_partial += $budget;
+
+ $this->_update_budget($order_id, $year,
$month, $budget, $budget, $budget, $action);
+ }
+
+ if(!$hit)
+ {
+// throw new
Exception('property_soproject::_update_order_budget() - found no active budget
to transfer from');
+ }
+
+ return $acc_partial;
+ }
+
$periodization_id = (int) $periodization_id;
$periodization_outline = array();
Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -67,7 +67,8 @@
'columns' => true,
'bulk_update_status' => true,
'project_group' => true,
- 'view_file' => true
+ 'view_file' => true,
+ 'get_orders' => true
);
function property_uiproject()
@@ -192,7 +193,7 @@
$GLOBALS['phpgw_info']['flags']['menu_selection'] .=
'::project';
if($this->cat_id)
{
-
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::{$this->cat_id}";
+
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::{$this->cat_id}";
}
if(!$this->acl_read)
@@ -386,7 +387,7 @@
),
array
(
- 'id' =>
'sel_filter',
+ 'id' =>
'sel_filter',
'name'
=> 'filter',
'value'
=> lang('User'),
'type'
=> 'select',
@@ -828,7 +829,7 @@
if($dry_run)
{
- $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
@@ -1002,7 +1003,7 @@
if(!$id)
{
- phpgwapi_cache::message_set('ID is
required for the function uiproject::view()', 'error');
+ phpgwapi_cache::message_set('ID is
required for the function uiproject::view()', 'error');
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiproject.index'));
}
}
@@ -1140,7 +1141,7 @@
);
}
-
+
$save='';
if (isset($values['save']))
{
@@ -1166,7 +1167,7 @@
$error_id=true;
}
}
-
+
if(!isset($values['location']))
{
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
@@ -1270,6 +1271,14 @@
}
}
+ if ($values['approval'] &&
$values['mail_address'] && $config->config_data['project_approval'])
+ {
+
if(isset($config->config_data['project_approval_status']) &&
$config->config_data['project_approval_status'])
+ {
+ $values['status'] =
$config->config_data['project_approval_status'];
+ }
+ }
+
if($id)
{
$values['id'] = $id;
@@ -1314,7 +1323,7 @@
{
$bofiles->create_document_dir("project/$id");
$bofiles->vfs->override_acl = 1;
-
+
if(!$bofiles->vfs->cp (array (
'from'
=> $_FILES['file']['tmp_name'],
'to'
=> $to_file,
@@ -1399,14 +1408,14 @@
}
}
}
-
+
$notify_list =
execMethod('property.notify.read', array
(
'location_id' => $location_id,
'location_item_id' => $id
)
);
-
+
$subject=lang('project
%1 has been edited',$id);
if(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))
@@ -1424,13 +1433,13 @@
}
}
unset($entry);
-
+
if($toarray_sms)
{
-
$historylog->add('MS',$id,implode(',',$toarray_sms));
+
$historylog->add('MS',$id,implode(',',$toarray_sms));
}
}
-
+
reset($notify_list);
foreach($notify_list as
$entry)
{
@@ -1501,7 +1510,7 @@
if(isset($bypass_error) || ((!isset($receipt['error'])
|| $add_request) && !$bypass) && $id)
{
$_transfer_new_project =
isset($values['new_project_id']) && $values['new_project_id'] ? true : false;
-
+
$values = $this->bo->read_single($id);
if(!isset($values['origin']))
@@ -1646,7 +1655,7 @@
if(isset($config->config_data['invoice_acl'])
&& $config->config_data['invoice_acl'] == 'dimb')
{
$supervisor_id =
$invoice->get_default_dimb_role_user(2, $values['ecodimb']);
- $prefs =
$this->bocommon->create_preferences('property',$supervisor_id);
+ $prefs =
$this->bocommon->create_preferences('property',$supervisor_id);
$supervisor_email[] = array
(
'id' => $supervisor_id,
@@ -1758,7 +1767,7 @@
'project_group_descr' =>
$values['project_group_descr']));
- //---datatable
settings---------------------------------------------------
+ //---datatable
settings---------------------------------------------------
$sum_actual_cost = 0;
$sum_oblications = 0;
@@ -1781,7 +1790,7 @@
}
$checked = $b_entry['closed'] ?
'checked="checked"' : '';
- $checked2 = $b_entry['active'] ?
'checked="checked"' : '';
+ $checked2 = $b_entry['active'] ?
'checked="checked"' : '';
$b_entry['flag_active'] =
$b_entry['active'];
$b_entry['delete_year'] = "<input
type='checkbox' name='values[delete_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_delete}'>";
@@ -1789,7 +1798,7 @@
$b_entry['closed_orig'] = "<input
type='checkbox' name='values[closed_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked>";
$b_entry['active'] = "<input
type='checkbox' name='values[active_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_active}'
$checked2>";
$b_entry['active_orig'] = "<input
type='checkbox' name='values[active_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked2>";
-
+
}
unset($b_entry);
}
@@ -1829,7 +1838,7 @@
$content_budget =
$this->bo->get_buffer_budget($id);
foreach($content_budget as & $b_entry)
{
- $b_entry['entry_date'] =
$GLOBALS['phpgw']->common->show_date($b_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $b_entry['entry_date'] =
$GLOBALS['phpgw']->common->show_date($b_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
unset($b_entry);
}
@@ -1871,11 +1880,13 @@
//_debug_array($values['workorder_budget']);die();
+ $content_orders = $this->get_orders($id, date('Y'));
+ //FIXME: deviation from this one
$datavalues[1] = array
(
'name'
=> "1",
- 'values'
=> json_encode($values['workorder_budget']),
- 'total_records' =>
count($values['workorder_budget']),
+ 'values'
=> json_encode($content_orders),
+ 'total_records' =>
count($content_orders),
'edit_action' =>
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.edit'))),
'is_paginator' => 1,
'footer'
=> 0
@@ -1897,7 +1908,7 @@
array('key' =>
'status','label'=>lang('Status'),'sortable'=>true,'resizeable'=>true)))
);
-
+
$invoices = array();
if ($id)
{
@@ -1915,7 +1926,7 @@
'voucher_out_id' =>
$entry['voucher_out_id'],
'workorder_id' =>
$entry['workorder_id'],
'status'
=> $entry['status'],
- 'invoice_id' =>
$entry['invoice_id'],
+ 'invoice_id' =>
$entry['invoice_id'],
'budget_account' =>
$entry['budget_account'],
'dima'
=> $entry['dima'],
'dimb'
=> $entry['dimb'],
@@ -1929,7 +1940,7 @@
'budget_responsible' =>
$entry['budget_responsible'],
'budsjettsigndato' =>
$entry['budsjettsigndato'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
'transfer_time' =>
$entry['transfer_time'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
- );
+ );
}
$datavalues[2] = array
@@ -1971,7 +1982,7 @@
'count'
=> count($myColumnDefs)
)
);
-
+
$datavalues[] = $notify_info['datavalues'];
$myColumnDefs[3] = $notify_info['column_defs'];
@@ -2017,7 +2028,7 @@
$link_view_file =
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
$_files = $this->bo->get_files($id);
-
+
$lang_view_file = lang('click to view file');
$lang_delete_file = lang('Check to delete file');
$z=0;
@@ -2034,7 +2045,7 @@
}
$content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\"
title=\"{$lang_delete_file}\">";
$z++;
- }
+ }
$datavalues[5] = array
(
@@ -2105,9 +2116,10 @@
'origin_id' => $id
);
}
+
$selected_tab = phpgw::get_var('tab', 'string',
'REQUEST', 'general');
$project_type_id = isset($values['project_type_id']) &&
$values['project_type_id'] ? $values['project_type_id'] :
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_type'];
-
+
$data = array
(
'project_types'
=> array('options' =>
$this->bo->get_project_types($project_type_id)),
@@ -2131,6 +2143,7 @@
'value_origin_type'
=> isset($origin)?$origin:'',
'value_origin_id'
=> isset($origin_id)?$origin_id:'',
'year_list'
=> array('options' => $year_list),
+ 'order_time_span'
=> array('options' => $this->bo->get_order_time_span($id)),
'periodization_list'
=> array('options' => $periodization_list),
'lang_select_request'
=> lang('Select request'),
'lang_select_request_statustext'
=> lang('Add request for this project'),
@@ -2307,6 +2320,35 @@
$GLOBALS['phpgw']->js->validate_file( 'portico',
'ajax_project_edit', 'property' );
}
+
+ public function get_orders($project_id = 0, $year = 0)
+ {
+ if(!$project_id)
+ {
+ $project_id = phpgw::get_var('project_id',
'int');
+ }
+ if(!$year)
+ {
+ $year = phpgw::get_var('year', 'int');
+ }
+
+ $content = $this->bo->get_orders(array('project_id'=>
$project_id,'year'=> $year));
+
+ if( phpgw::get_var('phpgw_return_as') == 'json' )
+ {
+
+ if(count($content))
+ {
+ return json_encode($content);
+ }
+ else
+ {
+ return "";
+ }
+ }
+ return $content;
+ }
+
function delete()
{
if(!$this->acl_delete)
@@ -2356,7 +2398,7 @@
unset($_entry);
unset($budget_arr);
-//_debug_array($new_budget);die();
+//_debug_array($new_budget);die();
if(isset($_POST['user_id']))
{
$user_id = phpgw::get_var('user_id',
'int');
@@ -2365,7 +2407,7 @@
{
$user_id = $this->account;
}
-
+
if($id_to_update)
{
$ids =
array_values(explode(',',trim($id_to_update,',')));
@@ -2394,7 +2436,7 @@
$_obligation = '';
$entry['new_budget'] = '';
- if($entry['project_type_id'] != 3)
+ if($entry['project_type_id'] == 1 ||
$entry['continuous']) // operation or continuous
{
$_obligation = 0;
$_order = 0;
@@ -2416,7 +2458,7 @@
if($_budget_entry['active'])
{
$_obligation +=
$_budget_entry['sum_oblications'];
- $_order +=
$_budget_entry['sum_orders'];
+ $_order +=
$_budget_entry['sum_orders'];
}
}
@@ -2426,9 +2468,19 @@
$entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::obligation'
name='{$entry['id']}::obligation' value='{$_obligation}' ></input>";
$entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::order_amount'
name='{$entry['id']}::order_amount' value='{$_order}'></input>";
$entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::latest_year'
name='{$entry['id']}::latest_year' value='{$entry['latest_year']}'></input>";
-
+
}
}
+ else if ($entry['project_type_id'] == 2)
+ {
+ $entry['new_budget'] = 'auto';
+ $entry['new_budget'] .= "<input
type='hidden' class='myValuesForPHP' id='{$entry['id']}::latest_year'
name='{$entry['id']}::latest_year' value='{$entry['latest_year']}'></input>";
+ }
+ else if ($entry['project_type_id'] == 3)
+ {
+ $entry['budget'] = '';
+ }
+
$entry['obligation'] = $_obligation;
}
@@ -2467,7 +2519,7 @@
$myColumnDefs[0] = array
(
'name' => "0",
- 'values' =>
json_encode(array(
+ 'values' =>
json_encode(array(
array('key' =>
'project_id','label'=>lang('project'),'sortable'=>true,'resizeable'=>true),
array('key' =>
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
array('key' =>
'start_date','label'=>lang('date'),'sortable'=>false,'resizeable'=>true),
@@ -2512,7 +2564,7 @@
{
array_unshift ($status_list_filter,array
('id'=>'open','name'=> lang('open')));
}
-
+
$status_list_filter =
$this->bocommon->select_list($status_filter,$status_list_filter);
$type_array = array
@@ -2627,7 +2679,7 @@
'project_group' =>
$values['project_group'],
'project_group_descr' =>
$values['project_group_descr']));
- //---datatable
settings---------------------------------------------------
+ //---datatable
settings---------------------------------------------------
$datavalues[0] = array
(
@@ -2675,7 +2727,7 @@
array('key' =>
'value_new_value','label'=>lang('new
value'),'sortable'=>true,'resizeable'=>true)))
);
-
+
$invoices = array();
if ($id)
{
@@ -2693,7 +2745,7 @@
'voucher_out_id' =>
$entry['voucher_out_id'],
'workorder_id' =>
$entry['workorder_id'],
'status'
=> $entry['status'],
- 'invoice_id' =>
$entry['invoice_id'],
+ 'invoice_id' =>
$entry['invoice_id'],
'budget_account' =>
$entry['budget_account'],
'dima'
=> $entry['dima'],
'dimb'
=> $entry['dimb'],
@@ -2706,7 +2758,7 @@
'budget_responsible' =>
$entry['budget_responsible'],
'budsjettsigndato' =>
$entry['budsjettsigndato'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
'transfer_time' =>
$entry['transfer_time'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
- );
+ );
}
$datavalues[2] = array
Modified: branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -748,7 +748,7 @@
if($dry_run)
{
- $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
@@ -887,7 +887,7 @@
if(!$id)
{
- phpgwapi_cache::message_set('ID is
required for the function uiworkorder::view()', 'error');
+ phpgwapi_cache::message_set('ID is
required for the function uiworkorder::view()', 'error');
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiworkorder.index'));
}
}
@@ -1042,7 +1042,7 @@
if(isset($config->config_data['workorder_require_vendor']) &&
$config->config_data['workorder_require_vendor'] == 1 && !$values['vendor_id'])
{
-
$receipt['error'][]=array('msg'=>lang('no vendor'));
+
$receipt['error'][]=array('msg'=>lang('no vendor'));
}
if(!$values['b_account_id'])
@@ -1079,6 +1079,14 @@
$receipt['error'][]=array('msg'=>lang('Percentage addition') . ': ' .
lang('Please enter an integer !'));
}
+ if ($values['approval'] &&
$values['mail_address'] && $config->config_data['workorder_approval'])
+ {
+
if(isset($config->config_data['workorder_approval_status']) &&
$config->config_data['workorder_approval_status'])
+ {
+ $values['status'] =
$config->config_data['workorder_approval_status'];
+ }
+ }
+
if($id)
{
$values['id']=$id;
@@ -1228,10 +1236,10 @@
if($toarray_sms)
{
-
$historylog->add('MS',$id,implode(',',$toarray_sms));
+
$historylog->add('MS',$id,implode(',',$toarray_sms));
}
}
-
+
reset($notify_list);
foreach($notify_list as $entry)
{
@@ -1294,7 +1302,7 @@
);
}
$result['receipt'] = $receipt;
-
+
return $result;
}
@@ -1434,7 +1442,7 @@
{
$location_template_type='view';
}
-
+
$location_data=$bolocation->initiate_ui_location(array(
'values' =>
$_location_data,
'type_id' =>
$mode == 'edit' ? $max_level :
count(explode('-',$_location_data['location_data']['location_code'])),
@@ -1534,7 +1542,7 @@
if(isset($config->config_data['invoice_acl'])
&& $config->config_data['invoice_acl'] == 'dimb')
{
$supervisor_id =
$invoice->get_default_dimb_role_user(2, $values['ecodimb']);
- $prefs =
$this->bocommon->create_preferences('property',$supervisor_id);
+ $prefs =
$this->bocommon->create_preferences('property',$supervisor_id);
$supervisor_email[] = array
(
'id' => $supervisor_id,
@@ -1653,7 +1661,7 @@
$content_files[$z]['file_name'] = '<a
href="'.$link_view_file.'&file_name='.$values['files'][$z]['file_name'].'"
target="_blank" title="'.lang('click to view
file').'">'.$values['files'][$z]['name'].'</a>';
}
$content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]"
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete
file').'">';
- }
+ }
$datavalues[1] = array
(
@@ -1689,7 +1697,7 @@
'voucher_out_id' =>
$entry['voucher_out_id'],
'status'
=> $entry['status'],
'period'
=> $entry['period'],
- 'invoice_id' =>
$entry['invoice_id'],
+ 'invoice_id' =>
$entry['invoice_id'],
'budget_account' =>
$entry['budget_account'],
'dima'
=> $entry['dima'],
'dimb'
=> $entry['dimb'],
@@ -1704,7 +1712,7 @@
'budget_responsible' =>
$entry['budget_responsible'],
'budsjettsigndato' =>
$entry['budsjettsigndato'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
'transfer_time' =>
$entry['transfer_time'] ?
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
: '',
- );
+ );
}
//_debug_array($content_invoice);
$datavalues[2] = array
@@ -1750,7 +1758,7 @@
'count'
=> count($myColumnDefs)
)
);
-
+
$datavalues[] = $notify_info['datavalues'];
$myColumnDefs[] = $notify_info['column_defs'];
$myButtons = array();
@@ -1766,11 +1774,11 @@
'name' => "4",
'values' =>
json_encode(array( array('key' => 'value_email', 'label'=>lang('email'),
'sortable'=>true,'resizeable'=>true),
array('key' =>
'value_select','label'=>lang('select'),'sortable'=>false,'resizeable'=>true)))
- );
+ );
$content_email =
execMethod('property.bocommon.get_vendor_email', isset($values['vendor_id']) ?
$values['vendor_id'] : 0 );
-
+
if(isset($values['mail_recipients']) &&
is_array($values['mail_recipients']))
{
$_recipients_found = array();
@@ -1808,7 +1816,7 @@
foreach($content_budget as & $b_entry)
{
$checked = $b_entry['closed'] ?
'checked="checked"' : '';
- $checked2 = $b_entry['active'] ?
'checked="checked"' : '';
+ $checked2 = $b_entry['active'] ?
'checked="checked"' : '';
$b_entry['flag_active'] = $b_entry['active'];
$b_entry['delete_period'] = "<input
type='checkbox' name='values[delete_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_delete}'>";
@@ -1816,7 +1824,7 @@
$b_entry['closed_orig'] = "<input
type='checkbox' name='values[closed_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked>";
$b_entry['active'] = "<input type='checkbox'
name='values[active_b_period][]' value='{$b_entry['year']}_{$b_entry['month']}'
title='{$lang_active}' $checked2>";
$b_entry['active_orig'] = "<input
type='checkbox' name='values[active_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked2>";
-
+
}
unset($b_entry);
@@ -1874,7 +1882,7 @@
}
}
-/*
+/*
if(isset($project['cat_id']) && $project['cat_id'])
{
$catetory =
$this->cats->return_single($project['cat_id']);
@@ -1894,7 +1902,7 @@
{
$user['id'] = $user['user_id'];
}
-
+
$value_coordinator = isset($project['coordinator']) ?
$GLOBALS['phpgw']->accounts->get($project['coordinator'])->__toString() :
$GLOBALS['phpgw']->accounts->get($this->account)->__toString();
$year = date('Y') -1;
@@ -1989,7 +1997,7 @@
'lang_calculation'
=> lang('Calculation'),
'value_calculation'
=> (isset($values['calculation'])?$values['calculation']:''),
'value_sum_estimated_cost'
=> $sum_estimated_cost,
-
+
'value_contract_sum'
=> isset($receipt['error']) && $receipt['error'] ?
$_POST['values']['contract_sum'] : '',
'actual_cost'
=> (isset($values['actual_cost'])?$values['actual_cost']:''),
@@ -2129,7 +2137,7 @@
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'workorder.edit', 'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'workorder.edit', 'property' );
$GLOBALS['phpgw']->js->validate_file( 'portico',
'ajax_workorder_edit', 'property' );
}
@@ -2283,7 +2291,7 @@
if(!execMethod('property.soXport.check_order',$values['order_id']))
{
-
$receipt['error'][]=array('msg'=>lang('Not a valid order!'));
+
$receipt['error'][]=array('msg'=>lang('Not a valid order!'));
}
if (!$values['amount'])
@@ -2295,8 +2303,12 @@
$receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
}
- if (!$values['vendor_id'])
+ if($values['vendor_id'] == 99)
{
+ $values['invoice_id'] =
$boinvoice->get_auto_generated_invoice_num($values['vendor_id']);
+ }
+ else if (!$values['vendor_id'])
+ {
$receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
}
else if
(!$boinvoice->check_vendor($values['vendor_id']))
@@ -2316,7 +2328,7 @@
if (!$values['invoice_id'])
{
- $receipt['error'][] =
array('msg'=>lang('Please - enter a invoice num!'));
+ $receipt['error'][] =
array('msg'=>lang('please enter a invoice num!'));
}
if (!$values['payment_date'] &&
!$values['num_days'])
@@ -2393,7 +2405,7 @@
'tenant' => false,
'lookup_type' => 'form',
'lookup_entity' => false,
- 'entity_data' => false
+ 'entity_data' => false
)
);
@@ -2540,7 +2552,7 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
-
+
}
protected function _generate_tabs($tabs_ = array(), $suppress =
array(), $selected = 'general')
Modified: branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
2013-02-05 07:40:24 UTC (rev 10749)
@@ -31,15 +31,16 @@
* Description
* @package property
*/
+ phpgw::import_class('phpgwapi.datetime');
class export_conv
{
//var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
- var $debug;
- var $client_code = 14;
+ var $debug = false;
protected $connection = false;
protected $receipt = array();
+ protected $type = '211';
function __construct()
{
@@ -50,14 +51,14 @@
$this->config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.invoice'));
}
- protected function get_anlegg()
+ protected function get_xmldata()
{
- $sql= "SELECT * FROM fm_entity_1_11 WHERE
auto_kontering = 1";
+ $sql= "SELECT * FROM fm_entity_1_11 WHERE
auto_kontering = 1 AND category = 2";//kun fellesmålere som er merket med
autokontering
$this->db->query($sql,__LINE__,__FILE__);
$anlegg = array();
- $TreeID = '202';
+ $TreeID = $this->type;
$PeriodFrom = date('Ym');
$PeriodTo = 209912;
@@ -129,10 +130,13 @@
xmlwriter_end_element($memory);
$xml = xmlwriter_output_memory($memory,true);
- header('Content-type: text/xml');
+ if($this->debug)
+ {
+ header('Content-type: text/xml');
+ echo $xml;
+ die();
+ }
- echo $xml; die();
-
return $xml;
}
@@ -163,15 +167,13 @@
// $this->debug=True;
//Bestem filnavn
- $external_ref = '';
- $Filnavn = $this->LagFilnavn($external_ref);
+ $Filnavn = $this->LagFilnavn();
if (!$Filnavn)
{
$message='LagFilnavn: Filnavn er i bruk';
$receipt['error'][]= array('msg' => $message);
$this->log_end();
- echo $message;
return;
}
@@ -183,23 +185,19 @@
else
{
$message='kan ikke lagre til fil: '. $Filnavn
.'<br>';
- if($this->debug)
+ $receipt['error'][]= array('msg' => $message);
+ if(!$this->debug)
{
- echo $message;
- }
- else
- {
- $receipt['error'][]= array('msg' =>
$message);
$this->log_end();
}
}
//Velg ut alle anlegg som skal overføres
- $anlegg = $this->get_anlegg();
+ $xmldata = $this->get_xmldata();
- if ($anlegg)
+ if ($xmldata)
{
- $this->receipt['message'][]= array('msg' =>
$this->transfer_anlegg($anlegg, $Filnavn, $download));
+ $this->transfer_anlegg($xmldata, $Filnavn,
$download);
}
if($this->connection)
@@ -224,15 +222,12 @@
}
- protected function LagFilnavn ($external_ref = '')
+ protected function LagFilnavn()
{
- if(!$external_ref)
- {
- $external_ref = mt_rand();
- }
+ $timestamp = date('YmdHi',
phpgwapi_datetime::user_localtime());
$fil_katalog =
$this->config->config_data['export']['path'];
- $Filnavn = $fil_katalog .
"/x114_14_{$external_ref}.xml";
+ $Filnavn = $fil_katalog .
"/konteringstre_{$this->type}_{$timestamp}.xml";
//Sjekk om filen eksisterer
if (file_exists($Filnavn))
@@ -268,18 +263,20 @@
if($transfer_ok)
{
$message = "El Anlegg er overført, fil:
{$Filnavn}";
+ phpgwapi_cache::message_set($message,
'message');
}
else
{
$message = 'Noe gikk galt med
overføring av El Anlegg';
+ phpgwapi_cache::message_set($message,
'error');
}
}
else
{
- $message = $xmldata;
+ header('Content-type: text/xml');
+ echo $xmldata;
+ die();
}
-
- return $message;
}
Modified: branches/Version-1_0-branch/property/inc/hook_config.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/hook_config.inc.php
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/inc/hook_config.inc.php
2013-02-05 07:40:24 UTC (rev 10749)
@@ -114,6 +114,64 @@
}
/**
+ * Get HTML listbox with project status that are to be set when asking
for approval
+ *
+ * @param $config
+ * @return string HTML checkboxes to be placed in a table
+ */
+ function project_approval_status($config)
+ {
+ $status_entries =
execMethod('property.soproject.select_status_list');
+
+ $status_assigned = isset($config['project_approval_status']) ?
$config['project_approval_status'] : array();
+
+ $out = '<option value="">' . lang('none selected') .
'</option>' . "\n";
+ foreach ( $status_entries as $status)
+ {
+ $selected = '';
+ if ( $status_assigned == $status['id'])
+ {
+ $selected = 'selected = "selected"';
+ }
+
+ $out .= <<<HTML
+ <option
value='{$status['id']}'{$selected}>{$status['name']}</option>
+HTML;
+ }
+
+ return $out;
+ }
+
+ /**
+ * Get HTML listbox with workorder status that are to be set when asking
for approval
+ *
+ * @param $config
+ * @return string HTML checkboxes to be placed in a table
+ */
+ function workorder_approval_status($config)
+ {
+ $status_entries =
execMethod('property.soworkorder.select_status_list');
+
+ $status_assigned = isset($config['workorder_approval_status'])
? $config['workorder_approval_status'] : array();
+
+ $out = '<option value="">' . lang('none selected') .
'</option>' . "\n";
+ foreach ( $status_entries as $status)
+ {
+ $selected = '';
+ if ( $status_assigned == $status['id'])
+ {
+ $selected = 'selected = "selected"';
+ }
+
+ $out .= <<<HTML
+ <option
value='{$status['id']}'{$selected}>{$status['name']}</option>
+HTML;
+ }
+
+ return $out;
+ }
+
+ /**
* Get HTML listbox with workorder status that are to be set when
invoice is processed
*
* @param $config
Modified: branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
2013-02-05 07:40:24 UTC (rev 10749)
@@ -23,3 +23,12 @@
});
});
+$(document).ready(function(){
+
+ $("#order_time_span").change(function(){
+ var oArgs = {menuaction:'property.uiproject.get_orders',
project_id:project_id, year:$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ execute_async(myDataTable_1, oArgs);
+ });
+});
+
Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-02-04
12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-02-05
07:40:24 UTC (rev 10749)
@@ -1229,6 +1229,7 @@
please either select generate id or type a equipment id ! property
no enten valg GENERER ID eller angi et utstyrs ID
please enter a apartment id ! property no angi leilighet ID
please enter a building id ! property no angi bygg ID
+please enter a invoice num! property no Angi Fakturanummer
please enter a description! property no angi en beskrivelse!
please enter a entrance id ! property no angi inngang ID
please enter a index ! property no Angi en indeks
Modified: branches/Version-1_0-branch/property/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/config.tpl
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/templates/base/config.tpl
2013-02-05 07:40:24 UTC (rev 10749)
@@ -96,6 +96,25 @@
</select>
</td>
</tr>
+ <tr class="row_off">
+ <td>{lang_project_status_on_approval}:</td>
+ <td>
+ <select
name="newsettings[project_approval_status]">
+ {hook_project_approval_status}
+ </select>
+ </td>
+ </tr>
+
+ <tr class="row_on">
+ <td>{lang_workorder_status_on_approval}:</td>
+ <td>
+ <select
name="newsettings[workorder_approval_status]">
+ {hook_workorder_approval_status}
+ </select>
+ </td>
+ </tr>
+
+
<tr class="row_off">
<td>{lang_workorder_status_that_are_to_be_set_when_invoice_is_processed}:</td>
<td>
Modified: branches/Version-1_0-branch/property/templates/base/project.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/project.xsl
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/templates/base/project.xsl
2013-02-05 07:40:24 UTC (rev 10749)
@@ -41,6 +41,7 @@
document.add_sub_entry_form.submit();
}
var project_type_id = '<xsl:value-of
select="project_type_id"/>';
+ var project_id = '<xsl:value-of
select="value_project_id"/>';
function set_tab(tab)
{
@@ -579,6 +580,15 @@
</xsl:when>
<xsl:otherwise>
<td>
+
<select id = "order_time_span" name="order_time_span">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'select')"/>
+
</xsl:attribute>
+
<option value="0">
+
<xsl:value-of select="php:function('lang',
'select')"/>
+
</option>
+
<xsl:apply-templates select="order_time_span/options"/>
+
</select>
<!-- DataTable -->
<div id="paging_1"> </div>
<div id="datatable-container_1"/>
Modified: branches/Version-1_0-branch/property/templates/base/status_select.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/status_select.xsl
2013-02-04 12:45:57 UTC (rev 10748)
+++ branches/Version-1_0-branch/property/templates/base/status_select.xsl
2013-02-05 07:40:24 UTC (rev 10749)
@@ -6,7 +6,7 @@
<xsl:variable name="status_name">
<xsl:value-of select="status_name"/>
</xsl:variable>
- <select name="{$status_name}" class="forms"
onMouseover="window.status='{$lang_status_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <select name="{$status_name}" class="forms"
title="{$lang_status_statustext}">
<option value="">
<xsl:value-of select="lang_no_status"/>
</option>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10749] Merge 10735:10748 from trunk,
Sigurd Nes <=