fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16491] billing


From: sigurdne
Subject: [Fmsystem-commits] [16491] billing
Date: Tue, 28 Mar 2017 12:08:27 -0400 (EDT)

Revision: 16491
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16491
Author:   sigurdne
Date:     2017-03-28 12:08:27 -0400 (Tue, 28 Mar 2017)
Log Message:
-----------
billing

Modified Paths:
--------------
    trunk/rental/inc/class.sobilling.inc.php
    trunk/rental/inc/class.socontract_price_item.inc.php
    trunk/rental/inc/class.uibilling.inc.php
    trunk/rental/inc/model/class.invoice.inc.php
    trunk/rental/setup/phpgw_no.lang

Modified: trunk/rental/inc/class.sobilling.inc.php
===================================================================
--- trunk/rental/inc/class.sobilling.inc.php    2017-03-28 13:54:48 UTC (rev 
16490)
+++ trunk/rental/inc/class.sobilling.inc.php    2017-03-28 16:08:27 UTC (rev 
16491)
@@ -312,7 +312,7 @@
                        $invoices = array();
                        foreach ($contracts_to_bill as $contract_id) // Runs 
through all the contracts that should be billed in this run
                        {
-                               $invoice = 
rental_invoice::create_invoice($decimals, $billing->get_id(), $contract_id, 
in_array($contract_id, $contracts_overriding_billing_start) ? true : false, 
$bill_from_timestamp, $billing_end_timestamp, in_array($contract_id, 
$contracts_bill_only_one_time) ? true : false, $dry_run, $billing_term); // 
Creates an invoice of the contract
+                               $invoice = 
rental_invoice::create_invoice($decimals, $billing->get_id(), $contract_id, 
in_array($contract_id, $contracts_overriding_billing_start) ? true : false, 
$bill_from_timestamp, $billing_end_timestamp, in_array($contract_id, 
$contracts_bill_only_one_time) ? true : false, $dry_run, $billing_term, 
$month); // Creates an invoice of the contract
                                if ($invoice != null)
                                {
                                        $total_sum += $invoice->get_total_sum();

Modified: trunk/rental/inc/class.socontract_price_item.inc.php
===================================================================
--- trunk/rental/inc/class.socontract_price_item.inc.php        2017-03-28 
13:54:48 UTC (rev 16490)
+++ trunk/rental/inc/class.socontract_price_item.inc.php        2017-03-28 
16:08:27 UTC (rev 16491)
@@ -52,8 +52,13 @@
                                if($filters['credits'])
                                {
                                        $filter_clauses[] = "is_one_time";
-                                       $filter_clauses[] = 
"rental_contract_price_item.total_price < 0.00";    
+                                       $filter_clauses[] = 
"rental_contract_price_item.total_price < 0.00";
                                }
+                               else if($filters['positive_one_time'])
+                               {
+                                       $filter_clauses[] = "is_one_time";
+                                       $filter_clauses[] = 
"rental_contract_price_item.total_price > 0.00";
+                               }
                                else
                                {
                                        $billing_term_id = 
(int)$filters['billing_term_id'];

Modified: trunk/rental/inc/class.uibilling.inc.php
===================================================================
--- trunk/rental/inc/class.uibilling.inc.php    2017-03-28 13:54:48 UTC (rev 
16490)
+++ trunk/rental/inc/class.uibilling.inc.php    2017-03-28 16:08:27 UTC (rev 
16491)
@@ -231,11 +231,16 @@
                                                                $month = 1;
                                                                
$billing_term_label = lang('free_of_charge');
                                                        }
-                                                       else
+                                                       else if ($billing_month 
== '2')
                                                        {
                                                                $month = 2;
                                                                
$billing_term_label = lang('credits');
                                                        }
+                                                       else
+                                                       {
+                                                               $month = 3;
+                                                               
$billing_term_label = lang('positive one time');
+                                                       }
                                                }
                                                else // yearly
                                                {
@@ -522,11 +527,16 @@
                                                $month = 1;
                                                $billing_term_label = 
lang('free_of_charge');
                                        }
-                                       else
+                                       else if ($billing_month == '2')
                                        {
                                                $month = 2;
                                                $billing_term_label = 
lang('credits');
                                        }
+                                       else
+                                       {
+                                               $month = 3;
+                                               $billing_term_label = 
lang('positive one time');
+                                       }
                                }
                                else // yearly
                                {
@@ -579,11 +589,21 @@
 
                                        $socontract_price_item = 
rental_socontract_price_item::get_instance();
 
-
+                                       $sort_ascending = false;
+                                       $search_for = '';
+                                       $search_type = '';
                                        //... 2. Contracts with one-time price 
items
                                        if($billing_term == 5)
                                        {
-                                               $filters2 = 
array('contract_ids_one_time' => true, 'credits' => true);
+                                               $filters2 = 
array('contract_ids_one_time' => true);
+                                               if($month == 2)
+                                               {
+                                                       $filters2['credits'] = 
true;
+                                               }
+                                               else if($month == 3)
+                                               {
+                                                       
$filters2['positive_one_time'] = true;
+                                               }
                                                $contracts = array();
                                        }
                                        else
@@ -961,6 +981,7 @@
                                        {
                                                $options[] = array('id' => 
$term_id . '-1', 'name' => lang($term_title), 'selected' => (($term_id . '-1' 
== $billing_term_selection) ? 1 : 0));
                                                $options[] = array('id' => 
$term_id . '-2', 'name' => 'Kreditering', 'selected' => (($term_id . '-2' == 
$billing_term_selection) ? 1 : 0));
+                                               $options[] = array('id' => 
$term_id . '-3', 'name' => lang('positive one time'), 'selected' => (($term_id 
. '-3' == $billing_term_selection) ? 1 : 0));
                                        }
                                        $current++;
                                        $billing_term_group_options[] = 
array('label' => lang($term_title), 'options' => $options);

Modified: trunk/rental/inc/model/class.invoice.inc.php
===================================================================
--- trunk/rental/inc/model/class.invoice.inc.php        2017-03-28 13:54:48 UTC 
(rev 16490)
+++ trunk/rental/inc/model/class.invoice.inc.php        2017-03-28 16:08:27 UTC 
(rev 16491)
@@ -329,7 +329,7 @@
                 * @param bool $bill_only_one_time      flag to indicate if the 
the invoice should only bill one time price elements
                 * @return rental_invoice       the newly created invoice
                 */
-               public static function create_invoice( int $decimals, int 
$billing_id, int $contract_id, bool $override, int $timestamp_invoice_start, 
int $timestamp_invoice_end, $bill_only_one_time, $dry_run = false, 
$billing_term = 0 )
+               public static function create_invoice( int $decimals, int 
$billing_id, int $contract_id, bool $override, int $timestamp_invoice_start, 
int $timestamp_invoice_end, $bill_only_one_time, $dry_run = false, 
$billing_term = 0, $month = 0)
                {
                        $contract = 
rental_socontract::get_instance()->get_single($contract_id);
 
@@ -363,8 +363,21 @@
                                {
                                        $filters2 = array(
                                                'contract_id' => 
$contract->get_id(),
-                                               'contract_ids_one_time' => 
true, 'credits' => true
+                                               'contract_ids_one_time' => true
                                        );
+                                       if($month == 2)
+                                       {
+                                               $filters2['credits'] = true;
+                                       }
+                                       else if($month == 3)
+                                       {
+                                               $filters2['positive_one_time'] 
= true;
+                                       }
+
+//                                     $filters2 = array(
+//                                             'contract_id' => 
$contract->get_id(),
+//                                             'contract_ids_one_time' => 
true, 'credits' => true
+//                                     );
                                }
                                else
                                {

Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang    2017-03-28 13:54:48 UTC (rev 16490)
+++ trunk/rental/setup/phpgw_no.lang    2017-03-28 16:08:27 UTC (rev 16491)
@@ -665,4 +665,5 @@
 select all     rental  no      Velg alle
 planned        rental  no      Planlagt
 email template rental  no      Standardtekster
-expired        rental  no      Utgått
\ No newline at end of file
+expired        rental  no      Utgått
+positive one time      rental  no      Positive engangsbeløp
\ No newline at end of file




reply via email to

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