function getPriceTax($priceset_id, $product_id, $netto, $tax_id = -1) { $query = "SELECT * FROM " . $this->db->price_table . " WHERE priceset_id='" . $priceset_id . "' AND product_id='" . $product_id . "'"; $tmp = $this->db->fetchRows($this->db->query($query)); $price = $tmp[0][3]; if ($tax_id == -1) { $product = new Product(); $tmp_product = $product->get($product_id); if (count($tmp_product) > 0) { $tax_id = $tmp_product[0][4]; } else { return 0; } } if ($netto) { $tax = new Tax(); $tmp_tax = $tax->get($tax_id); if (count($tmp_tax) <= 0) { return 0; } $price = $price * (1 + $tmp_tax[0][2]); } return $price; }
function fix($bill_id) { $products = $this->getByBillId($bill_id); $product = new Product(); $price = new Price(); $tax = new Tax(); $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]; for ($i = 0; $i < count($products); $i++) { $tmp = $this->getByBillIdAndProductId($bill_id, $products[$i][2]); $bill_product_data = $tmp[0]; $tmp = $product->get($products[$i][2]); $product_data = $tmp[0]; $tmp = $price->getPrice($customer_data[11], $product_data[0]); $price_data = $tmp[0]; $tmp = $tax->get($product_data[4]); $tax_data = $tmp[0]; $this->update($bill_product_data[0], array($bill_product_data[1], $bill_product_data[2], $bill_product_data[3], $bill_product_data[4], $bill_product_data[5], $price_data[3], $tax_data[2])); } }
<?php require_once "util.php"; $tax = new Tax(); if ($action == "new") { $tax->create(var_post("tax_id", ""), array(var_post("tax_name", ""), var_post("tax_rate", ""))); } elseif ($action == "edit") { $tax->update(var_post("tax_id", ""), array(var_post("tax_name", ""), var_post("tax_rate", ""))); } elseif ($action == "delete") { $tax->delete(var_get("tax_id", "")); } $tax_box = new NTKVBox("tax_box", 0, 0, False); $label = new NTKLabel("tax_label", "<h3>Steuersätze</h3>"); $tax_box->add($label); $taxlist = $tax->get(''); for ($i = 0; $i < count($taxlist); $i++) { $tax_box->add(new NTKETax($taxlist[$i][0], $taxlist[$i][1], $taxlist[$i][2])); } $label = new NTKLabel("tax_label", "<h4>neuer Steuersatz</h4>"); $tax_box->add($label); $tax_box->add(new NTKETax("", "", "", True), -1); $main_box->add($tax_box, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
case "delete": $bill->delete(var_get("bill_id", "")); if ($fp_tour_id != "") { $onload .= "location.href = 'tour.php?action=list_tour&tour_id=" . $fp_tour_id . "&date=" . $fp_date . "';"; } break; case "position_add": $bill_data = $bill->get(var_post("bill_id", "")); /* autoset anmerkung vom produkt, wenn nichts als anmerkung gegeben */ $details = var_post("details", ""); if ($details == "") { $product_data = $product->get(var_post("product_id", "")); $details = $product_data[0][8]; } if ($bill_data[0][5] == -1) { $bill_product->create(array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), $details, var_post("rabatt", ""), 0, 0)); } else { $customer_data = $customer->get($bill_data[0][1]); $price_data = $price->getPrice($customer_data[0][11], var_post("product_id", "")); $product_data = $product->get(var_post("product_id", "")); $tax_data = $tax->get($product_data[0][4]); $bill_product->create(array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), $details, var_post("rabatt", ""), $price_data[0][3], $tax_data[0][2])); } break; case "position_delete": $bill_product->delete(var_get("bill_product_id", "")); break; case "position_edit": $bill_product->update(var_post("bill_product_id", ""), array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), var_post("details", ""), var_post("rabatt", ""), var_post("price", ""), var_post("tax", ""))); break; }