160 |
160 |
|
161 |
161 |
# deal with fxtransaction
|
162 |
162 |
if ( $self->currency_id != $::instance_conf->get_currency_id ) {
|
163 |
|
my $fxamount = _round($amount - ($amount * $exchangerate));
|
164 |
|
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id,
|
165 |
|
chart_id => $account_bank->id,
|
166 |
|
chart_link => $account_bank->link,
|
167 |
|
amount => $fxamount * -1,
|
168 |
|
transdate => $transdate_obj,
|
169 |
|
source => $source,
|
170 |
|
memo => $memo,
|
171 |
|
taxkey => 0,
|
172 |
|
fx_transaction => 1,
|
173 |
|
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
|
174 |
|
$new_acc_trans->save;
|
175 |
|
# if invoice exchangerate differs from exchangerate of payment
|
|
163 |
# if invoice exchangerate differs from exchangerate of payment
|
176 |
164 |
# deal with fxloss and fxamount
|
177 |
165 |
if ($self->exchangerate and $self->exchangerate != 1 and $self->exchangerate != $exchangerate) {
|
178 |
166 |
my $fxgain_chart = SL::DB::Manager::Chart->find_by(id => $::instance_conf->get_fxgain_accno_id) || die "Can't determine fxgain chart";
|
... | ... | |
192 |
180 |
fx_transaction => 0,
|
193 |
181 |
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
|
194 |
182 |
$new_acc_trans->save;
|
195 |
|
|
|
183 |
my $fxamount = _round($amount - ($amount * $exchangerate));
|
|
184 |
$new_acc_trans = SL::DB::AccTransaction->new(trans_id => $self->id,
|
|
185 |
chart_id => $account_bank->id,
|
|
186 |
chart_link => $account_bank->link,
|
|
187 |
amount => $fxamount * -1,
|
|
188 |
transdate => $transdate_obj,
|
|
189 |
source => $source,
|
|
190 |
memo => $memo,
|
|
191 |
taxkey => 0,
|
|
192 |
fx_transaction => 1,
|
|
193 |
tax_id => SL::DB::Manager::Tax->find_by(taxkey => 0)->id);
|
|
194 |
$new_acc_trans->save;
|
196 |
195 |
};
|
197 |
196 |
};
|
198 |
197 |
};
|
... | ... | |
261 |
260 |
my $arap_booking= SL::DB::AccTransaction->new(trans_id => $self->id,
|
262 |
261 |
chart_id => $reference_account->id,
|
263 |
262 |
chart_link => $reference_account->link,
|
264 |
|
amount => _round($arap_amount * $mult * $exchangerate - $fx_gain_loss_amount),
|
|
263 |
amount => _round($arap_amount * $mult),
|
265 |
264 |
transdate => $transdate_obj,
|
266 |
265 |
source => '', #$params{source},
|
267 |
266 |
taxkey => 0,
|