Ejemplo n.º 1
0
 function createBill()
 {
     $bill = new Bill();
     $customer = new Customer();
     $tour = new Tour();
     $bill_product = new Bill_Product();
     $customer_data = $customer->get($this->customer_id);
     if (count($customer_data) == 0) {
         echo "<div class=\"error\">Fehler in Session, bitte neu anmelden</div><br>\n";
         return -1;
     }
     $tour_data = $tour->getByAssistant($customer_data[0][12]);
     $bill_id = $bill->create("", array($this->customer_id, $customer_data[0][12], "", $tour_data[0][2], -2, time()));
     $list = $this->getItems();
     for ($i = 0; $i < count($list); $i++) {
         if ($list[$i][2] > 0) {
             $bill_product->create(array($bill_id, $list[$i][0], $list[$i][2], $list[$i][5], "", 0, 0, time()));
         }
     }
     return 0;
 }
Ejemplo n.º 2
0
<?php

include "DataBase/database.php";
include "DataBase/Bill.php";
include "DataBase/Bill_Product.php";
$bill = new Bill();
$bill_product = new Bill_Product();
$folder = "mysql_export/";
if ($bill->export($folder . "bill.csv")) {
    echo "rechnung export erfolgreich<br>";
} else {
    echo "rechnung export schlug fehl<br>";
}
if ($bill_product->export($folder . "bill_product.csv")) {
    echo "bill_product export erfolgreich<br>";
} else {
    echo "bill_product export schlug fehl<br>";
}
?>

<br>
Synchronisation abgeschlossen
Ejemplo n.º 3
0
<?php

require_once "DataBase_Net/Bill_Net.php";
require_once "DataBase_Net/Bill_Product_Net.php";
require_once "DataBase/Bill.php";
require_once "DataBase/Bill_Product.php";
// sync Bill database
$bill = new Bill();
$bill_net = new Bill_Net();
$bill_product = new Bill_Product();
$bill_product_net = new Bill_Product_Net();
$new_bills_count = 0;
$new_position_count = 0;
// fetch all remote bills
$remote_bills = $bill_net->getPlainBills();
foreach ($remote_bills as $tmp) {
    $new_bill_id = $bill->create("", array_slice($tmp, 1));
    $new_bills_count++;
    // check for bill_products
    $remote_bill_products = $bill_product_net->getByBillId($tmp[0]);
    foreach ($remote_bill_products as $tmp1) {
        $tmp1[1] = $new_bill_id;
        $bill_product->create(array_slice($tmp1, 1));
        $new_position_count++;
    }
}
$main_box->add(new NTKLabel("", "neue Rechnungen: " . $new_bills_count), 200, 0, "background-color: #dfe7f3;");
$main_box->add(new NTKLabel("", "neue Positionen: " . $new_position_count), 200, 0, "background-color: #dfe7f3;");
// now we should have added all bills let's delete them remote
$bill_net->clearTable();
$bill_product_net->clearTable();
Ejemplo n.º 4
0
require_once "DataBase/Bill.php";
require_once "DataBase/Assistant.php";
require_once "DataBase/Customer.php";
require_once "DataBase/Product.php";
require_once "DataBase/Bill_Product.php";
require_once "DataBase/Price.php";
require_once "DataBase/Priceset.php";
require_once "DataBase/Tax.php";
$bill_id = var_get_post("bill_id", "");
$bill = new Bill();
$tmp = $bill->get($bill_id);
$bill_data = $tmp[0];
$customer = new Customer();
$tmp = $customer->get($bill_data[1]);
$customer_data = $tmp[0];
$assistant = new Assistant();
$tmp = $assistant->get($bill_data[4]);
$assistant_data = $tmp[0];
$priceset = new Priceset();
$tmp = $priceset->get($customer_data[11]);
$priceset_data = $tmp[0];
$bill_product = new Bill_Product();
$bill_product_data = $bill_product->getByBillId($bill_id);
$product = new Product();
$price = new Price();
$tax = new Tax();
include "Druckvorlagen/zeilen.php";
include "Druckvorlagen/rechnung.php";
?>

