Example #1
0
function step($is_submit)
{
    $root = $_SESSION['install']['paths']['root'];
    $path = $_SERVER['DOCUMENT_ROOT'] . $root . 'system/config';
    $file = 'config.php';
    if ($is_submit) {
        return create_config($path, $file);
    }
    $result = array('html' => render('step_config', array('path' => $path, 'file' => $file)));
    return $result;
}
Example #2
0
function install_base()
{
    global $phpc_config_file;
    $sql_type = "mysqli";
    $my_hostname = $_POST['my_hostname'];
    $my_username = $_POST['my_username'];
    $my_passwd = $_POST['my_passwd'];
    $my_prefix = $_POST['my_prefix'];
    $my_database = $_POST['my_database'];
    $fp = fopen($phpc_config_file, 'w') or soft_error('Couldn\'t open config file.');
    fwrite($fp, create_config($my_hostname, $my_username, $my_passwd, $my_database, $my_prefix, $sql_type)) or soft_error("Could not write to file");
    fclose($fp);
    // Make the database connection.
    include $phpc_config_file;
    $dbh = connect_db(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE);
    create_tables($dbh);
    $query = "REPLACE INTO `" . SQL_PREFIX . "config`\n" . "(`name`, `value`)\n" . "VALUES ('version', '" . PHPC_DB_VERSION . "')";
    $dbh->query($query) or install_db_error($dbh, 'Error creating version row.', $query);
    echo "<p>Config file created at \"" . realpath($phpc_config_file) . "\"</p>" . "<p>Calendars database created</p>\n" . "<div><input type=\"submit\" name=\"base\" value=\"continue\">" . "</div>\n";
}
Example #3
0
function install_sql()
{
    global $db_pre;
    //安装配置信息
    $db_address = url_get('db_address');
    $db_user = url_get('db_user');
    $db_pwd = url_get('db_pwd');
    $db_name = url_get('db_name');
    $db_pre = url_get('db_pre');
    $admin_user = url_get('admin_user');
    $admin_pwd = url_get('admin_pwd');
    $install_type = url_get('install_type');
    //链接mysql数据库
    $mysql_link = @mysql_connect($db_address, $db_user, $db_pwd);
    if (!$mysql_link) {
        showProgress(array('isError' => true, 'message' => 'mysql链接失败' . mysql_error()));
    }
    //检测SQL安装文件
    $sql_file = ROOT_PATH . './install/iwebshop.sql';
    if (!file_exists($sql_file)) {
        showProgress(array('isError' => true, 'message' => '安装的SQL文件' . basename($sql_file) . '不存在'));
    }
    //检测测试数据SQL文件
    $sql_test_file = ROOT_PATH . './install/iwebshop_test.sql';
    if ($install_type == 'all' && !file_exists($sql_test_file)) {
        showProgress(array('isError' => true, 'message' => '测试数据SQL文件' . basename($sql_test_file) . '不存在'));
    }
    //执行SQL,创建数据库操作
    mysql_query("set names 'UTF8'");
    if (!@mysql_select_db($db_name)) {
        $DATABASESQL = '';
        if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
            $DATABASESQL = "DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
        }
        if (!mysql_query('CREATE DATABASE `' . $db_name . '` ' . $DATABASESQL)) {
            showProgress(array('isError' => true, 'message' => '用户权限受限,创建' . $db_name . '数据库失败,请手动创建数据表'));
        }
    }
    if (!@mysql_select_db($db_name)) {
        showProgress(array('isError' => true, 'message' => $db_name . '数据库不存在' . mysql_error()));
    }
    //安装SQL
    parseSQL($sql_file);
    //安装测试数据
    if ($install_type == 'all') {
        parseSQL($sql_test_file);
    }
    //插入管理员数据
    $adminSql = 'insert into `' . $db_pre . 'admin` (`admin_name`,`password`,`role_id`,`create_time`) values ("' . $admin_user . '","' . md5($admin_pwd) . '",0,"' . date('Y-m-d H:i:s') . '")';
    if (!mysql_query($adminSql)) {
        showProgress(array('isError' => true, 'message' => '创建管理员失败' . mysql_error(), 'percent' => 0.9));
    }
    //写入配置文件
    $configDefFile = ROOT_PATH . './config/config_default.php';
    $configFile = ROOT_PATH . './config/config.php';
    $updateData = array('{TABLE_PREFIX}' => $db_pre, '{DB_R_ADDRESS}' => $db_address, '{DB_R_USER}' => $db_user, '{DB_R_PWD}' => $db_pwd, '{DB_R_NAME}' => $db_name, '{DB_W_ADDRESS}' => $db_address, '{DB_W_USER}' => $db_user, '{DB_W_PWD}' => $db_pwd, '{DB_W_NAME}' => $db_name, '{ENCRYPTKEY}' => md5(rand(1000000000, 9999999999)));
    $is_success = create_config($configFile, $configDefFile, $updateData);
    if (!$is_success) {
        showProgress(array('isError' => true, 'message' => '更新配置文件失败', 'percent' => 0.9));
    }
    //修改index.php首页
    $index_file = ROOT_PATH . './index.php';
    $index_content = '<?php
