Example #1
0
 * You can copy, adapt and distribute the work under the "Attribution-NonCommercial-ShareAlike"
 * Vizsage Public License (the "License"). You may not use this file except in compliance with the
 * License. Roughly speaking, non-commercial users may share and modify this code, but must give credit
 * and share improvements. However, for proper details please read the full License, available at
 * http://vizsage.com/license/Vizsage-License-BY-NC-SA.html and the handy reference for understanding
 * the full license at http://vizsage.com/license/Vizsage-Deed-BY-NC-SA.html. Unless required by
 * applicable law or agreed to in writing, any software distributed under the License is distributed
 * on an  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the
 * License terms of Creative Commons Attribution-NonCommercial-ShareAlike 3.0 (the License).
 *************************************************************************************************
 *  Module       : Adocmaster
 *  Version      : 5.4.0
 *  Author       : Opencubed
 *************************************************************************************************/
global $adb, $log, $current_user;
require_once 'modules/Adocmaster/Adocmaster.php';
require_once 'modules/Adocdetail/Adocdetail.php';
$laprueva = $_REQUEST['record'];
$sot = $_REQUEST['sot'];
$sot2 = $_REQUEST['sot2'];
$kaction = $_REQUEST['kaction'];
if ($kaction == doc1) {
    require_once "modules/Adocmaster/calculateTariffPrice.php";
    $foundRes2 = calculatePrice('Adocdetail', $sot2, $laprueva, $sot);
    $foundRes3 = explode("::", $foundRes2);
    echo $foundRes3[7];
}
?>

Example #2
0
<?php

function checker($key, $value, $default_)
{
    if (isset($_GET[$key]) && $_GET[$key] == $value || !isset($_GET[$key]) && $default_) {
        echo "checked";
    }
}
?>

<form method="GET" action="orderValidation.php" name="validationForm" id="validationForm">
    <?php 
addPastQuery('id_meal', 'id_specific_meal');
$orderPrice = calculatePrice($_GET, $connectionObject);
echo "<input type='hidden' name='price' value=" . $orderPrice . "/>";
?>
    Nom/prénom du client:<br/>
    <input type="text" name="name" id="beginning" value="<?php 
if (isset($_GET['name'])) {
    echo $_GET['name'];
}
?>
"
           autofocus/><br/><br/>
    Commentaires/détails de la commande:<br/>
    <input type="text" name="description" value="<?php 
