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

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



Revision: 2019
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2019&view=rev
Author:   einhverfr
Date:     2007-12-29 10:48:07 -0800 (Sat, 29 Dec 2007)

Log Message:
-----------
Committing David Mora's Payment patches

Modified Paths:
--------------
    trunk/UI/payments/payment1.html
    trunk/UI/payments/payment2.html
    trunk/scripts/payment.pl

Modified: trunk/UI/payments/payment1.html
===================================================================
--- trunk/UI/payments/payment1.html	2007-12-29 05:38:34 UTC (rev 2018)
+++ trunk/UI/payments/payment1.html	2007-12-29 18:48:07 UTC (rev 2019)
@@ -17,7 +17,7 @@
 
 <form name="search" method="post" action="payment.pl">
 	
-<?lsmb PROCESS 'elements.html'  # Include form elements helper. ?>
+<?lsmb PROCESS elements.html  # Include form elements helper. ?>
 
 <?lsmb PROCESS input element_data=sort ?>
 <?lsmb PROCESS input element_data=nextsub ?>

Modified: trunk/UI/payments/payment2.html
===================================================================
--- trunk/UI/payments/payment2.html	2007-12-29 05:38:34 UTC (rev 2018)
+++ trunk/UI/payments/payment2.html	2007-12-29 18:48:07 UTC (rev 2019)
@@ -15,7 +15,10 @@
  <form name="pay_single_dues" method="post" action="payment.pl">
 
  <?lsmb PROCESS elements.html  # Include form elements helper. ?>
-
+ <?lsmb accountclass.type = 'hidden';
+        INCLUDE input element_data=accountclass ?>
+ <?lsmb login.type = 'hidden' ; INCLUDE input element_data=login ?>
+       
  <table width=100%>
   <tr id="top_bar" class="listtop">
     <th id="top_bar_header" class="listtop"><?lsmb header.text ?></th>
@@ -27,7 +30,9 @@
     <table id="cv_info_table">
      <tr id="cv_row">
       <th class="label_left" id="cv_label_column"><?lsmb  text('Vendor') ?></th>
-       <td id="cv_column"><?lsmb vc.name ?></td>
+       <td id="cv_column">
+       		<?lsmb vc.name ?><?lsmb vendorcustomer.type = 'hidden'; INCLUDE input element_data=vendorcustomer?>       		
+       </td>
      </tr>
      <tr id="cv_address_row">
       <th valign="top" align="right" id="cv_address_label_column"><?lsmb text('Address') ?></th>
@@ -44,7 +49,7 @@
      </tr>
      <tr align="right" id="notes_row">
       <th valign="top" id="notes_column"><?lsmb text('Notes') ?></th>
-      <td><textarea id="notes" name="notes" cols="35" rows="3"></textarea></td>
+      <td><textarea id="notes" name="notes" cols="35" rows="3"><?lsmb notes ?></textarea></td>
      </tr>
     </table>
    </td>
@@ -56,7 +61,7 @@
       <th align="right" nowrap id="project_label_column"><?lsmb text('Projects') ?>:</th>
       <td colspan="2" id="project_column">
           <?lsmb project.text ?>
-	  <?lsmb  project.type="hidden"; PROCESS input element_data=project ?>
+	  <?lsmb  project.type="hidden"; INCLUDE input element_data=project ?>
      </td>
      </tr>
      <?lsmb END ?>
@@ -66,41 +71,61 @@
       <th align="right" nowrap id="department_label_column"><?lsmb  text('Department')  ?>:</th>
       <td colspan="2" id="department_column">
        <?lsmb  department.text ?>
-       <?lsmb  department.type="hidden"; PROCESS input element_data=department ?>
+       <?lsmb  department.type="hidden"; INCLUDE input element_data=department ?>
       </td>
      </tr>
      <?lsmb END ?>
      <tr id="account_row">
      <?lsmb  #here goes all the posible accounts were the paid can be done  ?>
       <th align="right" nowrap id="account_label_column"><?lsmb text('Account') ?></th>