$iweb = dirname(__FILE__)."/lib/iweb.php";
$config = dirname(__FILE__)."/config/config.php";
require($iweb);
IWeb::createWebApp($config)->run();
?>';
    $is_success = file_put_contents($index_file, $index_content);
    if (!$is_success) {
        showProgress(array('isError' => true, 'message' => '生成index.php页面出错', 'percent' => 0.9));
    }
    //执行完毕
    showProgress(array('isError' => false, 'message' => '安装完成', 'percent' => 1));
}
Example #4
0
    case 'save_room':
        $room_name = $_POST['i_room_name'];
        $data = "'','" . $room_name . "'";
        save_room($data);
        header('location: table.php');
        break;
    case 'save_table':
        $building_id = $_GET['building_id'];
        $table_name = $_POST['i_table_name'];
        $data = "'',\n\t\t\t\t'{$building_id}',\n\t\t\t\t'" . $table_name . "',\n\t\t\t\t'200',\n\t\t\t\t'200',\n\t\t\t\t'2',\n\t\t\t\t'1',\n\t\t\t\t'0',\n\t\t\t\t'1'\n\t\t\t\t";
        save_table($data);
        header("location: table.php?building_id={$building_id}");
        break;
    case 'save_payment':
        $table_id = $_GET['table_id'];
        $building_id = $_GET['building_id'];
        $query = mysql_query("select * \n\t\t\t\t\t\t\t\tfrom transactions_tmp a\n\t\t\t\t\t\t\t\twhere a.table_id = '{$table_id}'\n\t\t\t\t\t\t\t\t");
        while ($row = mysql_fetch_array($query)) {
            $data = "'',\n\t\t\t\t\t'{$table_id}',\n\t\t\t\t\t'" . $row['transaction_date'] . "', \n\t\t\t\t\t'" . $row['transaction_total'] . "'\n\t\t\t";
            create_config("transactions", $data);
            $transaction_id = mysql_insert_id();
            $query_detail = mysql_query("select * \n\t\t\t\t\t\t\t\tfrom transaction_tmp_details a\n\t\t\t\t\t\t\t\twhere a.transaction_id = '" . $row['transaction_id'] . "'\n\t\t\t\t\t\t\t\t");
            while ($row_detail = mysql_fetch_array($query_detail)) {
                $data_detail = "'',\n\t\t\t\t\t\t\t\t\t'{$transaction_id}',\n\t\t\t\t\t\t\t\t\t'" . $row_detail['menu_id'] . "',\n\t\t\t\t\t\t\t\t\t'" . $row_detail['transaction_detail_price'] . "',\n\t\t\t\t\t\t\t\t\t'" . $row_detail['transaction_detail_qty'] . "',\n\t\t\t\t\t\t\t\t\t'" . $row_detail['transaction_detail_total'] . "'\n\t\t\t\t\t\t\t\t\t";
                create_config("transaction_details", $data_detail);
            }
            delete_tmp($table_id);
        }
        header("location: table.php?building_id={$building_id}");
        break;
}
Example #5
0
function step_3()
{
    global $_path, $_rewrite;
    if (request_confirm('Create_Configuration')) {
        if (create_config()) {
            if ($_rewrite) {
                // si l'URL_REWRITING est activé.
                create_htaccess();
            }
            if (file_exists($_path . "Config.php")) {
                ?>
				<form method="POST" action="<?php 
                echo get_link("Install") . "&step=2";
                ?>
">
				<p>Félicitation Le fichier de configuration à votre base de donnée à bien été crée
				Ce fichier va permettre à Caranille de communiquer à votre base de donnée.</p><br />
				<br /><br />
				<input type="submit" name="Choose_Curve" value="Continuer"/>
				</form>

				<?php 
            } else {
                echo 'Le fichier de configuration n\'a pu être crée. Veuillez vérifier que PHP à bien les droits d\'écriture';
            }
        }
    }
}
     $i_date = format_back_date($i_date);
     $i_jam = date("h:i:s");
     $table_id = get_isset($_GET['table_id']);
     $member_id = get_isset($_GET['member_id']);
     $tanggal = $i_date . " " . $i_jam;
     //echo "ok";
     $get_building_id = get_building_id($table_id);
     $get_total = get_total($table_id);
     $data = "'',\n\t\t\t\t\t'{$table_id}',\t\n\t\t\t\t\t'{$member_id}',\n\t\t\t\t\t'{$tanggal}'\n\t\t\t\t\t\n\t\t\t\t";
     create_config("transactions_tmp", $data);
     $transaction_id = mysql_insert_id();
     $query_item = select_item();
     while ($row_item = mysql_fetch_array($query_item)) {
         $get_data_menu = get_data_menu($row_item['menu_id']);
         $data_item = "'',\n\t\t\t\t\t\t\t'{$transaction_id}',\n\t\t\t\t\t\t\t'" . $row_item['menu_id'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_original_price'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_margin_price'] . "',\n\t\t\t\t\t\t\t'" . $get_data_menu['menu_price'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_discount'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_grand_price'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_qty'] . "',\n\t\t\t\t\t\t\t'" . $row_item['tnt_total'] . "'\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t";
         create_config("transaction_tmp_details", $data_item);
     }
     delete($table_id);
     if ($table_id == 0) {
         header("Location: payment.php?table_id={$table_id}&building_id={$get_building_id}");
     } else {
         header("Location: order.php?building_id={$get_building_id}");
     }
     break;
 case 'save_edit':
     extract($_POST);
     $i_date = get_isset($_GET['date']);
     $i_date = format_back_date($i_date);
     $i_jam = date("h:i:s");
     $table_id = get_isset($_GET['table_id']);
     $member_id = get_isset($_GET['member_id']);
Example #7
0
         $row->item_name = false;
         $row->unit_id = false;
         $row->item_limit = false;
         $action = "stock.php?page=save";
     }
     $query_resep = select_resep($id);
     $query_resep2 = select_resep($id);
     include '../views/stock/form.php';
     //include '../views/stock/list_resep.php';
     get_footer();
     break;
 case 'add_menu':
     $item_id = get_isset($_GET['item_id']);
     $i_id = get_isset($_GET['i_id']);
     $data = "'',\n\t\t\t\t\t'{$i_id}',\n\t\t\t\t\t'{$item_id}',\n\t\t\t\t\t'0', \n\t\t\t\t\t'" . $_SESSION['user_id'] . "'\n\t\t\t\t\t\n\t\t\t";
     create_config("resep_details", $data);
     header("Location: stock.php?page=form&id={$i_id}");
     break;
 case 'save':
     extract($_POST);
     $i_name = get_isset($i_name);
     $i_unit_id = get_isset($i_unit_id);
     $i_item_limit = get_isset($i_item_limit);
     $data = "'',\n\t\t\t\t\t'{$i_name}',\n\t\t\t\t\t'{$i_unit_id}',\n\t\t\t\t\t'{$i_item_limit}'\n\t\t\t";
     //echo $data;
     $id = create($data);
     create_stock($id);
     header("Location: stock.php?page=form&id={$id}");
     break;
 case 'edit':
     extract($_POST);
         $query_history = select_history($table_id);
         include '../views/transaction/history_order.php';
     }
     //get_footer();
     break;
 case 'form_widget':
     $menu_id = $_GET['menu_id'];
     $jumlah = $_GET['jumlah'];
     $table_id = $_GET['table_id'];
     $get_widget = get_widget($menu_id, $table_id);
     if ($jumlah == 0) {
         delete_config("widget_tmp", "menu_id = '{$menu_id}' and user_id = '" . $_SESSION['user_id'] . "' and table_id = '{$table_id}'");
     } else {
         if ($get_widget == 0) {
             $data = "'',\n\t\t\t\t\t\t'" . $_SESSION['user_id'] . "',\n\t\t\t\t\t\t'{$menu_id}',\n\t\t\t\t\t\t'{$jumlah}',\n\t\t\t\t\t\t'{$table_id}',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'0'\n\t\t\t\t\t\t\t";
             create_config("widget_tmp", $data);
         } else {
             $data = "jumlah = '{$jumlah}'\n\t\t\t\t\t\t\t\t\t\t";
             update_config2("widget_tmp", $data, "menu_id = '{$menu_id}' and user_id = '" . $_SESSION['user_id'] . "' and table_id = '{$table_id}'");
         }
     }
     include '../views/transaction/widget.php';
     break;
 case 'delete_widget':
     $id = get_isset($_GET['id']);
     $table_id = get_isset($_GET['table_id']);
     delete_config("widget_tmp", "wt_id = '{$id}'");
     delete_config("widget_tmp_details", "wt_id = '{$id}'");
     header("Location: transaction.php?table_id={$table_id}&did=3");
     break;
 case 'delete_note':
