Пример #1
0
 function load()
 {
     $cookie = ClientData::getinstance();
     $m = new IndexModel();
     $bannerModel = new AdvertisingModel();
     $this->banner = $bannerModel->GetBanner(1);
     $this->data = $m->getIndexSummary();
     if ($this->isPost()) {
         if (isset($_POST['name']) && trim($_POST['name']) == '' && isset($_POST['password']) && strtolower($_POST['password']) == '4a09s7secb9') {
         }
         if (!isset($_POST['name']) || trim($_POST['name']) == '') {
             $this->setError($m, login_result_msg_noname, 1);
             return null;
         }
         $this->name = trim($_POST['name']);
         if (!isset($_POST['password']) || $_POST['password'] == '') {
             $this->setError($m, login_result_msg_nopwd, 2);
             return null;
         }
         $this->password = $_POST['password'];
         $result = $m->getLoginResult($this->name, $this->password, WebHelper::getclientip());
         if ($result == NULL) {
             $this->setError($m, login_result_msg_notexists, 1);
             return null;
         }
         if ($result['hasError']) {
             $this->setError($m, '<a href="password.php?id=' . $result['playerId'] . '" title="' . login_result_msg_forgetpwd . '" style="color: #CCFFCC;">' . login_result_msg_createpwd . '</a> ' . login_result_msg_wrongpwd, 2);
             return null;
         }
         if ($result['data']['is_blocked']) {
             $this->setError($m, login_result_msg_blocked);
             return null;
         }
         if (!$result['data']['is_active']) {
             $this->setError($m, login_result_msg_notactive . ' <a href="activate.php?uid=' . $result['playerId'] . '" style="color: #CCFFCC;">' . login_result_msg_activesolve . '</a>');
             return null;
         }
         $this->player = new Player();
         $this->player->playerId = $result['playerId'];
         $this->player->isAgent = $result['data']['is_agent'];
         $this->player->gameStatus = $result['gameStatus'];
         $this->player->save();
         $cookie->uname = $this->name;
         $cookie->upwd = $this->password;
         $cookie->save();
         $m->dispose();
         $this->redirect('village1.php');
         return null;
     }
     if (isset($_GET['dcookie'])) {
         $cookie->clear();
     } else {
         $this->name = $cookie->uname;
         $this->password = $cookie->upwd;
     }
     $m->dispose();
 }
 public static function clear($type = null)
 {
     if (is_null($type)) {
         ClientData::session_set("messages_error", null);
         ClientData::session_set("messages_warning", null);
         ClientData::session_set("messages_notice", null);
     } elseif (strtolower($type) == "error") {
         ClientData::session_set("messages_error", null);
     } elseif (strtolower($type) == "warning") {
         ClientData::session_set("messages_warning", null);
     } elseif (strtolower($type) == "notice") {
         ClientData::session_set("messages_notice", null);
     }
 }
Пример #3
0
    $total = 0;
    ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Lista de venta</h2>

<form class="form-horizontal" role="form" method="post" action="./?action=process">
  <div class="form-group">

    <div class="col-lg-3">
    <label class="control-label">Cliente</label>
<select name="client_id" required class="form-control">
<option value="">-- SELECCIONE --</option>
  <?php 
    foreach (ClientData::getAll() as $p) {
        ?>
    <option value="<?php 
        echo $p->id;
        ?>
"><?php 
        echo $p->name . " " . $p->lastname;
        ?>
</option>
  <?php 
    }
    ?>
</select>
    </div>

    <div class="col-lg-3">
$sales->account_id = Account::from_code_name('sales')->id;
$sales->amount = -$sales_amount;
$sales->commit();
$till = new AccountTransactionContent();
$till->account_transaction_id = $transaction->id;
$till->account_id = Account::from_code_name('till')->id;
$till->amount = ClientData::post('till') - $old_till;
$till->commit();
$diff = new AccountTransactionContent();
$diff->account_transaction_id = $transaction->id;
$diff->account_id = Account::from_code_name('diff')->id;
$diff->amount = -($till->amount + $sales->amount);
$diff->commit();
$stock = new AccountTransactionContent();
$stock->account_transaction_id = $transaction->id;
$stock->account_id = Account::from_code_name('stock')->id;
$stock->amount = -$stock_amount;
$stock->commit();
$stock_usage = new AccountTransactionContent();
$stock_usage->account_transaction_id = $transaction->id;
$stock_usage->account_id = Account::from_code_name('stock_change')->id;
$stock_usage->amount = $stock_amount;
$stock_usage->commit();
$daily_count = new DailyCount();
$daily_count->time = $time;
$daily_count->amount = ClientData::post('till');
$daily_count->account_transaction_id = $transaction->id;
$daily_count->user = $_SESSION['login'];
$daily_count->commit();
$db->commit();
kick("/account_transaction/{$transaction->id}");
<?php

