Lines Matching refs:form

46 if ( -f "bin/custom/$form->{login}_arapprn.pl" ) {
47 eval { require "bin/custom/$form->{login}_arapprn.pl"; };
56 if ( $form->{media} !~ /screen/ ) {
57 $form->error( $locale->text('Select postscript or PDF!') )
58 if $form->{format} !~ /(postscript|pdf)/;
60 for ( keys %$form ) { $old_form->{$_} = $form->{$_} }
63 if ( $form->{formname} =~ /(check|receipt)/ ) {
64 if ( $form->{media} eq 'screen' ) {
65 $form->error( $locale->text('Select postscript or PDF!') )
66 if $form->{format} !~ /(postscript|pdf)/;
70 if ( !$form->{invnumber} ) {
72 $invfld = 'vinumber' if $form->{ARAP} eq 'AP';
73 $form->{invnumber} = $form->update_defaults( \%myconfig, $invfld );
74 if ( $form->{media} eq 'screen' ) {
75 if ( $form->{media} eq 'screen' ) {
82 if ( $form->{formname} =~ /(check|receipt)/ ) {
83 if ( $form->{media} ne 'screen' ) {
84 for (qw(action header)) { delete $form->{$_} }
85 $form->{invtotal} = $form->{oldinvtotal};
87 foreach $key ( keys %$form ) {
88 $form->{$key} =~ s/&/%26/g;
89 $form->{previousform} .= qq|$key=$form->{$key}&|;
91 chop $form->{previousform};
92 $form->{previousform} = $form->escape( $form->{previousform}, 1 );
95 if ( $form->{paidaccounts} > 1 ) {
96 if ( $form->{"paid_$form->{paidaccounts}"} ) {
100 elsif ( $form->{paidaccounts} > 2 ) {
108 $form->error( $locale->text('Nothing to print!') );
112 if ( $filename = $queued{ $form->{formname} } ) {
113 $form->{queued} =~ s/$form->{formname} $filename//;
122 $filename .= ( $form->{format} eq 'postscript' ) ? '.ps' : '.pdf';
123 if ( $form->{media} ne 'screen' ) {
124 $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
125 $form->{printmode} = '>';
127 $form->{queued} .= " $form->{formname} $filename";
128 $form->{queued} =~ s/^ //;
130 for ( keys %$form ) {
131 $printform->{$_} = $form->{$_};
134 if ( $form->{printandpost} ) {
135 delete $form->{printandpost};
136 $form->{action} = 'post';
140 &{"print_$form->{formname}"}( $old_form, 1 );
149 ( $form->{display_form} ) ? $form->{display_form} : "display_form";
151 if ( $form->{"paid_$i"} ) {
154 if ( exists $form->{longformat} ) {
155 $form->{"datepaid_$i"} =
156 $locale->date( \%myconfig, $form->{"datepaid_$i"},
157 $form->{longformat} );
161 $form->format_string(@a);
164 $form->{amount} = $form->{"paid_$i"};
166 if ( ( $form->{formname} eq 'check' && $form->{vc} eq 'customer' )
167 || ( $form->{formname} eq 'receipt' && $form->{vc} eq 'vendor' ) )
169 $form->{amount} =~ s/-//g;
172 for (qw(datepaid source memo)) { $form->{$_} = $form->{"${_}_$i"} }
174 &{"$form->{vc}_details"};
178 $temp{$item} = $form->{$item};
179 delete $form->{$item};
180 push( @{ $form->{$item} }, $temp{$item} );
182 push( @{ $form->{invdate} }, $form->{transdate} );
184 @{ $form->{due} },
185 $form->format_amount( \%myconfig, $form->{oldinvtotal}, 2 )
187 push( @{ $form->{paid} }, $form->{"paid_$i"} );
191 CP->new( ( $form->{language_code} )
192 ? $form->{language_code}
195 ( $whole, $form->{decimal} ) = split /\./,
196 $form->parse_amount( \%myconfig, $form->{amount} );
198 $form->{decimal} .= "00";
199 $form->{decimal} = substr( $form->{decimal}, 0, 2 );
200 $form->{text_decimal} = $c->num2text( $form->{decimal} * 1 );
201 $form->{text_amount} = $c->num2text($whole);
202 $form->{integer_amount} = $form->format_amount( $myconfig, $whole );
204 ( $form->{employee} ) = split /--/, $form->{employee};
206 $form->{notes} =~ s/^\s+//g;
210 $form->{$_} = $myconfig{$_};
212 $form->{address} =~ s/\\n/\n/g;
217 $form->format_string(@a);
219 $form->{templates} = "$myconfig{templates}";
220 $form->{IN} =
221 ( $form->{formname} eq 'transaction' )
222 ? lc $form->{ARAP} . "_$form->{formname}.html"
223 : "$form->{formname}.html";
225 if ( $form->{format} =~ /(postscript|pdf)/ ) {
226 $form->{IN} =~ s/html$/tex/;
228 if ( $form->{media} eq 'queue' ) {
231 $form->update_status( \%myconfig );
233 $form->{queued} = $form->{queued};
237 reference => $form->{"${inv}number"},
238 formname => $form->{formname},
240 id => $form->{id}
243 $form->{audittrail} .=
244 $form->audittrail( "", \%myconfig, \%audittrail );
245 $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
246 $form->{printmode} = '>';
247 $form->{queued} .= " $form->{formname} $filename";
248 $form->{queued} =~ s/^ //;
251 if ( $form->{media} !~ /(screen|queue)/ ) {
253 %queued = split / /, $form->{queued};
255 $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
256 $form->{printmode} = '|-';
257 if ( $form->{printed} !~ /$form->{formname}/ ) {
259 $form->{printed} .= " $form->{formname}";
260 $form->{printed} =~ s/^ //;
262 $form->update_status( \%myconfig );
266 tablename => lc $form->{ARAP},
267 reference => $form->{invnumber},
268 formname => $form->{formname},
270 id => $form->{id}
274 for (qw(printed audittrail)) { $status{$_} = $form->{$_} }
277 $form->audittrail( "", \%myconfig, \%audittrail );
281 $form->{fileid} = $invnumber;
282 $form->{fileid} =~ s/(\s|\W)+//g;
284 $form->parse_template( \%myconfig );
286 if ( $form->{previousform} ) {
288 $previousform = $form->unescape( $form->{previousform} );
290 for ( keys %$form ) { delete $form->{$_} }
295 $form->{$key} = $value;
299 $form->{$_} = $form->parse_amount( \%myconfig, $form->{$_} );
302 for ( 1 .. $form->{rowcount} ) {
303 $form->{"amount_$_"} =
304 $form->parse_amount( \%myconfig, $form->{"amount_$_"} );
306 for ( split / /, $form->{taxaccounts} ) {
307 $form->{"tax_$_"} =
308 $form->parse_amount( \%myconfig, $form->{"tax_$_"} );
311 for $i ( 1 .. $form->{paidaccounts} ) {
313 $form->{"${_}_$i"} =
314 $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
318 for (qw(printed audittrail)) { $form->{$_} = $status{$_} }
337 ( $form->{display_form} ) ? $form->{display_form} : "display_form";
339 &{"$form->{vc}_details"};
342 $form->{invtotal} = 0;
343 foreach $i ( 1 .. $form->{rowcount} - 1 ) {
344 ( $form->{tempaccno}, $form->{tempaccount} ) = split /--/,
345 $form->{"$form->{ARAP}_amount_$i"};
346 ( $form->{tempprojectnumber} ) = split /--/,
347 $form->{"projectnumber_$i"};
348 $form->{tempdescription} = $form->{"description_$i"};
350 $form->format_string(
353 push( @{ $form->{accno} }, $form->{tempaccno} );
354 push( @{ $form->{account} }, $form->{tempaccount} );
355 push( @{ $form->{description} }, $form->{tempdescription} );
356 push( @{ $form->{projectnumber} }, $form->{tempprojectnumber} );
358 push( @{ $form->{amount} }, $form->{"amount_$i"} );
360 $form->{subtotal} +=
361 $form->parse_amount( \%myconfig, $form->{"amount_$i"} );
364 foreach $accno ( split / /, $form->{taxaccounts} ) {
365 if ( $form->{"tax_$accno"} ) {
366 $form->format_string("${accno}_description");
368 $tax += $form->parse_amount( \%myconfig, $form->{"tax_$accno"} );
370 $form->{"${accno}_tax"} = $form->{"tax_$accno"};
371 push( @{ $form->{tax} }, $form->{"tax_$accno"} );
374 @{ $form->{taxdescription} },
375 $form->{"${accno}_description"}
378 $form->{"${accno}_taxrate"} =
379 $form->format_amount( $myconfig, $form->{"${accno}_rate"} * 100 );
380 push( @{ $form->{taxrate} }, $form->{"${accno}_taxrate"} );
382 push( @{ $form->{taxnumber} }, $form->{"${accno}_taxnumber"} );
386 $tax = 0 if $form->{taxincluded};
388 push @a, $form->{ARAP};
389 $form->format_string(@a);
391 $form->{paid} = 0;
392 for $i ( 1 .. $form->{paidaccounts} - 1 ) {
394 if ( $form->{"paid_$i"} ) {
396 $form->{paid} +=
397 $form->parse_amount( \%myconfig, $form->{"paid_$i"} );
399 if ( exists $form->{longformat} ) {
400 $form->{"datepaid_$i"} =
401 $locale->date( \%myconfig, $form->{"datepaid_$i"},
402 $form->{longformat} );
405 push @a, "$form->{ARAP}_paid_$i", "source_$i", "memo_$i";
406 $form->format_string(@a);
408 ( $accno, $account ) = split /--/, $form->{"$form->{ARAP}_paid_$i"};
410 push( @{ $form->{payment} }, $form->{"paid_$i"} );
411 push( @{ $form->{paymentdate} }, $form->{"datepaid_$i"} );
412 push( @{ $form->{paymentaccount} }, $account );
413 push( @{ $form->{paymentsource} }, $form->{"source_$i"} );
414 push( @{ $form->{paymentmemo} }, $form->{"memo_$i"} );
419 $form->{invtotal} = $form->{subtotal} + $tax;
420 $form->{total} = $form->{invtotal} - $form->{paid};
424 CP->new( ( $form->{language_code} )
425 ? $form->{language_code}
428 ( $whole, $form->{decimal} ) = split /\./, $form->{invtotal};
430 $form->{decimal} .= "00";
431 $form->{decimal} = substr( $form->{decimal}, 0, 2 );
432 $form->{text_decimal} = $c->num2text( $form->{decimal} * 1 );
433 $form->{text_amount} = $c->num2text($whole);
434 $form->{integer_amount} = $form->format_amount( $myconfig, $whole );
437 $form->{$_} = $form->format_amount( \%myconfig, $form->{$_}, 2 );
440 ( $form->{employee} ) = split /--/, $form->{employee};
442 if ( exists $form->{longformat} ) {
444 $form->{$_} =
445 $locale->date( \%myconfig, $form->{$_}, $form->{longformat} );
449 $form->{notes} =~ s/^\s+//g;
454 $form->{$_} = $myconfig{$_};
456 $form->{address} =~ s/\\n/\n/g;
461 $form->format_string(@a);
463 $form->{invdate} = $form->{transdate};
465 $form->{templates} = "$myconfig{templates}";
466 $form->{IN} =
467 ( $form->{formname} eq 'transaction' )
468 ? lc $form->{ARAP} . "_$form->{formname}.html"
469 : "$form->{formname}.html";
471 if ( $form->{format} =~ /(postscript|pdf)/ ) {
472 $form->{IN} =~ s/html$/tex/;
474 if ( $form->{media} eq 'queue' ) {
475 %queued = split / /, $form->{queued};
477 if ( $filename = $queued{ $form->{formname} } ) {
478 $form->{queued} =~ s/$form->{formname} $filename//;
487 $filename .= ( $form->{format} eq 'postscript' ) ? '.ps' : '.pdf';
488 $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
489 $form->{printmode} = '>';
491 $form->{queued} .= " $form->{formname} $filename";
492 $form->{queued} =~ s/^ //;
495 $form->update_status( \%myconfig );
497 $old_form->{queued} = $form->{queued};
501 reference => $form->{"${inv}number"},
502 formname => $form->{formname},
504 id => $form->{id}
508 $form->audittrail( "", \%myconfig, \%audittrail );
511 if ( $form->{media} !~ /(queue|screen)/ ) {
512 $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
513 $form->{printmode} = '|-';
515 if ( $form->{printed} !~ /$form->{formname}/ ) {
517 $form->{printed} .= " $form->{formname}";
518 $form->{printed} =~ s/^ //;
520 $form->update_status( \%myconfig );
523 $old_form->{printed} = $form->{printed} if %$old_form;
526 tablename => lc $form->{ARAP},
527 reference => $form->{"invnumber"},
528 formname => $form->{formname},
530 id => $form->{id}
534 $form->audittrail( "", \%myconfig, \%audittrail )
539 $form->{fileid} = $form->{invnumber};
540 $form->{fileid} =~ s/(\s|\W)+//g;
542 $form->parse_template( \%myconfig );
545 $old_form->{invnumber} = $form->{invnumber};
546 $old_form->{invtotal} = $form->{invtotal};
548 for ( keys %$form ) { delete $form->{$_} }
549 for ( keys %$old_form ) { $form->{$_} = $old_form->{$_} }
551 if ( !$form->{printandpost} ) {
553 $form->{$_} = $form->parse_amount( \%myconfig, $form->{$_} );
556 for ( 1 .. $form->{rowcount} ) {
557 $form->{"amount_$_"} =
558 $form->parse_amount( \%myconfig, $form->{"amount_$_"} );
560 for ( split / /, $form->{taxaccounts} ) {
561 $form->{"tax_$_"} =
562 $form->parse_amount( \%myconfig, $form->{"tax_$_"} );
565 for $i ( 1 .. $form->{paidaccounts} ) {
567 $form->{"${_}_$i"} =
568 $form->parse_amount( \%myconfig, $form->{"${_}_$i"} );
579 sub vendor_details { IR->vendor_details( \%myconfig, \%$form ) }
580 sub customer_details { IS->customer_details( \%myconfig, \%$form ) }
585 ( "ndx", "datepaid", "source", "memo", "paid", "$form->{ARAP}_paid" );
588 $form->header;
597 $column_data{"$form->{ARAP}_paid"} =
603 <form method="post" action="$form->{script}">
622 foreach $i ( 1 .. $form->{paidaccounts} - 1 ) {
625 $column_data{$_} = qq|<td>$form->{"${_}_$i"}</td>|;
628 $paid = $form->{"paid_$i"};
660 for (qw(action nextsub)) { delete $form->{$_} }
662 $form->hide_form;
688 &{"print_$form->{formname}"}( $form->{oldform}, $form->{ndx} );
694 if ( $form->{selectlanguage} ) {
695 $form->{"selectlanguage"} =
696 $form->unescape( $form->{"selectlanguage"} );
697 $form->{"selectlanguage"} =~ s/ selected//;
698 $form->{"selectlanguage"} =~
699 s/(<option value="\Q$form->{language_code}\E")/$1 selected/;
700 $lang = qq|<select name="language_code">$form->{selectlanguage}</select>
702 . $form->escape( $form->{selectlanguage}, 1 ) . qq|">|;
705 $form->{selectformname} = $form->unescape( $form->{selectformname} );
706 $form->{selectformname} =~ s/ selected//;
707 $form->{selectformname} =~
708 s/(<option value="\Q$form->{formname}\E")/$1 selected/;
710 $type = qq|<select name="formname">$form->{selectformname}</select>
712 . $form->escape( $form->{selectformname}, 1 ) . qq|">|;
717 $form->{selectformat} = qq|<option value="html">html\n|;
727 $form->{selectformat} .= qq|
733 $format = qq|<select name="format">$form->{selectformat}</select>|;
734 $format =~ s/(<option value="\Q$form->{format}\E")/$1 selected/;
737 . $form->escape( $form->{selectformat}, 1 ) . qq|">|;
739 $media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
751 if ( $form->{printed} =~ /$form->{formname}/ ) {
755 if ( $form->{recurring} ) {
769 $form->error( $locale->text('Select postscript or PDF!') )
770 if $form->{format} !~ /(postscript|pdf)/;
771 $form->error( $locale->text('Select a Printer!') )
772 if $form->{media} eq 'screen';
774 $form->{printandpost} = 1;
775 $form->{display_form} = "post";