require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
require_once DIR_FS_MODULES . 'phreebooks/classes/gen_ledger.php';
require_once DIR_FS_MODULES . 'phreepos/classes/tills.php';
require_once DIR_FS_MODULES . 'phreepos/classes/other_transactions.php';
/**************   page specific initialization  *************************/
define('ORD_ACCT_ID', GEN_CUSTOMER_ID);
define('GL_TYPE', 'sos');
define('DEF_INV_GL_ACCT', AR_DEF_GL_SALES_ACCT);
define('DEF_GL_ACCT', AR_DEFAULT_GL_ACCT);
define('DEF_GL_ACCT_TITLE', ORD_AR_ACCOUNT);
define('POPUP_FORM_TYPE', 'pos:rcpt');
$error = false;
$account_type = 'c';
$order = new journal();
$transaction = new other_transactions();
$tills = new tills();
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'phreepos/custom/ajax/other_transactions.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
if ($security_level < 2) {
    $error .= ERROR_NO_PERMISSION;
}
$transaction->get_transaction_info($_POST['Other_trans_type']);
$tills->get_till_info($_POST['ot_till_id']);
// currency values (convert to DEFAULT_CURRENCY to store in db)
$order->currencies_code = db_prepare_input($_POST['ot_currencies_code']);
$order->currencies_value = db_prepare_input($_POST['ot_currencies_value']);
// load journal main data
 function build_form_html($action, $id = '')
 {
     global $db, $currencies;
     require_once DIR_FS_MODULES . 'phreepos/classes/tills.php';
     require_once DIR_FS_MODULES . 'phreepos/defaults.php';
     if ($action != 'new' && $this->error == false) {
         $sql = "select * from " . $this->db_table . " where ot_id = " . $id;
         $result = $db->Execute($sql);
         foreach ($result->fields as $key => $value) {
             $this->{$key} = $value;
         }
     }
     $tills = new tills();
     $output = "<script type='text/javascript'>\n\t\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\tchangeOfType();\n\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\tfunction changeOfType(){\n\t\t\t\t\t\t\tvar elt = document.getElementById('type');\n\t\t\t\t\t\t\tif(elt.options[elt.selectedIndex].value == 'expenses'){\n\t\t\t\t\t\t\t\t\$('#use_tax_row').show();\n\t\t\t\t\t\t\t\t\$('#tax_row').show();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\$('#use_tax_row').hide();\n\t\t\t\t\t\t\t\t\$('#tax_row').hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</script>";
     $output .= '<table style="border-collapse:collapse;margin-left:auto; margin-right:auto;">' . chr(10);
     $output .= '  <thead class="ui-widget-header">' . "\n";
     $output .= '  <tr>' . chr(10);
     $output .= '    <th colspan="2">' . ($action == 'new' ? TEXT_ENTER_NEW_OTHER_TRANSACTION : TEXT_EDIT_OTHER_TRANSACTION) . '</th>' . chr(10);
     $output .= '  </tr>' . chr(10);
     $output .= '  </thead>' . "\n";
     $output .= '  <tbody class="ui-widget-content">' . "\n";
     $output .= '  <tr>' . chr(10);
     $output .= '    <td>' . TEXT_DESCRIPTION . '</td>' . chr(10);
     $output .= '    <td>' . html_input_field('description', $this->description, 'size="16" maxlength="15"') . '</td>' . chr(10);
     $output .= '  </tr>' . chr(10);
     if ($tills->showDropDown()) {
         $output .= '  <tr>' . chr(10);
         $output .= '    <td>' . TEXT_TILLS . '</td>' . chr(10);
         $output .= '    <td>' . html_pull_down_menu('till_id', $tills->till_array(), $this->till_id ? $this->till_id : $tills->default_till()) . '</td>' . chr(10);
         $output .= '  </tr>' . chr(10);
     } else {
         $output .= html_hidden_field('till_id', $tills->default_till());
     }
     //type change cash or expences.
     $output .= '  <tr>' . chr(10);
     $output .= '    <td>' . TEXT_PHREEPOS_TRANSACTION_TYPE . '</td>' . chr(10);
     $output .= '    <td>' . html_pull_down_menu('type', gen_build_pull_down($ot_options), $this->type, 'onchange="changeOfType();"') . '</td>' . chr(10);
     $output .= '  </tr>' . chr(10);
     $output .= '  <tr>' . chr(10);
     //gl account
     $output .= '  <tr>' . chr(10);
     $output .= '    <td>' . TEXT_GL_ACCOUNT . '</td>' . chr(10);
     $output .= '    <td>' . html_pull_down_menu('gl_acct_id', gen_coa_pull_down(SHOW_FULL_GL_NAMES, true, true, false, false), $this->gl_acct_id) . '</td>' . chr(10);
     $output .= '  </tr>' . chr(10);
     $output .= '  <tr>' . chr(10);
     //Only show this when it are expenses
     //use show tax
     $output .= '  <tr id="use_tax_row">' . chr(10);
     $output .= '    <td>' . TEXT_USE_TAX . '</td>' . chr(10);
     $output .= '    <td>' . html_checkbox_field('use_tax', '0', $this->use_tax) . '</td>' . chr(10);
     $output .= '  </tr>' . chr(10);
     //default tax
     $output .= '  <tr id="tax_row">' . chr(10);
     $output .= '    <td>' . TEXT_TAX . '</td>' . chr(10);
     $output .= '    <td>' . html_pull_down_menu('taxable', inv_calculate_tax_drop_down('v', false), $this->taxable) . '</td>' . chr(10);
     $output .= '  </tr>' . chr(10);
     $output .= '  <tr>' . chr(10);
     $output .= '  </tbody>' . chr(10);
     $output .= '</table>' . chr(10);
     return $output;
 }
Beispiel #3
0
/**************   page specific initialization  *************************/
define('ORD_ACCT_ID', GEN_CUSTOMER_ID);
define('GL_TYPE', 'sos');
define('DEF_INV_GL_ACCT', AR_DEF_GL_SALES_ACCT);
define('DEF_GL_ACCT', AR_DEFAULT_GL_ACCT);
define('DEF_GL_ACCT_TITLE', ORD_AR_ACCOUNT);
define('POPUP_FORM_TYPE', 'pos:rcpt');
$error = false;
$auto_print = false;
$total_discount = 0;
$total_fixed = 0;
$account_type = 'c';
$post_success = false;
$order = new journal_19();
$payment_modules = load_all_methods('payment');
$tills = new tills();
/***************   hook for custom actions  ***************************/
$custom_path = DIR_FS_MODULES . 'phreepos/custom/ajax/save_main.php';
if (file_exists($custom_path)) {
    include $custom_path;
}
/***************   Act on the action request   *************************/
if ($security_level < 2) {
    $error .= ERROR_NO_PERMISSION;
}
$tills->get_till_info($_POST['till_id']);
// load bill to and ship to information
$order->short_name = db_prepare_input($_POST['search'] != TEXT_SEARCH ? $_POST['search'] : '');
$order->bill_add_update = isset($_POST['bill_add_update']) ? $_POST['bill_add_update'] : 0;
$order->account_type = $account_type;
$order->bill_acct_id = db_prepare_input($_POST['bill_acct_id']);
Beispiel #4
0
/**************  include page specific files    *********************/
gen_pull_language('phreebooks');
require_once DIR_FS_WORKING . 'classes/tills.php';
require_once DIR_FS_MODULES . 'phreebooks/functions/phreebooks.php';
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'] = '';
        }
    }