-      <td colspan="2" id="account_column"><?lsmb PROCESS select element_data=account ?></td>
+      <td colspan="2" id="account_column">
+       <select id="account" name="account">
+        <?lsmb FOREACH item IN account -?>
+         <option value="<?lsmb item.id -?>" <?lsmb IF item.id ==  selected_account -?> selected <?lsmb END ?>><?lsmb item.description -?></option>
+        <?lsmb END -?>
+       </select> 
+     </td>
      </tr>
      <tr id="date_row"><?lsmb # here goes an input where the date can be written, we can also use a java calendar :). We can use an ajax script to call the Exchange rate of the input date wich can be called with the onChange Method	  ?>
       <th align="right" nowrap id="date_label_column"><?lsmb text('Date') ?></th>
-      <td colspan="2" id="date_column"> <?lsmb PROCESS input element_data=datepaid ?> </td>
+      <td colspan="2" id="date_column"> <?lsmb INCLUDE input element_data=datepaid ?> </td>
      </tr>
      <tr id="source_row">
-     <?lsmb # here goes all the posible sources wich we can use ?>
+     <?lsmb # here goes all the posible sources wich we can use -?>
       <th align="right" nowrap id="source_label_column"><?lsmb text('Source')?></th>
-       <td width="28%" id="source_column"><?lsmb PROCESS select element_data=source ?></td>
-       <td id="source_text_column"><?lsmb PROCESS input element_data=source_text ?></td>
+      <td width="28%" id="source_column">
+         <select id="source" name="source">
+          <?lsmb FOREACH item IN source -?>
+           <option value="<?lsmb item -?>"<?lsmb IF item == selected_source -?> selected <?lsmb END ?>><?lsmb item -?></option>
+          <?lsmb END -?>
+         </select>
+      </td>
+      <td id="source_text_column">
+      <?lsmb INCLUDE input element_data={ name  => 'source_value' 
+                                          id    => 'source_value'
+                                          value => source_value } -?>
+      </td>
      </tr>
      <tr id="currency_row">
      <?lsmb #  here goes the selected currency in step 1 ?>
-      <th align="right" id="currency_label_column"><?lsmb text('Currency') ?>:</th>
-      <td id="currency_column"><?lsmb PROCESS label element_data=curr ?></td>
+      <th align="right" id="currency_label_column"><?lsmb text('Currency') -?>:</th>
+      <td id="currency_column">
+      		<?lsmb curr.value -?><?lsmb curr.type='hidden'; INCLUDE input element_data=curr -?>
+      </td>
      </tr>
      <?lsmb # here goes the exchange rate of the selected currency, it can be done by the ajax script or the update button ?>
      <?lsmb  IF defaultcurrency.text != curr.text # Only process element if one exists. ?>
       <tr id="exrate_row">
+      
        <th valig="top" align="right" id="exrate_label_column"><?lsmb text('Exchange Rate') ?>:</th>
        <td id="exrate_column">
-        <?lsmb  IF date_curr.value ?>
-         <?lsmb  date_curr.text ?>
-        <?lsmb  END ?>
-        <?lsmb  IF !date_curr.value ?>
-         <?lsmb PROCESS input element_data=date_curr ?>
-        <?lsmb  END ?>
+       <?lsmb  IF exrate.value -?>        
+         <?lsmb  exrate.text -?>
+         <?lsmb exrate.type='hidden'; INCLUDE input element_data=exrate -?>
+        <?lsmb  END -?>
+        <?lsmb  IF !exrate.value -?>
+         <?lsmb INCLUDE input element_data=exrate -?>
+        <?lsmb  END -?>
        </td>
       </tr>
      <?lsmb END ?>
@@ -108,7 +133,7 @@
    </td>
   </tr>
  </table>
- <table width="100%" border="1">
+ <table width="100%">
   <tr class="listheading">
    <?lsmb FOREACH column IN column_headers  # Loop through columns ?>
    <th class="listheading"><?lsmb column.text ?></th>
@@ -126,36 +151,67 @@
     <td><?lsmb row.amount ?></td>
     <td><?lsmb row.paid ?></td>
     <td><?lsmb row.due ?></td>
-    <?lsmb IF defaultcurrency.text != curr.text ?>
+    <?lsmb IF defaultcurrency.text != curr.value ?>
     <td><?lsmb row.exchange_rate ?></td>
     <td><?lsmb row.due_fx ?></td>
     <td><div id="<?lsmb "div_topay_invoice_$i" ?>"><?lsmb row.topay ?></div></td>
     <?lsmb END ?> 
     <?lsmb #This should be computed and updated to the div using  ?> 
