Lines Matching refs:form

18 require "$form->{path}/arap.pl";
19 require "$form->{path}/io.pl";
29 …$form->{callback} = "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&path=$form
40 $form->{linkshipto} = 1;
50 …$form->{callback} = "$form->{script}?action=generate&type=$form->{type}&login=$form->{login}&path=…
52 $form->{generate} = 1;
57 for (qw(notes intnotes department warehouse)) { delete $form->{$_} }
58 $form->{currency} = $form->{defaultcurrency};
67 $form->{vc} = "customer";
68 $readonly = $form->{readonly};
71 $form->create_links("AR", \%myconfig, "customer");
73 $form->{readonly} ||= $readonly;
75 $form->{selectprinter} = "";
76 for (@{ $form->{all_printer} }) { $form->{selectprinter} .= "$_->{printer}\n" }
77 chop $form->{selectprinter};
80 @curr = split /:/, $form->{currencies};
81 $form->{defaultcurrency} = $curr[0];
82 chomp $form->{defaultcurrency};
84 for (@curr) { $form->{selectcurrency} .= "$_\n" }
86 if (@{ $form->{"all_$form->{vc}"} }) {
87 unless ($form->{"$form->{vc}_id"}) {
88 $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
92 if (! $form->{generate}) {
93 AA->get_name(\%myconfig, \%$form);
94 delete $form->{notes};
95 IS->retrieve_invoice(\%myconfig, \%$form);
97 $ml = ($form->{type} eq 'invoice') ? 1 : -1;
98 $ml = 1 if $form->{type} eq 'pos_invoice';
100 $l{language_code} = $form->{language_code};
102 $l{all} = 1 if $form->{type} eq 'credit_invoice';
106 $form->get_partsgroup(\%myconfig, \%l);
108 if (@{ $form->{all_partsgroup} }) {
109 $form->{selectpartsgroup} = "\n";
110 foreach $ref (@ { $form->{all_partsgroup} }) {
112 $form->{selectpartsgroup} .= qq|$ref->{translation}--$ref->{id}\n|;
114 $form->{selectpartsgroup} .= qq|$ref->{partsgroup}--$ref->{id}\n|;
119 if (@{ $form->{all_project} }) {
120 $form->{selectprojectnumber} = "\n";
121 …for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|$_->{projectnumber}--$_->{id}…
124 $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
125 $form->{"old$form->{vc}number"} = $form->{"$form->{vc}number"};
126 for (qw(transdate duedate)) { $form->{"old$_"} = $form->{$_} }
128 if ($form->{generate}) {
129 $form->{"select$form->{vc}"} = "\n";
130 $form->{"old$form->{vc}"} = "";
131 $form->{"old$form->{vc}number"} = "";
133 $form->{"select$form->{vc}"} = "";
134 if (@{ $form->{"all_$form->{vc}"} }) {
135 $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
136 …for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|$_->{name}--$_->{id}\n|…
141 $form->{department} = "$form->{department}--$form->{department_id}" if $form->{department_id};
145 if (@{ $form->{all_warehouse} }) {
146 $form->{selectwarehouse} = ($form->{forcewarehouse}) ? "" : "\n";
147 …$form->{oldwarehouse} = $form->{warehouse} = "$form->{warehouse}--$form->{warehouse_id}" if $form-…
149 …for (@{ $form->{all_warehouse} }) { $form->{selectwarehouse} .= qq|$_->{description}--$_->{id}\n| }
152 $form->{employee} = "$form->{employee}--$form->{employee_id}";
154 if (@{ $form->{all_employee} }) {
155 $form->{selectemployee} = "\n";
156 for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|$_->{name}--$_->{id}\n| }
159 if (@{ $form->{all_language} }) {
160 $form->{selectlanguage} = "\n";
161 …for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|$_->{code}--$_->{description}\n| }
164 $form->{roundchange} = "=$form->{roundchange}";
167 if (@{ $form->{all_paymentmethod} }) {
168 $form->{selectpaymentmethod} = "\n";
169 for (@{ $form->{all_paymentmethod} }) {
170 $form->{selectpaymentmethod} .= qq|$_->{description}--$_->{id}\n|;
172 $form->{roundchange} .= ";$_->{description}--$_->{id}=$_->{roundchange}";
180 $form->{"select$form->{vc}"} = $form->escape($form->{"select$form->{vc}"},1);
181 … warehouse employee language paymentmethod printer)) { $form->{"select$_"} = $form->escape($form->…
182 $form->{roundchange} = $form->escape($form->{roundchange},1);
185 foreach $key (keys %{ $form->{AR_links} }) {
187 $form->{"select$key"} = "";
188 foreach $ref (@{ $form->{AR_links}{$key} }) {
189 $form->{"select$key"} .= "$ref->{accno}--$ref->{description}\n";
191 $form->{"select$key"} = $form->escape($form->{"select$key"},1);
194 for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
195 …$form->{"AR_paid_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-…
197 $form->{"paid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{amount} * -1 * $ml;
198 $form->{"datepaid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{transdate};
199 $form->{"olddatepaid_$i"} = $form->{acc_trans}{$key}->[$i-1]->{transdate};
200 $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i-1]->{exchangerate};
201 $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i-1]->{source};
202 $form->{"memo_$i"} = $form->{acc_trans}{$key}->[$i-1]->{memo};
203 $form->{"cleared_$i"} = $form->{acc_trans}{$key}->[$i-1]->{cleared};
204 $form->{"vr_id_$i"} = $form->{acc_trans}{$key}->[$i-1]->{vr_id};
205 …$form->{"paymentmethod_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{paymentmethod}--$form->{acc_tran…
207 $form->{paidaccounts} = $i;
211 …$form->{"AR_discount_paid"} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[…
212 $form->{"discount_paid"} = $form->{acc_trans}{$key}->[0]->{amount} * -1 * $ml;
213 $form->{"discount_datepaid"} = $form->{acc_trans}{$key}->[0]->{transdate};
214 $form->{"olddiscount_datepaid"} = $form->{acc_trans}{$key}->[0]->{transdate};
215 $form->{"discount_source"} = $form->{acc_trans}{$key}->[0]->{source};
216 $form->{"discount_memo"} = $form->{acc_trans}{$key}->[0]->{memo};
217 $form->{"discount_exchangerate"} = $form->{acc_trans}{$key}->[0]->{exchangerate};
218 $form->{"discount_cleared"} = $form->{acc_trans}{$key}->[0]->{cleared};
219 …$form->{"discount_paymentmethod"} = "$form->{acc_trans}{$key}->[0]->{paymentmethod_id}--$form->{ac…
222 …$form->{$key} = "$form->{acc_trans}{$key}->[0]->{accno}--$form->{acc_trans}{$key}->[0]->{descripti…
227 for (qw(AR_links acc_trans)) { delete $form->{$_} }
229 for (qw(payment discount)) { $form->{"${_}_accno"} = $form->escape($form->{"${_}_accno"},1) }
230 $form->{payment_method} = $form->escape($form->{payment_method}, 1);
232 $form->{exchangerate} ||= 1;
233 …$form->{cd_available} = $form->round_amount($form->{netamount} * $form->{cashdiscount} / $form->{e…
234 $form->{cashdiscount} *= 100;
236 $form->{paidaccounts} ||= 1;
238 $form->{AR} ||= $form->{AR_1};
240 …$form->{locked} = ($form->{revtrans}) ? '1' : ($form->datetonum(\%myconfig, $form->{transdate}) <=…
242 if (! $form->{readonly}) {
243 $form->{readonly} = 1 if $myconfig{acs} =~ /AR--Sales Invoice/ && $form->{type} eq 'invoice';
244 …$form->{readonly} = 1 if $myconfig{acs} =~ /AR--Sales Invoice/ && $form->{type} eq 'credit_invoice…
247 if ($form->{id}) {
258 if ($form->{generate}) {
263 $form->{title} = $title{$form->{type}};
270 $form->{type} ||= "invoice";
271 $form->{formname} ||= "invoice";
272 $form->{sortby} ||= "runningnumber";
273 $form->{format} ||= $myconfig{outputformat};
274 $form->{copies} ||= 1;
277 $form->{format} ||= "ps";
279 $form->{media} ||= $myconfig{printer};
283 $form->helpref($form->{type}, $myconfig{countrycode});
285 if ($form->{type} eq 'invoice') {
286 $form->{selectformname} = qq|invoice--|.$locale->text('Invoice')
289 $form->{selectformname} .= qq|\nbarcode--|.$locale->text('Barcode') if $dvipdf;
290 …$form->{selectformname} .= qq|\nremittance_voucher--|.$locale->text('Remittance Voucher') if $form
292 $generate = ($form->{generate}) ? "generate_" : "";
293 $form->helpref("${generate}sales_invoice", $myconfig{countrycode});
296 if ($form->{type} eq 'credit_invoice') {
298 $form->{selectformname} = qq|credit_invoice--|.$locale->text('Credit Invoice')
300 $form->{selectformname} .= qq|\nbarcode--|.$locale->text('Barcode') if $dvipdf;
304 $form->{currency} =~ s/ //g;
305 $form->{oldcurrency} = $form->{currency};
307 if ($form->{id}) {
309 … quonumber shippingpoint shipvia waybill notes intnotes)) { $form->{$_} = $form->quote($form->{$_}…
311 foreach $ref (@{ $form->{invoice_details} } ) {
312 for (keys %$ref) { $form->{"${_}_$i"} = $ref->{$_} }
314 if ($form->{type} eq 'invoice' || $form->{type} eq 'pos_invoice') {
315 if ($form->{"inventory_accno_id_$i"} || $form->{"assembly_$i"}) {
316 $form->{"onhand_$i"} += $form->{"qty_$i"};
319 $form->{"onhand_$i"} = $form->format_amount(\%myconfig, $form->{"onhand_$i"}, undef, " ");
321 … $form->{"projectnumber_$i"} = qq|$ref->{projectnumber}--$ref->{project_id}| if $ref->{project_id};
322 … $form->{"partsgroup_$i"} = qq|$ref->{partsgroup}--$ref->{partsgroup_id}| if $ref->{partsgroup_id};
324 $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
326 …for (qw(netweight grossweight volume)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $fo…
328 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
330 $decimalplaces = ($dec > $form->{precision}) ? $dec : $form->{precision};
332 …$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces…
333 $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $ml);
334 $form->{"oldqty_$i"} = $form->{"qty_$i"};
336 …for (qw(partnumber sku description unit)) { $form->{"${_}_$i"} = $form->quote($form->{"${_}_$i"}) }
337 $form->{rowcount} = $i;
342 for $formname (split / /, $form->{$_}) {
343 $form->{"${formname}_$_"} = 1;
350 $form->{selectformname} = $form->escape($form->{selectformname},1);
358 $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
362 if ($form->{defaultcurrency}) {
370 .$form->select_option($form->{selectcurrency}, $form->{currency})
373 if ($form->{currency} ne $form->{defaultcurrency}) {
374 $fdm = $form->dayofmonth($myconfig{dateformat}, $form->{transdate}, 'fdm');
375 $ldm = $form->dayofmonth($myconfig{dateformat}, $form->{transdate});
379 … <td nowrap><input name="exchangerate" class="inputright" size="10" value="$form->{exchangerate}">
380 …rates&transdatefrom=$fdm&transdateto=$ldm&currency=$form->{currency}&login=$form->{login}&path=$fo…
389 if ($form->{id} && $form->{"lock_sinumber"}) {
393 <td>|.$form->quote($form->{invnumber}).qq|</td>
394 </tr>|.$form->hide_form(qw(invnumber lock_sinumber));
399 <td><input name="invnumber" size="20" value="|.$form->quote($form->{invnumber}).qq|"></td>
403 …cref = qq|<a href="ct.pl?action=edit&db=$form->{vc}&id=$form->{"$form->{vc}_id"}&login=$form->{log…
410 if ($form->{"select$form->{vc}"}) {
412 …<select name="$form->{vc}" onChange="javascript:document.main.submit()">|.$form->select_option($fo…
418 <td>$form->{"$form->{vc}number"}</td>
420 | . $form->hide_form("$form->{vc}number");
423 … <td nowrap><input name="$form->{vc}" value="|.$form->quote($form->{$form->{vc}}).qq|" size="35">
429 <td><input name="$form->{vc}number" value="$form->{"$form->{vc}number"}" size="35"></td>
438 .$form->select_option($form->{selectdepartment}, $form->{department}, 1)
442 | if $form->{selectdepartment};
444 $form->{olddepartment} = $form->{department};
450 .$form->select_option($form->{selectwarehouse}, $form->{warehouse}, 1).qq|
454 | if $form->{selectwarehouse};
456 $form->{oldwarehouse} = $form->{warehouse};
458 $n = ($form->{creditremaining} < 0) ? "0" : "1";
461 if ($form->{business}) {
465 <td nowrap>$form->{business}
468 .$form->format_amount(\%myconfig, $form->{tradediscount} * 100).qq| %</td>
473 $employee = $form->hide_form(qw(employee));
479 .$form->select_option($form->{selectemployee}, $form->{employee}, 1)
483 | if $form->{selectemployee};
487 if (($rows = $form->numtextrows($form->{description}, 60, 5)) > 1) {
488 …$description = qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</…
490 …$description = qq|<input name="description" size="60" value="|.$form->quote($form->{description}).…
502 <td>|.$form->quote($form->{dcn}).qq|</td>
513 if ($form->{pricegroup}) {
517 <td>$form->{pricegroup}</td>
522 if ($form->{generate}) {
534 …<td>$form->{address1} $form->{address2} $form->{zipcode} $form->{city} $form->{state} $form->{coun…
544 … <td>|.$form->format_amount(\%myconfig, $form->{creditlimit}, $form->{precision}, "0").qq|</td>
547 …<td class="plus$n">|.$form->format_amount(\%myconfig, $form->{creditremaining}, $form->{precision}…
554 if ($form->{formname} !~ /invoice/) {
555 $title = " / $title{$form->{formname}}";
559 for (qw(terms discountterms)) { $form->{$_} = "" if ! $form->{$_} }
561 $form->header;
568 <form method=post name="main" action="$form->{script}">
571 …$form->hide_form(qw(id type printed emailed queued title vc discount creditlimit creditremaining t…
573 $form->hide_form(map { "select$_" } ("$form->{vc}", "AR", "AR_paid", "AR_discount"));
574 …$form->hide_form(map { "select$_" } qw(formname currency partsgroup projectnumber department wareh…
575 $form->hide_form("$form->{vc}_id", "old$form->{vc}", "quonumber", "old$form->{vc}number");
578 for $formname (split / /, $form->{$_}) {
579 if ($form->{formname} ne $formname) {
580 if ($form->{"${formname}_$_"}) {
581 $form->hide_form("${formname}_$_");
592 …<input name="terms" class="inputright" size="3" value="$form->{terms}"> |.$locale->text('days').qq|
597 if ($form->{type} !~ /credit_/) {
599 if ($form->{"selectAR_discount"}) {
604 …name="cashdiscount" class="inputright" size="3" value="|.$form->format_amount(\%myconfig, $form->{…
605 …<input name="discountterms" class="inputright" size="3" value="$form->{discountterms}"> |.$locale-…
606 …<input name="terms" class="inputright" size="3" value="$form->{terms}"> |.$locale->text('days').qq|
616 <th class=listtop>$form->{helpref}$form->{title}$title</a></th>
632 .$form->select_option($form->{selectAR}, $form->{AR})
640 <td><input name="shippingpoint" size="35" value="|.$form->quote($form->{shippingpoint}).qq|"></td>
644 <td><input name="shipvia" size="35" value="|.$form->quote($form->{shipvia}).qq|"></td>
648 <td><input name="waybill" size="35" value="|.$form->quote($form->{waybill}).qq|"></td>
659 <td><input name="ordnumber" size="20" value="|.$form->quote($form->{ordnumber}).qq|"></td>
663 …="transdate" size="11" class="date" title="$myconfig{dateformat}" value="$form->{transdate}" />|.&…
667 …me="duedate" size="11" class="date" title="$myconfig{dateformat}" value="$form->{duedate}">|.&js_c…
672 <td><input name="ponumber" size="20" value="|.$form->quote($form->{ponumber}).qq|"></td>
695 …$form->hide_form(map { "shipto$_" } qw(name address1 address2 city state zipcode country contact p…
696 …$form->hide_form(qw(address1 address2 city state zipcode country message email subject cc bcc taxa…
698 …foreach $accno (split / /, $form->{taxaccounts}) { $form->hide_form(map { "${accno}_$_" } qw(rate …
706 $form->{invtotal} = $form->{invsubtotal};
708 if ($form->{invsubtotal}) {
709 …$margin = $form->round_amount((($form->{invsubtotal} - $form->{costsubtotal}) / $form->{invsubtota…
712 if (($rows = $form->numtextrows($form->{notes}, 35, 8)) < 2) {
715 if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
719 $notes = qq|<textarea name=notes rows=$rows cols=35 wrap=soft>$form->{notes}</textarea>|;
720 $intnotes = qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
722 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
725 if ($form->{taxaccounts}) {
729 …ght><input name="taxincluded" class="checkbox" type="checkbox" value="1" $form->{taxincluded} onCh…
735 $form->hide_form("cd_available");
737 for (split / /, $form->{taxaccounts}) {
739 if (!$form->{taxincluded}) {
741 if ($form->{"${_}_base"}) {
743 …$form->{"${_}_total"} = $form->round_amount($form->{"${_}_base"} * $form->{"${_}_rate"}, $form->{p…
745 if ($form->{discount_paid} && $form->{cdt}) {
746 $cdtp = $form->{discount_paid} / $form->{invsubtotal} if $form->{invsubtotal};
747 $form->{"${_}_total"} -= $form->round_amount($form->{"${_}_total"} * $cdtp, $form->{precision});
750 $form->{invtotal} += $form->{"${_}_total"};
754 <th align=right>$form->{"${_}_description"}</th>
755 …<td align=right>|.$form->format_amount(\%myconfig, $form->{"${_}_total"}, $form->{precision}, 0).q…
766 …<td align=right>|.$form->format_amount(\%myconfig, $form->{invsubtotal}, $form->{precision}, 0).qq…
770 if ($form->{discount_paid}) {
774 …<td align=right>|.$form->format_amount(\%myconfig, $form->{discount_paid} * -1, $form->{precision}…
779 $form->{invtotal} -= $form->{discount_paid};
781 if ($form->{currency} eq $form->{defaultcurrency}) {
786 push @column_index, "paymentmethod" if $form->{selectpaymentmethod};
789 $form->{oldinvtotal} = $form->{invtotal};
790 $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, $form->{precision}, 0);
801 if ($form->{cashdiscount}) {
805 .$form->format_amount(\%myconfig, $form->{cd_available}, $form->{precision}, 0).qq|</td>
825 if ($form->{currency} ne $form->{defaultcurrency}) {
826 … $form->{discount_exchangerate} = $form->format_amount(\%myconfig, $form->{discount_exchangerate});
827 …count_exchangerate" class="inputright" size="10" value="$form->{discount_exchangerate}">|.$form->h…
830 …paid" class="inputright" size="11" value="|.$form->format_amount(\%myconfig, $form->{"discount_pai…
831 … align=center><select name="AR_discount_paid">|.$form->select_option($form->{"selectAR_discount"},…
832 …ter nowrap><input name="discount_datepaid" size="11" class="date" value="$form->{"discount_datepai…
834 …|<td align=center><input name="discount_source" size="11" value="|.$form->quote($form->{"discount_…
835 …qq|<td align=center><input name="discount_memo" size="11" value="|.$form->quote($form->{"discount_…
837 if ($form->{selectpaymentmethod}) {
838 …center><select name="discount_paymentmethod">|.$form->select_option($form->{"selectpaymentmethod"}…
850 .$form->hide_form(map { "discount_$_" } qw(vr_id cleared));
903 <td align=right>$form->{invtotal}</td>
916 $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
917 $form->{"AR_paid_$form->{paidaccounts}"} = $form->unescape($form->{payment_accno});
918 $form->{"paymentmethod_$form->{paidaccounts}"} = $form->unescape($form->{payment_method});
921 if ($form->{roundchange}) {
922 %roundchange = split /[=;]/, $form->unescape($form->{roundchange});
928 for $i (1 .. $form->{paidaccounts}) {
934 $totalpaid += $form->{"paid_$i"};
936 $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, $form->{precision});
937 $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
940 if ($form->{currency} ne $form->{defaultcurrency}) {
941 …ame="exchangerate_$i" class="inputright" size="10" value="$form->{"exchangerate_$i"}">|.$form->hid…
944 $form->hide_form(map { "${_}_$i" } qw(cleared vr_id));
946 …d align=center><input name="paid_$i" class="inputright" size="11" value="$form->{"paid_$i"}"></td>…
948 … = qq|<td align=center><select name="AR_paid_$i">|.$form->select_option($form->{selectAR_paid}, $f…
949 …datepaid_$i" size="11" class="date" title="$myconfig{dateformat}" value="$form->{"datepaid_$i"}">|…
950 …} = qq|<td align=center><input name="source_$i" size="11" value="|.$form->quote($form->{"source_$i…
951 …mo} = qq|<td align=center><input name="memo_$i" size="11" value="|.$form->quote($form->{"memo_$i"}…
953 if ($form->{selectpaymentmethod}) {
955 if ($form->{"paymentmethod_$i"}) {
956 if ($form->{"paid_$i"}) {
957 $roundto = $roundchange{$form->{"paymentmethod_$i"}};
961 …align=center><select name="paymentmethod_$i">|.$form->select_option($form->{"selectpaymentmethod"}…
969 $totalpaid = $form->round_amount($totalpaid, $form->{precision});
972 $roundto = $roundchange{$form->{"paymentmethod_$form->{paidaccounts}"}};
976 $outstanding = $form->round_amount($form->{oldinvtotal} / $roundto, 0) * $roundto;
978 $outstanding = $form->round_amount($outstanding / $roundto, 0) * $roundto;
980 $outstanding = $form->round_amount($form->{oldinvtotal} - $totalpaid, $form->{precision});
987 …span=7><b>|.$locale->text('Outstanding').":</b> ".$form->format_amount(\%myconfig, $outstanding, $
991 …span=7><b>|.$locale->text('Overpaid').":</b> ".$form->format_amount(\%myconfig, $outstanding * -1,…
995 …q| <b>|.$locale->text('Total Cost').":</b> ".$form->format_amount(\%myconfig, $form->{costsubtotal…
996 …print " <b>".$locale->text('Margin').":</b> ".$form->format_amount(\%myconfig, $margin, 1).qq|</b>…
1002 $form->{oldtotalpaid} = $totalpaid;
1003 …$form->hide_form(qw(paidaccounts oldinvtotal oldtotalpaid payment_accno payment_method roundchange…
1016 &print_options if ! $form->{generate};
1026 $transdate = $form->datetonum(\%myconfig, $form->{transdate});
1028 if ($form->{readonly}) {
1034 if ($form->{generate}) {
1058 if ($form->{id}) {
1062 if ($form->{locked} || $transdate <= $form->{closedto}) {
1072 if ($transdate > $form->{closedto}) {
1080 $ab{'Generate Invoices'} = 1 if $form->{generate};
1086 $form->print_button(\%button);
1090 if ($form->{menubar}) {
1091 require "$form->{path}/menu.pl";
1095 $form->hide_form(qw(helpref generate rowcount readonly callback path login));
1109 if ($form->{warehouse} ne $form->{oldwarehouse}) {
1110 $form->get_onhand(\%myconfig);
1111 for (1 .. $form->{rowcount}) {
1112 $form->{"onhand_$_"} = $form->format_amount(\%myconfig, $form->{"onhand_$_"}, undef, " ");
1116 …r (qw(exchangerate cashdiscount discount_paid)) { $form->{$_} = $form->parse_amount(\%myconfig, $f…
1118 &rebuild_departments if $form->{department} ne $form->{olddepartment};
1121 &rebuild_vc(customer, AR, $form->{transdate});
1123 if ($form->{oldterms} != $form->{terms}) {
1124 $form->{duedate} = $form->add_date(\%myconfig, $form->{transdate}, $form->{terms}, 'days');
1126 $form->{oldterms} = $form->{terms};
1127 $form->{oldduedate} = $form->{duedate};
1130 if ($form->{duedate} ne $form->{oldduedate}) {
1131 $form->{terms} = $form->datediff(\%myconfig, $form->{transdate}, $form->{duedate});
1133 $form->{oldterms} = $form->{terms};
1134 $form->{oldduedate} = $form->{duedate};
1137 if ($form->{transdate} ne $form->{oldtransdate}) {
1138 …$form->{duedate} = $form->add_date(\%myconfig, $form->{transdate}, $form->{terms}, 'days') if ! $n…
1139 $form->{oldtransdate} = $form->{transdate};
1140 &rebuild_vc(customer, AR, $form->{transdate}) if ! $newname;
1142 …$form->{exchangerate} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate…
1143 $form->{oldcurrency} = $form->{currency};
1145 if (@{ $form->{all_employee} }) {
1146 $form->{selectemployee} = "\n";
1147 for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|$_->{name}--$_->{id}\n| }
1148 $form->{selectemployee} = $form->escape($form->{selectemployee},1);
1152 …$form->{exchangerate} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate…
1153 $form->{oldcurrency} = $form->{currency};
1155 $form->{discount_exchangerate} = "";
1157 if ($form->{discount_paid}) {
1158 …if ($form->{discount_datepaid} ne $form->{olddiscount_datepaid} || $form->{currency} ne $form->{ol…
1159 …if ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{discount_date…
1160 $form->{discount_exchangerate} = $exchangerate;
1164 $expired = $form->add_date(\%myconfig, $form->{transdate}, $form->{discountterms}, 'days');
1165 …if ($form->datetonum(\%myconfig, $form->{discount_datepaid}) > $form->datetonum(\%myconfig, $expir…
1166 $form->{discount_datepaid} = $expired;
1168 $form->{olddiscount_datepaid} = $form->{discount_datepaid};
1171 $totalpaid = $form->{discount_paid};
1173 $form->{payment_accno} = $form->escape($form->{"AR_paid_$form->{paidaccounts}"},1);
1174 $form->{payment_method} = $form->escape($form->{"paymentmethod_$form->{paidaccounts}"},1);
1177 for $i (1 .. $form->{paidaccounts}) {
1178 if ($form->{"paid_$i"}) {
1179 …ddatepaid datepaid source memo cleared vr_id paymentmethod)) { $form->{"${_}_$j"} = $form->{"${_}_…
1180 …for (qw(paid exchangerate)) { $form->{"${_}_$j"} = $form->parse_amount(\%myconfig, $form->{"${_}_$…
1182 …if ($form->{"datepaid_$j"} ne $form->{"olddatepaid_$j"} || $form->{currency} ne $form->{oldcurrenc…
1183 …if ($exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$j"…
1184 $form->{"exchangerate_$j"} = $exchangerate;
1188 $form->{"olddatepaid_$j"} = $form->{"datepaid_$j"};
1191 … datepaid source memo cleared paid exchangerate vr_id paymentmethod)) { delete $form->{"${_}_$i"} }
1194 … datepaid source memo cleared paid exchangerate vr_id paymentmethod)) { delete $form->{"${_}_$i"} }
1198 $form->{paidaccounts} = $j;
1200 $i = $form->{rowcount};
1201 $form->{exchangerate} ||= 1;
1204 …if (($form->{"partnumber_$i"} eq "") && ($form->{"description_$i"} eq "") && ($form->{"partsgroup_…
1210 IS->retrieve_item(\%myconfig, \%$form);
1212 $rows = scalar @{ $form->{item_list} };
1214 if ($form->{language_code} && $rows == 0) {
1215 $language_code = $form->{language_code};
1216 $form->{language_code} = "";
1218 IS->retrieve_item(\%myconfig, \%$form);
1220 $form->{language_code} = $language_code;
1221 $rows = scalar @{ $form->{item_list} };
1224 if ($form->{rebuildpartsgroup}) {
1226 $form->{lookup} = "";
1227 for (@{ $form->{all_partsgroup} }) {
1229 $form->{lookup} .= "\n$_->{partsgroup}--$_->{translation}--$_->{image}";
1243 $form->{"qty_$i"} = ($form->{"qty_$i"} * 1) ? $form->{"qty_$i"} : 1;
1245 $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
1247 …for (qw(partnumber description unit)) { $form->{item_list}[$i]{$_} = $form->quote($form->{item_lis…
1249 for (keys %{ $form->{item_list}[0] }) {
1250 $form->{"${_}_$i"} = $form->{item_list}[0]{$_};
1253 if ($form->{"checkinventory_$i"} && $form->{"qty_$i"}) {
1254 if ($form->{type} eq 'invoice' || $form->{type} eq 'pos_invoice') {
1255 if ($form->{"inventory_accno_id_$i"} || $form->{"assembly_$i"}) {
1256 $form->error($locale->text('Not enough inventory!')) if $form->{"onhand_$i"} <= 0;
1261 $form->{"discount_$i"} ||= $form->{discount} * 100;
1264 $form->{"sellprice_$i"} = $sellprice;
1266 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1268 $decimalplaces1 = ($dec > $form->{precision}) ? $dec : $form->{precision};
1270 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1272 $decimalplaces1 = ($dec > $form->{precision}) ? $dec : $form->{precision};
1274 $form->{"sellprice_$i"} /= $form->{exchangerate};
1277 ($dec) = ($form->{"lastcost_$i"} =~ /\.(\d+)/);
1279 $decimalplaces2 = ($dec > $form->{precision}) ? $dec : $form->{precision};
1282 for (qw(listprice lastcost)) { $form->{"${_}_$i"} /= $form->{exchangerate} }
1283 $form->{"sell_$i"} = $form->{"sellprice_$i"};
1285 $sellprice = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100);
1286 $amount = $sellprice * $form->{"qty_$i"};
1287 for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 }
1288 for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
1289 if (!$form->{taxincluded}) {
1290 …for (split / /, $form->{"taxaccounts_$i"}) { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate…
1293 $ml = ($form->{type} eq 'invoice') ? 1 : -1;
1294 $ml = 1 if $form->{till};
1295 $form->{creditremaining} -= ($amount * $ml);
1297 …for (qw(sell sellprice listprice)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->…
1298 $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces2);
1299 $form->{"cost_$i"} = $form->{"lastcost_$i"};
1301 for (qw(netweight grossweight)) { $form->{"${_}_$i"} = $form->{"weight_$i"} * $form->{"qty_$i"} }
1303 …or (qw(qty discount netweight grossweight)) { $form->{"${_}_$i"} = $form->format_amount(\%myconfi…
1304 $form->{"onhand_$i"} = $form->format_amount(\%myconfig, $form->{"onhand_$i"}, undef, " ");
1306 for (qw(partnumber description unit)) { $form->{"${_}_$i"} = $form->quote($form->{"${_}_$i"}) }
1317 if ($form->{rebuildpartsgroup}) {
1318 $focus = "partnumber_$form->{rowcount}";
1319 $form->{rowcount}--;
1325 …if (($form->{"partsgroup_$i"} || $form->{"partsgroupcode_$i"}) && ($form->{"partsnumber_$i"} eq ""…
1326 $form->{rowcount}--;
1330 $form->{"id_$i"} = 0;
1331 $form->{"unit_$i"} = $locale->text('ea');
1344 $form->isblank("transdate", $locale->text('Invoice Date missing!'));
1345 $form->isblank("customer", $locale->text('Customer missing!'));
1355 $transdate = $form->datetonum(\%myconfig, $form->{transdate});
1357 …$form->error($locale->text('Cannot post invoice for a closed period!')) if ($transdate <= $form->{…
1359 …$form->isblank("exchangerate", $locale->text('Exchange rate missing!')) if ($form->{currency} ne $
1363 if ($form->{roundchange}) {
1364 %roundchange = split /[=;]/, $form->unescape($form->{roundchange});
1369 for $i (1 .. $form->{paidaccounts}) {
1370 if ($form->{"paid_$i"}) {
1371 $paid += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
1373 $datepaid = $form->datetonum(\%myconfig, $form->{"datepaid_$i"});
1375 $form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
1377 …$form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $form->{c…
1379 if ($form->{currency} ne $form->{defaultcurrency}) {
1380 $form->isblank("exchangerate_$i", $locale->text('Exchange rate for payment missing!'));
1383 if ($form->{selectpaymentmethod}) {
1384 $roundto = $roundchange{$form->{"paymentmethod_$i"}};
1389 $AR_paid = $form->{"AR_paid_$form->{paidaccounts}"};
1390 $paymentmethod = $form->{"paymentmethod_$form->{paidaccounts}"};
1392 $form->{label} = $locale->text('Invoice');
1394 if (! $form->{repost}) {
1395 if ($form->{id}) {
1403 if ($form->{discount_paid}) {
1404 $form->{paidaccounts}++ if $form->{"paid_$form->{paidaccounts}"};
1405 $i = $form->{paidaccounts};
1407 …epaid source memo exchangerate cleared vr_id paymentmethod)) { $form->{"${_}_$i"} = $form->{"disco…
1408 $form->{discount_index} = $i;
1409 $form->{"AR_paid_$i"} = $form->{"AR_discount_paid"};
1410 $form->{"paymentmethod_$i"} = $form->{discount_paymentmethod};
1412 if ($form->{"paid_$i"}) {
1413 $paid += $form->parse_amount(\%myconfig, $form->{"paid_$i"});
1415 $datepaid = $form->datetonum(\%myconfig, $form->{"datepaid_$i"});
1416 …$expired = $form->datetonum(\%myconfig, $form->add_date(\%myconfig, $form->{transdate}, $form->{di…
1418 $form->isblank("datepaid_$i", $locale->text('Cash discount date missing!'));
1420 …$form->error($locale->text('Cannot post cash discount for a closed period!')) if ($datepaid <= $fo…
1422 $form->error($locale->text('Cash discount date past due!')) if ($datepaid > $expired);
1424 if ($form->{currency} ne $form->{defaultcurrency}) {
1425 $form->isblank("exchangerate_$i", $locale->text('Exchange rate for cash discount missing!'));
1431 $total = $form->round_amount($form->{oldinvtotal} / $roundto, 0) * $roundto;
1432 …$cashover = $form->round_amount($paid - $total - ($paid - $form->{oldinvtotal}), $form->{precision…
1435 …if ($form->round_amount($paid, $form->{precision}) == $form->round_amount($total, $form->{precisio…
1436 $i = ++$form->{paidaccounts};
1437 $form->{"paid_$i"} = $form->format_amount(\%myconfig, $cashover, $form->{precision});
1438 $form->{"datepaid_$i"} = $datepaid;
1439 $form->{"AR_paid_$i"} = $form->{cashovershort};
1444 $i = ++$form->{paidaccounts};
1445 $form->{"AR_paid_$i"} = $AR_paid;
1446 $form->{"paymentmethod_$i"} = $paymentmethod;
1449 $form->{$_} =~ s/\s??$form->{formname}\s??//;
1450 if ($form->{"$form->{formname}_$_"}) {
1451 $form->{$_} .= " $form->{formname}";
1453 $form->{$_} =~ s/^ //;
1456 $form->{userspath} = $userspath;
1458 if (IS->post_invoice(\%myconfig, \%$form)) {
1459 $form->redirect($locale->text('Invoice')." $form->{invnumber} ".$locale->text('posted!'));
1461 $form->error($locale->text('Cannot post invoice!'));
1469 $form->error($locale->text('Select postscript or PDF!')) if $form->{format} !~ /(ps|pdf)/;
1470 $form->error($locale->text('Select a Printer!')) if $form->{media} eq 'screen';
1472 if (! $form->{repost}) {
1473 if ($form->{id}) {
1474 $form->{print_and_post} = 1;
1481 $form->{display_form} = "post";
1482 for (keys %$form) { $oldform->{$_} = $form->{$_} }
1492 $form->header;
1497 <form method=post action=$form->{script}>
1500 $form->{action} = "yes";
1501 $form->hide_form;
1506 <h4>|.$locale->text('Are you sure you want to delete Invoice Number').qq| $form->{invnumber}
1520 if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
1521 $form->redirect($locale->text('Invoice deleted!'));
1523 $form->error($locale->text('Cannot delete invoice!'));
1531 if ($form->{beenhere}) {
1538 $form->{reportcode} = "generate_sales_invoices";
1540 AA->vc_links(\%myconfig, \%$form);
1542 for (qw(name city startdate)) { $form->{"l_$_"} = "checked" }
1558 …ml => qq|<input name="l_name" class="checkbox" type="checkbox" value="Y" $form->{l_name}>|, label …
1559 …> qq|<input name="l_vcnumber" class="checkbox" type="checkbox" value="Y" $form->{l_vcnumber}>|, la…
1560 …ml => qq|<input name="l_city" class="checkbox" type="checkbox" value="Y" $form->{l_city}>|, label …
1561 …l => qq|<input name="l_state" class="checkbox" type="checkbox" value="Y" $form->{l_state}>|, label…
1562 …=> qq|<input name="l_zipcode" class="checkbox" type="checkbox" value="Y" $form->{l_zipcode}>|, lab…
1563 …=> qq|<input name="l_country" class="checkbox" type="checkbox" value="Y" $form->{l_country}>|, lab…
1564 … qq|<input name="l_startdate" class="checkbox" type="checkbox" value="Y" $form->{l_startdate}>|, l…
1565 …=> qq|<input name="l_enddate" class="checkbox" type="checkbox" value="Y" $form->{l_enddate}>|, lab…
1567 if (@{ $form->{all_report} }) {
1568 $form->{selectreportform} = "\n";
1569 …for (@{ $form->{all_report} }) { $form->{selectreportform} .= qq|$_->{reportdescription}--$_->{rep…
1575 …<select name=report onChange="ChangeReport();">|.$form->select_option($form->{selectreportform}, u…
1582 if (@{ $form->{all_pricegroup} }) {
1585 …qq|<input name="l_pricegroup" class="checkbox" type="checkbox" value="Y" $form->{l_pricegroup}>|, …
1588 for (@{ $form->{all_pricegroup} }) { $selectpricegroup .= qq|$_->{pricegroup}--$_->{id}\n| }
1594 .$form->select_option($selectpricegroup, undef, 1)
1599 if (@{ $form->{all_business} }) {
1602 …> qq|<input name="l_business" class="checkbox" type="checkbox" value="Y" $form->{l_business}>|, la…
1605 for (@{ $form->{all_business} }) { $selectbusiness .= qq|$_->{description}--$_->{id}\n| }
1611 .$form->select_option($selectbusiness, undef, 1)
1616 if ($form->{selectpaymentmethod}) {
1619 …<input name="l_paymentmethod" class="checkbox" type="checkbox" value="Y" $form->{l_paymentmethod}>…
1625 .$form->select_option($form->{selectpaymentmethod}, $form->{paymentmethod_1}, 1)
1630 if ($form->{selectcurrency}) {
1633 …ml => qq|<input name="l_curr" class="checkbox" type="checkbox" value="Y" $form->{l_curr}>|, label …
1635 $selectcurrency = "\n$form->{selectcurrency}";
1640 .$form->select_option($selectcurrency, $form->{currency}, 1)
1647 if ($form->{selectemployee}) {
1650 …> qq|<input name="l_employee" class="checkbox" type="checkbox" value="Y" $form->{l_employee}>|, la…
1656 .$form->select_option($form->{selectemployee}, $form->{employee}, 1)
1664 $form->{flds} = "";
1667 $form->{flds} .= "$_=$includeinreport{$_}->{label},";
1673 chop $form->{flds};
1676 $form->header;
1680 for (qw(name vcnumber city state zipcode country employee)) { delete $form->{$_} }
1681 …nguage partsgroup paymentmethod projectnumber warehouse reportform)) { delete $form->{"select$_"} }
1682 for (qw(business pricegroup)) { delete $form->{"all_$_"} }
1684 &change_report(\%$form, \@input, \@checked, \%radio);
1686 for (qw(report reportvars)) { delete $form->{"all_$_"} }
1687 for (@checked) { delete $form->{$_} }
1688 for (@input) { delete $form->{$_} }
1689 for (keys %radio) { delete $form->{$_} }
1694 <form method=post name="main" action=$form->{script}>
1698 <th class=listtop>$form->{helpref}$form->{title}</a></th>
1779 $form->{sort} ||= "name";
1780 $form->{direction} ||= "ASC";
1781 $form->{action} = "list_names";
1782 $form->{nextsub} = "list_names";
1784 $form->hide_form;
1786 if ($form->{menubar}) {
1787 require "$form->{path}/menu.pl";
1803 $form->{vc} = "customer";
1805 AA->all_names(\%myconfig, \%$form);
1808 for (split /,/, $form->{flds}) {
1817 if ($form->{column_index}) {
1818 for (split /,/, $form->{column_index}) {
1821 delete $form->{"l_$_"}
1825 if ($form->{"l_$_"} eq "Y") {
1827 $form->{column_index} .= "$_=,";
1829 delete $form->{"l_$_"};
1832 chop $form->{column_index};
1837 $href = "$form->{script}?action=list_names";
1838 for (qw(direction oldsort path login id)) { $href .= qq|&$_=$form->{$_}| }
1839 for (qw(id direction oldsort)) { delete $form->{$_} }
1841 @column_index = $form->sort_columns(@column_index);
1849 $form->header;
1856 <form method=post action=$form->{script}>
1860 <th class=listtop>$form->{helpref}$form->{title}</a></th>
1877 for $ref (@{ $form->{all_vc} }) {
1908 $form->{lastndx} = $i;
1910 map { delete $form->{"all_$_"} } qw(business pricegroup vc);
1916 if (!$form->{admin}) {
1917 delete $button{'Save Report'} unless $form->{savereport};
1920 $form->{beenhere} = 1;
1922 delete $form->{savereport};
1924 $form->hide_form;
1926 $form->print_button(\%button);
1941 for (keys %$form) { $myform->{$_} = $form->{$_} }
1943 $form->info($locale->text('Generating Invoices')."\n");
1948 for (1 .. $form->{lastndx}) {
1950 if ($form->{"ndx_$_"}) {
1952 $myform->{"$form->{vc}_id"} = $form->{"ndx_$_"};
1956 $form->{precision} = $myform->{precision};
1957 $form->info("$i. $myform->{$form->{vc}} $myform->{city} $myform->{invnumber}, ");
1958 $form->info($form->format_amount(\%myconfig, $myform->{invamount}, $myform->{precision}));
1959 $form->info(" ... ");
1964 $form->info($locale->text('ok'));
1966 $form->info($locale->text('failed!'));
1968 $form->info("\n");
1971 for (keys %$form) { $myform->{$_} = $form->{$_} }
1976 $form->info("<p>".$locale->text('Total:'));
1977 $form->info($form->format_amount(\%myconfig, $total, $form->{precision}, "0"));
1984 $form->{sort} ||= "transdate";
1986 IS->consolidate(\%myconfig, \%$form);
1988 $form->{title} = $locale->text('Consolidate');
1991 $form->{type} eq 'invoice';
1996 $href = "$form->{script}?action=consolidate";
1997 for (qw(type path direction oldsort login)) { $href .= "&$_=$form->{$_}" }
1999 $form->sort_order();
2002 @column_index = $form->sort_columns(@column_index);
2013 $form->helpref("consolidate", $myconfig{countrycode});
2015 $title = "$form->{title} / $form->{company}";
2017 $form->{callback} = "$form->{script}?action=consolidate";
2018 for (qw(direction sort oldsort type path login)) { $form->{callback} .= qq|&$_=$form->{$_}| }
2021 $callback = $form->escape($form->{callback});
2023 $form->header;
2034 <th class=listtop>$form->{helpref}$title</a></th>
2043 …ing width=1%><input name="allbox" type=checkbox class=checkbox value="1" $form->{allbox} onChange=…
2051 for $curr (sort keys %{ $form->{all_transactions} }) {
2055 if ($form->{$curr} > 1) {
2057 for $accno (sort keys %{ $form->{all_transactions}{$curr} }) {
2058 for $name (sort keys %{ $form->{all_transactions}{$curr}{$accno} }) {
2059 if ($#{$form->{all_transactions}{$curr}{$accno}{$name}} > 0) {
2072 …<th colspan=$colspan align=left>$name / $form->{all_transactions}{$curr}{$accno}{$name}->[0]->{cit…
2076 for $ref (@{ $form->{all_transactions}{$curr}{$accno}{$name} }) {
2083 $form->{ids} .= "$ref->{id} ";
2086 …$column_data{amount} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{amount}, $ref-…
2088 …vnumber} = "<td><a href=$module?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&…
2093 …name} = qq|<td><a href=ct.pl?path=$form->{path}&login=$form->{login}&action=edit&id=$ref->{"$form-…
2110 chop $form->{ids};
2125 $form->hide_form(qw(ids callback path login));
2127 if ($form->{ids}) {
2128 $form->print_button(\%button);
2130 $form->info($locale->text('Nothing to consolidate!'));
2133 if ($form->{menubar}) {
2134 require "$form->{path}/menu.pl";
2152 for (split / /, $form->{ids}) {
2153 if ($form->{"ndx_$_"}) {
2158 $form->error($locale->text('Nothing selected!')) unless $found;
2160 delete $form->{callback};
2162 if (IS->consolidate_invoices(\%myconfig, \%$form, $spool)) {
2163 $form->redirect($locale->text('Invoices consolidated!'));
2165 $form->error($locale->text('Failed to consolidate invoices!'));