[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4687] addons/1.3/colombia_general/trunk
- Subject: SF.net SVN: ledger-smb:[4687] addons/1.3/colombia_general/trunk
- From: ..hidden..
- Date: Fri, 27 Apr 2012 08:03:00 +0000
Revision: 4687
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4687&view=rev
Author: einhverfr
Date: 2012-04-27 08:03:00 +0000 (Fri, 27 Apr 2012)
Log Message:
-----------
Colombia Tax Module
Added Paths:
-----------
addons/1.3/colombia_general/trunk/LedgerSMB/
addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/
addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/Colombia.pm
Added: addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/Colombia.pm
===================================================================
--- addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/Colombia.pm (rev 0)
+++ addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/Colombia.pm 2012-04-27 08:03:00 UTC (rev 4687)
@@ -0,0 +1,72 @@
+#=====================================================================
+#
+# Colombia Tax support module for LedgerSMB
+# Based on Taxes::Simple
+# Taxes::Combia
+# Colombia tax application
+#
+# LedgerSMB
+# Small Medium Business Accounting software
+# http://www.ledgersmb.org/
+#
+#
+# Copyright (C) 2006
+# This work contains copyrighted information from a number of sources all used
+# with permission. It is released under the GNU General Public License
+# Version 2 or, at your option, any later version. See COPYRIGHT file for
+# details.
+#
+#
+#======================================================================
+# This package contains tax related functions:
+#
+# calculate_tax - calculates tax on subtotal
+# apply_tax - sets $value to the tax value for the subtotal
+# extract_tax - sets $value to the tax value on a tax-included subtotal
+#
+#====================================================================
+package Taxes::Simple;
+
+use Class::Struct;
+use Math::BigFloat;
+
+struct Taxes::Simple => {
+ taxnumber => '$',
+ description => '$',
+ rate => 'Math::BigFloat',
+ chart => '$',
+ account => '$',
+ value => 'Math::BigFloat',
+ minvalue => 'Math::BigFloat', #Ignored in Simple Tax rules
+ pass => '$'
+};
+
+sub calculate_tax {
+ my ( $self, $form, $subtotal, $extract, $passrate ) = @_;
+ if (abs($form->{subtotal}) < $tax->minvalue){
+ return 0;
+ }
+ my $rate = $self->rate;
+ my $tax = $subtotal * $rate / ( Math::BigFloat->bone() + $passrate );
+ $tax = $subtotal * $rate if not $extract;
+ return $tax;
+}
+
+sub apply_tax {
+ my ( $self, $form, $subtotal ) = @_;
+ my $tax = $self->calculate_tax( $form, $subtotal, 0 );
+ $self->value($tax);
+ return $tax;
+}
+
+sub extract_tax {
+ my ( $self, $form, $subtotal, $passrate ) = @_;
+ if (abs($form->{subtotal}) < $tax->minvalue){
+ return 0;
+ }
+ my $tax = $self->calculate_tax( $form, $subtotal, 1, $passrate );
+ $self->value($tax);
+ return $tax;
+}
+
+1;
Property changes on: addons/1.3/colombia_general/trunk/LedgerSMB/Taxes/Colombia.pm
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.