486
487
param = qof_class_get_parameter(GPE_QOF_EXPENSES, EXP_DATE);
487
488
qt = (QofTime*)param->param_getfcn (ent, param);
488
489
qd = qof_date_from_qtime (qt);
489
/** \todo Use a locale-sensitive format? */
490
date_string = qof_date_print (qd, QOF_DATE_FORMAT_UK);
490
date_string = qof_date_print (qd, QOF_DATE_FORMAT_LOCALE);
491
491
qof_date_free (qd);
492
492
param = qof_class_get_parameter(GPE_QOF_EXPENSES, EXP_TYPE);
493
493
dis_string = param->param_getfcn(ent, param);
619
619
gchar *numeric_char;
620
620
gdouble d_amount;
622
/* detect local currency */
623
628
context = (GpeExpenseData*)data;
624
629
g_return_if_fail(context);
626
632
qe = (Expense_t*)context->entity;
627
633
param = qof_class_get_parameter(GPE_QOF_EXPENSES, EXP_CURRENCY);
628
634
i32_setter = (void(*)(QofEntity*, gint32))param->param_setfcn;
629
/** \todo don't use 22 as a default */
630
if(i32_setter != NULL) { i32_setter(context->entity, 22); }
635
/* use locale currency */
637
DEBUG (" sym=%s", lc.currency_symbol);
638
sy = g_strdup (lc.int_curr_symbol);
639
sy = g_strstrip (sy);
640
c = gpe_currency_lookup_name ((QofInstance*)context->entity, sy);
642
def_pq_code = c->pq_code;
644
if(i32_setter != NULL) { i32_setter(context->entity, def_pq_code); }
631
645
param = qof_class_get_parameter(GPE_QOF_EXPENSES, EXP_AMOUNT);
632
646
numeric_setter = (void(*)(QofEntity*, QofNumeric))param->param_setfcn;
820
834
const QofParam *param;
821
835
void (*i32_setter) (QofEntity*, gint32);
836
/* detect local currency */
823
842
g_return_if_fail(context);
824
844
book = qof_session_get_book(context->qof.input_session);
825
845
inst = (QofInstance*)qof_object_new_instance(GPE_QOF_EXPENSES, book);
826
846
context->entity = &inst->entity;
827
/** \todo implement preferred currency */
847
/* use locale currency */
849
DEBUG (" sym=%s", lc.currency_symbol);
850
sy = g_strdup (lc.int_curr_symbol);
851
sy = g_strstrip (sy);
852
c = gpe_currency_lookup_name (inst, sy);
854
def_pq_code = c->pq_code;
828
856
param = qof_class_get_parameter (GPE_QOF_EXPENSES, EXP_CURRENCY);
829
857
i32_setter = (void(*)(QofEntity*, gint32))param->param_setfcn;
830
858
qof_util_param_edit ((QofInstance*)context->entity, param);
831
i32_setter(context->entity, 22);
859
i32_setter(context->entity, def_pq_code);
832
860
qof_util_param_commit ((QofInstance*)context->entity, param);
833
861
gtk_list_store_append(context->list_store, &ent_data);
834
862
exp_refresh_list(context);