Пример #1
0
define('JOURNAL_ID', (int) $_GET['jID']);
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/popup_delivery/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        $i = 1;
        while (true) {
            if (!isset($_POST['eta_date_' . $i])) {
                break;
            }
            if ($_POST['eta_date_' . $i] != '') {
                $new_date = gen_db_date($_POST['eta_date_' . $i]);
                $rID = $_POST['id_' . $i];
                $db->Execute("update " . TABLE_JOURNAL_ITEM . " set date_1 = '" . $new_date . "' where id = " . $rID);
            }
            $i++;
        }
        gen_add_audit_log(ORD_DELIVERY_DATES . TEXT_EDIT, $result->fields['purchase_invoice_id']);
        break;
    default:
}
/*****************   prepare to display templates  *************************/
$gl_type = JOURNAL_ID == 4 || JOURNAL_ID == 6 ? 'poo' : 'soo';
$sql = " select m.purchase_invoice_id, i.id, i.sku, i.qty, i.description, i.date_1 \n\tfrom " . TABLE_JOURNAL_MAIN . " m inner join " . TABLE_JOURNAL_ITEM . " i on m.id = i.ref_id \n\twhere i.ref_id = " . $oID . " and i.gl_type = '" . $gl_type . "'";
$ordr_items = $db->Execute($sql);
$num_items = $ordr_items->RecordCount();
$include_header = false;
Пример #2
0
define('POPUP_FORM_TYPE', 'bnk:chk');
define('AUDIT_LOG_DESC', ORD_TEXT_20_WINDOW_TITLE);
$post_success = false;
$error = false;
$post_date = isset($_REQUEST['post_date']) ? gen_db_date($_REQUEST['post_date']) : date('Y-m-d', time());
$_GET['post_date'] = $post_date;
$period = gen_calculate_period($post_date);
if (!$period) {
    // bad post_date was submitted
    $_REQUEST['action'] = '';
    $post_date = date('Y-m-d', time());
    $period = 0;
}
$invoice_date = isset($_REQUEST['invoice_date']) ? gen_db_date($_REQUEST['invoice_date']) : date('Y-m-d', time());
$_GET['invoice_date'] = $invoice_date;
$discount_date = isset($_REQUEST['discount_date']) ? gen_db_date($_REQUEST['discount_date']) : date('Y-m-d', time());
$_GET['discount_date'] = $discount_date;
$gl_acct_id = isset($_REQUEST['gl_acct_id']) ? db_prepare_input($_REQUEST['gl_acct_id']) : AP_PURCHASE_INVOICE_ACCOUNT;
$_GET['gl_acct_id'] = $gl_acct_id;
$gl_disc_acct_id = isset($_REQUEST['gl_disc_acct_id']) ? db_prepare_input($_REQUEST['gl_disc_acct_id']) : AP_DISCOUNT_PURCHASE_ACCOUNT;
$_GET['gl_disc_acct_id'] = $gl_disc_acct_id;
$purch_order_id = db_prepare_input($_POST['purch_order_id']);
// reference text
$purchase_invoice_id = db_prepare_input($_POST['purchase_invoice_id']);
// PhreeBooks starting check number
if (!$purchase_invoice_id) {
    $result = $db->Execute("select next_check_num from " . TABLE_CURRENT_STATUS);
    $purchase_invoice_id = $result->fields['next_check_num'];
}
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/bills/extra_actions.php';
// +-----------------------------------------------------------------+
//  Path: /modules/zencart/pages/main/pre_process.php
//
$security_level = validate_user(SECURITY_ID_ZENCART_INTERFACE);
/**************  include page specific files    *********************/
gen_pull_language('shipping');
gen_pull_language('inventory');
require_once DIR_FS_MODULES . 'inventory/defaults.php';
require_once DIR_FS_MODULES . 'shipping/defaults.php';
require_once DIR_FS_WORKING . 'functions/zencart.php';
require_once DIR_FS_MODULES . 'inventory/functions/inventory.php';
require_once DIR_FS_WORKING . 'classes/zencart.php';
require_once DIR_FS_WORKING . 'classes/bulk_upload.php';
/**************   page specific initialization  *************************/
$error = false;
$ship_date = $_POST['ship_date'] ? gen_db_date($_POST['ship_date']) : date('Y-m-d');
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'custom/zencart/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'upload':
        $upXML = new zencart();
        $id = db_prepare_input($_POST['rowSeq']);
        if ($upXML->submitXML($id, 'product_ul')) {
            gen_add_audit_log(ZENCART_UPLOAD_PRODUCT, $upXML->sku);
        }
        break;
    case 'bulkupload':
Пример #4
0
 function processCSV($upload_name = '')
 {
     global $coa, $db, $currencies, $messageStack;
     if (!$this->cyberParse($upload_name)) {
         return false;
     }
     // parse the submitted string, check for csv errors
     //echo 'parsed string = '; print_r($this->records); echo '<br />';
     $row_id = 0;
     while ($row_id < count($this->records)) {
         $current_order = $this->records[$row_id];
         // pre-process and check for errors
         if (!in_array($current_order['gl_acct'], $coa) || !in_array($current_order['inv_gl_acct'], $coa)) {
             $messageStack->add(GL_BEG_BAL_ERROR_1 . ($row_id + 1), 'error');
             return false;
         }
         if (!$current_order['order_id']) {
             switch (JOURNAL_ID) {
                 case 6:
                     $messageStack->add(sprintf(GL_BEG_BAL_ERROR_2, $row_id + 1), 'caution');
                     $this->records[$row_id]['waiting'] = 1;
                     break;
                 default:
                     $messageStack->add(GL_BEG_BAL_ERROR_3 . ($row_id + 1), 'error');
                     return false;
             }
         }
         $this->records[$row_id]['post_date'] = gen_db_date($current_order['post_date']);
         // from mm/dd/yyyy to YYYY-MM-DD
         if (!validate_db_date($this->records[$row_id]['post_date'])) {
             $messageStack->add(sprintf(GL_BEG_BAL_ERROR_4, $row_id + 1) . DATE_FORMAT, 'error');
             return false;
         }
         switch (JOURNAL_ID) {
             // total amount is calculated for PO/SOs
             case 6:
             case 12:
                 $this->records[$row_id]['total_amount'] = $currencies->clean_value($current_order['total_amount']);
                 if ($current_order['total_amount'] == 0) {
                     $messageStack->add(GL_BEG_BAL_ERROR_5 . ($row_id + 1), 'caution');
                     $this->records[$row_id]['skip_this_record'] = 1;
                 }
             default:
         }
         // TBD check for duplicate so/po/invoice numbers
         $row_id++;
     }
     if (is_array($this->records)) {
         // *************** START TRANSACTION *************************
         $db->transStart();
         if (!$this->submitJournalEntry()) {
             $db->transRollback();
             if (DEBUG) {
                 $messageStack->write_debug();
             }
             return false;
         }
         $db->transCommit();
         // post the chart of account values
         if (DEBUG) {
             $messageStack->write_debug();
         }
         // *************** END TRANSACTION *************************
     }
     return true;
 }
