Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 90815a31

Von Joachim Zach vor mehr als 14 Jahren hinzugefügt

  • ID 90815a31b45ced8f49c31502cff1c8155e692a7a
  • Vorgänger bedf5ec6
  • Nachfolger 4236c151

Optionale minimale Excel-Unterstützung für Druckvorlagen (Austausch von Platzhalter-Variablen in Excel-Dateien). Entsprechend noch für strict angepasst

Unterschiede anzeigen:

SL/CT.pm
1089 1089
  return $result;
1090 1090
}
1091 1091

  
1092
sub parse_excel_file {
1093
  $main::lxdebug->enter_sub();
1094

  
1095
  my ($self, $myconfig, $form) = @_;
1096
  my $locale = $main::locale;
1097

  
1098
  $form->{formname}   = 'sales_quotation';
1099
  $form->{type}   = 'sales_quotation';
1100
  $form->{format} = 'excel';
1101
  $form->{media}  = 'screen';
1102
  $form->{quonumber} = 1;
1103

  
1104

  
1105
  # $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
1106
  $form->{ $form->{"formname"} . "notes" } = $form->{"notes"};
1107

  
1108
  my $inv                  = "quo";
1109
  my $due                  = "req";
1110
  $form->{"${inv}date"} = $form->{transdate};
1111
  $form->{label}        = $locale->text('Quotation');
1112
  my $numberfld            = "sqnumber";
1113
  my $order                = 1;
1114

  
1115
  # assign number
1116
  $form->{what_done} = $form->{formname};
1117

  
1118
  map({ delete($form->{$_}); } grep(/^cp_/, keys(%{ $form })));
1119

  
1120
  my $output_dateformat = $myconfig->{"dateformat"};
1121
  my $output_numberformat = $myconfig->{"numberformat"};
1122
  my $output_longdates = 1;
1123

  
1124
  # map login user variables
1125
  map { $form->{"login_$_"} = $myconfig->{$_} } ("name", "email", "fax", "tel", "company");
1126

  
1127
  # format item dates
1128
  for my $field (qw(transdate_oe deliverydate_oe)) {
1129
    map {
1130
      $form->{$field}[$_] = $locale->date($myconfig, $form->{$field}[$_], 1);
1131
    } 0 .. $#{ $form->{$field} };
1132
  }
1133

  
1134
  if ($form->{shipto_id}) {
1135
    $form->get_shipto($myconfig);
1136
  }
1137

  
1138
  $form->{notes} =~ s/^\s+//g;
1139

  
1140
  $form->{templates} = $myconfig->{templates};
1141

  
1142
  delete $form->{printer_command};
1143

  
1144
  $form->get_employee_info($myconfig);
1145

  
1146
  my ($cvar_date_fields, $cvar_number_fields) = CVar->get_field_format_list('module' => 'CT', 'prefix' => 'vc_');
1147

  
1148
  if (scalar @{ $cvar_date_fields }) {
1149
    format_dates($output_dateformat, $output_longdates, @{ $cvar_date_fields });
1150
  }
1151

  
1152
  while (my ($precision, $field_list) = each %{ $cvar_number_fields }) {
1153
    reformat_numbers($output_numberformat, $precision, @{ $field_list });
1154
  }
1155

  
1156
  $form->{excel} = 1;
1157
  my $extension            = 'xls';
1158

  
1159
  my $form->{IN}         = "$form->{formname}.${extension}";
1160

  
1161
  delete $form->{OUT};
1162

  
1163
  $form->parse_template($myconfig, $main::userspath);
1164

  
1165
  $main::lxdebug->leave_sub();
1166
}
1167

  
1092 1168
1;

Auch abrufbar als: Unified diff