function cw_pos_get_doc_info($doc_info_id) { global $tables; $ret = cw_query_first("select * from $tables[docs_pos_info] where doc_info_id='$doc_info_id'"); $ret['pos_user_info'] = cw_pos_user_info($ret['pos_customer_id']); return $ret; }
function cw_aom_recalculate_totals($cart) { global $addons, $config, $global_store; global $current_area; if ($real_taxes == 'Y') { global $current_area, $customer_id; $_saved_data = compact("current_area", "customer_id"); $current_area = $current_area = $current_area == 'G' ? 'G' : 'C'; } $saved_state = false; $global_store['discounts'] = array(); if ($cart['info']['use_discount_alt'] == 'Y') { $global_store['discounts'][] = array('__override' => true, 'discount_id' => -1, 'minprice' => 0, 'discount' => $cart['info']['discount_alt'], 'discount_type' => 'absolute'); } if ($cart['info']['use_coupon_discount_alt'] == 'Y') { $global_store['discount_coupons'] = array(array("__override" => true, "coupon" => "Order#" . $cart['doc_id'], "discount" => $cart['info']['coupon_discount_alt'], "coupon_type" => "absolute", "minimum" => 0, "times" => 999999999, "times_used" => 0, "expire" => time() + 30879000, "status" => "A")); } # kornev, pos addon if ($cart['pos']['gd_value']) { $global_store['discounts'][] = array('__override' => true, 'discount_id' => -2, 'minprice' => 0, 'discount' => $cart['pos']['gd_value'], 'discount_type' => $cart['pos']['gd_type'] ? 'percent' : 'absolute'); } if ($cart['pos']['vd_value']) { $global_store['discounts_value'] = array('__override' => true, 'discount_id' => -3, 'minprice' => 0, 'discount' => $cart['pos']['vd_value'], 'discount_type' => 'absolute'); } $cart['products'] = cw_aom_update_prices($cart['products'], $cart['userinfo']); $cart = cw_func_call('cw_cart_calc', array('cart' => $cart, 'products' => $cart['products'], 'userinfo' => $cart['userinfo'])); $cart['info']['applied_taxes'] = $cart['info']['taxes']; if (!empty($_saved_data)) { extract($_saved_data); } if ($addons['pos']) { cw_load('pos'); if (!$cart['pos']['paid_by_cc']) { if ($cart['pos']['payment']) { $cart['pos']['change'] = $cart['pos']['payment'] - $cart['info']['total']; } } else { $cart['pos']['payment'] = $cart['pos']['change'] = 0; } $cart['pos']['pos_user_info'] = cw_pos_user_info($cart['pos']['pos_customer_id']); } return $cart; }