-    <td><?lsmb PROCESS input  element_data=row.topay_fx ?><div id="<?lsmb "div_topay_$i" ?>">
-    <hr />  
-    <table>
-     <tr id="<?lsmb "account-row$i"?>">
-      <?lsmb # here goes all the posible accounts were the paid can be  done ?>
-      <th align="right" nowrap id="<?lsmb "account_label_column$i" ?>"><?lsmb text('Account') ?></th>
-      <td colspan="2" id="<?lsmb "account_column$i" ?>"><?lsmb PROCESS select element_data=account ?></td>
-     </tr>
-     <tr id="<?lsmb "source_row$i" ?>">
-      <?lsmb # here goes all the posible sources wich we can used ?>
-      <th align="right" nowrap id="<?lsmb "source_label_column$i" ?>"><?lsmb text('Source') ?></th>
-      <td width="28%" id="<?lsmb "source_column$i" ?>"><?lsmb PROCESS select element_data=source ?></td>
-      <td><?lsmb PROCESS input element_data=source_text ?></td>   
-      <td nowrap align="left"><input  name="<?lsmb "optionalpay_$i" ?>" type="checkbox"  class="checkbox"></td>
-     </tr>
-    </table>
-   </div>
+    <td><?lsmb INCLUDE input  element_data=row.topay_fx ?>
+     <div id="<?lsmb "div_topay_$i" ?>">
+      <hr />  
+      <table>
+       <tr id="<?lsmb "account-row$i"?>">
+        <?lsmb # here goes all the posible accounts were the paid can be  done ?>
+        <th align="right" nowrap id="<?lsmb "account_label_column$i" ?>"><?lsmb text('Account') ?></th>
+        <td colspan="2" id="<?lsmb "account_column$i" ?>">
+         <select id="account_<?lsmb row.invoice.id -?>" name="account_<?lsmb row.invoice.id -?>">
+          <?lsmb FOREACH item IN account -?>
+           <option value="<?lsmb item.id -?>" <?lsmb IF item.id == row.selected_account -?> selected <?lsmb END ?>><?lsmb item.description -?></option>
+          <?lsmb END -?>
+         </select>
+        </td>
+       </tr>
+       <tr id="<?lsmb "source_row$i" ?>">
+        <?lsmb # here goes all the posible sources wich we can used ?>
+        <th align="right" nowrap id="<?lsmb "source_label_column$i" ?>"><?lsmb text('Source') ?></th>
+        <td width="28%" id="<?lsmb "source_column$i" ?>">
+         <select id="source_<?lsmb row.invoice.id -?>" name="source_<?lsmb row.invoice.id -?>">
+          <?lsmb FOREACH item IN source -?>
+           <option value="<?lsmb item -?>"<?lsmb IF item == row.selected_source -?> selected <?lsmb END ?>><?lsmb item -?></option>
+          <?lsmb END -?>
+         </select>
+        </td>
+        <td><?lsmb INCLUDE input element_data={
+                                              name  => "source_text_$row.invoice.id",
+                                              id    => "source_text_$row.invoice.id",
+                                              value => row.source_text 
+                                              } -?></td>   
+        <td nowrap align="left"><input  name="<?lsmb "optional_pay_$row.invoice.id" -?>"  id="<?lsmb "optional_pay_$row.invoice.id" -?>" type="checkbox"  class="checkbox"
+        <?lsmb IF row.optional -?> checked <?lsmb END -?>></td>
+       </tr>
+      </table>
+     </div>
+     </td>
+     <td valign="MIDDLE"><input type="checkbox" name="checkbox_<?lsmb
+     row.invoice.id ?>"></td>
    <?lsmb END ?>
+   </tr>
   </table>
   <hr />
