@ -57,15 +57,15 @@ std::map<GncTransPropType, const char*> gnc_csv_col_type_strs = {
{ GncTransPropType : : NONE , N_ ( " None " ) } ,
{ GncTransPropType : : UNIQUE_ID , N_ ( " Transaction ID " ) } ,
{ GncTransPropType : : DATE , N_ ( " Date " ) } ,
{ GncTransPropType : : NUM , N_ ( " Num " ) } ,
{ GncTransPropType : : NUM , N_ ( " Num ber " ) } ,
{ GncTransPropType : : DESCRIPTION , N_ ( " Description " ) } ,
{ GncTransPropType : : NOTES , N_ ( " Notes " ) } ,
{ GncTransPropType : : COMMODITY , N_ ( " Transaction Commodity " ) } ,
{ GncTransPropType : : VOID_REASON , N_ ( " Void Reason " ) } ,
{ GncTransPropType : : ACTION , N_ ( " Action " ) } ,
{ GncTransPropType : : ACCOUNT , N_ ( " Account " ) } ,
{ GncTransPropType : : DEPOSIT, N_ ( " Deposi t" ) } ,
{ GncTransPropType : : WITHDRAWAL, N_ ( " Withdrawal " ) } ,
{ GncTransPropType : : AMOUNT, N_ ( " Amoun t" ) } ,
{ GncTransPropType : : AMOUNT_NEG, N_ ( " Amount (Negated) " ) } ,
{ GncTransPropType : : PRICE , N_ ( " Price " ) } ,
{ GncTransPropType : : MEMO , N_ ( " Memo " ) } ,
{ GncTransPropType : : REC_STATE , N_ ( " Reconciled " ) } ,
@ -442,13 +442,13 @@ void GncPreSplit::set (GncTransPropType prop_type, const std::string& value)
m_tmemo = value ;
break ;
case GncTransPropType : : DEPOSI T:
m_ deposi t = boost : : none ;
m_ deposi t = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
case GncTransPropType : : AMOUN T:
m_ amoun t = boost : : none ;
m_ amoun t = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
break ;
case GncTransPropType : : WITHDRAWAL :
m_ withdrawal = boost : : none ;
m_ withdrawal = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
case GncTransPropType : : AMOUNT_NEG :
m_ amount_neg = boost : : none ;
m_ amount_neg = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
break ;
case GncTransPropType : : PRICE :
@ -532,18 +532,18 @@ void GncPreSplit::add (GncTransPropType prop_type, const std::string& value)
auto num_val = GncNumeric ( ) ;
switch ( prop_type )
{
case GncTransPropType : : DEPOSI T:
case GncTransPropType : : AMOUN T:
num_val = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
if ( m_ deposi t)
num_val + = * m_ deposi t;
m_ deposi t = num_val ;
if ( m_ amoun t)
num_val + = * m_ amoun t;
m_ amoun t = num_val ;
break ;
case GncTransPropType : : WITHDRAWAL :
case GncTransPropType : : AMOUNT_NEG :
num_val = parse_monetary ( value , m_currency_format ) ; // Will throw if parsing fails
if ( m_ withdrawal )
num_val + = * m_ withdrawal ;
m_ withdrawal = num_val ;
if ( m_ amount_neg )
num_val + = * m_ amount_neg ;
m_ amount_neg = num_val ;
break ;
default :
@ -574,8 +574,8 @@ std::string GncPreSplit::verify_essentials (void)
{
auto err_msg = std : : string ( ) ;
/* Make sure this split has the minimum required set of properties defined. */
if ( ! m_ deposit & & ! m_withdrawal )
err_msg = _ ( " No deposit or withdrawal column." ) ;
if ( ! m_ amount & & ! m_amount_neg )
err_msg = _ ( " No amount or negated amount column." ) ;
if ( m_rec_state & & * m_rec_state = = YREC & & ! m_rec_date )
{
@ -679,20 +679,16 @@ void GncPreSplit::create_split (Transaction* trans)
Account * account = nullptr ;
Account * taccount = nullptr ;
auto deposit = GncNumeric ( ) ;
auto withdrawal = GncNumeric ( ) ;
auto amount = GncNumeric ( ) ;
if ( m_account )
account = * m_account ;
if ( m_taccount )
taccount = * m_taccount ;
if ( m_deposit )
deposit = * m_deposit ;
if ( m_withdrawal )
withdrawal = * m_withdrawal ;
amount = deposit - withdrawal ;
if ( m_amount )
amount + = * m_amount ;
if ( m_amount_neg )
amount - = * m_amount_neg ;
/* Add a split with the cumulative amount value. */
trans_add_split ( trans , account , amount , m_action , m_memo , m_rec_state , m_rec_date , m_price ) ;