コード例 #1
0
ファイル: parser.php プロジェクト: siwiwit/PhreeBooksERP
 function responseXML($code, $text, $level, $extra_xml = false)
 {
     $strResponse = '';
     $strResponse .= '<?xml version="1.0" encoding="UTF-8" ?>' . chr(10);
     $strResponse .= '<Response>' . chr(10);
     $strResponse .= xmlEntry('Version', '1.00');
     $strResponse .= xmlEntry('Reference', $this->reference);
     $strResponse .= xmlEntry('Code', $code);
     switch ($level) {
         case 'success':
             $strResponse .= xmlEntry('Result', 'success');
             $strResponse .= xmlEntry('Text', $text);
             break;
         case 'error':
             $strResponse .= xmlEntry('Result', 'error');
             $strResponse .= xmlEntry('Text', $text);
             break;
         default:
             $strResponse .= xmlEntry('Result', 'error');
             $strResponse .= xmlEntry('Text', SOAP_UNEXPECTED_ERROR);
     }
     if ($extra_xml) {
         $strResponse .= $extra_xml;
     }
     $strResponse .= '</Response>';
     echo $strResponse;
     die;
 }
コード例 #2
0
ファイル: orders.php プロジェクト: siwiwit/PhreeBooksERP
 function processXML($rawXML)
 {
     global $messageStack;
     //echo '<pre>' . $rawXML . '</pre>';
     $rawXML = utf8_decode($rawXML);
     $rawXML = iconv("UTF-8", "UTF-8//IGNORE", $rawXML);
     //echo '<pre>' . $rawXML . '</pre>';
     if (!($objXML = xml_to_object($rawXML))) {
         return false;
     }
     // parse the submitted string, check for errors
     //echo 'parsed string = '; print_r($objXML); echo '<br />';
     if (DEBUG) {
         $messageStack->debug("\n\nobjXML array = " . serialize($objXML));
     }
     $this->username = $objXML->Request->UserID;
     $this->password = $objXML->Request->Password;
     $this->version = $objXML->Request->Version;
     $this->function = $objXML->Request->Function;
     $this->action = $objXML->Request->Action;
     $this->validateUser($this->username, $this->password);
     $this->processOrder($objXML);
     $extra_response = NULL;
     if (sizeof($this->successful) > 0) {
         $result_code = '0';
         $result_flag = 'success';
         $extra_response .= xmlEntry('SuccessfulOrders', implode(', ', $this->successful));
     }
     if (sizeof($this->failed) > 0) {
         $result_code = '90';
         $result_flag = 'error';
         $extra_response .= xmlEntry('FailedOrders', implode(', ', $this->failed));
     }
     $this->responseXML($result_code, implode("<br />", $this->response), $result_flag, $extra_response);
 }
