From 203351510e5470f31b431ba2d2923ee0f25f19d1 Mon Sep 17 00:00:00 2001 From: Lillem4n Date: Wed, 16 Nov 2011 17:02:20 +0100 Subject: [PATCH] Fixed some minor errors and added some DB updates --- css/admin/style.css | 5 +- init.php | 142 ++++++++++++++++++++------------------- xsl/admin/accounting.xsl | 8 +-- 3 files changed, 78 insertions(+), 77 deletions(-) diff --git a/css/admin/style.css b/css/admin/style.css index bfd78c3..50bddfb 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -281,11 +281,10 @@ div#loginbox border-bottom: 1px solid #d4d4d4; } - .contentwrap2 table tfoot td + .contentwrap2 table tfoot th { - font-weight: bold; - text-align: left; border-top: 1px solid #d4d4d4; + border-bottom: none; } .contentwrap2 table .small_row diff --git a/init.php b/init.php index 5bd3018..11e0a1d 100644 --- a/init.php +++ b/init.php @@ -4,86 +4,88 @@ $pdo = Kohana_pdo::instance('default'); $column_name = 'Tables_in_'.Kohana::$config->load('pdo.default.database_name'); $columns = $pdo->query(' - SHOW TABLES - WHERE - '.$column_name.' = \'bills\' OR - '.$column_name.' = \'bills_items\' OR - '.$column_name.' = \'employees\' OR - '.$column_name.' = \'transactions\' OR - '.$column_name.' = \'customers\' - ')->fetchAll(PDO::FETCH_COLUMN); + SHOW TABLES + WHERE + '.$column_name.' = \'bills\' OR + '.$column_name.' = \'bills_items\' OR + '.$column_name.' = \'employees\' OR + '.$column_name.' = \'transactions\' OR + '.$column_name.' = \'customers\' + ')->fetchAll(PDO::FETCH_COLUMN); if (count($columns) != 5) { $pdo->query('CREATE TABLE `bills` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `due_date` timestamp NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `customer_id` int(10) unsigned NOT NULL, - `customer_name` varchar(255) NOT NULL, - `customer_orgnr` bigint(20) unsigned NOT NULL, - `customer_contact` varchar(255) NOT NULL, - `customer_tel` varchar(100) NOT NULL, - `customer_email` varchar(100) NOT NULL, - `customer_street` varchar(255) NOT NULL, - `customer_zip` varchar(50) NOT NULL, - `customer_city` varchar(255) NOT NULL, - `comment` text NOT NULL, - `paid_date` timestamp NULL DEFAULT NULL, - `contact` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - KEY `customer_id` (`customer_id`) + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `due_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `customer_id` int(10) unsigned NOT NULL, + `customer_name` varchar(255) NOT NULL, + `customer_orgnr` bigint(20) unsigned NOT NULL, + `customer_contact` varchar(255) NOT NULL, + `customer_tel` varchar(100) NOT NULL, + `customer_email` varchar(100) NOT NULL, + `customer_street` varchar(255) NOT NULL, + `customer_zip` varchar(50) NOT NULL, + `customer_city` varchar(255) NOT NULL, + `comment` text NOT NULL, + `paid_date` timestamp NULL DEFAULT NULL, + `contact` varchar(255) NOT NULL, + `email_sent` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `customer_id` (`customer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `bills_items` ( - `item_id` int(11) NOT NULL, - `bill_id` int(11) NOT NULL, - `artnr` varchar(50) NOT NULL, - `spec` varchar(255) NOT NULL, - `qty` float NOT NULL, - `price` double NOT NULL, - `delivery_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`item_id`,`bill_id`) + `item_id` int(11) NOT NULL, + `bill_id` int(11) NOT NULL, + `artnr` varchar(50) NOT NULL, + `spec` varchar(255) NOT NULL, + `qty` float NOT NULL, + `price` double NOT NULL, + `delivery_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`item_id`,`bill_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `employees` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `lastname` varchar(255) NOT NULL, - `firstname` varchar(255) NOT NULL, - `SSN` varchar(100) NOT NULL, - `bank_name` varchar(255) DEFAULT NULL, - `bank_account` varchar(255) DEFAULT NULL, - `street` varchar(255) NOT NULL, - `zip` varchar(255) NOT NULL, - `city` varchar(255) NOT NULL, - `status` varchar(100) NOT NULL, - `comments` text NOT NULL, - `tax_level` float NOT NULL, - `email` varchar(255) NOT NULL, - PRIMARY KEY (`id`) + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lastname` varchar(255) NOT NULL, + `firstname` varchar(255) NOT NULL, + `SSN` varchar(100) NOT NULL, + `bank_name` varchar(255) DEFAULT NULL, + `bank_account` varchar(255) DEFAULT NULL, + `street` varchar(255) NOT NULL, + `zip` varchar(255) NOT NULL, + `city` varchar(255) NOT NULL, + `status` varchar(100) NOT NULL, + `comments` text NOT NULL, + `tax_level` float NOT NULL, + `email` varchar(255) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `transactions` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `accounting_date` date NOT NULL, - `transfer_date` date DEFAULT NULL, - `description` text NOT NULL, - `journal_id` varchar(255) DEFAULT NULL, - `vat` double NOT NULL, - `sum` double NOT NULL, - `employee_id` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `journal_id` (`journal_id`), - KEY `employee_id` (`employee_id`) + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `accounting_date` date NOT NULL, + `transfer_date` date DEFAULT NULL, + `description` text NOT NULL, + `journal_id` varchar(255) DEFAULT NULL, + `vat` double NOT NULL, + `sum` double NOT NULL, + `employee_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `journal_id` (`journal_id`), + KEY `employee_id` (`employee_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `customers` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `orgnr` bigint(20) unsigned NOT NULL, - `contact` varchar(255) NOT NULL, - `tel` varchar(100) NOT NULL, - `email` varchar(100) NOT NULL, - `street` varchar(255) NOT NULL, - `zip` varchar(50) NOT NULL, - `city` varchar(255) NOT NULL, - `comment` text NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `orgnr` bigint(20) unsigned NOT NULL, + `contact` varchar(255) NOT NULL, + `tel` varchar(100) NOT NULL, + `email` varchar(100) NOT NULL, + `street` varchar(255) NOT NULL, + `zip` varchar(50) NOT NULL, + `city` varchar(255) NOT NULL, + `comment` text NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1;'); + } diff --git a/xsl/admin/accounting.xsl b/xsl/admin/accounting.xsl index a9abf2a..0fb3bb3 100644 --- a/xsl/admin/accounting.xsl +++ b/xsl/admin/accounting.xsl @@ -64,10 +64,10 @@ - - - - + + + +