Пример #5
0
define('JOURNAL_ID', '19');
/**************  include page specific files    *********************/
require_once DIR_FS_MODULES . 'phreebooks/classes/gen_ledger.php';
if (file_exists(DIR_FS_MODULES . 'phreepos/custom/classes/journal/journal_' . JOURNAL_ID . '.php')) {
    require_once DIR_FS_MODULES . 'phreepos/custom/classes/journal/journal_' . JOURNAL_ID . '.php';
} else {
    require_once DIR_FS_MODULES . 'phreepos/classes/journal/journal_' . JOURNAL_ID . '.php';
    // is needed here for the defining of the class and retriving the security_token
}
$class = 'journal_' . JOURNAL_ID;
/**************   page specific initialization  *************************/
define('POPUP_FORM_TYPE', 'pos:rcpt');
$error = false;
history_filter('pos_mgr');
/***************   hook for custom actions  ***************************/
$date = gen_db_date($_REQUEST['search_date']);
$acct_period = $_REQUEST['search_period'];
$oid = isset($_GET['oID']) ? $_GET['oID'] : false;
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/pos_mgr/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'delete':
        $id = db_prepare_input($_POST['rowSeq']);
        if ($id) {
            $delOrd = new $class($id);
            if ($_SESSION['admin_prefs']['restrict_period'] && $delOrd->period != CURRENT_ACCOUNTING_PERIOD) {
                $error = $messageStack->add(ORD_ERROR_DEL_NOT_CUR_PERIOD, 'error');
//
$security_level = validate_user(SECURITY_RMA_MGT);
/**************  include page specific files    *********************/
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_MODULES . 'inventory/defaults.php';
/**************   page specific initialization  *************************/
if (!isset($_REQUEST['list'])) {
    $_REQUEST['list'] = 1;
}
$error = false;
$processed = false;
$cInfo = new objectInfo(array());
$creation_date = isset($_POST['creation_date']) ? gen_db_date($_POST['creation_date']) : date('Y-m-d');
$receive_date = isset($_POST['receive_date']) ? gen_db_date($_POST['receive_date']) : '';
$closed_date = isset($_POST['closed_date']) ? gen_db_date($_POST['closed_date']) : '';
$invoice_date = isset($_POST['invoice_date']) ? gen_db_date($_POST['invoice_date']) : '';
history_filter();
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        if ($security_level < 2) {
            $messageStack->add_session(ERROR_NO_PERMISSION, 'error');
            gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
            break;
        }
        $id = db_prepare_input($_POST['id']);
Пример #7
0
        foreach ($status_fields as $status_field) {
            if (db_prepare_input($_POST[$status_field]) != $status_values->fields[$status_field]) {
                $sequence_array[$status_field] = db_prepare_input($_POST[$status_field]);
                $status_values->fields[$status_field] = $sequence_array[$status_field];
            }
        }
        // post them to the current_status table
        if (sizeof($sequence_array) > 0) {
            $result = db_perform(TABLE_CURRENT_STATUS, $sequence_array, 'update', 'id > 0');
            $messageStack->add(GEN_ADM_TOOLS_POST_SEQ_SUCCESS, 'success');
            gen_add_audit_log(GEN_ADM_TOOLS_AUDIT_LOG_SEQ);
        }
        $default_tab_id = 'tools';
        break;
    case 'clean_security':
        $clean_date = gen_db_date($_POST['clean_date']);
        if (!$clean_date) {
            break;
        }
        $result = $db->Execute("delete from " . TABLE_DATA_SECURITY . " where exp_date < '" . $clean_date . "'");
        $messageStack->add(sprintf(TEXT_CLEAN_SECURITY_SUCCESS, $result->AffectedRows()), 'success');
        break;
    default:
}
/*****************   prepare to display templates  *************************/
// build some general pull down arrays
$sel_yes_no = array(array('id' => '0', 'text' => TEXT_NO), array('id' => '1', 'text' => TEXT_YES));
$sel_transport = array(array('id' => 'PHP', 'text' => 'PHP'), array('id' => 'sendmail', 'text' => 'sendmail'), array('id' => 'sendmail-f', 'text' => 'sendmail-f'), array('id' => 'smtp', 'text' => 'smtp'), array('id' => 'smtpauth', 'text' => 'smtpauth'), array('id' => 'Qmail', 'text' => 'Qmail'));
$sel_linefeed = array(array('id' => 'LF', 'text' => 'LF'), array('id' => 'CRLF', 'text' => 'CRLF'));
$sel_format = array(array('id' => 'TEXT', 'text' => 'TEXT'), array('id' => 'HTML', 'text' => 'HTML'));
$sel_order_lines = array(array('id' => '0', 'text' => TEXT_DOUBLE_MODE), array('id' => '1', 'text' => TEXT_SINGLE_MODE));
Пример #8
0
$period = CURRENT_ACCOUNTING_PERIOD;
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/admin_tools/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'update':
        validate_security($security_level, 3);
        // propagate into remaining fiscal years if the last date was changed.
        $fy_array = array();
        $x = 0;
        while (isset($_POST['start_' . $x])) {
            $update_period = db_prepare_input($_POST['per_' . $x]);
            $fy_array = array('start_date' => gen_db_date(db_prepare_input($_POST['start_' . $x])), 'end_date' => gen_db_date(db_prepare_input($_POST['end_' . $x])));
            db_perform(TABLE_ACCOUNTING_PERIODS, $fy_array, 'update', 'period = ' . (int) $update_period);
            $x++;
        }
        // see if there is a disconnect between fiscal years
        $next_period = $update_period + 1;
        $next_start_date = date('Y-m-d', strtotime($fy_array['end_date']) + 60 * 60 * 24);
        $result = $db->Execute("select start_date from " . TABLE_ACCOUNTING_PERIODS . " where period = " . $next_period);
        if ($result->RecordCount() > 0) {
            // next FY exists, check it
            if ($next_start_date != $result->fields['start_date']) {
                $fy_array = array('start_date' => $next_start_date);
                db_perform(TABLE_ACCOUNTING_PERIODS, $fy_array, 'update', 'period = ' . (int) $next_period);
                $messageStack->add(GL_ERROR_FISCAL_YEAR_SEQ, 'caution');
                $fy++;
            }
Пример #9
0
$creation_date = $_POST['creation_date'] ? gen_db_date($_POST['creation_date']) : date('Y-m-d');
history_filter();
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        validate_security($security_level, 2);
        $id = db_prepare_input($_POST['rowSeq']);
        // check for errors, process
        // write the data
        if (!$error) {
            $sql_data_array = array('capa_type' => db_prepare_input($_POST['capa_type']), 'requested_by' => db_prepare_input($_POST['requested_by']), 'capa_status' => db_prepare_input($_POST['capa_status']), 'entered_by' => db_prepare_input($_POST['entered_by']), 'creation_date' => $creation_date, 'analyze_due' => $_POST['analyze_due'] ? gen_db_date($_POST['analyze_due']) : '', 'analyze_date' => $_POST['analyze_date'] ? gen_db_date($_POST['analyze_date']) : '', 'repair_due' => $_POST['repair_due'] ? gen_db_date($_POST['repair_due']) : '', 'repair_date' => $_POST['repair_date'] ? gen_db_date($_POST['repair_date']) : '', 'audit_due' => $_POST['audit_due'] ? gen_db_date($_POST['audit_due']) : '', 'audit_date' => $_POST['audit_date'] ? gen_db_date($_POST['audit_date']) : '', 'closed_due' => $_POST['closed_due'] ? gen_db_date($_POST['closed_due']) : '', 'closed_date' => $_POST['closed_date'] ? gen_db_date($_POST['closed_date']) : '', 'action_date' => $_POST['action_date'] ? gen_db_date($_POST['action_date']) : '', 'notes_issue' => db_prepare_input($_POST['notes_issue']), 'customer_name' => db_prepare_input($_POST['customer_name']), 'customer_id' => db_prepare_input($_POST['customer_id']), 'customer_telephone' => db_prepare_input($_POST['customer_telephone']), 'customer_invoice' => db_prepare_input($_POST['customer_invoice']), 'customer_email' => db_prepare_input($_POST['customer_email']), 'notes_customer' => db_prepare_input($_POST['notes_customer']), 'analyze_due_id' => db_prepare_input($_POST['analyze_due_id']), 'analyze_close_id' => db_prepare_input($_POST['analyze_close_id']), 'repair_due_id' => db_prepare_input($_POST['repair_due_id']), 'repair_close_id' => db_prepare_input($_POST['repair_close_id']), 'audit_due_id' => db_prepare_input($_POST['audit_due_id']), 'audit_close_id' => db_prepare_input($_POST['audit_close_id']), 'closed_due_id' => db_prepare_input($_POST['closed_due_id']), 'closed_close_id' => db_prepare_input($_POST['closed_close_id']), 'notes_investigation' => db_prepare_input($_POST['notes_investigation']), 'agreed_by' => db_prepare_input($_POST['agreed_by']), 'notes_action' => db_prepare_input($_POST['notes_action']), 'capa_closed' => db_prepare_input($_POST['capa_closed']), 'next_capa_num' => db_prepare_input($_POST['next_capa_num']), 'notes_audit' => db_prepare_input($_POST['notes_audit']));
            if ($id) {
                if ($success = db_perform(TABLE_CAPA, $sql_data_array, 'update', 'id = ' . $id)) {
                    gen_add_audit_log(CAPA_LOG_USER_UPDATE . $_POST['capa_num']);
                    $capa_num = $_POST['capa_num'];
                } else {
                    $error = true;
                }
            } else {
                // fetch the CAPA number
                $result = $db->Execute("select next_capa_num from " . TABLE_CURRENT_STATUS);
                $capa_num = $result->fields['next_capa_num'];
                $sql_data_array['capa_num'] = $capa_num;
                $success = db_perform(TABLE_CAPA, $sql_data_array, 'insert');
                if ($success) {
                    $id = db_insert_id();
Пример #10
0
 // customer PO/Ref number
 $order->store_id = db_prepare_input($_POST['store_id']);
 if ($order->store_id == '') {
     $order->store_id = 0;
 }
 $order->description = sprintf(TEXT_JID_ENTRY, constant('ORD_TEXT_' . JOURNAL_ID . '_WINDOW_TITLE'));
 $order->recur_id = db_prepare_input($_POST['recur_id']);
 $order->recur_frequency = db_prepare_input($_POST['recur_frequency']);
 //	$order->sales_tax_auths     = db_prepare_input($_POST['sales_tax_auths']);
 $order->admin_id = $_SESSION['admin_id'];
 $order->rep_id = db_prepare_input($_POST['rep_id']);
 $order->gl_acct_id = db_prepare_input($_POST['gl_acct_id']);
 $order->terms = db_prepare_input($_POST['terms']);
 $order->waiting = JOURNAL_ID == 6 || JOURNAL_ID == 7 ? isset($_POST['waiting']) ? 1 : 0 : ($_POST['waiting'] ? 1 : 0);
 $order->closed = $_POST['closed'] == '1' ? 1 : 0;
 $order->terminal_date = gen_db_date($_POST['terminal_date']);
 $order->item_count = db_prepare_input($_POST['item_count']);
 $order->weight = db_prepare_input($_POST['weight']);
 $order->printed = db_prepare_input($_POST['printed']);
 $order->subtotal = $currencies->clean_value(db_prepare_input($_POST['subtotal']), $order->currencies_code) / $order->currencies_value;
 // don't need unless for verification
 $order->disc_gl_acct_id = db_prepare_input($_POST['disc_gl_acct_id']);
 $order->discount = $currencies->clean_value(db_prepare_input($_POST['discount']), $order->currencies_code) / $order->currencies_value;
 $order->disc_percent = $order->subtotal ? 1 - ($order->subtotal - $order->discount) / $order->subtotal : 0;
 $order->ship_gl_acct_id = db_prepare_input($_POST['ship_gl_acct_id']);
 $order->rm_attach = isset($_POST['rm_attach']) ? true : false;
 $order->sales_tax = $currencies->clean_value(db_prepare_input($_POST['sales_tax']), $order->currencies_code) / $order->currencies_value;
 $order->total_amount = $currencies->clean_value(db_prepare_input($_POST['total']), $order->currencies_code) / $order->currencies_value;
 // load item row data
 $x = 1;
 while (isset($_POST['qty_' . $x])) {
Пример #11
0
// | 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/audit/pages/main/pre_process.php
//
/**************   Check user security   *****************************/
$security_level = validate_user(SECURITY_ID_AUDIT);
/**************  include page specific files    *********************/
//gen_pull_language($module);
require_once DIR_FS_WORKING . 'functions/audit.php';
/**************   page specific initialization  *************************/
$error = false;
$date_from = gen_db_date($_REQUEST['date_from']);
//         ? db_prepare_input($_POST['date_from'])       : $_GET['date_from'];
$date_to = gen_db_date($_REQUEST['date_to']);
//           ? db_prepare_input($_POST['date_to'])         : $_GET['date_to'];
$select = $_REQUEST['select'];
//           ? db_prepare_input($_POST['date_to'])         : $_GET['date_to'];
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'audit/custom/pages/main/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'export_audit':
        //search for contacts, gl_accounts and journals
        $output = build_audit_xml($date_from, $date_to, $select);
        if ($output == false) {
            $messageStack->add(GL_ERROR_BALANCE, 'error');
Пример #12
0
function calculate_terms_due_dates($post_date, $terms_encoded, $type = 'AR')
{
    $terms = explode(':', $terms_encoded);
    $date_details = gen_get_dates($post_date);
    $result = array();
    switch ($terms[0]) {
        default:
        case '0':
            // Default terms
            $result['discount'] = constant($type . '_PREPAYMENT_DISCOUNT_PERCENT') / 100;
            $result['net_date'] = gen_specific_date($post_date, constant($type . '_NUM_DAYS_DUE'));
            if ($result['discount'] != 0) {
                $result['early_date'] = gen_specific_date($post_date, constant($type . '_PREPAYMENT_DISCOUNT_DAYS'));
            } else {
                $result['early_date'] = $post_date;
                // move way out
            }
            break;
        case '1':
            // Cash on Delivery (COD)
        // Cash on Delivery (COD)
        case '2':
            // Prepaid
            $result['discount'] = 0;
            $result['early_date'] = $post_date;
            $result['net_date'] = $post_date;
            break;
        case '3':
            // Special terms
            $result['discount'] = $terms[1] / 100;
            $result['early_date'] = gen_specific_date($post_date, $terms[2]);
            $result['net_date'] = gen_specific_date($post_date, $terms[3]);
            break;
        case '4':
            // Due on day of next month
            $result['discount'] = $terms[1] / 100;
            $result['early_date'] = gen_specific_date($post_date, $terms[2]);
            $result['net_date'] = gen_db_date($terms[3]);
            break;
        case '5':
            // Due at end of month
            $result['discount'] = $terms[1] / 100;
            $result['early_date'] = gen_specific_date($post_date, $terms[2]);
            $result['net_date'] = date('Y-m-d', mktime(0, 0, 0, $date_details['ThisMonth'], $date_details['TotalDays'], $date_details['ThisYear']));
            break;
    }
    return $result;
}
Пример #13
0
 public function start_import($ouwer_bank_account_number, $post_date, $other_bank_account_number, $credit_amount, $debit_amount, $description, $bank_gl_acct, $other_bank_account_iban)
 {
     global $db, $messageStack, $currencies;
     if ($post_date == '') {
         $messageStack->add(" date is required", 'error');
         return false;
         exit;
     }
     $this->reset();
     $messageStack->debug("\n\n*************** Start Processing Import Payment *******************");
     if ($ouwer_bank_account_number != '') {
         $ouwer_bank = ltrim($ouwer_bank_account_number, 0);
         if ($ouwer_bank == '') {
             $messageStack->add(TEXT_BIMP_ERMSG1, 'error');
             return false;
             exit;
         }
         $sql = "select id, description from " . TABLE_CHART_OF_ACCOUNTS . " where description like '%{$ouwer_bank}%'";
         $result = $db->Execute($sql);
         if ($result->RecordCount() == 0) {
             $messageStack->add(TEXT_BIMP_ERMSG5 . ' ' . $ouwer_bank, 'error');
             return false;
             exit;
         }
         if (!$result->RecordCount() > 1) {
             $messageStack->add(TEXT_BIMP_ERMSG2 . ' ' . $ouwer_bank, 'error');
             return false;
             exit;
         }
         $this->gl_acct_id = $result->fields['id'];
     } else {
         if ($bank_gl_acct == '') {
             $messageStack->add(TEXT_BIMP_ERMSG1, 'error');
             return false;
             exit;
         }
         $this->gl_acct_id = $bank_gl_acct;
     }
     $this->_description = $description;
     $this->_creditamount = $currencies->clean_value($credit_amount);
     $this->_debitamount = $currencies->clean_value($debit_amount);
     $this->total_amount = $this->_debitamount + $this->_creditamount;
     $this->post_date = gen_db_date($post_date);
     $this->period = gen_calculate_period($this->post_date, true);
     $this->admin_id = $_SESSION['admin_id'];
     if ($this->find_contact($other_bank_account_number, $other_bank_account_iban)) {
         $this->find_right_invoice();
     } else {
         if ($this->proces_know_mutation($other_bank_account_number, $other_bank_account_iban) == false) {
             $this->proces_mutation();
         }
     }
     $messageStack->debug("\n\n*************** End Processing Import Payment *******************");
 }
Пример #14
0
             if (DEBUG) {
                 $messageStack->write_debug();
             }
             gen_add_audit_log(GL_LOG_ADD_JOURNAL . TEXT_DELETE, $delGL->purchase_invoice_id);
             gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
         }
         // *************** END TRANSACTION *************************
     }
     $db->transRollback();
     $messageStack->add(GL_ERROR_NO_DELETE, 'error');
     if (DEBUG) {
         $messageStack->write_debug();
     }
     $cInfo = new objectInfo($_POST);
     // if we are here, there was an error, reload page
     $cInfo->post_date = gen_db_date($_POST['post_date']);
     break;
 case 'edit':
     $oID = (int) $_GET['oID'];
     validate_security($security_level, 2);
     $cInfo = new objectInfo(array());
     break;
 case 'dn_attach':
     $oID = db_prepare_input($_POST['id']);
     if (file_exists(PHREEBOOKS_DIR_MY_ORDERS . 'order_' . $oID . '.zip')) {
         require_once DIR_FS_MODULES . 'phreedom/classes/backup.php';
         $backup = new backup();
         $backup->download(PHREEBOOKS_DIR_MY_ORDERS, 'order_' . $oID . '.zip', true);
     }
     die;
 default:
Пример #15
0
require_once DIR_FS_MODULES . 'phreebooks/classes/gen_ledger.php';
require_once DIR_FS_MODULES . 'phreebooks/classes/banking.php';
/**************   page specific initialization  *************************/
$error = false;
$till_known = false;
$cleared_items = array();
$current_cleard_items = unserialize($_POST['current_cleard_items']);
$all_items = array();
$gl_types = array('pmt', 'ttl', 'tpm');
$post_date = $_POST['post_date'] ? gen_db_date($_POST['post_date']) : '';
$payment_modules = load_all_methods('payment');
$tills = new tills();
$glEntry = new journal();
if (isset($_GET['till_id'])) {
    $tills->get_till_info(db_prepare_input($_GET['till_id']));
    $post_date = gen_db_date(gen_locale_date(date('Y-m-d')));
} else {
    if (isset($_POST['till_id'])) {
        $tills->get_till_info(db_prepare_input($_POST['till_id']));
    } else {
        if ($tills->showDropDown() == false) {
            $tills->get_default_till_info();
        } else {
            $post_date = '';
            $_REQUEST['action'] = '';
        }
    }
}
if ($post_date) {
    $period = gen_calculate_period($post_date);
}
Пример #16
0
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/inventory/pages/adjustments/pre_process.php
//
$security_level = validate_user(SECURITY_ID_ADJUST_INVENTORY);
/**************  include page specific files    *********************/
gen_pull_language('phreebooks');
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
require_once DIR_FS_MODULES . 'phreebooks/classes/gen_ledger.php';
/**************   page specific initialization  *************************/
define('JOURNAL_ID', 16);
// Adjustment Journal
define('GL_TYPE', '');
$post_date = isset($_POST['post_date']) ? gen_db_date($_POST['post_date']) : date('Y-m-d');
$error = false;
$glEntry = new journal();
$glEntry->id = isset($_POST['id']) ? $_POST['id'] : '';
$glEntry->journal_id = JOURNAL_ID;
$glEntry->store_id = isset($_POST['store_id']) ? $_POST['store_id'] : 0;
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/adjustments/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        validate_security($security_level, 2);
        // retrieve and clean input values
Пример #17
0
 public function what_to_save()
 {
     global $db, $currencies;
     $sql_data_array = array();
     $xtra_db_fields = $db->Execute("select field_name, entry_type, params \n          from " . TABLE_EXTRA_FIELDS . " where module_id='{$this->module}'");
     while (!$xtra_db_fields->EOF) {
         if ($xtra_db_fields->fields['field_name'] == 'id') {
             $xtra_db_fields->MoveNext();
         }
         $field_name = $xtra_db_fields->fields['field_name'];
         if ($xtra_db_fields->fields['entry_type'] == 'multi_check_box') {
             $temp = '';
             $params = unserialize($xtra_db_fields->fields['params']);
             $choices = explode(',', $params['default']);
             while ($choice = array_shift($choices)) {
                 $values = explode(':', $choice);
                 if (isset($_POST[$field_name . $values[0]])) {
                     $temp .= $_POST[$field_name . $values[0]] . ',';
                 }
             }
             $sql_data_array[$field_name] = $temp;
         } elseif (!isset($_POST[$field_name]) && $xtra_db_fields->fields['entry_type'] == 'check_box') {
             $sql_data_array[$field_name] = '0';
             // special case for unchecked check boxes
         } elseif (isset($_POST[$field_name]) && $field_name != 'id') {
             $sql_data_array[$field_name] = db_prepare_input($_POST[$field_name]);
         }
         if ($xtra_db_fields->fields['entry_type'] == 'date_time') {
             $sql_data_array[$field_name] = $sql_data_array[$field_name] ? gen_db_date($sql_data_array[$field_name]) : '';
         }
         if ($xtra_db_fields->fields['entry_type'] == 'decimal') {
             $sql_data_array[$field_name] = $sql_data_array[$field_name] ? $currencies->clean_value($sql_data_array[$field_name]) : '';
         }
         $xtra_db_fields->MoveNext();
     }
     return $sql_data_array;
 }
Пример #18
0
$type = isset($_GET['type']) ? $_GET['type'] : 'c';
history_filter('inv_prices');
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'inventory/pages/price_sheets/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
    case 'update':
        validate_security($security_level, 2);
        $id = db_prepare_input($_POST['id']);
        $sheet_name = db_prepare_input($_POST['sheet_name']);
        $revision = db_prepare_input($_POST['revision']);
        $effective_date = gen_db_date($_POST['effective_date']);
        $default_sheet = isset($_POST['default_sheet']) ? '1' : '0';
        $inactive = isset($_POST['inactive']) ? '1' : '0';
        $encoded_prices = array();
        for ($i = 0, $j = 1; $i < MAX_NUM_PRICE_LEVELS; $i++, $j++) {
            $price = $currencies->clean_value(db_prepare_input($_POST['price_' . $j]));
            $adj = db_prepare_input($_POST['adj_' . $j]);
            $adj_val = $currencies->clean_value(db_prepare_input($_POST['adj_val_' . $j]));
            $rnd = db_prepare_input($_POST['rnd_' . $j]);
            $rnd_val = $currencies->clean_value(db_prepare_input($_POST['rnd_val_' . $j]));
            $level_data = $_POST['price_' . $j] ? $price : '0';
            $level_data .= ':' . db_prepare_input($_POST['qty_' . $j]);
            $level_data .= ':' . db_prepare_input($_POST['src_' . $j]);
            $level_data .= ':' . ($_POST['adj_' . $j] ? $adj : '0');
            $level_data .= ':' . ($_POST['adj_val_' . $j] ? $adj_val : '0');
            $level_data .= ':' . ($_POST['rnd_' . $j] ? $rnd : '0');
Пример #19
0
                     break;
                     // file does not exist, exit loop
                 }
             }
             $cnt++;
         }
         $shipments->MoveNext();
     }
     // delete log since deleting label from FedEx is just a courtesy
     $db->Execute("delete from " . TABLE_SHIPPING_LOG . " where shipment_id = " . $shipment_id);
     gen_add_audit_log(SHIPPING_LABEL_DELETED, $shipment_id);
     break;
 case 'close':
     $date = $_GET['date'] ? $_GET['date'] : date('Y-m-d');
     $shipment = new $shipping_module();
     $shipment->close_date = $_POST['search_date'] ? gen_db_date($_POST['search_date']) : date('Y-m-d');
     $shipment->closeFedEx($date);
     gen_add_audit_log(sprintf(SHIPPING_END_OF_DAY, $shipping_module), $tracking_id);
     break;
 case 'report':
     $date = $_GET['date'] ? $_GET['date'] : date('Y-m-d');
     break;
 default:
     $oID = db_prepare_input($_GET['oID']);
     $sql = "select shipper_code, ship_primary_name, ship_contact, ship_address1, ship_address2, \n\t\tship_city_town, ship_state_province, ship_postal_code, ship_country_code, ship_telephone1, \n\t\tship_email, purchase_invoice_id, purch_order_id, total_amount  \n\t\tfrom " . TABLE_JOURNAL_MAIN . " where id = " . (int) $oID;
     $result = $db->Execute($sql);
     if (is_array($result->fields)) {
         while (list($key, $value) = each($result->fields)) {
             $sInfo->{$key} = $value;
         }
         $temp = explode(':', $result->fields['shipper_code']);
Пример #20
0
// +-----------------------------------------------------------------+
//  Path: /modules/inventory/pages/transfer/pre_process.php
//
$security_level = validate_user(SECURITY_ID_TRANSFER_INVENTORY);
/**************  include page specific files    *********************/
gen_pull_language('phreebooks');
require_once DIR_FS_WORKING . 'defaults.php';
require_once DIR_FS_WORKING . 'functions/inventory.php';
require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
require_once DIR_FS_MODULES . 'phreebooks/classes/gen_ledger.php';
/**************   page specific initialization  *************************/
define('JOURNAL_ID', 16);
// Adjustment Journal
define('GL_TYPE', '');
$error = false;
$post_date = $_POST['post_date'] ? gen_db_date($_POST['post_date']) : date('Y-m-d');
$period = gen_calculate_period($post_date);
if (!$period) {
    $error = true;
}
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/transfer/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        validate_security($security_level, 2);
        // security check
        // retrieve and clean input values
Пример #21
0
function gen_build_sql_date($date_prefs, $df)
{
    global $db;
    $dates = gen_get_dates();
    $DateArray = explode(':', $date_prefs);
    $t = time();
    $ds = '0000-00-00';
    $de = '2199-00-00';
    switch ($DateArray[0]) {
        default:
        case "a":
            // All, skip the date addition to the where statement, all dates in db
            $d = '';
            $fildesc = '';
            break;
        case "b":
            // Date Range
            $d = '';
            $fildesc = RW_RPT_DATERANGE;
            if ($DateArray[1] != '') {
                $ds = gen_db_date($DateArray[1]);
                $d .= $df . " >= '" . $ds . "'";
                $fildesc .= ' ' . TEXT_FROM . ' ' . $DateArray[1];
            }
            if ($DateArray[2] != '') {
                // a value entered, check
                if (strlen($d) > 0) {
                    $d .= ' and ';
                }
                $de = gen_specific_date(gen_db_date($DateArray[2]), 1);
                $d .= $df . " < '" . $de . "'";
                $fildesc .= ' ' . TEXT_TO . ' ' . $DateArray[2];
            }
            $fildesc .= '; ';
            break;
        case "c":
            // Today (specify range for datetime type fields to match for time parts)
            $ds = $dates['Today'];
            $de = gen_specific_date($dates['Today'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' = ' . gen_locale_date($dates['Today']) . '; ';
            break;
        case "d":
            // This Week
            $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t), $dates['ThisYear']));
            $de = gen_specific_date(date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t) + 6, $dates['ThisYear'])), 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date(gen_specific_date($de, -1)) . '; ';
            break;
        case "e":
            // This Week to Date
            $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], date('j', $t) - date('w', $t), $dates['ThisYear']));
            $de = gen_specific_date($dates['Today'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($dates['Today']) . '; ';
            break;
        case "f":
            // This Month
            $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], 1, $dates['ThisYear']));
            $de = gen_specific_date(date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], $dates['TotalDays'], $dates['ThisYear'])), 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date(gen_specific_date($de, -1)) . '; ';
            break;
        case "g":
            // This Month to Date
            $ds = date('Y-m-d', mktime(0, 0, 0, $dates['ThisMonth'], 1, $dates['ThisYear']));
            $de = gen_specific_date($dates['Today'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($dates['Today']) . '; ';
            break;
        case "h":
            // This Quarter
            $QtrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 3;
            $temp = gen_calculate_fiscal_dates($QtrStrt);
            $ds = $temp['start_date'];
            $temp = gen_calculate_fiscal_dates($QtrStrt + 2);
            $de = gen_specific_date($temp['end_date'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($temp['end_date']) . '; ';
            break;
        case "i":
            // Quarter to Date
            $QtrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 3;
            $temp = gen_calculate_fiscal_dates($QtrStrt);
            $ds = $temp['start_date'];
            $de = gen_specific_date($dates['Today'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($dates['Today']) . '; ';
            break;
        case "j":
            // This Year
            $YrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 12;
            $temp = gen_calculate_fiscal_dates($YrStrt);
            $ds = $temp['start_date'];
            $temp = gen_calculate_fiscal_dates($YrStrt + 11);
            $de = gen_specific_date($temp['end_date'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($temp['end_date']) . '; ';
            break;
        case "k":
            // Year to Date
            $YrStrt = CURRENT_ACCOUNTING_PERIOD - (CURRENT_ACCOUNTING_PERIOD - 1) % 12;
            $temp = gen_calculate_fiscal_dates($YrStrt);
            $ds = $temp['start_date'];
            $de = gen_specific_date($dates['Today'], 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = RW_RPT_DATERANGE . ' ' . TEXT_FROM . ' ' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($dates['Today']) . '; ';
            break;
        case "l":
            // This Period
            $ds = CURRENT_ACCOUNTING_PERIOD_START;
            $de = gen_specific_date(CURRENT_ACCOUNTING_PERIOD_END, 1);
            $d = $df . " >= '" . $ds . "' and " . $df . " < '" . $de . "'";
            $fildesc = TEXT_PERIOD . ' ' . CURRENT_ACCOUNTING_PERIOD . ' (' . gen_locale_date(CURRENT_ACCOUNTING_PERIOD_START) . ' ' . TEXT_TO . ' ' . gen_locale_date(CURRENT_ACCOUNTING_PERIOD_END) . '); ';
            break;
        case "z":
            // date by period
            $temp = gen_calculate_fiscal_dates($DateArray[1]);
            $ds = $temp['start_date'];
            $de = $temp['end_date'];
            $d = 'period = ' . $DateArray[1];
            $fildesc = TEXT_PERIOD . ' ' . $DateArray[1] . ' (' . gen_locale_date($ds) . ' ' . TEXT_TO . ' ' . gen_locale_date($de) . '); ';
            break;
    }
    $dates = array('sql' => $d, 'description' => $fildesc, 'start_date' => $ds, 'end_date' => $de);
    return $dates;
}
Пример #22
0
/**************  include page specific files    *********************/
load_method_language(DEFAULT_MOD_DIR, $shipping_module);
require DIR_FS_WORKING . 'functions/shipping.php';
require DIR_FS_WORKING . 'classes/shipping.php';
require DIR_FS_WORKING . 'methods/' . $shipping_module . '/' . $shipping_module . '.php';
/**************   page specific initialization  *************************/
$error = false;
$sInfo = new shipment();
// load defaults
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        $sInfo->purchase_invoice_id = db_prepare_input($_POST['purchase_invoice_id']);
        $sInfo->ship_method = db_prepare_input($_POST['ship_method']);
        $sInfo->ship_date = gen_db_date($_POST['ship_date']);
        $sInfo->deliver_date = gen_db_date($_POST['deliver_date']);
        $sInfo->tracking_id = db_prepare_input($_POST['tracking_id']);
        $sInfo->cost = $currencies->clean_value($_POST['cost']);
        $temp = $db->Execute("select next_shipment_num from " . TABLE_CURRENT_STATUS);
        $sql_array = array('ref_id' => $sInfo->purchase_invoice_id, 'shipment_id' => $temp->fields['next_shipment_num'], 'carrier' => $shipping_module, 'method' => $sInfo->ship_method, 'ship_date' => $sInfo->ship_date, 'deliver_date' => $sInfo->deliver_date, 'tracking_id' => $sInfo->tracking_id, 'cost' => $sInfo->cost);
        db_perform(TABLE_SHIPPING_LOG, $sql_array, 'insert');
        $db->Execute("update " . TABLE_CURRENT_STATUS . " set next_shipment_num = next_shipment_num + 1");
        gen_add_audit_log(SHIPPING_LOG_LABEL_PRINTED, $sInfo->purchase_invoice_id);
        break;
    case 'delete':
        $shipment_id = db_prepare_input($_GET['sID']);
        $result = $db->Execute("select method, ship_date from " . TABLE_SHIPPING_LOG . " where shipment_id = " . (int) $shipment_id);
        $ship_method = $result->fields['method'];
        if ($result->RecordCount() == 0 || !$shipment_id) {
            $messageStack->add(SHIPPING_DELETE_ERROR, 'error');
            $error = true;
Пример #23
0
     $asset_path = substr($asset_path, 0, strlen($asset_path) - 1);
 }
 // remove trailing '/' if there
 $asset_type = db_prepare_input($_POST['asset_type']);
 $sql_data_array = array();
 $asset_fields = $db->Execute("select field_name, entry_type from " . TABLE_EXTRA_FIELDS . " where module_id = 'assets'");
 while (!$asset_fields->EOF) {
     $field_name = $asset_fields->fields['field_name'];
     if (!isset($_POST[$field_name]) && $asset_fields->fields['entry_type'] == 'check_box') {
         $sql_data_array[$field_name] = '0';
         // special case for unchecked check boxes
     } elseif (isset($_POST[$field_name]) && $field_name != 'id') {
         $sql_data_array[$field_name] = db_prepare_input($_POST[$field_name]);
     }
     if ($asset_fields->fields['entry_type'] == 'date_time') {
         $sql_data_array[$field_name] = $sql_data_array[$field_name] ? gen_db_date($sql_data_array[$field_name]) : '';
     }
     $asset_fields->MoveNext();
 }
 // special cases for checkboxes of system fields (don't return a POST value if unchecked)
 $remove_image = $_POST['remove_image'] == '1' ? true : false;
 unset($sql_data_array['remove_image']);
 // this is not a db field, just an action
 $sql_data_array['inactive'] = $sql_data_array['inactive'] == '1' ? '1' : '0';
 $sql_data_array['purch_cond'] = db_prepare_input($_POST['purch_cond']);
 $sql_data_array['acquisition_date'] = $acquisition_date;
 $sql_data_array['maintenance_date'] = $maintenance_date;
 $sql_data_array['terminal_date'] = $terminal_date;
 // special cases for monetary values in system fields
 $sql_data_array['full_price'] = $currencies->clean_value($sql_data_array['full_price']);
 $sql_data_array['asset_cost'] = $currencies->clean_value($sql_data_array['asset_cost']);
Пример #24
0
$ship_date = date('Y-m-d');
if ($method) {
    $subject_module = new $method();
}
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'shipping/custom/pages/popup_tracking/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        if (!$method) {
            break;
        }
        $sql_data_array = array('carrier' => db_prepare_input($_POST['carrier']), 'ref_id' => db_prepare_input($_POST['ref_id']), 'method' => db_prepare_input($_POST['method']), 'ship_date' => gen_db_date($_POST['ship_date']), 'deliver_date' => gen_db_date($_POST['deliver_date']), 'tracking_id' => db_prepare_input($_POST['tracking_id']), 'cost' => $currencies->clean_value($_POST['cost']));
        if (!$sID) {
            // it's a new entry
            $result = $db->Execute("select next_shipment_num from " . TABLE_CURRENT_STATUS);
            $sql_data_array['shipment_id'] = $result->fields['next_shipment_num'];
            db_perform(TABLE_SHIPPING_LOG, $sql_data_array, 'insert');
            $db->Execute("update " . TABLE_CURRENT_STATUS . " set next_shipment_num = next_shipment_num + 1");
            gen_add_audit_log(SHIPPING_SHIPMENT_DETAILS . ' - ' . TEXT_INSERT, $sID);
        } else {
            // update
            db_perform(TABLE_SHIPPING_LOG, $sql_data_array, 'update', "id = " . $sID);
            gen_add_audit_log(SHIPPING_SHIPMENT_DETAILS . ' - ' . TEXT_UPDATE, $sID);
        }
        $close_popup = true;
        break;
    default:
Пример #25
0
                $order->id = $_POST['id'] != '' ? $_POST['id'] : '';
                // will be null unless opening an existing purchase/receive
                $messageStack->add(GL_ERROR_NO_POST, 'error');
            }
            gen_add_audit_log(AUDIT_LOG_DESC, $order->purchase_invoice_id, $order->total_amount);
            if (DEBUG) {
                $messageStack->write_debug();
            }
            if ($_REQUEST['action'] == 'save') {
                gen_redirect(html_href_link(FILENAME_DEFAULT, gen_get_all_get_params(array('action')), 'SSL'));
            }
            // else print or print_update, fall through and load javascript to call form_popup and clear form
        } else {
            // else there was a post error, display and re-display form
            $order = new objectInfo($_POST);
            $order->post_date = gen_db_date($_POST['post_date']);
            // fix the date to original format
            $order->id = $_POST['id'] != '' ? $_POST['id'] : '';
            // will be null unless opening an existing purchase/receive
            $messageStack->add(GL_ERROR_NO_POST, 'error');
        }
        break;
    default:
}
/*****************   prepare to display templates  *************************/
$acct_balance = load_cash_acct_balance($post_date, $gl_acct_id, $period);
$gl_array_list = gen_coa_pull_down();
$js_gl_array = 'var js_gl_array = new Array(' . count($gl_array_list) . ');' . chr(10);
for ($i = 0; $i < count($gl_array_list); $i++) {
    $js_gl_array .= 'js_gl_array[' . $i . '] = new dropDownData("' . $gl_array_list[$i]['id'] . '", "' . $gl_array_list[$i]['text'] . '");' . chr(10);
}
Пример #26
0
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/contacts/pages/main/pre_process.php
//
/**************   page specific initialization  *************************/
$error = false;
$contact_js = '';
$js_pmt_array = '';
$js_actions = '';
$criteria = array();
$tab_list = array();
if ($_POST['crm_date']) {
    $_POST['crm_date'] = gen_db_date($_POST['crm_date']);
}
if ($_POST['due_date']) {
    $_POST['due_date'] = gen_db_date($_POST['due_date']);
}
$type = isset($_GET['type']) ? $_GET['type'] : 'c';
// default to customer
history_filter('contacts' . $type, $defaults = array('sf' => '', 'so' => 'asc'));
// load the filters
$default_f0 = defined('CONTACTS_F0_' . strtoupper($type)) ? constant('CONTACTS_F0_' . strtoupper($type)) : DEFAULT_F0_SETTING;
$_SESSION['f0'] = isset($_SESSION['f0']) ? $_SESSION['f0'] : $default_f0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $_SESSION['f0'] = isset($_POST['f0']) ? $_REQUEST['f0'] : false;
}
// show inactive checkbox
if (file_exists(DIR_FS_WORKING . 'custom/classes/type/' . $type . '.php')) {
    require_once DIR_FS_WORKING . 'custom/classes/type/' . $type . '.php';
} else {
    require_once DIR_FS_WORKING . 'classes/type/' . $type . '.php';
Пример #27
0
// | 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/shipping/pages/ship_mgr/pre_process.php
//
$security_level = validate_user(SECURITY_ID_SHIPPING_MANAGER);
/**************  include page specific files    *********************/
require_once DIR_FS_WORKING . 'defaults.php';
/**************   page specific initialization  *************************/
$date = $_GET['search_date'] ? gen_db_date($_GET['search_date']) : date('Y-m-d');
if ($_REQUEST['search_text'] == TEXT_SEARCH) {
    $_REQUEST['search_text'] = '';
}
$module_id = isset($_POST['module_id']) ? $_POST['module_id'] : '';
$row_seq = isset($_POST['rowSeq']) ? $_POST['rowSeq'] : '';
$action = $_REQUEST['action'];
// load methods
$installed_modules = load_all_methods('shipping');
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_WORKING . 'custom/pages/ship_mgr/extra_actions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
if ($module_id) {