-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
113 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,43 +13,36 @@ public function action_index() | |
{ | ||
$this->xml_content_bills = $this->xml_content->appendChild($this->dom->createElement('bills')); | ||
xml::to_XML(Bills::get(), $this->xml_content_bills, 'bill', 'id'); | ||
|
||
$session = Session::instance(); | ||
if ($message = $session->get_once('message')) | ||
$this->add_message($message); | ||
elseif ($error = $session->get_once('error')) | ||
$this->add_error($error); | ||
} | ||
|
||
public function action_email() | ||
{ | ||
//Get the bill data. | ||
$bill = New Bill($_GET['invoice']); | ||
$costumer = $bill->get_customer_data('costumer_email'); | ||
|
||
$mail = new Mail(); | ||
$mail->from('Larv IT AB', '[email protected]'); | ||
$mail->to($costumer); | ||
$mail->subject('Invoice from Larv IT'); | ||
$mail->content('Invoice sent'); | ||
$mail->attachment(url::base('http',FALSE).'/user_content/pdf/bill_'.$_GET['invoice'].'.pdf'); | ||
|
||
if($mail->send()) | ||
{ | ||
die('Email was sent and costumer = '.$costumer); | ||
} | ||
else | ||
{ | ||
die('email was not sent and costumer = '.$costumer); | ||
} | ||
|
||
// if email sent then update bills.invoice_sent with CURRENT_TIMESTAMP | ||
} | ||
|
||
|
||
public function action_new_bill() | ||
|
||
public function action_email() | ||
{ | ||
$session = Session::instance(); | ||
$bill_id = $this->request->param('options'); | ||
$bill = new Bill($bill_id); | ||
if ($bill->send_mail()) | ||
$session->set('message', 'Mail sent for bill #'.$bill_id); | ||
else | ||
$session->set('error', 'Mail for bill #'.$bill_id.' failed!'); | ||
|
||
$this->redirect(); | ||
|
||
// if email sent then update bills.invoice_sent with CURRENT_TIMESTAMP | ||
} | ||
|
||
|
||
public function action_bill() | ||
{ | ||
$this->xml_content_customers = $this->xml_content->appendChild($this->dom->createElement('customers')); | ||
xml::to_XML(Customers::get_customers(), $this->xml_content_customers, 'customer', 'id'); | ||
|
||
if ( ! isset($_SESSION['bills']['items'])) | ||
{ | ||
$_SESSION['bills']['items']['1item'] = 1; | ||
} | ||
if ( ! isset($_SESSION['bills']['items'])) $_SESSION['bills']['items']['1item'] = 1; | ||
|
||
if (count($_POST)) | ||
{ | ||
|
@@ -106,8 +99,10 @@ public function action_new_bill() | |
$transaction = new Transaction(NULL, $data); | ||
// End of Create the transaction | ||
|
||
// Make the PDF | ||
// Set new default due date | ||
$this->set_formdata(array('due_date' => date('Y-m-d', time() + 20*24*60*60))); | ||
|
||
// Make the PDF | ||
shell_exec('wkhtmltopdf '.$_SERVER['SERVER_NAME'].URL::site('bill?billnr='.$bill_id).' '.APPPATH.'user_content/pdf/bill_'.$bill_id.'.pdf'); | ||
} | ||
else | ||
|
@@ -137,6 +132,6 @@ public function action_mark_as_paid() | |
$bill->pay($pay_date); | ||
$this->redirect(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,27 @@ | |
|
||
return array | ||
( | ||
'soc_fee_levels' => array | ||
( | ||
'soc_fee_levels' => array( | ||
array( | ||
'start_age' => 0, | ||
'end_age' => 26, | ||
'level' => 15.49, | ||
'start_age' => 0, | ||
'end_age' => 26, | ||
'level' => 15.49, | ||
), | ||
array( | ||
'start_age' => 27, | ||
'end_age' => 65, | ||
'level' => 31.42, | ||
'start_age' => 27, | ||
'end_age' => 65, | ||
'level' => 31.42, | ||
), | ||
array( | ||
'start_age' => 66, | ||
'end_age' => 73, | ||
'level' => 10.21, | ||
'start_age' => 66, | ||
'end_age' => 73, | ||
'level' => 10.21, | ||
), | ||
), | ||
'email' => array( | ||
'from' => '[email protected]', | ||
'from_name' => 'Larv IT AB', | ||
'bill_message' => 'This email contains an invoice from Larv IT AB', | ||
'bill_subject' => 'Invoice', | ||
), | ||
); |
Oops, something went wrong.