-  <?lsmb PROCESS button element_data=post ?>
-  <?lsmb PROCESS button element_data=post_and_print ?>
-  <?lsmb PROCESS select element_data=format ?>
-  <?lsmb PROCESS select element_data=media ?>
+  <?lsmb post.accesskey   = 'U';
+         INCLUDE button element_data=update ?>
+  <?lsmb post.accesskey   = 'P';
+         INCLUDE button element_data=post ?>
+  <?lsmb post_and_print.accesskey = 'R';
+         INCLUDE button element_data=post_and_print ?>
+  <?lsmb INCLUDE select element_data=format ?>
+  <?lsmb INCLUDE select element_data=media ?>
+  <?lsmb FOREACH element_data IN selectedcheckboxes  ?>
+    <?lsmb element_data.type  ='hidden';
+    	   element_data.value ='checked'; 
+           INCLUDE input element_data?>
+  <?lsmb END ?>
   </form>
  </body>
-</html>
+</html>
\ No newline at end of file

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2007-12-29 05:38:34 UTC (rev 2018)
+++ trunk/scripts/payment.pl	2007-12-29 18:48:07 UTC (rev 2019)
@@ -277,18 +277,29 @@
 }
   
 
+=item payment
+
+This method is used to set the filter screen and prints it, using the 
+TT2 system. (hopefully it will... )
+
+=back
+
+=cut
+
 sub payment {
  my ($request)    = @_;  
  my $locale       = $request->{_locale};
  my  $dbPayment = LedgerSMB::DBObject::Payment->new({'base' => $request});
+ 
 # Lets get the project data... 
  my  @projectOptions; 
  my  @arrayOptions  = $dbPayment->list_open_projects();
- push @projectOptions, {}; #A blank field on the select box 
+  push @projectOptions, {}; #A blank field on the select box 
  for my $ref (0 .. $#arrayOptions) {
        push @projectOptions, { value => $arrayOptions[$ref]->{id}."--".$arrayOptions[$ref]->{projectnumber}."--".$arrayOptions[$ref]->{description},
                                 text => $arrayOptions[$ref]->{projectnumber}."--".$arrayOptions[$ref]->{description}};
  }
+
 # Lets get the departments data...
   my @departmentOptions;
   my $role =  $request->{type} eq 'receipt' ? 'P' : 'C';
@@ -298,6 +309,7 @@
       push @departmentOptions, {  value => $arrayOptions[$ref]->{id}."--".$arrayOptions[$ref]->{description},
                                   text => $arrayOptions[$ref]->{description}};
   }
+
 # Lets get the customer or vendor :)
  my @vcOptions;
  @arrayOptions = $dbPayment->get_open_accounts();
@@ -373,7 +385,6 @@
   user     => $request->{_user},
   locale   => $request->{_locale},
   path     => 'UI/payments',
-#  path     => 'UI',
   template => 'payment1',
   format => 'HTML', );
 $template->render($select);# And finally, Lets print the screen :)