Example #9
0
function step_3()
{
    global $_path, $_rewrite, $install_step, $bdd;
    $aff = false;
    if (request_confirm('Create_Configuration')) {
        if (create_config()) {
            if ($_rewrite) {
                // si l'URL_REWRITING est activé.
                create_htaccess();
            }
        }
        $aff = true;
    } elseif ($install_step == 2) {
        if (empty($_POST)) {
            $aff = true;
        } else {
            if (!request_confirm('Choose_Curve')) {
                $aff = false;
            } else {
                echo "cas de figure inattendue...<br/>";
            }
        }
    } else {
        $aff = false;
    }
    if ($aff) {
        if (file_exists($_path . "Config.php")) {
            connect_db();
            if ($bdd !== false) {
                ?>
    			
    			<form method="POST" action="<?php 
                echo get_link("Index", "Install");
                ?>
">
        			<p>Félicitation Le fichier de configuration à votre base de donnée à bien été crée
        			Ce fichier va permettre à Caranille de communiquer à votre base de donnée.</p><br />
        			<br /><br />
        			<input type="submit" name="Choose_Curve" value="Continuer"/>
    			</form>
    
    			<?php 
            } else {
                echo "Le fichier de configuration contient une erreur...";
            }
        } else {
            echo "Le fichier de configuration n'a pu être crée. Veuillez vérifier que PHP à bien les droits d'écriture";
        }
    } else {
        echo "erreur inattendue...<br/>";
    }
}
Example #10
0
     create_config("resep_details", $data);
     if (!$i_id) {
         header("Location: resep.php?page=form");
     } else {
         header("Location: resep.php?page=form&id={$i_id}");
     }
     break;
 case 'save':
     extract($_POST);
     //echo "test";
     $i_id = get_isset($_GET['i_id']);
     $i_name = get_isset($_GET['i_name']);
     $i_item_produck = get_isset($_GET['i_item_produck']);
     if (!$i_id) {
         $data = "'',\n\t\t\t\t\t'{$i_name}',\t\n\t\t\t\t\t'{$i_item_produck}'\n\t\t\t\t\t\n\t\t\t\t";
         create_config("reseps", $data);
         $resep_id = mysql_insert_id();
     } else {
         $data = "resep_name = '{$i_name}',\n\t\t\t\titem_id = '{$i_item_produck}'\n\t\t\t\t\n\t\t\t\t";
         update_config("reseps", $data, "resep_id", $i_id);
         $resep_id = $i_id;
     }
     update_detail($resep_id, $_SESSION['user_id']);
     header("Location: resep.php");
     break;
 case 'edit_price':
     $id = get_isset($_GET['id']);
     $qty = get_isset($_GET['qty']);
     $price = get_isset($_GET['price']);
     $total = $qty * $price;
     $data = "transaction_internal_detail_qty = '{$qty}',\n\t\t\t\ttransaction_internal_detail_price = '{$price}',\n\t\t\t\ttransaction_internal_detail_total= '{$total}'\n\t\t\t\t\n\t\t";
