New file
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 30 Oct 2008 10:35:25 +0000 (10:35 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 30 Oct 2008 10:35:25 +0000 (10:35 +0000)
CHANGELOG.txt
gl/manage/gl_quick_entries.php [new file with mode: 0644]

index fad2f3d0809f00a57e68a535f35207da4aa07882..7202bfcaff29d254a9330795e7f84bedd4f4e4f0 100644 (file)
@@ -28,6 +28,7 @@ $ /applications/generalledger.php
   /gl/gl_bank.php
   /gl/includes/db/gl_db_bank_accounts.inc
   /gl/includes/ui/gl_bank_ui.inc
+  /gl/manage/gl_quick_entries.php
   /sales/manage/customer_branches.php
 ! New table, 0_quick_entries
 $ /sql/alter2.1.sql
diff --git a/gl/manage/gl_quick_entries.php b/gl/manage/gl_quick_entries.php
new file mode 100644 (file)
index 0000000..3772b16
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+
+$page_security = 3;
+$path_to_root="../..";
+include($path_to_root . "/includes/session.inc");
+
+page(_("Quick Entries"));
+
+include($path_to_root . "/gl/includes/gl_db.inc");
+
+include($path_to_root . "/includes/ui.inc");
+
+simple_page_mode(true);
+//-----------------------------------------------------------------------------------
+
+function can_process() 
+{
+
+       if (strlen($_POST['description']) == 0) 
+       {
+               display_error( _("The Quick Entry description cannot be empty."));
+               set_focus('description');
+               return false;
+       }
+
+       return true;
+}
+
+//-----------------------------------------------------------------------------------
+
+if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') 
+{
+
+       if (can_process()) 
+       {
+
+       if ($selected_id != -1) 
+       {
+               update_quick_entry($selected_id, $_POST['description'], $_POST['account'], $_POST['deposit']);
+                       display_notification(_('Selected quick entry has been updated'));
+       } 
+       else 
+       {
+               add_quick_entry($_POST['description'], $_POST['account'], $_POST['deposit']);
+                       display_notification(_('New account class has been added'));
+       }
+               $Mode = 'RESET';
+       }
+}
+
+//-----------------------------------------------------------------------------------
+
+if ($Mode == 'Delete')
+{
+
+       delete_quick_entry($selected_id);
+       display_notification(_('Selected quick entry has been deleted'));
+       $Mode = 'RESET';
+}
+
+//-----------------------------------------------------------------------------------
+if ($Mode == 'RESET')
+{
+       $selected_id = -1;
+       $_POST['description'] = $_POST['account'] = $_POST['deposit'] = '';
+}
+//-----------------------------------------------------------------------------------
+
+$result = get_quick_entries();
+start_form();
+start_table($table_style);
+$th = array(_("Description"), _("Account"), _("Deposit"), "", "");
+table_header($th);
+
+$k = 0;
+while ($myrow = db_fetch($result)) 
+{
+
+       alt_table_row_color($k);
+
+       if ($myrow["deposit"] == 0) 
+       {
+               $bs_text = _("No");
+       } 
+       else 
+       {
+               $bs_text = _("Yes");
+       }
+       label_cell($myrow['description']);
+       label_cell($myrow['account']." ".$myrow['account_name']);
+       label_cell($bs_text);
+       edit_button_cell("Edit".$myrow["id"], _("Edit"));
+       edit_button_cell("Delete".$myrow["id"], _("Delete"));
+       end_row();
+}
+
+end_table();
+end_form();
+echo '<br>';
+//-----------------------------------------------------------------------------------
+
+start_form();
+
+start_table($table_style2);
+
+if ($selected_id != -1) 
+{
+       if ($Mode == 'Edit') 
+       {
+               //editing an existing status code
+               $myrow = get_quick_entry($selected_id);
+
+               $_POST['id']  = $myrow["id"];
+               $_POST['description']  = $myrow["description"];
+               $_POST['account']  = $myrow["account"];
+               $_POST['deposit']  = $myrow["deposit"];
+               hidden('selected_id', $selected_id);
+       }
+} 
+
+text_row_ex(_("Description:"), 'description', 50, 60);
+
+gl_all_accounts_list_row(_("Account"), 'account', null, true);
+
+yesno_list_row(_("Deposit:"), 'deposit', null, "", "", false);
+
+end_table(1);
+
+submit_add_or_update_center($selected_id == -1, '', true);
+
+end_form();
+
+//------------------------------------------------------------------------------------
+
+end_page();
+
+?>