@@ -393,42 +404,42 @@
 sub payment2 {
 my ($request) = @_;
 my $locale       = $request->{_locale};
-my   $dbPayment = LedgerSMB::DBObject::Payment->new({'base' => $request});
-
+my $Payment = LedgerSMB::DBObject::Payment->new({'base' => $request});
+# VARIABLES
+my ($project_id, $project_number, $project_name, $department_id, $department_name );
 my @array_options;
-# LETS GET THE CUSTOMER/VENDOR INFORMATION	
- ($dbPayment->{entity_id}, my $vendor_customer_name) = split /--/ , $request->{'vendor-customer'};
-
+my @project;
+my @selected_checkboxes;
+my @department;
 my @array_options;
+my @currency_options;
 my $exchangerate;
+# LETS GET THE CUSTOMER/VENDOR INFORMATION	
+($Payment->{entity_id}, my $vendor_customer_name) = split /--/ , $request->{'vendor-customer'};
+my @vc_options;
 
..hidden.. = $Payment->get_vc_info();
+#$request->error($array_options[0]->{name});
 # LETS BUILD THE PROJECTS INFO
 # I DONT KNOW IF I NEED ALL THIS, BUT AS IT IS AVAILABLE I'LL STORE IT FOR LATER USAGE.
-my ($project_id, $project_number, $project_name)  = split /--/ ,  $request->{projects} ; 
-my @project = { name => 'project',  text => $project_number.' '.$project_name,  value => $project_id   };
+if ($request->{projects}) {
+  ($project_id, $project_number, $project_name)  = split /--/ ,  $request->{projects} ; 
+  @project = { name => 'projects',  text => $project_number.' '.$project_name,  value => $request->{projects}};
+}
 # LETS GET THE DEPARTMENT INFO
-my ($department_id, $department_name)             = split /--/, $request->{department};
-my @department = { name => 'department',  text => $department_name,  value => $department_id };
+if ($request->{department}) {
+ ($department_id, $department_name)             = split /--/, $request->{department};
+ @department = { name => 'department',  text => $department_name,  value => $request->{department}};
+} 
 # LETS GET ALL THE ACCOUNTS
-my @account_options;
..hidden.. = $dbPayment->list_accounting();
-for my $ref (0 .. $#array_options) {
-      push @account_options, {    value => $array_options[$ref]->{id},
-                                  text =>  $array_options[$ref]->{description}};
-}
+my @account_options = $Payment->list_accounting();
 # LETS GET THE POSSIBLE SOURCES
-my @sources_options;
..hidden.. = $dbPayment->get_sources(\%$locale);
-for my $ref (0 .. $#array_options) {
-   push @sources_options, { value => $array_options[$ref],
-                            text =>  $array_options[$ref]};
-}
+my @sources_options = $Payment->get_sources(\%$locale);
 # WE MUST PREPARE THE ENTITY INFORMATION
-  @array_options = $dbPayment->get_vc_info();
..hidden.. = $Payment->get_vc_info();
 # LETS BUILD THE CURRENCIES INFORMATION 
 # FIRST, WE NEED TO KNOW THE DEFAULT CURRENCY
-my $default_currency = $dbPayment->get_default_currency(); 
-my @currency_options;
+my $default_currency = $Payment->get_default_currency(); 
 # LETS BUILD THE COLUMN HEADERS WE ALWAYS NEED 
 # THE OTHER HEADERS WILL BE BUILT IF THE RIGHT CONDITIONS ARE MET.
 # -----------------------------------------------
@@ -436,23 +447,15 @@
 # ON THE SCREEN ALL THE TIME, SO IF THEY ARE USING THE DEFAULT CURRENCY WE WONT PRINT IT
 my $currency_text  =  $request->{curr} eq $default_currency ? '' : '('.$request->{curr}.')';
 my $default_currency_text = $currency_text ? '('.$default_currency.')' : '';
-
-my @columnAS =  ({text => $locale->text('Invoice')},
-                       {text => $locale->text('Date')},
-                       {text => $locale->text('Total').$default_currency_text},
-                       {text => $locale->text('Paid').$default_currency_text},
-                       {text => $locale->text('Amount Due').$default_currency_text},
-                       {text => $locale->text('To pay').$default_currency_text} 
-                      );
-
 my @column_headers =  ({text => $locale->text('Invoice')},
                        {text => $locale->text('Date')},
                        {text => $locale->text('Total').$default_currency_text},
                        {text => $locale->text('Paid').$default_currency_text},
                        {text => $locale->text('Amount Due').$default_currency_text},
-                       {text => $locale->text('To pay').$default_currency_text} 
-                      );
+                       {text => $locale->text('To pay').$default_currency_text}
+                       );
  # WE NEED TO KNOW IF WE ARE USING A CURRENCY THAT NEEDS AN EXCHANGERATE
+ 
  if ($default_currency ne $request->{curr} ) {
  # FIRST WE PUSH THE OTHER COLUMN HEADERS WE NEED    
      push @column_headers, {text => $locale->text('Exchange Rate')},
@@ -462,99 +465,145 @@
      @column_headers[5,6,7] = @column_headers[6,7,5];
  # DOES THE CURRENCY IN USE HAS AN EXCHANGE RATE?, IF SO 
  # WE MUST SET THE VALUE, OTHERWISE THE UI WILL HANDLE IT
-       $exchangerate = $dbPayment->get_exchange_rate($request->{curr}, $dbPayment->{current_date});
+   $exchangerate = $request->{exrate} ? 
+                   $request->{exrate} :
+                   $Payment->get_exchange_rate($request->{curr}, 
+                   $request->{datepaid} ? $request->{datepaid} : $Payment->{current_date});
    if ($exchangerate) {
      @currency_options = {
-          name => 'date_curr',
+          name => 'exrate',
           value => "$exchangerate", #THERE IS A STRANGE BEHAVIOUR WITH THIS, 
           text =>  "$exchangerate"  #IF I DONT USE THE DOUBLE QUOTES, IT WILL PRINT THE ADDRESS
                                     #THERE MUST BE A REASON FOR THIS, I MUST RETURN TO IT LATER
 	  };
    } else {
    @currency_options = {
-        name => 'date_curr'};
+        name => 'exrate'};
    }
  
  } else {
  # WE MUST SET EXCHANGERATE TO 1 FOR THE MATHS SINCE WE
  # ARE USING THE DEFAULT CURRENCY
    $exchangerate = 1;
- }
+   @currency_options = {
+                          name => 'exrate',
+                          value => 1, 
+                          text =>  1 
+                       };
+  }
+
+ # FINALLY WE ADD TO THE COLUMN HEADERS A LAST FIELD TO PRINT THE CLOSE INVOICE CHECKBOX TRICK :)
+ push @column_headers, {text => 'X'};
 # WE NEED TO QUERY THE DATABASE TO CHECK FOR OPEN INVOICES
 # IF WE DONT HAVE ANY INVOICES MATCHING THE FILTER PARAMETERS, WE WILL WARN THE USER AND STOP
 # THE PROCCESS. 
 my @invoice_data;