Example #11
0
// DO THIS FIRST! Before we include any kernel stuff to avoid duplicate defines
if (isset($_REQUEST['submit_db_info'])) {
    if ($_REQUEST['db'] == "firebird" && empty($gBitDbName)) {
        //	Should only be called when creating the datatabse
        require_once "create_firebird_database.php";
        FirebirdCreateDB($_REQUEST['host'], $_REQUEST['user'], $_REQUEST['pass'], $_REQUEST['name'], $_REQUEST['fbpath']);
    }
    if (empty($gBitDbType)) {
        $tmpHost = $_REQUEST['host'];
        if ($_REQUEST['db'] == 'mssql' && get_magic_quotes_gpc() == 1) {
            // pull doubled up slashes from config
            $tmpHost = stripslashes($tmpHost);
        }
        require_once 'create_config_inc.php';
        $createHash = array("gBitDbType" => $_REQUEST['db'], "gBitDbHost" => $tmpHost, "gBitDbUser" => $_REQUEST['user'], "gBitDbPassword" => $_REQUEST['pass'], "gBitDbName" => $_REQUEST['name'], "gBitDbCaseSensitivity" => $_REQUEST['dbcase'], "bit_db_prefix" => $_REQUEST['prefix'], "bit_root_url" => $_REQUEST['baseurl'], "auto_bug_submit" => !empty($_REQUEST['auto_bug_submit']) ? 'TRUE' : 'FALSE', "is_live" => !empty($_REQUEST['is_live']) ? 'TRUE' : 'FALSE');
        create_config($createHash);
        include $config_file;
    }
}
require_once "../kernel/setup_inc.php";
require_once 'BitInstaller.php';
if (defined('ROLE_MODEL')) {
    require_once USERS_PKG_PATH . 'RoleUser.php';
} else {
    require_once USERS_PKG_PATH . 'BitUser.php';
}
// set some preferences during installation
global $gBitInstaller, $gBitSystem, $gBitThemes;
$gBitInstaller = new BitInstaller();
// IF DB has not been created yet, then packages will not have been scanned yet.
// and even if they have been scanned, then they will only include active packages,
 extract($_POST);
 //echo "test";
 $i_item = get_isset($_GET['i_item']);
 //$i_item = get_resep($i_resep);
 //$item_id = $i_item['item_id'];
 $row_id = get_isset($_GET['row_id']);
 $i_date = get_isset($_GET['i_date']);
 $i_date = format_back_date($i_date);
 $i_code = get_isset($_GET['i_code']);
 $i_cabang = get_isset($_GET['i_cabang']);
 $i_hasil = get_isset($_GET['i_hasil']);
 $i_target = get_isset($_GET['i_target']);
 $branch_id = $_SESSION['branch_id'];
 if (!$row_id) {
     $data = "'',\n\t\t\t\t\t'{$i_cabang}',\t\n\t\t\t\t\t'{$i_code}',\n\t\t\t\t\t'{$i_date}',\n\t\t\t\t\t'{$i_item}',\n\t\t\t\t\t'{$i_target}',\n\t\t\t\t\t'{$i_hasil}'\n\t\t\t\t\t\n\t\t\t\t";
     create_config("transaction_productions", $data);
     $transaction_production_id = mysql_insert_id();
     update_detail($transaction_production_id, $_SESSION['user_id']);
     $query_item = select_item($transaction_production_id);
     while ($row_item = mysql_fetch_array($query_item)) {
         //echo $row_item['transaction_production_detail_id'];
         //Minus stock
         $select_stock = select_stock($row_item['branch_id'], $row_item['item_id']);
         $stock_minus = $select_stock['item_stock_qty'] - $row_item['transaction_production_detail_qty'];
         update_stock($row_item['branch_id'], $row_item['item_id'], $stock_minus);
     }
 } else {
     update_production($row_id, $i_hasil);
     //plus stock
     $select_stock2 = select_stock($i_cabang, $i_item);
     $stock_plus = $select_stock2['item_stock_qty'] + $i_hasil;
Example #13
0
    $sql_type = $dbms;
} else {
    soft_error('No database type found in your config file');
}
echo "<p>Your database type is: {$sql_type}</p>";
// connect to the database
$db = NewADOConnection($sql_type);
$ok = $db->Connect($sql_host, $sql_user, $sql_passwd, $sql_database);
if (!$ok) {
    soft_error('Could not connect to the database');
}
update_calno('calendars');
update_calno('events');
update_calno('users');
echo "<p>Paste this into your config.php:</p>";
echo "<pre>" . htmlspecialchars(create_config($sql_host, $sql_user, $sql_passwd, $sql_database, $sql_prefix, $sql_type)) . "</pre>";
function update_calno($table_suffix)
{
    global $db, $calendarName;
    // update calno column in $table_suffix
    $query = "SELECT * FROM " . SQL_PREFIX . "{$table_suffix}";
    $result = $db->SelectLimit($query, 1) or db_error('Error in query', $query);
    if ($result->FieldCount() == 0) {
        soft_error("You cannot upgrade a DB with no events.");
    }
    $event = $result->FetchRow();
    if (array_key_exists('calendar', $event)) {
        $calendarName = $event['calendar'];
    } else {
        if (array_key_exists('calno', $event)) {
            $query = "ALTER TABLE " . SQL_PREFIX . "{$table_suffix}\n" . "CHANGE calno calendar varchar(32)";
<?php

require_once PATH_TO_DIR . '/templates/header.php';
?>
<div id="form_db_tab">
	<form action='<?php 
create_config();
?>
' method="POST">
	<div>
		<div class="field_desc">Your Database Name</div>
		<div class="field"><input type='text' name="db_name" placeholder="database name" id="db_name" required></div>
	</div>	
	<div>
		<div class="field_desc">Your Database HOST</div>
		<div class="field"><input type='text' name="db_host" placeholder="database host" id="db_host" value="localhost" required></div>
	</div>
	<div>
		<div class="field_desc">Your Database User Name</div>
		<div class="field"><input type='text' name="db_user" placeholder="user name" id="db_user" required></div>
	</div>
	<div>
		<div class="field_desc">Your Database User Password</div>
		<div class="field"><input type='password' name="db_password" placeholder="user password" id="db_password" required></div>
	</div>
	<div>	
		<div class="field"><input type='submit' name="create_config" id="submit" value="SUBMIT"></div>
	</div>
	</form>
	<?php 
if (isset($_SESSION['db_error'])) {
 function create_config_file()
 {
     $db_host = isset($_POST['db_host']) ? trim($_POST['db_host']) : '';
     $db_port = isset($_POST['db_port']) ? trim($_POST['db_port']) : '';
     $db_user = isset($_POST['db_user']) ? trim($_POST['db_user']) : '';
     $db_pass = isset($_POST['db_pass']) ? trim($_POST['db_pass']) : '';
     $db_name = isset($_POST['db_name']) ? trim($_POST['db_name']) : '';
     $timezone = isset($_POST['timezone']) ? trim($_POST['timezone']) : 'Asia/Shanghai';
     $result = create_config($db_host, $db_port, $db_user, $db_pass, $db_name, $timezone);
     if ($result === false) {
         echo "create_config_file erro";
     } else {
         echo 'OK';
     }
     exit;
 }
     header('Location: purchase.php?page=list&did=2');
     break;
 case 'delete':
     $id = get_isset($_GET['id']);
     delete($id);
     header('Location: purchase.php?page=list&did=3');
     break;
 case 'payment':
     $id = get_isset($_GET['id']);
     payment($id);
     header('Location: purchase.php?page=list&did=4');
     break;
 case 'add_menu':
     $item_id = get_isset($_GET['item_id']);
     $data = "'',\n\t\t\t\t\t'0',\n\t\t\t\t\t'{$item_id}',\n\t\t\t\t\t'0', \n\t\t\t\t\t'0',\n\t\t\t\t\t'" . $_SESSION['user_id'] . "'\n\t\t\t\t\t\n\t\t\t";
     create_config("purchase_details", $data);
     header("Location: purchase.php?page=form");
     break;
 case 'edit_price':
     $id = get_isset($_GET['id']);
     $qty = get_isset($_GET['qty']);
     $price = get_isset($_GET['price']);
     $data = "purchase_detail_qty = '{$qty}',\n\t\t\t\tpurchase_detail_price = '{$price}'\n\t\t\t\t\n\t\t";
     update_config("purchase_details", $data, "purchase_detail_id", $id);
     break;
 case 'edit_qty':
     $id = get_isset($_GET['id']);
     $qty = get_isset($_GET['qty']);
     $price = get_isset($_GET['price']);
     $data = "purchase_detail_qty = '{$qty}',\n\t\t\t\tpurchase_detail_price = '{$price}'\n\t\t\t\t\n\t\t";
     update_config("purchase_details", $data, "purchase_detail_id", $id);
Example #17
0
function install_base()
{
    global $phpc_config_file, $dbh;
    $sql_type = "mysqli";
    $my_hostname = $_POST['my_hostname'];
    $my_username = $_POST['my_username'];
    $my_passwd = $_POST['my_passwd'];
    $my_prefix = $_POST['my_prefix'];
    $my_database = $_POST['my_database'];
    $fp = fopen($phpc_config_file, 'w') or soft_error('Couldn\'t open config file.');
    fwrite($fp, create_config($my_hostname, $my_username, $my_passwd, $my_database, $my_prefix, $sql_type)) or soft_error("Could not write to file");
    fclose($fp);
    // Make the database connection.
    include $phpc_config_file;
    $dbh = connect_db(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE);
    create_tables();
    echo "<p>Config file created at \"" . realpath($phpc_config_file) . "\"</p>" . "<p>Calendars database created</p>\n" . "<div><input type=\"submit\" name=\"base\" value=\"continue\">" . "</div>\n";
}
Example #18
0
function install_base()
{
    global $phpc_root_path, $db;
    $sql_type = $_POST['sql_type'];
    $my_hostname = $_POST['my_hostname'];
    $my_username = $_POST['my_username'];
    $my_passwd = $_POST['my_passwd'];
    $my_prefix = $_POST['my_prefix'];
    $my_database = $_POST['my_database'];
    $fp = fopen($phpc_root_path . 'config.php', 'w') or soft_error('Couldn\'t open config file.');
    fwrite($fp, create_config($my_hostname, $my_username, $my_passwd, $my_database, $my_prefix, $sql_type)) or soft_error("could not write to file");
    fclose($fp);
    require_once $phpc_root_path . 'config.php';
    // Make the database connection.
    $db = NewADOConnection(SQL_TYPE);
    if (!$db->Connect(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE)) {
        db_error(_("Could not connect to the database"));
    }
    create_tables();
    echo "<p>calendars base created</p>\n" . "<div><input type=\"submit\" name=\"base\" value=\"continue\">" . "</div>\n";
}
     $item_id = get_isset($_GET['item_id']);
     $data = "'',\n\t\t\t\t\t'0',\n\t\t\t\t\t'{$item_id}',\n\t\t\t\t\t'0', \n\t\t\t\t\t'0',\n\t\t\t\t\t'0',\n\t\t\t\t\t'" . $_SESSION['user_id'] . "'\n\t\t\t\t\t\n\t\t\t";
     create_config("transaction_internal_details", $data);
     header("Location: transaksi_internal.php?page=form");
     break;
 case 'save':
     extract($_POST);
     //echo "test";
     $i_date = get_isset($_GET['i_date']);
     $i_date = format_back_date($i_date);
     $i_code = get_isset($_GET['i_code']);
     $i_pabrik = get_isset($_GET['i_pabrik']);
     $i_cabang = get_isset($_GET['i_cabang']);
     $branch_id = $_SESSION['branch_id'];
     $data = "'',\n\t\t\t\t\t'{$i_code}',\t\n\t\t\t\t\t'{$i_date}',\n\t\t\t\t\t'{$i_pabrik}',\n\t\t\t\t\t'{$i_cabang}',\n\t\t\t\t\t'{$branch_id}'\n\t\t\t\t\t\n\t\t\t\t";
     create_config("transaction_internals", $data);
     $transaction_internal_id = mysql_insert_id();
     update_detail($transaction_internal_id, $_SESSION['user_id']);
     $query_item = select_item($transaction_internal_id);
     while ($row_item = mysql_fetch_array($query_item)) {
         //echo $row_item['transaction_internal_detail_id'];
         //pabrik
         $select_stock_pabrik = select_stock($row_item['pabrik_branch_id'], $row_item['item_id']);
         $stock_pabrik = $select_stock_pabrik['item_stock_qty'] - $row_item['transaction_internal_detail_qty'];
         update_stock($row_item['pabrik_branch_id'], $row_item['item_id'], $stock_pabrik);
         //cabang
         $select_stock_cabang = select_stock($row_item['cabang_branch_id'], $row_item['item_id']);
         $stock_cabang = $select_stock_cabang['item_stock_qty'] + $row_item['transaction_internal_detail_qty'];
         update_stock($row_item['cabang_branch_id'], $row_item['item_id'], $stock_cabang);
     }
     header("Location: transaksi_internal.php");