fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [15749] property: invoice handling


From: sigurdne
Subject: [Fmsystem-commits] [15749] property: invoice handling
Date: Wed, 28 Sep 2016 14:45:32 +0000 (UTC)

Revision: 15749
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15749
Author:   sigurdne
Date:     2016-09-28 14:45:31 +0000 (Wed, 28 Sep 2016)
Log Message:
-----------
property: invoice handling

Modified Paths:
--------------
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2016-09-28 10:26:36 UTC (rev 
15748)
+++ trunk/property/inc/class.soinvoice.inc.php  2016-09-28 14:45:31 UTC (rev 
15749)
@@ -597,10 +597,10 @@
                        }
 
                        $groupmethod = "GROUP BY 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,"
-                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start";
+                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start,external_voucher_id";
 
                        $sql = "SELECT DISTINCT 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,sum(belop) as belop, 
sum(godkjentbelop) as godkjentbelop,"
-                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start"
+                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start,external_voucher_id"
                                . " FROM {$table}"
 //                             . " {$this->join} fm_ecoart ON fm_ecoart.id = 
$table.artid"
 //                             . " {$this->join} fm_workorder ON 
fm_workorder.id = $table.pmwrkord_code"
@@ -613,8 +613,7 @@
                        $values = array();
                        while ($this->db->next_record())
                        {
-                               $values[] = array
-                                       (
+                               $values[] = array(
                                        'workorder_id' => 
$this->db->f('pmwrkord_code'),
                                        'voucher_id' => 
$this->db->f('bilagsnr'),
                                        'voucher_out_id' => 
$this->db->f('bilagsnr_ut'),
@@ -626,7 +625,8 @@
                                        'period' => $this->db->f('periode'),
                                        'periodization' => 
$this->db->f('periodization'),
                                        'periodization_start' => 
$this->db->f('periodization_start'),
-                                       'budget_responsible' => 
$this->db->f('budsjettansvarligid')
+                                       'budget_responsible' => 
$this->db->f('budsjettansvarligid'),
+                                       'external_voucher_id' => 
$this->db->f('external_voucher_id'),
                                );
                        }
 

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2016-09-28 10:26:36 UTC (rev 
15748)
+++ trunk/property/inc/class.uitts.inc.php      2016-09-28 14:45:31 UTC (rev 
15749)
@@ -2580,6 +2580,7 @@
 
                                $content_invoice[] = array
                                        (
+                                       'external_voucher_id'   => 
$entry['external_voucher_id'],
                                        'voucher_id' => ($_lean) ? 
$entry['voucher_id'] : $link_voucher_id,
                                        'voucher_out_id' => 
$entry['voucher_out_id'],
                                        'status' => $entry['status'],
@@ -2606,14 +2607,63 @@
                                $approved_amount += $entry['approved_amount'];
                        }
 
+                       foreach ($invoices as $entry)
+                       {
+
+                               $invoice_config = 
CreateObject('admin.soconfig', $GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+
+                               $directory_attachment = 
rtrim($invoice_config->config_data['import']['local_path'], '/') . 
'/attachment/' .$entry['external_voucher_id'];
+                               $attachmen_list = array();
+                               try
+                               {
+                                       $dir = new 
DirectoryIterator("$directory_attachment/");
+                                       if (is_object($dir))
+                                       {
+                                               foreach ($dir as $file)
+                                               {
+                                                       if ($file->isDot() || 
!$file->isFile() || !$file->isReadable())
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       $attachmen_list[] = 
array(
+                                                               'voucher_id'    
=> $entry['external_voucher_id'],
+                                                               'file_name'     
        => (string)$file
+                                                       );
+                                               }
+                                       }
+                               }
+                               catch (Exception $e)
+                               {
+
+                               }
+                       }
+                       $attachmen_def = array(
+                               array(
+                                       'key' => 'voucher_id',
+                                       'label' => 'key',
+                                       'hidden' => false
+                                       ),
+                               array(
+                                       'key' => 'file_name',
+                                       'label' => lang('attachments'),
+                                       'hidden' => false,
+                                       'sortable' => true,
+                                       )
+                               );
+
                        $invoice_def = array
                                (
                                array(
-                                       'key' => 'voucher_id',
-                                       'label' => lang('bilagsnr'),
+                                       'key' => 'external_voucher_id',
+                                       'label' => 'key',
                                        'sortable' => false,
                                        'value_footer' => lang('Sum')),
                                array(
+                                       'key' => 'voucher_id',
+                                       'label' => lang('bilagsnr'),
+                                       'sortable' => false),
+                               array(
                                        'key' => 'voucher_out_id',
                                        'hidden' => true),
                                array(
@@ -2684,8 +2734,22 @@
                                )
                        );
 
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_8',
+                               'requestUrl' => "''",
+                               'data' => json_encode($attachmen_list),
+                               'ColumnDefs' => $attachmen_def,
+                               'config' => array(
+                                       array(
+                                               'disableFilter' => true),
+                                       array(
+                                               'disablePagination' => true)
+                               )
+                       );
 
 
+
                        // end invoice table
 
                        
//----------------------------------------------datatable settings--------

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2016-09-28 10:26:36 UTC (rev 
15748)
+++ trunk/property/templates/base/tts.xsl       2016-09-28 14:45:31 UTC (rev 
15749)
@@ -1124,7 +1124,24 @@
                                                                                
</div>
                                                                        </div>
 
+                                                                       <div 
class="pure-control-group">
+                                                                               
<div class="pure-custom">
+                                                                               
        <xsl:for-each select="datatable_def">
+                                                                               
                <xsl:if test="container = 'datatable-container_8'">
+                                                                               
                        <xsl:call-template name="table_setup">
+                                                                               
                                <xsl:with-param name="container" select 
='container'/>
+                                                                               
                                <xsl:with-param name="requestUrl" select 
='requestUrl' />
+                                                                               
                                <xsl:with-param name="ColumnDefs" select 
='ColumnDefs' />
+                                                                               
                                <xsl:with-param name="tabletools" select 
='tabletools' />
+                                                                               
                                <xsl:with-param name="data" select ='data' />
+                                                                               
                                <xsl:with-param name="config" select ='config' 
/>
+                                                                               
                        </xsl:call-template>
+                                                                               
                </xsl:if>
+                                                                               
        </xsl:for-each>
+                                                                               
</div>
+                                                                       </div>
 
+
                                                                </xsl:when>
                                                        </xsl:choose>
                                                </xsl:when>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]