From e294302d8bf2b12eec690d8c9f517fa81825c79a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 29 Nov 2003 10:39:58 +0000 Subject: adding sql_generic price plan --- httemplate/edit/part_pkg.cgi | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 862e98ecf..b697a76b2 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -439,6 +439,41 @@ tie my %plans, 'Tie::IxHash', 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctInputOctets\" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctOutputOctets\" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; my $totalcharge = sprintf(\"%.2f\", \' + what.recur_total_charge.value + \' * $total); my $hourscharge = sprintf(\"%.2f\", \' + what.recur_hourly_charge.value + \' * $hours); push @details, \"Last month\\\'s excess data \". sprintf(\"%.1f\", $total). \" megs: \\\$$totalcharge\", \"Last month\\\'s excess time \". sprintf(\"%.1f\", $hours). \" hours: \\\$$hourscharge\"; \' + what.recur_flat.value + \' + $hourscharge + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + $totalcharge ;\'', }, + 'sql_generic' => { + 'name' => 'Base charge plus a metered rate from a configurable SQL query', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'recur_included' => { 'name' => 'Units included', + 'default' => 0, + }, + 'recur_unit_charge' => { 'name' => 'Additional charge per unit', + 'default' => 0, + }, + 'datasrc' => { 'name' => 'DBI data source', + 'default' => '', + }, + 'db_username' => { 'name' => 'Database username', + 'default' => '', + }, + 'db_password' => { 'name' => 'Database username', + 'default' => '', + }, + 'query' => { 'name' => 'SQL query', + 'default' => '', + }, + }, + 'fieldorder' => [qw( setup_fee recur_flat recur_included recur_unit_charge datasrc db_username db_password query )], + 'setup' => 'what.setup_fee.value', + # 'recur' => '\'my $dbh = DBI->connect(\"\' + what.datasrc.value + \'\", \"\' + what.db_username.value + \'\") or die $DBI::errstr; \'', + 'recur' => '\'my $dbh = DBI->connect(\"\' + what.datasrc.value + \'\", \"\' + what.db_username.value + \'\", \"\' + what.db_password.value + \'\" ) or die $DBI::errstr; my $sth = $dbh->prepare(\"\' + what.query.value + \'\") or die $dbh->errstr; my $units = 0; foreach my $cust_svc ( grep { $_->part_svc->svcdb eq \"svc_domain\" } $cust_pkg->cust_svc ) { my $domain = $cust_svc->svc_x->domain; $sth->execute($domain) or die $sth->errstr; $units += $sth->fetchrow_arrayref->[0]; } $units -= \' + what.recur_included.value + \'; $units = 0 if $units < 0; \' + what.recur_flat.value + \' + $units * \' + what.recur_unit_charge.value + \';\'', + #'recur' => '\'my $dbh = DBI->connect("\' + what.datasrc.value + \'", "\' + what.db_username.value + \'", "\' what.db_password.value + \'" ) or die $DBI::errstr; my $sth = $dbh->prepare("\' + what.query.value + \'") or die $dbh->errstr; my $units = 0; foreach my $cust_svc ( grep { $_->part_svc->svcdb eq "svc_domain" } $cust_pkg->cust_svc ) { my $domain = $cust_svc->svc_x->domain; $sth->execute($domain) or die $sth->errstr; $units += $sth->fetchrow_arrayref->[0]; } $units -= \' + what.recur_included.value + \'; $units = 0 if $units < 0; \' + what.recur_flat.value + \' + $units * \' + what.recur_unit_charge + \';\'', + }, + ; my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } -- cgit v1.2.1 From 7f300c1a420b3a95bb7e99c0161059718fb21932 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 30 Nov 2003 07:52:17 +0000 Subject: add link to view typeset invoice --- httemplate/view/cust_bill.cgi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate') diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 53d7bc051..ddc92748d 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -22,6 +22,10 @@ print qq!Enter payments (check/cash) aga print qq!Reprint this invoice!. '

