@@ -173,7 +178,7 @@ require('./header.php');
}
krsort($list, SORT_STRING);
foreach ($list as $item) {
- echo "
#{$item['id']} to {$item['contactClientName']} ({$item['start']} - {$item['end']}; {$item['price_excl']} excl. VAT, {$item['price_incl']} incl. VAT){$item['percentage']}% complete
+ echo "
#{$item['id']} to {$item['contactClientName']} ({$item['start']} - {$item['end']}; {$item['price_excl']} excl. VAT, {$item['price_incl']} incl. VAT){$item['percentage']}% complete
";
@@ -206,11 +211,11 @@ require('./header.php');
CURDATE()"));
foreach ($offers as $offer) {
- echo "
";
- echo "{$offer->id} | ";
- echo "{$offer->getContact()->getClient()->name} | ";
- echo "".BusinessAdmin::formatDate($offer->end_date, false)." | ";
- echo "
";
+ echo "
+ {$offer->id} |
+ {$offer->getContact()->getClient()->name} |
+ ".BusinessAdmin::formatDate($offer->end_date, false)." |
+
";
}
if (count($offers) == 0) {
echo "
There are no offers that need an invoice. |
";
@@ -235,6 +240,7 @@ require('./header.php');
# |
Contact |
Invoice sent |
+
Braintree status |
@@ -243,15 +249,35 @@ require('./header.php');
"`invoice_date` > '1970-01-01'",
"`invoice_date`<=CURDATE()",
"NOT EXISTS (SELECT * FROM `".Constants::db_prefix."payment` WHERE `offerId`=`".Constants::db_prefix."offer`.`id`)"));
- if (count($offers) == 0) {
- echo "There are no currently open invoices. |
";
+ $open_offers = BusinessAdmin::getOffers($_pdo,
+ ['EXISTS (SELECT * FROM `'.Constants::db_prefix.'payment` WHERE `offerId`=`'.Constants::db_prefix.'offer`.`id` AND `braintree_id` IS NOT NULL)']);
+ $count = count($offers);
+ foreach ($open_offers as $offer) {
+ if (!$offer->getPayment()->isBraintreeFinished()) {
+ $count++;
+ }
+ }
+ if ($count == 0) {
+ echo "There are no currently open invoices. |
";
} else {
foreach ($offers as $offer) {
- echo "";
- echo "{$offer->id} | ";
- echo "{$offer->getContact()->getClient()->name} | ";
- echo "".BusinessAdmin::formatDate($offer->invoice_date, false)." | ";
- echo "
";
+ echo "
+ {$offer->id} |
+ {$offer->getContact()->getClient()->name} |
+ ".BusinessAdmin::formatDate($offer->invoice_date, false)." |
+ |
+
";
+ }
+ foreach ($open_offers as $offer) {
+ if ($offer->getPayment()->isBraintreeFinished()) {
+ continue;
+ }
+ echo "
+ {$offer->id} |
+ {$offer->getContact()->getClient()->name} |
+ ".BusinessAdmin::formatDate($offer->invoice_date, false)." |
+ {$offer->getPayment()->braintree_status} |
+
";
}
}
?>
diff --git a/include/offers-overview.php b/include/offers-overview.php
index 6d9bbc1..29b52b3 100644
--- a/include/offers-overview.php
+++ b/include/offers-overview.php
@@ -103,7 +103,7 @@ require_once('./login.php');
";
}
if (count($offers) == 0) {
- echo "There are no offers in the database. Why not start with creating one, below? |
";
+ echo "There are no offers in the database. |
";
}
?>
diff --git a/include/offers-view.php b/include/offers-view.php
index 1455e43..323fc31 100644
--- a/include/offers-view.php
+++ b/include/offers-view.php
@@ -57,7 +57,7 @@ $_offer = new Offer($_pdo, $_id);
";
}
if (count($assignments) == 0) {
- echo "
There are no assignments in the database. Why not start with creating one, below? |
";
+ echo "
There are no assignments in the database. |
";
}
?>
@@ -99,7 +99,7 @@ $_offer = new Offer($_pdo, $_id);
";
}
if (count($discounts) == 0) {
- echo "
There are no discounts in the database. Why not start with creating one, below? |
";
+ echo "
There are no discounts in the database. |
";
}
?>
@@ -135,7 +135,7 @@ $_offer = new Offer($_pdo, $_id);
";
}
if (count($payments) == 0) {
- echo "
There are no payments in the database. Why not start with creating one, below? |
";
+ echo "
There are no payments in the database. |
";
}
?>
diff --git a/include/offers.php b/include/offers.php
index 165d88f..22bd332 100644
--- a/include/offers.php
+++ b/include/offers.php
@@ -127,6 +127,7 @@ require('./header.php');
//------------------------------------------------------------------------------
// The header of the page
//------------------------------------------------------------------------------
+
$header = 'Offers';
// Whether or not to show an individual offer in the end (false if not, or the id if yes)
$show_individual = false;
@@ -136,7 +137,7 @@ require('./header.php');
$id = (int) $_GET['id'];
try {
$offer = new Offer($_pdo, $id);
- $header = "
Offers / #{$offer->id}";
+ $header = "
Offers / #
{$offer->id}";
$show_individual = $id;
$accepted = $offer->accepted ?
['Accepted', 'btn-success'] :
--
cgit v1.2.3