_copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id
employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma
globalproject_id delivered transaction_description container_type accepted_by_customer invoice terms storno storno_id dunning_config_id
- orddate quodate reqdate gldate duedate deliverydate datepaid transdate));
+ orddate quodate reqdate gldate duedate deliverydate datepaid transdate delivery_term_id));
$form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : '';
if (_has($self, 'transdate')) {
$form->{vc} = $vc if ref($self) =~ /^SL::DB::.*Invoice/;
- my @vc_fields = (qw(account_number bank bank_code bic business city contact country creditlimit discount
- email fax homepage iban language name payment_terms phone street taxnumber zipcode),
+ my @vc_fields = (qw(account_number bank bank_code bic business city contact country creditlimit
+ department_1 department_2 discount email fax homepage iban language name
+ payment_terms phone street taxnumber ustid zipcode),
"${vc}number",
($vc eq 'customer')? 'c_vendor_id': 'v_customer_id');
my @vc_prefixed_fields = qw(email fax notes number phone);
my $idx = 0;
my $format_amounts = $params{format_amounts} ? 1 : 0;
my $format_notnull = $params{format_amounts} ? 2 : 0;
+ my $format_percent = $params{format_amounts} ? 3 : 0;
foreach my $item (@{ $self->items_sorted }) {
next if _has($item, 'assemblyitem');
$idx++;
- $form->{"id_${idx}"} = $item->parts_id;
- $form->{"partnumber_${idx}"} = $item->part->partnumber;
- $form->{"weight_${idx}"} = $item->part->weight;
- _copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber cusordnumber unit
+ $form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id');
+ _copy($item->part, $form, '', "_${idx}", 0, qw(id partnumber weight));
+ _copy($item->part, $form, '', "_${idx}", $format_amounts, qw(listprice));
+ _copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber donumber cusordnumber unit
subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate));
_copy($item, $form, '', "_${idx}", $format_amounts, qw(qty sellprice marge_total marge_percent lastcost));
- _copy($item, $form, '', "_${idx}", $format_notnull, qw(discount));
+ _copy($item, $form, '', "_${idx}", $format_percent, qw(discount));
_copy($item->project, $form, 'project', "_${idx}", 0, qw(number description)) if _has($item, 'project_id');
_copy_custom_variables($item, $form, 'ic_cvar_', "_${idx}");
+
+ if (ref($self) eq 'SL::DB::Invoice') {
+ my $date = $item->deliverydate ? $item->deliverydate->to_lxoffice : undef;
+ $form->{"deliverydate_oe_${idx}"} = $date;
+ $form->{"reqdate_${idx}"} = $date;
+ }
}
_copy_custom_variables($self, $form, 'vc_cvar_', '');
@columns = grep { $src->can($_) } @columns;
- map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_ } @columns if !$format_amounts;
- map { $form->{"${prefix}${_}${postfix}"} = $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) } @columns if $format_amounts == 1;
- map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0 } @columns if $format_amounts == 2;
+ map { $form->{"${prefix}${_}${postfix}"} = ref($src->$_) eq 'DateTime' ? $src->$_->to_lxoffice : $src->$_ } @columns if !$format_amounts;
+ map { $form->{"${prefix}${_}${postfix}"} = $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) } @columns if $format_amounts == 1;
+ map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 1, 2) : 0 } @columns if $format_amounts == 2;
+ map { $form->{"${prefix}${_}${postfix}"} = $src->$_ * 1 ? $::form->format_amount(\%::myconfig, $src->$_ * 100, 2) : 0 } @columns if $format_amounts == 3;
return $src;
}