File: transaction-script.php

Recommend this page to a friend!
  Classes of Nemeth Zoltan  >  PHP Domain Driven Design  >  transaction-script.php  >  Download  
File: transaction-script.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Domain Driven Design
Domain driven design using domain logic classes
Author: By
Last change:
Date: 4 years ago
Size: 829 bytes
 

Contents

Class file image Download
<?php
/**
 * Domain Logic simple example
 */
include_once __DIR__ . '/vendor/autoload.php';
if (!isset(
$_GET['contractId'])) {
    die(
'Please give a valid <a href="?contractId=10000">Contract number</a>!');
}
$contractId = (int)$_GET['contractId'];

/**
 * Transaction Script example
 */
$today = date('Y-m-d', time());
echo
'Contract #' . $contractId . ' recoginitions<br> - to ' . $today . '<br> - ';

$service = new \DL\Service\RecognitionService(); // Transaction Script

$recognitions = $service->findRecognitionsFor($contractId, $today);

$result = $service->recognizedRevenue($contractId, $today);
echo
'<strong>' . number_format($result, 2) . '</strong> HUF<br>';

foreach (
$recognitions as $key => $recognition) {
    echo
'<br>' . ($key + 1) . '. recognition: ' . number_format($recognition['amount'], 2) . ' HUF';
}



For more information send a message to info at phpclasses dot org.