[Astpp-commit] SF.net SVN: astpp:[2255] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2009-09-20 03:31:37
|
Revision: 2255 http://astpp.svn.sourceforge.net/astpp/?rev=2255&view=rev Author: darrenkw Date: 2009-09-20 03:31:28 +0000 (Sun, 20 Sep 2009) Log Message: ----------- More work towards invoice presentation Modified Paths: -------------- trunk/modules/ASTPP/lib/ASTPP.pm trunk/templates/account-info.tpl trunk/web_interface/astpp-admin.cgi Added Paths: ----------- trunk/templates/invoice.tpl Modified: trunk/modules/ASTPP/lib/ASTPP.pm =================================================================== --- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-20 00:18:28 UTC (rev 2254) +++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-20 03:31:28 UTC (rev 2255) @@ -429,6 +429,7 @@ # set total_entries *once* then pass it around # in the object's links from then on for efficiency: my ($record,$sql); + $arg{te} = 0 if !$arg{te}; my $verify = $arg{ve} || ''; my $total_entries = int( $arg{te} ); my $te_match = $total_entries @@ -580,6 +581,24 @@ } } +sub invoice_list_internal +{ + my ($self, %arg) = @_; # List Internal Invoices. + my ($tmp,$sql,@invoices); + $tmp = "SELECT * FROM invoice_list_view"; + if ($arg{accountid}) { + $tmp .= " WHERE accountid = " + . $self->{_astpp_db}->quote($arg{accountid}); + } + $sql = $self->{_astpp_db}->prepare($tmp); + $sql->execute; + while ( my $record = $sql->fetchrow_hashref ) { + push @invoices, $record; + } + $sql->finish; + return @invoices; +} + sub invoice_create_internal { my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number. @@ -728,6 +747,39 @@ return $arg{sort_order}; } + +sub account_cdr_post +{ + my ($self, %arg) = @_; # Create invoice in ASTPP Internally and return the invoice number. + $arg{description} = "" if !$arg{timestamp}; + $arg{pricelist} = "" if !$arg{pricelist}; + $arg{pattern} = "" if !$arg{pattern}; + $arg{answeredtime} = "0" if !$arg{answeredtime}; + $arg{uniqueid} = "N/A" if $arg{uniqueid} eq "" || !$arg{uniqueid}; + $arg{clid} = "N/A" if $arg{clid} eq "" || !$arg{clid}; + + my $tmp = "INSERT INTO cdrs (uniqueid, cardnum, callednum, debit," + . " billseconds, callstart,callerid,pricelist,pattern) VALUES (" + . $self->{_astpp_db}->quote($arg{uniqueid}) . ", " + . $self->{_astpp_db}->quote($arg{account}) . "," + . $self->{_astpp_db}->quote($arg{description}) . ", " + . $self->{_astpp_db}->quote($arg{amount}) . ", " + . $self->{_astpp_db}->quote($arg{answeredtime}) . ", " + . $self->{_astpp_db}->quote($arg{timestamp}) . ", " + . $self->{_astpp_db}->quote($arg{clid}) . "," + . $self->{_astpp_db}->quote($arg{pricelist}) . "," + . $self->{_astpp_db}->quote($arg{pattern}) . ")"; + + if ( $self->{_astpp_db}->do($tmp) ) { + return (1, "POSTED CDR: $arg{account} in the amount of: " . $arg{amount} / 10000 . "\n"); + } + else { + return (2, $tmp . " FAILED! \n"); + } +} + + + # Preloaded methods go here. 1; Modified: trunk/templates/account-info.tpl =================================================================== --- trunk/templates/account-info.tpl 2009-09-20 00:18:28 UTC (rev 2254) +++ trunk/templates/account-info.tpl 2009-09-20 03:31:28 UTC (rev 2255) @@ -76,7 +76,7 @@ <TMPL_LOOP NAME="chargelist"> <tr> <td><a href="astpp-admin.cgi?mode=View Details&chargeid=<TMPL_VAR NAME="id">&accountnum=<TMPL_VAR NAME="accountnum">&action=Remove Charge...">Remove Charge...</a></td> - <td><TMPL_VAR NAME="id"><td> + <td><TMPL_VAR NAME="id"></td> <td><TMPL_VAR NAME="description"></td> <td><TMPL_VAR NAME="sweep"></td> <td>$<TMPL_VAR NAME="cost"></td> @@ -200,6 +200,9 @@ </table> <table class="default"> <tr class="header"> + <td colspan=5>Invoices</td> + </tr> + <tr class="header"> <td>Invoice Number</td> <td>Invoice Date</td> <td>Invoice Total</td> @@ -210,7 +213,7 @@ <tr> <td><TMPL_VAR NAME="invoiceid"></td> <td><TMPL_VAR NAME="date"></td> - <td><TMPL_VAR NAME="total"></td> + <td><TMPL_VAR NAME="value"></td> <td><a href="astpp-admin.cgi?mode=View Invoice&format=html&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td> <td><a href="astpp-admin.cgi?mode=View Invoice&format=pdf&invoiceid=<TMPL_VAR NAME="invoiceid">">View</a></td> </tr> Added: trunk/templates/invoice.tpl =================================================================== --- trunk/templates/invoice.tpl (rev 0) +++ trunk/templates/invoice.tpl 2009-09-20 03:31:28 UTC (rev 2255) @@ -0,0 +1,25 @@ + + +<table class="default"> + <tr class="header"> + <td>Date & Time</td> + <td>Caller*ID</td> + <td>Called Number</td> + <td>Disposition</td> + <td>Billable Seconds</td> + <td>Charge</td> + <td>Notes</td> + </tr> + <TMPL_LOOP NAME="invoice_cdr_list"> + <TR> + <TD><TMPL_VAR NAME="callstart"></TD> + <TD><TMPL_VAR NAME="callerid"></TD> + <TD><TMPL_VAR NAME="callednum"></TD> + <TD><TMPL_VAR NAME="disposition"></TD> + <TD><TMPL_VAR NAME="billseconds"></TD> + <TD><TMPL_VAR NAME="charge"></TD> + <TD><TMPL_VAR NAME="notes"></TD> + </TR> + </TMPL_LOOP> +</table> + Modified: trunk/web_interface/astpp-admin.cgi =================================================================== --- trunk/web_interface/astpp-admin.cgi 2009-09-20 00:18:28 UTC (rev 2254) +++ trunk/web_interface/astpp-admin.cgi 2009-09-20 03:31:28 UTC (rev 2255) @@ -2110,6 +2110,11 @@ } } $template->param( account_device_list => \@account_device_list ); + my @account_invoice_list = $ASTPP->invoice_list_internal( + accountid => $accountinfo->{accountid} + ); + $template->param( account_invoice_list => \@account_invoice_list ); + ### End Section ### ( $sql, $pagination ) = $ASTPP->pagination( sql_select => "SELECT * FROM cdrs WHERE cardnum =" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |