summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/shortcut.pm
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin/shortcut.pm')
0 files changed, 0 insertions, 0 deletions
hl"># This program is free software; you can redistribute it and/or modify
  • # it under the terms of the GNU General Public License as published by
  • # the Free Software Foundation; either version 2 of the License, or
  • # (at your option) any later version.
  • #
  • # This program is distributed in the hope that it will be useful,
  • # but WITHOUT ANY WARRANTY; without even the implied warranty of
  • # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • # GNU General Public License for more details.
  • # You should have received a copy of the GNU General Public License
  • # along with this program; if not, write to the Free Software
  • # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  • #=====================================================================
  • #
  • # POS
  • #
  • #=====================================================================
  • use Error qw(:try);
  • use LedgerSMB::Template;
  • use LedgerSMB::Tax;
  • 1;
  • # end
  • sub check_alert {
  • my $rc = $form->{'rowcount'};
  • if ( !$form->{"partnumber_$rc"} ) {
  • --$rc; # Ensures that alert shows up when item is selected from a list;
  • }
  • for ( 1 .. $rc ) {
  • $form->{'check_id'} = ( $form->{'check_id'} || $form->{"check_id_$_"} );
  • }
  • }
  • sub send_to_pd {
  • socket( SOCK, 2, 1, getprotobynumber( $pos_config{'pd_proto'} ) );
  • connect( SOCK, $pos_config{'pd_dest'} );
  • my $rn = $numrows - 1;
  • my $ds_string = sprintf(
  • '%s%s @ $%-7.2f%s%s%s',
  • $pd_control{'new_line'},
  • $form->{"qty_$rn"},
  • $form->{"sellprice_$rn"},
  • $pd_control{'new_line'},
  • "Subtotal: \$" . sprintf( '%-7.2f', $form->{'invtotal'} )
  • );
  • print SOCK $ds_string;
  • close SOCK;
  • }
  • sub on_update {
  • &send_to_pd;
  • &check_alert;
  • }
  • sub open_drawer {
  • open( PRINTER, "|-", ${LedgerSMB::Sysconfig::printer}{Printer} );
  • print PRINTER $pos_config{'rp_cash_open'};
  • close PRINTER;
  • sleep 1;
  • }
  • sub open {
  • &open_drawer;
  • &update;
  • }
  • sub add {
  • $form->{nextsub} = 'add';
  • $form->{title} = $locale->text('Add POS Invoice');