if (isset($_GET['description'])) {
    echo $_GET['description'];
}
?>
"/><br/><br/>
    removeFromCart($which);
}
if (isset($_POST['makeBooking'])) {
    $movie = $_POST['movie'];
    $date = (double) $_POST['day'];
    $sessiontime = $_POST['time'];
    $seats = array();
    $seats['SA'] = $_POST['SA'];
    $seats['SP'] = $_POST['SP'];
    $seats['SC'] = $_POST['SC'];
    $seats['FA'] = $_POST['FA'];
    $seats['FC'] = $_POST['FC'];
    $seats['B1'] = $_POST['B1'];
    $seats['B2'] = $_POST['B2'];
    $seats['B3'] = $_POST['B3'];
    $price = calculatePrice($seats, $date);
    foreach ($seats as $k => $v) {
        if ($v == 0) {
            unset($seats[$k]);
        }
    }
    addToCart($movie, $date, $price, $sessiontime, $seats);
}
if (isset($_POST['firstname'])) {
    checkOut($_POST['firstname'], $_POST['lastname'], $_POST['phone'], $_POST['emailaddress']);
    unset($_POST['firstname']);
}
function addToCart($movie, $date, $price, $sessiontime, $seats)
{
    $_SESSION['cart'][$movie]['date'] = $date;
    $_SESSION['cart'][$movie]['sessiontime'] = $sessiontime;
Example #4
0
        $adocp = $_REQUEST['adocp'];
        echo $adocp;
        $focus = new Adocdetail();
        $adoc1 = new Adocdetail();
        $adoc1->column_fields['adoc_quantity'] = $quantity;
        $adoc1->column_fields['adoctomaster'] = $laprueva;
        $adoc1->column_fields['assigned_user_id'] = $current_user->id;
        $adoc1->column_fields['adoc_product'] = $adocp;
        $adoc1->column_fields['adoc_price'] = $sot5;
        $adoc1->save("Adocdetail");
    }
    if ($kaction == 'delete') {
        $totdelete = $_REQUEST['totdelete'];
        $adocmasterdelete = $_REQUEST['adocmasterdelete'];
        $adb->pquery("delete from vtiger_adocdetail where adocdetailid=?", array($adocdelete));
        $adb->pquery("update vtiger_adocmaster set totalamount=?,amount=? WHERE adocmasterid=?", array($totdelete, $totdelete, $adocmasterdelete));
    }
    $adb->pquery("Update vtiger_adocdetail\n    set nrline=?   where adocdetailid=?", array($prova, $idja));
    $adb->pquery("Update vtiger_adocdetail\n    set adoc_quantity=? where adocdetailid=?", array($sasia, $idja));
    $adb->pquery("Update vtiger_adocdetail\n    set adoc_product=? where adocdetailid=?", array($produkt, $idja));
    $adb->pquery("UPDATE vtiger_adocmaster set totalamount=?,taxamount=?,amount=?,impiva=?,nonimpiva=?\n        WHERE adocmasterid=? ", array($totiduhur, $taxiduhur, $totali3, $totalIva, $totalNoIva, $adocmasterid));
    require_once "modules/Adocmaster/calculateTariffPrice.php";
    $foundRes2 = calculatePrice('Adocdetail', $productid, $adocmasterid, $sasia);
    $foundRes3 = explode("::", $foundRes2);
    $nuevoprecio = $foundRes3[2];
    $nuevotax = $foundRes3[3];
    $nuevototal = $foundRes3[4];
    $nuevoamount = $foundRes3[5];
    $adb->pquery("update vtiger_adocdetail set adocdtax=?,adocdtotal=?,adocdtotalamount=? where adocdetailid=? ", array($nuevotax, $nuevototal, $nuevoamount, $idja));
    $adb->pquery("update vtiger_adocdetail set adoc_price=? where adocdetailid=?", array($price2, $idja));
}
/**
 * calculates the price of a reservertion
 */
function calculatePriceOfReservation($reservation_id)
{
    global $root;
    global $link;
    include_once $root . "/include/reservierungFunctions.inc.php";
    $datumVon = getDatumVon($reservation_id, $link);
    $datumBis = getDatumBis($reservation_id, $link);
    $zimmer_id = getZimmerID($reservation_id, $link);
    $preis = calculatePrice($zimmer_id, $datumVon, $datumBis);
    return $preis;
}
                    echo getUebersetzung("Bitte korrigieren Sie das Datum Ihrer Anfrage!", $sprache, $link);
                    ?>
