Esempio n. 1
0
function profile_automatic_select($order)
{
    #Getting all pdf profiles with rules
    $pdf_profiles = profile_list();
    #Getting comparation data from order
    $order_data = array('country' => str_replace(' ', '', $order->billing['country']), 'shipping' => str_replace(' ', '', $order->info['shipping_method']), 'payment' => str_replace(' ', '', get_payment_name($order->info['payment_method'])), 'order' => str_replace(' ', '', xtc_get_order_status_name($order->info['orders_status'])), 'customer' => str_replace(' ', '', $order->info['status_name']));
    #Going trough profiles with rules and comparing rule data with order data
    foreach ($pdf_profiles as $pdf_profile) {
        $found = false;
        if (($profile_rules = $pdf_profile['rules']) != '') {
            $profile_name = $pdf_profile['profile_name'];
            $compare_results_array = array();
            $rules_complete_array = explode(' ', $profile_rules);
            $rules_groups_array = array_chunk($rules_complete_array, 4);
            foreach ($rules_groups_array as $rule) {
                foreach (compare_rule_values($rule, $order_data[$rule[0]]) as $compare_results) {
                    array_push($compare_results_array, $compare_results);
                }
            }
            #Split array in groups
            $results_array = array();
            $x = 0;
            foreach ($compare_results_array as $value) {
                if ($value === 1) {
                    $x++;
                }
                if ($value !== 1 && $value !== 0) {
                    $results_array[$x][] = $value;
                }
            }
            foreach ($results_array as $final_check) {
                if (check_conditions($final_check)) {
                    $found = true;
                    return $profile_name;
                    #break;
                }
            }
        }
        if ($found) {
            return $profile_name;
            # break;
        }
    }
    return 'default';
}
Esempio n. 2
0
    $frm->Label("Цена для клиента, " . $ofc_currency, 10, $ypos);
    $frm->Label("Оплачено автору, " . $ofc_currency, 230, $ypos);
    $ypos += 20;
    $t = $frm->Text(10, $ypos, 115, $order_info["cost_kln"]);
    $t->linkName = "cost_kln";
    $t = $frm->Text(230, $ypos, 115, $order_info["author_paid"]);
    $t->linkName = "author_paid";
    $ypos += 30;
    $frm->Label("Оплачено клиентом, " . $ofc_currency, 10, $ypos);
    $ypos += 20;
    $t = $frm->Text(10, $ypos, 115, $order_info["oplata_kln"]);
    $t->linkName = "oplata_kln";
    $ypos += 30;
    $frm->Label("Способ оплаты", 10, $ypos);
    $ypos += 20;
    $t = $frm->Text(10, $ypos, 200, get_payment_name($order_info['payment_id']));
    //18
    $t->linkName = "payment_id";
    $ypos += 30;
    $frm->Label('Долг перед фирмой', 10, $ypos);
    $ypos += 20;
    $t = $frm->Text(10, $ypos, 200, calculate_debt_to_company($order_info["cost_kln"], $order_info["cost_auth"], $order_info['filial_id']));
    $t->Disabled = true;
} else {
    $frm->Label("Гонорар автора, " . $ofc_currency, 10, $ypos);
    $frm->Label("Оплачено автору, " . $ofc_currency, 230, $ypos);
    $ypos += 20;
    $t = $frm->Text(10, $ypos, 115, $order_info["cost_auth"]);
    $t->linkName = "cost_auth";
    $t = $frm->Text(230, $ypos, 115, $order_info["author_paid"]);
    $t->linkName = "author_paid";
Esempio n. 3
0
 if (!$is_author) {
     $frm->Label("Комментарий менеджера", 10, $ypos);
     $frm->Label("Следующий контакт", 515, $ypos);
     $ypos += 20;
     $t = $frm->TextArea(10, $ypos, 490, 80, $order_change_history['about_mng_new']);
     //17
     $t->linkName = "about_mng";
     $t = $frm->Text(515, $ypos, 120, format_date($order_change_history['next_rel_date_new']));
     //10
     $t->linkName = "next_rel_date";
     $ypos += 100;
     $frm->Label("Способ оплаты", 10, $ypos);
     $frm->Label("Заказ принят", 230, $ypos);
     //          $frm->Label("Скидка", 445, $ypos);
     $ypos += 20;
     $s = $frm->Text(10, $ypos, 200, get_payment_name($order_change_history['payment_id_new']));
     //18
     $s->linkName = "payment_id";
     $s = $frm->Text(230, $ypos, 200, $data_ordertakemethod[$order_change_history['from_id_new']]);
     //19
     $s->linkName = "from_id";
     //          $t = $frm->Text(445, $ypos, 60, $defdata["skid"]); //20
     //          $t->linkName = "skid";
     //          $s = $frm->Text(510, $ypos, 50, $defdata["skidt"]); //21
     //          $s->linkName = "skidt";
     $ypos += 30;
     $frm->Label("Цена клиента, " . $ofc_currency, 10, $ypos);
     $frm->Label("Оплачено клиентом, " . $ofc_currency, 180, $ypos);
     $frm->Label("Оплачено фирме, " . $ofc_currency, 350, $ypos);
     $ypos += 20;
     $t = $frm->Text(10, $ypos, 115, $order_change_history["cost_kln_new"]);
Esempio n. 4
0
         }
     }
     $contents[] = array('align' => 'center', 'text' => '<br /><input type="submit" class="button" value="' . BUTTON_DELETE . '"><a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id) . '">' . BUTTON_CANCEL . '</a>');
     break;
 default:
     if (isset($oInfo) && is_object($oInfo)) {
         $heading[] = array('text' => '<b>[' . $oInfo->orders_id . ']&nbsp;&nbsp;' . xtc_datetime_short($oInfo->date_purchased) . '</b>');
         $contents[] = array('align' => 'center', 'text' => '<a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . BUTTON_EDIT . '</a> <a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete') . '">' . BUTTON_DELETE . '</a>');
         if (AFTERBUY_ACTIVATED == 'true') {
             $contents[] = array('align' => 'center', 'text' => '<a class="button" href="' . xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=afterbuy_send') . '">' . BUTTON_AFTERBUY_SEND . '</a>');
         }
         $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . xtc_date_short($oInfo->date_purchased));
         if (xtc_not_null($oInfo->last_modified)) {
             $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . xtc_date_short($oInfo->last_modified));
         }
         $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' ' . get_payment_name($oInfo->payment_method) . ' (' . $oInfo->payment_method . ')');
         $order = new order($oInfo->orders_id);
         $contents[] = array('text' => '<br /><br />' . sizeof($order->products) . '&nbsp;' . TEXT_PRODUCTS);
         for ($i = 0; $i < sizeof($order->products); $i++) {
             $contents[] = array('text' => $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name']);
             if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
                 for ($j = 0; $j < sizeof($order->products[$i]['attributes']); $j++) {
                     $contents[] = array('text' => '<small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>');
                 }
             }
         }
         if ($order->info['comments'] != '') {
             $contents[] = array('text' => '<br><strong>' . TABLE_HEADING_COMMENTS . ':</strong><br>' . $order->info['comments']);
         }
     }
     break;