'; +print menubar( + 'View typeset invoice' => "${p}view/cust_bill-ps.cgi?$invnum", +), '

'; + #false laziness with search/cust_bill_event.cgi print table(). 'EventDateStatus'; -- cgit v1.2.1 From a5bc5bcbadafe55b31d9e97fccb6122477e390fb Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Dec 2003 22:51:06 +0000 Subject: add part_referral.disabled, add disabled indices to agent and part_bill_event --- httemplate/docs/upgrade10.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 080528bac..3c6519a61 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -144,6 +144,9 @@ ALTER TABLE agent ADD _password varchar(80) NULL; ALTER TABLE h_agent ADD _password varchar(80) NULL; ALTER TABLE cust_main ADD paycvv varchar(4) NULL; ALTER TABLE h_cust_main ADD paycvv varchar(4) NULL; +ALTER TABLE part_referral ADD disabled char(1) NULL; +ALTER TABLE h_part_referral ADD disabled char(1) NULL; +CREATE INDEX part_referral1 ON part_referral ( disabled ); dump database, edit: - cust_main: increase otaker from 8 to 32 @@ -164,6 +167,8 @@ optionally: CREATE INDEX cust_main9 ON cust_main ( ship_daytime ); CREATE INDEX cust_main10 ON cust_main ( ship_night ); CREATE INDEX cust_main11 ON cust_main ( ship_fax ); + CREATE INDEX agent2 ON agent ( disabled ); + CREATE INDEX part_bill_event2 ON part_bill_event ( disabled ); serial columns -- cgit v1.2.1 From cc19608aa931a3f57e3f4a899e0ef49b2590877e Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 Dec 2003 17:53:28 +0000 Subject: non-breaking spaces in custoemr view field names --- httemplate/view/cust_main.cgi | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 83f114ef9..fb015671f 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -76,7 +76,7 @@ print ''; print "Billing address", &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Contact name', + 'Contact name', '', $cust_main->last, ', ', $cust_main->first, ''; @@ -105,8 +105,8 @@ print '', $cust_main->country, '', ; - my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; - my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; + my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; + my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; print ''. $daytime_label. '', $cust_main->daytime || ' ', '', @@ -166,7 +166,7 @@ print ''; print ''; print &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Customer number', + 'Customer number', $custnum, '', ; @@ -184,13 +184,13 @@ print ''; my $referral = qsearchs('part_referral', { 'refnum' => $cust_main->refnum } ); - print 'Advertising source', + print 'Advertising source', $referral->refnum, ": ", $referral->referral, ''; } print 'Order taker', $cust_main->otaker, ''; - print 'Referring Customer'; + print 'Referring Customer'; my $referring_cust_main = ''; if ( $cust_main->referral_custnum && ( $referring_cust_main = @@ -220,22 +220,22 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { print "Billing information (", qq!!, "Bill now)", &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Tax exempt', + 'Tax exempt', $cust_main->tax ? 'yes' : 'no', '', - 'Postal invoices', + 'Postal invoices', ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', '', - 'Email invoices', + 'Email invoices', join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', '', - 'Billing type', + 'Billing type', ; if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { my $payinfo = $cust_main->payinfo; $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); - print 'Credit card ', + print 'Credit card ', ( $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' ), '', 'Card number', @@ -247,7 +247,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { ; } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { my( $account, $aba ) = split('@', $cust_main->payinfo ); - print 'Electronic check', + print 'Electronic check ', ( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ), '', 'Account number', @@ -260,7 +260,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { } elsif ( $cust_main->payby eq 'LECB' ) { $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; my $payinfo = "$1-$2-$3"; - print 'Phone bill billing', + print 'Phone bill billing', 'Phone number', $payinfo, '', ; @@ -276,7 +276,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { ; } elsif ( $cust_main->payby eq 'COMP' ) { print 'Complimentary', - 'Authorized by', + 'Authorized by', $cust_main->payinfo, '', 'Expiration', $cust_main->paydate, '', -- cgit v1.2.1 From b3808f960c0351710f7005e7a2729925f57c7f4a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Dec 2003 08:07:06 +0000 Subject: print_ps returns ths invoice now, do not count on latex printing it, oops --- httemplate/misc/print-invoice.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 8c1240c05..0dda68a4e 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -13,8 +13,7 @@ die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; if ( $conf->exists('invoice_latex') ) { - $cust_bill->print_ps; - #print LPR $cust_bill->print_ps; #( date ) + print LPR $cust_bill->print_ps; #( date ) } else { print LPR $cust_bill->print_text; #( date ) } -- cgit v1.2.1 From 7c67ed5982f05a562c30e45938a9fa164cbeb7cb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 20 Dec 2003 03:47:09 +0000 Subject: fix inflated advertising source numbers --- httemplate/browse/part_referral.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 69bb95aa5..3f59abcf5 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -23,7 +23,8 @@ Where a customer heard about your service. Tracked for informational purposes. ; my $sth = dbh->prepare("SELECT COUNT(*) FROM h_cust_main - WHERE refnum = ? + WHERE history_action = 'insert' + AND refnum = ? AND history_date > ? ") or die dbh->errstr; %> -- cgit v1.2.1 From 6a751696054face897088706d222d5c9383d40fe Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Dec 2003 23:16:45 +0000 Subject: work even if there are stray type_pkgs records around --- httemplate/browse/agent_type.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index c61208c83..5473804e8 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -19,7 +19,7 @@ foreach my $agent_type ( sort { } qsearch('agent_type',{}) ) { my $hashref = $agent_type->hashref; #more efficient to do this with SQL... - my @type_pkgs = grep { ! $_->part_pkg->disabled } + my @type_pkgs = grep { $_->part_pkg and ! $_->part_pkg->disabled } qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); my $rowspan = scalar(@type_pkgs); $rowspan = int($rowspan/2+0.5) ; -- cgit v1.2.1 From 2c0d7675caacd5891b7f699c92260d321b4d03b5 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Dec 2003 21:37:04 +0000 Subject: add total cards & amount to pending batch screen --- httemplate/browse/cust_pay_batch.cgi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi index d90a03313..3420e97b6 100755 --- a/httemplate/browse/cust_pay_batch.cgi +++ b/httemplate/browse/cust_pay_batch.cgi @@ -14,8 +14,24 @@ Format
-

+
+ +<% + my $statement = "SELECT SUM(amount) from cust_pay_batch"; + my $sth = dbh->prepare($statement) or die dbh->errstr. "doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + my $total = $sth->fetchrow_arrayref->[0]; + + my $c_statement = "SELECT COUNT(*) from cust_pay_batch"; + my $c_sth = dbh->prepare($c_statement) + or die dbh->errstr. "doing $c_statement"; + $c_sth->execute or die "Error executing \"$c_statement\": ". $c_sth->errstr; + my $cards = $c_sth->fetchrow_arrayref->[0]; +%> +<%= $cards %> credit card payments batched
+$<%= sprintf("%.2f", $total) %> total in pending batch
+
<%= &table() %> # -- cgit v1.2.1 From d20581bcbf2809d5c2969d773b16a0c8714a6dec Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Dec 2003 01:49:32 +0000 Subject: add svc_external --- httemplate/docs/upgrade10.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 3c6519a61..275b821a3 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -73,6 +73,13 @@ CREATE TABLE acct_snarf ( ); CREATE INDEX acct_snarf1 ON acct_snarf ( svcnum ); +CREATE TABLE svc_external ( + svcnum int NOT NULL, + id int NOT NULL, + title varchar(80), + PRIMARY KEY (svcnum) +); + CREATE TABLE part_pkg_temp ( pkgpart serial NOT NULL, pkg varchar(80) NOT NULL, @@ -175,7 +182,7 @@ optionally: mandatory again: dbdef-create username -create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf +create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf svc_external dbdef-create username apache - fix sections to include .html also -- cgit v1.2.1 From 31d6d0e8d0d624cd051440acf322cd8893c1026e Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Dec 2003 02:36:38 +0000 Subject: add svc_external --- httemplate/edit/part_svc.cgi | 7 ++- httemplate/edit/process/svc_external.cgi | 29 +++++++++ httemplate/edit/svc_external.cgi | 105 +++++++++++++++++++++++++++++++ httemplate/view/svc_external.cgi | 52 +++++++++++++++ 4 files changed, 192 insertions(+), 1 deletion(-) create mode 100755 httemplate/edit/process/svc_external.cgi create mode 100644 httemplate/edit/svc_external.cgi create mode 100644 httemplate/view/svc_external.cgi (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 18319b341..10e89288f 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -53,6 +53,7 @@ Services are items you offer to your customers.
  • svc_forward - mail forwarding
  • svc_www - Virtual domain website
  • svc_broadband - Broadband/High-speed Internet service +
  • svc_external - Externally-tracked service @@ -129,6 +130,10 @@ my %defs = ( 'ip_addr' => 'IP address. Leave blank for automatic assignment.', 'blocknum' => 'Address block.', }, + 'svc_external' => { + #'id' => '', + #'title' => '', + }, ); foreach my $svcdb (grep dbdef->table($_), keys %defs ) { @@ -151,7 +156,7 @@ my %defs = ( my @dbs = $hashref->{svcdb} ? ( $hashref->{svcdb} ) - : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); + : qw( svc_acct svc_domain svc_forward svc_www svc_broadband svc_external ); tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs; my $widget = new HTML::Widgets::SelectLayers( diff --git a/httemplate/edit/process/svc_external.cgi b/httemplate/edit/process/svc_external.cgi new file mode 100755 index 000000000..728cd2189 --- /dev/null +++ b/httemplate/edit/process/svc_external.cgi @@ -0,0 +1,29 @@ +<% + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my $svcnum =$1; + +my $old = qsearchs('svc_external',{'svcnum'=>$svcnum}) if $svcnum; + +my $new = new FS::svc_external ( { + map { + ($_, scalar($cgi->param($_))); + } ( fields('svc_external'), qw( pkgnum svcpart ) ) +} ); + +my $error = ''; +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->getfield('svcnum'); +} + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_external.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_external.cgi?$svcnum"); +} + +%> diff --git a/httemplate/edit/svc_external.cgi b/httemplate/edit/svc_external.cgi new file mode 100644 index 000000000..bcfc85e3f --- /dev/null +++ b/httemplate/edit/svc_external.cgi @@ -0,0 +1,105 @@ + +<% + +my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_external ); +if ( $cgi->param('error') ) { + $svc_external = new FS::svc_external ( { + map { $_, scalar($cgi->param($_)) } fields('svc_external') + } ); + $svcnum = $svc_external->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_external=qsearchs('svc_external',{'svcnum'=>$svcnum}) + or die "Unknown (svc_external) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { #adding + + foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; + } + $svc_external = new FS::svc_external { svcpart => $svcpart }; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svcnum=''; + + #set fixed and default fields from part_svc + foreach my $part_svc_column ( + grep { $_->columnflag } $part_svc->all_part_svc_column + ) { + $svc_external->setfield( $part_svc_column->columnname, + $part_svc_column->columnvalue, + ); + } + + } +} +my $action = $svc_external->svcnum ? 'Edit' : 'Add'; + +my $p1 = popurl(1); +print header("External service $action", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
    !; + +#display + + +#svcnum +print qq!!; +print qq!Service #!, $svcnum ? $svcnum : "(NEW)", "

    "; + +#pkgnum +print qq!!; + +#svcpart +print qq!!; + +my($id,$title)=( + $svc_external->id, + $svc_external->title, +); + +print &ntable("#cccccc",2), + 'External ID'. + qq!!. + ''. + 'Title'. + qq!!. + ''; + +foreach my $field ($svc_external->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + # If the flag is X, it won't even show up in $svc_acct->virtual_fields. + print $svc_external->pvf($field)->widget('HTML', 'edit', + $svc_external->getfield($field)); + } +} + +%> + +
    +
    + + + diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi new file mode 100644 index 000000000..e5c977f13 --- /dev/null +++ b/httemplate/view/svc_external.cgi @@ -0,0 +1,52 @@ + +<% + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; +my $svc_external = qsearchs( 'svc_external', { 'svcnum' => $svcnum } ) + or die "svc_external: Unknown svcnum $svcnum"; + +#false laziness w/all svc_*.cgi +my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +my $pkgnum = $cust_svc->getfield('pkgnum'); +my($cust_pkg, $custnum); +if ($pkgnum) { + $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); + $custnum = $cust_pkg->custnum; +} else { + $cust_pkg = ''; + $custnum = ''; +} +#eofalse + +%> + +<%= header('External Service View', menubar( + ( ( $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) external service" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)) %> + +Edit this information
    +<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> + +Service number + <%= $svcnum %> +External ID + <%= $svc_external->id %> +Title + <%= $svc_external->title %> + +<% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { %> + <%= $svc_external->pvf($_)->widget('HTML', 'view', $svc_external->getfield($_)) %> +<% } %> + + +
    <%= joblisting({'svcnum'=>$svcnum}, 1) %> + -- cgit v1.2.1 From abc64a997eeacdc95988296889754d708aa97cad Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 27 Dec 2003 08:23:38 +0000 Subject: package reports by agent --- httemplate/index.html | 2 +- httemplate/search/cust_pkg.cgi | 6 ++++ httemplate/search/cust_pkg.html | 46 ------------------------- httemplate/search/cust_pkg_report.cgi | 63 +++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 47 deletions(-) delete mode 100755 httemplate/search/cust_pkg.html create mode 100755 httemplate/search/cust_pkg_report.cgi (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index d863f3f3e..d024de0bf 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -56,7 +56,7 @@
    Credit card #
    Invoice #
    Check #
    -
    View pending credit card batch

    Packages (by next bill date range) +
    View pending credit card batch

    Packages (by next bill date range)

    Invoice reports
    • Invoice event errors (failed credit cards) diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 3c3e17864..c2f6272c4 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -35,6 +35,12 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $range .= ( $range ? 'AND ' : ' WHERE ' ). '( cancel IS NULL OR cancel = 0 )'; + if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { + $range .= ( $range ? 'AND ' : ' WHERE ' ). + "$1 = ( SELECT agentnum FROM cust_main". + " WHERE cust_main.custnum = cust_pkg.custnum )"; + } + #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; warn $statement; diff --git a/httemplate/search/cust_pkg.html b/httemplate/search/cust_pkg.html deleted file mode 100755 index 0dad83a2a..000000000 --- a/httemplate/search/cust_pkg.html +++ /dev/null @@ -1,46 +0,0 @@ - - - Packages - - - - - - -

      Packages

      -
      - - Return packages with next bill date:

      - - - - - - - - - - - -
      From:
      m/d/y
      To:
      m/d/y
      -
      - -
      - - - - diff --git a/httemplate/search/cust_pkg_report.cgi b/httemplate/search/cust_pkg_report.cgi new file mode 100755 index 000000000..b31674540 --- /dev/null +++ b/httemplate/search/cust_pkg_report.cgi @@ -0,0 +1,63 @@ + + + Packages + + + + + + +

      Packages

      +
      + + Return packages with next bill date:

      + + + + + + + + + + + +<% my %agent_search = dbdef->table('agent')->column('disabled') + ? ( 'disabled' => '' ) : (); + my @agents = qsearch( 'agent', \%agent_search ); + if ( scalar(@agents) == 1 ) { +%> + +<% } else { %> + + + + + +<% } %> +
      From:
      m/d/y
      To:
      m/d/y
      Agent:
      +
      + +
      + + + + -- cgit v1.2.1