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

SF.net SVN: ledger-smb:[2736] trunk



Revision: 2736
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2736&view=rev
Author:   einhverfr
Date:     2009-07-22 16:38:54 +0000 (Wed, 22 Jul 2009)

Log Message:
-----------
Adding missing single-payment UI template

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Asset.pm
    trunk/LedgerSMB/DBObject/Asset_Class.pm
    trunk/LedgerSMB/DBObject/Asset_Report.pm
    trunk/sql/modules/Assets-tables.sql
    trunk/sql/modules/Assets.sql

Added Paths:
-----------
    trunk/UI/payments/payment1_5.html

Modified: trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset.pm	2009-07-17 05:06:31 UTC (rev 2735)
+++ trunk/LedgerSMB/DBObject/Asset.pm	2009-07-22 16:38:54 UTC (rev 2736)
@@ -19,8 +19,8 @@
     my ($ref) = $self->exec_method(funcname => 'asset__save');
     $self->merge($ref);
     $self->{dbh}->commit || $self->error(
-                  $locale->text("Unable to save [_1] object", 
-                          $locale->text('Asset'))
+                  $self->{_locale}->text("Unable to save [_1] object", 
+                          $self->{_locale}->text('Asset'))
     );
     return $ref if $self->{dbh}->commit;
 }

Modified: trunk/LedgerSMB/DBObject/Asset_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset_Class.pm	2009-07-17 05:06:31 UTC (rev 2735)
+++ trunk/LedgerSMB/DBObject/Asset_Class.pm	2009-07-22 16:38:54 UTC (rev 2736)
@@ -19,12 +19,20 @@
     my ($ref) = $self->exec_method(funcname => 'asset_class__save');
     $self->merge($ref);
     $self->{dbh}->commit || $self->error(
-                  $locale->text("Unable to save [_1] object", 
-                          $locale->text('Asset Class'))
+                  $self->{_locale}->text("Unable to save [_1] object", 
+                          $self->{_locale}->text('Asset Class'))
     );
     return $ref if $self->{dbh}->commit;
 }
 
