Skip to content
Code-Schnipsel Gruppen Projekte
Commit e7c5889f erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: Bezahlungsart hinzufügen

Übergeordneter 7cbb2793
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -63,10 +63,10 @@
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textOrderedBy}}">
{{textPaymentType}}
<span class="field-container-item" title="{{textPaymentMethod}}">
{{textPaymentMethod}}
</span>
<select class="field-container-field" name="payment_type"></select>
<select class="field-container-field" name="payment_method"></select>
</label>
</td>
</tr>
......
......@@ -64,14 +64,14 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
],
options: {
invoiceId : false,
customer_id : false,
address_id : false,
project_name : '',
date : '',
time_for_payment: '',
data : {},
articles : []
invoiceId : false,
customer_id : false,
invoice_address_id: false,
project_name : '',
date : '',
time_for_payment : '',
data : {},
articles : []
},
initialize: function (options) {
......@@ -142,16 +142,17 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
/**
*
* @returns {{customer_id, address_id, project_name, articles, date, time_for_payment}}
* @returns {{customer_id, invoice_address_id, project_name, articles, date, time_for_payment}}
*/
getCurrentData: function () {
return {
customer_id : this.getAttribute('customer_id'),
address_id : this.getAttribute('address_id'),
project_name : this.getAttribute('project_name'),
articles : this.getAttribute('articles'),
date : this.getAttribute('date'),
time_for_payment: this.getAttribute('time_for_payment')
customer_id : this.getAttribute('customer_id'),
invoice_address_id: this.getAttribute('invoice_address_id'),
project_name : this.getAttribute('project_name'),
articles : this.getAttribute('articles'),
date : this.getAttribute('date'),
time_for_payment : this.getAttribute('time_for_payment'),
payment_method : this.getAttribute('payment_method')
};
},
......@@ -161,7 +162,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
getUserData: function () {
return {
uid: this.getAttribute('customer_id'),
aid: this.getAttribute('address_id')
aid: this.getAttribute('invoice_address_id')
};
},
......@@ -190,7 +191,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
textProjectName : QUILocale.get(lg, 'erp.panel.temporary.invoice.category.data.textProjectName'),
textOrderedBy : QUILocale.get(lg, 'erp.panel.temporary.invoice.category.data.textOrderedBy'),
textInvoicePayment: QUILocale.get(lg, 'erp.panel.temporary.invoice.category.data.textInvoicePayment'),
textPaymentType : QUILocale.get(lg, 'erp.panel.temporary.invoice.category.data.textPaymentType')
textPaymentMethod : QUILocale.get(lg, 'erp.panel.temporary.invoice.category.data.textPaymentMethod')
})
});
......@@ -232,12 +233,12 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
Data.addEvent('onChange', function () {
self.setAttribute('customer_id', Data.getValue().userId);
self.setAttribute('address_id', Data.getValue().addressId);
self.setAttribute('invoice_address_id', Data.getValue().addressId);
});
return Data.setValue(
self.getAttribute('customer_id'),
self.getAttribute('address_id')
self.getAttribute('invoice_address_id')
);
}).then(function () {
var Container = self.getContent().getElement('.container');
......@@ -261,8 +262,25 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
return Payments.getPayments();
}).then(function (payments) {
// load payments
console.log(payments);
var Payments = self.getContent().getElement('[name="payment_method"]');
new Element('option', {
html : '',
value: ''
}).inject(Payments);
for (var payment in payments) {
if (!payments.hasOwnProperty(payment)) {
continue;
}
new Element('option', {
html : payments[payment].title,
value: payment
}).inject(Payments);
}
Payments.value = self.getAttribute('payment_method');
self.getCategory('data').setActive();
self.Loader.hide();
......@@ -528,7 +546,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
);
}
['time_for_payment', 'project_name'].each(function (entry) {
['time_for_payment', 'project_name', 'payment_method'].each(function (entry) {
if (!formData.hasOwnProperty(entry)) {
return;
}
......
......@@ -329,7 +329,7 @@
<de><![CDATA[Bezahlung]]></de>
<en><![CDATA[Payment]]></en>
</locale>
<locale name="erp.panel.temporary.invoice.category.data.textPaymentType">
<locale name="erp.panel.temporary.invoice.category.data.textPaymentMethod">
<de><![CDATA[Bezahlungsart]]></de>
<en><![CDATA[Payment type]]></en>
</locale>
......@@ -446,6 +446,10 @@
<de><![CDATA[Die Rechnung besitzt keine Artikel.]]></de>
<en><![CDATA[The invoice has no articles.]]></en>
</locale>
<locale name="exception.invoice.verification.missingPayment">
<de><![CDATA[Die Rechnung besitzt keine Bezahlmethod.]]></de>
<en><![CDATA[The invoice has no payment method.]]></en>
</locale>
</groups>
</locales>
\ No newline at end of file
......@@ -178,14 +178,14 @@ public function save($User = null)
$this->Articles->calc();
$listCalculations = $this->Articles->getCalculations();
//QUI\System\Log::writeRecursive($this->Articles->toJSON());
// attributes
$projectName = '';
$invoiceAddress = '';
$timeForPayment = '';
$paymentMethod = '';
$date = '';
$isBrutto = QUI\ERP\Defaults::getBruttoNettoStatus();
$isBrutto = QUI\ERP\Defaults::getBruttoNettoStatus();
if ($this->getCustomer()
&& !QUI\ERP\Utils\User::isNettoUser($this->getCustomer())
......@@ -219,41 +219,58 @@ public function save($User = null)
QUI\System\Log::addNotice($Exception->getMessage());
}
// payment
try {
if ($this->getAttribute('payment_method')) {
$Payments = QUI\ERP\Accounting\Payments\Handler::getInstance();
$Payment = $Payments->getPayment($this->getAttribute('payment_method'));
$paymentMethod = $Payment->getName();
}
} catch (QUI\ERP\Accounting\Payments\Exception $Exception) {
QUI\System\Log::addNotice($Exception->getMessage());
}
QUI::getDataBase()->update(
Handler::getInstance()->temporaryInvoiceTable(),
array(
'customer_id' => (int)$this->getAttribute('customer_id'),
'order_id' => (int)$this->getAttribute('order_id'),
'project_name' => $projectName,
'customer_id' => (int)$this->getAttribute('customer_id'),
'order_id' => (int)$this->getAttribute('order_id'),
'project_name' => $projectName,
'payment_method' => $this->getAttribute('payment_method'),
'payment_data' => '',
'payment_time' => '',
// payments
'payment_method' => $paymentMethod,
'payment_data' => '',
'payment_time' => '',
// address
'invoice_address_id' => (int)$this->getAttribute('invoice_address_id'),
'invoice_address' => $invoiceAddress,
'delivery_address_id' => '',
'delivery_address' => '',
'time_for_payment' => $timeForPayment,
'paid_status' => '', // nicht in gui
'paid_date' => '', // nicht in gui
'paid_data' => '', // nicht in gui
'processing_status' => '',
'customer_data' => '', // nicht in gui
'date' => $date,
'data' => '',
'articles' => $this->Articles->toJSON(),
'history' => $this->History->toJSON(),
'comments' => $this->Comments->toJSON(),
'isbrutto' => $isBrutto,
'currency_data' => json_encode($listCalculations['currencyData']),
'nettosum' => $listCalculations['nettoSum'],
'subsum' => $listCalculations['subSum'],
'sum' => $listCalculations['sum'],
'vat_data' => json_encode($listCalculations['vatArray'])
// processing status
'time_for_payment' => $timeForPayment,
'paid_status' => '', // nicht in gui
'paid_date' => '', // nicht in gui
'paid_data' => '', // nicht in gui
'processing_status' => '',
'customer_data' => '', // nicht in gui
// invoice data
'date' => $date,
'data' => '',
'articles' => $this->Articles->toJSON(),
'history' => $this->History->toJSON(),
'comments' => $this->Comments->toJSON(),
// Calc data
'isbrutto' => $isBrutto,
'currency_data' => json_encode($listCalculations['currencyData']),
'nettosum' => $listCalculations['nettoSum'],
'subsum' => $listCalculations['subSum'],
'sum' => $listCalculations['sum'],
'vat_data' => json_encode($listCalculations['vatArray'])
),
array(
'id' => $this->getCleanId()
......@@ -403,7 +420,16 @@ public function validate()
));
}
// @todo payment prüfung
// payment
try {
$Payments = QUI\ERP\Accounting\Payments\Handler::getInstance();
$Payments->getPayment($this->getAttribute('payment_method'));
} catch (QUI\ERP\Accounting\Payments\Exception $Exception) {
throw new Exception(array(
'quiqqer/invoice',
'exception.invoice.verification.missingPayment'
));
}
}
/**
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren