[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7572] property: reporting
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7572] property: reporting |
Date: |
Sun, 11 Sep 2011 13:23:58 +0000 |
Revision: 7572
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7572
Author: sigurdne
Date: 2011-09-11 13:23:57 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
property: reporting
Modified Paths:
--------------
trunk/property/inc/class.boinvoice.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.uiinvoice.inc.php
trunk/property/setup/phpgw_no.lang
Added Paths:
-----------
trunk/property/templates/base/invoice_reporting.xsl
Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php 2011-09-11 13:22:57 UTC (rev
7571)
+++ trunk/property/inc/class.boinvoice.inc.php 2011-09-11 13:23:57 UTC (rev
7572)
@@ -622,4 +622,31 @@
return $this->so->check_role();
}
+ public function get_historical_accounting_periods()
+ {
+ return $this->so->get_historical_accounting_periods();
+ }
+
+
+ public function export_historical_transactions_at_periods($data
= array())
+ {
+ $values =
$this->so->get_historical_transactions_at_periods($data);
+
+ if($values)
+ {
+ $names = $descr = array_keys($values[0]);
+
$this->bocommon->download($values,$names,$descr);
+ }
+ }
+
+ public function export_deposition()
+ {
+ $values = $this->so->get_deposition();
+
+ if($values)
+ {
+ $names = $descr = array_keys($values[0]);
+
$this->bocommon->download($values,$names,$descr);
+ }
+ }
}
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2011-09-11 13:22:57 UTC (rev
7571)
+++ trunk/property/inc/class.soinvoice.inc.php 2011-09-11 13:23:57 UTC (rev
7572)
@@ -1379,4 +1379,107 @@
$line = $this->read_single_voucher(0, $id);
return $line[0];
}
+
+ public function get_historical_accounting_periods()
+ {
+ $sql = "SELECT DISTINCT periode FROM fm_ecobilagoverf
ORDER BY periode DESC";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $values = array();
+ while ($this->db->next_record())
+ {
+ $periode = $this->db->f('periode');
+ $values[] = array
+ (
+ 'id' => $periode,
+ 'name' => $periode
+ );
+ }
+
+ $i = 0;
+ foreach ($values as &$periode)
+ {
+ if($i > 5)
+ {
+ break;
+ }
+ $sql = "SELECT count(id) as cnt FROM
fm_ecobilagoverf WHERE periode = {$periode['id']}";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+ $periode['name'] = $periode['name'] . ' [' .
sprintf("%010s",$this->db->f('cnt')) . ']';
+ $i ++;
+ }
+ return $values;
+ }
+
+ public function get_historical_transactions_at_periods($data =
array())
+ {
+ if(!$data && !is_array($data))
+ {
+ return array();
+ }
+
+ $filter = 'WHERE periode IN(' . implode(',', $data) .
')';
+
+ $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())
+ {
+ $values[] = $this->db->Record;
+ }
+ return $values;
+ }
+
+
+ /*
+ * Orders without related historic invoices, tagged as
'delivered'
+ * - And orders related to active (not processed) invoices.
+ */
+ public function get_deposition()
+ {
+ $this->db->query("SELECT id FROM fm_workorder_status
WHERE delivered IS NOT NULL");
+ $delivered = array();
+ while ($this->db->next_record())
+ {
+ $delivered[] = "'" . $this->db->f('id') . "'";
+ }
+
+ $orders = array();
+ $values = array();
+
+ $sql = 'SELECT fm_project.location_code as location,
fm_project.address as adresse,fm_workorder.*, bilagsnr,kidnr,belop as
invoice_amount,fakturadato,periode,forfallsdato,fakturanr,spvend_code as
vendor,'
+ . ' dima, fm_ecobilag.loc1 as loc1, dimb, mvakode,
dimd, saksbehandlerid, budsjettansvarligid, utbetalingid, oppsynsigndato,
saksigndato, budsjettsigndato,'
+ . ' utbetalingsigndato, merknad, kreditnota, kostra_id,
item_type, item_id, external_ref, currency, process_log'
+ . ' FROM fm_workorder'
+ . " {$this->join} fm_project ON
(fm_workorder.project_id = fm_project.id)"
+ . " {$this->join} fm_ecobilag ON (fm_workorder.id =
fm_ecobilag.pmwrkord_code)";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ $orders[] = $this->db->f('id');
+ $values[] = $this->db->Record;
+ }
+
+ if($delivered)
+ {
+ $sql = 'SELECT fm_project.location_code as
location, fm_project.address as adresse,fm_workorder.* FROM fm_workorder'
+ . " {$this->join} fm_project ON
(fm_workorder.project_id = fm_project.id)"
+ . " {$this->left_join} fm_ecobilagoverf ON
(fm_workorder.id = fm_ecobilagoverf.pmwrkord_code)"
+ . ' WHERE fm_workorder.status IN(' .
implode(",", $delivered) . ')'
+ . ' AND pmwrkord_code IS NULL';
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ if(
!in_array($this->db->f('id'),$orders ) )
+ {
+ $values[] = $this->db->Record;
+ }
+ }
+ }
+ return $values;
+ }
}
Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php 2011-09-11 13:22:57 UTC (rev
7571)
+++ trunk/property/inc/class.uiinvoice.inc.php 2011-09-11 13:23:57 UTC (rev
7572)
@@ -59,7 +59,8 @@
'download' => true,
'download_sub' => true,
'receipt' => true,
- 'edit' => true
+ 'edit' => true,
+ 'reporting' => true
);
function property_uiinvoice()
@@ -3297,4 +3298,79 @@
break;
}
}
+
+ public function reporting()
+ {
+ $acl_location = '.demo_location';
+ if(!$this->acl_read)
+ {
+ $this->bocommon->no_access();
+ return;
+ }
+
+ $type = phpgw::get_var('type', 'string', 'GET',
'deposition');
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] .=
"::{$type}";
+
+ $values = phpgw::get_var('values');
+
+ $receipt = array();
+ if($values)
+ {
+ // _debug_array($values);die();
+
+ if(isset($values['export_reconciliation']) &&
$values['export_reconciliation'])
+ {
+ if(!isset($values['periods']))
+ {
+ $type = 'reconciliation';
+
$receipt['error'][]=array('msg'=>lang('missing values'));
+ }
+ else
+ {
+
$this->bo->export_historical_transactions_at_periods($values['periods']);
+
+ }
+ }
+ else if(isset($values['export_deposition']) &&
$values['export_deposition'])
+ {
+ if(!isset($values['deposition']))
+ {
+ $type = 'deposition';
+
$receipt['error'][]=array('msg'=>lang('nothing to do'));
+ }
+ else
+ {
+ $this->bo->export_deposition();
+ }
+ }
+ }
+
+
+ $tab_info = array
+ (
+ 'deposition' => array('label' =>
lang('deposition'), 'link' => '#deposition'),
+ 'reconciliation' => array('label' =>
lang('reconciliation'), 'link' => '#reconciliation')
+ );
+
+ phpgwapi_yui::tabview_setup('reporting_tabview');
+
+ $msgbox_data =
isset($receipt)?$GLOBALS['phpgw']->common->msgbox_data($receipt):'';
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.reporting')),
+ 'accounting_periods' =>
array('options' => $this->bo->get_historical_accounting_periods()),
+ 'tabs'
=> phpgwapi_yui::tabview_generate($tab_info, $type)
+ );
+
+ $function_msg = lang('reporting');
+ $appname = lang('invoice');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice_reporting','attributes_form'));
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('reporting' => $data));
+
+ }
}
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2011-09-11 13:22:57 UTC (rev 7571)
+++ trunk/property/setup/phpgw_no.lang 2011-09-11 13:23:57 UTC (rev 7572)
@@ -498,6 +498,7 @@
delivered property no Levert
delivery address property no Leveringsadresse
deposit claim property no Krav mot depositum
+deposition property no Avsetning
description property no Beskrivelse
description order property no Bestilling til leverandør
descr property no Beskrivelse
@@ -1155,6 +1156,7 @@
percentage addition property no prosentvis tillegg
performed property no Utført
period property no Periode
+periods property no Perioder
permission property no rettighet
permissions property no Rettigheter
permissions are updated! property no rettigheter er oppdatert
@@ -1282,6 +1284,7 @@
re-assigned group property no Tildelt ny gruppe
receipt property no Kvittering
receipt date property no Kvitteringsdato
+reconciliation property no Avstemming
record property no Post
reference level property no Referanse nivå
regulations property no Forskrifter
@@ -1401,8 +1404,9 @@
select agreement group property no Velg en avtale-gruppe
select agreement_group property no Velg avtalegruppe
select all property no velg alle
-select a location property no vel en lokalisering
+select a location property no velg en lokalisering
select a location! property no Velg en lokalisering
+select a value property no velg en verdi
select a rental agreement type property no Velg en leieavtale-type
select a service agreement type property no Velg en
serviceavtale-type
select a standard-code from the norwegian standard property no
velg en standard NS-kode
Added: trunk/property/templates/base/invoice_reporting.xsl
===================================================================
--- trunk/property/templates/base/invoice_reporting.xsl
(rev 0)
+++ trunk/property/templates/base/invoice_reporting.xsl 2011-09-11 13:23:57 UTC
(rev 7572)
@@ -0,0 +1,77 @@
+<!-- $Id: demo.xsl 7561 2011-09-07 14:01:50Z sigurdne $ -->
+
+<!-- add / edit -->
+ <xsl:template match="reporting" xmlns:php="http://php.net/xsl">
+ <xsl:variable name="lang_download"><xsl:value-of
select="php:function('lang', 'download')" /></xsl:variable>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <div class="yui-navset yui-navset-top"
id="reporting_tabview">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+ <xsl:choose>
+ <xsl:when test="msgbox_data !=
''">
+ <table cellpadding="2"
cellspacing="2" width="90%" align="center">
+ <tr>
+ <td
align="left">
+
<xsl:call-template name="msgbox"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:when>
+ </xsl:choose>
+
+ <div class="yui-content">
+ <div id="deposition">
+ <table cellpadding="2"
cellspacing="2" width="90%" align="center">
+ <tr>
+ <td>
+
<xsl:value-of select="php:function('lang', 'deposition')" />
+
<xsl:text> </xsl:text>
+ <input
type="checkbox" name="values[deposition]" value="True">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'deposition')" />
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr height="50">
+ <td
valign="bottom">
+ <input
type="submit" name="values[export_deposition]" value="{$lang_download}">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'save')" />
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="reconciliation">
+ <table cellpadding="2"
cellspacing="2" width="90%" align="center">
+ <tr>
+ <td
valign="top">
+
<xsl:value-of select="php:function('lang', 'periods')" />
+
<p style="height: 150px; overflow: auto; border: 5px solid #eee; background:
#eee; color: #000; margin-bottom: 1.5em;">
+
<xsl:apply-templates select="accounting_periods/options"/>
+
</p>
+ </td>
+ </tr>
+ <tr height="50">
+ <td
valign="bottom">
+ <input
type="submit" name="values[export_reconciliation]" value="{$lang_download}">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'save')" />
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </form>
+ </xsl:template>
+
+
+ <xsl:template match="options">
+ <label><input type="checkbox" name="values[periods][]"
value="{id}" /> <xsl:value-of disable-output-escaping="yes" select="name"/>
</label><br />
+ </xsl:template>
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7572] property: reporting,
Sigurd Nes <=