28 #include <glib/gi18n.h>
34 #include "dialog-utils.h"
35 #include "gnc-component-manager.h"
36 #include "split-register-p.h"
37 #include "gnc-ledger-display.h"
40 #include "gnome-utils/gnc-warnings.h"
41 #include "guile-util.h"
43 #include "pricecell.h"
44 #include "quickfillcell.h"
47 #include "split-register-control.h"
49 #include "split-register-model.h"
50 #include "split-register-model-save.h"
53 #include "dialog-dup-trans.h"
54 #include "engine-helpers.h"
55 #include "qofbookslots.h"
64 static CursorClass copied_class = CURSOR_CLASS_NONE;
65 static SCM copied_item = SCM_UNDEFINED;
66 static GncGUID copied_leader_guid;
71 static gboolean gnc_split_register_save_to_scm (
SplitRegister *reg,
72 SCM trans_scm, SCM split_scm,
73 gboolean use_cut_semantics);
74 static gboolean gnc_split_register_auto_calc (
SplitRegister *reg,
82 gnc_copy_split_onto_split(
Split *from,
Split *to, gboolean use_cut_semantics)
86 if ((from == NULL) || (to == NULL))
89 split_scm = gnc_copy_split(from, use_cut_semantics);
90 if (split_scm == SCM_UNDEFINED)
93 gnc_copy_split_scm_onto_split(split_scm, to, gnc_get_current_book ());
99 gboolean use_cut_semantics,
104 if ((from == NULL) || (to == NULL))
107 trans_scm = gnc_copy_trans(from, use_cut_semantics);
108 if (trans_scm == SCM_UNDEFINED)
111 gnc_copy_trans_scm_onto_trans(trans_scm, to, do_commit,
112 gnc_get_current_book ());
116 gnc_split_get_value_denom (
Split *split)
135 gnc_split_get_amount_denom (
Split *split)
155 ENTER(
"info=%p, trans=%p", info, trans);
162 LEAVE(
"opened and marked pending");
168 gnc_get_current_book ());
171 if (trans == blank_trans)
176 LEAVE(
"already open, now pending.");
181 GtkWidget *parent = NULL;
182 if (info->get_parent)
183 parent = info->get_parent(info->user_data);
184 gnc_error_dialog(parent,
"%s", _(
"This transaction is already being edited in another register. Please finish editing it there first."));
185 LEAVE(
"already editing");
196 SRInfo *info = gnc_split_register_get_info (reg);
202 if (reg->style == REG_STYLE_AUTO_LEDGER ||
203 reg->style == REG_STYLE_JOURNAL)
207 if (!(expand ^ info->trans_expanded))
212 virt_loc = reg->
table->current_cursor_loc;
213 gnc_split_register_get_trans_split (reg, virt_loc.vcell_loc,
214 &virt_loc.vcell_loc);
216 if (gnc_table_find_close_valid_cell (reg->
table, &virt_loc, FALSE))
217 gnc_table_move_cursor_gui (reg->
table, virt_loc);
220 PERR (
"Can't find place to go!");
225 info->trans_expanded = expand;
227 gnc_table_set_virt_cell_cursor (reg->
table,
228 reg->
table->current_cursor_loc.vcell_loc,
229 gnc_split_register_get_active_cursor (reg));
231 gnc_split_register_set_trans_visible(
232 reg, reg->
table->current_cursor_loc.vcell_loc, expand, FALSE);
234 virt_loc = reg->
table->current_cursor_loc;
235 if (!expand || !gnc_table_virtual_loc_valid (reg->
table, virt_loc, FALSE))
237 if (gnc_table_find_close_valid_cell (reg->
table, &virt_loc, FALSE))
238 gnc_table_move_cursor_gui (reg->
table, virt_loc);
241 PERR (
"Can't find place to go!");
246 gnc_table_refresh_gui (reg->
table, TRUE);
249 gnc_split_register_show_trans (reg,
250 reg->
table->current_cursor_loc.vcell_loc);
256 SRInfo *info = gnc_split_register_get_info (reg);
261 if (reg->style == REG_STYLE_AUTO_LEDGER ||
262 reg->style == REG_STYLE_JOURNAL)
265 return info->trans_expanded;
283 vcell_loc = reg->
table->current_cursor_loc.vcell_loc;
285 vcell_loc.virt_row--;
287 split = gnc_split_register_get_split (reg, vcell_loc);
298 return gnc_split_register_get_split(
299 reg, reg->
table->current_cursor_loc.vcell_loc);
305 SRInfo *info = gnc_split_register_get_info (reg);
307 if (!reg)
return NULL;
309 return xaccSplitLookup (&info->blank_split_guid, gnc_get_current_book ());
320 if (!reg || !split)
return FALSE;
327 for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
328 for (v_col = 0; v_col < table->num_virt_cols; v_col++)
334 vcell = gnc_table_get_virtual_cell (table, vc_loc);
335 if (!vcell || !vcell->visible)
358 const char *cell_name;
368 switch (cursor_class)
370 case CURSOR_CLASS_SPLIT:
371 case CURSOR_CLASS_TRANS:
378 if (!gnc_table_get_cell_location (reg->
table, cell_name,
379 v_loc.vcell_loc, &v_loc))
382 if (virt_loc == NULL)
393 SRInfo *info = gnc_split_register_get_info(reg);
402 ENTER(
"reg=%p", reg);
405 gnc_get_current_book ());
413 LEAVE(
"no transaction");
420 if (cursor_class == CURSOR_CLASS_NONE)
422 LEAVE(
"no cursor class");
427 if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
429 LEAVE(
"no split with transaction class");
433 changed = gnc_table_current_cursor_changed (reg->
table, FALSE);
437 if (!changed && ((split == NULL) || (split == blank_split)))
439 LEAVE(
"skip unchanged blank split");
443 gnc_suspend_gui_refresh ();
449 GtkWidget *dialog, *window;
451 const char *title = _(
"Save transaction before duplicating?");
452 const char *message =
453 _(
"The current transaction has been changed. Would you like to "
454 "record the changes before duplicating the transaction, or "
455 "cancel the duplication?");
457 window = gnc_split_register_get_parent(reg);
458 dialog = gtk_message_dialog_new(GTK_WINDOW(window),
459 GTK_DIALOG_DESTROY_WITH_PARENT,
460 GTK_MESSAGE_QUESTION,
463 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
465 gtk_dialog_add_button(GTK_DIALOG(dialog),
466 _(
"_Record"), GTK_RESPONSE_ACCEPT);
467 response = gnc_dialog_run(GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_DUP);
468 gtk_widget_destroy(dialog);
470 if (response != GTK_RESPONSE_ACCEPT)
472 gnc_resume_gui_refresh ();
473 LEAVE(
"save cancelled");
489 if (cursor_class == CURSOR_CLASS_SPLIT)
493 gboolean new_act_num = FALSE;
506 const char *in_num = NULL;
507 const char* title = _(
"New Split Information");
508 time64 date = info->last_date_entered;
513 in_num = gnc_get_num_action (NULL, split);
514 if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg),
515 title, FALSE, &date, in_num, &out_num, NULL, NULL))
517 gnc_resume_gui_refresh ();
518 LEAVE(
"dup cancelled");
527 xaccSplitSetParent (new_split, trans);
528 gnc_copy_split_onto_split (split, new_split, FALSE);
530 gnc_set_num_action (NULL, new_split, out_num, NULL);
539 gnc_split_register_get_default_account(reg),
543 num_cell = (
NumCell *) gnc_table_layout_get_cell (reg->
table->layout,
545 if (gnc_num_cell_set_last_num (num_cell, out_num))
546 gnc_split_register_set_last_num (reg, out_num);
554 return_split = new_split;
556 info->cursor_hint_split = new_split;
557 info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
565 int trans_split_index;
567 const char *in_num = NULL;
568 const char *in_tnum = NULL;
576 date = info->last_date_entered;
577 if (
gnc_strisnum (gnc_get_num_action (trans, trans_split)))
579 Account *account = gnc_split_register_get_default_account (reg);
584 in_num = gnc_get_num_action (trans, trans_split);
587 : gnc_get_num_action (trans, NULL));
590 if (!gnc_dup_trans_dialog (gnc_split_register_get_parent (reg), NULL,
591 TRUE, &date, in_num, &out_num, in_tnum, &out_tnum))
593 gnc_resume_gui_refresh ();
594 LEAVE(
"dup cancelled");
598 if (use_autoreadonly)
603 if (g_date_compare(&d, readonly_threshold) < 0)
605 GtkWidget *dialog = gtk_message_dialog_new(NULL,
609 "%s", _(
"Cannot store a transaction at this date"));
610 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
611 "%s", _(
"The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
612 "This setting can be changed in File -> Properties -> Accounts."));
613 gtk_dialog_run(GTK_DIALOG(dialog));
614 gtk_widget_destroy(dialog);
616 g_date_free(readonly_threshold);
619 g_date_free(readonly_threshold);
628 gnc_resume_gui_refresh ();
643 gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
648 gnc_set_num_action (NULL,
657 num_cell = (
NumCell *) gnc_table_layout_get_cell (reg->
table->layout,
659 if (gnc_num_cell_set_last_num (num_cell, out_num))
660 gnc_split_register_set_last_num (reg, out_num);
673 info->cursor_hint_trans = new_trans;
674 info->cursor_hint_split = return_split;
675 info->cursor_hint_trans_split = trans_split;
676 info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
678 info->trans_expanded = FALSE;
682 gnc_resume_gui_refresh ();
689 gnc_split_register_copy_current_internal (
SplitRegister *reg,
690 gboolean use_cut_semantics)
692 SRInfo *info = gnc_split_register_get_info(reg);
700 g_return_if_fail(reg);
701 ENTER(
"reg=%p, use_cut_semantics=%s", reg,
702 use_cut_semantics ?
"TRUE" :
"FALSE");
705 gnc_get_current_book ());
719 if (cursor_class == CURSOR_CLASS_NONE)
721 LEAVE(
"no cursor class");
726 if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
728 g_warning(
"BUG DETECTED: transaction cursor with no anchoring split!");
729 LEAVE(
"transaction cursor with no anchoring split");
733 changed = gnc_table_current_cursor_changed (reg->
table, FALSE);
736 if (!changed && ((split == NULL) || (split == blank_split)))
745 LEAVE(
"nothing to copy/cut");
751 if (cursor_class == CURSOR_CLASS_SPLIT)
754 new_item = gnc_copy_split(split, use_cut_semantics);
756 if (new_item != SCM_UNDEFINED)
759 gnc_split_register_save_to_scm (reg, SCM_UNDEFINED, new_item,
768 new_item = gnc_copy_trans(trans, use_cut_semantics);
770 if (new_item != SCM_UNDEFINED)
778 if (split_index >= 0)
779 split_scm = gnc_trans_scm_get_split_scm(new_item, split_index);
781 split_scm = SCM_UNDEFINED;
783 gnc_split_register_save_to_scm (reg, new_item, split_scm,
787 copied_leader_guid = info->default_account;
791 if (new_item == SCM_UNDEFINED)
793 g_warning(
"BUG DETECTED: copy failed");
794 LEAVE(
"copy failed");
799 if (copied_item != SCM_UNDEFINED)
800 scm_gc_unprotect_object(copied_item);
802 copied_item = new_item;
803 scm_gc_protect_object(copied_item);
805 copied_class = cursor_class;
806 LEAVE(
"%s %s", use_cut_semantics ?
"cut" :
"copied",
807 cursor_class == CURSOR_CLASS_SPLIT ?
"split" :
"transaction");
813 gnc_split_register_copy_current_internal (reg, FALSE);
819 SRInfo *info = gnc_split_register_get_info (reg);
827 gnc_get_current_book ());
838 if (cursor_class == CURSOR_CLASS_NONE)
842 if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
845 changed = gnc_table_current_cursor_changed (reg->
table, FALSE);
848 if (!changed && ((split == NULL) || (split == blank_split)))
851 gnc_split_register_copy_current_internal (reg, TRUE);
853 if (cursor_class == CURSOR_CLASS_SPLIT)
862 SRInfo *info = gnc_split_register_get_info(reg);
870 ENTER(
"reg=%p", reg);
872 if (copied_class == CURSOR_CLASS_NONE)
874 LEAVE(
"no copied cursor class");
879 gnc_get_current_book ());
889 LEAVE(
"no transaction");
896 if (cursor_class == CURSOR_CLASS_NONE)
898 LEAVE(
"no current cursor class");
903 if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
905 g_warning(
"BUG DETECTED: transaction cursor with no anchoring split!");
906 LEAVE(
"transaction cursor with no anchoring split");
910 if (cursor_class == CURSOR_CLASS_SPLIT)
912 const char *message = _(
"You are about to overwrite an existing split. "
913 "Are you sure you want to do that?");
915 if (copied_class == CURSOR_CLASS_TRANS)
918 LEAVE(
"can't copy trans to split");
924 !gnc_verify_dialog (gnc_split_register_get_parent (reg),
925 FALSE,
"%s", message))
927 LEAVE(
"user cancelled");
931 gnc_suspend_gui_refresh ();
937 xaccSplitSetParent(split, trans);
940 gnc_copy_split_scm_onto_split(copied_item, split,
941 gnc_get_current_book ());
945 const char *message = _(
"You are about to overwrite an existing "
947 "Are you sure you want to do that?");
950 int trans_split_index;
954 if (copied_class == CURSOR_CLASS_SPLIT)
956 LEAVE(
"can't copy split to transaction");
961 if (split != blank_split &&
962 !gnc_verify_dialog(gnc_split_register_get_parent(reg),
963 FALSE,
"%s", message))
965 LEAVE(
"user cancelled");
970 if (gnc_split_register_begin_edit_or_warn(info, trans))
972 LEAVE(
"can't begin editing");
976 gnc_suspend_gui_refresh ();
978 DEBUG(
"Pasting txn, trans=%p, split=%p, blank_trans=%p, blank_split=%p",
979 trans, split, blank_trans, blank_split);
985 gnc_get_current_book());
986 if (copied_leader && (gnc_split_register_get_default_account(reg) != NULL))
988 new_guid = &info->default_account;
989 gnc_copy_trans_scm_onto_trans_swap_accounts(copied_item, trans,
992 gnc_get_current_book ());
995 gnc_copy_trans_scm_onto_trans(copied_item, trans, FALSE,
996 gnc_get_current_book ());
999 if (split_index >= num_splits)
1002 if (trans == blank_trans)
1007 info->blank_split_edited = TRUE;
1008 info->auto_complete = FALSE;
1009 DEBUG(
"replacement blank_split=%p", blank_split);
1016 info->cursor_hint_trans = trans;
1020 info->cursor_hint_cursor_class = CURSOR_CLASS_TRANS;
1024 gnc_resume_gui_refresh ();
1031 SRInfo *info = gnc_split_register_get_info (reg);
1040 gnc_get_current_book ());
1043 gnc_get_current_book ());
1053 if (split == blank_split)
1059 gnc_suspend_gui_refresh ();
1064 if (trans == pending_trans)
1070 g_assert(!pending_trans);
1071 if (gnc_split_register_begin_edit_or_warn(info, trans))
1073 gnc_resume_gui_refresh ();
1079 gnc_resume_gui_refresh ();
1086 SRInfo *info = gnc_split_register_get_info (reg);
1093 ENTER(
"reg=%p", reg);
1096 LEAVE(
"no register");
1101 gnc_get_current_book ());
1103 gnc_get_current_book ());
1113 gnc_suspend_gui_refresh ();
1119 if (split == blank_split)
1121 DEBUG(
"deleting blank split");
1123 info->auto_complete = FALSE;
1127 info->trans_expanded = FALSE;
1131 if (trans == pending_trans)
1133 DEBUG(
"clearing pending trans");
1134 info->pending_trans_guid = *
guid_null();
1135 pending_trans = NULL;
1142 DEBUG(
"committing");
1145 gnc_resume_gui_refresh ();
1152 SRInfo *info = gnc_split_register_get_info (reg);
1161 gnc_get_current_book ());
1163 gnc_get_current_book ());
1171 if (split == blank_split)
1178 info->trans_expanded = FALSE;
1180 gnc_suspend_gui_refresh ();
1186 if (trans == pending_trans)
1188 info->pending_trans_guid = *
guid_null();
1189 pending_trans = NULL;
1193 PERR(
"We should not be voiding an open transaction.");
1196 gnc_resume_gui_refresh ();
1202 SRInfo *info = gnc_split_register_get_info (reg);
1211 gnc_get_current_book ());
1213 gnc_get_current_book ());
1221 if (split == blank_split)
1228 info->trans_expanded = FALSE;
1230 gnc_suspend_gui_refresh ();
1237 if (trans == pending_trans)
1239 info->pending_trans_guid = *
guid_null();
1240 pending_trans = NULL;
1243 gnc_resume_gui_refresh ();
1256 if ((reg == NULL) || (split == NULL))
1259 gnc_suspend_gui_refresh ();
1260 info = gnc_split_register_get_info(reg);
1261 pending =
xaccTransLookup(&info->pending_trans_guid, gnc_get_current_book());
1266 if (gnc_split_register_begin_edit_or_warn(info, trans))
1268 gnc_resume_gui_refresh ();
1272 else if (pending == trans)
1276 else g_assert_not_reached();
1285 gnc_resume_gui_refresh ();
1307 virt_loc = reg->
table->current_cursor_loc;
1309 if (!gnc_table_current_cursor_changed (reg->
table, FALSE))
1314 gnc_table_clear_current_cursor_changes (reg->
table);
1316 if (gnc_table_find_close_valid_cell (reg->
table, &virt_loc, FALSE))
1317 gnc_table_move_cursor_gui (reg->
table, virt_loc);
1319 gnc_table_refresh_gui (reg->
table, TRUE);
1325 SRInfo *info = gnc_split_register_get_info (reg);
1329 gnc_get_current_book ());
1343 gnc_suspend_gui_refresh ();
1347 info->pending_trans_guid = *
guid_null ();
1349 gnc_resume_gui_refresh ();
1356 gnc_ledger_display_refresh_by_split_register (reg);
1363 SCM trans_scm, SCM split_scm,
1364 gboolean use_cut_semantics)
1366 SCM other_split_scm = SCM_UNDEFINED;
1372 if (!gnc_table_current_cursor_changed (reg->
table, FALSE))
1381 if (gnc_table_layout_get_cell_changed (reg->
table->layout, DATE_CELL, TRUE))
1386 cell = gnc_table_layout_get_cell (reg->
table->layout, DATE_CELL);
1387 gnc_date_cell_get_date ((
DateCell *) cell, &ts);
1389 gnc_trans_scm_set_date(trans_scm, &ts);
1392 if (gnc_table_layout_get_cell_changed (reg->
table->layout, NUM_CELL, TRUE))
1396 value = gnc_table_layout_get_cell_value (reg->
table->layout, NUM_CELL);
1398 gnc_trans_scm_set_num (trans_scm, value);
1404 if (gnc_table_layout_get_cell_changed (reg->
table->layout, TNUM_CELL, TRUE))
1408 value = gnc_table_layout_get_cell_value (reg->
table->layout, TNUM_CELL);
1410 gnc_trans_scm_set_num (trans_scm, value);
1414 if (gnc_table_layout_get_cell_changed (reg->
table->layout, DESC_CELL, TRUE))
1418 value = gnc_table_layout_get_cell_value (reg->
table->layout, DESC_CELL);
1419 gnc_trans_scm_set_description (trans_scm, value);
1422 if (gnc_table_layout_get_cell_changed (reg->
table->layout, NOTES_CELL, TRUE))
1426 value = gnc_table_layout_get_cell_value (reg->
table->layout, NOTES_CELL);
1427 gnc_trans_scm_set_notes (trans_scm, value);
1430 if (gnc_table_layout_get_cell_changed (reg->
table->layout, RECN_CELL, TRUE))
1435 cell = gnc_table_layout_get_cell (reg->
table->layout, RECN_CELL);
1436 flag = gnc_recn_cell_get_flag ((
RecnCell *) cell);
1438 gnc_split_scm_set_reconcile_state(split_scm, flag);
1441 if (gnc_table_layout_get_cell_changed (reg->
table->layout, ACTN_CELL, TRUE))
1445 value = gnc_table_layout_get_cell_value (reg->
table->layout, ACTN_CELL);
1446 gnc_split_scm_set_action (split_scm, value);
1449 if (gnc_table_layout_get_cell_changed (reg->
table->layout, MEMO_CELL, TRUE))
1453 value = gnc_table_layout_get_cell_value (reg->
table->layout, MEMO_CELL);
1454 gnc_split_scm_set_memo (split_scm, value);
1457 if (gnc_table_layout_get_cell_changed (reg->
table->layout, XFRM_CELL, TRUE))
1461 new_account = gnc_split_register_get_account (reg, XFRM_CELL);
1463 if (new_account != NULL)
1464 gnc_split_scm_set_account (split_scm, new_account);
1467 if (reg->style == REG_STYLE_LEDGER)
1468 other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
1470 if (gnc_table_layout_get_cell_changed (reg->
table->layout, MXFRM_CELL, TRUE))
1472 other_split_scm = gnc_trans_scm_get_other_split_scm (trans_scm, split_scm);
1474 if (other_split_scm == SCM_UNDEFINED)
1476 if (gnc_trans_scm_get_num_splits(trans_scm) == 1)
1481 other_split_scm = gnc_copy_split (temp_split, use_cut_semantics);
1484 gnc_trans_scm_append_split_scm (trans_scm, other_split_scm);
1488 if (other_split_scm != SCM_UNDEFINED)
1492 new_account = gnc_split_register_get_account (reg, MXFRM_CELL);
1494 if (new_account != NULL)
1495 gnc_split_scm_set_account (other_split_scm, new_account);
1499 if (gnc_table_layout_get_cell_changed (reg->
table->layout,
1501 gnc_table_layout_get_cell_changed (reg->
table->layout,
1509 cell = gnc_table_layout_get_cell (reg->
table->layout, CRED_CELL);
1510 credit = gnc_price_cell_get_value ((
PriceCell *) cell);
1512 cell = gnc_table_layout_get_cell (reg->
table->layout, DEBT_CELL);
1513 debit = gnc_price_cell_get_value ((
PriceCell *) cell);
1515 new_value = gnc_numeric_sub_fixed (debit, credit);
1517 gnc_split_scm_set_value (split_scm, new_value);
1520 if (gnc_table_layout_get_cell_changed (reg->
table->layout, PRIC_CELL, TRUE))
1525 if (gnc_table_layout_get_cell_changed (reg->
table->layout, SHRS_CELL, TRUE))
1530 cell = gnc_table_layout_get_cell (reg->
table->layout, SHRS_CELL);
1532 shares = gnc_price_cell_get_value ((
PriceCell *) cell);
1534 gnc_split_scm_set_amount (split_scm, shares);
1537 if (gnc_table_layout_get_cell_changed (reg->
table->layout,
1539 gnc_table_layout_get_cell_changed (reg->
table->layout,
1541 gnc_table_layout_get_cell_changed (reg->
table->layout,
1543 gnc_table_layout_get_cell_changed (reg->
table->layout,
1546 if (other_split_scm != SCM_UNDEFINED)
1550 num = gnc_split_scm_get_amount (split_scm);
1553 num = gnc_split_scm_get_value (split_scm);
1564 SRInfo *info = gnc_split_register_get_info (reg);
1574 ENTER(
"reg=%p, do_commit=%s", reg, do_commit ?
"TRUE" :
"FALSE");
1578 LEAVE(
"no register");
1583 gnc_get_current_book ());
1586 gnc_get_current_book ());
1595 LEAVE(
"no transaction");
1602 if (!gnc_table_current_cursor_changed (reg->
table, FALSE))
1606 LEAVE(
"commit unnecessary");
1612 LEAVE(
"transaction not open");
1616 if (trans == pending_trans ||
1617 (trans == blank_trans && info->blank_split_edited))
1621 gnc_suspend_gui_refresh ();
1623 if (trans == blank_trans)
1629 info->blank_split_edited = FALSE;
1630 info->auto_complete = FALSE;
1635 if (trans == pending_trans)
1636 info->pending_trans_guid = *
guid_null ();
1638 PINFO(
"committing trans (%p)", trans);
1641 gnc_resume_gui_refresh ();
1644 DEBUG(
"leaving trans (%p) open", trans);
1646 LEAVE(
"unchanged cursor");
1650 DEBUG(
"save split=%p", split);
1651 DEBUG(
"blank_split=%p, blank_trans=%p, pending_trans=%p, trans=%p",
1652 blank_split, blank_trans, pending_trans, trans);
1655 (void) gnc_split_register_check_cell (reg,
1656 gnc_table_get_current_cell_name (reg->
table));
1658 if (!gnc_split_register_auto_calc (reg, split))
1660 LEAVE(
"auto calc failed");
1665 (void)gnc_split_register_get_account (reg, MXFRM_CELL);
1666 (void)gnc_split_register_get_account (reg, XFRM_CELL);
1671 LEAVE(
"no exchange rate");
1675 gnc_suspend_gui_refresh ();
1678 if (pending_trans != trans)
1685 g_warning(
"Impossible? commiting pending %p", pending_trans);
1688 else if (pending_trans)
1690 g_critical(
"BUG DETECTED! pending transaction (%p) not open",
1692 g_assert_not_reached();
1695 if (trans == blank_trans)
1705 PINFO(
"beginning edit of trans %p", trans);
1706 if (gnc_split_register_begin_edit_or_warn(info, trans))
1708 gnc_resume_gui_refresh ();
1709 LEAVE(
"transaction opened elsewhere");
1713 pending_trans = trans;
1724 if (split == blank_split && !info->blank_split_edited)
1731 account = gnc_split_register_get_default_account(reg);
1733 xaccSplitSetAccount(blank_split, account);
1752 gnc_table_set_virt_cell_data (reg->
table,
1753 reg->
table->current_cursor_loc.vcell_loc,
1755 DEBUG(
"assigned cell to new split=%p", split);
1758 if ((info->cursor_hint_trans == trans) &&
1759 (info->cursor_hint_trans_split == trans_split) &&
1760 (info->cursor_hint_split == NULL))
1762 info->cursor_hint_split = split;
1763 info->cursor_hint_cursor_class = CURSOR_CLASS_SPLIT;
1767 DEBUG(
"updating trans=%p", trans);
1772 sd = gnc_split_register_save_data_new (
1773 trans, split, (info->trans_expanded ||
1774 reg->style == REG_STYLE_AUTO_LEDGER ||
1775 reg->style == REG_STYLE_JOURNAL));
1776 gnc_table_save_cells (reg->
table, sd);
1777 gnc_split_register_save_data_destroy (sd);
1781 memo = memo ? memo :
"(null)";
1783 desc = desc ? desc :
"(null)";
1784 PINFO (
"finished saving split \"%s\" of trans \"%s\"", memo, desc);
1790 if (trans == blank_trans)
1795 info->auto_complete = FALSE;
1800 info->blank_split_edited = TRUE;
1807 g_assert(trans == blank_trans || trans == pending_trans);
1808 if (pending_trans == trans)
1810 pending_trans = NULL;
1811 info->pending_trans_guid = *
guid_null ();
1816 gnc_table_clear_current_cursor_changes (reg->
table);
1818 gnc_resume_gui_refresh ();
1829 const char *placeholder = _(
"The account %s does not allow transactions.");
1830 const char *missing = _(
"The account %s does not exist. "
1831 "Would you like to create it?");
1836 if (!name || (strlen(name) == 0))
1847 if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
1848 TRUE, missing, name))
1859 if (g_strcmp0(account_name, gnc_basic_cell_get_value(bcell)))
1862 gnc_combo_cell_set_value (cell, account_name);
1863 gnc_basic_cell_set_changed (&cell->cell, TRUE);
1865 g_free (account_name);
1870 gnc_error_dialog (gnc_split_register_get_parent (reg),
1879 gnc_split_register_get_account (
SplitRegister *reg,
const char * cell_name)
1884 if (!gnc_table_layout_get_cell_changed (reg->
table->layout, cell_name, TRUE))
1887 cell = gnc_table_layout_get_cell (reg->
table->layout, cell_name);
1890 name = gnc_basic_cell_get_value (cell);
1891 return gnc_split_register_get_account_by_name (reg, cell, name);
1902 credit = gnc_price_cell_get_value (cell);
1904 cell = (
PriceCell*)gnc_table_layout_get_cell (reg->
table->layout,
1906 debit = gnc_price_cell_get_value (cell);
1908 return gnc_numeric_sub_fixed (debit, credit);
1913 recalc_message_box (
SplitRegister *reg, gboolean shares_changed,
1914 gboolean price_changed, gboolean value_changed)
1919 GList *radio_list = NULL;
1920 const char *title = _(
"Recalculate Transaction");
1921 const char *message = _(
"The values entered for this transaction "
1922 "are inconsistent. Which value would you "
1923 "like to have recalculated?");
1926 radio_list = g_list_append (radio_list, g_strdup_printf (
"%s (%s)",
1930 radio_list = g_list_append (radio_list, g_strdup (_(
"_Shares")));
1933 radio_list = g_list_append (radio_list, g_strdup_printf (
"%s (%s)",
1937 radio_list = g_list_append (radio_list, g_strdup (_(
"_Price")));
1940 radio_list = g_list_append (radio_list, g_strdup_printf (
"%s (%s)",
1944 radio_list = g_list_append (radio_list, g_strdup (_(
"_Value")));
1946 if (price_changed) default_value = 2;
1947 else default_value = 1;
1949 choice = gnc_choose_radio_option_dialog
1950 (gnc_split_register_get_parent (reg),
1957 for (node = radio_list; node; node = node->next)
1958 g_free (node->data);
1960 g_list_free (radio_list);
1969 gint64 denom = gnc_split_get_amount_denom (split);
1973 BasicCell *cell = gnc_table_layout_get_cell (reg->
table->layout, SHRS_CELL);
1974 gnc_price_cell_set_value ((
PriceCell *) cell, amount);
1975 gnc_basic_cell_set_changed (cell, TRUE);
1979 cell = gnc_table_layout_get_cell (reg->
table->layout, PRIC_CELL);
1980 gnc_basic_cell_set_changed (cell, FALSE);
1998 debit_cell = gnc_table_layout_get_cell (reg->
table->layout,
2001 credit_cell = gnc_table_layout_get_cell (reg->
table->layout,
2006 gnc_price_cell_set_debt_credit_value ((
PriceCell *) debit_cell,
2010 gnc_basic_cell_set_changed (debit_cell, TRUE);
2011 gnc_basic_cell_set_changed (credit_cell, TRUE);
2014 price_cell = gnc_table_layout_get_cell (reg->
table->layout, PRIC_CELL);
2015 gnc_price_cell_set_value ((
PriceCell *) price_cell, price);
2016 gnc_basic_cell_set_changed (price_cell, TRUE);
2023 BasicCell *debit_cell = gnc_table_layout_get_cell (reg->
table->layout,
2025 BasicCell *credit_cell = gnc_table_layout_get_cell (reg->
table->layout,
2027 gint64 denom = gnc_split_get_value_denom (split);
2031 gnc_price_cell_set_debt_credit_value ((
PriceCell *) debit_cell,
2034 gnc_basic_cell_set_changed (debit_cell, TRUE);
2035 gnc_basic_cell_set_changed (credit_cell, TRUE);
2041 gnc_basic_cell_set_changed (cell, FALSE);
2061 if (gnc_split_reg_has_rate_cell (reg->type))
2063 cell = gnc_table_layout_get_cell (reg->
table->layout, DATE_CELL);
2064 gnc_date_cell_get_date ((
DateCell*)cell, &ts);
2066 gnc_price_begin_edit (price);
2067 gnc_price_set_commodity (price, comm);
2068 gnc_price_set_currency (price, curr);
2069 gnc_price_set_time (price, ts);
2070 gnc_price_set_source (price,
"user:split-register");
2071 gnc_price_set_value (price, value);
2073 gnc_price_commit_edit (price);
2080 gboolean recalc_shares = FALSE;
2081 gboolean recalc_price = FALSE;
2082 gboolean recalc_value = FALSE;
2083 gboolean price_changed;
2084 gboolean value_changed;
2085 gboolean shares_changed;
2094 if (STOCK_REGISTER != reg->type &&
2095 CURRENCY_REGISTER != reg->type &&
2096 PORTFOLIO_LEDGER != reg->type)
2099 account = gnc_split_register_get_account (reg, XFRM_CELL);
2105 account = gnc_split_register_get_default_account (reg);
2110 price_changed = gnc_table_layout_get_cell_changed (reg->
table->layout,
2112 value_changed = (gnc_table_layout_get_cell_changed (reg->
table->layout,
2114 gnc_table_layout_get_cell_changed (reg->
table->layout,
2116 shares_changed = gnc_table_layout_get_cell_changed (reg->
table->layout,
2119 if (!price_changed && !value_changed && !shares_changed)
2135 cell = (
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout,
2137 amount = gnc_price_cell_get_value (cell);
2144 cell = (
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout,
2146 price = gnc_price_cell_get_value (cell);
2152 value = calculate_value (reg);
2174 recalc_price = TRUE;
2177 recalc_value = TRUE;
2181 recalc_shares = TRUE;
2186 if ((!recalc_shares) &&
2190 if (price_changed && value_changed)
2192 if (!shares_changed)
2193 recalc_shares = TRUE;
2195 else if (value_changed && shares_changed)
2196 recalc_price = TRUE;
2197 else if (price_changed && shares_changed)
2198 recalc_value = TRUE;
2204 denom = gnc_split_get_value_denom (split);
2210 if (!recalc_shares &&
2215 choice = recalc_message_box(reg, shares_changed,
2221 recalc_shares = TRUE;
2224 recalc_price = TRUE;
2227 recalc_value = TRUE;
2235 recalculate_shares (split, reg, value, price, value_changed);
2239 recalculate_price (split, reg, value, amount);
2240 price_changed = TRUE;
2243 recalculate_value (split, reg, price, amount, shares_changed);
2247 cell = (
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout,
2249 price = gnc_price_cell_get_value (cell);
2251 record_price (reg, account, price);
2265 case ASSET_REGISTER:
2267 case CREDIT_REGISTER:
2269 case LIABILITY_REGISTER:
2271 case PAYABLE_REGISTER:
2273 case RECEIVABLE_REGISTER:
2276 case INCOME_REGISTER:
2278 case EXPENSE_REGISTER:
2280 case STOCK_REGISTER:
2281 case PORTFOLIO_LEDGER:
2283 case CURRENCY_REGISTER:
2285 case TRADING_REGISTER:
2287 case GENERAL_LEDGER:
2289 case EQUITY_REGISTER:
2301 SRInfo *info = gnc_split_register_get_info (reg);
2306 if (info->debit_str)
2307 return info->debit_str;
2310 gnc_get_debit_string
2311 (gnc_split_register_type_to_account_type (reg->type));
2313 if (info->debit_str)
2314 return info->debit_str;
2316 info->debit_str = g_strdup (_(
"Debit"));
2318 return info->debit_str;
2324 SRInfo *info = gnc_split_register_get_info (reg);
2329 if (info->credit_str)
2330 return info->credit_str;
2333 gnc_get_credit_string
2334 (gnc_split_register_type_to_account_type (reg->type));
2336 if (info->credit_str)
2337 return info->credit_str;
2339 info->credit_str = g_strdup (_(
"Credit"));
2341 return info->credit_str;
2347 SRInfo *info = gnc_split_register_get_info (reg);
2350 ENTER(
"reg=%p", reg);
2354 LEAVE(
"no register");
2358 if (gnc_table_current_cursor_changed (reg->
table, FALSE))
2360 LEAVE(
"cursor changed");
2365 gnc_get_current_book ());
2368 LEAVE(
"open and pending txn");
2372 LEAVE(
"register unchanged");
2378 gboolean show_present)
2380 SRInfo *info = gnc_split_register_get_info (reg);
2385 info->show_present_divider = show_present;
2391 SRInfo *info = gnc_split_register_get_info (reg);
2396 return info->full_refresh;
2406 cell = (
ComboCell *) gnc_table_layout_get_cell (reg->
table->layout,
2446 case ASSET_REGISTER:
2451 case CREDIT_REGISTER:
2461 case LIABILITY_REGISTER:
2468 case RECEIVABLE_REGISTER:
2469 case PAYABLE_REGISTER:
2476 case INCOME_REGISTER:
2486 case EXPENSE_REGISTER:
2487 case TRADING_REGISTER:
2493 case GENERAL_LEDGER:
2494 case EQUITY_REGISTER:
2499 case STOCK_REGISTER:
2500 case PORTFOLIO_LEDGER:
2501 case CURRENCY_REGISTER:
2534 gnc_table_layout_get_cell (reg->
table->layout, MXFRM_CELL),
2539 gnc_table_layout_get_cell (reg->
table->layout, MXFRM_CELL),
2545 gnc_table_layout_get_cell (reg->
table->layout, ACTN_CELL), TRUE);
2548 gnc_price_cell_set_fraction
2550 gnc_table_layout_get_cell (reg->
table->layout, PRIC_CELL), 1000000);
2553 gnc_price_cell_set_print_info
2554 ((
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout, SHRS_CELL),
2555 gnc_default_share_print_info ());
2557 gnc_price_cell_set_print_info
2558 ((
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout, TSHRS_CELL),
2559 gnc_default_share_print_info ());
2564 gnc_price_cell_set_print_info
2565 ((
PriceCell *) gnc_table_layout_get_cell (reg->
table->layout, RATE_CELL),
2566 gnc_default_share_print_info());
2571 gnc_table_layout_get_cell (reg->
table->layout, ACTN_CELL), FALSE);
2576 case CURRENCY_REGISTER:
2577 case STOCK_REGISTER:
2578 case PORTFOLIO_LEDGER:
2579 gnc_price_cell_set_print_info
2581 gnc_table_layout_get_cell (reg->
table->layout, PRIC_CELL),
2582 gnc_default_price_print_info ());
2590 gnc_split_register_config_action (reg);
2594 split_register_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
2599 g_return_if_fail(pref);
2607 if (g_str_has_suffix(pref, GNC_PREF_ACCOUNTING_LABELS))
2610 g_free (info->debit_str);
2611 g_free (info->tdebit_str);
2612 g_free (info->credit_str);
2613 g_free (info->tcredit_str);
2615 info->debit_str = NULL;
2616 info->tdebit_str = NULL;
2617 info->credit_str = NULL;
2618 info->tcredit_str = NULL;
2621 else if (g_str_has_suffix(pref, GNC_PREF_ACCOUNT_SEPARATOR))
2623 info->separator_changed = TRUE;
2627 g_warning(
"split_register_pref_changed: Unknown preference %s", pref);
2632 split_register_book_option_changed (gpointer new_val, gpointer user_data)
2635 gboolean *new_data = (gboolean*)new_val;
2647 gboolean use_double_line,
2648 gboolean do_auto_complete,
2649 gboolean is_template)
2657 GNC_PREF_ACCOUNTING_LABELS,
2658 split_register_pref_changed,
2661 GNC_PREF_ACCOUNT_SEPARATOR,
2662 split_register_pref_changed,
2664 gnc_book_option_register_cb(OPTION_NAME_NUM_FIELD_SOURCE,
2665 split_register_book_option_changed,
2674 reg->is_template = is_template;
2682 model = gnc_template_register_model_new ();
2684 model = gnc_split_register_model_new ();
2685 model->handler_user_data = reg;
2687 control = gnc_split_register_control_new ();
2688 control->user_data = reg;
2690 reg->
table = gnc_table_new (layout, model, control);
2692 gnc_split_register_config_cells (reg);
2699 header = gnc_table_layout_get_cursor (reg->
table->layout, CURSOR_HEADER);
2701 gnc_table_set_vcell (reg->
table, header, NULL, TRUE, TRUE, vcell_loc);
2709 vloc.vcell_loc.virt_row = 1;
2710 vloc.vcell_loc.virt_col = 0;
2711 vloc.phys_row_offset = 0;
2712 vloc.phys_col_offset = 0;
2714 cursor = gnc_table_layout_get_cursor (reg->
table->layout,
2715 CURSOR_SINGLE_LEDGER);
2717 gnc_table_set_vcell (reg->
table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
2719 if (gnc_table_find_close_valid_cell (reg->
table, &vloc, FALSE))
2720 gnc_table_move_cursor (reg->
table, vloc);
2723 PERR (
"Can't find valid initial location");
2731 gboolean use_double_line,
2732 gboolean is_template)
2735 gboolean default_do_auto_complete = TRUE;
2739 if (type >= NUM_SINGLE_REGISTER_TYPES)
2740 style = REG_STYLE_JOURNAL;
2742 gnc_split_register_init (reg,
2746 default_do_auto_complete,
2756 gboolean use_double_line)
2764 if (gnc_table_find_close_valid_cell (reg->
table, &virt_loc, FALSE))
2766 if (virt_loc.phys_row_offset)
2769 gnc_table_move_cursor_gui (reg->
table, virt_loc);
2775 virt_loc.vcell_loc.virt_row = 1;
2776 virt_loc.vcell_loc.virt_col = 0;
2777 virt_loc.phys_row_offset = 0;
2778 virt_loc.phys_col_offset = 0;
2779 gnc_table_move_cursor_gui (reg->
table, virt_loc);
2783 reg->type = newtype;
2785 if (reg->type >= NUM_SINGLE_REGISTER_TYPES)
2786 newstyle = REG_STYLE_JOURNAL;
2788 reg->style = newstyle;
2791 gnc_table_realize_gui (reg->
table);
2796 gboolean do_auto_complete)
2798 g_return_if_fail(reg);
2814 g_free (info->debit_str);
2815 g_free (info->tdebit_str);
2816 g_free (info->credit_str);
2817 g_free (info->tcredit_str);
2819 info->debit_str = NULL;
2820 info->tdebit_str = NULL;
2821 info->credit_str = NULL;
2822 info->tcredit_str = NULL;
2833 SRInfo *info = gnc_split_register_get_info (reg);
2835 g_return_if_fail (reg != NULL);
2837 info->user_data = user_data;
2838 info->get_parent = get_parent;
2844 SRInfo *info = gnc_split_register_get_info (reg);
2849 ENTER(
"reg=%p", reg);
2852 gnc_get_current_book ());
2855 gnc_get_current_book ());
2857 gnc_suspend_gui_refresh ();
2862 if (blank_split != NULL)
2868 DEBUG(
"blank_split=%p, blank_trans=%p, pending_trans=%p",
2869 blank_split, blank_trans, pending_trans);
2878 if (blank_trans == pending_trans)
2880 info->pending_trans_guid = *
guid_null ();
2881 pending_trans = NULL;
2884 info->auto_complete = FALSE;
2889 if (pending_trans != NULL)
2891 g_critical(
"BUG DETECTED: pending_trans=%p, blank_split=%p, blank_trans=%p",
2892 pending_trans, blank_split, blank_trans);
2893 g_assert_not_reached();
2894 info->pending_trans_guid = *
guid_null ();
2900 else g_assert_not_reached();
2902 pending_trans = NULL;
2905 gnc_split_register_destroy_info (reg);
2907 gnc_resume_gui_refresh ();
2915 g_return_if_fail(reg);
2917 ENTER(
"reg=%p", reg);
2920 GNC_PREF_ACCOUNTING_LABELS,
2921 split_register_pref_changed,
2924 GNC_PREF_ACCOUNT_SEPARATOR,
2925 split_register_pref_changed,
2927 gnc_book_option_remove_cb(OPTION_NAME_NUM_FIELD_SOURCE,
2928 split_register_book_option_changed,
2930 gnc_split_register_cleanup (reg);
2932 gnc_table_destroy (reg->
table);
2943 gnc_table_model_set_read_only (reg->
table->model, read_only);
void gnc_copy_trans_onto_trans(Transaction *from, Transaction *to, gboolean use_cut_semantics, gboolean do_commit)
GNCPrice * gnc_price_create(QofBook *book)
Transaction * gnc_split_register_get_current_trans(SplitRegister *reg)
const char * gnc_split_register_get_debit_string(SplitRegister *reg)
void gnc_split_register_void_current_trans(SplitRegister *reg, const char *reason)
#define xaccTransAppendSplit(t, s)
Transaction * xaccMallocTransaction(QofBook *book)
void gnc_combo_cell_set_autosize(ComboCell *cell, gboolean autosize)
const char * xaccAccountGetLastNum(const Account *acc)
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
int gnc_commodity_get_fraction(const gnc_commodity *cm)
Split * xaccTransGetSplit(const Transaction *trans, int i)
void gnc_split_register_cancel_cursor_split_changes(SplitRegister *reg)
time64 xaccTransGetDate(const Transaction *trans)
gboolean xaccTransUseTradingAccounts(const Transaction *trans)
gulong gnc_prefs_register_cb(const char *group, const gchar *pref_name, gpointer func, gpointer user_data)
Dialog for create/edit an account.
QofBook * qof_instance_get_book(gconstpointer)
gboolean xaccAccountIsPriced(const Account *acc)
gboolean xaccTransIsOpen(const Transaction *trans)
void gnc_split_register_copy_current(SplitRegister *reg)
The type, style and table for the register.
#define PINFO(format, args...)
gboolean xaccSplitDestroy(Split *split)
gboolean use_tran_num_for_num_field
int xaccAccountGetCommoditySCU(const Account *acc)
gnc_numeric gnc_numeric_neg(gnc_numeric a)
void gnc_split_register_unvoid_current_trans(SplitRegister *reg)
Split * gnc_split_register_get_current_split(SplitRegister *reg)
void gnc_split_register_delete_current_split(SplitRegister *reg)
#define DEBUG(format, args...)
gboolean gnc_pricedb_add_price(GNCPriceDB *db, GNCPrice *p)
Split * gnc_split_register_get_blank_split(SplitRegister *reg)
gboolean qof_book_use_split_action_for_num_field(const QofBook *book)
char xaccSplitGetReconcile(const Split *split)
Account * gnc_ui_new_accounts_from_name_window(const char *name)
CursorClass gnc_split_register_get_cursor_class(SplitRegister *reg, VirtualCellLocation vcell_loc)
gboolean gnc_split_register_full_refresh_ok(SplitRegister *reg)
Use a 64-bit unsigned int timespec.
SplitRegister * gnc_split_register_new(SplitRegisterType type, SplitRegisterStyle style, gboolean use_double_line, gboolean is_template)
Split * gnc_split_register_get_current_trans_split(SplitRegister *reg, VirtualCellLocation *trans_split_loc)
gboolean gnc_numeric_zero_p(gnc_numeric a)
gboolean gnc_split_register_changed(SplitRegister *reg)
Transaction * xaccSplitGetParent(const Split *split)
gboolean gnc_table_move_vertical_position(Table *table, VirtualLocation *virt_loc, int phys_row_offset)
Create the actual register visual layout.
SplitRegisterType
Register types.
void gnc_split_register_expand_current_trans(SplitRegister *reg, gboolean expand)
gboolean gnc_split_register_save(SplitRegister *reg, gboolean do_commit)
#define PERR(format, args...)
void gnc_split_register_set_auto_complete(SplitRegister *reg, gboolean do_auto_complete)
#define ENTER(format, args...)
gboolean gnc_strisnum(const gchar *s)
void xaccAccountSetLastNum(Account *acc, const char *num)
GNCPriceDB * gnc_pricedb_get_db(QofBook *book)
gboolean gnc_numeric_negative_p(gnc_numeric a)
gnc_commodity * gnc_default_currency(void)
void xaccTransDestroy(Transaction *trans)
Transaction * xaccTransLookup(const GncGUID *guid, QofBook *book)
void gnc_split_register_redraw(SplitRegister *reg)
gboolean gnc_split_register_get_split_virt_loc(SplitRegister *reg, Split *split, VirtualCellLocation *vcell_loc)
int xaccTransCountSplits(const Transaction *trans)
gchar * gnc_get_account_name_for_register(const Account *account)
GDate * qof_book_get_autoreadonly_gdate(const QofBook *book)
Split * xaccSplitLookup(const GncGUID *guid, QofBook *book)
void gnc_split_register_paste_current(SplitRegister *reg)
void xaccTransVoid(Transaction *trans, const char *reason)
Account * gnc_account_lookup_by_code(const Account *parent, const char *code)
gnc_numeric gnc_numeric_mul(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
gboolean do_auto_complete
GtkWidget *(* SRGetParentCallback)(gpointer user_data)
const char * xaccTransGetDescription(const Transaction *trans)
void gnc_combo_cell_add_menu_item(ComboCell *cell, const char *menustr)
The ComboCell object implements a cell handler with a "combination-box" pull-down menu in it...
void xaccTransCommitEdit(Transaction *trans)
gnc_numeric gnc_numeric_div(gnc_numeric x, gnc_numeric y, gint64 denom, gint how)
#define xaccSplitGetGUID(X)
gboolean xaccAccountEqual(const Account *aa, const Account *ab, gboolean check_guids)
gboolean gnc_split_register_current_trans_expanded(SplitRegister *reg)
void xaccTransBeginEdit(Transaction *trans)
gnc_numeric xaccSplitGetSharePrice(const Split *split)
int xaccTransGetSplitIndex(const Transaction *trans, const Split *split)
void xaccTransUnvoid(Transaction *trans)
API for checkbook register display area.
void gnc_split_register_empty_current_trans_except_split(SplitRegister *reg, Split *split)
gboolean gnc_numeric_positive_p(gnc_numeric a)
Split * xaccMallocSplit(QofBook *book)
void gnc_combo_cell_add_ignore_string(ComboCell *cell, const char *ignore_string)
#define xaccTransGetGUID(X)
Generic api to store and retrieve preferences.
void gnc_split_register_set_read_only(SplitRegister *reg, gboolean read_only)
void gnc_combo_cell_set_strict(ComboCell *cell, gboolean strict)
const char * gnc_split_register_get_credit_string(SplitRegister *reg)
gboolean gnc_split_register_handle_exchange(SplitRegister *reg, gboolean force_dialog)
gnc_numeric xaccSplitGetValue(const Split *split)
CursorClass gnc_split_register_get_current_cursor_class(SplitRegister *reg)
Account * xaccSplitGetAccount(const Split *s)
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
const GncGUID * guid_null(void)
gnc_commodity * xaccTransGetCurrency(const Transaction *trans)
gboolean xaccAccountGetPlaceholder(const Account *acc)
Declarations for the Table object.
#define LEAVE(format, args...)
void gnc_split_register_delete_current_trans(SplitRegister *reg)
gboolean gnc_split_register_get_split_amount_virt_loc(SplitRegister *reg, Split *split, VirtualLocation *virt_loc)
Split * gnc_split_register_duplicate_current(SplitRegister *reg)
time64 gnc_time(time64 *tbuf)
get the current local time
const char * xaccSplitGetMemo(const Split *split)
void gnc_split_register_show_present_divider(SplitRegister *reg, gboolean show_present)
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
gboolean qof_book_uses_autoreadonly(const QofBook *book)
void gnc_split_register_destroy(SplitRegister *reg)
void gnc_split_register_set_data(SplitRegister *reg, gpointer user_data, SRGetParentCallback get_parent)
gint gnc_numeric_same(gnc_numeric a, gnc_numeric b, gint64 denom, gint how)
TableLayout * gnc_split_register_layout_new(SplitRegister *reg)
void gnc_split_register_cut_current(SplitRegister *reg)
Account * gnc_account_lookup_for_register(const Account *base_account, const gchar *name)
void xaccTransRollbackEdit(Transaction *trans)
gboolean gnc_commodity_is_iso(const gnc_commodity *cm)
void gnc_split_register_cancel_cursor_trans_changes(SplitRegister *reg)
const gchar * QofLogModule
void gnc_gdate_set_time64(GDate *gd, time64 time)
void gnc_prefs_remove_cb_by_func(const gchar *group, const gchar *pref_name, gpointer func, gpointer user_data)
gnc_numeric xaccSplitGetAmount(const Split *split)
void gnc_split_register_config(SplitRegister *reg, SplitRegisterType newtype, SplitRegisterStyle newstyle, gboolean use_double_line)
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)