Ejemplo n.º 5
0
    $main_box->add($iframe, False, False, "background-color: #dfe7f3;");
    $main_box->add($spacer, True, True, "background-color: #dfe7f3;");
    $main_box->add(new NTKButton("button_next", "Weiter", "ntk_show_splash('bitte warten ...'); location.replace('websync.php?action=download_1');"), 500);
} elseif ($action == "download_1") {
    // download all db-files "mysql_import"
    $handle = popen("/var/www/ursprung/bin/download.sh", "r");
    pclose($handle);
    require_once "DataBase/Bill.php";
    require_once "DataBase/Bill_Product.php";
    require_once "DataBase/Bill_Import.php";
    require_once "DataBase/Bill_Product_Import.php";
    require_once "DataBase/Customer.php";
    require_once "DataBase/Tour.php";
    // import new bills
    $bill = new Bill();
    $bill_product = new Bill_Product();
    $bill_import = new Bill_Import();
    $bill_product_import = new Bill_Product_Import();
    $customer = new Customer();
    $tour = new Tour();
    if ($bill_import->import("mysql_import/bill.csv") == 0 && $bill_product_import->import("mysql_import/bill_product.csv") == 0) {
        /* import bills from bill_import and products from bill_product_import */
        $bills = $bill_import->get();
        for ($i = 0; $i < count($bills); $i++) {
            if (!$bill->hasTimestamp($bills[$i][6])) {
                $customer_data = $customer->get($bills[$i][1]);
                if (count($customer_data) == 0) {
                    echo "Fehler: websync.php import bills from bill_import no customer data";
                    continue;
                }
                $tour_data = $tour->get($customer_data[0][12]);
Ejemplo n.º 6
0
require_once "DataBase/Assistant.php";
require_once "DataBase/Bill_Product.php";
$db_action = var_get_post("db_action", "");
$tour = new Tour();
$bill = new Bill();
$assistant = new Assistant();
switch ($db_action) {
    case "new":
        $tour->create(array(var_post("name", ""), var_post("assistant_id", "")));
        break;
    case "edit":
        $tour->update(var_post("tour_id", ""), array(var_post("name", ""), var_post("assistant_id", "")));
        break;
    case "delete":
        $tour->delete(var_get("tour_id", ""));
        break;
    case "tour_to_bill":
        $tour = new Tour();
        $tmp = $tour->get(var_get("tour_id", ""));
        $tour_data = $tmp[0];
        $bill = new Bill();
        $new_bill_id = $bill->create('', array(var_post("customer_id", ""), var_post("tour_id", ""), var_post("date", ""), var_post("assistant_id", ""), -1, 0));
        $bill_product = new Bill_Product();
        $product = new Product();
        $product_data = $product->get();
        $result = $bill_product->getTourZusammenfassung(var_post("current_tour_id", ""), var_post("date", ""));
        for ($i = 0; $i < count($result); $i++) {
            $bill_product->create(array($new_bill_id, $result[$i][0], $result[$i][2], '', '', '', ''));
        }
        break;
}
Ejemplo n.º 7
0
<?php

require_once "DataBase/Bill.php";
require_once "DataBase/Bill_Product.php";
require_once "DataBase/Tour.php";
require_once "DataBase/Assistant.php";
require_once "DataBase/Product.php";
require_once "DataBase/Customer.php";
require_once "DataBase/Price.php";
require_once "DataBase/Tax.php";
$db_action = var_get_post("db_action", "");
$bill = new Bill();
$tour = new Tour();
$assistant = new Assistant();
$bill_product = new Bill_Product();
$product = new Product();
$customer = new Customer();
$price = new Price();
$tax = new Tax();
switch ($db_action) {
    case "new":
        $customer_data = $customer->get(var_post("customer_id", ""));
        if (count($customer_data) > 0) {
            $tour_data = $tour->getByAssistant($customer_data[0][12]);
            if (count($tour_data) > 0) {
                $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), $customer_data[0][12], var_post("date", ""), $tour_data[0][2], -1, 0));
            } else {
                $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), $customer_data[0][12], var_post("date", ""), 1, -1, 0));
            }
        } else {
            $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), '', var_post("date", ""), var_post("assistant_id", "1"), -1, 0));