Initial work on recurring invoices some ui cleanup new DB dump

This commit is contained in:
root 2019-04-07 23:34:06 -04:00
parent a59555bc89
commit 2b7bdee81e
4 changed files with 121 additions and 7 deletions

31
db.sql
View File

@ -258,7 +258,7 @@ CREATE TABLE `expenses` (
`category_id` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
PRIMARY KEY (`expense_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -275,7 +275,7 @@ CREATE TABLE `invoice_history` (
`invoice_history_description` varchar(200) NOT NULL,
`invoice_id` int(11) NOT NULL,
PRIMARY KEY (`invoice_history_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -296,7 +296,7 @@ CREATE TABLE `invoice_items` (
`invoice_item_total` decimal(15,2) NOT NULL,
`invoice_id` int(11) NOT NULL,
PRIMARY KEY (`invoice_item_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -357,7 +357,28 @@ CREATE TABLE `payments` (
`account_id` int(11) NOT NULL,
`invoice_id` int(11) NOT NULL,
PRIMARY KEY (`payment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recurring_invoices`
--
DROP TABLE IF EXISTS `recurring_invoices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `recurring_invoices` (
`recurring_invoice_id` int(11) NOT NULL AUTO_INCREMENT,
`recurring_invoice_frequency` int(11) NOT NULL,
`recurring_invoice_start_date` date NOT NULL,
`recurring_invoice_last_sent` date NOT NULL,
`recurring_invoice_amount` decimal(15,2) NOT NULL,
`recurring_invoice_note` text NOT NULL,
`recurring_invoice_active` int(1) NOT NULL,
`category_id` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
PRIMARY KEY (`recurring_invoice_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -421,4 +442,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-04-07 12:36:00
-- Dump completed on 2019-04-07 23:34:02

87
recurring.php Normal file
View File

@ -0,0 +1,87 @@
<?php include("header.php"); ?>
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
WHERE invoices.client_id = clients.client_id
ORDER BY invoices.invoice_date DESC");
?>
<div class="card mb-3">
<div class="card-header">
<h6 class="float-left mt-1"><i class="fa fa-copy"></i> Recurring Invoices</h6>
<button type="button" class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addRecurringInvoiceModal"><i class="fas fa-plus"></i> New</button>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover" id="dT" width="100%" cellspacing="0">
<thead>
<tr>
<th>Frequency</th>
<th>Client</th>
<th>Start Date</th>
<th>Last Sent</th>
<th class="text-right">Amount</th>
<th>Status</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
$invoice_id = $row['invoice_id'];
$invoice_number = $row['invoice_number'];
$invoice_status = $row['invoice_status'];
$invoice_date = $row['invoice_date'];
$invoice_due = $row['invoice_due'];
$invoice_amount = $row['invoice_amount'];
$client_id = $row['client_id'];
$client_name = $row['client_name'];
?>
<tr>
<td><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>">INV-<?php echo "$invoice_number"; ?></a></td>
<td><a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo "$client_name"; ?></a></td>
<td class="text-right text-monospace">$<?php echo number_format($invoice_amount,2); ?></td>
<td><?php echo "$invoice_date"; ?></td>
<td><div class="<?php echo $overdue_color; ?>"><?php echo "$invoice_due"; ?></div></td>
<td>
<span class="p-2 badge badge-<?php echo $invoice_badge_color; ?>">
<?php echo "$invoice_status"; ?>
</span>
</td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editinvoiceModal<?php echo $invoice_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addinvoiceCopyModal<?php echo $invoice_id; ?>">Copy</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addinvoiceCopyModal<?php echo $invoice_id; ?>">PDF</a>
<a class="dropdown-item" href="post.php?delete_invoice=<?php echo $invoice_id; ?>">Delete</a>
</div>
</div>
</td>
</tr>
<?php
//include("edit_invoice_modal.php");
include("add_invoice_copy_modal.php");
}
?>
</tbody>
</table>
</div>
</div>
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
</div>
<?php include("add_invoice_modal.php"); ?>
<?php include("footer.php");

View File

@ -13,7 +13,7 @@
</li>
<li class="nav-item">
<a class="nav-link" href="vendors.php">
<i class="fas fa-fw fa-briefcase mx-2"></i>
<i class="fas fa-fw fa-building mx-2"></i>
<span>Vendors</span>
</a>
</li>
@ -41,6 +41,12 @@
<span>Payments</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="recurring.php">
<i class="fas fa-fw fa-copy mx-2"></i>
<span>Recurring</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="accounts.php">
<i class="fas fa-fw fa-piggy-bank mx-2"></i>

View File

@ -5,7 +5,7 @@
<div class="card mb-3">
<div class="card-header">
<h6 class="float-left mt-1"><i class="fa fa-briefcase"></i> Vendors</h6>
<h6 class="float-left mt-1"><i class="fa fa-building"></i> Vendors</h6>
<button type="button" class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addVendorModal"><i class="fas fa-plus"></i> New</button>
</div>
<div class="card-body">