aisa/scripts/pdf/vat_recon_pdf.pl
2025-11-26 11:31:54 +02:00

121 lines
3.0 KiB
Perl

#!/usr/bin/perl
BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
require cfg ;
use DBI;
use CGI::Carp qw(fatalsToBrowser);
# use Date::Calc qw(:all);
use POSIX;
use PDF::API2::Lite;
use constant mm => 25.4/72;
use constant in => 1/72;
use constant pt => 1;
print "Content-type: text/html\n\n";
&today ;
#------------------------------------------------------------------------------------------
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
#------------------------------------------------------------------------------------------
&build_pdf ;
&screen2 ;
exit ;
#------------------------------------------------------------------------------------------
sub build_pdf {
my $wbpdfpath = "$pdfpath/recon" ;
our $pdfname = 'VAT-RECON-' . '-' . $now_ccyymmdd . '.pdf' ;
&pdf_delete_previous_pdf($wbpdfpath) ;
&pdf_initialise($wbpdfpath,$pdfname,'Film Freight Waybill VAT Recon') ; ;
&pdf_initialise_page ;
$up = 275 ;
$across = 1 ;
&pdf_page_header ;
&pdf_nl;
&pdf_black_line;
&pdf_nl;
&waybill_out_to_vat_recon_pdf ;
&pdf_footer ;
&finish_pdf ;
} #------------------------------------------------------------------------------------------
sub waybill_out_to_vat_recon_pdf {
&pdf_small_bold_text (10, $up, 'Date') ;
&pdf_small_bold_text (30, $up, 'HAWB') ;
&pdf_small_bold_text (45, $up, 'Client') ;
&pdf_small_bold_text (100, $up, 'Customs VAT') ;
&pdf_small_bold_text (130, $up, 'Customs Duty') ;
&pdf_small_bold_text (160, $up, 'Invoice No') ;
&pdf_small_bold_text (185, $up, 'Paid') ;
&pdf_nl_t;
&pdf_dashed_line;
foreach (@ARGV) {
# print "<br>" . $_ ;
&pdf_check_value_of_up(30) ;
&db_load_waybill($_) ;
&pdf_nl;
my $invno = sprintf("%.0f",($wb{invno})) ;
my $invvalue = &common_commify(sprintf("%.2f",($wb{invvalue}))) ;
my $customsvat = &common_commify(sprintf("%.2f",($wb{customsvat}))) ;
my $customsduty = &common_commify(sprintf("%.2f",($wb{customsduty}))) ;
&pdf_small_text (10, $up, $wb{capturedate}) ;
&pdf_small_text (30, $up, $wb{waybillno}) ;
&pdf_small_text (45, $up, $wb{client}) ;
&pdf_small_text (100, $up, $customsvat) ;
&pdf_small_text (130, $up, $customsduty) ;
&pdf_small_text (160, $up, $invno) ;
&pdf_small_text (185, $up, $invvalue) ;
}
} #------------------------------------------------------------------------------------------
sub screen2 {
print <<ENDOFTEXT;
$dialog{'common'}{'head'}
<div id="content" class="col-lg-12 col-sm-12">
<CENTER>
<table height='100%' width='100%'>
<tr>
<td align='center'>
<iframe src='$useropts{'$domain'}/pdf/recon/$pdfname' width='100%' height='100%' frameborder='0'></iframe>
</td>
</tr>
</table>
</div>
</body>
</html>
ENDOFTEXT
#
} #------------------------------------------------------------------------------------------
use db ;
use dialog ;
use today ;
use common ;
use pdf ;
1;