From: Thomas Mudrunka Date: Wed, 19 Oct 2011 10:21:27 +0000 (+0200) Subject: Opraveny nesmyslny vypocty ceny nepocitatelnych polozek X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=fbf1a4e63bb82818dcebfa9b7a26a71c1c8de17e;p=mirrors%2FSokoMan.git Opraveny nesmyslny vypocty ceny nepocitatelnych polozek --- diff --git a/assistants/sell.inc.php b/assistants/sell.inc.php index 20444e0..26f9631 100644 --- a/assistants/sell.inc.php +++ b/assistants/sell.inc.php @@ -52,8 +52,8 @@ switch($SUBPATH[0]) { echo("Stock: ".$quantity_stored."
Disposing/Selling: ".$quantity_removed."
Keeping: ".$item_quantity); $current[$item_id]['item_quantity'] = $item_quantity; - $current[$item_id]['item_price_in'] = $item_quantity * $model_price_in; - $current[$item_id]['item_price_out'] = $item_quantity * $model_price_out; + $current[$item_id]['item_price_in'] -= $quantity_removed * $model_price_in; + $current[$item_id]['item_price_out'] -= $quantity_removed * $model_price_out; $forked_item[$item_id]['item_id'] = ''; $forked_item[$item_id]['item_serial'] .= '@'.time(); diff --git a/assistants/store.inc.php b/assistants/store.inc.php index cf48292..fcc420f 100644 --- a/assistants/store.inc.php +++ b/assistants/store.inc.php @@ -21,6 +21,10 @@ switch($SUBPATH[0]) { if($quantity_added <= 0) $this->post_redirect_get("$URL_INTERNAL/1","Can't store non-possitive amount of items!"); if(!is_numeric($quantity_added)) $quantity_added = 1; $quantity_stored = $this->db->map_unique('item_serial', $_GET['barcode'], 'item_quantity', 'item', false); + $item_price_in = $this->db->map_unique('item_serial', $_GET['barcode'], 'item_price_in', 'item', false); + $item_price_out = $this->db->map_unique('item_serial', $_GET['barcode'], 'item_price_out', 'item', false); + $model_price_in = $this->db->map_unique('model_barcode', $_GET['barcode'], 'model_price_in', 'model'); + $model_price_out = $this->db->map_unique('model_barcode', $_GET['barcode'], 'model_price_out', 'model'); if(!is_numeric($quantity_stored)) $quantity_stored = 0; echo("Quantity stored: ".$quantity_stored); @@ -39,8 +43,8 @@ switch($SUBPATH[0]) { 'item_serial' => $item_serial, 'item_quantity' => $item_quantity, 'status_id' => 1, - 'item_price_in' => $this->db->map_unique('model_barcode', $_GET['barcode'], 'model_price_in', 'model'), - 'item_price_out' => $this->db->map_unique('model_barcode', $_GET['barcode'], 'model_price_out', 'model'), + 'item_price_in' => $item_price_in + ($quantity_added * $model_price_in), + 'item_price_out' => $item_price_out + ($quantity_added * $model_price_out), 'item_author' => $this->db->auth->get_user_id() ));