#!/usr/bin/perl BEGIN { use lib '/usr/home/cfg' ; require push_inc ; } require cfg ; use DBI; use CGI::Carp qw(fatalsToBrowser); use Date::Manip; use Date::Calc qw(:all); use PDF::API2::Lite; use constant mm => 25.4/72; use constant in => 1/72; use constant pt => 1; #------------------------------------------------------------------------------------------ @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); my $qt_id = $ARGV[0] ; my $tab_no = $ARGV[1] ; my $tab_secs = $ARGV[2] ; # my @sections = split(/\|/,$tab_secs); my @prefix_arr = qw( cost_desc_ curr_amnt_ qty_cost_ zar_amnt_ ); # our $debug = 1 ; our $label = 1 ; # used in pdf_check_value_of_up #------------------------------------------------------------------------------------------ print "Content-type: text/html\n\n"; &today ; &pdf_curr_symbols ; my $table = 'quotes' ; &db_open_ro ; our $db_ignore_open_close = 1 ; # do one open and one close instead of repeating it &prep_pdf ; $db_ignore_open_close = 0 ; # do one open and one close instead of repeating it &db_close_conn ; &exclusions ; &start_pdf ; &build_pdf ; &finish_pdf ; &screen2 ; exit ; #------------------------------------------------------------------------------------------ sub prep_pdf { my @cols = () ; &tab_hash ; &db_min_ro('quotes_min',"*","`id`='$qt_id'",'','') ; &db_min_ro('quote_notes',"*","`id`='2'",'','') ; &db_min_ro('quotes_pdf_titles',"*","`quote_id`='$qt_id'",'','') ; &db_min_ro($table,"*","`id`='$qt_id'",'','') ; my @total_names = ("subtotal_one_time_fee","vat_one_time_fee","total_one_time_fee","subtotal_monthly_recurring_fee","vat_monthly_recurring_fee","total_monthly_recurring_fee","subtotal_annual_fee","vat_annual_fee","total_annual_fee") ; foreach (@total_names) { my @abc = split(/\;/,$db{$table}{$qt_id}{$_}) ; $db{$table}{$qt_id}{$_} = sprintf("%0.2f",$abc[0]+$abc[1]) ; } our $custid = $db{$table}{$qt_id}{quote_to} ; &db_min_ro('customers','id,name,physical_address,contact_email,phone,contact_name,vat_nr',"`id`='$custid'",'','') ; $customer_name{$custid} = $db{customers}{$custid}{name} ; $customer_address{$custid} = $db{customers}{$custid}{physical_address} ; $customer_email{$custid} = $db{customers}{$custid}{contact_email} ; $customer_phone{$custid} = $db{customers}{$custid}{phone} ; $customer_contact_name{$custid} = $db{customers}{$custid}{contact_name} ; $customer_vat_nr{$custid} = $db{customers}{$custid}{vat_nr} ; &db_min_ro('price_list','id,description','','','') ; foreach my $id (keys %{$db{price_list}}) { $price_list{$id} = $db{price_list}{$id}{description} ; } our $countryid = $db{$table}{$qt_id}{country_shipped} ; &db_min_ro('countries','*',"`id`='$countryid'",'','') ; $country{$countryid} = $db{countries}{$countryid}{name} ; our $camera_system_id = $db{$table}{$qt_id}{camera_system_id} ; &db_min_ro('camera_systems','*',"`id`='$camera_system_id'",'','') ; $camera_system{$camera_system_id} = $db{camera_systems}{$camera_system_id}{name} ; # our %terms_and_con = () ; # &db_min_ro('quote_notes','id, terms_1, terms_2, terms_3, terms_4, terms_5',"",'','') ; # foreach my $id (keys %{$db{quote_notes}}){ # for (1 .. 5){ # $terms_and_con{$_} = $db{quote_notes}{$id}{"terms\_$_"} ; # } # } } #------------------------------------------------------------------------------------------ sub exclusions { our $exclude_rate = 0 ; our $exclude_vat = 0 ; if ($db{$table}{$qt_id}{currency} ne 'ZAR') { $exclude_vat = 1 ; } } #------------------------------------------------------------------------------------------ sub start_pdf { my $qtpdfpath = "$pdfpath/quotes" ; our $pdfname = "QT-$qt_id-" . $now_ccyymmdd . '.pdf' ; &pdf_delete_previous_pdf($qtpdfpath) ; &pdf_initialise($qtpdfpath,$pdfname,'ITV Quote') ; } #------------------------------------------------------------------------------------------ sub build_pdf { &tab_curr_symbols; &pdf_initialise_page ; $up = 292 ; # "e_pdf_page_header ; &pdf_box_block_top(5,205,'#009bc8') ; $up = 260 ; $across = 1 ; $blue_box = 1 ; &pdf_page_header ; "e_pdf_vars ; "e_out_to_pdf ; "e_pdf_footer ; $up = 5 ; &pdf_box_block_bottom(5,205,'#009bc8') ; } #------------------------------------------------------------------------------------------ sub quote_out_to_pdf { my $qty_with_extra = 5.5 ; my $pos = 37; my $pos2 = $pos + 1; my $pos3 = 132; my $pos4 = $pos3 + 1; &pdf_nl_t; # unless ($db{$table}{$qt_id}{currency} eq 'ZAR') { &pdf_medium_red_bold_text (70, $up, "$db{$table}{$qt_id}{currency} ROE : $db{$table}{$qt_id}{roe}") ; } # hidden for client # &pdf_medium_bold_text (157, $up, "Nr. :") ; &pdf_small_bold_text($table_cols[3], $up, "Date") ; my $dttxt = &custom_date_txt($db{$table}{$qt_id}{quote_date}); &pdf_small_bold_text_right ($table_cols[-1]-6, $up, $dttxt) ; &pdf_nl; &pdf_small_bold_text($table_cols[3], $up, "Quote Nr") ; # &pdf_small_text_right (198, $up, $qt_id) ; &pdf_small_bold_text_right ($table_cols[-1]-6, $up, $db{$table}{$qt_id}{quote_nr}) ; &pdf_large_bold_text ($table_cols[0],$up,$db{$table}{$qt_id}{ref}) if $db{$table}{$qt_id}{ref} ; # &pdf_nl_gap_1; &pdf_nl; &pdf_nl_t; &pdf_bar($table_cols[0],$up,$table_cols[-1],$up,'#009bc8','QUOTE',20,98) ; &pdf_nl_gap_1; # &pdf_box_block_top($table_cols[0],$up,$table_cols[-1],'#009bc8') ; # start block ------------------------------------- &pdf_thin_black_line($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; $box_start{$table_cols[0]} = $up ; if ($custid) { # my ($quote_year,$quote_month,$quote_day) = split(/\-/,$db{$table}{$qt_id}{quote_date}); # my ($expiry_year,$expiry_month,$expiry_day) = Add_Delta_Days($quote_year,$quote_month,$quote_day,14); # Add 7 days to quote date # $expiry_month = sprintf("%02s", $expiry_month) ; # $expiry_day = sprintf("%02s", $expiry_day) ; my ($expiry_year,$expiry_month,$expiry_day) = split(/\-/,$db{$table}{$qt_id}{quote_expiry}); my $expiry_date = &custom_date_txt("$expiry_year-$expiry_month-$expiry_day"); # my $expiry_date = "$expiry_year-$expiry_month-$expiry_day"; &pdf_nl; &pdf_thin_box_block_top($table_cols[0]+5,$table_cols[1],'#009bc8'); $top = $up; &pdf_nl; &pdf_small_bold_text ($table_cols[0]+6, $up, "Customer") ; &pdf_small_text ($pos2, $up, $customer_name{$custid}) ; $up = $up - 3.25; &pdf_extra_thin_black_line($table_cols[0]+5,$top, $table_cols[0]+5 ,$up,'#009bc8') ; &pdf_extra_thin_black_line($pos,$top,$pos,$up,'#009bc8') ; &pdf_extra_thin_black_line($table_cols[1],$top,$table_cols[1] ,$up,'#009bc8') ; # &pdf_box_block_bottom($table_cols[0],$table_cols[1],'#009bc8',1); &pdf_thin_box_block_top($table_cols[2],$table_cols[-1]-5,'#009bc8'); $top = $up; $up = $up - 3.25; &pdf_small_bold_text ($table_cols[2]+1,$up,"Country") ; &pdf_small_text ($pos4,$up,$country{$countryid}) ; $up = $up -1.25; &pdf_thin_box_block_bottom($table_cols[2],$table_cols[-1]-5,'#009bc8'); $box_start{$table_cols[2]} = $up ; $up -= 3.25; &pdf_small_bold_text ($table_cols[2]+1,$up,"Tax/VAT Nr") ; &pdf_small_text ($pos4, $up, $customer_vat_nr{$custid}) ; $up -= 1.25; &pdf_thin_box_block_bottom($table_cols[2],$table_cols[-1]-5,'#009bc8'); &pdf_extra_thin_black_line ($pos3,$top, $pos3 ,$up,'#009bc8') ; $up -= 4.5; # &pdf_extra_thin_black_line ($pos,$top, $pos ,$up,'#009bc8') ; $top = $up; &pdf_thin_box_block_top($table_cols[2],$table_cols[-1]-5,'#009bc8'); $up -= 3.25; &pdf_small_bold_text ($table_cols[2]+1, $up, "Quote Expiry") ; &pdf_small_text ($pos4, $up, $expiry_date) ; $up -= 1.25; &pdf_thin_box_block_bottom($table_cols[2],$table_cols[-1]-5,'#009bc8'); &pdf_extra_thin_black_line ($pos3,$top, $pos3 ,$up,'#009bc8') ; $bottom = $up ; # $up+=1.25 ; $up += 18 ; $top = $up ; &pdf_thin_box_block_top($table_cols[0]+5,$table_cols[1],'#009bc8'); $up -= 3.25; &pdf_small_bold_text ($table_cols[0]+6,$up,"Address") ; # $customer_address{$custid} = "123" ; my @waypoint = split(/\,/,$customer_address{$custid}); # my $top2 = $up; # my $count = 0; for my $py (@waypoint){ $py =~ s/^\s+//g; &pdf_small_text ($pos2,$up,$py) ; # $count++; # &pdf_nl_s; $up -= 4.5 ; } $up += 3.25 if $customer_address{$custid} ; $up -= 1.25 if !$customer_address{$custid} ; # $up = $top2; # $up-=1.25 ; # &pdf_thin_box_block_top($table_cols[2],$table_cols[-1]-5,'#009bc8'); &pdf_thin_box_block_bottom($table_cols[0]+5,$table_cols[1],'#009bc8'); &pdf_extra_thin_black_line ($pos,$top, $pos ,$up,'#009bc8') ; # &pdf_extra_thin_black_line ($pos3,$top, $pos3 ,$up,'#009bc8') ; # $up = $up - 4.5; $up = $bottom - 4.5 ; &pdf_thin_box_block_top($table_cols[0]+5,$table_cols[1],'#009bc8'); $top = $up; &pdf_thin_box_block_top($table_cols[2],$table_cols[-1]-5,'#009bc8'); $up = $up - 3.25; # &pdf_small_bold_text (16, $up, "Contact") ; # &pdf_small_text ($pos2, $up, $customer_contact_name{$custid}) ; # &pdf_small_bold_text (111, $up, "Reference") ; # &pdf_small_text ($pos4, $up, $db{$table}{$qt_id}{ref}) ; # $up = $up -1.25; # &pdf_box_block_bottom(15,100,'#009bc8'); # &pdf_box_block_bottom(110,195,'#009bc8'); # &pdf_box_block_top(110,195,'#009bc8'); # &pdf_box_block_top(15,100,'#009bc8'); # $up = $up - 3.25; # &pdf_small_bold_text (16, $up, "Phone Nr") ; # &pdf_small_text ($pos2, $up, $customer_phone{$custid}) ; # &pdf_small_bold_text (111, $up, "PO Nr") ; # &pdf_small_text ($pos4, $up, $db{$table}{$qt_id}{po_nr}) ; # $up = $up - 1.25; # &pdf_box_block_bottom(110,195,'#009bc8'); # &pdf_box_block_bottom(15,100,'#009bc8'); # &pdf_thin_black_line ($pos3,$top, $pos3 ,$up,'#009bc8') ; # &pdf_box_block_top(15,100,'#009bc8'); # $up = $up - 3.25; # &pdf_small_bold_text (16, $up, "Email") ; # &pdf_small_text ($pos2, $up, $customer_email{$custid}) ; # $up = $up - 1.25; # &pdf_thin_black_line ($pos,$top, $pos ,$up,'#009bc8') ; # &pdf_box_block_bottom(15,100,'#009bc8'); # &pdf_nl; # &pdf_box_block_top(15,100,'#009bc8'); # &pdf_box_block_top(110,195,'#009bc8'); # $top = $up; # $up = $up - 3.25; &pdf_small_bold_text ($table_cols[0]+6, $up, "Notes") ; &pdf_small_bold_text ($table_cols[2]+1, $up, "System") ; &pdf_small_text ($pos4,$up,$camera_system{$camera_system_id}) ; $up = $up - 1.25; &pdf_extra_thin_black_line ($pos3,$top, $pos3 ,$up,'#009bc8') ; &pdf_thin_box_block_bottom($table_cols[2],$table_cols[-1]-5,'#009bc8'); $up = $up + 1.25; # &pdf_small_text (29, $up, $db{$table}{$qt_id}{notes}) ; if ($db{$table}{$qt_id}{notes}) { &pdf_text_block ($pos2,$db{$table}{$qt_id}{notes},60,5) ; } else { $up -= 1.25; $up -= 4.5; } # $up = $up - 9; &pdf_thin_box_block_bottom($table_cols[0]+5,$table_cols[1],'#009bc8'); &pdf_extra_thin_black_line ($pos,$top, $pos ,$up,'#009bc8') ; $up = $up - 4.5; } # $top = $top2; &pdf_box_block_bottom($table_cols[0],$table_cols[-1],'#009bc8') ; # end block ------------------------------------- # &pdf_nl_gap_1 ; #&pdf_nl_gap_1; # $up+=3.25 ; $up-= 8 ; $up+=3.25 ; &pdf_box_block_top($table_cols[0],$table_cols[-1],'#009bc8') ; # start block ------------------------------------- $up-=3.25 ; &pdf_bar($table_cols[0],$up,$table_cols[-1],$up,'#009bc8','Item List',20,97) ; $up-=3.25 ; $top = $up ; #&pdf_check_value_of_up(20); # &pdf_nl_t; # &pdf_nl_s; $up-=5; &pdf_small_bold_text ($table_cols[0]+5,$up,'Description') ; &pdf_small_bold_text ($table_cols[1]+7.5,$up,'Qty') ; &pdf_small_bold_text ($table_cols[2]+11,$up,'Amount') ; &pdf_small_bold_text ($table_cols[3]+11,$up,'VAT') ; &pdf_small_bold_text ($table_cols[4]+12.5,$up,'Total') ; $up -= 3 ; $up = $up ; &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; # &pdf_nl_gap_1; $up = $up - 4.5 ; $inner_blue_box = 1 ; my @prefexes = ("excl","item","qty","usd_amnt","curr_amnt","item_ttl","vat") ; foreach (%{$db{quotes_pdf_titles}}){ $get_pdf_name{$db{quotes_pdf_titles}{$_}{old_name}}{$db{quotes_pdf_titles}{$_}{quote_id}} = $db{quotes_pdf_titles}{$_}{new_name} ; } $up_test = 12 ; my $a = 0 ; my $b = 0 ; my $c = 0 ; if ($db{$table}{$qt_id}{subtotal_one_time_fee} ne '0.00' or $db{$table}{$qt_id}{vat_one_time_fee} ne '0.00' or $db{$table}{$qt_id}{total_one_time_fee} ne '0.00'){$a = 1; $up_test += 8 ; } if ($db{$table}{$qt_id}{subtotal_monthly_recurring_fee} ne '0.00' or $db{$table}{$qt_id}{vat_monthly_recurring_fee} ne '0.00' or $db{$table}{$qt_id}{total_monthly_recurring_fee} ne '0.00' ){$b = 1; $up_test += 8 ; } if ($db{$table}{$qt_id}{subtotal_annual_fee} ne '0.00' or $db{$table}{$qt_id}{vat_annual_fee} ne '0.00' or $db{$table}{$qt_id}{total_annual_fee} ne '0.00'){$c = 1; $up_test += 8 ; } if ($a or $b or $c) { $up_test += 8 ; } # $blue_box = 0 ; $inner_blue_box = 0 ; foreach (sort keys %sec_cnt) { # &pdf_check_value_of_up(45); if ($up > 280){ $up = 280 ; } $_k = substr($_,1) ; my @parts = split(/\-/,$sec_cnt{$_}) ; my $sec = '_costing' ; my $suffix = "$sec$_k" ; foreach my $prefex (@prefexes){ $col_name = "$prefex" . "$suffix" ; $cnt = 0 ; if ($db{quotes_min}{$qt_id}{$col_name}) { foreach my $col_input (split(/\;/,$db{quotes_min}{$qt_id}{$col_name})){ $cnt++ ; $saved_field{$prefex}{$suffix}{$cnt} = $col_input ; # &common_debug("$aa/$suffix : $cc") ; } } } # my $item = $db{$table}{$qt_id}{"item_1$suffix"} ; my $item = $saved_field{"item"}{$suffix}{1} ; next unless $item ; next if $item eq '0.00' ; if ($get_pdf_name{$parts[1]}{$qt_id}) { # &pdf_small_bold_text ($table_cols[0]+5,$up,$get_pdf_name{$parts[1]}{$qt_id}) ; } else { # &pdf_small_bold_text ($table_cols[0]+5,$up,$parts[1]) ; } # if ($up < 15) { # &pdf_check_value_of_up(15) ; # $new_page = 1 ; # } # &build_cost_form($id,$tab,$parts[0],"$sec$_k"); # &pdf_nl; for (1 .. $parts[0]) { # if ($db{$table}{$qt_id}{"excl_$_$suffix"}) { next ; } if ($saved_field{"excl"}{$suffix}{$_}) { next ; } if ($up < 12){ &pdf_check_value_of_up(12) ; $new_page = 1 ; $up-=4.5 ; } # if ($up>280){ $up=280; } # my $price_list_val = $price_list{$db{$table}{$qt_id}{"item_$_$suffix"}} ; my $disp_item = ($price_list_val) ? $price_list_val : $saved_field{"item"}{$suffix}{$_} ; @a = split(":", $disp_item) ; $disp_item = $a[0] ; # my $price_list_val = $price_list{$saved_field{"item"}{$suffix}{$_}} ; my $price_list_val = $price_list{$disp_item} ; $disp_item = $price_list{$disp_item} if $price_list{$disp_item} ; # my $disp_item = ($price_list_val) ? $price_list_val : $db{$table}{$qt_id}{"item_$_$suffix"} ; &pdf_small_bold_text($table_cols[0]+5,$up,"$disp_item") ; # &pdf_small_text($boxtxt[2]+4.4,$up,$db{$table}{$qt_id}{"qty_$_$suffix"}) ; # &pdf_small_text($boxtxt[2],$up,$saved_field{"qty"}{$suffix}{$_}) ; &pdf_small_text($table_cols[1]+$qty_with_extra+3.75,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 10 and $saved_field{"qty"}{$suffix}{$_} >= 0 ; &pdf_small_text($table_cols[1]+$qty_with_extra+3.00,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 100 and $saved_field{"qty"}{$suffix}{$_} >= 10 ; &pdf_small_text($table_cols[1]+$qty_with_extra+2.25,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 1000 and $saved_field{"qty"}{$suffix}{$_} >= 100 ; &pdf_small_text($table_cols[1]+$qty_with_extra+1.50,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 10000 and $saved_field{"qty"}{$suffix}{$_} >= 1000 ; &pdf_small_text($table_cols[1]+$qty_with_extra+0.75,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 100000 and $saved_field{"qty"}{$suffix}{$_} >= 10000 ; &pdf_small_text($table_cols[1]+$qty_with_extra+0.00,$up,$saved_field{"qty"}{$suffix}{$_}) if $saved_field{"qty"}{$suffix}{$_} < 1000000 and $saved_field{"qty"}{$suffix}{$_} >= 100000 ; # &pdf_small_text ($boxtxt[3]+2,$up,&common_commify($db{$table}{$qt_id}{"curr_amnt_$_$suffix"})) ; &pdf_small_text($table_cols[2]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text($table_cols[3]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text($table_cols[4]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; # &pdf_small_text_right($rboxtxt[3],$up,&common_commify($db{$table}{$qt_id}{"curr_amnt_$_$suffix"})) ; &pdf_small_text_right($table_cols[3]-2,$up,&common_commify(sprintf("%0.2f",$saved_field{"curr_amnt"}{$suffix}{$_}))) ; my $vat_amnt = 0 ; # if ($db{$table}{$qt_id}{"vat_$_$suffix"}) { if ($saved_field{"vat"}{$suffix}{$_}) { # $vat_amnt = sprintf("%0.2f",$db{$table}{$qt_id}{"curr_amnt_$_$suffix"}*0.15) ; $vat_amnt = &common_commify(sprintf("%0.2f",$saved_field{"curr_amnt"}{$suffix}{$_}*0.15)) ; # &pdf_small_text ($boxtxt[4]+2,$up,&common_commify($vat_amnt)) ; # &pdf_small_text($boxtxt[5],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; # &pdf_small_text_right($rboxtxt[5],$up,&common_commify($vat_amnt)) ; # &pdf_small_text_right($rboxtxt[5],$up,"S") ; &pdf_small_text_right($table_cols[4]-2,$up,$vat_amnt) ; } else { &pdf_small_text_right($table_cols[4]-2,$up,"0.00") ; # &pdf_small_text_right($rboxtxt[5],$up,"Z") ; # &pdf_small_text_right($rboxtxt[5],$up,"Z") ; } # &pdf_small_text ($boxtxt[5]+2,$up,&common_commify($db{$table}{$qt_id}{"curr_amnt_$_$suffix"}+$vat_amnt)) ; # &pdf_small_text($boxtxt[4],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; # my $ttl_amnt = sprintf("%0.2f",$db{$table}{$qt_id}{"curr_amnt_$_$suffix"}+$vat_amnt) ; $vat_amnt =~ s/\,//g ; my $ttl_amnt = sprintf("%0.2f",$saved_field{"curr_amnt"}{$suffix}{$_}+$vat_amnt) ; # $ttl_amnt = $ttl_amnt * $saved_field{"qty"}{$suffix}{$_} ; $ttl_amnt = &common_commify(sprintf("%0.2f",$ttl_amnt)) ; &pdf_small_text_right($table_cols[5]-2,$up,&common_commify($ttl_amnt)) ; $up-=4.5 ; } # $check_up = 40 ; # if ($db{$table}{$qt_id}{subtotal_one_time_fee} # $db{$table}{$qt_id}{subtotal_monthly_recurring_fee} # &pdf_check_value_of_up($up_test-5) unless $new_page ; # # # # # # # # # # # # # # if ($_k eq '_systems' and $db{$table}{$qt_id}{systems_included}) { # # # # # # # # # # # # # # my @para = split /^/m, $db{$table}{$qt_id}{systems_included} ; # # # # # # # # # # # # # # foreach (@para) { # # # # # # # # # # # # # # &pdf_small_text($boxtxt[1]+5,$up,$_) ; # # # # # # # # # # # # # # &pdf_nl_s; # # # # # # # # # # # # # # } # # # # # # # # # # # # # # # &pdf_text_block ($boxtxt[1]+2,$db{$table}{$qt_id}{systems_included},50,5) ; # # # # # # # # # # # # # # } # # # # # # # # # # # # # # if ($_k eq '_rental' and $db{$table}{$qt_id}{rental_included}) { # # # # # # # # # # # # # # my @para = split /^/m, $db{$table}{$qt_id}{rental_included} ; # # # # # # # # # # # # # # foreach (@para) { # # # # # # # # # # # # # # &pdf_small_text($boxtxt[1]+5,$up,$_) ; # # # # # # # # # # # # # # &pdf_nl_s; # # # # # # # # # # # # # # } # # # # # # # # # # # # # # } # # # # # # # # # # # # # # if ($_k eq '_other' and $db{$table}{$qt_id}{other_included}) { # # # # # # # # # # # # # # my @para = split /^/m, $db{$table}{$qt_id}{other_included} ; # # # # # # # # # # # # # # foreach (@para) { # # # # # # # # # # # # # # &pdf_small_text($boxtxt[1]+5,$up,$_) ; # # # # # # # # # # # # # # &pdf_nl_s; # # # # # # # # # # # # # # } # # # # # # # # # # # # # # } # &pdf_nl; # $up-=2 ; } $up+=2; &pdf_thin_black_line ($table_cols[1],$top,$table_cols[1],$up,'#009bc8') ; &pdf_box_block_bottom($table_cols[0],$table_cols[-1],'#009bc8') ; #$up=80; #&pdf_box_block_bottom($blocks[1],200,'#009bc8') ; # end block ------------------------------------- $inner_blue_box = 0 ; # ------------- totals ------------------------------------------------------------------ #$top=$up; #&pdf_box_block_top($blocks[1],200,'#009bc8') ; # start block ------------------------------------- # &pdf_nl_gap_1 ; #&pdf_nl_t; # # &pdf_small_bold_text ($boxtxt[1]+2,$up,'') ; # # &pdf_small_bold_text ($boxtxt[2],$up,'') ; # # &pdf_small_bold_text ($boxtxt[3],$up,'Sub Total') ; # # &pdf_small_bold_text ($boxtxt[4],$up,'Vat Total') ; # # &pdf_small_bold_text ($boxtxt[5],$up,'Grand Total') ; # &pdf_nl_t ; #$top = $up; # # $up -= 10 ; # $up -= 10 ; # $up -= 10 ; # Includes: (per each system) # Air NXT Camera # 12 months license fee # Pixellot Analytics # Live Sreamimg # 24/7 Live Support # Dedicated Project Manager # B2B Fleet Management Platform # Shipping if ($up < 57.5) { &pdf_check_value_of_up(57.5) ; &pdf_box_block_top($table_cols[0],$table_cols[-1],'#009bc8') ; } $up -= 4.5 ; &pdf_small_bold_text ($table_cols[0]+05,$up,'Includes: (per each system)') ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"Air NXT Camera") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"12 months license fee") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"Pixellot Analytics") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"Live Sreamimg") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"24/7 Live Support") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"Dedicated Project Manager") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"B2B Fleet Management Platform") ; $up -= 4.5 ; &pdf_small_text ($table_cols[0]+6,$up,"Shipping") ; $up -= 2 ; # if ($a == 1) { $up = $up - 8 ; } # if ($b == 1) { $up = $up - 8 ; } # if ($c == 1) { $up = $up - 8 ; } # $up -= 8 if $a || $b || $c ; &pdf_thin_black_line ($table_cols[2],$top,$table_cols[2],$up,'#009bc8') ; # vertical &pdf_extra_thin_black_line ($table_cols[3],$top,$table_cols[3],$up,'#009bc8') ; # vertical &pdf_extra_thin_black_line ($table_cols[4],$top,$table_cols[4],$up,'#009bc8') ; $top = $up ; if ($a || $b || $c) { my $up_min = ($a + $b + $c)*8 + 8 + 10 ; if ($up < $up_min) { &pdf_box_block_bottom($table_cols[0],$table_cols[-1],'#009bc8') ; &pdf_check_value_of_up($up_min) ; &pdf_box_block_top($table_cols[0],$table_cols[-1],'#009bc8') ; $top = $up ; } else { &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; } $up -= 5 ; &pdf_small_bold_text ($table_cols[0]+05,$up,'Total Summary') ; &pdf_small_bold_text ($table_cols[2]+10,$up,'Sub Total') ; &pdf_small_bold_text ($table_cols[3]+10,$up,'VAT') ; &pdf_small_bold_text ($table_cols[4]+10,$up,'Total') ; $up -= 3 ; } if ($a == 1) { &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; $up-=5; # $inner_blue_box = 1 ; if ($get_pdf_name{"Hardware"}{$qt_id} and $get_pdf_name{"Hardware"}{$qt_id} ne "Hardware"){ &pdf_small_text ($table_cols[0]+5,$up,$get_pdf_name{"Hardware"}{$qt_id}) ; } else { &pdf_small_text ($table_cols[0]+5,$up,"Hardware and/or other once-off costs") ; } &pdf_small_text($table_cols[2]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-3]-2,$up,&common_commify($db{$table}{$qt_id}{subtotal_one_time_fee})) ; &pdf_small_text($table_cols[3]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-2]-2,$up,&common_commify($db{$table}{$qt_id}{vat_one_time_fee})) ; &pdf_small_text($table_cols[4]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-1]-2,$up,&common_commify($db{$table}{$qt_id}{total_one_time_fee})) ; $up-=3; } if ($b == 1) { &pdf_thin_black_line ($blocks[1],$up,200,$up,'#009bc8') ; $up-=5; &pdf_small_text ($table_cols[0]+5,$up,'Monthly Recurring Fee for contract period') ; &pdf_small_text($table_cols[2]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-3]-2,$up,&common_commify($db{$table}{$qt_id}{subtotal_monthly_recurring_fee})) ; &pdf_small_text($table_cols[3]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-2]-2,$up,&common_commify($db{$table}{$qt_id}{vat_monthly_recurring_fee})) ; &pdf_small_text($table_cols[4]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-1]-2,$up,&common_commify($db{$table}{$qt_id}{total_monthly_recurring_fee})) ; $up-=3; } if ($c == 1) { &pdf_thin_black_line ($blocks[1],$up,200,$up,'#009bc8') ; $up-=5; &pdf_small_text ($table_cols[0]+5,$up,'Annual Fee') ; &pdf_small_text($table_cols[2]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-3]-2,$up,&common_commify($db{$table}{$qt_id}{subtotal_annual_fee})) ; &pdf_small_text($table_cols[3]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-2]-2,$up,&common_commify($db{$table}{$qt_id}{vat_annual_fee})) ; &pdf_small_text($table_cols[4]+2,$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($table_cols[-1]-2,$up,&common_commify($db{$table}{$qt_id}{total_annual_fee})) ; $up-=3; } &pdf_thin_black_line ($table_cols[2],$top,$table_cols[2],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($table_cols[3],$top,$table_cols[3],$up,'#009bc8') ; # vertical &pdf_extra_thin_black_line ($table_cols[4],$top,$table_cols[4],$up,'#009bc8') ; # vertical # our @blocks = (0,10,104,112,152,192) ; # &pdf_thin_black_line ($blocks[2],$top,$blocks[2],$up,'#009bc8') ; # &pdf_thin_black_line (136,$top,136,$up,'#009bc8') ; # &pdf_thin_black_line (168,$top,168,$up,'#009bc8') ; # vertical #&vertical_lines_inner_box; # &pdf_thin_black_line ($tblocks[3],$top,$tblocks[3],$up,'#009bc8') ; # vertical # &pdf_thin_black_line ($tblocks[4],$top,$tblocks[4],$up,'#009bc8') ; # vertical # &pdf_thin_black_line ($tblocks[5],$top,$tblocks[5],$up,'#009bc8') ; &pdf_box_block_bottom($table_cols[0],$table_cols[-1],'#009bc8') ; # end block ------------------------------------- $inner_blue_box = 0 ; # $up -= 5 ; # &pdf_medium_bold_text ($table_cols[0]+5,$up,'Notes:') ; # $up = $up - 1.5; # my $counter = 1 ; # for (1 .. 20) { # my $note = $db{quote_notes}{2}{"note_$_"}; # if ($note) { # if ($counter == 1) { # $up = $up - 3 ; # } else { $up = $up - 1 ; # } # $counter++ ; # &pdf_medium_text ($table_cols[0]+6,$up,"-") ; # &pdf_text_block ($table_cols[0]+8,"$note",130) ; # } # } # ------------- totals ------------------------------------------------------------------ # ------------- purchase summary ------------------------------------------------------------------ unless ($db{$table}{$qt_id}{excl_purchase_summary}) { &build_purchase_summary_table ; } # ------------- purchase summary ------------------------------------------------------------------ #&pdf_nl_gap_1; #&pdf_nl_gap_3; # $up = $up - 15; #$&pdf_check_value_of_up(50); # my $txt = qq~The parties hereby accept and agree to this quote, which incorporates by reference all the terms and conditions set forth in the Interactive Television Africa's Terms and Conditions document, attached hereto as Annexure A and the Service Level Agreement attached hereto as Annexure B (all, collectively with this quote, the "Agreement") effective as of the later of the signature dates below.~; # # my @excl_notes_qm = split(";", $db{quotes_min}{$qt_id}{"excl_notes"}) ; # # our $paragraph_incl = 0 ; # # for (1 .. 20) { # # # next if $db{$table}{$qt_id}{"excl_$_\_notes"} || $db{$table}{$qt_id}{"note_$_"} eq ''; # # next if $excl_notes_qm[$_ - 1] || $db{$table}{$qt_id}{"note_$_"} eq ''; # # $notes_exist = 1 ; # # } # my $counter = 1 ; # # if ($notes_exist) { # &pdf_medium_bold_text ($blocks[1],$up,'Notes:') ; # $up = $up - 1; # for (1 .. 20) { # # unless ($db{$table}{$qt_id}{"excl_$_\_notes"}) { # unless ($excl_notes_qm[$_ - 1]) { # # my $note = $db{$table}{$qt_id}{"note_$_"}; # my $note = $db{quote_notes}{2}{"note_$_"}; # if ($note) { # if ($counter == 1) { # &pdf_nl; $up = $up - 1 # } else { # $up = $up - 2 ; # } # $counter++ ; # # if ($_ == 7) { # &pdf_medium_text ($blocks[1],$up,"-") ; # &pdf_text_block (12,"$note",130,3) ; # # $paragraph_incl = 1 if $txt eq $db{$table}{$qt_id}{"excl_$_\_notes"} ; # # } else { # # &pdf_medium_text ($blocks[1],$up,"- $note") ; # # } # } # } # } # $up = $up + 4 ; # # } # # my @excl_payment_terms_qm = split(";", $db{quotes_min}{$qt_id}{"excl_payment_terms"}) ; # # for (1 .. 20) { # # # next if $db{$table}{$qt_id}{"excl_$_\_payment_terms"} || $db{$table}{$qt_id}{"payment_term_$_"} eq ''; # # next if $excl_payment_terms_qm[$_ - 1] || $db{$table}{$qt_id}{"payment_term_$_"} eq ''; # # $payment_terms_exists = 1 ; # # } # # if ($payment_terms_exists) { # # &pdf_nl_gap_3; # # &pdf_check_value_of_up(50); # # &pdf_medium_bold_text ($blocks[1],$up,'Payment Terms:') ; # # $up = $up - 1; # # for (1 .. 20) { # # # unless ($db{$table}{$qt_id}{"excl_$_\_payment_terms"}) { # # unless ($excl_payment_terms_qm[$_ - 1]) { # # my $payment_term = $db{$table}{$qt_id}{"payment_term_$_"}; # # if (length($payment_term) > 2) { # # &pdf_nl_gap_1 ; # # &pdf_medium_text ($blocks[1],$up,"- $payment_term") ; # # } # # } # # } # # } # # my @excl_roes_qm = split(";", $db{quotes_min}{$qt_id}{"excl_roes"}) ; # # for (1 .. 20) { # # # next if $db{$table}{$qt_id}{"excl_$_\_roes"} || $db{$table}{$qt_id}{"roe_$_"} eq ''; # # next if $excl_roes_qm[$_ - 1] || $db{$table}{$qt_id}{"roe_$_"} eq ''; # # $roe_exists = 1 ; # # } # # if ($roe_exists) { # # &pdf_nl_gap_3; # # &pdf_check_value_of_up(50); # # &pdf_medium_bold_text ($blocks[1],$up,'ROE:') ; # # $up = $up - 1; # # for (1 .. 20) { # # # unless ($db{$table}{$qt_id}{"excl_$_\_roes"}) { # # unless ($excl_roes_qm[$_ - 1]) { # # my $roe = $db{$table}{$qt_id}{"roe_$_"}; # # if ($roe) { # # &pdf_nl; # # $up = $up - 1; # # &pdf_medium_text ($blocks[1],$up,"- $roe") ; # # } # # } # # } # # } # # my @excl_delivery_times_qm = split(";", $db{quotes_min}{$qt_id}{"excl_delivery_times"}) ; # # for (1 .. 20) { # # # next if $db{$table}{$qt_id}{"excl_$_\_delivery_times"} || $db{$table}{$qt_id}{"delivery_time_$_"} eq ''; # # next if $excl_delivery_times_qm[$_ - 1] || $db{$table}{$qt_id}{"delivery_time_$_"} eq ''; # # $delivery_time_exists = 1 ; # # } # # if ($delivery_time_exists) { # # &pdf_nl_gap_3; # # &pdf_check_value_of_up(50); # # &pdf_medium_bold_text ($blocks[1],$up,'Delivery time:') ; # # $up = $up - 1; # # for (1 .. 20) { # # # unless ($db{$table}{$qt_id}{"excl_$_\_delivery_times"}) { # # unless ($excl_delivery_times_qm[$_ - 1]) { # # my $delivery_time = $db{$table}{$qt_id}{"delivery_time_$_"}; # # if ($delivery_time) { # # &pdf_nl; $up = $up - 1; # # &pdf_medium_text ($blocks[1],$up,"- $delivery_time") ; # # } # # } # # } # # } # if ($db{$table}{$qt_id}{"terms"}){ # &pdf_nl_gap_3; # &pdf_check_value_of_up(50); # &pdf_medium_bold_text ($blocks[1],$up,'Terms and Conditions:') ; # $up = $up - 1; # &pdf_nl_gap_1; # &pdf_medium_text ($blocks[1],$up,"-") ; # my $para = $terms_and_con{$db{$table}{$qt_id}{"terms"}} ; # &pdf_text_block (12,"$para",130,3) ; # } } #------------------------------------------------------------------------------------------ sub build_purchase_summary_table { if ($up<50) { &pdf_check_value_of_up(50); } else { $up -= 5; } $up = $up - 3.25; &pdf_bar(10,$up,200,$up,'#009bc8','Purchase Summary (Incl VAT)',20,90, 'med') ; $up = $up - 3.25; &pdf_box_block_top($tblocks[1],200,'#009bc8') ; # start block --------- $top = $up ; $up = $up - 5 ; # &pdf_small_bold_text ($table_cols[0]+5,$up,'Description') ; # &pdf_small_bold_text ($table_cols[1]+7.5,$up,'Qty') ; # &pdf_small_bold_text ($table_cols[2]+11,$up,'Amount') ; # &pdf_small_bold_text ($table_cols[3]+11,$up,'VAT') ; # &pdf_small_bold_text ($table_cols[4]+12.5,$up,'Total') ; # pdf_small_bold_text # &pdf_bar(10,$up,200,$up,'#009bc8','Description',20, 14, 'med'); # if ($db{$table}{$qt_id}{period} == 36) { # &pdf_bar (10,$up,200,$up,'#009bc8','Year 1', 20, 90, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 2', 20, 120, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 3', 20, 150, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','TOTAL', 20, 180, 'med') ; # } # elsif ($db{$table}{$qt_id}{period} == 60) { # &pdf_bar (10,$up,200,$up,'#009bc8','Year 1', 20, 55, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 2', 20, 80, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 3', 20, 105, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 4', 20, 130, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','Year 5', 20, 155, 'med') ; # &pdf_bar (10,$up,200,$up,'#009bc8','TOTAL', 20, 180, 'med') ; # } &pdf_bar(10,$up,200,$up,'#009bc8','Description',20, 14, 'med'); &pdf_small_bold_text($table_cols[0]+4,$up,'Description') ; if ($db{$table}{$qt_id}{period} == 36) { &pdf_small_bold_text(90,$up,'Year 1') ; &pdf_small_bold_text(120,$up,'Year 2') ; &pdf_small_bold_text(150,$up,'Year 3') ; } elsif ($db{$table}{$qt_id}{period} == 60) { &pdf_small_bold_text(55,$up,'Year 1') ; &pdf_small_bold_text(80,$up,'Year 2') ; &pdf_small_bold_text(105,$up,'Year 3') ; &pdf_small_bold_text(130,$up,'Year 4') ; &pdf_small_bold_text(155,$up,'Year 5') ; } &pdf_small_bold_text(180,$up,'TOTAL') ; # $up = $up - 8; $up = $up - 3 ; &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; $up-=4.5 ; $inner_blue_box = 1 ; my $suffix = "_purchase_summary" ; my @prefexes = ("excl", "item") ; foreach my $prefix (@prefexes) { $col_name = "$prefix" . "$suffix" ; $cnt = 0 ; if($db{quotes_min}{$qt_id}{$col_name}){ foreach my $col_input (split(";", $db{quotes_min}{$qt_id}{$col_name})){ $cnt++ ; $saved_field{$prefix}{$suffix}{$cnt} = $col_input ; # &common_debug("$aa/$suffix : $cc") ; } } } if ($db{$table}{$qt_id}{period} == 36) { foreach (1 .. 3) { &pdf_check_value_of_up(15); if ($up>280){ $up=280; } if ($saved_field{"excl"}{$suffix}{$_}) { next ; } &pdf_small_bold_text ($tboxtxt[1]+2,$up,$saved_field{"item"}{$suffix}{$_}) ; $box=1; for my $y_ (1 .. 3) { $box++; $ttl{$y_} += $db{$table}{$qt_id}{"year_$y_\_$_$suffix"} ; &pdf_small_text($tboxtxt[$box],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($tboxrtxt[$box],$up,&common_commify($db{$table}{$qt_id}{"year_$y_\_$_$suffix"})) ; } $box++; $ttl += $db{$table}{$qt_id}{"total_$_$suffix"} ; &pdf_small_text($tboxtxt[$box],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($tboxrtxt[$box],$up,&common_commify($db{$table}{$qt_id}{"total_$_$suffix"})) ; # &pdf_nl_gap_1; $up-=4.5; } $up+=3; &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; $up-=5; &pdf_small_bold_text($tboxtxt[1]+2,$up,'Total') ; &pdf_small_bold_text($tboxtxt[2],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt[3],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt[4],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt[5],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text_right($tboxrtxt[2],$up,&common_commify(sprintf("%0.2f",$ttl{1}))) ; &pdf_small_bold_text_right($tboxrtxt[3],$up,&common_commify(sprintf("%0.2f",$ttl{2}))) ; &pdf_small_bold_text_right($tboxrtxt[4],$up,&common_commify(sprintf("%0.2f",$ttl{3}))) ; &pdf_small_bold_text_right($tboxrtxt[5],$up,&common_commify(sprintf("%0.2f",$ttl))) ; $up-=3; # &pdf_bar (10,$up,200,$up,'#009bc8','Total', 20, 14, 'med') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt[2], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{1})), 20, $tboxrtxt[2], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt[3], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{2})), 20, $tboxrtxt[3], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt[4], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{3})), 20, $tboxrtxt[4], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt[5], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl)), 20, $tboxrtxt[5], 'small_right') ; &pdf_thin_black_line ($tblocks[2],$top,$tblocks[2],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[3],$top,$tblocks[3],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[4],$top,$tblocks[4],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[5],$top,$tblocks[5],$up,'#009bc8') ; # vertical } elsif ($db{$table}{$qt_id}{period} == 60) { foreach (1 .. 3) { &pdf_check_value_of_up(15); if ($up>280){ $up=280; } if ($saved_field{"excl"}{$suffix}{$_}) { next ; } &pdf_small_bold_text ($tboxtxt2[1]+2,$up,$saved_field{"item"}{$suffix}{$_}) ; $box=1; for my $y_ (1 .. 5) { $box++; $ttl{$y_} += $db{$table}{$qt_id}{"year_$y_\_$_$suffix"} ; &pdf_small_text($tboxtxt2[$box],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($tboxrtxt2[$box],$up,&common_commify($db{$table}{$qt_id}{"year_$y_\_$_$suffix"})) ; } $box++; $ttl += $db{$table}{$qt_id}{"total_$_$suffix"} ; &pdf_small_text($tboxtxt2[$box],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_text_right($tboxrtxt2[$box],$up,&common_commify($db{$table}{$qt_id}{"total_$_$suffix"})) ; # &pdf_nl_gap_1; $up-=4.5; } $up+=4.5; &pdf_thin_black_line ($table_cols[0],$up,$table_cols[-1],$up,'#009bc8') ; $up-=5; &pdf_small_bold_text($tboxtxt2[1]+2,$up,'Total') ; &pdf_small_bold_text($tboxtxt2[2],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt2[3],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt2[4],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt2[5],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt2[6],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text($tboxtxt2[7],$up,$curr_symb{$db{$table}{$qt_id}{currency}}) ; &pdf_small_bold_text_right($tboxrtxt2[2],$up,&common_commify(sprintf("%0.2f",$ttl{1}))) ; &pdf_small_bold_text_right($tboxrtxt2[3],$up,&common_commify(sprintf("%0.2f",$ttl{2}))) ; &pdf_small_bold_text_right($tboxrtxt2[4],$up,&common_commify(sprintf("%0.2f",$ttl{3}))) ; &pdf_small_bold_text_right($tboxrtxt2[5],$up,&common_commify(sprintf("%0.2f",$ttl{4}))) ; &pdf_small_bold_text_right($tboxrtxt2[6],$up,&common_commify(sprintf("%0.2f",$ttl{5}))) ; &pdf_small_bold_text_right($tboxrtxt2[7],$up,&common_commify(sprintf("%0.2f",$ttl))) ; $up-=3; # &pdf_bar (10,$up,200,$up,'#009bc8','Total', 20, 14, 'med') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[2], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{1})), 20, $tboxrtxt2[2], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[3], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{2})), 20, $tboxrtxt2[3], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[4], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{3})), 20, $tboxrtxt2[4], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[5], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{4})), 20, $tboxrtxt2[5], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[6], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl{5})), 20, $tboxrtxt2[6], 'small_right') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', $curr_symb{$db{$table}{$qt_id}{currency}}, 20, $tboxtxt2[7], 'small') ; # &pdf_bar( 10, $up, 200, $up, '#009bc8', &common_commify(sprintf("%0.2f",$ttl)), 20, $tboxrtxt2[7], 'small_right') ; &pdf_thin_black_line ($tblocks2[2],$top,$tblocks2[2],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks2[3],$top,$tblocks2[3],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks2[4],$top,$tblocks2[4],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks2[5],$top,$tblocks2[5],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks2[6],$top,$tblocks2[6],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks2[7],$top,$tblocks2[7],$up,'#009bc8') ; # vertical } &pdf_box_block_bottom($tblocks[1],200,'#009bc8') ; # end block ------------------------------------- # $up-=4; $inner_blue_box = 0 ; } #---------------------------------------------------------------------------------------------------- sub vertical_lines_inner_box { &pdf_thin_black_line ($blocks[2],$top,$blocks[2],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($blocks[3],$top,$blocks[3],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($blocks[4],$top,$blocks[4],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($blocks[5],$top,$blocks[5],$up,'#009bc8') ; # vertical } #---------------------------------------------------------------------------------------------------- sub vertical_lines_inner_box_t { &pdf_thin_black_line ($tblocks[2],$top,$tblocks[2],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[3],$top,$tblocks[3],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[4],$top,$tblocks[4],$up,'#009bc8') ; # vertical &pdf_thin_black_line ($tblocks[5],$top,$tblocks[5],$up,'#009bc8') ; # vertical } #---------------------------------------------------------------------------------------------------- sub quote_pdf_footer { # &pdf_check_value_of_up(60); if ($up < 89) { &pdf_check_value_of_up(89); $up = 89 ; } $up -= 4.5 ; &pdf_medium_bold_text ($table_cols[0],$up,'Notes:') ; $up = $up - 1.5; $up -= 3 ; &pdf_small_text ($table_cols[0]+2,$up,"- Payment due on date of order") ; $up -= 4 ; &pdf_small_text ($table_cols[0]+2,$up,"- Minimum 36x month Contract") ; $up -= 4 ; &pdf_small_text ($table_cols[0]+2,$up,"- Annual Fees for Year 2 & 3 = R 36,000.00 (Exl VAT) per system per year") ; $up -= 4 ; &pdf_small_text ($table_cols[0]+2,$up,"- Annual fees due annually in advance") ; $up -= 4 ; &pdf_small_text ($table_cols[0]+2,$up,"- Annual fees to be reviewed if renewed after 36 months") ; $up -= 5 ; &pdf_text_block (10,"The parties hereby accept and agree to this quote, which incorporates by reference all the terms and conditions set forth in the AI Sport Africa's Terms and Conditions document.",120) ; $up = $up - 6; &pdf_medium_bold_text (10, $up, "Name:") ; &pdf_thin_black_line (30,$up,100,$up,'#009bc8') ; #&pdf_tiny_text (25, $up, "________________________________________________") ; &pdf_medium_bold_text (110, $up, "Date:") ; &pdf_thin_black_line (130,$up,200,$up,'#009bc8') ; $up = $up - 5; &pdf_small_text (10, $up, "(Duly Authorised)") ; $up = $up - 5; # &pdf_medium_bold_text (10, $up, "Company:") ; &pdf_thin_black_line (30,$up,100,$up,'#009bc8') ; &pdf_medium_bold_text (110, $up, "Signature:") ; &pdf_thin_black_line (130,$up,200,$up,'#009bc8') ; $up = $up - 10 ; &pdf_medium_bold_text (10, $up, "Name:") ; &pdf_thin_black_line (30,$up,100,$up,'#009bc8') ; &pdf_medium_bold_text (110, $up, "Date:") ; &pdf_thin_black_line (130,$up,200,$up,'#009bc8') ; $up = $up - 5; &pdf_small_text (10, $up, "(Duly Authorised on behalf of AI Sport Africa)") ; $up = $up - 5; &pdf_medium_bold_text (110, $up, "Signature:") ; &pdf_thin_black_line (130,$up,200,$up,'#009bc8') ; } #------------------------------------------------------------------------------------------ sub quote_pdf_vars { our @table_cols = (10,80,100,135,165,200) ; # our @htxt = (0,0,115,0,146,172,0) ; # our @boxtxt = (0,12,102,117,142,167) ; # our @blocks = (0,10,100,115,140,165) ; # our @rboxtxt = (0,97,122,147,172,197) ; # our @boxtxt = (0,12,102,127,152,177) ; # our @blocks = (0,10,100,125,150,175) ; # our @rboxtxt = (0,93,106,148,190,197) ; # our @boxtxt = (0,12,106,114,154,194) ; # our @blocks = (0,10,104,112,152,192) ; # our @rboxtxt = (0,93,106,151,190,197) ; # our @boxtxt = (0,12,106,120,157,194) ; # our @blocks = (0,10,104,118,155,192) ; our @blocks = (0,$table_cols[0],$table_cols[1],$table_cols[2],$table_cols[3],$table_cols[4]) ; our @tboxrtxt = (0,77,107,137,167,197) ; our @tboxtxt = (0,12,82,112,142,172) ; our @tblocks = (0,10,80,110,140,170) ; our @tboxrtxt2 = (0,42,67,92,117,142,167,197) ; our @tboxtxt2 = (0,12,47,72,97,122,147,172) ; our @tblocks2 = (0,10,45,70,95,120,145,170) ; } #------------------------------------------------------------------------------- sub custom_date_txt { my ($date) = @_ ; my $dt_txt = Date_to_Text(substr($date,0,4),substr($date,5,2),substr($date,8,2)); $dt_txt = substr($dt_txt,4) ; return ($dt_txt) ; } #------------------------------------------------------------------------------------------ sub check_space_on_page_custom { my ($value) = @_ ; if ($up < $value) { &pdf_thin_black_line (10,$top,10,$up) ; &vertical_lines_table; # draw vertical_lines on prematurely ended table &pdf_initialise_page ; $up=282 ; $top=$up; &pdf_thin_black_line(10,$up,200,$up) ; $across = 1 ; } } #---------------------------------------------------------------------------------------------------- sub get_val { my ($val,$cur) = @_ ; my $disp_val = $val ; if ($val eq '0.00') { $disp_val = '' ; } elsif ($val) { $disp_val = $cur . ' ' . $val ; } # &common_min_debug($val); return($disp_val); } #------------------------------------------------------------------------------------------ sub vertical_lines_table { unless ($exclude_rate) { &pdf_thin_black_line ($blocks[2],$top,$blocks[2],$up) ; # vertical &pdf_thin_black_line ($blocks[3],$top,$blocks[3],$up) ; # vertical } unless ($exclude_vat) { &pdf_thin_black_line ($blocks[4],$top,$blocks[4],$up) ; # vertical } &pdf_thin_black_line ($blocks[5],$top,$blocks[5],$up) ; # vertical &pdf_thin_black_line ($blocks[6],$top,$blocks[6],$up) ; # vertical } #------------------------------------------------------------------------------------------ sub screen2 { print <
ENDOFTEXT # } #------------------------------------------------------------------------------------------ use db ; use db_min ; use dialog ; use today ; use common ; use pdf ; use tabs ; 1;