X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fmanage%2Fgl_quick_entries.php;h=4983ae40ec604bda2ebe8a3eadb2069321744e62;hb=ab24fcc549bb72e495fb85e5dcad41bc14d85b7d;hp=555c0888a61459f100e5215445fde23e5dc244d2;hpb=deed05a36c33ecad4dd8528b84c13490bbc042de;p=fa-stable.git diff --git a/gl/manage/gl_quick_entries.php b/gl/manage/gl_quick_entries.php index 555c0888..4983ae40 100644 --- a/gl/manage/gl_quick_entries.php +++ b/gl/manage/gl_quick_entries.php @@ -102,13 +102,13 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if ($selected_id != -1) { update_quick_entry($selected_id, $_POST['description'], $_POST['type'], - input_num('base_amount'), $_POST['base_desc'], get_post('bal_type')); + input_num('base_amount'), $_POST['base_desc'], get_post('bal_type', 0), $_POST['usage']); display_notification(_('Selected quick entry has been updated')); } else { add_quick_entry($_POST['description'], $_POST['type'], - input_num('base_amount'), $_POST['base_desc'], get_post('bal_type')); + input_num('base_amount'), $_POST['base_desc'], get_post('bal_type', 0), $_POST['usage']); display_notification(_('New quick entry has been added')); } $Mode = 'RESET'; @@ -117,16 +117,20 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') if ($Mode2=='ADD_ITEM2' || $Mode2=='UPDATE_ITEM2') { - if ($selected_id2 != -1) + if (!get_post('dest_id')) { + display_error(_("You must select GL account.")); + set_focus('dest_id'); + } + elseif ($selected_id2 != -1) { update_quick_entry_line($selected_id2, $selected_id, $_POST['actn'], $_POST['dest_id'], input_num('amount', 0), - $_POST['dimension_id'], $_POST['dimension2_id']); + $_POST['dimension_id'], $_POST['dimension2_id'], get_post('memo')); display_notification(_('Selected quick entry line has been updated')); } else { add_quick_entry_line($selected_id, $_POST['actn'], $_POST['dest_id'], input_num('amount', 0), - $_POST['dimension_id'], $_POST['dimension2_id']); + $_POST['dimension_id'], $_POST['dimension2_id'], get_post('memo')); display_notification(_('New quick entry line has been added')); } $Mode2 = 'RESET2'; @@ -149,6 +153,14 @@ if ($Mode == 'Delete') } } +if (find_submit('Edit') != -1) { + $Mode2 = 'RESET2'; + set_focus('description'); +} +if (find_submit('BEd') != -1 || get_post('ADD_ITEM2')) { + set_focus('actn'); +} + if ($Mode2 == 'BDel') { delete_quick_entry_line($selected_id2); @@ -159,7 +171,7 @@ if ($Mode2 == 'BDel') if ($Mode == 'RESET') { $selected_id = -1; - $_POST['description'] = $_POST['type'] = ''; + $_POST['description'] = $_POST['type'] = $_POST['usage'] = ''; $_POST['base_desc']= _('Base Amount'); $_POST['base_amount'] = price_format(0); $_POST['bal_type'] = 0; @@ -174,8 +186,8 @@ if ($Mode2 == 'RESET2') $result = get_quick_entries(); start_form(); -start_table($table_style); -$th = array(_("Description"), _("Type"), "", ""); +start_table(TABLESTYLE); +$th = array(_("Description"), _("Type"), _("Usage"), "", ""); table_header($th); $k = 0; @@ -185,74 +197,79 @@ while ($myrow = db_fetch($result)) $type_text = $quick_entry_types[$myrow["type"]]; label_cell($myrow['description']); label_cell($type_text); + label_cell($myrow['usage']); edit_button_cell("Edit".$myrow["id"], _("Edit")); delete_button_cell("Delete".$myrow["id"], _("Delete")); end_row(); } end_table(1); -end_form(); //----------------------------------------------------------------------------------- -if (list_updated('type') || (isset($_POST['bal_type']) && list_updated('bal_type'))) -{ - $Ajax->activate('qe'); -} -start_form(); div_start('qe'); -start_table($table_style2); +start_table(TABLESTYLE2); if ($selected_id != -1) { - $myrow = get_quick_entry($selected_id); - - $_POST['id'] = $myrow["id"]; - $_POST['description'] = $myrow["description"]; - $_POST['type'] = $myrow["type"]; - $_POST['base_desc'] = $myrow["base_desc"]; - $_POST['base_amount'] = price_format($myrow["base_amount"]); - $_POST['bal_type'] = $myrow["bal_type"]; + if ($Mode == 'Edit') // changed by Joe 2010-11-09 + { + $myrow = get_quick_entry($selected_id); + + $_POST['id'] = $myrow["id"]; + $_POST['description'] = $myrow["description"]; + $_POST['type'] = $myrow["type"]; + $_POST['base_desc'] = $myrow["base_desc"]; + $_POST['usage'] = $myrow["usage"]; + $_POST['bal_type'] = $myrow["bal_type"]; + $_POST['base_amount'] = $myrow["bal_type"] ? + $myrow["base_amount"] : price_format($myrow["base_amount"]); + } hidden('selected_id', $selected_id); } text_row_ex(_("Description").':', 'description', 50, 60); +text_row_ex(_("Usage").':', 'usage', 80, 120); -quick_entry_types_list_row(_("Entry Type").':', 'type', null, $selected_id == -1); +quick_entry_types_list_row(_("Entry Type").':', 'type', null, true); if (get_post('type') == QE_JOURNAL) +{ yesno_list_row(_("Balance Based"), 'bal_type', null, _("Yes"), _("No"), true); -if (get_post('bal_type') == 1) +} + +if (list_updated('bal_type') || list_updated('type')) +{ + $Ajax->activate('qe'); +} + +if (get_post('type') == QE_JOURNAL && get_post('bal_type') == 1) { yesno_list_row(_("Period"), 'base_amount', null, _("Monthly"), _("Yearly")); gl_all_accounts_list_row(_("Account"), 'base_desc', null, true); } else { - if ($selected_id == -1) - $_POST['base_desc'] = _("Base Amount"); - text_row_ex(_("Base Amount Description").':', 'base_desc', 50, 60, '',_('Base Amount')); + text_row_ex(_("Base Amount Description").':', 'base_desc', 50, 60, ''); amount_row(_("Default Base Amount").':', 'base_amount', price_format(0)); } end_table(1); submit_add_or_update_center($selected_id == -1, '', 'both'); div_end(); -end_form(); - if ($selected_id != -1) { display_heading(_("Quick Entry Lines") . " - " . $_POST['description']); $result = get_quick_entry_lines($selected_id); - start_form(); - start_table($table_style2); + + start_table(TABLESTYLE2); $dim = get_company_pref('use_dimension'); if ($dim == 2) - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), _("Dimension")." 2", "", ""); + $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Memo"), _("Dimension"), _("Dimension")." 2", "", ""); elseif ($dim == 1) - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), "", ""); + $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Memo"), _("Dimension"), "", ""); else - $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), "", ""); + $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Memo"), "", ""); table_header($th); $k = 0; @@ -277,7 +294,8 @@ if ($selected_id != -1) label_cell(number_format2($myrow['amount'], user_exrate_dec()), "nowrap align=right "); else amount_cell($myrow['amount']); - } + } + label_cell($myrow['memo']); if ($dim >= 1) label_cell(get_dimension_string($myrow['dimension_id'], true)); if ($dim > 1) @@ -287,15 +305,9 @@ if ($selected_id != -1) end_row(); } end_table(1); - hidden('selected_id', $selected_id); - hidden('selected_id2', $selected_id2); - hidden('description', $_POST['description']); - hidden('type', $_POST['type']); - end_form(); - start_form(); div_start('edit_line'); - start_table($table_style2); + start_table(TABLESTYLE2); if ($selected_id2 != -1) { @@ -308,6 +320,7 @@ if ($selected_id != -1) $_POST['dest_id'] = $myrow["dest_id"]; $_POST['actn'] = $myrow["action"]; $_POST['amount'] = $myrow["amount"]; + $_POST['memo'] = $myrow["memo"]; $_POST['dimension_id'] = $myrow["dimension_id"]; $_POST['dimension2_id'] = $myrow["dimension2_id"]; } @@ -334,6 +347,7 @@ if ($selected_id != -1) else amount_row(_("Amount").":", 'amount', price_format(0)); } + text_row_ex(_("Line memo").':', 'memo', 50, 256, ''); } if ($dim >= 1) dimensions_list_row(_("Dimension").":", 'dimension_id', null, true, " ", false, 1); @@ -346,18 +360,15 @@ if ($selected_id != -1) if ($dim < 1) hidden('dimension_id', 0); div_end(); - + hidden('selected_id', $selected_id); hidden('selected_id2', $selected_id2); - hidden('description', $_POST['description']); - hidden('type', $_POST['type']); submit_add_or_update_center2($selected_id2 == -1, '', true); - end_form(); } +end_form(); //------------------------------------------------------------------------------------ end_page(); -?> \ No newline at end of file