Skip to content

Commit

Permalink
Fixed some minor errors and added some DB updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lillem4n committed Nov 16, 2011
1 parent 314a913 commit 2033515
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 77 deletions.
5 changes: 2 additions & 3 deletions css/admin/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
142 changes: 72 additions & 70 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;');

}
8 changes: 4 additions & 4 deletions xsl/admin/accounting.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
</thead>
<tfoot>
<tr>
<td colspan="4"></td>
<td class="right"><xsl:value-of select="format-number(number(sum(accounting/entry/sum)), '#,##0.00')" /></td>
<td class="right"><xsl:value-of select="format-number(number(sum(accounting/entry/vat)), '#,##0.00')" /></td>
<td colspan="3"></td>
<th colspan="4"></th>
<th class="right"><xsl:value-of select="format-number(number(sum(accounting/entry/sum)), '#,##0.00')" /></th>
<th class="right"><xsl:value-of select="format-number(number(sum(accounting/entry/vat)), '#,##0.00')" /></th>
<th colspan="3"></th>
</tr>
</tfoot>
<tbody>
Expand Down

0 comments on commit 2033515

Please sign in to comment.