Skip to content

Commit

Permalink
fixed #14
Browse files Browse the repository at this point in the history
  • Loading branch information
alkali147 committed Sep 2, 2015
1 parent b9fd9a5 commit 4a0a24f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function fbilling_generate_invoice ($src,$search_results) {
# generate pdf
$pdf = new PDF();
$pdf->SetFont('Arial','',12);
# fwarning, ugly things coming through!
# WARNING, ugly things coming through!
# for PDF pagination, we loop through number of pages we have
for ($page=0; $page < $number_of_pages; $page++) {
$pdf->AddPage(); # createnew page
Expand Down
6 changes: 6 additions & 0 deletions page.fbilling_reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
if ($_REQUEST['dst'] == '' or !$_REQUEST['dst']) {$dst = 'all';} else {$dst = $_REQUEST['dst'];}
$src_match = isset($_REQUEST['src_match'])?$_REQUEST['src_match']:'false';
$dst_match = isset($_REQUEST['dst_match'])?$_REQUEST['dst_match']:'false';
$include_unanswered_calls = isset($_REQUEST['include_unanswered_calls'])?$_REQUEST['include_unanswered_calls']:'false';
$year_start = isset($_REQUEST['year_start'])?$_REQUEST['year_start']:date('Y');
$month_start = isset($_REQUEST['month_start'])?$_REQUEST['month_start']:date('m');
$day_start = isset($_REQUEST['day_start'])?$_REQUEST['day_start']:date('d');
Expand Down Expand Up @@ -679,6 +680,7 @@
// end reports by tenant
}


// start generate invoice
if ($cat == "generate_invoice") {
?>
Expand All @@ -692,6 +694,7 @@
<td><?php echo _("Extension"); ?></td>
<td>
<input type'text' name='src' tabindex="<?php echo ++$tabindex;?>" value=<?php echo $_REQUEST['src']; ?> >
<input type="checkbox" name="include_unanswered_calls" tabindex="<?php echo ++$tabindex;?>" value="true" <?php if ($include_unanswered_calls == 'true') {echo 'checked';} ?> ><?php echo _("Include unanswered calls"); ?><br>
</td>
<td></td>
</tr>
Expand Down Expand Up @@ -843,6 +846,9 @@
$sql = "SELECT dst,calldate,billsec,total_cost FROM billing_cdr WHERE ";
$sql .= "calldate > '$calldate_start' AND calldate < '$calldate_end' AND ";
$sql .= "src = '$src' ";
if ($include_unanswered_calls == 'false') {
$sql .= "and billsec > 0 ";
}
$sql .= "ORDER BY calldate ASC";
$search_results = sql($sql, 'getAll', DB_FETCHMODE_ASSOC);
if (count($search_results) == 0) { // no need to generate empty invoice...
Expand Down

0 comments on commit 4a0a24f

Please sign in to comment.