+sub get_metadata {
+    my ($self) = @_;
+    @{$self->{asset_accounts}} = $self->exec_method(funcname => 'asset_class__get_asset_accounts');
+    @{$self->{dep_accounts}} = $self->exec_method(funcname => 'asset_class__get_dep_accounts');
+    @{$self->{life_units}} = $self->exec_method(funcname => 'asset_class__get_life_units');
+    @{$self->{dep_methods}} = $self->exec_method(funcname => 'asset_class__get_dep_methods');
+}
+
 sub get_asset_class {
     my ($self) = @_;
     my ($ref) = $self->exec_method(funcname => 'asset_class__get');

Modified: trunk/LedgerSMB/DBObject/Asset_Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset_Report.pm	2009-07-17 05:06:31 UTC (rev 2735)
+++ trunk/LedgerSMB/DBObject/Asset_Report.pm	2009-07-22 16:38:54 UTC (rev 2736)
@@ -20,3 +20,5 @@
 
 sub get_report {
 }
+
+1;

Added: trunk/UI/payments/payment1_5.html
===================================================================
--- trunk/UI/payments/payment1_5.html	                        (rev 0)
+++ trunk/UI/payments/payment1_5.html	2009-07-22 16:38:54 UTC (rev 2736)
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+  <title><?lsmb titlebar -?></title>
+  <meta http-equiv="Pragma" content="no-cache" />
+  <meta http-equiv="Expires" content="-1" />
+  <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+  <link rel="stylesheet" href="css/<?lsmb stylesheet ?>" type="text/css" />
+
+  <meta http-equiv="content-type" content="text/html; charset=<?lsmb charset ?>" />  
+  <meta name="robots" content="noindex,nofollow" />
+
+</head>
+
+<body id="payment-1-body">
+
+<form name="search" method="post" action="payment.pl">
+<?lsmb PROCESS elements.html  # Include form elements helper. -?>
+<?lsmb login.type = 'hidden' ; INCLUDE input element_data=login -?>
+<?lsmb department.type = 'hidden' ; INCLUDE input element_data=department -?>
+<?lsmb currency.type = 'hidden' ; INCLUDE input element_data=currency -?>
+<?lsmb datefrom.type = 'hidden' ; INCLUDE input element_data=datefrom -?>
+<?lsmb dateto.type = 'hidden' ; INCLUDE input element_data=dateto -?>
+<?lsmb amountfrom.type = 'hidden' ; INCLUDE input element_data=amountfrom -?>
+<?lsmb amountto.type = 'hidden' ; INCLUDE input element_data=amountto -?>
+<?lsmb accountclass.type = 'hidden'; INCLUDE input element_data=accountclass -?>
+<?lsmb # The first_load field is required on payment2.html to initialize discounts the first time, on each subsequent update it wont exist-?>
+<?lsmb INCLUDE input element_data={
+            name => 'first_load',
+            id   => 'first_load',
+            type => 'hidden',
+            value => 'on'} ?>
+<?lsmb type.type = "hidden"; INCLUDE input element_data=type -?>
+<table width="100%">
+  <tr id="top-bar" class="listtop">
+    <th id="top-bar-header" class="listtop"><label  id="top-bar-header-label"><?lsmb  text('Choose a company') ?></th>
+  </tr>
+</table>
+<table width="100%">
+ <?lsmb i = 0; FOREACH item IN companies -?>
+ <?lsmb i = i + 1; j = i % 2; alterning_style = "listrow$j" ?>
+ 
+   <tr class="<?lsmb alterning_style -?>">
+     <td align="center"><?lsmb i -?> </td>
+     <td align="center"><?lsmb item.name -?>  </td>
+     <td align="center">
+     <input type="radio" name="vendor-customer" id="vendor-customer_id" value="<?lsmb  item.id -?>--<?lsmb item.name -?>" />
+     </td>
+  <?lsmb END -?>   
+</table>
+
+<?lsmb INCLUDE button element_data=action ?>
+
+</form>
+</body>
+</html>

Modified: trunk/sql/modules/Assets-tables.sql
===================================================================
--- trunk/sql/modules/Assets-tables.sql	2009-07-17 05:06:31 UTC (rev 2735)
+++ trunk/sql/modules/Assets-tables.sql	2009-07-22 16:38:54 UTC (rev 2736)
@@ -23,10 +23,11 @@
 CREATE TABLE asset_life_unit(
 	id serial unique not null,
 	unit text primary key,
-	unit_class int not null references asset_unit_class(id)
+	unit_class int not null references asset_unit_class(id),
+	div numeric not null
 );
 
-INSERT INTO asset_life_unit(unit, unit_class) values ('year', 1);
+INSERT INTO asset_life_unit(unit, unit_class, div) values ('year', 1, 1);
 -- year is only supported unit at present
 
 CREATE TABLE asset_class (

Modified: trunk/sql/modules/Assets.sql
===================================================================
--- trunk/sql/modules/Assets.sql	2009-07-17 05:06:31 UTC (rev 2735)
+++ trunk/sql/modules/Assets.sql	2009-07-22 16:38:54 UTC (rev 2736)
@@ -58,6 +58,53 @@
 SELECT * FROM asset_class ORDER BY label;
 $$ LANGUAGE SQL;
 
+CREATE TYPE asset_class_result AS (
+	id int,
+	asset_account_id int,
+	asset_accno text,
+	asset_description text,
+	dep_account_id int,
+	dep_accno text,
+	dep_description text,
+	method text, 
+	method_id int, 
+	life_unit text, 
+	life_unit_id int, 
+	label text
+);
+
+CREATE OR REPLACE FUNCTION asset_class__search
+(in_asset_account_id int, in_dep_account_id int, 
+in_method int, in_life_unit int, in_label text)
+RETURNS SETOF asset_class_result AS
+$$
+DECLARE out_var asset_class_result;
+BEGIN
+	FOR out_var IN
+		SELECT ac.id, ac.asset_account_id, aa.accno, aa.description, 
+			ad.accno, ad.description, m.label, ac.method_id,
+			lu.label, ac.life_unit_id, ac.label
+		FROM asset_class ac
+		JOIN account aa ON (aa.id = ac.asset_account_id)
+		JOIN account ad ON (ad.id = ac.dep_account_id)
+		JOIN asset_dep_method m ON (ac.method_id = m.id)
+		JOIN asset_life_unit lu ON (ac.life_unit_id = lu.id)
+		WHERE 
+			(in_asset_account_id is null 
+				or in_asset_account_id = ac.asset_account_id)
+			AND (in_dep_account_id is null OR
+				in_dep_account_id = ac.dep_account_id)
+			AND (in_method is null OR in_method = ac.method_id)
+			AND (in_life_unit is null 
+				OR in_life_unit = ac.life_unit_id)
+			AND (in_label IS NULL OR ac.label LIKE 
+				'%' || in_label || '%')
+	LOOP
+		RETURN NEXT out_var;
+	END LOOP;
+END;
+$$ language plpgsql;
+
 CREATE OR REPLACE FUNCTION asset_class__save
 (in_id int, in_asset_account_id int, in_dep_account_id int, 
 in_method int, in_life_unit int, in_label text)
@@ -100,6 +147,55 @@
 END;
 $$ language plpgsql;
 
+CREATE OR REPLACE FUNCTION asset__search
+(in_asset_class int, in_description text, in_tag text, 
+in_purchase_date date, in_purchase_value numeric,
+in_usable_life numeric, in_salvage_value numeric)
+RETURNS SETOF asset_item AS $$
+DECLARE out_val asset_item;
+BEGIN
+	FOR out_val IN
+		SELECT * FROM asset_item
+		WHERE (in_asset_class is null 
+			or asset_class_id = in_asset_class)
+			AND (in_description is null or description 
+				LIKE '%' || in_description || '%')
+			and (in_tag is not null or tag like '%'||in_tag||'%')
+			AND (in_purchase_date is null 
+				or purchase_date = in_purchase_date)
+			AND (in_purchase_value is null
+				or in_purchase_value = purchase_value)
+			AND (in_usable_life is null
+				or in_usable_life = usable_life)
+			AND (in_salvage_value is null
+				OR in_salvage_value = salvage_value)
+	LOOP
+		RETURN NEXT out_val;
+	END LOOP;
+END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION asset_class__get_asset_accounts()
+RETURNS SETOF account AS $$
+SELECT * FROM account 
+WHERE id IN 
+	(select account_id from account_link where description = 'Fixed_Asset')
+ORDER BY accno;
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION asset_class__get_dep_accounts()
+RETURNS SETOF account AS $$
+SELECT * FROM account 
+WHERE id IN 
+	(select account_id from account_link where description = 'Asset_Dep')
+ORDER BY accno;
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION asset_class__get_life_units()
+RETURNS SETOF asset_life_unit AS $$
+	SELECT * FROM asset_life_unit;
+$$ LANGUAGE SQL;
+
 CREATE OR REPLACE FUNCTION asset__save
 (in_id int, in_asset_class int, in_description text, in_tag text, 
 in_purchase_date date, in_purchase_value numeric,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.