..hidden..  = $dbPayment->get_open_invoices(); 
..hidden..  = $Payment->get_open_invoices(); 
 if (!$array_options[0]->{invoice_id}) { 
   $request->error($locale->text("Nothing to do"));
 }
 for my $ref (0 .. $#array_options) {
-      push @invoice_data, {       invoice => { number => $array_options[$ref]->{invnumber},
-                                               href   => 'ar.pl?id='."$array_options[$ref]->{invoice_id}"
-                                              },  
-                                  invoice_date  => "$array_options[$ref]->{invoice_date}",
-                                  amount        => "$array_options[$ref]->{amount}",
-                                  due           => "$array_options[$ref]->{due}",
-                                  paid          => "$array_options[$ref]->{amount}" - "$array_options[$ref]->{due}",
-                                  exchange_rate => "$exchangerate",
-                                  due_fx        => "$exchangerate"? "$array_options[$ref]->{due}"/"$exchangerate" : 'N/A',
-                                  topay         =>  "$array_options[$ref]->{due}",
-                                  topay_fx      => { name  => "topay_fx_$ref",
-                                                     value => "$exchangerate" ? "$array_options[$ref]->{due}"/"$exchangerate" : 'N/A'
-                                                   }  
+ if (  !$request->{"checkbox_$array_options[$ref]->{invoice_id}"}) {
+ #We have to set some things first ...
+   my $due_fx; my $topay_fx_value;
+   if ("$exchangerate") {
+       $topay_fx_value =   $due_fx = "$array_options[$ref]->{due}"/"$exchangerate";
+   } else {
+       $topay_fx_value = $due_fx = "N/A";
+   }
+   push @invoice_data, {       invoice => { number => $array_options[$ref]->{invnumber},
+                                            id     =>  $array_options[$ref]->{invoice_id},
+                                            href   => 'ar.pl?id='."$array_options[$ref]->{invoice_id}"
+                                           },  
+                               invoice_date      => "$array_options[$ref]->{invoice_date}",
+                               amount            => "$array_options[$ref]->{amount}",
+                               due               => "$array_options[$ref]->{due}",
+                               paid              => "$array_options[$ref]->{amount}" - "$array_options[$ref]->{due}",
+                               exchange_rate     => "$exchangerate",
+                               due_fx            =>  $due_fx, # This was set at the begining of the for statement
+                               topay             => "$array_options[$ref]->{due}",
+                               source_text       =>  $request->{"source_text_$array_options[$ref]->{invoice_id}"},
+                               optional          =>  $request->{"optional_pay_$array_options[$ref]->{invoice_id}"},
+                               selected_account  =>  $request->{"account_$array_options[$ref]->{invoice_id}"},
+                               selected_source   =>  $request->{"source_$array_options[$ref]->{invoice_id}"},
+                               topay_fx          =>  { name  => "topay_fx_$array_options[$ref]->{invoice_id}",
+                                                       value => $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} ? 
+                                                           $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} eq 'N/A' ?
+                                                           $topay_fx_value :
+                                                           $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} :
+                                                           $topay_fx_value
+                                                           # Ugly hack, but works ;) ... not sure if i should
+                                                           # change it.
+                                                 }  
                                                      
-                           };
+                           };# END PUSH 
+ }
+ else {
+  push @selected_checkboxes, {name => "checkbox_$array_options[$ref]->{invoice_id}", 
+                              value => "checked"} ;   
+ } #END IF                          
+}# END FOR
+if (..hidden..) { 
+ $request->error($locale->text("Nothing to do").'!');
 }
 # LETS BUILD THE SELECTION FOR THE UI
 my $select = {
   stylesheet => $request->{_user}->{stylesheet},
   header  =>  { text => $request->{type} eq 'receipt' ? $locale->text('Receipt') : $locale->text('Payment') },
-  project => @project,
-  department => @department,
-  account => { 
-             name    => 'account',
-             options => ..hidden..,
+  login    => { name  => 'login', 
+                value => $request->{_user}->{login}   },
+  accountclass => {
+   name  => 'account_class',
+   value => $Payment->{account_class} 
+  },
+  project =>  @project ? @project : '' ,        # WE NEED TO VERIFY THAT THE ARRAY EXISTS, IF IT DOESNT, 
+  department => @department ? @department : '', # WE WILL PASS A NULL STRING, THIS FIXES THE ISSUES
+                                                # I WAS HAVING WITH THE NULL ARRAYS, STILL UGLY :P
+  account => ..hidden..,
+  selected_account => $request->{account},
   datepaid => {
 	name => 'datepaid',
-	value => $dbPayment->{current_date}
+	value => $request->{datepaid} ? $request->{datepaid} : $Payment->{current_date}
   },
-  source => {
-    name => 'source',
-    options => ..hidden..
-  },
-  source_text => {
-
-	name => 'source_text',
-  },
-  
+  source => ..hidden..,
+  selected_source => $request->{source}, 
+  source_value => $request->{source_value},
   defaultcurrency => {
         text => $default_currency
   },
-  curr => {
-	  text => $request->{curr}  
+  curr => {       name  => 'curr',
+                  value => $request->{curr},
+          
   },
   column_headers => ..hidden..,
   rows		=>  ..hidden..,
- 
+  vendorcustomer => { name => 'vendor-customer',
+                      value => $request->{'vendor-customer'}
+                     },
+    
   vc => { name => $vendor_customer_name,
           address =>  [ {text => 'Crra 83 #32 -1'},
           	  {text => '442 6464'},
 		  {text => 'Medell\xEDn'},
-		  {text => 'Colombia'}]},
-  
+		  {text => 'Colombia'}]
+        },
+  update => {
+    title  => 'UPDATE ALT+U',
+    name =>   'action',
+    value =>  'payment2', 
+    text => $locale->text('UPDATE')
+  },
   post => {
-    accesskey =>  'O',
-    title     =>  'POST ALT+O',
+    title  =>  'POST ALT+O',
     name => 'action',
     value => 'post', 
-    text => "POST"
+    text => $locale->text('POST')
   },
   post_and_print => {
-    accesskey =>  'R',
     title     =>  'POST AND PRINT ALT+R',
     name => 'action',
     value => 'post_and_print', 
-    text => "POST AND PRINT"
+    text => $locale->text("POST AND PRINT")
   },
    format => {
     name => 'FORMAT',
@@ -572,19 +621,20 @@
       {value => 3, text => "EMAIL" }
     ],
   },
- date_curr => @currency_options # I HAVE TO PUT THIS LAST, BECAUSE IT CAN BE NULL
-                                # THIS IS AN UGLY HACK THAT MUST BE FIXED.  
+ exrate => @currency_options,
+ selectedcheckboxes => @selected_checkboxes  ? ..hidden.. : '',
+ notes => $request->{notes}
 };
 my $template = LedgerSMB::Template->new(
   user     => $request->{_user},
   locale   => $request->{_locale},
-#  path     => 'UI/payments',
-  path => 'UI',
+  path     => 'UI/payments',
   template => 'payment2',
   format => 'HTML' );
 eval {$template->render($select) };
-if ($@) { $request->error("$@");  }
+ if ($@) { $request->error("$@");  } # PRINT ERRORS ON THE UI
 }
 
+
 eval { do "scripts/custom/payment.pl"};
 1;


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