</p>
		</td>
	  </tr>
	</table>
	<?php 
                } else {
                    //berechne den preis falls Überhaupt welche definiert wurden:
                    $preis = 0;
                    if (isset($zimmer_ids)) {
                        foreach ($zimmer_ids as $zi_id) {
                            $preis += calculatePrice($zi_id, $datumVon, $datumBis);
                        }
                    } else {
                        $preis = calculatePrice($zimmer_id, $datumVon, $datumBis);
                    }
                    ?>
<form action="./send.php" method="post" name="adresseForm" target="_self" 
	id="adresseForm" onSubmit="return chkFormular()">
<table border="0" cellpadding="0" cellspacing="3" class="tableColor">
  <tr>
    <td><?php 
                    function removeChildRooms($zimmer_ids)
                    {
                        $newArr = array();
                        //is room with child rooms in array?
                        $parentInArray = false;
                        foreach ($zimmer_ids as $id) {
                            if (hasChildRooms($id)) {
                                $parentInArray = true;
Example #7
0
function AddtoStock($ITD, $quantity, $LID, $Price)
{
    $conn = conDB();
    $Cstock = getStock($ITD, $LID);
    if ($Cstock == "None") {
        $sql = "INSERT INTO stock (ItemID,LocID,Quantity) VALUES ('{$ITD}','{$LID}','{$quantity}')";
        mysqli_query($conn, $sql);
    } else {
        $Fstock = $Cstock + $quantity;
        $sql = "UPDATE stock SET Quantity='{$Fstock}' WHERE ItemID='{$ITD}' AND LocID='{$LID}'";
        mysqli_query($conn, $sql);
    }
    $AID = getID();
    $name = getAgentName($AID);
    addToStockLog('1', $LID, $quantity, "{$name} successfully added {$quantity} to a stockpile", $ITD);
    $newprice = calculatePrice($ITD, $Price, $quantity);
    setPrice($ITD, $newprice);
}
function insertOrder($values, $connectionObject)
{
    $orderString = "insert into order_ values(DEFAULT,0,0,:name,:price,:quantity,:id_meal,:id_specific_meal,:description, CURRENT_TIMESTAMP)";
    $connectionObject->prepare($orderString)->execute(array(':name' => $values['name'], ':id_meal' => $values['id_meal'], ':id_specific_meal' => $values['id_specific_meal'], ':quantity' => $values['quantity'], ':description' => $values['description'], ':price' => calculatePrice($values, $connectionObject)));
}
 function get_products()
 {
     global $languages_id, $_SERVER, $customer_id;
     if (!is_array($this->contents)) {
         return false;
     }
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         if (USE_PRICES_TO_QTY == 'true') {
             $products_query = tep_db_query("select p.products_id, pp.products_plant_id, pp.plant_price, pp.plant_maat, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_discount, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p JOIN " . TABLE_PRODUCTS_PLANT . " pp USING (products_model), " . TABLE_PRODUCTS_DESCRIPTION . " pd where pp.products_plant_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
             if (tep_db_num_rows($products_query) < 1) {
                 $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
             }
         } else {
             $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
         }
         if ($products = tep_db_fetch_array($products_query)) {
             $prid = $products['products_id'];
             if (USE_PRICES_TO_QTY == 'true') {
                 //Calculate products price
                 if (SOAP_STATUS == 'true') {
                     if ($this->contents[$products_id]['price']) {
                         $products_price = $this->contents[$products_id]['price'];
                     } else {
                         $products_price = showPriceTable($prid, $customer_id, $products['plant_maat'], $this->contents[$products_id]['qty'], $table = false);
                         $this->contents[$products_id]['price'] = $products_price;
                     }
                 } else {
                     $products_price = calculatePrice($products['plant_price'], $this->contents[$products_id]['qty']);
                     if (isset($products['products_discount']) && strlen($products['products_discount']) > 2) {
                         if ($tranche = explode(',', $products['products_discount'])) {
                             foreach ($tranche as $cle => $trn) {
                                 if ($qty_px = explode(':', $trn)) {
                                     if ($this->contents[$products_id]['qty'] >= $qty_px[0]) {
                                         $products_price = $qty_px[1];
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 if (SOAP_STATUS == 'true' && SOAP_PRICE == 'true') {
                     if ($this->contents[$products_id]['price']) {
                         $products_price = $this->contents[$products_id]['price'];
                     } else {
                         $products_price = showCustomerPrice($prid, $customer_id, $this->contents[$products_id]['qty']);
                         $this->contents[$products_id]['price'] = $products_price;
                     }
                 } else {
                     //DISCOUNT
                     $discount_price = tep_get_discountprice($products['products_price'], $customer_id, $customer_group, $products['products_id'], $cPath, $products['manufacturers_id']);
                     if ($discount_price['lowest']['discount'] > 0 || $discount_price['lowest']['price'] > 0 && PRICE_BOOK == 'true') {
                         if ($new_price = tep_get_products_special_price($products['products_id'])) {
                             if ($new_price < $discount_price['lowest']['price']) {
                                 $products_price = $new_price;
                             } else {
                                 $products_price = $discount_price['lowest']['price'];
                             }
                         } else {
                             $products_price = $discount_price['lowest']['price'];
                         }
                     } else {
                         if ($new_price = tep_get_products_special_price($products['products_id'])) {
                             $products_price = $new_price;
                         } else {
                             $products_price = $products['products_price'];
                         }
                     }
                     if (PRICE_BOOK == 'true') {
                         foreach ($discount_price['others'] as $prices) {
                             if ($prices['min_amount'] <= $this->contents[$products_id]['qty'] && $prices['price'] < $products_price) {
                                 $products_price = $prices['price'];
                             }
                         }
                     }
                     //END DISCOUNT
                 }
             }
             if (USE_PRICES_TO_QTY == 'true') {
                 //Lets get all sized
                 $products_sizes_query = tep_db_query("SELECT plant_description, plant_mc FROM " . TABLE_PRODUCTS_PLANT . " WHERE products_plant_id = '" . $products['products_plant_id'] . "'");
                 $products_size = tep_db_fetch_array($products_sizes_query);
                 $qty_array = getPricesToQty($products_size['plant_price']);
                 if ($products['plant_maat'] != '') {
                     $maat = Translate('Maat') . ': ' . $products['plant_maat'];
                     if ($products_size['plant_mc'] == 'hoogte') {
                         $eenheid = ' cm.';
                     } elseif ($products_size['plant_mc'] == 'stamomtrek') {
                         $eenheid = ' stamomtrek';
                     } elseif ($products_size['plant_mc'] == 'diameter') {
                         $eenheid = ' diameter';
                     } else {
                         $eenheid = '';
                     }
                 } else {
                     $maat = '';
                     $eenheid = '';
                 }
                 if ($products_size['plant_description'] != '') {
                     $descr = $products_size['plant_description'];
                 } else {
                     $descr = '';
                 }
                 $products_array[] = array('id' => $prid, 'size_id' => $products['products_plant_id'], 'original_name' => $products['products_name'], 'name' => $products['products_name'], 'description' => '<span style="font-weight: normal;">' . $descr . '</span>', 'maat' => '<span style="font-weight: normal;">' . $maat . $eenheid . '</span>', 'size' => $products['plant_maat'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '');
             } else {
                 $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '');
             }
         }
     }
     return $products_array;
 }
Example #10
0
<?php

require_once '../model/bookingModel.php';
require_once '../view/bookingStayView.php';
$loginUser = $_SESSION["login_user"];
if (isset($_POST['bathroom'])) {
    $bathroom = 1;
} else {
    $bathroom = 0;
}
if (isset($_POST['board'])) {
    $board = 1;
} else {
    $board = 0;
}
$arrivalDate = isset($_POST['arrivalDate']) ? $_POST['arrivalDate'] : '';
$departureDate = isset($_POST['departureDate']) ? $_POST['departureDate'] : '';
$idBooking = generateRandId();
$idClient = "SELECT `client_idclient` FROM `client` WHERE `client_clientlogin` = '{$loginUser}'";
$idPayment = "SELECT `payment_idpayment` FROM `payment` WHERE `payment_idclient` = '{$idClient}'";
$nbPersons = isset($_POST['number']) ? $_POST['number'] : "";
$idRoom = checkRoomAvailable($bathroom, $nbPersons, $arrivalDate, $departureDate);
$nbNights = calculateNbNights($arrivalDate, $departureDate);
$price = calculatePrice($nbNights, $arrivalDate, $idRoom, $board);
$canceled = 0;
if (isset($_POST['number'])) {
    $nbPersons = $_POST['number'];
}
$purpose = isset($_POST['purpose']) ? $_POST['purpose'] : '';
$_SESSION["idBooking"] = $idBooking;
$newBooking = "INSERT INTO `booking` (`booking_idbooking`, `booking_idroom`, `booking_idclient`, `booking_idpayment`, `booking_datestart`, `booking_dateend`, `booking_nbnights`, `booking_price`, `booking_canceled`, `booking_nbpersons`, `booking_purpose`) VALUES ('{$idBooking}', '{$idRoom}', '{$idClient}', '{$idPayment}', '{$arrivalDate}', '{$departureDate}', '{$nbNights}', '{$price}', '{$canceled}', '{$nbPersons}', '{$purpose}'";