rhein: rechnungsmod

This commit is contained in:
Ulf Gebhardt 2014-05-28 00:54:54 +02:00
parent 3e048b47d8
commit 25bf7833e1
10 changed files with 137 additions and 4 deletions

View File

@ -15,4 +15,4 @@ $rhein_config = array( array(config_ids::SYS_CONFIG_ERRORREPORTING,
array(config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL, '../system/'),
array(config_ids::SYS_CONFIG_LANGS, array('deDE')),
array(config_ids::SYS_CONFIG_DEFAULT_LANG, 'deDE'),
array(config_ids::WEBCRAFT_BILLING_TOKEN, 'DANUBEdhasda3afdsjadfa3'));
array(config_ids::WEBCRAFT_BILLING_TOKEN, 'RHEINadasdbcahdscjhd213'));

View File

@ -1,5 +1,5 @@
<?php
//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_webcraft_billing_satelite','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_webcraft_billing_satelite','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_webcraft_gallery','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/saimod_webcraft_gallery/qq','DBD');
require_once dirname(__FILE__).'/register_modules.php';

View File

@ -1,3 +1,3 @@
<?php
\SYSTEM\SAI\sai::register('saimod_webcraft_gallery');
//\SYSTEM\SAI\sai::register('saimod_webcraft_billing_satelite');
\SYSTEM\SAI\sai::register('saimod_webcraft_billing_satelite');
\SYSTEM\SAI\sai::register('saimod_webcraft_gallery');

View File

@ -0,0 +1,3 @@
td.customer_details {
font-weight: bold;
}

View File

@ -0,0 +1,3 @@
function init_saimod_webcraft_billing_satelite() {
$('#billingtab a').click(function (e) {e.preventDefault(); $(this).tab('show');});
}

View File

@ -0,0 +1,43 @@
<?php
class saimod_webcraft_billing_satelite extends \SYSTEM\SAI\SaiModule {
public static function sai_mod_saimod_webcraft_billing_satelite(){
$token = \SYSTEM\CONFIG\config::get(config_ids::WEBCRAFT_BILLING_TOKEN);
$billing = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=billing&token='.$token),true);
$project = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=project&token='.$token),true);
$customer = json_decode(file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=customer&token='.$token),true);
$vars = array('content_project' => '');
if($project['status']){
foreach($project['result'] as $row){
$row['customer_company'] = $row['customer_company'] == "" ? $row['customer_company'] = "" : $row['customer_company'] .= " - ";
$vars['content_project'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite_content_project.tpl'), $row);}
}
$vars['content_billing'] = '';
if($billing['status']){
foreach($billing['result'] as $row){
$row['pdf_link'] = './sai.php?sai_mod=saimod_webcraft_billing_satelite&action=getpdf&billid='.$row['ID'];
$row['state'] = $row['payed_date'] == "0000-00-00 00:00:00" ? "important" : "success";
$vars['content_billing'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite_content_billing.tpl'), $row);}
}
if($customer['status']){
$vars = array_merge($vars,$customer['result']);}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.tpl'), $vars);}
public static function sai_mod_saimod_webcraft_billing_satelite_action_getpdf($billid){
$token = \SYSTEM\CONFIG\config::get(config_ids::WEBCRAFT_BILLING_TOKEN);
header("Content-type: application/pdf");
return file_get_contents('http://mojotrollz.eu/web/webcraft/api.php?call=billing&action=bill&token='.$token.'&ID='.$billid);}
public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_webcraft_billing_satelite">Rechnungen</a></li><li class="divider"></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function sai_mod_saimod_webcraft_billing_satelite_flag_js(){
return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.js')));}
public static function sai_mod_saimod_webcraft_billing_satelite_flag_css(){
return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new PSAI(),'saimod_webcraft_billing_satelite/saimod_webcraft_billing_satelite.css')));}
}

View File

@ -0,0 +1,66 @@
<h4>Verwaltung</h4>
<hr>
<div class="tabbable">
<ul class="nav nav-tabs" id="billingtab">
<li class="active"><a href="#tab_billing">Rechnungen</a></li>
<li><a href="#tab_project">Projekte</a></li>
<li><a href="#tab_customer">Kundeninformation</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_billing">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<th>Rechnungsnummer</th>
<th>Projekt</th>
<th>Datum</th>
<th>PDF</th>
<th>Betrag</th>
<th>Bezahlt am</th>
</tr>
${content_billing}
</table>
</div>
<div class="tab-pane" id="tab_project">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<th>ID</th>
<th>Nutzer</th>
<th>Firma</th>
<th>seit</th>
<th>URL</th>
<th>Serverpfad</th>
<th>token</th>
</tr>
${content_project}
</table>
</div>
<div class="tab-pane" id="tab_customer">
<table class="table table-hover table-condensed sai_table" style="overflow: auto;">
<tr>
<td class="customer_details">Nutzer ID</td>
<td>${ID}</td>
</tr>
<tr>
<td class="customer_details">Firma</td>
<td>${company}</td>
</tr>
<tr>
<td class="customer_details">Vorname</td>
<td>${name}</td>
</tr>
<tr>
<td class="customer_details">Nachname</td>
<td>${name_last}</td>
</tr>
<tr>
<td class="customer_details">Addresse</td>
<td>${address}</td>
</tr>
<tr>
<td class="customer_details">Beigetreten</td>
<td>${join}</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,8 @@
<tr>
<td>${ID}</td>
<td>${project_name}</td>
<td>${date}</td>
<td><a href="${pdf_link}" target="_blank">PDF</a></td>
<td>${balance} €</td>
<td><span class="badge badge-${state}">${payed_date}</span></td>
</tr>

View File

@ -0,0 +1,9 @@
<tr>
<td>${ID}</td>
<td>${customer_company}${customer_name} ${customer_name_last}</td>
<td>${name}</td>
<td>${date}</td>
<td><a href="${url}" target="_blank">${url}</a></td>
<td>${path}</td>
<td>${token}</td>
</tr>

View File

@ -0,0 +1 @@
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (100, 42, 2, 3, 'getpdf', 'billid', 'UINT');