Skip to content

Instantly share code, notes, and snippets.

@gosuto-inzasheru
Created April 29, 2013 19:37
Show Gist options
  • Save gosuto-inzasheru/5484127 to your computer and use it in GitHub Desktop.
Save gosuto-inzasheru/5484127 to your computer and use it in GitHub Desktop.
Custom invoice template which complies to all Dutch tax regulations (Belastingdienst). Both files are placed in wp-content/themes/<yourtheme>/woocommerce/print/.
<!DOCTYPE html>
<html lang="<?php echo WPLANG; ?>" class="<?php echo wcdn_get_template_type(); ?>">
<head>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php wcdn_stylesheet_url( 'style.css' ); ?>" type="text/css" media="screen,print" />
</head>
<body>
<div id="container">
<div id="content">
<div id="page">
<div class="postal">
<?php wcdn_shipping_address(); ?>
</div>
<div class="billing">
<?php
global $wcdn;
if ( ($wcdn->print->get_order()->get_formatted_billing_address()) !== ($wcdn->print->get_order()->get_formatted_shipping_address()) ) {
wcdn_billing_address();
}
?>
</div>
<div class="company">
<?php wcdn_company_info(); ?>
</div>
<div id="title"><h1><?php _e( 'Invoice', 'eb-webshop' ); ?></h1></div>
<p><span class="itemtitle"><?php _e( 'Order Number:', 'eb-webshop' ); ?></span> <?php wcdn_order_number(); ?><br>
<span class="itemtitle"><?php _e( 'Billing Number:', 'eb-webshop' );?></span> W<?php echo date('Y'); echo date('m'); echo date('d'); wcdn_order_number();?><br>
<span class="itemtitle"><?php _e( 'Billing Date:', 'eb-webshop' ); ?></span> <?php echo date(get_option('date_format')); /* wcdn_order_date(); */ ?></p>
<div id="order-items">
<table>
<thead>
<tr>
<th class="product-label"><?php _e('Product', 'eb-webshop'); ?></th>
<th class="single-price-label"><?php _e('Price Each', 'eb-webshop'); ?></th>
<?php
/*support for displaying the tax class per item if several classes are used simultaniously
<th class="taxclass-label"><?php _e('Tax Class', 'eb-webshop'); ?></th>*/
?>
<th class="quantity-label"><?php _e('Quantity', 'eb-webshop'); ?></th>
<th class="totals-label"><?php _e('Totals', 'eb-webshop'); ?></th>
</tr>
</thead>
<tbody>
<?php $items = wcdn_get_order_items(); if( sizeof( $items ) > 0 ) : foreach( $items as $item ) : ?><tr>
<td class="description">
<?php
echo $item['name'];
$variations = $item['item']['item_meta'];
/*
if( sizeof( $variations ) > 0 ) : foreach( $variations as $variation ) :
echo "<br><span class=\"variation\">";
echo $variation['meta_name'].": ";
echo $variation['meta_value'];
echo "</span>";
endforeach; endif;
*/
?>
</td>
<td class="single-price">
<?php
//currency and tax rate are still hard coded
echo "&euro;".round( $item['single_price']/1.21, 2 );
?></td>
<?php
/*support for displaying the tax class per item if several classes are used simultaniously
<td class="tax-class"><?php echo $item['item']['tax_class']; ?></td>*/
?>
<td class="quantity"><?php echo $item['quantity']; ?></td>
<td class="price"><?php echo $item['price']; ?></td>
</tr><?php endforeach; endif; ?>
</tbody>
</table>
</div><!-- #order-items -->
<div id="order-summary">
<table>
<tfoot>
<?php foreach( wcdn_get_order_totals() as $total ) : ?>
<tr>
<th class="description"><?php echo $total['label']; ?></th>
<td class="price"><?php echo $total['value']; ?></td>
</tr>
<?php endforeach; ?>
</tfoot>
</table>
</div><!-- #order-summery -->
<div id="order-notes">
<div class="notes-shipping">
<?php if ( wcdn_get_shipping_notes() ) : ?>
<h3><?php _e( 'Customer Notes', 'eb-webshop' ); ?></h3>
<?php wcdn_shipping_notes(); ?>
<?php endif; ?>
</div>
<div class="notes-personal"><?php wcdn_personal_notes(); ?></div>
</div><!-- #order-notes -->
<?php if ( wcdn_get_policies_conditions() || wcdn_get_footer_imprint() ) : ?>
<div id="letter-footer">
<div class="policies"><?php wcdn_policies_conditions(); ?></div>
<div class="imprint"><?php wcdn_footer_imprint(); ?></div>
</div><!-- #letter-footer -->
<?php endif; ?>
</div><!-- #page -->
</div><!-- #content -->
</div><!-- #container -->
</body>
</html>
body {
font-family: Courier;
font-size: 11pt;
}
#page {
margin-left: auto;
margin-right: auto;
padding-top: 5%;
padding-bottom: 5%;
padding-left: 10%;
padding-right: 10%;
text-align: left;
page-break-after: always;
}
#imprint {
position: relative;
bottom: 0px;
}
h1 {
font-family: 'Poiret One';
color: #CC3300;
text-align: center;
text-transform: uppercase;
font-size: 40px;
margin-bottom: 20px;
margin-top: 20px;
}
p {
margin-bottom: 10px;
}
.postal {
margin-bottom: 50px;
}
.company {
text-align: right;
}
.itemtitle {
font-weight: bold;
text-transform: lowercase;
font-family: 'Poiret One';
color: #CC3300;
}
.footpart {
float: left;
width: 33%;
}
.variation {
font-size: 8pt;
}
small {
display: none;
}
table {
width: 100%;
page-break-inside: auto;
border: 1px solid black;
padding: 5px;
}
thead {
text-transform: uppercase;
font-family: 'Poiret One';
color: #CC3300;
}
tfoot {
text-align: right;
}
tr {
page-break-inside: avoid;
page-break-after: auto;
}
td {
padding: 5px;
}
.quantity, .quantity-label {
text-align: center;
}
.price, .totals-label {
text-align: right;
width: 1px;
padding-left: 30px;
}
.single-price, .single-price-label {
text-align: center;
}
th.description {
font-family: 'Poiret One';
color: #CC3300;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment