add payment informations

This commit is contained in:
Daniel Seifert 2020-07-02 01:21:14 +02:00
parent 35a2128c15
commit c28e7c3f45
11 changed files with 84 additions and 45 deletions

View File

@ -133,12 +133,17 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
return null;
}
public function setSmartyVars()
/**
* @param int $iSelLang
*/
public function setSmartyVars($iSelLang)
{
unset($iSelLang);
$this->oSmarty->assign('oConfig', Registry::getSession()->getConfig());
$this->oSmarty->assign('oViewConf', Registry::getSession()->getConfig()->getActiveView()->getViewConfig());
$this->oSmarty->assign('shop', Registry::getSession()->getConfig()->getActiveShop());
$this->oSmarty->assign('lang', Registry::getLang());
$this->oSmarty->assign('document', $this);
}
/**
@ -156,7 +161,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
$currTplLang = $lang->getTplLanguage();
$lang->setTplLanguage($iSelLang);
$this->setSmartyVars();
$this->setSmartyVars($iSelLang);
$content = $this->oSmarty->fetch($this->getTemplate());

View File

@ -22,6 +22,7 @@ use D3\PdfDocuments\Application\Model\Interfaces\pdfdocumentsOrderInterface as o
use \OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use Spipu\Html2Pdf\Exception\Html2PdfException;
abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInterface
@ -45,9 +46,12 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
return $this->oOrder;
}
public function setSmartyVars()
/**
* @param int $iSelLang
*/
public function setSmartyVars($iSelLang)
{
parent::setSmartyVars();
parent::setSmartyVars($iSelLang);
$this->oSmarty->assign('order', $this->getOrder());
@ -56,7 +60,7 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
$this->oSmarty->assign('user', $oUser);
$oPayment = oxNew(Payment::class);
$oPayment->load($this->getOrder()->getFieldData('oxpaymenttype'));
$oPayment->loadInLang($iSelLang, $this->getOrder()->getFieldData('oxpaymenttype'));
$this->oSmarty->assign('payment', $oPayment);
}
@ -110,4 +114,29 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
return parent::genPdf($sFilename, $iSelLang, $target);
}
/**
* @return int
*/
public function getPaymentTerm()
{
if (null === $iPaymentTerm = Registry::getConfig()->getConfigParam('iPaymentTerm')) {
$iPaymentTerm = 7;
}
return $iPaymentTerm;
}
/**
* @return false|string
*/
public function getPayableUntilDate()
{
return strtotime(
'+' . $this->getPaymentTerm() . ' day',
strtotime(
$this->getOrder()->getFieldData('oxbilldate')
)
);
}
}

View File