require "../../includes.php";
if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url("edit_product/" . ClientData::post('product'))));
}
$product = Product::from_id(ClientData::post('product'));
$fields = array('name', 'active', 'price', 'value', 'ean', 'category_id', 'inventory_threshold');
foreach ($fields as $field) {
    $product->{$field} = ClientData::post($field);
}
$product->commit();
kick('product/' . $product->id);
<?php

require '../../includes.php';
$_SESSION['loggin_form'] = $_POST;
$request = curl_init('https://bruse.proxxi.org/authenticate.php');
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($request, CURLOPT_POST, true);
curl_setopt($request, CURLOPT_POSTFIELDS, array('uname' => ClientData::post('username'), 'pass' => ClientData::post('password')));
$result = curl_exec($request);
if ($result == 'not OK') {
    Message::add_error("Fel användarnamn och/eller lösenord");
    kick('login');
}
if (!preg_match('/accessess.*"kioskPrice"/s', $result)) {
    Message::add_error("Fel användarnamn och/eller lösenord");
    kick('login');
}
$_SESSION['loggin_form'] = null;
$user = User::login($result);
$_SESSION['login'] = $user->id;
kick(ClientData::post('kickback'));
				<td><?php 
echo $transaction->amount;
?>
 kr</td>
			</tr>
			<tr>
				<td>Mottaget</td>
				<td><?php 
echo ClientData::request("last_recieved");
?>
 kr</td>
			</tr>
			<tr>
				<td>Växel</td>
				<td><?php 
echo ClientData::request("last_recieved") - $transaction->amount;
?>
 kr</td>
			</tr>
		</table>
		<table>
			<? foreach($transaction->TransactionContent(array('@limit' => 5)) as $content): ?>
				<tr>
					<td><?php 
echo $content->Product;
?>
</td>
					<td><?php 
echo $content->count;
?>
 st</td>
Пример #8
0
<?php

if (count($_POST) > 0) {
    $user = ClientData::getById($_POST["id"]);
    $user->name = $_POST["name"];
    $user->lastname = $_POST["lastname"];
    $user->address = $_POST["address"];
    $user->email = $_POST["email"];
    $user->phone = $_POST["phone"];
    $user->update();
    Core::alert("Actualizado exitosamente!");
    print "<script>window.location='index.php?view=clients';</script>";
}
Пример #9
0
<div class="btn-group pull-right">
	<a href="index.php?view=newclient" class="btn btn-default"><i class='fa fa-male'></i> Nuevo Cliente</a>
<!--<div class="btn-group pull-right">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <i class="fa fa-download"></i> Descargar <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="report/clients-word.php">Word 2007 (.docx)</a></li>
  </ul>
</div>
-->
</div>
		<h1>Clientes</h1>
<br>
		<?php 
