mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Compare commits
2 Commits
71337794ce
...
cbd44d167a
Author | SHA1 | Date | |
---|---|---|---|
|
cbd44d167a | ||
|
78dff8b5c1 |
@ -68,6 +68,9 @@ abstract class Versanddienstleister
|
|||||||
$auftragId = $this->app->DB->Select("SELECT auftragid FROM rechnung WHERE id=$rechnungId LIMIT 1");
|
$auftragId = $this->app->DB->Select("SELECT auftragid FROM rechnung WHERE id=$rechnungId LIMIT 1");
|
||||||
|
|
||||||
if ($sid === 'rechnung' || $sid === 'lieferschein' || $sid === 'adresse') {
|
if ($sid === 'rechnung' || $sid === 'lieferschein' || $sid === 'adresse') {
|
||||||
|
|
||||||
|
$ret['addresstype'] = 0; // 0 = firma, 1 = packstation, 2 = postfiliale, 3 = privatadresse
|
||||||
|
|
||||||
$docArr = $this->app->DB->SelectRow("SELECT * FROM `$sid` WHERE id = $id LIMIT 1");
|
$docArr = $this->app->DB->SelectRow("SELECT * FROM `$sid` WHERE id = $id LIMIT 1");
|
||||||
$ret['addressId'] = $docArr['adresse'];
|
$ret['addressId'] = $docArr['adresse'];
|
||||||
$ret['auftragId'] = $auftragId;
|
$ret['auftragId'] = $auftragId;
|
||||||
@ -79,12 +82,28 @@ abstract class Versanddienstleister
|
|||||||
|
|
||||||
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
|
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
$ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
|
if ($docArr['typ'] == "firma") {
|
||||||
$ret['name2'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
|
$ret['company_name'] = $docArr['name'];
|
||||||
$ret['name3'] = join(';', array_filter([
|
$ret['addresstype'] = 0;
|
||||||
$docArr['abteilung'],
|
} else {
|
||||||
$docArr['unterabteilung']
|
$ret['addresstype'] = 3;
|
||||||
], fn(string $item) => !empty(trim($item))));
|
}
|
||||||
|
|
||||||
|
$ret['contact_name'] = $docArr['ansprechpartner'];
|
||||||
|
|
||||||
|
$ret['company_division'] = join(
|
||||||
|
';',
|
||||||
|
array_filter(
|
||||||
|
[
|
||||||
|
$docArr['abteilung'],
|
||||||
|
$docArr['unterabteilung']
|
||||||
|
],
|
||||||
|
fn(string $item) => !empty(trim($item))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$ret['name'] = $docArr['name'];
|
||||||
|
|
||||||
$ret['address2'] = $docArr['adresszusatz'];
|
$ret['address2'] = $docArr['adresszusatz'];
|
||||||
|
|
||||||
$ret['city'] = $docArr['ort'];
|
$ret['city'] = $docArr['ort'];
|
||||||
@ -92,7 +111,6 @@ abstract class Versanddienstleister
|
|||||||
$ret['country'] = $docArr['land'];
|
$ret['country'] = $docArr['land'];
|
||||||
$ret['phone'] = $docArr['telefon'];
|
$ret['phone'] = $docArr['telefon'];
|
||||||
$ret['email'] = $docArr['email'];
|
$ret['email'] = $docArr['email'];
|
||||||
$ret['addresstype'] = 0;
|
|
||||||
|
|
||||||
$strasse = trim($docArr['strasse']);
|
$strasse = trim($docArr['strasse']);
|
||||||
$ret['streetwithnumber'] = $strasse;
|
$ret['streetwithnumber'] = $strasse;
|
||||||
|
@ -18,29 +18,34 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|||||||
<td>{|Adresstyp|}:</td>
|
<td>{|Adresstyp|}:</td>
|
||||||
<td>
|
<td>
|
||||||
<select v-model.number="form.addresstype">
|
<select v-model.number="form.addresstype">
|
||||||
<option value="0">Haus</option>
|
<option value="0">Firma</option>
|
||||||
<option value="1">Packstation</option>
|
<option value="1">Packstation</option>
|
||||||
<option value="2">Filiale</option>
|
<option value="2">Filiale</option>
|
||||||
|
<option value="3">Privatadresse</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr v-if="form.addresstype === 0">
|
||||||
<td>{|Name / Zeile 1|}:</td>
|
<td>{|Firma|}:</td>
|
||||||
<td><input type="text" size="36" v-model.trim="form.name"></td>
|
<td><input type="text" size="36" v-model.trim="form.company_name"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="form.addresstype === 0">
|
<tr v-if="form.addresstype === 0">
|
||||||
<td>{|Firmenname / Zeile 2|}:</td>
|
<td>{|Abteilung|}:</td>
|
||||||
<td><input type="text" size="36" v-model.trim="form.name2"></td>
|
<td><input type="text" size="36" v-model.trim="form.company_division"></td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="form.addresstype === 3">
|
||||||
|
<td>{|Name|}:</td>
|
||||||
|
<td><input type="text" size="36" v-model.trim="form.name"></td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||||
|
<td>{|Ansprechpartner|}:</td>
|
||||||
|
<td><input type="text" size="36" v-model.trim="form.contact_name"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
|
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
|
||||||
<td>{|Postnummer|}:</td>
|
<td>{|Postnummer|}:</td>
|
||||||
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
|
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="form.addresstype === 0">
|
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||||
<td>{|Firmenname / Zeile 3|}:</td>
|
|
||||||
<td><input type="text" size="36" v-model.trim="form.name3"></td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="form.addresstype === 0">
|
|
||||||
<td>{|Strasse/Hausnummer|}:</td>
|
<td>{|Strasse/Hausnummer|}:</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" size="30" v-model.trim="form.street">
|
<input type="text" size="30" v-model.trim="form.street">
|
||||||
@ -55,7 +60,7 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|||||||
<td>{|Postfilialnummer|}:</td>
|
<td>{|Postfilialnummer|}:</td>
|
||||||
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
|
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="form.addresstype === 0">
|
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||||
<td>{|Adresszeile 2|}:</td>
|
<td>{|Adresszeile 2|}:</td>
|
||||||
<td><input type="text" size="36" v-model.trim="form.address2"></td>
|
<td><input type="text" size="36" v-model.trim="form.address2"></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -77,10 +82,6 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>{|Ansprechpartner|}:</td>
|
|
||||||
<td><input type="text" size="36" v-model="form.contactperson"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{|E-Mail|}:</td>
|
<td>{|E-Mail|}:</td>
|
||||||
<td><input type="text" size="36" v-model.trim="form.email"></td>
|
<td><input type="text" size="36" v-model.trim="form.email"></td>
|
||||||
|
@ -102,7 +102,19 @@ class Versandart_dhl extends Versanddienstleister{
|
|||||||
switch ($json->addresstype) {
|
switch ($json->addresstype) {
|
||||||
case 0:
|
case 0:
|
||||||
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
||||||
$shipment->Receiver->Address->name2 = $json->name2;
|
|
||||||
|
$shipment->Receiver->name1 = $json->company_name;
|
||||||
|
$shipment->Receiver->Address->name2 = join(
|
||||||
|
';',
|
||||||
|
array_filter(
|
||||||
|
[
|
||||||
|
$json->contact_name,
|
||||||
|
$json->company_division
|
||||||
|
],
|
||||||
|
fn(string $item) => !empty(trim($item))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
||||||
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
||||||
$shipment->Receiver->Address->city = $json->city ?? '';
|
$shipment->Receiver->Address->city = $json->city ?? '';
|
||||||
@ -127,6 +139,20 @@ class Versandart_dhl extends Versanddienstleister{
|
|||||||
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
|
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
|
||||||
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
||||||
|
|
||||||
|
$shipment->Receiver->name1 = $json->name;
|
||||||
|
$shipment->Receiver->Address->name2 = $json->contact_name;
|
||||||
|
|
||||||
|
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
||||||
|
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
||||||
|
$shipment->Receiver->Address->city = $json->city ?? '';
|
||||||
|
$shipment->Receiver->Address->zip = $json->zip ?? '';
|
||||||
|
$shipment->Receiver->Address->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||||
|
if (isset($json->address2) && !empty($json->address2))
|
||||||
|
$shipment->Receiver->Address->addressAddition[] = $json->address2;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$shipment->Receiver->Communication = new Communication();
|
$shipment->Receiver->Communication = new Communication();
|
||||||
$shipment->Receiver->Communication->email = $json->email;
|
$shipment->Receiver->Communication->email = $json->email;
|
||||||
|
@ -82,8 +82,18 @@ class Versandart_sendcloud extends Versanddienstleister
|
|||||||
$parcel->ShippingMethodId = $json->product;
|
$parcel->ShippingMethodId = $json->product;
|
||||||
$parcel->Name = $json->name;
|
$parcel->Name = $json->name;
|
||||||
switch ($json->addresstype) {
|
switch ($json->addresstype) {
|
||||||
case 0:
|
case 0:
|
||||||
$parcel->CompanyName = trim("$json->name2 $json->name3");
|
$parcel->CompanyName = $json->company_name;
|
||||||
|
$parcel->Name = join(
|
||||||
|
';',
|
||||||
|
array_filter(
|
||||||
|
[
|
||||||
|
$json->contact_name,
|
||||||
|
$json->company_division
|
||||||
|
],
|
||||||
|
fn(string $item) => !empty(trim($item))
|
||||||
|
)
|
||||||
|
);
|
||||||
$parcel->Address = $json->street;
|
$parcel->Address = $json->street;
|
||||||
$parcel->Address2 = $json->address2;
|
$parcel->Address2 = $json->address2;
|
||||||
$parcel->HouseNumber = $json->streetnumber;
|
$parcel->HouseNumber = $json->streetnumber;
|
||||||
@ -98,6 +108,23 @@ class Versandart_sendcloud extends Versanddienstleister
|
|||||||
$parcel->Address = "Postfiliale";
|
$parcel->Address = "Postfiliale";
|
||||||
$parcel->HouseNumber = $json->postofficeNumber;
|
$parcel->HouseNumber = $json->postofficeNumber;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$parcel->Name = join(
|
||||||
|
';',
|
||||||
|
array_filter(
|
||||||
|
[
|
||||||
|
$json->name,
|
||||||
|
$json->contact_name
|
||||||
|
],
|
||||||
|
fn(string $item) => !empty(trim($item))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$parcel->Address = $json->street;
|
||||||
|
$parcel->Address2 = $json->address2;
|
||||||
|
$parcel->HouseNumber = $json->streetnumber;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
$parcel->Country = $json->country;
|
$parcel->Country = $json->country;
|
||||||
$parcel->PostalCode = $json->zip;
|
$parcel->PostalCode = $json->zip;
|
||||||
@ -164,4 +191,4 @@ class Versandart_sendcloud extends Versanddienstleister
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,16 @@
|
|||||||
<td>Konto für Differenzen:</td>
|
<td>Konto für Differenzen:</td>
|
||||||
<td><input type="text" name="sachkonto" id="sachkonto" value="[SACHKONTO]" /></td>
|
<td><input type="text" name="sachkonto" id="sachkonto" value="[SACHKONTO]" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Format:</td>
|
||||||
|
<td>
|
||||||
|
<select name="format">
|
||||||
|
<option value="ISO-8859-1">ISO-8859-1</option>
|
||||||
|
<option value="UTF-8">UTF-8</option>
|
||||||
|
<option value="UTF-8-BOM">UTF-8 mit BOM</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
@ -80,6 +80,7 @@ class Exportbuchhaltung
|
|||||||
$lgchecked = $this->app->Secure->GetPOST("lieferantengutschrift");
|
$lgchecked = $this->app->Secure->GetPOST("lieferantengutschrift");
|
||||||
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
$diffignore = $this->app->Secure->GetPOST("diffignore");
|
||||||
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
|
||||||
|
$format = $this->app->Secure->GetPOST('format');
|
||||||
|
|
||||||
$account_id = null;
|
$account_id = null;
|
||||||
if (!empty($sachkonto)) {
|
if (!empty($sachkonto)) {
|
||||||
@ -162,7 +163,7 @@ class Exportbuchhaltung
|
|||||||
if ($dataok) {
|
if ($dataok) {
|
||||||
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
$filename = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
|
||||||
try {
|
try {
|
||||||
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung);
|
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename, $diffignore, $sachkonto_kennung, $format);
|
||||||
header("Content-Disposition: attachment; filename=" . $filename);
|
header("Content-Disposition: attachment; filename=" . $filename);
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
header("Expires: 0");
|
header("Expires: 0");
|
||||||
@ -214,9 +215,10 @@ class Exportbuchhaltung
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Create DATEV Buchhungsstapel
|
* Create DATEV Buchhungsstapel
|
||||||
|
* format: "ISO-8859-1", "UTF-8", "UTF-8-BOM"
|
||||||
* @throws ConsistencyException with string (list of items) if consistency check fails and no sachkonto for differences is given
|
* @throws ConsistencyException with string (list of items) if consistency check fails and no sachkonto for differences is given
|
||||||
*/
|
*/
|
||||||
function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, bool $lieferantengutschrift, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences) : string {
|
function DATEV_Buchuchungsstapel(bool $rechnung, bool $gutschrift, bool $verbindlichkeit, bool $lieferantengutschrift, string $berater, string $mandant, datetime $wj_beginn, int $sachkontenlaenge, datetime $von, datetime $bis, int $projekt = 0, string $filename = 'EXTF_Buchungsstapel_DATEV_export.csv', $diffignore = false, $sachkonto_differences, string $format = "ISO-8859-1") : string {
|
||||||
|
|
||||||
$datev_header_definition = array (
|
$datev_header_definition = array (
|
||||||
'1' => 'Kennzeichen',
|
'1' => 'Kennzeichen',
|
||||||
@ -671,7 +673,17 @@ class Exportbuchhaltung
|
|||||||
|
|
||||||
$csv .= '"0";"S";"EUR";"0";"";"";"1234";"1370";"";"101";"";"";"";"Testbuchung";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"0";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""'; // Testbuchung
|
$csv .= '"0";"S";"EUR";"0";"";"";"1234";"1370";"";"101";"";"";"";"Testbuchung";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"0";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""'; // Testbuchung
|
||||||
|
|
||||||
$csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
|
switch ($format) {
|
||||||
|
case "UTF-8":
|
||||||
|
break;
|
||||||
|
case "UTF-8-BOM":
|
||||||
|
$csv = "\xef\xbb\xbf".$csv;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$csv = mb_convert_encoding($csv, "ISO-8859-1", "UTF-8");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return($csv);
|
return($csv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user