@ -68,6 +68,7 @@ $aLang = array(
'D3_PDFDOCUMENTS_TOTALSUMBRUT' => 'Gesamtsumme (brutto)',
'D3_PDFDOCUMENTS_USED_PAYMENTMETHOD' => 'Ihre gewählte Zahlungsweise',
'D3_PDFDOCUMENTS_PAYABLEUNTIL' => 'Zahlbar bis zum',
'D3_PDFDOCUMENTS_RECEIVED_PAYMENT' => 'Den Rechnungsbetrag haben wir dankend erhalten.',
'D3_PDFDOCUMENTS_MANAGINGDIRECTOR' => 'Geschäftsführer',

View File

@ -56,17 +56,18 @@ $aLang = array(
'D3_PDFDOCUMENTS_UNDEFINED_TAX' => 'plus VAT',
'D3_PDFDOCUMENTS_PROPORTIONAL_TAX' => 'plus VAT (proportionally calculated)',
'D3_PDFDOCUMENTS_VOUCHERDISCOUNT' => 'Coupon',
'D3_PDFDOCUMENTS_DELIVERY_NET' => 'Shipping costs (net)',
'D3_PDFDOCUMENTS_DELIVERY_NET' => 'Shipping costs (excl. tax)',
'D3_PDFDOCUMENTS_DELIVERY' => 'Shipping costs',
'D3_PDFDOCUMENTS_PAYMENT_NET' => 'Additional Charge Payment Method (net)',
'D3_PDFDOCUMENTS_PAYMENT_NET' => 'Additional Charge Payment Method (excl. tax)',
'D3_PDFDOCUMENTS_PAYMENT' => 'Additional Charge Payment Method',
'D3_PDFDOCUMENTS_WRAPPING_NET' => 'Gift Wrapping (net)',
'D3_PDFDOCUMENTS_WRAPPING_NET' => 'Gift Wrapping (excl. tax)',
'D3_PDFDOCUMENTS_WRAPPING' => 'Gift Wrapping',
'D3_PDFDOCUMENTS_GIFTCARD_NET' => 'Greeting Card (net)',
'D3_PDFDOCUMENTS_GIFTCARD_NET' => 'Greeting Card (excl. tax)',
'D3_PDFDOCUMENTS_GIFTCARD' => 'Greeting Card',
'D3_PDFDOCUMENTS_TOTALSUMBRUT' => 'Total sum (gross)',
'D3_PDFDOCUMENTS_USED_PAYMENTMETHOD' => 'Your chosen payment method',
'D3_PDFDOCUMENTS_PAYABLEUNTIL' => 'Billing till',
'D3_PDFDOCUMENTS_RECEIVED_PAYMENT' => 'We have received the invoice amount with thanks.',
'D3_PDFDOCUMENTS_MANAGINGDIRECTOR' => 'Managing director',

View File

@ -1,4 +1,4 @@
[{assign var="pagePadding" value=","|explode:"45,15,25,25"}] [{* top, right, bottom, left *}]
[{assign var="pagePadding" value=","|explode:"45,15,30,25"}] [{* top, right, bottom, left *}]
[{assign var="showLogo" value=$showLogo|default:true}]
[{capture append="pdfBlock_style"}]

View File

@ -1,11 +1,6 @@
[{block name="conclusion"}]
<nobreak>
<table class="conclusion_table">
<tr>
<td>
[{oxmultilang ident="D3_DELIVERYNOTE_PDF_PAYABLEUNTIL"}] 20.05.2020
</td>
</tr>
</table>
[{block name="conclusion_thankyou"}]
[{/block}]
</nobreak>
[{/block}]

View File

@ -1,24 +1,19 @@
[{block name="conclusion"}]
<nobreak>
<table class="conclusion_table">
[{block name="conclusion_paymethod"}]
<tr>
<td>
[{oxmultilang ident="D3_PDFDOCUMENTS_USED_PAYMENTMETHOD" suffix="COLON"}]
[{$payment->getFieldData('oxdesc')}]
</td>
</tr>
[{/block}]
<tr>
<td>
[{oxmultilang ident="D3_PDFDOCUMENTS_THANKYOU_1"}]
</td>
</tr>
<tr>
<td>
[{oxmultilang ident="D3_PDFDOCUMENTS_THANKYOU_2" args=$shop->getFieldData('oxname')}]
</td>
</tr>
</table>
[{block name="conclusion_paymethod"}]
<div class="conclusion_payment">
[{oxmultilang ident="D3_PDFDOCUMENTS_USED_PAYMENTMETHOD" suffix="COLON"}]
[{$payment->getFieldData('oxdesc')}]<br>
[{include file="d3invoice_pdf_payinfo.tpl"}]
</div>
[{/block}]
[{block name="conclusion_thankyou"}]
<div class="conclusion_thankyou">
[{oxmultilang ident="D3_PDFDOCUMENTS_THANKYOU_1"}]<br>
[{oxmultilang ident="D3_PDFDOCUMENTS_THANKYOU_2" args=$shop->getFieldData('oxname')}]
</div>
[{/block}]
</nobreak>
[{/block}]

View File

@ -0,0 +1,16 @@
[{block name="payinfo"}]
[{if $payment->getId() == 'oxidinvoice'}]
[{block name="payinfo_billable_till"}]
[{assign var="dateFormat" value='D3_PDFDOCUMENTS_DATE_FORMAT'|oxmultilangassign}]
[{oxmultilang ident="D3_PDFDOCUMENTS_PAYABLEUNTIL"}]
[{$document->getPayableUntilDate()|date_format:$dateFormat}]
[{/block}]
[{elseif $payment->getId() == 'oxidpayadvance' || $payment->getId() == 'oxidcreditcard'}]
[{block name="payinfo_payed"}]
[{oxmultilang ident="D3_PDFDOCUMENTS_RECEIVED_PAYMENT"}]
[{/block}]
[{else}]
[{block name="payinfo_other"}]
[{/block}]
[{/if}]
[{/block}]

View File

@ -1,4 +1,4 @@
[{assign var="pagePadding" value=","|explode:"45,15,25,25"}] [{* top, right, bottom, left *}]
[{assign var="pagePadding" value=","|explode:"45,15,30,25"}] [{* top, right, bottom, left *}]
[{assign var="showLogo" value=$showLogo|default:true}]
[{capture append="pdfBlock_style"}]

View File

@ -61,6 +61,7 @@ $aModule = [
'd3invoice_pdf_informations.tpl'=> 'd3/pdfdocuments/Application/views/tpl/documents/invoice/inc/informations.tpl',
'd3invoice_pdf_salutation.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/invoice/inc/salutation.tpl',
'd3invoice_pdf_conclusion.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/invoice/inc/conclusion.tpl',
'd3invoice_pdf_payinfo.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/invoice/inc/payinfo.tpl',
'd3pdfbase.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/inc/page/base.tpl',
'd3pdfheader.tpl' => 'd3/pdfdocuments/Application/views/tpl/documents/inc/page/header.tpl',

View File

@ -189,13 +189,9 @@ table{
font-weight: bold;
}
.conclusion_table {
width: 100%;
border-spacing: 0;
border-collapse: collapse;
padding-top: 10mm
}
.conclusion_table td {
.conclusion_payment,
.conclusion_thankyou {
margin-top: 5mm;
font-size: 12px;
}