Ejemplo n.º 1
0
 function manage()
 {
     expHistory::set('manageable', $this->params);
     $taxes = taxController::getTaxClasses();
     assign_to_template(array('taxes' => $taxes));
 }
Ejemplo n.º 2
0
 function show_payment_summary()
 {
     global $order, $db;
     $payments = billingmethod::$payment_types;
     $order_ids = array();
     if (isset($this->params['applytoall']) && $this->params['applytoall'] == 1) {
         $obs = expSession::get('order_export_values');
         foreach ($obs as $ob) {
             $order_ids[] = $ob->id;
         }
     } else {
         foreach ($this->params['act-upon'] as $order_id) {
             $order_ids[] = $order_id;
         }
     }
     $order_ids = array_unique($order_ids);
     $orders_string = implode(',', $order_ids);
     $payment_summary = array();
     // $Credit Cards
     $sql = "SELECT orders_id, billing_cost, billing_options, calculator_name, user_title FROM " . DB_TABLE_PREFIX . "_billingmethods, " . DB_TABLE_PREFIX . "_billingcalculator WHERE " . DB_TABLE_PREFIX . "_billingcalculator.id = billingcalculator_id and orders_id IN (" . $orders_string . ")";
     $res = $db->selectObjectsBySql($sql);
     if (!empty($res)) {
         foreach ($res as $item) {
             $options = unserialize($item->billing_options);
             if (!empty($item->billing_cost)) {
                 if ($item->user_title == 'Credit Card') {
                     if (!empty($options->cc_type)) {
                         //@$payment_summary[$payments[$options->cc_type]] += $item->billing_cost;
                         @($payment_summary[$payments[$options->cc_type]] += $options->result->amount_captured);
                     }
                 } else {
                     @($payment_summary[$payments[$item->calculator_name]] += $item->billing_cost);
                 }
             }
         }
     }
     foreach ($payment_summary as $key => $item) {
         $payments_key_arr[] = '"' . $key . '"';
         $payment_values_arr[] = round($item, 2);
     }
     $payments_key = implode(",", $payments_key_arr);
     $payment_values = implode(",", $payment_values_arr);
     //tax
     $tax_sql = "SELECT SUM(tax) as tax_total FROM " . DB_TABLE_PREFIX . "_orders WHERE id IN (" . $orders_string . ")";
     $tax_res = $db->selectObjectBySql($tax_sql);
     $tax_types = taxController::getTaxClasses();
     $tax_type_formatted = $tax_types[0]->zonename . ' - ' . $tax_types[0]->classname . ' - ' . $tax_types[0]->rate . '%';
     assign_to_template(array('payment_summary' => $payment_summary, 'payments_key' => $payments_key, 'payment_values' => $payment_values, 'tax_total' => $tax_res->tax_total, 'tax_type' => $tax_type_formatted));
 }