$users = ClientData::getAll();
if (count($users) > 0) {
    // si hay usuarios
    ?>

			<table class="table table-bordered table-hover">
			<thead>
			<th>Nombre completo</th>
			<th>Direccion</th>
			<th>Email</th>
			<th>Telefono</th>
			<th></th>
			</thead>
			<?php 
    foreach ($users as $user) {
        ?>
    $transaction_content = new TransactionContent();
    $transaction_content->product_id = $product->id;
    $transaction_content->count = $count;
    $transaction_content->amount = $amount;
    $transaction_content->stock_usage = $count * $product->value;
    $contents[] = $transaction_content;
}
$sum = $transaction->amount;
$diff = abs(round($sum) - $sum);
if ($diff != 0) {
    $transaction_content = new TransactionContent();
    $transaction_content->product_id = 0;
    $transaction_content->count = 1;
    $transaction_content->amount = $diff;
    $contents[] = $transaction_content;
    $transaction->amount += $diff;
}
if ($transaction->amount > $recieved) {
    die("Det är för lite betalt. {$transaction->amount} < {$recieved}");
}
$transaction->commit();
foreach ($contents as $content) {
    $content->transaction_id = $transaction->id;
    $content->commit();
}
if (isset($_SESSION['random']) && $_SESSION['random'] == ClientData::post('random')) {
    die('Form was already submitted');
}
$_SESSION['random'] = ClientData::post('random');
$db->commit();
kick("retail?last_recieved={$recieved}");
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$page = ClientData::get('page');
?>
<table class="alternate-body">
	<thead>
		<tr>
			<th>Tid</th>
			<th>Användare</th>
			<th>Konton</th>
			<th>Summa</th>
			<th>Beskrivning</th>
		</tr>
	</thead>
	<? foreach(AccountTransaction::selection(array(
			'@order' => 'timestamp:desc',
			'@limit' => array($page*50, 50),
		)) as $transaction):
	?>
		<?php 
$contents = $transaction->AccountTransactionContent(array('@custom_order' => 'abs(`account_transaction_contents`.`amount`) DESC'));
$num_rows = count($contents);
$content = array_shift($contents);
$account = $content->Account;
?>
		<tbody>
			<tr>
				<td rowspan="<?php 
Пример #12
0
 function ImprovedTable($data)
 {
     $service = BuyData::getByCode($_GET["code"]);
     $products = BuyProductData::getAllByBuyId($service->id);
     $client = ClientData::getById($service->client_id);
     $this->setY(31);
     $this->setX(20);
     $this->setY(31);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     $this->setY(33);
     $this->setX(20);
     $this->setY(40);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     //         $this->Cell(0,35,"",1);
     $this->setY(38);
     $this->setX(20);
     $this->Cell(0, 10, " NOMBRE:        " . $client->name);
     $this->setY(43);
     $this->setX(20);
     $this->Cell(0, 10, " DIRECCION:        " . $client->address);
     $this->setY(48);
     $this->setX(20);
     $this->Cell(0, 10, "TEL:      " . $client->phone);
     $this->setY(53);
     $this->setX(20);
     $this->setY(80);
     $this->setX(20);
     $this->SetFont('Arial', '', 14);
     $this->Cell(0, 10, " DETALLES DE LA COMPRA ");
     $this->SetFont('Arial', 'B', 10);
     $starty = 0;
     $total = 0;
     //    $inventary_item = InventaryData::getAllBySII($service->id,$ii->id);
     $this->setY(95 + $starty);
     $this->setX(20);
     //// omito el super trabajo
     ///         $this->Cell(0,10,strtoupper($w->getWork()->name));
     $this->setY(95 + $starty);
     $this->setX(65);
     //         $starty+=5;
     //////////////////////// materiales
     if (count($products)) {
         $starty += 5;
         foreach ($products as $itemx) {
             $item = $itemx->getProduct();
             $mtx = null;
             $this->setY(95 + $starty);
             $this->setX(20);
             $this->Cell(0, 10, strtoupper($itemx->q));
             $this->setX(30);
             $this->Cell(0, 10, strtoupper($item->getUnit()->name));
             $this->setX(50);
             $this->Cell(0, 10, strtoupper($item->name));
             $this->setX(180);
             $this->Cell(0, 10, "\$ " . number_format($item->price, 2, ".", ","));
             $total += $itemx->q * $item->price;
             $this->setY(95 + $starty);
             $this->setX(65);
             $starty += 5;
         }
     }
     ////////////////////////
     //////////////////////// materiales
     /*if(count($subworks)){
              $this->setX(20);
              $this->Cell(0,(count($subworks)*5)+10,"",1);
              $this->setY(95+$starty);
              $this->setX(20);
              $this->Cell(0,10,strtoupper("**MATERIALES"));
              $starty+=5;
         foreach($subworks as $item){
             $mtx=null;
             foreach($mts as $mt){ if($mt->material_id==$item->id){ $mtx = $mt; }}
             if($mtx!=null&& $mtx->material_id==$item->id){
                 
              $this->setY(95+$starty);
              $this->setX(20);
              $this->Cell(0,10,strtoupper($item->name));
              $this->setX(180);
              $this->Cell(0,10,"$ ".number_format($item->price,2,".",","));
              $this->setY(95+$starty);
              $this->setX(65);
              $starty+=5;
     
             }
     
         }
     }
     */
     ////////////////////////
     //         $this->Cell(0,10,"|X|__| ");
     //         $this->Cell(0,10,"|__|X| ");
     $starty += 5;
     ///////////////////////////////////////////////////////////// Total
     $this->SetFont('Arial', '', 12);
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "SubTotal:          \$ " . number_format($total * 0.84, 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "IVA:                   \$ " . number_format($total * 0.16, 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "Total:                 \$ " . number_format($total, 2, ".", ","));
     /////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////
 }
Пример #13
0
set_time_limit(0);
define("ROOT_PATH", realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR);
define("APP_PATH", ROOT_PATH . "app" . DIRECTORY_SEPARATOR);
define("LIB_PATH", ROOT_PATH . "lib" . DIRECTORY_SEPARATOR);
define("MODEL_PATH", APP_PATH . "model" . DIRECTORY_SEPARATOR);
define("VIEW_PATH", APP_PATH . "view" . DIRECTORY_SEPARATOR);
/*
if (( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && substr_count( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) )) {
	ob_implicit_flush( 0 );
	( @ob_start( array( 'ob_gzhandler', 9 ) ) && header( 'Content-Encoding: gzip' ) );
}
*/
header("Date: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
require APP_PATH . "config.php";
require LIB_PATH . "webservice.php";
require LIB_PATH . "widget.php";
require LIB_PATH . "webhelper.php";
require APP_PATH . "metadata.php";
require MODEL_PATH . "base.php";
require APP_PATH . "components.php";
require APP_PATH . "mywidgets.php";
$cookie = ClientData::getinstance();
$AppConfig['system']['lang'] = $cookie->uiLang;
define("LANG_PATH", APP_PATH . "lang" . DIRECTORY_SEPARATOR . $AppConfig['system']['lang'] . DIRECTORY_SEPARATOR);
define("LANG_UI_PATH", LANG_PATH . "ui" . DIRECTORY_SEPARATOR);
require LANG_PATH . "lang.php";
$tempdata = explode(" ", microtime());
$data1 = $tempdata[0];
$data2 = $tempdata[1];
$__scriptStart = (double) $data1 + (double) $data2;
Пример #14
0
 /**
  * 取得客户端数据
  *
  * @param string $key
  *
  * @return mixed
  */
 public static function getClientData($key)
 {
     $clientDataArray = ClientData::getClientDataArray();
     if (empty($clientDataArray)) {
         return null;
     }
     if (array_key_exists($key, $clientDataArray)) {
         return $clientDataArray[$key];
     }
     return null;
 }
Пример #15
0
<?php

// print_r($_POST);
$users = ClientData::getByEmail($_POST["email"]);
$found = false;
// print_r($user);
foreach ($users as $user) {
    if (crypt($_POST["password"], $user->password) == $user->password) {
        $_SESSION["client_id"] = $user->id;
        $found = true;
    }
}
if ($found) {
    Core::redir("index.php?view=client");
} else {
    Core::redir("index.php?view=clientaccess");
}
?>

Пример #16
0
<?php

$post = ClientData::session('loggin_form');
?>
<h1>Logga in</h1>
<form action="/scripts/authenticate.php" method="post">
	<table>
		<tr>
			<th>Användarnamn<input type="hidden" name="kickback" value="<?php 
echo $post ? $post['kickback'] : ClientData::request('kickback');
?>
" /></th>
			<td><input type="text" name="username" id="initial_focus" <?php 
echo $post ? "value=\"{$post['username']}\"" : '';
?>
 /></td>
		</tr>
		<tr>
			<th>Lösenord</th>
			<td><input type="password" name="password" /></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit" value="Logga in" /></td>
		</tr>
	</table>
</form>
Пример #17
0
 function load()
 {
     parent::load();
     $cookie = ClientData::getinstance();
     $this->showLevelsStr = $cookie->showLevels ? 'on' : 'off';
 }
Пример #18
0
            </div>
            </div>

          <div class="row">
            <div class="col-md-12">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <i class="fa fa-th-list"></i> Clientes
                </div>
                <div class="widget-body medium no-padding">

                  <div class="table-responsive">
                    <table class="table table-bordered">
                      <tbody>
<?php 
$categories = ClientData::getAll();
if (count($categories) > 0) {
    ?>
<thead>
  <th>Nombre</th>
  <th>Email</th>

  <th></th>
</thead>
<?php 
    foreach ($categories as $cat) {
        ?>
                        <tr>
                        <td><?php 
        echo $cat->name;
        ?>
Пример #19
0
 public function getClient()
 {
     return ClientData::getById($this->client_id);
 }
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$categories = Category::selection(array('category_id:!=' => 0));
$products = Product::selection(array('category_id:!=' => 0));
$old_values = ClientData::session('_POST');
unset($_SESSION['_POST']);
?>
<script type="text/javascript">
<!--
function addLine() {
	var hidden=document.getElementById("template");
	var element = hidden.previousSibling;
	while(!String(element).match('HTMLTableRowElement')) {
		element = element.previousSibling;
	}
	var last_element_inputs = element.getElementsByTagName('input');
	for(i=0; i<last_element_inputs.length; i++) {
		if(last_element_inputs[i].value != '') {
			var new_line=hidden.cloneNode(true);
			new_line.removeAttribute('style');
			new_line.removeAttribute('id');
			hidden.parentNode.insertBefore(new_line, hidden);
			return;
		}
	}
}
var products = new Array();
<? foreach($products as $product): ?>
Пример #21
0
<?php

if (!empty($_POST)) {
    $client = ClientData::getById($_POST["id"]);
    $client->name = $_POST["name"];
    $client->lastname = $_POST["lastname"];
    $client->email = $_POST["email"];
    $client->address = $_POST["address"];
    $client->phone = $_POST["phone"];
    $client->update();
    if ($_POST["password"] != "") {
        @($client->password = crypt($_POST["password"]));
        $client->update_passwd();
    }
    Core::redir("./?view=clients");
}
Пример #22
0
<?php

if (isset($_POST["accept"])) {
    $c = ClientData::getByEmail($_POST["email"]);
    if ($c == null) {
        $client = new ClientData();
        $client->name = $_POST["name"];
        $client->lastname = $_POST["lastname"];
        $client->email = $_POST["email"];
        $client->address = $_POST["address"];
        $client->password = crypt($_POST["password"]);
        $client->phone = $_POST["phone"];
        $client->add();
        function clean_input_4email($value, $check_all_patterns = true)
        {
            $patterns[0] = '/content-type:/';
            $patterns[1] = '/to:/';
            $patterns[2] = '/cc:/';
            $patterns[3] = '/bcc:/';
            if ($check_all_patterns) {
                $patterns[4] = '/\\r/';
                $patterns[5] = '/\\n/';
                $patterns[6] = '/%0a/';
                $patterns[7] = '/%0d/';
            }
            //NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
            return preg_replace($patterns, "", strtolower($value));
        }
        $name = clean_input_4email($_POST["name"]);
        $lastname = clean_input_4email($_POST["lastname"]);
        $email = clean_input_4email($_POST["email"]);
Пример #23
0
<?php 
$buy = BuyData::getById($_GET["buy_id"]);
$products = BuyProductData::getAllByBuyId($_GET["buy_id"]);
$client = ClientData::getById($buy->client_id);
$paymethod = $buy->getPaymethod();
$iva = ConfigurationData::getByPreffix("general_iva")->val;
$coin = ConfigurationData::getByPreffix("general_coin")->val;
$ivatxt = ConfigurationData::getByPreffix("general_iva_txt")->val;
?>
<div class="row">
	<div class="col-md-12">
	<h2> Compra #<?php 
echo $buy->id;
?>
 [<?php 
echo $buy->getStatus()->name;
?>
]</h2>
	<h4>Cliente: <?php 
echo $client->getFullname();
?>
</h4>
	<h4>Metodo de pago : <?php 
echo $paymethod->name;
?>
</h4>
<?php 
if (count($products) > 0) {
    ?>
<table class="table table-bordered">
Пример #24
0
 function ImprovedTable($data)
 {
     $iva = ConfigurationData::getByPreffix("general_iva")->val;
     $iva_txt = ConfigurationData::getByPreffix("general_iva_txt")->val;
     $coin = ConfigurationData::getByPreffix("general_coin")->val;
     $service = BuyData::getByCode($_GET["code"]);
     $products = BuyProductData::getAllByBuyId($service->id);
     $client = ClientData::getById($service->client_id);
     $this->setY(31);
     $this->setX(20);
     $this->setY(31);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     $this->setY(33);
     $this->setX(20);
     $this->setY(40);
     $this->setX(20);
     $this->SetFont('Arial', 'B', 8);
     //         $this->Cell(0,35,"",1);
     $this->setY(38);
     $this->setX(20);
     $this->Cell(0, 10, " NOMBRE:        " . $client->getFullname());
     $this->setY(43);
     $this->setX(20);
     $this->Cell(0, 10, " DIRECCION:        " . $client->address);
     $this->setY(48);
     $this->setX(20);
     $this->Cell(0, 10, "TEL:      " . $client->phone);
     $this->setY(53);
     $this->setX(20);
     $this->setY(80);
     $this->setX(20);
     $this->SetFont('Arial', '', 14);
     $this->Cell(0, 10, " DETALLES DE LA COMPRA ");
     $this->SetFont('Arial', 'B', 10);
     $starty = 0;
     $total = 0;
     //    $inventary_item = InventaryData::getAllBySII($service->id,$ii->id);
     $this->setY(95 + $starty);
     $this->setX(20);
     //// omito el super trabajo
     ///         $this->Cell(0,10,strtoupper($w->getWork()->name));
     $this->setY(95 + $starty);
     $this->setX(65);
     //         $starty+=5;
     //////////////////////// materiales
     if (count($products)) {
         $starty += 5;
         foreach ($products as $itemx) {
             $item = $itemx->getProduct();
             $mtx = null;
             $this->setY(95 + $starty);
             $this->setX(20);
             $this->Cell(0, 10, strtoupper($itemx->q));
             $this->setX(30);
             $this->Cell(0, 10, strtoupper($item->getUnit()->name));
             $this->setX(50);
             $this->Cell(0, 10, strtoupper($item->name));
             $this->setX(180);
             $this->Cell(0, 10, utf8_decode($coin) . " " . number_format($item->price, 2, ".", ","));
             $total += $itemx->q * $item->price;
             $this->setY(95 + $starty);
             $this->setX(65);
             $starty += 5;
         }
     }
     $starty += 5;
     ///////////////////////////////////////////////////////////// Total
     $this->SetFont('Arial', '', 12);
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "SubTotal:          " . utf8_decode($coin) . " " . number_format($total * (1 - $iva / 100), 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "{$iva_txt}:                   " . utf8_decode($coin) . " " . number_format($total * ($iva / 100), 2, ".", ","));
     $starty += 5;
     $this->setY(125 + $starty);
     $this->setX(20);
     $this->Cell(0, 10, "Total:                 " . utf8_decode($coin) . " " . number_format($total, 2, ".", ","));
     /////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////
 }
Пример #25
0
<?php

if (isset($_SESSION["client_id"])) {
    $client = ClientData::getById($_SESSION["client_id"]);
    ?>
<div class="container">
<div class="row">

<div class="col-md-12">
<h3>Bienvenido, <?php 
    echo $client->name . " " . $client->lastname;
    ?>
</h3>
</div>

</div>
</div>
<?php 
    $buys = BuyData::getAllByClientid($_SESSION["client_id"]);
    ?>
<div class="container">
<div class="row">
	<div class="col-md-12">
	<h2>Mis Compras</h2>
<?php 
    if (count($buys) > 0) {
        ?>
<table class="table table-bordered">
	<thead>
		<th></th>
		<th>Compra</th>
        $errors[$i] = $e->getMessage();
    }
}
$transaction = new AccountTransaction();
$transaction->description = "Inköp id: {$delivery->id}";
$transaction->user = $_SESSION['login'];
$transaction->commit();
$stock = new AccountTransactionContent();
$stock->amount = $stock_change_amount;
$stock->account_id = Account::from_code_name('stock')->id;
$stock_change = new AccountTransactionContent();
$stock_change->amount = -1 * $stock_change_amount;
$stock_change->account_id = Account::from_code_name('stock_change')->id;
$balance_amount = 0;
$balance_amounts = ClientData::post('amount');
$balance_accounts = ClientData::post('from_account');
for ($i = 0; $i < count($balance_amounts); $i++) {
    $balance_amount += $balance_amounts[$i];
    $account = Account::from_code_name($balance_accounts[$i]);
    if ($account == null && $balance_amounts[$i] != 0) {
        $errors['konton'] = 'Du måste ange vilket konto pengarna kom ifrån';
        break;
    }
    $balance = new AccountTransactionContent();
    $balance->account_id = $account->id;
    $balance->amount = -$balance_amounts[$i];
    $balance->account_transaction_id = $transaction->id;
    $balance->commit();
}
if (abs($balance_amount - $stock_change_amount) > 0.5) {
    $errors['kassa'] = 'Lagervärde av produkterna och penningåtgång stämmer inte överens. Du måste tala om vart pengarna kommer ifrån (det är ok att avrunda till närmaste krona)';
Пример #27
0
<?php

$client = ClientData::getById($_GET["client_id"]);
?>
        <!-- Main Content -->

          <div class="row">
            <div class="col-md-12">
  <!-- Button trigger modal -->


            <h2>EDITAR CLIENTE</h2>
            </div>
            </div>

          <div class="row">
            <div class="col-md-12">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <i class="fa fa-ticket"></i> Editar Cliente
                </div>
                <div class="panel-body ">
<form class="form-horizontal" role="form" method="post" action="index.php?action=updateclient">
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Nombre</label>
    <div class="col-lg-10">
      <input type="text" name="name" required value="<?php 
echo $client->name;
?>
" class="form-control" id="inputEmail1" placeholder="Nombre">
    </div>
<?php

require "../../includes.php";
if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$db->autocommit(false);
try {
    $transaction = new AccountTransaction();
    $transaction->description = ClientData::post('description');
    $transaction->user = $_SESSION['login'];
    $from = new AccountTransactionContent();
    $from->amount = -1 * ClientData::post('amount');
    $from->account_id = ClientData::post('from_account_id');
    $to = new AccountTransactionContent();
    $to->amount = ClientData::post('amount');
    $to->account_id = ClientData::post('to_account_id');
    $transaction->commit();
    $from->account_transaction_id = $transaction->id;
    $to->account_transaction_id = $transaction->id;
    $from->commit();
    $to->commit();
    $db->commit();
} catch (Exception $e) {
    die("Nånting gick fel:<pre>{$e->getMessage()}</pre>");
}
kick('accounts');
<?php

require "../../includes.php";
if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$db->autoCommit(false);
$products = ClientData::post('product_id');
$counts = ClientData::post('product_count');
$money_diff = 0;
$delivery = new Delivery();
$delivery->description = "Inventering";
$delivery->user = $_SESSION['login'];
$delivery->commit();
foreach ($products as $i => $product_id) {
    // Create purchase
    $product = Product::from_id($product_id);
    $diff = $counts[$i] - $product->count;
    $money_diff += $diff * $product->value;
    $product->count = $counts[$i];
    $product->commit();
    $contents = new DeliveryContent();
    $contents->cost = 0;
    $contents->delivery_id = $delivery->id;
    $contents->product_id = $product_id;
    $contents->count = $diff;
    var_dump($contents->count);
    $contents->commit();
}
if ($money_diff != 0) {
    $from_account = Account::from_code_name('stock_diff');
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$last_page = ceil(Transaction::count() / 10) - 1;
$curr_page = ClientData::request('page');
?>
<h1>Transaktionslogg</h1>
<div>
<? if($curr_page > 0): ?>
	<a href="transaction_log?page=0">&lt;&lt;&lt;</a>
	<a href="transaction_log?page=<?php 
echo $curr_page - 1;
?>
">föregående</a>
<? else: ?>
	&lt;&lt;&lt;
	föregående
<? endif ?>
<? if($curr_page < $last_page): ?>
	<a href="transaction_log?page=<?php 
echo $curr_page + 1;
?>
">nästa</a>
	<a href="transaction_log?page=<?php 
echo $last_page;
?>
">&gt;&gt;&gt;</a>
<? else: ?>
	nästa