コード例 #3
0
/**************   page specific initialization  *************************/
if (!isset($_REQUEST['list'])) {
    $_REQUEST['list'] = 1;
}
$fieldset_content = 'NULL';
$id = (int) $_GET['id'];
if (!isset($_GET['id'])) {
    die;
}
$doc_details = $db->Execute("select * from " . TABLE_PHREEFORM . " where id = '" . $id . "'");
if ($id == 0 || $doc_details->fields['doc_type'] == '0') {
    // folder
    $dir_path = TEXT_PATH . ': /' . build_dir_path($id);
    $result = html_heading_bar(array(), array(' ', $dir_path, TEXT_ACTION));
    $list_header = $result['html_code'];
    $field_list = array('id', 'doc_type', 'doc_title', 'security');
    $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_PHREEFORM . " where parent_id = '" . $id . "'";
    $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS);
    // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS
    $query_split = new splitPageResults($_REQUEST['list'], '');
    include DIR_FS_MODULES . 'phreeform/pages/main/tab_folder.php';
} else {
    // load document details
    include DIR_FS_MODULES . 'phreeform/pages/main/tab_report.php';
}
$html = "<div>";
$html .= $fieldset_content;
$html .= "</div>";
$xml .= "\t" . xmlEntry("htmlContents", $html);
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #4
0
// | Copyright(c) 2008-2014 PhreeSoft      (www.PhreeSoft.com)       |
// +-----------------------------------------------------------------+
// | This program is free software: you can redistribute it and/or   |
// | modify it under the terms of the GNU General Public License as  |
// | published by the Free Software Foundation, either version 3 of  |
// | the License, or any later version.                              |
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/work_orders/ajax/load_wo_detail.php
//
/**************   Check user security   *****************************/
$xml = NULL;
$security_level = validate_ajax_user();
/**************   page specific initialization  *************************/
$id = $_GET['id'];
if (!$id) {
    echo createXmlHeader() . xmlEntry('error', 'Error - Bad ID passed.') . createXmlFooter();
    die;
}
$result = $db->Execute("select display_name, admin_email from " . TABLE_USERS . " where admin_id = " . $_SESSION['admin_id']);
$xml = xmlEntry("id", $id);
$xml .= xmlEntry("sEmail", $result->fields['admin_email']);
$xml .= xmlEntry("sName", $result->fields['display_name']);
$xml .= xmlEntry("rEmail", '');
$xml .= xmlEntry("rName", '');
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #5
0
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/work_orders/ajax/load_bom_list.php
//
/**************   Check user security   *****************************/
$security_level = validate_ajax_user();
/**************  include page specific files    *********************/
/**************   page specific initialization  *************************/
$xml = NULL;
$sku_id = $_GET['skuID'];
$qty = $_GET['qty'];
if (!$sku_id || !$qty) {
    die;
}
$result = $db->Execute("select sku, description, qty from " . TABLE_INVENTORY_ASSY_LIST . " where ref_id = '" . $sku_id . "'");
$short = array();
while (!$result->EOF) {
    $stock = $db->Execute("select quantity_on_hand, quantity_on_sales_order, quantity_on_allocation \n    from " . TABLE_INVENTORY . " where sku = '" . $result->fields['sku'] . "' limit 1");
    $qty_available = $stock->fields['quantity_on_hand'] - $stock->fields['quantity_on_sales_order'] - $stock->fields['quantity_on_allocation'];
    if ($qty_available < $qty * $result->fields['qty']) {
        $short[] = sprintf(WO_TEXT_PARTS_SHORTAGE, $qty_available, $qty * $result->fields['qty'], $result->fields['sku'], $result->fields['description']);
    }
    $result->MoveNext();
}
$shortage = sizeof($short) == 0 ? 'none' : implode(chr(10), $short);
echo createXmlHeader() . xmlEntry("shortage", $shortage) . createXmlFooter();
die;
コード例 #6
0
    while (!$bill_add->EOF) {
        $xml .= "\t<billaddress>\n";
        foreach ($bill_add->fields as $key => $value) {
            $xml .= "\t\t" . xmlEntry($key, $value);
        }
        $xml .= "\t</billaddress>\n";
        $bill_add->MoveNext();
    }
}
if ($bill->fields) {
    // there was an bill to open
    $xml .= "\t<bill>\n";
    foreach ($bill->fields as $key => $value) {
        $xml .= "\t\t" . xmlEntry($key, $value);
    }
    $xml .= "\t</bill>\n";
}
foreach ($item_list as $item) {
    // there should always be invoices to pull
    $xml .= "\t<items>\n";
    foreach ($item as $key => $value) {
        $xml .= "\t\t" . xmlEntry($key, $value);
    }
    $xml .= "\t</items>\n";
}
//put it all together
$str = createXmlHeader($function_name);
$str .= $xml;
$str .= createXmlFooter();
echo $str;
die;
コード例 #7
0
ファイル: load_order.php プロジェクト: siwiwit/PhreeBooksERP
        while (!$ship_add->EOF) {
            $xml .= "\t<Address>\n";
            foreach ($ship_add->fields as $key => $value) {
                $xml .= "\t\t" . xmlEntry($key, $value);
            }
            $xml .= "\t</Address>\n";
            $ship_add->MoveNext();
        }
    }
    $xml .= "</ShipContact>\n";
}
if (sizeof($order->fields) > 0) {
    // there was an order to open
    $xml .= "<OrderData>\n";
    foreach ($order->fields as $key => $value) {
        $xml .= "\t" . xmlEntry($key, strval($value));
    }
    foreach ($item_list as $item) {
        $xml .= "\t<Item>\n";
        foreach ($item as $key => $value) {
            $xml .= "\t\t" . xmlEntry($key, strval($value));
        }
        $xml .= "\t</Item>\n";
    }
    $xml .= "</OrderData>\n";
}
if ($debug) {
    $xml .= xmlEntry('debug', $debug);
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #8
0
        $xml .= "<bom>\n";
        $xml .= "\t" . xmlEntry("qty", $value['qty']);
        $xml .= "\t" . xmlEntry("sku", $value['sku']);
        $xml .= "\t" . xmlEntry("description_short", $value['description_short']);
        $xml .= "\t" . xmlEntry("item_cost", $value['item_cost']);
        $xml .= "\t" . xmlEntry("quantity_on_hand", $value['quantity_on_hand']);
        $xml .= "</bom>\n";
    }
}
$xml .= xmlEntry("assy_cost", $assy_cost);
// build where used
foreach ($sku_usage as $value) {
    $xml .= "<sku_usage>\n";
    $xml .= "\t" . xmlEntry("text_line", $value);
    $xml .= "</sku_usage>\n";
}
// build the sales price
$xml .= xmlEntry("sales_price", $sales_price);
// build the stock status
if (sizeof($stock_note) > 0) {
    foreach ($stock_note as $value) {
        $xml .= "<stock_note>\n";
        $xml .= "\t" . xmlEntry("text_line", $value);
        $xml .= "</stock_note>\n";
    }
}
$str = createXmlHeader($fID);
$str .= $xml;
$str .= createXmlFooter();
echo $str;
die;
コード例 #9
0
ファイル: tab_details.php プロジェクト: siwiwit/PhreeBooksERP
    case 'delete':
        if ($rID) {
            $my_class->btn_delete($rID);
        }
        break;
    case 'update':
        $my_class->btn_update($rID);
        break;
    case 'go_first':
        $_REQUEST['list'] = 1;
        break;
    case 'go_previous':
        $_REQUEST['list'] = max($_REQUEST['list'] - 1, 1);
        break;
    case 'go_next':
        $_REQUEST['list']++;
        break;
    case 'go_last':
        $_REQUEST['list'] = 99999;
        break;
    case 'go_page':
        break;
}
// put the output together
$xml .= "\t" . xmlEntry("subject", $subject);
$xml .= "\t" . xmlEntry("htmlContents", "<div>" . $my_class->build_main_html() . "</div>");
if ($my_class->message) {
    $xml .= "\t" . xmlEntry("message", $my_class->message);
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #10
0
ファイル: validate.php プロジェクト: siwiwit/PhreeBooksERP
// +-----------------------------------------------------------------+
// | This program is free software: you can redistribute it and/or   |
// | modify it under the terms of the GNU General Public License as  |
// | published by the Free Software Foundation, either version 3 of  |
// | the License, or any later version.                              |
// |                                                                 |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/phreedom/ajax/validate.php
//
/**************   Check user security   *****************************/
$security_level = validate_ajax_user();
/**************  include page specific files    *********************/
/**************   page specific initialization  *************************/
$xml = NULL;
$user = $_GET['u'];
$pass = $_GET['p'];
$level = $_GET['level'];
$result = $db->Execute("select inactive, admin_pass from " . TABLE_USERS . " where admin_name = '" . $user . "'");
if ($result->RecordCount() != 1 || $result->fields['inactive']) {
    $xml = xmlEntry('result', 'failed');
} elseif (!pw_validate_password($pass, $result->fields['admin_pass'])) {
    $xml = xmlEntry('result', 'failed');
} else {
    $xml = xmlEntry('result', 'validated');
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #11
0
 function Execute($zf_sql, $zf_limit = false, $zf_cache = false, $zf_cachetime = 0)
 {
     global $zc_cache, $messageStack;
     if ($zf_limit) {
         $zf_sql = $zf_sql . ' LIMIT ' . $zf_limit;
     }
     if ($zf_cache and $zc_cache->sql_cache_exists($zf_sql) and !$zc_cache->sql_cache_is_expired($zf_sql, $zf_cachetime)) {
         $obj = new queryFactoryResult();
         $obj->cursor = 0;
         $obj->is_cached = true;
         $obj->sql_query = $zf_sql;
         $zp_result_array = $zc_cache->sql_cache_read($zf_sql);
         $obj->result = $zp_result_array;
         if (sizeof($zp_result_array) > 0) {
             $obj->EOF = false;
             while (list($key, $value) = each($zp_result_array[0])) {
                 $obj->fields[$key] = $value;
             }
             return $obj;
         } else {
             $obj->EOF = true;
         }
     } elseif ($zf_cache) {
         $zc_cache->sql_cache_expire_now($zf_sql);
         $time_start = explode(' ', microtime());
         $obj = new queryFactoryResult();
         $obj->sql_query = $zf_sql;
         if (!$this->db_connected) {
             $this->set_error('0', DB_ERROR_NOT_CONNECTED);
         }
         $zp_db_resource = @mysql_query($zf_sql, $this->link);
         if (!$zp_db_resource) {
             $this->set_error(@mysql_errno(), @mysql_error());
         }
         $obj->resource = $zp_db_resource;
         $obj->cursor = 0;
         $obj->is_cached = true;
         if ($obj->RecordCount() > 0) {
             $obj->EOF = false;
             $zp_ii = 0;
             while (!$obj->EOF) {
                 $zp_result_array = @mysql_fetch_array($zp_db_resource);
                 if ($zp_result_array) {
                     while (list($key, $value) = each($zp_result_array)) {
                         if (!preg_match('/^[0-9]/', $key)) {
                             $obj->result[$zp_ii][$key] = $value;
                         }
                     }
                 } else {
                     $obj->Limit = $zp_ii;
                     $obj->EOF = true;
                 }
                 $zp_ii++;
             }
             while (list($key, $value) = each($obj->result[$obj->cursor])) {
                 if (!preg_match('/^[0-9]/', $key)) {
                     $obj->fields[$key] = $value;
                 }
             }
             $obj->EOF = false;
         } else {
             $obj->EOF = true;
         }
         $zc_cache->sql_cache_store($zf_sql, $obj->result);
         $time_end = explode(' ', microtime());
         $query_time = $time_end[1] + $time_end[0] - $time_start[1] - $time_start[0];
         $this->total_query_time += $query_time;
         $this->count_queries++;
         return $obj;
     } else {
         $time_start = explode(' ', microtime());
         $obj = new queryFactoryResult();
         if (!$this->db_connected) {
             $this->set_error('0', DB_ERROR_NOT_CONNECTED);
         }
         $zp_db_resource = @mysql_query($zf_sql, $this->link);
         if (!$zp_db_resource) {
             if ($_POST['page'] == 'ajax' || $_GET['page'] == 'ajax') {
                 $messageStack->debug("\n\nThe failing sql was: " . $zf_sql);
                 $messageStack->debug("\n\nmySQL returned: " . @mysql_errno($this->link) . ' ' . @mysql_error($this->link));
                 if (defined('FILENAME_DEFAULT')) {
                     $messageStack->write_debug();
                 }
                 echo createXmlHeader() . xmlEntry('error', 'There was a SQL Error: ' . @mysql_error($this->link)) . createXmlFooter();
                 die;
             }
             if (method_exists($messageStack, 'debug')) {
                 $messageStack->debug("\n\nThe failing sql was: " . $zf_sql);
                 $messageStack->debug("\n\nmySQL returned: " . @mysql_errno($this->link) . ' ' . @mysql_error($this->link));
                 if (defined('FILENAME_DEFAULT')) {
                     $messageStack->write_debug();
                     $messageStack->add('The last transaction had a SQL database error.', 'error');
                     gen_redirect(html_href_link(FILENAME_DEFAULT, 'cat=phreedom&page=main&amp;action=crash', 'SSL'));
                 } else {
                     echo str_replace("\n", '<br />', $messageStack->debug_info);
                     die;
                 }
             } else {
                 echo str_replace("\n", '<br />', $messageStack->debug_info);
                 die;
             }
         }
         $obj->resource = $zp_db_resource;
         $obj->cursor = 0;
         if ($obj->RecordCount() > 0) {
             $obj->EOF = false;
             $zp_result_array = @mysql_fetch_array($zp_db_resource);
             if ($zp_result_array) {
                 while (list($key, $value) = each($zp_result_array)) {
                     if (!preg_match('/^[0-9]/', $key)) {
                         $obj->fields[$key] = $value;
                     }
                 }
                 $obj->EOF = false;
             } else {
                 $obj->EOF = true;
             }
         } else {
             $obj->EOF = true;
         }
         $time_end = explode(' ', microtime());
         $query_time = $time_end[1] + $time_end[0] - $time_start[1] - $time_start[0];
         $this->total_query_time += $query_time;
         $this->count_queries++;
         //$messageStack->add("query execution time = $query_time and sql = $zf_sql<br>".chr(13));
         return $obj;
     }
 }
コード例 #12
0
ファイル: parser.php プロジェクト: siwiwit/PhreeBooksERP
 function object_to_xml($params, $multiple = false, $multiple_key = '')
 {
     $output = NULL;
     if (!is_array($params) && !is_object($params)) {
         return;
     }
     foreach ($params as $key => $value) {
         $xml_key = $multiple ? $multiple_key : $key;
         if (is_array($value)) {
             $output .= object_to_xml($value, true, $key);
         } elseif (is_object($value)) {
             $output .= "<" . $xml_key . ">\n" . object_to_xml($value) . "</" . $xml_key . ">\n";
         } else {
             if ($value != '') {
                 $output .= xmlEntry($xml_key, $value);
             }
         }
     }
     return $output;
 }
コード例 #13
0
function PhreebooksExceptionHandler($exception)
{
    global $messageStack;
    if ($_POST['page'] == 'ajax' || $_GET['page'] == 'ajax') {
        echo createXmlHeader() . xmlEntry('error', "Exception: " . $exception->getMessage()) . createXmlFooter();
        die;
    }
    $messageStack->add($exception->getMessage(), 'error');
    $text = date('Y-m-d H:i:s') . " User: "******" Company: " . $_SESSION['company'];
    $text .= " Exception: '" . $exception->getMessage() . "' line " . $exception->getLine() . " in file " . $exception->getFile();
    if (DEBUG) {
        error_log($text . PHP_EOL, 3, DIR_FS_MY_FILES . "/errors.log");
    }
}
コード例 #14
0
$field_list = array();
$query_raw = "select m.id, m.wo_title, m.description, i.image_with_path \n  from " . TABLE_WO_MAIN . " m inner join " . TABLE_INVENTORY . " i on m.sku_id = i.id \n  where m.inactive = '0' and i.id = '" . $iID . "'";
$result = $db->Execute($query_raw);
$id = $result->fields['id'];
$xml .= xmlEntry("WOid", $id);
$xml .= xmlEntry("WOTitle", $result->fields['wo_title']);
$xml .= xmlEntry("WODescription", $result->fields['description']);
if ($result->fields['image_with_path']) {
    // show image if it is defined
    $image = DIR_WS_MY_FILES . $_SESSION['company'] . '/inventory/images/' . $result->fields['image_with_path'];
} else {
    $image = 0;
}
$xml .= xmlEntry("ImageURL", $image);
if ($id) {
    $result = $db->Execute("select * from " . TABLE_WO_STEPS . " where ref_id = '" . $id . "' order by step");
    while (!$result->EOF) {
        $task = $db->Execute("select task_name, description from " . TABLE_WO_TASK . " where id = " . $result->fields['task_id'] . " limit 1");
        $xml .= "<Task>\n";
        $xml .= "\t" . xmlEntry("Step", $result->fields['step']);
        $xml .= "\t" . xmlEntry("Task_id", $result->fields['task_id']);
        $xml .= "\t" . xmlEntry("Task_name", $task->fields['task_name']);
        $xml .= "\t" . xmlEntry("Description", $task->fields['description']);
        $xml .= "</Task>\n";
        $result->MoveNext();
    }
} else {
    $xml .= xmlEntry("Message", 'This SKU does not have a work order to build from!');
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #15
0
        if ($result->RecordCount() > 0) {
            $ajax_text = DOC_CTL_JS_DIR_DELETED_ERROR;
            break;
        }
        // jstree initialization
        $db_config = array("servername" => DB_SERVER_HOST, "username" => DB_SERVER_USERNAME, "password" => DB_SERVER_PASSWORD, "database" => DB_DATABASE);
        if (extension_loaded("mysqli")) {
            require_once DIR_FS_MODULES . "doc_ctl/includes/jstree/_lib/class._database_i.php";
        } else {
            require_once DIR_FS_MODULES . "doc_ctl/includes/jstree/_lib/class._database.php";
        }
        // Tree class
        require_once DIR_FS_MODULES . "doc_ctl/includes/jstree/_lib/class.tree.php";
        $jstree = new json_tree();
        // deleted from database tree
        $_POST['operation'] = $_REQUEST['operation'] = 'remove_node';
        $_POST['id'] = $_REQUEST['id'] = $id;
        $jstree->{'remove_node'}($_REQUEST);
        $id = $doc_details->fields['parent_id'];
        // set the id to the parent to display refreshed page
        $ajax_text = '';
        $xml .= "\t" . xmlEntry("action", 'reload_tree');
        break;
    default:
        die;
}
// put the output together
$xml .= "\t" . xmlEntry("docID", $id);
$xml .= "\t" . xmlEntry("msg", $ajax_text);
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #16
0
$contact_id = db_prepare_input($_GET['contact_id']);
$xml = NULL;
$enc_data = new encryption();
$sql = "select id, hint, enc_value from " . TABLE_DATA_SECURITY . " \r\n\twhere module = 'contacts' and ref_1 = " . $contact_id;
$result = $db->Execute($sql);
while (!$result->EOF) {
    $data = $enc_data->decrypt($_SESSION['admin_encrypt'], $result->fields['enc_value']);
    $fields = explode(':', $data);
    $xml .= "\t<payments>\n";
    $xml .= "\t\t" . xmlEntry("id", $result->fields['id']);
    $xml .= "\t\t" . xmlEntry("name", $fields[0]);
    // will be the name field for credit cards
    $xml .= "\t\t" . xmlEntry("hint", $result->fields['hint']);
    for ($i = 0; $i < sizeof($fields); $i++) {
        $xml .= "\t\t" . xmlEntry("field_" . $i, $fields[$i]);
    }
    $xml .= "\t</payments>\n";
    $result->MoveNext();
}
// error check
if (!$_SESSION['admin_encrypt'] && $result->RecordCount() > 0) {
    // no permission to enter page, return error
    echo createXmlHeader($function_name) . xmlEntry('error', BNK_ERROR_NO_ENCRYPT_KEY) . createXmlFooter();
    die;
}
//put it all together
$str = createXmlHeader($function_name);
$str .= $xml;
$str .= createXmlFooter();
echo $str;
die;
コード例 #17
0
ファイル: phreedom.php プロジェクト: siwiwit/PhreeBooksERP
            if ($results = get_chart_data($fID, $data)) {
                $xml .= xmlEntry('modID', $_GET['modID']);
                $xml .= xmlEntry('type', $results['type']);
                $xml .= xmlEntry('title', $results['title']);
                $xml .= xmlEntry('width', $results['width']);
                $xml .= xmlEntry('height', $results['height']);
                $xml .= xmlEntry('rowCnt', sizeof($results['data']));
                if (sizeof($results['data']) > 0) {
                    foreach ($results['data'] as $value) {
                        $xml .= '<chartData>';
                        $xml .= xmlEntry('string', $value['label']);
                        $xml .= xmlEntry('number', $value['value']);
                        $xml .= '</chartData>';
                    }
                } else {
                    $xml .= xmlEntry('error', 'No data returned from function call!');
                }
            } else {
                $xml .= xmlEntry('error', 'No data returned from function call!');
                break;
            }
        } else {
            $xml .= xmlEntry('error', 'Could not find module function file to process!');
            break;
        }
        break;
    default:
        die;
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #18
0
ファイル: audit.php プロジェクト: siwiwit/PhreeBooksERP
function build_audit_xml($date_from, $date_to, $select)
{
    global $db, $messageStack, $coa_types_list, $currencies;
    $tax_auths = gen_build_tax_auth_array();
    $dates = gen_get_dates($date_from);
    $output = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . chr(10);
    $output .= '<auditfile>' . chr(10);
    $output .= '<header>' . chr(10);
    $output .= xmlEntry('auditfileVersion', 'CLAIR2.00.00', true);
    $output .= xmlEntry('companyID', substr(htmlspecialchars(AUDIT_DEBIT_NUMBER), 0, 20), true);
    $output .= xmlEntry('taxRegistrationNr', substr(htmlspecialchars(TAX_ID), 0, 15), true);
    $output .= xmlEntry('companyName', substr(htmlspecialchars(COMPANY_NAME), 0, 50), true);
    $output .= xmlEntry('companyAddress', substr(htmlspecialchars(COMPANY_ADDRESS1), 0, 50), true);
    $output .= xmlEntry('companyCity', substr(htmlspecialchars(COMPANY_CITY_TOWN), 0, 50), true);
    $output .= xmlEntry('companyPostalCode', substr(htmlspecialchars(COMPANY_POSTAL_CODE), 0, 10), true);
    $output .= xmlEntry('fiscalYear', $dates['ThisYear'], true);
    $output .= xmlEntry('startDate', $date_from, true);
    $output .= xmlEntry('endDate', $date_to, true);
    $output .= xmlEntry('currencyCode', DEFAULT_CURRENCY, true);
    $output .= xmlEntry('dateCreated', date('Y-m-d'), true);
    $output .= xmlEntry('productID', 'Phreebooks', true);
    $output .= xmlEntry('productVersion', 'Phreebooks =' . MODULE_PHREEBOOKS_STATUS . ' audit=' . MODULE_AUDIT_STATUS, true);
    //$output .= xmlEntry('',);
    $output .= '</header>' . chr(10);
    $output .= '<generalLedger>' . chr(10);
    //all general ledger account
    $income_types = array(30, 32, 34);
    //$output .= xmlEntry('taxonomy','',true); //Zie toelichting *)
    $result = $db->Execute("select * from " . TABLE_CHART_OF_ACCOUNTS . " where heading_only = '0'");
    while (!$result->EOF) {
        $temp = $coa_types_list[$result->fields['account_type']]['text'];
        $output .= "\t" . '<ledgerAccount>' . chr(10);
        $output .= "\t" . xmlEntry('accountID', $result->fields['id'], true);
        //generalLedger id
        $output .= "\t" . xmlEntry('accountDesc', substr(htmlspecialchars($result->fields['description']), 0, 50), true);
        //generalLedger description
        $output .= "\t" . xmlEntry('accountType', in_array($result->fields['account_type'], $income_types) ? TEXT_INCOME_STATEMENT : TEXT_BALANCE_SHEET, true);
        //generalLedger Type balance or income
        $output .= "\t" . xmlEntry('leadCode', $result->fields['account_type'], true);
        //gl account type id *)
        $output .= "\t" . xmlEntry('leadDescription', constant($coa_types_list[$result->fields['account_type']]['text']), true);
        //GL account Type description *)
        $output .= "\t" . '</ledgerAccount>' . chr(10);
        $result->MoveNext();
    }
    $output .= '</generalLedger>' . chr(10);
    $output .= '<customersSuppliers>' . chr(10);
    // all contacts
    $contacts = array();
    $result = $db->Execute("select * from " . TABLE_CONTACTS . " where inactive = '0' and type in('v','c') ");
    while (!$result->EOF) {
        $contacts[$result->fields['id']] = $result->fields['short_name'];
        $output .= "\t" . '<customerSupplier>' . chr(10);
        $output .= "\t" . xmlEntry('custSupID', $result->fields['short_name'], true);
        // vendor- of customer id
        $output .= "\t" . xmlEntry('type', $result->fields['type'] == 'v' ? ACT_V_TYPE_NAME : ACT_C_TYPE_NAME, true);
        // type Vendor or customer
        $output .= "\t" . xmlEntry('taxRegistrationNr', htmlspecialchars($result->fields['gov_id_number']), true);
        //tax id
        $output .= "\t" . xmlEntry('taxVerificationDate', $result->fields['gov_id_number_date'], true);
        //tax verification date (not present in phreedom) maybe in custom fields
        $address = $db->Execute("select * from " . TABLE_ADDRESS_BOOK . " where ref_id = '" . $result->fields['id'] . "'");
        while (!$address->EOF) {
            if (substr($address->fields['type'], 1, 2) == 'm') {
                $output .= "\t" . xmlEntry('companyName', htmlspecialchars($address->fields['primary_name']), true);
                //company name
                $output .= "\t" . xmlEntry('contact', htmlspecialchars($address->fields['contact']), true);
                //contact person
                $output .= "\t" . xmlEntry('telephone', htmlspecialchars($address->fields['telephone1']), true);
                //company telephone
                $output .= "\t" . xmlEntry('fax', htmlspecialchars($address->fields['telephone3']), true);
                //company fax
                $output .= "\t" . xmlEntry('email', htmlspecialchars($address->fields['email']), true);
                //company email
                $output .= "\t" . xmlEntry('website', htmlspecialchars($address->fields['website']), true);
                //company URL website
                //company billing address
                $output .= "\t\t" . '<postalAddress>' . chr(10);
                $output .= "\t\t" . xmlEntry('address', substr(htmlspecialchars($address->fields['address1'] . ' ' . $address->fields['address2']), 0, 50), true);
                $output .= "\t\t" . xmlEntry('city', htmlspecialchars($address->fields['city_town']), true);
                $output .= "\t\t" . xmlEntry('postalCode', htmlspecialchars($address->fields['postal_code']), true);
                $output .= "\t\t" . xmlEntry('region', htmlspecialchars($address->fields['state_province']), true);
                $output .= "\t\t" . xmlEntry('country', $address->fields['country_code'], true);
                $output .= "\t\t" . '</postalAddress>' . chr(10);
            } else {
                if (substr($address->fields['type'], 1, 2) == 's') {
                    //company shipping address
                    $output .= "\t\t" . '<streetAddress>' . chr(10);
                    $output .= "\t\t" . xmlEntry('address', substr(htmlspecialchars($address->fields['address1'] . ' ' . $address->fields['address2']), 0, 50), true);
                    $output .= "\t\t" . xmlEntry('city', htmlspecialchars($address->fields['city_town']), true);
                    $output .= "\t\t" . xmlEntry('postalCode', htmlspecialchars($address->fields['postal_code']), true);
                    $output .= "\t\t" . xmlEntry('region', htmlspecialchars($address->fields['state_province']), true);
                    $output .= "\t\t" . xmlEntry('country', $address->fields['country_code'], true);
                    $output .= "\t\t" . '</streetAddress>' . chr(10);
                }
            }
            $address->MoveNext();
        }
        $output .= "\t" . '</customerSupplier>' . chr(10);
        $result->MoveNext();
    }
    $output .= '</customersSuppliers>' . chr(10);
    $output .= '<transactions>' . chr(10);
    // all journal lines.
    if ($select == '1') {
        $where = " and journal_id not in ('3','4','9','10') and waiting = '0' ";
    }
    $totals = $db->Execute("select sum(i.debit_amount) as totalDebit, sum(i.credit_amount) as totalCredit from " . TABLE_JOURNAL_MAIN . " m join " . TABLE_JOURNAL_ITEM . " i on m.id=i.ref_id where m.post_date >= '" . $date_from . "' and m.post_date<='" . $date_to . "'" . $where);
    $result = $db->Execute("select * from " . TABLE_JOURNAL_MAIN . " where post_date >= '" . $date_from . "' and post_date<='" . $date_to . "' " . $where . " order by journal_id ASC");
    $output .= xmlEntry('numberEntries', $result->RecordCount(), true);
    $total_credit = 0;
    $total_credit = 0;
    //$output .= xmlEntry('totalDedit',			$totals->fields['totalDebit']	,true);
    //$output .= xmlEntry('totalCredit',			$totals->fields['totalCredit']	,true);
    //if(number_format($totals->fields['totalDebit'],2) <> number_format($totals->fields['totalCredit'],2)) return false;
    $previous_journal_id = '';
    $output .= "\t" . '<journal>' . chr(10);
    while (!$result->EOF) {
        $line_debit = 0;
        $line_credit = 0;
        if ($previous_journal_id != $result->fields['journal_id']) {
            if ($previous_journal_id != '') {
                $output .= "\t" . '</journal>' . chr(10);
                $output .= "\t" . '<journal>' . chr(10);
            }
            $output .= "\t" . xmlEntry('journalID', $result->fields['journal_id'], true);
            //the journal id
            $output .= "\t" . xmlEntry('description', constant('GEN_ADM_TOOLS_J' . str_pad($result->fields['journal_id'], 2, '0', STR_PAD_LEFT)), true);
            //the journal description
            $output .= "\t" . xmlEntry('type', '', true);
            //type of journal
        }
        $output .= "\t\t" . '<transaction>' . chr(10);
        $output .= "\t\t" . xmlEntry('transactionID', $result->fields['id'], true);
        $output .= "\t\t" . xmlEntry('description', htmlspecialchars($result->fields['description']), true);
        $output .= "\t\t" . xmlEntry('period', $result->fields['period'], true);
        $output .= "\t\t" . xmlEntry('transactionDate', $result->fields['post_date'], true);
        $output .= "\t\t" . xmlEntry('sourceID', $result->fields['admin_id'], true);
        $line = $db->Execute("select id, gl_account, post_date, description, ROUND(debit_amount," . $currencies->currencies[DEFAULT_CURRENCY]['decimal_places'] . ") as debit_amount, ROUND(credit_amount," . $currencies->currencies[DEFAULT_CURRENCY]['decimal_places'] . ") as credit_amount, taxable  from " . TABLE_JOURNAL_ITEM . " where ref_id= '" . $result->fields['id'] . "'");
        while (!$line->EOF) {
            $output .= "\t\t\t" . '<line>' . chr(10);
            $output .= "\t\t\t" . xmlEntry('recordID', $line->fields['id'], true);
            // Uniek regelnummer
            $output .= "\t\t\t" . xmlEntry('accountID', $line->fields['gl_account'], true);
            // Grootboekrekeningcode (zie hiervoor)
            $output .= "\t\t\t" . xmlEntry('custSupID', $contacts[$result->fields['bill_acct_id']], true);
            // Debiteuren- of crediteurennummer (zie hiervoor)
            $output .= "\t\t\t" . xmlEntry('documentID', $result->fields['purchase_invoice_id'], true);
            // Boekstuknummer (verwijzing naar brondocument)
            $output .= "\t\t\t" . xmlEntry('effectiveDate', $line->fields['post_date'], true);
            // Mutatiedatum *)
            $output .= "\t\t\t" . xmlEntry('description', htmlspecialchars($line->fields['description']), true);
            // Omschrijving
            $line_debit += $line->fields['debit_amount'];
            $output .= "\t\t\t" . xmlEntry('debitAmount', $line->fields['debit_amount'], true);
            // Debetbedrag in lokale valuta (zie hiervoor)
            $line_credit += $line->fields['credit_amount'];
            $output .= "\t\t\t" . xmlEntry('creditAmount', $line->fields['credit_amount'], true);
            // Creditbedrag in lokale valuta (zie hiervoor)
            //				$output .= "\t\t\t" . xmlEntry('costDesc',					$line->fields['']						,true);// Kostenplaats
            //				$output .= "\t\t\t" . xmlEntry('productDesc',				$line->fields['']						,true);// Kostendrager
            $output .= "\t\t\t" . xmlEntry('projectDesc', $line->fields['project_id'], true);
            // Projectcode (i.p.v. kostensoort)
            //De BTW (vat) wordt als volgt uitgesplitst:
            if ($line->fields['taxable'] != '0') {
                $output .= "\t\t\t\t" . '<vat>' . chr(10);
                $output .= "\t\t\t\t" . xmlEntry('vatCode', $line->fields['taxable'], true);
                // BTW-code (leeg betekent geen BTW)
                $output .= "\t\t\t\t" . xmlEntry('vatPercentage', $tax_auths[$line->fields['taxable']]['tax_rate'] / 100, true);
                // BTW-percentage, of in plaats daarvan BTW-bedrag
                //					$output .= "\t\t\t\t" . xmlEntry('vatAmount',				$line->fields['']				,true);// BTW-bedrag (bij bijzondere transacties)
                $output .= "\t\t\t\t" . '</vat>' . chr(10);
            }
            //De valuta (currency) wordt vervolgens als volgt weergegeven:
            if ($result->fields['currencies_code'] != DEFAULT_CURRENCY) {
                $output .= "\t\t\t\t" . '<currency>' . chr(10);
                $output .= "\t\t\t\t" . xmlEntry('currencyCode', $result->fields['currencies_code'], true);
                // Valutacode (leeg betekent lokale valuta)
                $output .= "\t\t\t\t" . xmlEntry('currencyDebitAmount', $result->fields['currencies_value'], true);
                // Debetbedrag in vreemde valuta (i.p.v. koers)
                //					$output .= "\t\t\t\t" . xmlEntry('currencyCreditAmount',	$result->fields['currencies_value']		,true);// Creditbedrag in vreemde valuta (i.p.v. koers)
                $output .= "\t\t\t\t" . '</currency>' . chr(10);
            }
            $output .= "\t\t\t" . '</line>' . chr(10);
            $previous_journal_id = $result->fields['journal_id'];
            $line->MoveNext();
        }
        if ((double) (string) $line_debit != (double) (string) $line_credit) {
            if (DEBUG) {
                $output .= '<lineError>' . chr(10);
                $output .= xmlEntry('recordID', $result->fields['id'], true);
                // Uniek regelnummer
                $output .= xmlEntry('lineDebit', $line_debit, true);
                $output .= xmlEntry('lineCredit', $line_credit, true);
                $output .= '</lineError>' . chr(10);
            }
            $error = $messageStack->add('The journal with id ' . $result->fields['id'] . ' is out of balance total Debit = ' . $line_debit . ' total Credit = ' . $line_credit, 'error');
        }
        $total_debit += $line_debit;
        $total_credit += $line_credit;
        $output .= "\t\t" . '</transaction>' . chr(10);
        $result->MoveNext();
    }
    $output .= "\t" . '</journal>' . chr(10);
    if ((double) (string) $total_debit != (double) (string) $total_credit) {
        $error = $messageStack->add('Totals are out of balance total Debit = ' . $total_debit . ' total Credit = ' . $total_credit, 'error');
    }
    $output .= xmlEntry('totalDedit', $total_debit, true);
    $output .= xmlEntry('totalCredit', $total_credit, true);
    $output .= '</transactions>' . chr(10);
    $output .= '</auditfile>' . chr(10);
    if ($error) {
        return false;
    }
    return $output;
}
コード例 #19
0
/**************  include page specific files    *********************/
/**************   page specific initialization  *************************/
$id = $_GET['id'];
$ajax_text = '';
if (!isset($_GET['id'])) {
    die;
}
$dir_details = $db->Execute("select * from " . TABLE_PHREEFORM . " where id = '" . $id . "'");
switch ($_REQUEST['action']) {
    case 'go_up':
        $id = $dir_details->fields['parent_id'];
        // set the id to the parent to display refreshed page
        break;
    case 'delete':
        $result = $db->Execute("select id from " . TABLE_PHREEFORM . " where parent_id = '" . $id . "' limit 1");
        if ($result->RecordCount() > 0) {
            $ajax_text = DOC_CTL_DIR_NOT_EMPTY;
        } else {
            $db->Execute("delete from " . TABLE_PHREEFORM . " where id = '" . $id . "'");
            $id = $dir_details->fields['parent_id'];
            // set the id to the parent to display refreshed page
            $ajax_text = DOC_CTL_DIR_DELETED;
        }
        break;
    default:
        die;
}
$xml .= "\t" . xmlEntry("docID", $id);
$xml .= "\t" . xmlEntry("message", $ajax_text);
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #20
0
// +-----------------------------------------------------------------+
//  Path: /modules/phreebooks/ajax/load_gl_data.php
//
/**************   Check user security   *****************************/
$xml = NULL;
$security_level = validate_ajax_user();
/**************   include page specific files   *********************/
/**************   page specific initialization  *********************/
$gl_acct = db_prepare_input($_GET['glAcct']);
$fy = db_prepare_input($_GET['fy']);
$error = false;
$result = $db->Execute("select period, start_date, end_date from " . TABLE_ACCOUNTING_PERIODS . " \n\twhere fiscal_year = '" . ($fy - 1) . "' order by period");
if ($result->RecordCount() == 0) {
    // no earlier data found
    echo createXmlHeader() . xmlEntry('error', ERROR_NO_GL_ACCT_INFO) . createXmlFooter();
    die;
}
$periods = array();
while (!$result->EOF) {
    $periods[] = $result->fields['period'];
    $result->MoveNext();
}
$result = $db->Execute("select debit_amount - credit_amount as balance from " . TABLE_CHART_OF_ACCOUNTS_HISTORY . " \n\twhere account_id = '" . $gl_acct . "' and period in (" . implode(',', $periods) . ")");
while (!$result->EOF) {
    $xml .= "\t<items>\n";
    $xml .= "\t\t" . xmlEntry('balance', $currencies->format($result->fields['balance']));
    $xml .= "\t</items>\n";
    $result->MoveNext();
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #21
0
ファイル: box_load.php プロジェクト: siwiwit/PhreeBooksERP
}
if ($rID) {
    $report = get_report_details($rID);
}
$kFonts = gen_build_pull_down($Fonts);
$kFontSizes = gen_build_pull_down($FontSizes);
$kLineSizes = gen_build_pull_down($LineSizes);
$kFontColors = gen_build_pull_down($FontColors);
$kFontAlign = gen_build_pull_down($FontAlign);
$cFields = CreateCompanyArray();
$fFields = crit_build_pull_down($CritChoices);
$kFields = CreateSpecialDropDown($report);
$kTblFields = CreateFieldTblDropDown($report);
$kTables = CreateTableList($report);
$nyChoice = gen_build_pull_down($NoYesChoice);
$pFields = gen_build_pull_down($FormProcessing);
$tProcessing = gen_build_pull_down($TextProcessing);
if (!$type) {
    // use the first type of the FormEntries array since it will be shown first with a new line
    $temp = array_keys($FormEntries);
    $type = array_shift($temp);
}
$properties = new objectInfo();
$properties->type = $type;
$output = box_build($properties, $rowID);
$xml .= xmlEntry("rowID", $rowID);
$xml .= xmlEntry("html", $output);
//$xml .= xmlEntry("debug", 'sizeof kFields= ' . sizeof($kFields) . ' and rowID = ' . $rowID);
$xml .= xmlEntry("message", 'Success type = ' . $type . ' and html length = ' . strlen($output));
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #22
0
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/contacts/ajax/load_contact_info.php
//
/**************   Check user security   *****************************/
$security_level = validate_ajax_user();
/**************  include page specific files    *********************/
/**************   page specific initialization  *************************/
$guess = db_prepare_input($_GET['guess']);
$xml = NULL;
if (!$guess) {
    die;
}
$search_fields = array('a.primary_name', 'a.contact', 'a.telephone1', 'a.telephone2', 'a.telephone4', 'a.city_town', 'a.postal_code', 'c.id', 'c.short_name');
$search = ' and (' . implode(' like \'%' . $guess . '%\' or ', $search_fields) . ' like \'%' . $guess . '%\')';
$field_list = array('c.id', 'c.short_name', 'a.primary_name');
$query_raw = "select " . implode(', ', $field_list) . " \n\tfrom " . TABLE_CONTACTS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.id = a.ref_id \n\twhere a.type in ('cm', 'vm')" . $search;
$result = $db->Execute($query_raw);
$xml .= xmlEntry("guess", $guess);
while (!$result->EOF) {
    $xml .= "\t<guesses>\n";
    $xml .= "\t" . xmlEntry("id", $result->fields['id']);
    $xml .= "\t" . xmlEntry("guess", $result->fields['short_name'] . ' - ' . $result->fields['primary_name']);
    $xml .= "\t</guesses>\n";
    $result->MoveNext();
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #23
0
ファイル: validate_db.php プロジェクト: siwiwit/PhreeBooksERP
$tables[] = $_GET['table1'];
while (true) {
    if (!isset($_GET['table' . $i])) {
        break;
    }
    $joinopt = isset($_GET['joinopt' . $i]) ? $_GET['joinopt' . $i] : 'JOIN';
    $strTable .= ' ' . $joinopt . ' ' . DB_PREFIX . $_GET['table' . $i] . ' on ' . $_GET['table' . $i . 'criteria'];
    $tables[] = $_GET['table' . $i];
    $i++;
    if ($runaway++ > 100) {
        echo createXmlHeader() . xmlEntry('error', 'Runaway counter expired.') . createXmlFooter();
        die;
    }
}
foreach ($tables as $table) {
    // prefix the criteria
    $strTable = str_replace($table . '.', DB_PREFIX . $table . '.', $strTable);
}
$sql = "select * from " . $strTable . " limit 1";
$result = $db->Execute_return_error($sql);
// if we have a row, sql was valid
if ($db->error_number) {
    $message = sprintf(PHREEFORM_AJAX_BAD_DB_REFERENCE, $db->error_number . ' - ' . $db->error_text, $sql);
} elseif ($result->RecordCount() == 0) {
    // no rows were returned, could be no data yet so just warn and continue
    $message = PHREEFORM_AJAX_NO_TABLE_DATA;
} else {
    $message = PHREEFORM_AJAX_DB_SUCCESS;
}
echo createXmlHeader() . xmlEntry("message", $message) . createXmlFooter();
die;
コード例 #24
0
ファイル: save_main.php プロジェクト: siwiwit/PhreeBooksERP
                // if it is a array then it is not a sequential report
                // fetch the receipt and prepare to print
                $receipt_data = str_replace("\r", "", addslashes($output));
                // for javascript multi-line
                foreach (explode("\n", $receipt_data) as $value) {
                    if (!empty($value)) {
                        $xml .= "<receipt_data>\n";
                        $xml .= "\t" . xmlEntry("line", $value);
                        $xml .= "</receipt_data>\n";
                    }
                }
            }
        }
    }
}
$xml .= "\t" . xmlEntry("action", $_REQUEST['action']);
$xml .= "\t" . xmlEntry("open_cash_drawer", $order->opendrawer);
if (!$error) {
    $xml .= "\t" . xmlEntry("order_id", $order->id);
}
if ($error) {
    $xml .= "\t" . xmlEntry("error", $error);
}
if ($massage) {
    $xml .= "\t" . xmlEntry("massage", $massage);
}
if ($order->errormsg) {
    $xml .= "\t" . xmlEntry("error", $order->errormsg);
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #25
0
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// |                                                                 |
// | The license that is bundled with this package is located in the |
// | file: /doc/manual/ch01-Introduction/license.html.               |
// | If not, see http://www.gnu.org/licenses/                        |
// +-----------------------------------------------------------------+
//  Path: /modules/banking/ajax/acct_balance.php
//
/**************   Check user security   *****************************/
// None
/**************  include page specific files    *********************/
require DIR_FS_MODULES . 'banking/functions/banking.php';
/**************   page specific initialization  *************************/
$gl_acct_id = $_GET['gl_acct_id'] ? db_prepare_input($_GET['gl_acct_id']) : AP_PURCHASE_INVOICE_ACCOUNT;
$post_date = $_GET['post_date'] ? gen_db_date_short($_GET['post_date']) : date('Y-m-d', time());
$period = gen_calculate_period($post_date);
if (!$period) {
    // bad post_date was submitted
    $post_date = date('Y-m-d', time());
    $period = 0;
}
$xml = xmlEntry("value", load_cash_acct_balance($post_date, $gl_acct_id, $period));
// error check
//put it all together
$str = createXmlHeader('acctbal');
$str .= $xml;
$str .= createXmlFooter();
echo $str;
die;
コード例 #26
0
ファイル: contacts.php プロジェクト: siwiwit/PhreeBooksERP
            }
            // make sure year is 4 digits
            $xml .= "<PaymentMethod>\n";
            $xml .= xmlEntry("payment_id", $result->fields['id']);
            $xml .= xmlEntry("payment_hint", $result->fields['hint']);
            for ($i = 0; $i < sizeof($fields); $i++) {
                $xml .= xmlEntry("field_" . $i, $fields[$i]);
            }
            $xml .= "</PaymentMethod>\n";
        }
        break;
    case 'rm_payment':
        $id = $_GET['pID'];
        $db->Execute("delete from " . TABLE_DATA_SECURITY . " where id = {$id}");
        $xml .= xmlEntry('payment_id', $id);
        $message[] = 'The record was successfully deleted!';
        break;
    case 'rm_crm':
        $id = $_GET['nID'];
        $db->Execute("delete from " . TABLE_CONTACTS_LOG . " where log_id = {$id}");
        $xml .= xmlEntry('crm_id', $id);
        $message[] = 'The record was successfully deleted!';
        break;
    default:
        die;
}
if (sizeof($message) > 0) {
    $xml .= xmlEntry('message', implode("\n", $message));
}
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #27
0
switch ($transaction->type) {
    case 'cash_in':
        $credit_amount = '';
        $debit_amount = $currencies->clean_value(db_prepare_input($_POST['ot_amount']), $order->currencies_code) / $order->currencies_value;
        $tills->adjust_balance($debit_amount);
        break;
    default:
        $debit_amount = '';
        $credit_amount = $currencies->clean_value(db_prepare_input($_POST['ot_amount']), $order->currencies_code) / $order->currencies_value;
        $tills->adjust_balance(-$credit_amount);
}
$order->journal_rows[] = array('id' => '', 'qty' => '1', 'gl_type' => 'ttl', 'gl_account' => $tills->gl_acct_id, 'description' => db_prepare_input($_POST['ot_desc']) == '' ? $transaction->description : db_prepare_input($_POST['ot_desc']), 'debit_amount' => $debit_amount, 'credit_amount' => $credit_amount, 'post_date' => date('Y-m-d'));
if ($transaction->type == 'expenses') {
    $tax = $currencies->clean_value(db_prepare_input($_POST['ot_tax']), $order->currencies_code) / $order->currencies_value;
    $tax_auths = gen_build_tax_auth_array();
    $order->journal_rows[] = array('id' => '', 'qty' => '1', 'gl_type' => 'tax', 'gl_account' => $tax_auths[$_POST['ot_rate']]['account_id'], 'description' => $transaction->description, 'taxable' => db_prepare_input($_POST['ot_rate']), 'debit_amount' => $tax, 'credit_amount' => $debit_amount, 'post_date' => date('Y-m-d'));
    $order->journal_rows[] = array('id' => '', 'qty' => '1', 'gl_type' => 'sos', 'gl_account' => $transaction->gl_acct_id, 'description' => $transaction->description, 'debit_amount' => $credit_amount - $tax, 'credit_amount' => $debit_amount, 'post_date' => date('Y-m-d'));
} else {
    $order->journal_rows[] = array('id' => '', 'qty' => '1', 'gl_type' => 'sos', 'gl_account' => $transaction->gl_acct_id, 'description' => $transaction->description, 'debit_amount' => $credit_amount, 'credit_amount' => $debit_amount, 'post_date' => date('Y-m-d'));
}
$error = $order->Post('insert', true);
if (DEBUG) {
    $messageStack->write_debug();
}
$xml .= "\t" . xmlEntry("action", $_REQUEST['action']);
if ($error) {
    $xml .= "\t" . xmlEntry("error", $error);
}
//if ($order->errormsg)	$xml .= "\t" . xmlEntry("error", 			$order->errormsg);
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #28
0
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/phreeform/ajax/load_email_msg.php
//
/**************   Check user security   *****************************/
$security_level = validate_ajax_user(SECURITY_ID_PHREEFORM);
/**************  include page specific files    *********************/
require_once DIR_FS_MODULES . 'phreeform/defaults.php';
require_once DIR_FS_MODULES . 'phreeform/functions/phreeform.php';
/**************   page specific initialization  *************************/
$rID = $_GET['rID'];
if (!$rID) {
    die;
}
$result = $db->Execute("select doc_title from " . TABLE_PHREEFORM . " where id = '" . $rID . "'");
$subject = $result->fields['doc_title'] . ' ' . TEXT_FROM . ' ' . COMPANY_NAME;
$report = get_report_details($rID);
if (!$report->emailmessage) {
    $text = sprintf(PHREEFORM_EMAIL_BODY, $result->fields['doc_title'], COMPANY_NAME);
} else {
    $text = TextReplace($report->emailmessage);
}
$xml = '';
$xml .= "\t" . xmlEntry("subject", $subject);
$xml .= "\t" . xmlEntry("text", $text);
// error check
echo createXmlHeader() . $xml . createXmlFooter();
die;
コード例 #29
0
ファイル: zencart.php プロジェクト: siwiwit/PhreeBooksERP
 function buildConfirmXML()
 {
     global $db, $messageStack;
     $methods = $this->loadShippingMethods();
     $this->strXML = '<?xml version="1.0" encoding="UTF-8" ?>' . chr(10);
     $this->strXML .= '<Request>' . chr(10);
     $this->strXML .= xmlEntry('Version', '2.00');
     $this->strXML .= xmlEntry('UserName', ZENCART_USERNAME);
     $this->strXML .= xmlEntry('UserPassword', ZENCART_PASSWORD);
     $this->strXML .= xmlEntry('Language', $_SESSION['language']);
     $this->strXML .= xmlEntry('Operation', 'ShipConfirm');
     $this->strXML .= xmlEntry('Action', 'Confirm');
     $this->strXML .= xmlEntry('Reference', 'Order Ship Confirmation');
     // fetch every shipment for the given post_date
     $result = $db->Execute("select ref_id, carrier, method, tracking_id from " . TABLE_SHIPPING_LOG . " \n\t  where ship_date like '" . $this->post_date . " %'");
     if ($result->RecordCount() == 0) {
         $messageStack->add(ZENCART_ERROR_CONFRIM_NO_DATA, 'caution');
         return false;
     }
     // foreach shipment, fetch the PO Number (it is the ZenCart order number)
     while (!$result->EOF) {
         if (strpos($result->fields['ref_id'], '-') !== false) {
             $purchase_invoice_id = substr($result->fields['ref_id'], 0, strpos($result->fields['ref_id'], '-'));
         } else {
             $purchase_invoice_id = $result->fields['ref_id'];
         }
         $details = $db->Execute("select so_po_ref_id from " . TABLE_JOURNAL_MAIN . " \n\t    where journal_id = 12 and purchase_invoice_id = '" . $purchase_invoice_id . "' \n\t\torder by id desc limit 1");
         // check to see if the order is complete
         if ($details->fields['so_po_ref_id']) {
             $details = $db->Execute("select closed, purchase_invoice_id from " . TABLE_JOURNAL_MAIN . " \n\t        where id = '" . $details->fields['so_po_ref_id'] . "'");
             if ($details->RecordCount() == 1) {
                 $message = sprintf(ZENCART_CONFIRM_MESSAGE, $this->post_date, $methods[$result->fields['carrier']]['title'], $methods[$result->fields['carrier']][$result->fields['method']], $result->fields['tracking_id']);
                 $this->strXML .= '<Order>' . chr(10);
                 $this->strXML .= xmlEntry('ID', $details->fields['purchase_invoice_id']);
                 $this->strXML .= xmlEntry('Status', $details->fields['closed'] ? ZENCART_STATUS_CONFIRM_ID : ZENCART_STATUS_PARTIAL_ID);
                 $this->strXML .= xmlEntry('Message', $message);
                 $this->strXML .= '</Order>' . chr(10);
             }
         }
         $result->MoveNext();
     }
     $this->strXML .= '</Request>' . chr(10);
     return true;
 }
コード例 #30
0
ファイル: index.php プロジェクト: siwiwit/PhreeBooksERP
    $module = $_GET['module'];
} else {
    $module = 'phreedom';
}
if (isset($_POST['page'])) {
    $page = $_POST['page'];
} elseif (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 'main';
}
$user_validated = false;
require_once 'includes/application_top.php';
if (!$user_validated) {
    if ($page == 'ajax') {
        echo createXmlHeader() . xmlEntry('error', SORRY_YOU_ARE_LOGGED_OUT) . createXmlFooter();
        die;
    }
    $_SESSION['pb_cat'] = isset($_GET['module']) ? $_GET['module'] : '';
    $_SESSION['pb_module'] = isset($_GET['page']) ? $_GET['page'] : '';
    $_SESSION['pb_jID'] = isset($_GET['jID']) ? $_GET['jID'] : '';
    $_SESSION['pb_type'] = isset($_GET['type']) ? $_GET['type'] : '';
    $module = 'phreedom';
    $page = 'main';
    if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'validate') {
        $_REQUEST['action'] = 'login';
    }
} else {
    unset($_SESSION['pb_cat']);
    unset($_SESSION['pb_module']);
    unset($_SESSION['pb_jID']);